/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@shinyoshiaki/skyway-nodejs-sdk@1.15.6/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var import_node_process,import_node_os,import_node_tty,env,flagForceColor,supportsColor,supports_color_default,__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__esm=(e,t)=>function(){return e&&(t=(0,e[__getOwnPropNames(e)[0]])(e=0)),t},__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var i in t)__defProp(e,i,{get:t[i],enumerable:!0})},__copyProps=(e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===i||__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__reExport=(e,t,i)=>(__copyProps(e,t,"default"),i&&__copyProps(i,t,"default")),__toESM=(e,t,i)=>(i=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?i:__defProp(i,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__publicField=(e,t,i)=>__defNormalProp(e,"symbol"!=typeof t?t+"":t,i),require_logger=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/logger.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=e.logLevelTypes=void 0,e.logLevelTypes=["disable","error","warn","info","debug"];var t=class t{constructor(e){this.debug=(...e)=>(this._log("debug",...e),Date.now()),this.info=(...e)=>(this._log("info",...e),Date.now()),this.warn=(...e)=>{this._log("warn",...e)},this.error=(...e)=>{this._log("error",...e)},this.elapsed=(e,...t)=>{const i=Date.now()-e;this._log("info",`elapsed ms:${i}`,...t)},this.prefix=e}_log(i,...r){const s=e.logLevelTypes.indexOf(i);if(e.logLevelTypes.indexOf(t.level)>=s){const e=new Date,s=t.formatter.formatToParts(e),n=e=>{var t;return null===(t=s.find((t=>t.type===e)))||void 0===t?void 0:t.value},a=String(e.getMilliseconds()).padStart(3,"0"),o=`${n("year")}-${n("month")}-${n("day")}T${n("hour")}:${n("minute")}:${n("second")}.${a}+09:00`;r=[this.prefix,...r].map((e=>{if(e instanceof Error)return e.toJSON?e.toJSON():{name:e.name,message:e.message,stack:e.stack};if("object"==typeof e)try{return JSON.parse(JSON.stringify(e))}catch(e){return"json error"}return e}));let c=[o,i,...r];switch("string"===t.format&&(c=[o+" "+i+" "+JSON.stringify(r)]),i){case"debug":console.debug(...c);break;case"info":console.info(...c);break;case"warn":console.warn(...c);break;case"error":console.error(...c)}t.onLog({id:t.id,timestamp:o,level:i,message:r}),t._onLogForAnalytics({id:t.id,timestamp:o,level:i,message:r,prefix:this.prefix})}}createBlock(e){return{warn:(...t)=>{this.warn(Object.assign({},e),...t)},debug:(...t)=>{this.debug(Object.assign({},e),...t)},info:(...t)=>{this.info(Object.assign({},e),...t)},error:(...t)=>{this.error(Object.assign({},e),...t)}}}};e.Logger=t,t.level="error",t.format="object",t.onLog=()=>{},t._onLogForAnalytics=()=>{},t.id=Math.random().toString().slice(2,7),t.formatter=new Intl.DateTimeFormat("ja-JP",{timeZone:"Asia/Tokyo",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}}),require_error=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/error.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SkyWayError=void 0;var t=new(require_logger().Logger)("packages/common/src/error.ts"),i=class extends Error{constructor(e,i=!0){if(super(e.info.detail),this.id=Math.random().toString().slice(2,10),Object.assign(this,e),this.name=this.info.name,i){const e=["SkyWayError",`name:${this.info.name}, detail:${this.info.detail}, solution:${this.info.solution}`];this.path&&e.push(this.path),this.error&&e.push(this.error),this.payload&&e.push(this.payload),e.push(this.id),t.warn(...e)}}toJSON(){return{id:this.id,info:this.info,path:this.path,payload:this.payload,error:this.error,stack:this.stack}}};e.SkyWayError=i}}),require_event=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/event.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EventDisposer=e.Events=e.Event=void 0;var t=new(require_logger().Logger)("packages/common/src/event.ts"),i=class{constructor(e=()=>{}){this._onSetListener=e,this._stack=[],this._eventIndex=0,this.emit=e=>{for(const i of this._stack)try{i.execute(e)}catch(e){t.error("task throws error",e)}},this.removeAllListeners=()=>{this._stack=[]},this.pipe=e=>this.add((t=>e.emit(t))),this.add=e=>{const t=this._eventIndex;this._stack.push({execute:e,id:t}),this._eventIndex++;const i=()=>{this._stack=this._stack.filter((e=>e.id!==t&&e))};return this._onSetListener(),{removeListener:i,disposer:e=>{e.push(i)}}},this.once=e=>{const t=this.add((i=>{t.removeListener(),e(i)}));return t},this.asPromise=e=>new Promise(((t,i)=>{const s=e&&setTimeout((()=>{i(new r("Event asPromise timeout : "+e))}),e);this.once((e=>{s&&clearTimeout(s),t(e)}))})),this.watch=(e,t)=>new Promise(((i,s)=>{const n=t&&setTimeout((()=>{s(new r("Event watch timeout : "+t))}),t),{removeListener:a}=this.add((t=>{e(t)&&(n&&clearTimeout(n),a(),i(t))}))}))}get length(){return this._stack.length}};e.Event=i;e.Events=class{constructor(){this.events=[]}make(){const e=new i;return this.events.push(e),e}dispose(){this.events.forEach((e=>e.removeAllListeners())),this.events=[]}};e.EventDisposer=class{constructor(){this._disposer=[]}push(e){this._disposer.push(e)}dispose(){this._disposer.forEach((e=>e())),this._disposer=[]}};var r=class extends Error{toJSON(){return{name:this.name,message:this.message,stack:this.stack}}}}}),require_delayed_stream=__commonJS({"../../node_modules/.pnpm/delayed-stream@1.0.0/node_modules/delayed-stream/lib/delayed_stream.js"(e,t){var i=require("stream").Stream,r=require("util");function s(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}t.exports=s,r.inherits(s,i),s.create=function(e,t){var i=new this;for(var r in t=t||{})i[r]=t[r];i.source=e;var s=e.emit;return e.emit=function(){return i._handleEmit(arguments),s.apply(e,arguments)},e.on("error",(function(){})),i.pauseStream&&e.pause(),i},Object.defineProperty(s.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}}),s.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)},s.prototype.resume=function(){this._released||this.release(),this.source.resume()},s.prototype.pause=function(){this.source.pause()},s.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]},s.prototype.pipe=function(){var e=i.prototype.pipe.apply(this,arguments);return this.resume(),e},s.prototype._handleEmit=function(e){this._released?this.emit.apply(this,e):("data"===e[0]&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e))},s.prototype._checkIfMaxDataSizeExceeded=function(){if(!(this._maxDataSizeExceeded||this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}}}),require_combined_stream=__commonJS({"../../node_modules/.pnpm/combined-stream@1.0.8/node_modules/combined-stream/lib/combined_stream.js"(e,t){var i=require("util"),r=require("stream").Stream,s=require_delayed_stream();function n(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}t.exports=n,i.inherits(n,r),n.create=function(e){var t=new this;for(var i in e=e||{})t[i]=e[i];return t},n.isStreamLike=function(e){return"function"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Buffer.isBuffer(e)},n.prototype.append=function(e){if(n.isStreamLike(e)){if(!(e instanceof s)){var t=s.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=t}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this},n.prototype.pipe=function(e,t){return r.prototype.pipe.call(this,e,t),this.resume(),e},n.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop)this._pendingNext=!0;else{this._insideLoop=!0;try{do{this._pendingNext=!1,this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=!1}}},n.prototype._realGetNext=function(){var e=this._streams.shift();void 0!==e?"function"==typeof e?e(function(e){n.isStreamLike(e)&&(e.on("data",this._checkDataSize.bind(this)),this._handleErrors(e)),this._pipeNext(e)}.bind(this)):this._pipeNext(e):this.end()},n.prototype._pipeNext=function(e){if(this._currentStream=e,n.isStreamLike(e))return e.on("end",this._getNext.bind(this)),void e.pipe(this,{end:!1});var t=e;this.write(t),this._getNext()},n.prototype._handleErrors=function(e){var t=this;e.on("error",(function(e){t._emitError(e)}))},n.prototype.write=function(e){this.emit("data",e)},n.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.pause&&this._currentStream.pause(),this.emit("pause"))},n.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.resume&&this._currentStream.resume(),this.emit("resume")},n.prototype.end=function(){this._reset(),this.emit("end")},n.prototype.destroy=function(){this._reset(),this.emit("close")},n.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null},n.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}},n.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach((function(t){t.dataSize&&(e.dataSize+=t.dataSize)})),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)},n.prototype._emitError=function(e){this._reset(),this.emit("error",e)}}}),require_db=__commonJS({"../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json"(e,t){t.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}}}),require_mime_db=__commonJS({"../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js"(e,t){t.exports=require_db()}}),require_mime_types=__commonJS({"../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(e){"use strict";var t,i,r,s=require_mime_db(),n=require("path").extname,a=/^\s*([^;\s]*)(?:;|\s|$)/,o=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=a.exec(e),i=t&&s[t[1].toLowerCase()];return i&&i.charset?i.charset:!(!t||!o.test(t[1]))&&"UTF-8"}e.charset=c,e.charsets={lookup:c},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var r=e.charset(i);r&&(i+="; charset="+r.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=a.exec(t),r=i&&e.extensions[i[1].toLowerCase()];if(!r||!r.length)return!1;return r[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var i=n("x."+t).toLowerCase().substr(1);if(!i)return!1;return e.types[i]||!1},e.types=Object.create(null),t=e.extensions,i=e.types,r=["nginx","apache",void 0,"iana"],Object.keys(s).forEach((function(e){var n=s[e],a=n.extensions;if(a&&a.length){t[e]=a;for(var o=0;o<a.length;o++){var c=a[o];if(i[c]){var l=r.indexOf(s[i[c]].source),u=r.indexOf(n.source);if("application/octet-stream"!==i[c]&&(l>u||l===u&&"application/"===i[c].substr(0,12)))continue}i[c]=e}}}))}}),require_defer=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/defer.js"(e,t){t.exports=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)}}}),require_async=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/async.js"(e,t){var i=require_defer();t.exports=function(e){var t=!1;return i((function(){t=!0})),function(r,s){t?e(r,s):i((function(){e(r,s)}))}}}}),require_abort=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/abort.js"(e,t){function i(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}t.exports=function(e){Object.keys(e.jobs).forEach(i.bind(e)),e.jobs={}}}}),require_iterate=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/iterate.js"(e,t){var i=require_async(),r=require_abort();t.exports=function(e,t,s,n){var a=s.keyedList?s.keyedList[s.index]:s.index;s.jobs[a]=function(e,t,r,s){var n;n=2==e.length?e(r,i(s)):e(r,t,i(s));return n}(t,a,e[a],(function(e,t){a in s.jobs&&(delete s.jobs[a],e?r(s):s.results[a]=t,n(e,s.results))}))}}}),require_state=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/state.js"(e,t){t.exports=function(e,t){var i=!Array.isArray(e),r={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&r.keyedList.sort(i?t:function(i,r){return t(e[i],e[r])});return r}}}),require_terminator=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/terminator.js"(e,t){var i=require_abort(),r=require_async();t.exports=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,i(this),r(e)(null,this.results)}}}),require_parallel=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/parallel.js"(e,t){var i=require_iterate(),r=require_state(),s=require_terminator();t.exports=function(e,t,n){var a=r(e);for(;a.index<(a.keyedList||e).length;)i(e,t,a,(function(e,t){e?n(e,t):0!==Object.keys(a.jobs).length||n(null,a.results)})),a.index++;return s.bind(a,n)}}}),require_serialOrdered=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/serialOrdered.js"(e,t){var i=require_iterate(),r=require_state(),s=require_terminator();function n(e,t){return e<t?-1:e>t?1:0}t.exports=function(e,t,n,a){var o=r(e,n);return i(e,t,o,(function r(s,n){s?a(s,n):(o.index++,o.index<(o.keyedList||e).length?i(e,t,o,r):a(null,o.results))})),s.bind(o,a)},t.exports.ascending=n,t.exports.descending=function(e,t){return-1*n(e,t)}}}),require_serial=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/serial.js"(e,t){var i=require_serialOrdered();t.exports=function(e,t,r){return i(e,t,null,r)}}}),require_asynckit=__commonJS({"../../node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/index.js"(e,t){t.exports={parallel:require_parallel(),serial:require_serial(),serialOrdered:require_serialOrdered()}}}),require_es_object_atoms=__commonJS({"../../node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(e,t){"use strict";t.exports=Object}}),require_es_errors=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(e,t){"use strict";t.exports=Error}}),require_eval=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(e,t){"use strict";t.exports=EvalError}}),require_range=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(e,t){"use strict";t.exports=RangeError}}),require_ref=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(e,t){"use strict";t.exports=ReferenceError}}),require_syntax=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(e,t){"use strict";t.exports=SyntaxError}}),require_type=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(e,t){"use strict";t.exports=TypeError}}),require_uri=__commonJS({"../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(e,t){"use strict";t.exports=URIError}}),require_abs=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(e,t){"use strict";t.exports=Math.abs}}),require_floor=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(e,t){"use strict";t.exports=Math.floor}}),require_max=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(e,t){"use strict";t.exports=Math.max}}),require_min=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(e,t){"use strict";t.exports=Math.min}}),require_pow=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(e,t){"use strict";t.exports=Math.pow}}),require_round=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(e,t){"use strict";t.exports=Math.round}}),require_isNaN=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(e,t){"use strict";t.exports=Number.isNaN||function(e){return e!=e}}}),require_sign=__commonJS({"../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(e,t){"use strict";var i=require_isNaN();t.exports=function(e){return i(e)||0===e?e:e<0?-1:1}}}),require_gOPD=__commonJS({"../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(e,t){"use strict";t.exports=Object.getOwnPropertyDescriptor}}),require_gopd=__commonJS({"../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(e,t){"use strict";var i=require_gOPD();if(i)try{i([],"length")}catch(e){i=null}t.exports=i}}),require_es_define_property=__commonJS({"../../node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(e,t){"use strict";var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}t.exports=i}}),require_shams=__commonJS({"../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(e,t){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),i=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(var r in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var s=Object.getOwnPropertySymbols(e);if(1!==s.length||s[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}}}),require_has_symbols=__commonJS({"../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(e,t){"use strict";var i="undefined"!=typeof Symbol&&Symbol,r=require_shams();t.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&r())))}}}),require_Reflect_getPrototypeOf=__commonJS({"../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(e,t){"use strict";t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null}}),require_Object_getPrototypeOf=__commonJS({"../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(e,t){"use strict";var i=require_es_object_atoms();t.exports=i.getPrototypeOf||null}}),require_implementation=__commonJS({"../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(e,t){"use strict";var i=Object.prototype.toString,r=Math.max,s=function(e,t){for(var i=[],r=0;r<e.length;r+=1)i[r]=e[r];for(var s=0;s<t.length;s+=1)i[s+e.length]=t[s];return i};t.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==i.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n,a=function(e,t){for(var i=[],r=t||0,s=0;r<e.length;r+=1,s+=1)i[s]=e[r];return i}(arguments,1),o=r(0,t.length-a.length),c=[],l=0;l<o;l++)c[l]="$"+l;if(n=Function("binder","return function ("+function(e,t){for(var i="",r=0;r<e.length;r+=1)i+=e[r],r+1<e.length&&(i+=t);return i}(c,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var i=t.apply(this,s(a,arguments));return Object(i)===i?i:this}return t.apply(e,s(a,arguments))})),t.prototype){var u=function(){};u.prototype=t.prototype,n.prototype=new u,u.prototype=null}return n}}}),require_function_bind=__commonJS({"../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(e,t){"use strict";var i=require_implementation();t.exports=Function.prototype.bind||i}}),require_functionCall=__commonJS({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(e,t){"use strict";t.exports=Function.prototype.call}}),require_functionApply=__commonJS({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(e,t){"use strict";t.exports=Function.prototype.apply}}),require_reflectApply=__commonJS({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(e,t){"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply}}),require_actualApply=__commonJS({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(e,t){"use strict";var i=require_function_bind(),r=require_functionApply(),s=require_functionCall(),n=require_reflectApply();t.exports=n||i.call(s,r)}}),require_call_bind_apply_helpers=__commonJS({"../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(e,t){"use strict";var i=require_function_bind(),r=require_type(),s=require_functionCall(),n=require_actualApply();t.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new r("a function is required");return n(i,s,e)}}}),require_get=__commonJS({"../../node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(e,t){"use strict";var i,r=require_call_bind_apply_helpers(),s=require_gopd();try{i=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var n=!!i&&s&&s(Object.prototype,"__proto__"),a=Object,o=a.getPrototypeOf;t.exports=n&&"function"==typeof n.get?r([n.get]):"function"==typeof o&&function(e){return o(null==e?e:a(e))}}}),require_get_proto=__commonJS({"../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(e,t){"use strict";var i=require_Reflect_getPrototypeOf(),r=require_Object_getPrototypeOf(),s=require_get();t.exports=i?function(e){return i(e)}:r?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return r(e)}:s?function(e){return s(e)}:null}}),require_hasown=__commonJS({"../../node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(e,t){"use strict";var i=Function.prototype.call,r=Object.prototype.hasOwnProperty,s=require_function_bind();t.exports=s.call(i,r)}}),require_get_intrinsic=__commonJS({"../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(e,t){"use strict";var i,r,s=require_es_object_atoms(),n=require_es_errors(),a=require_eval(),o=require_range(),c=require_ref(),l=require_syntax(),u=require_type(),d=require_uri(),p=require_abs(),h=require_floor(),m=require_max(),f=require_min(),g=require_pow(),_=require_round(),y=require_sign(),b=Function,v=function(e){try{return b('"use strict"; return ('+e+").constructor;")()}catch(e){}},x=require_gopd(),S=require_es_define_property(),w=function(){throw new u},E=x?function(){try{return w}catch(e){try{return x(arguments,"callee").get}catch(e){return w}}}():w,C=require_has_symbols()(),A=require_get_proto(),T=require_Object_getPrototypeOf(),P=require_Reflect_getPrototypeOf(),I=require_functionApply(),k=require_functionCall(),R={},F="undefined"!=typeof Uint8Array&&A?A(Uint8Array):i,B={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":C&&A?A([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":R,"%AsyncGenerator%":R,"%AsyncGeneratorFunction%":R,"%AsyncIteratorPrototype%":R,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":a,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":b,"%GeneratorFunction%":R,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":C&&A?A(A([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&C&&A?A((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":s,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":o,"%ReferenceError%":c,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&C&&A?A((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":C&&A?A(""[Symbol.iterator]()):i,"%Symbol%":C?Symbol:i,"%SyntaxError%":l,"%ThrowTypeError%":E,"%TypedArray%":F,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":d,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":I,"%Object.defineProperty%":S,"%Object.getPrototypeOf%":T,"%Math.abs%":p,"%Math.floor%":h,"%Math.max%":m,"%Math.min%":f,"%Math.pow%":g,"%Math.round%":_,"%Math.sign%":y,"%Reflect.getPrototypeOf%":P};if(A)try{null.error}catch(e){r=A(A(e)),B["%Error.prototype%"]=r}var O=function e(t){var i;if("%AsyncFunction%"===t)i=v("async function () {}");else if("%GeneratorFunction%"===t)i=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)i=v("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(i=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var s=e("%AsyncGenerator%");s&&A&&(i=A(s.prototype))}return B[t]=i,i},N={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},D=require_function_bind(),j=require_hasown(),L=D.call(k,Array.prototype.concat),U=D.call(I,Array.prototype.splice),M=D.call(k,String.prototype.replace),q=D.call(k,String.prototype.slice),H=D.call(k,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,V=/\\(\\)?/g,K=function(e,t){var i,r=e;if(j(N,r)&&(r="%"+(i=N[r])[0]+"%"),j(B,r)){var s=B[r];if(s===R&&(s=O(r)),void 0===s&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new l("intrinsic "+e+" does not exist!")};t.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===H(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=q(e,0,1),i=q(e,-1);if("%"===t&&"%"!==i)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var r=[];return M(e,z,(function(e,t,i,s){r[r.length]=i?M(s,V,"$1"):t||e})),r}(e),r=i.length>0?i[0]:"",s=K("%"+r+"%",t),n=s.name,a=s.value,o=!1,c=s.alias;c&&(r=c[0],U(i,L([0,1],c)));for(var d=1,p=!0;d<i.length;d+=1){var h=i[d],m=q(h,0,1),f=q(h,-1);if(('"'===m||"'"===m||"`"===m||'"'===f||"'"===f||"`"===f)&&m!==f)throw new l("property names with quotes must have matching quotes");if("constructor"!==h&&p||(o=!0),j(B,n="%"+(r+="."+h)+"%"))a=B[n];else if(null!=a){if(!(h in a)){if(!t)throw new u("base intrinsic for "+e+" exists, but the property is not available.");return}if(x&&d+1>=i.length){var g=x(a,h);a=(p=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[h]}else p=j(a,h),a=a[h];p&&!o&&(B[n]=a)}}return a}}}),require_shams2=__commonJS({"../../node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js"(e,t){"use strict";var i=require_shams();t.exports=function(){return i()&&!!Symbol.toStringTag}}}),require_es_set_tostringtag=__commonJS({"../../node_modules/.pnpm/es-set-tostringtag@2.1.0/node_modules/es-set-tostringtag/index.js"(e,t){"use strict";var i=require_get_intrinsic()("%Object.defineProperty%",!0),r=require_shams2()(),s=require_hasown(),n=require_type(),a=r?Symbol.toStringTag:null;t.exports=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(void 0!==r&&"boolean"!=typeof r||void 0!==o&&"boolean"!=typeof o)throw new n("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");!a||!r&&s(e,a)||(i?i(e,a,{configurable:!o,enumerable:!1,value:t,writable:!1}):e[a]=t)}}}),require_populate=__commonJS({"../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js"(e,t){"use strict";t.exports=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e}}}),require_form_data=__commonJS({"../../node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js"(e,t){"use strict";var i=require_combined_stream(),r=require("util"),s=require("path"),n=require("http"),a=require("https"),o=require("url").parse,c=require("fs"),l=require("stream").Stream,u=require("crypto"),d=require_mime_types(),p=require_asynckit(),h=require_es_set_tostringtag(),m=require_hasown(),f=require_populate();function g(e){if(!(this instanceof g))return new g(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],i.call(this),e=e||{})this[t]=e[t]}r.inherits(g,i),g.LINE_BREAK="\r\n",g.DEFAULT_CONTENT_TYPE="application/octet-stream",g.prototype.append=function(e,t,r){"string"==typeof(r=r||{})&&(r={filename:r});var s=i.prototype.append.bind(this);if("number"!=typeof t&&null!=t||(t=String(t)),Array.isArray(t))this._error(new Error("Arrays are not supported."));else{var n=this._multiPartHeader(e,t,r),a=this._multiPartFooter();s(n),s(t),s(a),this._trackLength(n,t,r)}},g.prototype._trackLength=function(e,t,i){var r=0;null!=i.knownLength?r+=Number(i.knownLength):Buffer.isBuffer(t)?r=t.length:"string"==typeof t&&(r=Buffer.byteLength(t)),this._valueLength+=r,this._overheadLength+=Buffer.byteLength(e)+g.LINE_BREAK.length,t&&(t.path||t.readable&&m(t,"httpVersion")||t instanceof l)&&(i.knownLength||this._valuesToMeasure.push(t))},g.prototype._lengthRetriever=function(e,t){m(e,"fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):c.stat(e.path,(function(i,r){if(i)t(i);else{var s=r.size-(e.start?e.start:0);t(null,s)}})):m(e,"httpVersion")?t(null,Number(e.headers["content-length"])):m(e,"httpModule")?(e.on("response",(function(i){e.pause(),t(null,Number(i.headers["content-length"]))})),e.resume()):t("Unknown stream")},g.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var r,s=this._getContentDisposition(t,i),n=this._getContentType(t,i),a="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(n||[])};for(var c in"object"==typeof i.header&&f(o,i.header),o)if(m(o,c)){if(null==(r=o[c]))continue;Array.isArray(r)||(r=[r]),r.length&&(a+=c+": "+r.join("; ")+g.LINE_BREAK)}return"--"+this.getBoundary()+g.LINE_BREAK+a+g.LINE_BREAK},g.prototype._getContentDisposition=function(e,t){var i;if("string"==typeof t.filepath?i=s.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?i=s.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&m(e,"httpVersion")&&(i=s.basename(e.client._httpMessage.path||"")),i)return'filename="'+i+'"'},g.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e&&e.name&&(i=d.lookup(e.name)),!i&&e&&e.path&&(i=d.lookup(e.path)),!i&&e&&e.readable&&m(e,"httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=d.lookup(t.filepath||t.filename)),!i&&e&&"object"==typeof e&&(i=g.DEFAULT_CONTENT_TYPE),i},g.prototype._multiPartFooter=function(){return function(e){var t=g.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},g.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+g.LINE_BREAK},g.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)m(e,t)&&(i[t.toLowerCase()]=e[t]);return i},g.prototype.setBoundary=function(e){if("string"!=typeof e)throw new TypeError("FormData boundary must be a string");this._boundary=e},g.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},g.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,r=this._streams.length;i<r;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(g.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},g.prototype._generateBoundary=function(){this._boundary="--------------------------"+u.randomBytes(12).toString("hex")},g.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},g.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},g.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?p.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,r){i?e(i):(r.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},g.prototype.submit=function(e,t){var i,r,s={method:"post"};return"string"==typeof e?(e=o(e),r=f({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(r=f(e,s)).port||(r.port="https:"===r.protocol?443:80),r.headers=this.getHeaders(e.headers),i="https:"===r.protocol?a.request(r):n.request(r),this.getLength(function(e,r){if(e&&"Unknown stream"!==e)this._error(e);else if(r&&i.setHeader("Content-Length",r),this.pipe(i),t){var s,n=function(e,r){return i.removeListener("error",n),i.removeListener("response",s),t.call(this,e,r)};s=n.bind(this,null),i.on("error",n),i.on("response",s)}}.bind(this)),i},g.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},g.prototype.toString=function(){return"[object FormData]"},h(g,"FormData"),t.exports=g}}),require_proxy_from_env=__commonJS({"../../node_modules/.pnpm/proxy-from-env@1.1.0/node_modules/proxy-from-env/index.js"(e){"use strict";var t=require("url").parse,i={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},r=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function s(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}e.getProxyForUrl=function(e){var n="string"==typeof e?t(e):e||{},a=n.protocol,o=n.host,c=n.port;if("string"!=typeof o||!o||"string"!=typeof a)return"";if(a=a.split(":",1)[0],!function(e,t){var i=(s("npm_config_no_proxy")||s("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var s=i.match(/^(.+):(\d+)$/),n=s?s[1]:i,a=s?parseInt(s[2]):0;return!(!a||a===t)||(/^[.*]/.test(n)?("*"===n.charAt(0)&&(n=n.slice(1)),!r.call(e,n)):e!==n)}))}(o=o.replace(/:\d*$/,""),c=parseInt(c)||i[a]||0))return"";var l=s("npm_config_"+a+"_proxy")||s(a+"_proxy")||s("npm_config_proxy")||s("all_proxy");return l&&-1===l.indexOf("://")&&(l=a+"://"+l),l}}}),require_ms=__commonJS({"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(e,t){var i=1e3,r=60*i,s=60*r,n=24*s,a=7*n,o=365.25*n;function c(e,t,i,r){var s=t>=1.5*i;return Math.round(e/i)+" "+r+(s?"s":"")}t.exports=function(e,t){t=t||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var c=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*a;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=n)return c(e,t,n,"day");if(t>=s)return c(e,t,s,"hour");if(t>=r)return c(e,t,r,"minute");if(t>=i)return c(e,t,i,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=n)return Math.round(e/n)+"d";if(t>=s)return Math.round(e/s)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=i)return Math.round(e/i)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),require_common=__commonJS({"../../node_modules/.pnpm/debug@4.4.1_supports-color@10.2.0/node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let r,s,n,a=null;function o(...e){if(!o.enabled)return;const i=o,s=Number(new Date),n=s-(r||s);i.diff=n,i.prev=r,i.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const n=t.formatters[s];if("function"==typeof n){const t=e[a];r=n.call(i,t),e.splice(a,1),a--}return r})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=i,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,n=t.enabled(e)),n),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function i(e,i){const r=t(this.namespace+(void 0===i?":":i)+e);return r.log=this.log,r}function r(e,t){let i=0,r=0,s=-1,n=0;for(;i<e.length;)if(r<t.length&&(t[r]===e[i]||"*"===t[r]))"*"===t[r]?(s=r,n=i,r++):(i++,r++);else{if(-1===s)return!1;r=s+1,n++,i=n}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of i)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const i of t.skips)if(r(e,i))return!1;for(const i of t.names)if(r(e,i))return!0;return!1},t.humanize=require_ms(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((i=>{t[i]=e[i]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let i=0;for(let t=0;t<e.length;t++)i=(i<<5)-i+e.charCodeAt(t),i|=0;return t.colors[Math.abs(i)%t.colors.length]},t.enable(t.load()),t}}}),require_browser=__commonJS({"../../node_modules/.pnpm/debug@4.4.1_supports-color@10.2.0/node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;e.splice(1,0,i,"color: inherit");let r=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),e.splice(s,0,i)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(e){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=require_common()(e);var{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}}),supports_color_exports={};function hasFlag(e,t=(globalThis.Deno?globalThis.Deno.args:import_node_process.default.argv)){const i=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(i+e),s=t.indexOf("--");return-1!==r&&(-1===s||r<s)}function envForceColor(){if(!("FORCE_COLOR"in env))return;if("true"===env.FORCE_COLOR)return 1;if("false"===env.FORCE_COLOR)return 0;if(0===env.FORCE_COLOR.length)return 1;const e=Math.min(Number.parseInt(env.FORCE_COLOR,10),3);return[0,1,2,3].includes(e)?e:void 0}function translateLevel(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function _supportsColor(e,{streamIsTTY:t,sniffFlags:i=!0}={}){const r=envForceColor();void 0!==r&&(flagForceColor=r);const s=i?flagForceColor:r;if(0===s)return 0;if(i){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2}if("TF_BUILD"in env&&"AGENT_NAME"in env)return 1;if(e&&!t&&void 0===s)return 0;const n=s||0;if("dumb"===env.TERM)return n;if("win32"===import_node_process.default.platform){const e=import_node_os.default.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in env)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((e=>e in env))?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((e=>e in env))||"codeship"===env.CI_NAME?1:n;if("TEAMCITY_VERSION"in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if("truecolor"===env.COLORTERM)return 3;if("xterm-kitty"===env.TERM)return 3;if("xterm-ghostty"===env.TERM)return 3;if("wezterm"===env.TERM)return 3;if("TERM_PROGRAM"in env){const e=Number.parseInt((env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(env.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)||"COLORTERM"in env?1:n}function createSupportsColor(e,t={}){return translateLevel(_supportsColor(e,{streamIsTTY:e&&e.isTTY,...t}))}__export(supports_color_exports,{createSupportsColor:()=>createSupportsColor,default:()=>supports_color_default});var import_node_process2,import_node_os2,import_node_tty2,env2,flagForceColor2,supportsColor2,supports_color_default2,init_supports_color=__esm({"../../node_modules/.pnpm/supports-color@10.2.0/node_modules/supports-color/index.js"(){import_node_process=__toESM(require("node:process"),1),import_node_os=__toESM(require("node:os"),1),import_node_tty=__toESM(require("node:tty"),1),({env:env}=import_node_process.default),hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")?flagForceColor=0:(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always"))&&(flagForceColor=1),supportsColor={stdout:createSupportsColor({isTTY:import_node_tty.default.isatty(1)}),stderr:createSupportsColor({isTTY:import_node_tty.default.isatty(2)})},supports_color_default=supportsColor}}),require_node=__commonJS({"../../node_modules/.pnpm/debug@4.4.1_supports-color@10.2.0/node_modules/debug/src/node.js"(e,t){var i=require("tty"),r=require("util");e.init=function(t){t.inspectOpts={};const i=Object.keys(e.inspectOpts);for(let r=0;r<i.length;r++)t.inspectOpts[i[r]]=e.inspectOpts[i[r]]},e.log=function(...t){return process.stderr.write(r.formatWithOptions(e.inspectOpts,...t)+"\n")},e.formatArgs=function(i){const{namespace:r,useColors:s}=this;if(s){const e=this.color,s="[3"+(e<8?e:"8;5;"+e),n=`  ${s};1m${r} [0m`;i[0]=n+i[0].split("\n").join("\n"+n),i.push(s+"m+"+t.exports.humanize(this.diff)+"[0m")}else i[0]=function(){if(e.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+r+" "+i[0]},e.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},e.load=function(){return process.env.DEBUG},e.useColors=function(){return"colors"in e.inspectOpts?Boolean(e.inspectOpts.colors):i.isatty(process.stderr.fd)},e.destroy=r.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{const t=(init_supports_color(),__toCommonJS(supports_color_exports));t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}e.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const i=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[i]=r,e}),{}),t.exports=require_common()(e);var{formatters:s}=t.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}}),require_src=__commonJS({"../../node_modules/.pnpm/debug@4.4.1_supports-color@10.2.0/node_modules/debug/src/index.js"(e,t){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?t.exports=require_browser():t.exports=require_node()}}),require_debug=__commonJS({"../../node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/debug.js"(e,t){var i;t.exports=function(){if(!i){try{i=require_src()("follow-redirects")}catch(e){}"function"!=typeof i&&(i=function(){})}i.apply(null,arguments)}}}),require_follow_redirects=__commonJS({"../../node_modules/.pnpm/follow-redirects@1.15.11/node_modules/follow-redirects/index.js"(e,t){var i,r,s,n=require("url"),a=n.URL,o=require("http"),c=require("https"),l=require("stream").Writable,u=require("assert"),d=require_debug();i="undefined"!=typeof process,r="undefined"!=typeof window&&"undefined"!=typeof document,s=F(Error.captureStackTrace),i||!r&&s||console.warn("The follow-redirects package should be excluded from browser builds.");var p=!1;try{u(new a(""))}catch(e){p="ERR_INVALID_URL"===e.code}var h=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],m=["abort","aborted","connect","error","socket","timeout"],f=Object.create(null);m.forEach((function(e){f[e]=function(t,i,r){this._redirectable.emit(e,t,i,r)}}));var g=I("ERR_INVALID_URL","Invalid URL",TypeError),_=I("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),y=I("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",_),b=I("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),v=I("ERR_STREAM_WRITE_AFTER_END","write after end"),x=l.prototype.destroy||E;function S(e,t){l.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var i=this;this._onNativeResponse=function(e){try{i._processResponse(e)}catch(e){i.emit("error",e instanceof _?e:new _({cause:e}))}},this._performRequest()}function w(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(r){var s=r+":",n=i[s]=e[r],o=t[r]=Object.create(n);Object.defineProperties(o,{request:{value:function(e,r,n){var o;return o=e,a&&o instanceof a?e=T(e):R(e)?e=T(C(e)):(n=r,r=A(e),e={protocol:s}),F(r)&&(n=r,r=null),(r=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,r)).nativeProtocols=i,R(r.host)||R(r.hostname)||(r.hostname="::1"),u.equal(r.protocol,s,"protocol mismatch"),d("options",r),new S(r,n)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var r=o.request(e,t,i);return r.end(),r},configurable:!0,enumerable:!0,writable:!0}})})),t}function E(){}function C(e){var t;if(p)t=new a(e);else if(!R((t=A(n.parse(e))).protocol))throw new g({input:e});return t}function A(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new g({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new g({input:e.href||e});return e}function T(e,t){var i=t||{};for(var r of h)i[r]=e[r];return i.hostname.startsWith("[")&&(i.hostname=i.hostname.slice(1,-1)),""!==i.port&&(i.port=Number(i.port)),i.path=i.search?i.pathname+i.search:i.pathname,i}function P(e,t){var i;for(var r in t)e.test(r)&&(i=t[r],delete t[r]);return null==i?void 0:String(i).trim()}function I(e,t,i){function r(i){F(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return r.prototype=new(i||Error),Object.defineProperties(r.prototype,{constructor:{value:r,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),r}function k(e,t){for(var i of m)e.removeListener(i,f[i]);e.on("error",E),e.destroy(t)}function R(e){return"string"==typeof e||e instanceof String}function F(e){return"function"==typeof e}S.prototype=Object.create(l.prototype),S.prototype.abort=function(){k(this._currentRequest),this._currentRequest.abort(),this.emit("abort")},S.prototype.destroy=function(e){return k(this._currentRequest,e),x.call(this,e),this},S.prototype.write=function(e,t,i){if(this._ending)throw new v;if(!R(e)&&("object"!=typeof(r=e)||!("length"in r)))throw new TypeError("data should be a string, Buffer or Uint8Array");var r;F(t)&&(i=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,i)):(this.emit("error",new b),this.abort()):i&&i()},S.prototype.end=function(e,t,i){if(F(e)?(i=e,e=t=null):F(t)&&(i=t,t=null),e){var r=this,s=this._currentRequest;this.write(e,t,(function(){r._ended=!0,s.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},S.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},S.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},S.prototype.setTimeout=function(e,t){var i=this;function r(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),n()}),e),r(t)}function n(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",n),i.removeListener("error",n),i.removeListener("response",n),i.removeListener("close",n),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",r),this.on("abort",n),this.on("error",n),this.on("response",n),this.on("close",n),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){S.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(S.prototype,e,{get:function(){return this._currentRequest[e]}})})),S.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},S.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw new TypeError("Unsupported protocol "+e);if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var r=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(r._redirectable=this,m))r.on(s,f[s]);if(this._currentUrl=/^\//.test(this._options.path)?n.format(this._options):this._options.path,this._isRedirect){var a=0,o=this,c=this._requestBodyBuffers;!function e(t){if(r===o._currentRequest)if(t)o.emit("error",t);else if(a<c.length){var i=c[a++];r.finished||r.write(i.data,i.encoding,e)}else o._ended&&r.end()}()}},S.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i,r=e.headers.location;if(!r||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(k(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new y;var s=this._options.beforeRedirect;s&&(i=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var o=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],P(/^content-/i,this._options.headers));var c,l,h=P(/^host$/i,this._options.headers),m=C(this._currentUrl),f=h||m.host,g=/^\w+:/.test(r)?this._currentUrl:n.format(Object.assign(m,{host:f})),_=(c=r,l=g,p?new a(c,l):C(n.resolve(l,c)));if(d("redirecting to",_.href),this._isRedirect=!0,T(_,this._options),(_.protocol!==m.protocol&&"https:"!==_.protocol||_.host!==f&&!function(e,t){u(R(e)&&R(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(_.host,f))&&P(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),F(s)){var b={headers:e.headers,statusCode:t},v={url:g,method:o,headers:i};s(this._options,b,v),this._sanitizeOptions(this._options)}this._performRequest()},t.exports=w({http:o,https:c}),t.exports.wrap=w}}),require_axios=__commonJS({"../../node_modules/.pnpm/axios@1.11.0/node_modules/axios/dist/node/axios.cjs"(e,t){"use strict";var i=require_form_data(),r=require("crypto"),s=require("url"),n=require_proxy_from_env(),a=require("http"),o=require("https"),c=require("util"),l=require_follow_redirects(),u=require("zlib"),d=require("stream"),p=require("events");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=h(i),f=h(r),g=h(s),_=h(n),y=h(a),b=h(o),v=h(c),x=h(l),S=h(u),w=h(d);function E(e,t){return function(){return e.apply(t,arguments)}}var{toString:C}=Object.prototype,{getPrototypeOf:A}=Object,{iterator:T,toStringTag:P}=Symbol,I=(e=>t=>{const i=C.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),k=e=>(e=e.toLowerCase(),t=>I(t)===e),R=e=>t=>typeof t===e,{isArray:F}=Array,B=R("undefined");function O(e){return null!==e&&!B(e)&&null!==e.constructor&&!B(e.constructor)&&j(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var N=k("ArrayBuffer");var D=R("string"),j=R("function"),L=R("number"),U=e=>null!==e&&"object"==typeof e,M=e=>{if("object"!==I(e))return!1;const t=A(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||P in e||T in e)},q=k("Date"),H=k("File"),z=k("Blob"),V=k("FileList"),K=k("URLSearchParams"),[G,W,J,$]=["ReadableStream","Request","Response","Headers"].map(k);function Z(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),F(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(O(e))return;const s=i?Object.getOwnPropertyNames(e):Object.keys(e),n=s.length;let a;for(r=0;r<n;r++)a=s[r],t.call(null,e[a],a,e)}}function Y(e,t){if(O(e))return null;t=t.toLowerCase();const i=Object.keys(e);let r,s=i.length;for(;s-- >0;)if(r=i[s],t===r.toLowerCase())return r;return null}var X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Q=e=>!B(e)&&e!==X;var ee=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&A(Uint8Array)),te=k("HTMLFormElement"),ie=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),re=k("RegExp"),se=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),r={};Z(i,((i,s)=>{let n;!1!==(n=t(i,s,e))&&(r[s]=n||i)})),Object.defineProperties(e,r)};var ne,ae,oe,ce,le=k("AsyncFunction"),ue=(ne="function"==typeof setImmediate,ae=j(X.postMessage),ne?setImmediate:ae?(oe=`axios@${Math.random()}`,ce=[],X.addEventListener("message",(({source:e,data:t})=>{e===X&&t===oe&&ce.length&&ce.shift()()}),!1),e=>{ce.push(e),X.postMessage(oe,"*")}):e=>setTimeout(e)),de="undefined"!=typeof queueMicrotask?queueMicrotask.bind(X):"undefined"!=typeof process&&process.nextTick||ue,pe={isArray:F,isArrayBuffer:N,isBuffer:O,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||j(e.append)&&("formdata"===(t=I(e))||"object"===t&&j(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&N(e.buffer),t},isString:D,isNumber:L,isBoolean:e=>!0===e||!1===e,isObject:U,isPlainObject:M,isEmptyObject:e=>{if(!U(e)||O(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:G,isRequest:W,isResponse:J,isHeaders:$,isUndefined:B,isDate:q,isFile:H,isBlob:z,isRegExp:re,isFunction:j,isStream:e=>U(e)&&j(e.pipe),isURLSearchParams:K,isTypedArray:ee,isFileList:V,forEach:Z,merge:function e(){const{caseless:t}=Q(this)&&this||{},i={},r=(r,s)=>{const n=t&&Y(i,s)||s;M(i[n])&&M(r)?i[n]=e(i[n],r):M(r)?i[n]=e({},r):F(r)?i[n]=r.slice():i[n]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Z(arguments[e],r);return i},extend:(e,t,i,{allOwnKeys:r}={})=>(Z(t,((t,r)=>{i&&j(t)?e[r]=E(t,i):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,r)=>{let s,n,a;const o={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),n=s.length;n-- >0;)a=s[n],r&&!r(a,e,t)||o[a]||(t[a]=e[a],o[a]=!0);e=!1!==i&&A(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:I,kindOfTest:k,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const r=e.indexOf(t,i);return-1!==r&&r===i},toArray:e=>{if(!e)return null;if(F(e))return e;let t=e.length;if(!L(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[T]).call(e);let r;for(;(r=i.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const r=[];for(;null!==(i=e.exec(t));)r.push(i);return r},isHTMLForm:te,hasOwnProperty:ie,hasOwnProp:ie,reduceDescriptors:se,freezeMethods:e=>{se(e,((t,i)=>{if(j(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const r=e[i];j(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},r=e=>{e.forEach((e=>{i[e]=!0}))};return F(e)?r(e):r(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Y,global:X,isContextDefined:Q,isSpecCompliantForm:function(e){return!!(e&&j(e.append)&&"FormData"===e[P]&&e[T])},toJSONObject:e=>{const t=new Array(10),i=(e,r)=>{if(U(e)){if(t.indexOf(e)>=0)return;if(O(e))return e;if(!("toJSON"in e)){t[r]=e;const s=F(e)?[]:{};return Z(e,((e,t)=>{const n=i(e,r+1);!B(n)&&(s[t]=n)})),t[r]=void 0,s}}return e};return i(e,0)},isAsyncFn:le,isThenable:e=>e&&(U(e)||j(e))&&j(e.then)&&j(e.catch),setImmediate:ue,asap:de,isIterable:e=>null!=e&&j(e[T])};function he(e,t,i,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}pe.inherits(he,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:pe.toJSONObject(this.config),code:this.code,status:this.status}}});var me=he.prototype,fe={};function ge(e){return pe.isPlainObject(e)||pe.isArray(e)}function _e(e){return pe.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,i){return e?e.concat(t).map((function(e,t){return e=_e(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{fe[e]={value:e}})),Object.defineProperties(he,fe),Object.defineProperty(me,"isAxiosError",{value:!0}),he.from=(e,t,i,r,s,n)=>{const a=Object.create(me);return pe.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),he.call(a,e.message,t,i,r,s),a.cause=e,a.name=e.name,n&&Object.assign(a,n),a};var be=pe.toFlatObject(pe,{},null,(function(e){return/^is[A-Z]/.test(e)}));function ve(e,t,i){if(!pe.isObject(e))throw new TypeError("target must be an object");t=t||new(m.default||FormData);const r=(i=pe.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!pe.isUndefined(t[e])}))).metaTokens,s=i.visitor||l,n=i.dots,a=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&pe.isSpecCompliantForm(t);if(!pe.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(pe.isDate(e))return e.toISOString();if(pe.isBoolean(e))return e.toString();if(!o&&pe.isBlob(e))throw new he("Blob is not supported. Use a Buffer instead.");return pe.isArrayBuffer(e)||pe.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,i,s){let o=e;if(e&&!s&&"object"==typeof e)if(pe.endsWith(i,"{}"))i=r?i:i.slice(0,-2),e=JSON.stringify(e);else if(pe.isArray(e)&&function(e){return pe.isArray(e)&&!e.some(ge)}(e)||(pe.isFileList(e)||pe.endsWith(i,"[]"))&&(o=pe.toArray(e)))return i=_e(i),o.forEach((function(e,r){!pe.isUndefined(e)&&null!==e&&t.append(!0===a?ye([i],r,n):null===a?i:i+"[]",c(e))})),!1;return!!ge(e)||(t.append(ye(s,i,n),c(e)),!1)}const u=[],d=Object.assign(be,{defaultVisitor:l,convertValue:c,isVisitable:ge});if(!pe.isObject(e))throw new TypeError("data must be an object");return function e(i,r){if(!pe.isUndefined(i)){if(-1!==u.indexOf(i))throw Error("Circular reference detected in "+r.join("."));u.push(i),pe.forEach(i,(function(i,n){!0===(!(pe.isUndefined(i)||null===i)&&s.call(t,i,pe.isString(n)?n.trim():n,r,d))&&e(i,r?r.concat(n):[n])})),u.pop()}}(e),t}function xe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Se(e,t){this._pairs=[],e&&ve(e,this,t)}var we=Se.prototype;function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ce(e,t,i){if(!t)return e;const r=i&&i.encode||Ee;pe.isFunction(i)&&(i={serialize:i});const s=i&&i.serialize;let n;if(n=s?s(t,i):pe.isURLSearchParams(t)?t.toString():new Se(t,i).toString(r),n){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}we.append=function(e,t){this._pairs.push([e,t])},we.toString=function(e){const t=e?function(t){return e.call(this,t,xe)}:xe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Ae=class{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){pe.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Te={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Pe=g.default.URLSearchParams,Ie="abcdefghijklmnopqrstuvwxyz",ke="0123456789",Re={DIGIT:ke,ALPHA:Ie,ALPHA_DIGIT:Ie+Ie.toUpperCase()+ke},Fe={isNode:!0,classes:{URLSearchParams:Pe,FormData:m.default,Blob:"undefined"!=typeof Blob&&Blob||null},ALPHABET:Re,generateString:(e=16,t=Re.ALPHA_DIGIT)=>{let i="";const{length:r}=t,s=new Uint32Array(e);f.default.randomFillSync(s);for(let n=0;n<e;n++)i+=t[s[n]%r];return i},protocols:["http","https","file","data"]},Be="undefined"!=typeof window&&"undefined"!=typeof document,Oe="object"==typeof navigator&&navigator||void 0,Ne=Be&&(!Oe||["ReactNative","NativeScript","NS"].indexOf(Oe.product)<0),De="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,je=Be&&window.location.href||"http://localhost",Le={...Object.freeze({__proto__:null,hasBrowserEnv:Be,hasStandardBrowserWebWorkerEnv:De,hasStandardBrowserEnv:Ne,navigator:Oe,origin:je}),...Fe};function Ue(e){function t(e,i,r,s){let n=e[s++];if("__proto__"===n)return!0;const a=Number.isFinite(+n),o=s>=e.length;if(n=!n&&pe.isArray(r)?r.length:n,o)return pe.hasOwnProp(r,n)?r[n]=[r[n],i]:r[n]=i,!a;r[n]&&pe.isObject(r[n])||(r[n]=[]);return t(e,i,r[n],s)&&pe.isArray(r[n])&&(r[n]=function(e){const t={},i=Object.keys(e);let r;const s=i.length;let n;for(r=0;r<s;r++)n=i[r],t[n]=e[n];return t}(r[n])),!a}if(pe.isFormData(e)&&pe.isFunction(e.entries)){const i={};return pe.forEachEntry(e,((e,r)=>{t(function(e){return pe.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,i,0)})),i}return null}var Me={transitional:Te,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=pe.isObject(e);s&&pe.isHTMLForm(e)&&(e=new FormData(e));if(pe.isFormData(e))return r?JSON.stringify(Ue(e)):e;if(pe.isArrayBuffer(e)||pe.isBuffer(e)||pe.isStream(e)||pe.isFile(e)||pe.isBlob(e)||pe.isReadableStream(e))return e;if(pe.isArrayBufferView(e))return e.buffer;if(pe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let n;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ve(e,new Le.classes.URLSearchParams,{visitor:function(e,t,i,r){return Le.isNode&&pe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((n=pe.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ve(n?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,i){if(pe.isString(e))try{return(t||JSON.parse)(e),pe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Me.transitional,i=t&&t.forcedJSONParsing,r="json"===this.responseType;if(pe.isResponse(e)||pe.isReadableStream(e))return e;if(e&&pe.isString(e)&&(i&&!this.responseType||r)){const i=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw he.from(e,he.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Le.classes.FormData,Blob:Le.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};pe.forEach(["delete","get","head","post","put","patch"],(e=>{Me.headers[e]={}}));var qe=Me,He=pe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ze=Symbol("internals");function Ve(e){return e&&String(e).trim().toLowerCase()}function Ke(e){return!1===e||null==e?e:pe.isArray(e)?e.map(Ke):String(e)}function Ge(e,t,i,r,s){return pe.isFunction(r)?r.call(this,t,i):(s&&(t=i),pe.isString(t)?pe.isString(r)?-1!==t.indexOf(r):pe.isRegExp(r)?r.test(t):void 0:void 0)}var We=class{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(e,t,i){const s=Ve(t);if(!s)throw new Error("header name must be a non-empty string");const n=pe.findKey(r,s);(!n||void 0===r[n]||!0===i||void 0===i&&!1!==r[n])&&(r[n||t]=Ke(e))}const n=(e,t)=>pe.forEach(e,((e,i)=>s(e,i,t)));if(pe.isPlainObject(e)||e instanceof this.constructor)n(e,t);else if(pe.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))n((e=>{const t={};let i,r,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),i=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!i||t[i]&&He[i]||("set-cookie"===i?t[i]?t[i].push(r):t[i]=[r]:t[i]=t[i]?t[i]+", "+r:r)})),t})(e),t);else if(pe.isObject(e)&&pe.isIterable(e)){let i,r,s={};for(const t of e){if(!pe.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(i=s[r])?pe.isArray(i)?[...i,t[1]]:[i,t[1]]:t[1]}n(s,t)}else null!=e&&s(t,e,i);return this}get(e,t){if(e=Ve(e)){const i=pe.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=i.exec(e);)t[r[1]]=r[2];return t}(e);if(pe.isFunction(t))return t.call(this,e,i);if(pe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ve(e)){const i=pe.findKey(this,e);return!(!i||void 0===this[i]||t&&!Ge(0,this[i],i,t))}return!1}delete(e,t){const i=this;let r=!1;function s(e){if(e=Ve(e)){const s=pe.findKey(i,e);!s||t&&!Ge(0,i[s],s,t)||(delete i[s],r=!0)}}return pe.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];e&&!Ge(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return pe.forEach(this,((r,s)=>{const n=pe.findKey(i,s);if(n)return t[n]=Ke(r),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Ke(r),i[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return pe.forEach(this,((i,r)=>{null!=i&&!1!==i&&(t[r]=e&&pe.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[ze]=this[ze]={accessors:{}}).accessors,i=this.prototype;function r(e){const r=Ve(e);t[r]||(!function(e,t){const i=pe.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+i,{value:function(e,i,s){return this[r].call(this,t,e,i,s)},configurable:!0})}))}(i,e),t[r]=!0)}return pe.isArray(e)?e.forEach(r):r(e),this}};We.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),pe.reduceDescriptors(We.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}})),pe.freezeMethods(We);var Je=We;function $e(e,t){const i=this||qe,r=t||i,s=Je.from(r.headers);let n=r.data;return pe.forEach(e,(function(e){n=e.call(i,n,s.normalize(),t?t.status:void 0)})),s.normalize(),n}function Ze(e){return!(!e||!e.__CANCEL__)}function Ye(e,t,i){he.call(this,null==e?"canceled":e,he.ERR_CANCELED,t,i),this.name="CanceledError"}function Xe(e,t,i){const r=i.config.validateStatus;i.status&&r&&!r(i.status)?t(new he("Request failed with status code "+i.status,[he.ERR_BAD_REQUEST,he.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Qe(e,t,i){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==i)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}pe.inherits(Ye,he,{__CANCEL__:!0});var et="1.11.0";function tt(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var it=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;var rt=Symbol("internals"),st=class extends w.default.Transform{constructor(e){super({readableHighWaterMark:(e=pe.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!pe.isUndefined(t[e])))).chunkSize});const t=this[rt]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{"progress"===e&&(t.isCaptured||(t.isCaptured=!0))}))}_read(e){const t=this[rt];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const r=this[rt],s=r.maxRate,n=this.readableHighWaterMark,a=r.timeWindow,o=s/(1e3/a),c=!1!==r.minChunkSize?Math.max(r.minChunkSize,.01*o):0,l=(e,t)=>{const i=Buffer.byteLength(e);r.bytesSeen+=i,r.bytes+=i,r.isCaptured&&this.emit("progress",r.bytesSeen),this.push(e)?process.nextTick(t):r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(t)}},u=(e,t)=>{const i=Buffer.byteLength(e);let u,d=null,p=n,h=0;if(s){const e=Date.now();(!r.ts||(h=e-r.ts)>=a)&&(r.ts=e,u=o-r.bytes,r.bytes=u<0?-u:0,h=0),u=o-r.bytes}if(s){if(u<=0)return setTimeout((()=>{t(null,e)}),a-h);u<p&&(p=u)}p&&i>p&&i-p>c&&(d=e.subarray(p),e=e.subarray(0,p)),l(e,d?()=>{process.nextTick(t,null,d)}:t)};u(e,(function e(t,r){if(t)return i(t);r?u(r,e):i(null)}))}},{asyncIterator:nt}=Symbol,at=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[nt]?yield*e[nt]():yield e},ot=Le.ALPHABET.ALPHA_DIGIT+"-_",ct="function"==typeof TextEncoder?new TextEncoder:new v.default.TextEncoder,lt="\r\n",ut=ct.encode(lt),dt=class{constructor(e,t){const{escapeName:i}=this.constructor,r=pe.isString(t);let s=`Content-Disposition: form-data; name="${i(e)}"${!r&&t.name?`; filename="${i(t.name)}"`:""}${lt}`;r?t=ct.encode(String(t).replace(/\r?\n|\r\n?/g,lt)):s+=`Content-Type: ${t.type||"application/octet-stream"}${lt}`,this.headers=ct.encode(s+lt),this.contentLength=r?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;pe.isTypedArray(e)?yield e:yield*at(e),yield ut}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}},pt=(e,t,i)=>{const{tag:r="form-data-boundary",size:s=25,boundary:n=r+"-"+Le.generateString(s,ot)}=i||{};if(!pe.isFormData(e))throw TypeError("FormData instance required");if(n.length<1||n.length>70)throw Error("boundary must be 10-70 characters long");const a=ct.encode("--"+n+lt),o=ct.encode("--"+n+"--"+lt);let c=o.byteLength;const l=Array.from(e.entries()).map((([e,t])=>{const i=new dt(e,t);return c+=i.size,i}));c+=a.byteLength*l.length,c=pe.toFiniteNumber(c);const u={"Content-Type":`multipart/form-data; boundary=${n}`};return Number.isFinite(c)&&(u["Content-Length"]=c),t&&t(u),d.Readable.from(async function*(){for(const e of l)yield a,yield*e.encode();yield o}())},ht=class extends w.default.Transform{__transform(e,t,i){this.push(e),i()}_transform(e,t,i){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,i)}},mt=(e,t)=>pe.isAsyncFn(e)?function(...i){const r=i.pop();e.apply(this,i).then((e=>{try{t?r(null,...t(e)):r(null,e)}catch(e){r(e)}}),r)}:e;var ft=(e,t,i=3)=>{let r=0;const s=function(e,t){e=e||10;const i=new Array(e),r=new Array(e);let s,n=0,a=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),l=r[a];s||(s=c),i[n]=o,r[n]=c;let u=a,d=0;for(;u!==n;)d+=i[u++],u%=e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let i,r,s=0,n=1e3/t;const a=(t,n=Date.now())=>{s=n,i=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),o=t-s;o>=n?a(e,t):(i=e,r||(r=setTimeout((()=>{r=null,a(i)}),n-o)))},()=>i&&a(i)]}((i=>{const n=i.loaded,a=i.lengthComputable?i.total:void 0,o=n-r,c=s(o);r=n;e({loaded:n,total:a,progress:a?n/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&n<=a?(a-n)/c:void 0,event:i,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),i)},gt=(e,t)=>{const i=null!=e;return[r=>t[0]({lengthComputable:i,total:e,loaded:r}),t[1]]},_t=e=>(...t)=>pe.asap((()=>e(...t))),yt={flush:S.default.constants.Z_SYNC_FLUSH,finishFlush:S.default.constants.Z_SYNC_FLUSH},bt={flush:S.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:S.default.constants.BROTLI_OPERATION_FLUSH},vt=pe.isFunction(S.default.createBrotliDecompress),{http:xt,https:St}=x.default,wt=/https:?/,Et=Le.protocols.map((e=>e+":")),Ct=(e,[t,i])=>(e.on("end",i).on("error",i),t);function At(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function Tt(e,t,i){let r=t;if(!r&&!1!==r){const e=_.default.getProxyForUrl(i);e&&(r=new URL(e))}if(r){if(r.username&&(r.auth=(r.username||"")+":"+(r.password||"")),r.auth){(r.auth.username||r.auth.password)&&(r.auth=(r.auth.username||"")+":"+(r.auth.password||""));const t=Buffer.from(r.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=r.hostname||r.host;e.hostname=t,e.host=t,e.port=r.port,e.path=i,r.protocol&&(e.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`)}e.beforeRedirects.proxy=function(e){Tt(e,t,e.href)}}var Pt="undefined"!=typeof process&&"process"===pe.kindOf(process),It=(e,t)=>(({address:e,family:t})=>{if(!pe.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}})(pe.isObject(e)?e:{address:e,family:t}),kt=Pt&&function(e){return t=async function(t,i,r){let{data:s,lookup:n,family:a}=e;const{responseType:o,responseEncoding:c}=e,l=e.method.toUpperCase();let u,d,h=!1;if(n){const e=mt(n,(e=>pe.isArray(e)?e:[e]));n=(t,i,r)=>{e(t,i,((e,t,s)=>{if(e)return r(e);const n=pe.isArray(t)?t.map((e=>It(e))):[It(t,s)];i.all?r(e,n):r(e,n[0].address,n[0].family)}))}}const m=new p.EventEmitter,f=()=>{e.cancelToken&&e.cancelToken.unsubscribe(g),e.signal&&e.signal.removeEventListener("abort",g),m.removeAllListeners()};function g(t){m.emit("abort",!t||t.type?new Ye(null,e,d):t)}r(((e,t)=>{u=!0,t&&(h=!0,f())})),m.once("abort",i),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(g),e.signal&&(e.signal.aborted?g():e.signal.addEventListener("abort",g)));const _=Qe(e.baseURL,e.url,e.allowAbsoluteUrls),x=new URL(_,Le.hasBrowserEnv?Le.origin:void 0),E=x.protocol||Et[0];if("data:"===E){let r;if("GET"!==l)return Xe(t,i,{status:405,statusText:"method not allowed",headers:{},config:e});try{r=function(e,t,i){const r=i&&i.Blob||Le.classes.Blob,s=tt(e);if(void 0===t&&r&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const i=it.exec(e);if(!i)throw new he("Invalid URL",he.ERR_INVALID_URL);const n=i[1],a=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),a?"base64":"utf8");if(t){if(!r)throw new he("Blob is not supported",he.ERR_NOT_SUPPORT);return new r([c],{type:n})}return c}throw new he("Unsupported protocol "+s,he.ERR_NOT_SUPPORT)}(e.url,"blob"===o,{Blob:e.env&&e.env.Blob})}catch(t){throw he.from(t,he.ERR_BAD_REQUEST,e)}return"text"===o?(r=r.toString(c),c&&"utf8"!==c||(r=pe.stripBOM(r))):"stream"===o&&(r=w.default.Readable.from(r)),Xe(t,i,{data:r,status:200,statusText:"OK",headers:new Je,config:e})}if(-1===Et.indexOf(E))return i(new he("Unsupported protocol "+E,he.ERR_BAD_REQUEST,e));const C=Je.from(e.headers).normalize();C.set("User-Agent","axios/"+et,!1);const{onUploadProgress:A,onDownloadProgress:T}=e,P=e.maxRate;let I,k;if(pe.isSpecCompliantForm(s)){const e=C.getContentType(/boundary=([-_\w\d]{10,70})/i);s=pt(s,(e=>{C.set(e)}),{tag:`axios-${et}-boundary`,boundary:e&&e[1]||void 0})}else if(pe.isFormData(s)&&pe.isFunction(s.getHeaders)){if(C.set(s.getHeaders()),!C.hasContentLength())try{const e=await v.default.promisify(s.getLength).call(s);Number.isFinite(e)&&e>=0&&C.setContentLength(e)}catch(e){}}else if(pe.isBlob(s)||pe.isFile(s))s.size&&C.setContentType(s.type||"application/octet-stream"),C.setContentLength(s.size||0),s=w.default.Readable.from(at(s));else if(s&&!pe.isStream(s)){if(Buffer.isBuffer(s));else if(pe.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else{if(!pe.isString(s))return i(new he("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",he.ERR_BAD_REQUEST,e));s=Buffer.from(s,"utf-8")}if(C.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return i(new he("Request body larger than maxBodyLength limit",he.ERR_BAD_REQUEST,e))}const R=pe.toFiniteNumber(C.getContentLength());let F,B;pe.isArray(P)?(I=P[0],k=P[1]):I=k=P,s&&(A||I)&&(pe.isStream(s)||(s=w.default.Readable.from(s,{objectMode:!1})),s=w.default.pipeline([s,new st({maxRate:pe.toFiniteNumber(I)})],pe.noop),A&&s.on("progress",Ct(s,gt(R,ft(_t(A),!1,3))))),e.auth&&(F=(e.auth.username||"")+":"+(e.auth.password||"")),!F&&x.username&&(F=x.username+":"+x.password),F&&C.delete("authorization");try{B=Ce(x.pathname+x.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const r=new Error(t.message);return r.config=e,r.url=e.url,r.exists=!0,i(r)}C.set("Accept-Encoding","gzip, compress, deflate"+(vt?", br":""),!1);const O={path:B,method:l,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:F,protocol:E,family:a,beforeRedirect:At,beforeRedirects:{}};let N;!pe.isUndefined(n)&&(O.lookup=n),e.socketPath?O.socketPath=e.socketPath:(O.hostname=x.hostname.startsWith("[")?x.hostname.slice(1,-1):x.hostname,O.port=x.port,Tt(O,e.proxy,E+"//"+x.hostname+(x.port?":"+x.port:"")+O.path));const D=wt.test(O.protocol);if(O.agent=D?e.httpsAgent:e.httpAgent,e.transport?N=e.transport:0===e.maxRedirects?N=D?b.default:y.default:(e.maxRedirects&&(O.maxRedirects=e.maxRedirects),e.beforeRedirect&&(O.beforeRedirects.config=e.beforeRedirect),N=D?St:xt),e.maxBodyLength>-1?O.maxBodyLength=e.maxBodyLength:O.maxBodyLength=1/0,e.insecureHTTPParser&&(O.insecureHTTPParser=e.insecureHTTPParser),d=N.request(O,(function(r){if(d.destroyed)return;const s=[r],n=+r.headers["content-length"];if(T||k){const e=new st({maxRate:pe.toFiniteNumber(k)});T&&e.on("progress",Ct(e,gt(n,ft(_t(T),!0,3)))),s.push(e)}let a=r;const u=r.req||d;if(!1!==e.decompress&&r.headers["content-encoding"])switch("HEAD"!==l&&204!==r.statusCode||delete r.headers["content-encoding"],(r.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":s.push(S.default.createUnzip(yt)),delete r.headers["content-encoding"];break;case"deflate":s.push(new ht),s.push(S.default.createUnzip(yt)),delete r.headers["content-encoding"];break;case"br":vt&&(s.push(S.default.createBrotliDecompress(bt)),delete r.headers["content-encoding"])}a=s.length>1?w.default.pipeline(s,pe.noop):s[0];const p=w.default.finished(a,(()=>{p(),f()})),g={status:r.statusCode,statusText:r.statusMessage,headers:new Je(r.headers),config:e,request:u};if("stream"===o)g.data=a,Xe(t,i,g);else{const r=[];let s=0;a.on("data",(function(t){r.push(t),s+=t.length,e.maxContentLength>-1&&s>e.maxContentLength&&(h=!0,a.destroy(),i(new he("maxContentLength size of "+e.maxContentLength+" exceeded",he.ERR_BAD_RESPONSE,e,u)))})),a.on("aborted",(function(){if(h)return;const t=new he("stream has been aborted",he.ERR_BAD_RESPONSE,e,u);a.destroy(t),i(t)})),a.on("error",(function(t){d.destroyed||i(he.from(t,null,e,u))})),a.on("end",(function(){try{let e=1===r.length?r[0]:Buffer.concat(r);"arraybuffer"!==o&&(e=e.toString(c),c&&"utf8"!==c||(e=pe.stripBOM(e))),g.data=e}catch(t){return i(he.from(t,null,e,g.request,g))}Xe(t,i,g)}))}m.once("abort",(e=>{a.destroyed||(a.emit("error",e),a.destroy())}))})),m.once("abort",(e=>{i(e),d.destroy(e)})),d.on("error",(function(t){i(he.from(t,null,e,d))})),d.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t))return void i(new he("error trying to parse `config.timeout` to int",he.ERR_BAD_OPTION_VALUE,e,d));d.setTimeout(t,(function(){if(u)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Te;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new he(t,r.clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,e,d)),g()}))}if(pe.isStream(s)){let t=!1,i=!1;s.on("end",(()=>{t=!0})),s.once("error",(e=>{i=!0,d.destroy(e)})),s.on("close",(()=>{t||i||g(new Ye("Request stream has been aborted",e,d))})),s.pipe(d)}else d.end(s)},new Promise(((e,i)=>{let r,s;const n=(e,t)=>{s||(s=!0,r&&r(e,t))},a=e=>{n(e,!0),i(e)};t((t=>{n(t),e(t)}),a,(e=>r=e)).catch(a)}));var t},Rt=Le.hasStandardBrowserEnv?((e,t)=>i=>(i=new URL(i,Le.origin),e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)))(new URL(Le.origin),Le.navigator&&/(msie|trident)/i.test(Le.navigator.userAgent)):()=>!0,Ft=Le.hasStandardBrowserEnv?{write(e,t,i,r,s,n){const a=[e+"="+encodeURIComponent(t)];pe.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),pe.isString(r)&&a.push("path="+r),pe.isString(s)&&a.push("domain="+s),!0===n&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}},Bt=e=>e instanceof Je?{...e}:e;function Ot(e,t){t=t||{};const i={};function r(e,t,i,r){return pe.isPlainObject(e)&&pe.isPlainObject(t)?pe.merge.call({caseless:r},e,t):pe.isPlainObject(t)?pe.merge({},t):pe.isArray(t)?t.slice():t}function s(e,t,i,s){return pe.isUndefined(t)?pe.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function n(e,t){if(!pe.isUndefined(t))return r(void 0,t)}function a(e,t){return pe.isUndefined(t)?pe.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function o(i,s,n){return n in t?r(i,s):n in e?r(void 0,i):void 0}const c={url:n,method:n,data:n,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t,i)=>s(Bt(e),Bt(t),0,!0)};return pe.forEach(Object.keys({...e,...t}),(function(r){const n=c[r]||s,a=n(e[r],t[r],r);pe.isUndefined(a)&&n!==o||(i[r]=a)})),i}var Nt,Dt=e=>{const t=Ot({},e);let i,{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=Je.from(o),t.url=Ce(Qe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),pe.isFormData(r))if(Le.hasStandardBrowserEnv||Le.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(i=o.getContentType())){const[e,...t]=i?i.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}if(Le.hasStandardBrowserEnv&&(s&&pe.isFunction(s)&&(s=s(t)),s||!1!==s&&Rt(t.url))){const e=n&&a&&Ft.read(a);e&&o.set(n,e)}return t},jt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){const r=Dt(e);let s=r.data;const n=Je.from(r.headers).normalize();let a,o,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:h}=r;function m(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let f=new XMLHttpRequest;function g(){if(!f)return;const r=Je.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());Xe((function(e){t(e),m()}),(function(e){i(e),m()}),{data:d&&"text"!==d&&"json"!==d?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f}),f=null}f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout,"onloadend"in f?f.onloadend=g:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(g)},f.onabort=function(){f&&(i(new he("Request aborted",he.ECONNABORTED,e,f)),f=null)},f.onerror=function(){i(new he("Network Error",he.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||Te;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),i(new he(t,s.clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,e,f)),f=null},void 0===s&&n.setContentType(null),"setRequestHeader"in f&&pe.forEach(n.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),pe.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),d&&"json"!==d&&(f.responseType=r.responseType),h&&([c,u]=ft(h,!0),f.addEventListener("progress",c)),p&&f.upload&&([o,l]=ft(p),f.upload.addEventListener("progress",o),f.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(a=t=>{f&&(i(!t||t.type?new Ye(null,e,f):t),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const _=tt(r.url);_&&-1===Le.protocols.indexOf(_)?i(new he("Unsupported protocol "+_+":",he.ERR_BAD_REQUEST,e)):f.send(s||null)}))},Lt=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,r=new AbortController;const s=function(e){if(!i){i=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof he?t:new Ye(t instanceof Error?t.message:t))}};let n=t&&setTimeout((()=>{n=null,s(new he(`timeout ${t} of ms exceeded`,he.ETIMEDOUT))}),t);const a=()=>{e&&(n&&clearTimeout(n),n=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)})),e=null)};e.forEach((e=>e.addEventListener("abort",s)));const{signal:o}=r;return o.unsubscribe=()=>pe.asap(a),o}},Ut=function*(e,t){let i=e.byteLength;if(!t||i<t)return void(yield e);let r,s=0;for(;s<i;)r=s+t,yield e.slice(s,r),s=r},Mt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},qt=(e,t,i,r)=>{const s=async function*(e,t){for await(const i of Mt(e))yield*Ut(i,t)}(e,t);let n,a=0,o=e=>{n||(n=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return o(),void e.close();let n=r.byteLength;if(i){let e=a+=n;i(e)}e.enqueue(new Uint8Array(r))}catch(e){throw o(e),e}},cancel:e=>(o(e),s.return())},{highWaterMark:2})},Ht="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,zt=Ht&&"function"==typeof ReadableStream,Vt=Ht&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Kt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Gt=zt&&Kt((()=>{let e=!1;const t=new Request(Le.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Wt=zt&&Kt((()=>pe.isReadableStream(new Response("").body))),Jt={stream:Wt&&(e=>e.body)};Ht&&(Nt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Jt[e]&&(Jt[e]=pe.isFunction(Nt[e])?t=>t[e]():(t,i)=>{throw new he(`Response type '${e}' is not supported`,he.ERR_NOT_SUPPORT,i)})})));var $t=async(e,t)=>{const i=pe.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(pe.isBlob(e))return e.size;if(pe.isSpecCompliantForm(e)){const t=new Request(Le.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return pe.isArrayBufferView(e)||pe.isArrayBuffer(e)?e.byteLength:(pe.isURLSearchParams(e)&&(e+=""),pe.isString(e)?(await Vt(e)).byteLength:void 0)})(t):i},Zt={http:kt,xhr:jt,fetch:Ht&&(async e=>{let{url:t,method:i,data:r,signal:s,cancelToken:n,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:p}=Dt(e);l=l?(l+"").toLowerCase():"text";let h,m=Lt([s,n&&n.toAbortSignal()],a);const f=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let g;try{if(c&&Gt&&"get"!==i&&"head"!==i&&0!==(g=await $t(u,r))){let e,i=new Request(t,{method:"POST",body:r,duplex:"half"});if(pe.isFormData(r)&&(e=i.headers.get("content-type"))&&u.setContentType(e),i.body){const[e,t]=gt(g,ft(_t(c)));r=qt(i.body,65536,e,t)}}pe.isString(d)||(d=d?"include":"omit");const s="credentials"in Request.prototype;h=new Request(t,{...p,signal:m,method:i.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:s?d:void 0});let n=await fetch(h,p);const a=Wt&&("stream"===l||"response"===l);if(Wt&&(o||a&&f)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=n[t]}));const t=pe.toFiniteNumber(n.headers.get("content-length")),[i,r]=o&&gt(t,ft(_t(o),!0))||[];n=new Response(qt(n.body,65536,i,(()=>{r&&r(),f&&f()})),e)}l=l||"text";let _=await Jt[pe.findKey(Jt,l)||"text"](n,e);return!a&&f&&f(),await new Promise(((t,i)=>{Xe(t,i,{data:_,headers:Je.from(n.headers),status:n.status,statusText:n.statusText,config:e,request:h})}))}catch(t){if(f&&f(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new he("Network Error",he.ERR_NETWORK,e,h),{cause:t.cause||t});throw he.from(t,t&&t.code,e,h)}})};pe.forEach(Zt,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Yt=e=>`- ${e}`,Xt=e=>pe.isFunction(e)||null===e||!1===e,Qt=e=>{e=pe.isArray(e)?e:[e];const{length:t}=e;let i,r;const s={};for(let n=0;n<t;n++){let t;if(i=e[n],r=i,!Xt(i)&&(r=Zt[(t=String(i)).toLowerCase()],void 0===r))throw new he(`Unknown adapter '${t}'`);if(r)break;s[t||"#"+n]=r}if(!r){const e=Object.entries(s).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new he("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Yt).join("\n"):" "+Yt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function ei(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ye(null,e)}function ti(e){ei(e),e.headers=Je.from(e.headers),e.data=$e.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Qt(e.adapter||qe.adapter)(e).then((function(t){return ei(e),t.data=$e.call(e,e.transformResponse,t),t.headers=Je.from(t.headers),t}),(function(t){return Ze(t)||(ei(e),t&&t.response&&(t.response.data=$e.call(e,e.transformResponse,t.response),t.response.headers=Je.from(t.response.headers))),Promise.reject(t)}))}var ii={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ii[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));var ri={};ii.transitional=function(e,t,i){function r(e,t){return"[Axios v"+et+"] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,s,n)=>{if(!1===e)throw new he(r(s," has been removed"+(t?" in "+t:"")),he.ERR_DEPRECATED);return t&&!ri[s]&&(ri[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,s,n)}},ii.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};var si={assertOptions:function(e,t,i){if("object"!=typeof e)throw new he("options must be an object",he.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const n=r[s],a=t[n];if(a){const t=e[n],i=void 0===t||a(t,n,e);if(!0!==i)throw new he("option "+n+" must be "+i,he.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new he("Unknown option "+n,he.ERR_BAD_OPTION)}},validators:ii},ni=si.validators,ai=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ae,response:new Ae}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const i=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?i&&!String(e.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+i):e.stack=i}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ot(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;void 0!==i&&si.assertOptions(i,{silentJSONParsing:ni.transitional(ni.boolean),forcedJSONParsing:ni.transitional(ni.boolean),clarifyTimeoutError:ni.transitional(ni.boolean)},!1),null!=r&&(pe.isFunction(r)?t.paramsSerializer={serialize:r}:si.assertOptions(r,{encode:ni.function,serialize:ni.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),si.assertOptions(t,{baseUrl:ni.spelling("baseURL"),withXsrfToken:ni.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let n=s&&pe.merge(s.common,s[t.method]);s&&pe.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=Je.concat(n,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,d=0;if(!o){const e=[ti.bind(this),void 0];for(e.unshift(...a),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=a.length;let p=t;for(d=0;d<u;){const e=a[d++],t=a[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=ti.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Ce(Qe((e=Ot(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};pe.forEach(["delete","get","head","options"],(function(e){ai.prototype[e]=function(t,i){return this.request(Ot(i||{},{method:e,url:t,data:(i||{}).data}))}})),pe.forEach(["post","put","patch"],(function(e){function t(t){return function(i,r,s){return this.request(Ot(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:r}))}}ai.prototype[e]=t(),ai.prototype[e+"Form"]=t(!0)}));var oi=ai,ci=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{i.subscribe(e),t=e})).then(e);return r.cancel=function(){i.unsubscribe(t)},r},e((function(e,r,s){i.reason||(i.reason=new Ye(e,r,s),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}};var li={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(li).forEach((([e,t])=>{li[t]=e}));var ui=li;var di=function e(t){const i=new oi(t),r=E(oi.prototype.request,i);return pe.extend(r,oi.prototype,i,{allOwnKeys:!0}),pe.extend(r,i,null,{allOwnKeys:!0}),r.create=function(i){return e(Ot(t,i))},r}(qe);di.Axios=oi,di.CanceledError=Ye,di.CancelToken=ci,di.isCancel=Ze,di.VERSION=et,di.toFormData=ve,di.AxiosError=he,di.Cancel=di.CanceledError,di.all=function(e){return Promise.all(e)},di.spread=function(e){return function(t){return e.apply(null,t)}},di.isAxiosError=function(e){return pe.isObject(e)&&!0===e.isAxiosError},di.mergeConfig=Ot,di.AxiosHeaders=Je,di.formToJSON=e=>Ue(pe.isHTMLForm(e)?new FormData(e):e),di.getAdapter=Qt,di.HttpStatusCode=ui,di.default=di,t.exports=di}}),require_http=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/http.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.HttpClient=void 0;var r=i(require_axios()),s=new(require_logger().Logger)("packages/common/src/http.ts");e.HttpClient=class{constructor(e){this.api=r.default.create({baseURL:e})}get(e,i){return t(this,void 0,void 0,(function*(){const t=yield this.api.get(e,i).catch((e=>e));if(r.default.isAxiosError(t)){const r=Object.assign(Object.assign({},t.response),{message:t.message});if(null==i?void 0:i.retry){if(yield i.retry(r))return s.warn("retry get",{url:e}),this.get(e,i);throw s.warn("retry get failed",{url:e}),r}throw s.warn("response error",{error:r}),r}return t.data}))}post(e,i,n){var a,o,c;return t(this,void 0,void 0,(function*(){const t=yield this.api.post(e,i,n).catch((e=>e));if(r.default.isAxiosError(t)){const r={data:null===(a=t.response)||void 0===a?void 0:a.data,status:null===(o=t.response)||void 0===o?void 0:o.status,statusText:null===(c=t.response)||void 0===c?void 0:c.statusText,message:t.message};if(s.warn("error received",r),null==n?void 0:n.retry){const t=yield n.retry(r);if(t)return s.warn("retry post",e,{data:i,error:r,needRetry:t}),this.post(e,i,n);throw r}throw r}return t.data}))}put(e,i,n){return t(this,void 0,void 0,(function*(){const t=yield this.api.put(e,i,n).catch((e=>e));if(r.default.isAxiosError(t)){const r=Object.assign(Object.assign({},t.response),{message:t.message});if(null==n?void 0:n.retry){if(yield n.retry(r))return s.warn("retry put",{url:e,data:i}),this.put(e,i,n);throw s.warn("retry put failed",{url:e,data:i}),r}throw s.warn("response error",{error:r}),r}return t.data}))}delete(e,i){return t(this,void 0,void 0,(function*(){const t=yield this.api.delete(e,i).catch((e=>e));if(r.default.isAxiosError(t)){const r=Object.assign(Object.assign({},t.response),{message:t.message});if(null==i?void 0:i.retry){if(yield i.retry(r))return s.warn("retry delete",{url:e}),this.delete(e,i);throw s.warn("retry delete failed",{url:e}),r}throw s.warn("response error",{error:r}),r}return t.data}))}}}}),require_promise=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/promise.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.PromiseQueue=void 0;var i=new(require_logger().Logger)("packages/common/src/promise.ts");e.PromiseQueue=class{constructor(){this.id=Math.random().toString().slice(2),this.queue=[],this.running=!1,this.push=e=>new Promise(((t,r)=>{this.queue.push({promise:e,done:t,failed:r}),this.running||this.run().catch((e=>{i.error("push",e)}))}))}run(){return t(this,void 0,void 0,(function*(){const e=this.queue.shift();if(e){this.running=!0;try{const t=yield e.promise();e.done(t)}catch(t){e.failed(t)}yield this.run()}else this.running=!1}))}}}}),require_util=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/util.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.deepCopy=e.BackOff=void 0;e.BackOff=class{constructor(e={}){this.count=0,this.times=8,this.interval=100,this.jitter=0,Object.assign(this,e)}wait(){return t(this,void 0,void 0,(function*(){if(this.exceeded)return!1;const e=this.timeout;return this.count++,yield new Promise((t=>setTimeout(t,e))),!0}))}get timeout(){return Math.pow(this.count,2)*this.interval+Math.pow(this.count,2)*this.jitter*Math.random()}get exceeded(){return this.count>=this.times}reset(){this.count=0}};e.deepCopy=e=>JSON.parse(JSON.stringify(e))}}),require_dist=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+common@1.5.0/node_modules/@skyway-sdk/common/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(require_error(),e),i(require_event(),e),i(require_http(),e),i(require_logger(),e),i(require_promise(),e),i(require_util(),e)}}),require_grammar=__commonJS({"../../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/grammar.js"(e,t){var i=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(i).forEach((function(e){i[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))}}),require_parser=__commonJS({"../../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/parser.js"(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var s=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:s&&!i[e.name]&&(i[e.name]={});var n=e.push?{}:s?i[e.name]:i;!function(e,i,r,s){if(s&&!r)i[s]=t(e[1]);else for(var n=0;n<r.length;n+=1)null!=e[n+1]&&(i[r[n]]=t(e[n+1]))}(r.match(e.reg),n,e.names,e.name),e.push&&i[e.push].push(n)},r=require_grammar(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},n=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),a=n[n.length-1]);for(var o=0;o<(r[t]||[]).length;o+=1){var c=r[t][o];if(c.reg.test(s))return i(c,a,s)}})),t.media=n,t};var n=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(n,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),s=0;s<r.length;s+=3)i.push({component:r[s],ip:r[s+1],port:r[s+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(n,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}}),require_writer=__commonJS({"../../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/writer.js"(e,t){var i=require_grammar(),r=/%[sdv%]/g,s=function(e){var t=1,i=arguments,s=i.length;return e.replace(r,(function(e){if(t>=s)return e;var r=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}}))},n=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var a=t.names[n];t.name?r.push(i[t.name][a]):r.push(i[t.names[n]])}else r.push(i[t.name]);return s.apply(null,r)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],o=["i","c","b","a"];t.exports=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||a,s=t.innerOrder||o,c=[];return r.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(n(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(n(t,i,e))}))}))})),e.media.forEach((function(e){c.push(n("m",i.m[0],e)),s.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(n(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(n(t,i,e))}))}))}))})),c.join("\r\n")+"\r\n"}}}),require_lib=__commonJS({"../../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/index.js"(e){var t=require_parser(),i=require_writer(),r=require_grammar();e.grammar=r,e.write=i,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList}}),require_ua_parser=__commonJS({"../../node_modules/.pnpm/ua-parser-js@1.0.40/node_modules/ua-parser-js/src/ua-parser.js"(e,t){!function(i,r){"use strict";var s="function",n="undefined",a="object",o="string",c="major",l="model",u="name",d="type",p="vendor",h="version",m="architecture",f="console",g="mobile",_="tablet",y="smarttv",b="wearable",v="embedded",x="Amazon",S="Apple",w="ASUS",E="BlackBerry",C="Browser",A="Chrome",T="Firefox",P="Google",I="Huawei",k="LG",R="Microsoft",F="Motorola",B="Opera",O="Samsung",N="Sharp",D="Sony",j="Xiaomi",L="Zebra",U="Facebook",M="Chromium OS",q="Mac OS",H=" Browser",z=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},V=function(e,t){return typeof e===o&&-1!==K(t).indexOf(K(e))},K=function(e){return e.toLowerCase()},G=function(e,t){if(typeof e===o)return e=e.replace(/^\s\s*/,""),typeof t===n?e:e.substring(0,500)},W=function(e,t){for(var i,n,o,c,l,u,d=0;d<t.length&&!l;){var p=t[d],h=t[d+1];for(i=n=0;i<p.length&&!l&&p[i];)if(l=p[i++].exec(e))for(o=0;o<h.length;o++)u=l[++n],typeof(c=h[o])===a&&c.length>0?2===c.length?typeof c[1]==s?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==s||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):r:this[c[0]]=u?c[1].call(this,u,c[2]):r:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):r):this[c]=u||r;d+=2}},J=function(e,t){for(var i in t)if(typeof t[i]===a&&t[i].length>0){for(var s=0;s<t[i].length;s++)if(V(t[i][s],e))return"?"===i?r:i}else if(V(t[i],e))return"?"===i?r:i;return t.hasOwnProperty("*")?t["*"]:e},$={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,h],[/opios[\/ ]+([\w\.]+)/i],[h,[u,B+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[h,[u,B+" GX"]],[/\bopr\/([\w\.]+)/i],[h,[u,B]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[h,[u,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[h,[u,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,h],[/quark(?:pc)?\/([-\w\.]+)/i],[h,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[h,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[u,"UC"+C]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[h,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[h,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[h,[u,"Smart Lenovo "+C]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+C],h],[/\bfocus\/([\w\.]+)/i],[h,[u,T+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[u,B+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,B+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[u,"MIUI"+H]],[/fxios\/([\w\.-]+)/i],[h,[u,T]],[/\bqihoobrowser\/?([\w\.]*)/i],[h,[u,"360"]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],h],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+H],h],[/samsungbrowser\/([\w\.]+)/i],[h,[u,O+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[h,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[u,h],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[h,u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,U],h],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[h,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[u,A+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,A+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[u,"Android "+C]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[h,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],h],[/(wolvic|librewolf)\/([\w\.]+)/i],[u,h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[u,T+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,[h,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,K]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",K]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,K]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[p,O],[d,_]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[l,[p,O],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[p,S],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[p,S],[d,_]],[/(macintosh);/i],[l,[p,S]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[p,N],[d,g]],[/(?:honor)([-\w ]+)[;\)]/i],[l,[p,"Honor"],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[p,I],[d,_]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[p,I],[d,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[l,/_/g," "],[p,j],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[p,j],[d,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[p,"OPPO"],[d,g]],[/\b(opd2\d{3}a?) bui/i],[l,[p,"OPPO"],[d,_]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[p,"Vivo"],[d,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[p,"Realme"],[d,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[p,F],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[p,F],[d,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[p,k],[d,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[p,k],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[p,"Lenovo"],[d,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[p,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[p,P],[d,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[p,P],[d,g]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[p,D],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[p,D],[d,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[p,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[p,x],[d,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[p,x],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,p,[d,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[p,E],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[p,w],[d,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[p,w],[d,g]],[/(nexus 9)/i],[l,[p,"HTC"],[d,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[l,/_/g," "],[d,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[l,[p,"TCL"],[d,_]],[/(itel) ((\w+))/i],[[p,K],l,[d,J,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[p,"Acer"],[d,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[p,"Meizu"],[d,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[p,"Ulefone"],[d,g]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[l,[p,"Energizer"],[d,g]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[l,[p,"Cat"],[d,g]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[l,[p,"Smartfren"],[d,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[p,"Nothing"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,l,[d,g]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,l,[d,_]],[/(surface duo)/i],[l,[p,R],[d,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[p,"Fairphone"],[d,g]],[/(u304aa)/i],[l,[p,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[l,[p,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[l,[p,"RCA"],[d,_]],[/\b(venue[\d ]{2,7}) b/i],[l,[p,"Dell"],[d,_]],[/\b(q(?:mv|ta)\w+) b/i],[l,[p,"Verizon"],[d,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[p,"Barnes & Noble"],[d,_]],[/\b(tm\d{3}\w+) b/i],[l,[p,"NuVision"],[d,_]],[/\b(k88) b/i],[l,[p,"ZTE"],[d,_]],[/\b(nx\d{3}j) b/i],[l,[p,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[l,[p,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[l,[p,"Swiss"],[d,_]],[/\b((zeki)?tb.*\b) b/i],[l,[p,"Zeki"],[d,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],l,[d,_]],[/\b(ns-?\w{0,9}) b/i],[l,[p,"Insignia"],[d,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[p,"NextBook"],[d,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],l,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],l,[d,g]],[/\b(ph-1) /i],[l,[p,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[p,"Envizen"],[d,_]],[/\b(trio[-\w\. ]+) b/i],[l,[p,"MachSpeed"],[d,_]],[/\btu_(1491) b/i],[l,[p,"Rotor"],[d,_]],[/(shield[\w ]+) b/i],[l,[p,"Nvidia"],[d,_]],[/(sprint) (\w+)/i],[p,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[p,R],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[p,L],[d,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[p,L],[d,g]],[/smart-tv.+(samsung)/i],[p,[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[p,O],[d,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,k],[d,y]],[/(apple) ?tv/i],[p,[l,S+" TV"],[d,y]],[/crkey/i],[[l,A+"cast"],[p,P],[d,y]],[/droid.+aft(\w+)( bui|\))/i],[l,[p,x],[d,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[p,N],[d,y]],[/(bravia[\w ]+)( bui|\))/i],[l,[p,D],[d,y]],[/(mitv-\w{5}) bui/i],[l,[p,j],[d,y]],[/Hbbtv.*(technisat) (.*);/i],[p,l,[d,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,G],[l,G],[d,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,l,[d,f]],[/droid.+; (shield) bui/i],[l,[p,"Nvidia"],[d,f]],[/(playstation [345portablevi]+)/i],[l,[p,D],[d,f]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[p,R],[d,f]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[l,[p,O],[d,b]],[/((pebble))app/i],[p,l,[d,b]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[p,S],[d,b]],[/droid.+; (glass) \d/i],[l,[p,P],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[l,[p,L],[d,b]],[/droid.+; (glass) \d/i],[l,[p,P],[d,b]],[/(pico) (4|neo3(?: link|pro)?)/i],[p,l,[d,b]],[/; (quest( \d| pro)?)/i],[l,[p,U],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,v]],[/(aeobc)\b/i],[l,[p,x],[d,v]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[u,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[u,h],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,h],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[h,J,$]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[h,J,$],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,q],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,h],[/\(bb(10);/i],[h,[u,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[u,T+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[h,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[h,[u,A+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,M],h],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,h],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,h]]},Y=function(e,t){if(typeof e===a&&(t=e,e=r),!(this instanceof Y))return new Y(e,t).getResult();var f=typeof i!==n&&i.navigator?i.navigator:r,y=e||(f&&f.userAgent?f.userAgent:""),b=f&&f.userAgentData?f.userAgentData:r,v=t?function(e,t){var i={};for(var r in e)t[r]&&t[r].length%2==0?i[r]=t[r].concat(e[r]):i[r]=e[r];return i}(Z,t):Z,x=f&&f.userAgent==y;return this.getBrowser=function(){var e,t={};return t[u]=r,t[h]=r,W.call(t,y,v.browser),t[c]=typeof(e=t[h])===o?e.replace(/[^\d\.]/g,"").split(".")[0]:r,x&&f&&f.brave&&typeof f.brave.isBrave==s&&(t[u]="Brave"),t},this.getCPU=function(){var e={};return e[m]=r,W.call(e,y,v.cpu),e},this.getDevice=function(){var e={};return e[p]=r,e[l]=r,e[d]=r,W.call(e,y,v.device),x&&!e[d]&&b&&b.mobile&&(e[d]=g),x&&"Macintosh"==e[l]&&f&&typeof f.standalone!==n&&f.maxTouchPoints&&f.maxTouchPoints>2&&(e[l]="iPad",e[d]=_),e},this.getEngine=function(){var e={};return e[u]=r,e[h]=r,W.call(e,y,v.engine),e},this.getOS=function(){var e={};return e[u]=r,e[h]=r,W.call(e,y,v.os),x&&!e[u]&&b&&b.platform&&"Unknown"!=b.platform&&(e[u]=b.platform.replace(/chrome os/i,M).replace(/macos/i,q)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return y},this.setUA=function(e){return y=typeof e===o&&e.length>500?G(e,500):e,this},this.setUA(y),this};Y.VERSION="1.0.40",Y.BROWSER=z([u,h,c]),Y.CPU=z([m]),Y.DEVICE=z([l,p,d,f,g,y,_,b,v]),Y.ENGINE=Y.OS=z([u,h]),typeof e!==n?(typeof t!==n&&t.exports&&(e=t.exports=Y),e.UAParser=Y):typeof define===s&&define.amd?define((function(){return Y})):typeof i!==n&&(i.UAParser=Y);var X=typeof i!==n&&(i.jQuery||i.Zepto);if(X&&!X.ua){var Q=new Y;X.ua=Q.getResult(),X.ua.get=function(){return Q.getUA()},X.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var i in t)X.ua[i]=t[i]}}}("object"==typeof window?window:e)}}),require_es5=__commonJS({"../../submodules/mediasoup/node_modules/bowser/es5.js"(e,t){var i,r;i=e,r=function(){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(r,s,function(t){return e[t]}.bind(null,s));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=90)}({17:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r=i(18),s=function(){function e(){}return e.getFirstMatch=function(e,t){var i=t.match(e);return i&&i.length>0&&i[1]||""},e.getSecondMatch=function(e,t){var i=t.match(e);return i&&i.length>1&&i[2]||""},e.matchAndReturnConst=function(e,t,i){if(e.test(t))return i},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,i,r){void 0===r&&(r=!1);var s=e.getVersionPrecision(t),n=e.getVersionPrecision(i),a=Math.max(s,n),o=0,c=e.map([t,i],(function(t){var i=a-e.getVersionPrecision(t),r=t+new Array(i+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(o=a-Math.min(s,n)),a-=1;a>=o;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===o)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var i,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)r.push(t(e[i]));return r},e.find=function(e,t){var i,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(i=0,r=e.length;i<r;i+=1){var s=e[i];if(t(s,i))return s}},e.assign=function(e){for(var t,i,r=e,s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(n));var o=function(){var e=n[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,i=n.length;t<i;t+=1)o();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=s,e.exports=t.default},18:function(e,t,i){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,s=(r=i(91))&&r.__esModule?r:{default:r},n=i(18);function a(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){}var t,i;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new s.default(e,t)},e.parse=function(e){return new s.default(e).getResult()},t=e,(i=[{key:"BROWSER_MAP",get:function(){return n.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return n.ENGINE_MAP}},{key:"OS_MAP",get:function(){return n.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return n.PLATFORMS_MAP}}])&&a(t,i),e}();t.default=o,e.exports=t.default},91:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r=c(i(92)),s=c(i(93)),n=c(i(94)),a=c(i(95)),o=c(i(17));function c(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=o.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=o.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=o.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return o.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,i={},r=0,s={},n=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(s[t]=a,n+=1):"object"==typeof a&&(i[t]=a,r+=1)})),r>0){var a=Object.keys(i),c=o.default.find(a,(function(e){return t.isOS(e)}));if(c){var l=this.satisfies(i[c]);if(void 0!==l)return l}var u=o.default.find(a,(function(e){return t.isPlatform(e)}));if(u){var d=this.satisfies(i[u]);if(void 0!==d)return d}}if(n>0){var p=Object.keys(s),h=o.default.find(p,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(s[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var i=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),s=o.default.getBrowserTypeByAlias(r);return t&&s&&(r=s.toLowerCase()),r===i},t.compareVersion=function(e){var t=[0],i=e,r=!1,s=this.getBrowserVersion();if("string"==typeof s)return">"===e[0]||"<"===e[0]?(i=e.substr(1),"="===e[1]?(r=!0,i=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?i=e.substr(1):"~"===e[0]&&(r=!0,i=e.substr(1)),t.indexOf(o.default.compareVersions(s,i,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=l,e.exports=t.default},92:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,s=(r=i(17))&&r.__esModule?r:{default:r},n=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},i=s.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},i=s.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},i=s.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},i=s.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},i=s.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},i=s.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},i=s.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},i=s.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},i=s.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},i=s.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},i=s.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},i=s.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},i=s.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},i=s.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},i=s.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return i&&(t.version=i),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},i=s.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},i=s.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},i=s.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},i=s.default.getFirstMatch(n,e)||s.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},i=s.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},i=s.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},i=s.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},i=s.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},i=s.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},i=s.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},i=s.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},i=s.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},i=s.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){var t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe:function(e){var t={name:"Android Browser"},i=s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},i=s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},i=s.default.getFirstMatch(n,e);return i&&(t.version=i),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:s.default.getFirstMatch(t,e),version:s.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,s=(r=i(17))&&r.__esModule?r:{default:r},n=i(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=s.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:n.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=s.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=s.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),i=s.default.getWindowsVersionName(t);return{name:n.OS_MAP.Windows,version:t,versionName:i}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:n.OS_MAP.iOS},i=s.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return i&&(t.version=i),t}},{test:[/macintosh/i],describe:function(e){var t=s.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),i=s.default.getMacOSVersionName(t),r={name:n.OS_MAP.MacOS,version:t};return i&&(r.versionName=i),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=s.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:n.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe:function(e){var t=s.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),i=s.default.getAndroidVersionName(t),r={name:n.OS_MAP.Android,version:t};return i&&(r.versionName=i),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=s.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),i={name:n.OS_MAP.WebOS};return t&&t.length&&(i.version=t),i}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=s.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||s.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||s.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:n.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=s.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=s.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:n.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:n.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=s.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,s=(r=i(17))&&r.__esModule?r:{default:r},n=i(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=s.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",i={type:n.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(i.model=t),i}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),i=e.test(/like (ipod|iphone)/i);return t&&!i},describe:function(e){var t=s.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:n.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:n.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,s=(r=i(17))&&r.__esModule?r:{default:r},n=i(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:n.ENGINE_MAP.Blink};var t=s.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:n.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:n.ENGINE_MAP.Trident},i=s.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:n.ENGINE_MAP.Presto},i=s.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){var t=e.test(/gecko/i),i=e.test(/like gecko/i);return t&&!i},describe:function(e){var t={name:n.ENGINE_MAP.Gecko},i=s.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:n.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:n.ENGINE_MAP.WebKit},i=s.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}}];t.default=a,e.exports=t.default}})},"object"==typeof e&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof e?e.bowser=r():i.bowser=r()}}),require_ms2=__commonJS({"../../submodules/mediasoup/node_modules/ms/index.js"(e,t){var i=1e3,r=60*i,s=60*r,n=24*s,a=7*n,o=365.25*n;function c(e,t,i,r){var s=t>=1.5*i;return Math.round(e/i)+" "+r+(s?"s":"")}t.exports=function(e,t){t=t||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var c=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*a;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=n)return c(e,t,n,"day");if(t>=s)return c(e,t,s,"hour");if(t>=r)return c(e,t,r,"minute");if(t>=i)return c(e,t,i,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=n)return Math.round(e/n)+"d";if(t>=s)return Math.round(e/s)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=i)return Math.round(e/i)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),require_common2=__commonJS({"../../submodules/mediasoup/node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let r,s,n,a=null;function o(...e){if(!o.enabled)return;const i=o,s=Number(new Date),n=s-(r||s);i.diff=n,i.prev=r,i.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const n=t.formatters[s];if("function"==typeof n){const t=e[a];r=n.call(i,t),e.splice(a,1),a--}return r})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=i,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,n=t.enabled(e)),n),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function i(e,i){const r=t(this.namespace+(void 0===i?":":i)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let i;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(i=0;i<s;i++)r[i]&&("-"===(e=r[i].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let i,r;for(i=0,r=t.skips.length;i<r;i++)if(t.skips[i].test(e))return!1;for(i=0,r=t.names.length;i<r;i++)if(t.names[i].test(e))return!0;return!1},t.humanize=require_ms2(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((i=>{t[i]=e[i]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let i=0;for(let t=0;t<e.length;t++)i=(i<<5)-i+e.charCodeAt(t),i|=0;return t.colors[Math.abs(i)%t.colors.length]},t.enable(t.load()),t}}}),require_browser2=__commonJS({"../../submodules/mediasoup/node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;e.splice(1,0,i,"color: inherit");let r=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),e.splice(s,0,i)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=require_common2()(e);var{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}}),supports_color_exports2={};function hasFlag2(e,t=(globalThis.Deno?globalThis.Deno.args:import_node_process2.default.argv)){const i=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(i+e),s=t.indexOf("--");return-1!==r&&(-1===s||r<s)}function envForceColor2(){if("FORCE_COLOR"in env2)return"true"===env2.FORCE_COLOR?1:"false"===env2.FORCE_COLOR?0:0===env2.FORCE_COLOR.length?1:Math.min(Number.parseInt(env2.FORCE_COLOR,10),3)}function translateLevel2(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function _supportsColor2(e,{streamIsTTY:t,sniffFlags:i=!0}={}){const r=envForceColor2();void 0!==r&&(flagForceColor2=r);const s=i?flagForceColor2:r;if(0===s)return 0;if(i){if(hasFlag2("color=16m")||hasFlag2("color=full")||hasFlag2("color=truecolor"))return 3;if(hasFlag2("color=256"))return 2}if("TF_BUILD"in env2&&"AGENT_NAME"in env2)return 1;if(e&&!t&&void 0===s)return 0;const n=s||0;if("dumb"===env2.TERM)return n;if("win32"===import_node_process2.default.platform){const e=import_node_os2.default.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in env2)return"GITHUB_ACTIONS"in env2||"GITEA_ACTIONS"in env2?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((e=>e in env2))||"codeship"===env2.CI_NAME?1:n;if("TEAMCITY_VERSION"in env2)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION)?1:0;if("truecolor"===env2.COLORTERM)return 3;if("xterm-kitty"===env2.TERM)return 3;if("TERM_PROGRAM"in env2){const e=Number.parseInt((env2.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env2.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(env2.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)||"COLORTERM"in env2?1:n}function createSupportsColor2(e,t={}){return translateLevel2(_supportsColor2(e,{streamIsTTY:e&&e.isTTY,...t}))}__export(supports_color_exports2,{createSupportsColor:()=>createSupportsColor2,default:()=>supports_color_default2});var extendStatics,__assign,__createBinding,__setModuleDefault,ownKeys,_SuppressedError,tslib_es6_default,init_supports_color2=__esm({"../../submodules/mediasoup/node_modules/supports-color/index.js"(){import_node_process2=__toESM(require("node:process"),1),import_node_os2=__toESM(require("node:os"),1),import_node_tty2=__toESM(require("node:tty"),1),({env:env2}=import_node_process2.default),hasFlag2("no-color")||hasFlag2("no-colors")||hasFlag2("color=false")||hasFlag2("color=never")?flagForceColor2=0:(hasFlag2("color")||hasFlag2("colors")||hasFlag2("color=true")||hasFlag2("color=always"))&&(flagForceColor2=1),supportsColor2={stdout:createSupportsColor2({isTTY:import_node_tty2.default.isatty(1)}),stderr:createSupportsColor2({isTTY:import_node_tty2.default.isatty(2)})},supports_color_default2=supportsColor2}}),require_node2=__commonJS({"../../submodules/mediasoup/node_modules/debug/src/node.js"(e,t){var i=require("tty"),r=require("util");e.init=function(t){t.inspectOpts={};const i=Object.keys(e.inspectOpts);for(let r=0;r<i.length;r++)t.inspectOpts[i[r]]=e.inspectOpts[i[r]]},e.log=function(...e){return process.stderr.write(r.format(...e)+"\n")},e.formatArgs=function(i){const{namespace:r,useColors:s}=this;if(s){const e=this.color,s="[3"+(e<8?e:"8;5;"+e),n=`  ${s};1m${r} [0m`;i[0]=n+i[0].split("\n").join("\n"+n),i.push(s+"m+"+t.exports.humanize(this.diff)+"[0m")}else i[0]=function(){if(e.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+r+" "+i[0]},e.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},e.load=function(){return process.env.DEBUG},e.useColors=function(){return"colors"in e.inspectOpts?Boolean(e.inspectOpts.colors):i.isatty(process.stderr.fd)},e.destroy=r.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{const t=(init_supports_color2(),__toCommonJS(supports_color_exports2));t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}e.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const i=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[i]=r,e}),{}),t.exports=require_common2()(e);var{formatters:s}=t.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}}),require_src2=__commonJS({"../../submodules/mediasoup/node_modules/debug/src/index.js"(e,t){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?t.exports=require_browser2():t.exports=require_node2()}}),require_h264_profile_level_id=__commonJS({"../../submodules/mediasoup/node_modules/h264-profile-level-id/index.js"(e){var t=require_src2()("h264-profile-level-id");t.log=console.info.bind(console);e.ProfileConstrainedBaseline=1,e.ProfileBaseline=2,e.ProfileMain=3,e.ProfileConstrainedHigh=4,e.ProfileHigh=5;var i=10;e.Level1_b=0,e.Level1=10,e.Level1_1=11,e.Level1_2=12,e.Level1_3=13,e.Level2=20,e.Level2_1=21,e.Level2_2=22,e.Level3=30,e.Level3_1=31,e.Level3_2=32,e.Level4=40,e.Level4_1=41,e.Level4_2=42,e.Level5=50,e.Level5_1=51,e.Level5_2=52;var r=class{constructor(e,t){this.profile=e,this.level=t}};e.ProfileLevelId=r;var s=new r(1,31),n=class{constructor(e){this._mask=~c("x",e),this._maskedValue=c("1",e)}isMatch(e){return this._maskedValue===(e&this._mask)}},a=class{constructor(e,t,i){this.profile_idc=e,this.profile_iop=t,this.profile=i}},o=[new a(66,new n("x1xx0000"),1),new a(77,new n("1xxx0000"),1),new a(88,new n("11xx0000"),1),new a(66,new n("x0xx0000"),2),new a(88,new n("10xx0000"),2),new a(77,new n("0x0x0000"),3),new a(100,new n("00000000"),5),new a(100,new n("00001100"),4)];function c(e,t){return(t[0]===e)<<7|(t[1]===e)<<6|(t[2]===e)<<5|(t[3]===e)<<4|(t[4]===e)<<3|(t[5]===e)<<2|(t[6]===e)<<1|t[7]===e}function l(e={}){const t=e["level-asymmetry-allowed"];return 1===t||"1"===t}e.parseProfileLevelId=function(e){if("string"!=typeof e||6!==e.length)return null;const i=parseInt(e,16);if(0===i)return null;const s=255&i,n=i>>8&255,a=i>>16&255;let c;switch(s){case 11:c=16&n?0:11;break;case 10:case 12:case 13:case 20:case 21:case 22:case 30:case 31:case 32:case 40:case 41:case 42:case 50:case 51:case 52:c=s;break;default:return t("parseProfileLevelId() | unrecognized level_idc:%s",s),null}for(const e of o)if(a===e.profile_idc&&e.profile_iop.isMatch(n))return new r(e.profile,c);return t("parseProfileLevelId() | unrecognized profile_idc/profile_iop combination"),null},e.profileLevelIdToString=function(e){if(0==e.level)switch(e.profile){case 1:return"42f00b";case 2:return"42100b";case 3:return"4d100b";default:return t("profileLevelIdToString() | Level 1_b not is allowed for profile:%s",e.profile),null}let i;switch(e.profile){case 1:i="42e0";break;case 2:i="4200";break;case 3:i="4d00";break;case 4:i="640c";break;case 5:i="6400";break;default:return t("profileLevelIdToString() | unrecognized profile:%s",e.profile),null}let r=e.level.toString(16);return 1===r.length&&(r=`0${r}`),`${i}${r}`},e.parseSdpProfileLevelId=function(t={}){const i=t["profile-level-id"];return i?e.parseProfileLevelId(i):s},e.isSameProfile=function(t={},i={}){const r=e.parseSdpProfileLevelId(t),s=e.parseSdpProfileLevelId(i);return Boolean(r&&s&&r.profile===s.profile)},e.generateProfileLevelIdForAnswer=function(s={},n={}){if(!s["profile-level-id"]&&!n["profile-level-id"])return t("generateProfileLevelIdForAnswer() | no profile-level-id in local and remote params"),null;const a=e.parseSdpProfileLevelId(s),o=e.parseSdpProfileLevelId(n);if(!a)throw new TypeError("invalid local_profile_level_id");if(!o)throw new TypeError("invalid remote_profile_level_id");if(a.profile!==o.profile)throw new TypeError("H264 Profile mismatch");const c=l(s)&&l(n),u=a.level,d=o.level,p=function(e,t){return 0===e?t!==i&&0!==t:0===t?e!==i:e<t}(h=u,m=d)?h:m;var h,m;const f=c?u:p;return t("generateProfileLevelIdForAnswer() | result: [profile:%s, level:%s]",a.profile,f),e.profileLevelIdToString(new r(a.profile,f))}}}),require_lib2=__commonJS({"../../submodules/mediasoup/node_modules/awaitqueue/lib/index.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});e.AwaitQueue=class{constructor({ClosedErrorClass:e=Error,StoppedErrorClass:t=Error,RemovedTaskErrorClass:i=Error}={ClosedErrorClass:Error,StoppedErrorClass:Error,RemovedTaskErrorClass:Error}){this.closed=!1,this.pendingTasks=[],this.ClosedErrorClass=Error,this.StoppedErrorClass=Error,this.RemovedTaskErrorClass=Error,this.ClosedErrorClass=e,this.StoppedErrorClass=t,this.RemovedTaskErrorClass=i}get size(){return this.pendingTasks.length}close(){if(!this.closed){this.closed=!0;for(const e of this.pendingTasks)e.stopped=!0,e.reject(new this.ClosedErrorClass("AwaitQueue closed"));this.pendingTasks.length=0}}push(e,i){return t(this,void 0,void 0,(function*(){if(this.closed)throw new this.ClosedErrorClass("AwaitQueue closed");if("function"!=typeof e)throw new TypeError("given task is not a function");if(!e.name&&i)try{Object.defineProperty(e,"name",{value:i})}catch(e){}return new Promise(((t,r)=>{const s={task:e,name:i,resolve:t,reject:r,stopped:!1,enqueuedAt:new Date,executedAt:void 0};this.pendingTasks.push(s),1===this.pendingTasks.length&&this.next()}))}))}removeTask(e){if(0===e)throw new TypeError("cannot remove task with index 0");const t=this.pendingTasks[e];t&&(this.pendingTasks.splice(e,1),t.reject(new this.RemovedTaskErrorClass("task removed from the queue")))}stop(){if(!this.closed){for(const e of this.pendingTasks)e.stopped=!0,e.reject(new this.StoppedErrorClass("AwaitQueue stopped"));this.pendingTasks.length=0}}dump(){const e=new Date;let t=0;return this.pendingTasks.map((i=>({idx:t++,task:i.task,name:i.name,enqueuedTime:i.executedAt?i.executedAt.getTime()-i.enqueuedAt.getTime():e.getTime()-i.enqueuedAt.getTime(),executingTime:i.executedAt?e.getTime()-i.executedAt.getTime():0})))}next(){return t(this,void 0,void 0,(function*(){const e=this.pendingTasks[0];e&&(yield this.executeTask(e),this.pendingTasks.shift(),this.next())}))}executeTask(e){return t(this,void 0,void 0,(function*(){if(!e.stopped){e.executedAt=new Date;try{const t=yield e.task();if(e.stopped)return;e.resolve(t)}catch(t){if(e.stopped)return;e.reject(t)}}}))}}}}),require_grammar2=__commonJS({"../../submodules/mediasoup/node_modules/sdp-transform/lib/grammar.js"(e,t){var i=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(i).forEach((function(e){i[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))}}),require_parser2=__commonJS({"../../submodules/mediasoup/node_modules/sdp-transform/lib/parser.js"(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var s=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:s&&!i[e.name]&&(i[e.name]={});var n=e.push?{}:s?i[e.name]:i;!function(e,i,r,s){if(s&&!r)i[s]=t(e[1]);else for(var n=0;n<r.length;n+=1)null!=e[n+1]&&(i[r[n]]=t(e[n+1]))}(r.match(e.reg),n,e.names,e.name),e.push&&i[e.push].push(n)},r=require_grammar2(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},n=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),a=n[n.length-1]);for(var o=0;o<(r[t]||[]).length;o+=1){var c=r[t][o];if(c.reg.test(s))return i(c,a,s)}})),t.media=n,t};var n=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(n,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),s=0;s<r.length;s+=3)i.push({component:r[s],ip:r[s+1],port:r[s+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(n,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}}),require_writer2=__commonJS({"../../submodules/mediasoup/node_modules/sdp-transform/lib/writer.js"(e,t){var i=require_grammar2(),r=/%[sdv%]/g,s=function(e){var t=1,i=arguments,s=i.length;return e.replace(r,(function(e){if(t>=s)return e;var r=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}}))},n=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var a=t.names[n];t.name?r.push(i[t.name][a]):r.push(i[t.names[n]])}else r.push(i[t.name]);return s.apply(null,r)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],o=["i","c","b","a"];t.exports=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||a,s=t.innerOrder||o,c=[];return r.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(n(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(n(t,i,e))}))}))})),e.media.forEach((function(e){c.push(n("m",i.m[0],e)),s.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(n(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(n(t,i,e))}))}))}))})),c.join("\r\n")+"\r\n"}}}),require_lib3=__commonJS({"../../submodules/mediasoup/node_modules/sdp-transform/lib/index.js"(e){var t=require_parser2(),i=require_writer2();e.write=i,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList}}),require_jspack=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/jspack/jspack.js"(e){e.jspack=new function(){var e,t=!1,i=this;i._DeArray=function(e,t,i){return[e.slice(t,t+i)]},i._EnArray=function(e,t,i,r){for(var s=0;s<i;e[t+s]=r[s]?r[s]:0,s++);},i._DeChar=function(e,t){return String.fromCharCode(e[t])},i._EnChar=function(e,t,i){e[t]=i.charCodeAt(0)},i._DeInt=function(i,r){var s,n,a,o=t?e.len-1:0,c=t?-1:1,l=o+c*e.len;for(s=0,n=o,a=1;n!=l;s+=i[r+n]*a,n+=c,a*=256);return e.bSigned&&s&Math.pow(2,8*e.len-1)&&(s-=Math.pow(2,8*e.len)),s},i._EnInt=function(i,r,s){var n,a=t?e.len-1:0,o=t?-1:1,c=a+o*e.len;for(s=s<e.min?e.min:s>e.max?e.max:s,n=a;n!=c;i[r+n]=255&s,n+=o,s>>=8);},i._DeString=function(e,t,i){for(var r=new Array(i),s=0;s<i;r[s]=String.fromCharCode(e[t+s]),s++);return r.join("")},i._EnString=function(e,t,i,r){for(var s,n=0;n<i;e[t+n]=(s=r.charCodeAt(n))?s:0,n++);},i._De754=function(i,r){var s,n,a,o,c,l,u,d,p,h;for(u=e.mLen,p=(h=(1<<(d=8*e.len-e.mLen-1))-1)>>1,o=t?0:e.len-1,c=t?1:-1,s=i[r+o],o+=c,n=s&(1<<-(l=-7))-1,s>>=-l,l+=d;l>0;n=256*n+i[r+o],o+=c,l-=8);for(a=n&(1<<-l)-1,n>>=-l,l+=u;l>0;a=256*a+i[r+o],o+=c,l-=8);switch(n){case 0:n=1-p;break;case h:return a?NaN:1/0*(s?-1:1);default:a+=Math.pow(2,u),n-=p}return(s?-1:1)*a*Math.pow(2,n-u)},i._En754=function(i,r,s){var n,a,o,c,l,u,d,p,h,m;for(d=e.mLen,h=(m=(1<<(p=8*e.len-e.mLen-1))-1)>>1,n=s<0?1:0,s=Math.abs(s),isNaN(s)||s==1/0?(o=isNaN(s)?1:0,a=m):(a=Math.floor(Math.log(s)/Math.LN2),s*(u=Math.pow(2,-a))<1&&(a--,u*=2),(s+=a+h>=1?e.rt/u:e.rt*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=m?(o=0,a=m):a+h>=1?(o=(s*u-1)*Math.pow(2,d),a+=h):(o=s*Math.pow(2,h-1)*Math.pow(2,d),a=0)),c=t?e.len-1:0,l=t?-1:1;d>=8;i[r+c]=255&o,c+=l,o/=256,d-=8);for(a=a<<d|o,p+=d;p>0;i[r+c]=255&a,c+=l,a/=256,p-=8);i[r+c-l]|=128*n},i._DeInt64=function(i,r){var s,n,a,o=t?0:7,c=t?1:-1,l=o+8*c,u=[0,0,!e.bSigned];for(s=o,a=1,n=0;s!=l;u[a]=(u[a]<<8>>>0)+i[r+s],s+=c,a=++n<4?1:0);return u},i._EnInt64=function(e,i,r){var s,n,a,o,c=t?0:7,l=t?1:-1,u=c+8*l;for(s=c,a=1,n=0,o=24;s!=u;e[i+s]=r[a]>>o&255,s+=l,a=++n<4?1:0,o=24-n%4*8);},i._sPattern="(\\d + )?([AxcbBhHsfdiIlLqQ])",i._lenLut={A:1,x:1,c:1,b:1,B:1,h:2,H:2,s:1,f:4,d:8,i:4,I:4,l:4,L:4,q:8,Q:8},i._elLut={A:{en:i._EnArray,de:i._DeArray},s:{en:i._EnString,de:i._DeString},c:{en:i._EnChar,de:i._DeChar},b:{en:i._EnInt,de:i._DeInt,len:1,bSigned:!0,min:-Math.pow(2,7),max:Math.pow(2,7)-1},B:{en:i._EnInt,de:i._DeInt,len:1,bSigned:!1,min:0,max:Math.pow(2,8)-1},h:{en:i._EnInt,de:i._DeInt,len:2,bSigned:!0,min:-Math.pow(2,15),max:Math.pow(2,15)-1},H:{en:i._EnInt,de:i._DeInt,len:2,bSigned:!1,min:0,max:Math.pow(2,16)-1},i:{en:i._EnInt,de:i._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},I:{en:i._EnInt,de:i._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},l:{en:i._EnInt,de:i._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},L:{en:i._EnInt,de:i._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},f:{en:i._En754,de:i._De754,len:4,mLen:23,rt:Math.pow(2,-24)-Math.pow(2,-77)},d:{en:i._En754,de:i._De754,len:8,mLen:52,rt:0},q:{en:i._EnInt64,de:i._DeInt64,bSigned:!0},Q:{en:i._EnInt64,de:i._DeInt64,bSigned:!1}},i._UnpackSeries=function(t,i,r,s){for(var n=e.de,a=[],o=0;o<t;a.push(n(r,s+o*i)),o++);return a},i._PackSeries=function(t,i,r,s,n,a){for(var o=e.en,c=0;c<t;o(r,s+c*i,n[a+c]),c++);},i.Unpack=function(i,r,s){t="<"!=i.charAt(0),s=s||0;for(var n,a,o,c=new RegExp(this._sPattern,"g"),l=[];n=c.exec(i);){if(s+(a=null==n[1]||""==n[1]?1:parseInt(n[1]))*(o=this._lenLut[n[2]])>r.length)return;switch(n[2]){case"A":case"s":l.push(this._elLut[n[2]].de(r,s,a));break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":e=this._elLut[n[2]],l.push(this._UnpackSeries(a,o,r,s))}s+=a*o}return Array.prototype.concat.apply([],l)},i.PackTo=function(i,r,s,n){t="<"!=i.charAt(0);for(var a,o,c,l,u=new RegExp(this._sPattern,"g"),d=0;a=u.exec(i);){if(s+(o=null==a[1]||""==a[1]?1:parseInt(a[1]))*(c=this._lenLut[a[2]])>r.length)return!1;switch(a[2]){case"A":case"s":if(d+1>n.length)return!1;this._elLut[a[2]].en(r,s,o,n[d]),d+=1;break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":if(e=this._elLut[a[2]],d+o>n.length)return!1;this._PackSeries(o,c,r,s,n,d),d+=o;break;case"x":for(l=0;l<o;l++)r[s+l]=0}s+=o*c}return r},i.Pack=function(e,t){return this.PackTo(e,new Array(this.CalcLength(e)),0,t)},i.CalcLength=function(e){for(var t,i=new RegExp(this._sPattern,"g"),r=0;t=i.exec(e);)r+=(null==t[1]||""==t[1]?1:parseInt(t[1]))*this._lenLut[t[2]];return r}}}}),require_ms3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/ms/index.js"(e,t){var i=1e3,r=60*i,s=60*r,n=24*s,a=7*n,o=365.25*n;function c(e,t,i,r){var s=t>=1.5*i;return Math.round(e/i)+" "+r+(s?"s":"")}t.exports=function(e,t){t=t||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var c=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*a;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=n)return c(e,t,n,"day");if(t>=s)return c(e,t,s,"hour");if(t>=r)return c(e,t,r,"minute");if(t>=i)return c(e,t,i,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=n)return Math.round(e/n)+"d";if(t>=s)return Math.round(e/s)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=i)return Math.round(e/i)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),require_common3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let r,s,n,a=null;function o(...e){if(!o.enabled)return;const i=o,s=Number(new Date),n=s-(r||s);i.diff=n,i.prev=r,i.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const n=t.formatters[s];if("function"==typeof n){const t=e[a];r=n.call(i,t),e.splice(a,1),a--}return r})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=i,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,n=t.enabled(e)),n),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function i(e,i){const r=t(this.namespace+(void 0===i?":":i)+e);return r.log=this.log,r}function r(e,t){let i=0,r=0,s=-1,n=0;for(;i<e.length;)if(r<t.length&&(t[r]===e[i]||"*"===t[r]))"*"===t[r]?(s=r,n=i,r++):(i++,r++);else{if(-1===s)return!1;r=s+1,n++,i=n}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of i)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const i of t.skips)if(r(e,i))return!1;for(const i of t.names)if(r(e,i))return!0;return!1},t.humanize=require_ms3(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((i=>{t[i]=e[i]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let i=0;for(let t=0;t<e.length;t++)i=(i<<5)-i+e.charCodeAt(t),i|=0;return t.colors[Math.abs(i)%t.colors.length]},t.enable(t.load()),t}}}),require_browser3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;e.splice(1,0,i,"color: inherit");let r=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),e.splice(s,0,i)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=require_common3()(e);var{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}}),require_has_flag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/has-flag/index.js"(e,t){"use strict";t.exports=(e,t=process.argv)=>{const i=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(i+e),s=t.indexOf("--");return-1!==r&&(-1===s||r<s)}}}),require_supports_color=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/supports-color/index.js"(e,t){"use strict";var i,r=require("os"),s=require("tty"),n=require_has_flag(),{env:a}=process;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function c(e,t){if(0===i)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(e&&!t&&void 0===i)return 0;const s=i||0;if("dumb"===a.TERM)return s;if("win32"===process.platform){const e=r.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in a)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in a))||"codeship"===a.CI_NAME?1:s;if("TEAMCITY_VERSION"in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if("truecolor"===a.COLORTERM)return 3;if("TERM_PROGRAM"in a){const e=parseInt((a.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(a.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||"COLORTERM"in a?1:s}n("no-color")||n("no-colors")||n("color=false")||n("color=never")?i=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(i=1),"FORCE_COLOR"in a&&(i="true"===a.FORCE_COLOR?1:"false"===a.FORCE_COLOR?0:0===a.FORCE_COLOR.length?1:Math.min(parseInt(a.FORCE_COLOR,10),3)),t.exports={supportsColor:function(e){return o(c(e,e&&e.isTTY))},stdout:o(c(!0,s.isatty(1))),stderr:o(c(!0,s.isatty(2)))}}}),require_node3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/debug/src/node.js"(e,t){var i=require("tty"),r=require("util");e.init=function(t){t.inspectOpts={};const i=Object.keys(e.inspectOpts);for(let r=0;r<i.length;r++)t.inspectOpts[i[r]]=e.inspectOpts[i[r]]},e.log=function(...t){return process.stderr.write(r.formatWithOptions(e.inspectOpts,...t)+"\n")},e.formatArgs=function(i){const{namespace:r,useColors:s}=this;if(s){const e=this.color,s="[3"+(e<8?e:"8;5;"+e),n=`  ${s};1m${r} [0m`;i[0]=n+i[0].split("\n").join("\n"+n),i.push(s+"m+"+t.exports.humanize(this.diff)+"[0m")}else i[0]=function(){if(e.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+r+" "+i[0]},e.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},e.load=function(){return process.env.DEBUG},e.useColors=function(){return"colors"in e.inspectOpts?Boolean(e.inspectOpts.colors):i.isatty(process.stderr.fd)},e.destroy=r.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{const t=require_supports_color();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}e.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const i=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[i]=r,e}),{}),t.exports=require_common3()(e);var{formatters:s}=t.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}}),require_src3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/debug/src/index.js"(e,t){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?t.exports=require_browser3():t.exports=require_node3()}}),require_common4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/x509/build/common.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require("net");e.bytesFromIP=function(e){switch(t.isIP(e)){case 4:return Buffer.from(e.split(".").map((e=>parseInt(e,10))));case 6:const t=e.split(":"),i=Buffer.alloc(16);let r=0;""===t[t.length-1]&&(t[t.length-1]="0");for(let e=0;e<t.length;e++)""!==t[e]?(i.writeUInt16BE(parseInt(t[e],16),r),r+=2):e+1<t.length&&""!==t[e+1]&&(r=16-2*(t.length-e-1));return i;default:return null}},e.bytesToIP=function(e){switch(e.length){case 4:return[e[0],e[1],e[2],e[3]].join(".");case 16:const t=[];let i=-1,r=0,s=-1,n=0;for(let a=0;a<e.length;a+=2){const o=e[a]<<8|e[a+1];0===o?(r++,-1===i&&(i=t.length),r>n&&(n=r,s=i)):(i=-1,r=0),t.push(o.toString(16))}if(n>0){let e="";const i=t.slice(s+n);t.length=s,0===t.length&&(e+=":"),0===i.length&&(e+=":"),t.push(e,...i)}return t.join(":");default:return""}};var i=Object.create(null),r=/^[0-9.]+$/;function s(e,t){i[e]=t,i[t]=e}e.getOID=function(e){return r.test(e)&&""!==i[e]?e:null==i[e]?"":i[e]},e.getOIDName=function(e){return r.test(e)||""===i[e]?null==i[e]?e:i[e]:e},s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRsaEncryption"),s("1.2.840.113549.1.1.5","sha1WithRsaEncryption"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRsaEncryption"),s("1.2.840.113549.1.1.12","sha384WithRsaEncryption"),s("1.2.840.113549.1.1.13","sha512WithRsaEncryption"),s("1.2.840.10045.2.1","ecEncryption"),s("1.2.840.10045.4.1","ecdsaWithSha1"),s("1.2.840.10045.4.3.2","ecdsaWithSha256"),s("1.2.840.10045.4.3.3","ecdsaWithSha384"),s("1.2.840.10045.4.3.4","ecdsaWithSha512"),s("1.2.840.10040.4.3","dsaWithSha1"),s("2.16.840.1.101.3.4.3.2","dsaWithSha256"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("1.2.840.113549.2.5","md5"),s("1.3.101.110","X25519"),s("1.3.101.111","X448"),s("1.3.101.112","Ed25519"),s("1.3.101.113","Ed448"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.2.7","hmacWithSha1"),s("1.2.840.113549.2.9","hmacWithSha256"),s("1.2.840.113549.2.10","hmacWithSha384"),s("1.2.840.113549.2.11","hmacWithSha512"),s("1.2.840.113549.3.7","3desCBC"),s("2.16.840.1.101.3.4.1.2","aesCBC128"),s("2.16.840.1.101.3.4.1.42","aesCBC256"),s("2.5.4.3","commonName"),s("2.5.4.5","serialName"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.15","businessCategory"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.5.29.2","keyAttributes"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionST"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionC"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping"),s("1.3.6.1.5.5.7.48.1","authorityInfoAccessOcsp"),s("1.3.6.1.5.5.7.48.2","authorityInfoAccessIssuers")}}),require_nacl_fast=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tweetnacl/nacl-fast.js"(e,t){!function(e){"use strict";var t=function(e){var t,i=new Float64Array(16);if(e)for(t=0;t<e.length;t++)i[t]=e[t];return i},i=function(){throw new Error("no PRNG")},r=new Uint8Array(16),s=new Uint8Array(32);s[0]=9;var n=t(),a=t([1]),o=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t,i,r){e[t]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function m(e,t,i,r,s){var n,a=0;for(n=0;n<s;n++)a|=e[t+n]^i[r+n];return(1&a-1>>>8)-1}function f(e,t,i,r){return m(e,t,i,r,16)}function g(e,t,i,r){return m(e,t,i,r,32)}function _(e,t,i,r){!function(e,t,i,r){for(var s,n=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,o=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,c=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,l=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,m=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,g=255&i[16]|(255&i[17])<<8|(255&i[18])<<16|(255&i[19])<<24,_=255&i[20]|(255&i[21])<<8|(255&i[22])<<16|(255&i[23])<<24,y=255&i[24]|(255&i[25])<<8|(255&i[26])<<16|(255&i[27])<<24,b=255&i[28]|(255&i[29])<<8|(255&i[30])<<16|(255&i[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,x=n,S=a,w=o,E=c,C=l,A=u,T=d,P=p,I=h,k=m,R=f,F=g,B=_,O=y,N=b,D=v,j=0;j<20;j+=2)x^=(s=(B^=(s=(I^=(s=(C^=(s=x+B|0)<<7|s>>>25)+x|0)<<9|s>>>23)+C|0)<<13|s>>>19)+I|0)<<18|s>>>14,A^=(s=(S^=(s=(O^=(s=(k^=(s=A+S|0)<<7|s>>>25)+A|0)<<9|s>>>23)+k|0)<<13|s>>>19)+O|0)<<18|s>>>14,R^=(s=(T^=(s=(w^=(s=(N^=(s=R+T|0)<<7|s>>>25)+R|0)<<9|s>>>23)+N|0)<<13|s>>>19)+w|0)<<18|s>>>14,D^=(s=(F^=(s=(P^=(s=(E^=(s=D+F|0)<<7|s>>>25)+D|0)<<9|s>>>23)+E|0)<<13|s>>>19)+P|0)<<18|s>>>14,x^=(s=(E^=(s=(w^=(s=(S^=(s=x+E|0)<<7|s>>>25)+x|0)<<9|s>>>23)+S|0)<<13|s>>>19)+w|0)<<18|s>>>14,A^=(s=(C^=(s=(P^=(s=(T^=(s=A+C|0)<<7|s>>>25)+A|0)<<9|s>>>23)+T|0)<<13|s>>>19)+P|0)<<18|s>>>14,R^=(s=(k^=(s=(I^=(s=(F^=(s=R+k|0)<<7|s>>>25)+R|0)<<9|s>>>23)+F|0)<<13|s>>>19)+I|0)<<18|s>>>14,D^=(s=(N^=(s=(O^=(s=(B^=(s=D+N|0)<<7|s>>>25)+D|0)<<9|s>>>23)+B|0)<<13|s>>>19)+O|0)<<18|s>>>14;x=x+n|0,S=S+a|0,w=w+o|0,E=E+c|0,C=C+l|0,A=A+u|0,T=T+d|0,P=P+p|0,I=I+h|0,k=k+m|0,R=R+f|0,F=F+g|0,B=B+_|0,O=O+y|0,N=N+b|0,D=D+v|0,e[0]=x>>>0&255,e[1]=x>>>8&255,e[2]=x>>>16&255,e[3]=x>>>24&255,e[4]=S>>>0&255,e[5]=S>>>8&255,e[6]=S>>>16&255,e[7]=S>>>24&255,e[8]=w>>>0&255,e[9]=w>>>8&255,e[10]=w>>>16&255,e[11]=w>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=P>>>0&255,e[29]=P>>>8&255,e[30]=P>>>16&255,e[31]=P>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=k>>>0&255,e[37]=k>>>8&255,e[38]=k>>>16&255,e[39]=k>>>24&255,e[40]=R>>>0&255,e[41]=R>>>8&255,e[42]=R>>>16&255,e[43]=R>>>24&255,e[44]=F>>>0&255,e[45]=F>>>8&255,e[46]=F>>>16&255,e[47]=F>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=N>>>0&255,e[57]=N>>>8&255,e[58]=N>>>16&255,e[59]=N>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}(e,t,i,r)}function y(e,t,i,r){!function(e,t,i,r){for(var s,n=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,o=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,c=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,l=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,m=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,g=255&i[16]|(255&i[17])<<8|(255&i[18])<<16|(255&i[19])<<24,_=255&i[20]|(255&i[21])<<8|(255&i[22])<<16|(255&i[23])<<24,y=255&i[24]|(255&i[25])<<8|(255&i[26])<<16|(255&i[27])<<24,b=255&i[28]|(255&i[29])<<8|(255&i[30])<<16|(255&i[31])<<24,v=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,x=0;x<20;x+=2)n^=(s=(_^=(s=(h^=(s=(l^=(s=n+_|0)<<7|s>>>25)+n|0)<<9|s>>>23)+l|0)<<13|s>>>19)+h|0)<<18|s>>>14,u^=(s=(a^=(s=(y^=(s=(m^=(s=u+a|0)<<7|s>>>25)+u|0)<<9|s>>>23)+m|0)<<13|s>>>19)+y|0)<<18|s>>>14,f^=(s=(d^=(s=(o^=(s=(b^=(s=f+d|0)<<7|s>>>25)+f|0)<<9|s>>>23)+b|0)<<13|s>>>19)+o|0)<<18|s>>>14,v^=(s=(g^=(s=(p^=(s=(c^=(s=v+g|0)<<7|s>>>25)+v|0)<<9|s>>>23)+c|0)<<13|s>>>19)+p|0)<<18|s>>>14,n^=(s=(c^=(s=(o^=(s=(a^=(s=n+c|0)<<7|s>>>25)+n|0)<<9|s>>>23)+a|0)<<13|s>>>19)+o|0)<<18|s>>>14,u^=(s=(l^=(s=(p^=(s=(d^=(s=u+l|0)<<7|s>>>25)+u|0)<<9|s>>>23)+d|0)<<13|s>>>19)+p|0)<<18|s>>>14,f^=(s=(m^=(s=(h^=(s=(g^=(s=f+m|0)<<7|s>>>25)+f|0)<<9|s>>>23)+g|0)<<13|s>>>19)+h|0)<<18|s>>>14,v^=(s=(b^=(s=(y^=(s=(_^=(s=v+b|0)<<7|s>>>25)+v|0)<<9|s>>>23)+_|0)<<13|s>>>19)+y|0)<<18|s>>>14;e[0]=n>>>0&255,e[1]=n>>>8&255,e[2]=n>>>16&255,e[3]=n>>>24&255,e[4]=u>>>0&255,e[5]=u>>>8&255,e[6]=u>>>16&255,e[7]=u>>>24&255,e[8]=f>>>0&255,e[9]=f>>>8&255,e[10]=f>>>16&255,e[11]=f>>>24&255,e[12]=v>>>0&255,e[13]=v>>>8&255,e[14]=v>>>16&255,e[15]=v>>>24&255,e[16]=d>>>0&255,e[17]=d>>>8&255,e[18]=d>>>16&255,e[19]=d>>>24&255,e[20]=p>>>0&255,e[21]=p>>>8&255,e[22]=p>>>16&255,e[23]=p>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=m>>>0&255,e[29]=m>>>8&255,e[30]=m>>>16&255,e[31]=m>>>24&255}(e,t,i,r)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function v(e,t,i,r,s,n,a){var o,c,l=new Uint8Array(16),u=new Uint8Array(64);for(c=0;c<16;c++)l[c]=0;for(c=0;c<8;c++)l[c]=n[c];for(;s>=64;){for(_(u,l,a,b),c=0;c<64;c++)e[t+c]=i[r+c]^u[c];for(o=1,c=8;c<16;c++)o=o+(255&l[c])|0,l[c]=255&o,o>>>=8;s-=64,t+=64,r+=64}if(s>0)for(_(u,l,a,b),c=0;c<s;c++)e[t+c]=i[r+c]^u[c];return 0}function x(e,t,i,r,s){var n,a,o=new Uint8Array(16),c=new Uint8Array(64);for(a=0;a<16;a++)o[a]=0;for(a=0;a<8;a++)o[a]=r[a];for(;i>=64;){for(_(c,o,s,b),a=0;a<64;a++)e[t+a]=c[a];for(n=1,a=8;a<16;a++)n=n+(255&o[a])|0,o[a]=255&n,n>>>=8;i-=64,t+=64}if(i>0)for(_(c,o,s,b),a=0;a<i;a++)e[t+a]=c[a];return 0}function S(e,t,i,r,s){var n=new Uint8Array(32);y(n,r,s,b);for(var a=new Uint8Array(8),o=0;o<8;o++)a[o]=r[o+16];return x(e,t,i,a,n)}function w(e,t,i,r,s,n,a){var o=new Uint8Array(32);y(o,n,a,b);for(var c=new Uint8Array(8),l=0;l<8;l++)c[l]=n[l+16];return v(e,t,i,r,s,c,o)}var E=function(e){var t,i,r,s,n,a,o,c;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,i=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|i<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(i>>>10|r<<6),s=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|s<<9),n=255&e[8]|(255&e[9])<<8,this.r[4]=255&(s>>>4|n<<12),this.r[5]=n>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(n>>>14|a<<2),o=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|o<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(o>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function C(e,t,i,r,s,n){var a=new E(n);return a.update(i,r,s),a.finish(e,t),0}function A(e,t,i,r,s,n){var a=new Uint8Array(16);return C(a,0,i,r,s,n),f(e,t,a,0)}function T(e,t,i,r,s){var n;if(i<32)return-1;for(w(e,0,t,0,i,r,s),C(e,16,e,32,i-32,e),n=0;n<16;n++)e[n]=0;return 0}function P(e,t,i,r,s){var n,a=new Uint8Array(32);if(i<32)return-1;if(S(a,0,32,r,s),0!==A(t,16,t,32,i-32,a))return-1;for(w(e,0,t,0,i,r,s),n=0;n<32;n++)e[n]=0;return 0}function I(e,t){var i;for(i=0;i<16;i++)e[i]=0|t[i]}function k(e){var t,i,r=1;for(t=0;t<16;t++)i=e[t]+r+65535,r=Math.floor(i/65536),e[t]=i-65536*r;e[0]+=r-1+37*(r-1)}function R(e,t,i){for(var r,s=~(i-1),n=0;n<16;n++)r=s&(e[n]^t[n]),e[n]^=r,t[n]^=r}function F(e,i){var r,s,n,a=t(),o=t();for(r=0;r<16;r++)o[r]=i[r];for(k(o),k(o),k(o),s=0;s<2;s++){for(a[0]=o[0]-65517,r=1;r<15;r++)a[r]=o[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=o[15]-32767-(a[14]>>16&1),n=a[15]>>16&1,a[14]&=65535,R(o,a,1-n)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function B(e,t){var i=new Uint8Array(32),r=new Uint8Array(32);return F(i,e),F(r,t),g(i,0,r,0)}function O(e){var t=new Uint8Array(32);return F(t,e),1&t[0]}function N(e,t){var i;for(i=0;i<16;i++)e[i]=t[2*i]+(t[2*i+1]<<8);e[15]&=32767}function D(e,t,i){for(var r=0;r<16;r++)e[r]=t[r]+i[r]}function j(e,t,i){for(var r=0;r<16;r++)e[r]=t[r]-i[r]}function L(e,t,i){var r,s,n=0,a=0,o=0,c=0,l=0,u=0,d=0,p=0,h=0,m=0,f=0,g=0,_=0,y=0,b=0,v=0,x=0,S=0,w=0,E=0,C=0,A=0,T=0,P=0,I=0,k=0,R=0,F=0,B=0,O=0,N=0,D=i[0],j=i[1],L=i[2],U=i[3],M=i[4],q=i[5],H=i[6],z=i[7],V=i[8],K=i[9],G=i[10],W=i[11],J=i[12],$=i[13],Z=i[14],Y=i[15];n+=(r=t[0])*D,a+=r*j,o+=r*L,c+=r*U,l+=r*M,u+=r*q,d+=r*H,p+=r*z,h+=r*V,m+=r*K,f+=r*G,g+=r*W,_+=r*J,y+=r*$,b+=r*Z,v+=r*Y,a+=(r=t[1])*D,o+=r*j,c+=r*L,l+=r*U,u+=r*M,d+=r*q,p+=r*H,h+=r*z,m+=r*V,f+=r*K,g+=r*G,_+=r*W,y+=r*J,b+=r*$,v+=r*Z,x+=r*Y,o+=(r=t[2])*D,c+=r*j,l+=r*L,u+=r*U,d+=r*M,p+=r*q,h+=r*H,m+=r*z,f+=r*V,g+=r*K,_+=r*G,y+=r*W,b+=r*J,v+=r*$,x+=r*Z,S+=r*Y,c+=(r=t[3])*D,l+=r*j,u+=r*L,d+=r*U,p+=r*M,h+=r*q,m+=r*H,f+=r*z,g+=r*V,_+=r*K,y+=r*G,b+=r*W,v+=r*J,x+=r*$,S+=r*Z,w+=r*Y,l+=(r=t[4])*D,u+=r*j,d+=r*L,p+=r*U,h+=r*M,m+=r*q,f+=r*H,g+=r*z,_+=r*V,y+=r*K,b+=r*G,v+=r*W,x+=r*J,S+=r*$,w+=r*Z,E+=r*Y,u+=(r=t[5])*D,d+=r*j,p+=r*L,h+=r*U,m+=r*M,f+=r*q,g+=r*H,_+=r*z,y+=r*V,b+=r*K,v+=r*G,x+=r*W,S+=r*J,w+=r*$,E+=r*Z,C+=r*Y,d+=(r=t[6])*D,p+=r*j,h+=r*L,m+=r*U,f+=r*M,g+=r*q,_+=r*H,y+=r*z,b+=r*V,v+=r*K,x+=r*G,S+=r*W,w+=r*J,E+=r*$,C+=r*Z,A+=r*Y,p+=(r=t[7])*D,h+=r*j,m+=r*L,f+=r*U,g+=r*M,_+=r*q,y+=r*H,b+=r*z,v+=r*V,x+=r*K,S+=r*G,w+=r*W,E+=r*J,C+=r*$,A+=r*Z,T+=r*Y,h+=(r=t[8])*D,m+=r*j,f+=r*L,g+=r*U,_+=r*M,y+=r*q,b+=r*H,v+=r*z,x+=r*V,S+=r*K,w+=r*G,E+=r*W,C+=r*J,A+=r*$,T+=r*Z,P+=r*Y,m+=(r=t[9])*D,f+=r*j,g+=r*L,_+=r*U,y+=r*M,b+=r*q,v+=r*H,x+=r*z,S+=r*V,w+=r*K,E+=r*G,C+=r*W,A+=r*J,T+=r*$,P+=r*Z,I+=r*Y,f+=(r=t[10])*D,g+=r*j,_+=r*L,y+=r*U,b+=r*M,v+=r*q,x+=r*H,S+=r*z,w+=r*V,E+=r*K,C+=r*G,A+=r*W,T+=r*J,P+=r*$,I+=r*Z,k+=r*Y,g+=(r=t[11])*D,_+=r*j,y+=r*L,b+=r*U,v+=r*M,x+=r*q,S+=r*H,w+=r*z,E+=r*V,C+=r*K,A+=r*G,T+=r*W,P+=r*J,I+=r*$,k+=r*Z,R+=r*Y,_+=(r=t[12])*D,y+=r*j,b+=r*L,v+=r*U,x+=r*M,S+=r*q,w+=r*H,E+=r*z,C+=r*V,A+=r*K,T+=r*G,P+=r*W,I+=r*J,k+=r*$,R+=r*Z,F+=r*Y,y+=(r=t[13])*D,b+=r*j,v+=r*L,x+=r*U,S+=r*M,w+=r*q,E+=r*H,C+=r*z,A+=r*V,T+=r*K,P+=r*G,I+=r*W,k+=r*J,R+=r*$,F+=r*Z,B+=r*Y,b+=(r=t[14])*D,v+=r*j,x+=r*L,S+=r*U,w+=r*M,E+=r*q,C+=r*H,A+=r*z,T+=r*V,P+=r*K,I+=r*G,k+=r*W,R+=r*J,F+=r*$,B+=r*Z,O+=r*Y,v+=(r=t[15])*D,a+=38*(S+=r*L),o+=38*(w+=r*U),c+=38*(E+=r*M),l+=38*(C+=r*q),u+=38*(A+=r*H),d+=38*(T+=r*z),p+=38*(P+=r*V),h+=38*(I+=r*K),m+=38*(k+=r*G),f+=38*(R+=r*W),g+=38*(F+=r*J),_+=38*(B+=r*$),y+=38*(O+=r*Z),b+=38*(N+=r*Y),n=(r=(n+=38*(x+=r*j))+(s=1)+65535)-65536*(s=Math.floor(r/65536)),a=(r=a+s+65535)-65536*(s=Math.floor(r/65536)),o=(r=o+s+65535)-65536*(s=Math.floor(r/65536)),c=(r=c+s+65535)-65536*(s=Math.floor(r/65536)),l=(r=l+s+65535)-65536*(s=Math.floor(r/65536)),u=(r=u+s+65535)-65536*(s=Math.floor(r/65536)),d=(r=d+s+65535)-65536*(s=Math.floor(r/65536)),p=(r=p+s+65535)-65536*(s=Math.floor(r/65536)),h=(r=h+s+65535)-65536*(s=Math.floor(r/65536)),m=(r=m+s+65535)-65536*(s=Math.floor(r/65536)),f=(r=f+s+65535)-65536*(s=Math.floor(r/65536)),g=(r=g+s+65535)-65536*(s=Math.floor(r/65536)),_=(r=_+s+65535)-65536*(s=Math.floor(r/65536)),y=(r=y+s+65535)-65536*(s=Math.floor(r/65536)),b=(r=b+s+65535)-65536*(s=Math.floor(r/65536)),v=(r=v+s+65535)-65536*(s=Math.floor(r/65536)),n=(r=(n+=s-1+37*(s-1))+(s=1)+65535)-65536*(s=Math.floor(r/65536)),a=(r=a+s+65535)-65536*(s=Math.floor(r/65536)),o=(r=o+s+65535)-65536*(s=Math.floor(r/65536)),c=(r=c+s+65535)-65536*(s=Math.floor(r/65536)),l=(r=l+s+65535)-65536*(s=Math.floor(r/65536)),u=(r=u+s+65535)-65536*(s=Math.floor(r/65536)),d=(r=d+s+65535)-65536*(s=Math.floor(r/65536)),p=(r=p+s+65535)-65536*(s=Math.floor(r/65536)),h=(r=h+s+65535)-65536*(s=Math.floor(r/65536)),m=(r=m+s+65535)-65536*(s=Math.floor(r/65536)),f=(r=f+s+65535)-65536*(s=Math.floor(r/65536)),g=(r=g+s+65535)-65536*(s=Math.floor(r/65536)),_=(r=_+s+65535)-65536*(s=Math.floor(r/65536)),y=(r=y+s+65535)-65536*(s=Math.floor(r/65536)),b=(r=b+s+65535)-65536*(s=Math.floor(r/65536)),v=(r=v+s+65535)-65536*(s=Math.floor(r/65536)),n+=s-1+37*(s-1),e[0]=n,e[1]=a,e[2]=o,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=p,e[8]=h,e[9]=m,e[10]=f,e[11]=g,e[12]=_,e[13]=y,e[14]=b,e[15]=v}function U(e,t){L(e,t,t)}function M(e,i){var r,s=t();for(r=0;r<16;r++)s[r]=i[r];for(r=253;r>=0;r--)U(s,s),2!==r&&4!==r&&L(s,s,i);for(r=0;r<16;r++)e[r]=s[r]}function q(e,i){var r,s=t();for(r=0;r<16;r++)s[r]=i[r];for(r=250;r>=0;r--)U(s,s),1!==r&&L(s,s,i);for(r=0;r<16;r++)e[r]=s[r]}function H(e,i,r){var s,n,a=new Uint8Array(32),c=new Float64Array(80),l=t(),u=t(),d=t(),p=t(),h=t(),m=t();for(n=0;n<31;n++)a[n]=i[n];for(a[31]=127&i[31]|64,a[0]&=248,N(c,r),n=0;n<16;n++)u[n]=c[n],p[n]=l[n]=d[n]=0;for(l[0]=p[0]=1,n=254;n>=0;--n)R(l,u,s=a[n>>>3]>>>(7&n)&1),R(d,p,s),D(h,l,d),j(l,l,d),D(d,u,p),j(u,u,p),U(p,h),U(m,l),L(l,d,l),L(d,u,h),D(h,l,d),j(l,l,d),U(u,l),j(d,p,m),L(l,d,o),D(l,l,p),L(d,d,l),L(l,p,m),L(p,u,c),U(u,h),R(l,u,s),R(d,p,s);for(n=0;n<16;n++)c[n+16]=l[n],c[n+32]=d[n],c[n+48]=u[n],c[n+64]=p[n];var f=c.subarray(32),g=c.subarray(16);return M(f,f),L(g,g,f),F(e,g),0}function z(e,t){return H(e,t,s)}function V(e,t){return i(t,32),z(e,t)}function K(e,t,i){var s=new Uint8Array(32);return H(s,i,t),y(e,r,s,b)}E.prototype.blocks=function(e,t,i){for(var r,s,n,a,o,c,l,u,d,p,h,m,f,g,_,y,b,v,x,S=this.fin?0:2048,w=this.h[0],E=this.h[1],C=this.h[2],A=this.h[3],T=this.h[4],P=this.h[5],I=this.h[6],k=this.h[7],R=this.h[8],F=this.h[9],B=this.r[0],O=this.r[1],N=this.r[2],D=this.r[3],j=this.r[4],L=this.r[5],U=this.r[6],M=this.r[7],q=this.r[8],H=this.r[9];i>=16;)p=d=0,p+=(w+=8191&(r=255&e[t+0]|(255&e[t+1])<<8))*B,p+=(E+=8191&(r>>>13|(s=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*H),p+=(C+=8191&(s>>>10|(n=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*q),p+=(A+=8191&(n>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*M),d=(p+=(T+=8191&(a>>>4|(o=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*U))>>>13,p&=8191,p+=(P+=o>>>1&8191)*(5*L),p+=(I+=8191&(o>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*j),p+=(k+=8191&(c>>>11|(l=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*D),p+=(R+=8191&(l>>>8|(u=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*N),h=d+=(p+=(F+=u>>>5|S)*(5*O))>>>13,h+=w*O,h+=E*B,h+=C*(5*H),h+=A*(5*q),d=(h+=T*(5*M))>>>13,h&=8191,h+=P*(5*U),h+=I*(5*L),h+=k*(5*j),h+=R*(5*D),d+=(h+=F*(5*N))>>>13,h&=8191,m=d,m+=w*N,m+=E*O,m+=C*B,m+=A*(5*H),d=(m+=T*(5*q))>>>13,m&=8191,m+=P*(5*M),m+=I*(5*U),m+=k*(5*L),m+=R*(5*j),f=d+=(m+=F*(5*D))>>>13,f+=w*D,f+=E*N,f+=C*O,f+=A*B,d=(f+=T*(5*H))>>>13,f&=8191,f+=P*(5*q),f+=I*(5*M),f+=k*(5*U),f+=R*(5*L),g=d+=(f+=F*(5*j))>>>13,g+=w*j,g+=E*D,g+=C*N,g+=A*O,d=(g+=T*B)>>>13,g&=8191,g+=P*(5*H),g+=I*(5*q),g+=k*(5*M),g+=R*(5*U),_=d+=(g+=F*(5*L))>>>13,_+=w*L,_+=E*j,_+=C*D,_+=A*N,d=(_+=T*O)>>>13,_&=8191,_+=P*B,_+=I*(5*H),_+=k*(5*q),_+=R*(5*M),y=d+=(_+=F*(5*U))>>>13,y+=w*U,y+=E*L,y+=C*j,y+=A*D,d=(y+=T*N)>>>13,y&=8191,y+=P*O,y+=I*B,y+=k*(5*H),y+=R*(5*q),b=d+=(y+=F*(5*M))>>>13,b+=w*M,b+=E*U,b+=C*L,b+=A*j,d=(b+=T*D)>>>13,b&=8191,b+=P*N,b+=I*O,b+=k*B,b+=R*(5*H),v=d+=(b+=F*(5*q))>>>13,v+=w*q,v+=E*M,v+=C*U,v+=A*L,d=(v+=T*j)>>>13,v&=8191,v+=P*D,v+=I*N,v+=k*O,v+=R*B,x=d+=(v+=F*(5*H))>>>13,x+=w*H,x+=E*q,x+=C*M,x+=A*U,d=(x+=T*L)>>>13,x&=8191,x+=P*j,x+=I*D,x+=k*N,x+=R*O,w=p=8191&(d=(d=((d+=(x+=F*B)>>>13)<<2)+d|0)+(p&=8191)|0),E=h+=d>>>=13,C=m&=8191,A=f&=8191,T=g&=8191,P=_&=8191,I=y&=8191,k=b&=8191,R=v&=8191,F=x&=8191,t+=16,i-=16;this.h[0]=w,this.h[1]=E,this.h[2]=C,this.h[3]=A,this.h[4]=T,this.h[5]=P,this.h[6]=I,this.h[7]=k,this.h[8]=R,this.h[9]=F},E.prototype.finish=function(e,t){var i,r,s,n,a=new Uint16Array(10);if(this.leftover){for(n=this.leftover,this.buffer[n++]=1;n<16;n++)this.buffer[n]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,n=2;n<10;n++)this.h[n]+=i,i=this.h[n]>>>13,this.h[n]&=8191;for(this.h[0]+=5*i,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,a[0]=this.h[0]+5,i=a[0]>>>13,a[0]&=8191,n=1;n<10;n++)a[n]=this.h[n]+i,i=a[n]>>>13,a[n]&=8191;for(a[9]-=8192,r=(1^i)-1,n=0;n<10;n++)a[n]&=r;for(r=~r,n=0;n<10;n++)this.h[n]=this.h[n]&r|a[n];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),s=this.h[0]+this.pad[0],this.h[0]=65535&s,n=1;n<8;n++)s=(this.h[n]+this.pad[n]|0)+(s>>>16)|0,this.h[n]=65535&s;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},E.prototype.update=function(e,t,i){var r,s;if(this.leftover){for((s=16-this.leftover)>i&&(s=i),r=0;r<s;r++)this.buffer[this.leftover+r]=e[t+r];if(i-=s,t+=s,this.leftover+=s,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(i>=16&&(s=i-i%16,this.blocks(e,t,s),t+=s,i-=s),i){for(r=0;r<i;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=i}};var G=T,W=P;var J=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function $(e,t,i,r){for(var s,n,a,o,c,l,u,d,p,h,m,f,g,_,y,b,v,x,S,w,E,C,A,T,P,I,k=new Int32Array(16),R=new Int32Array(16),F=e[0],B=e[1],O=e[2],N=e[3],D=e[4],j=e[5],L=e[6],U=e[7],M=t[0],q=t[1],H=t[2],z=t[3],V=t[4],K=t[5],G=t[6],W=t[7],$=0;r>=128;){for(S=0;S<16;S++)w=8*S+$,k[S]=i[w+0]<<24|i[w+1]<<16|i[w+2]<<8|i[w+3],R[S]=i[w+4]<<24|i[w+5]<<16|i[w+6]<<8|i[w+7];for(S=0;S<80;S++)if(s=F,n=B,a=O,o=N,c=D,l=j,u=L,U,p=M,h=q,m=H,f=z,g=V,_=K,y=G,W,A=65535&(C=W),T=C>>>16,P=65535&(E=U),I=E>>>16,A+=65535&(C=(V>>>14|D<<18)^(V>>>18|D<<14)^(D>>>9|V<<23)),T+=C>>>16,P+=65535&(E=(D>>>14|V<<18)^(D>>>18|V<<14)^(V>>>9|D<<23)),I+=E>>>16,A+=65535&(C=V&K^~V&G),T+=C>>>16,P+=65535&(E=D&j^~D&L),I+=E>>>16,A+=65535&(C=J[2*S+1]),T+=C>>>16,P+=65535&(E=J[2*S]),I+=E>>>16,E=k[S%16],T+=(C=R[S%16])>>>16,P+=65535&E,I+=E>>>16,P+=(T+=(A+=65535&C)>>>16)>>>16,A=65535&(C=x=65535&A|T<<16),T=C>>>16,P=65535&(E=v=65535&P|(I+=P>>>16)<<16),I=E>>>16,A+=65535&(C=(M>>>28|F<<4)^(F>>>2|M<<30)^(F>>>7|M<<25)),T+=C>>>16,P+=65535&(E=(F>>>28|M<<4)^(M>>>2|F<<30)^(M>>>7|F<<25)),I+=E>>>16,T+=(C=M&q^M&H^q&H)>>>16,P+=65535&(E=F&B^F&O^B&O),I+=E>>>16,d=65535&(P+=(T+=(A+=65535&C)>>>16)>>>16)|(I+=P>>>16)<<16,b=65535&A|T<<16,A=65535&(C=f),T=C>>>16,P=65535&(E=o),I=E>>>16,T+=(C=x)>>>16,P+=65535&(E=v),I+=E>>>16,B=s,O=n,N=a,D=o=65535&(P+=(T+=(A+=65535&C)>>>16)>>>16)|(I+=P>>>16)<<16,j=c,L=l,U=u,F=d,q=p,H=h,z=m,V=f=65535&A|T<<16,K=g,G=_,W=y,M=b,S%16==15)for(w=0;w<16;w++)E=k[w],A=65535&(C=R[w]),T=C>>>16,P=65535&E,I=E>>>16,E=k[(w+9)%16],A+=65535&(C=R[(w+9)%16]),T+=C>>>16,P+=65535&E,I+=E>>>16,v=k[(w+1)%16],A+=65535&(C=((x=R[(w+1)%16])>>>1|v<<31)^(x>>>8|v<<24)^(x>>>7|v<<25)),T+=C>>>16,P+=65535&(E=(v>>>1|x<<31)^(v>>>8|x<<24)^v>>>7),I+=E>>>16,v=k[(w+14)%16],T+=(C=((x=R[(w+14)%16])>>>19|v<<13)^(v>>>29|x<<3)^(x>>>6|v<<26))>>>16,P+=65535&(E=(v>>>19|x<<13)^(x>>>29|v<<3)^v>>>6),I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,k[w]=65535&P|I<<16,R[w]=65535&A|T<<16;A=65535&(C=M),T=C>>>16,P=65535&(E=F),I=E>>>16,E=e[0],T+=(C=t[0])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[0]=F=65535&P|I<<16,t[0]=M=65535&A|T<<16,A=65535&(C=q),T=C>>>16,P=65535&(E=B),I=E>>>16,E=e[1],T+=(C=t[1])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[1]=B=65535&P|I<<16,t[1]=q=65535&A|T<<16,A=65535&(C=H),T=C>>>16,P=65535&(E=O),I=E>>>16,E=e[2],T+=(C=t[2])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[2]=O=65535&P|I<<16,t[2]=H=65535&A|T<<16,A=65535&(C=z),T=C>>>16,P=65535&(E=N),I=E>>>16,E=e[3],T+=(C=t[3])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[3]=N=65535&P|I<<16,t[3]=z=65535&A|T<<16,A=65535&(C=V),T=C>>>16,P=65535&(E=D),I=E>>>16,E=e[4],T+=(C=t[4])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[4]=D=65535&P|I<<16,t[4]=V=65535&A|T<<16,A=65535&(C=K),T=C>>>16,P=65535&(E=j),I=E>>>16,E=e[5],T+=(C=t[5])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[5]=j=65535&P|I<<16,t[5]=K=65535&A|T<<16,A=65535&(C=G),T=C>>>16,P=65535&(E=L),I=E>>>16,E=e[6],T+=(C=t[6])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[6]=L=65535&P|I<<16,t[6]=G=65535&A|T<<16,A=65535&(C=W),T=C>>>16,P=65535&(E=U),I=E>>>16,E=e[7],T+=(C=t[7])>>>16,P+=65535&E,I+=E>>>16,I+=(P+=(T+=(A+=65535&C)>>>16)>>>16)>>>16,e[7]=U=65535&P|I<<16,t[7]=W=65535&A|T<<16,$+=128,r-=128}return r}function Z(e,t,i){var r,s=new Int32Array(8),n=new Int32Array(8),a=new Uint8Array(256),o=i;for(s[0]=1779033703,s[1]=3144134277,s[2]=1013904242,s[3]=2773480762,s[4]=1359893119,s[5]=2600822924,s[6]=528734635,s[7]=1541459225,n[0]=4089235720,n[1]=2227873595,n[2]=4271175723,n[3]=1595750129,n[4]=2917565137,n[5]=725511199,n[6]=4215389547,n[7]=327033209,$(s,n,t,i),i%=128,r=0;r<i;r++)a[r]=t[o-i+r];for(a[i]=128,a[(i=256-128*(i<112?1:0))-9]=0,h(a,i-8,o/536870912|0,o<<3),$(s,n,a,i),r=0;r<8;r++)h(e,8*r,s[r],n[r]);return 0}function Y(e,i){var r=t(),s=t(),n=t(),a=t(),o=t(),c=t(),u=t(),d=t(),p=t();j(r,e[1],e[0]),j(p,i[1],i[0]),L(r,r,p),D(s,e[0],e[1]),D(p,i[0],i[1]),L(s,s,p),L(n,e[3],i[3]),L(n,n,l),L(a,e[2],i[2]),D(a,a,a),j(o,s,r),j(c,a,n),D(u,a,n),D(d,s,r),L(e[0],o,c),L(e[1],d,u),L(e[2],u,c),L(e[3],o,d)}function X(e,t,i){var r;for(r=0;r<4;r++)R(e[r],t[r],i)}function Q(e,i){var r=t(),s=t(),n=t();M(n,i[2]),L(r,i[0],n),L(s,i[1],n),F(e,s),e[31]^=O(r)<<7}function ee(e,t,i){var r,s;for(I(e[0],n),I(e[1],a),I(e[2],a),I(e[3],n),s=255;s>=0;--s)X(e,t,r=i[s/8|0]>>(7&s)&1),Y(t,e),Y(e,e),X(e,t,r)}function te(e,i){var r=[t(),t(),t(),t()];I(r[0],u),I(r[1],d),I(r[2],a),L(r[3],u,d),ee(e,r,i)}function ie(e,r,s){var n,a=new Uint8Array(64),o=[t(),t(),t(),t()];for(s||i(r,32),Z(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64,te(o,a),Q(e,o),n=0;n<32;n++)r[n+32]=e[n];return 0}var re=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function se(e,t){var i,r,s,n;for(r=63;r>=32;--r){for(i=0,s=r-32,n=r-12;s<n;++s)t[s]+=i-16*t[r]*re[s-(r-32)],i=Math.floor((t[s]+128)/256),t[s]-=256*i;t[s]+=i,t[r]=0}for(i=0,s=0;s<32;s++)t[s]+=i-(t[31]>>4)*re[s],i=t[s]>>8,t[s]&=255;for(s=0;s<32;s++)t[s]-=i*re[s];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ne(e){var t,i=new Float64Array(64);for(t=0;t<64;t++)i[t]=e[t];for(t=0;t<64;t++)e[t]=0;se(e,i)}function ae(e,i,r,s){var n,a,o=new Uint8Array(64),c=new Uint8Array(64),l=new Uint8Array(64),u=new Float64Array(64),d=[t(),t(),t(),t()];Z(o,s,32),o[0]&=248,o[31]&=127,o[31]|=64;var p=r+64;for(n=0;n<r;n++)e[64+n]=i[n];for(n=0;n<32;n++)e[32+n]=o[32+n];for(Z(l,e.subarray(32),r+32),ne(l),te(d,l),Q(e,d),n=32;n<64;n++)e[n]=s[n];for(Z(c,e,r+64),ne(c),n=0;n<64;n++)u[n]=0;for(n=0;n<32;n++)u[n]=l[n];for(n=0;n<32;n++)for(a=0;a<32;a++)u[n+a]+=c[n]*o[a];return se(e.subarray(32),u),p}function oe(e,i,r,s){var o,l=new Uint8Array(32),u=new Uint8Array(64),d=[t(),t(),t(),t()],h=[t(),t(),t(),t()];if(r<64)return-1;if(function(e,i){var r=t(),s=t(),o=t(),l=t(),u=t(),d=t(),h=t();return I(e[2],a),N(e[1],i),U(o,e[1]),L(l,o,c),j(o,o,e[2]),D(l,e[2],l),U(u,l),U(d,u),L(h,d,u),L(r,h,o),L(r,r,l),q(r,r),L(r,r,o),L(r,r,l),L(r,r,l),L(e[0],r,l),U(s,e[0]),L(s,s,l),B(s,o)&&L(e[0],e[0],p),U(s,e[0]),L(s,s,l),B(s,o)?-1:(O(e[0])===i[31]>>7&&j(e[0],n,e[0]),L(e[3],e[0],e[1]),0)}(h,s))return-1;for(o=0;o<r;o++)e[o]=i[o];for(o=0;o<32;o++)e[o+32]=s[o];if(Z(u,e,r),ne(u),ee(d,h,u),te(h,i.subarray(32)),Y(d,h),Q(l,d),r-=64,g(i,0,l,0)){for(o=0;o<r;o++)e[o]=0;return-1}for(o=0;o<r;o++)e[o]=i[o+64];return r}var ce=16,le=64,ue=32,de=64;function pe(e,t){if(32!==e.length)throw new Error("bad key size");if(24!==t.length)throw new Error("bad nonce size")}function he(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function me(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:y,crypto_stream_xor:w,crypto_stream:S,crypto_stream_salsa20_xor:v,crypto_stream_salsa20:x,crypto_onetimeauth:C,crypto_onetimeauth_verify:A,crypto_verify_16:f,crypto_verify_32:g,crypto_secretbox:T,crypto_secretbox_open:P,crypto_scalarmult:H,crypto_scalarmult_base:z,crypto_box_beforenm:K,crypto_box_afternm:G,crypto_box:function(e,t,i,r,s,n){var a=new Uint8Array(32);return K(a,s,n),G(e,t,i,r,a)},crypto_box_open:function(e,t,i,r,s,n){var a=new Uint8Array(32);return K(a,s,n),W(e,t,i,r,a)},crypto_box_keypair:V,crypto_hash:Z,crypto_sign:ae,crypto_sign_keypair:ie,crypto_sign_open:oe,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ce,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:le,crypto_sign_PUBLICKEYBYTES:ue,crypto_sign_SECRETKEYBYTES:de,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:c,L:re,pack25519:F,unpack25519:N,M:L,A:D,S:U,Z:j,pow2523:q,add:Y,set25519:I,modL:se,scalarmult:ee,scalarbase:te},e.randomBytes=function(e){var t=new Uint8Array(e);return i(t,e),t},e.secretbox=function(e,t,i){he(e,t,i),pe(i,t);for(var r=new Uint8Array(32+e.length),s=new Uint8Array(r.length),n=0;n<e.length;n++)r[n+32]=e[n];return T(s,r,r.length,t,i),s.subarray(ce)},e.secretbox.open=function(e,t,i){he(e,t,i),pe(i,t);for(var r=new Uint8Array(ce+e.length),s=new Uint8Array(r.length),n=0;n<e.length;n++)r[n+ce]=e[n];return r.length<32||0!==P(s,r,r.length,t,i)?null:s.subarray(32)},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=ce,e.scalarMult=function(e,t){if(he(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var i=new Uint8Array(32);return H(i,e,t),i},e.scalarMult.base=function(e){if(he(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return z(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,i,r,s){var n=e.box.before(r,s);return e.secretbox(t,i,n)},e.box.before=function(e,t){he(e,t),function(e,t){if(32!==e.length)throw new Error("bad public key size");if(32!==t.length)throw new Error("bad secret key size")}(e,t);var i=new Uint8Array(32);return K(i,e,t),i},e.box.after=e.secretbox,e.box.open=function(t,i,r,s){var n=e.box.before(r,s);return e.secretbox.open(t,i,n)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return V(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(he(e),32!==e.length)throw new Error("bad secret key size");var t=new Uint8Array(32);return z(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(he(e,t),t.length!==de)throw new Error("bad secret key size");var i=new Uint8Array(le+e.length);return ae(i,e,e.length,t),i},e.sign.open=function(e,t){if(he(e,t),t.length!==ue)throw new Error("bad public key size");var i=new Uint8Array(e.length),r=oe(i,e,e.length,t);if(r<0)return null;for(var s=new Uint8Array(r),n=0;n<s.length;n++)s[n]=i[n];return s},e.sign.detached=function(t,i){for(var r=e.sign(t,i),s=new Uint8Array(le),n=0;n<s.length;n++)s[n]=r[n];return s},e.sign.detached.verify=function(e,t,i){if(he(e,t,i),t.length!==le)throw new Error("bad signature size");if(i.length!==ue)throw new Error("bad public key size");var r,s=new Uint8Array(le+e.length),n=new Uint8Array(le+e.length);for(r=0;r<le;r++)s[r]=t[r];for(r=0;r<e.length;r++)s[r+le]=e[r];return oe(n,s,s.length,i)>=0},e.sign.keyPair=function(){var e=new Uint8Array(ue),t=new Uint8Array(de);return ie(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(he(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(ue),i=0;i<t.length;i++)t[i]=e[32+i];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(he(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(ue),i=new Uint8Array(de),r=0;r<32;r++)i[r]=e[r];return ie(t,i,!0),{publicKey:t,secretKey:i}},e.sign.publicKeyLength=ue,e.sign.secretKeyLength=de,e.sign.seedLength=32,e.sign.signatureLength=le,e.hash=function(e){he(e);var t=new Uint8Array(64);return Z(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return he(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===m(e,0,t,0,e.length))},e.setPRNG=function(e){i=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG((function(e,i){var r,s=new Uint8Array(i);for(r=0;r<i;r+=65536)t.getRandomValues(s.subarray(r,r+Math.min(i-r,65536)));for(r=0;r<i;r++)e[r]=s[r];me(s)}))}else"undefined"!=typeof require&&(t=require("crypto"))&&t.randomBytes&&e.setPRNG((function(e,i){var r,s=t.randomBytes(i);for(r=0;r<i;r++)e[r]=s[r];me(s)}))}()}(void 0!==t&&t.exports?t.exports:self.nacl=self.nacl||{})}}),require_common5=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/asn1/build/common.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.BufferVisitor=class{constructor(e,t=0,i=0){this.start=t,this.end=i>t?i:t,this.buf=e}get length(){return this.buf.length}reset(e=0,t=0){return this.start=e,t>=this.start?this.end=t:this.end<this.start&&(this.end=this.start),this}walk(e){return this.start=this.end,this.end+=e,this}mustHas(e,t="Too few bytes to parse."){const i=this.end+e;if(i>this.buf.length){const e=new Error(t);throw e.available=this.buf.length,e.requested=i,e}return this.walk(0),this}mustWalk(e,t){return this.mustHas(e,t),this.walk(e),this}}}}),require_pem=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/asn1/build/pem.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require("util"),i="-----BEGIN ",r="-----END ",s="-----",n="Proc-Type",a=class{static parse(e){const t=[],i=e.toString("utf8").split("\n").map((e=>e.trim())).filter((e=>""!==e&&!e.startsWith("#")));for(;i.length>0;)t.push(o(i));if(0===t.length)throw new Error("PEM: no block");return t}constructor(e,t){this.type=e,this.body=t,this.headers=Object.create(null)}get procType(){return this.getHeader(n)}getHeader(e){const t=this.headers[e];return null==t?"":t}setHeader(e,t){if(e.includes(":"))throw new Error("pem: cannot encode a header key that contains a colon");if(""===e||""===t)throw new Error("pem: invalid header key or value");this.headers[e]=t}toString(){let e=i+this.type+s+"\n";const t=Object.keys(this.headers);if(t.length>0){const i=this.procType;""!==i&&(e+=`${n}: ${i}\n`),t.sort();for(const i of t)i!==n&&(e+=`${i}: ${this.headers[i]}\n`);e+="\n"}const a=this.body.toString("base64");let o=0;for(;o<a.length;)e+=a.slice(o,o+64)+"\n",o+=64;return e+=r+this.type+s+"\n",e}toBuffer(){return Buffer.from(this.toString(),"utf8")}valueOf(){return this.body}toJSON(){return{type:this.type,body:this.body,headers:this.headers}}[t.inspect.custom](e,i){return`<${this.constructor.name} ${t.inspect(this.toJSON(),i)}>`}};function o(e){let t=e.shift();if(null==t||!t.startsWith(i)||!t.endsWith(s))throw new Error("pem: invalid BEGIN line");const n=t.slice(11,t.length-5);if(""===n)throw new Error("pem: invalid type");const o=[];for(t=e.shift();null!=t&&t.includes(": ");){const i=t.split(": ");if(2!==i.length||""===i[0]||""===i[1])throw new Error("pem: invalid Header line");o.push(i),t=e.shift()}let c="";for(;null!=t&&!t.startsWith(r);)c+=t,t=e.shift();if(null==t||t!==`${r}${n}${s}`)throw new Error("pem: invalid END line");const l=new a(n,Buffer.from(c,"base64"));if(""===c||l.body.toString("base64")!==c)throw new Error("pem: invalid base64 body");for(const e of o)l.setHeader(e[0],e[1]);return l}e.PEM=a}}),require_asn1=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/asn1/build/asn1.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t,i,r,s,n=require("util"),a=require_common5();(i=t=e.Class||(e.Class={}))[i.UNIVERSAL=0]="UNIVERSAL",i[i.APPLICATION=64]="APPLICATION",i[i.CONTEXT_SPECIFIC=128]="CONTEXT_SPECIFIC",i[i.PRIVATE=192]="PRIVATE",(s=r=e.Tag||(e.Tag={}))[s.NONE=0]="NONE",s[s.BOOLEAN=1]="BOOLEAN",s[s.INTEGER=2]="INTEGER",s[s.BITSTRING=3]="BITSTRING",s[s.OCTETSTRING=4]="OCTETSTRING",s[s.NULL=5]="NULL",s[s.OID=6]="OID",s[s.ENUMERATED=10]="ENUMERATED",s[s.UTF8=12]="UTF8",s[s.SEQUENCE=16]="SEQUENCE",s[s.SET=17]="SET",s[s.NUMERICSTRING=18]="NUMERICSTRING",s[s.PRINTABLESTRING=19]="PRINTABLESTRING",s[s.T61STRING=20]="T61STRING",s[s.IA5STRING=22]="IA5STRING",s[s.UTCTIME=23]="UTCTIME",s[s.GENERALIZEDTIME=24]="GENERALIZEDTIME",s[s.GENERALSTRING=27]="GENERALSTRING";var o=class{constructor(e,t){this.buf=e,this.bitLen=t}at(e){if(e<0||e>=this.bitLen||!Number.isInteger(e))return 0;const t=Math.floor(e/8),i=7-e%8;return this.buf[t]>>i&1}rightAlign(){const e=8-this.bitLen%8;if(8===e||0===this.buf.length)return this.buf;const t=Buffer.alloc(this.buf.length);t[0]=this.buf[0]>>e;for(let i=1;i<this.buf.length;i++)t[i]=this.buf[i-1]<<8-e,t[i]|=this.buf[i]>>e;return t}};e.BitString=o;var c=class e{static Bool(i){const s=new e(t.UNIVERSAL,r.BOOLEAN,Buffer.from([i?255:0]));return s._value=i,s}static parseBool(e){if(!(e instanceof Buffer)||1!==e.length)throw new Error("ASN1 syntax error: invalid boolean");switch(e[0]){case 0:return!1;case 255:return!0;default:throw new Error("ASN1 syntax error: invalid boolean")}}static Integer(i){if(i instanceof Buffer){const s=new e(t.UNIVERSAL,r.INTEGER,i);return s._value=i.toString("hex"),s}if(!Number.isSafeInteger(i))throw new Error("ASN1 syntax error: invalid integer");let s;if(i>=-128&&i<128)s=Buffer.alloc(1),s.writeInt8(i,0);else if(i>=-32768&&i<32768)s=Buffer.alloc(2),s.writeIntBE(i,0,2);else if(i>=-8388608&&i<8388608)s=Buffer.alloc(3),s.writeIntBE(i,0,3);else if(i>=-2147483648&&i<2147483648)s=Buffer.alloc(4),s.writeIntBE(i,0,4);else if(i>=-549755813888&&i<549755813888)s=Buffer.alloc(5),s.writeIntBE(i,0,5);else{if(!(i>=-0x800000000000&&i<0x800000000000))throw new Error("ASN1 syntax error: invalid Integer");s=Buffer.alloc(6),s.writeIntBE(i,0,6)}const n=new e(t.UNIVERSAL,r.INTEGER,s);return n._value=i,n}static parseInteger(e){if(!(e instanceof Buffer)||0===e.length)throw new Error("ASN1 syntax error: invalid Integer");return e.length>6?e.toString("hex"):e.readIntBE(0,e.length)}static parseIntegerNum(t){const i=e.parseInteger(t);if("number"!=typeof i)throw new Error("ASN1 syntax error: invalid Integer number");return i}static parseIntegerStr(t){const i=e.parseInteger(t);return"number"==typeof i?i.toString(16):i}static BitString(i){i instanceof Buffer&&(i=new o(i,8*i.length));const s=8*i.buf.length-i.bitLen,n=Buffer.alloc(i.buf.length+1);return n.writeInt8(s,0),i.buf.copy(n,1),new e(t.UNIVERSAL,r.BITSTRING,n)}static parseBitString(e){if(!(e instanceof Buffer)||0===e.length)throw new Error("ASN1 syntax error: invalid BitString");const t=e[0];if(t>7||1===e.length&&t>0||e[e.length-1]&(1<<e[0])-1)throw new Error("ASN1 syntax error: invalid padding bits in BIT STRING");return new o(e.slice(1),8*(e.length-1)-t)}static Null(){const i=new e(t.UNIVERSAL,r.NULL,Buffer.alloc(0));return i._value=null,i}static parseNull(e){if(!(e instanceof Buffer)||0!==e.length)throw new Error("ASN1 syntax error: invalid null");return null}static OID(i){const s=i.split(".");if(0===s.length)throw new Error("ASN1 syntax error: invalid Object Identifier");const n=[];n.push(40*d(s[0])+d(s[1]));const a=[];for(let e=2;e<s.length;++e){let t=d(s[e]);for(a.length=0,a.push(127&t);t>127;)t>>>=7,a.unshift(127&t|128);n.push(...a)}const o=new e(t.UNIVERSAL,r.OID,Buffer.from(n));return o._value=i,o}static parseOID(e){if(!(e instanceof Buffer)||0===e.length)throw new Error("ASN1 syntax error: invalid OID");let t=Math.floor(e[0]/40)+"."+e[0]%40,i=0;for(let r=1;r<e.length;r++)e[r]>=128?(i+=127&e[r],i<<=7):(t+="."+(i+e[r]),i=0);return t}static UTF8(i){const s=new e(t.UNIVERSAL,r.UTF8,Buffer.from(i,"utf8"));return s._value=i,s}static parseUTF8(e){if(!(e instanceof Buffer))throw new Error("parse ASN1 error: invalid Buffer");return e.toString("utf8")}static NumericString(i){if(!l(i))throw new Error("ASN1 syntax error: invalid NumericString");const s=new e(t.UNIVERSAL,r.NUMERICSTRING,Buffer.from(i,"utf8"));return s._value=i,s}static parseNumericString(e){if(!(e instanceof Buffer))throw new Error("parse ASN1 error: invalid Buffer");const t=e.toString("utf8");if(!l(t))throw new Error("ASN1 syntax error: invalid NumericString");return t}static PrintableString(i){const s=new e(t.UNIVERSAL,r.PRINTABLESTRING,Buffer.from(i,"utf8"));return s._value=i,s}static parsePrintableString(e){if(!(e instanceof Buffer))throw new Error("parse ASN1 error: invalid Buffer");return e.toString("utf8")}static IA5String(i){if(!u(i))throw new Error("ASN1 syntax error: invalid IA5String");const s=new e(t.UNIVERSAL,r.IA5STRING,Buffer.from(i,"utf8"));return s._value=i,s}static parseIA5String(e){if(!(e instanceof Buffer))throw new Error("parse ASN1 error: invalid Buffer");const t=e.toString("utf8");if(!u(t))throw new Error("ASN1 syntax error: invalid IA5String");return t}static T61String(i){const s=new e(t.UNIVERSAL,r.T61STRING,Buffer.from(i,"utf8"));return s._value=i,s}static parseT61String(e){if(!(e instanceof Buffer))throw new Error("parse ASN1 error: invalid Buffer");return e.toString("utf8")}static GeneralString(i){const s=new e(t.UNIVERSAL,r.GENERALSTRING,Buffer.from(i,"utf8"));return s._value=i,s}static parseGeneralString(e){if(!(e instanceof Buffer))throw new Error("parse ASN1 error: invalid Buffer");return e.toString("utf8")}static UTCTime(i){let s="";const n=[];n.push((""+i.getUTCFullYear()).substr(2)),n.push(""+(i.getUTCMonth()+1)),n.push(""+i.getUTCDate()),n.push(""+i.getUTCHours()),n.push(""+i.getUTCMinutes()),n.push(""+i.getUTCSeconds());for(const e of n)e.length<2&&(s+="0"),s+=e;s+="Z";const a=new e(t.UNIVERSAL,r.UTCTIME,Buffer.from(s,"utf8"));return a._value=i,a}static parseUTCTime(e){if(!(e instanceof Buffer)||0===e.length)throw new Error("ASN1 syntax error: invalid UTC Time");const t=e.toString("utf8"),i=new Date;let r=d(t.substr(0,2));r=r>=50?1900+r:2e3+r;const s=d(t.substr(2,2))-1,n=d(t.substr(4,2)),a=d(t.substr(6,2)),o=d(t.substr(8,2));let c=0,l=0,u="";if(t.length>11&&(l=10,u=t.charAt(l),"+"!==u&&"-"!==u&&(c=d(t.substr(10,2)),l+=2)),i.setUTCFullYear(r,s,n),i.setUTCHours(a,o,c,0),l>0&&(u=t.charAt(l),"+"===u||"-"===u)){let e=60*d(t.substr(l+1,2))+d(t.substr(l+4,2));e*=6e4,"+"===u?i.setTime(+i-e):i.setTime(+i+e)}return i}static GeneralizedTime(i){let s="";const n=[];n.push(""+i.getUTCFullYear()),n.push(""+(i.getUTCMonth()+1)),n.push(""+i.getUTCDate()),n.push(""+i.getUTCHours()),n.push(""+i.getUTCMinutes()),n.push(""+i.getUTCSeconds());for(const e of n)e.length<2&&(s+="0"),s+=e;s+="Z";const a=new e(t.UNIVERSAL,r.GENERALIZEDTIME,Buffer.from(s,"utf8"));return a._value=i,a}static parseGeneralizedTime(e){if(!(e instanceof Buffer)||0===e.length)throw new Error("ASN1 syntax error: invalid Generalized Time");const t=e.toString("utf8"),i=new Date,r=d(t.substr(0,4)),s=d(t.substr(4,2))-1,n=d(t.substr(6,2)),a=d(t.substr(8,2)),o=d(t.substr(10,2)),c=d(t.substr(12,2));let l=0,u=0,p=!1;"Z"===t.charAt(t.length-1)&&(p=!0);const h=t.length-5,m=t.charAt(h);if("+"===m||"-"===m){u=60*d(t.substr(h+1,2))+d(t.substr(h+4,2)),u*=6e4,"+"===m&&(u*=-1),p=!0}return"."===t.charAt(14)&&(l=1e3*parseFloat(t.substr(14))),p?(i.setUTCFullYear(r,s,n),i.setUTCHours(a,o,c,l),i.setTime(+i+u)):(i.setFullYear(r,s,n),i.setHours(a,o,c,l)),i}static parseTime(t,i){switch(t){case r.UTCTIME:return e.parseUTCTime(i);case r.GENERALIZEDTIME:return e.parseGeneralizedTime(i);default:throw new Error("Invalid ASN1 time tag")}}static Set(i){const s=new e(t.UNIVERSAL,r.SET,Buffer.concat(i.map((e=>e.toDER()))));return s._value=i,s}static Seq(i){const s=new e(t.UNIVERSAL,r.SEQUENCE,Buffer.concat(i.map((e=>e.toDER()))));return s._value=i,s}static Spec(i,r,s=!0){const n=Array.isArray(r)?Buffer.concat(r.map((e=>e.toDER()))):r.toDER();Array.isArray(r)&&(s=!0);const a=new e(t.CONTEXT_SPECIFIC,i,n,s);return a._value=r,a}static fromDER(t,i=!1){return e._fromDER(new a.BufferVisitor(t),i)}static parseDER(t,i,r){const s=e._fromDER(new a.BufferVisitor(t),!1);if(s.class!==i&&s.tag!==r)throw new Error(`invalid ASN.1 DER for class ${i} and tag ${r}`);return s}static parseDERWithTemplate(t,i){const r=e._fromDER(new a.BufferVisitor(t),!0),s={},n=r.validate(i,s);if(null!=n)throw n.data=r,n;return s}static _parseCompound(t,i){const r=[],s=t.length,n=new a.BufferVisitor(t);let o=0;for(;o<s;){const t=n.end;r.push(e._fromDER(n,i)),o+=n.end-t}return r}static _fromDER(t,i){if(!(t.buf instanceof Buffer)||0===t.length)throw new Error("ASN1 syntax error: invalid Generalized Time");t.mustWalk(1,"Too few bytes to read ASN.1 tag.");const s=t.start,n=t.buf[s],a=192&n,o=31&n,c=function(e){e.mustWalk(1,"Too few bytes to read ASN.1 value length.");const t=e.buf[e.start];if(!(128&t))return t;const i=127&t;return e.mustWalk(i,"Too few bytes to read ASN.1 value length."),e.buf.readUIntBE(e.start,i)}(t);if(t.mustHas(c),0!==c&&o===r.NULL)throw new Error("invalid value length or NULL tag.");t.mustWalk(c);const l=!(32&~n),u=new e(a,o,t.buf.slice(t.start,t.end),l);return l&&i&&(u._value=e._parseCompound(u.bytes,i)),u._der=t.buf.slice(s,t.end),u}constructor(e,t,i,s=!1){this.class=e,this.tag=t,this.bytes=i,this.isCompound=s||t===r.SEQUENCE||t===r.SET,this._value=void 0,this._der=null}get value(){return void 0===this._value&&(this._value=this.valueOf()),this._value}get DER(){return null==this._der&&(this._der=this.toDER()),this._der}mustCompound(e="asn1 object value is not compound"){if(!this.isCompound||!Array.isArray(this.value)){const t=new Error(e);throw t.data=this.toJSON(),t}return this.value}equals(t){return t instanceof e&&(this.class===t.class&&this.tag===t.tag&&this.isCompound===t.isCompound&&!!this.bytes.equals(t.bytes))}toDER(){let e=this.class|this.tag;this.isCompound&&(e|=32);const t=function(e){if(e<=127)return 0;if(e<=255)return 1;if(e<=65535)return 2;if(e<=16777215)return 3;if(e<=4294967295)return 4;if(e<=0xffffffffff)return 5;if(e<=0xffffffffffff)return 6;throw new Error("invalid value length")}(this.bytes.length),i=Buffer.allocUnsafe(2+t+this.bytes.length);return i.writeInt8(e,0),0===t?(i.writeUInt8(this.bytes.length,1),this.bytes.copy(i,2)):(i.writeUInt8(128|t,1),i.writeUIntBE(this.bytes.length,2,t),this.bytes.copy(i,2+t)),i}valueOf(){if(this.isCompound)return e._parseCompound(this.bytes,!1);if(this.class!==t.UNIVERSAL)return this.bytes;switch(this.tag){case r.BOOLEAN:return e.parseBool(this.bytes);case r.INTEGER:return e.parseInteger(this.bytes);case r.BITSTRING:return e.parseBitString(this.bytes);case r.NULL:return e.parseNull(this.bytes);case r.OID:return e.parseOID(this.bytes);case r.UTF8:return e.parseUTF8(this.bytes);case r.NUMERICSTRING:return e.parseNumericString(this.bytes);case r.PRINTABLESTRING:return e.parsePrintableString(this.bytes);case r.T61STRING:return e.parseT61String(this.bytes);case r.IA5STRING:return e.parseIA5String(this.bytes);case r.GENERALSTRING:return e.parseGeneralString(this.bytes);case r.UTCTIME:return e.parseUTCTime(this.bytes);case r.GENERALIZEDTIME:return e.parseGeneralizedTime(this.bytes);default:return this.bytes}}validate(i,s={}){if(this.class!==i.class)return new Error(`ASN.1 object validate failure for ${i.name} : error class ${t[this.class]}`);if(!(Array.isArray(i.tag)?i.tag:[i.tag]).includes(this.tag))return new Error(`ASN.1 object validate failure for ${i.name}: error tag ${r[this.tag]}`);if(null!=i.capture&&(s[i.capture]=this),Array.isArray(i.value)){const e=this.mustCompound(`${i.name} need compound ASN1 value`);for(let t=0,r=0;t<i.value.length;t++)if(null!=e[r]){const n=e[r].validate(i.value[t],s);if(null==n)r++;else if(!0!==i.value[t].optional)return n}else if(!0!==i.value[t].optional)return new Error(`ASN.1 object validate failure for ${i.value[t].name}: not exists`)}else if(null!=i.value){const t=this.tag===r.BITSTRING?this.bytes.slice(1):this.bytes;return e.fromDER(t).validate(i.value,s)}return null}toJSON(){let e=this.value;return Array.isArray(e)&&(e=e.map((e=>e.toJSON()))),{class:t[this.class],tag:this.class===t.UNIVERSAL?r[this.tag]:this.tag,value:e}}[n.inspect.custom](e,t){return t.depth<=2&&(t.depth=10),`<${this.constructor.name} ${n.inspect(this.toJSON(),t)}>`}};function l(e){for(const t of e){const e=t.charCodeAt(0);if(32!==e&&(e<48||e>57))return!1}return!0}function u(e){for(const t of e)if(t.charCodeAt(0)>=128)return!1;return!0}function d(e,t=10){const i=parseInt(e,t);if(Number.isNaN(i))throw new Error(`Invalid numeric string "${e}" in radix ${t}.`);return i}e.ASN1=c}}),require_build=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/asn1/build/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_common5();e.BufferVisitor=t.BufferVisitor;var i=require_pem();e.PEM=i.PEM;var r=require_asn1();e.ASN1=r.ASN1,e.Class=r.Class,e.Tag=r.Tag,e.BitString=r.BitString}}),require_pki=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/x509/build/pki.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require("util"),i=require("crypto"),r=require_nacl_fast(),s=require_build(),n=require_common4();e.publicKeyValidator={name:"PublicKeyInfo",class:s.Class.UNIVERSAL,tag:s.Tag.SEQUENCE,capture:"publicKeyInfo",value:[{name:"PublicKeyInfo.AlgorithmIdentifier",class:s.Class.UNIVERSAL,tag:s.Tag.SEQUENCE,value:[{name:"PublicKeyAlgorithmIdentifier.algorithm",class:s.Class.UNIVERSAL,tag:s.Tag.OID,capture:"publicKeyOID"}]},{name:"PublicKeyInfo.PublicKey",class:s.Class.UNIVERSAL,tag:s.Tag.BITSTRING,capture:"publicKey"}]},e.privateKeyValidator={name:"PrivateKeyInfo",class:s.Class.UNIVERSAL,tag:s.Tag.SEQUENCE,capture:"privateKeyInfo",value:[{name:"PrivateKeyInfo.Version",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.AlgorithmIdentifier",class:s.Class.UNIVERSAL,tag:s.Tag.SEQUENCE,value:[{name:"PrivateKeyAlgorithmIdentifier.algorithm",class:s.Class.UNIVERSAL,tag:s.Tag.OID,capture:"privateKeyOID"}]},{name:"PrivateKeyInfo.PrivateKey",class:s.Class.UNIVERSAL,tag:s.Tag.OCTETSTRING,capture:"privateKey"}]};var a={name:"RSAPublicKey",class:s.Class.UNIVERSAL,tag:s.Tag.SEQUENCE,value:[{name:"RSAPublicKey.modulus",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"publicKeyExponent"}]},o={name:"RSAPrivateKey",class:s.Class.UNIVERSAL,tag:s.Tag.SEQUENCE,value:[{name:"RSAPrivateKey.version",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",class:s.Class.UNIVERSAL,tag:s.Tag.INTEGER,capture:"privateKeyCoefficient"}]},c=[n.getOID("X25519"),n.getOID("X448"),n.getOID("Ed25519"),n.getOID("Ed448")],l=class r{constructor(t){const i={},r=t.validate(e.publicKeyValidator,i);if(null!=r)throw new Error("Cannot read X.509 public key: "+r.message);this.oid=s.ASN1.parseOID(i.publicKeyOID.bytes),this.algo=n.getOIDName(this.oid),this._pkcs8=t,this._keyRaw=s.ASN1.parseBitString(i.publicKey.bytes).buf,this._finalKey=this._keyRaw,this._finalPEM=""}static fromPEM(e){const t=s.PEM.parse(e)[0];if(t.procType.includes("ENCRYPTED"))throw new Error("Could not convert public key from PEM, PEM is encrypted.");const i=s.ASN1.fromDER(t.body,!0);switch(t.type){case"PUBLIC KEY":return new r(i);case"RSA PUBLIC KEY":const e=s.ASN1.Seq([s.ASN1.Seq([s.ASN1.OID(n.getOID("rsaEncryption")),s.ASN1.Null()]),s.ASN1.BitString(i.DER)]);return new r(e);default:throw new Error("Could not convert public key from PEM, recommend PKCS#8 PEM")}}static addVerifier(e,t){if(""===(e=n.getOID(e)))throw new Error(`Invalid object identifier: ${e}`);if(null!=r._verifiers[e])throw new Error(`Verifier ${e} exists`);r._verifiers[e]=t}get keyRaw(){return this._finalKey}verify(e,t,s){const n=r._verifiers[this.oid];if(null!=n){const r=i.createHash(s).update(e).digest();return n.call(this,r,t)}const a=i.createVerify(s);return a.update(e),a.verify(this.toPEM(),t)}getFingerprint(e,t="PublicKey"){let r;switch(t){case"PublicKeyInfo":r=this._pkcs8.DER;break;case"PublicKey":r=this._keyRaw;break;default:throw new Error(`Unknown fingerprint type "${t}".`)}const s=i.createHash(e);return s.update(r),s.digest()}toASN1(){return this._pkcs8}toDER(){return this._pkcs8.DER}toPEM(){return""===this._finalPEM&&(this._finalPEM=new s.PEM("PUBLIC KEY",this._pkcs8.DER).toString()),this._finalPEM}toJSON(){return{oid:this.oid,algo:this.algo,publicKey:this._keyRaw}}[t.inspect.custom](e,i){return`<${this.constructor.name} ${t.inspect(this.toJSON(),i)}>`}};l._verifiers=Object.create(null),e.PublicKey=l;var u=class a{constructor(t){const i=Object.create(null),a=t.validate(e.privateKeyValidator,i);if(null!=a)throw new Error("Cannot read X.509 private key: "+a.message);if(this.version=s.ASN1.parseIntegerNum(i.privateKeyVersion.bytes)+1,this.oid=s.ASN1.parseOID(i.privateKeyOID.bytes),this.algo=n.getOIDName(this.oid),this._pkcs8=t,this._keyRaw=i.privateKey.bytes,this._publicKeyRaw=null,this._finalKey=this._keyRaw,this._finalPEM="",c.includes(this.oid))if(this._finalKey=this._keyRaw=s.ASN1.parseDER(this._keyRaw,s.Class.UNIVERSAL,s.Tag.OCTETSTRING).bytes,"1.3.101.112"===this.oid){const e=r.sign.keyPair.fromSeed(this._keyRaw);this._publicKeyRaw=Buffer.from(e.publicKey),this._finalKey=Buffer.from(e.secretKey)}else if(2===this.version)for(const e of t.mustCompound())e.class===s.Class.CONTEXT_SPECIFIC&&1===e.tag&&(this._publicKeyRaw=s.ASN1.parseBitString(e.bytes).buf,this._finalKey=Buffer.concat([this._keyRaw,this._publicKeyRaw]))}static fromPEM(e){const t=s.PEM.parse(e)[0];if(t.procType.includes("ENCRYPTED"))throw new Error("Could not convert private key from PEM, PEM is encrypted.");let i=s.ASN1.fromDER(t.body,!0);switch(t.type){case"PRIVATE KEY":return new a(i);case"RSA PRIVATE KEY":return i=s.ASN1.Seq([i.value[0],s.ASN1.Seq([s.ASN1.OID(n.getOID("rsaEncryption")),s.ASN1.Null()]),new s.ASN1(s.Class.UNIVERSAL,s.Tag.OCTETSTRING,i.DER)]),new a(i);default:throw new Error("Could not convert private key from PEM, recommend PKCS#8 PEM")}}static addSigner(e,t){if(""===(e=n.getOID(e)))throw new Error(`Invalid object identifier: ${e}`);if(null!=a._signers[e])throw new Error(`Signer ${e} exists`);a._signers[e]=t}get keyRaw(){return this._finalKey}get publicKeyRaw(){return this._publicKeyRaw}sign(e,t){const r=a._signers[this.oid];if(null!=r){const s=i.createHash(t).update(e).digest();return r.call(this,s)}const s=i.createSign(t);return s.update(e),s.sign(this.toPEM())}toASN1(){return this._pkcs8}toDER(){return this._pkcs8.DER}toPEM(){return""===this._finalPEM&&(this._finalPEM=new s.PEM("PRIVATE KEY",this._pkcs8.DER).toString()),this._finalPEM}toJSON(){return{version:this.version,oid:this.oid,algo:this.algo,privateKey:this._keyRaw,publicKey:this._publicKeyRaw}}[t.inspect.custom](e,i){return`<${this.constructor.name} ${t.inspect(this.toJSON(),i)}>`}};u._signers=Object.create(null),e.PrivateKey=u;var d=class e extends l{static fromPublicKey(t){return new e(t.toASN1())}constructor(e){if(super(e),n.getOID(this.oid)!==n.getOID("rsaEncryption"))throw new Error(`Invalid RSA public key, unknown OID: ${this.oid}`);const t=Object.create(null);this._pkcs1=s.ASN1.fromDER(this._keyRaw,!0);const i=this._pkcs1.validate(a,t);if(null!=i)throw new Error("Cannot read RSA public key: "+i.message);this.modulus=s.ASN1.parseIntegerStr(t.publicKeyModulus.bytes),this.exponent=s.ASN1.parseIntegerNum(t.publicKeyExponent.bytes)}toASN1(){return this._pkcs1}toDER(){return this._keyRaw}toPEM(){return""===this._finalPEM&&(this._finalPEM=new s.PEM("RSA PUBLIC KEY",this._keyRaw).toString()),this._finalPEM}toPublicKeyPEM(){return new s.PEM("PUBLIC KEY",this._pkcs8.DER).toString()}toJSON(){return{oid:this.oid,algo:this.algo,modulus:h(this.modulus),exponent:this.exponent}}[t.inspect.custom](e,i){return`<${this.constructor.name} ${t.inspect(this.toJSON(),i)}>`}};e.RSAPublicKey=d;var p=class e extends u{static fromPrivateKey(t){return new e(t.toASN1())}constructor(e){if(super(e),n.getOID(this.oid)!==n.getOID("rsaEncryption"))throw new Error(`Invalid RSA private key, unknown OID: ${this.oid}`);const t=Object.create(null);this._pkcs1=s.ASN1.fromDER(this._keyRaw,!0);const i=this._pkcs1.validate(o,t);if(null!=i)throw new Error("Cannot read RSA private key: "+i.message);this.publicExponent=s.ASN1.parseIntegerNum(t.privateKeyPublicExponent.bytes),this.privateExponent=s.ASN1.parseIntegerStr(t.privateKeyPrivateExponent.bytes),this.modulus=s.ASN1.parseIntegerStr(t.privateKeyModulus.bytes),this.prime1=s.ASN1.parseIntegerStr(t.privateKeyPrime1.bytes),this.prime2=s.ASN1.parseIntegerStr(t.privateKeyPrime2.bytes),this.exponent1=s.ASN1.parseIntegerStr(t.privateKeyExponent1.bytes),this.exponent2=s.ASN1.parseIntegerStr(t.privateKeyExponent2.bytes),this.coefficient=s.ASN1.parseIntegerStr(t.privateKeyCoefficient.bytes)}toASN1(){return this._pkcs1}toDER(){return this._keyRaw}toPEM(){return""===this._finalPEM&&(this._finalPEM=new s.PEM("RSA PRIVATE KEY",this._keyRaw).toString()),this._finalPEM}toPrivateKeyPEM(){return new s.PEM("PRIVATE KEY",this._pkcs8.DER).toString()}toJSON(){return{version:this.version,oid:this.oid,algo:this.algo,publicExponent:this.publicExponent,privateExponent:h(this.privateExponent),modulus:h(this.modulus),prime1:h(this.prime1),prime2:h(this.prime2),exponent1:h(this.exponent1),exponent2:h(this.exponent2),coefficient:h(this.coefficient)}}[t.inspect.custom](e,i){return`<${this.constructor.name} ${t.inspect(this.toJSON(),i)}>`}};function h(e){return e.length%8!=0&&e.startsWith("00")?e.slice(2):e}e.RSAPrivateKey=p,l.addVerifier(n.getOID("Ed25519"),(function(e,t){return r.sign.detached.verify(e,t,this.keyRaw)})),u.addSigner(n.getOID("Ed25519"),(function(e){const t=this.keyRaw;if(64!==t.length)throw new Error("Invalid signing key.");return Buffer.from(r.sign.detached(e,t))}))}}),require_x509=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/x509/build/x509.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require("util"),i=require("crypto"),r=require_build(),s=require_common4(),n=require_pki(),a=Object.create(null);a.CN=s.getOID("commonName"),a.commonName="CN",a.C=s.getOID("countryName"),a.countryName="C",a.L=s.getOID("localityName"),a.localityName="L",a.ST=s.getOID("stateOrProvinceName"),a.stateOrProvinceName="ST",a.O=s.getOID("organizationName"),a.organizationName="O",a.OU=s.getOID("organizationalUnitName"),a.organizationalUnitName="OU",a.E=s.getOID("emailAddress"),a.emailAddress="E";var o={name:"Certificate",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,value:[{name:"Certificate.TBSCertificate",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,capture:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.NONE,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",class:r.Class.UNIVERSAL,tag:r.Tag.INTEGER,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",class:r.Class.UNIVERSAL,tag:r.Tag.INTEGER,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,value:[{name:"Certificate.TBSCertificate.signature.algorithm",class:r.Class.UNIVERSAL,tag:r.Tag.OID,capture:"certinfoSignatureOID"},{name:"Certificate.TBSCertificate.signature.parameters",class:r.Class.UNIVERSAL,tag:r.Tag.OCTETSTRING,optional:!0,capture:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,capture:"certIssuer"},{name:"Certificate.TBSCertificate.validity",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,value:[{name:"Certificate.TBSCertificate.validity.notBefore",class:r.Class.UNIVERSAL,tag:[r.Tag.UTCTIME,r.Tag.GENERALIZEDTIME],capture:"certValidityNotBefore"},{name:"Certificate.TBSCertificate.validity.notAfter",class:r.Class.UNIVERSAL,tag:[r.Tag.UTCTIME,r.Tag.GENERALIZEDTIME],capture:"certValidityNotAfter"}]},{name:"Certificate.TBSCertificate.subject",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,capture:"certSubject"},n.publicKeyValidator,{name:"Certificate.TBSCertificate.issuerUniqueID",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.BOOLEAN,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",class:r.Class.UNIVERSAL,tag:r.Tag.BITSTRING,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.INTEGER,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",class:r.Class.UNIVERSAL,tag:r.Tag.BITSTRING,capture:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.BITSTRING,capture:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,value:[{name:"Certificate.signatureAlgorithm.algorithm",class:r.Class.UNIVERSAL,tag:r.Tag.OID,capture:"certSignatureOID"},{name:"Certificate.TBSCertificate.signature.parameters",class:r.Class.UNIVERSAL,tag:r.Tag.OCTETSTRING,optional:!0,capture:"certSignatureParams"}]},{name:"Certificate.signatureValue",class:r.Class.UNIVERSAL,tag:r.Tag.BITSTRING,capture:"certSignature"}]},c=class{constructor(){this.attributes=[],this.uniqueId=null}get commonName(){return this.getFieldValue("commonName")}get organizationName(){return this.getFieldValue("organizationName")}get organizationalUnitName(){return this.getFieldValue("organizationalUnitName")}get countryName(){return this.getFieldValue("countryName")}get localityName(){return this.getFieldValue("localityName")}get serialName(){return this.getFieldValue("serialName")}getHash(){const e=i.createHash("sha1");for(const t of this.attributes)e.update(t.oid),e.update(t.value);return e.digest()}getField(e){for(const t of this.attributes)if(e===t.oid||e===t.name||e===t.shortName)return t;return null}addField(e){f([e]),this.attributes.push(e)}setAttrs(e){f(e),this.attributes=e}toJSON(){const e={};for(const t of this.attributes){const i=t.shortName;"string"==typeof i&&""!==i&&(e[i]=t.value)}return e.uniqueId=this.uniqueId,e.attributes=this.attributes,e}getFieldValue(e){const t=this.getField(e);return null!=t?t.value:""}};e.DistinguishedName=c;var l=class e{static fromPEMs(t){const i=[],s=r.PEM.parse(t);for(const t of s){if("CERTIFICATE"!==t.type&&"X509 CERTIFICATE"!==t.type&&"TRUSTED CERTIFICATE"!==t.type)throw new Error("Could not convert certificate from PEM: invalid type");if(t.procType.includes("ENCRYPTED"))throw new Error("Could not convert certificate from PEM: PEM is encrypted.");const s=r.ASN1.fromDER(t.body);i.push(new e(s))}if(0===i.length)throw new Error("No Certificate");return i}static fromPEM(t){return e.fromPEMs(t)[0]}constructor(e){const t=Object.create(null),i=e.validate(o,t);if(null!=i)throw new Error("Cannot read X.509 certificate: "+i.message);if(this.raw=e.DER,this.version=null==t.certVersion?0:r.ASN1.parseIntegerNum(t.certVersion.bytes)+1,this.serialNumber=r.ASN1.parseIntegerStr(t.certSerialNumber.bytes),this.signatureOID=r.ASN1.parseOID(t.certSignatureOID.bytes),this.signatureAlgorithm=s.getOIDName(this.signatureOID),this.infoSignatureOID=r.ASN1.parseOID(t.certinfoSignatureOID.bytes),this.signature=r.ASN1.parseBitString(t.certSignature.bytes).buf,this.validFrom=r.ASN1.parseTime(t.certValidityNotBefore.tag,t.certValidityNotBefore.bytes),this.validTo=r.ASN1.parseTime(t.certValidityNotAfter.tag,t.certValidityNotAfter.bytes),this.issuer=new c,this.issuer.setAttrs(g(t.certIssuer)),null!=t.certIssuerUniqueId&&(this.issuer.uniqueId=r.ASN1.parseBitString(t.certIssuerUniqueId.bytes)),this.subject=new c,this.subject.setAttrs(g(t.certSubject)),null!=t.certSubjectUniqueId&&(this.subject.uniqueId=r.ASN1.parseBitString(t.certSubjectUniqueId.bytes)),this.extensions=[],this.subjectKeyIdentifier="",this.authorityKeyIdentifier="",this.ocspServer="",this.issuingCertificateURL="",this.isCA=!1,this.maxPathLen=-1,this.basicConstraintsValid=!1,this.keyUsage=0,this.dnsNames=[],this.emailAddresses=[],this.ipAddresses=[],this.uris=[],null!=t.certExtensions){this.extensions=function(e){const t=[];for(const i of e.mustCompound())for(const e of i.mustCompound())t.push(u(e));return t}(t.certExtensions);for(const e of this.extensions)if("string"==typeof e.subjectKeyIdentifier&&(this.subjectKeyIdentifier=e.subjectKeyIdentifier),"string"==typeof e.authorityKeyIdentifier&&(this.authorityKeyIdentifier=e.authorityKeyIdentifier),"string"==typeof e.authorityInfoAccessOcsp&&(this.ocspServer=e.authorityInfoAccessOcsp),"string"==typeof e.authorityInfoAccessIssuers&&(this.issuingCertificateURL=e.authorityInfoAccessIssuers),"boolean"==typeof e.basicConstraintsValid&&(this.isCA=e.isCA,this.maxPathLen=e.maxPathLen,this.basicConstraintsValid=e.basicConstraintsValid),"number"==typeof e.keyUsage&&(this.keyUsage=e.keyUsage),Array.isArray(e.altNames))for(const t of e.altNames)null!=t.dnsName&&this.dnsNames.push(t.dnsName),null!=t.email&&this.emailAddresses.push(t.email),null!=t.ip&&this.ipAddresses.push(t.ip),null!=t.uri&&this.uris.push(t.uri)}this.publicKey=new n.PublicKey(t.publicKeyInfo),this.publicKeyRaw=this.publicKey.toDER(),this.tbsCertificate=t.tbsCertificate}getExtension(e,t=""){for(const i of this.extensions)if(e===i.oid||e===i.name)return""===t?i:i[t];return null}checkSignature(e){if(3===this.version&&!this.basicConstraintsValid||this.basicConstraintsValid&&!this.isCA)return new Error("The parent constraint violation error");if(!0!==this.getExtension("keyUsage","keyCertSign"))return new Error("The parent constraint violation error");if(!e.isIssuer(this))return new Error("The parent certificate did not issue the given child certificate");const t=function(e){switch(s.getOIDName(e)){case"sha1WithRsaEncryption":case"ecdsaWithSha1":case"dsaWithSha1":return"sha1";case"md5WithRsaEncryption":return"md5";case"sha256WithRsaEncryption":case"RSASSA-PSS":case"ecdsaWithSha256":case"dsaWithSha256":return"sha256";case"sha384WithRsaEncryption":case"ecdsaWithSha384":return"sha384";case"sha512WithRsaEncryption":case"ecdsaWithSha512":return"sha512";default:return""}}(e.signatureOID);if(""===t)return new Error("Unknown child signature OID.");return!1===this.publicKey.verify(e.tbsCertificate.DER,e.signature,t)?new Error("Child signature not matched"):null}isIssuer(e){return this.issuer.getHash().equals(e.subject.getHash())}verifySubjectKeyIdentifier(){return this.publicKey.getFingerprint("sha1","PublicKey").toString("hex")===this.subjectKeyIdentifier}toJSON(){const e={};for(const t of Object.keys(this))e[t]=_(this[t]);return delete e.tbsCertificate,e}[t.inspect.custom](e,i){return i.depth<=2&&(i.depth=10),`<${this.constructor.name} ${t.inspect(this.toJSON(),i)}>`}};function u(e){const t={};switch(t.oid=r.ASN1.parseOID(e.value[0].bytes),t.critical=!1,e.value[1].tag===r.Tag.BOOLEAN?(t.critical=r.ASN1.parseBool(e.value[1].bytes),t.value=e.value[2].bytes):t.value=e.value[1].bytes,t.name=s.getOIDName(t.oid),t.name){case"keyUsage":!function(e){const t=r.ASN1.parseBitString(r.ASN1.fromDER(e.value).bytes);let i=0,s=0;e.keyUsage=0;for(let i=0;i<9;i++)0!==t.at(i)&&(e.keyUsage|=1<<i);t.buf.length>0&&(i=t.buf[0],s=t.buf.length>1?t.buf[1]:0);e.digitalSignature=!(128&~i),e.nonRepudiation=!(64&~i),e.keyEncipherment=!(32&~i),e.dataEncipherment=!(16&~i),e.keyAgreement=!(8&~i),e.keyCertSign=!(4&~i),e.cRLSign=!(2&~i),e.encipherOnly=!(1&~i),e.decipherOnly=!(128&~s)}(t);break;case"basicConstraints":!function(e){const t=r.ASN1.fromDER(e.value),i=t.mustCompound();i.length>0&&i[0].tag===r.Tag.BOOLEAN?e.isCA=r.ASN1.parseBool(i[0].bytes):e.isCA=!1;let s=null;i.length>0&&i[0].tag===r.Tag.INTEGER?s=i[0].bytes:i.length>1&&(s=i[1].bytes);e.maxPathLen=null!==s?r.ASN1.parseInteger(s):-1;e.basicConstraintsValid=!0}(t);break;case"extKeyUsage":!function(e){const t=r.ASN1.fromDER(e.value),i=t.mustCompound();for(const t of i)e[s.getOIDName(r.ASN1.parseOID(t.bytes))]=!0}(t);break;case"nsCertType":!function(e){const t=r.ASN1.parseBitString(r.ASN1.fromDER(e.value).bytes);let i=0;t.buf.length>0&&(i=t.buf[0]);e.client=!(128&~i),e.server=!(64&~i),e.email=!(32&~i),e.objsign=!(16&~i),e.reserved=!(8&~i),e.sslCA=!(4&~i),e.emailCA=!(2&~i),e.objCA=!(1&~i)}(t);break;case"subjectAltName":case"issuerAltName":d(t);break;case"subjectKeyIdentifier":!function(e){const t=r.ASN1.parseDERWithTemplate(e.value,p);e.subjectKeyIdentifier=t.subjectKeyIdentifier.bytes.toString("hex")}(t);break;case"authorityKeyIdentifier":!function(e){const t=r.ASN1.parseDERWithTemplate(e.value,h);e.authorityKeyIdentifier=t.authorityKeyIdentifier.bytes.toString("hex")}(t);break;case"authorityInfoAccess":!function(e){const t=r.ASN1.parseDERWithTemplate(e.value,m);null!=t.authorityInfoAccessOcsp&&(e.authorityInfoAccessOcsp=t.authorityInfoAccessOcsp.bytes.toString());null!=t.authorityInfoAccessIssuers&&(e.authorityInfoAccessIssuers=t.authorityInfoAccessIssuers.bytes.toString())}(t)}return t}function d(e){e.altNames=[];const t=r.ASN1.fromDER(e.value).mustCompound();for(const i of t){const t={tag:i.tag,value:i.bytes};switch(e.altNames.push(t),i.tag){case 1:t.email=i.bytes.toString();break;case 2:t.dnsName=i.bytes.toString();break;case 6:t.uri=i.bytes.toString();break;case 7:t.ip=s.bytesToIP(i.bytes);break;case 8:t.oid=r.ASN1.parseOID(i.bytes)}}}e.Certificate=l;var p={name:"subjectKeyIdentifier",class:r.Class.UNIVERSAL,tag:r.Tag.OCTETSTRING,capture:"subjectKeyIdentifier"};var h={name:"authorityKeyIdentifier",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,value:[{name:"authorityKeyIdentifier.value",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.NONE,capture:"authorityKeyIdentifier"}]};var m={name:"authorityInfoAccess",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,value:[{name:"authorityInfoAccess.authorityInfoAccessOcsp",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,optional:!0,value:[{name:"authorityInfoAccess.authorityInfoAccessOcsp.oid",class:r.Class.UNIVERSAL,tag:r.Tag.OID},{name:"authorityInfoAccess.authorityInfoAccessOcsp.value",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.OID,capture:"authorityInfoAccessOcsp"}]},{name:"authorityInfoAccess.authorityInfoAccessIssuers",class:r.Class.UNIVERSAL,tag:r.Tag.SEQUENCE,optional:!0,value:[{name:"authorityInfoAccess.authorityInfoAccessIssuers.oid",class:r.Class.UNIVERSAL,tag:r.Tag.OID},{name:"authorityInfoAccess.authorityInfoAccessIssuers.value",class:r.Class.CONTEXT_SPECIFIC,tag:r.Tag.OID,capture:"authorityInfoAccessIssuers"}]}]};function f(e){for(const t of e){if(null!=t.name&&""!==t.name||(null!=t.oid&&(t.name=s.getOIDName(t.oid)),""===t.name&&null!=t.shortName&&(t.name=s.getOIDName(a[t.shortName]))),null==t.oid||""===t.oid){if(""===t.name)throw new Error("Attribute oid not specified.");t.oid=s.getOID(t.name)}if(null!=t.shortName&&""!==t.shortName||(t.shortName=null==a[t.name]?"":a[t.name]),null==t.value)throw new Error("Attribute value not specified.")}}function g(e){const t=[];for(const n of e.mustCompound())for(const e of n.mustCompound()){const n=e.mustCompound(),o={};o.oid=r.ASN1.parseOID(n[0].bytes),o.value=n[1].value,o.valueTag=n[1].tag,o.name=s.getOIDName(o.oid),o.shortName=(i=o.name,null==a[i]?"":a[i]),t.push(o)}var i;return t}function _(e){return null==e||e instanceof Buffer||"function"!=typeof e.toJSON?e:e.toJSON()}}}),require_build2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@fidm/x509/build/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_common4();e.bytesFromIP=t.bytesFromIP,e.bytesToIP=t.bytesToIP,e.getOID=t.getOID,e.getOIDName=t.getOIDName;var i=require_pki();e.PublicKey=i.PublicKey,e.PrivateKey=i.PrivateKey,e.RSAPublicKey=i.RSAPublicKey,e.RSAPrivateKey=i.RSAPrivateKey;var r=require_x509();e.Certificate=r.Certificate,e.DistinguishedName=r.DistinguishedName}}),require_Reflect=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/reflect-metadata/Reflect.js"(){var e,t;t=e||(e={}),function(){var e="object"==typeof globalThis?globalThis:"object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),i=r(t);function r(e,t){return function(i,r){Object.defineProperty(e,i,{configurable:!0,writable:!0,value:r}),t&&t(i,r)}}void 0!==e.Reflect&&(i=r(e.Reflect,i)),function(e,t){var i=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,s=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",a="function"==typeof Object.create,o={__proto__:[]}instanceof Array,c=!a&&!o,l={create:a?function(){return de(Object.create(null))}:o?function(){return de({__proto__:null})}:function(){return de({})},has:c?function(e,t){return i.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return i.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),d="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ce(),p="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:le(),h="function"==typeof WeakMap?WeakMap:ue(),m=r?Symbol.for("@reflect-metadata:registry"):void 0,f=se(),g=ne(f);function _(e,t,i,r){if(j(i)){if(!G(e))throw new TypeError;if(!J(t))throw new TypeError;return T(e,t)}if(!G(e))throw new TypeError;if(!M(t))throw new TypeError;if(!M(r)&&!j(r)&&!L(r))throw new TypeError;return L(r)&&(r=void 0),P(e,t,i=K(i),r)}function y(e,t){function i(i,r){if(!M(i))throw new TypeError;if(!j(r)&&!$(r))throw new TypeError;B(e,t,i,r)}return i}function b(e,t,i,r){if(!M(i))throw new TypeError;return j(r)||(r=K(r)),B(e,t,i,r)}function v(e,t,i){if(!M(t))throw new TypeError;return j(i)||(i=K(i)),I(e,t,i)}function x(e,t,i){if(!M(t))throw new TypeError;return j(i)||(i=K(i)),k(e,t,i)}function S(e,t,i){if(!M(t))throw new TypeError;return j(i)||(i=K(i)),R(e,t,i)}function w(e,t,i){if(!M(t))throw new TypeError;return j(i)||(i=K(i)),F(e,t,i)}function E(e,t){if(!M(e))throw new TypeError;return j(t)||(t=K(t)),O(e,t)}function C(e,t){if(!M(e))throw new TypeError;return j(t)||(t=K(t)),N(e,t)}function A(e,t,i){if(!M(t))throw new TypeError;if(j(i)||(i=K(i)),!M(t))throw new TypeError;j(i)||(i=K(i));var r=oe(t,i,!1);return!j(r)&&r.OrdinaryDeleteMetadata(e,t,i)}function T(e,t){for(var i=e.length-1;i>=0;--i){var r=(0,e[i])(t);if(!j(r)&&!L(r)){if(!J(r))throw new TypeError;t=r}}return t}function P(e,t,i,r){for(var s=e.length-1;s>=0;--s){var n=(0,e[s])(t,i,r);if(!j(n)&&!L(n)){if(!M(n))throw new TypeError;r=n}}return r}function I(e,t,i){if(k(e,t,i))return!0;var r=ie(t);return!L(r)&&I(e,r,i)}function k(e,t,i){var r=oe(t,i,!1);return!j(r)&&z(r.OrdinaryHasOwnMetadata(e,t,i))}function R(e,t,i){if(k(e,t,i))return F(e,t,i);var r=ie(t);return L(r)?void 0:R(e,r,i)}function F(e,t,i){var r=oe(t,i,!1);if(!j(r))return r.OrdinaryGetOwnMetadata(e,t,i)}function B(e,t,i,r){oe(i,r,!0).OrdinaryDefineOwnMetadata(e,t,i,r)}function O(e,t){var i=N(e,t),r=ie(e);if(null===r)return i;var s=O(r,t);if(s.length<=0)return i;if(i.length<=0)return s;for(var n=new p,a=[],o=0,c=i;o<c.length;o++){var l=c[o];n.has(l)||(n.add(l),a.push(l))}for(var u=0,d=s;u<d.length;u++)l=d[u],n.has(l)||(n.add(l),a.push(l));return a}function N(e,t){var i=oe(e,t,!1);return i?i.OrdinaryOwnMetadataKeys(e,t):[]}function D(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function j(e){return void 0===e}function L(e){return null===e}function U(e){return"symbol"==typeof e}function M(e){return"object"==typeof e?null!==e:"function"==typeof e}function q(e,t){switch(D(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var i=3===t?"string":5===t?"number":"default",r=Y(e,s);if(void 0!==r){var n=r.call(e,i);if(M(n))throw new TypeError;return n}return H(e,"default"===i?"number":i)}function H(e,t){if("string"===t){var i=e.toString;if(W(i)&&!M(s=i.call(e)))return s;if(W(r=e.valueOf)&&!M(s=r.call(e)))return s}else{var r;if(W(r=e.valueOf)&&!M(s=r.call(e)))return s;var s,n=e.toString;if(W(n)&&!M(s=n.call(e)))return s}throw new TypeError}function z(e){return!!e}function V(e){return""+e}function K(e){var t=q(e,3);return U(t)?t:V(t)}function G(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function W(e){return"function"==typeof e}function J(e){return"function"==typeof e}function $(e){switch(D(e)){case 3:case 4:return!0;default:return!1}}function Z(e,t){return e===t||e!=e&&t!=t}function Y(e,t){var i=e[t];if(null!=i){if(!W(i))throw new TypeError;return i}}function X(e){var t=Y(e,n);if(!W(t))throw new TypeError;var i=t.call(e);if(!M(i))throw new TypeError;return i}function Q(e){return e.value}function ee(e){var t=e.next();return!t.done&&t}function te(e){var t=e.return;t&&t.call(e)}function ie(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===u)return t;if(t!==u)return t;var i=e.prototype,r=i&&Object.getPrototypeOf(i);if(null==r||r===Object.prototype)return t;var s=r.constructor;return"function"!=typeof s||s===e?t:s}function re(){var e,i,r,s;j(m)||void 0===t.Reflect||m in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=ae(t.Reflect));var n=new h,a={registerProvider:o,getProvider:l,setProvider:f};return a;function o(t){if(!Object.isExtensible(a))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case j(i):i=t;break;case i===t:break;case j(r):r=t;break;case r===t:break;default:void 0===s&&(s=new p),s.add(t)}}function c(t,n){if(!j(i)){if(i.isProviderFor(t,n))return i;if(!j(r)){if(r.isProviderFor(t,n))return i;if(!j(s))for(var a=X(s);;){var o=ee(a);if(!o)return;var c=Q(o);if(c.isProviderFor(t,n))return te(a),c}}}if(!j(e)&&e.isProviderFor(t,n))return e}function l(e,t){var i,r=n.get(e);return j(r)||(i=r.get(t)),j(i)?(j(i=c(e,t))||(j(r)&&(r=new d,n.set(e,r)),r.set(t,i)),i):i}function u(e){if(j(e))throw new TypeError;return i===e||r===e||!j(s)&&s.has(e)}function f(e,t,i){if(!u(i))throw new Error("Metadata provider not registered.");var r=l(e,t);if(r!==i){if(!j(r))return!1;var s=n.get(e);j(s)&&(s=new d,n.set(e,s)),s.set(t,i)}return!0}}function se(){var e;return!j(m)&&M(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[m]),j(e)&&(e=re()),!j(m)&&M(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function ne(e){var t=new h,i={isProviderFor:function(e,i){var r=t.get(e);return!j(r)&&r.has(i)},OrdinaryDefineOwnMetadata:a,OrdinaryHasOwnMetadata:s,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:o,OrdinaryDeleteMetadata:c};return f.registerProvider(i),i;function r(r,s,n){var a=t.get(r),o=!1;if(j(a)){if(!n)return;a=new d,t.set(r,a),o=!0}var c=a.get(s);if(j(c)){if(!n)return;if(c=new d,a.set(s,c),!e.setProvider(r,s,i))throw a.delete(s),o&&t.delete(r),new Error("Wrong provider for target.")}return c}function s(e,t,i){var s=r(t,i,!1);return!j(s)&&z(s.has(e))}function n(e,t,i){var s=r(t,i,!1);if(!j(s))return s.get(e)}function a(e,t,i,s){r(i,s,!0).set(e,t)}function o(e,t){var i=[],s=r(e,t,!1);if(j(s))return i;for(var n=X(s.keys()),a=0;;){var o=ee(n);if(!o)return i.length=a,i;var c=Q(o);try{i[a]=c}catch(e){try{te(n)}finally{throw e}}a++}}function c(e,i,s){var n=r(i,s,!1);if(j(n))return!1;if(!n.delete(e))return!1;if(0===n.size){var a=t.get(i);j(a)||(a.delete(s),0===a.size&&t.delete(a))}return!0}}function ae(e){var t=e.defineMetadata,i=e.hasOwnMetadata,r=e.getOwnMetadata,s=e.getOwnMetadataKeys,n=e.deleteMetadata,a=new h;return{isProviderFor:function(e,t){var i=a.get(e);return!(j(i)||!i.has(t))||!!s(e,t).length&&(j(i)&&(i=new p,a.set(e,i)),i.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:i,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:n}}function oe(e,t,i){var r=f.getProvider(e,t);if(!j(r))return r;if(i){if(f.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function ce(){var e={},t=[],i=function(){function e(e,t,i){this._index=0,this._keys=e,this._values=t,this._selector=i}return e.prototype["@@iterator"]=function(){return this},e.prototype[n]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var i=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var i=this._find(e,!0);return this._values[i]=t,this},t.prototype.delete=function(t){var i=this._find(t,!1);if(i>=0){for(var r=this._keys.length,s=i+1;s<r;s++)this._keys[s-1]=this._keys[s],this._values[s-1]=this._values[s];return this._keys.length--,this._values.length--,Z(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new i(this._keys,this._values,r)},t.prototype.values=function(){return new i(this._keys,this._values,s)},t.prototype.entries=function(){return new i(this._keys,this._values,a)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[n]=function(){return this.entries()},t.prototype._find=function(e,t){if(!Z(this._cacheKey,e)){this._cacheIndex=-1;for(var i=0;i<this._keys.length;i++)if(Z(this._keys[i],e)){this._cacheIndex=i;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function r(e,t){return e}function s(e,t){return t}function a(e,t){return[e,t]}}function le(){return function(){function e(){this._map=new d}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[n]=function(){return this.keys()},e}()}function ue(){var e=16,t=l.create(),r=s();return function(){function e(){this._key=s()}return e.prototype.has=function(e){var t=n(e,!1);return void 0!==t&&l.has(t,this._key)},e.prototype.get=function(e){var t=n(e,!1);return void 0!==t?l.get(t,this._key):void 0},e.prototype.set=function(e,t){return n(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=n(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=s()},e}();function s(){var e;do{e="@@WeakMap@@"+c()}while(l.has(t,e));return t[e]=!0,e}function n(e,t){if(!i.call(e,r)){if(!t)return;Object.defineProperty(e,r,{value:l.create()})}return e[r]}function a(e,t){for(var i=0;i<t;++i)e[i]=255*Math.random()|0;return e}function o(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):a(t,e),t}return a(new Array(e),e)}function c(){var t=o(e);t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var i="",r=0;r<e;++r){var s=t[r];4!==r&&6!==r&&8!==r||(i+="-"),s<16&&(i+="0"),i+=s.toString(16).toLowerCase()}return i}}function de(e){return e.__=void 0,delete e.__,e}e("decorate",_),e("metadata",y),e("defineMetadata",b),e("hasMetadata",v),e("hasOwnMetadata",x),e("getMetadata",S),e("getOwnMetadata",w),e("getMetadataKeys",E),e("getOwnMetadataKeys",C),e("deleteMetadata",A)}(i,e),void 0===e.Reflect&&(e.Reflect=t)}()}}),tslib_es6_exports={};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function __rest(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]])}return i}function __decorate(e,t,i,r){var s,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,i,a):s(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a}function __param(e,t){return function(i,r){t(i,r,e)}}function __esDecorate(e,t,i,r,s,n){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=r.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?r.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),p=!1,h=i.length-1;h>=0;h--){var m={};for(var f in r)m[f]="access"===f?{}:r[f];for(var f in r.access)m.access[f]=r.access[f];m.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(e||null))};var g=(0,i[h])("accessor"===c?{get:d.get,set:d.set}:d[l],m);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(o=a(g.get))&&(d.get=o),(o=a(g.set))&&(d.set=o),(o=a(g.init))&&s.unshift(o)}else(o=a(g))&&("field"===c?s.unshift(o):d[l]=o)}u&&Object.defineProperty(u,r.name,d),p=!0}function __runInitializers(e,t,i){for(var r=arguments.length>2,s=0;s<t.length;s++)i=r?t[s].call(e,i):t[s].call(e);return r?i:void 0}function __propKey(e){return"symbol"==typeof e?e:"".concat(e)}function __setFunctionName(e,t,i){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:i?"".concat(i," ",t):t})}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))}function __generator(e,t){var i,r,s,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(n=0)),n;)try{if(i=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,r=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(s=n.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){n.label=o[1];break}if(6===o[0]&&n.label<s[1]){n.label=s[1],s=o;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(o);break}s[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],r=0}finally{i=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function __exportStar(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||__createBinding(t,e,i)}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,s,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=n.next()).done;)a.push(r.value)}catch(e){s={error:e}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}return a}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var r=Array(e),s=0;for(t=0;t<i;t++)for(var n=arguments[t],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function __spreadArray(e,t,i){if(i||2===arguments.length)for(var r,s=0,n=t.length;s<n;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,s=i.apply(e,t||[]),n=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",(function(e){return function(t){return Promise.resolve(t).then(e,l)}})),r[Symbol.asyncIterator]=function(){return this},r;function a(e,t){s[e]&&(r[e]=function(t){return new Promise((function(i,r){n.push([e,t,i,r])>1||o(e,t)}))},t&&(r[e]=t(r[e])))}function o(e,t){try{(i=s[e](t)).value instanceof __await?Promise.resolve(i.value.v).then(c,l):u(n[0][2],i)}catch(e){u(n[0][3],e)}var i}function c(e){o("next",e)}function l(e){o("throw",e)}function u(e,t){e(t),n.shift(),n.length&&o(n[0][0],n[0][1])}}function __asyncDelegator(e){var t,i;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,s){t[r]=e[r]?function(t){return(i=!i)?{value:__await(e[r](t)),done:!1}:s?s(t):t}:s}}function __asyncValues(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(t){return new Promise((function(r,s){(function(e,t,i,r){Promise.resolve(r).then((function(t){e({value:t,done:i})}),t)})(r,s,(t=e[i](t)).done,t.value)}))}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=ownKeys(e),r=0;r<i.length;r++)"default"!==i[r]&&__createBinding(t,e,i[r]);return __setModuleDefault(t,e),t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}function __classPrivateFieldSet(e,t,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,i):s?s.value=i:t.set(e,i),i}function __classPrivateFieldIn(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function __addDisposableResource(e,t,i){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r,s;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],i&&(s=r)}if("function"!=typeof r)throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:i})}else i&&e.stack.push({async:!0});return t}function __disposeResources(e){function t(t){e.error=e.hasError?new _SuppressedError(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var i,r=0;return function s(){for(;i=e.stack.pop();)try{if(!i.async&&1===r)return r=0,e.stack.push(i),Promise.resolve().then(s);if(i.dispose){var n=i.dispose.call(i.value);if(i.async)return r|=2,Promise.resolve(n).then(s,(function(e){return t(e),s()}))}else r|=1}catch(e){t(e)}if(1===r)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function __rewriteRelativeImportExtension(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,(function(e,i,r,s,n){return i?t?".jsx":".js":!r||s&&n?r+s+"."+n.toLowerCase()+"js":e})):e}__export(tslib_es6_exports,{__addDisposableResource:()=>__addDisposableResource,__assign:()=>__assign,__asyncDelegator:()=>__asyncDelegator,__asyncGenerator:()=>__asyncGenerator,__asyncValues:()=>__asyncValues,__await:()=>__await,__awaiter:()=>__awaiter,__classPrivateFieldGet:()=>__classPrivateFieldGet,__classPrivateFieldIn:()=>__classPrivateFieldIn,__classPrivateFieldSet:()=>__classPrivateFieldSet,__createBinding:()=>__createBinding,__decorate:()=>__decorate,__disposeResources:()=>__disposeResources,__esDecorate:()=>__esDecorate,__exportStar:()=>__exportStar,__extends:()=>__extends,__generator:()=>__generator,__importDefault:()=>__importDefault,__importStar:()=>__importStar,__makeTemplateObject:()=>__makeTemplateObject,__metadata:()=>__metadata,__param:()=>__param,__propKey:()=>__propKey,__read:()=>__read,__rest:()=>__rest,__rewriteRelativeImportExtension:()=>__rewriteRelativeImportExtension,__runInitializers:()=>__runInitializers,__setFunctionName:()=>__setFunctionName,__spread:()=>__spread,__spreadArray:()=>__spreadArray,__spreadArrays:()=>__spreadArrays,__values:()=>__values,default:()=>tslib_es6_default});var extendStatics2,__assign2,init_tslib_es6=__esm({"../../submodules/mediasoup/submodules/werift/node_modules/tslib/tslib.es6.mjs"(){extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},__assign=function(){return __assign=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)},__createBinding=Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]},__setModuleDefault=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},ownKeys=function(e){return(ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t})(e)},_SuppressedError="function"==typeof SuppressedError?SuppressedError:function(e,t,i){var r=new Error(i);return r.name="SuppressedError",r.error=e,r.suppressed=t,r},tslib_es6_default={__extends:__extends,__assign:__assign,__rest:__rest,__decorate:__decorate,__param:__param,__esDecorate:__esDecorate,__runInitializers:__runInitializers,__propKey:__propKey,__setFunctionName:__setFunctionName,__metadata:__metadata,__awaiter:__awaiter,__generator:__generator,__createBinding:__createBinding,__exportStar:__exportStar,__values:__values,__read:__read,__spread:__spread,__spreadArrays:__spreadArrays,__spreadArray:__spreadArray,__await:__await,__asyncGenerator:__asyncGenerator,__asyncDelegator:__asyncDelegator,__asyncValues:__asyncValues,__makeTemplateObject:__makeTemplateObject,__importStar:__importStar,__importDefault:__importDefault,__classPrivateFieldGet:__classPrivateFieldGet,__classPrivateFieldSet:__classPrivateFieldSet,__classPrivateFieldIn:__classPrivateFieldIn,__addDisposableResource:__addDisposableResource,__disposeResources:__disposeResources,__rewriteRelativeImportExtension:__rewriteRelativeImportExtension}}}),require_build3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/pvtsutils/build/index.js"(e){"use strict";var t=class e{static isArrayBuffer(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(t,i){const r=e.toUint8Array(t),s=e.toUint8Array(i);if(r.length!==s.byteLength)return!1;for(let e=0;e<r.length;e++)if(r[e]!==s[e])return!1;return!0}static concat(...e){let t;t=!Array.isArray(e[0])||e[1]instanceof Function?Array.isArray(e[0])&&e[1]instanceof Function?e[0]:e[e.length-1]instanceof Function?e.slice(0,e.length-1):e:e[0];let i=0;for(const e of t)i+=e.byteLength;const r=new Uint8Array(i);let s=0;for(const e of t){const t=this.toUint8Array(e);r.set(t,s),s+=t.length}return e[e.length-1]instanceof Function?this.toView(r,e[e.length-1]):r.buffer}},i="string",r=/^[0-9a-f\s]+$/i,s=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,n=/^[a-zA-Z0-9-_]+$/,a=class{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i.buffer}static toString(e){const i=t.toUint8Array(e);let r="";for(let e=0;e<i.length;e++)r+=String.fromCharCode(i[e]);return decodeURIComponent(escape(r))}},o=class{static toString(e,i=!1){const r=t.toArrayBuffer(e),s=new DataView(r);let n="";for(let e=0;e<r.byteLength;e+=2){const t=s.getUint16(e,i);n+=String.fromCharCode(t)}return n}static fromString(e,t=!1){const i=new ArrayBuffer(2*e.length),r=new DataView(i);for(let i=0;i<e.length;i++)r.setUint16(2*i,e.charCodeAt(i),t);return i}},c=class e{static isHex(e){return typeof e===i&&r.test(e)}static isBase64(e){return typeof e===i&&s.test(e)}static isBase64Url(e){return typeof e===i&&n.test(e)}static ToString(e,i="utf8"){const r=t.toUint8Array(e);switch(i.toLowerCase()){case"utf8":return this.ToUtf8String(r);case"binary":return this.ToBinary(r);case"hex":return this.ToHex(r);case"base64":return this.ToBase64(r);case"base64url":return this.ToBase64Url(r);case"utf16le":return o.toString(r,!0);case"utf16":case"utf16be":return o.toString(r);default:throw new Error(`Unknown type of encoding '${i}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return o.fromString(e,!0);case"utf16":case"utf16be":return o.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const i=t.toUint8Array(e);if("undefined"!=typeof btoa){const e=this.ToString(i,"binary");return btoa(e)}return Buffer.from(i).toString("base64")}static FromBase64(t){const i=this.formatString(t);if(!i)return new ArrayBuffer(0);if(!e.isBase64(i))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return"undefined"!=typeof atob?this.FromBinary(atob(i)):new Uint8Array(Buffer.from(i,"base64")).buffer}static FromBase64Url(t){const i=this.formatString(t);if(!i)return new ArrayBuffer(0);if(!e.isBase64Url(i))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(i.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,i=e.DEFAULT_UTF8_ENCODING){switch(i){case"ascii":return this.FromBinary(t);case"utf8":return a.fromString(t);case"utf16":case"utf16be":return o.fromString(t);case"utf16le":case"usc2":return o.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${i}'`)}}static ToUtf8String(t,i=e.DEFAULT_UTF8_ENCODING){switch(i){case"ascii":return this.ToBinary(t);case"utf8":return a.toString(t);case"utf16":case"utf16be":return o.toString(t);case"utf16le":case"usc2":return o.toString(t,!0);default:throw new Error(`Unknown type of encoding '${i}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);return i.buffer}static ToBinary(e){const i=t.toUint8Array(e);let r="";for(let e=0;e<i.length;e++)r+=String.fromCharCode(i[e]);return r}static ToHex(e){const i=t.toUint8Array(e);let r="";const s=i.length;for(let e=0;e<s;e++){const t=i[e];t<16&&(r+="0"),r+=t.toString(16)}return r}static FromHex(t){let i=this.formatString(t);if(!i)return new ArrayBuffer(0);if(!e.isHex(i))throw new TypeError("Argument 'hexString' is not HEX encoded");i.length%2&&(i=`0${i}`);const r=new Uint8Array(i.length/2);for(let e=0;e<i.length;e+=2){const t=i.slice(e,e+2);r[e/2]=parseInt(t,16)}return r.buffer}static ToUtf16String(e,t=!1){return o.toString(e,t)}static FromUtf16String(e,t=!1){return o.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(null==e?void 0:e.replace(/[\n\r\t ]/g,""))||""}};c.DEFAULT_UTF8_ENCODING="utf8",e.BufferSourceConverter=t,e.Convert=c,e.assign=function(e,...t){const i=arguments[0];for(let e=1;e<arguments.length;e++){const t=arguments[e];for(const e in t)i[e]=t[e]}return i},e.combine=function(...e){const t=e.map((e=>e.byteLength)).reduce(((e,t)=>e+t)),i=new Uint8Array(t);let r=0;return e.map((e=>new Uint8Array(e))).forEach((e=>{for(const t of e)i[r++]=t})),i.buffer},e.isEqual=function(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;const i=new Uint8Array(e),r=new Uint8Array(t);for(let t=0;t<e.byteLength;t++)if(i[t]!==r[t])return!1;return!0}}}),require_utils=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/pvutils/build/utils.js"(e){"use strict";function t(e,t){let i=0;if(1===e.length)return e[0];for(let r=e.length-1;r>=0;r--)i+=e[e.length-1-r]*Math.pow(2,t*r);return i}function i(e,t,i=-1){const r=i;let s=e,n=0,a=Math.pow(2,t);for(let i=1;i<8;i++){if(e<a){let e;if(r<0)e=new ArrayBuffer(i),n=i;else{if(r<i)return new ArrayBuffer(0);e=new ArrayBuffer(r),n=r}const a=new Uint8Array(e);for(let e=i-1;e>=0;e--){const i=Math.pow(2,e*t);a[n-e-1]=Math.floor(s/i),s-=a[n-e-1]*i}return e}a*=Math.pow(2,t)}return new ArrayBuffer(0)}Object.defineProperty(e,"__esModule",{value:!0});var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";var n=Math.log(2);e.arrayBufferToString=function(e){let t="";const i=new Uint8Array(e);for(const e of i)t+=String.fromCharCode(e);return t},e.bufferToHexCodes=function(e,t=0,i=e.byteLength-t,r=!1){let s="";for(const n of new Uint8Array(e,t,i)){const e=n.toString(16).toUpperCase();1===e.length&&(s+="0"),s+=e,r&&(s+=" ")}return s.trim()},e.checkBufferParams=function(e,t,i,r){return t instanceof ArrayBuffer?t.byteLength?i<0?(e.error="Wrong parameter: inputOffset less than zero",!1):r<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-i-r<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(e.error="Wrong parameter: inputBuffer has zero length",!1):(e.error='Wrong parameter: inputBuffer must be "ArrayBuffer"',!1)},e.clearProps=function(e,t){for(const i of t)delete e[i]},e.fromBase64=function(e,t=!1,i=!1){const n=t?s:r;function a(e){for(let t=0;t<64;t++)if(n.charAt(t)===e)return t;return 64}function o(e){return 64===e?0:e}let c=0,l="";for(;c<e.length;){const t=a(e.charAt(c++)),i=c>=e.length?0:a(e.charAt(c++)),r=c>=e.length?0:a(e.charAt(c++)),s=c>=e.length?0:a(e.charAt(c++)),n=o(t)<<2|o(i)>>4,u=(15&o(i))<<4|o(r)>>2,d=(3&o(r))<<6|o(s);l+=String.fromCharCode(n),64!==r&&(l+=String.fromCharCode(u)),64!==s&&(l+=String.fromCharCode(d))}if(i){let e=-1;for(let t=l.length-1;t>=0;t--)if(0!==l.charCodeAt(t)){e=t;break}l=-1!==e?l.slice(0,e+1):""}return l},e.getParametersValue=function(e,t,i){var r;return e instanceof Object==!1?i:null!==(r=e[t])&&void 0!==r?r:i},e.getUTCDate=function(e){return new Date(e.getTime()+6e4*e.getTimezoneOffset())},e.isEqualBuffer=function(e,t){if(e.byteLength!==t.byteLength)return!1;const i=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<i.length;e++)if(i[e]!==r[e])return!1;return!0},e.nearestPowerOf2=function(e){const t=Math.log(e)/n,i=Math.floor(t),r=Math.round(t);return i===r?i:r},e.padNumber=function(e,t){const i=e.toString(10);if(t<i.length)return"";const r=t-i.length,s=new Array(r);for(let e=0;e<r;e++)s[e]="0";return s.join("").concat(i)},e.stringToArrayBuffer=function(e){const t=e.length,i=new ArrayBuffer(t),r=new Uint8Array(i);for(let i=0;i<t;i++)r[i]=e.charCodeAt(i);return i},e.toBase64=function(e,t=!1,i=!1,n=!1){let a=0,o=0,c=0,l="";const u=t?s:r;if(n){let t=0;for(let i=0;i<e.length;i++)if(0!==e.charCodeAt(i)){t=i;break}e=e.slice(t)}for(;a<e.length;){const t=e.charCodeAt(a++);a>=e.length&&(o=1);const r=e.charCodeAt(a++);a>=e.length&&(c=1);const s=e.charCodeAt(a++),n=t>>2,d=(3&t)<<4|r>>4;let p=(15&r)<<2|s>>6,h=63&s;1===o?p=h=64:1===c&&(h=64),l+=i?64===p?`${u.charAt(n)}${u.charAt(d)}`:64===h?`${u.charAt(n)}${u.charAt(d)}${u.charAt(p)}`:`${u.charAt(n)}${u.charAt(d)}${u.charAt(p)}${u.charAt(h)}`:`${u.charAt(n)}${u.charAt(d)}${u.charAt(p)}${u.charAt(h)}`}return l},e.utilConcatBuf=function(...e){let t=0,i=0;for(const i of e)t+=i.byteLength;const r=new ArrayBuffer(t),s=new Uint8Array(r);for(const t of e)s.set(new Uint8Array(t),i),i+=t.byteLength;return r},e.utilConcatView=function(...e){let t=0,i=0;for(const i of e)t+=i.length;const r=new ArrayBuffer(t),s=new Uint8Array(r);for(const t of e)s.set(t,i),i+=t.length;return s},e.utilDecodeTC=function(){const e=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const t=255===e[0]&&128&e[1],i=0===e[0]&&!(128&e[1]);(t||i)&&this.warnings.push("Needlessly long format")}const i=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(i);for(let e=0;e<this.valueHex.byteLength;e++)r[e]=0;r[0]=128&e[0];const s=t(r,8),n=new ArrayBuffer(this.valueHex.byteLength),a=new Uint8Array(n);for(let t=0;t<this.valueHex.byteLength;t++)a[t]=e[t];return a[0]&=127,t(a,8)-s},e.utilEncodeTC=function(e){const t=e<0?-1*e:e;let r=128;for(let s=1;s<8;s++){if(t<=r){if(e<0){const e=i(r-t,8,s);return new Uint8Array(e)[0]|=128,e}let n=i(t,8,s),a=new Uint8Array(n);if(128&a[0]){const e=n.slice(0),t=new Uint8Array(e);n=new ArrayBuffer(n.byteLength+1),a=new Uint8Array(n);for(let i=0;i<e.byteLength;i++)a[i+1]=t[i];a[0]=0}return n}r*=Math.pow(2,8)}return new ArrayBuffer(0)},e.utilFromBase=t,e.utilToBase=i}}),require_build4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/asn1js/build/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_build3(),i=require_utils();function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var s=r(t),n=r(i);function a(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function o(e){let t=0,i=0;for(let i=0;i<e.length;i++){t+=e[i].byteLength}const r=new Uint8Array(t);for(let t=0;t<e.length;t++){const s=e[t];r.set(new Uint8Array(s),i),i+=s.byteLength}return r.buffer}function c(e,t,i,r){return t instanceof Uint8Array?t.byteLength?i<0?(e.error="Wrong parameter: inputOffset less than zero",!1):r<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-i-r<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(e.error="Wrong parameter: inputBuffer has zero length",!1):(e.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var l=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return o(this.items)}},u=[new Uint8Array([1])],d="0123456789",p="name",h="valueHexView",m="",f=new ArrayBuffer(0),g=new Uint8Array(0),_="EndOfContent",y="OCTET STRING",b="BIT STRING";function v(e){var t;return(t=class extends e{constructor(...e){var t;super(...e);const i=e[0]||{};this.isHexOnly=null!==(t=i.isHexOnly)&&void 0!==t&&t,this.valueHexView=i.valueHex?s.BufferSourceConverter.toUint8Array(i.valueHex):g}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(e){this.valueHexView=new Uint8Array(e)}fromBER(e,t,i){const r=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!c(this,r,t,i))return-1;const s=t+i;return this.valueHexView=r.subarray(t,s),this.valueHexView.length?(this.blockLength=i,s):(this.warnings.push("Zero buffer length"),t)}toBER(e=!1){return this.isHexOnly?e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",f)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:s.Convert.ToHex(this.valueHexView)}}}).NAME="hexBlock",t}var x=class{constructor({blockLength:e=0,error:t="",warnings:i=[],valueBeforeDecode:r=g}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=s.BufferSourceConverter.toUint8Array(r)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:s.Convert.ToHex(this.valueBeforeDecodeView)}}};x.NAME="baseBlock";var S=class extends x{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};S.NAME="valueBlock";var w=class extends(v(x)){constructor({idBlock:e={}}={}){var t,i,r,n;super(),e?(this.isHexOnly=null!==(t=e.isHexOnly)&&void 0!==t&&t,this.valueHexView=e.valueHex?s.BufferSourceConverter.toUint8Array(e.valueHex):g,this.tagClass=null!==(i=e.tagClass)&&void 0!==i?i:-1,this.tagNumber=null!==(r=e.tagNumber)&&void 0!==r?r:-1,this.isConstructed=null!==(n=e.isConstructed)&&void 0!==n&&n):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",f}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!e){let e=this.tagNumber;e&=31,t|=e,i[0]=t}return i.buffer}if(!this.isHexOnly){const i=n.utilToBase(this.tagNumber,7),r=new Uint8Array(i),s=i.byteLength,a=new Uint8Array(s+1);if(a[0]=31|t,!e){for(let e=0;e<s-1;e++)a[e+1]=128|r[e];a[s]=r[s-1]}return a.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=31|t,!e){const e=this.valueHexView;for(let t=0;t<e.length-1;t++)i[t+1]=128|e[t];i[this.valueHexView.byteLength]=e[e.length-1]}return i.buffer}fromBER(e,t,i){const r=s.BufferSourceConverter.toUint8Array(e);if(!c(this,r,t,i))return-1;const a=r.subarray(t,t+i);if(0===a.length)return this.error="Zero buffer length",-1;switch(192&a[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=!(32&~a[0]),this.isHexOnly=!1;const o=31&a[0];if(31!==o)this.tagNumber=o,this.blockLength=1;else{let e=1,t=this.valueHexView=new Uint8Array(255),i=255;for(;128&a[e];){if(t[e-1]=127&a[e],e++,e>=a.length)return this.error="End of input reached before message was fully decoded",-1;if(e===i){i+=255;const e=new Uint8Array(i);for(let i=0;i<t.length;i++)e[i]=t[i];t=this.valueHexView=new Uint8Array(i)}}this.blockLength=e+1,t[e-1]=127&a[e];const r=new Uint8Array(e);for(let i=0;i<e;i++)r[i]=t[i];t=this.valueHexView=new Uint8Array(e),t.set(r),this.blockLength<=9?this.tagNumber=n.utilFromBase(t,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};w.NAME="identificationBlock";var E=class extends x{constructor({lenBlock:e={}}={}){var t,i,r;super(),this.isIndefiniteForm=null!==(t=e.isIndefiniteForm)&&void 0!==t&&t,this.longFormUsed=null!==(i=e.longFormUsed)&&void 0!==i&&i,this.length=null!==(r=e.length)&&void 0!==r?r:0}fromBER(e,t,i){const r=s.BufferSourceConverter.toUint8Array(e);if(!c(this,r,t,i))return-1;const a=r.subarray(t,t+i);if(0===a.length)return this.error="Zero buffer length",-1;if(255===a[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===a[0],this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(128&a[0]),!1===this.longFormUsed)return this.length=a[0],this.blockLength=1,t+this.blockLength;const o=127&a[0];if(o>8)return this.error="Too big integer",-1;if(o+1>a.length)return this.error="End of input reached before message was fully decoded",-1;const l=t+1,u=r.subarray(l,l+o);return 0===u[o-1]&&this.warnings.push("Needlessly long encoded length"),this.length=n.utilFromBase(u,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const r=n.utilToBase(this.length,8);if(r.byteLength>127)return this.error="Too big length",f;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const s=new Uint8Array(r);i=new Uint8Array(t),i[0]=128|r.byteLength;for(let e=0;e<r.byteLength;e++)i[e+1]=s[e];return t}return t=new ArrayBuffer(1),!1===e&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};E.NAME="lengthBlock";var C={},A=class extends x{constructor({name:e="",optional:t=!1,primitiveSchema:i,...r}={},s){super(r),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new w(r),this.lenBlock=new E(r),this.valueBlock=s?new s(r):new S(r)}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(e,t){const i=t||new l;t||T(this);const r=this.idBlock.toBER(e);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const t=this.valueBlock.toBER(e);this.lenBlock.length=t.byteLength;const r=this.lenBlock.toBER(e);i.write(r),i.write(t)}return t?f:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return"ascii"===e?this.onAsciiEncoding():s.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${s.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return n.isEqualBuffer(t,i)}};function T(e){if(e instanceof C.Constructed)for(const t of e.valueBlock.value)T(t)&&(e.lenBlock.isIndefiniteForm=!0);return!!e.lenBlock.isIndefiniteForm}A.NAME="BaseBlock";var P=class extends A{constructor({value:e="",...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};P.NAME="BaseStringBlock";var I,k=class extends(v(S)){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};k.NAME="PrimitiveValueBlock";var R=class extends A{constructor(e={}){super(e,k),this.idBlock.isConstructed=!1}};function F(e,t=0,i=e.length){const r=t;let s=new A({},S);const n=new x;if(!c(n,e,t,i))return s.error=n.error,{offset:-1,result:s};if(!e.subarray(t,t+i).length)return s.error="Zero buffer length",{offset:-1,result:s};let a=s.idBlock.fromBER(e,t,i);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),-1===a)return s.error=s.idBlock.error,{offset:-1,result:s};if(t=a,i-=s.idBlock.blockLength,a=s.lenBlock.fromBER(e,t,i),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),-1===a)return s.error=s.lenBlock.error,{offset:-1,result:s};if(t=a,i-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let o=A;if(1===s.idBlock.tagClass){if(s.idBlock.tagNumber>=37&&!1===s.idBlock.isHexOnly)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};o=C.EndOfContent;break;case 1:o=C.Boolean;break;case 2:o=C.Integer;break;case 3:o=C.BitString;break;case 4:o=C.OctetString;break;case 5:o=C.Null;break;case 6:o=C.ObjectIdentifier;break;case 10:o=C.Enumerated;break;case 12:o=C.Utf8String;break;case 13:o=C.RelativeObjectIdentifier;break;case 14:o=C.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:o=C.Sequence;break;case 17:o=C.Set;break;case 18:o=C.NumericString;break;case 19:o=C.PrintableString;break;case 20:o=C.TeletexString;break;case 21:o=C.VideotexString;break;case 22:o=C.IA5String;break;case 23:o=C.UTCTime;break;case 24:o=C.GeneralizedTime;break;case 25:o=C.GraphicString;break;case 26:o=C.VisibleString;break;case 27:o=C.GeneralString;break;case 28:o=C.UniversalString;break;case 29:o=C.CharacterString;break;case 30:o=C.BmpString;break;case 31:o=C.DATE;break;case 32:o=C.TimeOfDay;break;case 33:o=C.DateTime;break;case 34:o=C.Duration;break;default:{const e=s.idBlock.isConstructed?new C.Constructed:new C.Primitive;e.idBlock=s.idBlock,e.lenBlock=s.lenBlock,e.warnings=s.warnings,s=e}}}else o=s.idBlock.isConstructed?C.Constructed:C.Primitive;return s=function(e,t){if(e instanceof t)return e;const i=new t;return i.idBlock=e.idBlock,i.lenBlock=e.lenBlock,i.warnings=e.warnings,i.valueBeforeDecodeView=e.valueBeforeDecodeView,i}(s,o),a=s.fromBER(e,t,s.lenBlock.isIndefiniteForm?i:s.lenBlock.length),s.valueBeforeDecodeView=e.subarray(r,r+s.blockLength),{offset:a,result:s}}I=R,C.Primitive=I,R.NAME="PRIMITIVE";var B,O=class extends S{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const r=s.BufferSourceConverter.toUint8Array(e);if(!c(this,r,t,i))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+i),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let n=t;for(;a=this.isIndefiniteForm,o=i,(a?1:o)>0;){const e=F(r,n,i);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(n=e.offset,this.blockLength+=e.result.blockLength,i-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===_)break}var a,o;return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===_?this.value.pop():this.warnings.push("No EndOfContent block encoded")),n}toBER(e,t){const i=t||new l;for(let t=0;t<this.value.length;t++)this.value[t].toBER(e,i);return t?f:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}};O.NAME="ConstructedValueBlock";var N=class extends A{constructor(e={}){super(e,O),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const e=[];for(const t of this.valueBlock.value)e.push(t.toString("ascii").split("\n").map((e=>`  ${e}`)).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}};B=N,C.Constructed=B,N.NAME="CONSTRUCTED";var D,j=class extends S{fromBER(e,t,i){return t}toBER(e){return f}};j.override="EndOfContentValueBlock";var L,U=class extends A{constructor(e={}){super(e,j),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};D=U,C.EndOfContent=D,U.NAME=_;var M=class extends A{constructor(e={}){super(e,S),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const e=new Uint8Array(i);e[0]=5,e[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}};L=M,C.Null=L,M.NAME="NULL";var q,H=class extends(v(S)){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=s.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const r=s.BufferSourceConverter.toUint8Array(e);return c(this,r,t,i)?(this.valueHexView=r.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,n.utilDecodeTC.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}};H.NAME="BooleanValueBlock";var z=class extends A{constructor(e={}){super(e,H),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};q=z,C.Boolean=q,z.NAME="BOOLEAN";var V,K=class extends(v(O)){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=O.prototype.fromBER.call(this,e,t,i),-1===r)return r;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.NAME;if(t===_){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(t!==y)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,i),this.blockLength=i;return r}toBER(e,t){return this.isConstructed?O.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}};K.NAME="OctetStringValueBlock";var G=class e extends A{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;null!==(r=i.isConstructed)&&void 0!==r||(i.isConstructed=!!(null===(s=i.value)||void 0===s?void 0:s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},K),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===i)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const r=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(r.byteLength){const e=F(r,0,r.byteLength);-1!==e.offset&&e.offset===i&&(this.valueBlock.value=[e.result])}}catch(e){}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?N.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${s.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const t=[];for(const i of this.valueBlock.value)i instanceof e&&t.push(i.valueBlock.valueHexView);return s.BufferSourceConverter.concat(t)}};V=G,C.OctetString=V,G.NAME=y;var W,J=class extends(v(O)){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let r=-1;if(this.isConstructed){if(r=O.prototype.fromBER.call(this,e,t,i),-1===r)return r;for(const e of this.value){const t=e.constructor.NAME;if(t===_){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(t!==b)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const i=e.valueBlock;if(this.unusedBits>0&&i.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=i.unusedBits}return r}const n=s.BufferSourceConverter.toUint8Array(e);if(!c(this,n,t,i))return-1;const a=n.subarray(t,t+i);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const e=a.subarray(1);try{if(e.byteLength){const t=F(e,0,e.byteLength);-1!==t.offset&&t.offset===i-1&&(this.value=[t.result])}}catch(e){}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+i}toBER(e,t){if(this.isConstructed)return O.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return f;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}};J.NAME="BitStringValueBlock";var $,Z=class extends A{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;null!==(r=i.isConstructed)&&void 0!==r||(i.isConstructed=!!(null===(s=i.value)||void 0===s?void 0:s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},J),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return N.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const i of t)e.push(i.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};function Y(e,t){const i=new Uint8Array([0]),r=new Uint8Array(e),s=new Uint8Array(t);let a=r.slice(0);const o=a.length-1,c=s.slice(0),l=c.length-1;let u=0;let d=0;for(let e=l<o?o:l;e>=0;e--,d++){if(!0==d<c.length)u=a[o-d]+c[l-d]+i[0];else u=a[o-d]+i[0];if(i[0]=u/10,!0==d>=a.length)a=n.utilConcatView(new Uint8Array([u%10]),a);else a[o-d]=u%10}return i[0]>0&&(a=n.utilConcatView(i,a)),a}function X(e){if(e>=u.length)for(let t=u.length;t<=e;t++){const e=new Uint8Array([0]);let i=u[t-1].slice(0);for(let t=i.length-1;t>=0;t--){const r=new Uint8Array([(i[t]<<1)+e[0]]);e[0]=r[0]/10,i[t]=r[0]%10}e[0]>0&&(i=n.utilConcatView(e,i)),u.push(i)}return u[e]}function Q(e,t){let i=0;const r=new Uint8Array(e),s=new Uint8Array(t),n=r.slice(0),a=n.length-1,o=s.slice(0),c=o.length-1;let l,u=0;for(let e=c;e>=0;e--,u++)if(l=n[a-u]-o[c-u]-i,!0==l<0)i=1,n[a-u]=l+10;else i=0,n[a-u]=l;if(i>0)for(let e=a-c+1;e>=0;e--,u++){if(l=n[a-u]-i,!(l<0)){i=0,n[a-u]=l;break}i=1,n[a-u]=l+10}return n.slice()}W=Z,C.BitString=W,Z.NAME=b;var ee,te=class extends(v(S)){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=n.utilDecodeTC.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(n.utilEncodeTC(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,r=0){const s=this.fromBER(e,t,i);if(-1===s)return s;const n=this.valueHexView;return 0===n[0]&&128&n[1]?this.valueHexView=n.subarray(1):0!==r&&n.length<r&&(r-n.length>1&&(r=n.length+1),this.valueHexView=n.subarray(r-n.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case!!(128&t[0]):{const e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&!(128&t[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,i){const r=super.fromBER(e,t,i);return-1===r||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=8*this.valueHexView.length-1;let t,i=new Uint8Array(8*this.valueHexView.length/3),r=0;const s=this.valueHexView;let n="",a=!1;for(let a=s.byteLength-1;a>=0;a--){t=s[a];for(let s=0;s<8;s++){if(!(1&~t))if(r===e)i=Q(X(r),i),n="-";else i=Y(i,X(r));r++,t>>=1}}for(let e=0;e<i.length;e++)i[e]&&(a=!0),a&&(n+=d.charAt(i[e]));return!1===a&&(n+=d.charAt(0)),n}};$=te,te.NAME="IntegerValueBlock",Object.defineProperty($.prototype,"valueHex",{set:function(e){this.valueHexView=new Uint8Array(e),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var ie,re=class e extends A{constructor(e={}){super(e,te),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return a(),BigInt(this.valueBlock.toString())}static fromBigInt(t){a();const i=BigInt(t),r=new l,n=i.toString(16).replace(/^-/,""),o=new Uint8Array(s.Convert.FromHex(n));if(i<0){const e=new Uint8Array(o.length+(128&o[0]?1:0));e[0]|=128;const t=BigInt(`0x${s.Convert.ToHex(e)}`)+i,n=s.BufferSourceConverter.toUint8Array(s.Convert.FromHex(t.toString(16)));n[0]|=128,r.write(n)}else 128&o[0]&&r.write(new Uint8Array([0])),r.write(o);return new e({valueHex:r.final()})}convertToDER(){const t=new e({valueHex:this.valueBlock.valueHexView});return t.valueBlock.toDER(),t}convertFromDER(){return new e({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};ee=re,C.Integer=ee,re.NAME="INTEGER";var se=class extends re{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};ie=se,C.Enumerated=ie,se.NAME="ENUMERATED";var ne=class extends(v(S)){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const r=s.BufferSourceConverter.toUint8Array(e);if(!c(this,r,t,i))return-1;const a=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let e=0;e<i&&(this.valueHexView[e]=127&a[e],this.blockLength++,128&a[e]);e++);const o=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)o[e]=this.valueHexView[e];return this.valueHexView=o,128&a[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=n.utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){a();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let e=0;e<i.length;e++)i[e]=parseInt(t.slice(7*e,7*e+7),2)+(e+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,i=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)i[e]=128|t[e];return i[this.blockLength-1]=t[this.blockLength-1],i.buffer}const t=n.utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",f;const i=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)i[t]=128|e[t];i[r]=e[r]}return i}toString(){let e="";if(this.isHexOnly)e=s.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}};ne.NAME="sidBlock";var ae,oe=class extends S{constructor({value:e="",...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const t=new ne;if(r=t.fromBER(e,r,i),-1===r)return this.blockLength=0,this.error=t.error,r;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,i-=t.blockLength,this.value.push(t)}return r}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(e);if(0===r.byteLength)return this.error=this.value[i].error,f;t.push(r)}return o(t)}fromString(e){this.value=[];let t=0,i=0,r="",s=!1;do{if(i=e.indexOf(".",t),r=-1===i?e.substring(t):e.substring(t,i),t=i+1,s){const e=this.value[0];let t=0;switch(e.valueDec){case 0:break;case 1:t=40;break;case 2:t=80;break;default:return void(this.value=[])}const i=parseInt(r,10);if(isNaN(i))return;e.valueDec=i+t,s=!1}else{const e=new ne;if(r>Number.MAX_SAFE_INTEGER){a();const t=BigInt(r);e.valueBigInt=t}else if(e.valueDec=parseInt(r,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,s=!0),this.value.push(e)}}while(-1!==i)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();0!==i&&(e=`${e}.`),t?(r=`{${r}}`,this.value[i].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};oe.NAME="ObjectIdentifierValueBlock";var ce=class extends A{constructor(e={}){super(e,oe),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};ae=ce,C.ObjectIdentifier=ae,ce.NAME="OBJECT IDENTIFIER";var le=class extends(v(x)){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(0===i)return t;const r=s.BufferSourceConverter.toUint8Array(e);if(!c(this,r,t,i))return-1;const a=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let e=0;e<i&&(this.valueHexView[e]=127&a[e],this.blockLength++,128&a[e]);e++);const o=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)o[e]=this.valueHexView[e];return this.valueHexView=o,128&a[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=n.utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,i=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)i[e]=128|t[e];return i[this.blockLength-1]=t[this.blockLength-1],i.buffer}const t=n.utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",f;const i=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)i[t]=128|e[t];i[r]=e[r]}return i.buffer}toString(){let e="";return e=this.isHexOnly?s.Convert.ToHex(this.valueHexView):this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}};le.NAME="relativeSidBlock";var ue,de=class extends S{constructor({value:e="",...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const t=new le;if(r=t.fromBER(e,r,i),-1===r)return this.blockLength=0,this.error=t.error,r;this.blockLength+=t.blockLength,i-=t.blockLength,this.value.push(t)}return r}toBER(e,t){const i=[];for(let t=0;t<this.value.length;t++){const r=this.value[t].toBER(e);if(0===r.byteLength)return this.error=this.value[t].error,f;i.push(r)}return o(i)}fromString(e){this.value=[];let t=0,i=0,r="";do{i=e.indexOf(".",t),r=-1===i?e.substring(t):e.substring(t,i),t=i+1;const s=new le;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(-1!==i);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();0!==i&&(e=`${e}.`),t?(r=`{${r}}`,e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};de.NAME="RelativeObjectIdentifierValueBlock";var pe,he=class extends A{constructor(e={}){super(e,de),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};ue=he,C.RelativeObjectIdentifier=ue,he.NAME="RelativeObjectIdentifier";var me,fe=class extends N{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};pe=fe,C.Sequence=pe,fe.NAME="SEQUENCE";var ge=class extends N{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};me=ge,C.Set=me,ge.NAME="SET";var _e=class extends(v(S)){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=m}toJSON(){return{...super.toJSON(),value:this.value}}};_e.NAME="StringValueBlock";var ye=class extends _e{};ye.NAME="SimpleStringValueBlock";var be=class extends P{constructor({...e}={}){super(e,ye)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,s.BufferSourceConverter.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);this.valueBlock.value=e}};be.NAME="SIMPLE STRING";var ve,xe=class extends be{fromBuffer(e){this.valueBlock.valueHexView=s.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=s.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=s.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(s.Convert.FromUtf8String(e)),this.valueBlock.value=e}};xe.NAME="Utf8StringValueBlock";var Se=class extends xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};ve=Se,C.Utf8String=ve,Se.NAME="UTF8String";var we,Ee=class extends be{fromBuffer(e){this.valueBlock.value=s.Convert.ToUtf16String(e),this.valueBlock.valueHexView=s.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(s.Convert.FromUtf16String(e))}};Ee.NAME="BmpStringValueBlock";var Ce=class extends Ee{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};we=Ce,C.BmpString=we,Ce.NAME="BMPString";var Ae,Te=class extends be{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let e=0;e<i.length;e+=4)i[e]=i[e+3],i[e+1]=i[e+2],i[e+2]=0,i[e+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(4*t);for(let r=0;r<t;r++){const t=n.utilToBase(e.charCodeAt(r),8),s=new Uint8Array(t);if(s.length>4)continue;const a=4-s.length;for(let e=s.length-1;e>=0;e--)i[4*r+e+a]=s[e]}this.valueBlock.value=e}};Te.NAME="UniversalStringValueBlock";var Pe,Ie=class extends Te{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};Ae=Ie,C.UniversalString=Ae,Ie.NAME="UniversalString";var ke,Re=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};Pe=Re,C.NumericString=Pe,Re.NAME="NumericString";var Fe,Be=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};ke=Be,C.PrintableString=ke,Be.NAME="PrintableString";var Oe,Ne=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};Fe=Ne,C.TeletexString=Fe,Ne.NAME="TeletexString";var De,je=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};Oe=je,C.VideotexString=Oe,je.NAME="VideotexString";var Le,Ue=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};De=Ue,C.IA5String=De,Ue.NAME="IA5String";var Me,qe=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};Le=qe,C.GraphicString=Le,qe.NAME="GraphicString";var He,ze=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};Me=ze,C.VisibleString=Me,ze.NAME="VisibleString";var Ve,Ke=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};He=Ke,C.GeneralString=He,Ke.NAME="GeneralString";var Ge,We=class extends be{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};Ve=We,C.CharacterString=Ve,We.NAME="CharacterString";var Je,$e=class extends ze{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let t=0;t<e.length;t++)this.valueBlock.valueHexView[t]=e.charCodeAt(t)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,s.BufferSourceConverter.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t<e.length;t++)i[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(e);if(null===t)return void(this.error="Wrong input string for conversion");const i=parseInt(t[1],10);this.year=i>=50?1900+i:2e3+i,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){const e=new Array(7);return e[0]=n.padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=n.padNumber(this.month,2),e[2]=n.padNumber(this.day,2),e[3]=n.padNumber(this.hour,2),e[4]=n.padNumber(this.minute,2),e[5]=n.padNumber(this.second,2),e[6]="Z",e.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}};Ge=$e,C.UTCTime=Ge,$e.NAME="UTCTime";var Ze,Ye=class extends $e{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t,i=!1,r="",s="",n=0,a=0,o=0;if("Z"===e[e.length-1])r=e.substring(0,e.length-1),i=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(i){if(-1!==r.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==r.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=r.indexOf("+"),i="";if(-1===t&&(t=r.indexOf("-"),e=-1),-1!==t){if(i=r.substring(t+1),r=r.substring(0,t),2!==i.length&&4!==i.length)throw new Error("Wrong input string for conversion");let s=parseInt(i.substring(0,2),10);if(isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");if(a=e*s,4===i.length){if(s=parseInt(i.substring(2,4),10),isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");o=e*s}}}let c=r.indexOf(".");if(-1===c&&(c=r.indexOf(",")),-1!==c){const e=new Number(`0${r.substring(c)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");n=e.valueOf(),s=r.substring(0,c)}else s=r;switch(!0){case 8===s.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===s.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*n;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===s.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*n;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===s.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){const e=1e3*n;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const l=t.exec(s);if(null===l)throw new Error("Wrong input string for conversion");for(let e=1;e<l.length;e++)switch(e){case 1:this.year=parseInt(l[e],10);break;case 2:this.month=parseInt(l[e],10);break;case 3:this.day=parseInt(l[e],10);break;case 4:this.hour=parseInt(l[e],10)+a;break;case 5:this.minute=parseInt(l[e],10)+o;break;case 6:this.second=parseInt(l[e],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===i){const e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth(),this.day=e.getUTCDay(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}}toString(e="iso"){if("iso"===e){const e=[];return e.push(n.padNumber(this.year,4)),e.push(n.padNumber(this.month,2)),e.push(n.padNumber(this.day,2)),e.push(n.padNumber(this.hour,2)),e.push(n.padNumber(this.minute,2)),e.push(n.padNumber(this.second,2)),0!==this.millisecond&&(e.push("."),e.push(n.padNumber(this.millisecond,3))),e.push("Z"),e.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}};Je=Ye,C.GeneralizedTime=Je,Ye.NAME="GeneralizedTime";var Xe,Qe=class extends Se{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};Ze=Qe,C.DATE=Ze,Qe.NAME="DATE";var et,tt=class extends Se{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};Xe=tt,C.TimeOfDay=Xe,tt.NAME="TimeOfDay";var it,rt=class extends Se{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};et=rt,C.DateTime=et,rt.NAME="DateTime";var st,nt=class extends Se{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};it=nt,C.Duration=it,nt.NAME="Duration";var at=class extends Se{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};st=at,C.TIME=st,at.NAME="TIME";var ot=class{constructor({name:e="",optional:t=!1}={}){this.name=e,this.optional=t}},ct=class extends ot{constructor({value:e=[],...t}={}){super(t),this.value=e}},lt=class extends ot{constructor({value:e=new ot,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}};function ut(e,t,i){if(i instanceof ct){for(let r=0;r<i.value.length;r++){if(ut(e,t,i.value[r]).verified)return{verified:!0,result:e}}{const e={verified:!1,result:{error:"Wrong values for Choice type"}};return i.hasOwnProperty(p)&&(e.name=i.name),e}}if(i instanceof ot)return i.hasOwnProperty(p)&&(e[i.name]=t),{verified:!0,result:e};if(e instanceof Object==!1)return{verified:!1,result:{error:"Wrong root object"}};if(t instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(i instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("idBlock"in i==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("fromBER"in i.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("toBER"in i.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=i.idBlock.toBER(!1);if(0===r.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===i.idBlock.fromBER(r,0,r.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===i.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.tagClass!==t.idBlock.tagClass)return{verified:!1,result:e};if(!1===i.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.tagNumber!==t.idBlock.tagNumber)return{verified:!1,result:e};if(!1===i.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.isConstructed!==t.idBlock.isConstructed)return{verified:!1,result:e};if(!("isHexOnly"in i.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.isHexOnly!==t.idBlock.isHexOnly)return{verified:!1,result:e};if(i.idBlock.isHexOnly){if(h in i.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=i.idBlock.valueHexView,s=t.idBlock.valueHexView;if(r.length!==s.length)return{verified:!1,result:e};for(let t=0;t<r.length;t++)if(r[t]!==s[1])return{verified:!1,result:e}}if(i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&(e[i.name]=t)),i instanceof C.Constructed){let r=0,s={verified:!1,result:{error:"Unknown error"}},n=i.valueBlock.value.length;if(n>0&&i.valueBlock.value[0]instanceof lt&&(n=t.valueBlock.value.length),0===n)return{verified:!0,result:e};if(0===t.valueBlock.value.length&&0!==i.valueBlock.value.length){let t=!0;for(let e=0;e<i.valueBlock.value.length;e++)t=t&&(i.valueBlock.value[e].optional||!1);return t?{verified:!0,result:e}:(i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&delete e[i.name]),e.error="Inconsistent object length",{verified:!1,result:e})}for(let a=0;a<n;a++)if(a-r>=t.valueBlock.value.length){if(!1===i.valueBlock.value[a].optional){const t={verified:!1,result:e};return e.error="Inconsistent length between ASN.1 data and schema",i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&(delete e[i.name],t.name=i.name)),t}}else if(i.valueBlock.value[0]instanceof lt){if(s=ut(e,t.valueBlock.value[a],i.valueBlock.value[0].value),!1===s.verified){if(!i.valueBlock.value[0].optional)return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&delete e[i.name]),s;r++}if(p in i.valueBlock.value[0]&&i.valueBlock.value[0].name.length>0){let r={};r="local"in i.valueBlock.value[0]&&i.valueBlock.value[0].local?t:e,void 0===r[i.valueBlock.value[0].name]&&(r[i.valueBlock.value[0].name]=[]),r[i.valueBlock.value[0].name].push(t.valueBlock.value[a])}}else if(s=ut(e,t.valueBlock.value[a-r],i.valueBlock.value[a]),!1===s.verified){if(!i.valueBlock.value[a].optional)return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&delete e[i.name]),s;r++}if(!1===s.verified){const t={verified:!1,result:e};return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&(delete e[i.name],t.name=i.name)),t}return{verified:!0,result:e}}if(i.primitiveSchema&&h in t.valueBlock){const r=F(t.valueBlock.valueHexView);if(-1===r.offset){const t={verified:!1,result:r.result};return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,m),i.name&&(delete e[i.name],t.name=i.name)),t}return ut(e,r.result,i.primitiveSchema)}return{verified:!0,result:e}}e.Any=ot,e.BaseBlock=A,e.BaseStringBlock=P,e.BitString=Z,e.BmpString=Ce,e.Boolean=z,e.CharacterString=We,e.Choice=ct,e.Constructed=N,e.DATE=Qe,e.DateTime=rt,e.Duration=nt,e.EndOfContent=U,e.Enumerated=se,e.GeneralString=Ke,e.GeneralizedTime=Ye,e.GraphicString=qe,e.HexBlock=v,e.IA5String=Ue,e.Integer=re,e.Null=M,e.NumericString=Re,e.ObjectIdentifier=ce,e.OctetString=G,e.Primitive=R,e.PrintableString=Be,e.RawData=class{constructor({data:e=g}={}){this.dataView=s.BufferSourceConverter.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=s.BufferSourceConverter.toUint8Array(e)}fromBER(e,t,i){const r=t+i;return this.dataView=s.BufferSourceConverter.toUint8Array(e).subarray(t,r),r}toBER(e){return this.dataView.slice().buffer}},e.RelativeObjectIdentifier=he,e.Repeated=lt,e.Sequence=fe,e.Set=ge,e.TIME=at,e.TeletexString=Ne,e.TimeOfDay=tt,e.UTCTime=$e,e.UniversalString=Ie,e.Utf8String=Se,e.ValueBlock=S,e.VideotexString=je,e.ViewWriter=l,e.VisibleString=ze,e.compareSchema=ut,e.fromBER=function(e){if(!e.byteLength){const e=new A({},S);return e.error="Input buffer has zero length",{offset:-1,result:e}}return F(s.BufferSourceConverter.toUint8Array(e).slice(),0,e.byteLength)},e.verifySchema=function(e,t){if(t instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const i=F(s.BufferSourceConverter.toUint8Array(e));return-1===i.offset?{verified:!1,result:i.result}:ut(i.result,i.result,t)}}}),require_enums=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/enums.js"(e){"use strict";var t,i,r,s;Object.defineProperty(e,"__esModule",{value:!0}),e.AsnPropTypes=e.AsnTypeTypes=void 0,(i=t||(e.AsnTypeTypes=t={}))[i.Sequence=0]="Sequence",i[i.Set=1]="Set",i[i.Choice=2]="Choice",(s=r||(e.AsnPropTypes=r={}))[s.Any=1]="Any",s[s.Boolean=2]="Boolean",s[s.OctetString=3]="OctetString",s[s.BitString=4]="BitString",s[s.Integer=5]="Integer",s[s.Enumerated=6]="Enumerated",s[s.ObjectIdentifier=7]="ObjectIdentifier",s[s.Utf8String=8]="Utf8String",s[s.BmpString=9]="BmpString",s[s.UniversalString=10]="UniversalString",s[s.NumericString=11]="NumericString",s[s.PrintableString=12]="PrintableString",s[s.TeletexString=13]="TeletexString",s[s.VideotexString=14]="VideotexString",s[s.IA5String=15]="IA5String",s[s.GraphicString=16]="GraphicString",s[s.VisibleString=17]="VisibleString",s[s.GeneralString=18]="GeneralString",s[s.CharacterString=19]="CharacterString",s[s.UTCTime=20]="UTCTime",s[s.GeneralizedTime=21]="GeneralizedTime",s[s.DATE=22]="DATE",s[s.TimeOfDay=23]="TimeOfDay",s[s.DateTime=24]="DateTime",s[s.Duration=25]="Duration",s[s.TIME=26]="TIME",s[s.Null=27]="Null"}}),require_bit_string=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/types/bit_string.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BitString=void 0;var t=require_build4(),i=require_build3();e.BitString=class{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if("number"==typeof e)this.fromNumber(e);else{if(!i.BufferSourceConverter.isBufferSource(e))throw TypeError("Unsupported type of 'params' argument for BitString");this.unusedBits=t,this.value=i.BufferSourceConverter.toArrayBuffer(e)}}fromASN(e){if(!(e instanceof t.BitString))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new t.BitString({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new t.BitString({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const r=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(t.slice(s<<3,8+(s<<3)),2),s++;this.value=r.buffer}}}}),require_octet_string=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/types/octet_string.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OctetString=void 0;var t=require_build4(),i=require_build3();e.OctetString=class{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){"number"==typeof e?this.buffer=new ArrayBuffer(e):i.BufferSourceConverter.isBufferSource(e)?this.buffer=i.BufferSourceConverter.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof t.OctetString))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new t.OctetString({valueHex:this.buffer})}toSchema(e){return new t.OctetString({name:e})}}}}),require_types=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/types/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_bit_string(),e),t.__exportStar(require_octet_string(),e)}}),require_converters=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/converters.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnNullConverter=e.AsnGeneralizedTimeConverter=e.AsnUTCTimeConverter=e.AsnCharacterStringConverter=e.AsnGeneralStringConverter=e.AsnVisibleStringConverter=e.AsnGraphicStringConverter=e.AsnIA5StringConverter=e.AsnVideotexStringConverter=e.AsnTeletexStringConverter=e.AsnPrintableStringConverter=e.AsnNumericStringConverter=e.AsnUniversalStringConverter=e.AsnBmpStringConverter=e.AsnUtf8StringConverter=e.AsnConstructedOctetStringConverter=e.AsnOctetStringConverter=e.AsnBooleanConverter=e.AsnObjectIdentifierConverter=e.AsnBitStringConverter=e.AsnIntegerBigIntConverter=e.AsnIntegerArrayBufferConverter=e.AsnEnumeratedConverter=e.AsnIntegerConverter=e.AsnAnyConverter=void 0,e.defaultConverter=function(t){switch(t){case i.AsnPropTypes.Any:return e.AsnAnyConverter;case i.AsnPropTypes.BitString:return e.AsnBitStringConverter;case i.AsnPropTypes.BmpString:return e.AsnBmpStringConverter;case i.AsnPropTypes.Boolean:return e.AsnBooleanConverter;case i.AsnPropTypes.CharacterString:return e.AsnCharacterStringConverter;case i.AsnPropTypes.Enumerated:return e.AsnEnumeratedConverter;case i.AsnPropTypes.GeneralString:return e.AsnGeneralStringConverter;case i.AsnPropTypes.GeneralizedTime:return e.AsnGeneralizedTimeConverter;case i.AsnPropTypes.GraphicString:return e.AsnGraphicStringConverter;case i.AsnPropTypes.IA5String:return e.AsnIA5StringConverter;case i.AsnPropTypes.Integer:return e.AsnIntegerConverter;case i.AsnPropTypes.Null:return e.AsnNullConverter;case i.AsnPropTypes.NumericString:return e.AsnNumericStringConverter;case i.AsnPropTypes.ObjectIdentifier:return e.AsnObjectIdentifierConverter;case i.AsnPropTypes.OctetString:return e.AsnOctetStringConverter;case i.AsnPropTypes.PrintableString:return e.AsnPrintableStringConverter;case i.AsnPropTypes.TeletexString:return e.AsnTeletexStringConverter;case i.AsnPropTypes.UTCTime:return e.AsnUTCTimeConverter;case i.AsnPropTypes.UniversalString:return e.AsnUniversalStringConverter;case i.AsnPropTypes.Utf8String:return e.AsnUtf8StringConverter;case i.AsnPropTypes.VideotexString:return e.AsnVideotexStringConverter;case i.AsnPropTypes.VisibleString:return e.AsnVisibleStringConverter;default:return null}};var t=require_build4(),i=require_enums(),r=require_types();function s(e){return{fromASN:e=>e.valueBlock.value,toASN:t=>new e({value:t})}}e.AsnAnyConverter={fromASN:e=>e instanceof t.Null?null:e.valueBeforeDecodeView,toASN:e=>{if(null===e)return new t.Null;const i=t.fromBER(e);if(i.result.error)throw new Error(i.result.error);return i.result}},e.AsnIntegerConverter={fromASN:e=>e.valueBlock.valueHexView.byteLength>=4?e.valueBlock.toString():e.valueBlock.valueDec,toASN:e=>new t.Integer({value:+e})},e.AsnEnumeratedConverter={fromASN:e=>e.valueBlock.valueDec,toASN:e=>new t.Enumerated({value:e})},e.AsnIntegerArrayBufferConverter={fromASN:e=>e.valueBlock.valueHexView,toASN:e=>new t.Integer({valueHex:e})},e.AsnIntegerBigIntConverter={fromASN:e=>e.toBigInt(),toASN:e=>t.Integer.fromBigInt(e)},e.AsnBitStringConverter={fromASN:e=>e.valueBlock.valueHexView,toASN:e=>new t.BitString({valueHex:e})},e.AsnObjectIdentifierConverter={fromASN:e=>e.valueBlock.toString(),toASN:e=>new t.ObjectIdentifier({value:e})},e.AsnBooleanConverter={fromASN:e=>e.valueBlock.value,toASN:e=>new t.Boolean({value:e})},e.AsnOctetStringConverter={fromASN:e=>e.valueBlock.valueHexView,toASN:e=>new t.OctetString({valueHex:e})},e.AsnConstructedOctetStringConverter={fromASN:e=>new r.OctetString(e.getValue()),toASN:e=>e.toASN()},e.AsnUtf8StringConverter=s(t.Utf8String),e.AsnBmpStringConverter=s(t.BmpString),e.AsnUniversalStringConverter=s(t.UniversalString),e.AsnNumericStringConverter=s(t.NumericString),e.AsnPrintableStringConverter=s(t.PrintableString),e.AsnTeletexStringConverter=s(t.TeletexString),e.AsnVideotexStringConverter=s(t.VideotexString),e.AsnIA5StringConverter=s(t.IA5String),e.AsnGraphicStringConverter=s(t.GraphicString),e.AsnVisibleStringConverter=s(t.VisibleString),e.AsnGeneralStringConverter=s(t.GeneralString),e.AsnCharacterStringConverter=s(t.CharacterString),e.AsnUTCTimeConverter={fromASN:e=>e.toDate(),toASN:e=>new t.UTCTime({valueDate:e})},e.AsnGeneralizedTimeConverter={fromASN:e=>e.toDate(),toASN:e=>new t.GeneralizedTime({valueDate:e})},e.AsnNullConverter={fromASN:()=>null,toASN:()=>new t.Null}}}),require_helper=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/helper.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isConvertible=function e(t){return"function"==typeof t&&t.prototype?!(!t.prototype.toASN||!t.prototype.fromASN)||e(t.prototype):!!(t&&"object"==typeof t&&"toASN"in t&&"fromASN"in t)},e.isTypeOfArray=function e(t){var i;if(t){const r=Object.getPrototypeOf(t);return(null===(i=null==r?void 0:r.prototype)||void 0===i?void 0:i.constructor)===Array||e(r)}return!1},e.isArrayEqual=function(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;const i=new Uint8Array(e),r=new Uint8Array(t);for(let t=0;t<e.byteLength;t++)if(i[t]!==r[t])return!1;return!0}}}),require_schema=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/schema.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnSchemaStorage=void 0;var t=require_build4(),i=require_enums(),r=require_helper();e.AsnSchemaStorage=class{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:i.AsnTypeTypes.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(t,r),t.items=Object.assign({},t.items,r.items)),t}create(e,s){const n=this.items.get(e)||this.createDefault(e),a=[];for(const e in n.items){const o=n.items[e],c=s?e:"";let l;if("number"==typeof o.type){const e=i.AsnPropTypes[o.type],r=t[e];if(!r)throw new Error(`Cannot get ASN1 class by name '${e}'`);l=new r({name:c})}else if((0,r.isConvertible)(o.type)){l=(new o.type).toSchema(c)}else if(o.optional){this.get(o.type).type===i.AsnTypeTypes.Choice?l=new t.Any({name:c}):(l=this.create(o.type,!1),l.name=c)}else l=new t.Any({name:c});const u=!!o.optional||void 0!==o.defaultValue;if(o.repeated){l.name="";l=new("set"===o.repeated?t.Set:t.Sequence)({name:"",value:[new t.Repeated({name:c,value:l})]})}if(null!==o.context&&void 0!==o.context)if(o.implicit)if("number"==typeof o.type||(0,r.isConvertible)(o.type)){const e=o.repeated?t.Constructed:t.Primitive;a.push(new e({name:c,optional:u,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);const e=!!o.repeated;let i=e?l:this.get(o.type,!0).schema;i="valueBlock"in i?i.valueBlock.value:i.value,a.push(new t.Constructed({name:e?"":c,optional:u,idBlock:{tagClass:3,tagNumber:o.context},value:i}))}else a.push(new t.Constructed({optional:u,idBlock:{tagClass:3,tagNumber:o.context},value:[l]}));else l.optional=u,a.push(l)}switch(n.type){case i.AsnTypeTypes.Sequence:return new t.Sequence({value:a,name:""});case i.AsnTypeTypes.Set:return new t.Set({value:a,name:""});case i.AsnTypeTypes.Choice:return new t.Choice({value:a,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);if(t){return this.items.get(t)||this.findParentSchema(t)}return null}}}}),require_storage=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/storage.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.schemaStorage=void 0;var t=require_schema();e.schemaStorage=new t.AsnSchemaStorage}}),require_decorators=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/decorators.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnProp=e.AsnSequenceType=e.AsnSetType=e.AsnChoiceType=e.AsnType=void 0;var t=require_converters(),i=require_enums(),r=require_storage();e.AsnType=e=>t=>{let i;r.schemaStorage.has(t)?i=r.schemaStorage.get(t):(i=r.schemaStorage.createDefault(t),r.schemaStorage.set(t,i)),Object.assign(i,e)};e.AsnChoiceType=()=>(0,e.AsnType)({type:i.AsnTypeTypes.Choice});e.AsnSetType=t=>(0,e.AsnType)({type:i.AsnTypeTypes.Set,...t});e.AsnSequenceType=t=>(0,e.AsnType)({type:i.AsnTypeTypes.Sequence,...t});e.AsnProp=e=>(i,s)=>{let n;r.schemaStorage.has(i.constructor)?n=r.schemaStorage.get(i.constructor):(n=r.schemaStorage.createDefault(i.constructor),r.schemaStorage.set(i.constructor,n));const a=Object.assign({},e);if("number"==typeof a.type&&!a.converter){const r=t.defaultConverter(e.type);if(!r)throw new Error(`Cannot get default converter for property '${s}' of ${i.constructor.name}`);a.converter=r}n.items[s]=a}}}),require_schema_validation=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/errors/schema_validation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnSchemaValidationError=void 0;var t=class extends Error{constructor(){super(...arguments),this.schemas=[]}};e.AsnSchemaValidationError=t}}),require_errors=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/errors/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(init_tslib_es6(),__toCommonJS(tslib_es6_exports)).__exportStar(require_schema_validation(),e)}}),require_parser3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/parser.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnParser=void 0;var t=require_build4(),i=require_enums(),r=require_converters(),s=require_errors(),n=require_helper(),a=require_storage();e.AsnParser=class{static parse(e,i){const r=t.fromBER(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,i)}static fromASN(e,o){var c;try{if((0,n.isConvertible)(o)){return(new o).fromASN(e)}const l=a.schemaStorage.get(o);a.schemaStorage.cache(o);let u=l.schema;if(e.constructor===t.Constructed&&l.type!==i.AsnTypeTypes.Choice){u=new t.Constructed({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:l.schema.valueBlock.value});for(const t in l.items)delete e[t]}const d=t.compareSchema({},e,u);if(!d.verified)throw new s.AsnSchemaValidationError(`Data does not match to ${o.name} ASN1 schema. ${d.result.error}`);const p=new o;if((0,n.isTypeOfArray)(o)){if(!("value"in e.valueBlock)||!Array.isArray(e.valueBlock.value))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const t=l.itemType;if("number"==typeof t){const i=r.defaultConverter(t);if(!i)throw new Error(`Cannot get default converter for array item of ${o.name} ASN1 schema`);return o.from(e.valueBlock.value,(e=>i.fromASN(e)))}return o.from(e.valueBlock.value,(e=>this.fromASN(e,t)))}for(const e in l.items){const r=d.result[e];if(!r)continue;const s=l.items[e],a=s.type;if("number"==typeof a||(0,n.isConvertible)(a)){const o=null!==(c=s.converter)&&void 0!==c?c:(0,n.isConvertible)(a)?new a:null;if(!o)throw new Error("Converter is empty");if(s.repeated)if(s.implicit){const i=new("sequence"===s.repeated?t.Sequence:t.Set);i.valueBlock=r.valueBlock;const n=t.fromBER(i.toBER(!1));if(-1===n.offset)throw new Error(`Cannot parse the child item. ${n.result.error}`);if(!("value"in n.result.valueBlock)||!Array.isArray(n.result.valueBlock.value))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const a=n.result.valueBlock.value;p[e]=Array.from(a,(e=>o.fromASN(e)))}else p[e]=Array.from(r,(e=>o.fromASN(e)));else{let c=r;if(s.implicit){let e;if((0,n.isConvertible)(a))e=(new a).toSchema("");else{const r=i.AsnPropTypes[a],s=t[r];if(!s)throw new Error(`Cannot get '${r}' class from asn1js module`);e=new s}e.valueBlock=c.valueBlock,c=t.fromBER(e.toBER(!1)).result}p[e]=o.fromASN(c)}}else if(s.repeated){if(!Array.isArray(r))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");p[e]=Array.from(r,(e=>this.fromASN(e,a)))}else p[e]=this.fromASN(r,a)}return p}catch(e){throw e instanceof s.AsnSchemaValidationError&&e.schemas.push(o.name),e}}}}}),require_serializer=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/serializer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnSerializer=void 0;var t=require_build4(),i=require_converters(),r=require_enums(),s=require_helper(),n=require_storage();e.AsnSerializer=class e{static serialize(e){return e instanceof t.BaseBlock?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(a){if(a&&"object"==typeof a&&(0,s.isConvertible)(a))return a.toASN();if(!a||"object"!=typeof a)throw new TypeError("Parameter 1 should be type of Object.");const o=a.constructor,c=n.schemaStorage.get(o);n.schemaStorage.cache(o);let l,u=[];if(c.itemType){if(!Array.isArray(a))throw new TypeError("Parameter 1 should be type of Array.");if("number"==typeof c.itemType){const e=i.defaultConverter(c.itemType);if(!e)throw new Error(`Cannot get default converter for array item of ${o.name} ASN1 schema`);u=a.map((t=>e.toASN(t)))}else u=a.map((e=>this.toAsnItem({type:c.itemType},"[]",o,e)))}else for(const i in c.items){const r=c.items[i],n=a[i];if(void 0===n||r.defaultValue===n||"object"==typeof r.defaultValue&&"object"==typeof n&&(0,s.isArrayEqual)(this.serialize(r.defaultValue),this.serialize(n)))continue;const l=e.toAsnItem(r,i,o,n);if("number"==typeof r.context)if(r.implicit)if(r.repeated||"number"!=typeof r.type&&!(0,s.isConvertible)(r.type))u.push(new t.Constructed({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},value:l.valueBlock.value}));else{const e={};e.valueHex=l instanceof t.Null?l.valueBeforeDecodeView:l.valueBlock.toBER(),u.push(new t.Primitive({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},...e}))}else u.push(new t.Constructed({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},value:[l]}));else r.repeated?u=u.concat(l):u.push(l)}switch(c.type){case r.AsnTypeTypes.Sequence:l=new t.Sequence({value:u});break;case r.AsnTypeTypes.Set:l=new t.Set({value:u});break;case r.AsnTypeTypes.Choice:if(!u[0])throw new Error(`Schema '${o.name}' has wrong data. Choice cannot be empty.`);l=u[0]}return l}static toAsnItem(e,i,s,n){let a;if("number"==typeof e.type){const o=e.converter;if(!o)throw new Error(`Property '${i}' doesn't have converter for type ${r.AsnPropTypes[e.type]} in schema '${s.name}'`);if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const i=Array.from(n,(e=>o.toASN(e)));a=new("sequence"===e.repeated?t.Sequence:t.Set)({value:i})}else a=o.toASN(n)}else if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const i=Array.from(n,(e=>this.toASN(e)));a=new("sequence"===e.repeated?t.Sequence:t.Set)({value:i})}else a=this.toASN(n);return a}}}}),require_objects=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/objects.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnArray=void 0;e.AsnArray=class extends Array{constructor(e=[]){if("number"==typeof e)super(e);else{super();for(const t of e)this.push(t)}}}}}),require_convert=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/convert.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnConvert=void 0;var t=require_build4(),i=require_build3(),r=require_parser3(),s=require_serializer();e.AsnConvert=class e{static serialize(e){return s.AsnSerializer.serialize(e)}static parse(e,t){return r.AsnParser.parse(e,t)}static toString(r){const s=i.BufferSourceConverter.isBufferSource(r)?i.BufferSourceConverter.toArrayBuffer(r):e.serialize(r),n=t.fromBER(s);if(-1===n.offset)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}}}}),require_cjs=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-schema/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsnSerializer=e.AsnParser=e.AsnPropTypes=e.AsnTypeTypes=e.AsnSetType=e.AsnSequenceType=e.AsnChoiceType=e.AsnType=e.AsnProp=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_converters(),e),t.__exportStar(require_types(),e);var i=require_decorators();Object.defineProperty(e,"AsnProp",{enumerable:!0,get:function(){return i.AsnProp}}),Object.defineProperty(e,"AsnType",{enumerable:!0,get:function(){return i.AsnType}}),Object.defineProperty(e,"AsnChoiceType",{enumerable:!0,get:function(){return i.AsnChoiceType}}),Object.defineProperty(e,"AsnSequenceType",{enumerable:!0,get:function(){return i.AsnSequenceType}}),Object.defineProperty(e,"AsnSetType",{enumerable:!0,get:function(){return i.AsnSetType}});var r=require_enums();Object.defineProperty(e,"AsnTypeTypes",{enumerable:!0,get:function(){return r.AsnTypeTypes}}),Object.defineProperty(e,"AsnPropTypes",{enumerable:!0,get:function(){return r.AsnPropTypes}});var s=require_parser3();Object.defineProperty(e,"AsnParser",{enumerable:!0,get:function(){return s.AsnParser}});var n=require_serializer();Object.defineProperty(e,"AsnSerializer",{enumerable:!0,get:function(){return n.AsnSerializer}}),t.__exportStar(require_errors(),e),t.__exportStar(require_objects(),e),t.__exportStar(require_convert(),e)}}),require_ip_converter=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/ip_converter.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IpConverter=void 0;var t=require_build3();e.IpConverter=class{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const t=e.split(".");if(4!==t.length)throw new Error("Invalid IPv4 address");return t.map((e=>{const t=parseInt(e,10);if(isNaN(t)||t<0||t>255)throw new Error("Invalid IPv4 address part");return t}))}static parseIPv6(e){const t=this.expandIPv6(e).split(":");if(8!==t.length)throw new Error("Invalid IPv6 address");return t.reduce(((e,t)=>{const i=parseInt(t,16);if(isNaN(i)||i<0||i>65535)throw new Error("Invalid IPv6 address part");return e.push(i>>8&255),e.push(255&i),e}),[])}static expandIPv6(e){if(!e.includes("::"))return e;const t=e.split("::");if(t.length>2)throw new Error("Invalid IPv6 address");const i=t[0]?t[0].split(":"):[],r=t[1]?t[1].split(":"):[],s=8-(i.length+r.length);if(s<0)throw new Error("Invalid IPv6 address");return[...i,...Array(s).fill("0"),...r].join(":")}static formatIPv6(e){const t=[];for(let i=0;i<16;i+=2)t.push((e[i]<<8|e[i+1]).toString(16));return this.compressIPv6(t.join(":"))}static compressIPv6(e){const t=e.split(":");let i=-1,r=0,s=-1,n=0;for(let e=0;e<t.length;e++)"0"===t[e]?(-1===s&&(s=e),n++):(n>r&&(i=s,r=n),s=-1,n=0);if(n>r&&(i=s,r=n),r>1){return`${t.slice(0,i).join(":")}::${t.slice(i+r).join(":")}`}return e}static parseCIDR(e){const[t,i]=e.split("/"),r=parseInt(i,10);if(this.isIPv4(t)){if(r<0||r>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(t),r]}if(r<0||r>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(t),r]}static decodeIP(e){if(64===e.length&&0===parseInt(e,16))return"::/0";if(16!==e.length)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce(((e,t)=>e+ +t),0);let i=e.slice(0,8).replace(/(.{2})/g,(e=>`${parseInt(e,16)}.`));return i=i.slice(0,-1),`${i}/${t}`}static toString(e){const i=new Uint8Array(e);if(4===i.length)return Array.from(i).join(".");if(16===i.length)return this.formatIPv6(i);if(8===i.length||32===i.length){const e=i.length/2,t=i.slice(0,e),r=i.slice(e);if(i.every((e=>0===e)))return 8===i.length?"0.0.0.0/0":"::/0";const s=r.reduce(((e,t)=>e+(t.toString(2).match(/1/g)||[]).length),0);if(8===i.length){return`${Array.from(t).join(".")}/${s}`}return`${this.formatIPv6(t)}/${s}`}return this.decodeIP(t.Convert.ToHex(e))}static fromString(e){if(e.includes("/")){const[t,i]=this.parseCIDR(e),r=new Uint8Array(t.length);let s=i;for(let e=0;e<r.length;e++)s>=8?(r[e]=255,s-=8):s>0&&(r[e]=255<<8-s,s=0);const n=new Uint8Array(2*t.length);return n.set(t,0),n.set(r,t.length),n.buffer}const t=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(t).buffer}}}}),require_name=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/name.js"(e){"use strict";var t,i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.Name=e.RDNSequence=e.RelativeDistinguishedName=e.AttributeTypeAndValue=e.AttributeValue=e.DirectoryString=void 0;var s=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),n=require_cjs(),a=require_build3(),o=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};e.DirectoryString=o,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.TeletexString})],o.prototype,"teletexString",void 0),s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.PrintableString})],o.prototype,"printableString",void 0),s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.UniversalString})],o.prototype,"universalString",void 0),s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.Utf8String})],o.prototype,"utf8String",void 0),s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.BmpString})],o.prototype,"bmpString",void 0),e.DirectoryString=o=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],o);var c=class extends o{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?a.Convert.ToHex(this.anyValue):super.toString())}};e.AttributeValue=c,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.IA5String})],c.prototype,"ia5String",void 0),s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.Any})],c.prototype,"anyValue",void 0),e.AttributeValue=c=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],c);var l=class{constructor(e={}){this.type="",this.value=new c,Object.assign(this,e)}};e.AttributeTypeAndValue=l,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.ObjectIdentifier})],l.prototype,"type",void 0),s.__decorate([(0,n.AsnProp)({type:c})],l.prototype,"value",void 0);var u=t=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.RelativeDistinguishedName=u,e.RelativeDistinguishedName=u=t=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Set,itemType:l})],u);var d=i=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,i.prototype)}};e.RDNSequence=d,e.RDNSequence=d=i=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence,itemType:u})],d);var p=r=class extends d{constructor(e){super(e),Object.setPrototypeOf(this,r.prototype)}};e.Name=p,e.Name=p=r=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],p)}}),require_general_name=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/general_name.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GeneralName=e.EDIPartyName=e.OtherName=e.AsnIpConverter=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_ip_converter(),s=require_name();e.AsnIpConverter={fromASN:e=>r.IpConverter.toString(i.AsnOctetStringConverter.fromASN(e)),toASN:e=>i.AsnOctetStringConverter.toASN(r.IpConverter.fromString(e))};var n=class{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}};e.OtherName=n,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],n.prototype,"typeId",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,context:0})],n.prototype,"value",void 0);var a=class{constructor(e={}){this.partyName=new s.DirectoryString,Object.assign(this,e)}};e.EDIPartyName=a,t.__decorate([(0,i.AsnProp)({type:s.DirectoryString,optional:!0,context:0,implicit:!0})],a.prototype,"nameAssigner",void 0),t.__decorate([(0,i.AsnProp)({type:s.DirectoryString,context:1,implicit:!0})],a.prototype,"partyName",void 0);var o=class{constructor(e={}){Object.assign(this,e)}};e.GeneralName=o,t.__decorate([(0,i.AsnProp)({type:n,context:0,implicit:!0})],o.prototype,"otherName",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.IA5String,context:1,implicit:!0})],o.prototype,"rfc822Name",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.IA5String,context:2,implicit:!0})],o.prototype,"dNSName",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,context:3,implicit:!0})],o.prototype,"x400Address",void 0),t.__decorate([(0,i.AsnProp)({type:s.Name,context:4,implicit:!1})],o.prototype,"directoryName",void 0),t.__decorate([(0,i.AsnProp)({type:a,context:5})],o.prototype,"ediPartyName",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.IA5String,context:6,implicit:!0})],o.prototype,"uniformResourceIdentifier",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.OctetString,context:7,implicit:!0,converter:e.AsnIpConverter})],o.prototype,"iPAddress",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier,context:8,implicit:!0})],o.prototype,"registeredID",void 0),e.GeneralName=o=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],o)}}),require_object_identifiers=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/object_identifiers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_ce=e.id_ad_caRepository=e.id_ad_timeStamping=e.id_ad_caIssuers=e.id_ad_ocsp=e.id_qt_unotice=e.id_qt_csp=e.id_ad=e.id_kp=e.id_qt=e.id_pe=e.id_pkix=void 0,e.id_pkix="1.3.6.1.5.5.7",e.id_pe=`${e.id_pkix}.1`,e.id_qt=`${e.id_pkix}.2`,e.id_kp=`${e.id_pkix}.3`,e.id_ad=`${e.id_pkix}.48`,e.id_qt_csp=`${e.id_qt}.1`,e.id_qt_unotice=`${e.id_qt}.2`,e.id_ad_ocsp=`${e.id_ad}.1`,e.id_ad_caIssuers=`${e.id_ad}.2`,e.id_ad_timeStamping=`${e.id_ad}.3`,e.id_ad_caRepository=`${e.id_ad}.5`,e.id_ce="2.5.29"}}),require_authority_information_access=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/authority_information_access.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.AuthorityInfoAccessSyntax=e.AccessDescription=e.id_pe_authorityInfoAccess=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_general_name(),n=require_object_identifiers();e.id_pe_authorityInfoAccess=`${n.id_pe}.1`;var a=class{constructor(e={}){this.accessMethod="",this.accessLocation=new s.GeneralName,Object.assign(this,e)}};e.AccessDescription=a,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],a.prototype,"accessMethod",void 0),i.__decorate([(0,r.AsnProp)({type:s.GeneralName})],a.prototype,"accessLocation",void 0);var o=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.AuthorityInfoAccessSyntax=o,e.AuthorityInfoAccessSyntax=o=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:a})],o)}}),require_authority_key_identifier=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/authority_key_identifier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AuthorityKeyIdentifier=e.KeyIdentifier=e.id_ce_authorityKeyIdentifier=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_general_name(),s=require_object_identifiers();e.id_ce_authorityKeyIdentifier=`${s.id_ce}.35`;var n=class extends i.OctetString{};e.KeyIdentifier=n;var a=class{constructor(e={}){e&&Object.assign(this,e)}};e.AuthorityKeyIdentifier=a,t.__decorate([(0,i.AsnProp)({type:n,context:0,optional:!0,implicit:!0})],a.prototype,"keyIdentifier",void 0),t.__decorate([(0,i.AsnProp)({type:r.GeneralName,context:1,optional:!0,implicit:!0,repeated:"sequence"})],a.prototype,"authorityCertIssuer",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,context:2,optional:!0,implicit:!0,converter:i.AsnIntegerArrayBufferConverter})],a.prototype,"authorityCertSerialNumber",void 0)}}),require_basic_constraints=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/basic_constraints.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BasicConstraints=e.id_ce_basicConstraints=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers();e.id_ce_basicConstraints=`${r.id_ce}.19`;var s=class{constructor(e={}){this.cA=!1,Object.assign(this,e)}};e.BasicConstraints=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Boolean,defaultValue:!1})],s.prototype,"cA",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,optional:!0})],s.prototype,"pathLenConstraint",void 0)}}),require_general_names=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/general_names.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.GeneralNames=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_general_name(),n=require_cjs(),a=t=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.GeneralNames=a,e.GeneralNames=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s.GeneralName})],a)}}),require_certificate_issuer=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/certificate_issuer.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.CertificateIssuer=e.id_ce_certificateIssuer=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_general_names(),n=require_object_identifiers();e.id_ce_certificateIssuer=`${n.id_ce}.29`;var a=t=class extends s.GeneralNames{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.CertificateIssuer=a,e.CertificateIssuer=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence})],a)}}),require_certificate_policies=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/certificate_policies.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.CertificatePolicies=e.PolicyInformation=e.PolicyQualifierInfo=e.Qualifier=e.UserNotice=e.NoticeReference=e.DisplayText=e.id_ce_certificatePolicies_anyPolicy=e.id_ce_certificatePolicies=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_object_identifiers();e.id_ce_certificatePolicies=`${s.id_ce}.32`,e.id_ce_certificatePolicies_anyPolicy=`${e.id_ce_certificatePolicies}.0`;var n=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};e.DisplayText=n,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.IA5String})],n.prototype,"ia5String",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.VisibleString})],n.prototype,"visibleString",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.BmpString})],n.prototype,"bmpString",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Utf8String})],n.prototype,"utf8String",void 0),e.DisplayText=n=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],n);var a=class{constructor(e={}){this.organization=new n,this.noticeNumbers=[],Object.assign(this,e)}};e.NoticeReference=a,i.__decorate([(0,r.AsnProp)({type:n})],a.prototype,"organization",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,repeated:"sequence"})],a.prototype,"noticeNumbers",void 0);var o=class{constructor(e={}){Object.assign(this,e)}};e.UserNotice=o,i.__decorate([(0,r.AsnProp)({type:a,optional:!0})],o.prototype,"noticeRef",void 0),i.__decorate([(0,r.AsnProp)({type:n,optional:!0})],o.prototype,"explicitText",void 0);var c=class{constructor(e={}){Object.assign(this,e)}};e.Qualifier=c,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.IA5String})],c.prototype,"cPSuri",void 0),i.__decorate([(0,r.AsnProp)({type:o})],c.prototype,"userNotice",void 0),e.Qualifier=c=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],c);var l=class{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}};e.PolicyQualifierInfo=l,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],l.prototype,"policyQualifierId",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Any})],l.prototype,"qualifier",void 0);var u=class{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}};e.PolicyInformation=u,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],u.prototype,"policyIdentifier",void 0),i.__decorate([(0,r.AsnProp)({type:l,repeated:"sequence",optional:!0})],u.prototype,"policyQualifiers",void 0);var d=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.CertificatePolicies=d,e.CertificatePolicies=d=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:u})],d)}}),require_crl_number=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_number.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CRLNumber=e.id_ce_cRLNumber=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers();e.id_ce_cRLNumber=`${r.id_ce}.20`;var s=class{constructor(e=0){this.value=e}};e.CRLNumber=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],s.prototype,"value",void 0),e.CRLNumber=s=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],s)}}),require_crl_delta_indicator=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_delta_indicator.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCRLNumber=e.id_ce_deltaCRLIndicator=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers(),s=require_crl_number();e.id_ce_deltaCRLIndicator=`${r.id_ce}.27`;var n=class extends s.CRLNumber{};e.BaseCRLNumber=n,e.BaseCRLNumber=n=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],n)}}),require_crl_distribution_points=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_distribution_points.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.CRLDistributionPoints=e.DistributionPoint=e.DistributionPointName=e.Reason=e.ReasonFlags=e.id_ce_cRLDistributionPoints=void 0;var i,r,s=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),n=require_cjs(),a=require_name(),o=require_general_name(),c=require_object_identifiers();e.id_ce_cRLDistributionPoints=`${c.id_ce}.31`,(r=i||(e.ReasonFlags=i={}))[r.unused=1]="unused",r[r.keyCompromise=2]="keyCompromise",r[r.cACompromise=4]="cACompromise",r[r.affiliationChanged=8]="affiliationChanged",r[r.superseded=16]="superseded",r[r.cessationOfOperation=32]="cessationOfOperation",r[r.certificateHold=64]="certificateHold",r[r.privilegeWithdrawn=128]="privilegeWithdrawn",r[r.aACompromise=256]="aACompromise";var l=class extends n.BitString{toJSON(){const e=[],t=this.toNumber();return t&i.aACompromise&&e.push("aACompromise"),t&i.affiliationChanged&&e.push("affiliationChanged"),t&i.cACompromise&&e.push("cACompromise"),t&i.certificateHold&&e.push("certificateHold"),t&i.cessationOfOperation&&e.push("cessationOfOperation"),t&i.keyCompromise&&e.push("keyCompromise"),t&i.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&i.superseded&&e.push("superseded"),t&i.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}};e.Reason=l;var u=class{constructor(e={}){Object.assign(this,e)}};e.DistributionPointName=u,s.__decorate([(0,n.AsnProp)({type:o.GeneralName,context:0,repeated:"sequence",implicit:!0})],u.prototype,"fullName",void 0),s.__decorate([(0,n.AsnProp)({type:a.RelativeDistinguishedName,context:1,implicit:!0})],u.prototype,"nameRelativeToCRLIssuer",void 0),e.DistributionPointName=u=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],u);var d=class{constructor(e={}){Object.assign(this,e)}};e.DistributionPoint=d,s.__decorate([(0,n.AsnProp)({type:u,context:0,optional:!0})],d.prototype,"distributionPoint",void 0),s.__decorate([(0,n.AsnProp)({type:l,context:1,optional:!0,implicit:!0})],d.prototype,"reasons",void 0),s.__decorate([(0,n.AsnProp)({type:o.GeneralName,context:2,optional:!0,repeated:"sequence",implicit:!0})],d.prototype,"cRLIssuer",void 0);var p=t=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.CRLDistributionPoints=p,e.CRLDistributionPoints=p=t=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence,itemType:d})],p)}}),require_crl_freshest=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_freshest.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.FreshestCRL=e.id_ce_freshestCRL=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_object_identifiers(),n=require_crl_distribution_points();e.id_ce_freshestCRL=`${s.id_ce}.46`;var a=t=class extends n.CRLDistributionPoints{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.FreshestCRL=a,e.FreshestCRL=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:n.DistributionPoint})],a)}}),require_crl_issuing_distribution_point=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_issuing_distribution_point.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IssuingDistributionPoint=e.id_ce_issuingDistributionPoint=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_crl_distribution_points(),s=require_object_identifiers(),n=require_cjs();e.id_ce_issuingDistributionPoint=`${s.id_ce}.28`;var a=class e{constructor(t={}){this.onlyContainsUserCerts=e.ONLY,this.onlyContainsCACerts=e.ONLY,this.indirectCRL=e.ONLY,this.onlyContainsAttributeCerts=e.ONLY,Object.assign(this,t)}};e.IssuingDistributionPoint=a,a.ONLY=!1,t.__decorate([(0,i.AsnProp)({type:r.DistributionPointName,context:0,optional:!0})],a.prototype,"distributionPoint",void 0),t.__decorate([(0,i.AsnProp)({type:n.AsnPropTypes.Boolean,context:1,defaultValue:a.ONLY,implicit:!0})],a.prototype,"onlyContainsUserCerts",void 0),t.__decorate([(0,i.AsnProp)({type:n.AsnPropTypes.Boolean,context:2,defaultValue:a.ONLY,implicit:!0})],a.prototype,"onlyContainsCACerts",void 0),t.__decorate([(0,i.AsnProp)({type:r.Reason,context:3,optional:!0,implicit:!0})],a.prototype,"onlySomeReasons",void 0),t.__decorate([(0,i.AsnProp)({type:n.AsnPropTypes.Boolean,context:4,defaultValue:a.ONLY,implicit:!0})],a.prototype,"indirectCRL",void 0),t.__decorate([(0,i.AsnProp)({type:n.AsnPropTypes.Boolean,context:5,defaultValue:a.ONLY,implicit:!0})],a.prototype,"onlyContainsAttributeCerts",void 0)}}),require_crl_reason=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_reason.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CRLReason=e.CRLReasons=e.id_ce_cRLReasons=void 0;var t,i,r=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),s=require_cjs(),n=require_object_identifiers();e.id_ce_cRLReasons=`${n.id_ce}.21`,(i=t||(e.CRLReasons=t={}))[i.unspecified=0]="unspecified",i[i.keyCompromise=1]="keyCompromise",i[i.cACompromise=2]="cACompromise",i[i.affiliationChanged=3]="affiliationChanged",i[i.superseded=4]="superseded",i[i.cessationOfOperation=5]="cessationOfOperation",i[i.certificateHold=6]="certificateHold",i[i.removeFromCRL=8]="removeFromCRL",i[i.privilegeWithdrawn=9]="privilegeWithdrawn",i[i.aACompromise=10]="aACompromise";var a=class{constructor(e=t.unspecified){this.reason=t.unspecified,this.reason=e}toJSON(){return t[this.reason]}toString(){return this.toJSON()}};e.CRLReason=a,r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.Enumerated})],a.prototype,"reason",void 0),e.CRLReason=a=r.__decorate([(0,s.AsnType)({type:s.AsnTypeTypes.Choice})],a)}}),require_extended_key_usage=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/extended_key_usage.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.id_kp_OCSPSigning=e.id_kp_timeStamping=e.id_kp_emailProtection=e.id_kp_codeSigning=e.id_kp_clientAuth=e.id_kp_serverAuth=e.anyExtendedKeyUsage=e.ExtendedKeyUsage=e.id_ce_extKeyUsage=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_object_identifiers();e.id_ce_extKeyUsage=`${s.id_ce}.37`;var n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.ExtendedKeyUsage=n,e.ExtendedKeyUsage=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:r.AsnPropTypes.ObjectIdentifier})],n),e.anyExtendedKeyUsage=`${e.id_ce_extKeyUsage}.0`,e.id_kp_serverAuth=`${s.id_kp}.1`,e.id_kp_clientAuth=`${s.id_kp}.2`,e.id_kp_codeSigning=`${s.id_kp}.3`,e.id_kp_emailProtection=`${s.id_kp}.4`,e.id_kp_timeStamping=`${s.id_kp}.8`,e.id_kp_OCSPSigning=`${s.id_kp}.9`}}),require_inhibit_any_policy=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/inhibit_any_policy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InhibitAnyPolicy=e.id_ce_inhibitAnyPolicy=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers();e.id_ce_inhibitAnyPolicy=`${r.id_ce}.54`;var s=class{constructor(e=new ArrayBuffer(0)){this.value=e}};e.InhibitAnyPolicy=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"value",void 0),e.InhibitAnyPolicy=s=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],s)}}),require_invalidity_date=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/invalidity_date.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidityDate=e.id_ce_invalidityDate=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers();e.id_ce_invalidityDate=`${r.id_ce}.24`;var s=class{constructor(e){this.value=new Date,e&&(this.value=e)}};e.InvalidityDate=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime})],s.prototype,"value",void 0),e.InvalidityDate=s=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],s)}}),require_issuer_alternative_name=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/issuer_alternative_name.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.IssueAlternativeName=e.id_ce_issuerAltName=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_general_names(),n=require_object_identifiers();e.id_ce_issuerAltName=`${n.id_ce}.18`;var a=t=class extends s.GeneralNames{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.IssueAlternativeName=a,e.IssueAlternativeName=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence})],a)}}),require_key_usage=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/key_usage.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyUsage=e.KeyUsageFlags=e.id_ce_keyUsage=void 0;var t,i,r=require_cjs(),s=require_object_identifiers();e.id_ce_keyUsage=`${s.id_ce}.15`,(i=t||(e.KeyUsageFlags=t={}))[i.digitalSignature=1]="digitalSignature",i[i.nonRepudiation=2]="nonRepudiation",i[i.keyEncipherment=4]="keyEncipherment",i[i.dataEncipherment=8]="dataEncipherment",i[i.keyAgreement=16]="keyAgreement",i[i.keyCertSign=32]="keyCertSign",i[i.cRLSign=64]="cRLSign",i[i.encipherOnly=128]="encipherOnly",i[i.decipherOnly=256]="decipherOnly";var n=class extends r.BitString{toJSON(){const e=this.toNumber(),i=[];return e&t.cRLSign&&i.push("crlSign"),e&t.dataEncipherment&&i.push("dataEncipherment"),e&t.decipherOnly&&i.push("decipherOnly"),e&t.digitalSignature&&i.push("digitalSignature"),e&t.encipherOnly&&i.push("encipherOnly"),e&t.keyAgreement&&i.push("keyAgreement"),e&t.keyCertSign&&i.push("keyCertSign"),e&t.keyEncipherment&&i.push("keyEncipherment"),e&t.nonRepudiation&&i.push("nonRepudiation"),i}toString(){return`[${this.toJSON().join(", ")}]`}};e.KeyUsage=n}}),require_name_constraints=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/name_constraints.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.NameConstraints=e.GeneralSubtrees=e.GeneralSubtree=e.id_ce_nameConstraints=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_general_name(),n=require_object_identifiers();e.id_ce_nameConstraints=`${n.id_ce}.30`;var a=class{constructor(e={}){this.base=new s.GeneralName,this.minimum=0,Object.assign(this,e)}};e.GeneralSubtree=a,i.__decorate([(0,r.AsnProp)({type:s.GeneralName})],a.prototype,"base",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,context:0,defaultValue:0,implicit:!0})],a.prototype,"minimum",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,context:1,optional:!0,implicit:!0})],a.prototype,"maximum",void 0);var o=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.GeneralSubtrees=o,e.GeneralSubtrees=o=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:a})],o);var c=class{constructor(e={}){Object.assign(this,e)}};e.NameConstraints=c,i.__decorate([(0,r.AsnProp)({type:o,context:0,optional:!0,implicit:!0})],c.prototype,"permittedSubtrees",void 0),i.__decorate([(0,r.AsnProp)({type:o,context:1,optional:!0,implicit:!0})],c.prototype,"excludedSubtrees",void 0)}}),require_policy_constraints=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/policy_constraints.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PolicyConstraints=e.id_ce_policyConstraints=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers();e.id_ce_policyConstraints=`${r.id_ce}.36`;var s=class{constructor(e={}){Object.assign(this,e)}};e.PolicyConstraints=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,context:0,implicit:!0,optional:!0,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"requireExplicitPolicy",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,context:1,implicit:!0,optional:!0,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"inhibitPolicyMapping",void 0)}}),require_policy_mappings=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/policy_mappings.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.PolicyMappings=e.PolicyMapping=e.id_ce_policyMappings=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_object_identifiers();e.id_ce_policyMappings=`${s.id_ce}.33`;var n=class{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}};e.PolicyMapping=n,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],n.prototype,"issuerDomainPolicy",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],n.prototype,"subjectDomainPolicy",void 0);var a=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.PolicyMappings=a,e.PolicyMappings=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:n})],a)}}),require_subject_alternative_name=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_alternative_name.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.SubjectAlternativeName=e.id_ce_subjectAltName=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_general_names(),n=require_object_identifiers();e.id_ce_subjectAltName=`${n.id_ce}.17`;var a=t=class extends s.GeneralNames{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.SubjectAlternativeName=a,e.SubjectAlternativeName=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence})],a)}}),require_attribute=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/attribute.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Attribute=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};e.Attribute=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],r.prototype,"type",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,repeated:"set"})],r.prototype,"values",void 0)}}),require_subject_directory_attributes=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_directory_attributes.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.SubjectDirectoryAttributes=e.id_ce_subjectDirectoryAttributes=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_attribute(),n=require_object_identifiers();e.id_ce_subjectDirectoryAttributes=`${n.id_ce}.9`;var a=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.SubjectDirectoryAttributes=a,e.SubjectDirectoryAttributes=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s.Attribute})],a)}}),require_subject_key_identifier=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_key_identifier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SubjectKeyIdentifier=e.id_ce_subjectKeyIdentifier=void 0;var t=require_object_identifiers(),i=require_authority_key_identifier();e.id_ce_subjectKeyIdentifier=`${t.id_ce}.14`;var r=class extends i.KeyIdentifier{};e.SubjectKeyIdentifier=r}}),require_private_key_usage_period=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/private_key_usage_period.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PrivateKeyUsagePeriod=e.id_ce_privateKeyUsagePeriod=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_object_identifiers();e.id_ce_privateKeyUsagePeriod=`${r.id_ce}.16`;var s=class{constructor(e={}){Object.assign(this,e)}};e.PrivateKeyUsagePeriod=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime,context:0,implicit:!0,optional:!0})],s.prototype,"notBefore",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime,context:1,implicit:!0,optional:!0})],s.prototype,"notAfter",void 0)}}),require_entrust_version_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/entrust_version_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EntrustVersionInfo=e.EntrustInfo=e.EntrustInfoFlags=e.id_entrust_entrustVersInfo=void 0;var t,i,r=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),s=require_cjs();e.id_entrust_entrustVersInfo="1.2.840.113533.7.65.0",(i=t||(e.EntrustInfoFlags=t={}))[i.keyUpdateAllowed=1]="keyUpdateAllowed",i[i.newExtensions=2]="newExtensions",i[i.pKIXCertificate=4]="pKIXCertificate";var n=class extends s.BitString{toJSON(){const e=[],i=this.toNumber();return i&t.pKIXCertificate&&e.push("pKIXCertificate"),i&t.newExtensions&&e.push("newExtensions"),i&t.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}};e.EntrustInfo=n;var a=class{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new n,Object.assign(this,e)}};e.EntrustVersionInfo=a,r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.GeneralString})],a.prototype,"entrustVers",void 0),r.__decorate([(0,s.AsnProp)({type:n})],a.prototype,"entrustInfoFlags",void 0)}}),require_subject_info_access=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_info_access.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.SubjectInfoAccessSyntax=e.id_pe_subjectInfoAccess=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_object_identifiers(),n=require_authority_information_access();e.id_pe_subjectInfoAccess=`${s.id_pe}.11`;var a=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.SubjectInfoAccessSyntax=a,e.SubjectInfoAccessSyntax=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:n.AccessDescription})],a)}}),require_extensions=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extensions/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_authority_information_access(),e),t.__exportStar(require_authority_key_identifier(),e),t.__exportStar(require_basic_constraints(),e),t.__exportStar(require_certificate_issuer(),e),t.__exportStar(require_certificate_policies(),e),t.__exportStar(require_crl_delta_indicator(),e),t.__exportStar(require_crl_distribution_points(),e),t.__exportStar(require_crl_freshest(),e),t.__exportStar(require_crl_issuing_distribution_point(),e),t.__exportStar(require_crl_number(),e),t.__exportStar(require_crl_reason(),e),t.__exportStar(require_extended_key_usage(),e),t.__exportStar(require_inhibit_any_policy(),e),t.__exportStar(require_invalidity_date(),e),t.__exportStar(require_issuer_alternative_name(),e),t.__exportStar(require_key_usage(),e),t.__exportStar(require_name_constraints(),e),t.__exportStar(require_policy_constraints(),e),t.__exportStar(require_policy_mappings(),e),t.__exportStar(require_subject_alternative_name(),e),t.__exportStar(require_subject_directory_attributes(),e),t.__exportStar(require_subject_key_identifier(),e),t.__exportStar(require_private_key_usage_period(),e),t.__exportStar(require_entrust_version_info(),e),t.__exportStar(require_subject_info_access(),e)}}),require_algorithm_identifier=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/algorithm_identifier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AlgorithmIdentifier=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_build3(),s=class e{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(t){return t instanceof e&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&r.isEqual(t.parameters,this.parameters)||t.parameters===this.parameters)}};e.AlgorithmIdentifier=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],s.prototype,"algorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,optional:!0})],s.prototype,"parameters",void 0)}}),require_subject_public_key_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/subject_public_key_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SubjectPublicKeyInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_algorithm_identifier(),s=class{constructor(e={}){this.algorithm=new r.AlgorithmIdentifier,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}};e.SubjectPublicKeyInfo=s,t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],s.prototype,"algorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString})],s.prototype,"subjectPublicKey",void 0)}}),require_time=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/time.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Time=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e){if(e)if("string"==typeof e||"number"==typeof e||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};e.Time=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.UTCTime})],r.prototype,"utcTime",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime})],r.prototype,"generalTime",void 0),e.Time=r=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],r)}}),require_validity=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/validity.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Validity=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_time(),s=class{constructor(e){this.notBefore=new r.Time(new Date),this.notAfter=new r.Time(new Date),e&&(this.notBefore=new r.Time(e.notBefore),this.notAfter=new r.Time(e.notAfter))}};e.Validity=s,t.__decorate([(0,i.AsnProp)({type:r.Time})],s.prototype,"notBefore",void 0),t.__decorate([(0,i.AsnProp)({type:r.Time})],s.prototype,"notAfter",void 0)}}),require_extension=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/extension.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Extensions=e.Extension=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=class e{constructor(t={}){this.extnID="",this.critical=e.CRITICAL,this.extnValue=new r.OctetString,Object.assign(this,t)}};e.Extension=s,s.CRITICAL=!1,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],s.prototype,"extnID",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Boolean,defaultValue:s.CRITICAL})],s.prototype,"critical",void 0),i.__decorate([(0,r.AsnProp)({type:r.OctetString})],s.prototype,"extnValue",void 0);var n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.Extensions=n,e.Extensions=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s})],n)}}),require_types2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/types.js"(e){"use strict";var t,i;Object.defineProperty(e,"__esModule",{value:!0}),e.Version=void 0,(i=t||(e.Version=t={}))[i.v1=0]="v1",i[i.v2=1]="v2",i[i.v3=2]="v3"}}),require_tbs_certificate=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/tbs_certificate.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TBSCertificate=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_algorithm_identifier(),s=require_name(),n=require_subject_public_key_info(),a=require_validity(),o=require_extension(),c=require_types2(),l=class{constructor(e={}){this.version=c.Version.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new r.AlgorithmIdentifier,this.issuer=new s.Name,this.validity=new a.Validity,this.subject=new s.Name,this.subjectPublicKeyInfo=new n.SubjectPublicKeyInfo,Object.assign(this,e)}};e.TBSCertificate=l,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,context:0,defaultValue:c.Version.v1})],l.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],l.prototype,"serialNumber",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],l.prototype,"signature",void 0),t.__decorate([(0,i.AsnProp)({type:s.Name})],l.prototype,"issuer",void 0),t.__decorate([(0,i.AsnProp)({type:a.Validity})],l.prototype,"validity",void 0),t.__decorate([(0,i.AsnProp)({type:s.Name})],l.prototype,"subject",void 0),t.__decorate([(0,i.AsnProp)({type:n.SubjectPublicKeyInfo})],l.prototype,"subjectPublicKeyInfo",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString,context:1,implicit:!0,optional:!0})],l.prototype,"issuerUniqueID",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString,context:2,implicit:!0,optional:!0})],l.prototype,"subjectUniqueID",void 0),t.__decorate([(0,i.AsnProp)({type:o.Extensions,context:3,optional:!0})],l.prototype,"extensions",void 0)}}),require_certificate=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/certificate.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Certificate=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_algorithm_identifier(),s=require_tbs_certificate(),n=class{constructor(e={}){this.tbsCertificate=new s.TBSCertificate,this.signatureAlgorithm=new r.AlgorithmIdentifier,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}};e.Certificate=n,t.__decorate([(0,i.AsnProp)({type:s.TBSCertificate})],n.prototype,"tbsCertificate",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],n.prototype,"signatureAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString})],n.prototype,"signatureValue",void 0)}}),require_tbs_cert_list=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/tbs_cert_list.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TBSCertList=e.RevokedCertificate=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_algorithm_identifier(),s=require_name(),n=require_time(),a=require_extension(),o=class{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new n.Time,Object.assign(this,e)}};e.RevokedCertificate=o,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],o.prototype,"userCertificate",void 0),t.__decorate([(0,i.AsnProp)({type:n.Time})],o.prototype,"revocationDate",void 0),t.__decorate([(0,i.AsnProp)({type:a.Extension,optional:!0,repeated:"sequence"})],o.prototype,"crlEntryExtensions",void 0);var c=class{constructor(e={}){this.signature=new r.AlgorithmIdentifier,this.issuer=new s.Name,this.thisUpdate=new n.Time,Object.assign(this,e)}};e.TBSCertList=c,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,optional:!0})],c.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],c.prototype,"signature",void 0),t.__decorate([(0,i.AsnProp)({type:s.Name})],c.prototype,"issuer",void 0),t.__decorate([(0,i.AsnProp)({type:n.Time})],c.prototype,"thisUpdate",void 0),t.__decorate([(0,i.AsnProp)({type:n.Time,optional:!0})],c.prototype,"nextUpdate",void 0),t.__decorate([(0,i.AsnProp)({type:o,repeated:"sequence",optional:!0})],c.prototype,"revokedCertificates",void 0),t.__decorate([(0,i.AsnProp)({type:a.Extension,optional:!0,context:0,repeated:"sequence"})],c.prototype,"crlExtensions",void 0)}}),require_certificate_list=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/certificate_list.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CertificateList=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_algorithm_identifier(),s=require_tbs_cert_list(),n=class{constructor(e={}){this.tbsCertList=new s.TBSCertList,this.signatureAlgorithm=new r.AlgorithmIdentifier,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};e.CertificateList=n,t.__decorate([(0,i.AsnProp)({type:s.TBSCertList})],n.prototype,"tbsCertList",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],n.prototype,"signatureAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString})],n.prototype,"signature",void 0)}}),require_cjs2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_extensions(),e),t.__exportStar(require_algorithm_identifier(),e),t.__exportStar(require_attribute(),e),t.__exportStar(require_certificate(),e),t.__exportStar(require_certificate_list(),e),t.__exportStar(require_extension(),e),t.__exportStar(require_general_name(),e),t.__exportStar(require_general_names(),e),t.__exportStar(require_name(),e),t.__exportStar(require_object_identifiers(),e),t.__exportStar(require_subject_public_key_info(),e),t.__exportStar(require_tbs_cert_list(),e),t.__exportStar(require_tbs_certificate(),e),t.__exportStar(require_time(),e),t.__exportStar(require_types2(),e),t.__exportStar(require_validity(),e)}}),require_issuer_and_serial_number=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/issuer_and_serial_number.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IssuerAndSerialNumber=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class{constructor(e={}){this.issuer=new r.Name,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}};e.IssuerAndSerialNumber=s,t.__decorate([(0,i.AsnProp)({type:r.Name})],s.prototype,"issuer",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"serialNumber",void 0)}}),require_signer_identifier=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/signer_identifier.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SignerIdentifier=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_issuer_and_serial_number(),s=require_cjs2(),n=class{constructor(e={}){Object.assign(this,e)}};e.SignerIdentifier=n,t.__decorate([(0,i.AsnProp)({type:s.SubjectKeyIdentifier,context:0,implicit:!0})],n.prototype,"subjectKeyIdentifier",void 0),t.__decorate([(0,i.AsnProp)({type:r.IssuerAndSerialNumber})],n.prototype,"issuerAndSerialNumber",void 0),e.SignerIdentifier=n=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],n)}}),require_types3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/types.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyDerivationAlgorithmIdentifier=e.MessageAuthenticationCodeAlgorithm=e.ContentEncryptionAlgorithmIdentifier=e.KeyEncryptionAlgorithmIdentifier=e.SignatureAlgorithmIdentifier=e.DigestAlgorithmIdentifier=e.CMSVersion=void 0;var t,i,r=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),s=require_cjs2(),n=require_cjs();(i=t||(e.CMSVersion=t={}))[i.v0=0]="v0",i[i.v1=1]="v1",i[i.v2=2]="v2",i[i.v3=3]="v3",i[i.v4=4]="v4",i[i.v5=5]="v5";var a=class extends s.AlgorithmIdentifier{};e.DigestAlgorithmIdentifier=a,e.DigestAlgorithmIdentifier=a=r.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],a);var o=class extends s.AlgorithmIdentifier{};e.SignatureAlgorithmIdentifier=o,e.SignatureAlgorithmIdentifier=o=r.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],o);var c=class extends s.AlgorithmIdentifier{};e.KeyEncryptionAlgorithmIdentifier=c,e.KeyEncryptionAlgorithmIdentifier=c=r.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],c);var l=class extends s.AlgorithmIdentifier{};e.ContentEncryptionAlgorithmIdentifier=l,e.ContentEncryptionAlgorithmIdentifier=l=r.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],l);var u=class extends s.AlgorithmIdentifier{};e.MessageAuthenticationCodeAlgorithm=u,e.MessageAuthenticationCodeAlgorithm=u=r.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],u);var d=class extends s.AlgorithmIdentifier{};e.KeyDerivationAlgorithmIdentifier=d,e.KeyDerivationAlgorithmIdentifier=d=r.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],d)}}),require_attribute2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/attribute.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Attribute=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};e.Attribute=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],r.prototype,"attrType",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,repeated:"set"})],r.prototype,"attrValues",void 0)}}),require_signer_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/signer_info.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.SignerInfos=e.SignerInfo=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_signer_identifier(),n=require_types3(),a=require_attribute2(),o=class{constructor(e={}){this.version=n.CMSVersion.v0,this.sid=new s.SignerIdentifier,this.digestAlgorithm=new n.DigestAlgorithmIdentifier,this.signatureAlgorithm=new n.SignatureAlgorithmIdentifier,this.signature=new r.OctetString,Object.assign(this,e)}};e.SignerInfo=o,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer})],o.prototype,"version",void 0),i.__decorate([(0,r.AsnProp)({type:s.SignerIdentifier})],o.prototype,"sid",void 0),i.__decorate([(0,r.AsnProp)({type:n.DigestAlgorithmIdentifier})],o.prototype,"digestAlgorithm",void 0),i.__decorate([(0,r.AsnProp)({type:a.Attribute,repeated:"set",context:0,implicit:!0,optional:!0})],o.prototype,"signedAttrs",void 0),i.__decorate([(0,r.AsnProp)({type:n.SignatureAlgorithmIdentifier})],o.prototype,"signatureAlgorithm",void 0),i.__decorate([(0,r.AsnProp)({type:r.OctetString})],o.prototype,"signature",void 0),i.__decorate([(0,r.AsnProp)({type:a.Attribute,repeated:"set",context:1,implicit:!0,optional:!0})],o.prototype,"unsignedAttrs",void 0);var c=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.SignerInfos=c,e.SignerInfos=c=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Set,itemType:o})],c)}}),require_attributes=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/attributes.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CounterSignature=e.SigningTime=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_signer_info(),n=class extends r.Time{};n=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],n),e.SigningTime=n;var a=class extends s.SignerInfo{};a=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Sequence})],a),e.CounterSignature=a}}),require_aa_clear_attrs=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/aa_clear_attrs.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ACClearAttrs=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class{constructor(e={}){this.acIssuer=new r.GeneralName,this.acSerial=0,this.attrs=[],Object.assign(this,e)}};e.ACClearAttrs=s,t.__decorate([(0,i.AsnProp)({type:r.GeneralName})],s.prototype,"acIssuer",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],s.prototype,"acSerial",void 0),t.__decorate([(0,i.AsnProp)({type:r.Attribute,repeated:"sequence"})],s.prototype,"attrs",void 0)}}),require_attr_spec=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/attr_spec.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.AttrSpec=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.AttrSpec=s,e.AttrSpec=s=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:r.AsnPropTypes.ObjectIdentifier})],s)}}),require_aa_controls=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/aa_controls.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AAControls=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_attr_spec(),s=class{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}};e.AAControls=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,optional:!0})],s.prototype,"pathLenConstraint",void 0),t.__decorate([(0,i.AsnProp)({type:r.AttrSpec,implicit:!0,context:0,optional:!0})],s.prototype,"permittedAttrs",void 0),t.__decorate([(0,i.AsnProp)({type:r.AttrSpec,implicit:!0,context:1,optional:!0})],s.prototype,"excludedAttrs",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Boolean,defaultValue:!0})],s.prototype,"permitUnSpecified",void 0)}}),require_issuer_serial=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/issuer_serial.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IssuerSerial=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class{constructor(e={}){this.issuer=new r.GeneralNames,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}};e.IssuerSerial=s,t.__decorate([(0,i.AsnProp)({type:r.GeneralNames})],s.prototype,"issuer",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"serial",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString,optional:!0})],s.prototype,"issuerUID",void 0)}}),require_object_digest_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/object_digest_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectDigestInfo=e.DigestedObjectType=void 0;var t,i,r=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),s=require_cjs(),n=require_cjs2();(i=t||(e.DigestedObjectType=t={}))[i.publicKey=0]="publicKey",i[i.publicKeyCert=1]="publicKeyCert",i[i.otherObjectTypes=2]="otherObjectTypes";var a=class{constructor(e={}){this.digestedObjectType=t.publicKey,this.digestAlgorithm=new n.AlgorithmIdentifier,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}};e.ObjectDigestInfo=a,r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.Enumerated})],a.prototype,"digestedObjectType",void 0),r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.ObjectIdentifier,optional:!0})],a.prototype,"otherObjectTypeID",void 0),r.__decorate([(0,s.AsnProp)({type:n.AlgorithmIdentifier})],a.prototype,"digestAlgorithm",void 0),r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.BitString})],a.prototype,"objectDigest",void 0)}}),require_v2_form=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/v2_form.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.V2Form=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_issuer_serial(),n=require_object_digest_info(),a=class{constructor(e={}){Object.assign(this,e)}};e.V2Form=a,t.__decorate([(0,i.AsnProp)({type:r.GeneralNames,optional:!0})],a.prototype,"issuerName",void 0),t.__decorate([(0,i.AsnProp)({type:s.IssuerSerial,context:0,implicit:!0,optional:!0})],a.prototype,"baseCertificateID",void 0),t.__decorate([(0,i.AsnProp)({type:n.ObjectDigestInfo,context:1,implicit:!0,optional:!0})],a.prototype,"objectDigestInfo",void 0)}}),require_attr_cert_issuer=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/attr_cert_issuer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttCertIssuer=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_v2_form(),n=class{constructor(e={}){Object.assign(this,e)}};e.AttCertIssuer=n,t.__decorate([(0,i.AsnProp)({type:r.GeneralName,repeated:"sequence"})],n.prototype,"v1Form",void 0),t.__decorate([(0,i.AsnProp)({type:s.V2Form,context:0,implicit:!0})],n.prototype,"v2Form",void 0),e.AttCertIssuer=n=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],n)}}),require_attr_cert_validity_period=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/attr_cert_validity_period.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttCertValidityPeriod=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}};e.AttCertValidityPeriod=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime})],r.prototype,"notBeforeTime",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime})],r.prototype,"notAfterTime",void 0)}}),require_holder=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/holder.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Holder=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_issuer_serial(),s=require_cjs2(),n=require_object_digest_info(),a=class{constructor(e={}){Object.assign(this,e)}};e.Holder=a,t.__decorate([(0,i.AsnProp)({type:r.IssuerSerial,implicit:!0,context:0,optional:!0})],a.prototype,"baseCertificateID",void 0),t.__decorate([(0,i.AsnProp)({type:s.GeneralNames,implicit:!0,context:1,optional:!0})],a.prototype,"entityName",void 0),t.__decorate([(0,i.AsnProp)({type:n.ObjectDigestInfo,implicit:!0,context:2,optional:!0})],a.prototype,"objectDigestInfo",void 0)}}),require_attribute_certificate_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/attribute_certificate_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeCertificateInfo=e.AttCertVersion=void 0;var t,i,r=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),s=require_cjs(),n=require_cjs2(),a=require_holder(),o=require_attr_cert_issuer(),c=require_attr_cert_validity_period();(i=t||(e.AttCertVersion=t={}))[i.v2=1]="v2";var l=class{constructor(e={}){this.version=t.v2,this.holder=new a.Holder,this.issuer=new o.AttCertIssuer,this.signature=new n.AlgorithmIdentifier,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new c.AttCertValidityPeriod,this.attributes=[],Object.assign(this,e)}};e.AttributeCertificateInfo=l,r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.Integer})],l.prototype,"version",void 0),r.__decorate([(0,s.AsnProp)({type:a.Holder})],l.prototype,"holder",void 0),r.__decorate([(0,s.AsnProp)({type:o.AttCertIssuer})],l.prototype,"issuer",void 0),r.__decorate([(0,s.AsnProp)({type:n.AlgorithmIdentifier})],l.prototype,"signature",void 0),r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.Integer,converter:s.AsnIntegerArrayBufferConverter})],l.prototype,"serialNumber",void 0),r.__decorate([(0,s.AsnProp)({type:c.AttCertValidityPeriod})],l.prototype,"attrCertValidityPeriod",void 0),r.__decorate([(0,s.AsnProp)({type:n.Attribute,repeated:"sequence"})],l.prototype,"attributes",void 0),r.__decorate([(0,s.AsnProp)({type:s.AsnPropTypes.BitString,optional:!0})],l.prototype,"issuerUniqueID",void 0),r.__decorate([(0,s.AsnProp)({type:n.Extensions,optional:!0})],l.prototype,"extensions",void 0)}}),require_attribute_certificate=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/attribute_certificate.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeCertificate=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_attribute_certificate_info(),n=class{constructor(e={}){this.acinfo=new s.AttributeCertificateInfo,this.signatureAlgorithm=new r.AlgorithmIdentifier,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}};e.AttributeCertificate=n,t.__decorate([(0,i.AsnProp)({type:s.AttributeCertificateInfo})],n.prototype,"acinfo",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],n.prototype,"signatureAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString})],n.prototype,"signatureValue",void 0)}}),require_class_list=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/class_list.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClassList=e.ClassListFlags=void 0;var t,i,r=require_cjs();(i=t||(e.ClassListFlags=t={}))[i.unmarked=1]="unmarked",i[i.unclassified=2]="unclassified",i[i.restricted=4]="restricted",i[i.confidential=8]="confidential",i[i.secret=16]="secret",i[i.topSecret=32]="topSecret";var s=class extends r.BitString{};e.ClassList=s}}),require_security_category=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/security_category.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SecurityCategory=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}};e.SecurityCategory=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier,implicit:!0,context:0})],r.prototype,"type",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,implicit:!0,context:1})],r.prototype,"value",void 0)}}),require_clearance=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/clearance.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Clearance=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_class_list(),s=require_security_category(),n=class{constructor(e={}){this.policyId="",this.classList=new r.ClassList(r.ClassListFlags.unclassified),Object.assign(this,e)}};e.Clearance=n,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],n.prototype,"policyId",void 0),t.__decorate([(0,i.AsnProp)({type:r.ClassList,defaultValue:new r.ClassList(r.ClassListFlags.unclassified)})],n.prototype,"classList",void 0),t.__decorate([(0,i.AsnProp)({type:s.SecurityCategory,repeated:"set"})],n.prototype,"securityCategories",void 0)}}),require_ietf_attr_syntax=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/ietf_attr_syntax.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IetfAttrSyntax=e.IetfAttrSyntaxValueChoices=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class{constructor(e={}){Object.assign(this,e)}};e.IetfAttrSyntaxValueChoices=s,t.__decorate([(0,i.AsnProp)({type:i.OctetString})],s.prototype,"cotets",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],s.prototype,"oid",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Utf8String})],s.prototype,"string",void 0);var n=class{constructor(e={}){this.values=[],Object.assign(this,e)}};e.IetfAttrSyntax=n,t.__decorate([(0,i.AsnProp)({type:r.GeneralNames,implicit:!0,context:0,optional:!0})],n.prototype,"policyAuthority",void 0),t.__decorate([(0,i.AsnProp)({type:s,repeated:"sequence"})],n.prototype,"values",void 0)}}),require_object_identifiers2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/object_identifiers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_at_clearance=e.id_at_role=e.id_at=e.id_aca_encAttrs=e.id_aca_group=e.id_aca_chargingIdentity=e.id_aca_accessIdentity=e.id_aca_authenticationInfo=e.id_aca=e.id_ce_targetInformation=e.id_pe_ac_proxying=e.id_pe_aaControls=e.id_pe_ac_auditIdentity=void 0;var t=require_cjs2();e.id_pe_ac_auditIdentity=`${t.id_pe}.4`,e.id_pe_aaControls=`${t.id_pe}.6`,e.id_pe_ac_proxying=`${t.id_pe}.10`,e.id_ce_targetInformation=`${t.id_ce}.55`,e.id_aca=`${t.id_pkix}.10`,e.id_aca_authenticationInfo=`${e.id_aca}.1`,e.id_aca_accessIdentity=`${e.id_aca}.2`,e.id_aca_chargingIdentity=`${e.id_aca}.3`,e.id_aca_group=`${e.id_aca}.4`,e.id_aca_encAttrs=`${e.id_aca}.6`,e.id_at="2.5.4",e.id_at_role=`${e.id_at}.72`,e.id_at_clearance="2.5.1.5.55"}}),require_target=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/target.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Targets=e.Target=e.TargetCert=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_cjs2(),n=require_issuer_serial(),a=require_object_digest_info(),o=class{constructor(e={}){this.targetCertificate=new n.IssuerSerial,Object.assign(this,e)}};e.TargetCert=o,i.__decorate([(0,r.AsnProp)({type:n.IssuerSerial})],o.prototype,"targetCertificate",void 0),i.__decorate([(0,r.AsnProp)({type:s.GeneralName,optional:!0})],o.prototype,"targetName",void 0),i.__decorate([(0,r.AsnProp)({type:a.ObjectDigestInfo,optional:!0})],o.prototype,"certDigestInfo",void 0);var c=class{constructor(e={}){Object.assign(this,e)}};e.Target=c,i.__decorate([(0,r.AsnProp)({type:s.GeneralName,context:0,implicit:!0})],c.prototype,"targetName",void 0),i.__decorate([(0,r.AsnProp)({type:s.GeneralName,context:1,implicit:!0})],c.prototype,"targetGroup",void 0),i.__decorate([(0,r.AsnProp)({type:o,context:2,implicit:!0})],c.prototype,"targetCert",void 0),e.Target=c=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],c);var l=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.Targets=l,e.Targets=l=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:c})],l)}}),require_proxy_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/proxy_info.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyInfo=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_target(),n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.ProxyInfo=n,e.ProxyInfo=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s.Targets})],n)}}),require_role_syntax=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/role_syntax.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RoleSyntax=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class{constructor(e={}){Object.assign(this,e)}};e.RoleSyntax=s,t.__decorate([(0,i.AsnProp)({type:r.GeneralNames,implicit:!0,context:0,optional:!0})],s.prototype,"roleAuthority",void 0),t.__decorate([(0,i.AsnProp)({type:r.GeneralName,implicit:!0,context:1})],s.prototype,"roleName",void 0)}}),require_svce_auth_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/svce_auth_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SvceAuthInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class{constructor(e={}){this.service=new r.GeneralName,this.ident=new r.GeneralName,Object.assign(this,e)}};e.SvceAuthInfo=s,t.__decorate([(0,i.AsnProp)({type:r.GeneralName})],s.prototype,"service",void 0),t.__decorate([(0,i.AsnProp)({type:r.GeneralName})],s.prototype,"ident",void 0),t.__decorate([(0,i.AsnProp)({type:i.OctetString,optional:!0})],s.prototype,"authInfo",void 0)}}),require_cjs3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-x509-attr/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_aa_clear_attrs(),e),t.__exportStar(require_aa_controls(),e),t.__exportStar(require_attr_cert_issuer(),e),t.__exportStar(require_attr_cert_validity_period(),e),t.__exportStar(require_attr_spec(),e),t.__exportStar(require_attribute_certificate(),e),t.__exportStar(require_attribute_certificate_info(),e),t.__exportStar(require_class_list(),e),t.__exportStar(require_clearance(),e),t.__exportStar(require_holder(),e),t.__exportStar(require_ietf_attr_syntax(),e),t.__exportStar(require_issuer_serial(),e),t.__exportStar(require_object_digest_info(),e),t.__exportStar(require_object_identifiers2(),e),t.__exportStar(require_proxy_info(),e),t.__exportStar(require_role_syntax(),e),t.__exportStar(require_security_category(),e),t.__exportStar(require_svce_auth_info(),e),t.__exportStar(require_target(),e),t.__exportStar(require_v2_form(),e)}}),require_certificate_choices=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/certificate_choices.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.CertificateSet=e.CertificateChoices=e.OtherCertificateFormat=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_cjs2(),n=require_cjs3(),a=class{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}};e.OtherCertificateFormat=a,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],a.prototype,"otherCertFormat",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Any})],a.prototype,"otherCert",void 0);var o=class{constructor(e={}){Object.assign(this,e)}};e.CertificateChoices=o,i.__decorate([(0,r.AsnProp)({type:s.Certificate})],o.prototype,"certificate",void 0),i.__decorate([(0,r.AsnProp)({type:n.AttributeCertificate,context:2,implicit:!0})],o.prototype,"v2AttrCert",void 0),i.__decorate([(0,r.AsnProp)({type:a,context:3,implicit:!0})],o.prototype,"other",void 0),e.CertificateChoices=o=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],o);var c=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.CertificateSet=c,e.CertificateSet=c=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Set,itemType:o})],c)}}),require_content_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/content_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContentInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}};e.ContentInfo=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],r.prototype,"contentType",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,context:0})],r.prototype,"content",void 0)}}),require_encapsulated_content_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/encapsulated_content_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncapsulatedContentInfo=e.EncapsulatedContent=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){Object.assign(this,e)}};e.EncapsulatedContent=r,t.__decorate([(0,i.AsnProp)({type:i.OctetString})],r.prototype,"single",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any})],r.prototype,"any",void 0),e.EncapsulatedContent=r=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],r);var s=class{constructor(e={}){this.eContentType="",Object.assign(this,e)}};e.EncapsulatedContentInfo=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],s.prototype,"eContentType",void 0),t.__decorate([(0,i.AsnProp)({type:r,context:0,optional:!0})],s.prototype,"eContent",void 0)}}),require_encrypted_content_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/encrypted_content_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncryptedContentInfo=e.EncryptedContent=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_types3(),s=class{constructor(e={}){Object.assign(this,e)}};e.EncryptedContent=s,t.__decorate([(0,i.AsnProp)({type:i.OctetString,context:0,implicit:!0,optional:!0})],s.prototype,"value",void 0),t.__decorate([(0,i.AsnProp)({type:i.OctetString,converter:i.AsnConstructedOctetStringConverter,context:0,implicit:!0,optional:!0,repeated:"sequence"})],s.prototype,"constructedValue",void 0),e.EncryptedContent=s=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],s);var n=class{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new r.ContentEncryptionAlgorithmIdentifier,Object.assign(this,e)}};e.EncryptedContentInfo=n,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],n.prototype,"contentType",void 0),t.__decorate([(0,i.AsnProp)({type:r.ContentEncryptionAlgorithmIdentifier})],n.prototype,"contentEncryptionAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:s,optional:!0})],n.prototype,"encryptedContent",void 0)}}),require_other_key_attribute=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/other_key_attribute.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OtherKeyAttribute=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}};e.OtherKeyAttribute=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],r.prototype,"keyAttrId",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,optional:!0})],r.prototype,"keyAttr",void 0)}}),require_key_agree_recipient_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/key_agree_recipient_info.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.KeyAgreeRecipientInfo=e.OriginatorIdentifierOrKey=e.OriginatorPublicKey=e.RecipientEncryptedKeys=e.RecipientEncryptedKey=e.KeyAgreeRecipientIdentifier=e.RecipientKeyIdentifier=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_types3(),n=require_issuer_and_serial_number(),a=require_cjs2(),o=require_other_key_attribute(),c=class{constructor(e={}){this.subjectKeyIdentifier=new a.SubjectKeyIdentifier,Object.assign(this,e)}};e.RecipientKeyIdentifier=c,i.__decorate([(0,r.AsnProp)({type:a.SubjectKeyIdentifier})],c.prototype,"subjectKeyIdentifier",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.GeneralizedTime,optional:!0})],c.prototype,"date",void 0),i.__decorate([(0,r.AsnProp)({type:o.OtherKeyAttribute,optional:!0})],c.prototype,"other",void 0);var l=class{constructor(e={}){Object.assign(this,e)}};e.KeyAgreeRecipientIdentifier=l,i.__decorate([(0,r.AsnProp)({type:c,context:0,implicit:!0,optional:!0})],l.prototype,"rKeyId",void 0),i.__decorate([(0,r.AsnProp)({type:n.IssuerAndSerialNumber,optional:!0})],l.prototype,"issuerAndSerialNumber",void 0),e.KeyAgreeRecipientIdentifier=l=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],l);var u=class{constructor(e={}){this.rid=new l,this.encryptedKey=new r.OctetString,Object.assign(this,e)}};e.RecipientEncryptedKey=u,i.__decorate([(0,r.AsnProp)({type:l})],u.prototype,"rid",void 0),i.__decorate([(0,r.AsnProp)({type:r.OctetString})],u.prototype,"encryptedKey",void 0);var d=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.RecipientEncryptedKeys=d,e.RecipientEncryptedKeys=d=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:u})],d);var p=class{constructor(e={}){this.algorithm=new a.AlgorithmIdentifier,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}};e.OriginatorPublicKey=p,i.__decorate([(0,r.AsnProp)({type:a.AlgorithmIdentifier})],p.prototype,"algorithm",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.BitString})],p.prototype,"publicKey",void 0);var h=class{constructor(e={}){Object.assign(this,e)}};e.OriginatorIdentifierOrKey=h,i.__decorate([(0,r.AsnProp)({type:a.SubjectKeyIdentifier,context:0,implicit:!0,optional:!0})],h.prototype,"subjectKeyIdentifier",void 0),i.__decorate([(0,r.AsnProp)({type:p,context:1,implicit:!0,optional:!0})],h.prototype,"originatorKey",void 0),i.__decorate([(0,r.AsnProp)({type:n.IssuerAndSerialNumber,optional:!0})],h.prototype,"issuerAndSerialNumber",void 0),e.OriginatorIdentifierOrKey=h=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],h);var m=class{constructor(e={}){this.version=s.CMSVersion.v3,this.originator=new h,this.keyEncryptionAlgorithm=new s.KeyEncryptionAlgorithmIdentifier,this.recipientEncryptedKeys=new d,Object.assign(this,e)}};e.KeyAgreeRecipientInfo=m,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer})],m.prototype,"version",void 0),i.__decorate([(0,r.AsnProp)({type:h,context:0})],m.prototype,"originator",void 0),i.__decorate([(0,r.AsnProp)({type:r.OctetString,context:1,optional:!0})],m.prototype,"ukm",void 0),i.__decorate([(0,r.AsnProp)({type:s.KeyEncryptionAlgorithmIdentifier})],m.prototype,"keyEncryptionAlgorithm",void 0),i.__decorate([(0,r.AsnProp)({type:d})],m.prototype,"recipientEncryptedKeys",void 0)}}),require_key_trans_recipient_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/key_trans_recipient_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyTransRecipientInfo=e.RecipientIdentifier=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_types3(),s=require_issuer_and_serial_number(),n=require_cjs2(),a=class{constructor(e={}){Object.assign(this,e)}};e.RecipientIdentifier=a,t.__decorate([(0,i.AsnProp)({type:n.SubjectKeyIdentifier,context:0,implicit:!0})],a.prototype,"subjectKeyIdentifier",void 0),t.__decorate([(0,i.AsnProp)({type:s.IssuerAndSerialNumber})],a.prototype,"issuerAndSerialNumber",void 0),e.RecipientIdentifier=a=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],a);var o=class{constructor(e={}){this.version=r.CMSVersion.v0,this.rid=new a,this.keyEncryptionAlgorithm=new r.KeyEncryptionAlgorithmIdentifier,this.encryptedKey=new i.OctetString,Object.assign(this,e)}};e.KeyTransRecipientInfo=o,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],o.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:a})],o.prototype,"rid",void 0),t.__decorate([(0,i.AsnProp)({type:r.KeyEncryptionAlgorithmIdentifier})],o.prototype,"keyEncryptionAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.OctetString})],o.prototype,"encryptedKey",void 0)}}),require_kek_recipient_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/kek_recipient_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KEKRecipientInfo=e.KEKIdentifier=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_other_key_attribute(),s=require_types3(),n=class{constructor(e={}){this.keyIdentifier=new i.OctetString,Object.assign(this,e)}};e.KEKIdentifier=n,t.__decorate([(0,i.AsnProp)({type:i.OctetString})],n.prototype,"keyIdentifier",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.GeneralizedTime,optional:!0})],n.prototype,"date",void 0),t.__decorate([(0,i.AsnProp)({type:r.OtherKeyAttribute,optional:!0})],n.prototype,"other",void 0);var a=class{constructor(e={}){this.version=s.CMSVersion.v4,this.kekid=new n,this.keyEncryptionAlgorithm=new s.KeyEncryptionAlgorithmIdentifier,this.encryptedKey=new i.OctetString,Object.assign(this,e)}};e.KEKRecipientInfo=a,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],a.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:n})],a.prototype,"kekid",void 0),t.__decorate([(0,i.AsnProp)({type:s.KeyEncryptionAlgorithmIdentifier})],a.prototype,"keyEncryptionAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.OctetString})],a.prototype,"encryptedKey",void 0)}}),require_password_recipient_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/password_recipient_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PasswordRecipientInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_types3(),s=class{constructor(e={}){this.version=r.CMSVersion.v0,this.keyEncryptionAlgorithm=new r.KeyEncryptionAlgorithmIdentifier,this.encryptedKey=new i.OctetString,Object.assign(this,e)}};e.PasswordRecipientInfo=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],s.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:r.KeyDerivationAlgorithmIdentifier,context:0,optional:!0})],s.prototype,"keyDerivationAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:r.KeyEncryptionAlgorithmIdentifier})],s.prototype,"keyEncryptionAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.OctetString})],s.prototype,"encryptedKey",void 0)}}),require_recipient_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/recipient_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RecipientInfo=e.OtherRecipientInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_key_agree_recipient_info(),s=require_key_trans_recipient_info(),n=require_kek_recipient_info(),a=require_password_recipient_info(),o=class{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}};e.OtherRecipientInfo=o,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],o.prototype,"oriType",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any})],o.prototype,"oriValue",void 0);var c=class{constructor(e={}){Object.assign(this,e)}};e.RecipientInfo=c,t.__decorate([(0,i.AsnProp)({type:s.KeyTransRecipientInfo,optional:!0})],c.prototype,"ktri",void 0),t.__decorate([(0,i.AsnProp)({type:r.KeyAgreeRecipientInfo,context:1,implicit:!0,optional:!0})],c.prototype,"kari",void 0),t.__decorate([(0,i.AsnProp)({type:n.KEKRecipientInfo,context:2,implicit:!0,optional:!0})],c.prototype,"kekri",void 0),t.__decorate([(0,i.AsnProp)({type:a.PasswordRecipientInfo,context:3,implicit:!0,optional:!0})],c.prototype,"pwri",void 0),t.__decorate([(0,i.AsnProp)({type:o,context:4,implicit:!0,optional:!0})],c.prototype,"ori",void 0),e.RecipientInfo=c=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],c)}}),require_recipient_infos=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/recipient_infos.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.RecipientInfos=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_recipient_info(),n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.RecipientInfos=n,e.RecipientInfos=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Set,itemType:s.RecipientInfo})],n)}}),require_revocation_info_choice=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/revocation_info_choice.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.RevocationInfoChoices=e.RevocationInfoChoice=e.OtherRevocationInfoFormat=e.id_ri_scvp=e.id_ri_ocsp_response=e.id_ri=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_cjs2();e.id_ri=`${s.id_pkix}.16`,e.id_ri_ocsp_response=`${e.id_ri}.2`,e.id_ri_scvp=`${e.id_ri}.4`;var n=class{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}};e.OtherRevocationInfoFormat=n,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],n.prototype,"otherRevInfoFormat",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Any})],n.prototype,"otherRevInfo",void 0);var a=class{constructor(e={}){this.other=new n,Object.assign(this,e)}};e.RevocationInfoChoice=a,i.__decorate([(0,r.AsnProp)({type:n,context:1,implicit:!0})],a.prototype,"other",void 0),e.RevocationInfoChoice=a=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Choice})],a);var o=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.RevocationInfoChoices=o,e.RevocationInfoChoices=o=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Set,itemType:a})],o)}}),require_originator_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/originator_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OriginatorInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_certificate_choices(),s=require_revocation_info_choice(),n=class{constructor(e={}){Object.assign(this,e)}};e.OriginatorInfo=n,t.__decorate([(0,i.AsnProp)({type:r.CertificateSet,context:0,implicit:!0,optional:!0})],n.prototype,"certs",void 0),t.__decorate([(0,i.AsnProp)({type:s.RevocationInfoChoices,context:1,implicit:!0,optional:!0})],n.prototype,"crls",void 0)}}),require_enveloped_data=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/enveloped_data.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.EnvelopedData=e.UnprotectedAttributes=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_types3(),n=require_attribute2(),a=require_recipient_infos(),o=require_originator_info(),c=require_encrypted_content_info(),l=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.UnprotectedAttributes=l,e.UnprotectedAttributes=l=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Set,itemType:n.Attribute})],l);var u=class{constructor(e={}){this.version=s.CMSVersion.v0,this.recipientInfos=new a.RecipientInfos,this.encryptedContentInfo=new c.EncryptedContentInfo,Object.assign(this,e)}};e.EnvelopedData=u,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer})],u.prototype,"version",void 0),i.__decorate([(0,r.AsnProp)({type:o.OriginatorInfo,context:0,implicit:!0,optional:!0})],u.prototype,"originatorInfo",void 0),i.__decorate([(0,r.AsnProp)({type:a.RecipientInfos})],u.prototype,"recipientInfos",void 0),i.__decorate([(0,r.AsnProp)({type:c.EncryptedContentInfo})],u.prototype,"encryptedContentInfo",void 0),i.__decorate([(0,r.AsnProp)({type:l,context:1,implicit:!0,optional:!0})],u.prototype,"unprotectedAttrs",void 0)}}),require_object_identifiers3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/object_identifiers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_authData=e.id_encryptedData=e.id_digestedData=e.id_envelopedData=e.id_signedData=e.id_data=e.id_ct_contentInfo=void 0,e.id_ct_contentInfo="1.2.840.113549.1.9.16.1.6",e.id_data="1.2.840.113549.1.7.1",e.id_signedData="1.2.840.113549.1.7.2",e.id_envelopedData="1.2.840.113549.1.7.3",e.id_digestedData="1.2.840.113549.1.7.5",e.id_encryptedData="1.2.840.113549.1.7.6",e.id_authData="1.2.840.113549.1.9.16.1.2"}}),require_signed_data=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/signed_data.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.SignedData=e.DigestAlgorithmIdentifiers=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_certificate_choices(),n=require_types3(),a=require_encapsulated_content_info(),o=require_revocation_info_choice(),c=require_signer_info(),l=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.DigestAlgorithmIdentifiers=l,e.DigestAlgorithmIdentifiers=l=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Set,itemType:n.DigestAlgorithmIdentifier})],l);var u=class{constructor(e={}){this.version=n.CMSVersion.v0,this.digestAlgorithms=new l,this.encapContentInfo=new a.EncapsulatedContentInfo,this.signerInfos=new c.SignerInfos,Object.assign(this,e)}};e.SignedData=u,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer})],u.prototype,"version",void 0),i.__decorate([(0,r.AsnProp)({type:l})],u.prototype,"digestAlgorithms",void 0),i.__decorate([(0,r.AsnProp)({type:a.EncapsulatedContentInfo})],u.prototype,"encapContentInfo",void 0),i.__decorate([(0,r.AsnProp)({type:s.CertificateSet,context:0,implicit:!0,optional:!0})],u.prototype,"certificates",void 0),i.__decorate([(0,r.AsnProp)({type:o.RevocationInfoChoices,context:1,implicit:!0,optional:!0})],u.prototype,"crls",void 0),i.__decorate([(0,r.AsnProp)({type:c.SignerInfos})],u.prototype,"signerInfos",void 0)}}),require_cjs4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-cms/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_attributes(),e),t.__exportStar(require_attribute2(),e),t.__exportStar(require_certificate_choices(),e),t.__exportStar(require_content_info(),e),t.__exportStar(require_encapsulated_content_info(),e),t.__exportStar(require_encrypted_content_info(),e),t.__exportStar(require_enveloped_data(),e),t.__exportStar(require_issuer_and_serial_number(),e),t.__exportStar(require_kek_recipient_info(),e),t.__exportStar(require_key_agree_recipient_info(),e),t.__exportStar(require_key_trans_recipient_info(),e),t.__exportStar(require_object_identifiers3(),e),t.__exportStar(require_originator_info(),e),t.__exportStar(require_password_recipient_info(),e),t.__exportStar(require_recipient_info(),e),t.__exportStar(require_recipient_infos(),e),t.__exportStar(require_revocation_info_choice(),e),t.__exportStar(require_signed_data(),e),t.__exportStar(require_signer_identifier(),e),t.__exportStar(require_signer_info(),e),t.__exportStar(require_types3(),e)}}),require_object_identifiers4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/object_identifiers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_sect571r1=e.id_sect571k1=e.id_secp521r1=e.id_sect409r1=e.id_sect409k1=e.id_secp384r1=e.id_sect283r1=e.id_sect283k1=e.id_secp256r1=e.id_sect233r1=e.id_sect233k1=e.id_secp224r1=e.id_sect163r2=e.id_sect163k1=e.id_secp192r1=e.id_ecdsaWithSHA512=e.id_ecdsaWithSHA384=e.id_ecdsaWithSHA256=e.id_ecdsaWithSHA224=e.id_ecdsaWithSHA1=e.id_ecMQV=e.id_ecDH=e.id_ecPublicKey=void 0,e.id_ecPublicKey="1.2.840.10045.2.1",e.id_ecDH="1.3.132.1.12",e.id_ecMQV="1.3.132.1.13",e.id_ecdsaWithSHA1="1.2.840.10045.4.1",e.id_ecdsaWithSHA224="1.2.840.10045.4.3.1",e.id_ecdsaWithSHA256="1.2.840.10045.4.3.2",e.id_ecdsaWithSHA384="1.2.840.10045.4.3.3",e.id_ecdsaWithSHA512="1.2.840.10045.4.3.4",e.id_secp192r1="1.2.840.10045.3.1.1",e.id_sect163k1="1.3.132.0.1",e.id_sect163r2="1.3.132.0.15",e.id_secp224r1="1.3.132.0.33",e.id_sect233k1="1.3.132.0.26",e.id_sect233r1="1.3.132.0.27",e.id_secp256r1="1.2.840.10045.3.1.7",e.id_sect283k1="1.3.132.0.16",e.id_sect283r1="1.3.132.0.17",e.id_secp384r1="1.3.132.0.34",e.id_sect409k1="1.3.132.0.36",e.id_sect409r1="1.3.132.0.37",e.id_secp521r1="1.3.132.0.35",e.id_sect571k1="1.3.132.0.38",e.id_sect571r1="1.3.132.0.39"}}),require_algorithms=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/algorithms.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ecdsaWithSHA512=e.ecdsaWithSHA384=e.ecdsaWithSHA256=e.ecdsaWithSHA224=e.ecdsaWithSHA1=void 0;var t=require_cjs2(),i=require_object_identifiers4();function r(e){return new t.AlgorithmIdentifier({algorithm:e})}e.ecdsaWithSHA1=r(i.id_ecdsaWithSHA1),e.ecdsaWithSHA224=r(i.id_ecdsaWithSHA224),e.ecdsaWithSHA256=r(i.id_ecdsaWithSHA256),e.ecdsaWithSHA384=r(i.id_ecdsaWithSHA384),e.ecdsaWithSHA512=r(i.id_ecdsaWithSHA512)}}),require_rfc3279=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/rfc3279.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SpecifiedECDomain=e.ECPVer=e.Curve=e.FieldElement=e.ECPoint=e.FieldID=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){Object.assign(this,e)}};e.FieldID=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],r.prototype,"fieldType",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any})],r.prototype,"parameters",void 0),e.FieldID=r=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Sequence})],r);var s=class extends i.OctetString{};e.ECPoint=s;var n=class extends i.OctetString{};e.FieldElement=n;var a,o,c=class{constructor(e={}){Object.assign(this,e)}};e.Curve=c,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.OctetString})],c.prototype,"a",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.OctetString})],c.prototype,"b",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString,optional:!0})],c.prototype,"seed",void 0),e.Curve=c=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Sequence})],c),(o=a||(e.ECPVer=a={}))[o.ecpVer1=1]="ecpVer1";var l=class{constructor(e={}){this.version=a.ecpVer1,Object.assign(this,e)}};e.SpecifiedECDomain=l,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],l.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:r})],l.prototype,"fieldID",void 0),t.__decorate([(0,i.AsnProp)({type:c})],l.prototype,"curve",void 0),t.__decorate([(0,i.AsnProp)({type:s})],l.prototype,"base",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],l.prototype,"order",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,optional:!0})],l.prototype,"cofactor",void 0),e.SpecifiedECDomain=l=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Sequence})],l)}}),require_ec_parameters=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/ec_parameters.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ECParameters=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_rfc3279(),s=class{constructor(e={}){Object.assign(this,e)}};e.ECParameters=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],s.prototype,"namedCurve",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Null})],s.prototype,"implicitCurve",void 0),t.__decorate([(0,i.AsnProp)({type:r.SpecifiedECDomain})],s.prototype,"specifiedCurve",void 0),e.ECParameters=s=t.__decorate([(0,i.AsnType)({type:i.AsnTypeTypes.Choice})],s)}}),require_ec_private_key=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/ec_private_key.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ECPrivateKey=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_ec_parameters(),s=class{constructor(e={}){this.version=1,this.privateKey=new i.OctetString,Object.assign(this,e)}};e.ECPrivateKey=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],s.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:i.OctetString})],s.prototype,"privateKey",void 0),t.__decorate([(0,i.AsnProp)({type:r.ECParameters,context:0,optional:!0})],s.prototype,"parameters",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString,context:1,optional:!0})],s.prototype,"publicKey",void 0)}}),require_ec_signature_value=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/ec_signature_value.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ECDSASigValue=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}};e.ECDSASigValue=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],r.prototype,"r",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],r.prototype,"s",void 0)}}),require_cjs5=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-ecc/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_algorithms(),e),t.__exportStar(require_ec_parameters(),e),t.__exportStar(require_ec_private_key(),e),t.__exportStar(require_ec_signature_value(),e),t.__exportStar(require_object_identifiers4(),e),t.__exportStar(require_rfc3279(),e)}}),require_object_identifiers5=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/object_identifiers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_mgf1=e.id_md5=e.id_md2=e.id_sha512_256=e.id_sha512_224=e.id_sha512=e.id_sha384=e.id_sha256=e.id_sha224=e.id_sha1=e.id_sha512_256WithRSAEncryption=e.id_sha512_224WithRSAEncryption=e.id_sha512WithRSAEncryption=e.id_sha384WithRSAEncryption=e.id_sha256WithRSAEncryption=e.id_ssha224WithRSAEncryption=e.id_sha224WithRSAEncryption=e.id_sha1WithRSAEncryption=e.id_md5WithRSAEncryption=e.id_md2WithRSAEncryption=e.id_RSASSA_PSS=e.id_pSpecified=e.id_RSAES_OAEP=e.id_rsaEncryption=e.id_pkcs_1=void 0,e.id_pkcs_1="1.2.840.113549.1.1",e.id_rsaEncryption=`${e.id_pkcs_1}.1`,e.id_RSAES_OAEP=`${e.id_pkcs_1}.7`,e.id_pSpecified=`${e.id_pkcs_1}.9`,e.id_RSASSA_PSS=`${e.id_pkcs_1}.10`,e.id_md2WithRSAEncryption=`${e.id_pkcs_1}.2`,e.id_md5WithRSAEncryption=`${e.id_pkcs_1}.4`,e.id_sha1WithRSAEncryption=`${e.id_pkcs_1}.5`,e.id_sha224WithRSAEncryption=`${e.id_pkcs_1}.14`,e.id_ssha224WithRSAEncryption=e.id_sha224WithRSAEncryption,e.id_sha256WithRSAEncryption=`${e.id_pkcs_1}.11`,e.id_sha384WithRSAEncryption=`${e.id_pkcs_1}.12`,e.id_sha512WithRSAEncryption=`${e.id_pkcs_1}.13`,e.id_sha512_224WithRSAEncryption=`${e.id_pkcs_1}.15`,e.id_sha512_256WithRSAEncryption=`${e.id_pkcs_1}.16`,e.id_sha1="1.3.14.3.2.26",e.id_sha224="2.16.840.1.101.3.4.2.4",e.id_sha256="2.16.840.1.101.3.4.2.1",e.id_sha384="2.16.840.1.101.3.4.2.2",e.id_sha512="2.16.840.1.101.3.4.2.3",e.id_sha512_224="2.16.840.1.101.3.4.2.5",e.id_sha512_256="2.16.840.1.101.3.4.2.6",e.id_md2="1.2.840.113549.2.2",e.id_md5="1.2.840.113549.2.5",e.id_mgf1=`${e.id_pkcs_1}.8`}}),require_algorithms2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/algorithms.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha512_256WithRSAEncryption=e.sha512_224WithRSAEncryption=e.sha512WithRSAEncryption=e.sha384WithRSAEncryption=e.sha256WithRSAEncryption=e.sha224WithRSAEncryption=e.sha1WithRSAEncryption=e.md5WithRSAEncryption=e.md2WithRSAEncryption=e.rsaEncryption=e.pSpecifiedEmpty=e.mgf1SHA1=e.sha512_256=e.sha512_224=e.sha512=e.sha384=e.sha256=e.sha224=e.sha1=e.md4=e.md2=void 0;var t=require_cjs(),i=require_cjs2(),r=require_object_identifiers5();function s(e){return new i.AlgorithmIdentifier({algorithm:e,parameters:null})}e.md2=s(r.id_md2),e.md4=s(r.id_md5),e.sha1=s(r.id_sha1),e.sha224=s(r.id_sha224),e.sha256=s(r.id_sha256),e.sha384=s(r.id_sha384),e.sha512=s(r.id_sha512),e.sha512_224=s(r.id_sha512_224),e.sha512_256=s(r.id_sha512_256),e.mgf1SHA1=new i.AlgorithmIdentifier({algorithm:r.id_mgf1,parameters:t.AsnConvert.serialize(e.sha1)}),e.pSpecifiedEmpty=new i.AlgorithmIdentifier({algorithm:r.id_pSpecified,parameters:t.AsnConvert.serialize(t.AsnOctetStringConverter.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))}),e.rsaEncryption=s(r.id_rsaEncryption),e.md2WithRSAEncryption=s(r.id_md2WithRSAEncryption),e.md5WithRSAEncryption=s(r.id_md5WithRSAEncryption),e.sha1WithRSAEncryption=s(r.id_sha1WithRSAEncryption),e.sha224WithRSAEncryption=s(r.id_sha512_224WithRSAEncryption),e.sha256WithRSAEncryption=s(r.id_sha512_256WithRSAEncryption),e.sha384WithRSAEncryption=s(r.id_sha384WithRSAEncryption),e.sha512WithRSAEncryption=s(r.id_sha512WithRSAEncryption),e.sha512_224WithRSAEncryption=s(r.id_sha512_224WithRSAEncryption),e.sha512_256WithRSAEncryption=s(r.id_sha512_256WithRSAEncryption)}}),require_rsaes_oaep=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/rsaes_oaep.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RSAES_OAEP=e.RsaEsOaepParams=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_object_identifiers5(),n=require_algorithms2(),a=class{constructor(e={}){this.hashAlgorithm=new r.AlgorithmIdentifier(n.sha1),this.maskGenAlgorithm=new r.AlgorithmIdentifier({algorithm:s.id_mgf1,parameters:i.AsnConvert.serialize(n.sha1)}),this.pSourceAlgorithm=new r.AlgorithmIdentifier(n.pSpecifiedEmpty),Object.assign(this,e)}};e.RsaEsOaepParams=a,t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier,context:0,defaultValue:n.sha1})],a.prototype,"hashAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier,context:1,defaultValue:n.mgf1SHA1})],a.prototype,"maskGenAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier,context:2,defaultValue:n.pSpecifiedEmpty})],a.prototype,"pSourceAlgorithm",void 0),e.RSAES_OAEP=new r.AlgorithmIdentifier({algorithm:s.id_RSAES_OAEP,parameters:i.AsnConvert.serialize(new a)})}}),require_rsassa_pss=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/rsassa_pss.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RSASSA_PSS=e.RsaSaPssParams=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_object_identifiers5(),n=require_algorithms2(),a=class{constructor(e={}){this.hashAlgorithm=new r.AlgorithmIdentifier(n.sha1),this.maskGenAlgorithm=new r.AlgorithmIdentifier({algorithm:s.id_mgf1,parameters:i.AsnConvert.serialize(n.sha1)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}};e.RsaSaPssParams=a,t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier,context:0,defaultValue:n.sha1})],a.prototype,"hashAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier,context:1,defaultValue:n.mgf1SHA1})],a.prototype,"maskGenAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,context:2,defaultValue:20})],a.prototype,"saltLength",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,context:3,defaultValue:1})],a.prototype,"trailerField",void 0),e.RSASSA_PSS=new r.AlgorithmIdentifier({algorithm:s.id_RSASSA_PSS,parameters:i.AsnConvert.serialize(new a)})}}),require_rsassa_pkcs1_v1_5=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/rsassa_pkcs1_v1_5.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DigestInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs2(),r=require_cjs(),s=class{constructor(e={}){this.digestAlgorithm=new i.AlgorithmIdentifier,this.digest=new r.OctetString,Object.assign(this,e)}};e.DigestInfo=s,t.__decorate([(0,r.AsnProp)({type:i.AlgorithmIdentifier})],s.prototype,"digestAlgorithm",void 0),t.__decorate([(0,r.AsnProp)({type:r.OctetString})],s.prototype,"digest",void 0)}}),require_parameters=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_rsaes_oaep(),e),t.__exportStar(require_rsassa_pss(),e),t.__exportStar(require_rsassa_pkcs1_v1_5(),e)}}),require_other_prime_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/other_prime_info.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.OtherPrimeInfos=e.OtherPrimeInfo=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=class{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}};e.OtherPrimeInfo=s,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,converter:r.AsnIntegerArrayBufferConverter})],s.prototype,"prime",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,converter:r.AsnIntegerArrayBufferConverter})],s.prototype,"exponent",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,converter:r.AsnIntegerArrayBufferConverter})],s.prototype,"coefficient",void 0);var n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.OtherPrimeInfos=n,e.OtherPrimeInfos=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s})],n)}}),require_rsa_private_key=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/rsa_private_key.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RSAPrivateKey=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_other_prime_info(),s=class{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}};e.RSAPrivateKey=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],s.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"modulus",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"publicExponent",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"privateExponent",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"prime1",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"prime2",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"exponent1",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"exponent2",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],s.prototype,"coefficient",void 0),t.__decorate([(0,i.AsnProp)({type:r.OtherPrimeInfos,optional:!0})],s.prototype,"otherPrimeInfos",void 0)}}),require_rsa_public_key=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/rsa_public_key.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RSAPublicKey=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}};e.RSAPublicKey=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],r.prototype,"modulus",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer,converter:i.AsnIntegerArrayBufferConverter})],r.prototype,"publicExponent",void 0)}}),require_cjs6=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-rsa/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_parameters(),e),t.__exportStar(require_algorithms2(),e),t.__exportStar(require_object_identifiers5(),e),t.__exportStar(require_other_prime_info(),e),t.__exportStar(require_rsa_private_key(),e),t.__exportStar(require_rsa_public_key(),e)}}),tslib_es6_exports2={};function __extends2(e,t){function i(){this.constructor=e}extendStatics2(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function __rest2(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]])}return i}function __decorate2(e,t,i,r){var s,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,i,a):s(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a}function __param2(e,t){return function(i,r){t(i,r,e)}}function __metadata2(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter2(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))}function __generator2(e,t){var i,r,s,n,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function o(n){return function(o){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){a.label=n[1];break}if(6===n[0]&&a.label<s[1]){a.label=s[1],s=n;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(n);break}s[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],r=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,o])}}}function __createBinding2(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}function __exportStar2(e,t){for(var i in e)"default"===i||t.hasOwnProperty(i)||(t[i]=e[i])}function __values2(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read2(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,s,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=n.next()).done;)a.push(r.value)}catch(e){s={error:e}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}return a}function __spread2(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read2(arguments[t]));return e}function __spreadArrays2(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var r=Array(e),s=0;for(t=0;t<i;t++)for(var n=arguments[t],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function __await2(e){return this instanceof __await2?(this.v=e,this):new __await2(e)}function __asyncGenerator2(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,s=i.apply(e,t||[]),n=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){s[e]&&(r[e]=function(t){return new Promise((function(i,r){n.push([e,t,i,r])>1||o(e,t)}))})}function o(e,t){try{(i=s[e](t)).value instanceof __await2?Promise.resolve(i.value.v).then(c,l):u(n[0][2],i)}catch(e){u(n[0][3],e)}var i}function c(e){o("next",e)}function l(e){o("throw",e)}function u(e,t){e(t),n.shift(),n.length&&o(n[0][0],n[0][1])}}function __asyncDelegator2(e){var t,i;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,s){t[r]=e[r]?function(t){return(i=!i)?{value:__await2(e[r](t)),done:"return"===r}:s?s(t):t}:s}}function __asyncValues2(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values2?__values2(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(t){return new Promise((function(r,s){(function(e,t,i,r){Promise.resolve(r).then((function(t){e({value:t,done:i})}),t)})(r,s,(t=e[i](t)).done,t.value)}))}}}function __makeTemplateObject2(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function __importStar2(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function __importDefault2(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet2(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function __classPrivateFieldSet2(e,t,i){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,i),i}__export(tslib_es6_exports2,{__assign:()=>__assign2,__asyncDelegator:()=>__asyncDelegator2,__asyncGenerator:()=>__asyncGenerator2,__asyncValues:()=>__asyncValues2,__await:()=>__await2,__awaiter:()=>__awaiter2,__classPrivateFieldGet:()=>__classPrivateFieldGet2,__classPrivateFieldSet:()=>__classPrivateFieldSet2,__createBinding:()=>__createBinding2,__decorate:()=>__decorate2,__exportStar:()=>__exportStar2,__extends:()=>__extends2,__generator:()=>__generator2,__importDefault:()=>__importDefault2,__importStar:()=>__importStar2,__makeTemplateObject:()=>__makeTemplateObject2,__metadata:()=>__metadata2,__param:()=>__param2,__read:()=>__read2,__rest:()=>__rest2,__spread:()=>__spread2,__spreadArrays:()=>__spreadArrays2,__values:()=>__values2});var import_crypto32,rnds8Pool,poolPtr,init_tslib_es62=__esm({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/node_modules/tslib/tslib.es6.js"(){extendStatics2=function(e,t){return(extendStatics2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},__assign2=function(){return __assign2=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign2.apply(this,arguments)}}}),require_lifecycle=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/types/lifecycle.js"(e){"use strict";var t,i;Object.defineProperty(e,"__esModule",{value:!0}),(i=t||(t={}))[i.Transient=0]="Transient",i[i.Singleton=1]="Singleton",i[i.ResolutionScoped=2]="ResolutionScoped",i[i.ContainerScoped=3]="ContainerScoped",e.default=t}}),require_types4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/types/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_lifecycle();Object.defineProperty(e,"Lifecycle",{enumerable:!0,get:function(){return t.default}})}}),require_reflection_helpers=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/reflection-helpers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.defineInjectionTokenMetadata=e.getParamInfo=e.INJECTION_TOKEN_METADATA_KEY=void 0,e.INJECTION_TOKEN_METADATA_KEY="injectionTokens",e.getParamInfo=function(t){const i=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(e.INJECTION_TOKEN_METADATA_KEY,t)||{};return Object.keys(r).forEach((e=>{i[+e]=r[e]})),i},e.defineInjectionTokenMetadata=function(t,i){return function(r,s,n){const a=Reflect.getOwnMetadata(e.INJECTION_TOKEN_METADATA_KEY,r)||{};a[n]=i?{token:t,transform:i.transformToken,transformArgs:i.args||[]}:t,Reflect.defineMetadata(e.INJECTION_TOKEN_METADATA_KEY,a,r)}}}}),require_class_provider=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/class-provider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isClassProvider=void 0,e.isClassProvider=function(e){return!!e.useClass}}}),require_factory_provider=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/factory-provider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isFactoryProvider=void 0,e.isFactoryProvider=function(e){return!!e.useFactory}}}),require_lazy_helpers=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/lazy-helpers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.delay=e.DelayedConstructor=void 0;var t=class{constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t,i=!1;return new Proxy({},this.createHandler((()=>(i||(t=e(this.wrap()),i=!0),t))))}createHandler(e){const t={};return this.reflectMethods.forEach((i=>{t[i]=(...t)=>{t[0]=e();return(0,Reflect[i])(...t)}})),t}};e.DelayedConstructor=t,e.delay=function(e){if(void 0===e)throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new t(e)}}}),require_injection_token=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/injection-token.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isConstructorToken=e.isTransformDescriptor=e.isTokenDescriptor=e.isNormalToken=void 0;var t=require_lazy_helpers();e.isNormalToken=function(e){return"string"==typeof e||"symbol"==typeof e},e.isTokenDescriptor=function(e){return"object"==typeof e&&"token"in e&&"multiple"in e},e.isTransformDescriptor=function(e){return"object"==typeof e&&"token"in e&&"transform"in e},e.isConstructorToken=function(e){return"function"==typeof e||e instanceof t.DelayedConstructor}}}),require_token_provider=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/token-provider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isTokenProvider=void 0,e.isTokenProvider=function(e){return!!e.useToken}}}),require_value_provider=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/value-provider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isValueProvider=void 0,e.isValueProvider=function(e){return null!=e.useValue}}}),require_providers=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_class_provider();Object.defineProperty(e,"isClassProvider",{enumerable:!0,get:function(){return t.isClassProvider}});var i=require_factory_provider();Object.defineProperty(e,"isFactoryProvider",{enumerable:!0,get:function(){return i.isFactoryProvider}});var r=require_injection_token();Object.defineProperty(e,"isNormalToken",{enumerable:!0,get:function(){return r.isNormalToken}});var s=require_token_provider();Object.defineProperty(e,"isTokenProvider",{enumerable:!0,get:function(){return s.isTokenProvider}});var n=require_value_provider();Object.defineProperty(e,"isValueProvider",{enumerable:!0,get:function(){return n.isValueProvider}})}}),require_provider=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/providers/provider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isProvider=void 0;var t=require_class_provider(),i=require_value_provider(),r=require_token_provider(),s=require_factory_provider();e.isProvider=function(e){return t.isClassProvider(e)||i.isValueProvider(e)||r.isTokenProvider(e)||s.isFactoryProvider(e)}}}),require_registry_base=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/registry-base.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);const t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}}}}),require_registry=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/registry.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_registry_base(),i=class extends t.default{};e.default=i}}),require_resolution_context=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/resolution-context.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(){this.scopedResolutions=new Map}}}}),require_error_helpers=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/error-helpers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.formatErrorCtor=void 0,e.formatErrorCtor=function(e,t,i){const[,r=null]=e.toString().match(/constructor\(([\w, ]+)\)/)||[];return function(e,t,i="    "){return[e,...t.message.split("\n").map((e=>i+e))].join("\n")}(`Cannot inject the dependency ${function(e,t){return null===e?`at position #${t}`:`"${e.split(",")[t].trim()}" at position #${t}`}(r,t)} of "${e.name}" constructor. Reason:`,i)}}}),require_disposable=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/types/disposable.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isDisposable=void 0,e.isDisposable=function(e){return"function"==typeof e.dispose&&!(e.dispose.length>0)}}}),require_interceptors=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/interceptors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PostResolutionInterceptors=e.PreResolutionInterceptors=void 0;var t=require_registry_base(),i=class extends t.default{};e.PreResolutionInterceptors=i;var r=class extends t.default{};e.PostResolutionInterceptors=r;e.default=class{constructor(){this.preResolution=new i,this.postResolution=new r}}}}),require_dependency_container=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/dependency-container.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.instance=e.typeInfo=void 0;var t=(init_tslib_es62(),__toCommonJS(tslib_es6_exports2)),i=require_providers(),r=require_provider(),s=require_injection_token(),n=require_registry(),a=require_lifecycle(),o=require_resolution_context(),c=require_error_helpers(),l=require_lazy_helpers(),u=require_disposable(),d=require_interceptors();e.typeInfo=new Map;e.instance=new class p{constructor(e){this.parent=e,this._registry=new n.default,this.interceptors=new d.default,this.disposed=!1,this.disposables=new Set}register(e,t,s={lifecycle:a.default.Transient}){let n;if(this.ensureNotDisposed(),n=r.isProvider(t)?t:{useClass:t},i.isTokenProvider(n)){const t=[e];let r=n;for(;null!=r;){const e=r.useToken;if(t.includes(e))throw new Error(`Token registration cycle detected! ${[...t,e].join(" -> ")}`);t.push(e);const s=this._registry.get(e);r=s&&i.isTokenProvider(s.provider)?s.provider:null}}if((s.lifecycle===a.default.Singleton||s.lifecycle==a.default.ContainerScoped||s.lifecycle==a.default.ResolutionScoped)&&(i.isValueProvider(n)||i.isFactoryProvider(n)))throw new Error(`Cannot use lifecycle "${a.default[s.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:n,options:s}),this}registerType(e,t){return this.ensureNotDisposed(),i.isNormalToken(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})}registerInstance(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})}registerSingleton(e,t){if(this.ensureNotDisposed(),i.isNormalToken(e)){if(i.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:a.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:a.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!i.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:a.default.Singleton})}resolve(e,t=new o.default){this.ensureNotDisposed();const r=this.getRegistration(e);if(!r&&i.isNormalToken(e))throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`);if(this.executePreResolutionInterceptor(e,"Single"),r){const i=this.resolveRegistration(r,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(s.isConstructorToken(e)){const i=this.construct(e,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")}executePreResolutionInterceptor(e,t){if(this.interceptors.preResolution.has(e)){const i=[];for(const r of this.interceptors.preResolution.getAll(e))"Once"!=r.options.frequency&&i.push(r),r.callback(e,t);this.interceptors.preResolution.setAll(e,i)}}executePostResolutionInterceptor(e,t,i){if(this.interceptors.postResolution.has(e)){const r=[];for(const s of this.interceptors.postResolution.getAll(e))"Once"!=s.options.frequency&&r.push(s),s.callback(e,t,i);this.interceptors.postResolution.setAll(e,r)}}resolveRegistration(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===a.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);const r=e.options.lifecycle===a.default.Singleton,s=e.options.lifecycle===a.default.ContainerScoped,n=r||s;let o;return o=i.isValueProvider(e.provider)?e.provider.useValue:i.isTokenProvider(e.provider)?n?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):i.isClassProvider(e.provider)?n?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):i.isFactoryProvider(e.provider)?e.provider.useFactory(this):this.construct(e.provider,t),e.options.lifecycle===a.default.ResolutionScoped&&t.scopedResolutions.set(e,o),o}resolveAll(e,t=new o.default){this.ensureNotDisposed();const r=this.getAllRegistrations(e);if(!r&&i.isNormalToken(e))throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`);if(this.executePreResolutionInterceptor(e,"All"),r){const i=r.map((e=>this.resolveRegistration(e,t)));return this.executePostResolutionInterceptor(e,i,"All"),i}const s=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,s,"All"),s}isRegistered(e,t=!1){return this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)}reset(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()}clearInstances(){this.ensureNotDisposed();for(const[e,t]of this._registry.entries())this._registry.setAll(e,t.filter((e=>!i.isValueProvider(e.provider))).map((e=>(e.instance=void 0,e))))}createChildContainer(){this.ensureNotDisposed();const e=new p(this);for(const[t,i]of this._registry.entries())i.some((({options:e})=>e.lifecycle===a.default.ContainerScoped))&&e._registry.setAll(t,i.map((e=>e.options.lifecycle===a.default.ContainerScoped?{provider:e.provider,options:e.options}:e)));return e}beforeResolution(e,t,i={frequency:"Always"}){this.interceptors.preResolution.set(e,{callback:t,options:i})}afterResolution(e,t,i={frequency:"Always"}){this.interceptors.postResolution.set(e,{callback:t,options:i})}dispose(){return t.__awaiter(this,void 0,void 0,(function*(){this.disposed=!0;const e=[];this.disposables.forEach((t=>{const i=t.dispose();i&&e.push(i)})),yield Promise.all(e)}))}getRegistration(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null}getAllRegistrations(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null}construct(t,i){if(t instanceof l.DelayedConstructor)return t.createProxy((e=>this.resolve(e,i)));const r=(()=>{const r=e.typeInfo.get(t);if(!r||0===r.length){if(0===t.length)return new t;throw new Error(`TypeInfo not known for "${t.name}"`)}const s=r.map(this.resolveParams(i,t));return new t(...s)})();return u.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(i,r)=>{try{return s.isTokenDescriptor(i)?s.isTransformDescriptor(i)?i.multiple?this.resolve(i.transform).transform(this.resolveAll(i.token),...i.transformArgs):this.resolve(i.transform).transform(this.resolve(i.token,e),...i.transformArgs):i.multiple?this.resolveAll(i.token):this.resolve(i.token,e):s.isTransformDescriptor(i)?this.resolve(i.transform,e).transform(this.resolve(i.token,e),...i.transformArgs):this.resolve(i,e)}catch(e){throw new Error(c.formatErrorCtor(t,r,e))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}},e.default=e.instance}}),require_auto_injectable=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/auto-injectable.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_reflection_helpers(),i=require_dependency_container(),r=require_injection_token(),s=require_error_helpers();e.default=function(){return function(e){const n=t.getParamInfo(e);return class extends e{constructor(...t){super(...t.concat(n.slice(t.length).map(((n,a)=>{try{return r.isTokenDescriptor(n)?r.isTransformDescriptor(n)?n.multiple?i.instance.resolve(n.transform).transform(i.instance.resolveAll(n.token),...n.transformArgs):i.instance.resolve(n.transform).transform(i.instance.resolve(n.token),...n.transformArgs):n.multiple?i.instance.resolveAll(n.token):i.instance.resolve(n.token):r.isTransformDescriptor(n)?i.instance.resolve(n.transform).transform(i.instance.resolve(n.token),...n.transformArgs):i.instance.resolve(n)}catch(i){const r=a+t.length;throw new Error(s.formatErrorCtor(e,r,i))}}))))}}}}}}),require_inject=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/inject.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_reflection_helpers();e.default=function(e){return t.defineInjectionTokenMetadata(e)}}}),require_injectable=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/injectable.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_reflection_helpers(),i=require_dependency_container();e.default=function(){return function(e){i.typeInfo.set(e,t.getParamInfo(e))}}}}),require_registry2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/registry.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es62(),__toCommonJS(tslib_es6_exports2)),i=require_dependency_container();e.default=function(e=[]){return function(r){return e.forEach((e=>{var{token:r,options:s}=e,n=t.__rest(e,["token","options"]);return i.instance.register(r,n,s)})),r}}}}),require_singleton=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/singleton.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_injectable(),i=require_dependency_container();e.default=function(){return function(e){t.default()(e),i.instance.registerSingleton(e)}}}}),require_inject_all=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/inject-all.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_reflection_helpers();e.default=function(e){const i={token:e,multiple:!0};return t.defineInjectionTokenMetadata(i)}}}),require_inject_all_with_transform=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/inject-all-with-transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_reflection_helpers();e.default=function(e,i,...r){const s={token:e,multiple:!0,transform:i,transformArgs:r};return t.defineInjectionTokenMetadata(s)}}}),require_inject_with_transform=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/inject-with-transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_reflection_helpers();e.default=function(e,i,...r){return t.defineInjectionTokenMetadata(e,{transformToken:i,args:r})}}}),require_scoped=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/scoped.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_injectable(),i=require_dependency_container();e.default=function(e,r){return function(s){t.default()(s),i.instance.register(r||s,s,{lifecycle:e})}}}}),require_decorators2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/decorators/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_auto_injectable();Object.defineProperty(e,"autoInjectable",{enumerable:!0,get:function(){return t.default}});var i=require_inject();Object.defineProperty(e,"inject",{enumerable:!0,get:function(){return i.default}});var r=require_injectable();Object.defineProperty(e,"injectable",{enumerable:!0,get:function(){return r.default}});var s=require_registry2();Object.defineProperty(e,"registry",{enumerable:!0,get:function(){return s.default}});var n=require_singleton();Object.defineProperty(e,"singleton",{enumerable:!0,get:function(){return n.default}});var a=require_inject_all();Object.defineProperty(e,"injectAll",{enumerable:!0,get:function(){return a.default}});var o=require_inject_all_with_transform();Object.defineProperty(e,"injectAllWithTransform",{enumerable:!0,get:function(){return o.default}});var c=require_inject_with_transform();Object.defineProperty(e,"injectWithTransform",{enumerable:!0,get:function(){return c.default}});var l=require_scoped();Object.defineProperty(e,"scoped",{enumerable:!0,get:function(){return l.default}})}}),require_instance_caching_factory=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/factories/instance-caching-factory.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){let t;return i=>(null==t&&(t=e(i)),t)}}}),require_instance_per_container_caching_factory=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/factories/instance-per-container-caching-factory.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){const t=new WeakMap;return i=>{let r=t.get(i);return null==r&&(r=e(i),t.set(i,r)),r}}}}),require_predicate_aware_class_factory=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/factories/predicate-aware-class-factory.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e,t,i,r=!0){let s,n;return a=>{const o=e(a);return r&&n===o||(s=(n=o)?a.resolve(t):a.resolve(i)),s}}}}),require_factories=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/factories/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_instance_caching_factory();Object.defineProperty(e,"instanceCachingFactory",{enumerable:!0,get:function(){return t.default}});var i=require_instance_per_container_caching_factory();Object.defineProperty(e,"instancePerContainerCachingFactory",{enumerable:!0,get:function(){return i.default}});var r=require_predicate_aware_class_factory();Object.defineProperty(e,"predicateAwareClassFactory",{enumerable:!0,get:function(){return r.default}})}}),require_cjs7=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/tsyringe/dist/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es62(),__toCommonJS(tslib_es6_exports2));if("undefined"==typeof Reflect||!Reflect.getMetadata)throw new Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");var i=require_types4();Object.defineProperty(e,"Lifecycle",{enumerable:!0,get:function(){return i.Lifecycle}}),t.__exportStar(require_decorators2(),e),t.__exportStar(require_factories(),e),t.__exportStar(require_providers(),e);var r=require_lazy_helpers();Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return r.delay}});var s=require_dependency_container();Object.defineProperty(e,"container",{enumerable:!0,get:function(){return s.instance}})}}),require_attribute3=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/attribute.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.PKCS12AttrSet=e.PKCS12Attribute=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=class{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}};e.PKCS12Attribute=s,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],s.prototype,"attrId",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Any,repeated:"set"})],s.prototype,"attrValues",void 0);var n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.PKCS12AttrSet=n,e.PKCS12AttrSet=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s})],n)}}),require_authenticated_safe=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/authenticated_safe.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.AuthenticatedSafe=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_cjs4(),n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.AuthenticatedSafe=n,e.AuthenticatedSafe=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s.ContentInfo})],n)}}),require_object_identifiers6=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/object_identifiers.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_bagtypes=e.id_pbewithSHAAnd40BitRC2_CBC=e.id_pbeWithSHAAnd128BitRC2_CBC=e.id_pbeWithSHAAnd2_KeyTripleDES_CBC=e.id_pbeWithSHAAnd3_KeyTripleDES_CBC=e.id_pbeWithSHAAnd40BitRC4=e.id_pbeWithSHAAnd128BitRC4=e.id_pkcs_12PbeIds=e.id_pkcs_12=e.id_pkcs=e.id_rsadsi=void 0,e.id_rsadsi="1.2.840.113549",e.id_pkcs=`${e.id_rsadsi}.1`,e.id_pkcs_12=`${e.id_pkcs}.12`,e.id_pkcs_12PbeIds=`${e.id_pkcs_12}.1`,e.id_pbeWithSHAAnd128BitRC4=`${e.id_pkcs_12PbeIds}.1`,e.id_pbeWithSHAAnd40BitRC4=`${e.id_pkcs_12PbeIds}.2`,e.id_pbeWithSHAAnd3_KeyTripleDES_CBC=`${e.id_pkcs_12PbeIds}.3`,e.id_pbeWithSHAAnd2_KeyTripleDES_CBC=`${e.id_pkcs_12PbeIds}.4`,e.id_pbeWithSHAAnd128BitRC2_CBC=`${e.id_pkcs_12PbeIds}.5`,e.id_pbewithSHAAnd40BitRC2_CBC=`${e.id_pkcs_12PbeIds}.6`,e.id_bagtypes=`${e.id_pkcs_12}.10.1`}}),require_types5=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/types.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_pkcs_9=e.id_SafeContents=e.id_SecretBag=e.id_CRLBag=e.id_certBag=e.id_pkcs8ShroudedKeyBag=e.id_keyBag=void 0;var t=require_object_identifiers6();e.id_keyBag=`${t.id_bagtypes}.1`,e.id_pkcs8ShroudedKeyBag=`${t.id_bagtypes}.2`,e.id_certBag=`${t.id_bagtypes}.3`,e.id_CRLBag=`${t.id_bagtypes}.4`,e.id_SecretBag=`${t.id_bagtypes}.5`,e.id_SafeContents=`${t.id_bagtypes}.6`,e.id_pkcs_9="1.2.840.113549.1.9"}}),require_cert_bag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/cert_bag.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_sdsiCertificate=e.id_x509Certificate=e.id_certTypes=e.CertBag=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_types5(),s=class{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}};e.CertBag=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],s.prototype,"certId",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,context:0})],s.prototype,"certValue",void 0),e.id_certTypes=`${r.id_pkcs_9}.22`,e.id_x509Certificate=`${e.id_certTypes}.1`,e.id_sdsiCertificate=`${e.id_certTypes}.2`}}),require_crl_bag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/crl_bag.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id_x509CRL=e.id_crlTypes=e.CRLBag=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_types5(),s=class{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}};e.CRLBag=s,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],s.prototype,"crlId",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,context:0})],s.prototype,"crltValue",void 0),e.id_crlTypes=`${r.id_pkcs_9}.23`,e.id_x509CRL=`${e.id_crlTypes}.1`}}),require_encrypted_private_key_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pkcs8/build/cjs/encrypted_private_key_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncryptedPrivateKeyInfo=e.EncryptedData=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=class extends i.OctetString{};e.EncryptedData=s;var n=class{constructor(e={}){this.encryptionAlgorithm=new r.AlgorithmIdentifier,this.encryptedData=new s,Object.assign(this,e)}};e.EncryptedPrivateKeyInfo=n,t.__decorate([(0,i.AsnProp)({type:r.AlgorithmIdentifier})],n.prototype,"encryptionAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:s})],n.prototype,"encryptedData",void 0)}}),require_private_key_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pkcs8/build/cjs/private_key_info.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.PrivateKeyInfo=e.Attributes=e.PrivateKey=e.Version=void 0;var i,r,s=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),n=require_cjs(),a=require_cjs2();(r=i||(e.Version=i={}))[r.v1=0]="v1";var o=class extends n.OctetString{};e.PrivateKey=o;var c=t=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.Attributes=c,e.Attributes=c=t=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence,itemType:a.Attribute})],c);var l=class{constructor(e={}){this.version=i.v1,this.privateKeyAlgorithm=new a.AlgorithmIdentifier,this.privateKey=new o,Object.assign(this,e)}};e.PrivateKeyInfo=l,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.Integer})],l.prototype,"version",void 0),s.__decorate([(0,n.AsnProp)({type:a.AlgorithmIdentifier})],l.prototype,"privateKeyAlgorithm",void 0),s.__decorate([(0,n.AsnProp)({type:o})],l.prototype,"privateKey",void 0),s.__decorate([(0,n.AsnProp)({type:c,implicit:!0,context:0,optional:!0})],l.prototype,"attributes",void 0)}}),require_cjs8=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pkcs8/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_encrypted_private_key_info(),e),t.__exportStar(require_private_key_info(),e)}}),require_key_bag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/key_bag.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyBag=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs8(),r=require_cjs(),s=class extends i.PrivateKeyInfo{};e.KeyBag=s,e.KeyBag=s=t.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence})],s)}}),require_pkcs8_shrouded_key_bag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/pkcs8_shrouded_key_bag.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PKCS8ShroudedKeyBag=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs8(),r=require_cjs(),s=class extends i.EncryptedPrivateKeyInfo{};e.PKCS8ShroudedKeyBag=s,e.PKCS8ShroudedKeyBag=s=t.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence})],s)}}),require_secret_bag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/secret_bag.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SecretBag=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=class{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}};e.SecretBag=r,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.ObjectIdentifier})],r.prototype,"secretTypeId",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Any,context:0})],r.prototype,"secretValue",void 0)}}),require_bags=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/bags/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_cert_bag(),e),t.__exportStar(require_crl_bag(),e),t.__exportStar(require_key_bag(),e),t.__exportStar(require_pkcs8_shrouded_key_bag(),e),t.__exportStar(require_secret_bag(),e),t.__exportStar(require_types5(),e)}}),require_mac_data=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/mac_data.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MacData=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs6(),r=require_cjs(),s=class{constructor(e={}){this.mac=new i.DigestInfo,this.macSalt=new r.OctetString,this.iterations=1,Object.assign(this,e)}};e.MacData=s,t.__decorate([(0,r.AsnProp)({type:i.DigestInfo})],s.prototype,"mac",void 0),t.__decorate([(0,r.AsnProp)({type:r.OctetString})],s.prototype,"macSalt",void 0),t.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Integer,defaultValue:1})],s.prototype,"iterations",void 0)}}),require_pfx=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/pfx.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PFX=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs4(),s=require_mac_data(),n=class{constructor(e={}){this.version=3,this.authSafe=new r.ContentInfo,this.macData=new s.MacData,Object.assign(this,e)}};e.PFX=n,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],n.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:r.ContentInfo})],n.prototype,"authSafe",void 0),t.__decorate([(0,i.AsnProp)({type:s.MacData,optional:!0})],n.prototype,"macData",void 0)}}),require_safe_bag=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/safe_bag.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeContents=e.SafeBag=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_attribute3(),n=class{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}};e.SafeBag=n,i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.ObjectIdentifier})],n.prototype,"bagId",void 0),i.__decorate([(0,r.AsnProp)({type:r.AsnPropTypes.Any,context:0})],n.prototype,"bagValue",void 0),i.__decorate([(0,r.AsnProp)({type:s.PKCS12Attribute,repeated:"set",optional:!0})],n.prototype,"bagAttributes",void 0);var a=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.SafeContents=a,e.SafeContents=a=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:n})],a)}}),require_cjs9=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pfx/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_attribute3(),e),t.__exportStar(require_authenticated_safe(),e),t.__exportStar(require_bags(),e),t.__exportStar(require_mac_data(),e),t.__exportStar(require_object_identifiers6(),e),t.__exportStar(require_pfx(),e),t.__exportStar(require_safe_bag(),e)}}),require_cjs10=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-pkcs9/build/cjs/index.js"(e){"use strict";var t,i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DateOfBirth=e.UnstructuredAddress=e.UnstructuredName=e.EmailAddress=e.EncryptedPrivateKeyInfo=e.UserPKCS12=e.Pkcs7PDU=e.PKCS9String=e.id_at_pseudonym=e.crlTypes=e.id_certTypes=e.id_smime=e.id_pkcs9_mr_signingTimeMatch=e.id_pkcs9_mr_caseIgnoreMatch=e.id_pkcs9_sx_signingTime=e.id_pkcs9_sx_pkcs9String=e.id_pkcs9_at_countryOfResidence=e.id_pkcs9_at_countryOfCitizenship=e.id_pkcs9_at_gender=e.id_pkcs9_at_placeOfBirth=e.id_pkcs9_at_dateOfBirth=e.id_ietf_at=e.id_pkcs9_at_pkcs7PDU=e.id_pkcs9_at_sequenceNumber=e.id_pkcs9_at_randomNonce=e.id_pkcs9_at_encryptedPrivateKeyInfo=e.id_pkcs9_at_pkcs15Token=e.id_pkcs9_at_userPKCS12=e.id_pkcs9_at_localKeyId=e.id_pkcs9_at_friendlyName=e.id_pkcs9_at_smimeCapabilities=e.id_pkcs9_at_extensionRequest=e.id_pkcs9_at_signingDescription=e.id_pkcs9_at_extendedCertificateAttributes=e.id_pkcs9_at_unstructuredAddress=e.id_pkcs9_at_challengePassword=e.id_pkcs9_at_counterSignature=e.id_pkcs9_at_signingTime=e.id_pkcs9_at_messageDigest=e.id_pkcs9_at_contentType=e.id_pkcs9_at_unstructuredName=e.id_pkcs9_at_emailAddress=e.id_pkcs9_oc_naturalPerson=e.id_pkcs9_oc_pkcsEntity=e.id_pkcs9_mr=e.id_pkcs9_sx=e.id_pkcs9_at=e.id_pkcs9_oc=e.id_pkcs9_mo=e.id_pkcs9=void 0,e.SMIMECapabilities=e.SMIMECapability=e.SigningDescription=e.LocalKeyId=e.FriendlyName=e.ExtendedCertificateAttributes=e.ExtensionRequest=e.ChallengePassword=e.CounterSignature=e.SequenceNumber=e.RandomNonce=e.SigningTime=e.MessageDigest=e.ContentType=e.Pseudonym=e.CountryOfResidence=e.CountryOfCitizenship=e.Gender=e.PlaceOfBirth=void 0;var s=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),n=require_cjs(),a=require_cjs4(),o=require_cjs9(),c=require_cjs8(),l=require_cjs2(),u=require_cjs3();e.id_pkcs9="1.2.840.113549.1.9",e.id_pkcs9_mo=`${e.id_pkcs9}.0`,e.id_pkcs9_oc=`${e.id_pkcs9}.24`,e.id_pkcs9_at=`${e.id_pkcs9}.25`,e.id_pkcs9_sx=`${e.id_pkcs9}.26`,e.id_pkcs9_mr=`${e.id_pkcs9}.27`,e.id_pkcs9_oc_pkcsEntity=`${e.id_pkcs9_oc}.1`,e.id_pkcs9_oc_naturalPerson=`${e.id_pkcs9_oc}.2`,e.id_pkcs9_at_emailAddress=`${e.id_pkcs9}.1`,e.id_pkcs9_at_unstructuredName=`${e.id_pkcs9}.2`,e.id_pkcs9_at_contentType=`${e.id_pkcs9}.3`,e.id_pkcs9_at_messageDigest=`${e.id_pkcs9}.4`,e.id_pkcs9_at_signingTime=`${e.id_pkcs9}.5`,e.id_pkcs9_at_counterSignature=`${e.id_pkcs9}.6`,e.id_pkcs9_at_challengePassword=`${e.id_pkcs9}.7`,e.id_pkcs9_at_unstructuredAddress=`${e.id_pkcs9}.8`,e.id_pkcs9_at_extendedCertificateAttributes=`${e.id_pkcs9}.9`,e.id_pkcs9_at_signingDescription=`${e.id_pkcs9}.13`,e.id_pkcs9_at_extensionRequest=`${e.id_pkcs9}.14`,e.id_pkcs9_at_smimeCapabilities=`${e.id_pkcs9}.15`,e.id_pkcs9_at_friendlyName=`${e.id_pkcs9}.20`,e.id_pkcs9_at_localKeyId=`${e.id_pkcs9}.21`,e.id_pkcs9_at_userPKCS12="2.16.840.1.113730.3.1.216",e.id_pkcs9_at_pkcs15Token=`${e.id_pkcs9_at}.1`,e.id_pkcs9_at_encryptedPrivateKeyInfo=`${e.id_pkcs9_at}.2`,e.id_pkcs9_at_randomNonce=`${e.id_pkcs9_at}.3`,e.id_pkcs9_at_sequenceNumber=`${e.id_pkcs9_at}.4`,e.id_pkcs9_at_pkcs7PDU=`${e.id_pkcs9_at}.5`,e.id_ietf_at="1.3.6.1.5.5.7.9",e.id_pkcs9_at_dateOfBirth=`${e.id_ietf_at}.1`,e.id_pkcs9_at_placeOfBirth=`${e.id_ietf_at}.2`,e.id_pkcs9_at_gender=`${e.id_ietf_at}.3`,e.id_pkcs9_at_countryOfCitizenship=`${e.id_ietf_at}.4`,e.id_pkcs9_at_countryOfResidence=`${e.id_ietf_at}.5`,e.id_pkcs9_sx_pkcs9String=`${e.id_pkcs9_sx}.1`,e.id_pkcs9_sx_signingTime=`${e.id_pkcs9_sx}.2`,e.id_pkcs9_mr_caseIgnoreMatch=`${e.id_pkcs9_mr}.1`,e.id_pkcs9_mr_signingTimeMatch=`${e.id_pkcs9_mr}.2`,e.id_smime=`${e.id_pkcs9}.16`,e.id_certTypes=`${e.id_pkcs9}.22`,e.crlTypes=`${e.id_pkcs9}.23`,e.id_at_pseudonym=`${u.id_at}.65`;var d=class extends l.DirectoryString{constructor(e={}){super(e)}toString(){return{}.toString(),this.ia5String||super.toString()}};e.PKCS9String=d,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.IA5String})],d.prototype,"ia5String",void 0),e.PKCS9String=d=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],d);var p=class extends a.ContentInfo{};e.Pkcs7PDU=p,e.Pkcs7PDU=p=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],p);var h=class extends o.PFX{};e.UserPKCS12=h,e.UserPKCS12=h=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],h);var m=class extends c.EncryptedPrivateKeyInfo{};e.EncryptedPrivateKeyInfo=m,e.EncryptedPrivateKeyInfo=m=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],m);var f=class{constructor(e=""){this.value=e}toString(){return this.value}};e.EmailAddress=f,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.IA5String})],f.prototype,"value",void 0),e.EmailAddress=f=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],f);var g=class extends d{};e.UnstructuredName=g,e.UnstructuredName=g=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],g);var _=class extends l.DirectoryString{};e.UnstructuredAddress=_,e.UnstructuredAddress=_=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],_);var y=class{constructor(e=new Date){this.value=e}};e.DateOfBirth=y,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.GeneralizedTime})],y.prototype,"value",void 0),e.DateOfBirth=y=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],y);var b=class extends l.DirectoryString{};e.PlaceOfBirth=b,e.PlaceOfBirth=b=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],b);var v=class{constructor(e="M"){this.value=e}toString(){return this.value}};e.Gender=v,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.PrintableString})],v.prototype,"value",void 0),e.Gender=v=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],v);var x=class{constructor(e=""){this.value=e}toString(){return this.value}};e.CountryOfCitizenship=x,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.PrintableString})],x.prototype,"value",void 0),e.CountryOfCitizenship=x=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],x);var S=class extends x{};e.CountryOfResidence=S,e.CountryOfResidence=S=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],S);var w=class extends l.DirectoryString{};e.Pseudonym=w,e.Pseudonym=w=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],w);var E=class{constructor(e=""){this.value=e}toString(){return this.value}};e.ContentType=E,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.ObjectIdentifier})],E.prototype,"value",void 0),e.ContentType=E=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],E);var C=class extends n.OctetString{};e.MessageDigest=C;var A=class extends l.Time{};e.SigningTime=A,e.SigningTime=A=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],A);var T=class extends n.OctetString{};e.RandomNonce=T;var P=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};e.SequenceNumber=P,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.Integer})],P.prototype,"value",void 0),e.SequenceNumber=P=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],P);var I=class extends a.SignerInfo{};e.CounterSignature=I,e.CounterSignature=I=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],I);var k=class extends l.DirectoryString{};e.ChallengePassword=k,e.ChallengePassword=k=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],k);var R=t=class extends l.Extensions{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.ExtensionRequest=R,e.ExtensionRequest=R=t=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],R);var F=i=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,i.prototype)}};e.ExtendedCertificateAttributes=F,e.ExtendedCertificateAttributes=F=i=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Set,itemType:a.Attribute})],F);var B=class{constructor(e=""){this.value=e}toString(){return this.value}};e.FriendlyName=B,s.__decorate([(0,n.AsnProp)({type:n.AsnPropTypes.BmpString})],B.prototype,"value",void 0),e.FriendlyName=B=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Choice})],B);var O=class extends n.OctetString{};e.LocalKeyId=O;var N=class extends l.DirectoryString{};e.SigningDescription=N;var D=class extends l.AlgorithmIdentifier{};e.SMIMECapability=D,e.SMIMECapability=D=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence})],D);var j=r=class extends n.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,r.prototype)}};e.SMIMECapabilities=j,e.SMIMECapabilities=j=r=s.__decorate([(0,n.AsnType)({type:n.AsnTypeTypes.Sequence,itemType:D})],j)}}),require_attributes2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-csr/build/cjs/attributes.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Attributes=void 0;var i=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),r=require_cjs(),s=require_cjs2(),n=t=class extends r.AsnArray{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};e.Attributes=n,e.Attributes=n=t=i.__decorate([(0,r.AsnType)({type:r.AsnTypeTypes.Sequence,itemType:s.Attribute})],n)}}),require_certification_request_info=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-csr/build/cjs/certification_request_info.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CertificationRequestInfo=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_cjs2(),s=require_attributes2(),n=class{constructor(e={}){this.version=0,this.subject=new r.Name,this.subjectPKInfo=new r.SubjectPublicKeyInfo,this.attributes=new s.Attributes,Object.assign(this,e)}};e.CertificationRequestInfo=n,t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.Integer})],n.prototype,"version",void 0),t.__decorate([(0,i.AsnProp)({type:r.Name})],n.prototype,"subject",void 0),t.__decorate([(0,i.AsnProp)({type:r.SubjectPublicKeyInfo})],n.prototype,"subjectPKInfo",void 0),t.__decorate([(0,i.AsnProp)({type:s.Attributes,implicit:!0,context:0})],n.prototype,"attributes",void 0)}}),require_certification_request=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-csr/build/cjs/certification_request.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CertificationRequest=void 0;var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),i=require_cjs(),r=require_certification_request_info(),s=require_cjs2(),n=class{constructor(e={}){this.certificationRequestInfo=new r.CertificationRequestInfo,this.signatureAlgorithm=new s.AlgorithmIdentifier,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};e.CertificationRequest=n,t.__decorate([(0,i.AsnProp)({type:r.CertificationRequestInfo})],n.prototype,"certificationRequestInfo",void 0),t.__decorate([(0,i.AsnProp)({type:s.AlgorithmIdentifier})],n.prototype,"signatureAlgorithm",void 0),t.__decorate([(0,i.AsnProp)({type:i.AsnPropTypes.BitString})],n.prototype,"signature",void 0)}}),require_cjs11=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/asn1-csr/build/cjs/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=(init_tslib_es6(),__toCommonJS(tslib_es6_exports));t.__exportStar(require_attributes2(),e),t.__exportStar(require_certification_request(),e),t.__exportStar(require_certification_request_info(),e)}}),require_x509_cjs=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@peculiar/x509/build/x509.cjs.js"(e){"use strict";require_Reflect();var t=require_cjs(),i=require_cjs2(),r=require_build3(),s=require_cjs4(),n=require_cjs5(),a=require_cjs6(),o=(init_tslib_es6(),__toCommonJS(tslib_es6_exports)),c=require_cjs7(),l=require_cjs10(),u=require_cjs11();function d(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var p,h=d(i),m=d(s),f=d(n),g=d(a),_=d(l),y="crypto.algorithm",b=class{getAlgorithms(){return c.container.resolveAll(y)}toAsnAlgorithm(e){for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new i.AlgorithmIdentifier({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const t of this.getAlgorithms()){const i=t.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}},v="crypto.algorithmProvider";c.container.registerSingleton(v,b);var x="1.3.36.3.3.2.8.1.1",S=`${x}.1`,w=`${x}.2`,E=`${x}.3`,C=`${x}.4`,A=`${x}.5`,T=`${x}.6`,P=`${x}.7`,I=`${x}.8`,k=`${x}.9`,R=`${x}.10`,F=`${x}.11`,B=`${x}.12`,O=`${x}.13`,N=`${x}.14`,D="brainpoolP160r1",j="brainpoolP160t1",L="brainpoolP192r1",U="brainpoolP192t1",M="brainpoolP224r1",q="brainpoolP224t1",H="brainpoolP256r1",z="brainpoolP256t1",V="brainpoolP320r1",K="brainpoolP320t1",G="brainpoolP384r1",W="brainpoolP384t1",J="brainpoolP512r1",$="brainpoolP512t1",Z="ECDSA";e.EcAlgorithm=p=class{toAsnAlgorithm(e){if(e.name.toLowerCase()===Z.toLowerCase())if("hash"in e){switch(("string"==typeof e.hash?e.hash:e.hash.name).toLowerCase()){case"sha-1":return f.ecdsaWithSHA1;case"sha-256":return f.ecdsaWithSHA256;case"sha-384":return f.ecdsaWithSHA384;case"sha-512":return f.ecdsaWithSHA512}}else if("namedCurve"in e){let r="";switch(e.namedCurve){case"P-256":r=f.id_secp256r1;break;case"K-256":r=p.SECP256K1;break;case"P-384":r=f.id_secp384r1;break;case"P-521":r=f.id_secp521r1;break;case D:r=S;break;case j:r=w;break;case L:r=E;break;case U:r=C;break;case M:r=A;break;case q:r=T;break;case H:r=P;break;case z:r=I;break;case V:r=k;break;case K:r=R;break;case G:r=F;break;case W:r=B;break;case J:r=O;break;case $:r=N}if(r)return new i.AlgorithmIdentifier({algorithm:f.id_ecPublicKey,parameters:t.AsnConvert.serialize(new f.ECParameters({namedCurve:r}))})}return null}toWebAlgorithm(e){switch(e.algorithm){case f.id_ecdsaWithSHA1:return{name:Z,hash:{name:"SHA-1"}};case f.id_ecdsaWithSHA256:return{name:Z,hash:{name:"SHA-256"}};case f.id_ecdsaWithSHA384:return{name:Z,hash:{name:"SHA-384"}};case f.id_ecdsaWithSHA512:return{name:Z,hash:{name:"SHA-512"}};case f.id_ecPublicKey:if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(t.AsnConvert.parse(e.parameters,f.ECParameters).namedCurve){case f.id_secp256r1:return{name:Z,namedCurve:"P-256"};case p.SECP256K1:return{name:Z,namedCurve:"K-256"};case f.id_secp384r1:return{name:Z,namedCurve:"P-384"};case f.id_secp521r1:return{name:Z,namedCurve:"P-521"};case S:return{name:Z,namedCurve:D};case w:return{name:Z,namedCurve:j};case E:return{name:Z,namedCurve:L};case C:return{name:Z,namedCurve:U};case A:return{name:Z,namedCurve:M};case T:return{name:Z,namedCurve:q};case P:return{name:Z,namedCurve:H};case I:return{name:Z,namedCurve:z};case k:return{name:Z,namedCurve:V};case R:return{name:Z,namedCurve:K};case F:return{name:Z,namedCurve:G};case B:return{name:Z,namedCurve:W};case O:return{name:Z,namedCurve:J};case N:return{name:Z,namedCurve:$}}}return null}},e.EcAlgorithm.SECP256K1="1.3.132.0.10",e.EcAlgorithm=p=o.__decorate([c.injectable()],e.EcAlgorithm),c.container.registerSingleton(y,e.EcAlgorithm);var Y=Symbol("name"),X=Symbol("value"),Q=class{constructor(e,t={},i=""){this[Y]=e,this[X]=i;for(const e in t)this[e]=t[e]}};Q.NAME=Y,Q.VALUE=X;var ee=class{static toTextObject(t){const i=new Q("Algorithm Identifier",{},te.toString(t.algorithm));if(t.parameters)switch(t.algorithm){case f.id_ecPublicKey:{const r=(new e.EcAlgorithm).toWebAlgorithm(t);r&&"namedCurve"in r?i["Named Curve"]=r.namedCurve:i.Parameters=t.parameters;break}default:i.Parameters=t.parameters}return i}},te=class{static toString(e){const t=this.items[e];return t||e}};te.items={[g.id_sha1]:"sha1",[g.id_sha224]:"sha224",[g.id_sha256]:"sha256",[g.id_sha384]:"sha384",[g.id_sha512]:"sha512",[g.id_rsaEncryption]:"rsaEncryption",[g.id_sha1WithRSAEncryption]:"sha1WithRSAEncryption",[g.id_sha224WithRSAEncryption]:"sha224WithRSAEncryption",[g.id_sha256WithRSAEncryption]:"sha256WithRSAEncryption",[g.id_sha384WithRSAEncryption]:"sha384WithRSAEncryption",[g.id_sha512WithRSAEncryption]:"sha512WithRSAEncryption",[f.id_ecPublicKey]:"ecPublicKey",[f.id_ecdsaWithSHA1]:"ecdsaWithSHA1",[f.id_ecdsaWithSHA224]:"ecdsaWithSHA224",[f.id_ecdsaWithSHA256]:"ecdsaWithSHA256",[f.id_ecdsaWithSHA384]:"ecdsaWithSHA384",[f.id_ecdsaWithSHA512]:"ecdsaWithSHA512",[h.id_kp_serverAuth]:"TLS WWW server authentication",[h.id_kp_clientAuth]:"TLS WWW client authentication",[h.id_kp_codeSigning]:"Code Signing",[h.id_kp_emailProtection]:"E-mail Protection",[h.id_kp_timeStamping]:"Time Stamping",[h.id_kp_OCSPSigning]:"OCSP Signing",[m.id_signedData]:"Signed Data"};var ie=class{static serialize(e){return this.serializeObj(e).join("\n")}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let s=this.pad(t++),n="";const a=e[Q.VALUE];a&&(n=` ${a}`),i.push(`${s}${e[Q.NAME]}:${n}`),s=this.pad(t);for(const n in e){if("symbol"==typeof n)continue;const a=e[n],o=n?`${n}: `:"";if("string"==typeof a||"number"==typeof a||"boolean"==typeof a)i.push(`${s}${o}${a}`);else if(a instanceof Date)i.push(`${s}${o}${a.toUTCString()}`);else if(Array.isArray(a))for(const e of a)e[Q.NAME]=n,i.push(...this.serializeObj(e,t));else if(a instanceof Q)a[Q.NAME]=n,i.push(...this.serializeObj(a,t));else if(r.BufferSourceConverter.isBufferSource(a))n?(i.push(`${s}${o}`),i.push(...this.serializeBufferSource(a,t+1))):i.push(...this.serializeBufferSource(a,t));else{if(!("toTextObject"in a))throw new TypeError("Cannot serialize data in text format. Unsupported type.");{const e=a.toTextObject();e[Q.NAME]=n,i.push(...this.serializeObj(e,t))}}}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),s=r.BufferSourceConverter.toUint8Array(e),n=[];for(let e=0;e<s.length;){const t=[];for(let i=0;i<16&&e<s.length;i++){8===i&&t.push("");const r=s[e++].toString(16).padStart(2,"0");t.push(r)}n.push(`${i}${t.join(" ")}`)}return n}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}};ie.oidSerializer=te,ie.algorithmSerializer=ee;var re=class e{constructor(...e){if(1===e.length){const i=e[0];this.rawData=t.AsnConvert.serialize(i),this.onInit(i)}else{const i=t.AsnConvert.parse(e[0],e[1]);this.rawData=r.BufferSourceConverter.toArrayBuffer(e[0]),this.onInit(i)}}equal(t){return t instanceof e&&r.isEqual(t.rawData,this.rawData)}toString(e="text"){switch(e){case"asn":return t.AsnConvert.toString(this.rawData);case"text":return ie.serialize(this.toTextObject());case"hex":return r.Convert.ToHex(this.rawData);case"base64":return r.Convert.ToBase64(this.rawData);case"base64url":return r.Convert.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new Q(this.getTextName(),{},e)}};re.NAME="ASN";var se,ne=class e extends re{constructor(...e){let s;s=r.BufferSourceConverter.isBufferSource(e[0])?r.BufferSourceConverter.toArrayBuffer(e[0]):t.AsnConvert.serialize(new i.Extension({extnID:e[0],critical:e[1],extnValue:new t.OctetString(r.BufferSourceConverter.toArrayBuffer(e[2]))})),super(s,i.Extension)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty(this.critical?"critical":void 0);return t[Q.NAME]===e.NAME&&(t[Q.NAME]=te.toString(this.type)),t}},ae=class e{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&void 0!==e.extractable}constructor(){this.items=new Map,this[se]="CryptoProvider","undefined"!=typeof self&&"undefined"!=typeof crypto?this.set(e.DEFAULT,crypto):"undefined"!=typeof global&&global.crypto&&global.crypto.subtle&&this.set(e.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(t=e.DEFAULT){const i=this.items.get(t.toLowerCase());if(!i)throw new Error(`Cannot get Crypto by name '${t}'`);return i}set(t,i){if("string"==typeof t){if(!i)throw new TypeError("Argument 'value' is required");this.items.set(t.toLowerCase(),i)}else this.items.set(e.DEFAULT,t);return this}};se=Symbol.toStringTag,ae.DEFAULT="default";var oe=new ae,ce=/^[0-2](?:\.[1-9][0-9]*)+$/;var le=class{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return t=e,new RegExp(ce).test(t)?e:this.get(e);var t}register(e,t){this.items[e]=t,this.items[t]=e}},ue=new le;function de(e,t){return`\\${r.Convert.ToHex(r.Convert.FromUtf8String(t)).toUpperCase()}`}ue.register("CN","2.5.4.3"),ue.register("L","2.5.4.7"),ue.register("ST","2.5.4.8"),ue.register("O","2.5.4.10"),ue.register("OU","2.5.4.11"),ue.register("C","2.5.4.6"),ue.register("DC","0.9.2342.19200300.100.1.25"),ue.register("E","1.2.840.113549.1.9.1"),ue.register("G","2.5.4.42"),ue.register("I","2.5.4.43"),ue.register("SN","2.5.4.4"),ue.register("T","2.5.4.12");var pe=class e{static isASCII(e){for(let t=0;t<e.length;t++){if(e.charCodeAt(t)>255)return!1}return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,s={}){this.extraNames=new le,this.asn=new i.Name;for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];this.extraNames.register(e,t)}"string"==typeof e?this.asn=this.fromString(e):e instanceof i.Name?this.asn=e:r.BufferSourceConverter.isBufferSource(e)?this.asn=t.AsnConvert.parse(e,i.Name):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||ue.findId(e),i=[];for(const e of this.asn)for(const r of e)r.type===t&&i.push(r.value.toString());return i}getName(e){return this.extraNames.get(e)||ue.get(e)}toString(){return this.asn.map((e=>e.map((e=>`${this.getName(e.type)||e.type}=${e.value.anyValue?`#${r.Convert.ToHex(e.value.anyValue)}`:e.value.toString().replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,de)}`)).join("+"))).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const s={};for(const t of i){const i=this.getName(t.type)||t.type;null!==(e=s[i])&&void 0!==e||(s[i]=[]),s[i].push(t.value.anyValue?`#${r.Convert.ToHex(t.value.anyValue)}`:t.value.toString())}t.push(s)}return t}fromString(e){const t=new i.Name,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let s=null,n=",";for(;s=r.exec(`${e},`);){let[,e,r]=s;const a=r[r.length-1];","!==a&&"+"!==a||(r=r.slice(0,r.length-1),s[3]=a);const o=s[3];e=this.getTypeOid(e);const c=this.createAttribute(e,r);"+"===n?t[t.length-1].push(c):t.push(new i.RelativeDistinguishedName([c])),n=o}return t}fromJSON(e){const t=new i.Name;for(const r of e){const e=new i.RelativeDistinguishedName;for(const t in r){const i=this.getTypeOid(t),s=r[t];for(const t of s){const r=this.createAttribute(i,t);e.push(r)}}t.push(e)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(t,s){const n=new i.AttributeTypeAndValue({type:t});if("object"==typeof s)for(const e in s)switch(e){case"ia5String":n.value.ia5String=s[e];break;case"utf8String":n.value.utf8String=s[e];break;case"universalString":n.value.universalString=s[e];break;case"bmpString":n.value.bmpString=s[e];break;case"printableString":n.value.printableString=s[e]}else if("#"===s[0])n.value.anyValue=r.Convert.FromHex(s.slice(1));else{const i=this.processStringValue(s);t===this.getName("E")||t===this.getName("DC")?n.value.ia5String=i:e.isPrintableString(i)?n.value.printableString=i:n.value.utf8String=i}return n}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/gi,"\n").replace(/\\0d/gi,"\r").replace(/\\0g/gi,"\t").replace(/\\(.)/g,"$1")}toArrayBuffer(){return t.AsnConvert.serialize(this.asn)}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(null===(t=e[0])||void 0===t?void 0:t.subtle)?(r=e[0]||r,i=e[1]||oe.get()):i=e[0]||oe.get(),await i.subtle.digest(r,this.toArrayBuffer())}},he="Cannot initialize GeneralName from ASN.1 data.",me=`${he} Unsupported string format in use.`,fe=`${he} Value doesn't match to GUID regular expression.`,ge=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,_e="1.3.6.1.4.1.311.25.1",ye="1.3.6.1.4.1.311.20.2.3",be="dns",ve="dn",xe="email",Se="ip",we="url",Ee="guid",Ce="upn",Ae="id",Te=class extends re{constructor(...e){let i;if(2===e.length)switch(e[0]){case ve:{const r=new pe(e[1]).toArrayBuffer(),s=t.AsnConvert.parse(r,h.Name);i=new h.GeneralName({directoryName:s});break}case be:i=new h.GeneralName({dNSName:e[1]});break;case xe:i=new h.GeneralName({rfc822Name:e[1]});break;case Ee:{const s=new RegExp(ge,"i").exec(e[1]);if(!s)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const n=s.slice(1).map(((e,t)=>t<3?r.Convert.ToHex(new Uint8Array(r.Convert.FromHex(e)).reverse()):e)).join("");i=new h.GeneralName({otherName:new h.OtherName({typeId:_e,value:t.AsnConvert.serialize(new t.OctetString(r.Convert.FromHex(n)))})});break}case Se:i=new h.GeneralName({iPAddress:e[1]});break;case Ae:i=new h.GeneralName({registeredID:e[1]});break;case Ce:i=new h.GeneralName({otherName:new h.OtherName({typeId:ye,value:t.AsnConvert.serialize(t.AsnUtf8StringConverter.toASN(e[1]))})});break;case we:i=new h.GeneralName({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else i=r.BufferSourceConverter.isBufferSource(e[0])?t.AsnConvert.parse(e[0],h.GeneralName):e[0];super(i)}onInit(e){if(null!=e.dNSName)this.type=be,this.value=e.dNSName;else if(null!=e.rfc822Name)this.type=xe,this.value=e.rfc822Name;else if(null!=e.iPAddress)this.type=Se,this.value=e.iPAddress;else if(null!=e.uniformResourceIdentifier)this.type=we,this.value=e.uniformResourceIdentifier;else if(null!=e.registeredID)this.type=Ae,this.value=e.registeredID;else if(null!=e.directoryName)this.type=ve,this.value=new pe(e.directoryName).toString();else{if(null==e.otherName)throw new Error(me);if(e.otherName.typeId===_e){this.type=Ee;const i=t.AsnConvert.parse(e.otherName.value,t.OctetString),s=new RegExp(ge,"i").exec(r.Convert.ToHex(i));if(!s)throw new Error(fe);this.value=s.slice(1).map(((e,t)=>t<3?r.Convert.ToHex(new Uint8Array(r.Convert.FromHex(e)).reverse()):e)).join("-")}else{if(e.otherName.typeId!==ye)throw new Error(me);this.type=Ce,this.value=t.AsnConvert.parse(e.otherName.value,h.DirectoryString).toString()}}}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case ve:case be:case Ee:case Se:case Ae:case Ce:case we:e=this.type.toUpperCase();break;case xe:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Ae&&(t=te.toString(t)),new Q(e,void 0,t)}},Pe=class extends re{constructor(e){let i;if(e instanceof h.GeneralNames)i=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof h.GeneralName)r.push(i);else{const e=t.AsnConvert.parse(new Te(i.type,i.value).rawData,h.GeneralName);r.push(e)}i=new h.GeneralNames(r)}else{if(!r.BufferSourceConverter.isBufferSource(e))throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");i=t.AsnConvert.parse(e,h.GeneralNames)}super(i)}onInit(e){const t=[];for(const i of e){let e=null;try{e=new Te(i)}catch{continue}t.push(e)}this.items=t}toJSON(){return this.items.map((e=>e.toJSON()))}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let r=e[i[Q.NAME]];Array.isArray(r)||(r=[],e[i[Q.NAME]]=r),r.push(i)}return e}};Pe.NAME="GeneralNames";var Ie="-{5}",ke="\\n",Re="\\n",Fe=`${`${Ie}BEGIN (${`[^${ke}]+`}(?=${Ie}))${Ie}`}${Re}(?:((?:${`[^:${ke}]+`}: ${`(?:[^${ke}]+${Re}(?: +[^${ke}]+${Re})*)`})+))?${Re}?(${`(?:[a-zA-Z0-9=+/]+${Re})+`})${`${Ie}END \\1${Ie}`}`,Be=class{static isPem(e){return"string"==typeof e&&new RegExp(Fe,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Fe,"g"),i=[];let s=null;for(;s=t.exec(e);){const e=s[3].replace(new RegExp(`[${ke}]+`,"g"),""),t={type:s[1],headers:[],rawData:r.Convert.FromBase64(e)},n=s[2];if(n){const e=n.split(new RegExp(Re,"g"));let i=null;for(const r of e){const[e,s]=r.split(/:(.*)/);if(void 0===s){if(!i)throw new Error("Cannot parse PEM string. Incorrect header value");i.value+=e.trim()}else i&&t.headers.push(i),i={key:e,value:s.trim()}}i&&t.headers.push(i)}i.push(t)}return i}static decode(e){return this.decodeWithHeaders(e).map((e=>e.rawData))}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach((e=>{if(!r.BufferSourceConverter.isBufferSource(e))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:r.BufferSourceConverter.toArrayBuffer(e)}))})):e.forEach((e=>{if(!("type"in e))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(e))})),i.join("\n")}if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:r.BufferSourceConverter.toArrayBuffer(e)})}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),s=[];if(s.push(`-----BEGIN ${i}-----`),null===(t=e.headers)||void 0===t?void 0:t.length){for(const t of e.headers)s.push(`${t.key}: ${t.value}`);s.push("")}const n=r.Convert.ToBase64(e.rawData);let a,o=0;const c=Array();for(;o<n.length&&(n.length-o<64?a=n.substring(o):(a=n.substring(o,o+64),o+=64),0!==a.length)&&(c.push(a),!(a.length<64)););return s.push(...c),s.push(`-----END ${i}-----`),s.join("\n")}};Be.CertificateTag="CERTIFICATE",Be.CrlTag="CRL",Be.CertificateRequestTag="CERTIFICATE REQUEST",Be.PublicKeyTag="PUBLIC KEY",Be.PrivateKeyTag="PRIVATE KEY";var Oe=class e extends re{static isAsnEncoded(e){return r.BufferSourceConverter.isBufferSource(e)||"string"==typeof e}static toArrayBuffer(e){if("string"==typeof e){if(Be.isPem(e))return Be.decode(e)[0];if(r.Convert.isHex(e))return r.Convert.FromHex(e);if(r.Convert.isBase64(e))return r.Convert.FromBase64(e);if(r.Convert.isBase64Url(e))return r.Convert.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}{const t=r.Convert.ToBinary(e);return Be.isPem(t)?Be.decode(t)[0]:r.Convert.isHex(t)?r.Convert.FromHex(t):r.Convert.isBase64(t)?r.Convert.FromBase64(t):r.Convert.isBase64Url(t)?r.Convert.FromBase64Url(t):r.BufferSourceConverter.toArrayBuffer(e)}}constructor(...t){e.isAsnEncoded(t[0])?super(e.toArrayBuffer(t[0]),t[1]):super(t[0])}toString(e="pem"){return"pem"===e?Be.encode(this.rawData,this.tag):super.toString(e)}},Ne=class e extends Oe{static async create(t,i=oe.get()){if(t instanceof e)return t;if(ae.isCryptoKey(t)){if("public"!==t.type)throw new TypeError("Public key is required");const r=await i.subtle.exportKey("spki",t);return new e(r)}if(t.publicKey)return t.publicKey;if(r.BufferSourceConverter.isBufferSource(t))return new e(t);throw new TypeError("Unsupported PublicKeyType")}constructor(e){Oe.isAsnEncoded(e)?super(e,i.SubjectPublicKeyInfo):super(e),this.tag=Be.PublicKeyTag}async export(...e){let r,s=["verify"],n={hash:"SHA-256",...this.algorithm};e.length>1?(n=e[0]||n,s=e[1]||s,r=e[2]||oe.get()):r=e[0]||oe.get();let o=this.rawData;const c=t.AsnConvert.parse(this.rawData,i.SubjectPublicKeyInfo);return c.algorithm.algorithm===a.id_RSASSA_PSS&&(o=function(e,r){return e.algorithm=new i.AlgorithmIdentifier({algorithm:a.id_rsaEncryption,parameters:null}),r=t.AsnConvert.serialize(e),r}(c,o)),r.subtle.importKey("spki",o,n,!0,s)}onInit(e){const i=c.container.resolve(v),s=this.algorithm=i.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case a.id_rsaEncryption:{const i=t.AsnConvert.parse(e.subjectPublicKey,a.RSAPublicKey),n=r.BufferSourceConverter.toUint8Array(i.modulus);s.publicExponent=r.BufferSourceConverter.toUint8Array(i.publicExponent),s.modulusLength=(n[0]?n:n.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(null===(t=e[0])||void 0===t?void 0:t.subtle)?(r=e[0]||r,i=e[1]||oe.get()):i=e[0]||oe.get(),await i.subtle.digest(r,this.rawData)}async getKeyIdentifier(...e){let r,s="SHA-1";1===e.length?"string"==typeof e[0]?(s=e[0],r=oe.get()):r=e[0]:2===e.length?(s=e[0],r=e[1]):r=oe.get();const n=t.AsnConvert.parse(this.rawData,i.SubjectPublicKeyInfo);return await r.subtle.digest(s,n.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),r=t.AsnConvert.parse(this.rawData,i.SubjectPublicKeyInfo);switch(e.Algorithm=ie.serializeAlgorithm(r.algorithm),r.algorithm.algorithm){case n.id_ecPublicKey:e["EC Point"]=r.subjectPublicKey;break;case a.id_rsaEncryption:default:e["Raw Data"]=r.subjectPublicKey}return e}};var De=class e extends ne{static async create(t,i=!1,s=oe.get()){if("name"in t&&"serialNumber"in t)return new e(t,i);const n=await Ne.create(t,s),a=await n.getKeyIdentifier(s);return new e(r.Convert.ToHex(a),i)}constructor(...e){if(r.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if("string"==typeof e[0]){const i=new h.AuthorityKeyIdentifier({keyIdentifier:new h.KeyIdentifier(r.Convert.FromHex(e[0]))});super(h.id_ce_authorityKeyIdentifier,e[1],t.AsnConvert.serialize(i))}else{const i=e[0],s=i.name instanceof Pe?t.AsnConvert.parse(i.name.rawData,h.GeneralNames):i.name,n=new h.AuthorityKeyIdentifier({authorityCertIssuer:s,authorityCertSerialNumber:r.Convert.FromHex(i.serialNumber)});super(h.id_ce_authorityKeyIdentifier,e[1],t.AsnConvert.serialize(n))}}onInit(e){super.onInit(e);const i=t.AsnConvert.parse(e.extnValue,h.AuthorityKeyIdentifier);i.keyIdentifier&&(this.keyId=r.Convert.ToHex(i.keyIdentifier)),(i.authorityCertIssuer||i.authorityCertSerialNumber)&&(this.certId={name:i.authorityCertIssuer||[],serialNumber:i.authorityCertSerialNumber?r.Convert.ToHex(i.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),i=t.AsnConvert.parse(this.value,h.AuthorityKeyIdentifier);return i.authorityCertIssuer&&(e["Authority Issuer"]=new Pe(i.authorityCertIssuer).toTextObject()),i.authorityCertSerialNumber&&(e["Authority Serial Number"]=i.authorityCertSerialNumber),i.keyIdentifier&&(e[""]=i.keyIdentifier),e}};De.NAME="Authority Key Identifier";var je,Le=class extends ne{constructor(...e){if(r.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const r=t.AsnConvert.parse(this.value,i.BasicConstraints);this.ca=r.cA,this.pathLength=r.pathLenConstraint}else{const r=new i.BasicConstraints({cA:e[0],pathLenConstraint:e[1]});super(i.id_ce_basicConstraints,e[2],t.AsnConvert.serialize(r)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),void 0!==this.pathLength&&(e["Path Length"]=this.pathLength),e}};Le.NAME="Basic Constraints",e.ExtendedKeyUsage=void 0,(je=e.ExtendedKeyUsage||(e.ExtendedKeyUsage={})).serverAuth="1.3.6.1.5.5.7.3.1",je.clientAuth="1.3.6.1.5.5.7.3.2",je.codeSigning="1.3.6.1.5.5.7.3.3",je.emailProtection="1.3.6.1.5.5.7.3.4",je.timeStamping="1.3.6.1.5.5.7.3.8",je.ocspSigning="1.3.6.1.5.5.7.3.9";var Ue,Me=class extends ne{constructor(...e){if(r.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const i=t.AsnConvert.parse(this.value,h.ExtendedKeyUsage);this.usages=i.map((e=>e))}else{const i=new h.ExtendedKeyUsage(e[0]);super(h.id_ce_extKeyUsage,e[1],t.AsnConvert.serialize(i)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map((e=>te.toString(e))).join(", "),e}};Me.NAME="Extended Key Usages",e.KeyUsageFlags=void 0,(Ue=e.KeyUsageFlags||(e.KeyUsageFlags={}))[Ue.digitalSignature=1]="digitalSignature",Ue[Ue.nonRepudiation=2]="nonRepudiation",Ue[Ue.keyEncipherment=4]="keyEncipherment",Ue[Ue.dataEncipherment=8]="dataEncipherment",Ue[Ue.keyAgreement=16]="keyAgreement",Ue[Ue.keyCertSign=32]="keyCertSign",Ue[Ue.cRLSign=64]="cRLSign",Ue[Ue.encipherOnly=128]="encipherOnly",Ue[Ue.decipherOnly=256]="decipherOnly";var qe=class extends ne{constructor(...e){if(r.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const r=t.AsnConvert.parse(this.value,i.KeyUsage);this.usages=r.toNumber()}else{const r=new i.KeyUsage(e[0]);super(i.id_ce_keyUsage,e[1],t.AsnConvert.serialize(r)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),r=t.AsnConvert.parse(this.value,i.KeyUsage);return e[""]=r.toJSON().join(", "),e}};qe.NAME="Key Usages";var He=class e extends ne{static async create(t,i=!1,s=oe.get()){const n=await Ne.create(t,s),a=await n.getKeyIdentifier(s);return new e(r.Convert.ToHex(a),i)}constructor(...e){if(r.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const i=t.AsnConvert.parse(this.value,h.SubjectKeyIdentifier);this.keyId=r.Convert.ToHex(i)}else{const i="string"==typeof e[0]?r.Convert.FromHex(e[0]):e[0],s=new h.SubjectKeyIdentifier(i);super(h.id_ce_subjectKeyIdentifier,e[1],t.AsnConvert.serialize(s)),this.keyId=r.Convert.ToHex(i)}}toTextObject(){const e=this.toTextObjectWithoutValue(),i=t.AsnConvert.parse(this.value,h.SubjectKeyIdentifier);return e[""]=i,e}};He.NAME="Subject Key Identifier";var ze=class extends ne{constructor(...e){r.BufferSourceConverter.isBufferSource(e[0])?super(e[0]):super(h.id_ce_subjectAltName,e[1],new Pe(e[0]||[]).rawData)}onInit(e){super.onInit(e);const i=t.AsnConvert.parse(e.extnValue,h.SubjectAlternativeName);this.names=new Pe(i)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}};ze.NAME="Subject Alternative Name";var Ve=class{static register(e,t){this.items.set(e,t)}static create(e){const t=new ne(e),i=this.items.get(t.type);return i?new i(e):t}};Ve.items=new Map;var Ke=class extends ne{constructor(...e){var i;if(r.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);const i=t.AsnConvert.parse(this.value,h.CertificatePolicies);this.policies=i.map((e=>e.policyIdentifier))}else{const r=e[0],s=null!==(i=e[1])&&void 0!==i&&i,n=new h.CertificatePolicies(r.map((e=>new h.PolicyInformation({policyIdentifier:e}))));super(h.id_ce_certificatePolicies,s,t.AsnConvert.serialize(n)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map((e=>new Q("",{},te.toString(e)))),e}};Ke.NAME="Certificate Policies",Ve.register(h.id_ce_certificatePolicies,Ke);var Ge=class extends ne{constructor(...e){var i;if(r.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&"string"==typeof e[0][0]){const i=e[0].map((e=>new h.DistributionPoint({distributionPoint:new h.DistributionPointName({fullName:[new h.GeneralName({uniformResourceIdentifier:e})]})}))),r=new h.CRLDistributionPoints(i);super(h.id_ce_cRLDistributionPoints,e[1],t.AsnConvert.serialize(r))}else{const i=new h.CRLDistributionPoints(e[0]);super(h.id_ce_cRLDistributionPoints,e[1],t.AsnConvert.serialize(i))}null!==(i=this.distributionPoints)&&void 0!==i||(this.distributionPoints=[])}onInit(e){super.onInit(e);const i=t.AsnConvert.parse(e.extnValue,h.CRLDistributionPoints);this.distributionPoints=i}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map((e=>{var t;const i={};return e.distributionPoint&&(i[""]=null===(t=e.distributionPoint.fullName)||void 0===t?void 0:t.map((e=>new Te(e).toString())).join(", ")),e.reasons&&(i.Reasons=e.reasons.toString()),e.cRLIssuer&&(i["CRL Issuer"]=e.cRLIssuer.map((e=>e.toString())).join(", ")),i})),e}};Ge.NAME="CRL Distribution Points";var We=class extends ne{constructor(...e){var i,s,n,a;if(r.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof h.AuthorityInfoAccessSyntax){const i=new h.AuthorityInfoAccessSyntax(e[0]);super(h.id_pe_authorityInfoAccess,e[1],t.AsnConvert.serialize(i))}else{const i=e[0],r=new h.AuthorityInfoAccessSyntax;$e(r,i,h.id_ad_ocsp,"ocsp"),$e(r,i,h.id_ad_caIssuers,"caIssuers"),$e(r,i,h.id_ad_timeStamping,"timeStamping"),$e(r,i,h.id_ad_caRepository,"caRepository"),super(h.id_pe_authorityInfoAccess,e[1],t.AsnConvert.serialize(r))}null!==(i=this.ocsp)&&void 0!==i||(this.ocsp=[]),null!==(s=this.caIssuers)&&void 0!==s||(this.caIssuers=[]),null!==(n=this.timeStamping)&&void 0!==n||(this.timeStamping=[]),null!==(a=this.caRepository)&&void 0!==a||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[];t.AsnConvert.parse(e.extnValue,h.AuthorityInfoAccessSyntax).forEach((e=>{switch(e.accessMethod){case h.id_ad_ocsp:this.ocsp.push(new Te(e.accessLocation));break;case h.id_ad_caIssuers:this.caIssuers.push(new Te(e.accessLocation));break;case h.id_ad_timeStamping:this.timeStamping.push(new Te(e.accessLocation));break;case h.id_ad_caRepository:this.caRepository.push(new Te(e.accessLocation))}}))}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Je(e,"OCSP",this.ocsp),this.caIssuers.length&&Je(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Je(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Je(e,"CA Repository",this.caRepository),e}};function Je(e,t,i){if(1===i.length)e[t]=i[0].toTextObject();else{const r=new Q("");i.forEach(((e,t)=>{const i=e.toTextObject(),s=`${i[Q.NAME]} ${t+1}`;let n=r[s];Array.isArray(n)||(n=[],r[s]=n),n.push(i)})),e[t]=r}}function $e(e,i,r,s){const n=i[s];if(n){(Array.isArray(n)?n:[n]).forEach((i=>{"string"==typeof i&&(i=new Te("url",i)),e.push(new h.AccessDescription({accessMethod:r,accessLocation:t.AsnConvert.parse(i.rawData,h.GeneralName)}))}))}}We.NAME="Authority Info Access";var Ze=class e extends re{constructor(...e){let s;if(r.BufferSourceConverter.isBufferSource(e[0]))s=r.BufferSourceConverter.toArrayBuffer(e[0]);else{const n=e[0],a=Array.isArray(e[1])?e[1].map((e=>r.BufferSourceConverter.toArrayBuffer(e))):[];s=t.AsnConvert.serialize(new i.Attribute({type:n,values:a}))}super(s,i.Attribute)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map((e=>new Q("",{"":e}))),e}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty();return t[Q.NAME]===e.NAME&&(t[Q.NAME]=te.toString(this.type)),t}};Ze.NAME="Attribute";var Ye=class extends Ze{constructor(...e){var i;if(r.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else{const i=new _.ChallengePassword({printableString:e[0]});super(_.id_pkcs9_at_challengePassword,[t.AsnConvert.serialize(i)])}null!==(i=this.password)&&void 0!==i||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const e=t.AsnConvert.parse(this.values[0],_.ChallengePassword);this.password=e.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[Q.VALUE]=this.password,e}};Ye.NAME="Challenge Password";var Xe=class extends Ze{constructor(...e){var i;if(r.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else{const i=e[0],r=new h.Extensions;for(const e of i)r.push(t.AsnConvert.parse(e.rawData,h.Extension));super(_.id_pkcs9_at_extensionRequest,[t.AsnConvert.serialize(r)])}null!==(i=this.items)&&void 0!==i||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const e=t.AsnConvert.parse(this.values[0],h.Extensions);this.items=e.map((e=>Ve.create(t.AsnConvert.serialize(e))))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map((e=>e.toTextObject()));for(const i of t)e[i[Q.NAME]]=i;return e}};Xe.NAME="Extensions";var Qe=class{static register(e,t){this.items.set(e,t)}static create(e){const t=new Ze(e),i=this.items.get(t.type);return i?new i(e):t}};Qe.items=new Map;var et,tt="crypto.signatureFormatter",it=class{toAsnSignature(e,t){return r.BufferSourceConverter.toArrayBuffer(t)}toWebSignature(e,t){return r.BufferSourceConverter.toArrayBuffer(t)}};e.RsaAlgorithm=et=class{static createPssParams(e,r){const s=et.getHashAlgorithm(e);return s?new g.RsaSaPssParams({hashAlgorithm:s,maskGenAlgorithm:new i.AlgorithmIdentifier({algorithm:g.id_mgf1,parameters:t.AsnConvert.serialize(s)}),saltLength:r}):null}static getHashAlgorithm(e){const t=c.container.resolve(v);return"string"==typeof e?t.toAsnAlgorithm({name:e}):"object"==typeof e&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if(!("hash"in e))return new i.AlgorithmIdentifier({algorithm:g.id_rsaEncryption,parameters:null});{let t;if("string"==typeof e.hash)t=e.hash;else{if(!e.hash||"object"!=typeof e.hash||!("name"in e.hash)||"string"!=typeof e.hash.name)throw new Error("Cannot get hash algorithm name");t=e.hash.name.toUpperCase()}switch(t.toLowerCase()){case"sha-1":return new i.AlgorithmIdentifier({algorithm:g.id_sha1WithRSAEncryption,parameters:null});case"sha-256":return new i.AlgorithmIdentifier({algorithm:g.id_sha256WithRSAEncryption,parameters:null});case"sha-384":return new i.AlgorithmIdentifier({algorithm:g.id_sha384WithRSAEncryption,parameters:null});case"sha-512":return new i.AlgorithmIdentifier({algorithm:g.id_sha512WithRSAEncryption,parameters:null})}}break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e)||"number"!=typeof e.saltLength)throw new Error("Cannot get 'saltLength' from 'alg' argument");const r=et.createPssParams(e.hash,e.saltLength);if(!r)throw new Error("Cannot create PSS parameters");return new i.AlgorithmIdentifier({algorithm:g.id_RSASSA_PSS,parameters:t.AsnConvert.serialize(r)})}return new i.AlgorithmIdentifier({algorithm:g.id_RSASSA_PSS,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case g.id_rsaEncryption:return{name:"RSASSA-PKCS1-v1_5"};case g.id_sha1WithRSAEncryption:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case g.id_sha256WithRSAEncryption:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case g.id_sha384WithRSAEncryption:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case g.id_sha512WithRSAEncryption:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case g.id_RSASSA_PSS:if(e.parameters){const i=t.AsnConvert.parse(e.parameters,g.RsaSaPssParams);return{name:"RSA-PSS",hash:c.container.resolve(v).toWebAlgorithm(i.hashAlgorithm),saltLength:i.saltLength}}return{name:"RSA-PSS"}}return null}},e.RsaAlgorithm=et=o.__decorate([c.injectable()],e.RsaAlgorithm),c.container.registerSingleton(y,e.RsaAlgorithm),e.ShaAlgorithm=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new i.AlgorithmIdentifier({algorithm:a.id_sha1});case"sha-256":return new i.AlgorithmIdentifier({algorithm:a.id_sha256});case"sha-384":return new i.AlgorithmIdentifier({algorithm:a.id_sha384});case"sha-512":return new i.AlgorithmIdentifier({algorithm:a.id_sha512})}return null}toWebAlgorithm(e){switch(e.algorithm){case a.id_sha1:return{name:"SHA-1"};case a.id_sha256:return{name:"SHA-256"};case a.id_sha384:return{name:"SHA-384"};case a.id_sha512:return{name:"SHA-512"}}return null}},e.ShaAlgorithm=o.__decorate([c.injectable()],e.ShaAlgorithm),c.container.registerSingleton(y,e.ShaAlgorithm);var rt=class e{addPadding(e,t){const i=r.BufferSourceConverter.toUint8Array(t),s=new Uint8Array(e);return s.set(i,e-i.length),s}removePadding(e,t=!1){let i=r.BufferSourceConverter.toUint8Array(e);for(let e=0;e<i.length;e++)if(i[e]){i=i.slice(e);break}if(t&&i[0]>127){const e=new Uint8Array(i.length+1);return e.set(i,1),e.buffer}return i.buffer}toAsnSignature(i,s){if("ECDSA"===i.name){const a=i.namedCurve,o=e.namedCurveSize.get(a)||e.defaultNamedCurveSize,c=new n.ECDSASigValue,l=r.BufferSourceConverter.toUint8Array(s);return c.r=this.removePadding(l.slice(0,o),!0),c.s=this.removePadding(l.slice(o,o+o),!0),t.AsnConvert.serialize(c)}return null}toWebSignature(i,s){if("ECDSA"===i.name){const a=t.AsnConvert.parse(s,n.ECDSASigValue),o=i.namedCurve,c=e.namedCurveSize.get(o)||e.defaultNamedCurveSize,l=this.addPadding(c,this.removePadding(a.r)),u=this.addPadding(c,this.removePadding(a.s));return r.combine(l,u)}return null}};rt.namedCurveSize=new Map,rt.defaultNamedCurveSize=32;var st="1.3.101.110",nt="1.3.101.111",at="1.3.101.112",ot="1.3.101.113";e.EdAlgorithm=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=at;break;case"x25519":t=st;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=at;break;case"ed448":t=ot}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=st;break;case"x448":t=nt}}return t?new i.AlgorithmIdentifier({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case at:return{name:"Ed25519"};case ot:return{name:"EdDSA",namedCurve:"Ed448"};case st:return{name:"X25519"};case nt:return{name:"ECDH-ES",namedCurve:"X448"}}return null}},e.EdAlgorithm=o.__decorate([c.injectable()],e.EdAlgorithm),c.container.registerSingleton(y,e.EdAlgorithm);var ct=class extends Oe{constructor(e){Oe.isAsnEncoded(e)?super(e,u.CertificationRequest):super(e),this.tag=Be.CertificateRequestTag}onInit(e){this.tbs=t.AsnConvert.serialize(e.certificationRequestInfo),this.publicKey=new Ne(e.certificationRequestInfo.subjectPKInfo);const i=c.container.resolve(v);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map((e=>Qe.create(t.AsnConvert.serialize(e))));const r=this.getAttribute(l.id_pkcs9_at_extensionRequest);this.extensions=[],r instanceof Xe&&(this.extensions=r.items),this.subjectName=new pe(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const t of this.attributes)if(t.type===e)return t;return null}getAttributes(e){return this.attributes.filter((t=>t.type===e))}getExtension(e){for(const t of this.extensions)if(t.type===e)return t;return null}getExtensions(e){return this.extensions.filter((t=>t.type===e))}async verify(e=oe.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),r=c.container.resolveAll(tt).reverse();let s=null;for(const e of r)if(s=e.toWebSignature(t,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),r=t.AsnConvert.parse(this.rawData,u.CertificationRequest),s=r.certificationRequestInfo,n=new Q("",{Version:`${i.Version[s.version]} (${s.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const e=new Q("");for(const t of this.attributes){const i=t.toTextObject();e[i[Q.NAME]]=i}n.Attributes=e}return e.Data=n,e.Signature=new Q("",{Algorithm:ie.serializeAlgorithm(r.signatureAlgorithm),"":r.signature}),e}};ct.NAME="PKCS#10 Certificate Request";var lt=class extends Oe{constructor(e){Oe.isAsnEncoded(e)?super(e,i.Certificate):super(e),this.tag=Be.CertificateTag}onInit(e){const i=e.tbsCertificate;this.tbs=t.AsnConvert.serialize(i),this.serialNumber=r.Convert.ToHex(i.serialNumber),this.subjectName=new pe(i.subject),this.subject=new pe(i.subject).toString(),this.issuerName=new pe(i.issuer),this.issuer=this.issuerName.toString();const s=c.container.resolve(v);this.signatureAlgorithm=s.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const n=i.validity.notBefore.utcTime||i.validity.notBefore.generalTime;if(!n)throw new Error("Cannot get 'notBefore' value");this.notBefore=n;const a=i.validity.notAfter.utcTime||i.validity.notAfter.generalTime;if(!a)throw new Error("Cannot get 'notAfter' value");this.notAfter=a,this.extensions=[],i.extensions&&(this.extensions=i.extensions.map((e=>Ve.create(t.AsnConvert.serialize(e))))),this.publicKey=new Ne(i.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if("string"==typeof e){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter((t=>"string"==typeof e?t.type===e:t instanceof e))}async verify(e={},t=oe.get()){let i,s;const n=e.publicKey;try{if(n)if("publicKey"in n)i={...n.publicKey.algorithm,...this.signatureAlgorithm},s=await n.publicKey.export(i,["verify"],t);else if(n instanceof Ne)i={...n.algorithm,...this.signatureAlgorithm},s=await n.export(i,["verify"],t);else if(r.BufferSourceConverter.isBufferSource(n)){const e=new Ne(n);i={...e.algorithm,...this.signatureAlgorithm},s=await e.export(i,["verify"],t)}else i={...n.algorithm,...this.signatureAlgorithm},s=n;else i={...this.publicKey.algorithm,...this.signatureAlgorithm},s=await this.publicKey.export(i,["verify"],t)}catch(e){return!1}const a=c.container.resolveAll(tt).reverse();let o=null;for(const e of a)if(o=e.toWebSignature(i,this.signature),o)break;if(!o)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await t.subtle.verify(this.signatureAlgorithm,s,o,this.tbs);if(e.signatureOnly)return l;{const t=(e.date||new Date).getTime();return l&&this.notBefore.getTime()<t&&t<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),null!=t||(t=oe.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=oe.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),r=t.AsnConvert.parse(this.rawData,i.Certificate),s=r.tbsCertificate,n=new Q("",{Version:`${i.Version[s.version]} (${s.version})`,"Serial Number":s.serialNumber,"Signature Algorithm":ie.serializeAlgorithm(s.signature),Issuer:this.issuer,Validity:new Q("",{"Not Before":s.validity.notBefore.getTime(),"Not After":s.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(s.issuerUniqueID&&(n["Issuer Unique ID"]=s.issuerUniqueID),s.subjectUniqueID&&(n["Subject Unique ID"]=s.subjectUniqueID),this.extensions.length){const e=new Q("");for(const t of this.extensions){const i=t.toTextObject();e[i[Q.NAME]]=i}n.Extensions=e}return e.Data=n,e.Signature=new Q("",{Algorithm:ie.serializeAlgorithm(r.signatureAlgorithm),"":r.signatureValue}),e}};lt.NAME="Certificate";var ut,dt=class extends Array{constructor(e){if(super(),Oe.isAsnEncoded(e))this.import(e);else if(e instanceof lt)this.push(e);else if(Array.isArray(e))for(const t of e)this.push(t)}export(e){const r=new m.SignedData;r.version=1,r.encapContentInfo.eContentType=m.id_data,r.encapContentInfo.eContent=new m.EncapsulatedContent({single:new t.OctetString}),r.certificates=new m.CertificateSet(this.map((e=>new m.CertificateChoices({certificate:t.AsnConvert.parse(e.rawData,i.Certificate)}))));const s=new m.ContentInfo({contentType:m.id_signedData,content:t.AsnConvert.serialize(r)}),n=t.AsnConvert.serialize(s);return"raw"===e?n:this.toString(e)}import(e){const i=Oe.toArrayBuffer(e),r=t.AsnConvert.parse(i,m.ContentInfo);if(r.contentType!==m.id_signedData)throw new TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");const s=t.AsnConvert.parse(r.content,m.SignedData);this.clear();for(const e of s.certificates||[])e.certificate&&this.push(new lt(e.certificate))}clear(){for(;this.pop(););}toString(e="pem"){const i=this.export("raw");switch(e){case"pem":return Be.encode(i,"CMS");case"pem-chain":return this.map((e=>e.toString("pem"))).join("\n");case"asn":return t.AsnConvert.toString(i);case"hex":return r.Convert.ToHex(i);case"base64":return r.Convert.ToBase64(i);case"base64url":return r.Convert.ToBase64Url(i);case"text":return ie.serialize(this.toTextObject());default:throw TypeError("Argument 'format' is unsupported value")}}toTextObject(){const e=t.AsnConvert.parse(this.export("raw"),m.ContentInfo),i=t.AsnConvert.parse(e.content,m.SignedData);return new Q("X509Certificates",{"Content Type":te.toString(e.contentType),Content:new Q("",{Version:`${m.CMSVersion[i.version]} (${i.version})`,Certificates:new Q("",{Certificate:this.map((e=>e.toTextObject()))})})})}};e.X509CrlReason=void 0,(ut=e.X509CrlReason||(e.X509CrlReason={}))[ut.unspecified=0]="unspecified",ut[ut.keyCompromise=1]="keyCompromise",ut[ut.cACompromise=2]="cACompromise",ut[ut.affiliationChanged=3]="affiliationChanged",ut[ut.superseded=4]="superseded",ut[ut.cessationOfOperation=5]="cessationOfOperation",ut[ut.certificateHold=6]="certificateHold",ut[ut.removeFromCRL=8]="removeFromCRL",ut[ut.privilegeWithdrawn=9]="privilegeWithdrawn",ut[ut.aACompromise=10]="aACompromise";var pt=class extends re{constructor(...e){let s;s=r.BufferSourceConverter.isBufferSource(e[0])?r.BufferSourceConverter.toArrayBuffer(e[0]):t.AsnConvert.serialize(new i.RevokedCertificate({userCertificate:e[0],revocationDate:new i.Time(e[1]),crlEntryExtensions:e[2]})),super(s,i.RevokedCertificate)}onInit(e){this.serialNumber=r.Convert.ToHex(e.userCertificate),this.revocationDate=e.revocationDate.getTime(),this.extensions=[],e.crlEntryExtensions&&(this.extensions=e.crlEntryExtensions.map((e=>{const r=Ve.create(t.AsnConvert.serialize(e));switch(r.type){case i.id_ce_cRLReasons:this.reason=t.AsnConvert.parse(r.value,i.CRLReason).reason;break;case i.id_ce_invalidityDate:this.invalidity=t.AsnConvert.parse(r.value,i.InvalidityDate).value}return r})))}},ht=class extends Oe{constructor(e){Oe.isAsnEncoded(e)?super(e,i.CertificateList):super(e),this.tag=Be.CrlTag}onInit(e){var i,r;const s=e.tbsCertList;this.tbs=t.AsnConvert.serialize(s),this.version=s.version;const n=c.container.resolve(v);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.tbsCertListSignatureAlgorithm=s.signature,this.certListSignatureAlgorithm=e.signatureAlgorithm,this.signature=e.signature,this.issuerName=new pe(s.issuer),this.issuer=this.issuerName.toString();const a=s.thisUpdate.getTime();if(!a)throw new Error("Cannot get 'thisUpdate' value");this.thisUpdate=a;const o=null===(i=s.nextUpdate)||void 0===i?void 0:i.getTime();this.nextUpdate=o,this.entries=(null===(r=s.revokedCertificates)||void 0===r?void 0:r.map((e=>new pt(t.AsnConvert.serialize(e)))))||[],this.extensions=[],s.crlExtensions&&(this.extensions=s.crlExtensions.map((e=>Ve.create(t.AsnConvert.serialize(e)))))}getExtension(e){for(const t of this.extensions)if("string"==typeof e){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter((t=>"string"==typeof e?t.type===e:t instanceof e))}async verify(e,t=oe.get()){if(!this.certListSignatureAlgorithm.isEqual(this.tbsCertListSignatureAlgorithm))throw new Error("algorithm identifier in the sequence tbsCertList and CertificateList mismatch");let i,r;const s=e.publicKey;try{s instanceof lt?(i={...s.publicKey.algorithm,...s.signatureAlgorithm},r=await s.publicKey.export(i,["verify"])):s instanceof Ne?(i={...s.algorithm,...this.signature},r=await s.export(i,["verify"])):(i={...s.algorithm,...this.signature},r=s)}catch(e){return!1}const n=c.container.resolveAll(tt).reverse();let a=null;for(const e of n)if(a=e.toWebSignature(i,this.signature),a)break;if(!a)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return await t.subtle.verify(this.signatureAlgorithm,r,a,this.tbs)}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),null!=t||(t=oe.get()),await t.subtle.digest(i,this.rawData)}findRevoked(e){const t="string"==typeof e?e:e.serialNumber;for(const e of this.entries)if(e.serialNumber===t)return e;return null}};Ve.register(h.id_ce_basicConstraints,Le),Ve.register(h.id_ce_extKeyUsage,Me),Ve.register(h.id_ce_keyUsage,qe),Ve.register(h.id_ce_subjectKeyIdentifier,He),Ve.register(h.id_ce_authorityKeyIdentifier,De),Ve.register(h.id_ce_subjectAltName,ze),Ve.register(h.id_ce_cRLDistributionPoints,Ge),Ve.register(h.id_pe_authorityInfoAccess,We),Qe.register(_.id_pkcs9_at_challengePassword,Ye),Qe.register(_.id_pkcs9_at_extensionRequest,Xe),c.container.registerSingleton(tt,it),c.container.registerSingleton(tt,rt),rt.namedCurveSize.set("P-256",32),rt.namedCurveSize.set("K-256",32),rt.namedCurveSize.set("P-384",48),rt.namedCurveSize.set("P-521",66),e.AlgorithmProvider=b,e.AsnData=re,e.AsnDefaultSignatureFormatter=it,e.AsnEcSignatureFormatter=rt,e.Attribute=Ze,e.AttributeFactory=Qe,e.AuthorityInfoAccessExtension=We,e.AuthorityKeyIdentifierExtension=De,e.BasicConstraintsExtension=Le,e.CRLDistributionPointsExtension=Ge,e.CertificatePolicyExtension=Ke,e.ChallengePasswordAttribute=Ye,e.CryptoProvider=ae,e.DefaultAlgorithmSerializer=ee,e.ExtendedKeyUsageExtension=Me,e.Extension=ne,e.ExtensionFactory=Ve,e.ExtensionsAttribute=Xe,e.GeneralName=Te,e.GeneralNames=Pe,e.KeyUsagesExtension=qe,e.Name=pe,e.NameIdentifier=le,e.OidSerializer=te,e.PemConverter=Be,e.Pkcs10CertificateRequest=ct,e.Pkcs10CertificateRequestGenerator=class{static async create(e,r=oe.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");const s=await r.subtle.exportKey("spki",e.keys.publicKey),n=new u.CertificationRequest({certificationRequestInfo:new u.CertificationRequestInfo({subjectPKInfo:t.AsnConvert.parse(s,i.SubjectPublicKeyInfo)})});if(e.name){const r=e.name instanceof pe?e.name:new pe(e.name);n.certificationRequestInfo.subject=t.AsnConvert.parse(r.toArrayBuffer(),i.Name)}if(e.attributes)for(const r of e.attributes)n.certificationRequestInfo.attributes.push(t.AsnConvert.parse(r.rawData,i.Attribute));if(e.extensions&&e.extensions.length){const r=new i.Attribute({type:l.id_pkcs9_at_extensionRequest}),s=new i.Extensions;for(const r of e.extensions)s.push(t.AsnConvert.parse(r.rawData,i.Extension));r.values.push(t.AsnConvert.serialize(s)),n.certificationRequestInfo.attributes.push(r)}const a={...e.signingAlgorithm,...e.keys.privateKey.algorithm},o=c.container.resolve(v);n.signatureAlgorithm=o.toAsnAlgorithm(a);const d=t.AsnConvert.serialize(n.certificationRequestInfo),p=await r.subtle.sign(a,e.keys.privateKey,d),h=c.container.resolveAll(tt).reverse();let m=null;for(const e of h)if(m=e.toAsnSignature(a,p),m)break;if(!m)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return n.signature=m,new ct(t.AsnConvert.serialize(n))}},e.PublicKey=Ne,e.SubjectAlternativeNameExtension=ze,e.SubjectKeyIdentifierExtension=He,e.TextConverter=ie,e.TextObject=Q,e.X509Certificate=lt,e.X509CertificateGenerator=class{static async createSelfSigned(e,t=oe.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},t)}static async create(e,i=oe.get()){var s;let n;n=e.publicKey instanceof Ne?e.publicKey.rawData:"publicKey"in e.publicKey?e.publicKey.publicKey.rawData:r.BufferSourceConverter.isBufferSource(e.publicKey)?e.publicKey:await i.subtle.exportKey("spki",e.publicKey);const a=e.serialNumber?r.BufferSourceConverter.toUint8Array(r.Convert.FromHex(e.serialNumber)):i.getRandomValues(new Uint8Array(16));a[0]>127&&(a[0]&=127),a.length>1&&0===a[0]&&(a[1]|=128);const o=e.notBefore||new Date,l=e.notAfter||new Date(o.getTime()+31536e6),u=new h.Certificate({tbsCertificate:new h.TBSCertificate({version:h.Version.v3,serialNumber:a,validity:new h.Validity({notBefore:o,notAfter:l}),extensions:new h.Extensions((null===(s=e.extensions)||void 0===s?void 0:s.map((e=>t.AsnConvert.parse(e.rawData,h.Extension))))||[]),subjectPublicKeyInfo:t.AsnConvert.parse(n,h.SubjectPublicKeyInfo)})});if(e.subject){const i=e.subject instanceof pe?e.subject:new pe(e.subject);u.tbsCertificate.subject=t.AsnConvert.parse(i.toArrayBuffer(),h.Name)}if(e.issuer){const i=e.issuer instanceof pe?e.issuer:new pe(e.issuer);u.tbsCertificate.issuer=t.AsnConvert.parse(i.toArrayBuffer(),h.Name)}const d={hash:"SHA-256"},p="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},m=c.container.resolve(v);u.tbsCertificate.signature=u.signatureAlgorithm=m.toAsnAlgorithm(p);const f=t.AsnConvert.serialize(u.tbsCertificate),g="signingKey"in e?await i.subtle.sign(p,e.signingKey,f):e.signature,_=c.container.resolveAll(tt).reverse();let y=null;for(const e of _)if(y=e.toAsnSignature(p,g),y)break;if(!y)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=y,new lt(t.AsnConvert.serialize(u))}},e.X509Certificates=dt,e.X509ChainBuilder=class{constructor(e={}){this.certificates=[],e.certificates&&(this.certificates=e.certificates)}async build(e,t=oe.get()){const i=new dt(e);let s=e;for(;s=await this.findIssuer(s,t);){const e=await s.getThumbprint(t);for(const s of i){const i=await s.getThumbprint(t);if(r.isEqual(e,i))throw new Error("Cannot build a certificate chain. Circular dependency.")}i.push(s)}return i}async findIssuer(e,i=oe.get()){if(!await e.isSelfSigned(i)){const s=e.getExtension(h.id_ce_authorityKeyIdentifier);for(const n of this.certificates)if(n.subject===e.issuer){if(s)if(s.keyId){const e=n.getExtension(h.id_ce_subjectKeyIdentifier);if(e&&e.keyId!==s.keyId)continue}else if(s.certId){const e=n.getExtension(h.id_ce_subjectAltName);if(e&&(s.certId.serialNumber!==n.serialNumber||!r.isEqual(t.AsnConvert.serialize(s.certId.name),t.AsnConvert.serialize(e))))continue}try{const t={...n.publicKey.algorithm,...e.signatureAlgorithm},r=await n.publicKey.export(t,["verify"],i);if(!await e.verify({publicKey:r,signatureOnly:!0},i))continue}catch(e){continue}return n}}return null}},e.X509Crl=ht,e.X509CrlEntry=pt,e.X509CrlGenerator=class{static async create(e,s=oe.get()){var n;const a=e.issuer instanceof pe?e.issuer:new pe(e.issuer),o=new h.CertificateList({tbsCertList:new h.TBSCertList({version:h.Version.v2,issuer:t.AsnConvert.parse(a.toArrayBuffer(),h.Name),thisUpdate:new i.Time(e.thisUpdate||new Date)})});if(e.nextUpdate&&(o.tbsCertList.nextUpdate=new i.Time(e.nextUpdate)),e.extensions&&e.extensions.length&&(o.tbsCertList.crlExtensions=new h.Extensions(e.extensions.map((e=>t.AsnConvert.parse(e.rawData,h.Extension)))||[])),e.entries&&e.entries.length){o.tbsCertList.revokedCertificates=[];for(const s of e.entries){const a=Oe.toArrayBuffer(s.serialNumber);if(o.tbsCertList.revokedCertificates.findIndex((e=>r.isEqual(e.userCertificate,a)))>-1)throw new Error(`Certificate serial number ${s.serialNumber} already exists in tbsCertList`);const c=new i.RevokedCertificate({userCertificate:a,revocationDate:new i.Time(s.revocationDate||new Date)});if("extensions"in s&&(null===(n=s.extensions)||void 0===n?void 0:n.length)?c.crlEntryExtensions=s.extensions.map((e=>t.AsnConvert.parse(e.rawData,h.Extension))):c.crlEntryExtensions=[],!(s instanceof pt)&&(s.reason&&c.crlEntryExtensions.push(new h.Extension({extnID:h.id_ce_cRLReasons,critical:!1,extnValue:new t.OctetString(t.AsnConvert.serialize(new h.CRLReason(s.reason)))})),s.invalidity&&c.crlEntryExtensions.push(new h.Extension({extnID:h.id_ce_invalidityDate,critical:!1,extnValue:new t.OctetString(t.AsnConvert.serialize(new h.InvalidityDate(s.invalidity)))})),s.issuer)){const i=e.issuer instanceof pe?e.issuer:new pe(e.issuer);c.crlEntryExtensions.push(new h.Extension({extnID:h.id_ce_certificateIssuer,critical:!1,extnValue:new t.OctetString(t.AsnConvert.serialize(t.AsnConvert.parse(i.toArrayBuffer(),h.Name)))}))}o.tbsCertList.revokedCertificates.push(c)}}const l={...e.signingAlgorithm,...e.signingKey.algorithm},u=c.container.resolve(v);o.tbsCertList.signature=o.signatureAlgorithm=u.toAsnAlgorithm(l);const d=t.AsnConvert.serialize(o.tbsCertList),p=await s.subtle.sign(l,e.signingKey,d),m=c.container.resolveAll(tt).reverse();let f=null;for(const e of m)if(f=e.toAsnSignature(l,p),f)break;if(!f)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return o.signature=f,new ht(t.AsnConvert.serialize(o))}},e.cryptoProvider=oe,e.diAlgorithm=y,e.diAlgorithmProvider=v,e.diAsnSignatureFormatter=tt,e.idEd25519=at,e.idEd448=ot,e.idX25519=st,e.idX448=nt}}),require_is_property=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/is-property/is-property.js"(e,t){"use strict";t.exports=function(e){return/^[$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc][$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19d9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f]*$/.test(e)}}}),require_generate_function=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/generate-function/index.js"(e,t){var i,r=require("util"),s=require_is_property(),n=/[\{\[]/,a=/[\}\]]/,o=["do","if","in","for","let","new","try","var","case","else","enum","eval","null","this","true","void","with","await","break","catch","class","const","false","super","throw","while","yield","delete","export","import","public","return","static","switch","typeof","default","extends","finally","package","private","continue","debugger","function","arguments","interface","protected","implements","instanceof","NaN","undefined"],c={};for(i=0;i<o.length;i++)c[o[i]]=!0;var l={s:function(e){return""+e},d:function(e){return""+Number(e)},o:function(e){return JSON.stringify(e)}},u=function(){var e=[],t=0,i={},o=function(i){for(var r="";r.length<2*t;)r+="  ";e.push(r+i)},u=function(e){return a.test(e.trim()[0])&&n.test(e[e.length-1])?(t--,o(e),void t++):n.test(e[e.length-1])?(o(e),void t++):a.test(e.trim()[0])?(t--,void o(e)):void o(e)},d=function(e){if(!e)return d;if(1===arguments.length&&e.indexOf("\n")>-1)for(var t=e.trim().split("\n"),i=0;i<t.length;i++)u(t[i].trim());else u(r.format.apply(r,arguments));return d};return d.scope={},d.formats=l,d.sym=function(e){return e&&function(e){return s(e)&&!c.hasOwnProperty(e)}(e)||(e="tmp"),i[e]||(i[e]=0),e+(i[e]++||"")},d.property=function(e,t){return 1===arguments.length&&(t=e,e=""),s(t+="")?e?e+"."+t:t:e?e+"["+JSON.stringify(t)+"]":JSON.stringify(t)},d.toString=function(){return e.join("\n")},d.toFunction=function(e){e||(e={});var t="return ("+d.toString()+")";Object.keys(d.scope).forEach((function(t){e[t]||(e[t]=d.scope[t])}));var i=Object.keys(e).map((function(e){return e})),r=i.map((function(t){return e[t]}));return Function.apply(null,i.concat(t)).apply(null,r)},arguments.length&&d.apply(null,arguments),d};u.formats=l,t.exports=u}}),require_linked_list=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/internal/linked-list.js"(e,t){"use strict";var i=class{constructor(){this.next=null,this.buffer=null}};t.exports=class e{constructor(){this.head=null,this.tail=null,this.length=0,this.count=0}push(e){const t=new i;t.buffer=e,this.length>0?this.tail.next=t:this.head=t,this.tail=t,this.length+=e.length,this.count+=1}unshift(e){const t=new i;t.buffer=e,t.next=this.head,this.isEmpty()&&(this.tail=t),this.head=t,this.length+=e.length,this.count+=1}shift(){if(this.isEmpty())return null;const e=this.head.buffer;return this.head===this.tail?(this.head=null,this.tail=null):this.head=this.head.next,this.length-=e.length,this.length=Math.max(this.length,0),this.count-=1,e}get first(){return this.isEmpty()?null:this.head.buffer}get last(){return this.isEmpty()?null:this.tail.buffer}isEmpty(){return 0===this.length}clear(){this.head=null,this.tail=null,this.length=0,this.count=0}slice(t,i){if(t<0||t>=this.length)return new e;if(i<0||i>this.length||i<t)return new e;const r=new e;let s=this.head,n=t,a=i;for(;s;){if(s.buffer.length>n){0===n&&s.buffer.length<=a?r.push(s.buffer):s.buffer.length>=a?r.push(s.buffer.slice(n,a)):r.push(s.buffer.slice(n));break}n-=s.buffer.length,a-=s.buffer.length,s=s.next}if(s.buffer.length<a)for(;s;){if(s.buffer.length===a){r.push(s.buffer);break}if(s.buffer.length>a){r.push(s.buffer.slice(0,a));break}n<0&&s.buffer.length<a&&r.push(s.buffer),n-=s.buffer.length,a-=s.buffer.length,s=s.next}return r}}}}),require_buffer_list=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/internal/buffer-list.js"(e,t){"use strict";var i=require_generate_function(),r=require_linked_list(),s=class e{constructor(){this.queue=new r,this.offset=0}get length(){return this.queue.length-this.offset}append(t){if(Buffer.isBuffer(t)){if(this.offset>0){const e=this.queue.shift();this.queue.unshift(e.slice(this.offset)),this.offset=0}this.queue.push(t)}else if(Array.isArray(t))for(let e=0;e<t.length;e+=1)this.append(t[e]);else if(t instanceof e){if(this.offset>0){const e=this.queue.shift();this.queue.unshift(e.slice(this.offset)),this.offset=0}if(t.offset>0){const e=t.queue.shift();t.queue.unshift(e.slice(t.offset)),t.offset=0}let e=t.queue.head;for(;e;)this.queue.push(e.buffer),e=e.next}}get(e){let t=e;for(;t>=this.length;)t-=this.length;for(;t<0;)t+=this.length;let i=this.queue.head,{offset:r}=this;for(;i;){if(i.buffer.length-r>t)return i.buffer[t+r];t-=i.buffer.length-r,r=0,i=i.next}}slice(e,t){for("number"!=typeof e&&(e=0),"number"!=typeof t&&(t=this.length);e<0;)e+=this.length;for(;t<0;)t+=this.length;if(t=Math.min(t,this.length),e>=this.length||0===t)return Buffer.alloc(0);const i=e;e=Math.min(i,t),t=Math.max(i,t);const r=this.queue.slice(e+this.offset,t+this.offset);if(1===r.count)return r.first;let s=r.head;const n=Buffer.allocUnsafe(r.length);let a=0;for(let e=0;e<r.count;e+=1)n.set(s.buffer,a),a+=s.buffer.length,s=s.next;return n}toString(e,t,i){return this.slice(t,i).toString(e)}consume(e){let t=e;for(;this.length>0;){const e=this.queue.first.length-this.offset;if(!(t>=e)){this.offset+=t;break}this.queue.shift(),t-=e,this.offset=0}}indexOf(e,t=0){if(!Number.isInteger(e))throw new TypeError("Invalid argument 1");if(e<0||e>255)throw new Error("Invalid argument 1");for(Number.isInteger(t)||(t=0);t>=this.length;)t-=this.length;for(;t<0;)t+=this.length;let i=this.queue.head,r=0;const s=()=>{r+=i.buffer.length,i=i.next};for(;i;){let n=0;if(i===this.queue.head&&(n+=this.offset),t>=i.buffer.length-n){t-=i.buffer.length-n,s();continue}t<i.buffer.length&&(n+=t);const a=i.buffer.indexOf(e,n);if(a>-1)return a+r-this.offset;s(),n>this.offset&&(t=0)}return-1}},n={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1};Object.keys(n).forEach((e=>{const t=i();t(`\n    function bufferlist_${e}(offset = 0) {\n      const start = offset + this.offset;\n      const head = this.queue.first;\n      const size = ${t.formats.d(n[e])};\n      const isFirtsChunkEnough = head.length - start >= size;\n\n      return isFirtsChunkEnough\n        ? head.${e}(start)\n        : this.slice(offset, offset + size).${e}(0)\n    }\n  `),s.prototype[e]=t.toFunction()}));["readIntBE","readIntLE","readUIntBE","readUIntLE"].forEach((e=>{const t=i();t(`\n    function bufferlist_${e}(size, offset = 0) {\n      const start = offset + this.offset;\n      const head = this.queue.first;\n      const isFirtsChunkEnough = head.length - start >= size;\n\n      return isFirtsChunkEnough\n        ? head.${e}(start, size)\n        : this.slice(offset, offset + size).${e}(0, size)\n    }\n  `),s.prototype[e]=t.toFunction()}));var a={writeDoubleBE:8,writeDoubleLE:8,writeFloatBE:4,writeFloatLE:4,writeInt32BE:4,writeInt32LE:4,writeUInt32BE:4,writeUInt32LE:4,writeInt16BE:2,writeInt16LE:2,writeUInt16BE:2,writeUInt16LE:2,writeInt8:1,writeUInt8:1};Object.keys(a).forEach((e=>{const t=i();t(`\n    function bufferlist_${e}(value) {\n      const size = ${t.formats.d(a[e])};\n      const buf = Buffer.allocUnsafe(size);\n      buf.${e}(value, 0);\n      this.append(buf);\n    }\n  `),s.prototype[e]=t.toFunction()}));["writeIntBE","writeIntLE","writeUIntBE","writeUIntLE"].forEach((e=>{const t=i();t(`\n    function bufferlist_${e}(value, size) {\n      const buf = Buffer.allocUnsafe(size);\n      buf.${e}(value, 0, size);\n      this.append(buf);\n    }\n  `),s.prototype[e]=t.toFunction()})),t.exports=s}}),require_not_enough_data_error=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/not-enough-data-error.js"(e,t){"use strict";t.exports=class extends Error{constructor(e,t){super(`requested ${e} bytes but only ${t} available`),this.name="NotEnoughDataError"}}}}),require_binary_stream=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/binary-stream.js"(e,t){"use strict";var{Transform:i}=require("stream"),r=require_generate_function(),s=require_buffer_list(),n=require_not_enough_data_error(),a=Symbol("buffer"),o=class extends i{constructor(e={}){super(e),this[a]=new s}get buffer(){return this[a]}get length(){return this.buffer.length}append(e){this.buffer.append(e)}get(e){return this.buffer.get(e)}slice(e,t){return this.buffer.slice(e,t)}consume(e){this.buffer.consume(e)}toString(e,t,i){return this.buffer.toString(e,t,i)}indexOf(e,t=0){return this.buffer.indexOf(e,t)}readBuffer(e){l(e,this.length);const t=this.slice(0,e);return this.consume(e),t}writeBuffer(e){this.append(e)}},c={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1};Object.keys(c).forEach((e=>{const t=r();t(`\n    function binary_${e}() {\n      const bytes = ${t.formats.d(c[e])};\n      assertSize(bytes, this.length);\n\n      const res = this.buffer.${e}(0);\n      this.consume(bytes);\n\n      return res;\n    }\n  `),o.prototype[e]=t.toFunction({assertSize:l})})),["readIntBE","readIntLE","readUIntBE","readUIntLE"].forEach((e=>{const t=r();t(`\n    function binary_${e}(size) {\n      assertSize(size, this.length);\n\n      const res = this.buffer.${e}(size, 0);\n      this.consume(size);\n      return res;\n    }\n  `),o.prototype[e]=t.toFunction({assertSize:l})}));["writeDoubleBE","writeDoubleLE","writeFloatBE","writeFloatLE","writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE","writeInt8","writeUInt8"].forEach((e=>{const t=r();t(`\n    function binary_${e}(value) {\n      this.buffer.${e}(value);\n    }\n  `),o.prototype[e]=t.toFunction()}));function l(e,t){if(e>t)throw new n(e,t)}["writeIntBE","writeIntLE","writeUIntBE","writeUIntLE"].forEach((e=>{const t=r();t(`\n    function binary_${e}(value, size) {\n      this.buffer.${e}(value, size);\n    }\n  `),o.prototype[e]=t.toFunction()})),t.exports=o}}),require_isobject=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/isobject/index.js"(e,t){"use strict";t.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}}}),require_is_plain_object=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/is-plain-object/index.js"(e,t){"use strict";var i=require_isobject();function r(e){return!0===i(e)&&"[object Object]"===Object.prototype.toString.call(e)}t.exports=function(e){var t,i;return!1!==r(e)&&("function"==typeof(t=e.constructor)&&(!1!==r(i=t.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf")))}}}),require_util2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/util.js"(e,t){"use strict";var i=require_is_plain_object();function r(e){return"function"==typeof e}function s(e){return"object"==typeof e&&null!==e}t.exports={isType:function(e){return s(e)&&r(e.encode)&&r(e.decode)},isUserType:i,isFunction:r,isDecodeType:function(e){return s(e)&&r(e.decode)},isEncodeType:function(e){return s(e)&&r(e.encode)}}}}),require_symbols=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/internal/symbols.js"(e,t){"use strict";var i=Symbol("skip"),r=Symbol("bytes");t.exports={skip:i,bytes:r}}}),require_meta=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/internal/meta.js"(e,t){"use strict";var i=require_symbols();t.exports=class e{constructor(){this[i.bytes]=0,this.node=void 0,this.current=void 0}get bytes(){return this[i.bytes]}static clone(t){const i=new e;return t instanceof e&&(i.node=t.node,i.current=t.current),i}static clean(t){t instanceof e&&(t.node=void 0,t.current=void 0)}}}}),require_decode=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/decode.js"(e,t){"use strict";var{isType:i,isUserType:r,isDecodeType:s}=require_util2(),n=require_binary_stream(),a=require_symbols(),o=require_meta();function c(e,t,r){if(i(t)){const i=t.decode.call(r,e);return r[a.bytes]+=t.decode.bytes,i}return l(e,t,r)}function l(e,t,i){!function(e){if(!r(e))throw new TypeError("Argument #2 should be a plain object.")}(t);const n=Object.create(null);void 0===i.node?(i.node=n,i.current=n):i.current=n;const o=Object.keys(t);for(let r=0;r<o.length;r+=1){const c=o[r],u=t[c];if(!s(u)){n[c]=l(e,u,i),i.current=n;continue}const d=u.decode.call(i,e);i[a.bytes]+=u.decode.bytes,!0!==u[a.skip]&&(n[c]=d)}return n}t.exports={decode:function e(t,i){let r=t;Buffer.isBuffer(t)&&(r=new n,r.append(t));const s=new o,a=c(r,i,s);return e.bytes=s.bytes,o.clean(s),a},decodeCommon:c}}}),require_encode=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/encode.js"(e,t){"use strict";var{isUserType:i,isEncodeType:r,isType:s}=require_util2(),n=require_symbols(),a=require_meta(),o=require_binary_stream();function c(e,t,i,r){s(i)?(i.encode.call(r,e,t),r[n.bytes]+=i.encode.bytes):l(e,t,i,r)}function l(e,t,s,a){!function(e){if(!i(e))throw new TypeError("Argument `schema` should be a plain object.")}(s),void 0===a.node?(a.node=e,a.current=e):a.current=e;const o=Object.keys(s);for(let i=0;i<o.length;i+=1){const c=o[i],u=s[c],d=e[c];r(u)?(u.encode.call(a,d,t),a[n.bytes]+=u.encode.bytes):(l(d,t,u,a),a.current=e)}}t.exports={encode:function e(t,i,r){const s=new a;if(i instanceof o){const e=r;r=i,i=e}r instanceof o||(r=new o);return c(t,r,i,s),e.bytes=s.bytes,a.clean(s),r},encodeCommon:c}}}),require_encoding_length=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/encoding-length.js"(e,t){"use strict";var{isUserType:i,isType:r}=require_util2(),s=require_meta(),n=require_symbols();function a(e,t,i){r(t)?i[n.bytes]+=t.encodingLength.call(i,e):o(e,t,i)}function o(e,t,s){if(!i(t))throw new TypeError("Argument `schema` should be a plain object.");void 0===s.node?(s.node=e,s.current=e):s.current=e;const a=Object.keys(t);for(let i=0;i<a.length;i+=1){const c=a[i],l=t[c],u=e[c];r(l)?s[n.bytes]+=l.encodingLength.call(s,u):(o(u,l,s),s.current=e)}}t.exports={encodingLength:function(e,t){const i=new s;return a(e,t,i),s.clean(i),i.bytes},encodingLengthCommon:a}}}),require_array=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/array.js"(e,t){"use strict";var{decodeCommon:i}=require_decode(),{encodeCommon:r}=require_encode(),{encodingLengthCommon:s}=require_encoding_length(),{isType:n,isUserType:a,isFunction:o}=require_util2(),c=require_meta();function l(e){if(!Array.isArray(e))throw new TypeError("Argument #1 should be an Array.")}function u(e){if("number"!=typeof e)throw new TypeError("Length of an array should be a number.")}function d(e,t){if(e!==t)throw new Error(`Argument #1 required length ${e} instead of ${t}`)}t.exports=function(e,t,p="count"){if(!n(e)&&!a(e))throw new TypeError("Argument #1 should be a valid type.");const h="bytes"===p,m="number"==typeof t,f=n(t),g=o(t);if(!m&&!f&&!g)throw new TypeError("Unknown type of argument #1.");return{encode:function i(n,a){l(n);const o=c.clone(this);i.bytes=0;let p=0;f?p=n.length:m?p=t:g&&(p=t(o),u(p));h||d(p,n.length);if(h){const t=c.clone(o);for(const i of n)s(i,e,t);f&&(p=t.bytes),d(t.bytes,p),c.clean(t)}f&&(t.encode.call(o,p,a),i.bytes+=t.encode.bytes);n.forEach((t=>{r(t,a,e,o)})),i.bytes+=o.bytes,c.clean(o)},decode:function r(s){let n=0;r.bytes=0;const a=c.clone(this);m?n=t:f?(n=t.decode.call(a,s),r.bytes+=t.decode.bytes):g&&(n=t(a));let o;u(n),o=h?function(e,t,r,s){const n=[],a=s.bytes;let o=0;for(;o<t;)n.push(i(r,e,s)),o=s.bytes-a;if(o>t)throw new Error("Incorrect length of an array.");return n}(e,n,s,a):function(e,t,r,s){const n=new Array(t);for(let a=0;a<t;a+=1)n[a]=i(r,e,s);return n}(e,n,s,a);return r.bytes+=a.bytes,c.clean(a),o},encodingLength:function(i){l(i);const r=c.clone(this);let n=0;if(m&&h)return t;f&&!h&&(n=t.encodingLength(i.length));for(const t of i)s(t,e,r);c.clean(r),n+=r.bytes,f&&h&&(n+=t.encodingLength(n));return n}}}}}),require_buffer=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/buffer.js"(e,t){"use strict";var{isType:i,isFunction:r}=require_util2(),s=require_not_enough_data_error(),n=require_binary_stream();function a(e){if(!(Buffer.isBuffer(e)||e instanceof n))throw new TypeError("Argument 1 should be a Buffer or a BinaryStream.")}function o(e,t){if(e!==t)throw new Error(`Buffer required length ${e} instead of ${t}`)}function c(e){if("number"!=typeof e)throw new TypeError("Length of a buffer should be a number.")}t.exports=function(e){const t="number"==typeof e,n=i(e),l=r(e),u=null===e;if(!(t||n||l||u))throw new TypeError("Unknown type of argument #1.");return{encode:function i(r,s){a(r),i.bytes=0;const d=this;t&&o(e,r.length);n&&(e.encode.call(d,r.length,s),i.bytes+=e.encode.bytes);if(l){const t=e(d);c(t),o(t,r.length)}s.writeBuffer(Buffer.isBuffer(r)?r:r.buffer),i.bytes+=r.length,u&&(s.writeUInt8(0),i.bytes+=1)},decode:function i(r){let a=0;i.bytes=0;const o=this;if(t)a=e;else if(n)a=e.decode.call(o,r),i.bytes+=e.decode.bytes,c(a);else if(l)a=e(o),c(a);else if(u&&(a=r.indexOf(0),-1===a))throw new s(r.length+1,r.length);const d=r.readBuffer(a);i.bytes+=a,u&&(i.bytes+=1,r.consume(1));return d},encodingLength:function(i){a(i);let r=0;if(t)return e;u?r=1:n&&(r=e.encodingLength(i.length));return r+i.length}}}}}),require_bool=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/bool.js"(e,t){"use strict";var{isType:i}=require_util2();t.exports=function(e){if(!i(e))throw new TypeError("Argument #1 should be valid type.");return{encode:function t(i,r){e.encode.call(this,i?1:0,r),t.bytes=e.encode.bytes},decode:function t(i){const r=e.decode.call(this,i);return t.bytes=e.decode.bytes,Boolean(r)},encodingLength:e.encodingLength}}}}),require_reserved=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/reserved.js"(e,t){"use strict";var{decodeCommon:i}=require_decode(),{encodeCommon:r}=require_encode(),{encodingLengthCommon:s}=require_encoding_length(),{isType:n,isFunction:a}=require_util2(),o=require_symbols(),c=require_meta();t.exports=function(e,t=1){if(!n(e))throw new TypeError("Invalid data type.");if(!Number.isInteger(t)&&!a(t))throw new TypeError("Argument #2 should be a valid integer or function.");return{[o.skip]:!0,encodingLength:function(i){const r=c.clone(this),n=a(t)?t(r):t;return s(i,e,r),c.clean(r),r.bytes*n},decode:function r(s){const n=c.clone(this);r.bytes=0;const o=a(t)?t(n):t;if(0===o)return void c.clean(n);for(let t=o;t>0;t-=1)i(s,e,n);r.bytes=n.bytes,c.clean(n)},encode:function i(s,n){i.bytes=0;const o=c.clone(this),l=a(t)?t(o):t;if(0===l)return void c.clean(o);for(let t=l;t>0;t-=1)r(0,n,e,o);i.bytes=o.bytes,c.clean(o)}}}}}),require_string=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/string.js"(e,t){"use strict";var{isType:i}=require_util2(),r=require_not_enough_data_error();function s(e){return function t(i,r){const s=Buffer.from(i.toString(),e);r.writeBuffer(s),r.writeInt8(0),t.bytes=s.length+1}}function n(e){return function t(i){const s=i.indexOf(0);if(-1===s)throw new r(i.length+1,i.length);const n=s+1,a=i.readBuffer(n);return t.bytes=n,a.toString(e,0,s)}}function a(e,t){return function i(r,s){if(r=r.toString(),Buffer.byteLength(r,t)!==e)throw new Error(`Size of string should be ${e} in bytes.`);const n=Buffer.from(r,t);s.writeBuffer(n),i.bytes=n.length}}function o(e,t){return function i(r){const s=r.readBuffer(e);return i.bytes=e,s.toString(t)}}function c(e,t){return function i(r,s){r=r.toString();e.encode.call(this,Buffer.byteLength(r,t),s),i.bytes=e.encode.bytes;const n=Buffer.from(r,t);s.writeBuffer(n),i.bytes+=n.length}}function l(e,t){return function i(r){const s=e.decode.call(this,r);if("number"!=typeof s)throw new TypeError("Size of a string should be a number.");const n=r.readBuffer(s);return i.bytes=e.decode.bytes+n.length,n.toString(t)}}function u(e,t){return function(i){const r=Buffer.byteLength(i,t);return e.encodingLength(r)+r}}function d(e,t){return function i(r,s){i.bytes=0;const n=e(this),a=Buffer.from(r.toString(),t);h(n),function(e,t){if(e!==t)throw new Error(`Buffer required length ${e} instead of ${t}`)}(n,a.length),s.writeBuffer(a),i.bytes+=a.length}}function p(e,t){return function i(r){const s=e(this);h(s);const n=r.readBuffer(s);return i.bytes=s,n.toString(t)}}function h(e){if("number"!=typeof e)throw new TypeError("Length of a buffer should be a number.")}t.exports=function(e,t="ascii"){if(!Buffer.isEncoding(t))throw new Error("Argument #2 should be an encoding name.");if("number"==typeof e)return{encode:a(e,t),decode:o(e,t),encodingLength:()=>e};if(i(e))return{encode:c(e,t),decode:l(e,t),encodingLength:u(e,t)};if(null===e)return{encode:s(t),decode:n(t),encodingLength:e=>Buffer.byteLength(e,t)+1};if("function"==typeof e)return{encode:d(e,t),decode:p(e,t),encodingLength:e=>Buffer.byteLength(e,t)};throw new TypeError("Unknown type of argument #1.")}}}),require_numbers=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/numbers.js"(e,t){"use strict";var i=require_generate_function();function r(e,t,r){const s=i(),n=i();return s(`\n    function decode_${r}(rstream) {\n      decode_${r}.bytes = ${s.formats.d(e)};\n      return rstream.${r}()\n    }\n  `),n(`\n    function encode_${t}(value, wstream) {\n      wstream.${t}(value);\n      encode_${t}.bytes = ${s.formats.d(e)};\n    }\n  `),{encodingLength:()=>e,encode:n.toFunction(),decode:s.toFunction()}}function s(e,t,r){const s=i(),n=i();return s(`\n    function decode_${r}(rstream) {\n      decode_${r}.bytes = ${s.formats.d(e)};\n      return rstream.${r}(${s.formats.d(e)})\n    }\n  `),n(`\n    function encode_${t}(value, wstream) {\n      wstream.${t}(value, ${s.formats.d(e)});\n      encode_${t}.bytes = ${s.formats.d(e)};\n    }\n  `),{encodingLength:()=>e,encode:n.toFunction(),decode:s.toFunction()}}t.exports={doublebe:r(8,"writeDoubleBE","readDoubleBE"),doublele:r(8,"writeDoubleLE","readDoubleLE"),floatbe:r(4,"writeFloatBE","readFloatBE"),floatle:r(4,"writeFloatLE","readFloatLE"),int8:r(1,"writeInt8","readInt8"),uint8:r(1,"writeUInt8","readUInt8"),int16be:r(2,"writeInt16BE","readInt16BE"),uint16be:r(2,"writeUInt16BE","readUInt16BE"),int16le:r(2,"writeInt16LE","readInt16LE"),uint16le:r(2,"writeUInt16LE","readUInt16LE"),int32be:r(4,"writeInt32BE","readInt32BE"),uint32be:r(4,"writeUInt32BE","readUInt32BE"),int32le:r(4,"writeInt32LE","readInt32LE"),uint32le:r(4,"writeUInt32LE","readUInt32LE"),int24be:s(3,"writeIntBE","readIntBE"),uint24be:s(3,"writeUIntBE","readUIntBE"),int24le:s(3,"writeIntLE","readIntLE"),uint24le:s(3,"writeUIntLE","readUIntLE"),int40be:s(5,"writeIntBE","readIntBE"),uint40be:s(5,"writeUIntBE","readUIntBE"),int40le:s(5,"writeIntLE","readIntLE"),uint40le:s(5,"writeUIntLE","readUIntLE"),int48be:s(6,"writeIntBE","readIntBE"),uint48be:s(6,"writeUIntBE","readUIntBE"),int48le:s(6,"writeIntLE","readIntLE"),uint48le:s(6,"writeUIntLE","readUIntLE")}}}),require_when=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/when.js"(e,t){"use strict";var{isType:i,isFunction:r,isUserType:s}=require_util2(),n=require_symbols(),{decodeCommon:a}=require_decode(),{encodeCommon:o}=require_encode(),{encodingLengthCommon:c}=require_encoding_length(),l=require_meta();t.exports=function(e,t){if(!i(t)&&!s(t))throw new TypeError("Argument #2 should be a valid type.");const u={encode:function i(s,a){const c=l.clone(this);i.bytes=0;const d=r(e)?Boolean(e(c)):Boolean(e);if(u[n.skip]=!d,!d)return void l.clean(c);o(s,a,t,c),i.bytes=c.bytes,l.clean(c)},decode:function i(s){const o=l.clone(this);i.bytes=0;const c=r(e)?Boolean(e(o)):Boolean(e);if(u[n.skip]=!c,!c)return void l.clean(o);const d=a(s,t,o);return i.bytes=o.bytes,l.clean(o),d},encodingLength:function(i){const s=l.clone(this);(r(e)?Boolean(e(s)):Boolean(e))&&c(i,t,s);return l.clean(s),s.bytes},[n.skip]:!1};return u}}}),require_select=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/types/select.js"(e,t){"use strict";var i=require_symbols(),{decodeCommon:r}=require_decode(),s=require_meta();t.exports=function(...e){if(0===e.length)throw new TypeError("You should set at least one condition type.");const t={decode:function n(a){n.bytes=0;const o=s.clone(this);for(const c of e){const e=r(a,c,o);if(!0!==c[i.skip])return n.bytes=o.bytes,s.clean(o),t[i.skip]=!1,e}t[i.skip]=!0},encode:()=>{},[i.skip]:!0};return t}}}),require_transaction=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/node_modules/lib/transaction.js"(e,t){"use strict";var i=require_generate_function(),r=require_not_enough_data_error(),s=class{constructor(e){this.stream=e,this.index=0}append(e){this.stream.append(e)}commit(){this.stream.consume(this.index)}get(e=0){return this.stream.get(this.index+e)}get length(){return this.stream.length}slice(e,t){return this.stream.slice(e,t)}toString(e,t,i){return this.stream.toString(e,t,i)}readBuffer(e){a(this.index+e,this.length);const t=this.stream.slice(this.index,this.index+e);return this.index+=e,t}indexOf(e,t=0){return this.stream.indexOf(e,this.index+t)-this.index}},n={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1};function a(e,t){if(e>t)throw new r(e,t)}Object.keys(n).forEach((e=>{const t=i(),r=n[e];t(`\n    function transaction_${e}() {\n      assertSize(this.index + ${t.formats.d(r)}, this.length);\n      const value = this.stream.buffer.${e}(this.index);\n      this.index += ${t.formats.d(r)};\n      return value;\n    }\n  `),s.prototype[e]=t.toFunction({assertSize:a})})),["readIntBE","readIntLE","readUIntBE","readUIntLE"].forEach((e=>{const t=i();t(`\n    function transaction_${e}(bytes) {\n      assertSize(this.index + bytes, this.length);\n      const value = this.stream.buffer.${e}(bytes, this.index);\n      this.index += bytes;\n      return value;\n    }\n  `),s.prototype[e]=t.toFunction({assertSize:a})})),t.exports=s}}),require_src4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@shinyoshiaki/binary-data/src/index.js"(e,t){"use strict";var i=require_binary_stream(),r=require_array(),s=require_buffer(),n=require_bool(),a=require_reserved(),o=require_string(),c=require_numbers(),l=require_when(),u=require_select(),{encode:d}=require_encode(),{decode:p}=require_decode(),{encodingLength:h}=require_encoding_length(),m=require_transaction(),f=require_not_enough_data_error(),g={array:r,bool:n,buffer:s,reserved:a,string:o,when:l,select:u};for(const e of Object.keys(c))g[e]=c[e];var _=Symbol("schema");function y(e){const t=new i({readableObjectMode:!1,writableObjectMode:!0,transform:v});return t[_]=e,t}function b(e){let t=null;const r=Buffer.isBuffer(e);r||(t=e);const s=new i({transform:x,readableObjectMode:!0,writableObjectMode:!1});return s[_]=t,r&&s.append(e),s}function v(e,t,i){try{d(e,this[_],this);const t=this.slice();this.consume(t.length),i(null,t)}catch(e){i(e)}}function x(e,t,i){this.append(e);try{for(;this.length>0;){const e=new m(this),t=p(e,this[_]);e.commit(),this.push(t)}i()}catch(e){e instanceof f?i():i(e)}}t.exports={createEncodeStream:y,createDecodeStream:b,encode:d,decode:p,encodingLength:h,createEncode:y,createDecode:b,types:g,BinaryStream:i,NotEnoughDataError:f}}}),require_dist2=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@minhducsun2002/leb128/dist/index.js"(e){"use strict";var t,i;Object.defineProperty(e,"__esModule",{value:!0}),e.LEB128=e.SignedLEB128=e.UnsignedLEB128=void 0,(i=t||(t={}))[i.LOWER_7=127]="LOWER_7",i[i.UPPER_1=128]="UPPER_1";var r=e=>Number.isSafeInteger(e),s=class{static decode(e,i=0){const r=this.$scanForNullBytes(e,i);let s=0,n=0;for(let a=0;a<=r-i;a++){s|=(e[i+a]&t.LOWER_7)<<n,n+=7}return s}static encode(e){if(this.check(e),e<0)throw new Error(`An unsigned number must NOT be negative, ${e} is!`);let i=[],r=e;do{let e=r&t.LOWER_7;r>>=7,r&&(e|=t.UPPER_1),i.push(e)}while(r);return Uint8Array.from(i)}static check(e){if(!r(e))throw new Error(`${e} is not a safe integer!`)}static $scanForNullBytes(e,i=0){let r=i,s=0;do{if(r>=e.byteLength)throw new Error("This is not a LEB128-encoded Uint8Array, no ending found!");s=e.slice(r,r+1)[0],r++}while(s&t.UPPER_1);return r-1}static getLength(e,t=0){return this.$scanForNullBytes(e,t)-t}};e.UnsignedLEB128=s;var n=class{static $ceil7mul(e){let t=e;for(;t%7;)t++;return t}static check(e){if(!r(e))throw new Error(`${e} is not a safe integer!`)}static encode(e){if(this.check(e),e>=0)throw new Error(`A signed number must be negative, ${e} isn't!`);const t=Math.ceil(Math.log2(-e));return s.encode((1<<this.$ceil7mul(t))+e)}static decode(e,t=0){const i=s.decode(e,t);return-((1<<Math.ceil(Math.log2(i)))-i)}};e.SignedLEB128=n;var a=class{};e.LEB128=a,a.encode=e=>(e>=0?s:n).encode(e),a.decode=(e,t=0,i=!1)=>(i?n:s).decode(e,t)}}),require_aes_js=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/aes-js/index.js"(e,t){!function(i){"use strict";function r(e){return parseInt(e)===e}function s(e){if(!r(e.length))return!1;for(var t=0;t<e.length;t++)if(!r(e[t])||e[t]<0||e[t]>255)return!1;return!0}function n(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!s(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&s(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function a(e){return new Uint8Array(e)}function o(e,t,i,r,s){null==r&&null==s||(e=e.slice?e.slice(r,s):Array.prototype.slice.call(e,r,s)),t.set(e,i)}var c=function(){return{toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i<e.length;){var r=e.charCodeAt(i++);37===r?(t.push(parseInt(e.substr(i,2),16)),i+=2):t.push(r)}return n(t)},fromBytes:function(e){for(var t=[],i=0;i<e.length;){var r=e[i];r<128?(t.push(String.fromCharCode(r)),i++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}}}(),l=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i<e.length;i+=2)t.push(parseInt(e.substr(i,2),16));return t},fromBytes:function(t){for(var i=[],r=0;r<t.length;r++){var s=t[r];i.push(e[(240&s)>>4]+e[15&s])}return i.join("")}}}(),u={16:10,24:12,32:14},d=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],p=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],m=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],f=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],_=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],v=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],x=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],S=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],w=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],E=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],C=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function A(e){for(var t=[],i=0;i<e.length;i+=4)t.push(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]);return t}var T=function(e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:n(e,!0)}),this._prepare()};T.prototype._prepare=function(){var e=u[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var i,r=4*(e+1),s=this.key.length/4,n=A(this.key);for(t=0;t<s;t++)i=t>>2,this._Ke[i][t%4]=n[t],this._Kd[e-i][t%4]=n[t];for(var a,o=0,c=s;c<r;){if(a=n[s-1],n[0]^=p[a>>16&255]<<24^p[a>>8&255]<<16^p[255&a]<<8^p[a>>24&255]^d[o]<<24,o+=1,8!=s)for(t=1;t<s;t++)n[t]^=n[t-1];else{for(t=1;t<s/2;t++)n[t]^=n[t-1];a=n[s/2-1],n[s/2]^=p[255&a]^p[a>>8&255]<<8^p[a>>16&255]<<16^p[a>>24&255]<<24;for(t=s/2+1;t<s;t++)n[t]^=n[t-1]}for(t=0;t<s&&c<r;)l=c>>2,h=c%4,this._Ke[l][h]=n[t],this._Kd[e-l][h]=n[t++],c++}for(var l=1;l<e;l++)for(var h=0;h<4;h++)a=this._Kd[l][h],this._Kd[l][h]=S[a>>24&255]^w[a>>16&255]^E[a>>8&255]^C[255&a]},T.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],r=A(e),s=0;s<4;s++)r[s]^=this._Ke[0][s];for(var n=1;n<t;n++){for(s=0;s<4;s++)i[s]=m[r[s]>>24&255]^f[r[(s+1)%4]>>16&255]^g[r[(s+2)%4]>>8&255]^_[255&r[(s+3)%4]]^this._Ke[n][s];r=i.slice()}var o,c=a(16);for(s=0;s<4;s++)o=this._Ke[t][s],c[4*s]=255&(p[r[s]>>24&255]^o>>24),c[4*s+1]=255&(p[r[(s+1)%4]>>16&255]^o>>16),c[4*s+2]=255&(p[r[(s+2)%4]>>8&255]^o>>8),c[4*s+3]=255&(p[255&r[(s+3)%4]]^o);return c},T.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],r=A(e),s=0;s<4;s++)r[s]^=this._Kd[0][s];for(var n=1;n<t;n++){for(s=0;s<4;s++)i[s]=y[r[s]>>24&255]^b[r[(s+3)%4]>>16&255]^v[r[(s+2)%4]>>8&255]^x[255&r[(s+1)%4]]^this._Kd[n][s];r=i.slice()}var o,c=a(16);for(s=0;s<4;s++)o=this._Kd[t][s],c[4*s]=255&(h[r[s]>>24&255]^o>>24),c[4*s+1]=255&(h[r[(s+3)%4]>>16&255]^o>>16),c[4*s+2]=255&(h[r[(s+2)%4]>>8&255]^o>>8),c[4*s+3]=255&(h[255&r[(s+1)%4]]^o);return c};var P=function(e){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new T(e)};P.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),i=a(16),r=0;r<e.length;r+=16)o(e,i,0,r,r+16),o(i=this._aes.encrypt(i),t,r);return t},P.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=a(e.length),i=a(16),r=0;r<e.length;r+=16)o(e,i,0,r,r+16),o(i=this._aes.decrypt(i),t,r);return t};var I=function(e,t){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=a(16);this._lastCipherblock=n(t,!0),this._aes=new T(e)};I.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),i=a(16),r=0;r<e.length;r+=16){o(e,i,0,r,r+16);for(var s=0;s<16;s++)i[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(i),o(this._lastCipherblock,t,r)}return t},I.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=a(e.length),i=a(16),r=0;r<e.length;r+=16){o(e,i,0,r,r+16),i=this._aes.decrypt(i);for(var s=0;s<16;s++)t[r+s]=i[s]^this._lastCipherblock[s];o(e,this._lastCipherblock,0,r,r+16)}return t};var k=function(e,t,i){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=a(16);i||(i=1),this.segmentSize=i,this._shiftRegister=n(t,!0),this._aes=new T(e)};k.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,i=n(e,!0),r=0;r<i.length;r+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var s=0;s<this.segmentSize;s++)i[r+s]^=t[s];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(i,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return i},k.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,i=n(e,!0),r=0;r<i.length;r+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var s=0;s<this.segmentSize;s++)i[r+s]^=t[s];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(e,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return i};var R=function(e,t){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=a(16);this._lastPrecipher=n(t,!0),this._lastPrecipherIndex=16,this._aes=new T(e)};R.prototype.encrypt=function(e){for(var t=n(e,!0),i=0;i<t.length;i++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[i]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},R.prototype.decrypt=R.prototype.encrypt;var F=function(e){if(!(this instanceof F))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};F.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},F.prototype.setBytes=function(e){if(16!=(e=n(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},F.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var B=function(e,t){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof F||(t=new F(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new T(e)};B.prototype.encrypt=function(e){for(var t=n(e,!0),i=0;i<t.length;i++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[i]^=this._remainingCounter[this._remainingCounterIndex++];return t},B.prototype.decrypt=B.prototype.encrypt;var O={AES:T,Counter:F,ModeOfOperation:{ecb:P,cbc:I,cfb:k,ofb:R,ctr:B},utils:{hex:l,utf8:c},padding:{pkcs7:{pad:function(e){var t=16-(e=n(e,!0)).length%16,i=a(e.length+t);o(e,i);for(var r=e.length;r<i.length;r++)i[r]=t;return i},strip:function(e){if((e=n(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,r=0;r<t;r++)if(e[i+r]!==t)throw new Error("PKCS#7 invalid padding byte");var s=a(i);return o(e,s,0,0,i),s}}},_arrayTest:{coerceArray:n,createArray:a,copyArray:o}};void 0!==e?t.exports=O:"function"==typeof define&&define.amd?define([],(function(){return O})):(i.aesjs&&(O._aesjs=i.aesjs),i.aesjs=O)}(e)}}),require_ip=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/ip/lib/ip.js"(e){var t=e,{Buffer:i}=require("buffer"),r=require("os");t.toBuffer=function(e,t,r){let s;if(r=~~r,this.isV4Format(e))s=t||i.alloc(r+4),e.split(/\./g).map((e=>{s[r++]=255&parseInt(e,10)}));else if(this.isV6Format(e)){const n=e.split(":",8);let a;for(a=0;a<n.length;a++){let e;this.isV4Format(n[a])&&(e=this.toBuffer(n[a]),n[a]=e.slice(0,2).toString("hex")),e&&++a<8&&n.splice(a,0,e.slice(2,4).toString("hex"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(a=0;a<n.length&&""!==n[a];a++);const e=[a,1];for(a=9-n.length;a>0;a--)e.push("0");n.splice(...e)}for(s=t||i.alloc(r+16),a=0;a<n.length;a++){const e=parseInt(n[a],16);s[r++]=e>>8&255,s[r++]=255&e}}if(!s)throw Error(`Invalid ip address: ${e}`);return s},t.toString=function(e,t,i){t=~~t;let r=[];if(4===(i=i||e.length-t)){for(let s=0;s<i;s++)r.push(e[t+s]);r=r.join(".")}else if(16===i){for(let s=0;s<i;s+=2)r.push(e.readUInt16BE(t+s).toString(16));r=r.join(":"),r=r.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),r=r.replace(/:{3,4}/,"::")}return r};var s=/^(\d{1,3}\.){3,3}\d{1,3}$/,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;function a(e){return 4===e?"ipv4":6===e?"ipv6":e?e.toLowerCase():"ipv4"}t.isV4Format=function(e){return s.test(e)},t.isV6Format=function(e){return n.test(e)},t.fromPrefixLen=function(e,r){let s=4;"ipv6"===(r=e>32?"ipv6":a(r))&&(s=16);const n=i.alloc(s);for(let t=0,i=n.length;t<i;++t){let i=8;e<8&&(i=e),e-=i,n[t]=255&~(255>>i)}return t.toString(n)},t.mask=function(e,r){e=t.toBuffer(e),r=t.toBuffer(r);const s=i.alloc(Math.max(e.length,r.length));let n;if(e.length===r.length)for(n=0;n<e.length;n++)s[n]=e[n]&r[n];else if(4===r.length)for(n=0;n<r.length;n++)s[n]=e[e.length-4+n]&r[n];else{for(n=0;n<s.length-6;n++)s[n]=0;for(s[10]=255,s[11]=255,n=0;n<e.length;n++)s[n+12]=e[n]&r[n+12];n+=12}for(;n<s.length;n++)s[n]=0;return t.toString(s)},t.cidr=function(e){const i=e.split("/"),r=i[0];if(2!==i.length)throw new Error(`invalid CIDR subnet: ${r}`);const s=t.fromPrefixLen(parseInt(i[1],10));return t.mask(r,s)},t.subnet=function(e,i){const r=t.toLong(t.mask(e,i)),s=t.toBuffer(i);let n=0;for(let e=0;e<s.length;e++)if(255===s[e])n+=8;else{let t=255&s[e];for(;t;)t=t<<1&255,n++}const a=2**(32-n);return{networkAddress:t.fromLong(r),firstAddress:a<=2?t.fromLong(r):t.fromLong(r+1),lastAddress:a<=2?t.fromLong(r+a-1):t.fromLong(r+a-2),broadcastAddress:t.fromLong(r+a-1),subnetMask:i,subnetMaskLength:n,numHosts:a<=2?a:a-2,length:a,contains:e=>r===t.toLong(t.mask(e,i))}},t.cidrSubnet=function(e){const i=e.split("/"),r=i[0];if(2!==i.length)throw new Error(`invalid CIDR subnet: ${r}`);const s=t.fromPrefixLen(parseInt(i[1],10));return t.subnet(r,s)},t.not=function(e){const i=t.toBuffer(e);for(let e=0;e<i.length;e++)i[e]=255^i[e];return t.toString(i)},t.or=function(e,i){if(e=t.toBuffer(e),i=t.toBuffer(i),e.length===i.length){for(let t=0;t<e.length;++t)e[t]|=i[t];return t.toString(e)}let r=e,s=i;i.length>e.length&&(r=i,s=e);const n=r.length-s.length;for(let e=n;e<r.length;++e)r[e]|=s[e-n];return t.toString(r)},t.isEqual=function(e,i){if(e=t.toBuffer(e),i=t.toBuffer(i),e.length===i.length){for(let t=0;t<e.length;t++)if(e[t]!==i[t])return!1;return!0}if(4===i.length){const t=i;i=e,e=t}for(let e=0;e<10;e++)if(0!==i[e])return!1;const r=i.readUInt16BE(10);if(0!==r&&65535!==r)return!1;for(let t=0;t<4;t++)if(e[t]!==i[t+12])return!1;return!0},t.isPrivate=function(e){if(t.isLoopback(e))return!0;if(!t.isV6Format(e)){const i=t.normalizeToLong(e);if(i<0)throw new Error("invalid ipv4 address");e=t.fromLong(i)}return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^f[cd][0-9a-f]{2}:/i.test(e)||/^fe80:/i.test(e)||/^::1$/.test(e)||/^::$/.test(e)},t.isPublic=function(e){return!t.isPrivate(e)},t.isLoopback=function(e){return/\./.test(e)||/:/.test(e)||(e=t.fromLong(Number(e))),/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(e)||/^0177\./.test(e)||/^0x7f\./i.test(e)||/^fe80::1$/i.test(e)||/^::1$/.test(e)||/^::$/.test(e)},t.loopback=function(e){if("ipv4"!==(e=a(e))&&"ipv6"!==e)throw new Error("family must be ipv4 or ipv6");return"ipv4"===e?"127.0.0.1":"fe80::1"},t.address=function(e,i){const s=r.networkInterfaces();if(i=a(i),e&&"private"!==e&&"public"!==e){const t=s[e].filter((e=>a(e.family)===i));if(0===t.length)return;return t[0].address}const n=Object.keys(s).map((r=>{const n=s[r].filter((r=>(r.family=a(r.family),r.family===i&&!t.isLoopback(r.address)&&(!e||("public"===e?t.isPrivate(r.address):t.isPublic(r.address))))));return n.length?n[0].address:void 0})).filter(Boolean);return n.length?n[0]:t.loopback(i)},t.toLong=function(e){let t=0;return e.split(".").forEach((e=>{t<<=8,t+=parseInt(e)})),t>>>0},t.fromLong=function(e){return`${e>>>24}.${e>>16&255}.${e>>8&255}.${255&e}`},t.normalizeToLong=function(e){const t=e.split(".").map((e=>e.startsWith("0x")||e.startsWith("0X")?parseInt(e,16):e.startsWith("0")&&"0"!==e&&/^[0-7]+$/.test(e)?parseInt(e,8):/^[1-9]\d*$/.test(e)||"0"===e?parseInt(e,10):NaN));if(t.some(isNaN))return-1;let i=0;switch(t.length){case 1:i=t[0];break;case 2:if(t[0]>255||t[1]>16777215)return-1;i=t[0]<<24|16777215&t[1];break;case 3:if(t[0]>255||t[1]>255||t[2]>65535)return-1;i=t[0]<<24|t[1]<<16|65535&t[2];break;case 4:if(t.some((e=>e>255)))return-1;i=t[0]<<24|t[1]<<16|t[2]<<8|t[3];break;default:return-1}return i>>>0}}}),require_fast_deep_equal=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/fast-deep-equal/index.js"(e,t){"use strict";t.exports=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var r,s,n;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(s=r;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=r;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,n[s]))return!1;for(s=r;0!=s--;){var a=n[s];if(!e(t[a],i[a]))return!1}return!0}return t!=t&&i!=i}}}),require_types6=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/dns-packet/types.js"(e){"use strict";e.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e},e.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}}}),require_rcodes=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/dns-packet/rcodes.js"(e){"use strict";e.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e},e.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}}}),require_opcodes=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/dns-packet/opcodes.js"(e){"use strict";e.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e},e.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}}}),require_classes=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/dns-packet/classes.js"(e){"use strict";e.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e},e.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}}}),require_optioncodes=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/dns-packet/optioncodes.js"(e){"use strict";e.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`},e.toCode=function(e){if("number"==typeof e)return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}const t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}}}),require_ip_codec=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/@leichtgewicht/ip-codec/index.cjs"(e,t){var i=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(e,t,i){if(t=~~t,(i=i||e.length-t)===r.size)return r.decode(e,t,i);if(i===s.size)return s.decode(e,t,i);throw Error(`Invalid buffer size needs to be ${r.size} for v4 or ${s.size} for v6.`)},e.encode=function(e,t,i){i=~~i;const a=n(e);"function"==typeof t&&(t=t(i+a));if(a===r.size)return r.encode(e,t,i);return s.encode(e,t,i)},e.familyOf=function(e){return n(e)===r.size?1:2},e.name=void 0,e.sizeOf=n,e.v6=e.v4=void 0;const t=/^(\d{1,3}\.){3,3}\d{1,3}$/,i=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,r={name:"v4",size:4,isFormat:e=>t.test(e),encode(e,t,i){i=~~i,t=t||new Uint8Array(i+4);const r=e.length;let s=0;for(let n=0;n<r;){const r=e.charCodeAt(n++);46===r?(t[i++]=s,s=0):s=10*s+(r-48)}return t[i]=s,t},decode:(e,t)=>(t=~~t,`${e[t++]}.${e[t++]}.${e[t++]}.${e[t]}`)};e.v4=r;const s={name:"v6",size:16,isFormat:e=>e.length>0&&i.test(e),encode(e,t,i){let r=(i=~~i)+16,s=-1,n=0,a=0,o=!0,c=!1;t=t||new Uint8Array(i+16);for(let l=0;l<e.length;l++){let u=e.charCodeAt(l);58===u?(o?-1!==s?(i<r&&(t[i]=0),i<r-1&&(t[i+1]=0),i+=2):i<r&&(s=i):(!0===c?(i<r&&(t[i]=a),i++):(i<r&&(t[i]=n>>8),i<r-1&&(t[i+1]=255&n),i+=2),n=0,a=0),o=!0,c=!1):46===u?(i<r&&(t[i]=a),i++,a=0,n=0,o=!1,c=!0):(o=!1,u>=97?u-=87:u>=65?u-=55:(u-=48,a=10*a+u),n=(n<<4)+u)}if(!1===o)!0===c?(i<r&&(t[i]=a),i++):(i<r&&(t[i]=n>>8),i<r-1&&(t[i+1]=255&n),i+=2);else if(0===s)i<r&&(t[i]=0),i<r-1&&(t[i+1]=0),i+=2;else if(-1!==s){i+=2;for(let e=Math.min(i-1,r-1);e>=s+2;e--)t[e]=t[e-2];t[s]=0,t[s+1]=0,s=i}if(s!==i&&-1!==s)for(i>r-2&&(i=r-2);r>s;)t[--r]=i<r&&i>s?t[--i]:0;else for(;i<r;)t[i++]=0;return t},decode(e,t){t=~~t;let i="";for(let r=0;r<16;r+=2)0!==r&&(i+=":"),i+=(e[t+r]<<8|e[t+r+1]).toString(16);return i.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=s;function n(e){if(r.isFormat(e))return r.size;if(s.isFormat(e))return s.size;throw Error(`Invalid ip address: ${e}`)}return e.name="ip","default"in e?e.default:e}({});"function"==typeof define&&define.amd?define([],(function(){return i})):"object"==typeof t&&"object"==typeof e&&(t.exports=i)}}),require_dns_packet=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/dns-packet/index.js"(e){"use strict";var t=require("buffer").Buffer,i=require_types6(),r=require_rcodes(),s=require_opcodes(),n=require_classes(),a=require_optioncodes(),o=require_ip_codec(),c=32768,l=e.name={};l.encode=function(e,i,r,{mail:s=!1}={}){i||(i=t.alloc(l.encodingLength(e))),r||(r=0);const n=r,a=e.replace(/^\.|\.$/gm,"");if(a.length){let e=[];if(s){let t="";a.split(".").forEach((i=>{i.endsWith("\\")?t+=(t.length?".":"")+i.slice(0,-1):0===e.length&&t.length?e.push(t+"."+i):e.push(i)}))}else e=a.split(".");for(let t=0;t<e.length;t++){const s=i.write(e[t],r+1);i[r]=s,r+=s+1}}return i[r++]=0,l.encode.bytes=r-n,i},l.encode.bytes=0,l.decode=function(e,t,{mail:i=!1}={}){t||(t=0);const r=[];let s=t,n=0,a=0,o=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");const c=e[t++];if(a+=o?0:1,0===c)break;if(192&c){if(192&~c)throw new Error("Cannot decode name (bad label)");{if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");const i=e.readUInt16BE(t-1)-49152;if(i>=s)throw new Error("Cannot decode name (bad pointer)");t=i,s=i,a+=o?0:1,o=!0}}else{if(t+c>e.length)throw new Error("Cannot decode name (buffer overflow)");if(n+=c+1,n>254)throw new Error("Cannot decode name (name too long)");let s=e.toString("utf-8",t,t+c);i&&(s=s.replace(/\./g,"\\.")),r.push(s),t+=c,a+=o?0:c}}return l.decode.bytes=a,0===r.length?".":r.join(".")},l.decode.bytes=0,l.encodingLength=function(e){return"."===e||".."===e?1:t.byteLength(e.replace(/^\.|\.$/gm,""))+2};var u={encode:function(e,i,r){i||(i=t.alloc(u.encodingLength(e))),r||(r=0);const s=i.write(e,r+1);return i[r]=s,u.encode.bytes=s+1,i}};u.encode.bytes=0,u.decode=function(e,t){t||(t=0);const i=e[t],r=e.toString("utf-8",t+1,t+1+i);return u.decode.bytes=i+1,r},u.decode.bytes=0,u.encodingLength=function(e){return t.byteLength(e)+1};var d={encode:function(e,t,i){t||(t=d.encodingLength(e)),i||(i=0);const r=32767&(e.flags||0),s="response"===e.type?32768:0;return t.writeUInt16BE(e.id||0,i),t.writeUInt16BE(r|s,i+2),t.writeUInt16BE(e.questions.length,i+4),t.writeUInt16BE(e.answers.length,i+6),t.writeUInt16BE(e.authorities.length,i+8),t.writeUInt16BE(e.additionals.length,i+10),t}};d.encode.bytes=12,d.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const i=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:32768&i?"response":"query",flags:32767&i,flag_qr:1==(i>>15&1),opcode:s.toString(i>>11&15),flag_aa:1==(i>>10&1),flag_tc:1==(i>>9&1),flag_rd:1==(i>>8&1),flag_ra:1==(i>>7&1),flag_z:1==(i>>6&1),flag_ad:1==(i>>5&1),flag_cd:1==(i>>4&1),rcode:r.toString(15&i),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}},d.decode.bytes=12,d.encodingLength=function(){return 12};var p=e.unknown={};p.encode=function(e,i,r){return i||(i=t.alloc(p.encodingLength(e))),r||(r=0),i.writeUInt16BE(e.length,r),e.copy(i,r+2),p.encode.bytes=e.length+2,i},p.encode.bytes=0,p.decode=function(e,t){t||(t=0);const i=e.readUInt16BE(t),r=e.slice(t+2,t+2+i);return p.decode.bytes=i+2,r},p.decode.bytes=0,p.encodingLength=function(e){return e.length+2};var h=e.ns={};h.encode=function(e,i,r){return i||(i=t.alloc(h.encodingLength(e))),r||(r=0),l.encode(e,i,r+2),i.writeUInt16BE(l.encode.bytes,r),h.encode.bytes=l.encode.bytes+2,i},h.encode.bytes=0,h.decode=function(e,t){t||(t=0);const i=e.readUInt16BE(t),r=l.decode(e,t+2);return h.decode.bytes=i+2,r},h.decode.bytes=0,h.encodingLength=function(e){return l.encodingLength(e)+2};var m=e.soa={};m.encode=function(e,i,r){i||(i=t.alloc(m.encodingLength(e))),r||(r=0);const s=r;return r+=2,l.encode(e.mname,i,r),r+=l.encode.bytes,l.encode(e.rname,i,r,{mail:!0}),r+=l.encode.bytes,i.writeUInt32BE(e.serial||0,r),r+=4,i.writeUInt32BE(e.refresh||0,r),r+=4,i.writeUInt32BE(e.retry||0,r),r+=4,i.writeUInt32BE(e.expire||0,r),r+=4,i.writeUInt32BE(e.minimum||0,r),r+=4,i.writeUInt16BE(r-s-2,s),m.encode.bytes=r-s,i},m.encode.bytes=0,m.decode=function(e,t){t||(t=0);const i=t,r={};return t+=2,r.mname=l.decode(e,t),t+=l.decode.bytes,r.rname=l.decode(e,t,{mail:!0}),t+=l.decode.bytes,r.serial=e.readUInt32BE(t),t+=4,r.refresh=e.readUInt32BE(t),t+=4,r.retry=e.readUInt32BE(t),t+=4,r.expire=e.readUInt32BE(t),t+=4,r.minimum=e.readUInt32BE(t),t+=4,m.decode.bytes=t-i,r},m.decode.bytes=0,m.encodingLength=function(e){return 22+l.encodingLength(e.mname)+l.encodingLength(e.rname)};var f=e.txt={};f.encode=function(e,i,r){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if("string"==typeof e[i]&&(e[i]=t.from(e[i])),!t.isBuffer(e[i]))throw new Error("Must be a Buffer");i||(i=t.alloc(f.encodingLength(e))),r||(r=0);const s=r;return r+=2,e.forEach((function(e){i[r++]=e.length,e.copy(i,r,0,e.length),r+=e.length})),i.writeUInt16BE(r-s-2,s),f.encode.bytes=r-s,i},f.encode.bytes=0,f.decode=function(e,t){t||(t=0);const i=t;let r=e.readUInt16BE(t);t+=2;let s=[];for(;r>0;){const i=e[t++];if(--r,r<i)throw new Error("Buffer overflow");s.push(e.slice(t,t+i)),t+=i,r-=i}return f.decode.bytes=t-i,s},f.decode.bytes=0,f.encodingLength=function(e){Array.isArray(e)||(e=[e]);let i=2;return e.forEach((function(e){i+="string"==typeof e?t.byteLength(e)+1:e.length+1})),i};var g=e.null={};g.encode=function(e,i,r){i||(i=t.alloc(g.encodingLength(e))),r||(r=0),"string"==typeof e&&(e=t.from(e)),e||(e=t.alloc(0));const s=r;r+=2;const n=e.length;return e.copy(i,r,0,n),r+=n,i.writeUInt16BE(r-s-2,s),g.encode.bytes=r-s,i},g.encode.bytes=0,g.decode=function(e,t){t||(t=0);const i=t,r=e.readUInt16BE(t);t+=2;const s=e.slice(t,t+r);return t+=r,g.decode.bytes=t-i,s},g.decode.bytes=0,g.encodingLength=function(e){return e?(t.isBuffer(e)?e.length:t.byteLength(e))+2:2};var _=e.hinfo={};_.encode=function(e,i,r){i||(i=t.alloc(_.encodingLength(e))),r||(r=0);const s=r;return r+=2,u.encode(e.cpu,i,r),r+=u.encode.bytes,u.encode(e.os,i,r),r+=u.encode.bytes,i.writeUInt16BE(r-s-2,s),_.encode.bytes=r-s,i},_.encode.bytes=0,_.decode=function(e,t){t||(t=0);const i=t,r={};return t+=2,r.cpu=u.decode(e,t),t+=u.decode.bytes,r.os=u.decode(e,t),t+=u.decode.bytes,_.decode.bytes=t-i,r},_.decode.bytes=0,_.encodingLength=function(e){return u.encodingLength(e.cpu)+u.encodingLength(e.os)+2};var y=e.ptr={},b=e.cname=y,v=e.dname=y;y.encode=function(e,i,r){return i||(i=t.alloc(y.encodingLength(e))),r||(r=0),l.encode(e,i,r+2),i.writeUInt16BE(l.encode.bytes,r),y.encode.bytes=l.encode.bytes+2,i},y.encode.bytes=0,y.decode=function(e,t){t||(t=0);const i=l.decode(e,t+2);return y.decode.bytes=l.decode.bytes+2,i},y.decode.bytes=0,y.encodingLength=function(e){return l.encodingLength(e)+2};var x=e.srv={};x.encode=function(e,i,r){i||(i=t.alloc(x.encodingLength(e))),r||(r=0),i.writeUInt16BE(e.priority||0,r+2),i.writeUInt16BE(e.weight||0,r+4),i.writeUInt16BE(e.port||0,r+6),l.encode(e.target,i,r+8);const s=l.encode.bytes+6;return i.writeUInt16BE(s,r),x.encode.bytes=s+2,i},x.encode.bytes=0,x.decode=function(e,t){t||(t=0);const i=e.readUInt16BE(t),r={};return r.priority=e.readUInt16BE(t+2),r.weight=e.readUInt16BE(t+4),r.port=e.readUInt16BE(t+6),r.target=l.decode(e,t+8),x.decode.bytes=i+2,r},x.decode.bytes=0,x.encodingLength=function(e){return 8+l.encodingLength(e.target)};var S=e.caa={};S.ISSUER_CRITICAL=128,S.encode=function(e,i,r){const s=S.encodingLength(e);return i||(i=t.alloc(S.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=S.ISSUER_CRITICAL),i.writeUInt16BE(s-2,r),r+=2,i.writeUInt8(e.flags||0,r),r+=1,u.encode(e.tag,i,r),r+=u.encode.bytes,i.write(e.value,r),r+=t.byteLength(e.value),S.encode.bytes=s,i},S.encode.bytes=0,S.decode=function(e,t){t||(t=0);const i=e.readUInt16BE(t),r=t+=2,s={};return s.flags=e.readUInt8(t),t+=1,s.tag=u.decode(e,t),t+=u.decode.bytes,s.value=e.toString("utf-8",t,r+i),s.issuerCritical=!!(s.flags&S.ISSUER_CRITICAL),S.decode.bytes=i+2,s},S.decode.bytes=0,S.encodingLength=function(e){return u.encodingLength(e.tag)+u.encodingLength(e.value)+2};var w=e.mx={};w.encode=function(e,i,r){i||(i=t.alloc(w.encodingLength(e))),r||(r=0);const s=r;return r+=2,i.writeUInt16BE(e.preference||0,r),r+=2,l.encode(e.exchange,i,r),r+=l.encode.bytes,i.writeUInt16BE(r-s-2,s),w.encode.bytes=r-s,i},w.encode.bytes=0,w.decode=function(e,t){t||(t=0);const i=t,r={};return t+=2,r.preference=e.readUInt16BE(t),t+=2,r.exchange=l.decode(e,t),t+=l.decode.bytes,w.decode.bytes=t-i,r},w.encodingLength=function(e){return 4+l.encodingLength(e.exchange)};var E=e.a={};E.encode=function(e,i,r){return i||(i=t.alloc(E.encodingLength(e))),r||(r=0),i.writeUInt16BE(4,r),r+=2,o.v4.encode(e,i,r),E.encode.bytes=6,i},E.encode.bytes=0,E.decode=function(e,t){t||(t=0),t+=2;const i=o.v4.decode(e,t);return E.decode.bytes=6,i},E.decode.bytes=0,E.encodingLength=function(){return 6};var C=e.aaaa={};C.encode=function(e,i,r){return i||(i=t.alloc(C.encodingLength(e))),r||(r=0),i.writeUInt16BE(16,r),r+=2,o.v6.encode(e,i,r),C.encode.bytes=18,i},C.encode.bytes=0,C.decode=function(e,t){t||(t=0),t+=2;const i=o.v6.decode(e,t);return C.decode.bytes=18,i},C.decode.bytes=0,C.encodingLength=function(){return 18};var A=e.option={};A.encode=function(e,i,r){i||(i=t.alloc(A.encodingLength(e))),r||(r=0);const s=r,n=a.toCode(e.code);if(i.writeUInt16BE(n,r),r+=2,e.data)i.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(i,r),r+=e.data.length;else switch(n){case 8:const s=e.sourcePrefixLength||0,n=e.family||o.familyOf(e.ip),a=o.encode(e.ip,t.alloc),c=Math.ceil(s/8);i.writeUInt16BE(c+4,r),r+=2,i.writeUInt16BE(n,r),r+=2,i.writeUInt8(s,r++),i.writeUInt8(e.scopePrefixLength||0,r++),a.copy(i,r,0,c),r+=c;break;case 11:e.timeout?(i.writeUInt16BE(2,r),r+=2,i.writeUInt16BE(e.timeout,r),r+=2):(i.writeUInt16BE(0,r),r+=2);break;case 12:const l=e.length||0;i.writeUInt16BE(l,r),r+=2,i.fill(0,r,r+l),r+=l;break;case 14:const u=2*e.tags.length;i.writeUInt16BE(u,r),r+=2;for(const t of e.tags)i.writeUInt16BE(t,r),r+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return A.encode.bytes=r-s,i},A.encode.bytes=0,A.decode=function(e,i){i||(i=0);const r={};r.code=e.readUInt16BE(i),r.type=a.toString(r.code),i+=2;const s=e.readUInt16BE(i);switch(i+=2,r.data=e.slice(i,i+s),r.code){case 8:r.family=e.readUInt16BE(i),i+=2,r.sourcePrefixLength=e.readUInt8(i++),r.scopePrefixLength=e.readUInt8(i++);const n=t.alloc(1===r.family?4:16);e.copy(n,0,i,i+s-4),r.ip=o.decode(n);break;case 11:s>0&&(r.timeout=e.readUInt16BE(i),i+=2);break;case 14:r.tags=[];for(let t=0;t<s;t+=2)r.tags.push(e.readUInt16BE(i)),i+=2}return A.decode.bytes=s+4,r},A.decode.bytes=0,A.encodingLength=function(e){if(e.data)return e.data.length+4;switch(a.toCode(e.code)){case 8:const t=e.sourcePrefixLength||0;return Math.ceil(t/8)+8;case 11:return"number"==typeof e.timeout?6:4;case 12:return e.length+4;case 14:return 4+2*e.tags.length}throw new Error(`Unknown roption code: ${e.code}`)};var T=e.opt={};T.encode=function(e,i,r){i||(i=t.alloc(T.encodingLength(e))),r||(r=0);const s=r,n=q(e,A);return i.writeUInt16BE(n,r),r=H(e,A,i,r+2),T.encode.bytes=r-s,i},T.encode.bytes=0,T.decode=function(e,t){t||(t=0);const i=t,r=[];let s=e.readUInt16BE(t);t+=2;let n=0;for(;s>0;)r[n++]=A.decode(e,t),t+=A.decode.bytes,s-=A.decode.bytes;return T.decode.bytes=t-i,r},T.decode.bytes=0,T.encodingLength=function(e){return 2+q(e||[],A)};var P=e.dnskey={};P.PROTOCOL_DNSSEC=3,P.ZONE_KEY=128,P.SECURE_ENTRYPOINT=32768,P.encode=function(e,i,r){i||(i=t.alloc(P.encodingLength(e))),r||(r=0);const s=r,n=e.key;if(!t.isBuffer(n))throw new Error("Key must be a Buffer");return r+=2,i.writeUInt16BE(e.flags,r),r+=2,i.writeUInt8(P.PROTOCOL_DNSSEC,r),r+=1,i.writeUInt8(e.algorithm,r),r+=1,n.copy(i,r,0,n.length),r+=n.length,P.encode.bytes=r-s,i.writeUInt16BE(P.encode.bytes-2,s),i},P.encode.bytes=0,P.decode=function(e,t){t||(t=0);const i=t;var r={},s=e.readUInt16BE(t);if(t+=2,r.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==P.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,r.algorithm=e.readUInt8(t),t+=1,r.key=e.slice(t,i+s+2),t+=r.key.length,P.decode.bytes=t-i,r},P.decode.bytes=0,P.encodingLength=function(e){return 6+t.byteLength(e.key)};var I=e.rrsig={};I.encode=function(e,r,s){r||(r=t.alloc(I.encodingLength(e))),s||(s=0);const n=s,a=e.signature;if(!t.isBuffer(a))throw new Error("Signature must be a Buffer");return s+=2,r.writeUInt16BE(i.toType(e.typeCovered),s),s+=2,r.writeUInt8(e.algorithm,s),s+=1,r.writeUInt8(e.labels,s),s+=1,r.writeUInt32BE(e.originalTTL,s),s+=4,r.writeUInt32BE(e.expiration,s),s+=4,r.writeUInt32BE(e.inception,s),s+=4,r.writeUInt16BE(e.keyTag,s),s+=2,l.encode(e.signersName,r,s),s+=l.encode.bytes,a.copy(r,s,0,a.length),s+=a.length,I.encode.bytes=s-n,r.writeUInt16BE(I.encode.bytes-2,n),r},I.encode.bytes=0,I.decode=function(e,t){t||(t=0);const r=t;var s={},n=e.readUInt16BE(t);return t+=2,s.typeCovered=i.toString(e.readUInt16BE(t)),t+=2,s.algorithm=e.readUInt8(t),t+=1,s.labels=e.readUInt8(t),t+=1,s.originalTTL=e.readUInt32BE(t),t+=4,s.expiration=e.readUInt32BE(t),t+=4,s.inception=e.readUInt32BE(t),t+=4,s.keyTag=e.readUInt16BE(t),t+=2,s.signersName=l.decode(e,t),t+=l.decode.bytes,s.signature=e.slice(t,r+n+2),t+=s.signature.length,I.decode.bytes=t-r,s},I.decode.bytes=0,I.encodingLength=function(e){return 20+l.encodingLength(e.signersName)+t.byteLength(e.signature)};var k=e.rp={};k.encode=function(e,i,r){i||(i=t.alloc(k.encodingLength(e))),r||(r=0);const s=r;return r+=2,l.encode(e.mbox||".",i,r,{mail:!0}),r+=l.encode.bytes,l.encode(e.txt||".",i,r),r+=l.encode.bytes,k.encode.bytes=r-s,i.writeUInt16BE(k.encode.bytes-2,s),i},k.encode.bytes=0,k.decode=function(e,t){t||(t=0);const i=t,r={};return t+=2,r.mbox=l.decode(e,t,{mail:!0})||".",t+=l.decode.bytes,r.txt=l.decode(e,t)||".",t+=l.decode.bytes,k.decode.bytes=t-i,r},k.decode.bytes=0,k.encodingLength=function(e){return 2+l.encodingLength(e.mbox||".")+l.encodingLength(e.txt||".")};var R={encode:function(e,r,s){r||(r=t.alloc(R.encodingLength(e))),s||(s=0);const n=s;for(var a=[],o=0;o<e.length;o++){var c=i.toType(e[o]);void 0===a[c>>8]&&(a[c>>8]=[]),a[c>>8][c>>3&31]|=1<<7-(7&c)}for(o=0;o<a.length;o++)if(void 0!==a[o]){var l=t.from(a[o]);r.writeUInt8(o,s),s+=1,r.writeUInt8(l.length,s),s+=1,l.copy(r,s),s+=l.length}return R.encode.bytes=s-n,r}};R.encode.bytes=0,R.decode=function(e,t,r){t||(t=0);const s=t;for(var n=[];t-s<r;){var a=e.readUInt8(t);t+=1;var o=e.readUInt8(t);t+=1;for(var c=0;c<o;c++)for(var l=e.readUInt8(t+c),u=0;u<8;u++)if(l&1<<7-u){var d=i.toString(a<<8|c<<3|u);n.push(d)}t+=o}return R.decode.bytes=t-s,n},R.decode.bytes=0,R.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var s=i.toType(e[r]);t[s>>8]=Math.max(t[s>>8]||0,255&s)}var n=0;for(r=0;r<t.length;r++)void 0!==t[r]&&(n+=2+Math.ceil((t[r]+1)/8));return n};var F=e.nsec={};F.encode=function(e,i,r){i||(i=t.alloc(F.encodingLength(e))),r||(r=0);const s=r;return r+=2,l.encode(e.nextDomain,i,r),r+=l.encode.bytes,R.encode(e.rrtypes,i,r),r+=R.encode.bytes,F.encode.bytes=r-s,i.writeUInt16BE(F.encode.bytes-2,s),i},F.encode.bytes=0,F.decode=function(e,t){t||(t=0);const i=t;var r={},s=e.readUInt16BE(t);return t+=2,r.nextDomain=l.decode(e,t),t+=l.decode.bytes,r.rrtypes=R.decode(e,t,s-(t-i)),t+=R.decode.bytes,F.decode.bytes=t-i,r},F.decode.bytes=0,F.encodingLength=function(e){return 2+l.encodingLength(e.nextDomain)+R.encodingLength(e.rrtypes)};var B=e.nsec3={};B.encode=function(e,i,r){i||(i=t.alloc(B.encodingLength(e))),r||(r=0);const s=r,n=e.salt;if(!t.isBuffer(n))throw new Error("salt must be a Buffer");const a=e.nextDomain;if(!t.isBuffer(a))throw new Error("nextDomain must be a Buffer");return r+=2,i.writeUInt8(e.algorithm,r),r+=1,i.writeUInt8(e.flags,r),r+=1,i.writeUInt16BE(e.iterations,r),r+=2,i.writeUInt8(n.length,r),r+=1,n.copy(i,r,0,n.length),r+=n.length,i.writeUInt8(a.length,r),r+=1,a.copy(i,r,0,a.length),r+=a.length,R.encode(e.rrtypes,i,r),r+=R.encode.bytes,B.encode.bytes=r-s,i.writeUInt16BE(B.encode.bytes-2,s),i},B.encode.bytes=0,B.decode=function(e,t){t||(t=0);const i=t;var r={},s=e.readUInt16BE(t);t+=2,r.algorithm=e.readUInt8(t),t+=1,r.flags=e.readUInt8(t),t+=1,r.iterations=e.readUInt16BE(t),t+=2;const n=e.readUInt8(t);t+=1,r.salt=e.slice(t,t+n),t+=n;const a=e.readUInt8(t);return t+=1,r.nextDomain=e.slice(t,t+a),t+=a,r.rrtypes=R.decode(e,t,s-(t-i)),t+=R.decode.bytes,B.decode.bytes=t-i,r},B.decode.bytes=0,B.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+R.encodingLength(e.rrtypes)};var O=e.ds={};O.encode=function(e,i,r){i||(i=t.alloc(O.encodingLength(e))),r||(r=0);const s=r,n=e.digest;if(!t.isBuffer(n))throw new Error("Digest must be a Buffer");return r+=2,i.writeUInt16BE(e.keyTag,r),r+=2,i.writeUInt8(e.algorithm,r),r+=1,i.writeUInt8(e.digestType,r),r+=1,n.copy(i,r,0,n.length),r+=n.length,O.encode.bytes=r-s,i.writeUInt16BE(O.encode.bytes-2,s),i},O.encode.bytes=0,O.decode=function(e,t){t||(t=0);const i=t;var r={},s=e.readUInt16BE(t);return t+=2,r.keyTag=e.readUInt16BE(t),t+=2,r.algorithm=e.readUInt8(t),t+=1,r.digestType=e.readUInt8(t),t+=1,r.digest=e.slice(t,i+s+2),t+=r.digest.length,O.decode.bytes=t-i,r},O.decode.bytes=0,O.encodingLength=function(e){return 6+t.byteLength(e.digest)};var N=e.sshfp={};N.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}},N.encode=function(e,i,r){i||(i=t.alloc(N.encodingLength(e))),r||(r=0);const s=r;i[r+=2]=e.algorithm,i[r+=1]=e.hash,r+=1;const n=t.from(e.fingerprint.toUpperCase(),"hex");if(n.length!==N.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return n.copy(i,r),r+=n.byteLength,N.encode.bytes=r-s,i.writeUInt16BE(N.encode.bytes-2,s),i},N.encode.bytes=0,N.decode=function(e,t){t||(t=0);const i=t,r={};t+=2,r.algorithm=e[t],t+=1,r.hash=e[t],t+=1;const s=N.getFingerprintLengthForHashType(r.hash);return r.fingerprint=e.slice(t,t+s).toString("hex").toUpperCase(),t+=s,N.decode.bytes=t-i,r},N.decode.bytes=0,N.encodingLength=function(e){return 4+t.from(e.fingerprint,"hex").byteLength};var D=e.naptr={};D.encode=function(e,i,r){i||(i=t.alloc(D.encodingLength(e))),r||(r=0);const s=r;return r+=2,i.writeUInt16BE(e.order||0,r),r+=2,i.writeUInt16BE(e.preference||0,r),r+=2,u.encode(e.flags,i,r),r+=u.encode.bytes,u.encode(e.services,i,r),r+=u.encode.bytes,u.encode(e.regexp,i,r),r+=u.encode.bytes,l.encode(e.replacement,i,r),r+=l.encode.bytes,D.encode.bytes=r-s,i.writeUInt16BE(D.encode.bytes-2,s),i},D.encode.bytes=0,D.decode=function(e,t){t||(t=0);const i=t,r={};return t+=2,r.order=e.readUInt16BE(t),t+=2,r.preference=e.readUInt16BE(t),t+=2,r.flags=u.decode(e,t),t+=u.decode.bytes,r.services=u.decode(e,t),t+=u.decode.bytes,r.regexp=u.decode(e,t),t+=u.decode.bytes,r.replacement=l.decode(e,t),t+=l.decode.bytes,D.decode.bytes=t-i,r},D.decode.bytes=0,D.encodingLength=function(e){return u.encodingLength(e.flags)+u.encodingLength(e.services)+u.encodingLength(e.regexp)+l.encodingLength(e.replacement)+6};var j=e.tlsa={};j.encode=function(e,i,r){i||(i=t.alloc(j.encodingLength(e))),r||(r=0);const s=r,n=e.certificate;if(!t.isBuffer(n))throw new Error("Certificate must be a Buffer");return r+=2,i.writeUInt8(e.usage,r),r+=1,i.writeUInt8(e.selector,r),r+=1,i.writeUInt8(e.matchingType,r),r+=1,n.copy(i,r,0,n.length),r+=n.length,j.encode.bytes=r-s,i.writeUInt16BE(j.encode.bytes-2,s),i},j.encode.bytes=0,j.decode=function(e,t){t||(t=0);const i=t,r={},s=e.readUInt16BE(t);return t+=2,r.usage=e.readUInt8(t),t+=1,r.selector=e.readUInt8(t),t+=1,r.matchingType=e.readUInt8(t),t+=1,r.certificate=e.slice(t,i+s+2),t+=r.certificate.length,j.decode.bytes=t-i,r},j.decode.bytes=0,j.encodingLength=function(e){return 5+t.byteLength(e.certificate)};var L=e.record=function(e){switch(e.toUpperCase()){case"A":return E;case"PTR":return y;case"CNAME":return b;case"DNAME":return v;case"TXT":return f;case"NULL":return g;case"AAAA":return C;case"SRV":return x;case"HINFO":return _;case"CAA":return S;case"NS":return h;case"SOA":return m;case"MX":return w;case"OPT":return T;case"DNSKEY":return P;case"RRSIG":return I;case"RP":return k;case"NSEC":return F;case"NSEC3":return B;case"SSHFP":return N;case"DS":return O;case"NAPTR":return D;case"TLSA":return j}return p},U=e.answer={};U.encode=function(e,r,s){r||(r=t.alloc(U.encodingLength(e))),s||(s=0);const a=s;if(l.encode(e.name,r,s),s+=l.encode.bytes,r.writeUInt16BE(i.toType(e.type),s),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw new Error("OPT name must be root.");r.writeUInt16BE(e.udpPayloadSize||4096,s+2),r.writeUInt8(e.extendedRcode||0,s+4),r.writeUInt8(e.ednsVersion||0,s+5),r.writeUInt16BE(e.flags||0,s+6),s+=8,T.encode(e.options||[],r,s),s+=T.encode.bytes}else{let t=n.toClass(void 0===e.class?"IN":e.class);e.flush&&(t|=c),r.writeUInt16BE(t,s+2),r.writeUInt32BE(e.ttl||0,s+4),s+=8;const i=L(e.type);i.encode(e.data,r,s),s+=i.encode.bytes}return U.encode.bytes=s-a,r},U.encode.bytes=0,U.decode=function(e,t){t||(t=0);const r={},s=t;if(r.name=l.decode(e,t),t+=l.decode.bytes,r.type=i.toString(e.readUInt16BE(t)),"OPT"===r.type)r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=1==(r.flags>>15&1),r.options=T.decode(e,t+8),t+=8+T.decode.bytes;else{const i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=n.toString(-32769&i),r.flush=!!(i&c);const s=L(r.type);r.data=s.decode(e,t+8),t+=8+s.decode.bytes}return U.decode.bytes=t-s,r},U.decode.bytes=0,U.encodingLength=function(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return l.encodingLength(e.name)+8+L(e.type).encodingLength(t)};var M=e.question={};function q(e,t){let i=0;for(let r=0;r<e.length;r++)i+=t.encodingLength(e[r]);return i}function H(e,t,i,r){for(let s=0;s<e.length;s++)t.encode(e[s],i,r),r+=t.encode.bytes;return r}function z(e,t,i,r){for(let s=0;s<e.length;s++)e[s]=t.decode(i,r),r+=t.decode.bytes;return r}M.encode=function(e,r,s){r||(r=t.alloc(M.encodingLength(e))),s||(s=0);const a=s;return l.encode(e.name,r,s),s+=l.encode.bytes,r.writeUInt16BE(i.toType(e.type),s),s+=2,r.writeUInt16BE(n.toClass(void 0===e.class?"IN":e.class),s),s+=2,M.encode.bytes=s-a,e},M.encode.bytes=0,M.decode=function(e,t){t||(t=0);const r=t,s={};s.name=l.decode(e,t),t+=l.decode.bytes,s.type=i.toString(e.readUInt16BE(t)),t+=2,s.class=n.toString(e.readUInt16BE(t)),t+=2;return!!(32768&s.class)&&(s.class&=-32769),M.decode.bytes=t-r,s},M.decode.bytes=0,M.encodingLength=function(e){return l.encodingLength(e.name)+4},e.AUTHORITATIVE_ANSWER=1024,e.TRUNCATED_RESPONSE=512,e.RECURSION_DESIRED=256,e.RECURSION_AVAILABLE=128,e.AUTHENTIC_DATA=32,e.CHECKING_DISABLED=16,e.DNSSEC_OK=32768,e.encode=function(i,r,s){const n=!r;n&&(r=t.alloc(e.encodingLength(i))),s||(s=0);const a=s;return i.questions||(i.questions=[]),i.answers||(i.answers=[]),i.authorities||(i.authorities=[]),i.additionals||(i.additionals=[]),d.encode(i,r,s),s+=d.encode.bytes,s=H(i.questions,M,r,s),s=H(i.answers,U,r,s),s=H(i.authorities,U,r,s),s=H(i.additionals,U,r,s),e.encode.bytes=s-a,n&&e.encode.bytes!==r.length?r.slice(0,e.encode.bytes):r},e.encode.bytes=0,e.decode=function(t,i){i||(i=0);const r=i,s=d.decode(t,i);return i+=d.decode.bytes,i=z(s.questions,M,t,i),i=z(s.answers,U,t,i),i=z(s.authorities,U,t,i),i=z(s.additionals,U,t,i),e.decode.bytes=i-r,s},e.decode.bytes=0,e.encodingLength=function(e){return d.encodingLength(e)+q(e.questions||[],M)+q(e.answers||[],U)+q(e.authorities||[],U)+q(e.additionals||[],U)},e.streamEncode=function(i){const r=e.encode(i),s=t.alloc(2);s.writeUInt16BE(r.byteLength);const n=t.concat([s,r]);return e.streamEncode.bytes=n.byteLength,n},e.streamEncode.bytes=0,e.streamDecode=function(t){const i=t.readUInt16BE(0);if(t.byteLength<i+2)return null;const r=e.decode(t.slice(2));return e.streamDecode.bytes=e.decode.bytes,r},e.streamDecode.bytes=0}}),require_thunky=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/thunky/index.js"(e,t){"use strict";var i=function(e,t,i){process.nextTick((function(){e(t,i)}))};function r(){}function s(e,t){e.apply(null,t)}process.nextTick((function(e){42===e&&(i=process.nextTick)}),42),t.exports=function(e){var t=function r(n){var a=[n];function o(e){a.push(e)}function c(e){var n=arguments;for(t=function(e){return"[object Error]"===Object.prototype.toString.call(e)}(e)?r:o;a.length;)o(a.shift());function o(e){i(s,e,n)}}t=o,e(c)};return function(e){t(e||r)}}}}),require_multicast_dns=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/multicast-dns/index.js"(e,t){var i=require_dns_packet(),r=require("dgram"),s=require_thunky(),n=require("events"),a=require("os"),o=function(){};function c(e){return 4===e||"IPv4"===e}t.exports=function(e){e||(e={});var t=new n.EventEmitter,l="number"==typeof e.port?e.port:5353,u=e.type||"udp4",d=e.ip||e.host||("udp4"===u?"224.0.0.251":null),p={address:d,port:l},h={},m=!1,f=null;if(!("udp6"!==u||d&&e.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var g=e.socket||r.createSocket({type:u,reuseAddr:!1!==e.reuseAddr,toString:function(){return u}});g.on("error",(function(e){"EACCES"===e.code||"EADDRINUSE"===e.code?t.emit("error",e):t.emit("warning",e)})),g.on("message",(function(e,r){try{e=i.decode(e)}catch(e){return void t.emit("warning",e)}t.emit("packet",e,r),"query"===e.type&&t.emit("query",e,r),"response"===e.type&&t.emit("response",e,r)})),g.on("listening",(function(){l||(l=p.port=g.address().port),!1!==e.multicast&&(t.update(),f=setInterval(t.update,5e3),g.setMulticastTTL(e.ttl||255),g.setMulticastLoopback(!1!==e.loopback))}));var _=s((function(t){if(!l||!1===e.bind)return t(null);g.once("error",t),g.bind(l,e.bind||e.interface,(function(){g.removeListener("error",t),t(null)}))}));return _((function(e){if(e)return t.emit("error",e);t.emit("ready")})),t.send=function(e,r,s){if("function"==typeof r)return t.send(e,null,r);s||(s=o),r?r.host||r.address||(r.address=p.address):r=p,_((function(t){if(m)return s();if(t)return s(t);var n=i.encode(e);g.send(n,0,n.length,r.port,r.address||r.host,s)}))},t.response=t.respond=function(e,r,s){Array.isArray(e)&&(e={answers:e}),e.type="response",e.flags=(e.flags||0)|i.AUTHORITATIVE_ANSWER,t.send(e,r,s)},t.query=function(e,i,r,s){return"function"==typeof i?t.query(e,null,null,i):"object"==typeof i&&i&&i.port?t.query(e,null,i,r):"function"==typeof r?t.query(e,i,null,r):(s||(s=o),"string"==typeof e&&(e=[{name:e,type:i||"ANY"}]),Array.isArray(e)&&(e={type:"query",questions:e}),e.type="query",void t.send(e,r,s))},t.destroy=function(e){if(e||(e=o),m)return process.nextTick(e);for(var t in m=!0,clearInterval(f),h)try{g.dropMembership(d,t)}catch(e){}h={},g.close(e)},t.update=function(){for(var i=e.interface?[].concat(e.interface):function(){for(var e=a.networkInterfaces(),t=Object.keys(e),i=[],r=0;r<t.length;r++)for(var s=e[t[r]],n=0;n<s.length;n++){var o=s[n];if(c(o.family)){i.push(o.address);break}}return i}(),r=!1,s=0;s<i.length;s++){var n=i[s];if(!h[n])try{g.addMembership(d,n),h[n]=!0,r=!0}catch(e){t.emit("warning",e)}}if(r){if(g.setMulticastInterface)try{g.setMulticastInterface(e.interface||function(){for(var e=a.networkInterfaces(),t=Object.keys(e),i=0;i<t.length;i++)for(var r=e[t[i]],s=0;s<r.length;s++){var n=r[s];if(c(n.family)&&!n.internal)return"darwin"===a.platform()&&"en0"===t[i]?n.address:"0.0.0.0"}return"127.0.0.1"}())}catch(e){t.emit("warning",e)}t.emit("networkInterface")}},t}}}),require_create_table=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/turbo-crc32/src/create-table.js"(e,t){"use strict";function i(e){const t=new Uint32Array(256);for(let i=0;i<t.length;i+=1){let r=i;for(let t=0;t<8;t+=1)r=1&r?r>>>1^e:r>>>1;t[i]=r}return t}t.exports={createTable:i,createSlicedTable:function(e){const t=new Array(8),r=i(e);t[0]=r;for(let e=1;e<t.length;e+=1){t[e]=new Uint32Array(256);for(let i=0;i<256;i+=1)t[e][i]=t[e-1][i]>>>8^t[0][255&t[e-1][i]]}return t}}}}),require_crc32_by_1=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/turbo-crc32/src/crc32-by-1.js"(e,t){"use strict";t.exports=function(e,t,i,r){let s=i;for(let i=r;i<t.length;i+=1){const r=t[i];s=e[0][255&(s^r)]^s>>>8}return s}}}),require_crc32_by_4=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/turbo-crc32/src/crc32-by-4.js"(e,t){"use strict";var i=require_crc32_by_1();t.exports=function(e,t,r,s){let n=s,a=r;for(let i=n;i+4<t.length;i+=4){const r=t.readUInt32LE(i)^a;a=e[0][r>>>24&255]^e[1][r>>>16&255]^e[2][r>>>8&255]^e[3][255&r],n+=4}return i(e,t,a,n)}}}),require_crc32_by_8=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/turbo-crc32/src/crc32-by-8.js"(e,t){"use strict";var i=require_crc32_by_4();t.exports=function(e,t,r,s){let n=s,a=r;for(let i=n;i+8<t.length;i+=8){const r=t.readUInt32LE(i)^a,s=t.readUInt32LE(i+4);a=e[0][s>>>24&255]^e[1][s>>>16&255]^e[2][s>>>8&255]^e[3][255&s]^e[4][r>>>24&255]^e[5][r>>>16&255]^e[6][r>>>8&255]^e[7][255&r],n+=8}return i(e,t,a,n)}}}),require_crc32c=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/turbo-crc32/crc32c.js"(e,t){"use strict";var{createSlicedTable:i}=require_create_table(),r=require_crc32_by_8(),s=i(2197175160);t.exports=function(e){const t=Buffer.isBuffer(e)?e:Buffer.from(e);return(4294967295^r(s,t,4294967295,0))>>>0}}}),require_mp4box_all=__commonJS({"../../submodules/mediasoup/submodules/werift/node_modules/mp4box/dist/mp4box.all.js"(e){var t=function(){var e=new Date,i=4;return{setLogLevel:function(e){i=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(r,s){void 0===console.debug&&(console.debug=console.log),1>=i&&console.debug("["+t.getDurationString(new Date-e,1e3)+"]","["+r+"]",s)},log:function(e,t){this.debug(e.msg)},info:function(r,s){2>=i&&console.info("["+t.getDurationString(new Date-e,1e3)+"]","["+r+"]",s)},warn:function(r,s){3>=i&&console.warn("["+t.getDurationString(new Date-e,1e3)+"]","["+r+"]",s)},error:function(r,s){4>=i&&console.error("["+t.getDurationString(new Date-e,1e3)+"]","["+r+"]",s)}}}();t.getDurationString=function(e,t){var i;function r(e,t){for(var i=(""+e).split(".");i[0].length<t;)i[0]="0"+i[0];return i.join(".")}e<0?(i=!0,e=-e):i=!1;var s=e/(t||1),n=Math.floor(s/3600);s-=3600*n;var a=Math.floor(s/60),o=1e3*(s-=60*a);return o-=1e3*(s=Math.floor(s)),o=Math.floor(o),(i?"-":"")+n+":"+r(a,2)+":"+r(s,2)+"."+r(o,3)},t.printRanges=function(e){var i=e.length;if(i>0){for(var r="",s=0;s<i;s++)s>0&&(r+=","),r+="["+t.getDurationString(e.start(s))+","+t.getDurationString(e.end(s))+"]";return r}return"(empty)"},void 0!==e&&(e.Log=t);var r=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};r.prototype.getPosition=function(){return this.position},r.prototype.getEndPosition=function(){return this.buffer.byteLength},r.prototype.getLength=function(){return this.buffer.byteLength},r.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},r.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},r.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},r.prototype.readUint8=function(){return this.readAnyInt(1,!1)},r.prototype.readUint16=function(){return this.readAnyInt(2,!1)},r.prototype.readUint24=function(){return this.readAnyInt(3,!1)},r.prototype.readUint32=function(){return this.readAnyInt(4,!1)},r.prototype.readUint64=function(){return this.readAnyInt(8,!1)},r.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;i<e;i++)t+=String.fromCharCode(this.readUint8());return t}throw"Not enough bytes in buffer"},r.prototype.readCString=function(){for(var e=[];;){var t=this.readUint8();if(0===t)break;e.push(t)}return String.fromCharCode.apply(null,e)},r.prototype.readInt8=function(){return this.readAnyInt(1,!0)},r.prototype.readInt16=function(){return this.readAnyInt(2,!0)},r.prototype.readInt32=function(){return this.readAnyInt(4,!0)},r.prototype.readInt64=function(){return this.readAnyInt(8,!1)},r.prototype.readUint8Array=function(e){for(var t=new Uint8Array(e),i=0;i<e;i++)t[i]=this.readUint8();return t},r.prototype.readInt16Array=function(e){for(var t=new Int16Array(e),i=0;i<e;i++)t[i]=this.readInt16();return t},r.prototype.readUint16Array=function(e){for(var t=new Int16Array(e),i=0;i<e;i++)t[i]=this.readUint16();return t},r.prototype.readUint32Array=function(e){for(var t=new Uint32Array(e),i=0;i<e;i++)t[i]=this.readUint32();return t},r.prototype.readInt32Array=function(e){for(var t=new Int32Array(e),i=0;i<e;i++)t[i]=this.readInt32();return t},void 0!==e&&(e.MP4BoxStream=r);var s=function(e,t,i){this._byteOffset=t||0,e instanceof ArrayBuffer?this.buffer=e:"object"==typeof e?(this.dataView=e,t&&(this._byteOffset+=t)):this.buffer=new ArrayBuffer(e||0),this.position=0,this.endianness=null==i?s.LITTLE_ENDIAN:i};s.prototype={},s.prototype.getPosition=function(){return this.position},s.prototype._realloc=function(e){if(this._dynamicSize){var t=this._byteOffset+this.position+e,i=this._buffer.byteLength;if(t<=i)t>this._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var r=new ArrayBuffer(i),s=new Uint8Array(this._buffer);new Uint8Array(r,0,s.length).set(s),this.buffer=r,this._byteLength=t}}},s.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},s.BIG_ENDIAN=!1,s.LITTLE_ENDIAN=!0,s.prototype._byteLength=0,Object.defineProperty(s.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(s.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(s.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(s.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),s.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},s.prototype.isEof=function(){return this.position>=this._byteLength},s.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},s.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return s.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),s.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},s.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return s.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),s.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},s.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return s.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},s.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return s.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),s.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},s.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return s.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),s.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},s.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return s.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},s.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return s.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),s.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},s.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return s.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),s.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},s.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},s.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},s.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},s.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},s.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},s.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},s.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},s.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},s.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,s.memcpy=function(e,t,i,r,s){var n=new Uint8Array(e,t,s),a=new Uint8Array(i,r,s);n.set(a)},s.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},s.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},s.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;i<e.byteLength;i+=e.BYTES_PER_ELEMENT)for(var r=i+e.BYTES_PER_ELEMENT-1,s=i;r>s;r--,s++){var n=t[s];t[s]=t[r],t[r]=n}return e},s.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i<e.length;i++)t[i]=e[i];return String.fromCharCode.apply(null,t)},s.prototype.readString=function(e,t){return null==t||"ASCII"==t?String.fromCharCodeUint8.apply(null,[this.mapUint8Array(null==e?this.byteLength-this.position:e)]):new TextDecoder(t).decode(this.mapUint8Array(e))},s.prototype.readCString=function(e){var t=this.byteLength-this.position,i=new Uint8Array(this._buffer,this._byteOffset+this.position),r=t;null!=e&&(r=Math.min(e,t));for(var s=0;s<r&&0!==i[s];s++);var n=String.fromCharCodeUint8.apply(null,[this.mapUint8Array(s)]);return null!=e?this.position+=r-s:s!=t&&(this.position+=1),n};var n=Math.pow(2,32);s.prototype.readInt64=function(){return this.readInt32()*n+this.readUint32()},s.prototype.readUint64=function(){return this.readUint32()*n+this.readUint32()},s.prototype.readInt64=function(){return this.readUint32()*n+this.readUint32()},s.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()},void 0!==e&&(e.DataStream=s),s.prototype.save=function(e){var t=new Blob([this.buffer]);if(!window.URL||!URL.createObjectURL)throw"DataStream.save: Can't create object URL.";var i=window.URL.createObjectURL(t),r=document.createElement("a");document.body.appendChild(r),r.setAttribute("href",i),r.setAttribute("download",e),r.setAttribute("target","_self"),r.click(),window.URL.revokeObjectURL(i)},s.prototype._dynamicSize=!0,Object.defineProperty(s.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){e||this._trimAlloc(),this._dynamicSize=e}}),s.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e),i=new Uint8Array(t),r=new Uint8Array(this._buffer,e,i.length);i.set(r),this.buffer=t,this.position-=e},s.prototype.writeInt32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt32Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeInt32(e[i],t)},s.prototype.writeInt16Array=function(e,t){if(this._realloc(2*e.length),e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt16Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeInt16(e[i],t)},s.prototype.writeInt8Array=function(e){if(this._realloc(1*e.length),e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt8Array(e.length);else for(var t=0;t<e.length;t++)this.writeInt8(e[t])},s.prototype.writeUint32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint32Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeUint32(e[i],t)},s.prototype.writeUint16Array=function(e,t){if(this._realloc(2*e.length),e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint16Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeUint16(e[i],t)},s.prototype.writeUint8Array=function(e){if(this._realloc(1*e.length),e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint8Array(e.length);else for(var t=0;t<e.length;t++)this.writeUint8(e[t])},s.prototype.writeFloat64Array=function(e,t){if(this._realloc(8*e.length),e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat64Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeFloat64(e[i],t)},s.prototype.writeFloat32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)s.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat32Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeFloat32(e[i],t)},s.prototype.writeInt32=function(e,t){this._realloc(4),this._dataView.setInt32(this.position,e,null==t?this.endianness:t),this.position+=4},s.prototype.writeInt16=function(e,t){this._realloc(2),this._dataView.setInt16(this.position,e,null==t?this.endianness:t),this.position+=2},s.prototype.writeInt8=function(e){this._realloc(1),this._dataView.setInt8(this.position,e),this.position+=1},s.prototype.writeUint32=function(e,t){this._realloc(4),this._dataView.setUint32(this.position,e,null==t?this.endianness:t),this.position+=4},s.prototype.writeUint16=function(e,t){this._realloc(2),this._dataView.setUint16(this.position,e,null==t?this.endianness:t),this.position+=2},s.prototype.writeUint8=function(e){this._realloc(1),this._dataView.setUint8(this.position,e),this.position+=1},s.prototype.writeFloat32=function(e,t){this._realloc(4),this._dataView.setFloat32(this.position,e,null==t?this.endianness:t),this.position+=4},s.prototype.writeFloat64=function(e,t){this._realloc(8),this._dataView.setFloat64(this.position,e,null==t?this.endianness:t),this.position+=8},s.prototype.writeUCS2String=function(e,t,i){null==i&&(i=e.length);for(var r=0;r<e.length&&r<i;r++)this.writeUint16(e.charCodeAt(r),t);for(;r<i;r++)this.writeUint16(0)},s.prototype.writeString=function(e,t,i){var r=0;if(null==t||"ASCII"==t)if(null!=i){var s=Math.min(e.length,i);for(r=0;r<s;r++)this.writeUint8(e.charCodeAt(r));for(;r<i;r++)this.writeUint8(0)}else for(r=0;r<e.length;r++)this.writeUint8(e.charCodeAt(r));else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,i)))},s.prototype.writeCString=function(e,t){var i=0;if(null!=t){var r=Math.min(e.length,t);for(i=0;i<r;i++)this.writeUint8(e.charCodeAt(i));for(;i<t;i++)this.writeUint8(0)}else{for(i=0;i<e.length;i++)this.writeUint8(e.charCodeAt(i));this.writeUint8(0)}},s.prototype.writeStruct=function(e,t){for(var i=0;i<e.length;i+=2){var r=e[i+1];this.writeType(r,t[e[i]],t)}},s.prototype.writeType=function(e,t,i){var r;if("function"==typeof e)return e(this,t);if("object"==typeof e&&!(e instanceof Array))return e.set(this,t,i);var n=null,a="ASCII",o=this.position;switch("string"==typeof e&&/:/.test(e)&&(r=e.split(":"),e=r[0],n=parseInt(r[1])),"string"==typeof e&&/,/.test(e)&&(r=e.split(","),e=r[0],a=parseInt(r[1])),e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,s.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,s.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,s.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,s.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,s.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,s.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,s.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,s.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,s.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,s.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,s.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,s.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,n);break;case"string":this.writeString(t,a,n);break;case"u16string":this.writeUCS2String(t,this.endianness,n);break;case"u16stringle":this.writeUCS2String(t,s.LITTLE_ENDIAN,n);break;case"u16stringbe":this.writeUCS2String(t,s.BIG_ENDIAN,n);break;default:if(3==e.length){for(var c=e[1],l=0;l<t.length;l++)this.writeType(c,t[l]);break}this.writeStruct(e,t)}null!=n&&(this.position=o,this._realloc(n),this.position=o+n)},s.prototype.writeUint64=function(e){var t=Math.floor(e/n);this.writeUint32(t),this.writeUint32(4294967295&e)},s.prototype.writeUint24=function(e){this.writeUint8((16711680&e)>>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},s.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},s.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return s.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},s.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return s.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},s.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},s.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return s.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},s.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return s.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},s.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return s.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},s.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return s.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var a=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(a.prototype=new s(new ArrayBuffer,0,s.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,t.debug("MultiBufferStream","Stream ready for parsing"),!0):(t.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(t.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,i){t.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+i.byteLength));var r=new Uint8Array(e.byteLength+i.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(i),e.byteLength),r.buffer},a.prototype.reduceBuffer=function(e,t,i){var r;return(r=new Uint8Array(i)).set(new Uint8Array(e,t,i)),r.buffer.fileStart=e.fileStart+t,r.buffer.usedBytes=0,r.buffer},a.prototype.insertBuffer=function(e){for(var i=!0,r=0;r<this.buffers.length;r++){var s=this.buffers[r];if(e.fileStart<=s.fileStart){if(e.fileStart===s.fileStart){if(e.byteLength>s.byteLength){this.buffers.splice(r,1),r--;continue}t.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),t.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);i=!1;break}if(e.fileStart<s.fileStart+s.byteLength){var n=s.fileStart+s.byteLength-e.fileStart,a=e.byteLength-n;if(!(a>0)){i=!1;break}e=this.reduceBuffer(e,n,a)}}i&&(t.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},a.prototype.logBufferLevel=function(e){var i,r,s,n,a,o=[],c="";for(s=0,n=0,i=0;i<this.buffers.length;i++)r=this.buffers[i],0===i?(a={},o.push(a),a.start=r.fileStart,a.end=r.fileStart+r.byteLength,c+="["+a.start+"-"):a.end===r.fileStart?a.end=r.fileStart+r.byteLength:((a={}).start=r.fileStart,c+=o[o.length-1].end-1+"], ["+a.start+"-",a.end=r.fileStart+r.byteLength,o.push(a)),s+=r.usedBytes,n+=r.byteLength;o.length>0&&(c+=a.end-1+"]");var l=e?t.info:t.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+n+" bytes), continuous ranges: "+c)},a.prototype.cleanBuffers=function(){var e,i;for(e=0;e<this.buffers.length;e++)(i=this.buffers[e]).usedBytes===i.byteLength&&(t.debug("MultiBufferStream","Removing buffer #"+e),this.buffers.splice(e,1),e--)},a.prototype.mergeNextBuffer=function(){var e;if(this.bufferIndex+1<this.buffers.length){if((e=this.buffers[this.bufferIndex+1]).fileStart===this.buffer.fileStart+this.buffer.byteLength){var i=this.buffer.byteLength,r=this.buffer.usedBytes,s=this.buffer.fileStart;return this.buffers[this.bufferIndex]=ArrayBuffer.concat(this.buffer,e),this.buffer=this.buffers[this.bufferIndex],this.buffers.splice(this.bufferIndex+1,1),this.buffer.usedBytes=r,this.buffer.fileStart=s,t.debug("ISOFile","Concatenating buffer for box parsing (length: "+i+"->"+this.buffer.byteLength+")"),!0}return!1}return!1},a.prototype.findPosition=function(e,i,r){var s,n=null,a=-1;for(s=!0===e?0:this.bufferIndex;s<this.buffers.length&&(n=this.buffers[s]).fileStart<=i;)a=s,r&&(n.fileStart+n.byteLength<=i?n.usedBytes=n.byteLength:n.usedBytes=i-n.fileStart,this.logBufferLevel()),s++;return-1!==a&&(n=this.buffers[a]).fileStart+n.byteLength>=i?(t.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},a.prototype.findEndContiguousBuf=function(e){var t,i,r,s=void 0!==e?e:this.bufferIndex;if(i=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t<this.buffers.length&&(r=this.buffers[t]).fileStart===i.fileStart+i.byteLength;t++)i=r;return i.fileStart+i.byteLength},a.prototype.getEndFilePositionAfter=function(e){var t=this.findPosition(!0,e,!1);return-1!==t?this.findEndContiguousBuf(t):e},a.prototype.addUsedBytes=function(e){this.buffer.usedBytes+=e,this.logBufferLevel()},a.prototype.setAllUsedBytes=function(){this.buffer.usedBytes=this.buffer.byteLength,this.logBufferLevel()},a.prototype.seek=function(e,i,r){var s;return-1!==(s=this.findPosition(i,e,r))?(this.buffer=this.buffers[s],this.bufferIndex=s,this.position=e-this.buffer.fileStart,t.debug("MultiBufferStream","Repositioning parser at buffer position: "+this.position),!0):(t.debug("MultiBufferStream","Position "+e+" not found in buffered data"),!1)},a.prototype.getPosition=function(){if(-1===this.bufferIndex||null===this.buffers[this.bufferIndex])throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.position},a.prototype.getLength=function(){return this.byteLength},a.prototype.getEndPosition=function(){if(-1===this.bufferIndex||null===this.buffers[this.bufferIndex])throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.byteLength},void 0!==e&&(e.MultiBufferStream=a);var o=function(){var e=[];e[3]="ES_Descriptor",e[4]="DecoderConfigDescriptor",e[5]="DecoderSpecificInfo",e[6]="SLConfigDescriptor",this.getDescriptorName=function(t){return e[t]};var i=this,r={};return this.parseOneDescriptor=function(i){var s,n,a,o=0;for(s=i.readUint8(),a=i.readUint8();128&a;)o=(o<<7)+(127&a),a=i.readUint8();return o=(o<<7)+(127&a),t.debug("MPEG4DescriptorParser","Found "+(e[s]||"Descriptor "+s)+", size "+o+" at position "+i.getPosition()),(n=e[s]?new r[e[s]](o):new r.Descriptor(o)).parse(i),n},r.Descriptor=function(e,t){this.tag=e,this.size=t,this.descs=[]},r.Descriptor.prototype.parse=function(e){this.data=e.readUint8Array(this.size)},r.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++)if(this.descs[t].tag==e)return this.descs[t];return null},r.Descriptor.prototype.parseRemainingDescriptors=function(e){for(var t=e.position;e.position<t+this.size;){var r=i.parseOneDescriptor(e);this.descs.push(r)}},r.ES_Descriptor=function(e){r.Descriptor.call(this,3,e)},r.ES_Descriptor.prototype=new r.Descriptor,r.ES_Descriptor.prototype.parse=function(e){if(this.ES_ID=e.readUint16(),this.flags=e.readUint8(),this.size-=3,128&this.flags?(this.dependsOn_ES_ID=e.readUint16(),this.size-=2):this.dependsOn_ES_ID=0,64&this.flags){var t=e.readUint8();this.URL=e.readString(t),this.size-=t+1}else this.URL="";32&this.flags?(this.OCR_ES_ID=e.readUint16(),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(e)},r.ES_Descriptor.prototype.getOTI=function(e){var t=this.findDescriptor(4);return t?t.oti:0},r.ES_Descriptor.prototype.getAudioConfig=function(e){var t=this.findDescriptor(4);if(!t)return null;var i=t.findDescriptor(5);if(i&&i.data){var r=(248&i.data[0])>>3;return 31===r&&i.data.length>=2&&(r=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),r}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=!!(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};void 0!==e&&(e.MPEG4DescriptorParser=o);var c={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){c.FullBox.prototype=new c.Box,c.ContainerBox.prototype=new c.Box,c.SampleEntry.prototype=new c.Box,c.TrackGroupTypeBox.prototype=new c.FullBox,c.BASIC_BOXES.forEach((function(e){c.createBoxCtor(e)})),c.FULL_BOXES.forEach((function(e){c.createFullBoxCtor(e)})),c.CONTAINER_BOXES.forEach((function(e){c.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){c.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){c.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,r){c.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=r},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){c.FullBox.call(this,e,t)},createBoxCtor:function(e,t){c.boxCodes.push(e),c[e+"Box"]=function(t){c.Box.call(this,e,t)},c[e+"Box"].prototype=new c.Box,t&&(c[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){c[e+"Box"]=function(t){c.FullBox.call(this,e,t)},c[e+"Box"].prototype=new c.FullBox,c[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;i<t;i++)this[e[i]+"s"]=[]}},createContainerBoxCtor:function(e,t,i){c[e+"Box"]=function(t){c.ContainerBox.call(this,e,t),c.addSubBoxArrays.call(this,i)},c[e+"Box"].prototype=new c.ContainerBox,t&&(c[e+"Box"].prototype.parse=t)},createMediaSampleEntryCtor:function(e,t,i){c.sampleEntryCodes[e]=[],c[e+"SampleEntry"]=function(e,t){c.SampleEntry.call(this,e,t),c.addSubBoxArrays.call(this,i)},c[e+"SampleEntry"].prototype=new c.SampleEntry,t&&(c[e+"SampleEntry"].prototype.parse=t)},createSampleEntryCtor:function(e,t,i,r){c.sampleEntryCodes[e].push(t),c[t+"SampleEntry"]=function(i){c[e+"SampleEntry"].call(this,t,i),c.addSubBoxArrays.call(this,r)},c[t+"SampleEntry"].prototype=new c[e+"SampleEntry"],i&&(c[t+"SampleEntry"].prototype.parse=i)},createEncryptedSampleEntryCtor:function(e,t,i){c.createSampleEntryCtor.call(this,e,t,i,["sinf"])},createSampleGroupCtor:function(e,t){c[e+"SampleGroupEntry"]=function(t){c.SampleGroupEntry.call(this,e,t)},c[e+"SampleGroupEntry"].prototype=new c.SampleGroupEntry,t&&(c[e+"SampleGroupEntry"].prototype.parse=t)},createTrackGroupCtor:function(e,t){c[e+"TrackGroupTypeBox"]=function(t){c.TrackGroupTypeBox.call(this,e,t)},c[e+"TrackGroupTypeBox"].prototype=new c.TrackGroupTypeBox,t&&(c[e+"TrackGroupTypeBox"].prototype.parse=t)},createUUIDBox:function(e,t,i,r){c.UUIDs.push(e),c.UUIDBoxes[e]=function(r){t?c.FullBox.call(this,"uuid",r,e):i?c.ContainerBox.call(this,"uuid",r,e):c.Box.call(this,"uuid",r,e)},c.UUIDBoxes[e].prototype=t?new c.FullBox:i?new c.ContainerBox:new c.Box,r&&(c.UUIDBoxes[e].prototype.parse=t?function(e){this.parseFullHeader(e),r&&r.call(this,e)}:r)}};function l(e,t){this.x=e,this.y=t}function u(e,t){this.bad_pixel_row=e,this.bad_pixel_column=t}c.initialize(),c.TKHD_FLAG_ENABLED=1,c.TKHD_FLAG_IN_MOVIE=2,c.TKHD_FLAG_IN_PREVIEW=4,c.TFHD_FLAG_BASE_DATA_OFFSET=1,c.TFHD_FLAG_SAMPLE_DESC=2,c.TFHD_FLAG_SAMPLE_DUR=8,c.TFHD_FLAG_SAMPLE_SIZE=16,c.TFHD_FLAG_SAMPLE_FLAGS=32,c.TFHD_FLAG_DUR_EMPTY=65536,c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072,c.TRUN_FLAGS_DATA_OFFSET=1,c.TRUN_FLAGS_FIRST_FLAG=4,c.TRUN_FLAGS_DURATION=256,c.TRUN_FLAGS_SIZE=512,c.TRUN_FLAGS_FLAGS=1024,c.TRUN_FLAGS_CTS_OFFSET=2048,c.Box.prototype.add=function(e){return this.addBox(new c[e+"Box"])},c.Box.prototype.addBox=function(e){return this.boxes.push(e),this[e.type+"s"]?this[e.type+"s"].push(e):this[e.type]=e,e},c.Box.prototype.set=function(e,t){return this[e]=t,this},c.Box.prototype.addEntry=function(e,t){var i=t||"entries";return this[i]||(this[i]=[]),this[i].push(e),this},void 0!==e&&(e.BoxParser=c),c.parseUUID=function(e){return c.parseHex16(e)},c.parseHex16=function(e){for(var t="",i=0;i<16;i++){var r=e.readUint8().toString(16);t+=1===r.length?"0"+r:r}return t},c.parseOneBox=function(e,i,r){var s,n,a,o=e.getPosition(),l=0;if(e.getEndPosition()-o<8)return t.debug("BoxParser","Not enough data in stream to parse the type and size of the box"),{code:c.ERR_NOT_ENOUGH_DATA};if(r&&r<8)return t.debug("BoxParser","Not enough bytes left in the parent box to parse a new box"),{code:c.ERR_NOT_ENOUGH_DATA};var u=e.readUint32(),d=e.readString(4),p=d;if(t.debug("BoxParser","Found box of type '"+d+"' and size "+u+" at position "+o),l=8,"uuid"==d){if(e.getEndPosition()-e.getPosition()<16||r-l<16)return e.seek(o),t.debug("BoxParser","Not enough bytes left in the parent box to parse a UUID box"),{code:c.ERR_NOT_ENOUGH_DATA};l+=16,p=a=c.parseUUID(e)}if(1==u){if(e.getEndPosition()-e.getPosition()<8||r&&r-l<8)return e.seek(o),t.warn("BoxParser",'Not enough data in stream to parse the extended size of the "'+d+'" box'),{code:c.ERR_NOT_ENOUGH_DATA};u=e.readUint64(),l+=8}else if(0===u)if(r)u=r;else if("mdat"!==d)return t.error("BoxParser","Unlimited box size not supported for type: '"+d+"'"),s=new c.Box(d,u),{code:c.OK,box:s,size:s.size};return 0!==u&&u<l?(t.error("BoxParser","Box of type "+d+" has an invalid size "+u+" (too small to be a box)"),{code:c.ERR_NOT_ENOUGH_DATA,type:d,size:u,hdr_size:l,start:o}):0!==u&&r&&u>r?(t.error("BoxParser","Box of type '"+d+"' has a size "+u+" greater than its container size "+r),{code:c.ERR_NOT_ENOUGH_DATA,type:d,size:u,hdr_size:l,start:o}):0!==u&&o+u>e.getEndPosition()?(e.seek(o),t.info("BoxParser","Not enough data in stream to parse the entire '"+d+"' box"),{code:c.ERR_NOT_ENOUGH_DATA,type:d,size:u,hdr_size:l,start:o}):i?{code:c.OK,type:d,size:u,hdr_size:l,start:o}:(c[d+"Box"]?s=new c[d+"Box"](u):"uuid"!==d?(t.warn("BoxParser","Unknown box type: '"+d+"'"),(s=new c.Box(d,u)).has_unparsed_data=!0):c.UUIDBoxes[a]?s=new c.UUIDBoxes[a](u):(t.warn("BoxParser","Unknown uuid type: '"+a+"'"),(s=new c.Box(d,u)).uuid=a,s.has_unparsed_data=!0),s.hdr_size=l,s.start=o,s.write===c.Box.prototype.write&&"mdat"!==s.type&&(t.info("BoxParser","'"+p+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(n=e.getPosition()-(s.start+s.size))<0?(t.warn("BoxParser","Parsing of box '"+p+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(s.start+s.size)):n>0&&(t.error("BoxParser","Parsing of box '"+p+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:c.OK,box:s,size:s.size})},c.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},c.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},c.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},c.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},c.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},c.ContainerBox.prototype.parse=function(e){for(var i,r;e.getPosition()<this.start+this.size;){if((i=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==c.OK)return;if(r=i.box,this.boxes.push(r),this.subBoxNames&&-1!=this.subBoxNames.indexOf(r.type))this[this.subBoxNames[this.subBoxNames.indexOf(r.type)]+"s"].push(r);else{var s="uuid"!==r.type?r.type:r.uuid;this[s]?t.warn("Box of type "+s+" already stored in field of this type"):this[s]=r}}},c.Box.prototype.parseLanguage=function(e){this.language=e.readUint16();var t=[];t[0]=this.language>>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},c.SAMPLE_ENTRY_TYPE_VISUAL="Visual",c.SAMPLE_ENTRY_TYPE_AUDIO="Audio",c.SAMPLE_ENTRY_TYPE_HINT="Hint",c.SAMPLE_ENTRY_TYPE_METADATA="Metadata",c.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",c.SAMPLE_ENTRY_TYPE_SYSTEM="System",c.SAMPLE_ENTRY_TYPE_TEXT="Text",c.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},c.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},c.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},c.SampleEntry.prototype.parseFooter=function(e){c.ContainerBox.prototype.parse.call(this,e)},c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_HINT),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SYSTEM),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_TEXT),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"fLaC"),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_TEXT,"enct"),c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,"encm"),c.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),c.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),c.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),c.createBoxCtor("av1C",(function(e){var i=e.readUint8();if(i>>7&!1)t.error("av1C marker problem");else if(this.version=127&i,1===this.version)if(i=e.readUint8(),this.seq_profile=i>>5&7,this.seq_level_idx_0=31&i,i=e.readUint8(),this.seq_tier_0=i>>7&1,this.high_bitdepth=i>>6&1,this.twelve_bit=i>>5&1,this.monochrome=i>>4&1,this.chroma_subsampling_x=i>>3&1,this.chroma_subsampling_y=i>>2&1,this.chroma_sample_position=3&i,i=e.readUint8(),this.reserved_1=i>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=i>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&i;else if(this.reserved_2=15&i,0!==this.reserved_2)return void t.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else t.error("av1C reserved_1 parsing problem");else t.error("av1C version "+this.version+" not supported")})),c.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t<this.nb_SPS_nalus;t++)this.SPS[t]={},this.SPS[t].length=e.readUint16(),this.SPS[t].nalu=e.readUint8Array(this.SPS[t].length),i-=2+this.SPS[t].length;for(this.nb_PPS_nalus=e.readUint8(),i--,this.PPS=[],t=0;t<this.nb_PPS_nalus;t++)this.PPS[t]={},this.PPS[t].length=e.readUint16(),this.PPS[t].nalu=e.readUint8Array(this.PPS[t].length),i-=2+this.PPS[t].length;i>0&&(this.ext=e.readUint8Array(i))})),c.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),c.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=!(128&~t),this.intra_pred_used=!(64&~t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),c.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t<this.channel_count;t++)this.channel_indexes.push(e.readUint16()),this.channel_types.push(e.readUint16()),this.channel_associations.push(e.readUint16())})),c.createBoxCtor("clap",(function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()})),c.createBoxCtor("clli",(function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()})),c.createFullBoxCtor("cmex",(function(e){1&this.flags&&(this.pos_x=e.readInt32()),2&this.flags&&(this.pos_y=e.readInt32()),4&this.flags&&(this.pos_z=e.readInt32()),8&this.flags&&(0==this.version?16&this.flags?(this.quat_x=e.readInt32(),this.quat_y=e.readInt32(),this.quat_z=e.readInt32()):(this.quat_x=e.readInt16(),this.quat_y=e.readInt16(),this.quat_z=e.readInt16()):this.version),32&this.flags&&(this.id=e.readUint32())})),c.createFullBoxCtor("cmin",(function(e){this.focal_length_x=e.readInt32(),this.principal_point_x=e.readInt32(),this.principal_point_y=e.readInt32(),1&this.flags&&(this.focal_length_y=e.readInt32(),this.skew_factor=e.readInt32())})),c.createBoxCtor("cmpd",(function(e){for(this.component_count=e.readUint32(),this.component_types=[],this.component_type_urls=[],i=0;i<this.component_count;i++){var t=e.readUint16();this.component_types.push(t),t>=32768&&this.component_type_urls.push(e.readCString())}})),c.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i<t;i++)this.chunk_offsets.push(e.readUint64())})),c.createFullBoxCtor("CoLL",(function(e){this.maxCLL=e.readUint16(),this.maxFALL=e.readUint16()})),c.createBoxCtor("colr",(function(e){if(this.colour_type=e.readString(4),"nclx"===this.colour_type){this.colour_primaries=e.readUint16(),this.transfer_characteristics=e.readUint16(),this.matrix_coefficients=e.readUint16();var t=e.readUint8();this.full_range_flag=t>>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),c.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),c.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),c.createFullBoxCtor("ctts",(function(e){var i,r;if(i=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r<i;r++){this.sample_counts.push(e.readUint32());var s=e.readInt32();s<0&&t.warn("BoxParser","ctts box uses negative values without using version 1"),this.sample_offsets.push(s)}else if(1==this.version)for(r=0;r<i;r++)this.sample_counts.push(e.readUint32()),this.sample_offsets.push(e.readInt32())})),c.createBoxCtor("dac3",(function(e){var t=e.readUint8(),i=e.readUint8(),r=e.readUint8();this.fscod=t>>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|r>>5&7})),c.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i<this.num_ind_sub+1;i++){var r={};this.ind_subs.push(r);var s=e.readUint8(),n=e.readUint8(),a=e.readUint8();r.fscod=s>>6,r.bsid=s>>1&31,r.bsmod=(1&s)<<4|n>>4&15,r.acmod=n>>1&7,r.lfeon=1&n,r.num_dep_sub=a>>1&15,r.num_dep_sub>0&&(r.chan_loc=(1&a)<<8|e.readUint8())}})),c.createFullBoxCtor("dfLa",(function(e){for(var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];;){var r=e.readUint8(),s=Math.min(127&r,i.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[s]),128&r)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),c.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),c.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),c.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),c.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t<this.OutputChannelCount;t++)this.ChannelMapping[t]=e.readUint8()}})),c.createFullBoxCtor("dref",(function(e){var t,i;this.entries=[];for(var r=e.readUint32(),s=0;s<r;s++){if((t=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==c.OK)return;i=t.box,this.entries.push(i)}})),c.createBoxCtor("drep",(function(e){this.bytessent=e.readUint64()})),c.createFullBoxCtor("elng",(function(e){this.extended_language=e.readString(this.size-this.hdr_size)})),c.createFullBoxCtor("elst",(function(e){this.entries=[];for(var t=e.readUint32(),i=0;i<t;i++){var r={};this.entries.push(r),1===this.version?(r.segment_duration=e.readUint64(),r.media_time=e.readInt64()):(r.segment_duration=e.readUint32(),r.media_time=e.readInt32()),r.media_rate_integer=e.readInt16(),r.media_rate_fraction=e.readInt16()}})),c.createFullBoxCtor("emsg",(function(e){1==this.version?(this.timescale=e.readUint32(),this.presentation_time=e.readUint64(),this.event_duration=e.readUint32(),this.id=e.readUint32(),this.scheme_id_uri=e.readCString(),this.value=e.readCString()):(this.scheme_id_uri=e.readCString(),this.value=e.readCString(),this.timescale=e.readUint32(),this.presentation_time_delta=e.readUint32(),this.event_duration=e.readUint32(),this.id=e.readUint32());var t=this.size-this.hdr_size-(16+(this.scheme_id_uri.length+1)+(this.value.length+1));1==this.version&&(t-=4),this.message_data=e.readUint8Array(t)})),c.createEntityToGroupCtor=function(e,t){c[e+"Box"]=function(t){c.FullBox.call(this,e,t)},c[e+"Box"].prototype=new c.FullBox,c[e+"Box"].prototype.parse=function(e){if(this.parseFullHeader(e),t)t.call(this,e);else for(this.group_id=e.readUint32(),this.num_entities_in_group=e.readUint32(),this.entity_ids=[],i=0;i<this.num_entities_in_group;i++){var r=e.readUint32();this.entity_ids.push(r)}}},c.createEntityToGroupCtor("aebr"),c.createEntityToGroupCtor("afbr"),c.createEntityToGroupCtor("albc"),c.createEntityToGroupCtor("altr"),c.createEntityToGroupCtor("brst"),c.createEntityToGroupCtor("dobr"),c.createEntityToGroupCtor("eqiv"),c.createEntityToGroupCtor("favc"),c.createEntityToGroupCtor("fobr"),c.createEntityToGroupCtor("iaug"),c.createEntityToGroupCtor("pano"),c.createEntityToGroupCtor("slid"),c.createEntityToGroupCtor("ster"),c.createEntityToGroupCtor("tsyn"),c.createEntityToGroupCtor("wbbr"),c.createEntityToGroupCtor("prgr"),c.createEntityToGroupCtor("pymd",(function(e){this.group_id=e.readUint32(),this.num_entities_in_group=e.readUint32(),this.entity_ids=[];for(var t=0;t<this.num_entities_in_group;t++){var i=e.readUint32();this.entity_ids.push(i)}for(this.tile_size_x=e.readUint16(),this.tile_size_y=e.readUint16(),this.layer_binning=[],this.tiles_in_layer_column_minus1=[],this.tiles_in_layer_row_minus1=[],t=0;t<this.num_entities_in_group;t++)this.layer_binning[t]=e.readUint16(),this.tiles_in_layer_row_minus1[t]=e.readUint16(),this.tiles_in_layer_column_minus1[t]=e.readUint16()})),c.createFullBoxCtor("esds",(function(e){var t=e.readUint8Array(this.size-this.hdr_size);if(void 0!==o){var i=new o;this.esd=i.parseOneDescriptor(new s(t.buffer,0,s.BIG_ENDIAN))}})),c.createBoxCtor("fiel",(function(e){this.fieldCount=e.readUint8(),this.fieldOrdering=e.readUint8()})),c.createBoxCtor("frma",(function(e){this.data_format=e.readString(4)})),c.createBoxCtor("ftyp",(function(e){var t=this.size-this.hdr_size;this.major_brand=e.readString(4),this.minor_version=e.readUint32(),t-=8,this.compatible_brands=[];for(var i=0;t>=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),c.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),c.createBoxCtor("hvcC",(function(e){var t,i,r,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var n=e.readUint8();for(t=0;t<n;t++){var a=[];this.nalu_arrays.push(a),s=e.readUint8(),a.completeness=(128&s)>>7,a.nalu_type=63&s;var o=e.readUint16();for(i=0;i<o;i++){var c={};a.push(c),r=e.readUint16(),c.data=e.readUint8Array(r)}}})),c.createFullBoxCtor("iinf",(function(e){var i;0===this.version?this.entry_count=e.readUint16():this.entry_count=e.readUint32(),this.item_infos=[];for(var r=0;r<this.entry_count;r++){if((i=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==c.OK)return;"infe"!==i.box.type&&t.error("BoxParser","Expected 'infe' box, got "+i.box.type),this.item_infos[r]=i.box}})),c.createFullBoxCtor("iloc",(function(e){var t;t=e.readUint8(),this.offset_size=t>>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var r=0;r<i;r++){var s={};if(this.items.push(s),this.version<2)s.item_ID=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";s.item_ID=e.readUint32()}switch(1===this.version||2===this.version?s.construction_method=15&e.readUint16():s.construction_method=0,s.data_reference_index=e.readUint16(),this.base_offset_size){case 0:s.base_offset=0;break;case 4:s.base_offset=e.readUint32();break;case 8:s.base_offset=e.readUint64();break;default:throw"Error reading base offset size"}var n=e.readUint16();s.extents=[];for(var a=0;a<n;a++){var o={};if(s.extents.push(o),1===this.version||2===this.version)switch(this.index_size){case 0:o.extent_index=0;break;case 4:o.extent_index=e.readUint32();break;case 8:o.extent_index=e.readUint64();break;default:throw"Error reading extent index"}switch(this.offset_size){case 0:o.extent_offset=0;break;case 4:o.extent_offset=e.readUint32();break;case 8:o.extent_offset=e.readUint64();break;default:throw"Error reading extent index"}switch(this.length_size){case 0:o.extent_length=0;break;case 4:o.extent_length=e.readUint32();break;case 8:o.extent_length=e.readUint64();break;default:throw"Error reading extent index"}}}})),c.createBoxCtor("imir",(function(e){var t=e.readUint8();this.reserved=t>>7,this.axis=1&t})),c.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),t.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),c.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t<entry_count;t++){var r={};this.associations.push(r),this.version<1?r.id=e.readUint16():r.id=e.readUint32();var s=e.readUint8();for(r.props=[],i=0;i<s;i++){var n=e.readUint8(),a={};r.props.push(a),a.essential=(128&n)>>7==1,1&this.flags?a.property_index=(127&n)<<8|e.readUint8():a.property_index=127&n}}})),c.createFullBoxCtor("iref",(function(e){var i,r;for(this.references=[];e.getPosition()<this.start+this.size;){if((i=c.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==c.OK)return;(r=0===this.version?new c.SingleItemTypeReferenceBox(i.type,i.size,i.hdr_size,i.start):new c.SingleItemTypeReferenceBoxLarge(i.type,i.size,i.hdr_size,i.start)).write===c.Box.prototype.write&&"mdat"!==r.type&&(t.warn("BoxParser",r.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),this.references.push(r)}})),c.createBoxCtor("irot",(function(e){this.angle=3&e.readUint8()})),c.createFullBoxCtor("ispe",(function(e){this.image_width=e.readUint32(),this.image_height=e.readUint32()})),c.createFullBoxCtor("kind",(function(e){this.schemeURI=e.readCString(),this.value=e.readCString()})),c.createFullBoxCtor("leva",(function(e){var i=e.readUint8();this.levels=[];for(var r=0;r<i;r++){var s={};this.levels[r]=s,s.track_ID=e.readUint32();var n=e.readUint8();switch(s.padding_flag=n>>7,s.assignment_type=127&n,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:t.warn("BoxParser","Unknown leva assignement type")}}})),c.createBoxCtor("lhvC",(function(e){var t,i,r;this.configurationVersion=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),r=e.readUint8(),this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t<s;t++){var n=[];this.nalu_arrays.push(n),r=e.readUint8(),n.completeness=(128&r)>>7,n.nalu_type=63&r;var a=e.readUint16();for(i=0;i<a;i++){var o={};n.push(o);var c=e.readUint16();o.data=e.readUint8Array(c)}}})),c.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),c.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),l.prototype.toString=function(){return"("+this.x+","+this.y+")"},c.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new l(e.readUint16(),e.readUint16()),this.display_primaries[1]=new l(e.readUint16(),e.readUint16()),this.display_primaries[2]=new l(e.readUint16(),e.readUint16()),this.white_point=new l(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),c.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),c.createFullBoxCtor("mehd",(function(e){1&this.flags&&(t.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),c.createFullBoxCtor("meta",(function(e){this.boxes=[],c.ContainerBox.prototype.parse.call(this,e)})),c.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),c.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),c.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),c.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),c.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),c.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),c.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i<Math.floor((t+1)/2);i++)this.padbits=e.readUint8()})),c.createBoxCtor("pasp",(function(e){this.hSpacing=e.readUint32(),this.vSpacing=e.readUint32()})),c.createBoxCtor("payl",(function(e){this.text=e.readString(this.size-this.hdr_size)})),c.createBoxCtor("payt",(function(e){this.payloadID=e.readUint32();var t=e.readUint8();this.rtpmap_string=e.readString(t)})),c.createFullBoxCtor("pdin",(function(e){var t=(this.size-this.hdr_size)/8;this.rate=[],this.initial_delay=[];for(var i=0;i<t;i++)this.rate[i]=e.readUint32(),this.initial_delay[i]=e.readUint32()})),c.createFullBoxCtor("pitm",(function(e){0===this.version?this.item_id=e.readUint16():this.item_id=e.readUint32()})),c.createFullBoxCtor("pixi",(function(e){var t;for(this.num_channels=e.readUint8(),this.bits_per_channels=[],t=0;t<this.num_channels;t++)this.bits_per_channels[t]=e.readUint8()})),c.createBoxCtor("pmax",(function(e){this.bytes=e.readUint32()})),c.createFullBoxCtor("prdi",(function(e){if(this.step_count=e.readUint16(),this.item_count=[],2&this.flags)for(var t=0;t<this.step_count;t++)this.item_count[t]=e.readUint16()})),c.createFullBoxCtor("prft",(function(e){this.ref_track_id=e.readUint32(),this.ntp_timestamp=e.readUint64(),0===this.version?this.media_time=e.readUint32():this.media_time=e.readUint64()})),c.createFullBoxCtor("pssh",(function(e){if(this.system_id=c.parseHex16(e),this.version>0){var t=e.readUint32();this.kid=[];for(var i=0;i<t;i++)this.kid[i]=c.parseHex16(e)}var r=e.readUint32();r>0&&(this.data=e.readUint8Array(r))})),c.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),c.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),c.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),c.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),c.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),c.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i<t;i++)0===this.version?this.offset[i]=e.readUint32():this.offset[i]=e.readUint64()})),c.createFullBoxCtor("saiz",(function(e){if(1&this.flags&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32()),this.default_sample_info_size=e.readUint8(),this.sample_count=e.readUint32(),this.sample_info_size=[],0===this.default_sample_info_size)for(var t=0;t<this.sample_count;t++)this.sample_info_size[t]=e.readUint8()})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,"mett",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,"metx",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,"sbtt",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,"stpp",(function(e){this.parseHeader(e),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.auxiliary_mime_types=e.readCString(),this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,"stxt",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE,"tx3g",(function(e){this.parseHeader(e),this.displayFlags=e.readUint32(),this.horizontal_justification=e.readInt8(),this.vertical_justification=e.readInt8(),this.bg_color_rgba=e.readUint8Array(4),this.box_record=e.readInt16Array(4),this.style_record=e.readUint8Array(12),this.parseFooter(e)})),c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA,"wvtt",(function(e){this.parseHeader(e),this.parseFooter(e)})),c.createSampleGroupCtor("alst",(function(e){var t,i=e.readUint16();for(this.first_output_sample=e.readUint16(),this.sample_offset=[],t=0;t<i;t++)this.sample_offset[t]=e.readUint32();var r=this.description_length-4-4*i;for(this.num_output_samples=[],this.num_total_samples=[],t=0;t<r/4;t++)this.num_output_samples[t]=e.readUint16(),this.num_total_samples[t]=e.readUint16()})),c.createSampleGroupCtor("avll",(function(e){this.layerNumber=e.readUint8(),this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()})),c.createSampleGroupCtor("avss",(function(e){this.subSequenceIdentifier=e.readUint16(),this.layerNumber=e.readUint8();var t=e.readUint8();this.durationFlag=t>>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),r=0;r<i;r++){var s={};this.dependency.push(s),s.subSeqDirectionFlag=e.readUint8(),s.layerNumber=e.readUint8(),s.subSequenceIdentifier=e.readUint16()}})),c.createSampleGroupCtor("dtrt",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("mvif",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("prol",(function(e){this.roll_distance=e.readInt16()})),c.createSampleGroupCtor("rap ",(function(e){var t=e.readUint8();this.num_leading_samples_known=t>>7,this.num_leading_samples=127&t})),c.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)t.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var i=0;i<this.operation_point_count;i++)this.available_bitrate[i]=e.readUint32(),this.target_rate_share[i]=e.readUint16()}this.maximum_bitrate=e.readUint32(),this.minimum_bitrate=e.readUint32(),this.discard_priority=e.readUint8()}})),c.createSampleGroupCtor("roll",(function(e){this.roll_distance=e.readInt16()})),c.SampleGroupEntry.prototype.parse=function(e){t.warn("BoxParser","Unknown Sample Group type: "+this.grouping_type),this.data=e.readUint8Array(this.description_length)},c.createSampleGroupCtor("scif",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("scnm",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("seig",(function(e){this.reserved=e.readUint8();var t=e.readUint8();this.crypt_byte_block=t>>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=c.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),c.createSampleGroupCtor("stsa",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),c.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),c.createSampleGroupCtor("tsas",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("tscl",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createSampleGroupCtor("vipr",(function(e){t.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),c.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i<t;i++){var r={};this.entries.push(r),r.sample_count=e.readInt32(),r.group_description_index=e.readInt32()}})),u.prototype.toString=function(){return"[row: "+this.bad_pixel_row+", column: "+this.bad_pixel_column+"]"},c.createFullBoxCtor("sbpm",(function(e){var t;for(this.component_count=e.readUint16(),this.component_index=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16());var i=e.readUint8();for(this.correction_applied=!(128&~i),this.num_bad_rows=e.readUint32(),this.num_bad_cols=e.readUint32(),this.num_bad_pixels=e.readUint32(),this.bad_rows=[],this.bad_columns=[],this.bad_pixels=[],t=0;t<this.num_bad_rows;t++)this.bad_rows.push(e.readUint32());for(t=0;t<this.num_bad_cols;t++)this.bad_columns.push(e.readUint32());for(t=0;t<this.num_bad_pixels;t++){var r=e.readUint32(),s=e.readUint32();this.bad_pixels.push(new u(r,s))}})),c.createFullBoxCtor("schm",(function(e){this.scheme_type=e.readString(4),this.scheme_version=e.readUint32(),1&this.flags&&(this.scheme_uri=e.readString(this.size-this.hdr_size-8))})),c.createBoxCtor("sdp ",(function(e){this.sdptext=e.readString(this.size-this.hdr_size)})),c.createFullBoxCtor("sdtp",(function(e){var t,i=this.size-this.hdr_size;this.is_leading=[],this.sample_depends_on=[],this.sample_is_depended_on=[],this.sample_has_redundancy=[];for(var r=0;r<i;r++)t=e.readUint8(),this.is_leading[r]=t>>6,this.sample_depends_on[r]=t>>4&3,this.sample_is_depended_on[r]=t>>2&3,this.sample_has_redundancy[r]=3&t})),c.createFullBoxCtor("senc"),c.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),t.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var i=e.readUint32(),r=0;r<i;r++){var s;s=c[this.grouping_type+"SampleGroupEntry"]?new c[this.grouping_type+"SampleGroupEntry"](this.grouping_type):new c.SampleGroupEntry(this.grouping_type),this.entries.push(s),1===this.version&&0===this.default_length?s.description_length=e.readUint32():s.description_length=this.default_length,s.write===c.SampleGroupEntry.prototype.write&&(t.info("BoxParser","SampleGroup for type "+this.grouping_type+" writing not yet implemented, keeping unparsed data in memory for later write"),s.data=e.readUint8Array(s.description_length),e.position-=s.description_length),s.parse(e)}})),c.createFullBoxCtor("sidx",(function(e){this.reference_ID=e.readUint32(),this.timescale=e.readUint32(),0===this.version?(this.earliest_presentation_time=e.readUint32(),this.first_offset=e.readUint32()):(this.earliest_presentation_time=e.readUint64(),this.first_offset=e.readUint64()),e.readUint16(),this.references=[];for(var t=e.readUint16(),i=0;i<t;i++){var r={};this.references.push(r);var s=e.readUint32();r.reference_type=s>>31&1,r.referenced_size=2147483647&s,r.subsegment_duration=e.readUint32(),s=e.readUint32(),r.starts_with_SAP=s>>31&1,r.SAP_type=s>>28&7,r.SAP_delta_time=268435455&s}})),c.SingleItemTypeReferenceBox=function(e,t,i,r){c.Box.call(this,e,t),this.hdr_size=i,this.start=r},c.SingleItemTypeReferenceBox.prototype=new c.Box,c.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i<t;i++)this.references[i]={},this.references[i].to_item_ID=e.readUint16()},c.SingleItemTypeReferenceBoxLarge=function(e,t,i,r){c.Box.call(this,e,t),this.hdr_size=i,this.start=r},c.SingleItemTypeReferenceBoxLarge.prototype=new c.Box,c.SingleItemTypeReferenceBoxLarge.prototype.parse=function(e){this.from_item_ID=e.readUint32();var t=e.readUint16();this.references=[];for(var i=0;i<t;i++)this.references[i]={},this.references[i].to_item_ID=e.readUint32()},c.createFullBoxCtor("SmDm",(function(e){this.primaryRChromaticity_x=e.readUint16(),this.primaryRChromaticity_y=e.readUint16(),this.primaryGChromaticity_x=e.readUint16(),this.primaryGChromaticity_y=e.readUint16(),this.primaryBChromaticity_x=e.readUint16(),this.primaryBChromaticity_y=e.readUint16(),this.whitePointChromaticity_x=e.readUint16(),this.whitePointChromaticity_y=e.readUint16(),this.luminanceMax=e.readUint32(),this.luminanceMin=e.readUint32()})),c.createFullBoxCtor("smhd",(function(e){this.balance=e.readUint16(),e.readUint16()})),c.createFullBoxCtor("ssix",(function(e){this.subsegments=[];for(var t=e.readUint32(),i=0;i<t;i++){var r={};this.subsegments.push(r),r.ranges=[];for(var s=e.readUint32(),n=0;n<s;n++){var a={};r.ranges.push(a),a.level=e.readUint8(),a.range_size=e.readUint24()}}})),c.createFullBoxCtor("stco",(function(e){var t;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(var i=0;i<t;i++)this.chunk_offsets.push(e.readUint32())})),c.createFullBoxCtor("stdp",(function(e){var t=(this.size-this.hdr_size)/2;this.priority=[];for(var i=0;i<t;i++)this.priority[i]=e.readUint16()})),c.createFullBoxCtor("sthd"),c.createFullBoxCtor("stri",(function(e){this.switch_group=e.readUint16(),this.alternate_group=e.readUint16(),this.sub_track_id=e.readUint32();var t=(this.size-this.hdr_size-8)/4;this.attribute_list=[];for(var i=0;i<t;i++)this.attribute_list[i]=e.readUint32()})),c.createFullBoxCtor("stsc",(function(e){var t,i;if(t=e.readUint32(),this.first_chunk=[],this.samples_per_chunk=[],this.sample_description_index=[],0===this.version)for(i=0;i<t;i++)this.first_chunk.push(e.readUint32()),this.samples_per_chunk.push(e.readUint32()),this.sample_description_index.push(e.readUint32())})),c.createFullBoxCtor("stsd",(function(e){var i,r,s,n;for(this.entries=[],s=e.readUint32(),i=1;i<=s;i++){if((r=c.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==c.OK)return;c[r.type+"SampleEntry"]?((n=new c[r.type+"SampleEntry"](r.size)).hdr_size=r.hdr_size,n.start=r.start):(t.warn("BoxParser","Unknown sample entry type: "+r.type),n=new c.SampleEntry(r.type,r.size,r.hdr_size,r.start)),n.write===c.SampleEntry.prototype.write&&(t.info("BoxParser","SampleEntry "+n.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),n.parseDataAndRewind(e)),n.parse(e),this.entries.push(n)}})),c.createFullBoxCtor("stsg",(function(e){this.grouping_type=e.readUint32();var t=e.readUint16();this.group_description_index=[];for(var i=0;i<t;i++)this.group_description_index[i]=e.readUint32()})),c.createFullBoxCtor("stsh",(function(e){var t,i;if(t=e.readUint32(),this.shadowed_sample_numbers=[],this.sync_sample_numbers=[],0===this.version)for(i=0;i<t;i++)this.shadowed_sample_numbers.push(e.readUint32()),this.sync_sample_numbers.push(e.readUint32())})),c.createFullBoxCtor("stss",(function(e){var t,i;if(i=e.readUint32(),0===this.version)for(this.sample_numbers=[],t=0;t<i;t++)this.sample_numbers.push(e.readUint32())})),c.createFullBoxCtor("stsz",(function(e){var t;if(this.sample_sizes=[],0===this.version)for(this.sample_size=e.readUint32(),this.sample_count=e.readUint32(),t=0;t<this.sample_count;t++)0===this.sample_size?this.sample_sizes.push(e.readUint32()):this.sample_sizes[t]=this.sample_size})),c.createFullBoxCtor("stts",(function(e){var i,r,s;if(i=e.readUint32(),this.sample_counts=[],this.sample_deltas=[],0===this.version)for(r=0;r<i;r++)this.sample_counts.push(e.readUint32()),(s=e.readInt32())<0&&(t.warn("BoxParser","File uses negative stts sample delta, using value 1 instead, sync may be lost!"),s=1),this.sample_deltas.push(s)})),c.createFullBoxCtor("stvi",(function(e){var t=e.readUint32();this.single_view_allowed=3&t,this.stereo_scheme=e.readUint32();var i,r,s=e.readUint32();for(this.stereo_indication_type=e.readString(s),this.boxes=[];e.getPosition()<this.start+this.size;){if((i=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==c.OK)return;r=i.box,this.boxes.push(r),this[r.type]=r}})),c.createBoxCtor("styp",(function(e){c.ftypBox.prototype.parse.call(this,e)})),c.createFullBoxCtor("stz2",(function(e){var i,r;if(this.sample_sizes=[],0===this.version)if(this.reserved=e.readUint24(),this.field_size=e.readUint8(),r=e.readUint32(),4===this.field_size)for(i=0;i<r;i+=2){var s=e.readUint8();this.sample_sizes[i]=s>>4&15,this.sample_sizes[i+1]=15&s}else if(8===this.field_size)for(i=0;i<r;i++)this.sample_sizes[i]=e.readUint8();else if(16===this.field_size)for(i=0;i<r;i++)this.sample_sizes[i]=e.readUint16();else t.error("BoxParser","Error in length field in stz2 box")})),c.createFullBoxCtor("subs",(function(e){var t,i,r,s;for(r=e.readUint32(),this.entries=[],t=0;t<r;t++){var n={};if(this.entries[t]=n,n.sample_delta=e.readUint32(),n.subsamples=[],(s=e.readUint16())>0)for(i=0;i<s;i++){var a={};n.subsamples.push(a),1==this.version?a.size=e.readUint32():a.size=e.readUint16(),a.priority=e.readUint8(),a.discardable=e.readUint8(),a.codec_specific_parameters=e.readUint32()}}})),c.createFullBoxCtor("tenc",(function(e){if(e.readUint8(),0===this.version)e.readUint8();else{var t=e.readUint8();this.default_crypt_byte_block=t>>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=c.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),c.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),c.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&c.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),c.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),r=0;r<i;r++)1===this.version?(this.time=e.readUint64(),this.moof_offset=e.readUint64()):(this.time=e.readUint32(),this.moof_offset=e.readUint32()),this.traf_number=e["readUint"+8*(this.length_size_of_traf_num+1)](),this.trun_number=e["readUint"+8*(this.length_size_of_trun_num+1)](),this.sample_number=e["readUint"+8*(this.length_size_of_sample_num+1)]()})),c.createFullBoxCtor("tkhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint32()),e.readUint32Array(2),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),c.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),c.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),c.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),c.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),c.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),c.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},c.createTrackGroupCtor("msrc"),c.TrackReferenceTypeBox=function(e,t,i,r){c.Box.call(this,e,t),this.hdr_size=i,this.start=r},c.TrackReferenceTypeBox.prototype=new c.Box,c.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},c.trefBox.prototype.parse=function(e){for(var i,r;e.getPosition()<this.start+this.size;){if((i=c.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==c.OK)return;(r=new c.TrackReferenceTypeBox(i.type,i.size,i.hdr_size,i.start)).write===c.Box.prototype.write&&"mdat"!==r.type&&(t.info("BoxParser","TrackReference "+r.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),this.boxes.push(r)}},c.createFullBoxCtor("trep",(function(e){for(this.track_ID=e.readUint32(),this.boxes=[];e.getPosition()<this.start+this.size;){if(ret=c.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),ret.code!==c.OK)return;box=ret.box,this.boxes.push(box)}})),c.createFullBoxCtor("trex",(function(e){this.track_id=e.readUint32(),this.default_sample_description_index=e.readUint32(),this.default_sample_duration=e.readUint32(),this.default_sample_size=e.readUint32(),this.default_sample_flags=e.readUint32()})),c.createBoxCtor("trpy",(function(e){this.bytessent=e.readUint64()})),c.createFullBoxCtor("trun",(function(e){var t=0;if(this.sample_count=e.readUint32(),t+=4,this.size-this.hdr_size>t&&this.flags&c.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&c.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i<this.sample_count;i++)this.flags&c.TRUN_FLAGS_DURATION&&(this.sample_duration[i]=e.readUint32()),this.flags&c.TRUN_FLAGS_SIZE&&(this.sample_size[i]=e.readUint32()),this.flags&c.TRUN_FLAGS_FLAGS&&(this.sample_flags[i]=e.readUint32()),this.flags&c.TRUN_FLAGS_CTS_OFFSET&&(0===this.version?this.sample_composition_time_offset[i]=e.readUint32():this.sample_composition_time_offset[i]=e.readInt32())})),c.createFullBoxCtor("tsel",(function(e){this.switch_group=e.readUint32();var t=(this.size-this.hdr_size-4)/4;this.attribute_list=[];for(var i=0;i<t;i++)this.attribute_list[i]=e.readUint32()})),c.createFullBoxCtor("txtC",(function(e){this.config=e.readCString()})),c.createBoxCtor("tyco",(function(e){var t=(this.size-this.hdr_size)/4;this.compatible_brands=[];for(var i=0;i<t;i++)this.compatible_brands[i]=e.readString(4)})),c.createFullBoxCtor("udes",(function(e){this.lang=e.readCString(),this.name=e.readCString(),this.description=e.readCString(),this.tags=e.readCString()})),c.createFullBoxCtor("uncC",(function(e){var t;if(this.profile=e.readUint32(),1==this.version);else if(0==this.version){for(this.component_count=e.readUint32(),this.component_index=[],this.component_bit_depth_minus_one=[],this.component_format=[],this.component_align_size=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16()),this.component_bit_depth_minus_one.push(e.readUint8()),this.component_format.push(e.readUint8()),this.component_align_size.push(e.readUint8());this.sampling_type=e.readUint8(),this.interleave_type=e.readUint8(),this.block_size=e.readUint8();var i=e.readUint8();this.component_little_endian=i>>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),c.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),c.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),c.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")})),c.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=c.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),c.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),c.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=c.parseHex16(e)})),c.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t<this.fragment_count;t++){var i={},r=0,s=0;1===this.version?(r=e.readUint64(),s=e.readUint64()):(r=e.readUint32(),s=e.readUint32()),i.absolute_time=r,i.absolute_duration=s,this.entries.push(i)}})),c.createUUIDBox("6d1d9b0542d544e680e2141daff757b2",!0,!1,(function(e){1===this.version?(this.absolute_time=e.readUint64(),this.duration=e.readUint64()):(this.absolute_time=e.readUint32(),this.duration=e.readUint32())})),c.createFullBoxCtor("vmhd",(function(e){this.graphicsmode=e.readUint16(),this.opcolor=e.readUint16Array(3)})),c.createFullBoxCtor("vpcC",(function(e){var t;1===this.version?(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),c.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),c.createFullBoxCtor("vvcC",(function(e){var t,i,r={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<<e)-1;return this.num_held_bits-=e,t}};if(r.stream_read_1_bytes(e),r.extract_bits(5),this.lengthSizeMinusOne=r.extract_bits(2),this.ptl_present_flag=r.extract_bits(1),this.ptl_present_flag){if(r.stream_read_2_bytes(e),this.ols_idx=r.extract_bits(9),this.num_sublayers=r.extract_bits(3),this.constant_frame_rate=r.extract_bits(2),this.chroma_format_idc=r.extract_bits(2),r.stream_read_1_bytes(e),this.bit_depth_minus8=r.extract_bits(3),r.extract_bits(5),r.stream_read_2_bytes(e),r.extract_bits(2),this.num_bytes_constraint_info=r.extract_bits(6),this.general_profile_idc=r.extract_bits(7),this.general_tier_flag=r.extract_bits(1),this.general_level_idc=e.readUint8(),r.stream_read_1_bytes(e),this.ptl_frame_only_constraint_flag=r.extract_bits(1),this.ptl_multilayer_enabled_flag=r.extract_bits(1),this.general_constraint_info=new Uint8Array(this.num_bytes_constraint_info),this.num_bytes_constraint_info){for(t=0;t<this.num_bytes_constraint_info-1;t++){var s=r.extract_bits(6);r.stream_read_1_bytes(e);var n=r.extract_bits(2);this.general_constraint_info[t]=s<<2|n}this.general_constraint_info[this.num_bytes_constraint_info-1]=r.extract_bits(6)}else r.extract_bits(6);if(this.num_sublayers>1){for(r.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var a=r.extract_bits(1);this.ptl_sublayer_present_mask|=a<<i}for(i=this.num_sublayers;i<=8&&this.num_sublayers>1;++i)r.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<<i&&(this.sublayer_level_idc[i]=e.readUint8())}if(this.ptl_num_sub_profiles=e.readUint8(),this.general_sub_profile_idc=[],this.ptl_num_sub_profiles)for(t=0;t<this.ptl_num_sub_profiles;t++)this.general_sub_profile_idc.push(e.readUint32());this.max_picture_width=e.readUint16(),this.max_picture_height=e.readUint16(),this.avg_frame_rate=e.readUint16()}this.nalu_arrays=[];var o=e.readUint8();for(t=0;t<o;t++){var c=[];this.nalu_arrays.push(c),r.stream_read_1_bytes(e),c.completeness=r.extract_bits(1),r.extract_bits(2),c.nalu_type=r.extract_bits(5);var l=1;for(13!=c.nalu_type&&12!=c.nalu_type&&(l=e.readUint16()),i=0;i<l;i++){var u=e.readUint16();c.push({data:e.readUint8Array(u),length:u})}}})),c.createFullBoxCtor("vvnC",(function(e){var t=strm.readUint8();this.lengthSizeMinusOne=3&t})),c.SampleEntry.prototype.isVideo=function(){return!1},c.SampleEntry.prototype.isAudio=function(){return!1},c.SampleEntry.prototype.isSubtitle=function(){return!1},c.SampleEntry.prototype.isMetadata=function(){return!1},c.SampleEntry.prototype.isHint=function(){return!1},c.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},c.SampleEntry.prototype.getWidth=function(){return""},c.SampleEntry.prototype.getHeight=function(){return""},c.SampleEntry.prototype.getChannelCount=function(){return""},c.SampleEntry.prototype.getSampleRate=function(){return""},c.SampleEntry.prototype.getSampleSize=function(){return""},c.VisualSampleEntry.prototype.isVideo=function(){return!0},c.VisualSampleEntry.prototype.getWidth=function(){return this.width},c.VisualSampleEntry.prototype.getHeight=function(){return this.height},c.AudioSampleEntry.prototype.isAudio=function(){return!0},c.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},c.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},c.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},c.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},c.MetadataSampleEntry.prototype.isMetadata=function(){return!0},c.decimalToHex=function(e,t){var i=Number(e).toString(16);for(t=null==t?t=2:t;i.length<t;)i="0"+i;return i},c.avc1SampleEntry.prototype.getCodec=c.avc2SampleEntry.prototype.getCodec=c.avc3SampleEntry.prototype.getCodec=c.avc4SampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this);return this.avcC?e+"."+c.decimalToHex(this.avcC.AVCProfileIndication)+c.decimalToHex(this.avcC.profile_compatibility)+c.decimalToHex(this.avcC.AVCLevelIndication):e},c.hev1SampleEntry.prototype.getCodec=c.hvc1SampleEntry.prototype.getCodec=function(){var e,t=c.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){switch(t+=".",this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C"}t+=this.hvcC.general_profile_idc,t+=".";var i=this.hvcC.general_profile_compatibility,r=0;for(e=0;e<32&&(r|=1&i,31!=e);e++)r<<=1,i>>=1;t+=c.decimalToHex(r,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,n="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(n="."+c.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+n,s=!0);t+=n}return t},c.vvc1SampleEntry.prototype.getCodec=c.vvi1SampleEntry.prototype.getCodec=function(){var e,t=c.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var r,s=[],n=0;for(n|=this.vvcC.ptl_frame_only_constraint<<7,n|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e<this.vvcC.general_constraint_info.length;++e)n|=this.vvcC.general_constraint_info[e]>>2&63,s.push(n),n&&(r=e),n=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===r)i=".CA";else{i=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,l=0;for(e=0;e<=r;++e)for(o=o<<8|s[e],l+=8;l>=5;){i+=a[o>>l-5&31],o&=(1<<(l-=5))-1}l&&(i+=a[31&(o<<=5-l)])}}t+=i}return t},c.mp4aSampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+c.decimalToHex(t)+(i?"."+i:"")}return e},c.stxtSampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},c.vp08SampleEntry.prototype.getCodec=c.vp09SampleEntry.prototype.getCodec=function(){var e=c.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},c.av01SampleEntry.prototype.getCodec=function(){var e,t=c.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},c.Box.prototype.writeHeader=function(e,i){this.size+=8,this.size>n&&(this.size+=8),"uuid"===this.type&&(this.size+=16),t.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(i||"")),this.size>n?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>n&&e.writeUint64(this.size)},c.FullBox.prototype.writeHeader=function(e){this.size+=4,c.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},c.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},c.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var i=0;i<this.boxes.length;i++)this.boxes[i]&&(this.boxes[i].write(e),this.size+=this.boxes[i].size);t.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},c.TrackReferenceTypeBox.prototype.write=function(e){this.size=4*this.track_ids.length,this.writeHeader(e),e.writeUint32Array(this.track_ids)},c.avcCBox.prototype.write=function(e){var t;for(this.size=7,t=0;t<this.SPS.length;t++)this.size+=2+this.SPS[t].length;for(t=0;t<this.PPS.length;t++)this.size+=2+this.PPS[t].length;for(this.ext&&(this.size+=this.ext.length),this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8(this.AVCProfileIndication),e.writeUint8(this.profile_compatibility),e.writeUint8(this.AVCLevelIndication),e.writeUint8(this.lengthSizeMinusOne+252),e.writeUint8(this.SPS.length+224),t=0;t<this.SPS.length;t++)e.writeUint16(this.SPS[t].length),e.writeUint8Array(this.SPS[t].nalu);for(e.writeUint8(this.PPS.length),t=0;t<this.PPS.length;t++)e.writeUint16(this.PPS[t].length),e.writeUint8Array(this.PPS[t].nalu);this.ext&&e.writeUint8Array(this.ext)},c.co64Box.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),t=0;t<this.chunk_offsets.length;t++)e.writeUint64(this.chunk_offsets[t])},c.cslgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeInt32(this.compositionToDTSShift),e.writeInt32(this.leastDecodeToDisplayDelta),e.writeInt32(this.greatestDecodeToDisplayDelta),e.writeInt32(this.compositionStartTime),e.writeInt32(this.compositionEndTime)},c.cttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),1===this.version?e.writeInt32(this.sample_offsets[t]):e.writeUint32(this.sample_offsets[t])},c.drefBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.entries.length);for(var i=0;i<this.entries.length;i++)this.entries[i].write(e),this.size+=this.entries[i].size;t.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},c.elngBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.extended_language.length,this.writeHeader(e),e.writeString(this.extended_language)},c.elstBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+12*this.entries.length,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var i=this.entries[t];e.writeUint32(i.segment_duration),e.writeInt32(i.media_time),e.writeInt16(i.media_rate_integer),e.writeInt16(i.media_rate_fraction)}},c.emsgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=16+this.message_data.length+(this.scheme_id_uri.length+1)+(this.value.length+1),this.writeHeader(e),e.writeCString(this.scheme_id_uri),e.writeCString(this.value),e.writeUint32(this.timescale),e.writeUint32(this.presentation_time_delta),e.writeUint32(this.event_duration),e.writeUint32(this.id),e.writeUint8Array(this.message_data)},c.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length,this.writeHeader(e),e.writeString(this.major_brand,null,4),e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++)e.writeString(this.compatible_brands[t],null,4)},c.hdlrBox.prototype.write=function(e){this.size=20+this.name.length+1,this.version=0,this.flags=0,this.writeHeader(e),e.writeUint32(0),e.writeString(this.handler,null,4),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeCString(this.name)},c.hvcCBox.prototype.write=function(e){var t,i;for(this.size=23,t=0;t<this.nalu_arrays.length;t++)for(this.size+=3,i=0;i<this.nalu_arrays[t].length;i++)this.size+=2+this.nalu_arrays[t][i].data.length;for(this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8((this.general_profile_space<<6)+(this.general_tier_flag<<5)+this.general_profile_idc),e.writeUint32(this.general_profile_compatibility),e.writeUint8Array(this.general_constraint_indicator),e.writeUint8(this.general_level_idc),e.writeUint16(this.min_spatial_segmentation_idc+(15<<24)),e.writeUint8(this.parallelismType+252),e.writeUint8(this.chroma_format_idc+252),e.writeUint8(this.bit_depth_luma_minus8+248),e.writeUint8(this.bit_depth_chroma_minus8+248),e.writeUint16(this.avgFrameRate),e.writeUint8((this.constantFrameRate<<6)+(this.numTemporalLayers<<3)+(this.temporalIdNested<<2)+this.lengthSizeMinusOne),e.writeUint8(this.nalu_arrays.length),t=0;t<this.nalu_arrays.length;t++)for(e.writeUint8((this.nalu_arrays[t].completeness<<7)+this.nalu_arrays[t].nalu_type),e.writeUint16(this.nalu_arrays[t].length),i=0;i<this.nalu_arrays[t].length;i++)e.writeUint16(this.nalu_arrays[t][i].data.length),e.writeUint8Array(this.nalu_arrays[t][i].data)},c.kindBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.schemeURI.length+1+(this.value.length+1),this.writeHeader(e),e.writeCString(this.schemeURI),e.writeCString(this.value)},c.mdhdBox.prototype.write=function(e){this.size=20,this.flags=0,this.version=0,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint16(this.language),e.writeUint16(0)},c.mehdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.fragment_duration)},c.mfhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.sequence_number)},c.mvhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=96,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint32(this.rate),e.writeUint16(this.volume<<8),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32Array(this.matrix),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(this.next_track_id)},c.SampleEntry.prototype.writeHeader=function(e){this.size=8,c.Box.prototype.writeHeader.call(this,e),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint16(this.data_reference_index)},c.SampleEntry.prototype.writeFooter=function(e){for(var i=0;i<this.boxes.length;i++)this.boxes[i].write(e),this.size+=this.boxes[i].size;t.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},c.SampleEntry.prototype.write=function(e){this.writeHeader(e),e.writeUint8Array(this.data),this.size+=this.data.length,t.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},c.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=70,e.writeUint16(0),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.width),e.writeUint16(this.height),e.writeUint32(this.horizresolution),e.writeUint32(this.vertresolution),e.writeUint32(0),e.writeUint16(this.frame_count),e.writeUint8(Math.min(31,this.compressorname.length)),e.writeString(this.compressorname,null,31),e.writeUint16(this.depth),e.writeInt16(-1),this.writeFooter(e)},c.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=20,e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.channel_count),e.writeUint16(this.samplesize),e.writeUint16(0),e.writeUint16(0),e.writeUint32(this.samplerate<<16),this.writeFooter(e)},c.stppSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=this.namespace.length+1+this.schema_location.length+1+this.auxiliary_mime_types.length+1,e.writeCString(this.namespace),e.writeCString(this.schema_location),e.writeCString(this.auxiliary_mime_types),this.writeFooter(e)},c.SampleGroupEntry.prototype.write=function(e){e.writeUint8Array(this.data)},c.sbgpBox.prototype.write=function(e){this.version=1,this.flags=0,this.size=12+8*this.entries.length,this.writeHeader(e),e.writeString(this.grouping_type,null,4),e.writeUint32(this.grouping_type_parameter),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var i=this.entries[t];e.writeInt32(i.sample_count),e.writeInt32(i.group_description_index)}},c.sgpdBox.prototype.write=function(e){var t,i;for(this.flags=0,this.size=12,t=0;t<this.entries.length;t++)i=this.entries[t],1===this.version&&(0===this.default_length&&(this.size+=4),this.size+=i.data.length);for(this.writeHeader(e),e.writeString(this.grouping_type,null,4),1===this.version&&e.writeUint32(this.default_length),this.version>=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t<this.entries.length;t++)i=this.entries[t],1===this.version&&0===this.default_length&&e.writeUint32(i.description_length),i.write(e)},c.sidxBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20+12*this.references.length,this.writeHeader(e),e.writeUint32(this.reference_ID),e.writeUint32(this.timescale),e.writeUint32(this.earliest_presentation_time),e.writeUint32(this.first_offset),e.writeUint16(0),e.writeUint16(this.references.length);for(var t=0;t<this.references.length;t++){var i=this.references[t];e.writeUint32(i.reference_type<<31|i.referenced_size),e.writeUint32(i.subsegment_duration),e.writeUint32(i.starts_with_SAP<<31|i.SAP_type<<28|i.SAP_delta_time)}},c.smhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=4,this.writeHeader(e),e.writeUint16(this.balance),e.writeUint16(0)},c.stcoBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),e.writeUint32Array(this.chunk_offsets)},c.stscBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+12*this.first_chunk.length,this.writeHeader(e),e.writeUint32(this.first_chunk.length),t=0;t<this.first_chunk.length;t++)e.writeUint32(this.first_chunk[t]),e.writeUint32(this.samples_per_chunk[t]),e.writeUint32(this.sample_description_index[t])},c.stsdBox.prototype.write=function(e){var i;for(this.version=0,this.flags=0,this.size=0,this.writeHeader(e),e.writeUint32(this.entries.length),this.size+=4,i=0;i<this.entries.length;i++)this.entries[i].write(e),this.size+=this.entries[i].size;t.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},c.stshBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.shadowed_sample_numbers.length,this.writeHeader(e),e.writeUint32(this.shadowed_sample_numbers.length),t=0;t<this.shadowed_sample_numbers.length;t++)e.writeUint32(this.shadowed_sample_numbers[t]),e.writeUint32(this.sync_sample_numbers[t])},c.stssBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.sample_numbers.length,this.writeHeader(e),e.writeUint32(this.sample_numbers.length),e.writeUint32Array(this.sample_numbers)},c.stszBox.prototype.write=function(e){var t,i=!0;if(this.version=0,this.flags=0,this.sample_sizes.length>0)for(t=0;t+1<this.sample_sizes.length;){if(this.sample_sizes[t+1]!==this.sample_sizes[0]){i=!1;break}t++}else i=!1;this.size=8,i||(this.size+=4*this.sample_sizes.length),this.writeHeader(e),i?e.writeUint32(this.sample_sizes[0]):e.writeUint32(0),e.writeUint32(this.sample_sizes.length),i||e.writeUint32Array(this.sample_sizes)},c.sttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),e.writeUint32(this.sample_deltas[t])},c.tfdtBox.prototype.write=function(e){var t=Math.pow(2,32)-1;this.version=this.baseMediaDecodeTime>t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},c.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&c.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&c.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&c.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&c.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&c.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&c.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&c.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&c.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&c.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&c.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},c.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},c.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},c.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&c.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&c.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&c.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&c.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&c.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&c.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&c.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&c.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t<this.sample_count;t++)this.flags&c.TRUN_FLAGS_DURATION&&e.writeUint32(this.sample_duration[t]),this.flags&c.TRUN_FLAGS_SIZE&&e.writeUint32(this.sample_size[t]),this.flags&c.TRUN_FLAGS_FLAGS&&e.writeUint32(this.sample_flags[t]),this.flags&c.TRUN_FLAGS_CTS_OFFSET&&(0===this.version?e.writeUint32(this.sample_composition_time_offset[t]):e.writeInt32(this.sample_composition_time_offset[t]))},c["url Box"].prototype.write=function(e){this.version=0,this.location?(this.flags=0,this.size=this.location.length+1):(this.flags=1,this.size=0),this.writeHeader(e),this.location&&e.writeCString(this.location)},c["urn Box"].prototype.write=function(e){this.version=0,this.flags=0,this.size=this.name.length+1+(this.location?this.location.length+1:0),this.writeHeader(e),e.writeCString(this.name),this.location&&e.writeCString(this.location)},c.vmhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=8,this.writeHeader(e),e.writeUint16(this.graphicsmode),e.writeUint16Array(this.opcolor)},c.cttsBox.prototype.unpack=function(e){var t,i,r;for(r=0,t=0;t<this.sample_counts.length;t++)for(i=0;i<this.sample_counts[t];i++)e[r].pts=e[r].dts+this.sample_offsets[t],r++},c.sttsBox.prototype.unpack=function(e){var t,i,r;for(r=0,t=0;t<this.sample_counts.length;t++)for(i=0;i<this.sample_counts[t];i++)e[r].dts=0===r?0:e[r-1].dts+this.sample_deltas[t],r++},c.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++)e[t].offset=this.chunk_offsets[t]},c.stscBox.prototype.unpack=function(e){var t,i,r,s,n;for(s=0,n=0,t=0;t<this.first_chunk.length;t++)for(i=0;i<(t+1<this.first_chunk.length?this.first_chunk[t+1]:1/0);i++)for(n++,r=0;r<this.samples_per_chunk[t];r++){if(!e[s])return;e[s].description_index=this.sample_description_index[t],e[s].chunk_index=n,s++}},c.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++)e[t].size=this.sample_sizes[t]},c.DIFF_BOXES_PROP_NAMES=["boxes","entries","references","subsamples","items","item_infos","extents","associations","subsegments","ranges","seekLists","seekPoints","esd","levels"],c.DIFF_PRIMITIVE_ARRAY_PROP_NAMES=["compatible_brands","matrix","opcolor","sample_counts","sample_counts","sample_deltas","first_chunk","samples_per_chunk","sample_sizes","chunk_offsets","sample_offsets","sample_description_index","sample_duration"],c.boxEqualFields=function(e,t){if(e&&!t)return!1;var i;for(i in e)if(!(c.DIFF_BOXES_PROP_NAMES.indexOf(i)>-1||e[i]instanceof c.Box||t[i]instanceof c.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||c.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},c.boxEqual=function(e,t){if(!c.boxEqualFields(e,t))return!1;for(var i=0;i<c.DIFF_BOXES_PROP_NAMES.length;i++){var r=c.DIFF_BOXES_PROP_NAMES[i];if(e[r]&&t[r]&&!c.boxEqual(e[r],t[r]))return!1}return!0};var d=function(){};d.prototype.parseSample=function(e){var t,i,s=new r(e.buffer);for(t=[];!s.isEos();)(i=c.parseOneBox(s,!1)).code===c.OK&&"vttc"===i.box.type&&t.push(i.box);return t},d.prototype.getText=function(e,t,i){function r(e,t,i){return i=i||"0",(e+="").length>=t?e:new Array(t-e.length+1).join(i)+e}function s(e){var t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i),n=Math.floor(1e3*(e-3600*t-60*i-s));return r(t,2)+":"+r(i,2)+":"+r(s,2)+"."+r(n,3)}for(var n=this.parseSample(i),a="",o=0;o<n.length;o++){var c=n[o];a+=s(e)+" --\x3e "+s(t)+"\r\n",a+=c.payl.text}return a};var p=function(){};p.prototype.parseSample=function(e){var t,i={};i.resources=[];var s=new r(e.data.buffer);if(e.subsamples&&0!==e.subsamples.length){if(i.documentString=s.readString(e.subsamples[0].size),e.subsamples.length>1)for(t=1;t<e.subsamples.length;t++)i.resources[t]=s.readUint8Array(e.subsamples[t].size)}else i.documentString=s.readString(e.data.length);return"undefined"!=typeof DOMParser&&(i.document=(new DOMParser).parseFromString(i.documentString,"application/xml")),i};var h=function(){};h.prototype.parseSample=function(e){return new r(e.data.buffer).readString(e.data.length)},h.prototype.parseConfig=function(e){var t=new r(e.buffer);return t.readUint32(),t.readCString()},void 0!==e&&(e.VTTin4Parser=d,e.XMLSubtitlein4Parser=p,e.Textin4Parser=h);var m=function(e){this.stream=e||new a,this.boxes=[],this.mdats=[],this.moofs=[],this.isProgressive=!1,this.moovStartFound=!1,this.onMoovStart=null,this.moovStartSent=!1,this.onReady=null,this.readySent=!1,this.onSegment=null,this.onSamples=null,this.onError=null,this.sampleListBuilt=!1,this.fragmentedTracks=[],this.extractedTracks=[],this.isFragmentationInitialized=!1,this.sampleProcessingStarted=!1,this.nextMoofNumber=0,this.itemListBuilt=!1,this.items=[],this.entity_groups=[],this.onSidx=null,this.sidxSent=!1};m.prototype.setSegmentOptions=function(e,t,i){var r=this.getTrackById(e);if(r){var s={};this.fragmentedTracks.push(s),s.id=e,s.user=t,s.trak=r,r.nextSample=0,s.segmentStream=null,s.nb_samples=1e3,s.rapAlignement=!0,i&&(i.nbSamples&&(s.nb_samples=i.nbSamples),i.rapAlignement&&(s.rapAlignement=i.rapAlignement))}},m.prototype.unsetSegmentOptions=function(e){for(var t=-1,i=0;i<this.fragmentedTracks.length;i++){this.fragmentedTracks[i].id==e&&(t=i)}t>-1&&this.fragmentedTracks.splice(t,1)},m.prototype.setExtractionOptions=function(e,t,i){var r=this.getTrackById(e);if(r){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=r,r.nextSample=0,s.nb_samples=1e3,s.samples=[],i&&i.nbSamples&&(s.nb_samples=i.nbSamples)}},m.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i<this.extractedTracks.length;i++){this.extractedTracks[i].id==e&&(t=i)}t>-1&&this.extractedTracks.splice(t,1)},m.prototype.parse=function(){var e,i;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=c.parseOneBox(this.stream,false)).code===c.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(i=e.box).type?i.type:i.uuid,this.boxes.push(i),r){case"mdat":this.mdats.push(i);break;case"moof":this.moofs.push(i);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&t.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=i}this.updateUsedBytes&&this.updateUsedBytes(i,e)}},m.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(t.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(t.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(t.warn("ISOFile","Not ready to start parsing"),!1))},m.prototype.appendBuffer=function(e,i){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(i),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(t.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),t.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},m.prototype.getInfo=function(){var e,t,i,r,s,n,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e<this.moov.traks.length;e++){if(n=(i=this.moov.traks[e]).mdia.minf.stbl.stsd.entries[0],r={},a.tracks.push(r),r.id=i.tkhd.track_id,r.name=i.mdia.hdlr.name,r.references=[],i.tref)for(t=0;t<i.tref.boxes.length;t++)s={},r.references.push(s),s.type=i.tref.boxes[t].type,s.track_ids=i.tref.boxes[t].track_ids;i.edts&&(r.edits=i.edts.elst.entries),r.created=new Date(o+1e3*i.tkhd.creation_time),r.modified=new Date(o+1e3*i.tkhd.modification_time),r.movie_duration=i.tkhd.duration,r.movie_timescale=a.timescale,r.layer=i.tkhd.layer,r.alternate_group=i.tkhd.alternate_group,r.volume=i.tkhd.volume,r.matrix=i.tkhd.matrix,r.track_width=i.tkhd.width/65536,r.track_height=i.tkhd.height/65536,r.timescale=i.mdia.mdhd.timescale,r.cts_shift=i.mdia.minf.stbl.cslg,r.duration=i.mdia.mdhd.duration,r.samples_duration=i.samples_duration,r.codec=n.getCodec(),r.kind=i.udta&&i.udta.kinds.length?i.udta.kinds[0]:{schemeURI:"",value:""},r.language=i.mdia.elng?i.mdia.elng.extended_language:i.mdia.mdhd.languageString,r.nb_samples=i.samples.length,r.size=i.samples_size,r.bitrate=8*r.size*r.timescale/r.samples_duration,n.isAudio()?(r.type="audio",a.audioTracks.push(r),r.audio={},r.audio.sample_rate=n.getSampleRate(),r.audio.channel_count=n.getChannelCount(),r.audio.sample_size=n.getSampleSize()):n.isVideo()?(r.type="video",a.videoTracks.push(r),r.video={},r.video.width=n.getWidth(),r.video.height=n.getHeight()):n.isSubtitle()?(r.type="subtitles",a.subtitleTracks.push(r)):n.isHint()?(r.type="metadata",a.hintTracks.push(r)):n.isMetadata()?(r.type="metadata",a.metadataTracks.push(r)):(r.type="metadata",a.otherTracks.push(r))}else a.hasMoov=!1;if(a.mime="",a.hasMoov&&a.tracks){for(a.videoTracks&&a.videoTracks.length>0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e<a.tracks.length;e++)0!==e&&(a.mime+=","),a.mime+=a.tracks[e].codec;a.mime+='"; profiles="',a.mime+=this.ftyp.compatible_brands.join(),a.mime+='"'}return a},m.prototype.setNextSeekPositionFromSample=function(e){e&&(this.nextSeekPosition?this.nextSeekPosition=Math.min(e.offset+e.alreadyRead,this.nextSeekPosition):this.nextSeekPosition=e.offset+e.alreadyRead)},m.prototype.processSamples=function(e){var i,r;if(this.sampleProcessingStarted){if(this.isFragmentationInitialized&&null!==this.onSegment)for(i=0;i<this.fragmentedTracks.length;i++){var s=this.fragmentedTracks[i];for(r=s.trak;r.nextSample<r.samples.length&&this.sampleProcessingStarted;){t.debug("ISOFile","Creating media fragment on track #"+s.id+" for sample "+r.nextSample);var n=this.createFragment(s.id,r.nextSample,s.segmentStream);if(!n)break;if(s.segmentStream=n,r.nextSample++,(r.nextSample%s.nb_samples==0||e||r.nextSample>=r.samples.length)&&(t.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,r.nextSample-s.nb_samples)+","+(r.nextSample-1)+"]"),t.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[i]))break}}if(null!==this.onSamples)for(i=0;i<this.extractedTracks.length;i++){var a=this.extractedTracks[i];for(r=a.trak;r.nextSample<r.samples.length&&this.sampleProcessingStarted;){t.debug("ISOFile","Exporting on track #"+a.id+" sample #"+r.nextSample);var o=this.getSample(r,r.nextSample);if(!o){this.setNextSeekPositionFromSample(r.samples[r.nextSample]);break}if(r.nextSample++,a.samples.push(o),(r.nextSample%a.nb_samples==0||r.nextSample>=r.samples.length)&&(t.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[i]))break}}}},m.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},m.prototype.getBoxes=function(e,t){var i=[];return m._sweep.call(this,e,i,t),i},m._sweep=function(e,t,i){for(var r in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;m._sweep.call(this.boxes[r],e,t,i)}},m.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},m.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},m.prototype.releaseUsedSamples=function(e,i){var r=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var n=s.lastValidSample;n<i;n++)r+=this.releaseSample(s,n);t.info("ISOFile","Track #"+e+" released samples up to "+i+" (released size: "+r+", remaining: "+this.samplesDataSize+")"),s.lastValidSample=i},m.prototype.start=function(){this.sampleProcessingStarted=!0,this.processSamples(!1)},m.prototype.stop=function(){this.sampleProcessingStarted=!1},m.prototype.flush=function(){t.info("ISOFile","Flushing remaining samples"),this.updateSampleLists(),this.processSamples(!0),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0)},m.prototype.seekTrack=function(e,i,r){var s,n,a,o,c=0,l=0;if(0===r.samples.length)return t.info("ISOFile","No sample in track, cannot seek! Using time "+t.getDurationString(0,1)+" and offset: 0"),{offset:0,time:0};for(s=0;s<r.samples.length;s++){if(n=r.samples[s],0===s)l=0,o=n.timescale;else if(n.cts>e*n.timescale){l=s-1;break}i&&n.is_sync&&(c=s)}for(i&&(l=c),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return a=r.samples[l].offset+r.samples[l].alreadyRead,t.info("ISOFile","Seeking to "+(i?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+t.getDurationString(e,o)+" and offset: "+a),{offset:a,time:e/o}},m.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},m.prototype.seek=function(e,i){var r,s,n,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;n<a.traks.length;n++)r=a.traks[n],e>this.getTrackDuration(r)||((s=this.seekTrack(e,i,r)).offset<o.offset&&(o.offset=s.offset),s.time<o.time&&(o.time=s.time));return t.info("ISOFile","Seeking at time "+t.getDurationString(o.time,1)+" needs a buffer with a fileStart position of "+o.offset),o.offset===1/0?o={offset:this.nextParsePosition,time:0}:o.offset=this.stream.getEndFilePositionAfter(o.offset),t.info("ISOFile","Adjusted seek position (after checking data already in buffer): "+o.offset),o}throw"Cannot seek: moov not received!"},m.prototype.equal=function(e){for(var t=0;t<this.boxes.length&&t<e.boxes.length;){var i=this.boxes[t],r=e.boxes[t];if(!c.boxEqual(i,r))return!1;t++}return!0},void 0!==e&&(e.ISOFile=m),m.prototype.lastBoxStartPosition=0,m.prototype.parsingMdat=null,m.prototype.nextParsePosition=0,m.prototype.discardMdatData=!1,m.prototype.processIncompleteBox=function(e){var t;return"mdat"===e.type?(t=new c[e.type+"Box"](e.size),this.parsingMdat=t,this.boxes.push(t),this.mdats.push(t),t.start=e.start,t.hdr_size=e.hdr_size,this.stream.addUsedBytes(t.hdr_size),this.lastBoxStartPosition=t.start+t.size,this.stream.seek(t.start+t.size,!1,this.discardMdatData)?(this.parsingMdat=null,!0):(this.moovStartFound?this.nextParsePosition=this.stream.findEndContiguousBuf():this.nextParsePosition=t.start+t.size,!1)):("moov"===e.type&&(this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0)),!!this.stream.mergeNextBuffer&&this.stream.mergeNextBuffer()?(this.nextParsePosition=this.stream.getEndPosition(),!0):(e.type?this.moovStartFound?this.nextParsePosition=this.stream.getEndPosition():this.nextParsePosition=this.stream.getPosition()+e.size:this.nextParsePosition=this.stream.getEndPosition(),!1))},m.prototype.hasIncompleteMdat=function(){return null!==this.parsingMdat},m.prototype.processIncompleteMdat=function(){var e;return e=this.parsingMdat,this.stream.seek(e.start+e.size,!1,this.discardMdatData)?(t.debug("ISOFile","Found 'mdat' end in buffered data"),this.parsingMdat=null,!0):(this.nextParsePosition=this.stream.findEndContiguousBuf(),!1)},m.prototype.restoreParsePosition=function(){return this.stream.seek(this.lastBoxStartPosition,!0,this.discardMdatData)},m.prototype.saveParsePosition=function(){this.lastBoxStartPosition=this.stream.getPosition()},m.prototype.updateUsedBytes=function(e,t){this.stream.addUsedBytes&&("mdat"===e.type?(this.stream.addUsedBytes(e.hdr_size),this.discardMdatData&&this.stream.addUsedBytes(e.size-e.hdr_size)):this.stream.addUsedBytes(e.size))},m.prototype.add=c.Box.prototype.add,m.prototype.addBox=c.Box.prototype.addBox,m.prototype.init=function(e){var t=e||{},i=(this.add("ftyp").set("major_brand",t.brands&&t.brands[0]||"iso4").set("minor_version",0).set("compatible_brands",t.brands||["iso4"]),this.add("moov"));return i.add("mvhd").set("timescale",t.timescale||600).set("rate",t.rate||65536).set("creation_time",0).set("modification_time",0).set("duration",t.duration||0).set("volume",t.width?0:256).set("matrix",[65536,0,0,0,65536,0,0,0,1073741824]).set("next_track_id",1),i.add("mvex"),this},m.prototype.addTrack=function(e){this.moov||this.init(e);var t=e||{};t.width=t.width||320,t.height=t.height||320,t.id=t.id||this.moov.mvhd.next_track_id,t.type=t.type||"avc1";var i=this.moov.add("trak");this.moov.mvhd.next_track_id=t.id+1,i.add("tkhd").set("flags",c.TKHD_FLAG_ENABLED|c.TKHD_FLAG_IN_MOVIE|c.TKHD_FLAG_IN_PREVIEW).set("creation_time",0).set("modification_time",0).set("track_id",t.id).set("duration",t.duration||0).set("layer",t.layer||0).set("alternate_group",0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("width",t.width<<16).set("height",t.height<<16);var s=i.add("mdia");s.add("mdhd").set("creation_time",0).set("modification_time",0).set("timescale",t.timescale||1).set("duration",t.media_duration||0).set("language",t.language||"und"),s.add("hdlr").set("handler",t.hdlr||"vide").set("name",t.name||"Track created with MP4Box.js"),s.add("elng").set("extended_language",t.language||"fr-FR");var n=s.add("minf");if(void 0!==c[t.type+"SampleEntry"]){var a=new c[t.type+"SampleEntry"];a.data_reference_index=1;var o="";for(var l in c.sampleEntryCodes)for(var u=c.sampleEntryCodes[l],d=0;d<u.length;d++)if(u.indexOf(t.type)>-1){o=l;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var p=new c.avcCBox;p.parse(new r(t.avcDecoderConfigRecord)),a.addBox(p)}else if(t.hevcDecoderConfigRecord){var h=new c.hvcCBox;h.parse(new r(t.hevcDecoderConfigRecord)),a.addBox(h)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&a.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){a.addBox(e)})),n.add("dinf").add("dref").addEntry((new c["url Box"]).set("flags",1));var m=n.add("stbl");return m.add("stsd").addEntry(a),m.add("stts").set("sample_counts",[]).set("sample_deltas",[]),m.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),m.add("stco").set("chunk_offsets",[]),m.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},c.Box.prototype.computeSize=function(e){var t=e||new s;t.endianness=s.BIG_ENDIAN,this.write(t)},m.prototype.addSample=function(e,t,i){var r=i||{},s={},n=this.getTrackById(e);if(null!==n){s.number=n.samples.length,s.track_id=n.tkhd.track_id,s.timescale=n.mdia.mdhd.timescale,s.description_index=r.sample_description_index?r.sample_description_index-1:0,s.description=n.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=r.duration||1,s.cts=r.cts||0,s.dts=r.dts||0,s.is_sync=r.is_sync||!1,s.is_leading=r.is_leading||0,s.depends_on=r.depends_on||0,s.is_depended_on=r.is_depended_on||0,s.has_redundancy=r.has_redundancy||0,s.degradation_priority=r.degradation_priority||0,s.offset=0,s.subsamples=r.subsamples,n.samples.push(s),n.samples_size+=s.size,n.samples_duration+=s.duration,void 0===n.first_dts&&(n.first_dts=r.dts),this.processSamples();var a=this.createSingleSampleMoof(s);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),s}},m.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new c.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var r=i.add("traf"),s=this.getTrackById(e.track_id);return r.add("tfhd").set("track_id",e.track_id).set("flags",c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),r.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),r.add("trun").set("flags",c.TRUN_FLAGS_DATA_OFFSET|c.TRUN_FLAGS_DURATION|c.TRUN_FLAGS_SIZE|c.TRUN_FLAGS_FLAGS|c.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},m.prototype.lastMoofIndex=0,m.prototype.samplesDataSize=0,m.prototype.resetTables=function(){var e,t,i,r,s,n;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e<this.moov.traks.length;e++){(t=this.moov.traks[e]).tkhd.duration=0,t.mdia.mdhd.duration=0,(t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64).chunk_offsets=[],(i=t.mdia.minf.stbl.stsc).first_chunk=[],i.samples_per_chunk=[],i.sample_description_index=[],(t.mdia.minf.stbl.stsz||t.mdia.minf.stbl.stz2).sample_sizes=[],(r=t.mdia.minf.stbl.stts).sample_counts=[],r.sample_deltas=[],(s=t.mdia.minf.stbl.ctts)&&(s.sample_counts=[],s.sample_offsets=[]),n=t.mdia.minf.stbl.stss;var a=t.mdia.minf.stbl.boxes.indexOf(n);-1!=a&&(t.mdia.minf.stbl.boxes[a]=null)}},m.initSampleGroups=function(e,t,i,r,s){var n,a,o,c;function l(e,t,i){this.grouping_type=e,this.grouping_type_parameter=t,this.sbgp=i,this.last_sample_in_run=-1,this.entry_index=-1}for(t&&(t.sample_groups_info=[]),e.sample_groups_info||(e.sample_groups_info=[]),a=0;a<i.length;a++){for(c=i[a].grouping_type+"/"+i[a].grouping_type_parameter,o=new l(i[a].grouping_type,i[a].grouping_type_parameter,i[a]),t&&(t.sample_groups_info[c]=o),e.sample_groups_info[c]||(e.sample_groups_info[c]=o),n=0;n<r.length;n++)r[n].grouping_type===i[a].grouping_type&&(o.description=r[n],o.description.used=!0);if(s)for(n=0;n<s.length;n++)s[n].grouping_type===i[a].grouping_type&&(o.fragment_description=s[n],o.fragment_description.used=!0,o.is_fragment=!0)}if(t){if(s)for(a=0;a<s.length;a++)!s[a].used&&s[a].version>=2&&(c=s[a].grouping_type+"/0",(o=new l(s[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[c]||(t.sample_groups_info[c]=o))}else for(a=0;a<r.length;a++)!r[a].used&&r[a].version>=2&&(c=r[a].grouping_type+"/0",o=new l(r[a].grouping_type,0),e.sample_groups_info[c]||(e.sample_groups_info[c]=o))},m.setSampleGroupProperties=function(e,t,i,r){var s,n;for(s in t.sample_groups=[],r){var a;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=r[s].grouping_type,t.sample_groups[s].grouping_type_parameter=r[s].grouping_type_parameter,i>=r[s].last_sample_in_run&&(r[s].last_sample_in_run<0&&(r[s].last_sample_in_run=0),r[s].entry_index++,r[s].entry_index<=r[s].sbgp.entries.length-1&&(r[s].last_sample_in_run+=r[s].sbgp.entries[r[s].entry_index].sample_count)),r[s].entry_index<=r[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=r[s].sbgp.entries[r[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)a=r[s].fragment_description?r[s].fragment_description:r[s].description,t.sample_groups[s].group_description_index>0?(n=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,a&&n>=0&&(t.sample_groups[s].description=a.entries[n])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[s].description=a.entries[a.default_group_description_index-1])}},m.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},m.prototype.buildSampleLists=function(){var e,t;for(e=0;e<this.moov.traks.length;e++)t=this.moov.traks[e],this.buildTrakSampleLists(t)},m.prototype.buildTrakSampleLists=function(e){var t,i,r,s,n,a,o,c,l,u,d,p,h,f,g,_,y,b,v,x,S,w,E,C;if(e.samples=[],e.samples_duration=0,e.samples_size=0,i=e.mdia.minf.stbl.stco||e.mdia.minf.stbl.co64,r=e.mdia.minf.stbl.stsc,s=e.mdia.minf.stbl.stsz||e.mdia.minf.stbl.stz2,n=e.mdia.minf.stbl.stts,a=e.mdia.minf.stbl.ctts,o=e.mdia.minf.stbl.stss,c=e.mdia.minf.stbl.stsd,l=e.mdia.minf.stbl.subs,p=e.mdia.minf.stbl.stdp,u=e.mdia.minf.stbl.sbgps,d=e.mdia.minf.stbl.sgpds,b=-1,v=-1,x=-1,S=-1,w=0,E=0,C=0,m.initSampleGroups(e,null,u,d),void 0!==s){for(t=0;t<s.sample_sizes.length;t++){var A={};A.number=t,A.track_id=e.tkhd.track_id,A.timescale=e.mdia.mdhd.timescale,A.alreadyRead=0,e.samples[t]=A,A.size=s.sample_sizes[t],e.samples_size+=A.size,0===t?(f=1,h=0,A.chunk_index=f,A.chunk_run_index=h,y=r.samples_per_chunk[h],_=0,g=h+1<r.first_chunk.length?r.first_chunk[h+1]-1:1/0):t<y?(A.chunk_index=f,A.chunk_run_index=h):(f++,A.chunk_index=f,_=0,f<=g||(g=++h+1<r.first_chunk.length?r.first_chunk[h+1]-1:1/0),A.chunk_run_index=h,y+=r.samples_per_chunk[h]),A.description_index=r.sample_description_index[A.chunk_run_index]-1,A.description=c.entries[A.description_index],A.offset=i.chunk_offsets[A.chunk_index-1]+_,_+=A.size,t>b&&(v++,b<0&&(b=0),b+=n.sample_counts[v]),t>0?(e.samples[t-1].duration=n.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,A.dts=e.samples[t-1].dts+e.samples[t-1].duration):A.dts=0,a?(t>=x&&(S++,x<0&&(x=0),x+=a.sample_counts[S]),A.cts=e.samples[t].dts+a.sample_offsets[S]):A.cts=A.dts,o?(t==o.sample_numbers[w]-1?(A.is_sync=!0,w++):(A.is_sync=!1,A.degradation_priority=0),l&&l.entries[E].sample_delta+C==t+1&&(A.subsamples=l.entries[E].subsamples,C+=l.entries[E].sample_delta,E++)):A.is_sync=!0,m.process_sdtp(e.mdia.minf.stbl.sdtp,A,A.number),A.degradation_priority=p?p.priority[t]:0,l&&l.entries[E].sample_delta+C==t&&(A.subsamples=l.entries[E].subsamples,C+=l.entries[E].sample_delta),(u.length>0||d.length>0)&&m.setSampleGroupProperties(e,A,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},m.prototype.updateSampleLists=function(){var e,t,i,r,s,n,a,o,l,u,d,p,h,f,g;if(void 0!==this.moov)for(;this.lastMoofIndex<this.moofs.length;)if(l=this.moofs[this.lastMoofIndex],this.lastMoofIndex++,"moof"==l.type)for(u=l,e=0;e<u.trafs.length;e++){for(d=u.trafs[e],p=this.getTrackById(d.tfhd.track_id),h=this.getTrexById(d.tfhd.track_id),r=d.tfhd.flags&c.TFHD_FLAG_SAMPLE_DESC?d.tfhd.default_sample_description_index:h?h.default_sample_description_index:1,s=d.tfhd.flags&c.TFHD_FLAG_SAMPLE_DUR?d.tfhd.default_sample_duration:h?h.default_sample_duration:0,n=d.tfhd.flags&c.TFHD_FLAG_SAMPLE_SIZE?d.tfhd.default_sample_size:h?h.default_sample_size:0,a=d.tfhd.flags&c.TFHD_FLAG_SAMPLE_FLAGS?d.tfhd.default_sample_flags:h?h.default_sample_flags:0,d.sample_number=0,d.sbgps.length>0&&m.initSampleGroups(p,d,d.sbgps,p.mdia.minf.stbl.sgpds,d.sgpds),t=0;t<d.truns.length;t++){var _=d.truns[t];for(i=0;i<_.sample_count;i++){(f={}).moof_number=this.lastMoofIndex,f.number_in_traf=d.sample_number,d.sample_number++,f.number=p.samples.length,d.first_sample_index=p.samples.length,p.samples.push(f),f.track_id=p.tkhd.track_id,f.timescale=p.mdia.mdhd.timescale,f.description_index=r-1,f.description=p.mdia.minf.stbl.stsd.entries[f.description_index],f.size=n,_.flags&c.TRUN_FLAGS_SIZE&&(f.size=_.sample_size[i]),p.samples_size+=f.size,f.duration=s,_.flags&c.TRUN_FLAGS_DURATION&&(f.duration=_.sample_duration[i]),p.samples_duration+=f.duration,p.first_traf_merged||i>0?f.dts=p.samples[p.samples.length-2].dts+p.samples[p.samples.length-2].duration:(d.tfdt?f.dts=d.tfdt.baseMediaDecodeTime:f.dts=0,p.first_traf_merged=!0),f.cts=f.dts,_.flags&c.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+_.sample_composition_time_offset[i]),g=a,_.flags&c.TRUN_FLAGS_FLAGS?g=_.sample_flags[i]:0===i&&_.flags&c.TRUN_FLAGS_FIRST_FLAG&&(g=_.first_sample_flags),f.is_sync=!(g>>16&1),f.is_leading=g>>26&3,f.depends_on=g>>24&3,f.is_depended_on=g>>22&3,f.has_redundancy=g>>20&3,f.degradation_priority=65535&g;var y=!!(d.tfhd.flags&c.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(d.tfhd.flags&c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(_.flags&c.TRUN_FLAGS_DATA_OFFSET),x=0;x=y?d.tfhd.base_data_offset:b||0===t?u.start:o,f.offset=0===t&&0===i?v?x+_.data_offset:x:o,o=f.offset+f.size,(d.sbgps.length>0||d.sgpds.length>0||p.mdia.minf.stbl.sbgps.length>0||p.mdia.minf.stbl.sgpds.length>0)&&m.setSampleGroupProperties(p,f,f.number_in_traf,d.sample_groups_info)}}if(d.subs){p.has_fragment_subsamples=!0;var S=d.first_sample_index;for(t=0;t<d.subs.entries.length;t++)S+=d.subs.entries[t].sample_delta,(f=p.samples[S-1]).subsamples=d.subs.entries[t].subsamples}}},m.prototype.getSample=function(e,i){var r,n=e.samples[i];if(!this.moov)return null;if(n.data){if(n.alreadyRead==n.size)return n}else n.data=new Uint8Array(n.size),n.alreadyRead=0,this.samplesDataSize+=n.size,t.debug("ISOFile","Allocating sample #"+i+" on track #"+e.tkhd.track_id+" of size "+n.size+" (total: "+this.samplesDataSize+")");for(;;){var a=this.stream.findPosition(!0,n.offset+n.alreadyRead,!1);if(!(a>-1))return null;var o=(r=this.stream.buffers[a]).byteLength-(n.offset+n.alreadyRead-r.fileStart);if(n.size-n.alreadyRead<=o)return t.debug("ISOFile","Getting sample #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-r.fileStart)+" read size: "+(n.size-n.alreadyRead)+" full size: "+n.size+")"),s.memcpy(n.data.buffer,n.alreadyRead,r,n.offset+n.alreadyRead-r.fileStart,n.size-n.alreadyRead),r.usedBytes+=n.size-n.alreadyRead,this.stream.logBufferLevel(),n.alreadyRead=n.size,n;if(0===o)return null;t.debug("ISOFile","Getting sample #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-r.fileStart)+" read size: "+o+" full size: "+n.size+")"),s.memcpy(n.data.buffer,n.alreadyRead,r,n.offset+n.alreadyRead-r.fileStart,o),n.alreadyRead+=o,r.usedBytes+=o,this.stream.logBufferLevel()}},m.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.alreadyRead=0,i.size):0},m.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},m.prototype.getCodecs=function(){var e,t="";for(e=0;e<this.moov.traks.length;e++){e>0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},m.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t<this.moov.mvex.trexs.length;t++){var i=this.moov.mvex.trexs[t];if(i.track_id==e)return i}return null},m.prototype.getTrackById=function(e){if(void 0===this.moov)return null;for(var t=0;t<this.moov.traks.length;t++){var i=this.moov.traks[t];if(i.tkhd.track_id==e)return i}return null},m.prototype.itemsDataSize=0,m.prototype.flattenItemInfo=function(){var e,i,r,s=this.items,n=this.entity_groups,a=this.meta;if(null!=a&&void 0!==a.hdlr&&void 0!==a.iinf){for(e=0;e<a.iinf.item_infos.length;e++)(r={}).id=a.iinf.item_infos[e].item_ID,s[r.id]=r,r.ref_to=[],r.name=a.iinf.item_infos[e].item_name,a.iinf.item_infos[e].protection_index>0&&(r.protection=a.ipro.protections[a.iinf.item_infos[e].protection_index-1]),a.iinf.item_infos[e].item_type?r.type=a.iinf.item_infos[e].item_type:r.type="mime",r.content_type=a.iinf.item_infos[e].content_type,r.content_encoding=a.iinf.item_infos[e].content_encoding;if(a.grpl)for(e=0;e<a.grpl.boxes.length;e++)entity_group={},entity_group.id=a.grpl.boxes[e].group_id,entity_group.entity_ids=a.grpl.boxes[e].entity_ids,entity_group.type=a.grpl.boxes[e].type,n[entity_group.id]=entity_group;if(a.iloc)for(e=0;e<a.iloc.items.length;e++){var o=a.iloc.items[e];switch(r=s[o.item_ID],0!==o.data_reference_index&&(t.warn("Item storage with reference to other files: not supported"),r.source=a.dinf.boxes[o.data_reference_index-1]),o.construction_method){case 0:case 1:break;case 2:t.warn("Item storage with construction_method : not supported")}for(r.extents=[],r.size=0,i=0;i<o.extents.length;i++)r.extents[i]={},r.extents[i].offset=o.extents[i].extent_offset+o.base_offset,1==o.construction_method&&(r.extents[i].offset+=a.idat.start+a.idat.hdr_size),r.extents[i].length=o.extents[i].extent_length,r.extents[i].alreadyRead=0,r.size+=r.extents[i].length}if(a.pitm&&(s[a.pitm.item_id].primary=!0),a.iref)for(e=0;e<a.iref.references.length;e++){var c=a.iref.references[e];for(i=0;i<c.references.length;i++)s[c.from_item_ID].ref_to.push({type:c.type,id:c.references[i]})}if(a.iprp)for(var l=0;l<a.iprp.ipmas.length;l++){var u=a.iprp.ipmas[l];for(e=0;e<u.associations.length;e++){var d=u.associations[e];if((r=s[d.id])||(r=n[d.id]),r)for(void 0===r.properties&&(r.properties={},r.properties.boxes=[]),i=0;i<d.props.length;i++){var p=d.props[i];if(p.property_index>0&&p.property_index-1<a.iprp.ipco.boxes.length){var h=a.iprp.ipco.boxes[p.property_index-1];r.properties[h.type]=h,r.properties.boxes.push(h)}}}}}},m.prototype.getItem=function(e){var i,r;if(!this.meta)return null;if(!(r=this.items[e]).data&&r.size)r.data=new Uint8Array(r.size),r.alreadyRead=0,this.itemsDataSize+=r.size,t.debug("ISOFile","Allocating item #"+e+" of size "+r.size+" (total: "+this.itemsDataSize+")");else if(r.alreadyRead===r.size)return r;for(var n=0;n<r.extents.length;n++){var a=r.extents[n];if(a.alreadyRead!==a.length){var o=this.stream.findPosition(!0,a.offset+a.alreadyRead,!1);if(!(o>-1))return null;var c=(i=this.stream.buffers[o]).byteLength-(a.offset+a.alreadyRead-i.fileStart);if(!(a.length-a.alreadyRead<=c))return t.debug("ISOFile","Getting item #"+e+" extent #"+n+" partial data (alreadyRead: "+a.alreadyRead+" offset: "+(a.offset+a.alreadyRead-i.fileStart)+" read size: "+c+" full extent size: "+a.length+" full item size: "+r.size+")"),s.memcpy(r.data.buffer,r.alreadyRead,i,a.offset+a.alreadyRead-i.fileStart,c),a.alreadyRead+=c,r.alreadyRead+=c,i.usedBytes+=c,this.stream.logBufferLevel(),null;t.debug("ISOFile","Getting item #"+e+" extent #"+n+" data (alreadyRead: "+a.alreadyRead+" offset: "+(a.offset+a.alreadyRead-i.fileStart)+" read size: "+(a.length-a.alreadyRead)+" full extent size: "+a.length+" full item size: "+r.size+")"),s.memcpy(r.data.buffer,r.alreadyRead,i,a.offset+a.alreadyRead-i.fileStart,a.length-a.alreadyRead),i.usedBytes+=a.length-a.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=a.length-a.alreadyRead,a.alreadyRead=a.length}}return r.alreadyRead===r.size?r:null},m.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i<t.extents.length;i++){t.extents[i].alreadyRead=0}return t.size}return 0},m.prototype.processItems=function(e){for(var t in this.items){var i=this.items[t];this.getItem(i.id),e&&!i.sent&&(e(i),i.sent=!0,i.data=null)}},m.prototype.hasItem=function(e){for(var t in this.items){var i=this.items[t];if(i.name===e)return i.id}return-1},m.prototype.getMetaHandler=function(){return this.meta?this.meta.hdlr.handler:null},m.prototype.getPrimaryItem=function(){return this.meta&&this.meta.pitm?this.getItem(this.meta.pitm.item_id):null},m.prototype.itemToFragmentedTrackFile=function(e){var t=e||{},i=null;if(null==(i=t.itemId?this.getItem(t.itemId):this.getPrimaryItem()))return null;var r=new m;r.discardMdatData=!1;var s={type:i.type,description_boxes:i.properties.boxes};i.properties.ispe&&(s.width=i.properties.ispe.image_width,s.height=i.properties.ispe.image_height);var n=r.addTrack(s);return n?(r.addSample(n,i.data),r):null},m.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e)},m.prototype.createFragment=function(e,i,r){var n=this.getTrackById(e),a=this.getSample(n,i);if(null==a)return this.setNextSeekPositionFromSample(n.samples[i]),null;var o=r||new s;o.endianness=s.BIG_ENDIAN;var l=this.createSingleSampleMoof(a);l.write(o),l.trafs[0].truns[0].data_offset=l.size+8,t.debug("MP4Box","Adjusting data_offset with new value "+l.trafs[0].truns[0].data_offset),o.adjustUint32(l.trafs[0].truns[0].data_offset_position,l.trafs[0].truns[0].data_offset);var u=new c.mdatBox;return u.data=a.data,u.write(o),o},m.writeInitializationSegment=function(e,i,r,n){var a;t.debug("ISOFile","Generating initialization segment");var o=new s;o.endianness=s.BIG_ENDIAN,e.write(o);var c=i.add("mvex");for(r&&c.add("mehd").set("fragment_duration",r),a=0;a<i.traks.length;a++)c.add("trex").set("track_id",i.traks[a].tkhd.track_id).set("default_sample_description_index",1).set("default_sample_duration",n).set("default_sample_size",0).set("default_sample_flags",65536);return i.write(o),o.buffer},m.prototype.save=function(e){var t=new s;t.endianness=s.BIG_ENDIAN,this.write(t),t.save(e)},m.prototype.getBuffer=function(){var e=new s;return e.endianness=s.BIG_ENDIAN,this.write(e),e.buffer},m.prototype.initializeSegmentation=function(){var e,i,r,s;for(null===this.onSegment&&t.warn("MP4Box","No segmentation callback set!"),this.isFragmentationInitialized||(this.isFragmentationInitialized=!0,this.nextMoofNumber=0,this.resetTables()),i=[],e=0;e<this.fragmentedTracks.length;e++){var n=new c.moovBox;n.mvhd=this.moov.mvhd,n.boxes.push(n.mvhd),r=this.getTrackById(this.fragmentedTracks[e].id),n.boxes.push(r),n.traks.push(r),(s={}).id=r.tkhd.track_id,s.user=this.fragmentedTracks[e].user,s.buffer=m.writeInitializationSegment(this.ftyp,n,this.moov.mvex&&this.moov.mvex.mehd?this.moov.mvex.mehd.fragment_duration:void 0,this.moov.traks[e].samples.length>0?this.moov.traks[e].samples[0].duration:0),i.push(s)}return i},c.Box.prototype.printHeader=function(e){this.size+=8,this.size>n&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},c.FullBox.prototype.printHeader=function(e){this.size+=4,c.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},c.Box.prototype.print=function(e){this.printHeader(e)},c.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t<this.boxes.length;t++)if(this.boxes[t]){var i=e.indent;e.indent+=" ",this.boxes[t].print(e),e.indent=i}},m.prototype.print=function(e){e.indent="";for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&this.boxes[t].print(e)},c.mvhdBox.prototype.print=function(e){c.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"timescale: "+this.timescale),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"rate: "+this.rate),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},c.tkhdBox.prototype.print=function(e){c.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var f={createFile:function(e,t){var i=void 0===e||e,r=new m(t);return r.discardMdatData=!i,r}};void 0!==e&&(e.createFile=f.createFile)}});function rng(){return poolPtr>rnds8Pool.length-16&&(import_crypto32.default.randomFillSync(rnds8Pool),poolPtr=0),rnds8Pool.slice(poolPtr,poolPtr+=16)}var regex_default,validate_default,init_rng=__esm({"../../node_modules/uuid/dist/esm-node/rng.js"(){import_crypto32=__toESM(require("crypto")),rnds8Pool=new Uint8Array(256),poolPtr=rnds8Pool.length}}),init_regex=__esm({"../../node_modules/uuid/dist/esm-node/regex.js"(){regex_default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}});function validate(e){return"string"==typeof e&&regex_default.test(e)}var byteToHex,stringify_default,init_validate=__esm({"../../node_modules/uuid/dist/esm-node/validate.js"(){init_regex(),validate_default=validate}});function unsafeStringify(e,t=0){return byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]}function stringify(e,t=0){const i=unsafeStringify(e,t);if(!validate_default(i))throw TypeError("Stringified UUID is invalid");return i}var _nodeId,_clockseq,_lastMSecs,_lastNSecs,v1_default,init_stringify=__esm({"../../node_modules/uuid/dist/esm-node/stringify.js"(){init_validate(),byteToHex=[];for(let e=0;e<256;++e)byteToHex.push((e+256).toString(16).slice(1));stringify_default=stringify}});function v1(e,t,i){let r=t&&i||0;const s=t||new Array(16);let n=(e=e||{}).node||_nodeId,a=void 0!==e.clockseq?e.clockseq:_clockseq;if(null==n||null==a){const t=e.random||(e.rng||rng)();null==n&&(n=_nodeId=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==a&&(a=_clockseq=16383&(t[6]<<8|t[7]))}let o=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:_lastNSecs+1;const l=o-_lastMSecs+(c-_lastNSecs)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||o>_lastMSecs)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=o,_lastNSecs=c,_clockseq=a,o+=122192928e5;const u=(1e4*(268435455&o)+c)%4294967296;s[r++]=u>>>24&255,s[r++]=u>>>16&255,s[r++]=u>>>8&255,s[r++]=255&u;const d=o/4294967296*1e4&268435455;s[r++]=d>>>8&255,s[r++]=255&d,s[r++]=d>>>24&15|16,s[r++]=d>>>16&255,s[r++]=a>>>8|128,s[r++]=255&a;for(let e=0;e<6;++e)s[r+e]=n[e];return t||unsafeStringify(s)}var parse_default,init_v1=__esm({"../../node_modules/uuid/dist/esm-node/v1.js"(){init_rng(),init_stringify(),_lastMSecs=0,_lastNSecs=0,v1_default=v1}});function parse11(e){if(!validate_default(e))throw TypeError("Invalid UUID");let t;const i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}var DNS,URL2,init_parse=__esm({"../../node_modules/uuid/dist/esm-node/parse.js"(){init_validate(),parse_default=parse11}});function stringToBytes(e){e=unescape(encodeURIComponent(e));const t=[];for(let i=0;i<e.length;++i)t.push(e.charCodeAt(i));return t}function v35(e,t,i){function r(e,r,s,n){var a;if("string"==typeof e&&(e=stringToBytes(e)),"string"==typeof r&&(r=parse_default(r)),16!==(null===(a=r)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let o=new Uint8Array(16+e.length);if(o.set(r),o.set(e,r.length),o=i(o),o[6]=15&o[6]|t,o[8]=63&o[8]|128,s){n=n||0;for(let e=0;e<16;++e)s[n+e]=o[e];return s}return unsafeStringify(o)}try{r.name=e}catch(e){}return r.DNS=DNS,r.URL=URL2,r}var import_crypto33,md5_default,init_v35=__esm({"../../node_modules/uuid/dist/esm-node/v35.js"(){init_stringify(),init_parse(),DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",URL2="6ba7b811-9dad-11d1-80b4-00c04fd430c8"}});function md5(e){return Array.isArray(e)?e=Buffer.from(e):"string"==typeof e&&(e=Buffer.from(e,"utf8")),import_crypto33.default.createHash("md5").update(e).digest()}var v3,v3_default,import_crypto34,native_default,v4_default,init_md5=__esm({"../../node_modules/uuid/dist/esm-node/md5.js"(){import_crypto33=__toESM(require("crypto")),md5_default=md5}}),init_v3=__esm({"../../node_modules/uuid/dist/esm-node/v3.js"(){init_v35(),init_md5(),v3=v35("v3",48,md5_default),v3_default=v3}}),init_native=__esm({"../../node_modules/uuid/dist/esm-node/native.js"(){import_crypto34=__toESM(require("crypto")),native_default={randomUUID:import_crypto34.default.randomUUID}}});function v4(e,t,i){if(native_default.randomUUID&&!t&&!e)return native_default.randomUUID();const r=(e=e||{}).random||(e.rng||rng)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=r[e];return t}return unsafeStringify(r)}var import_crypto35,sha1_default,init_v4=__esm({"../../node_modules/uuid/dist/esm-node/v4.js"(){init_native(),init_rng(),init_stringify(),v4_default=v4}});function sha1(e){return Array.isArray(e)?e=Buffer.from(e):"string"==typeof e&&(e=Buffer.from(e,"utf8")),import_crypto35.default.createHash("sha1").update(e).digest()}var v5,v5_default,nil_default,version_default,init_sha1=__esm({"../../node_modules/uuid/dist/esm-node/sha1.js"(){import_crypto35=__toESM(require("crypto")),sha1_default=sha1}}),init_v5=__esm({"../../node_modules/uuid/dist/esm-node/v5.js"(){init_v35(),init_sha1(),v5=v35("v5",80,sha1_default),v5_default=v5}}),init_nil=__esm({"../../node_modules/uuid/dist/esm-node/nil.js"(){nil_default="00000000-0000-0000-0000-000000000000"}});function version(e){if(!validate_default(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}var init_version=__esm({"../../node_modules/uuid/dist/esm-node/version.js"(){init_validate(),version_default=version}}),esm_node_exports={};__export(esm_node_exports,{NIL:()=>nil_default,parse:()=>parse_default,stringify:()=>stringify_default,v1:()=>v1_default,v3:()=>v3_default,v4:()=>v4_default,v5:()=>v5_default,validate:()=>validate_default,version:()=>version_default});var import_crypto36,rnds8Pool2,poolPtr2,init_esm_node=__esm({"../../node_modules/uuid/dist/esm-node/index.js"(){init_v1(),init_v3(),init_v4(),init_v5(),init_nil(),init_version(),init_validate(),init_stringify(),init_parse()}}),require_logger2=__commonJS({"../../node_modules/@skyway-sdk/common/dist/logger.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=e.logLevelTypes=void 0,e.logLevelTypes=["disable","error","warn","info","debug"];var t=class t{constructor(e){this.debug=(...e)=>(this._log("debug",...e),Date.now()),this.info=(...e)=>(this._log("info",...e),Date.now()),this.warn=(...e)=>{this._log("warn",...e)},this.error=(...e)=>{this._log("error",...e)},this.elapsed=(e,...t)=>{const i=Date.now()-e;this._log("info",`elapsed ms:${i}`,...t)},this.prefix=e}_log(i,...r){const s=e.logLevelTypes.indexOf(i);if(e.logLevelTypes.indexOf(t.level)>=s){const e=new Date(Date.now()+324e5).toISOString()+"+JST";r=[this.prefix,...r].map((e=>{if(e instanceof Error)return e.toJSON?e.toJSON():{name:e.name,message:e.message,stack:e.stack};if("object"==typeof e)try{return JSON.parse(JSON.stringify(e))}catch(e){return"json error"}return e}));let s=[e,i,...r];switch("string"===t.format&&(s=[e+" "+i+" "+JSON.stringify(r)]),i){case"debug":console.debug(...s);break;case"info":console.info(...s);break;case"warn":console.warn(...s);break;case"error":console.error(...s)}t.onLog({id:t.id,timestamp:e,level:i,message:r})}}createBlock(e){return{warn:(...t)=>{this.warn(Object.assign({},e),...t)},debug:(...t)=>{this.debug(Object.assign({},e),...t)},info:(...t)=>{this.info(Object.assign({},e),...t)},error:(...t)=>{this.error(Object.assign({},e),...t)}}}};e.Logger=t,t.level="error",t.format="object",t.onLog=()=>{},t.id=Math.random().toString().slice(2,7)}}),require_error2=__commonJS({"../../node_modules/@skyway-sdk/common/dist/error.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SkyWayError=void 0;var t=new(require_logger2().Logger)("packages/common/src/error.ts"),i=class extends Error{constructor(e,i=!0){if(super(e.info.detail),this.id=Math.random().toString().slice(2,10),Object.assign(this,e),this.name=this.info.name,i){const e=["SkyWayError",`name:${this.info.name}, detail:${this.info.detail}, solution:${this.info.solution}`];this.path&&e.push(this.path),this.error&&e.push(this.error),this.payload&&e.push(this.payload),e.push(this.id),t.warn(...e)}}toJSON(){return{id:this.id,info:this.info,path:this.path,payload:this.payload,error:this.error,stack:this.stack}}};e.SkyWayError=i}}),require_event2=__commonJS({"../../node_modules/@skyway-sdk/common/dist/event.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EventDisposer=e.Events=e.Event=void 0;var t=new(require_logger2().Logger)("packages/common/src/event.ts"),i=class{constructor(e=()=>{}){this._onSetListener=e,this._stack=[],this._eventIndex=0,this.emit=e=>{for(const i of this._stack)try{i.execute(e)}catch(e){t.error("task throws error",e)}},this.removeAllListeners=()=>{this._stack=[]},this.pipe=e=>this.add((t=>e.emit(t))),this.add=e=>{const t=this._eventIndex;this._stack.push({execute:e,id:t}),this._eventIndex++;const i=()=>{this._stack=this._stack.filter((e=>e.id!==t&&e))};return this._onSetListener(),{removeListener:i,disposer:e=>{e.push(i)}}},this.once=e=>{const t=this.add((i=>{t.removeListener(),e(i)}));return t},this.asPromise=e=>new Promise(((t,i)=>{const s=e&&setTimeout((()=>{i(new r("Event asPromise timeout : "+e))}),e);this.once((e=>{s&&clearTimeout(s),t(e)}))})),this.watch=(e,t)=>new Promise(((i,s)=>{const n=t&&setTimeout((()=>{s(new r("Event watch timeout : "+t))}),t),{removeListener:a}=this.add((t=>{e(t)&&(n&&clearTimeout(n),a(),i(t))}))}))}get length(){return this._stack.length}};e.Event=i;e.Events=class{constructor(){this.events=[]}make(){const e=new i;return this.events.push(e),e}dispose(){this.events.forEach((e=>e.removeAllListeners())),this.events=[]}};e.EventDisposer=class{constructor(){this._disposer=[]}push(e){this._disposer.push(e)}dispose(){this._disposer.forEach((e=>e())),this._disposer=[]}};var r=class extends Error{toJSON(){return{name:this.name,message:this.message,stack:this.stack}}}}}),require_delayed_stream2=__commonJS({"../../node_modules/delayed-stream/lib/delayed_stream.js"(e,t){var i=require("stream").Stream,r=require("util");function s(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}t.exports=s,r.inherits(s,i),s.create=function(e,t){var i=new this;for(var r in t=t||{})i[r]=t[r];i.source=e;var s=e.emit;return e.emit=function(){return i._handleEmit(arguments),s.apply(e,arguments)},e.on("error",(function(){})),i.pauseStream&&e.pause(),i},Object.defineProperty(s.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}}),s.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)},s.prototype.resume=function(){this._released||this.release(),this.source.resume()},s.prototype.pause=function(){this.source.pause()},s.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]},s.prototype.pipe=function(){var e=i.prototype.pipe.apply(this,arguments);return this.resume(),e},s.prototype._handleEmit=function(e){this._released?this.emit.apply(this,e):("data"===e[0]&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e))},s.prototype._checkIfMaxDataSizeExceeded=function(){if(!(this._maxDataSizeExceeded||this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}}}),require_combined_stream2=__commonJS({"../../node_modules/combined-stream/lib/combined_stream.js"(e,t){var i=require("util"),r=require("stream").Stream,s=require_delayed_stream2();function n(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}t.exports=n,i.inherits(n,r),n.create=function(e){var t=new this;for(var i in e=e||{})t[i]=e[i];return t},n.isStreamLike=function(e){return"function"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Buffer.isBuffer(e)},n.prototype.append=function(e){if(n.isStreamLike(e)){if(!(e instanceof s)){var t=s.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=t}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this},n.prototype.pipe=function(e,t){return r.prototype.pipe.call(this,e,t),this.resume(),e},n.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop)this._pendingNext=!0;else{this._insideLoop=!0;try{do{this._pendingNext=!1,this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=!1}}},n.prototype._realGetNext=function(){var e=this._streams.shift();void 0!==e?"function"==typeof e?e(function(e){n.isStreamLike(e)&&(e.on("data",this._checkDataSize.bind(this)),this._handleErrors(e)),this._pipeNext(e)}.bind(this)):this._pipeNext(e):this.end()},n.prototype._pipeNext=function(e){if(this._currentStream=e,n.isStreamLike(e))return e.on("end",this._getNext.bind(this)),void e.pipe(this,{end:!1});var t=e;this.write(t),this._getNext()},n.prototype._handleErrors=function(e){var t=this;e.on("error",(function(e){t._emitError(e)}))},n.prototype.write=function(e){this.emit("data",e)},n.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.pause&&this._currentStream.pause(),this.emit("pause"))},n.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.resume&&this._currentStream.resume(),this.emit("resume")},n.prototype.end=function(){this._reset(),this.emit("end")},n.prototype.destroy=function(){this._reset(),this.emit("close")},n.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null},n.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}},n.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach((function(t){t.dataSize&&(e.dataSize+=t.dataSize)})),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)},n.prototype._emitError=function(e){this._reset(),this.emit("error",e)}}}),require_db2=__commonJS({"../../node_modules/mime-db/db.json"(e,t){t.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}}}),require_mime_db2=__commonJS({"../../node_modules/mime-db/index.js"(e,t){t.exports=require_db2()}}),require_mime_types2=__commonJS({"../../node_modules/mime-types/index.js"(e){"use strict";var t,i,r,s=require_mime_db2(),n=require("path").extname,a=/^\s*([^;\s]*)(?:;|\s|$)/,o=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=a.exec(e),i=t&&s[t[1].toLowerCase()];return i&&i.charset?i.charset:!(!t||!o.test(t[1]))&&"UTF-8"}e.charset=c,e.charsets={lookup:c},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var r=e.charset(i);r&&(i+="; charset="+r.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=a.exec(t),r=i&&e.extensions[i[1].toLowerCase()];if(!r||!r.length)return!1;return r[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var i=n("x."+t).toLowerCase().substr(1);if(!i)return!1;return e.types[i]||!1},e.types=Object.create(null),t=e.extensions,i=e.types,r=["nginx","apache",void 0,"iana"],Object.keys(s).forEach((function(e){var n=s[e],a=n.extensions;if(a&&a.length){t[e]=a;for(var o=0;o<a.length;o++){var c=a[o];if(i[c]){var l=r.indexOf(s[i[c]].source),u=r.indexOf(n.source);if("application/octet-stream"!==i[c]&&(l>u||l===u&&"application/"===i[c].substr(0,12)))continue}i[c]=e}}}))}}),require_defer2=__commonJS({"../../node_modules/asynckit/lib/defer.js"(e,t){t.exports=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)}}}),require_async2=__commonJS({"../../node_modules/asynckit/lib/async.js"(e,t){var i=require_defer2();t.exports=function(e){var t=!1;return i((function(){t=!0})),function(r,s){t?e(r,s):i((function(){e(r,s)}))}}}}),require_abort2=__commonJS({"../../node_modules/asynckit/lib/abort.js"(e,t){function i(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}t.exports=function(e){Object.keys(e.jobs).forEach(i.bind(e)),e.jobs={}}}}),require_iterate2=__commonJS({"../../node_modules/asynckit/lib/iterate.js"(e,t){var i=require_async2(),r=require_abort2();t.exports=function(e,t,s,n){var a=s.keyedList?s.keyedList[s.index]:s.index;s.jobs[a]=function(e,t,r,s){var n;n=2==e.length?e(r,i(s)):e(r,t,i(s));return n}(t,a,e[a],(function(e,t){a in s.jobs&&(delete s.jobs[a],e?r(s):s.results[a]=t,n(e,s.results))}))}}}),require_state2=__commonJS({"../../node_modules/asynckit/lib/state.js"(e,t){t.exports=function(e,t){var i=!Array.isArray(e),r={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&r.keyedList.sort(i?t:function(i,r){return t(e[i],e[r])});return r}}}),require_terminator2=__commonJS({"../../node_modules/asynckit/lib/terminator.js"(e,t){var i=require_abort2(),r=require_async2();t.exports=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,i(this),r(e)(null,this.results)}}}),require_parallel2=__commonJS({"../../node_modules/asynckit/parallel.js"(e,t){var i=require_iterate2(),r=require_state2(),s=require_terminator2();t.exports=function(e,t,n){var a=r(e);for(;a.index<(a.keyedList||e).length;)i(e,t,a,(function(e,t){e?n(e,t):0!==Object.keys(a.jobs).length||n(null,a.results)})),a.index++;return s.bind(a,n)}}}),require_serialOrdered2=__commonJS({"../../node_modules/asynckit/serialOrdered.js"(e,t){var i=require_iterate2(),r=require_state2(),s=require_terminator2();function n(e,t){return e<t?-1:e>t?1:0}t.exports=function(e,t,n,a){var o=r(e,n);return i(e,t,o,(function r(s,n){s?a(s,n):(o.index++,o.index<(o.keyedList||e).length?i(e,t,o,r):a(null,o.results))})),s.bind(o,a)},t.exports.ascending=n,t.exports.descending=function(e,t){return-1*n(e,t)}}}),require_serial2=__commonJS({"../../node_modules/asynckit/serial.js"(e,t){var i=require_serialOrdered2();t.exports=function(e,t,r){return i(e,t,null,r)}}}),require_asynckit2=__commonJS({"../../node_modules/asynckit/index.js"(e,t){t.exports={parallel:require_parallel2(),serial:require_serial2(),serialOrdered:require_serialOrdered2()}}}),require_es_object_atoms2=__commonJS({"../../node_modules/es-object-atoms/index.js"(e,t){"use strict";t.exports=Object}}),require_es_errors2=__commonJS({"../../node_modules/es-errors/index.js"(e,t){"use strict";t.exports=Error}}),require_eval2=__commonJS({"../../node_modules/es-errors/eval.js"(e,t){"use strict";t.exports=EvalError}}),require_range2=__commonJS({"../../node_modules/es-errors/range.js"(e,t){"use strict";t.exports=RangeError}}),require_ref2=__commonJS({"../../node_modules/es-errors/ref.js"(e,t){"use strict";t.exports=ReferenceError}}),require_syntax2=__commonJS({"../../node_modules/es-errors/syntax.js"(e,t){"use strict";t.exports=SyntaxError}}),require_type2=__commonJS({"../../node_modules/es-errors/type.js"(e,t){"use strict";t.exports=TypeError}}),require_uri2=__commonJS({"../../node_modules/es-errors/uri.js"(e,t){"use strict";t.exports=URIError}}),require_abs2=__commonJS({"../../node_modules/math-intrinsics/abs.js"(e,t){"use strict";t.exports=Math.abs}}),require_floor2=__commonJS({"../../node_modules/math-intrinsics/floor.js"(e,t){"use strict";t.exports=Math.floor}}),require_max2=__commonJS({"../../node_modules/math-intrinsics/max.js"(e,t){"use strict";t.exports=Math.max}}),require_min2=__commonJS({"../../node_modules/math-intrinsics/min.js"(e,t){"use strict";t.exports=Math.min}}),require_pow2=__commonJS({"../../node_modules/math-intrinsics/pow.js"(e,t){"use strict";t.exports=Math.pow}}),require_round2=__commonJS({"../../node_modules/math-intrinsics/round.js"(e,t){"use strict";t.exports=Math.round}}),require_isNaN2=__commonJS({"../../node_modules/math-intrinsics/isNaN.js"(e,t){"use strict";t.exports=Number.isNaN||function(e){return e!=e}}}),require_sign2=__commonJS({"../../node_modules/math-intrinsics/sign.js"(e,t){"use strict";var i=require_isNaN2();t.exports=function(e){return i(e)||0===e?e:e<0?-1:1}}}),require_gOPD2=__commonJS({"../../node_modules/gopd/gOPD.js"(e,t){"use strict";t.exports=Object.getOwnPropertyDescriptor}}),require_gopd2=__commonJS({"../../node_modules/gopd/index.js"(e,t){"use strict";var i=require_gOPD2();if(i)try{i([],"length")}catch(e){i=null}t.exports=i}}),require_es_define_property2=__commonJS({"../../node_modules/es-define-property/index.js"(e,t){"use strict";var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}t.exports=i}}),require_shams3=__commonJS({"../../node_modules/has-symbols/shams.js"(e,t){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),i=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(var r in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var s=Object.getOwnPropertySymbols(e);if(1!==s.length||s[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}}}),require_has_symbols2=__commonJS({"../../node_modules/has-symbols/index.js"(e,t){"use strict";var i="undefined"!=typeof Symbol&&Symbol,r=require_shams3();t.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&r())))}}}),require_Reflect_getPrototypeOf2=__commonJS({"../../node_modules/get-proto/Reflect.getPrototypeOf.js"(e,t){"use strict";t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null}}),require_Object_getPrototypeOf2=__commonJS({"../../node_modules/get-proto/Object.getPrototypeOf.js"(e,t){"use strict";var i=require_es_object_atoms2();t.exports=i.getPrototypeOf||null}}),require_implementation2=__commonJS({"../../node_modules/function-bind/implementation.js"(e,t){"use strict";var i=Object.prototype.toString,r=Math.max,s=function(e,t){for(var i=[],r=0;r<e.length;r+=1)i[r]=e[r];for(var s=0;s<t.length;s+=1)i[s+e.length]=t[s];return i};t.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==i.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n,a=function(e,t){for(var i=[],r=t||0,s=0;r<e.length;r+=1,s+=1)i[s]=e[r];return i}(arguments,1),o=r(0,t.length-a.length),c=[],l=0;l<o;l++)c[l]="$"+l;if(n=Function("binder","return function ("+function(e,t){for(var i="",r=0;r<e.length;r+=1)i+=e[r],r+1<e.length&&(i+=t);return i}(c,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var i=t.apply(this,s(a,arguments));return Object(i)===i?i:this}return t.apply(e,s(a,arguments))})),t.prototype){var u=function(){};u.prototype=t.prototype,n.prototype=new u,u.prototype=null}return n}}}),require_function_bind2=__commonJS({"../../node_modules/function-bind/index.js"(e,t){"use strict";var i=require_implementation2();t.exports=Function.prototype.bind||i}}),require_functionCall2=__commonJS({"../../node_modules/call-bind-apply-helpers/functionCall.js"(e,t){"use strict";t.exports=Function.prototype.call}}),require_functionApply2=__commonJS({"../../node_modules/call-bind-apply-helpers/functionApply.js"(e,t){"use strict";t.exports=Function.prototype.apply}}),require_reflectApply2=__commonJS({"../../node_modules/call-bind-apply-helpers/reflectApply.js"(e,t){"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply}}),require_actualApply2=__commonJS({"../../node_modules/call-bind-apply-helpers/actualApply.js"(e,t){"use strict";var i=require_function_bind2(),r=require_functionApply2(),s=require_functionCall2(),n=require_reflectApply2();t.exports=n||i.call(s,r)}}),require_call_bind_apply_helpers2=__commonJS({"../../node_modules/call-bind-apply-helpers/index.js"(e,t){"use strict";var i=require_function_bind2(),r=require_type2(),s=require_functionCall2(),n=require_actualApply2();t.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new r("a function is required");return n(i,s,e)}}}),require_get2=__commonJS({"../../node_modules/dunder-proto/get.js"(e,t){"use strict";var i,r=require_call_bind_apply_helpers2(),s=require_gopd2();try{i=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var n=!!i&&s&&s(Object.prototype,"__proto__"),a=Object,o=a.getPrototypeOf;t.exports=n&&"function"==typeof n.get?r([n.get]):"function"==typeof o&&function(e){return o(null==e?e:a(e))}}}),require_get_proto2=__commonJS({"../../node_modules/get-proto/index.js"(e,t){"use strict";var i=require_Reflect_getPrototypeOf2(),r=require_Object_getPrototypeOf2(),s=require_get2();t.exports=i?function(e){return i(e)}:r?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return r(e)}:s?function(e){return s(e)}:null}}),require_hasown2=__commonJS({"../../node_modules/hasown/index.js"(e,t){"use strict";var i=Function.prototype.call,r=Object.prototype.hasOwnProperty,s=require_function_bind2();t.exports=s.call(i,r)}}),require_get_intrinsic2=__commonJS({"../../node_modules/get-intrinsic/index.js"(e,t){"use strict";var i,r,s=require_es_object_atoms2(),n=require_es_errors2(),a=require_eval2(),o=require_range2(),c=require_ref2(),l=require_syntax2(),u=require_type2(),d=require_uri2(),p=require_abs2(),h=require_floor2(),m=require_max2(),f=require_min2(),g=require_pow2(),_=require_round2(),y=require_sign2(),b=Function,v=function(e){try{return b('"use strict"; return ('+e+").constructor;")()}catch(e){}},x=require_gopd2(),S=require_es_define_property2(),w=function(){throw new u},E=x?function(){try{return w}catch(e){try{return x(arguments,"callee").get}catch(e){return w}}}():w,C=require_has_symbols2()(),A=require_get_proto2(),T=require_Object_getPrototypeOf2(),P=require_Reflect_getPrototypeOf2(),I=require_functionApply2(),k=require_functionCall2(),R={},F="undefined"!=typeof Uint8Array&&A?A(Uint8Array):i,B={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":C&&A?A([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":R,"%AsyncGenerator%":R,"%AsyncGeneratorFunction%":R,"%AsyncIteratorPrototype%":R,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":a,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":b,"%GeneratorFunction%":R,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":C&&A?A(A([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&C&&A?A((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":s,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":o,"%ReferenceError%":c,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&C&&A?A((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":C&&A?A(""[Symbol.iterator]()):i,"%Symbol%":C?Symbol:i,"%SyntaxError%":l,"%ThrowTypeError%":E,"%TypedArray%":F,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":d,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":I,"%Object.defineProperty%":S,"%Object.getPrototypeOf%":T,"%Math.abs%":p,"%Math.floor%":h,"%Math.max%":m,"%Math.min%":f,"%Math.pow%":g,"%Math.round%":_,"%Math.sign%":y,"%Reflect.getPrototypeOf%":P};if(A)try{null.error}catch(e){r=A(A(e)),B["%Error.prototype%"]=r}var O=function e(t){var i;if("%AsyncFunction%"===t)i=v("async function () {}");else if("%GeneratorFunction%"===t)i=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)i=v("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(i=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var s=e("%AsyncGenerator%");s&&A&&(i=A(s.prototype))}return B[t]=i,i},N={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},D=require_function_bind2(),j=require_hasown2(),L=D.call(k,Array.prototype.concat),U=D.call(I,Array.prototype.splice),M=D.call(k,String.prototype.replace),q=D.call(k,String.prototype.slice),H=D.call(k,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,V=/\\(\\)?/g,K=function(e,t){var i,r=e;if(j(N,r)&&(r="%"+(i=N[r])[0]+"%"),j(B,r)){var s=B[r];if(s===R&&(s=O(r)),void 0===s&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new l("intrinsic "+e+" does not exist!")};t.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===H(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=q(e,0,1),i=q(e,-1);if("%"===t&&"%"!==i)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var r=[];return M(e,z,(function(e,t,i,s){r[r.length]=i?M(s,V,"$1"):t||e})),r}(e),r=i.length>0?i[0]:"",s=K("%"+r+"%",t),n=s.name,a=s.value,o=!1,c=s.alias;c&&(r=c[0],U(i,L([0,1],c)));for(var d=1,p=!0;d<i.length;d+=1){var h=i[d],m=q(h,0,1),f=q(h,-1);if(('"'===m||"'"===m||"`"===m||'"'===f||"'"===f||"`"===f)&&m!==f)throw new l("property names with quotes must have matching quotes");if("constructor"!==h&&p||(o=!0),j(B,n="%"+(r+="."+h)+"%"))a=B[n];else if(null!=a){if(!(h in a)){if(!t)throw new u("base intrinsic for "+e+" exists, but the property is not available.");return}if(x&&d+1>=i.length){var g=x(a,h);a=(p=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[h]}else p=j(a,h),a=a[h];p&&!o&&(B[n]=a)}}return a}}}),require_shams4=__commonJS({"../../node_modules/has-tostringtag/shams.js"(e,t){"use strict";var i=require_shams3();t.exports=function(){return i()&&!!Symbol.toStringTag}}}),require_es_set_tostringtag2=__commonJS({"../../node_modules/es-set-tostringtag/index.js"(e,t){"use strict";var i=require_get_intrinsic2()("%Object.defineProperty%",!0),r=require_shams4()(),s=require_hasown2(),n=require_type2(),a=r?Symbol.toStringTag:null;t.exports=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(void 0!==r&&"boolean"!=typeof r||void 0!==o&&"boolean"!=typeof o)throw new n("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");!a||!r&&s(e,a)||(i?i(e,a,{configurable:!o,enumerable:!1,value:t,writable:!1}):e[a]=t)}}}),require_populate2=__commonJS({"../../node_modules/form-data/lib/populate.js"(e,t){t.exports=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e}}}),require_form_data2=__commonJS({"../../node_modules/form-data/lib/form_data.js"(e,t){var i=require_combined_stream2(),r=require("util"),s=require("path"),n=require("http"),a=require("https"),o=require("url").parse,c=require("fs"),l=require("stream").Stream,u=require_mime_types2(),d=require_asynckit2(),p=require_es_set_tostringtag2(),h=require_populate2();function m(e){if(!(this instanceof m))return new m(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],i.call(this),e=e||{})this[t]=e[t]}t.exports=m,r.inherits(m,i),m.LINE_BREAK="\r\n",m.DEFAULT_CONTENT_TYPE="application/octet-stream",m.prototype.append=function(e,t,r){"string"==typeof(r=r||{})&&(r={filename:r});var s=i.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),Array.isArray(t))this._error(new Error("Arrays are not supported."));else{var n=this._multiPartHeader(e,t,r),a=this._multiPartFooter();s(n),s(t),s(a),this._trackLength(n,t,r)}},m.prototype._trackLength=function(e,t,i){var r=0;null!=i.knownLength?r+=+i.knownLength:Buffer.isBuffer(t)?r=t.length:"string"==typeof t&&(r=Buffer.byteLength(t)),this._valueLength+=r,this._overheadLength+=Buffer.byteLength(e)+m.LINE_BREAK.length,t&&(t.path||t.readable&&Object.prototype.hasOwnProperty.call(t,"httpVersion")||t instanceof l)&&(i.knownLength||this._valuesToMeasure.push(t))},m.prototype._lengthRetriever=function(e,t){Object.prototype.hasOwnProperty.call(e,"fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):c.stat(e.path,(function(i,r){var s;i?t(i):(s=r.size-(e.start?e.start:0),t(null,s))})):Object.prototype.hasOwnProperty.call(e,"httpVersion")?t(null,+e.headers["content-length"]):Object.prototype.hasOwnProperty.call(e,"httpModule")?(e.on("response",(function(i){e.pause(),t(null,+i.headers["content-length"])})),e.resume()):t("Unknown stream")},m.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var r,s=this._getContentDisposition(t,i),n=this._getContentType(t,i),a="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(n||[])};for(var c in"object"==typeof i.header&&h(o,i.header),o)if(Object.prototype.hasOwnProperty.call(o,c)){if(null==(r=o[c]))continue;Array.isArray(r)||(r=[r]),r.length&&(a+=c+": "+r.join("; ")+m.LINE_BREAK)}return"--"+this.getBoundary()+m.LINE_BREAK+a+m.LINE_BREAK},m.prototype._getContentDisposition=function(e,t){var i,r;return"string"==typeof t.filepath?i=s.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?i=s.basename(t.filename||e.name||e.path):e.readable&&Object.prototype.hasOwnProperty.call(e,"httpVersion")&&(i=s.basename(e.client._httpMessage.path||"")),i&&(r='filename="'+i+'"'),r},m.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e.name&&(i=u.lookup(e.name)),!i&&e.path&&(i=u.lookup(e.path)),!i&&e.readable&&Object.prototype.hasOwnProperty.call(e,"httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=u.lookup(t.filepath||t.filename)),i||"object"!=typeof e||(i=m.DEFAULT_CONTENT_TYPE),i},m.prototype._multiPartFooter=function(){return function(e){var t=m.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},m.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+m.LINE_BREAK},m.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t.toLowerCase()]=e[t]);return i},m.prototype.setBoundary=function(e){this._boundary=e},m.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},m.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,r=this._streams.length;i<r;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(m.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},m.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},m.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},m.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},m.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?d.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,r){i?e(i):(r.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},m.prototype.submit=function(e,t){var i,r,s={method:"post"};return"string"==typeof e?(e=o(e),r=h({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(r=h(e,s)).port||(r.port="https:"==r.protocol?443:80),r.headers=this.getHeaders(e.headers),i="https:"==r.protocol?a.request(r):n.request(r),this.getLength(function(e,r){if(e&&"Unknown stream"!==e)this._error(e);else if(r&&i.setHeader("Content-Length",r),this.pipe(i),t){var s,n=function(e,r){return i.removeListener("error",n),i.removeListener("response",s),t.call(this,e,r)};s=n.bind(this,null),i.on("error",n),i.on("response",s)}}.bind(this)),i},m.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},m.prototype.toString=function(){return"[object FormData]"},p(m,"FormData")}}),require_proxy_from_env2=__commonJS({"../../node_modules/proxy-from-env/index.js"(e){"use strict";var t=require("url").parse,i={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},r=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function s(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}e.getProxyForUrl=function(e){var n="string"==typeof e?t(e):e||{},a=n.protocol,o=n.host,c=n.port;if("string"!=typeof o||!o||"string"!=typeof a)return"";if(a=a.split(":",1)[0],!function(e,t){var i=(s("npm_config_no_proxy")||s("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var s=i.match(/^(.+):(\d+)$/),n=s?s[1]:i,a=s?parseInt(s[2]):0;return!(!a||a===t)||(/^[.*]/.test(n)?("*"===n.charAt(0)&&(n=n.slice(1)),!r.call(e,n)):e!==n)}))}(o=o.replace(/:\d*$/,""),c=parseInt(c)||i[a]||0))return"";var l=s("npm_config_"+a+"_proxy")||s(a+"_proxy")||s("npm_config_proxy")||s("all_proxy");return l&&-1===l.indexOf("://")&&(l=a+"://"+l),l}}}),require_ms4=__commonJS({"../../node_modules/ms/index.js"(e,t){var i=1e3,r=60*i,s=60*r,n=24*s,a=7*n,o=365.25*n;function c(e,t,i,r){var s=t>=1.5*i;return Math.round(e/i)+" "+r+(s?"s":"")}t.exports=function(e,t){t=t||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var c=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*a;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=n)return c(e,t,n,"day");if(t>=s)return c(e,t,s,"hour");if(t>=r)return c(e,t,r,"minute");if(t>=i)return c(e,t,i,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=n)return Math.round(e/n)+"d";if(t>=s)return Math.round(e/s)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=i)return Math.round(e/i)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),require_common6=__commonJS({"../../node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let r,s,n,a=null;function o(...e){if(!o.enabled)return;const i=o,s=Number(new Date),n=s-(r||s);i.diff=n,i.prev=r,i.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const n=t.formatters[s];if("function"==typeof n){const t=e[a];r=n.call(i,t),e.splice(a,1),a--}return r})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=i,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,n=t.enabled(e)),n),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function i(e,i){const r=t(this.namespace+(void 0===i?":":i)+e);return r.log=this.log,r}function r(e,t){let i=0,r=0,s=-1,n=0;for(;i<e.length;)if(r<t.length&&(t[r]===e[i]||"*"===t[r]))"*"===t[r]?(s=r,n=i,r++):(i++,r++);else{if(-1===s)return!1;r=s+1,n++,i=n}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of i)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const i of t.skips)if(r(e,i))return!1;for(const i of t.names)if(r(e,i))return!0;return!1},t.humanize=require_ms4(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((i=>{t[i]=e[i]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let i=0;for(let t=0;t<e.length;t++)i=(i<<5)-i+e.charCodeAt(t),i|=0;return t.colors[Math.abs(i)%t.colors.length]},t.enable(t.load()),t}}}),require_browser4=__commonJS({"../../node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;e.splice(1,0,i,"color: inherit");let r=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),e.splice(s,0,i)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(e){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=require_common6()(e);var{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}}),require_has_flag2=__commonJS({"../../node_modules/has-flag/index.js"(e,t){"use strict";t.exports=(e,t=process.argv)=>{const i=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(i+e),s=t.indexOf("--");return-1!==r&&(-1===s||r<s)}}}),require_supports_color2=__commonJS({"../../node_modules/supports-color/index.js"(e,t){"use strict";var i,r=require("os"),s=require("tty"),n=require_has_flag2(),{env:a}=process;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function c(e,t){if(0===i)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(e&&!t&&void 0===i)return 0;const s=i||0;if("dumb"===a.TERM)return s;if("win32"===process.platform){const e=r.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in a)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in a))||"codeship"===a.CI_NAME?1:s;if("TEAMCITY_VERSION"in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if("truecolor"===a.COLORTERM)return 3;if("TERM_PROGRAM"in a){const e=parseInt((a.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(a.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||"COLORTERM"in a?1:s}n("no-color")||n("no-colors")||n("color=false")||n("color=never")?i=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(i=1),"FORCE_COLOR"in a&&(i="true"===a.FORCE_COLOR?1:"false"===a.FORCE_COLOR?0:0===a.FORCE_COLOR.length?1:Math.min(parseInt(a.FORCE_COLOR,10),3)),t.exports={supportsColor:function(e){return o(c(e,e&&e.isTTY))},stdout:o(c(!0,s.isatty(1))),stderr:o(c(!0,s.isatty(2)))}}}),require_node4=__commonJS({"../../node_modules/debug/src/node.js"(e,t){var i=require("tty"),r=require("util");e.init=function(t){t.inspectOpts={};const i=Object.keys(e.inspectOpts);for(let r=0;r<i.length;r++)t.inspectOpts[i[r]]=e.inspectOpts[i[r]]},e.log=function(...t){return process.stderr.write(r.formatWithOptions(e.inspectOpts,...t)+"\n")},e.formatArgs=function(i){const{namespace:r,useColors:s}=this;if(s){const e=this.color,s="[3"+(e<8?e:"8;5;"+e),n=`  ${s};1m${r} [0m`;i[0]=n+i[0].split("\n").join("\n"+n),i.push(s+"m+"+t.exports.humanize(this.diff)+"[0m")}else i[0]=function(){if(e.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+r+" "+i[0]},e.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},e.load=function(){return process.env.DEBUG},e.useColors=function(){return"colors"in e.inspectOpts?Boolean(e.inspectOpts.colors):i.isatty(process.stderr.fd)},e.destroy=r.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{const t=require_supports_color2();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}e.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const i=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[i]=r,e}),{}),t.exports=require_common6()(e);var{formatters:s}=t.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}}),require_src5=__commonJS({"../../node_modules/debug/src/index.js"(e,t){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?t.exports=require_browser4():t.exports=require_node4()}}),require_debug2=__commonJS({"../../node_modules/follow-redirects/debug.js"(e,t){var i;t.exports=function(){if(!i){try{i=require_src5()("follow-redirects")}catch(e){}"function"!=typeof i&&(i=function(){})}i.apply(null,arguments)}}}),require_follow_redirects2=__commonJS({"../../node_modules/follow-redirects/index.js"(e,t){var i,r,s,n=require("url"),a=n.URL,o=require("http"),c=require("https"),l=require("stream").Writable,u=require("assert"),d=require_debug2();i="undefined"!=typeof process,r="undefined"!=typeof window&&"undefined"!=typeof document,s=F(Error.captureStackTrace),i||!r&&s||console.warn("The follow-redirects package should be excluded from browser builds.");var p=!1;try{u(new a(""))}catch(e){p="ERR_INVALID_URL"===e.code}var h=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],m=["abort","aborted","connect","error","socket","timeout"],f=Object.create(null);m.forEach((function(e){f[e]=function(t,i,r){this._redirectable.emit(e,t,i,r)}}));var g=I("ERR_INVALID_URL","Invalid URL",TypeError),_=I("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),y=I("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",_),b=I("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),v=I("ERR_STREAM_WRITE_AFTER_END","write after end"),x=l.prototype.destroy||E;function S(e,t){l.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var i=this;this._onNativeResponse=function(e){try{i._processResponse(e)}catch(e){i.emit("error",e instanceof _?e:new _({cause:e}))}},this._performRequest()}function w(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(r){var s=r+":",n=i[s]=e[r],o=t[r]=Object.create(n);Object.defineProperties(o,{request:{value:function(e,r,n){var o;return o=e,a&&o instanceof a?e=T(e):R(e)?e=T(C(e)):(n=r,r=A(e),e={protocol:s}),F(r)&&(n=r,r=null),(r=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,r)).nativeProtocols=i,R(r.host)||R(r.hostname)||(r.hostname="::1"),u.equal(r.protocol,s,"protocol mismatch"),d("options",r),new S(r,n)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var r=o.request(e,t,i);return r.end(),r},configurable:!0,enumerable:!0,writable:!0}})})),t}function E(){}function C(e){var t;if(p)t=new a(e);else if(!R((t=A(n.parse(e))).protocol))throw new g({input:e});return t}function A(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new g({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new g({input:e.href||e});return e}function T(e,t){var i=t||{};for(var r of h)i[r]=e[r];return i.hostname.startsWith("[")&&(i.hostname=i.hostname.slice(1,-1)),""!==i.port&&(i.port=Number(i.port)),i.path=i.search?i.pathname+i.search:i.pathname,i}function P(e,t){var i;for(var r in t)e.test(r)&&(i=t[r],delete t[r]);return null==i?void 0:String(i).trim()}function I(e,t,i){function r(i){F(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return r.prototype=new(i||Error),Object.defineProperties(r.prototype,{constructor:{value:r,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),r}function k(e,t){for(var i of m)e.removeListener(i,f[i]);e.on("error",E),e.destroy(t)}function R(e){return"string"==typeof e||e instanceof String}function F(e){return"function"==typeof e}S.prototype=Object.create(l.prototype),S.prototype.abort=function(){k(this._currentRequest),this._currentRequest.abort(),this.emit("abort")},S.prototype.destroy=function(e){return k(this._currentRequest,e),x.call(this,e),this},S.prototype.write=function(e,t,i){if(this._ending)throw new v;if(!R(e)&&("object"!=typeof(r=e)||!("length"in r)))throw new TypeError("data should be a string, Buffer or Uint8Array");var r;F(t)&&(i=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,i)):(this.emit("error",new b),this.abort()):i&&i()},S.prototype.end=function(e,t,i){if(F(e)?(i=e,e=t=null):F(t)&&(i=t,t=null),e){var r=this,s=this._currentRequest;this.write(e,t,(function(){r._ended=!0,s.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},S.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},S.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},S.prototype.setTimeout=function(e,t){var i=this;function r(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),n()}),e),r(t)}function n(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",n),i.removeListener("error",n),i.removeListener("response",n),i.removeListener("close",n),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",r),this.on("abort",n),this.on("error",n),this.on("response",n),this.on("close",n),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){S.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(S.prototype,e,{get:function(){return this._currentRequest[e]}})})),S.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},S.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw new TypeError("Unsupported protocol "+e);if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var r=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(r._redirectable=this,m))r.on(s,f[s]);if(this._currentUrl=/^\//.test(this._options.path)?n.format(this._options):this._options.path,this._isRedirect){var a=0,o=this,c=this._requestBodyBuffers;!function e(t){if(r===o._currentRequest)if(t)o.emit("error",t);else if(a<c.length){var i=c[a++];r.finished||r.write(i.data,i.encoding,e)}else o._ended&&r.end()}()}},S.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i,r=e.headers.location;if(!r||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(k(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new y;var s=this._options.beforeRedirect;s&&(i=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var o=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],P(/^content-/i,this._options.headers));var c,l,h=P(/^host$/i,this._options.headers),m=C(this._currentUrl),f=h||m.host,g=/^\w+:/.test(r)?this._currentUrl:n.format(Object.assign(m,{host:f})),_=(c=r,l=g,p?new a(c,l):C(n.resolve(l,c)));if(d("redirecting to",_.href),this._isRedirect=!0,T(_,this._options),(_.protocol!==m.protocol&&"https:"!==_.protocol||_.host!==f&&!function(e,t){u(R(e)&&R(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(_.host,f))&&P(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),F(s)){var b={headers:e.headers,statusCode:t},v={url:g,method:o,headers:i};s(this._options,b,v),this._sanitizeOptions(this._options)}this._performRequest()},t.exports=w({http:o,https:c}),t.exports.wrap=w}}),require_axios2=__commonJS({"../../node_modules/axios/dist/node/axios.cjs"(e,t){"use strict";var i=require_form_data2(),r=require("crypto"),s=require("url"),n=require_proxy_from_env2(),a=require("http"),o=require("https"),c=require("util"),l=require_follow_redirects2(),u=require("zlib"),d=require("stream"),p=require("events");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=h(i),f=h(r),g=h(s),_=h(n),y=h(a),b=h(o),v=h(c),x=h(l),S=h(u),w=h(d);function E(e,t){return function(){return e.apply(t,arguments)}}var{toString:C}=Object.prototype,{getPrototypeOf:A}=Object,{iterator:T,toStringTag:P}=Symbol,I=(e=>t=>{const i=C.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),k=e=>(e=e.toLowerCase(),t=>I(t)===e),R=e=>t=>typeof t===e,{isArray:F}=Array,B=R("undefined");var O=k("ArrayBuffer");var N=R("string"),D=R("function"),j=R("number"),L=e=>null!==e&&"object"==typeof e,U=e=>{if("object"!==I(e))return!1;const t=A(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||P in e||T in e)},M=k("Date"),q=k("File"),H=k("Blob"),z=k("FileList"),V=k("URLSearchParams"),[K,G,W,J]=["ReadableStream","Request","Response","Headers"].map(k);function $(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),F(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const s=i?Object.getOwnPropertyNames(e):Object.keys(e),n=s.length;let a;for(r=0;r<n;r++)a=s[r],t.call(null,e[a],a,e)}}function Z(e,t){t=t.toLowerCase();const i=Object.keys(e);let r,s=i.length;for(;s-- >0;)if(r=i[s],t===r.toLowerCase())return r;return null}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,X=e=>!B(e)&&e!==Y;var Q=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&A(Uint8Array)),ee=k("HTMLFormElement"),te=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),ie=k("RegExp"),re=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),r={};$(i,((i,s)=>{let n;!1!==(n=t(i,s,e))&&(r[s]=n||i)})),Object.defineProperties(e,r)};var se,ne,ae,oe,ce=k("AsyncFunction"),le=(se="function"==typeof setImmediate,ne=D(Y.postMessage),se?setImmediate:ne?(ae=`axios@${Math.random()}`,oe=[],Y.addEventListener("message",(({source:e,data:t})=>{e===Y&&t===ae&&oe.length&&oe.shift()()}),!1),e=>{oe.push(e),Y.postMessage(ae,"*")}):e=>setTimeout(e)),ue="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Y):"undefined"!=typeof process&&process.nextTick||le,de={isArray:F,isArrayBuffer:O,isBuffer:function(e){return null!==e&&!B(e)&&null!==e.constructor&&!B(e.constructor)&&D(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||D(e.append)&&("formdata"===(t=I(e))||"object"===t&&D(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&O(e.buffer),t},isString:N,isNumber:j,isBoolean:e=>!0===e||!1===e,isObject:L,isPlainObject:U,isReadableStream:K,isRequest:G,isResponse:W,isHeaders:J,isUndefined:B,isDate:M,isFile:q,isBlob:H,isRegExp:ie,isFunction:D,isStream:e=>L(e)&&D(e.pipe),isURLSearchParams:V,isTypedArray:Q,isFileList:z,forEach:$,merge:function e(){const{caseless:t}=X(this)&&this||{},i={},r=(r,s)=>{const n=t&&Z(i,s)||s;U(i[n])&&U(r)?i[n]=e(i[n],r):U(r)?i[n]=e({},r):F(r)?i[n]=r.slice():i[n]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&$(arguments[e],r);return i},extend:(e,t,i,{allOwnKeys:r}={})=>($(t,((t,r)=>{i&&D(t)?e[r]=E(t,i):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,r)=>{let s,n,a;const o={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),n=s.length;n-- >0;)a=s[n],r&&!r(a,e,t)||o[a]||(t[a]=e[a],o[a]=!0);e=!1!==i&&A(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:I,kindOfTest:k,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const r=e.indexOf(t,i);return-1!==r&&r===i},toArray:e=>{if(!e)return null;if(F(e))return e;let t=e.length;if(!j(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[T]).call(e);let r;for(;(r=i.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const r=[];for(;null!==(i=e.exec(t));)r.push(i);return r},isHTMLForm:ee,hasOwnProperty:te,hasOwnProp:te,reduceDescriptors:re,freezeMethods:e=>{re(e,((t,i)=>{if(D(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const r=e[i];D(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},r=e=>{e.forEach((e=>{i[e]=!0}))};return F(e)?r(e):r(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Z,global:Y,isContextDefined:X,isSpecCompliantForm:function(e){return!!(e&&D(e.append)&&"FormData"===e[P]&&e[T])},toJSONObject:e=>{const t=new Array(10),i=(e,r)=>{if(L(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const s=F(e)?[]:{};return $(e,((e,t)=>{const n=i(e,r+1);!B(n)&&(s[t]=n)})),t[r]=void 0,s}}return e};return i(e,0)},isAsyncFn:ce,isThenable:e=>e&&(L(e)||D(e))&&D(e.then)&&D(e.catch),setImmediate:le,asap:ue,isIterable:e=>null!=e&&D(e[T])};function pe(e,t,i,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}de.inherits(pe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:de.toJSONObject(this.config),code:this.code,status:this.status}}});var he=pe.prototype,me={};function fe(e){return de.isPlainObject(e)||de.isArray(e)}function ge(e){return de.endsWith(e,"[]")?e.slice(0,-2):e}function _e(e,t,i){return e?e.concat(t).map((function(e,t){return e=ge(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{me[e]={value:e}})),Object.defineProperties(pe,me),Object.defineProperty(he,"isAxiosError",{value:!0}),pe.from=(e,t,i,r,s,n)=>{const a=Object.create(he);return de.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),pe.call(a,e.message,t,i,r,s),a.cause=e,a.name=e.name,n&&Object.assign(a,n),a};var ye=de.toFlatObject(de,{},null,(function(e){return/^is[A-Z]/.test(e)}));function be(e,t,i){if(!de.isObject(e))throw new TypeError("target must be an object");t=t||new(m.default||FormData);const r=(i=de.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!de.isUndefined(t[e])}))).metaTokens,s=i.visitor||l,n=i.dots,a=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(de.isDate(e))return e.toISOString();if(!o&&de.isBlob(e))throw new pe("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(e)||de.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,i,s){let o=e;if(e&&!s&&"object"==typeof e)if(de.endsWith(i,"{}"))i=r?i:i.slice(0,-2),e=JSON.stringify(e);else if(de.isArray(e)&&function(e){return de.isArray(e)&&!e.some(fe)}(e)||(de.isFileList(e)||de.endsWith(i,"[]"))&&(o=de.toArray(e)))return i=ge(i),o.forEach((function(e,r){!de.isUndefined(e)&&null!==e&&t.append(!0===a?_e([i],r,n):null===a?i:i+"[]",c(e))})),!1;return!!fe(e)||(t.append(_e(s,i,n),c(e)),!1)}const u=[],d=Object.assign(ye,{defaultVisitor:l,convertValue:c,isVisitable:fe});if(!de.isObject(e))throw new TypeError("data must be an object");return function e(i,r){if(!de.isUndefined(i)){if(-1!==u.indexOf(i))throw Error("Circular reference detected in "+r.join("."));u.push(i),de.forEach(i,(function(i,n){!0===(!(de.isUndefined(i)||null===i)&&s.call(t,i,de.isString(n)?n.trim():n,r,d))&&e(i,r?r.concat(n):[n])})),u.pop()}}(e),t}function ve(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function xe(e,t){this._pairs=[],e&&be(e,this,t)}var Se=xe.prototype;function we(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ee(e,t,i){if(!t)return e;const r=i&&i.encode||we;de.isFunction(i)&&(i={serialize:i});const s=i&&i.serialize;let n;if(n=s?s(t,i):de.isURLSearchParams(t)?t.toString():new xe(t,i).toString(r),n){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}Se.append=function(e,t){this._pairs.push([e,t])},Se.toString=function(e){const t=e?function(t){return e.call(this,t,ve)}:ve;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Ce=class{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){de.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Ae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Te=g.default.URLSearchParams,Pe="abcdefghijklmnopqrstuvwxyz",Ie="0123456789",ke={DIGIT:Ie,ALPHA:Pe,ALPHA_DIGIT:Pe+Pe.toUpperCase()+Ie},Re={isNode:!0,classes:{URLSearchParams:Te,FormData:m.default,Blob:"undefined"!=typeof Blob&&Blob||null},ALPHABET:ke,generateString:(e=16,t=ke.ALPHA_DIGIT)=>{let i="";const{length:r}=t,s=new Uint32Array(e);f.default.randomFillSync(s);for(let n=0;n<e;n++)i+=t[s[n]%r];return i},protocols:["http","https","file","data"]},Fe="undefined"!=typeof window&&"undefined"!=typeof document,Be="object"==typeof navigator&&navigator||void 0,Oe=Fe&&(!Be||["ReactNative","NativeScript","NS"].indexOf(Be.product)<0),Ne="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,De=Fe&&window.location.href||"http://localhost",je={...Object.freeze({__proto__:null,hasBrowserEnv:Fe,hasStandardBrowserWebWorkerEnv:Ne,hasStandardBrowserEnv:Oe,navigator:Be,origin:De}),...Re};function Le(e){function t(e,i,r,s){let n=e[s++];if("__proto__"===n)return!0;const a=Number.isFinite(+n),o=s>=e.length;if(n=!n&&de.isArray(r)?r.length:n,o)return de.hasOwnProp(r,n)?r[n]=[r[n],i]:r[n]=i,!a;r[n]&&de.isObject(r[n])||(r[n]=[]);return t(e,i,r[n],s)&&de.isArray(r[n])&&(r[n]=function(e){const t={},i=Object.keys(e);let r;const s=i.length;let n;for(r=0;r<s;r++)n=i[r],t[n]=e[n];return t}(r[n])),!a}if(de.isFormData(e)&&de.isFunction(e.entries)){const i={};return de.forEachEntry(e,((e,r)=>{t(function(e){return de.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,i,0)})),i}return null}var Ue={transitional:Ae,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=de.isObject(e);s&&de.isHTMLForm(e)&&(e=new FormData(e));if(de.isFormData(e))return r?JSON.stringify(Le(e)):e;if(de.isArrayBuffer(e)||de.isBuffer(e)||de.isStream(e)||de.isFile(e)||de.isBlob(e)||de.isReadableStream(e))return e;if(de.isArrayBufferView(e))return e.buffer;if(de.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let n;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return be(e,new je.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,r){return je.isNode&&de.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((n=de.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return be(n?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,i){if(de.isString(e))try{return(t||JSON.parse)(e),de.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ue.transitional,i=t&&t.forcedJSONParsing,r="json"===this.responseType;if(de.isResponse(e)||de.isReadableStream(e))return e;if(e&&de.isString(e)&&(i&&!this.responseType||r)){const i=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw pe.from(e,pe.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],(e=>{Ue.headers[e]={}}));var Me=Ue,qe=de.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),He=Symbol("internals");function ze(e){return e&&String(e).trim().toLowerCase()}function Ve(e){return!1===e||null==e?e:de.isArray(e)?e.map(Ve):String(e)}function Ke(e,t,i,r,s){return de.isFunction(r)?r.call(this,t,i):(s&&(t=i),de.isString(t)?de.isString(r)?-1!==t.indexOf(r):de.isRegExp(r)?r.test(t):void 0:void 0)}var Ge=class{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(e,t,i){const s=ze(t);if(!s)throw new Error("header name must be a non-empty string");const n=de.findKey(r,s);(!n||void 0===r[n]||!0===i||void 0===i&&!1!==r[n])&&(r[n||t]=Ve(e))}const n=(e,t)=>de.forEach(e,((e,i)=>s(e,i,t)));if(de.isPlainObject(e)||e instanceof this.constructor)n(e,t);else if(de.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))n((e=>{const t={};let i,r,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),i=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!i||t[i]&&qe[i]||("set-cookie"===i?t[i]?t[i].push(r):t[i]=[r]:t[i]=t[i]?t[i]+", "+r:r)})),t})(e),t);else if(de.isObject(e)&&de.isIterable(e)){let i,r,s={};for(const t of e){if(!de.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(i=s[r])?de.isArray(i)?[...i,t[1]]:[i,t[1]]:t[1]}n(s,t)}else null!=e&&s(t,e,i);return this}get(e,t){if(e=ze(e)){const i=de.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=i.exec(e);)t[r[1]]=r[2];return t}(e);if(de.isFunction(t))return t.call(this,e,i);if(de.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ze(e)){const i=de.findKey(this,e);return!(!i||void 0===this[i]||t&&!Ke(0,this[i],i,t))}return!1}delete(e,t){const i=this;let r=!1;function s(e){if(e=ze(e)){const s=de.findKey(i,e);!s||t&&!Ke(0,i[s],s,t)||(delete i[s],r=!0)}}return de.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];e&&!Ke(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return de.forEach(this,((r,s)=>{const n=de.findKey(i,s);if(n)return t[n]=Ve(r),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Ve(r),i[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return de.forEach(this,((i,r)=>{null!=i&&!1!==i&&(t[r]=e&&de.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[He]=this[He]={accessors:{}}).accessors,i=this.prototype;function r(e){const r=ze(e);t[r]||(!function(e,t){const i=de.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+i,{value:function(e,i,s){return this[r].call(this,t,e,i,s)},configurable:!0})}))}(i,e),t[r]=!0)}return de.isArray(e)?e.forEach(r):r(e),this}};Ge.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(Ge.prototype,(({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}})),de.freezeMethods(Ge);var We=Ge;function Je(e,t){const i=this||Me,r=t||i,s=We.from(r.headers);let n=r.data;return de.forEach(e,(function(e){n=e.call(i,n,s.normalize(),t?t.status:void 0)})),s.normalize(),n}function $e(e){return!(!e||!e.__CANCEL__)}function Ze(e,t,i){pe.call(this,null==e?"canceled":e,pe.ERR_CANCELED,t,i),this.name="CanceledError"}function Ye(e,t,i){const r=i.config.validateStatus;i.status&&r&&!r(i.status)?t(new pe("Request failed with status code "+i.status,[pe.ERR_BAD_REQUEST,pe.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Xe(e,t,i){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==i)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}de.inherits(Ze,pe,{__CANCEL__:!0});var Qe="1.9.0";function et(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var tt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;var it=Symbol("internals"),rt=class extends w.default.Transform{constructor(e){super({readableHighWaterMark:(e=de.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!de.isUndefined(t[e])))).chunkSize});const t=this[it]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{"progress"===e&&(t.isCaptured||(t.isCaptured=!0))}))}_read(e){const t=this[it];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const r=this[it],s=r.maxRate,n=this.readableHighWaterMark,a=r.timeWindow,o=s/(1e3/a),c=!1!==r.minChunkSize?Math.max(r.minChunkSize,.01*o):0,l=(e,t)=>{const i=Buffer.byteLength(e);r.bytesSeen+=i,r.bytes+=i,r.isCaptured&&this.emit("progress",r.bytesSeen),this.push(e)?process.nextTick(t):r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(t)}},u=(e,t)=>{const i=Buffer.byteLength(e);let u,d=null,p=n,h=0;if(s){const e=Date.now();(!r.ts||(h=e-r.ts)>=a)&&(r.ts=e,u=o-r.bytes,r.bytes=u<0?-u:0,h=0),u=o-r.bytes}if(s){if(u<=0)return setTimeout((()=>{t(null,e)}),a-h);u<p&&(p=u)}p&&i>p&&i-p>c&&(d=e.subarray(p),e=e.subarray(0,p)),l(e,d?()=>{process.nextTick(t,null,d)}:t)};u(e,(function e(t,r){if(t)return i(t);r?u(r,e):i(null)}))}},{asyncIterator:st}=Symbol,nt=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[st]?yield*e[st]():yield e},at=je.ALPHABET.ALPHA_DIGIT+"-_",ot="function"==typeof TextEncoder?new TextEncoder:new v.default.TextEncoder,ct="\r\n",lt=ot.encode(ct),ut=class{constructor(e,t){const{escapeName:i}=this.constructor,r=de.isString(t);let s=`Content-Disposition: form-data; name="${i(e)}"${!r&&t.name?`; filename="${i(t.name)}"`:""}${ct}`;r?t=ot.encode(String(t).replace(/\r?\n|\r\n?/g,ct)):s+=`Content-Type: ${t.type||"application/octet-stream"}${ct}`,this.headers=ot.encode(s+ct),this.contentLength=r?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;de.isTypedArray(e)?yield e:yield*nt(e),yield lt}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}},dt=(e,t,i)=>{const{tag:r="form-data-boundary",size:s=25,boundary:n=r+"-"+je.generateString(s,at)}=i||{};if(!de.isFormData(e))throw TypeError("FormData instance required");if(n.length<1||n.length>70)throw Error("boundary must be 10-70 characters long");const a=ot.encode("--"+n+ct),o=ot.encode("--"+n+"--"+ct);let c=o.byteLength;const l=Array.from(e.entries()).map((([e,t])=>{const i=new ut(e,t);return c+=i.size,i}));c+=a.byteLength*l.length,c=de.toFiniteNumber(c);const u={"Content-Type":`multipart/form-data; boundary=${n}`};return Number.isFinite(c)&&(u["Content-Length"]=c),t&&t(u),d.Readable.from(async function*(){for(const e of l)yield a,yield*e.encode();yield o}())},pt=class extends w.default.Transform{__transform(e,t,i){this.push(e),i()}_transform(e,t,i){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,i)}},ht=(e,t)=>de.isAsyncFn(e)?function(...i){const r=i.pop();e.apply(this,i).then((e=>{try{t?r(null,...t(e)):r(null,e)}catch(e){r(e)}}),r)}:e;var mt=(e,t,i=3)=>{let r=0;const s=function(e,t){e=e||10;const i=new Array(e),r=new Array(e);let s,n=0,a=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),l=r[a];s||(s=c),i[n]=o,r[n]=c;let u=a,d=0;for(;u!==n;)d+=i[u++],u%=e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let i,r,s=0,n=1e3/t;const a=(t,n=Date.now())=>{s=n,i=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),o=t-s;o>=n?a(e,t):(i=e,r||(r=setTimeout((()=>{r=null,a(i)}),n-o)))},()=>i&&a(i)]}((i=>{const n=i.loaded,a=i.lengthComputable?i.total:void 0,o=n-r,c=s(o);r=n;e({loaded:n,total:a,progress:a?n/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&n<=a?(a-n)/c:void 0,event:i,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),i)},ft=(e,t)=>{const i=null!=e;return[r=>t[0]({lengthComputable:i,total:e,loaded:r}),t[1]]},gt=e=>(...t)=>de.asap((()=>e(...t))),_t={flush:S.default.constants.Z_SYNC_FLUSH,finishFlush:S.default.constants.Z_SYNC_FLUSH},yt={flush:S.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:S.default.constants.BROTLI_OPERATION_FLUSH},bt=de.isFunction(S.default.createBrotliDecompress),{http:vt,https:xt}=x.default,St=/https:?/,wt=je.protocols.map((e=>e+":")),Et=(e,[t,i])=>(e.on("end",i).on("error",i),t);function Ct(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function At(e,t,i){let r=t;if(!r&&!1!==r){const e=_.default.getProxyForUrl(i);e&&(r=new URL(e))}if(r){if(r.username&&(r.auth=(r.username||"")+":"+(r.password||"")),r.auth){(r.auth.username||r.auth.password)&&(r.auth=(r.auth.username||"")+":"+(r.auth.password||""));const t=Buffer.from(r.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=r.hostname||r.host;e.hostname=t,e.host=t,e.port=r.port,e.path=i,r.protocol&&(e.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`)}e.beforeRedirects.proxy=function(e){At(e,t,e.href)}}var Tt="undefined"!=typeof process&&"process"===de.kindOf(process),Pt=(e,t)=>(({address:e,family:t})=>{if(!de.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}})(de.isObject(e)?e:{address:e,family:t}),It=Tt&&function(e){return t=async function(t,i,r){let{data:s,lookup:n,family:a}=e;const{responseType:o,responseEncoding:c}=e,l=e.method.toUpperCase();let u,d,h=!1;if(n){const e=ht(n,(e=>de.isArray(e)?e:[e]));n=(t,i,r)=>{e(t,i,((e,t,s)=>{if(e)return r(e);const n=de.isArray(t)?t.map((e=>Pt(e))):[Pt(t,s)];i.all?r(e,n):r(e,n[0].address,n[0].family)}))}}const m=new p.EventEmitter,f=()=>{e.cancelToken&&e.cancelToken.unsubscribe(g),e.signal&&e.signal.removeEventListener("abort",g),m.removeAllListeners()};function g(t){m.emit("abort",!t||t.type?new Ze(null,e,d):t)}r(((e,t)=>{u=!0,t&&(h=!0,f())})),m.once("abort",i),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(g),e.signal&&(e.signal.aborted?g():e.signal.addEventListener("abort",g)));const _=Xe(e.baseURL,e.url,e.allowAbsoluteUrls),x=new URL(_,je.hasBrowserEnv?je.origin:void 0),E=x.protocol||wt[0];if("data:"===E){let r;if("GET"!==l)return Ye(t,i,{status:405,statusText:"method not allowed",headers:{},config:e});try{r=function(e,t,i){const r=i&&i.Blob||je.classes.Blob,s=et(e);if(void 0===t&&r&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const i=tt.exec(e);if(!i)throw new pe("Invalid URL",pe.ERR_INVALID_URL);const n=i[1],a=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),a?"base64":"utf8");if(t){if(!r)throw new pe("Blob is not supported",pe.ERR_NOT_SUPPORT);return new r([c],{type:n})}return c}throw new pe("Unsupported protocol "+s,pe.ERR_NOT_SUPPORT)}(e.url,"blob"===o,{Blob:e.env&&e.env.Blob})}catch(t){throw pe.from(t,pe.ERR_BAD_REQUEST,e)}return"text"===o?(r=r.toString(c),c&&"utf8"!==c||(r=de.stripBOM(r))):"stream"===o&&(r=w.default.Readable.from(r)),Ye(t,i,{data:r,status:200,statusText:"OK",headers:new We,config:e})}if(-1===wt.indexOf(E))return i(new pe("Unsupported protocol "+E,pe.ERR_BAD_REQUEST,e));const C=We.from(e.headers).normalize();C.set("User-Agent","axios/"+Qe,!1);const{onUploadProgress:A,onDownloadProgress:T}=e,P=e.maxRate;let I,k;if(de.isSpecCompliantForm(s)){const e=C.getContentType(/boundary=([-_\w\d]{10,70})/i);s=dt(s,(e=>{C.set(e)}),{tag:`axios-${Qe}-boundary`,boundary:e&&e[1]||void 0})}else if(de.isFormData(s)&&de.isFunction(s.getHeaders)){if(C.set(s.getHeaders()),!C.hasContentLength())try{const e=await v.default.promisify(s.getLength).call(s);Number.isFinite(e)&&e>=0&&C.setContentLength(e)}catch(e){}}else if(de.isBlob(s)||de.isFile(s))s.size&&C.setContentType(s.type||"application/octet-stream"),C.setContentLength(s.size||0),s=w.default.Readable.from(nt(s));else if(s&&!de.isStream(s)){if(Buffer.isBuffer(s));else if(de.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else{if(!de.isString(s))return i(new pe("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",pe.ERR_BAD_REQUEST,e));s=Buffer.from(s,"utf-8")}if(C.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return i(new pe("Request body larger than maxBodyLength limit",pe.ERR_BAD_REQUEST,e))}const R=de.toFiniteNumber(C.getContentLength());let F,B;de.isArray(P)?(I=P[0],k=P[1]):I=k=P,s&&(A||I)&&(de.isStream(s)||(s=w.default.Readable.from(s,{objectMode:!1})),s=w.default.pipeline([s,new rt({maxRate:de.toFiniteNumber(I)})],de.noop),A&&s.on("progress",Et(s,ft(R,mt(gt(A),!1,3))))),e.auth&&(F=(e.auth.username||"")+":"+(e.auth.password||"")),!F&&x.username&&(F=x.username+":"+x.password),F&&C.delete("authorization");try{B=Ee(x.pathname+x.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const r=new Error(t.message);return r.config=e,r.url=e.url,r.exists=!0,i(r)}C.set("Accept-Encoding","gzip, compress, deflate"+(bt?", br":""),!1);const O={path:B,method:l,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:F,protocol:E,family:a,beforeRedirect:Ct,beforeRedirects:{}};let N;!de.isUndefined(n)&&(O.lookup=n),e.socketPath?O.socketPath=e.socketPath:(O.hostname=x.hostname.startsWith("[")?x.hostname.slice(1,-1):x.hostname,O.port=x.port,At(O,e.proxy,E+"//"+x.hostname+(x.port?":"+x.port:"")+O.path));const D=St.test(O.protocol);if(O.agent=D?e.httpsAgent:e.httpAgent,e.transport?N=e.transport:0===e.maxRedirects?N=D?b.default:y.default:(e.maxRedirects&&(O.maxRedirects=e.maxRedirects),e.beforeRedirect&&(O.beforeRedirects.config=e.beforeRedirect),N=D?xt:vt),e.maxBodyLength>-1?O.maxBodyLength=e.maxBodyLength:O.maxBodyLength=1/0,e.insecureHTTPParser&&(O.insecureHTTPParser=e.insecureHTTPParser),d=N.request(O,(function(r){if(d.destroyed)return;const s=[r],n=+r.headers["content-length"];if(T||k){const e=new rt({maxRate:de.toFiniteNumber(k)});T&&e.on("progress",Et(e,ft(n,mt(gt(T),!0,3)))),s.push(e)}let a=r;const u=r.req||d;if(!1!==e.decompress&&r.headers["content-encoding"])switch("HEAD"!==l&&204!==r.statusCode||delete r.headers["content-encoding"],(r.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":s.push(S.default.createUnzip(_t)),delete r.headers["content-encoding"];break;case"deflate":s.push(new pt),s.push(S.default.createUnzip(_t)),delete r.headers["content-encoding"];break;case"br":bt&&(s.push(S.default.createBrotliDecompress(yt)),delete r.headers["content-encoding"])}a=s.length>1?w.default.pipeline(s,de.noop):s[0];const p=w.default.finished(a,(()=>{p(),f()})),g={status:r.statusCode,statusText:r.statusMessage,headers:new We(r.headers),config:e,request:u};if("stream"===o)g.data=a,Ye(t,i,g);else{const r=[];let s=0;a.on("data",(function(t){r.push(t),s+=t.length,e.maxContentLength>-1&&s>e.maxContentLength&&(h=!0,a.destroy(),i(new pe("maxContentLength size of "+e.maxContentLength+" exceeded",pe.ERR_BAD_RESPONSE,e,u)))})),a.on("aborted",(function(){if(h)return;const t=new pe("stream has been aborted",pe.ERR_BAD_RESPONSE,e,u);a.destroy(t),i(t)})),a.on("error",(function(t){d.destroyed||i(pe.from(t,null,e,u))})),a.on("end",(function(){try{let e=1===r.length?r[0]:Buffer.concat(r);"arraybuffer"!==o&&(e=e.toString(c),c&&"utf8"!==c||(e=de.stripBOM(e))),g.data=e}catch(t){return i(pe.from(t,null,e,g.request,g))}Ye(t,i,g)}))}m.once("abort",(e=>{a.destroyed||(a.emit("error",e),a.destroy())}))})),m.once("abort",(e=>{i(e),d.destroy(e)})),d.on("error",(function(t){i(pe.from(t,null,e,d))})),d.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t))return void i(new pe("error trying to parse `config.timeout` to int",pe.ERR_BAD_OPTION_VALUE,e,d));d.setTimeout(t,(function(){if(u)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Ae;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new pe(t,r.clarifyTimeoutError?pe.ETIMEDOUT:pe.ECONNABORTED,e,d)),g()}))}if(de.isStream(s)){let t=!1,i=!1;s.on("end",(()=>{t=!0})),s.once("error",(e=>{i=!0,d.destroy(e)})),s.on("close",(()=>{t||i||g(new Ze("Request stream has been aborted",e,d))})),s.pipe(d)}else d.end(s)},new Promise(((e,i)=>{let r,s;const n=(e,t)=>{s||(s=!0,r&&r(e,t))},a=e=>{n(e,!0),i(e)};t((t=>{n(t),e(t)}),a,(e=>r=e)).catch(a)}));var t},kt=je.hasStandardBrowserEnv?((e,t)=>i=>(i=new URL(i,je.origin),e.protocol===i.protocol&&e.host===i.host&&(t||e.port===i.port)))(new URL(je.origin),je.navigator&&/(msie|trident)/i.test(je.navigator.userAgent)):()=>!0,Rt=je.hasStandardBrowserEnv?{write(e,t,i,r,s,n){const a=[e+"="+encodeURIComponent(t)];de.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),de.isString(r)&&a.push("path="+r),de.isString(s)&&a.push("domain="+s),!0===n&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}},Ft=e=>e instanceof We?{...e}:e;function Bt(e,t){t=t||{};const i={};function r(e,t,i,r){return de.isPlainObject(e)&&de.isPlainObject(t)?de.merge.call({caseless:r},e,t):de.isPlainObject(t)?de.merge({},t):de.isArray(t)?t.slice():t}function s(e,t,i,s){return de.isUndefined(t)?de.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function n(e,t){if(!de.isUndefined(t))return r(void 0,t)}function a(e,t){return de.isUndefined(t)?de.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function o(i,s,n){return n in t?r(i,s):n in e?r(void 0,i):void 0}const c={url:n,method:n,data:n,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t,i)=>s(Ft(e),Ft(t),0,!0)};return de.forEach(Object.keys(Object.assign({},e,t)),(function(r){const n=c[r]||s,a=n(e[r],t[r],r);de.isUndefined(a)&&n!==o||(i[r]=a)})),i}var Ot,Nt=e=>{const t=Bt({},e);let i,{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=We.from(o),t.url=Ee(Xe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),de.isFormData(r))if(je.hasStandardBrowserEnv||je.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(i=o.getContentType())){const[e,...t]=i?i.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}if(je.hasStandardBrowserEnv&&(s&&de.isFunction(s)&&(s=s(t)),s||!1!==s&&kt(t.url))){const e=n&&a&&Rt.read(a);e&&o.set(n,e)}return t},Dt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){const r=Nt(e);let s=r.data;const n=We.from(r.headers).normalize();let a,o,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:h}=r;function m(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let f=new XMLHttpRequest;function g(){if(!f)return;const r=We.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());Ye((function(e){t(e),m()}),(function(e){i(e),m()}),{data:d&&"text"!==d&&"json"!==d?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f}),f=null}f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout,"onloadend"in f?f.onloadend=g:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(g)},f.onabort=function(){f&&(i(new pe("Request aborted",pe.ECONNABORTED,e,f)),f=null)},f.onerror=function(){i(new pe("Network Error",pe.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||Ae;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),i(new pe(t,s.clarifyTimeoutError?pe.ETIMEDOUT:pe.ECONNABORTED,e,f)),f=null},void 0===s&&n.setContentType(null),"setRequestHeader"in f&&de.forEach(n.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),de.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),d&&"json"!==d&&(f.responseType=r.responseType),h&&([c,u]=mt(h,!0),f.addEventListener("progress",c)),p&&f.upload&&([o,l]=mt(p),f.upload.addEventListener("progress",o),f.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(a=t=>{f&&(i(!t||t.type?new Ze(null,e,f):t),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const _=et(r.url);_&&-1===je.protocols.indexOf(_)?i(new pe("Unsupported protocol "+_+":",pe.ERR_BAD_REQUEST,e)):f.send(s||null)}))},jt=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,r=new AbortController;const s=function(e){if(!i){i=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof pe?t:new Ze(t instanceof Error?t.message:t))}};let n=t&&setTimeout((()=>{n=null,s(new pe(`timeout ${t} of ms exceeded`,pe.ETIMEDOUT))}),t);const a=()=>{e&&(n&&clearTimeout(n),n=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)})),e=null)};e.forEach((e=>e.addEventListener("abort",s)));const{signal:o}=r;return o.unsubscribe=()=>de.asap(a),o}},Lt=function*(e,t){let i=e.byteLength;if(!t||i<t)return void(yield e);let r,s=0;for(;s<i;)r=s+t,yield e.slice(s,r),s=r},Ut=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},Mt=(e,t,i,r)=>{const s=async function*(e,t){for await(const i of Ut(e))yield*Lt(i,t)}(e,t);let n,a=0,o=e=>{n||(n=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return o(),void e.close();let n=r.byteLength;if(i){let e=a+=n;i(e)}e.enqueue(new Uint8Array(r))}catch(e){throw o(e),e}},cancel:e=>(o(e),s.return())},{highWaterMark:2})},qt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ht=qt&&"function"==typeof ReadableStream,zt=qt&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Vt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Kt=Ht&&Vt((()=>{let e=!1;const t=new Request(je.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Gt=Ht&&Vt((()=>de.isReadableStream(new Response("").body))),Wt={stream:Gt&&(e=>e.body)};qt&&(Ot=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Wt[e]&&(Wt[e]=de.isFunction(Ot[e])?t=>t[e]():(t,i)=>{throw new pe(`Response type '${e}' is not supported`,pe.ERR_NOT_SUPPORT,i)})})));var Jt=async(e,t)=>{const i=de.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(de.isBlob(e))return e.size;if(de.isSpecCompliantForm(e)){const t=new Request(je.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return de.isArrayBufferView(e)||de.isArrayBuffer(e)?e.byteLength:(de.isURLSearchParams(e)&&(e+=""),de.isString(e)?(await zt(e)).byteLength:void 0)})(t):i},$t={http:It,xhr:Dt,fetch:qt&&(async e=>{let{url:t,method:i,data:r,signal:s,cancelToken:n,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:p}=Nt(e);l=l?(l+"").toLowerCase():"text";let h,m=jt([s,n&&n.toAbortSignal()],a);const f=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let g;try{if(c&&Kt&&"get"!==i&&"head"!==i&&0!==(g=await Jt(u,r))){let e,i=new Request(t,{method:"POST",body:r,duplex:"half"});if(de.isFormData(r)&&(e=i.headers.get("content-type"))&&u.setContentType(e),i.body){const[e,t]=ft(g,mt(gt(c)));r=Mt(i.body,65536,e,t)}}de.isString(d)||(d=d?"include":"omit");const s="credentials"in Request.prototype;h=new Request(t,{...p,signal:m,method:i.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:s?d:void 0});let n=await fetch(h);const a=Gt&&("stream"===l||"response"===l);if(Gt&&(o||a&&f)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=n[t]}));const t=de.toFiniteNumber(n.headers.get("content-length")),[i,r]=o&&ft(t,mt(gt(o),!0))||[];n=new Response(Mt(n.body,65536,i,(()=>{r&&r(),f&&f()})),e)}l=l||"text";let _=await Wt[de.findKey(Wt,l)||"text"](n,e);return!a&&f&&f(),await new Promise(((t,i)=>{Ye(t,i,{data:_,headers:We.from(n.headers),status:n.status,statusText:n.statusText,config:e,request:h})}))}catch(t){if(f&&f(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new pe("Network Error",pe.ERR_NETWORK,e,h),{cause:t.cause||t});throw pe.from(t,t&&t.code,e,h)}})};de.forEach($t,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Zt=e=>`- ${e}`,Yt=e=>de.isFunction(e)||null===e||!1===e,Xt=e=>{e=de.isArray(e)?e:[e];const{length:t}=e;let i,r;const s={};for(let n=0;n<t;n++){let t;if(i=e[n],r=i,!Yt(i)&&(r=$t[(t=String(i)).toLowerCase()],void 0===r))throw new pe(`Unknown adapter '${t}'`);if(r)break;s[t||"#"+n]=r}if(!r){const e=Object.entries(s).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new pe("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Zt).join("\n"):" "+Zt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function Qt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ze(null,e)}function ei(e){Qt(e),e.headers=We.from(e.headers),e.data=Je.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Xt(e.adapter||Me.adapter)(e).then((function(t){return Qt(e),t.data=Je.call(e,e.transformResponse,t),t.headers=We.from(t.headers),t}),(function(t){return $e(t)||(Qt(e),t&&t.response&&(t.response.data=Je.call(e,e.transformResponse,t.response),t.response.headers=We.from(t.response.headers))),Promise.reject(t)}))}var ti={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ti[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));var ii={};ti.transitional=function(e,t,i){function r(e,t){return"[Axios v1.9.0] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,s,n)=>{if(!1===e)throw new pe(r(s," has been removed"+(t?" in "+t:"")),pe.ERR_DEPRECATED);return t&&!ii[s]&&(ii[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,s,n)}},ti.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};var ri={assertOptions:function(e,t,i){if("object"!=typeof e)throw new pe("options must be an object",pe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const n=r[s],a=t[n];if(a){const t=e[n],i=void 0===t||a(t,n,e);if(!0!==i)throw new pe("option "+n+" must be "+i,pe.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new pe("Unknown option "+n,pe.ERR_BAD_OPTION)}},validators:ti},si=ri.validators,ni=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ce,response:new Ce}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const i=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?i&&!String(e.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+i):e.stack=i}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Bt(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;void 0!==i&&ri.assertOptions(i,{silentJSONParsing:si.transitional(si.boolean),forcedJSONParsing:si.transitional(si.boolean),clarifyTimeoutError:si.transitional(si.boolean)},!1),null!=r&&(de.isFunction(r)?t.paramsSerializer={serialize:r}:ri.assertOptions(r,{encode:si.function,serialize:si.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ri.assertOptions(t,{baseUrl:si.spelling("baseURL"),withXsrfToken:si.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let n=s&&de.merge(s.common,s[t.method]);s&&de.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=We.concat(n,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,d=0;if(!o){const e=[ei.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=a.length;let p=t;for(d=0;d<u;){const e=a[d++],t=a[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=ei.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Ee(Xe((e=Bt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],(function(e){ni.prototype[e]=function(t,i){return this.request(Bt(i||{},{method:e,url:t,data:(i||{}).data}))}})),de.forEach(["post","put","patch"],(function(e){function t(t){return function(i,r,s){return this.request(Bt(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:r}))}}ni.prototype[e]=t(),ni.prototype[e+"Form"]=t(!0)}));var ai=ni,oi=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{i.subscribe(e),t=e})).then(e);return r.cancel=function(){i.unsubscribe(t)},r},e((function(e,r,s){i.reason||(i.reason=new Ze(e,r,s),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}};var ci={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ci).forEach((([e,t])=>{ci[t]=e}));var li=ci;var ui=function e(t){const i=new ai(t),r=E(ai.prototype.request,i);return de.extend(r,ai.prototype,i,{allOwnKeys:!0}),de.extend(r,i,null,{allOwnKeys:!0}),r.create=function(i){return e(Bt(t,i))},r}(Me);ui.Axios=ai,ui.CanceledError=Ze,ui.CancelToken=oi,ui.isCancel=$e,ui.VERSION=Qe,ui.toFormData=be,ui.AxiosError=pe,ui.Cancel=ui.CanceledError,ui.all=function(e){return Promise.all(e)},ui.spread=function(e){return function(t){return e.apply(null,t)}},ui.isAxiosError=function(e){return de.isObject(e)&&!0===e.isAxiosError},ui.mergeConfig=Bt,ui.AxiosHeaders=We,ui.formToJSON=e=>Le(de.isHTMLForm(e)?new FormData(e):e),ui.getAdapter=Xt,ui.HttpStatusCode=li,ui.default=ui,t.exports=ui}}),require_http2=__commonJS({"../../node_modules/@skyway-sdk/common/dist/http.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.HttpClient=void 0;var r=i(require_axios2()),s=new(require_logger2().Logger)("packages/common/src/http.ts");e.HttpClient=class{constructor(e){this.api=r.default.create({baseURL:e})}get(e,i){return t(this,void 0,void 0,(function*(){const t=yield this.api.get(e,i).catch((e=>e));if(r.default.isAxiosError(t)){const r=Object.assign(Object.assign({},t.response),{message:t.message});if(null==i?void 0:i.retry){if(yield i.retry(r))return s.warn("retry get",{url:e}),this.get(e,i);throw s.warn("retry get failed",{url:e}),r}throw s.warn("response error",{error:r}),r}return t.data}))}post(e,i,n){var a,o,c;return t(this,void 0,void 0,(function*(){const t=yield this.api.post(e,i,n).catch((e=>e));if(r.default.isAxiosError(t)){const r={data:null===(a=t.response)||void 0===a?void 0:a.data,status:null===(o=t.response)||void 0===o?void 0:o.status,statusText:null===(c=t.response)||void 0===c?void 0:c.statusText,message:t.message};if(s.warn("error received",r),null==n?void 0:n.retry){const t=yield n.retry(r);if(t)return s.warn("retry post",e,{data:i,error:r,needRetry:t}),this.post(e,i,n);throw r}throw r}return t.data}))}put(e,i,n){return t(this,void 0,void 0,(function*(){const t=yield this.api.put(e,i,n).catch((e=>e));if(r.default.isAxiosError(t)){const r=Object.assign(Object.assign({},t.response),{message:t.message});if(null==n?void 0:n.retry){if(yield n.retry(r))return s.warn("retry put",{url:e,data:i}),this.put(e,i,n);throw s.warn("retry put failed",{url:e,data:i}),r}throw s.warn("response error",{error:r}),r}return t.data}))}delete(e,i){return t(this,void 0,void 0,(function*(){const t=yield this.api.delete(e,i).catch((e=>e));if(r.default.isAxiosError(t)){const r=Object.assign(Object.assign({},t.response),{message:t.message});if(null==i?void 0:i.retry){if(yield i.retry(r))return s.warn("retry delete",{url:e}),this.delete(e,i);throw s.warn("retry delete failed",{url:e}),r}throw s.warn("response error",{error:r}),r}return t.data}))}}}}),require_promise2=__commonJS({"../../node_modules/@skyway-sdk/common/dist/promise.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.PromiseQueue=void 0;var i=new(require_logger2().Logger)("packages/common/src/promise.ts");e.PromiseQueue=class{constructor(){this.id=Math.random().toString().slice(2),this.queue=[],this.running=!1,this.push=e=>new Promise(((t,r)=>{this.queue.push({promise:e,done:t,failed:r}),this.running||this.run().catch((e=>{i.error("push",e)}))}))}run(){return t(this,void 0,void 0,(function*(){const e=this.queue.shift();if(e){this.running=!0;try{const t=yield e.promise();e.done(t)}catch(t){e.failed(t)}yield this.run()}else this.running=!1}))}}}}),require_util3=__commonJS({"../../node_modules/@skyway-sdk/common/dist/util.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.deepCopy=e.BackOff=void 0;e.BackOff=class{constructor(e={}){this.count=0,this.times=8,this.interval=100,this.jitter=0,Object.assign(this,e)}wait(){return t(this,void 0,void 0,(function*(){if(this.exceeded)return!1;const e=this.timeout;return this.count++,yield new Promise((t=>setTimeout(t,e))),!0}))}get timeout(){return Math.pow(this.count,2)*this.interval+Math.pow(this.count,2)*this.jitter*Math.random()}get exceeded(){return this.count>=this.times}reset(){this.count=0}};e.deepCopy=e=>JSON.parse(JSON.stringify(e))}}),require_dist3=__commonJS({"../../node_modules/@skyway-sdk/common/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(require_error2(),e),i(require_event2(),e),i(require_http2(),e),i(require_logger2(),e),i(require_promise2(),e),i(require_util3(),e)}}),require_jsrsasign=__commonJS({"../../node_modules/jsrsasign/lib/jsrsasign.js"(e){var t,i,r,s,n,a,o,c,l,u,d,p={userAgent:!1},h={},m=m||(t=Math,r=(i={}).lib={},s=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var i=new e;return t&&i.mixIn(t),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),n=r.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||o).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,s=e.sigBytes;if(this.clamp(),r%4)for(var n=0;n<s;n++){var a=i[n>>>2]>>>24-n%4*8&255;t[r+n>>>2]|=a<<24-(r+n)%4*8}else for(n=0;n<s;n+=4)t[r+n>>>2]=i[n>>>2];return this.sigBytes+=s,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var i=[],r=0;r<e;r+=4)i.push(4294967296*t.random()|0);return new n.init(i,e)}}),a=i.enc={},o=a.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s<i;s++){var n=t[s>>>2]>>>24-s%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new n.init(i,t/2)}},c=a.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s<i;s++){var n=t[s>>>2]>>>24-s%4*8&255;r.push(String.fromCharCode(n))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new n.init(i,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=r.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new n.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var i=this._data,r=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),c=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,l=t.min(4*c,s);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(r,u);var d=r.splice(0,c);i.sigBytes-=l}return new n.init(d,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),r.Hasher=u.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new d.HMAC.init(e,i).finalize(t)}}}),d=i.algo={},i);!function(){var e,t=(e=m).lib,i=t.Base,r=t.WordArray;(e=e.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),e.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,i=[],s=0;s<t;s++){var n=e[s];i.push(n.high),i.push(n.low)}return r.create(i,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,s=0;s<r;s++)t[s]=t[s].clone();return e}})}(),m.lib.Cipher||function(){var e=(p=m).lib,t=e.Base,i=e.WordArray,r=e.BufferedBlockAlgorithm,s=p.enc.Base64,n=p.algo.EvpKDF,a=e.Cipher=r.extend({cfg:t.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,r){return("string"==typeof i?h:d).encrypt(e,t,i,r)},decrypt:function(t,i,r){return("string"==typeof i?h:d).decrypt(e,t,i,r)}}}});e.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var o=p.mode={},c=function(e,t,i){var r=this._iv;r?this._iv=undefined:r=this._prevBlock;for(var s=0;s<i;s++)e[t+s]^=r[s]},l=(e.BlockCipherMode=t.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize;c.call(this,e,t,r),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,s=e.slice(t,t+r);i.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=s}}),o=o.CBC=l,l=(p.pad={}).Pkcs7={pad:function(e,t){for(var r,s=(r=(r=4*t)-e.sigBytes%r)<<24|r<<16|r<<8|r,n=[],a=0;a<r;a+=4)n.push(s);r=i.create(n,r),e.concat(r)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},e.BlockCipher=a.extend({cfg:a.cfg.extend({mode:o,padding:l}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=t.createEncryptor;else i=t.createDecryptor,this._minBufferSize=1;this._mode=i.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var u=e.CipherParams=t.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),d=(o=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(s)},parse:function(e){var t=(e=s.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var r=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return u.create({ciphertext:e,salt:r})}},e.SerializableCipher=t.extend({cfg:t.extend({format:o}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var s=e.createEncryptor(i,r);return t=s.finalize(t),s=s.cfg,u.create({ciphertext:t,key:i,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,r,s){return s||(s=i.random(8)),e=n.create({keySize:t+r}).compute(e,s),r=i.create(e.words.slice(t),4*r),e.sigBytes=4*t,u.create({key:e,iv:r,salt:s})}},h=e.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:p}),encrypt:function(e,t,i,r){return i=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize),r.iv=i.iv,(e=d.encrypt.call(this,e,t,i.key,r)).mixIn(i),e},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),i=r.kdf.execute(i,e.keySize,e.ivSize,t.salt),r.iv=i.iv,d.decrypt.call(this,e,t,i.key,r)}})}(),function(){for(var e=m,t=e.lib.BlockCipher,i=e.algo,r=[],s=[],n=[],a=[],o=[],c=[],l=[],u=[],d=[],p=[],h=[],f=0;256>f;f++)h[f]=128>f?f<<1:f<<1^283;var g=0,_=0;for(f=0;256>f;f++){var y=(y=_^_<<1^_<<2^_<<3^_<<4)>>>8^255&y^99;r[g]=y,s[y]=g;var b=h[g],v=h[b],x=h[v],S=257*h[y]^16843008*y;n[g]=S<<24|S>>>8,a[g]=S<<16|S>>>16,o[g]=S<<8|S>>>24,c[g]=S,S=16843009*x^65537*v^257*b^16843008*g,l[y]=S<<24|S>>>8,u[y]=S<<16|S>>>16,d[y]=S<<8|S>>>24,p[y]=S,g?(g=b^h[h[h[x^b]]],_^=h[h[_]]):g=_=1}var w=[0,1,2,4,8,16,32,64,128,27,54];i=i.AES=t.extend({_doReset:function(){for(var e=(i=this._key).words,t=i.sigBytes/4,i=4*((this._nRounds=t+6)+1),s=this._keySchedule=[],n=0;n<i;n++)if(n<t)s[n]=e[n];else{var a=s[n-1];n%t?6<t&&4==n%t&&(a=r[a>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a]):(a=r[(a=a<<8|a>>>24)>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a],a^=w[n/t|0]<<24),s[n]=s[n-t]^a}for(e=this._invKeySchedule=[],t=0;t<i;t++)n=i-t,a=t%4?s[n]:s[n-4],e[t]=4>t||4>=n?a:l[r[a>>>24]]^u[r[a>>>16&255]]^d[r[a>>>8&255]]^p[r[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,n,a,o,c,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,l,u,d,p,s),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,s,n,a,o){for(var c=this._nRounds,l=e[t]^i[0],u=e[t+1]^i[1],d=e[t+2]^i[2],p=e[t+3]^i[3],h=4,m=1;m<c;m++){var f=r[l>>>24]^s[u>>>16&255]^n[d>>>8&255]^a[255&p]^i[h++],g=r[u>>>24]^s[d>>>16&255]^n[p>>>8&255]^a[255&l]^i[h++],_=r[d>>>24]^s[p>>>16&255]^n[l>>>8&255]^a[255&u]^i[h++];p=r[p>>>24]^s[l>>>16&255]^n[u>>>8&255]^a[255&d]^i[h++],l=f,u=g,d=_}f=(o[l>>>24]<<24|o[u>>>16&255]<<16|o[d>>>8&255]<<8|o[255&p])^i[h++],g=(o[u>>>24]<<24|o[d>>>16&255]<<16|o[p>>>8&255]<<8|o[255&l])^i[h++],_=(o[d>>>24]<<24|o[p>>>16&255]<<16|o[l>>>8&255]<<8|o[255&u])^i[h++],p=(o[p>>>24]<<24|o[l>>>16&255]<<16|o[u>>>8&255]<<8|o[255&d])^i[h++],e[t]=f,e[t+1]=g,e[t+2]=_,e[t+3]=p},keySize:8});e.AES=t._createHelper(i)}(),function(){function e(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<<e}function t(e,t){var i=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<<e}var i=m,r=(s=i.lib).WordArray,s=s.BlockCipher,n=i.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=n.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;56>i;i++){var r=a[i]-1;t[i]=e[r>>>5]>>>31-r%32&1}for(e=this._subKeys=[],r=0;16>r;r++){var s=e[r]=[],n=c[r];for(i=0;24>i;i++)s[i/6|0]|=t[(o[i]-1+n)%28]<<31-i%6,s[4+(i/6|0)]|=t[28+(o[i+24]-1+n)%28]<<31-i%6;for(s[0]=s[0]<<1|s[0]>>>31,i=1;7>i;i++)s[i]>>>=4*(i-1)+3;s[7]=s[7]<<5|s[7]>>>27}for(t=this._invSubKeys=[],i=0;16>i;i++)t[i]=e[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(i,r,s){this._lBlock=i[r],this._rBlock=i[r+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var n=0;16>n;n++){for(var a=s[n],o=this._lBlock,c=this._rBlock,d=0,p=0;8>p;p++)d|=l[p][((c^a[p])&u[p])>>>0];this._lBlock=c,this._rBlock=o^d}s=this._lBlock,this._lBlock=this._rBlock,this._rBlock=s,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),i[r]=this._lBlock,i[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});i.DES=s._createHelper(d),n=n.TripleDES=s.extend({_doReset:function(){var e=this._key.words;this._des1=d.createEncryptor(r.create(e.slice(0,2))),this._des2=d.createEncryptor(r.create(e.slice(2,4))),this._des3=d.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),i.TripleDES=s._createHelper(n)}(),function(){var e=m,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp(),e=[];for(var s=0;s<i;s+=3)for(var n=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;4>a&&s+.75*a<i;a++)e.push(r.charAt(n>>>6*(3-a)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var i=e.length,r=this._map;(s=r.charAt(64))&&(-1!=(s=e.indexOf(s))&&(i=s));for(var s=[],n=0,a=0;a<i;a++)if(a%4){var o=r.indexOf(e.charAt(a-1))<<a%4*2,c=r.indexOf(e.charAt(a))>>>6-a%4*2;s[n>>>2]|=(o|c)<<24-n%4*8,n++}return t.create(s,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,i,r,s,n,a){return((e=e+(t&i|~t&r)+s+a)<<n|e>>>32-n)+t}function i(e,t,i,r,s,n,a){return((e=e+(t&r|i&~r)+s+a)<<n|e>>>32-n)+t}function r(e,t,i,r,s,n,a){return((e=e+(t^i^r)+s+a)<<n|e>>>32-n)+t}function s(e,t,i,r,s,n,a){return((e=e+(i^(t|~r))+s+a)<<n|e>>>32-n)+t}for(var n=m,a=(c=n.lib).WordArray,o=c.Hasher,c=n.algo,l=[],u=0;64>u;u++)l[u]=4294967296*e.abs(e.sin(u+1))|0;c=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var a=0;16>a;a++){var o=e[c=n+a];e[c]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}a=this._hash.words;var c=e[n+0],u=(o=e[n+1],e[n+2]),d=e[n+3],p=e[n+4],h=e[n+5],m=e[n+6],f=e[n+7],g=e[n+8],_=e[n+9],y=e[n+10],b=e[n+11],v=e[n+12],x=e[n+13],S=e[n+14],w=e[n+15],E=t(E=a[0],T=a[1],A=a[2],C=a[3],c,7,l[0]),C=t(C,E,T,A,o,12,l[1]),A=t(A,C,E,T,u,17,l[2]),T=t(T,A,C,E,d,22,l[3]);E=t(E,T,A,C,p,7,l[4]),C=t(C,E,T,A,h,12,l[5]),A=t(A,C,E,T,m,17,l[6]),T=t(T,A,C,E,f,22,l[7]),E=t(E,T,A,C,g,7,l[8]),C=t(C,E,T,A,_,12,l[9]),A=t(A,C,E,T,y,17,l[10]),T=t(T,A,C,E,b,22,l[11]),E=t(E,T,A,C,v,7,l[12]),C=t(C,E,T,A,x,12,l[13]),A=t(A,C,E,T,S,17,l[14]),E=i(E,T=t(T,A,C,E,w,22,l[15]),A,C,o,5,l[16]),C=i(C,E,T,A,m,9,l[17]),A=i(A,C,E,T,b,14,l[18]),T=i(T,A,C,E,c,20,l[19]),E=i(E,T,A,C,h,5,l[20]),C=i(C,E,T,A,y,9,l[21]),A=i(A,C,E,T,w,14,l[22]),T=i(T,A,C,E,p,20,l[23]),E=i(E,T,A,C,_,5,l[24]),C=i(C,E,T,A,S,9,l[25]),A=i(A,C,E,T,d,14,l[26]),T=i(T,A,C,E,g,20,l[27]),E=i(E,T,A,C,x,5,l[28]),C=i(C,E,T,A,u,9,l[29]),A=i(A,C,E,T,f,14,l[30]),E=r(E,T=i(T,A,C,E,v,20,l[31]),A,C,h,4,l[32]),C=r(C,E,T,A,g,11,l[33]),A=r(A,C,E,T,b,16,l[34]),T=r(T,A,C,E,S,23,l[35]),E=r(E,T,A,C,o,4,l[36]),C=r(C,E,T,A,p,11,l[37]),A=r(A,C,E,T,f,16,l[38]),T=r(T,A,C,E,y,23,l[39]),E=r(E,T,A,C,x,4,l[40]),C=r(C,E,T,A,c,11,l[41]),A=r(A,C,E,T,d,16,l[42]),T=r(T,A,C,E,m,23,l[43]),E=r(E,T,A,C,_,4,l[44]),C=r(C,E,T,A,v,11,l[45]),A=r(A,C,E,T,w,16,l[46]),E=s(E,T=r(T,A,C,E,u,23,l[47]),A,C,c,6,l[48]),C=s(C,E,T,A,f,10,l[49]),A=s(A,C,E,T,S,15,l[50]),T=s(T,A,C,E,h,21,l[51]),E=s(E,T,A,C,v,6,l[52]),C=s(C,E,T,A,d,10,l[53]),A=s(A,C,E,T,y,15,l[54]),T=s(T,A,C,E,o,21,l[55]),E=s(E,T,A,C,g,6,l[56]),C=s(C,E,T,A,w,10,l[57]),A=s(A,C,E,T,m,15,l[58]),T=s(T,A,C,E,x,21,l[59]),E=s(E,T,A,C,p,6,l[60]),C=s(C,E,T,A,b,10,l[61]),A=s(A,C,E,T,u,15,l[62]),T=s(T,A,C,E,_,21,l[63]);a[0]=a[0]+E|0,a[1]=a[1]+T|0,a[2]=a[2]+A|0,a[3]=a[3]+C|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;i[s>>>5]|=128<<24-s%32;var n=e.floor(r/4294967296);for(i[15+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),i[14+(s+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(i.length+1),this._process(),i=(t=this._hash).words,r=0;4>r;r++)s=i[r],i[r]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8);return t},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.MD5=o._createHelper(c),n.HmacMD5=o._createHmacHelper(c)}(Math),function(){var e=m,t=(s=e.lib).WordArray,i=s.Hasher,r=[],s=e.algo.SHA1=i.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],n=i[1],a=i[2],o=i[3],c=i[4],l=0;80>l;l++){if(16>l)r[l]=0|e[t+l];else{var u=r[l-3]^r[l-8]^r[l-14]^r[l-16];r[l]=u<<1|u>>>31}u=(s<<5|s>>>27)+c+r[l],u=20>l?u+(1518500249+(n&a|~n&o)):40>l?u+(1859775393+(n^a^o)):60>l?u+((n&a|n&o|a&o)-1894007588):u+((n^a^o)-899497514),c=o,o=a,a=n<<30|n>>>2,n=s,s=u}i[0]=i[0]+s|0,i[1]=i[1]+n|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=i._createHelper(s),e.HmacSHA1=i._createHmacHelper(s)}(),function(e){for(var t=m,i=(s=t.lib).WordArray,r=s.Hasher,s=t.algo,n=[],a=[],o=function(e){return 4294967296*(e-(0|e))|0},c=2,l=0;64>l;){var u;e:{u=c;for(var d=e.sqrt(u),p=2;p<=d;p++)if(!(u%p)){u=!1;break e}u=!0}u&&(8>l&&(n[l]=o(e.pow(c,.5))),a[l]=o(e.pow(c,1/3)),l++),c++}var h=[];s=s.SHA256=r.extend({_doReset:function(){this._hash=new i.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],n=i[2],o=i[3],c=i[4],l=i[5],u=i[6],d=i[7],p=0;64>p;p++){if(16>p)h[p]=0|e[t+p];else{var m=h[p-15],f=h[p-2];h[p]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+h[p-7]+((f<<15|f>>>17)^(f<<13|f>>>19)^f>>>10)+h[p-16]}m=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+a[p]+h[p],f=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&s^r&n^s&n),d=u,u=l,l=c,c=o+m|0,o=n,n=s,s=r,r=m+f|0}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+n|0,i[3]=i[3]+o|0,i[4]=i[4]+c|0,i[5]=i[5]+l|0,i[6]=i[6]+u|0,i[7]=i[7]+d|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;return i[s>>>5]|=128<<24-s%32,i[14+(s+64>>>9<<4)]=e.floor(r/4294967296),i[15+(s+64>>>9<<4)]=r,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(s),t.HmacSHA256=r._createHmacHelper(s)}(Math),function(){var e=m,t=e.lib.WordArray,i=(r=e.algo).SHA256,r=r.SHA224=i.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=i._createHelper(r),e.HmacSHA224=i._createHmacHelper(r)}(),function(){function e(){return r.create.apply(r,arguments)}for(var t=m,i=t.lib.Hasher,r=(n=t.x64).Word,s=n.WordArray,n=t.algo,a=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],o=[],c=0;80>c;c++)o[c]=e();n=n.SHA512=i.extend({_doReset:function(){this._hash=new s.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=(d=this._hash.words)[0],r=d[1],s=d[2],n=d[3],c=d[4],l=d[5],u=d[6],d=d[7],p=i.high,h=i.low,m=r.high,f=r.low,g=s.high,_=s.low,y=n.high,b=n.low,v=c.high,x=c.low,S=l.high,w=l.low,E=u.high,C=u.low,A=d.high,T=d.low,P=p,I=h,k=m,R=f,F=g,B=_,O=y,N=b,D=v,j=x,L=S,U=w,M=E,q=C,H=A,z=T,V=0;80>V;V++){var K=o[V];if(16>V)var G=K.high=0|e[t+2*V],W=K.low=0|e[t+2*V+1];else{G=((W=(G=o[V-15]).high)>>>1|(J=G.low)<<31)^(W>>>8|J<<24)^W>>>7;var J=(J>>>1|W<<31)^(J>>>8|W<<24)^(J>>>7|W<<25),$=((W=($=o[V-2]).high)>>>19|(Z=$.low)<<13)^(W<<3|Z>>>29)^W>>>6,Z=(Z>>>19|W<<13)^(Z<<3|W>>>29)^(Z>>>6|W<<26),Y=(W=o[V-7]).high,X=(Q=o[V-16]).high,Q=Q.low;G=(G=(G=G+Y+((W=J+W.low)>>>0<J>>>0?1:0))+$+((W=W+Z)>>>0<Z>>>0?1:0))+X+((W=W+Q)>>>0<Q>>>0?1:0);K.high=G,K.low=W}Y=D&L^~D&M,Q=j&U^~j&q,K=P&k^P&F^k&F;var ee=I&R^I&B^R&B,te=(J=(P>>>28|I<<4)^(P<<30|I>>>2)^(P<<25|I>>>7),$=(I>>>28|P<<4)^(I<<30|P>>>2)^(I<<25|P>>>7),(Z=a[V]).high),ie=Z.low;X=H+((D>>>14|j<<18)^(D>>>18|j<<14)^(D<<23|j>>>9))+((Z=z+((j>>>14|D<<18)^(j>>>18|D<<14)^(j<<23|D>>>9)))>>>0<z>>>0?1:0),H=M,z=q,M=L,q=U,L=D,U=j,D=O+(X=(X=(X=X+Y+((Z=Z+Q)>>>0<Q>>>0?1:0))+te+((Z=Z+ie)>>>0<ie>>>0?1:0))+G+((Z=Z+W)>>>0<W>>>0?1:0))+((j=N+Z|0)>>>0<N>>>0?1:0)|0,O=F,N=B,F=k,B=R,k=P,R=I,P=X+(K=J+K+((W=$+ee)>>>0<$>>>0?1:0))+((I=Z+W|0)>>>0<Z>>>0?1:0)|0}h=i.low=h+I,i.high=p+P+(h>>>0<I>>>0?1:0),f=r.low=f+R,r.high=m+k+(f>>>0<R>>>0?1:0),_=s.low=_+B,s.high=g+F+(_>>>0<B>>>0?1:0),b=n.low=b+N,n.high=y+O+(b>>>0<N>>>0?1:0),x=c.low=x+j,c.high=v+D+(x>>>0<j>>>0?1:0),w=l.low=w+U,l.high=S+L+(w>>>0<U>>>0?1:0),C=u.low=C+q,u.high=E+M+(C>>>0<q>>>0?1:0),T=d.low=T+z,d.high=A+H+(T>>>0<z>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(r+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=i._createHelper(n),t.HmacSHA512=i._createHmacHelper(n)}(),function(){var e=m,t=(s=e.x64).Word,i=s.WordArray,r=(s=e.algo).SHA512,s=s.SHA384=r.extend({_doReset:function(){this._hash=new i.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=r._createHelper(s),e.HmacSHA384=r._createHmacHelper(s)}(),function(){var e=m,t=(r=e.lib).WordArray,i=r.Hasher,r=e.algo,s=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),n=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=t.create([0,1518500249,1859775393,2400959708,2840853838]),l=t.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=i.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;16>i;i++){var r=e[v=t+i];e[v]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var u,d,p,h,m,f,g,_,y,b,v=this._hash.words,x=(r=c.words,l.words),S=s.words,w=n.words,E=a.words,C=o.words;f=u=v[0],g=d=v[1],_=p=v[2],y=h=v[3],b=m=v[4];var A;for(i=0;80>i;i+=1)A=u+e[t+S[i]]|0,A=16>i?A+((d^p^h)+r[0]):32>i?A+((d&p|~d&h)+r[1]):48>i?A+(((d|~p)^h)+r[2]):64>i?A+((d&h|p&~h)+r[3]):A+((d^(p|~h))+r[4]),A=(A=(A|=0)<<E[i]|A>>>32-E[i])+m|0,u=m,m=h,h=p<<10|p>>>22,p=d,d=A,A=f+e[t+w[i]]|0,A=16>i?A+((g^(_|~y))+x[0]):32>i?A+((g&y|_&~y)+x[1]):48>i?A+(((g|~_)^y)+x[2]):64>i?A+((g&_|~g&y)+x[3]):A+((g^_^y)+x[4]),A=(A=(A|=0)<<C[i]|A>>>32-C[i])+b|0,f=b,b=y,y=_<<10|_>>>22,_=g,g=A;A=v[1]+p+y|0,v[1]=v[2]+h+b|0,v[2]=v[3]+m+f|0,v[3]=v[4]+u+g|0,v[4]=v[0]+d+_|0,v[0]=A},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;for(t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,i=0;5>i;i++)r=t[i],t[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.RIPEMD160=i._createHelper(r),e.HmacRIPEMD160=i._createHmacHelper(r)}(Math),function(){var e=m,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,i){e=this._hasher=new e.init,"string"==typeof i&&(i=t.parse(i));var r=e.blockSize,s=4*r;i.sigBytes>s&&(i=e.finalize(i)),i.clamp();for(var n=this._oKey=i.clone(),a=this._iKey=i.clone(),o=n.words,c=a.words,l=0;l<r;l++)o[l]^=1549556828,c[l]^=909522486;n.sigBytes=a.sigBytes=s,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),function(){var e,t=m,i=(e=t.lib).Base,r=e.WordArray,s=(e=t.algo).HMAC,n=e.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var i=this.cfg,n=s.create(i.hasher,e),a=r.create(),o=r.create([1]),c=a.words,l=o.words,u=i.keySize;for(i=i.iterations;c.length<u;){var d=n.update(t).finalize(o);n.reset();for(var p=d.words,h=p.length,m=d,f=1;f<i;f++){m=n.finalize(m),n.reset();for(var g=m.words,_=0;_<h;_++)p[_]^=g[_]}a.concat(d),l[0]++}return a.sigBytes=4*u,a}});t.PBKDF2=function(e,t,i){return n.create(i).compute(e,t)}}();var f,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function _(e){var t,i,r="";for(t=0;t+3<=e.length;t+=3)i=parseInt(e.substring(t,t+3),16),r+=g.charAt(i>>6)+g.charAt(63&i);for(t+1==e.length?(i=parseInt(e.substring(t,t+1),16),r+=g.charAt(i<<2)):t+2==e.length&&(i=parseInt(e.substring(t,t+2),16),r+=g.charAt(i>>2)+g.charAt((3&i)<<4)),"=";(3&r.length)>0;)r+="=";return r}function y(e){var t,i,r,s="",n=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t)(r=g.indexOf(e.charAt(t)))<0||(0==n?(s+=C(r>>2),i=3&r,n=1):1==n?(s+=C(i<<2|r>>4),i=15&r,n=2):2==n?(s+=C(i),s+=C(r>>2),i=3&r,n=3):(s+=C(i<<2|r>>4),s+=C(15&r),n=0));return 1==n&&(s+=C(i<<2)),s}function b(e){var t,i=y(e),r=new Array;for(t=0;2*t<i.length;++t)r[t]=parseInt(i.substring(2*t,2*t+2),16);return r}function v(e,t,i){null!=e&&("number"==typeof e?this.fromNumber(e,t,i):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function x(){return new v(null)}"Microsoft Internet Explorer"==p.appName?(v.prototype.am=function(e,t,i,r,s,n){for(var a=32767&t,o=t>>15;--n>=0;){var c=32767&this[e],l=this[e++]>>15,u=o*c+l*a;s=((c=a*c+((32767&u)<<15)+i[r]+(1073741823&s))>>>30)+(u>>>15)+o*l+(s>>>30),i[r++]=1073741823&c}return s},f=30):"Netscape"!=p.appName?(v.prototype.am=function(e,t,i,r,s,n){for(;--n>=0;){var a=t*this[e++]+i[r]+s;s=Math.floor(a/67108864),i[r++]=67108863&a}return s},f=26):(v.prototype.am=function(e,t,i,r,s,n){for(var a=16383&t,o=t>>14;--n>=0;){var c=16383&this[e],l=this[e++]>>14,u=o*c+l*a;s=((c=a*c+((16383&u)<<14)+i[r]+s)>>28)+(u>>14)+o*l,i[r++]=268435455&c}return s},f=28),v.prototype.DB=f,v.prototype.DM=(1<<f)-1,v.prototype.DV=1<<f;v.prototype.FV=Math.pow(2,52),v.prototype.F1=52-f,v.prototype.F2=2*f-52;var S,w,E=new Array;for(S="0".charCodeAt(0),w=0;w<=9;++w)E[S++]=w;for(S="a".charCodeAt(0),w=10;w<36;++w)E[S++]=w;for(S="A".charCodeAt(0),w=10;w<36;++w)E[S++]=w;function C(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function A(e,t){var i=E[e.charCodeAt(t)];return null==i?-1:i}function T(e){var t=x();return t.fromInt(e),t}function P(e){var t,i=1;return 0!=(t=e>>>16)&&(e=t,i+=16),0!=(t=e>>8)&&(e=t,i+=8),0!=(t=e>>4)&&(e=t,i+=4),0!=(t=e>>2)&&(e=t,i+=2),0!=(t=e>>1)&&(e=t,i+=1),i}function I(e){this.m=e}function k(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function R(e,t){return e&t}function F(e,t){return e|t}function B(e,t){return e^t}function O(e,t){return e&~t}function N(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function D(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function j(){}function L(e){return e}function U(e){this.r2=x(),this.q3=x(),v.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}I.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},I.prototype.revert=function(e){return e},I.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},I.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},k.prototype.convert=function(e){var t=x();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(v.ZERO)>0&&this.m.subTo(t,t),t},k.prototype.revert=function(e){var t=x();return e.copyTo(t),this.reduce(t),t},k.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=32767&e[t],r=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[i=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},k.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},k.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},v.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},v.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},v.prototype.fromString=function(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var r=e.length,s=!1,n=0;--r>=0;){var a=8==i?255&e[r]:A(e,r);a<0?"-"==e.charAt(r)&&(s=!0):(s=!1,0==n?this[this.t++]=a:n+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-n)-1)<<n,this[this.t++]=a>>this.DB-n):this[this.t-1]|=a<<n,(n+=i)>=this.DB&&(n-=this.DB))}8==i&&128&e[0]&&(this.s=-1,n>0&&(this[this.t-1]|=(1<<this.DB-n)-1<<n)),this.clamp(),s&&v.ZERO.subTo(this,this)},v.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},v.prototype.dlShiftTo=function(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s},v.prototype.drShiftTo=function(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s},v.prototype.lShiftTo=function(e,t){var i,r=e%this.DB,s=this.DB-r,n=(1<<s)-1,a=Math.floor(e/this.DB),o=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)t[i+a+1]=this[i]>>s|o,o=(this[i]&n)<<r;for(i=a-1;i>=0;--i)t[i]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()},v.prototype.rShiftTo=function(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t)t.t=0;else{var r=e%this.DB,s=this.DB-r,n=(1<<r)-1;t[0]=this[i]>>r;for(var a=i+1;a<this.t;++a)t[a-i-1]|=(this[a]&n)<<s,t[a-i]=this[a]>>r;r>0&&(t[this.t-i-1]|=(this.s&n)<<s),t.t=this.t-i,t.clamp()}},v.prototype.subTo=function(e,t){for(var i=0,r=0,s=Math.min(e.t,this.t);i<s;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()},v.prototype.multiplyTo=function(e,t){var i=this.abs(),r=e.abs(),s=i.t;for(t.t=s+r.t;--s>=0;)t[s]=0;for(s=0;s<r.t;++s)t[s+i.t]=i.am(0,r[s],t,s,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&v.ZERO.subTo(t,t)},v.prototype.squareTo=function(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var r=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,r,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()},v.prototype.divRemTo=function(e,t,i){var r=e.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=x());var n=x(),a=this.s,o=e.s,c=this.DB-P(r[r.t-1]);c>0?(r.lShiftTo(c,n),s.lShiftTo(c,i)):(r.copyTo(n),s.copyTo(i));var l=n.t,u=n[l-1];if(0!=u){var d=u*(1<<this.F1)+(l>1?n[l-2]>>this.F2:0),p=this.FV/d,h=(1<<this.F1)/d,m=1<<this.F2,f=i.t,g=f-l,_=null==t?x():t;for(n.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),v.ONE.dlShiftTo(l,_),_.subTo(n,n);n.t<l;)n[n.t++]=0;for(;--g>=0;){var y=i[--f]==u?this.DM:Math.floor(i[f]*p+(i[f-1]+m)*h);if((i[f]+=n.am(0,y,i,g,0,l))<y)for(n.dlShiftTo(g,_),i.subTo(_,i);i[f]<--y;)i.subTo(_,i)}null!=t&&(i.drShiftTo(l,t),a!=o&&v.ZERO.subTo(t,t)),i.t=l,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&v.ZERO.subTo(i,i)}}},v.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},v.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},v.prototype.exp=function(e,t){if(e>4294967295||e<1)return v.ONE;var i=x(),r=x(),s=t.convert(this),n=P(e)-1;for(s.copyTo(i);--n>=0;)if(t.sqrTo(i,r),(e&1<<n)>0)t.mulTo(r,s,i);else{var a=i;i=r,r=a}return t.revert(i)},v.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var i,r=(1<<t)-1,s=!1,n="",a=this.t,o=this.DB-a*this.DB%t;if(a-- >0)for(o<this.DB&&(i=this[a]>>o)>0&&(s=!0,n=C(i));a>=0;)o<t?(i=(this[a]&(1<<o)-1)<<t-o,i|=this[--a]>>(o+=this.DB-t)):(i=this[a]>>(o-=t)&r,o<=0&&(o+=this.DB,--a)),i>0&&(s=!0),s&&(n+=C(i));return s?n:"0"},v.prototype.negate=function(){var e=x();return v.ZERO.subTo(this,e),e},v.prototype.abs=function(){return this.s<0?this.negate():this},v.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var i=this.t;if(0!=(t=i-e.t))return this.s<0?-t:t;for(;--i>=0;)if(0!=(t=this[i]-e[i]))return t;return 0},v.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+P(this[this.t-1]^this.s&this.DM)},v.prototype.mod=function(e){var t=x();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(v.ZERO)>0&&e.subTo(t,t),t},v.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new I(t):new k(t),this.exp(e,i)},v.ZERO=T(0),v.ONE=T(1),j.prototype.convert=L,j.prototype.revert=L,j.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},j.prototype.sqrTo=function(e,t){e.squareTo(t)},U.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=x();return e.copyTo(t),this.reduce(t),t},U.prototype.revert=function(e){return e},U.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},U.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},U.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var M=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],q=(1<<26)/M[M.length-1];function H(){this.i=0,this.j=0,this.S=new Array}v.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},v.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),r=T(i),s=x(),n=x(),a="";for(this.divRemTo(r,s,n);s.signum()>0;)a=(i+n.intValue()).toString(e).substr(1)+a,s.divRemTo(r,s,n);return n.intValue().toString(e)+a},v.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),s=!1,n=0,a=0,o=0;o<e.length;++o){var c=A(e,o);c<0?"-"==e.charAt(o)&&0==this.signum()&&(s=!0):(a=t*a+c,++n>=i&&(this.dMultiply(r),this.dAddOffset(a,0),n=0,a=0))}n>0&&(this.dMultiply(Math.pow(t,n)),this.dAddOffset(a,0)),s&&v.ZERO.subTo(this,this)},v.prototype.fromNumber=function(e,t,i){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(v.ONE.shiftLeft(e-1),F,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(v.ONE.shiftLeft(e-1),this);else{var r=new Array,s=7&e;r.length=1+(e>>3),t.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},v.prototype.bitwiseTo=function(e,t,i){var r,s,n=Math.min(e.t,this.t);for(r=0;r<n;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(s=e.s&this.DM,r=n;r<this.t;++r)i[r]=t(this[r],s);i.t=this.t}else{for(s=this.s&this.DM,r=n;r<e.t;++r)i[r]=t(s,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},v.prototype.changeBit=function(e,t){var i=v.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},v.prototype.addTo=function(e,t){for(var i=0,r=0,s=Math.min(e.t,this.t);i<s;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()},v.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},v.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},v.prototype.multiplyLowerTo=function(e,t,i){var r,s=Math.min(this.t+e.t,t);for(i.s=0,i.t=s;s>0;)i[--s]=0;for(r=i.t-this.t;s<r;++s)i[s+this.t]=this.am(0,e[s],i,s,0,this.t);for(r=Math.min(e.t,t);s<r;++s)this.am(0,e[s],i,s,0,t-s);i.clamp()},v.prototype.multiplyUpperTo=function(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)},v.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(0==t)i=this[0]%e;else for(var r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i},v.prototype.millerRabin=function(e){var t=this.subtract(v.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);(e=e+1>>1)>M.length&&(e=M.length);for(var s=x(),n=0;n<e;++n){s.fromInt(M[Math.floor(Math.random()*M.length)]);var a=s.modPow(r,this);if(0!=a.compareTo(v.ONE)&&0!=a.compareTo(t)){for(var o=1;o++<i&&0!=a.compareTo(t);)if(0==(a=a.modPowInt(2,this)).compareTo(v.ONE))return!1;if(0!=a.compareTo(t))return!1}}return!0},v.prototype.clone=function(){var e=x();return this.copyTo(e),e},v.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},v.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},v.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},v.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},v.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,r=this.DB-e*this.DB%8,s=0;if(e-- >0)for(r<this.DB&&(i=this[e]>>r)!=(this.s&this.DM)>>r&&(t[s++]=i|this.s<<this.DB-r);e>=0;)r<8?(i=(this[e]&(1<<r)-1)<<8-r,i|=this[--e]>>(r+=this.DB-8)):(i=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),128&i&&(i|=-256),0==s&&(128&this.s)!=(128&i)&&++s,(s>0||i!=this.s)&&(t[s++]=i);return t},v.prototype.equals=function(e){return 0==this.compareTo(e)},v.prototype.min=function(e){return this.compareTo(e)<0?this:e},v.prototype.max=function(e){return this.compareTo(e)>0?this:e},v.prototype.and=function(e){var t=x();return this.bitwiseTo(e,R,t),t},v.prototype.or=function(e){var t=x();return this.bitwiseTo(e,F,t),t},v.prototype.xor=function(e){var t=x();return this.bitwiseTo(e,B,t),t},v.prototype.andNot=function(e){var t=x();return this.bitwiseTo(e,O,t),t},v.prototype.not=function(){for(var e=x(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},v.prototype.shiftLeft=function(e){var t=x();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},v.prototype.shiftRight=function(e){var t=x();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},v.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+N(this[e]);return this.s<0?this.t*this.DB:-1},v.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=D(this[i]^t);return e},v.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)},v.prototype.setBit=function(e){return this.changeBit(e,F)},v.prototype.clearBit=function(e){return this.changeBit(e,O)},v.prototype.flipBit=function(e){return this.changeBit(e,B)},v.prototype.add=function(e){var t=x();return this.addTo(e,t),t},v.prototype.subtract=function(e){var t=x();return this.subTo(e,t),t},v.prototype.multiply=function(e){var t=x();return this.multiplyTo(e,t),t},v.prototype.divide=function(e){var t=x();return this.divRemTo(e,t,null),t},v.prototype.remainder=function(e){var t=x();return this.divRemTo(e,null,t),t},v.prototype.divideAndRemainder=function(e){var t=x(),i=x();return this.divRemTo(e,t,i),new Array(t,i)},v.prototype.modPow=function(e,t){var i,r,s=e.bitLength(),n=T(1);if(s<=0)return n;i=s<18?1:s<48?3:s<144?4:s<768?5:6,r=s<8?new I(t):t.isEven()?new U(t):new k(t);var a=new Array,o=3,c=i-1,l=(1<<i)-1;if(a[1]=r.convert(this),i>1){var u=x();for(r.sqrTo(a[1],u);o<=l;)a[o]=x(),r.mulTo(u,a[o-2],a[o]),o+=2}var d,p,h=e.t-1,m=!0,f=x();for(s=P(e[h])-1;h>=0;){for(s>=c?d=e[h]>>s-c&l:(d=(e[h]&(1<<s+1)-1)<<c-s,h>0&&(d|=e[h-1]>>this.DB+s-c)),o=i;!(1&d);)d>>=1,--o;if((s-=o)<0&&(s+=this.DB,--h),m)a[d].copyTo(n),m=!1;else{for(;o>1;)r.sqrTo(n,f),r.sqrTo(f,n),o-=2;o>0?r.sqrTo(n,f):(p=n,n=f,f=p),r.mulTo(f,a[d],n)}for(;h>=0&&!(e[h]&1<<s);)r.sqrTo(n,f),p=n,n=f,f=p,--s<0&&(s=this.DB-1,--h)}return r.revert(n)},v.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return v.ZERO;for(var i=e.clone(),r=this.clone(),s=T(1),n=T(0),a=T(0),o=T(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(s.isEven()&&n.isEven()||(s.addTo(this,s),n.subTo(e,n)),s.rShiftTo(1,s)):n.isEven()||n.subTo(e,n),n.rShiftTo(1,n);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(e,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);i.compareTo(r)>=0?(i.subTo(r,i),t&&s.subTo(a,s),n.subTo(o,n)):(r.subTo(i,r),t&&a.subTo(s,a),o.subTo(n,o))}return 0!=r.compareTo(v.ONE)?v.ZERO:o.compareTo(e)>=0?o.subtract(e):o.signum()<0?(o.addTo(e,o),o.signum()<0?o.add(e):o):o},v.prototype.pow=function(e){return this.exp(e,new j)},v.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var r=t;t=i,i=r}var s=t.getLowestSetBit(),n=i.getLowestSetBit();if(n<0)return t;for(s<n&&(n=s),n>0&&(t.rShiftTo(n,t),i.rShiftTo(n,i));t.signum()>0;)(s=t.getLowestSetBit())>0&&t.rShiftTo(s,t),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return n>0&&i.lShiftTo(n,i),i},v.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=M[M.length-1]){for(t=0;t<M.length;++t)if(i[0]==M[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<M.length;){for(var r=M[t],s=t+1;s<M.length&&r<q;)r*=M[s++];for(r=i.modInt(r);t<s;)if(r%M[t++]==0)return!1}return i.millerRabin(e)},v.prototype.square=function(){var e=x();return this.squareTo(e),e},H.prototype.init=function(e){var t,i,r;for(t=0;t<256;++t)this.S[t]=t;for(i=0,t=0;t<256;++t)i=i+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[i],this.S[i]=r;this.i=0,this.j=0},H.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var z,V,K,G,W,J,$;function Z(){!function(e){V[K++]^=255&e,V[K++]^=e>>8&255,V[K++]^=e>>16&255,V[K++]^=e>>24&255,K>=256&&(K-=256)}((new Date).getTime())}if(null==V){if(V=new Array,K=0,void 0!==h&&(void 0!==h.crypto||void 0!==h.msCrypto))if((W=h.crypto||h.msCrypto).getRandomValues)for(J=new Uint8Array(32),W.getRandomValues(J),G=0;G<32;++G)V[K++]=J[G];else if("Netscape"==p.appName&&p.appVersion<"5")for($=h.crypto.random(32),G=0;G<$.length;++G)V[K++]=255&$.charCodeAt(G);for(;K<256;)G=Math.floor(65536*Math.random()),V[K++]=G>>>8,V[K++]=255&G;K=0,Z()}function Y(){if(null==z){for(Z(),(z=new H).init(V),K=0;K<V.length;++K)V[K]=0;K=0}return z.next()}function X(){}function Q(e,t){return new v(e,t)}function ee(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function te(e,t){this.x=t,this.q=e}function ie(e,t,i,r){this.curve=e,this.x=t,this.y=i,this.z=null==r?v.ONE:r,this.zinv=null}function re(e,t,i){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(i),this.infinity=new ie(this,null,null)}X.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=Y()},ee.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},ee.prototype.setPublic=function(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=Q(e,16),this.e=parseInt(t,16)}},ee.prototype.type="RSA",ee.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),i=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(i)<0;)t=t.add(this.p);return t.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},ee.prototype.setPrivate=function(e,t,i){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=i;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=Q(e,16),this.e=parseInt(t,16),this.d=Q(i,16)}},ee.prototype.setPrivateEx=function(e,t,i,r,s,n,a,o){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=Q(e,16),this.e=parseInt(t,16),this.d=Q(i,16),this.p=Q(r,16),this.q=Q(s,16),this.dmp1=Q(n,16),this.dmq1=Q(a,16),this.coeff=Q(o,16)},ee.prototype.generate=function(e,t){var i=new X,r=e>>1;this.e=parseInt(t,16);for(var s=new v(t,16),n=e/2-100,a=v.ONE.shiftLeft(n);;){for(;this.p=new v(e-r,1,i),0!=this.p.subtract(v.ONE).gcd(s).compareTo(v.ONE)||!this.p.isProbablePrime(10););for(;this.q=new v(r,1,i),0!=this.q.subtract(v.ONE).gcd(s).compareTo(v.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var c=this.q.subtract(this.p).abs();if(!(c.bitLength()<n||c.compareTo(a)<=0)){var l=this.p.subtract(v.ONE),u=this.q.subtract(v.ONE),d=l.multiply(u);if(0==d.gcd(s).compareTo(v.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=s.modInverse(d),this.dmp1=this.d.mod(l),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0},te.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.x.equals(e.x)},te.prototype.toBigInteger=function(){return this.x},te.prototype.negate=function(){return new te(this.q,this.x.negate().mod(this.q))},te.prototype.add=function(e){return new te(this.q,this.x.add(e.toBigInteger()).mod(this.q))},te.prototype.subtract=function(e){return new te(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))},te.prototype.multiply=function(e){return new te(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))},te.prototype.square=function(){return new te(this.q,this.x.square().mod(this.q))},te.prototype.divide=function(e){return new te(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))},te.prototype.sqrt=function(){return new te(this.q,this.x.sqrt().mod(this.q))},ie.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ie.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ie.prototype.equals=function(e){return e==this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(v.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(v.ZERO))},ie.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(v.ZERO)&&!this.y.toBigInteger().equals(v.ZERO)},ie.prototype.negate=function(){return new ie(this.curve,this.x,this.y.negate(),this.z)},ie.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),i=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(v.ZERO.equals(i))return v.ZERO.equals(t)?this.twice():this.curve.getInfinity();var r=new v("3"),s=this.x.toBigInteger(),n=this.y.toBigInteger(),a=(e.x.toBigInteger(),e.y.toBigInteger(),i.square()),o=a.multiply(i),c=s.multiply(a),l=t.square().multiply(this.z),u=l.subtract(c.shiftLeft(1)).multiply(e.z).subtract(o).multiply(i).mod(this.curve.q),d=c.multiply(r).multiply(t).subtract(n.multiply(o)).subtract(l.multiply(t)).multiply(e.z).add(t.multiply(o)).mod(this.curve.q),p=o.multiply(this.z).multiply(e.z).mod(this.curve.q);return new ie(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(d),p)},ie.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=new v("3"),t=this.x.toBigInteger(),i=this.y.toBigInteger(),r=i.multiply(this.z),s=r.multiply(i).mod(this.curve.q),n=this.curve.a.toBigInteger(),a=t.square().multiply(e);v.ZERO.equals(n)||(a=a.add(this.z.square().multiply(n)));var o=(a=a.mod(this.curve.q)).square().subtract(t.shiftLeft(3).multiply(s)).shiftLeft(1).multiply(r).mod(this.curve.q),c=a.multiply(e).multiply(t).subtract(s.shiftLeft(1)).shiftLeft(2).multiply(s).subtract(a.square().multiply(a)).mod(this.curve.q),l=r.square().multiply(r).shiftLeft(3).mod(this.curve.q);return new ie(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(c),l)},ie.prototype.multiply=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,i=e,r=i.multiply(new v("3")),s=this.negate(),n=this,a=this.curve.q.subtract(e),o=a.multiply(new v("3")),c=new ie(this.curve,this.x,this.y),l=c.negate();for(t=r.bitLength()-2;t>0;--t){n=n.twice();var u=r.testBit(t);u!=i.testBit(t)&&(n=n.add(u?this:s))}for(t=o.bitLength()-2;t>0;--t){c=c.twice();var d=o.testBit(t);d!=a.testBit(t)&&(c=c.add(d?c:l))}return n},ie.prototype.multiplyTwo=function(e,t,i){var r;r=e.bitLength()>i.bitLength()?e.bitLength()-1:i.bitLength()-1;for(var s=this.curve.getInfinity(),n=this.add(t);r>=0;)s=s.twice(),e.testBit(r)?s=i.testBit(r)?s.add(n):s.add(this):i.testBit(r)&&(s=s.add(t)),--r;return s},re.prototype.getQ=function(){return this.q},re.prototype.getA=function(){return this.a},re.prototype.getB=function(){return this.b},re.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)},re.prototype.getInfinity=function(){return this.infinity},re.prototype.fromBigInteger=function(e){return new te(this.q,e)},re.prototype.decodePointHex=function(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),i=(e.substr(2),this.fromBigInteger(new v(o,16))),r=this.getA(),s=this.getB(),n=i.square().add(r).multiply(i).add(s).sqrt();return"03"==t&&(n=n.negate()),new ie(this,i,n);case 4:case 6:case 7:var a=(e.length-2)/2,o=e.substr(2,a),c=e.substr(a+2,a);return new ie(this,this.fromBigInteger(new v(o,16)),this.fromBigInteger(new v(c,16)));default:return null}},te.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ie.prototype.getEncoded=function(e){var t=function(e,t){var i=e.toByteArrayUnsigned();if(t<i.length)i=i.slice(i.length-t);else for(;t>i.length;)i.unshift(0);return i},i=this.getX().toBigInteger(),r=this.getY().toBigInteger(),s=t(i,32);return e?r.isEven()?s.unshift(2):s.unshift(3):(s.unshift(4),s=s.concat(t(r,32))),s},ie.decodeFrom=function(e,t){t[0];var i=t.length-1,r=t.slice(1,1+i/2),s=t.slice(1+i/2,1+i);r.unshift(0),s.unshift(0);var n=new v(r),a=new v(s);return new ie(e,e.fromBigInteger(n),e.fromBigInteger(a))},ie.decodeFromHex=function(e,t){t.substr(0,2);var i=t.length-2,r=t.substr(2,i/2),s=t.substr(2+i/2,i/2),n=new v(r,16),a=new v(s,16);return new ie(e,e.fromBigInteger(n),e.fromBigInteger(a))},ie.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),i=e.y.subtract(this.y).divide(t),r=i.square().subtract(this.x).subtract(e.x),s=i.multiply(this.x.subtract(r)).subtract(this.y);return new ie(this.curve,r,s)},ie.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(v.valueOf(2)),t=this.curve.fromBigInteger(v.valueOf(3)),i=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),r=i.square().subtract(this.x.multiply(e)),s=i.multiply(this.x.subtract(r)).subtract(this.y);return new ie(this.curve,r,s)},ie.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,i=e,r=i.multiply(new v("3")),s=this.negate(),n=this;for(t=r.bitLength()-2;t>0;--t){n=n.twice();var a=r.testBit(t);a!=i.testBit(t)&&(n=n.add2D(a?this:s))}return n},ie.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),i=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),s=this.curve.getQ(),n=t.multiply(t).mod(s),a=e.multiply(e).multiply(e).add(i.multiply(e)).add(r).mod(s);return n.equals(a)},ie.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ie.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),i=this.getY().toBigInteger();if(t.compareTo(v.ONE)<0||t.compareTo(e.subtract(v.ONE))>0)throw new Error("x coordinate out of bounds");if(i.compareTo(v.ONE)<0||i.compareTo(e.subtract(v.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var se=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),i={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(e,t,r){return t?i[t]:String.fromCharCode(parseInt(r,16))}var s=new String(""),n=Object.hasOwnProperty;return function(i,a){var o,c,l=i.match(e),u=l[0],d=!1;"{"===u?o={}:"["===u?o=[]:(o=[],d=!0);for(var p=[o],h=1-d,m=l.length;h<m;++h){var f;switch((u=l[h]).charCodeAt(0)){default:(f=p[0])[c||f.length]=+u,c=void 0;break;case 34:if(-1!==(u=u.substring(1,u.length-1)).indexOf("\\")&&(u=u.replace(t,r)),f=p[0],!c){if(!(f instanceof Array)){c=u||s;break}c=f.length}f[c]=u,c=void 0;break;case 91:f=p[0],p.unshift(f[c||f.length]=[]),c=void 0;break;case 93:case 125:p.shift();break;case 102:(f=p[0])[c||f.length]=!1,c=void 0;break;case 110:(f=p[0])[c||f.length]=null,c=void 0;break;case 116:(f=p[0])[c||f.length]=!0,c=void 0;break;case 123:f=p[0],p.unshift(f[c||f.length]={}),c=void 0}}if(d){if(1!==p.length)throw new Error;o=o[0]}else if(p.length)throw new Error;if(a){var g=function(e,t){var i=e[t];if(i&&"object"==typeof i){var r=null;for(var s in i)if(n.call(i,s)&&i!==e){var o=g(i,s);void 0!==o?i[s]=o:(r||(r=[]),r.push(s))}if(r)for(var c=r.length;--c>=0;)delete i[r[c]]}return a.call(e,t,i)};o=g({"":o},"")}return o}}();void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),ne.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return Ge(e)},this.getPEMStringFromHex=function(e,t){return Ce(e,t)},this.newObject=function(e){var t=ne.asn1,i=t.ASN1Object,r=t.DERBoolean,s=t.DERInteger,n=t.DERBitString,a=t.DEROctetString,o=t.DERNull,c=t.DERObjectIdentifier,l=t.DEREnumerated,u=t.DERUTF8String,d=t.DERNumericString,p=t.DERPrintableString,h=t.DERTeletexString,m=t.DERIA5String,f=t.DERUTCTime,g=t.DERGeneralizedTime,_=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,v=t.DERSet,x=t.DERTaggedObject,S=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var w=Object.keys(e);if(1!=w.length)throw new Error("key of param shall be only one.");var E=w[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+E+":"))throw new Error("undefined key: "+E);if("bool"==E)return new r(e[E]);if("int"==E)return new s(e[E]);if("bitstr"==E)return new n(e[E]);if("octstr"==E)return new a(e[E]);if("null"==E)return new o(e[E]);if("oid"==E)return new c(e[E]);if("enum"==E)return new l(e[E]);if("utf8str"==E)return new u(e[E]);if("numstr"==E)return new d(e[E]);if("prnstr"==E)return new p(e[E]);if("telstr"==E)return new h(e[E]);if("ia5str"==E)return new m(e[E]);if("utctime"==E)return new f(e[E]);if("gentime"==E)return new g(e[E]);if("visstr"==E)return new _(e[E]);if("bmpstr"==E)return new y(e[E]);if("asn1"==E)return new i(e[E]);if("seq"==E){for(var C=e[E],A=[],T=0;T<C.length;T++){var P=S(C[T]);A.push(P)}return new b({array:A})}if("set"==E){for(C=e[E],A=[],T=0;T<C.length;T++){P=S(C[T]);A.push(P)}return new v({array:A})}if("tag"==E){var I=e[E];if("[object Array]"===Object.prototype.toString.call(I)&&3==I.length){var k=S(I[2]);return new x({tag:I[0],explicit:I[1],obj:k})}return new x(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).tohex()}},ne.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),r=(t=Math.floor(i/40)+"."+i%40,""),s=2;s<e.length;s+=2){var n=("00000000"+parseInt(e.substr(s,2),16).toString(2)).slice(-8);if(r+=n.substr(1,7),"0"==n.substr(0,1))t=t+"."+new v(r,2).toString(10),r=""}return t},ne.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",r=new v(e,10).toString(2),s=7-r.length%7;7==s&&(s=0);for(var n="",a=0;a<s;a++)n+="0";r=n+r;for(a=0;a<r.length-1;a+=7){var o=r.substr(a,7);a!=r.length-7&&(o="1"+o),i+=t(parseInt(o,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",s=e.split("."),n=40*parseInt(s[0])+parseInt(s[1]);r+=t(n),s.splice(0,2);for(var a=0;a<s.length;a++)r+=i(s[a]);return r},ne.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var i=t.length/2;if(i>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+e.toString(16));return(128+i).toString(16)+t},this.tohex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},ne.asn1.DERAbstractString=function(e){ne.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=_e(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},Qe(ne.asn1.DERAbstractString,ne.asn1.ASN1Object),ne.asn1.DERAbstractTime=function(e){ne.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,i){var r=this.zeroPadding,s=this.localDateToUTC(e),n=String(s.getFullYear());"utc"==t&&(n=n.substr(2,2));var a=n+r(String(s.getMonth()+1),2)+r(String(s.getDate()),2)+r(String(s.getHours()),2)+r(String(s.getMinutes()),2)+r(String(s.getSeconds()),2);if(!0===i){var o=s.getMilliseconds();if(0!=o){var c=r(String(o),3);a=a+"."+(c=c.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.setByParam=function(e){this.hV=null,this.hTLV=null,this.params=e},this.getString=function(){},this.setString=function(e){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.str=e},this.setByDate=function(e){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.date=e},this.setByDateValue=function(e,t,i,r,s,n){var a=new Date(Date.UTC(e,t-1,i,r,s,n,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},Qe(ne.asn1.DERAbstractTime,ne.asn1.ASN1Object),ne.asn1.DERAbstractStructured=function(e){ne.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},Qe(ne.asn1.DERAbstractStructured,ne.asn1.ASN1Object),ne.asn1.DERBoolean=function(e){ne.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},Qe(ne.asn1.DERBoolean,ne.asn1.ASN1Object),ne.asn1.DERInteger=function(e){ne.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=Ge;this.setByBigInteger=function(e){this.isModified=!0,this.params={bigint:e}},this.setByInteger=function(e){this.isModified=!0,this.params=e},this.setValueHex=function(e){this.isModified=!0,this.params={hex:e}},this.getFreshValueHex=function(){var e=this.params,i=null;if(null==e)throw new Error("value not set");if("object"==typeof e&&null!=e.hex)return this.hV=e.hex,this.hV;if("number"==typeof e)i=new v(String(e),10);else if(null!=e.int)i=new v(String(e.int),10);else{if(null==e.bigint)throw new Error("wrong parameter");i=e.bigint}return this.hV=t(i),this.hV},null!=e&&(this.params=e)},Qe(ne.asn1.DERInteger,ne.asn1.ASN1Object),ne.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ne.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}ne.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var i="0"+e;this.hTLV=null,this.isModified=!0,this.hV=i+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0),e+="0000000".substr(0,t);for(var i="",r=0;r<e.length-1;r+=8){var s=e.substr(r,8),n=parseInt(s,2).toString(16);1==n.length&&(n="0"+n),i+=n}this.hTLV=null,this.isModified=!0,this.hV="0"+t+i},this.setByBooleanArray=function(e){for(var t="",i=0;i<e.length;i++)1==e[i]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},Qe(ne.asn1.DERBitString,ne.asn1.ASN1Object),ne.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ne.asn1.ASN1Util.newObject(e.obj);e.hex=t.tohex()}ne.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},Qe(ne.asn1.DEROctetString,ne.asn1.DERAbstractString),ne.asn1.DERNull=function(){ne.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Qe(ne.asn1.DERNull,ne.asn1.ASN1Object),ne.asn1.DERObjectIdentifier=function(e){ne.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=ze(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=ne.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.DERObjectIdentifier,ne.asn1.ASN1Object),ne.asn1.DEREnumerated=function(e){ne.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Ge(e)},this.setByInteger=function(e){var t=new v(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},Qe(ne.asn1.DEREnumerated,ne.asn1.ASN1Object),ne.asn1.DERUTF8String=function(e){ne.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},Qe(ne.asn1.DERUTF8String,ne.asn1.DERAbstractString),ne.asn1.DERNumericString=function(e){ne.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},Qe(ne.asn1.DERNumericString,ne.asn1.DERAbstractString),ne.asn1.DERPrintableString=function(e){ne.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},Qe(ne.asn1.DERPrintableString,ne.asn1.DERAbstractString),ne.asn1.DERTeletexString=function(e){ne.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},Qe(ne.asn1.DERTeletexString,ne.asn1.DERAbstractString),ne.asn1.DERIA5String=function(e){ne.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},Qe(ne.asn1.DERIA5String,ne.asn1.DERAbstractString),ne.asn1.DERVisibleString=function(e){ne.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},Qe(ne.asn1.DERVisibleString,ne.asn1.DERAbstractString),ne.asn1.DERBMPString=function(e){ne.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},Qe(ne.asn1.DERBMPString,ne.asn1.DERAbstractString),ne.asn1.DERUTCTime=function(e){ne.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var e=this.params;if(null==this.params&&(e={date:new Date}),"string"==typeof e){if(!e.match(/^[0-9]{12}Z$/)&&!e.match(/^[0-9]{12}\.[0-9]+Z$/))throw new Error("malformed string for UTCTime: "+e);this.hV=pe(e)}else if(null!=e.str)this.hV=pe(e.str);else if(null==e.date&&1==e.millis){var t=new Date;this.hV=pe(this.formatDate(t,"utc",!0))}else if(null!=e.date&&e.date instanceof Date){var i=!0===e.millis;this.hV=pe(this.formatDate(e.date,"utc",i))}else e instanceof Date&&(this.hV=pe(this.formatDate(e,"utc")));if(null==this.hV)throw new Error("parameter not specified properly for UTCTime");return this.hV},null!=e&&this.setByParam(e)},Qe(ne.asn1.DERUTCTime,ne.asn1.DERAbstractTime),ne.asn1.DERGeneralizedTime=function(e){ne.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.params=e,this.getFreshValueHex=function(){var e=this.params;if(null==this.params&&(e={date:new Date}),"string"==typeof e){if(!e.match(/^[0-9]{14}Z$/)&&!e.match(/^[0-9]{14}\.[0-9]+Z$/))throw new Error("malformed string for GeneralizedTime: "+e);this.hV=pe(e)}else if(null!=e.str)this.hV=pe(e.str);else if(null==e.date&&1==e.millis){var t=new Date;this.hV=pe(this.formatDate(t,"gen",!0))}else if(null!=e.date&&e.date instanceof Date){var i=!0===e.millis;this.hV=pe(this.formatDate(e.date,"gen",i))}else e instanceof Date&&(this.hV=pe(this.formatDate(e,"gen")));if(null==this.hV)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},null!=e&&this.setByParam(e)},Qe(ne.asn1.DERGeneralizedTime,ne.asn1.DERAbstractTime),ne.asn1.DERSequence=function(e){ne.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].tohex()}return this.hV=e,this.hV}},Qe(ne.asn1.DERSequence,ne.asn1.DERAbstractStructured),ne.asn1.DERSet=function(e){ne.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var i=this.asn1Array[t];e.push(i.tohex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},Qe(ne.asn1.DERSet,ne.asn1.DERAbstractStructured),ne.asn1.DERTaggedObject=function(e){ne.asn1.DERTaggedObject.superclass.constructor.call(this);var t=ne.asn1,i=ce,r=i.getV,s=(i.isASN1HEX,t.ASN1Util.newObject);this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(e,t,i){this.params={tag:t,explicit:e,obj:i}},this.getFreshValueHex=function(){var e=this.params;if(null==e.explicit&&(e.explicit=!0),null!=e.tage&&(e.tag=e.tage,e.explicit=!0),null!=e.tagi&&(e.tag=e.tagi,e.explicit=!1),null!=e.str)this.hV=_e(e.str);else if(null!=e.hex)this.hV=e.hex;else{if(null==e.obj)throw new Error("str, hex nor obj not specified");var i;e.obj instanceof t.ASN1Object?i=e.obj.tohex():"object"==typeof e.obj&&(i=s(e.obj).tohex()),e.explicit?this.hV=i:this.hV=r(i,0)}return null==e.tag&&(e.tag="a0"),this.hT=e.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.DERTaggedObject,ne.asn1.ASN1Object);var ne,ae,oe,ce=new function(){};function le(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function ue(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t}function de(e){for(var t="",i=0;i<e.length;i++){var r=e[i].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function pe(e){return de(le(e))}function he(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function me(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function fe(e){return e.length%2==1&&(e="0"+e),he(_(e))}function ge(e){return y(me(e))}function _e(e){return ke(Ue(e)).toLowerCase()}function ye(e){try{return decodeURIComponent(Re(e))}catch(e){return null}}function be(e){return ye(function(e){for(var t=e.match(/.{1,2}/g),i=[],r=0;r<t.length;r++){var s=parseInt(t[r],16);161<=s&&s<=191?(i.push("c2"),i.push(t[r])):192<=s&&s<=255?(i.push("c3"),i.push((s-64).toString(16))):i.push(t[r])}return i.join("")}(e))}function ve(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function xe(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function Se(e){return _(e)}function we(e,t){return e=(e=e.replace(new RegExp("(.{"+t+"})","g"),"$1\r\n")).replace(/\s+$/,"")}function Ee(e){return y(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Ce(e,t){return"-----BEGIN "+t+"-----\r\n"+we(Se(e),64)+"\r\n-----END "+t+"-----\r\n"}function Ae(e,t){if(-1==e.indexOf("-----BEGIN "))throw new Error("can't find PEM header");return Ee(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Te(e){var t,i,r,s,n,a,o,c,l,u;if(u=(e=Ie(e)).match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return t=parseInt(u[1]),i=parseInt(u[2])-1,r=parseInt(u[3]),s=parseInt(u[4]),n=parseInt(u[5]),a=parseInt(u[6]),o=0,""!==(c=u[7])&&(l=(c.substr(1)+"00").substr(0,3),o=parseInt(l)),Date.UTC(t,i,r,s,n,a,o);throw new Error("unsupported zulu format: "+e)}function Pe(e){return Math.round(Te(e)/1e3)}function Ie(e){return e.match(/^[0-9]{12}Z$/)||e.match(/^[0-9]{12}[.][0-9]*Z$/)?e.match(/^[0-4]/)?"20"+e:"19"+e:e}function ke(e){return e.replace(/%/g,"")}function Re(e){return e.replace(/(..)/g,"%$1")}function Fe(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var i=(e=e.toLowerCase()).split(":").length-1;if(i<2)throw t;var r=":".repeat(7-i+2),s=(e=e.replace("::",r)).split(":");if(8!=s.length)throw t;for(var n=0;n<8;n++)s[n]=("0000"+s[n]).slice(-4);return s.join("")}function Be(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+e);var t=(e=e.toLowerCase()).match(/.{1,4}/g);t=t.map((function(e){return e.replace(/^0+/,"")})),t=t.map((function(e){return""==e?"0":e}));var i=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null==i)return e.slice(1,-1);var r=i.sort().slice(-1)[0];return"::"!=(e=e.replace(r.substr(0,r.length-1),":")).substr(0,2)&&(e=e.substr(1)),"::"!=e.substr(-2,2)&&(e=e.substr(0,e.length-1)),e}function Oe(e){var t=new Error("malformed hex value");if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8==e.length){try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}else{if(16!=e.length){if(32==e.length)return Be(e);if(64==e.length){try{return Be(e.substr(0,32))+"/"+Ne(e.substr(32))}catch(e){throw t}return}return e}try{return Oe(e.substr(0,8))+"/"+Ne(e.substr(8))}catch(e){throw t}}}function Ne(e){var t,i=new Error("malformed mask");try{t=new v(e,16).toString(2)}catch(e){throw i}if(!t.match(/^1*0*$/))throw i;return t.replace(/0+$/,"").length}function De(e){var t=new Error("malformed IP address");if(!(e=e.toLowerCase(e)).match(/^[0-9a-f.:/]+$/))throw t;if(!e.match(/^[0-9.]+$/)){var i;if(e.match(/^[0-9.]+\/[0-9]+$/))return De((i=e.split("/"))[0])+je(parseInt(i[1]),32);if(e.match(/^[0-9a-f:]+$/)&&-1!==e.indexOf(":"))return Fe(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&-1!==e.indexOf(":"))return Fe((i=e.split("/"))[0])+je(parseInt(i[1]),128);throw t}var r=e.split(".");if(4!==r.length)throw t;var s="";try{for(var n=0;n<4;n++){s+=("0"+parseInt(r[n]).toString(16)).slice(-2)}return s}catch(e){throw t}}function je(e,t){return 32==t&&0==e?"00000000":128==t&&0==e?"00000000000000000000000000000000":new v(Array(e+1).join("1")+Array(t-e+1).join("0"),2).toString(16)}function Le(e){var t=e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),i=parseInt(e.substr(2),16);if(0==t&i<128)return String.fromCharCode(i);if(t<8){var r=128|63&i;return ye((192|(7&t)<<3|(192&i)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&i)>>6;var s=128|63&i;return ye((224|(240&t)>>4).toString(16)+r.toString(16)+s.toString(16))}));return t.join("")}function Ue(e){for(var t=encodeURIComponent(e),i="",r=0;r<t.length;r++)"%"==t[r]?(i+=t.substr(r,3),r+=2):i=i+"%"+pe(t[r]);return i}function Me(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function qe(e){return!!e.match(/^[0-9A-Za-z-_.]+$/)}function He(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}ce.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var i=parseInt(e.substr(t+3,1));return 0==i?-1:0<i&&i<10?i+1:-2},ce.getL=function(e,t){var i=ce.getLblen(e,t);return i<1?"":e.substr(t+2,2*i)},ce.getVblen=function(e,t){var i;return""==(i=ce.getL(e,t))?-1:("8"===i.substr(0,1)?new v(i.substr(2),16):new v(i,16)).intValue()},ce.getVidx=function(e,t){var i=ce.getLblen(e,t);return i<0?i:t+2*(i+1)},ce.getV=function(e,t){var i=ce.getVidx(e,t),r=ce.getVblen(e,t);return e.substr(i,2*r)},ce.getTLV=function(e,t){return e.substr(t,2)+ce.getL(e,t)+ce.getV(e,t)},ce.getTLVblen=function(e,t){return 2+2*ce.getLblen(e,t)+2*ce.getVblen(e,t)},ce.getNextSiblingIdx=function(e,t){return ce.getVidx(e,t)+2*ce.getVblen(e,t)},ce.getChildIdx=function(e,t){var i,r,s,n=ce,a=[];i=n.getVidx(e,t),r=2*n.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,r-=2),s=0;for(var o=i;s<=r;){var c=n.getTLVblen(e,o);if((s+=c)<=r&&a.push(o),o+=c,s>=r)break}return a},ce.getNthChildIdx=function(e,t,i){return ce.getChildIdx(e,t)[i]},ce.getIdxbyList=function(e,t,i,r){var s,n,a=ce;return 0==i.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(s=i.shift())>=(n=a.getChildIdx(e,t)).length?-1:a.getIdxbyList(e,n[s],i,r)},ce.getIdxbyListEx=function(e,t,i,r){var s,n,a=ce;if(0==i.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;s=i.shift(),n=a.getChildIdx(e,t);for(var o=0,c=0;c<n.length;c++){var l=e.substr(n[c],2);if("number"==typeof s&&!a.isContextTag(l)&&o==s||"string"==typeof s&&a.isContextTag(l,s))return a.getIdxbyListEx(e,n[c],i,r);a.isContextTag(l)||o++}return-1},ce.getTLVbyList=function(e,t,i,r){var s=ce,n=s.getIdxbyList(e,t,i,r);return-1==n||n>=e.length?null:s.getTLV(e,n)},ce.getTLVbyListEx=function(e,t,i,r){var s=ce,n=s.getIdxbyListEx(e,t,i,r);return-1==n?null:s.getTLV(e,n)},ce.getVbyList=function(e,t,i,r,s){var n,a,o=ce;return-1==(n=o.getIdxbyList(e,t,i,r))||n>=e.length?null:(a=o.getV(e,n),!0===s&&(a=a.substr(2)),a)},ce.getVbyListEx=function(e,t,i,r,s){var n,a,o=ce;return-1==(n=o.getIdxbyListEx(e,t,i,r))?null:(a=o.getV(e,n),"03"==e.substr(n,2)&&!1!==s&&(a=a.substr(2)),a)},ce.getInt=function(e,t,i){null==i&&(i=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return i;var s=ce.getV(e,t);return"02"==r?parseInt(s,16):Je(s)}catch(e){return i}},ce.getOID=function(e,t,i){null==i&&(i=null);try{return"06"!=e.substr(t,2)?i:Ve(ce.getV(e,t))}catch(e){return i}},ce.getOIDName=function(e,t,i){null==i&&(i=null);try{var r=ce.getOID(e,t,i);if(r==i)return i;var s=ne.asn1.x509.OID.oid2name(r);return""==s?r:s}catch(e){return i}},ce.getString=function(e,t,i){null==i&&(i=null);try{return ve(ce.getV(e,t))}catch(e){return i}},ce.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},i=[],r=e.substr(0,2),s=parseInt(r,16);i[0]=new String(Math.floor(s/40)),i[1]=new String(s%40);for(var n=e.substr(2),a=[],o=0;o<n.length/2;o++)a.push(parseInt(n.substr(2*o,2),16));var c=[],l="";for(o=0;o<a.length;o++)128&a[o]?l+=t((127&a[o]).toString(2),7):(l+=t((127&a[o]).toString(2),7),c.push(new String(parseInt(l,2))),l="");var u=i.join(".");return c.length>0&&(u=u+"."+c.join(".")),u},ce.dump=function(e,t,i,r){var s=ce,n=s.getV,a=s.dump,o=s.getChildIdx,c=e;e instanceof ne.asn1.ASN1Object&&(c=e.tohex());var l=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===i&&(i=0),void 0===r&&(r="");var u,d=t.ommit_long_octet;if("01"==(u=c.substr(i,2)))return"00"==(p=n(c,i))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==u)return r+"INTEGER "+l(p=n(c,i),d)+"\n";if("03"==u){var p=n(c,i);if(s.isASN1HEX(p.substr(2))){var h=r+"BITSTRING, encapsulates\n";return h+=a(p.substr(2),t,0,r+"  ")}return r+"BITSTRING "+l(p,d)+"\n"}if("04"==u){p=n(c,i);if(s.isASN1HEX(p)){h=r+"OCTETSTRING, encapsulates\n";return h+=a(p,t,0,r+"  ")}return r+"OCTETSTRING "+l(p,d)+"\n"}if("05"==u)return r+"NULL\n";if("06"==u){var m=n(c,i),f=ne.asn1.ASN1Util.oidHexToInt(m),g=ne.asn1.x509.OID.oid2name(f),_=f.replace(/\./g," ");return""!=g?r+"ObjectIdentifier "+g+" ("+_+")\n":r+"ObjectIdentifier ("+_+")\n"}if("0a"==u)return r+"ENUMERATED "+parseInt(n(c,i))+"\n";if("0c"==u)return r+"UTF8String '"+ye(n(c,i))+"'\n";if("13"==u)return r+"PrintableString '"+ye(n(c,i))+"'\n";if("14"==u)return r+"TeletexString '"+ye(n(c,i))+"'\n";if("16"==u)return r+"IA5String '"+ye(n(c,i))+"'\n";if("17"==u)return r+"UTCTime "+ye(n(c,i))+"\n";if("18"==u)return r+"GeneralizedTime "+ye(n(c,i))+"\n";if("1a"==u)return r+"VisualString '"+ye(n(c,i))+"'\n";if("1e"==u)return r+"BMPString '"+Le(n(c,i))+"'\n";if("30"==u){if("3000"==c.substr(i,4))return r+"SEQUENCE {}\n";h=r+"SEQUENCE\n";var y=t;if((2==(x=o(c,i)).length||3==x.length)&&"06"==c.substr(x[0],2)&&"04"==c.substr(x[x.length-1],2)){g=s.oidname(n(c,x[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=g,y=b}for(var v=0;v<x.length;v++)h+=a(c,y,x[v],r+"  ");return h}if("31"==u){h=r+"SET\n";var x=o(c,i);for(v=0;v<x.length;v++)h+=a(c,t,x[v],r+"  ");return h}if(128&(u=parseInt(u,16))){var S=31&u;if(32&u){for(h=r+"["+S+"]\n",x=o(c,i),v=0;v<x.length;v++)h+=a(c,t,x[v],r+"  ");return h}p=n(c,i);if(ce.isASN1HEX(p)){var h=r+"["+S+"]\n";return h+=a(p,t,0,r+"  ")}return("68747470"==p.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==S)&&(p=ye(p)),h=r+"["+S+"] "+p+"\n"}return r+"UNKNOWN("+u+") "+n(c,i)+"\n"},ce.parse=function(e){var t=ce,i=t.parse,r=t.isASN1HEX,s=t.getV,n=t.getTLV,a=t.getChildIdx,o=ne.asn1,c=o.ASN1Util.oidHexToInt,l=o.x509.OID.oid2name,u=ye,d=Le,p=be,h={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},m=e.substr(0,2),f={},g=s(e,0);if("01"==m)return"0101ff"==e?{bool:!0}:{bool:!1};if("02"==m)return{int:{hex:g}};if("03"==m)try{if("00"!=g.substr(0,2))throw"not encap";var _=g.substr(2);if(!r(_))throw"not encap";return{bitstr:{obj:i(_)}}}catch(e){var y=null;return g.length<=10&&(y=Ze(g)),null==y?{bitstr:{hex:g}}:{bitstr:{bin:y}}}else if("04"==m)try{if(!r(g))throw"not encap";return{octstr:{obj:i(g)}}}catch(e){return{octstr:{hex:g}}}else{if("05"==m)return{null:""};if("06"==m){var b=c(g),v=l(b);return""==v?{oid:b}:{oid:v}}if("0a"==m)return g.length>4?{enum:{hex:g}}:{enum:parseInt(g,16)};if("30"==m||"31"==m)return f[h[m]]=function(e){for(var t=[],r=a(e,0),s=0;s<r.length;s++){var o=r[s],c=n(e,o),l=i(c);t.push(l)}return t}(e),f;if("14"==m){var x=p(g);return f[h[m]]={str:x},f}if("1e"==m){x=d(g);return f[h[m]]={str:x},f}if(-1!=":0c:12:13:16:17:18:1a:".indexOf(m)){x=u(g);return f[h[m]]={str:x},f}if(m.match(/^8[0-9]$/))return null==(x=u(g))|""==x||null!=x.match(/[\x00-\x1F\x7F-\x9F]/)||null!=x.match(/[\u0000-\u001F\u0080–\u009F]/)?{tag:{tag:m,explicit:!1,hex:g}}:{tag:{tag:m,explicit:!1,str:x}};if(!m.match(/^a[0-9]$/)){var S=new ne.asn1.ASN1Object;return S.hV=g,{asn1:{tlv:m+S.getLengthHexFromValue()+g}}}try{if(!r(g))throw new Error("not encap");return{tag:{tag:m,explicit:!0,obj:i(g)}}}catch(e){return{tag:{tag:m,explicit:!0,hex:g}}}}},ce.isContextTag=function(e,t){var i,r;e=e.toLowerCase();try{i=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&i);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&i)&&(31&i)==r))}catch(e){return!1}},ce.isASN1HEX=function(e){var t=ce;if(e.length%2==1)return!1;var i=t.getVblen(e,0),r=e.substr(0,2),s=t.getL(e,0);return e.length-r.length-s.length==2*i},ce.checkStrictDER=function(e,t,i,r,s){var n=ce;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!ne.lang.String.isHex(e))throw new Error("not hex string");i=e.length,s=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(n.getL(e,t).length>2*s)throw new Error("L of TLV too long: idx="+t);var a=n.getVblen(e,t);if(a>r)throw new Error("value of L too long than hex: idx="+t);var o=n.getTLV(e,t),c=o.length-2-n.getL(e,t).length;if(c!==2*a)throw new Error("V string length and L's value not the same:"+c+"/"+2*a);if(0===t&&e.length!=o.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+o.length);var l=e.substr(t,2);if("02"===l){var u=n.getVidx(e,t);if("00"==e.substr(u,2)&&e.charCodeAt(u+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(l,16)){for(var d=n.getVblen(e,t),p=0,h=n.getChildIdx(e,t),m=0;m<h.length;m++){p+=n.getTLV(e,h[m]).length,n.checkStrictDER(e,h[m],i,r,s)}if(2*d!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*d+"!="+p)}},ce.oidname=function(e){var t=ne.asn1;ne.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.x509&&ne.asn1.x509||(ne.asn1.x509={}),ne.asn1.x509.Certificate=function(e){ne.asn1.x509.Certificate.superclass.constructor.call(this);var t=ne.asn1,i=t.DERBitString,r=t.DERSequence,s=t.x509,n=s.TBSCertificate,a=s.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var i=e.tbsobj.tohex(),r=new ne.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(i),e.sighex=r.sign()},this.getPEM=function(){return Ce(this.tohex(),"CERTIFICATE")},this.tohex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new n(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new i({hex:"00"+e.sighex})),new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&(this.params=e)},Qe(ne.asn1.x509.Certificate,ne.asn1.ASN1Object),ne.asn1.x509.TBSCertificate=function(e){ne.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=ne.asn1,i=t.x509,r=t.DERTaggedObject,s=t.DERInteger,n=t.DERSequence,a=i.AlgorithmIdentifier,o=i.Time,c=i.X500Name,l=i.Extensions,u=i.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var i=2;null!=t.version&&(i=t.version-1);var d=new r({obj:new s({int:i})});e.push(d)}return e.push(new s(t.serial)),e.push(new a({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new n({array:[new o(t.notbefore),new o(t.notafter)]})),e.push(new c(t.subject)),e.push(new u(et.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new l(t.ext)})),new ne.asn1.DERSequence({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.TBSCertificate,ne.asn1.ASN1Object),ne.asn1.x509.Extensions=function(e){ne.asn1.x509.Extensions.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.tohex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var s=this.aParam[t],n=s.extname,a=null;if(null!=s.extn)a=new r.PrivateExtension(s);else if("subjectKeyIdentifier"==n)a=new r.SubjectKeyIdentifier(s);else if("keyUsage"==n)a=new r.KeyUsage(s);else if("subjectAltName"==n)a=new r.SubjectAltName(s);else if("issuerAltName"==n)a=new r.IssuerAltName(s);else if("basicConstraints"==n)a=new r.BasicConstraints(s);else if("nameConstraints"==n)a=new r.NameConstraints(s);else if("cRLDistributionPoints"==n)a=new r.CRLDistributionPoints(s);else if("certificatePolicies"==n)a=new r.CertificatePolicies(s);else if("policyMappings"==n)a=new r.PolicyMappings(s);else if("policyConstraints"==n)a=new r.PolicyConstraints(s);else if("inhibitAnyPolicy"==n)a=new r.InhibitAnyPolicy(s);else if("authorityKeyIdentifier"==n)a=new r.AuthorityKeyIdentifier(s);else if("extKeyUsage"==n)a=new r.ExtKeyUsage(s);else if("authorityInfoAccess"==n)a=new r.AuthorityInfoAccess(s);else if("cRLNumber"==n)a=new r.CRLNumber(s);else if("cRLReason"==n)a=new r.CRLReason(s);else if("ocspNonce"==n)a=new r.OCSPNonce(s);else if("ocspNoCheck"==n)a=new r.OCSPNoCheck(s);else if("adobeTimeStamp"==n)a=new r.AdobeTimeStamp(s);else{if("subjectDirectoryAttributes"!=n)throw new Error("extension not supported:"+JSON.stringify(s));a=new r.SubjectDirectoryAttributes(s)}null!=a&&e.push(a)}return new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.x509.Extensions,ne.asn1.ASN1Object),ne.asn1.x509.Extension=function(e){ne.asn1.x509.Extension.superclass.constructor.call(this);var t=ne.asn1,i=t.DERObjectIdentifier,r=t.DEROctetString,s=(t.DERBitString,t.DERBoolean),n=t.DERSequence;this.tohex=function(){var e=new i({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),a=new Array;return a.push(e),this.critical&&a.push(new s),a.push(t),new n({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},Qe(ne.asn1.x509.Extension,ne.asn1.ASN1Object),ne.asn1.x509.KeyUsage=function(e){ne.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Error,i={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var e=this.getBinValue();return this.asn1ExtnValue=new ne.asn1.DERBitString({bin:e}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var e=this.params;if("object"!=typeof e||"object"!=typeof e.names&&"string"!=typeof e.bin)throw new t("parameter not yet set");if(null!=e.names)return Ye(e.names,i);if(null!=e.bin)return e.bin;throw new t("parameter not set properly")},this.oid="2.5.29.15",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.KeyUsage,ne.asn1.x509.Extension),ne.asn1.x509.BasicConstraints=function(e){ne.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERBoolean,r=t.DERInteger,s=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new s({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},Qe(ne.asn1.x509.BasicConstraints,ne.asn1.x509.Extension),ne.asn1.x509.CRLDistributionPoints=function(e){ne.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=ne.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(e){for(var r=[],s=0;s<e.length;s++)if(e[s]instanceof ne.asn1.ASN1Object)r.push(e[s]);else{var n=new i.DistributionPoint(e[s]);r.push(n)}this.asn1ExtnValue=new t.DERSequence({array:r})},this.setByOneURI=function(e){var t=new i.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},Qe(ne.asn1.x509.CRLDistributionPoints,ne.asn1.x509.Extension),ne.asn1.x509.DistributionPoint=function(e){ne.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=ne.asn1,i=t.x509.DistributionPointName;this.tohex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var i=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(i)}return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new i(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))},Qe(ne.asn1.x509.DistributionPoint,ne.asn1.ASN1Object),ne.asn1.x509.DistributionPointName=function(e){ne.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=ne.asn1,i=t.DERTaggedObject;if(this.tohex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new i({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},Qe(ne.asn1.x509.DistributionPointName,ne.asn1.ASN1Object),ne.asn1.x509.CertificatePolicies=function(e){ne.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=ne.asn1,i=t.x509,r=t.DERSequence,s=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new s(this.params.array[t]));var i=new r({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.CertificatePolicies,ne.asn1.x509.Extension),ne.asn1.x509.PolicyInformation=function(e){ne.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,s=t.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],n=0;n<this.params.array.length;n++)t.push(new s(this.params.array[n]));t.length>0&&e.push(new i({array:t}))}return new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyInformation,ne.asn1.ASN1Object),ne.asn1.x509.PolicyQualifierInfo=function(e){ne.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERSequence,r=t.DERIA5String,s=t.DERObjectIdentifier,n=t.x509.UserNotice;this.params=null,this.tohex=function(){return void 0!==this.params.cps?new i({array:[new s({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).tohex():null!=this.params.unotice?new i({array:[new s({oid:"1.3.6.1.5.5.7.2.2"}),new n(this.params.unotice)]}).tohex():void 0},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyQualifierInfo,ne.asn1.ASN1Object),ne.asn1.x509.UserNotice=function(e){ne.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=ne.asn1.DERSequence,i=(ne.asn1.DERInteger,ne.asn1.x509.DisplayText),r=ne.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new i(this.params.exptext)),new t({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.UserNotice,ne.asn1.ASN1Object),ne.asn1.x509.NoticeReference=function(e){ne.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=ne.asn1.DERSequence,i=ne.asn1.DERInteger,r=ne.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var s=[],n=this.params.noticenum,a=0;a<n.length;a++)s.push(new i(n[a]));e.push(new t({array:s}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.NoticeReference,ne.asn1.ASN1Object),ne.asn1.x509.DisplayText=function(e){ne.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},Qe(ne.asn1.x509.DisplayText,ne.asn1.DERAbstractString),ne.asn1.x509.PolicyMappings=function(e){ne.asn1.x509.PolicyMappings.superclass.constructor.call(this,e);var t=ne.asn1,i=(t.x509,t.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){for(var e=this.params,t=[],r=0;r<e.array.length;r++){var s=e.array[r];t.push({seq:[{oid:s[0]},{oid:s[1]}]})}return this.asn1ExtnValue=i({seq:t}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyMappings,ne.asn1.x509.Extension),ne.asn1.x509.PolicyConstraints=function(e){ne.asn1.x509.PolicyConstraints.superclass.constructor.call(this,e);var t=ne.asn1,i=(t.x509,t.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[];return null!=e.reqexp&&t.push({tag:{tagi:"80",obj:{int:e.reqexp}}}),null!=e.inhibit&&t.push({tag:{tagi:"81",obj:{int:e.inhibit}}}),this.asn1ExtnValue=i({seq:t}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyConstraints,ne.asn1.x509.Extension),ne.asn1.x509.InhibitAnyPolicy=function(e){ne.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,e);var t=ne.asn1,i=(t.x509,t.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=i({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.InhibitAnyPolicy,ne.asn1.x509.Extension),ne.asn1.x509.NameConstraints=function(e){ne.asn1.x509.NameConstraints.superclass.constructor.call(this,e);var t=ne.asn1,i=t.x509,r=t.ASN1Util.newObject,s=i.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[];if(null!=e.permit&&null!=e.permit.length){for(var i=[],n=0;n<e.permit.length;n++)i.push(new s(e.permit[n]));t.push({tag:{tagi:"a0",obj:{seq:i}}})}if(null!=e.exclude&&null!=e.exclude.length){var a=[];for(n=0;n<e.exclude.length;n++)a.push(new s(e.exclude[n]));t.push({tag:{tagi:"a1",obj:{seq:a}}})}return this.asn1ExtnValue=r({seq:t}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.NameConstraints,ne.asn1.x509.Extension),ne.asn1.x509.GeneralSubtree=function(e){ne.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var t=ne.asn1,i=t.x509.GeneralName,r=t.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params,t=[new i(e)];return null!=e.min&&t.push({tag:{tagi:"80",obj:{int:e.min}}}),null!=e.max&&t.push({tag:{tagi:"81",obj:{int:e.max}}}),r({seq:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.GeneralSubtree,ne.asn1.ASN1Object),ne.asn1.x509.ExtKeyUsage=function(e){ne.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=ne.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var r=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},Qe(ne.asn1.x509.ExtKeyUsage,ne.asn1.x509.Extension),ne.asn1.x509.AuthorityKeyIdentifier=function(e){ne.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=ne,i=t.asn1,r=i.DERTaggedObject,s=i.x509.GeneralNames;t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new s([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new i.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new ne.asn1.DEROctetString(e);else if("object"==typeof e&&ne.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=et.getKey(e));var i=et.getKeyID(t);this.asn1KID=new ne.asn1.DEROctetString({hex:i})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new ne.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new ne.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new ne.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new st;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new ne.asn1.DERInteger({hex:i})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},Qe(ne.asn1.x509.AuthorityKeyIdentifier,ne.asn1.x509.Extension),ne.asn1.x509.SubjectKeyIdentifier=function(e){ne.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=ne.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&ne.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=et.getKey(e));var r=et.getKeyID(i);this.asn1KID=new ne.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},Qe(ne.asn1.x509.SubjectKeyIdentifier,ne.asn1.x509.Extension),ne.asn1.x509.AuthorityInfoAccess=function(e){ne.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=ne.asn1,r=i.DERSequence,s=i.DERObjectIdentifier,n=i.x509.GeneralName,a=0;a<e.length;a++){var o,c=e[a];if(void 0!==c.ocsp)o=new r({array:[new s({oid:"1.3.6.1.5.5.7.48.1"}),new n({uri:c.ocsp})]});else{if(void 0===c.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(c));o=new r({array:[new s({oid:"1.3.6.1.5.5.7.48.2"}),new n({uri:c.caissuer})]})}t.push(o)}this.asn1ExtnValue=new r({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},Qe(ne.asn1.x509.AuthorityInfoAccess,ne.asn1.x509.Extension),ne.asn1.x509.SubjectAltName=function(e){ne.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new ne.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},Qe(ne.asn1.x509.SubjectAltName,ne.asn1.x509.Extension),ne.asn1.x509.IssuerAltName=function(e){ne.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new ne.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},Qe(ne.asn1.x509.IssuerAltName,ne.asn1.x509.Extension),ne.asn1.x509.SubjectDirectoryAttributes=function(e){ne.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERSequence,r=t.ASN1Util.newObject,s=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var n=this.params.array[t];if(null==n.attr||null==n.array){var a={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={gentime:n.str};else if("placeOfBirth"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={utf8str:n.str};else if("gender"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={prnstr:n.str};else if("countryOfCitizenship"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={prnstr:n.str};else{if("countryOfResidence"!=n.attr)throw new Error("unsupported attribute: "+n.attr);a.seq[0].oid=s(n.attr),a.seq[1].set[0]={prnstr:n.str}}e.push(new r(a))}else{var o={seq:[{oid:n.attr},{set:n.array}]};e.push(r(o))}}var c=new i({array:e});return this.asn1ExtnValue=c,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.SubjectDirectoryAttributes,ne.asn1.x509.Extension),ne.asn1.x509.PrivateExtension=function(e){ne.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=ne,i=t.lang.String.isHex,r=t.asn1,s=r.x509.OID.name2oid,n=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=s(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&i(e))return e;if("object"==typeof e)try{return n(e).tohex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},Qe(ne.asn1.x509.PrivateExtension,ne.asn1.x509.Extension),ne.asn1.x509.CRL=function(e){ne.asn1.x509.CRL.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.DERBitString,s=t.x509,n=s.AlgorithmIdentifier,a=s.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).tohex(),t=new ne.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return Ce(this.tohex(),"X509 CRL")},this.tohex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new n({name:e.sigalg})),t.push(new r({hex:"00"+e.sighex})),new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&(this.params=e)},Qe(ne.asn1.x509.CRL,ne.asn1.ASN1Object),ne.asn1.x509.TBSCertList=function(e){ne.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=ne.asn1,i=t.DERInteger,r=t.DERSequence,s=t.DERTaggedObject,n=(t.DERObjectIdentifier,t.x509),a=n.AlgorithmIdentifier,o=n.Time,c=n.Extensions,l=n.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,s=0;s<t.length;s++){var n=[new i(t[s].sn),new o(t[s].date)];null!=t[s].ext&&n.push(new c(t[s].ext)),e.push(new r({array:n}))}return new r({array:e})},this.tohex=function(){var e=[],t=this.params;if(null!=t.version){var n=t.version-1,u=new i({int:n});e.push(u)}if(e.push(new a({name:t.sigalg})),e.push(new l(t.issuer)),e.push(new o(t.thisupdate)),null!=t.nextupdate&&e.push(new o(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var d=new c(t.ext);e.push(new s({tag:"a0",explicit:!0,obj:d}))}return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.TBSCertList,ne.asn1.ASN1Object),ne.asn1.x509.CRLEntry=function(e){ne.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=ne.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.tohex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},Qe(ne.asn1.x509.CRLEntry,ne.asn1.ASN1Object),ne.asn1.x509.CRLNumber=function(e){ne.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},Qe(ne.asn1.x509.CRLNumber,ne.asn1.x509.Extension),ne.asn1.x509.CRLReason=function(e){ne.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},Qe(ne.asn1.x509.CRLReason,ne.asn1.x509.Extension),ne.asn1.x509.OCSPNonce=function(e){ne.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},Qe(ne.asn1.x509.OCSPNonce,ne.asn1.x509.Extension),ne.asn1.x509.OCSPNoCheck=function(e){ne.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},Qe(ne.asn1.x509.OCSPNoCheck,ne.asn1.x509.Extension),ne.asn1.x509.AdobeTimeStamp=function(e){ne.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERInteger,r=t.DERBoolean,s=t.DERSequence,n=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new i(1)];return t.push(new n({uri:e.uri})),null!=e.reqauth&&t.push(new r(e.reqauth)),this.asn1ExtnValue=new s({array:t}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.AdobeTimeStamp,ne.asn1.x509.Extension),ne.asn1.x509.X500Name=function(e){ne.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=ne.asn1,i=t.x509,r=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var s=[],n=0;n<i.length;n++)if(i[n].match(/^[^=]+=.+$/))s.push(i[n]);else{var a=s.length-1;s[a]=s[a]+"/"+i[n]}for(n=0;n<s.length;n++)this.asn1Array.push(new r({str:s[n],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=i.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var s=new r({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(s):this.asn1Array=[s]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new st).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new st).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.tohex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i={array:this.paramArray[e]};"utf8"!=this.sRule&&(i.rule=this.sRule);var s=new r(i);this.asn1Array.push(s)}var n=new t.DERSequence({array:this.asn1Array});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.X500Name,ne.asn1.ASN1Object),ne.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),t=t.map((function(e){return e.replace(/,/,"\\,")})),t.join(",")},ne.asn1.x509.X500Name.onelineToLDAP=function(e){return ne.asn1.x509.X500Name.compatToLDAP(e)},ne.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,r=[],s=0;t.length>0;s++){var n=t.shift();if(!0===i){var a=(r.pop()+","+n).replace(/\\,/g,",");r.push(a),i=!1}else r.push(n);"\\"===n.substr(-1,1)&&(i=!0)}return r=r.map((function(e){return e.replace("/","\\/")})),r.reverse(),"/"+r.join("/")},ne.asn1.x509.X500Name.ldapToOneline=function(e){return ne.asn1.x509.X500Name.ldapToCompat(e)},ne.asn1.x509.RDN=function(e){ne.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=ne.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new ne.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=ne.asn1.x509.RDN.parseString(e),i=0;i<t.length;i++)this.addByString(t[i])},this.tohex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i=this.paramArray[e];void 0!==i.rule&&"utf8"!=this.sRule&&(i.rule=this.sRule);var r=new t(i);this.asn1Array.push(r)}var s=new ne.asn1.DERSet({array:this.asn1Array});return this.TLV=s.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.RDN,ne.asn1.ASN1Object),ne.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,r=[],s=0;t.length>0;s++){var n=t.shift();if(!0===i){var a=(r.pop()+"+"+n).replace(/\\\+/g,"+");r.push(a),i=!1}else r.push(n);"\\"===n.substr(-1,1)&&(i=!0)}var o=!1,c=[];for(s=0;r.length>0;s++){n=r.shift();if(!0===o){var l=c.pop();if(n.match(/"$/)){a=(l+"+"+n).replace(/^([^=]+)="(.*)"$/,"$1=$2");c.push(a),o=!1}else c.push(l+"+"+n)}else c.push(n);n.match(/^[^=]+="/)&&(o=!0)}return c},ne.asn1.x509.AttributeTypeAndValue=function(e){ne.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=ne,i=t.asn1,r=i.DERSequence,s=i.DERUTF8String,n=i.DERPrintableString,a=i.DERTeletexString,o=i.DERIA5String,c=i.DERVisibleString,l=i.DERBMPString,u=t.lang.String.isMail,d=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.match(/^([^=]+)=(.+)$/);if(!i)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(i[1],i[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,i=this.sRule;return"prn"===i?"CN"==e&&u(t)?"ia5":d(t)?"prn":"utf8":"utf8"===i?"CN"==e&&u(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,i){void 0!==i&&(this.sRule=i),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new s({str:t});if("prn"==e)return new n({str:t});if("tel"==e)return new a({str:t});if("ia5"==e)return new o({str:t});if("vis"==e)return new c({str:t});if("bmp"==e)return new l({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.tohex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=ne.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new r({array:[e,t]});return this.TLV=i.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.AttributeTypeAndValue,ne.asn1.ASN1Object),ne.asn1.x509.SubjectPublicKeyInfo=function(e){ne.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=ne,i=t.asn1,r=i.DERInteger,s=i.DERBitString,n=i.DERObjectIdentifier,a=i.DERSequence,o=i.ASN1Util.newObject,c=i.x509.AlgorithmIdentifier,l=t.crypto;l.ECDSA,l.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new a({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.tohex=function(){var e=this.getASN1Object();return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(e){try{if(e instanceof ee){var t=o({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).tohex();this.asn1AlgId=new c({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+t})}}catch(e){}try{if(e instanceof ne.crypto.ECDSA){var i=new n({name:e.curveName});this.asn1AlgId=new c({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new s({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof ne.crypto.DSA){i=new o({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new c({name:"dsa",asn1params:i});var a=new r({bigint:e.y});this.asn1SubjPKey=new s({hex:"00"+a.tohex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},Qe(ne.asn1.x509.SubjectPublicKeyInfo,ne.asn1.ASN1Object),ne.asn1.x509.Time=function(e){ne.asn1.x509.Time.superclass.constructor.call(this);var t=ne.asn1,i=t.DERUTCTime,r=t.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(e){this.timeParams=e},this.setByParam=function(e){this.params=e},this.getType=function(e){return e.match(/^[0-9]{12}Z$/)?"utc":e.match(/^[0-9]{14}Z$/)?"gen":e.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":e.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var e=this.params,t=null;if("string"==typeof e&&(e={str:e}),null==e||!e.str||null!=e.type&&null!=e.type||(e.type=this.getType(e.str)),null!=e&&e.str?("utc"==e.type&&(t=new i(e.str)),"gen"==e.type&&(t=new r(e.str))):t="gen"==this.type?new r:new i,null==t)throw new Error("wrong setting for Time");return this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},ne.asn1.x509.Time_bak=function(e){ne.asn1.x509.Time_bak.superclass.constructor.call(this);var t=ne.asn1,i=t.DERUTCTime,r=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.tohex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new i(this.timeParams):new r(this.timeParams):"utc"==this.type?new i:new r,this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},Qe(ne.asn1.x509.Time,ne.asn1.ASN1Object),ne.asn1.x509.AlgorithmIdentifier=function(e){ne.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=ne.asn1,i=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var r in i)r===this.nameAlg&&(e=i[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var s=[this.asn1Alg];null!==this.asn1Params&&s.push(this.asn1Params);var n=new t.DERSequence({array:s});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},Qe(ne.asn1.x509.AlgorithmIdentifier,ne.asn1.ASN1Object),ne.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},ne.asn1.x509.GeneralName=function(e){ne.asn1.x509.GeneralName.superclass.constructor.call(this);var t=ne.asn1,i=t.x509,r=i.X500Name,s=i.OtherName,n=t.DERIA5String,a=(t.DERPrintableString,t.DEROctetString),o=t.DERTaggedObject,c=t.ASN1Object,l=Error;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e,t,i=this.params,u=!1;if(void 0!==i.other)e="a0",t=new s(i.other);else if(void 0!==i.rfc822)e="81",t=new n({str:i.rfc822});else if(void 0!==i.dns)e="82",t=new n({str:i.dns});else if(void 0!==i.dn)e="a4",u=!0,t="string"==typeof i.dn?new r({str:i.dn}):i.dn instanceof ne.asn1.x509.X500Name?i.dn:new r(i.dn);else if(void 0!==i.ldapdn)e="a4",u=!0,t=new r({ldapstr:i.ldapdn});else if(void 0!==i.certissuer||void 0!==i.certsubj){var d,p;e="a4",u=!0;var h=null;if(void 0!==i.certsubj?(d=!1,p=i.certsubj):(d=!0,p=i.certissuer),p.match(/^[0-9A-Fa-f]+$/),-1!=p.indexOf("-----BEGIN ")&&(h=Ae(p)),null==h)throw new Error("certsubj/certissuer not cert");var m,f=new st;f.hex=h,m=d?f.getIssuerHex():f.getSubjectHex(),(t=new c).hTLV=m}else if(void 0!==i.uri)e="86",t=new n({str:i.uri});else{if(void 0===i.ip)throw new l("improper params");var g;e="87";var _=i.ip;try{if(_.match(/^[0-9a-f]+$/)){var y=_.length;if(8!=y&&16!=y&&32!=y&&64!=y)throw"err";g=_}else g=De(_)}catch(e){throw new l("malformed IP address: "+i.ip+":"+e.message)}t=new a({hex:g})}return new o({tag:e,explicit:u,obj:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.GeneralName,ne.asn1.ASN1Object),ne.asn1.x509.GeneralNames=function(e){ne.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=ne.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var r=new t.x509.GeneralName(e[i]);this.asn1Array.push(r)}},this.tohex=function(){return new t.DERSequence({array:this.asn1Array}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},Qe(ne.asn1.x509.GeneralNames,ne.asn1.ASN1Object),ne.asn1.x509.OtherName=function(e){ne.asn1.x509.OtherName.superclass.constructor.call(this);var t=ne.asn1,i=t.DERObjectIdentifier,r=t.DERSequence,s=t.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params;if(null==e.oid||null==e.value)throw new Error("oid or value not specified");var t=new i({oid:e.oid}),n=s({tag:{tag:"a0",explicit:!0,obj:e.value}});return new r({array:[t,n]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.OtherName,ne.asn1.ASN1Object),ne.asn1.x509.OID=new function(){var e=ne.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.name2oidList[t])throw"Name of ObjectIdentifier not defined: "+t;var i=this.name2oidList[t],r=new e({oid:i});return this.objCache[t]=r,r},this.atype2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];var i;if(t.match(/^\d+\.\d+\.[0-9.]+$/))i=t;else if(void 0!==this.atype2oidList[t])i=this.atype2oidList[t];else{if(void 0===this.name2oidList[t])throw new Error("AttributeType name undefined: "+t);i=this.name2oidList[t]}var r=new e({oid:i});return this.objCache[t]=r,r},this.registerOIDs=function(e){if(this.checkOIDs(e))for(var t in e)this.name2oidList[t]=e[t]},this.checkOIDs=function(e){try{var t=Object.keys(e);return 0!=t.length&&(t.map((function(e,t,i){if(!this[e].match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")}),e),!0)}catch(e){return!1}}},ne.asn1.x509.OID.oid2name=function(e){var t=ne.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},ne.asn1.x509.OID.oid2atype=function(e){var t=ne.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},ne.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=ne.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},ne.asn1.x509.X509Util={},ne.asn1.x509.X509Util.newCertPEM=function(e){var t=ne.asn1.x509;t.TBSCertificate;return new(0,t.Certificate)(e).getPEM()},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.cms&&ne.asn1.cms||(ne.asn1.cms={}),ne.asn1.cms.Attribute=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERSet,n=i.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(e){this.params=e},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var e=new n({oid:this.typeOid}),t=new s({array:this.getValueArray()});return new r({array:[e,t]}).tohex()},this.getEncodedHex=function(){return this.tohex()}},Qe(ne.asn1.cms.Attribute,ne.asn1.ASN1Object),ne.asn1.cms.ContentType=function(e){var t=ne.asn1;t.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new t.DERObjectIdentifier(this.params.type)]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ContentType,ne.asn1.cms.Attribute),ne.asn1.cms.MessageDigest=function(e){var t=ne.asn1,i=t.DEROctetString;t.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new i(this.params)]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.MessageDigest,ne.asn1.cms.Attribute),ne.asn1.cms.SigningTime=function(e){var t=ne.asn1;t.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new t.x509.Time(this.params)]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SigningTime,ne.asn1.cms.Attribute),ne.asn1.cms.SigningCertificate=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERSequence,n=r.cms,a=n.ESSCertID;i.crypto;n.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var i=this.params.array,r=[],n=0;n<i.length;n++){var o=i[n];0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!ce.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new a(o))}var c=new s({array:r});return[new s({array:[c]})]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SigningCertificate,ne.asn1.cms.Attribute),ne.asn1.cms.ESSCertID=function(e){ne.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,i=ne,r=i.asn1,s=r.DEROctetString,n=r.DERSequence,a=r.cms.IssuerSerial;this.params=null,this.getCertHash=function(e,r){if(null!=e.hash)return e.hash;if("string"==typeof e&&-1==e.indexOf("-----BEGIN")&&!ce.isASN1HEX(e))return e;var s,n,a;if("string"==typeof e)s=e;else{if(null==e.cert)throw new t("hash nor cert unspecified");s=e.cert}if(n=-1!=s.indexOf("-----BEGIN")?Ae(s):s,"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?n=Ae(e):ce.isASN1HEX(e)&&(n=e)),null!=e.alg)a=e.alg;else{if(null==r)throw new t("hash alg unspecified");a=r}return i.crypto.Util.hashHex(n,a)},this.tohex=function(){var e=this.params,t=this.getCertHash(e,"sha1"),i=[];return i.push(new s({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&i.push(new a(e)),new n({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ESSCertID,ne.asn1.ASN1Object),ne.asn1.cms.SigningCertificateV2=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERSequence,n=(r.x509,r.cms),a=n.ESSCertIDv2;i.crypto;n.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var i=this.params.array,r=[],n=0;n<i.length;n++){var o=i[n];null==e.alg&&0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!ce.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=e.alg&&(o.alg=e.alg),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new a(o))}var c=new s({array:r});return[new s({array:[c]})]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SigningCertificateV2,ne.asn1.cms.Attribute),ne.asn1.cms.ESSCertIDv2=function(e){ne.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);Error;var t=ne.asn1,i=t.DEROctetString,r=t.DERSequence,s=t.cms.IssuerSerial,n=t.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var e=this.params,t=this.getCertHash(e,"sha256"),a=[];return null!=e.alg&&"sha256"!=e.alg&&a.push(new n({name:e.alg})),a.push(new i({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&a.push(new s(e)),new r({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ESSCertIDv2,ne.asn1.cms.ESSCertID),ne.asn1.cms.IssuerSerial=function(e){var t=Error,i=ne.asn1,r=i.DERInteger,s=i.DERSequence,n=i.cms,a=i.x509.GeneralNames,o=st;n.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.tohex=function(){var e,i,n=this.params;if("string"==typeof n&&-1!=n.indexOf("-----BEGIN")||null!=n.cert){var c;c=null!=n.cert?n.cert:n;var l=new o;l.readCertPEM(c),e=l.getIssuer(),i={hex:l.getSerialNumberHex()}}else{if(null==n.issuer||!n.serial)throw new t("cert or issuer and serial parameter not specified");e=n.issuer,i=n.serial}var u=new a([{dn:e}]),d=new r(i);return new s({array:[u,d]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.IssuerSerial,ne.asn1.ASN1Object),ne.asn1.cms.SignerIdentifier=function(e){var t=ne.asn1,i=(t.DERInteger,t.DERSequence,t.cms),r=i.IssuerAndSerialNumber,s=i.SubjectKeyIdentifier;t.x509.X500Name,Error;i.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if("isssn"==e.type)return new r(e).tohex();if("skid"==e.type)return new s(e).tohex();throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SignerIdentifier,ne.asn1.ASN1Object),ne.asn1.cms.IssuerAndSerialNumber=function(e){var t=ne.asn1,i=t.DERInteger,r=t.DERSequence,s=t.cms,n=t.x509.X500Name,a=st,o=Error;s.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e,t,s=this.params;if("string"==typeof s&&-1!=s.indexOf("-----BEGIN")||null!=s.cert){var c;c=null!=s.cert?s.cert:s;var l=new a;l.readCertPEM(c),e=l.getIssuer(),t={hex:l.getSerialNumberHex()}}else{if(null==s.issuer||!s.serial)throw new o("cert or issuer and serial parameter not specified");e=s.issuer,t=s.serial}var u=new n(e),d=new i(t);return new r({array:[u,d]}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.IssuerAndSerialNumber,ne.asn1.ASN1Object),ne.asn1.cms.SubjectKeyIdentifier=function(e){var t=ne.asn1,i=(t.DERInteger,t.DERSequence,t.ASN1Util.newObject),r=t.cms,s=(r.IssuerAndSerialName,r.SubjectKeyIdentifier,t.x509.X500Name,st),n=Error;r.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var e,t=this.params;if(null==t.cert&&null==t.skid)throw new n("property cert nor skid undefined");null!=t.cert?e=new s(t.cert).getExtSubjectKeyIdentifier().kid.hex:null!=t.skid&&(e=t.skid);return i({tag:{tage:"a0",obj:{octstr:{hex:e}}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SubjectKeyIdentifier,ne.asn1.ASN1Object),ne.asn1.cms.AttributeList=function(e){var t=Error,i=ne.asn1,r=i.DERSet,s=i.cms;s.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params;if(null!=this.hTLV)return this.hTLV;var i=!0;null!=e.sortflag&&(i=e.sortflag);for(var n=e.array,a=[],o=0;o<n.length;o++){var c=n[o],l=c.attr;if("contentType"==l)a.push(new s.ContentType(c));else if("messageDigest"==l)a.push(new s.MessageDigest(c));else if("signingTime"==l)a.push(new s.SigningTime(c));else if("signingCertificate"==l)a.push(new s.SigningCertificate(c));else if("signingCertificateV2"==l)a.push(new s.SigningCertificateV2(c));else if("signaturePolicyIdentifier"==l)a.push(new ne.asn1.cades.SignaturePolicyIdentifier(c));else{if("signatureTimeStamp"!=l&&"timeStampToken"!=l)throw new t("unknown attr: "+l);a.push(new ne.asn1.cades.SignatureTimeStamp(c))}}var u=new r({array:a,sortflag:i});return this.hTLV=u.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.AttributeList,ne.asn1.ASN1Object),ne.asn1.cms.SignerInfo=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERInteger,n=r.DEROctetString,a=r.DERSequence,o=r.DERTaggedObject,c=r.cms,l=c.SignerIdentifier,u=c.AttributeList,d=(c.ContentType,c.EncapsulatedContentInfo,c.MessageDigest,c.SignedData,r.x509.AlgorithmIdentifier),p=i.crypto,h=et;c.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var e=this.params,t=e.sigalg,i=new u(e.sattrs).tohex(),r=h.getKey(e.signkey),s=new p.Signature({alg:t});s.init(r),s.updateHex(i);var n=s.sign();e.sighex=n},this.tohex=function(){var e=this.params,i=[];if(i.push(new s({int:e.version})),i.push(new l(e.id)),i.push(new d({name:e.hashalg})),null!=e.sattrs){var r=new u(e.sattrs);try{i.push(new o({tag:"a0",explicit:!1,obj:r}))}catch(e){throw new t("si sattr error: "+e)}}if(null!=e.sigalgfield?i.push(new d({name:e.sigalgfield})):i.push(new d({name:e.sigalg})),null==e.sighex&&null!=e.signkey&&this.sign(),i.push(new n({hex:e.sighex})),null!=e.uattrs){r=new u(e.uattrs);try{i.push(new o({tag:"a1",explicit:!1,obj:r}))}catch(e){throw new t("si uattr error: "+e)}}return new a({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SignerInfo,ne.asn1.ASN1Object),ne.asn1.cms.EncapsulatedContentInfo=function(e){var t=ne.asn1,i=t.DERTaggedObject,r=t.DERSequence,s=t.DERObjectIdentifier,n=t.DEROctetString;t.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];if(t.push(new s(e.type)),null!=e.content&&(null!=e.content.hex||null!=e.content.str)&&1!=e.isDetached){var a=new n(e.content),o=new i({tag:"a0",explicit:!0,obj:a});t.push(o)}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.EncapsulatedContentInfo,ne.asn1.ASN1Object),ne.asn1.cms.ContentInfo=function(e){var t=ne.asn1,i=t.DERTaggedObject,r=t.DERSequence,s=t.DERObjectIdentifier;t.x509.OID.name2obj;ne.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];t.push(new s(e.type));var n=new i({tag:"a0",explicit:!0,obj:e.obj});return t.push(n),new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ContentInfo,ne.asn1.ASN1Object),ne.asn1.cms.SignedData=function(e){Error;var t=ne.asn1,i=(t.ASN1Object,t.DERInteger),r=t.DERSet,s=t.DERSequence,n=(t.DERTaggedObject,t.cms),a=n.EncapsulatedContentInfo,o=n.SignerInfo,c=n.ContentInfo,l=n.CertificateSet,u=n.RevocationInfoChoices,d=t.x509.AlgorithmIdentifier;ne.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var e=this.params;this._setDigestAlgs(e),this._setContentTypeByEContent(e),this._setMessageDigestByEContent(e),this._setSignerInfoVersion(e),this._setSignedDataVersion(e)},this._setDigestAlgs=function(e){for(var t={},i=e.sinfos,r=0;r<i.length;r++){t[i[r].hashalg]=1}e.hashalgs=Object.keys(t).sort()},this._setContentTypeByEContent=function(e){for(var t=e.econtent.type,i=e.sinfos,r=0;r<i.length;r++){var s=i[r];this._getAttrParamByName(s,"contentType").type=t}},this._setMessageDigestByEContent=function(e){var t=e.econtent,i=(e.econtent.type,t.content.hex);null==i&&"data"==t.type&&null!=t.content.str&&(i=xe(t.content.str));for(var r=e.sinfos,s=0;s<r.length;s++){var n=r[s],a=n.hashalg,o=this._getAttrParamByName(n,"messageDigest"),c=ne.crypto.Util.hashHex(i,a);o.hex=c}},this._getAttrParamByName=function(e,t){for(var i=e.sattrs.array,r=0;r<i.length;r++)if(i[r].attr==t)return i[r]},this._setSignerInfoVersion=function(e){for(var t=e.sinfos,i=0;i<t.length;i++){var r=t[i],s=1;"skid"==r.id.type&&(s=3),r.version=s}},this._setSignedDataVersion=function(e){var t=this._getSignedDataVersion(e);e.version=t},this._getSignedDataVersion=function(e){if(null!=e.revinfos)for(var t=e.revinfos,i=0;i<t.length;i++){if(null!=t[i].ocsp)return 5}var r=e.sinfos;for(i=0;i<r.length;i++){if(3==e.sinfos[i].version)return 3}return"data"!=e.econtent.type?3:1},this.tohex=function(){var e=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=e.fixed&&this.checkAndFixParam();var t=[];t.push(new i({int:e.version}));for(var n=[],c=0;c<e.hashalgs.length;c++){var p=e.hashalgs[c];n.push(new d({name:p}))}t.push(new r({array:n})),t.push(new a(e.econtent)),null!=e.certs&&t.push(new l(e.certs)),null!=e.revinfos&&t.push(new u(e.revinfos));var h=[];for(c=0;c<e.sinfos.length;c++){var m=e.sinfos[c];h.push(new o(m))}return t.push(new r({array:h})),new s({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){return new c({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SignedData,ne.asn1.ASN1Object),ne.asn1.cms.CertificateSet=function(e){ne.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,i=ne.asn1,r=i.DERTaggedObject,s=i.DERSet,n=i.ASN1Object;this.params=null,this.tohex=function(){var e,i=this.params,a=[];if(i instanceof Array)e=i;else{if(null==i.array)throw new t("cert array not specified");e=i.array}for(var o=0;o<e.length;o++){var c=Ae(e[o]),l=new n;l.hTLV=c,a.push(l)}var u={array:a};0==i.sortflag&&(u.sortflag=!1);var d=new s(u);return new r({tag:"a0",explicit:!1,obj:d}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.CertificateSet,ne.asn1.ASN1Object),ne.asn1.cms.RevocationInfoChoices=function(e){ne.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(!e instanceof Array)throw new Error("params is not array");for(var t=[],i=0;i<e.length;i++)t.push(new ne.asn1.cms.RevocationInfoChoice(e[i]));return ne.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:t}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.RevocationInfoChoices,ne.asn1.ASN1Object),ne.asn1.cms.RevocationInfoChoice=function(e){ne.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(null!=e.crl&&"string"==typeof e.crl){var t=e.crl;return-1!=e.crl.indexOf("-----BEGIN")&&(t=Ae(e.crl)),t}if(null!=e.ocsp)return ne.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new ne.asn1.cms.OtherRevocationFormat(e)}}).tohex();throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.RevocationInfoChoice,ne.asn1.ASN1Object),ne.asn1.cms.OtherRevocationFormat=function(e){ne.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,i=ne,r=i.asn1.ASN1Util.newObject,s=i.lang.String.isHex;this.params=null,this.tohex=function(){var e=this.params;if(null==e.ocsp)throw new t("property ocsp not specified");if(!s(e.ocsp)||!ce.isASN1HEX(e.ocsp))throw new t("ocsp value not ASN.1 hex string");return r({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:e.ocsp}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.OtherRevocationFormat,ne.asn1.ASN1Object),ne.asn1.cms.CMSUtil=new function(){},ne.asn1.cms.CMSUtil.newSignedData=function(e){return new ne.asn1.cms.SignedData(e)},ne.asn1.cms.CMSUtil.verifySignedData=function(e){var t=ne,i=t.asn1,r=i.cms,s=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,i.cades.SignaturePolicyIdentifier,t.lang.String.isHex),n=ce,a=n.getVbyList,o=n.getTLVbyList,c=n.getIdxbyList,l=n.getChildIdx,u=n.getTLV,d=n.oidname,p=t.crypto.Util.hashHex;void 0===e.cms&&s(e.cms);var h=e.cms,m=function(e,t){var i=t.idx;t.signerid_issuer1=o(e,i,[1,0],"30"),t.signerid_serial1=a(e,i,[1,1],"02"),t.hashalg=d(a(e,i,[2,0],"06"));var r=c(e,i,[3],"a0");t.idxSignedAttrs=r,f(e,t,r);var s=l(e,i).length;if(s<6)throw"malformed SignerInfo";t.sigalg=d(a(e,i,[s-2,0],"06")),t.sigval=a(e,i,[s-1],"04")},f=function(e,t,i){var r=l(e,i);t.signedAttrIdxList=r;for(var s=0;s<r.length;s++){var n,o=r[s],c=a(e,o,[0],"06");"2a864886f70d010905"===c?(n=ye(a(e,o,[1,0])),t.saSigningTime=n):"2a864886f70d010904"===c&&(n=a(e,o,[1,0],"04"),t.saMessageDigest=n)}},g=function(e,t,i,r){i.verifyDetail={};var s=i.verifyDetail,n=t.parse.econtent,a=i.hashalg,o=i.saMessageDigest;s.validMessageDigest=!1,p(n,a)===o&&(s.validMessageDigest=!0),function(e,t,i){var r,s=t.parse.certsIdx;if(void 0===t.certs){r=[],t.certkeys=[];for(var n=l(e,s),a=0;a<n.length;a++){var o=u(e,n[a]),c=new st;c.readCertHex(o),r[a]=c,t.certkeys[a]=c.getPublicKey()}t.certs=r}else r=t.certs;for(t.cccc=r.length,t.cccci=n.length,a=0;a<r.length;a++){var d=c.getIssuerHex(),p=c.getSerialNumberHex();i.signerid_issuer1===d&&i.signerid_serial1===p&&(i.certkey_idx=a)}}(e,t,i),s.validSignatureValue=!1;var c=i.sigalg,d="31"+u(e,i.idxSignedAttrs).substr(2);i.signedattrshex=d;var h=t.certs[i.certkey_idx].getPublicKey(),m=new ne.crypto.Signature({alg:c});m.init(h),m.updateHex(d);var f=m.verify(i.sigval);s.validSignatureValue_isValid=f,!0===f&&(s.validSignatureValue=!0),i.isValid=!1,s.validMessageDigest&&s.validSignatureValue&&(i.isValid=!0)},_={isValid:!1,parse:{}};return function(e,t){if("2a864886f70d010702"!==a(e,0,[0],"06"))return t;t.cmsType="signedData",t.econtent=a(e,0,[1,0,2,1,0]),function(e,t){for(var i,r=3;r<6;r++)if(void 0!==(i=c(e,0,[1,0,r]))){var s=e.substr(i,2);"a0"===s&&(t.certsIdx=i),"a1"===s&&(t.revinfosIdx=i),"31"===s&&(t.signerinfosIdx=i)}}(e,t),t.signerInfos=[],function(e,t){var i=t.signerinfosIdx;if(void 0!==i){var r=l(e,i);t.signerInfoIdxList=r;for(var s=0;s<r.length;s++){var n={idx:r[s]};m(e,n),t.signerInfos.push(n)}}}(e,t)}(h,_.parse),function(e,t){for(var i=t.parse.signerInfos,r=i.length,s=!0,n=0;n<r;n++){var a=i[n];g(e,t,a,n),a.isValid||(s=!1)}t.isValid=s}(h,_),_},ne.asn1.cms.CMSParser=function(){var e=Error,t=st,i=new t,r=ce,s=r.getV,n=r.getTLV,a=(r.getIdxbyList,r.getTLVbyList),o=r.getTLVbyListEx,c=r.getVbyList,l=r.getVbyListEx,u=r.getChildIdx;this.getCMSSignedData=function(e){var t=a(e,0,[1,0]);return this.getSignedData(t)},this.getSignedData=function(e){var t=u(e,0),i={},r=s(e,t[0]),a=parseInt(r,16);i.version=a;var c=n(e,t[1]);i.hashalgs=this.getHashAlgArray(c);var l=n(e,t[2]);i.econtent=this.getEContent(l);var d=o(e,0,["[0]"]);null!=d&&(i.certs=this.getCertificateSet(d));o(e,0,["[1]"]);var p=o(e,0,[3]);return i.sinfos=this.getSignerInfos(p),i},this.getHashAlgArray=function(e){for(var i=u(e,0),r=new t,s=[],a=0;a<i.length;a++){var o=n(e,i[a]),c=r.getAlgorithmIdentifierName(o);s.push(c)}return s},this.getEContent=function(e){var t={},i=c(e,0,[0]),r=c(e,0,[1,0]);return t.type=ne.asn1.x509.OID.oid2name(ce.hextooidstr(i)),t.content={hex:r},t},this.getSignerInfos=function(e){for(var t=[],i=u(e,0),r=0;r<i.length;r++){var s=n(e,i[r]),a=this.getSignerInfo(s);t.push(a)}return t},this.getSignerInfo=function(e){var t={},s=u(e,0),a=r.getInt(e,s[0],-1);-1!=a&&(t.version=a);var c=n(e,s[1]),d=this.getIssuerAndSerialNumber(c);t.id=d;var p=n(e,s[2]),h=i.getAlgorithmIdentifierName(p);t.hashalg=h;var m=o(e,0,["[0]"]);if(null!=m){var f=this.getAttributeList(m);t.sattrs=f}var g=o(e,0,[3]),_=i.getAlgorithmIdentifierName(g);t.sigalg=_;var y=l(e,0,[4]);t.sighex=y;var b=o(e,0,["[1]"]);if(null!=b){var v=this.getAttributeList(b);t.uattrs=v}return t},this.getSignerIdentifier=function(e){if("30"==e.substr(0,2))return this.getIssuerAndSerialNumber(e);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(e){var t={type:"isssn"},r=u(e,0),a=n(e,r[0]);t.issuer=i.getX500Name(a);var o=s(e,r[1]);return t.serial={hex:o},t},this.getAttributeList=function(e){for(var t=[],i=u(e,0),r=0;r<i.length;r++){var s=n(e,i[r]),a=this.getAttribute(s);t.push(a)}return{array:t}},this.getAttribute=function(e){var t={},i=u(e,0),s=r.getOID(e,i[0]),a=ne.asn1.x509.OID.oid2name(s);t.attr=a;var o=n(e,i[1]),c=u(o,0);if(1==c.length)t.valhex=n(o,c[0]);else{for(var l=[],d=0;d<c.length;d++)l.push(n(o,c[d]));t.valhex=l}return"contentType"==a?this.setContentType(t):"messageDigest"==a?this.setMessageDigest(t):"signingTime"==a?this.setSigningTime(t):"signingCertificate"==a?this.setSigningCertificate(t):"signingCertificateV2"==a?this.setSigningCertificateV2(t):"signaturePolicyIdentifier"==a&&this.setSignaturePolicyIdentifier(t),t},this.setContentType=function(e){var t=r.getOIDName(e.valhex,0,null);null!=t&&(e.type=t,delete e.valhex)},this.setSigningTime=function(e){var t=ye(s(e.valhex,0));e.str=t,delete e.valhex},this.setMessageDigest=function(e){var t=s(e.valhex,0);e.hex=t,delete e.valhex},this.setSigningCertificate=function(e){var t=u(e.valhex,0);if(t.length>0){for(var i=n(e.valhex,t[0]),r=u(i,0),s=[],a=0;a<r.length;a++){var o=n(i,r[a]),c=this.getESSCertID(o);s.push(c)}e.array=s}if(t.length>1){var l=n(e.valhex,t[1]);e.polhex=l}delete e.valhex},this.setSignaturePolicyIdentifier=function(e){var i=u(e.valhex,0);if(i.length>0){var a=r.getOID(e.valhex,i[0]);e.oid=a}if(i.length>1){var o=new t,c=u(e.valhex,i[1]),l=n(e.valhex,c[0]),d=o.getAlgorithmIdentifierName(l);e.alg=d;var p=s(e.valhex,c[1]);e.hash=p}delete e.valhex},this.setSigningCertificateV2=function(e){var t=u(e.valhex,0);if(t.length>0){for(var i=n(e.valhex,t[0]),r=u(i,0),s=[],a=0;a<r.length;a++){var o=n(i,r[a]),c=this.getESSCertIDv2(o);s.push(c)}e.array=s}if(t.length>1){var l=n(e.valhex,t[1]);e.polhex=l}delete e.valhex},this.getESSCertID=function(e){var t={},i=u(e,0);if(i.length>0){var r=s(e,i[0]);t.hash=r}if(i.length>1){var a=n(e,i[1]),o=this.getIssuerSerial(a);null!=o.serial&&(t.serial=o.serial),null!=o.issuer&&(t.issuer=o.issuer)}return t},this.getESSCertIDv2=function(t){var r={},a=u(t,0);if(a.length<1||3<a.length)throw new e("wrong number of elements");var o=0;if("30"==t.substr(a[0],2)){var c=n(t,a[0]);r.alg=i.getAlgorithmIdentifierName(c),o++}else r.alg="sha256";var l=s(t,a[o]);if(r.hash=l,a.length>o+1){var d=n(t,a[o+1]),p=this.getIssuerSerial(d);r.issuer=p.issuer,r.serial=p.serial}return r},this.getIssuerSerial=function(e){var t={},r=u(e,0),a=n(e,r[0]),o=i.getGeneralNames(a)[0].dn;t.issuer=o;var c=s(e,r[1]);return t.serial={hex:c},t},this.getCertificateSet=function(e){for(var t=u(e,0),i=[],r=0;r<t.length;r++){var s=n(e,t[r]);if("30"==s.substr(0,2)){var a=Ce(s,"CERTIFICATE");i.push(a)}}return{array:i,sortflag:!1}}},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.tsp&&ne.asn1.tsp||(ne.asn1.tsp={}),ne.asn1.tsp.TimeStampToken=function(e){var t=ne.asn1.tsp;t.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var e=new t.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=e.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.TimeStampToken,ne.asn1.cms.SignedData),ne.asn1.tsp.TSTInfo=function(e){Error;var t=ne.asn1,i=t.DERSequence,r=t.DERInteger,s=t.DERBoolean,n=t.DERGeneralizedTime,a=t.DERObjectIdentifier,o=t.DERTaggedObject,c=t.tsp,l=c.MessageImprint,u=c.Accuracy,d=(t.x509.X500Name,t.x509.GeneralName);if(c.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var e=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(e.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(e.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(e.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");e.push(this.dGenTime),null!=this.dAccuracy&&e.push(this.dAccuracy),null!=this.dOrdering&&e.push(this.dOrdering),null!=this.dNonce&&e.push(this.dNonce),null!=this.dTsa&&e.push(this.dTsa);var t=new i({array:e});return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e){if("string"==typeof e.policy){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new a({oid:e.policy})}void 0!==e.messageImprint&&(this.dMessageImprint=new l(e.messageImprint)),void 0!==e.serial&&(this.dSerial=new r(e.serial)),void 0!==e.genTime&&(this.dGenTime=new n(e.genTime)),void 0!==e.accuracy&&(this.dAccuracy=new u(e.accuracy)),void 0!==e.ordering&&1==e.ordering&&(this.dOrdering=new s),void 0!==e.nonce&&(this.dNonce=new r(e.nonce)),void 0!==e.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new d({dn:e.tsa})}))}},Qe(ne.asn1.tsp.TSTInfo,ne.asn1.ASN1Object),ne.asn1.tsp.Accuracy=function(e){var t=ne.asn1,i=t.ASN1Util.newObject;t.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];return null!=e.seconds&&"number"==typeof e.seconds&&t.push({int:e.seconds}),null!=e.millis&&"number"==typeof e.millis&&t.push({tag:{tagi:"80",obj:{int:e.millis}}}),null!=e.micros&&"number"==typeof e.micros&&t.push({tag:{tagi:"81",obj:{int:e.micros}}}),i({seq:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.Accuracy,ne.asn1.ASN1Object),ne.asn1.tsp.MessageImprint=function(e){var t=ne.asn1,i=t.DERSequence,r=t.DEROctetString,s=t.x509.AlgorithmIdentifier;t.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=new s({name:e.alg}),n=new r({hex:e.hash});return new i({array:[t,n]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.tsp.MessageImprint,ne.asn1.ASN1Object),ne.asn1.tsp.TimeStampReq=function(e){var t=ne.asn1,i=t.DERSequence,r=t.DERInteger,s=t.DERBoolean,n=(t.ASN1Object,t.DERObjectIdentifier),a=t.tsp,o=a.MessageImprint;a.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];return t.push(new r({int:1})),e.messageImprint instanceof ne.asn1.ASN1Object?t.push(e.messageImprint):t.push(new o(e.messageImprint)),null!=e.policy&&t.push(new n(e.policy)),null!=e.nonce&&t.push(new r(e.nonce)),1==e.certreq&&t.push(new s),new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.TimeStampReq,ne.asn1.ASN1Object),ne.asn1.tsp.TimeStampResp=function(e){var t=ne.asn1,i=t.DERSequence,r=(t.ASN1Object,t.tsp),s=r.PKIStatusInfo;r.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,n=[];if(null!=e.econtent||null!=e.tst)if(null!=e.statusinfo?n.push(new s(e.statusinfo)):n.push(new s("granted")),null!=e.econtent)n.push(new r.TimeStampToken(e).getContentInfo());else{if(!(e.tst instanceof t.ASN1Object))throw new Error("improper member tst value");n.push(e.tst)}else{if(null==e.statusinfo)throw new Error("parameter for token nor statusinfo not specified");n.push(new s(e.statusinfo))}return new i({array:n}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.TimeStampResp,ne.asn1.ASN1Object),ne.asn1.tsp.PKIStatusInfo=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.tsp,n=s.PKIStatus,a=s.PKIFreeText,o=s.PKIFailureInfo;s.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,i=[];if("string"==typeof e)i.push(new n(e));else{if(null==e.status)throw new t("property 'status' unspecified");i.push(new n(e.status)),null!=e.statusstr&&i.push(new a(e.statusstr)),null!=e.failinfo&&i.push(new o(e.failinfo))}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIStatusInfo,ne.asn1.ASN1Object),ne.asn1.tsp.PKIStatus=function(e){var t=Error,i=ne.asn1,r=i.DERInteger;i.tsp.PKIStatus.superclass.constructor.call(this);var s={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var e,i=this.params;if("string"==typeof i)try{e=s[i]}catch(e){throw new t("undefined name: "+i)}else{if("number"!=typeof i)throw new t("unsupported params");e=i}return new r({int:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIStatus,ne.asn1.ASN1Object),ne.asn1.tsp.PKIFreeText=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERUTF8String;i.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(!e instanceof Array)throw new t("wrong params: not array");for(var i=[],n=0;n<e.length;n++)i.push(new s({str:e[n]}));return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIFreeText,ne.asn1.ASN1Object),ne.asn1.tsp.PKIFailureInfo=function(e){var t=Error,i=ne.asn1,r=i.DERBitString,s=i.tsp.PKIFailureInfo,n={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};s.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var e=this.params,i=0;if("number"==typeof e&&0<=e&&e<=25){for(var r=(i|=1<<e).toString(2),s="",a=r.length-1;a>=0;a--)s+=r[a];return s}if("string"==typeof e&&null!=n[e])return Ye([e],n);if("object"==typeof e&&null!=e.length)return Ye(e,n);throw new t("wrong params")},this.tohex=function(){this.params;var e=this.getBinValue();return new r({bin:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIFailureInfo,ne.asn1.ASN1Object),ne.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(e,t){throw"not implemented yet"}},ne.asn1.tsp.SimpleTSAAdapter=function(e){var t=ne,i=t.asn1.tsp,r=t.crypto.Util.hashHex;i.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(e,t){var s=r(e,t);this.params.econtent.content.messageImprint={alg:t,hash:s},this.params.econtent.content.serial={int:this.serial++};var n=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:n},new i.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.tsp.SimpleTSAAdapter,ne.asn1.tsp.AbstractTSAAdapter),ne.asn1.tsp.FixedTSAAdapter=function(e){var t=ne,i=t.asn1.tsp,r=t.crypto.Util.hashHex;i.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(e,t){var s=r(e,t);return this.params.econtent.content.messageImprint={alg:t,hash:s},new i.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.tsp.FixedTSAAdapter,ne.asn1.tsp.AbstractTSAAdapter),ne.asn1.tsp.TSPUtil=new function(){},ne.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new ne.asn1.tsp.TimeStampToken(e)},ne.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){return(new ne.asn1.tsp.TSPParser).getTimeStampReq(e)},ne.asn1.tsp.TSPUtil.parseMessageImprint=function(e){return(new ne.asn1.tsp.TSPParser).getMessageImprint(e)},ne.asn1.tsp.TSPParser=function(){Error;var e=new st,t=ce,i=t.getV,r=t.getTLV,s=t.getIdxbyList,n=(t.getTLVbyListEx,t.getChildIdx),a=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(e){var t=n(e,0);if(1==t.length)return this.getPKIStatusInfo(r(e,t[0]));if(t.length>1){var i=this.getPKIStatusInfo(r(e,t[0])),s=r(e,t[1]),a=this.getToken(s);return a.statusinfo=i,a}},this.getToken=function(e){var t=(new ne.asn1.cms.CMSParser).getCMSSignedData(e);return this.setTSTInfo(t),t},this.setTSTInfo=function(e){var t=e.econtent;if("tstinfo"==t.type){var i=t.content.hex,r=this.getTSTInfo(i);t.content=r}},this.getTSTInfo=function(t){var s={},a=n(t,0),o=i(t,a[1]);s.policy=Ve(o);var c=r(t,a[2]);s.messageImprint=this.getMessageImprint(c);var l=i(t,a[3]);s.serial={hex:l};var u=i(t,a[4]);s.genTime={str:ye(u)};var d=0;if(a.length>5&&"30"==t.substr(a[5],2)){var p=r(t,a[5]);s.accuracy=this.getAccuracy(p),d++}a.length>5+d&&"01"==t.substr(a[5+d],2)&&("ff"==i(t,a[5+d])&&(s.ordering=!0),d++);if(a.length>5+d&&"02"==t.substr(a[5+d],2)){var h=i(t,a[5+d]);s.nonce={hex:h},d++}if(a.length>5+d&&"a0"==t.substr(a[5+d],2)){var m=r(t,a[5+d]);m="30"+m.substr(2),pGeneralNames=e.getGeneralNames(m);var f=pGeneralNames[0].dn;s.tsa=f,d++}if(a.length>5+d&&"a1"==t.substr(a[5+d],2)){var g=r(t,a[5+d]);g="30"+g.substr(2);var _=e.getExtParamArray(g);s.ext=_,d++}return s},this.getAccuracy=function(e){for(var t={},r=n(e,0),s=0;s<r.length;s++){var a=e.substr(r[s],2),o=i(e,r[s]),c=parseInt(o,16);"02"==a?t.seconds=c:"80"==a?t.millis=c:"81"==a&&(t.micros=c)}return t},this.getMessageImprint=function(e){if("30"!=e.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var r={},a=(n(e,0),s(e,0,[0,0])),o=i(e,a),c=t.hextooidstr(o),l=ne.asn1.x509.OID.oid2name(c);if(""==l)throw new Error("hashAlg name undefined: "+c);var u=l,d=s(e,0,[1]);return r.alg=u,r.hash=i(e,d),r},this.getPKIStatusInfo=function(e){var t={},s=n(e,0),o=0;try{var c=i(e,s[0]),l=parseInt(c,16);t.status=a[l]}catch(e){}if(s.length>1&&"30"==e.substr(s[1],2)){var u=r(e,s[1]);t.statusstr=this.getPKIFreeText(u),o++}if(s.length>o&&"03"==e.substr(s[1+o],2)){var d=r(e,s[1+o]);t.failinfo=this.getPKIFailureInfo(d)}return t},this.getPKIFreeText=function(e){for(var i=[],r=n(e,0),s=0;s<r.length;s++)i.push(t.getString(e,r[s]));return i},this.getPKIFailureInfo=function(e){var i=t.getInt(e,0);return null!=o[i]?o[i]:i},this.getTimeStampReq=function(e){var s={certreq:!1},a=n(e,0);if(a.length<2)throw new Error("TimeStampReq must have at least 2 items");var o=r(e,a[1]);s.messageImprint=ne.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var c=2;c<a.length;c++){var l=a[c],u=e.substr(l,2);if("06"==u){var d=i(e,l);s.policy=t.hextooidstr(d)}"02"==u&&(s.nonce=i(e,l)),"01"==u&&(s.certreq=!0)}return s}},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.cades&&ne.asn1.cades||(ne.asn1.cades={}),ne.asn1.cades.SignaturePolicyIdentifier=function(e){var t=ne.asn1.cades,i=t.SignaturePolicyId;t.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.SignaturePolicyIdentifier,ne.asn1.cms.Attribute),ne.asn1.cades.SignaturePolicyId=function(e){var t=ne.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,s=(t.x509.AlgorithmIdentifier,t.cades),n=s.SignaturePolicyId,a=s.OtherHashAlgAndValue;n.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];return t.push(new r(e.oid)),t.push(new a(e)),new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.SignaturePolicyId,ne.asn1.ASN1Object),ne.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DEROctetString,n=i.x509.AlgorithmIdentifier;i.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(null==e.alg)throw new t("property 'alg' not specified");if(null==e.hash&&null==e.cert)throw new t("property 'hash' nor 'cert' not specified");var i=null;if(null!=e.hash)i=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var a=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(a=Ae(e.cert)),i=ne.crypto.Util.hashHex(a,e.alg)}var o=[];return o.push(new n({name:e.alg})),o.push(new s({hex:i})),new r({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherHashAlgAndValue,ne.asn1.ASN1Object),ne.asn1.cades.OtherHashValue=function(e){ne.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,i=ne,r=(i.lang.String.isHex,i.asn1.DEROctetString);i.crypto.Util.hashHex;this.params=null,this.tohex=function(){var e=this.params;if(null==e.hash&&null==e.cert)throw new t("hash or cert not specified");var i=null;if(null!=e.hash)i=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var s=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(s=Ae(e.cert)),i=ne.crypto.Util.hashHex(s,"sha1")}return new r({hex:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherHashValue,ne.asn1.ASN1Object),ne.asn1.cades.SignatureTimeStamp=function(e){var t=Error,i=ne,r=i.lang.String.isHex,s=i.asn1,n=s.ASN1Object;s.x509;s.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var e=this.params;if(null!=e.tst){if(r(e.tst))return(s=new n).hTLV=e.tst,[s];if(e.tst instanceof n)return[e.tst];throw new t("params.tst has wrong value")}if(null!=e.res){var i=e.res;if(i instanceof n&&(i=i.tohex()),"string"!=typeof i||!r(i))throw new t("params.res has wrong value");var s;ce.getTLVbyList(i,0,[1]);return(s=new n).hTLV=e.tst,[s]}},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.SignatureTimeStamp,ne.asn1.cms.Attribute),ne.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERSequence,n=r.cades,a=n.OtherCertID,o=i.lang.String.isHex;n.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var e=this.params,i=[],r=0;r<e.array.length;r++){var n=e.array[r];if("string"==typeof n)if(-1!=n.indexOf("-----BEGIN"))n={cert:n};else{if(!o(n))throw new t("unsupported value: "+n);n={hash:n}}null!=e.alg&&null==n.alg&&(n.alg=e.alg),null!=e.hasis&&null==n.hasis&&(n.hasis=e.hasis);var c=new a(n);i.push(c)}return[new s({array:i})]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.CompleteCertificateRefs,ne.asn1.cms.Attribute),ne.asn1.cades.OtherCertID=function(e){var t=ne.asn1,i=t.DERSequence,r=t.cms.IssuerSerial,s=t.cades,n=s.OtherHashValue,a=s.OtherHashAlgAndValue;s.OtherCertID.superclass.constructor.call(this),this.params=e,this.tohex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:_isHex(e)&&(e={hash:e}));var t=[],s=null;if(s=null!=e.alg?new a(e):new n(e),t.push(s),null!=e.cert&&1==e.hasis||null!=e.issuer&&null!=e.serial){var o=new r(e);t.push(o)}return new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherCertID,ne.asn1.ASN1Object),ne.asn1.cades.OtherHash=function(e){Error;var t=ne,i=t.asn1,r=(i.cms,i.cades),s=r.OtherHashAlgAndValue,n=r.OtherHashValue,a=(t.crypto.Util.hashHex,t.lang.String.isHex);r.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:a(e)&&(e={hash:e}));return(null!=e.alg?new s(e):new n(e)).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherHash,ne.asn1.ASN1Object),ne.asn1.cades.CAdESUtil=new function(){},ne.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){return(new ne.asn1.cms.CMSParser).getCMSSignedData(e)},ne.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,i){var r=ce,s=r.getChildIdx,n=r.getTLV,a=r.getV,o=ne.asn1,c=o.ASN1Object,l=o.cms,u=l.AttributeList,d=l.SignerInfo,p={},h=s(e,t);if(6!=h.length)throw"not supported items for SignerInfo (!=6)";var m=h.shift();p.version=n(e,m);var f=h.shift();p.si=n(e,f);var g=h.shift();p.digalg=n(e,g);var _=h.shift();p.sattrs=n(e,_);var y=h.shift();p.sigalg=n(e,y);var b=h.shift();p.sig=n(e,b),p.sigval=a(e,b);var v=null;return p.obj=new d,(v=new c).hTLV=p.version,p.obj.dCMSVersion=v,(v=new c).hTLV=p.si,p.obj.dSignerIdentifier=v,(v=new c).hTLV=p.digalg,p.obj.dDigestAlgorithm=v,(v=new c).hTLV=p.sattrs,p.obj.dSignedAttrs=v,(v=new c).hTLV=p.sigalg,p.obj.dSigAlg=v,(v=new c).hTLV=p.sig,p.obj.dSig=v,p.obj.dUnsignedAttrs=new u,p},void 0!==ne.asn1.csr&&ne.asn1.csr||(ne.asn1.csr={}),ne.asn1.csr.CertificationRequest=function(e){var t=ne.asn1,i=t.DERBitString,r=t.DERSequence,s=t.csr,n=(t.x509,s.CertificationRequestInfo);s.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.sign=function(){var e=new n(this.params).tohex(),t=new ne.crypto.Signature({alg:this.params.sigalg});t.init(this.params.sbjprvkey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return Ce(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var e=this.params,t=new ne.asn1.csr.CertificationRequestInfo(this.params),s=new ne.asn1.x509.AlgorithmIdentifier({name:e.sigalg});if(null==e.sighex&&null!=e.sbjprvkey&&this.sign(),null==e.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var n=new i({hex:"00"+e.sighex});return new r({array:[t,s,n]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.csr.CertificationRequest,ne.asn1.ASN1Object),ne.asn1.csr.CertificationRequestInfo=function(e){var t=ne.asn1,i=(t.DERBitString,t.DERSequence),r=t.DERInteger,s=t.DERUTF8String,n=t.DERTaggedObject,a=t.ASN1Util.newObject,o=t.csr,c=t.x509,l=c.X500Name,u=c.Extensions,d=c.SubjectPublicKeyInfo;o.AttributeList;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(e){null!=e&&(this.params=e)},this.tohex=function(){var e=this.params,t=[];if(t.push(new r({int:0})),t.push(new l(e.subject)),t.push(new d(et.getKey(e.sbjpubkey))),null!=e.attrs){var o=function(e){for(var t=Error,i=ne.asn1.x509.Extensions,r=[],s=0;s<e.length;s++){var n=e[s],a=n.attr;if("extensionRequest"==a){var o={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[new i(n.ext)]}]};r.push(o)}else if("unstructuredName"==a){o={seq:[{oid:"1.2.840.113549.1.9.2"},{set:n.names}]};r.push(o)}else{if("challengePassword"!=a)throw new t("unknown CSR attribute");o={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:n.password}]}]};r.push(o)}}return{set:r}}(e.attrs),c=a({tag:{tage:"a0",obj:o}});t.push(c)}else if(null!=e.extreq){var p=new u(e.extreq);c=a({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[p]}]}}});t.push(c)}else t.push(new n({tag:"a0",explicit:!1,obj:new s({str:""})}));return new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.csr.CertificationRequestInfo,ne.asn1.ASN1Object),ne.asn1.csr.AttributeList=function(e){},Qe(ne.asn1.csr.AttributeList,ne.asn1.ASN1Object),ne.asn1.csr.CSRUtil=new function(){},ne.asn1.csr.CSRUtil.newCSRPEM=function(e){return new ne.asn1.csr.CertificationRequest(e).getPEM()},ne.asn1.csr.CSRUtil.getParam=function(e,t){var i=ce,r=i.getV,s=i.getIdxbyList,n=i.getTLVbyList,a=i.getTLVbyListEx,o=i.getVbyListEx,c={};if(-1==e.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var l=Ae(e,"CERTIFICATE REQUEST");t&&(c.tbs=n(l,0,[0]));try{var u=a(l,0,[0,1]);if("3000"==u)c.subject={};else{var d=new st;c.subject=d.getX500Name(u)}}catch(e){}var p=a(l,0,[0,2]),h=et.getKey(p,null,"pkcs8pub");c.sbjpubkey=et.getPEM(h,"PKCS8PUB");var m,f,g=(f=s(m=l,0,[0,3,0,0],"06"),"2a864886f70d01090e"!=r(m,f)?null:n(m,0,[0,3,0,1,0],"30"));d=new st;null!=g&&(c.extreq=d.getExtParamArray(g));try{var _=a(l,0,[1],"30");d=new st;c.sigalg=d.getAlgorithmIdentifierName(_)}catch(e){}try{var y=o(l,0,[2]);c.sighex=y}catch(e){}return c},ne.asn1.csr.CSRUtil.verifySignature=function(e){try{var t=null;if("string"==typeof e&&-1!=e.indexOf("-----BEGIN CERTIFICATE REQUEST")?t=ne.asn1.csr.CSRUtil.getParam(e,!0):"object"==typeof e&&null!=e.sbjpubkey&&null!=e.sigalg&&null!=e.sighex&&null!=e.tbs&&(t=e),null==t)return!1;var i=new ne.crypto.Signature({alg:t.sigalg});return i.init(t.sbjpubkey),i.updateHex(t.tbs),i.verify(t.sighex)}catch(e){return alert(e),!1}},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.ocsp&&ne.asn1.ocsp||(ne.asn1.ocsp={}),ne.asn1.ocsp.DEFAULT_HASH="sha1",ne.asn1.ocsp.OCSPResponse=function(e){ne.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);ne.asn1.DEREnumerated;var t=ne.asn1.ASN1Util.newObject,i=ne.asn1.ocsp.ResponseBytes,r=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var e=this.params.resstatus;return"number"==typeof e?e:"string"!=typeof e?-1:r.indexOf(e)},this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params,r=this._getStatusCode();if(-1==r)throw new Error("responseStatus not supported: "+e.resstatus);if(0!=r)return t({seq:[{enum:{int:r}}]}).tohex();var s=new i(e);return t({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:s}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.OCSPResponse,ne.asn1.ASN1Object),ne.asn1.ocsp.ResponseBytes=function(e){ne.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,s=t.DEROctetString,n=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params;if("ocspBasic"!=e.restype)throw new Error("not supported responseType: "+e.restype);var t=new n(e),a=[];return a.push(new r({name:"ocspBasic"})),a.push(new s({hex:t.tohex()})),new i({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.ResponseBytes,ne.asn1.ASN1Object),ne.asn1.ocsp.BasicOCSPResponse=function(e){ne.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,i=ne.asn1,r=i.ASN1Object,s=i.DERSequence,n=(i.DERGeneralizedTime,i.DERTaggedObject),a=i.DERBitString,o=(i.x509.Extensions,i.x509.AlgorithmIdentifier),c=i.ocsp;c.ResponderID;_SingleResponseList=c.SingleResponseList,_ResponseData=c.ResponseData,this.params=null,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.tbsresp.tohex(),i=new ne.crypto.Signature({alg:e.sigalg});i.init(e.reskey),i.updateHex(t),e.sighex=i.sign()},this.tohex=function(){var e=this.params;null==e.tbsresp&&(e.tbsresp=new _ResponseData(e)),null==e.sighex&&null!=e.reskey&&this.sign();var i=[];if(i.push(e.tbsresp),i.push(new o({name:e.sigalg})),i.push(new a({hex:"00"+e.sighex})),null!=e.certs&&null!=e.certs.length){for(var c=[],l=0;l<e.certs.length;l++){var u=e.certs[l],d=null;if(ce.isASN1HEX(u))d=u;else{if(!u.match(/-----BEGIN/))throw new t("certs["+l+"] not hex or PEM");d=Ae(u)}c.push(new r({tlv:d}))}var p=new s({array:c});i.push(new n({tag:"a0",explicit:!0,obj:p}))}return new s({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.BasicOCSPResponse,ne.asn1.ASN1Object),ne.asn1.ocsp.ResponseData=function(e){ne.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERGeneralizedTime,n=i.DERTaggedObject,a=i.x509.Extensions,o=i.ocsp,c=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.tohex=function(){var e=this.params;null!=e.respid&&new t("respid not specified"),null!=e.prodat&&new t("prodat not specified"),null!=e.array&&new t("array not specified");var i=[];if(i.push(new c(e.respid)),i.push(new s(e.prodat)),i.push(new _SingleResponseList(e.array)),null!=e.ext){var o=new a(e.ext);i.push(new n({tag:"a1",explicit:!0,obj:o}))}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.ResponseData,ne.asn1.ASN1Object),ne.asn1.ocsp.ResponderID=function(e){ne.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=ne,i=t.asn1,r=i.ASN1Util.newObject,s=i.x509.X500Name,n=t.lang.String.isHex,a=Error;this.params=null,this.tohex=function(){var e=this.params;if(null!=e.key){var t,i=null;if("string"==typeof e.key){if(n(e.key)&&(i=e.key),e.key.match(/-----BEGIN CERTIFICATE/))null!=(t=new st(e.key).getExtSubjectKeyIdentifier())&&(i=t.kid.hex)}else if(e.key instanceof st)null!=(t=e.key.getExtSubjectKeyIdentifier())&&(i=t.kid.hex);if(null==i)throw new a("wrong key member value");return r({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:i}}}}).tohex()}if(null!=e.name){var o=null;if("string"==typeof e.name&&e.name.match(/-----BEGIN CERTIFICATE/))o=new st(e.name).getSubject();else e.name instanceof st?o=e.name.getSubject():"object"!=typeof e.name||null==e.name.array&&null==e.name.str||(o=e.name);if(null==o)throw new a("wrong name member value");return r({tag:{tag:"a1",explicit:!0,obj:new s(o)}}).tohex()}throw new a("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.ResponderID,ne.asn1.ASN1Object),ne.asn1.ocsp.SingleResponseList=function(e){ne.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.tohex=function(){var e=this.params;if("object"!=typeof e||null==e.length)throw new Error("params not specified properly");for(var t=[],s=0;s<e.length;s++)t.push(new r(e[s]));return new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.SingleResponseList,ne.asn1.ASN1Object),ne.asn1.ocsp.SingleResponse=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERGeneralizedTime,n=i.DERTaggedObject,a=i.ocsp,o=a.CertID,c=a.CertStatus,l=i.x509.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,i=[];if(null==e.certid)throw new t("certid unspecified");if(null==e.status)throw new t("status unspecified");if(null==e.thisupdate)throw new t("thisupdate unspecified");if(i.push(new o(e.certid)),i.push(new c(e.status)),i.push(new s(e.thisupdate)),null!=e.nextupdate){var a=new s(e.nextupdate);i.push(new n({tag:"a0",explicit:!0,obj:a}))}if(null!=e.ext){var u=new l(e.ext);i.push(new n({tag:"a1",explicit:!0,obj:u}))}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.SingleResponse,ne.asn1.ASN1Object),ne.asn1.ocsp.CertID=function(e){var t=ne,i=t.asn1,r=i.DEROctetString,s=i.DERInteger,n=i.DERSequence,a=i.x509.AlgorithmIdentifier,o=i.ocsp,c=(o.DEFAULT_HASH,t.crypto.Util.hashHex),l=st,u=ce.getVbyList;o.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(e,t,i,r){null==r&&(r=this.DEFAULT_HASH),this.params={alg:r,issname:e,isskey:t,sbjsn:i}},this.setByCert=function(e,t,i){null==i&&(i=this.DEFAULT_HASH),this.params={alg:i,issuerCert:e,subjectCert:t}},this.getParamByCerts=function(e,t,i){null==i&&(i=this.DEFAULT_HASH);var r=new l(e),s=new l(t),n=c(r.getSubjectHex(),i),a=r.getPublicKeyHex();return{alg:i,issname:n,isskey:c(u(a,0,[1],"03",!0),i),sbjsn:s.getSerialNumberHex()}},this.tohex=function(){if("object"!=typeof this.params)throw new Error("params not set");var e,t,i,o,c=this.params;if(o=null==c.alg?this.DEFAULT_HASH:c.alg,null!=c.issuerCert&&null!=c.subjectCert){var l=this.getParamByCerts(c.issuerCert,c.subjectCert,o);e=l.issname,t=l.isskey,i=l.sbjsn}else{if(null==c.issname||null==c.isskey||null==c.sbjsn)throw new Error("required param members not defined");e=c.issname,t=c.isskey,i=c.sbjsn}var u=new a({name:o}),d=new r({hex:e}),p=new r({hex:t}),h=new s({hex:i}),m=new n({array:[u,d,p,h]});return this.hTLV=m.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.CertID,ne.asn1.ASN1Object),ne.asn1.ocsp.CertStatus=function(e){ne.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if("good"==e.status)return"8000";if("unknown"==e.status)return"8200";if("revoked"==e.status){var t=[{gentime:{str:e.time}}];null!=e.reason&&t.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:e.reason}}}});var i={tag:"a1",explicit:!1,obj:{seq:t}};return ne.asn1.ASN1Util.newObject({tag:i}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.CertStatus,ne.asn1.ASN1Object),ne.asn1.ocsp.Request=function(e){var t=ne.asn1,i=t.DERSequence,r=t.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var e=[];if(null===this.dReqCert)throw"reqCert not set";e.push(this.dReqCert);var t=new i({array:e});return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e){var s=new r.CertID(e);this.dReqCert=s}},Qe(ne.asn1.ocsp.Request,ne.asn1.ASN1Object),ne.asn1.ocsp.TBSRequest=function(e){var t=ne.asn1,i=t.DERSequence,r=t.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(e){for(var t=[],i=0;i<e.length;i++){var s=new r.Request(e[0]);t.push(s)}this.dRequestList=t},this.tohex=function(){var e=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var t=new i({array:this.dRequestList});if(e.push(t),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new i({array:e});return this.hTLV=r.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&void 0!==e.reqList&&this.setRequestListByParam(e.reqList)},Qe(ne.asn1.ocsp.TBSRequest,ne.asn1.ASN1Object),ne.asn1.ocsp.OCSPRequest=function(e){var t=ne.asn1,i=t.DERSequence,r=t.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var e=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(e.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var t=new i({array:e});return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&void 0!==e.reqList){var s=new r.TBSRequest(e);this.dTbsRequest=s}},Qe(ne.asn1.ocsp.OCSPRequest,ne.asn1.ASN1Object),ne.asn1.ocsp.OCSPUtil={},ne.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,i){var r=ne.asn1.ocsp;void 0===i&&(i=r.DEFAULT_HASH);var s={alg:i,issuerCert:e,subjectCert:t};return new r.OCSPRequest({reqList:[s]}).tohex()},ne.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=ce,i=t.getVbyList,r=t.getVbyListEx,s=t.getIdxbyList,n=(t.getIdxbyListEx,t.getV),a={};try{var o=r(e,0,[0],"0a");a.responseStatus=parseInt(o,16)}catch(e){}if(0!==a.responseStatus)return a;try{var c=s(e,0,[1,0,1,0,0,2,0,1]);"80"===e.substr(c,2)?a.certStatus="good":"a1"===e.substr(c,2)?(a.certStatus="revoked",a.revocationTime=ye(i(e,c,[0]))):"82"===e.substr(c,2)&&(a.certStatus="unknown")}catch(e){}try{var l=s(e,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=ye(n(e,l))}catch(e){}try{var u=s(e,0,[1,0,1,0,0,2,0,3]);"a0"===e.substr(u,2)&&(a.nextUpdate=ye(i(e,u,[0])))}catch(e){}return a},ne.asn1.ocsp.OCSPParser=function(){var e=Error,t=st,i=new t,r=ce,s=r.getV,n=r.getTLV,a=r.getIdxbyList,o=r.getVbyList,c=r.getTLVbyList,l=r.getVbyListEx,u=r.getTLVbyListEx,d=r.getChildIdx;this.getOCSPRequest=function(t){var i=d(t,0);if(1!=i.length&&2!=i.length)throw new e("wrong number elements: "+i.length);return this.getTBSRequest(n(t,i[0]))},this.getTBSRequest=function(e){var t={},r=u(e,0,[0],"30");t.array=this.getRequestList(r);var s=u(e,0,["[2]",0],"30");return null!=s&&(t.ext=i.getExtParamArray(s)),t},this.getRequestList=function(e){for(var t=[],i=d(e,0),r=0;r<i.length;r++){e=n(e,i[r]);t.push(this.getRequest(e))}return t},this.getRequest=function(t){var r=d(t,0);if(1!=r.length&&2!=r.length)throw new e("wrong number elements: "+r.length);var s=this.getCertID(n(t,r[0]));if(2==r.length){var o=a(t,0,[1,0]);s.ext=i.getExtParamArray(n(t,o))}return s},this.getCertID=function(i){var r=d(i,0);if(4!=r.length)throw new e("wrong number elements: "+r.length);var a=new t,o={};return o.alg=a.getAlgorithmIdentifierName(n(i,r[0])),o.issname=s(i,r[1]),o.isskey=s(i,r[2]),o.sbjsn=s(i,r[3]),o},this.getOCSPResponse=function(e){var t,i=d(e,0),r=s(e,i[0]),n=parseInt(r);if(1==i.length)return{resstatus:n};var a=c(e,0,[1,0]);return(t=this.getResponseBytes(a)).resstatus=n,t},this.getResponseBytes=function(e){var t,i=d(e,0),r=c(e,0,[1,0]);t=this.getBasicOCSPResponse(r);var n=s(e,i[0]);return t.restype=ne.asn1.x509.OID.oid2name(Ve(n)),t},this.getBasicOCSPResponse=function(e){var t,i=d(e,0);t=this.getResponseData(n(e,i[0]));var r=new st;t.alg=r.getAlgorithmIdentifierName(n(e,i[1]));var a=s(e,i[2]);t.sighex=a.substr(2);var o=l(e,0,["[0]"]);if(null!=o){for(var c=d(o,0),u=[],p=0;p<c.length;p++){var h=n(o,c[p]);u.push(h)}t.certs=u}return t},this.getResponseData=function(e){var t=d(e,0),i=t.length,r={},a=0;"a0"==e.substr(t[0],2)&&a++,r.respid=this.getResponderID(n(e,t[a++]));var o=s(e,t[a++]);if(r.prodat=ye(o),r.array=this.getSingleResponseList(n(e,t[a++])),"a1"==e.substr(t[i-1],2)){var l=c(e,t[i-1],[0]),u=new st;r.ext=u.getExtParamArray(l)}return r},this.getResponderID=function(e){var t={};if("a2"==e.substr(0,2)){var i=o(e,0,[0]);t.key=i}if("a1"==e.substr(0,2)){var r=c(e,0,[0]),s=new st;t.name=s.getX500Name(r)}return t},this.getSingleResponseList=function(e){for(var t=d(e,0),i=[],r=0;r<t.length;r++){var s=this.getSingleResponse(n(e,t[r]));i.push(s)}return i},this.getSingleResponse=function(e){var t=d(e,0),i={},r=this.getCertID(n(e,t[0]));i.certid=r;var a=this.getCertStatus(n(e,t[1]));if(i.status=a,"18"==e.substr(t[2],2)){var l=s(e,t[2]);i.thisupdate=ye(l)}for(var u=3;u<t.length;u++){if("a0"==e.substr(t[u],2)){var p=o(e,t[u],[0],"18");i.nextupdate=ye(p)}if("a1"==e.substr(t[u],2)){var h=new st,m=c(e,0,[u,0]);i.ext=h.getExtParamArray(m)}}return i},this.getCertStatus=function(e){var t={};if("8000"==e)return{status:"good"};if("8200"==e)return{status:"unknown"};if("a1"==e.substr(0,2)){t.status="revoked";var i=ye(o(e,0,[0]));t.time=i}return t}},void 0!==ne&&ne||(ne={}),void 0!==ne.lang&&ne.lang||(ne.lang={}),ne.lang.String=function(){},"function"==typeof Buffer?(ae=function(e){return he(Buffer.from(e,"utf8").toString("base64"))},oe=function(e){return Buffer.from(me(e),"base64").toString("utf8")}):(ae=function(e){return fe(ke(Ue(e)))},oe=function(e){return decodeURIComponent(Re(ge(e)))}),ne.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},ne.lang.String.isHex=function(e){return Me(e)},ne.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},ne.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=me(e),ne.lang.String.isBase64(e))},ne.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ne.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ne.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},ne.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};function ze(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",r=parseInt(e,10).toString(2),s=7-r.length%7;7==s&&(s=0);for(var n="",a=0;a<s;a++)n+="0";r=n+r;for(a=0;a<r.length-1;a+=7){var o=r.substr(a,7);a!=r.length-7&&(o="1"+o),i+=t(parseInt(o,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var r="",s=e.split("."),n=40*parseInt(s[0],10)+parseInt(s[1],10);r+=t(n),s.splice(0,2);for(var a=0;a<s.length;a++)r+=i(s[a]);return r}catch(e){return null}}function Ve(e){if(!Me(e))return null;try{var t=[],i=e.substr(0,2),r=parseInt(i,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var s=e.substr(2),n=[],a=0;a<s.length/2;a++)n.push(parseInt(s.substr(2*a,2),16));var o=[],c="";for(a=0;a<n.length;a++)128&n[a]?c+=We((127&n[a]).toString(2),7):(c+=We((127&n[a]).toString(2),7),o.push(new String(parseInt(c,2))),c="");var l=t.join(".");return o.length>0&&(l=l+"."+o.join(".")),l}catch(e){return null}}function Ke(e){return Ge(new v(String(e),10))}function Ge(e){var t=e.toString(16);if("-"!=t.substr(0,1))return t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t),t;var i=t.substr(1).length;i%2==1?i+=1:t.match(/^[0-7]/)||(i+=2);for(var r="",s=0;s<i;s++)r+="f";return t=new v(r,16).xor(e).add(v.ONE).toString(16).replace(/^-/,"")}var We=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function Je(e){if(e.length%2!=0)return-1;if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return-1;try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16);if(i>7)return-1;var r=e.substr(2),s=parseInt(r,16).toString(2);"0"==s&&(s="00000000"),s=s.slice(0,0-i);var n=parseInt(s,2);return NaN==n?-1:n}catch(e){return-1}}function $e(e){if("number"!=typeof e)return null;if(e<0)return null;var t=Number(e).toString(2),i=8-t.length%8;8==i&&(i=0),t+=We("",i,"0");var r=parseInt(t,2).toString(16);return r.length%2==1&&(r="0"+r),"0"+i+r}function Ze(e){if("string"!=typeof e)return null;if(e.length%2!=0)return null;if(!e.match(/^[0-9a-f]+$/))return null;try{var t=parseInt(e.substr(0,2),16);if(t<0||7<t)return null;for(var i=e.substr(2),r="",s=0;s<i.length;s+=2){var n=i.substr(s,2),a=parseInt(n,16).toString(2);r+=a=("0000000"+a).slice(-8)}return r.substr(0,r.length-t)}catch(e){return null}}function Ye(e,t){for(var i=0,r=0;r<e.length;r++)i|=1<<t[e[r]];var s=i.toString(2),n="";for(r=s.length-1;r>=0;r--)n+=s[r];return n}function Xe(e,t,i){if("object"==typeof e){t=String(t).split(".");for(var r=0;r<t.length&&e;r++){var s=t[r];s.match(/^[0-9]+$/)&&(s=parseInt(s)),e=e[s]}return e||!1===e?e:i}}function Qe(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:m.algo.MD5,sha1:m.algo.SHA1,sha224:m.algo.SHA224,sha256:m.algo.SHA256,sha384:m.algo.SHA384,sha512:m.algo.SHA512,ripemd160:m.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,i){var r=this.getDigestInfoHex(e,t),s=i/4;if(r.length+22>s)throw"key is too short for SigAlg: keylen="+i+","+t;for(var n="0001",a="00"+r,o="",c=s-4-a.length,l=0;l<c;l+=2)o+="ff";return n+o+a},this.hashString=function(e,t){return new ne.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new ne.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ee||e instanceof ne.crypto.DSA||e instanceof ne.crypto.ECDSA}},ne.crypto.Util.md5=function(e){return new ne.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},ne.crypto.Util.ripemd160=function(e){return new ne.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},ne.crypto.Util.SECURERANDOMGEN=new X,ne.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return ne.crypto.Util.SECURERANDOMGEN.nextBytes(t),de(t)},ne.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new v(ne.crypto.Util.getRandomHexOfNbytes(e),16)},ne.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return ne.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],de(i)},ne.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new v(ne.crypto.Util.getRandomHexOfNbits(e),16)},ne.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=ne.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},ne.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var i=e.compareTo(t);if(1==i)throw"biMin is greater than biMax";if(0==i)return e;var r=t.subtract(e);return ne.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},ne.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=ne.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=ne.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=ne.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=m.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(m.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=ne.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ne.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},ne.crypto.MessageDigest.getHashLength=function(e){var t=ne.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},ne.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ne.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=ne.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var i=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==t){try{var r=ne.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=m.algo.HMAC.create(r,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=m.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(m.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=xe(e)),void(this.pass=m.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=_e(e.utf8)),void 0!==e.rstr&&(t=xe(e.rstr)),void 0!==e.b64&&(t=y(e.b64)),void 0!==e.b64u&&(t=ge(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=m.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=ne.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ne.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var i="",r=t/4-e.length,s=0;s<r;s++)i+="0";return i+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ne.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var i=null;try{i=void 0===t?et.getKey(e):et.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===i.isPrivate)this.prvKey=i,this.state="SIGN";else{if(!0!==i.isPublic)throw"init failed.:"+i;this.pubKey=i,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ne.crypto.ECDSA&&(this.prvKey=new ne.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ee&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ee&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ne.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ne.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ne.crypto.ECDSA&&(this.pubKey=new ne.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ee&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ee&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==ne.crypto.ECDSA&&this.pubKey instanceof ne.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==ne.crypto.DSA&&this.pubKey instanceof ne.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=ne.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=et.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},ne.crypto.Cipher=function(e){},ne.crypto.Cipher.encrypt=function(e,t,i,r){if(null!=Xe(r,"enclag")&&(i=r.encalg),"string"==typeof i&&"-CBC"==i.substr(-4)){var s=t,n=e;null!=Xe(r,"key")&&(s=r.key),null!=Xe(r,"enc")&&(hEnc=r.enc);var a,o=m.enc.Hex.parse(s),c=m.enc.Hex.parse(n),l=m.enc.Hex.parse(r.iv);if("des-EDE3-CBC"==i)a=m.TripleDES.encrypt(c,o,{iv:l});else{if("aes128-CBC"!=i&&"aes256-CBC"!=i)throw new Error("unsupported algorithm: "+i);a=m.AES.encrypt(c,o,{iv:l})}return a+""}throw new Error("Cipher.encrypt: unsupported key or algorithm")},ne.crypto.Cipher.decrypt=function(e,t,i,r){if(null!=Xe(r,"enclag")&&(i=r.encalg),"string"==typeof i&&"-CBC"==i.substr(-4)){var s=t,n=e;null!=Xe(r,"key")&&(s=r.key),null!=Xe(r,"enc")&&(n=r.enc);var a,o=m.enc.Hex.parse(s),c=m.enc.Hex.parse(n),l=m.enc.Hex.parse(r.iv);if("des-EDE3-CBC"==i)a=m.TripleDES.decrypt({ciphertext:c},o,{iv:l});else{if("aes128-CBC"!=i&&"aes256-CBC"!=i)throw new Error("unsupported algorithm: "+i);a=m.AES.decrypt({ciphertext:c},o,{iv:l})}return m.enc.Hex.stringify(a)}throw new Error("Cipher.decrypt: unsupported key or algorithm")},ne.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.ECDSA=function(e){var t=Error,i=v,r=ie,s=ne.crypto.ECDSA,n=ne.crypto.ECParameterDB,a=s.getName,o=ce,c=o.getVbyListEx,l=o.isASN1HEX,u=new X;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(e){return new i(e.bitLength(),u).mod(e.subtract(i.ONE)).add(i.ONE)},this.setNamedCurve=function(e){this.ecparams=n.getByName(e),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=e},this.setPrivateKeyHex=function(e){this.isPrivate=!0,this.prvKeyHex=e},this.setPublicKeyHex=function(e){this.isPublic=!0,this.pubKeyHex=e},this.getPublicKeyXYHex=function(){var e=this.pubKeyHex;if("04"!==e.substr(0,2))throw"this method supports uncompressed format(04) only";var t=this.ecparams.keycharlen;if(e.length!==2+2*t)throw"malformed public key hex length";var i={};return i.x=e.substr(2,t),i.y=e.substr(2+t),i},this.getShortNISTPCurveName=function(){var e=this.curveName;return"secp256r1"===e||"NIST P-256"===e||"P-256"===e||"prime256v1"===e?"P-256":"secp384r1"===e||"NIST P-384"===e||"P-384"===e?"P-384":"secp521r1"===e||"NIST P-521"===e||"P-521"===e?"P-521":null},this.generateKeyPairHex=function(){var e=this.ecparams.n,t=this.getBigRandom(e),i=this.ecparams.keycharlen,r=("0000000000"+t.toString(16)).slice(-i);return this.setPrivateKeyHex(r),{ecprvhex:r,ecpubhex:this.generatePublicKeyHex()}},this.generatePublicKeyHex=function(){var e=new i(this.prvKeyHex,16),t=this.ecparams.G.multiply(e),r=t.getX().toBigInteger(),s=t.getY().toBigInteger(),n=this.ecparams.keycharlen,a="04"+("0000000000"+r.toString(16)).slice(-n)+("0000000000"+s.toString(16)).slice(-n);return this.setPublicKeyHex(a),a},this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)},this.signHex=function(e,t){var r=new i(t,16),n=this.ecparams.n,a=new i(e.substring(0,this.ecparams.keycharlen),16);do{var o=this.getBigRandom(n),c=this.ecparams.G.multiply(o).getX().toBigInteger().mod(n)}while(c.compareTo(i.ZERO)<=0);var l=o.modInverse(n).multiply(a.add(r.multiply(c))).mod(n);return s.biRSSigToASN1Sig(c,l)},this.sign=function(e,t){var r=t,s=this.ecparams.n,n=i.fromByteArrayUnsigned(e);do{var a=this.getBigRandom(s),o=this.ecparams.G.multiply(a).getX().toBigInteger().mod(s)}while(o.compareTo(v.ZERO)<=0);var c=a.modInverse(s).multiply(n.add(r.multiply(o))).mod(s);return this.serializeSig(o,c)},this.verifyWithMessageHash=function(e,t){return this.verifyHex(e,t,this.pubKeyHex)},this.verifyHex=function(e,t,n){try{var a,o,c=s.parseSigHex(t);a=c.r,o=c.s;var l=r.decodeFromHex(this.ecparams.curve,n),u=new i(e.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(u,a,o,l)}catch(e){return!1}},this.verify=function(e,t,s){var n,a,o;if(Bitcoin.Util.isArray(t)){var c=this.parseSig(t);n=c.r,a=c.s}else{if("object"!=typeof t||!t.r||!t.s)throw"Invalid value for signature";n=t.r,a=t.s}if(s instanceof ie)o=s;else{if(!Bitcoin.Util.isArray(s))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=r.decodeFrom(this.ecparams.curve,s)}var l=i.fromByteArrayUnsigned(e);return this.verifyRaw(l,n,a,o)},this.verifyRaw=function(e,t,r,s){var n=this.ecparams.n,a=this.ecparams.G;if(t.compareTo(i.ONE)<0||t.compareTo(n)>=0)return!1;if(r.compareTo(i.ONE)<0||r.compareTo(n)>=0)return!1;var o=r.modInverse(n),c=e.multiply(o).mod(n),l=t.multiply(o).mod(n);return a.multiply(c).add(s.multiply(l)).getX().toBigInteger().mod(n).equals(t)},this.serializeSig=function(e,t){var i=e.toByteArraySigned(),r=t.toByteArraySigned(),s=[];return s.push(2),s.push(i.length),(s=s.concat(i)).push(2),s.push(r.length),(s=s.concat(r)).unshift(s.length),s.unshift(48),s},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var r=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var s=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:i.fromByteArrayUnsigned(r),s:i.fromByteArrayUnsigned(s)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:i.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:i.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===l(e))throw new Error("not ASN.1 hex string");var t,i,r;try{t=c(e,0,["[0]",0],"06"),i=c(e,0,[1],"04");try{r=c(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=a(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(i),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===l(e))throw new t("not ASN.1 hex string");var i,r,s;try{c(e,0,[1,0],"06"),i=c(e,0,[1,1],"06"),r=c(e,0,[2,0,1],"04");try{s=c(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=a(i),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(s),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===l(e))throw new t("not ASN.1 hex string");var i,r;try{c(e,0,[0,0],"06"),i=c(e,0,[0,1],"06"),r=c(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=a(i),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(e,i){if(!1===l(e))throw new t("not ASN.1 hex string");var r,s;try{r=c(e,0,[0,5,0,1],"06"),s=c(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=a(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(s)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},ne.crypto.ECDSA.parseSigHex=function(e){var t=ne.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new v(t.r,16),s:new v(t.s,16)}},ne.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=ce,i=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var s=i(e,0);if(2!=s.length)throw new Error("signature shall have two elements");var n=s[0],a=s[1];if("02"!=e.substr(n,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(a,2))throw new Error("2nd item not ASN.1 integer");return{r:r(e,n),s:r(e,a)}},ne.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=ne.crypto.ECDSA.parseSigHexInHexRS(e),i=t.r,r=t.s;if(i.length>=130&&i.length<=134){if(i.length%2!=0)throw Error("unknown ECDSA sig r length error");if(r.length%2!=0)throw Error("unknown ECDSA sig s length error");"00"==i.substr(0,2)&&(i=i.substr(2)),"00"==r.substr(0,2)&&(r=r.substr(2));var s=Math.max(i.length,r.length);return(i=("000000"+i).slice(-s))+(r=("000000"+r).slice(-s))}if("00"==i.substr(0,2)&&i.length%32==2&&(i=i.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),i.length%32==30&&(i="00"+i),r.length%32==30&&(r="00"+r),i.length%32!=0)throw Error("unknown ECDSA sig r length error");if(r.length%32!=0)throw Error("unknown ECDSA sig s length error");return i+r},ne.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),i=e.substr(e.length/2);return ne.crypto.ECDSA.hexRSSigToASN1Sig(t,i)},ne.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var i=new v(e,16),r=new v(t,16);return ne.crypto.ECDSA.biRSSigToASN1Sig(i,r)},ne.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var i=ne.asn1,r=new i.DERInteger({bigint:e}),s=new i.DERInteger({bigint:t});return new i.DERSequence({array:[r,s]}).tohex()},ne.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":"2b81040023"===e?"secp521r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":-1!=="|secp521r1|NIST P-521|P-521|".indexOf(e)?"secp521r1":null},void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.ECParameterDB=new function(){var e={},t={};function i(e){return new v(e,16)}this.getByName=function(i){var r=i;if(void 0!==t[r]&&(r=t[i]),void 0!==e[r])return e[r];throw"unregistered EC curve name: "+r},this.regist=function(r,s,n,a,o,c,l,u,d,p,h,m){e[r]={};var f=i(n),g=i(a),_=i(o),y=i(c),b=i(l),v=new re(f,g,_),x=v.decodePointHex("04"+u+d);e[r].name=r,e[r].keylen=s,e[r].keycharlen=2*Math.ceil(s/8),e[r].curve=v,e[r].G=x,e[r].n=y,e[r].h=b,e[r].oid=h,e[r].info=m;for(var S=0;S<p.length;S++)t[p[S]]=r}},ne.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ne.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ne.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ne.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ne.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ne.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ne.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ne.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ne.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ne.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.DSA=function(){var e=ce,t=(e.getVbyList,e.getVbyListEx),i=e.isASN1HEX,r=v;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(e,t,i,r,s){this.isPrivate=!0,this.p=e,this.q=t,this.g=i,this.y=r,this.x=s},this.setPrivateHex=function(e,t,i,r,s){var n,a,o,c,l;n=new v(e,16),a=new v(t,16),o=new v(i,16),c="string"==typeof r&&r.length>1?new v(r,16):null,l=new v(s,16),this.setPrivate(n,a,o,c,l)},this.setPublic=function(e,t,i,r){this.isPublic=!0,this.p=e,this.q=t,this.g=i,this.y=r,this.x=null},this.setPublicHex=function(e,t,i,r){var s,n,a,o;s=new v(e,16),n=new v(t,16),a=new v(i,16),o=new v(r,16),this.setPublic(s,n,a,o)},this.signWithMessageHash=function(e){var t=this.p,i=this.q,r=this.g,s=(this.y,this.x),n=ne.crypto.Util.getRandomBigIntegerMinToMax(v.ONE.add(v.ONE),i.subtract(v.ONE)),a=new v(e.substr(0,i.bitLength()/4),16),o=r.modPow(n,t).mod(i),c=n.modInverse(i).multiply(a.add(s.multiply(o))).mod(i);return ne.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:c}}]})},this.verifyWithMessageHash=function(e,t){var i=this.p,r=this.q,s=this.g,n=this.y,a=this.parseASN1Signature(t),o=a[0],c=a[1],l=new v(e.substr(0,r.bitLength()/4),16);if(v.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(v.ZERO.compareTo(c)>=0||c.compareTo(r)>0)throw"invalid DSA signature";var u=c.modInverse(r),d=l.multiply(u).mod(r),p=o.multiply(u).mod(r);return 0==s.modPow(d,i).multiply(n.modPow(p,i)).mod(i).mod(r).compareTo(o)},this.parseASN1Signature=function(e){try{return[new r(t(e,0,[0],"02"),16),new r(t(e,0,[1],"02"),16)]}catch(e){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(e){var r,s,n,a,o;if(!1===i(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1],"02"),s=t(e,0,[2],"02"),n=t(e,0,[3],"02"),a=t(e,0,[4],"02"),o=t(e,0,[5],"02")}catch(e){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(r,s,n,a,o)},this.readPKCS8PrvKeyHex=function(e){var r,s,n,a;if(!1===i(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1,1,0],"02"),s=t(e,0,[1,1,1],"02"),n=t(e,0,[1,1,2],"02"),a=t(e,0,[2,0],"02")}catch(e){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(r,s,n,null,a)},this.readPKCS8PubKeyHex=function(e){var r,s,n,a;if(!1===i(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[0,1,0],"02"),s=t(e,0,[0,1,1],"02"),n=t(e,0,[0,1,2],"02"),a=t(e,0,[1,0],"02")}catch(e){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(r,s,n,a)},this.readCertPubKeyHex=function(e,r){var s,n,a,o;if(!1===i(e))throw new Error("not ASN.1 hex string");try{s=t(e,0,[0,5,0,1,0],"02"),n=t(e,0,[0,5,0,1,1],"02"),a=t(e,0,[0,5,0,1,2],"02"),o=t(e,0,[0,5,1,0],"02")}catch(e){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(s,n,a,o)}};var et=function(){var e=function(e,i,r){return t(m.AES,e,i,r)},t=function(e,t,i,r){var s=m.enc.Hex.parse(t),n=m.enc.Hex.parse(i),a=m.enc.Hex.parse(r),o={};o.key=n,o.iv=a,o.ciphertext=s;var c=e.decrypt(o,n,{iv:a});return m.enc.Hex.stringify(c)},i=function(e,t,i){return r(m.AES,e,t,i)},r=function(e,t,i,r){var s=m.enc.Hex.parse(t),n=m.enc.Hex.parse(i),a=m.enc.Hex.parse(r),o=e.encrypt(s,n,{iv:a}),c=m.enc.Hex.parse(o.toString());return m.enc.Base64.stringify(c)},s={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,i,r){return t(m.TripleDES,e,i,r)},eproc:function(e,t,i){return r(m.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,i,r){return t(m.DES,e,i,r)},eproc:function(e,t,i){return r(m.DES,e,t,i)},keylen:8,ivlen:8}},n=function(e){var t={},i=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));i&&(t.cipher=i[1],t.ivsalt=i[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var s=-1,n=0;-1!=e.indexOf("\r\n\r\n")&&(s=e.indexOf("\r\n\r\n"),n=2),-1!=e.indexOf("\n\n")&&(s=e.indexOf("\n\n"),n=1);var a=e.indexOf("-----END");if(-1!=s&&-1!=a){var o=e.substring(s+2*n,a-n);o=o.replace(/\s+/g,""),t.data=o}return t},a=function(e,t,i){for(var r=i.substring(0,16),n=m.enc.Hex.parse(r),a=m.enc.Utf8.parse(t),o=s[e].keylen+s[e].ivlen,c="",l=null;;){var u=m.algo.MD5.create();if(null!=l&&u.update(l),u.update(a),u.update(n),l=u.finalize(),(c+=m.enc.Hex.stringify(l)).length>=2*o)break}var d={};return d.keyhex=c.substr(0,2*s[e].keylen),d.ivhex=c.substr(2*s[e].keylen,2*s[e].ivlen),d},o=function(e,t,i,r){var n=m.enc.Base64.parse(e),a=m.enc.Hex.stringify(n);return(0,s[t].proc)(a,i,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return n(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return a(e,t,i)},decryptKeyB64:function(e,t,i,r){return o(e,t,i,r)},getDecryptedKeyHex:function(e,t){var i=n(e),r=(i.type,i.cipher),s=i.ivsalt,c=i.data,l=a(r,t,s).keyhex;return o(c,r,l,s)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,r,n){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===s[r])throw new Error("KEYUTIL unsupported algorithm: "+r);if(void 0===n||null==n){var c=function(e){var t=m.lib.WordArray.random(e);return m.enc.Hex.stringify(t)}(s[r].ivlen);n=c.toUpperCase()}var l=function(e,t,i,r){return(0,s[t].eproc)(e,i,r)}(t,r,a(r,i,n).keyhex,n);o="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+n+"\r\n",o+="\r\n",o+=l.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},getEncryptedPKCS8PEM:function(e,t,i){return Ce(this.getEncryptedPKCS8Hex(e,t,i),"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(e,t,i){var r;(r=null==i||null==i?{}:JSON.parse(JSON.stringify(i))).plain=e,this.initPBES2Param(r),this.encryptPBES2Param(r,t);var s=this.generatePBES2ASN1Param(r);return ne.asn1.ASN1Util.newObject(s).tohex()},initPBES2Param:function(e){var t;(null==Xe(e,"encalg")&&(e.encalg="aes256-CBC"),null==Xe(e,"iter")&&(e.iter=2048),null==Xe(e,"prf")&&(e.prf="hmacWithSHA256"),null==Xe(e,"salt")&&(e.salt=m.enc.Hex.stringify(m.lib.WordArray.random(8))),null==Xe(e,"enciv"))&&("des-EDE3-CBC"==e.encalg&&(t=8),"aes128-CBC"==e.encalg&&(t=16),"aes256-CBC"==e.encalg&&(t=16),e.enciv=m.enc.Hex.stringify(m.lib.WordArray.random(t)))},encryptPBES2Param:function(e,t){var i=et.getDKFromPBES2Param(e,t);try{var r=ne.crypto.Cipher.encrypt(e.plain,i,e.encalg,{iv:e.enciv})}catch(t){throw new Error("encrypt error: "+e.plain+" "+i+" "+e.encalg+" "+e.enciv)}e.enc=r},generatePBES2ASN1Param:function(e){var t={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:e.salt}},{int:{hex:Ke(e.iter)}}]}]},{seq:[{oid:e.encalg},{octstr:{hex:e.enciv}}]}]}]},{octstr:{hex:e.enc}}]};return"hmacWithSHA1"!=e.prf&&t.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:e.prf},{null:""}]}),t},parseHexOfEncryptedPKCS8:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={},n=i(e,0);if(2!=n.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+n.length);s.ciphertext=r(e,n[1]);var a=i(e,n[0]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+a.length);if("2a864886f70d01050d"!=r(e,a[0]))throw new Error("this only supports pkcs5PBES2");var o=i(e,a[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var c=i(e,o[1]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length);if("2a864886f70d0307"!=r(e,c[0]))throw"this only supports TripleDES";s.encryptionSchemeAlg="TripleDES",s.encryptionSchemeIV=r(e,c[1]);var l=i(e,o[0]);if(2!=l.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length);if("2a864886f70d01050c"!=r(e,l[0]))throw new Error("this only supports pkcs5PBKDF2");var u=i(e,l[1]);if(u.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+u.length);s.pbkdf2Salt=r(e,u[0]);var d=r(e,u[1]);try{s.pbkdf2Iter=parseInt(d,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+d)}return s},getPBKDF2KeyHexFromParam:function(e,t){var i=m.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,s=m.PBKDF2(t,i,{keySize:6,iterations:r});return m.enc.Hex.stringify(s)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=Ae(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(i),s=et.getPBKDF2KeyHexFromParam(r,t),n={};n.ciphertext=m.enc.Hex.parse(r.ciphertext);var a=m.enc.Hex.parse(s),o=m.enc.Hex.parse(r.encryptionSchemeIV),c=m.TripleDES.decrypt(n,a,{iv:o});return m.enc.Hex.stringify(c)},parsePBES2:function(e){var t=ce.parse(e);if("pkcs5PBES2"!=Xe(t,"seq.0.seq.0.oid")||"pkcs5PBKDF2"!=Xe(t,"seq.0.seq.1.seq.0.seq.0.oid"))throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var i=Xe(t,"seq.0.seq.1.seq.0.seq.1.seq");if(null==i)throw new Error("PBKDF2 parameter not found");var r=Xe(i,"0.octstr.hex"),s=Xe(i,"1.int.hex"),n=Xe(i,"2.seq.0.oid","hmacWithSHA1"),a=-1;try{a=parseInt(s,16)}catch(e){throw new Error("iter not proper value")}var o=Xe(t,"seq.0.seq.1.seq.1.seq.0.oid"),c=Xe(t,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),l=Xe(t,"seq.1.octstr.hex");if(null==o||null==c||null==l)throw new Error("encalg, enciv or enc is undefined");return{salt:r,iter:a,prf:n,encalg:o,enciv:c,enc:l}},getDKFromPBES2Param:function(e,t){var i={hmacWithSHA1:m.algo.SHA1,hmacWithSHA224:m.algo.SHA224,hmacWithSHA256:m.algo.SHA256,hmacWithSHA384:m.algo.SHA384,hmacWithSHA512:m.algo.SHA512}[e.prf];if(null==i)throw new Error("unsupported prf");var r={"des-EDE3-CBC":6,"aes128-CBC":4,"aes256-CBC":8}[e.encalg];if(null==r)throw new Error("unsupported encalg");var s=m.enc.Hex.parse(e.salt),n=e.iter;try{var a=m.PBKDF2(t,s,{keySize:r,iterations:n,hasher:i});return m.enc.Hex.stringify(a)}catch(i){throw new Error("PBKDF2 error: "+i+" "+JSON.stringify(e)+" "+t)}},getPlainHexFromEncryptedPKCS8PEM:function(e,t){if(-1==e.indexOf("BEGIN ENCRYPTED PRIVATE KEY"))throw new Error("not Encrypted PKCS#8 PEM string");var i,r=Ae(e);try{i=et.parsePBES2(r)}catch(e){throw new Error("malformed PBES2 format: "+e.message)}var s=et.getDKFromPBES2Param(i,t);return ne.crypto.Cipher.decrypt(i.enc,s,i.encalg,{iv:i.enciv})},getKeyFromEncryptedPKCS8PEM:function(e,t){var i=this.getPlainHexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(i)},parsePlainPrivatePKCS8Hex:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var n=i(e,0);if(n.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(n[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=i(e,n[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(s.algoid=r(e,a[0]),"06"==e.substr(a[1],2)&&(s.algparam=r(e,a[1])),"04"!=e.substr(n[2],2))throw new Error("malformed PKCS8 private key(code:006)");return s.keyidx=t.getVidx(e,n[2]),s},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=Ae(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new ee;else if("2a8648ce380401"==i.algoid)t=new ne.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw new Error("unsupported private key algorithm");t=new ne.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,i=ce.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===i)t=new ee;else if("2a8648ce380401"===i)t=new ne.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw new Error("unsupported PKCS#8 public key hex");t=new ne.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var n=i(e,0);if(2!=n.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(n[0],2))throw new Error("malformed RSA key(code:003)");if(s.n=r(e,n[0]),"02"!=e.substr(n[1],2))throw new Error("malformed RSA key(code:004)");return s.e=r(e,n[1]),s},parsePublicPKCS8Hex:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={algparam:null},n=i(e,0);if(2!=n.length)throw new Error("outer DERSequence shall have 2 elements: "+n.length);var a=n[0];if("30"!=e.substr(a,2))throw new Error("malformed PKCS8 public key(code:001)");var o=i(e,a);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(s.algoid=r(e,o[0]),"06"==e.substr(o[1],2)?s.algparam=r(e,o[1]):"30"==e.substr(o[1],2)&&(s.algparam={},s.algparam.p=t.getVbyList(e,o[1],[0],"02"),s.algparam.q=t.getVbyList(e,o[1],[1],"02"),s.algparam.g=t.getVbyList(e,o[1],[2],"02")),"03"!=e.substr(n[1],2))throw new Error("malformed PKCS8 public key(code:004)");return s.key=r(e,n[1]).substr(2),s}}}();et.getKey=function(e,t,i){var r=(g=ce).getChildIdx,s=(g.getV,g.getVbyList),n=ne.crypto,a=n.ECDSA,o=n.DSA,c=ee,l=Ae,u=et;if(void 0!==c&&e instanceof c)return e;if(void 0!==a&&e instanceof a)return e;if(void 0!==o&&e instanceof o)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new a({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new a({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new c).setPublic(e.n,e.e),P;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(P=new c).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),P;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(P=new c).setPrivate(e.n,e.e,e.d),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(P=new o).setPublic(e.p,e.q,e.g,e.y),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(P=new o).setPrivate(e.p,e.q,e.g,e.y,e.x),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new c).setPublic(ge(e.n),ge(e.e)),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(P=new c).setPrivateEx(ge(e.n),ge(e.e),ge(e.d),ge(e.p),ge(e.q),ge(e.dp),ge(e.dq),ge(e.qi)),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(P=new c).setPrivate(ge(e.n),ge(e.e),ge(e.d)),P;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var d=(T=new a({curve:e.crv})).ecparams.keycharlen,p="04"+("0000000000"+ge(e.x)).slice(-d)+("0000000000"+ge(e.y)).slice(-d);return T.setPublicKeyHex(p),T}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){d=(T=new a({curve:e.crv})).ecparams.keycharlen,p="04"+("0000000000"+ge(e.x)).slice(-d)+("0000000000"+ge(e.y)).slice(-d);var h=("0000000000"+ge(e.d)).slice(-d);return T.setPublicKeyHex(p),T.setPrivateKeyHex(h),T}if("pkcs5prv"===i){var m,f=e,g=ce;if(9===(m=r(f,0)).length)(P=new c).readPKCS5PrvKeyHex(f);else if(6===m.length)(P=new o).readPKCS5PrvKeyHex(f);else{if(!(m.length>2&&"04"===f.substr(m[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(P=new a).readPKCS5PrvKeyHex(f)}return P}if("pkcs8prv"===i)return P=u.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return u._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return st.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return st.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var _=Ae(e,"PUBLIC KEY");return u._getKeyFromPublicPKCS8Hex(_)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=l(e,"RSA PRIVATE KEY");return u.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=s(R=l(e,"DSA PRIVATE KEY"),0,[1],"02"),x=s(R,0,[2],"02"),S=s(R,0,[3],"02"),w=s(R,0,[4],"02"),E=s(R,0,[5],"02");return(P=new o).setPrivate(new v(b,16),new v(x,16),new v(S,16),new v(w,16),new v(E,16)),P}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){y=l(e,"EC PRIVATE KEY");return u.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return u.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C=u.getDecryptedKeyHex(e,t),A=new ee;return A.readPKCS5PrvKeyHex(C),A}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var T,P=s(R=u.getDecryptedKeyHex(e,t),0,[1],"04"),I=s(R,0,[2,0],"06"),k=s(R,0,[3,0],"03").substr(2);if(void 0===ne.crypto.OID.oidhex2name[I])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);return(T=new a({curve:ne.crypto.OID.oidhex2name[I]})).setPublicKeyHex(k),T.setPrivateKeyHex(P),T.isPublic=!1,T}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var R;b=s(R=u.getDecryptedKeyHex(e,t),0,[1],"02"),x=s(R,0,[2],"02"),S=s(R,0,[3],"02"),w=s(R,0,[4],"02"),E=s(R,0,[5],"02");return(P=new o).setPrivate(new v(b,16),new v(x,16),new v(S,16),new v(w,16),new v(E,16)),P}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return u.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},et.generateKeypair=function(e,t){if("RSA"==e){var i=t;(a=new ee).generate(i,"10001"),a.isPrivate=!0,a.isPublic=!0;var r=new ee,s=a.n.toString(16),n=a.e.toString(16);return r.setPublic(s,n),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=r,o}if("EC"==e){var a,o,c=t,l=new ne.crypto.ECDSA({curve:c}).generateKeyPairHex();return(a=new ne.crypto.ECDSA({curve:c})).setPublicKeyHex(l.ecpubhex),a.setPrivateKeyHex(l.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(r=new ne.crypto.ECDSA({curve:c})).setPublicKeyHex(l.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=r,o}throw new Error("unknown algorithm: "+e)},et.getPEM=function(e,t,i,r,s,n){var a=ne,o=a.asn1,c=o.DERObjectIdentifier,l=o.DERInteger,u=o.ASN1Util.newObject,d=o.x509.SubjectPublicKeyInfo,p=a.crypto,h=p.DSA,m=p.ECDSA,f=ee;function g(e){return u({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function _(e){return u({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function y(e){return u({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==f&&e instanceof f||void 0!==h&&e instanceof h||void 0!==m&&e instanceof m)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Ce(S=new d(e).tohex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==f&&e instanceof f&&(void 0===i||null==i)&&1==e.isPrivate)return Ce(S=g(e).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate){var b=new c({name:e.curveName}).tohex(),v=_(e).tohex(),x="";return x+=Ce(b,"EC PARAMETERS"),x+=Ce(v,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==h&&e instanceof h&&(void 0===i||null==i)&&1==e.isPrivate)return Ce(S=y(e).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==f&&e instanceof f&&void 0!==i&&null!=i&&1==e.isPrivate){var S=g(e).tohex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",S,i,r,n)}if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==i&&null!=i&&1==e.isPrivate){S=_(e).tohex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",S,i,r,n)}if("PKCS5PRV"==t&&void 0!==h&&e instanceof h&&void 0!==i&&null!=i&&1==e.isPrivate){S=y(e).tohex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",S,i,r,n)}var w=function(e,t){if("string"==typeof t)return et.getEncryptedPKCS8PEM(e,t);if("object"==typeof t&&null!=Xe(t,"passcode")){var i=JSON.parse(JSON.stringify(t)),r=i.passcode;return delete i.passcode,et.getEncryptedPKCS8PEM(e,r,i)}};if("PKCS8PRV"==t&&null!=f&&e instanceof f&&1==e.isPrivate){var E=g(e).tohex();S=u({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:E}}]}).tohex();return void 0===i||null==i?Ce(S,"PRIVATE KEY"):w(S,i)}if("PKCS8PRV"==t&&void 0!==m&&e instanceof m&&1==e.isPrivate){var C={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};"string"==typeof e.pubKeyHex&&C.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});E=new u(C).tohex(),S=u({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:E}}]}).tohex();return void 0===i||null==i?Ce(S,"PRIVATE KEY"):w(S,i)}if("PKCS8PRV"==t&&void 0!==h&&e instanceof h&&1==e.isPrivate){E=new l({bigint:e.x}).tohex(),S=u({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:E}}]}).tohex();return void 0===i||null==i?Ce(S,"PRIVATE KEY"):w(S,i)}throw new Error("unsupported object nor format")},et.getKeyFromCSRPEM=function(e){var t=Ae(e,"CERTIFICATE REQUEST");return et.getKeyFromCSRHex(t)},et.getKeyFromCSRHex=function(e){var t=et.parseCSRHex(e);return et.getKey(t.p8pubkeyhex,null,"pkcs8pub")},et.parseCSRHex=function(e){var t=ce,i=t.getChildIdx,r=t.getTLV,s={},n=e;if("30"!=n.substr(0,2))throw new Error("malformed CSR(code:001)");var a=i(n,0);if(a.length<1)throw new Error("malformed CSR(code:002)");if("30"!=n.substr(a[0],2))throw new Error("malformed CSR(code:003)");var o=i(n,a[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return s.p8pubkeyhex=r(n,o[2]),s},et.getKeyID=function(e){var t=et,i=ce;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=Ae(t.getPEM(e)),s=i.getIdxbyList(r,0,[1]),n=i.getV(r,s).substring(2);return ne.crypto.Util.hashHex(n,"sha1")},et.getJWK=function(e,t,i,r,s){var n,a,o={},c=ne.crypto.Util.hashHex;if("string"==typeof e)n=et.getKey(e),-1!=e.indexOf("CERTIFICATE")&&(a=Ae(e));else{if("object"!=typeof e)throw new Error("unsupported keyinfo type");e instanceof st?(n=e.getPublicKey(),a=e.hex):n=e}if(n instanceof ee&&n.isPrivate)o.kty="RSA",o.n=fe(n.n.toString(16)),o.e=fe(n.e.toString(16)),o.d=fe(n.d.toString(16)),o.p=fe(n.p.toString(16)),o.q=fe(n.q.toString(16)),o.dp=fe(n.dmp1.toString(16)),o.dq=fe(n.dmq1.toString(16)),o.qi=fe(n.coeff.toString(16));else if(n instanceof ee&&n.isPublic)o.kty="RSA",o.n=fe(n.n.toString(16)),o.e=fe(n.e.toString(16));else if(n instanceof ne.crypto.ECDSA&&n.isPrivate){if("P-256"!==(u=n.getShortNISTPCurveName())&&"P-384"!==u&&"P-521"!==u)throw new Error("unsupported curve name for JWT: "+u);var l=n.getPublicKeyXYHex();o.kty="EC",o.crv=u,o.x=fe(l.x),o.y=fe(l.y),o.d=fe(n.prvKeyHex)}else if(n instanceof ne.crypto.ECDSA&&n.isPublic){var u;if("P-256"!==(u=n.getShortNISTPCurveName())&&"P-384"!==u&&"P-521"!==u)throw new Error("unsupported curve name for JWT: "+u);l=n.getPublicKeyXYHex();o.kty="EC",o.crv=u,o.x=fe(l.x),o.y=fe(l.y)}if(null==o.kty)throw new Error("unsupported keyinfo");return n.isPrivate||1==t||(o.kid=ne.jws.JWS.getJWKthumbprint(o)),null!=a&&1!=i&&(o.x5c=[_(a)]),null!=a&&1!=r&&(o.x5t=he(_(c(a,"sha1")))),null!=a&&1!=s&&(o["x5t#S256"]=he(_(c(a,"sha256")))),o},et.getJWKFromKey=function(e){return et.getJWK(e,!0,!0,!0,!0)},ee.getPosArrayOfChildrenFromHex=function(e){return ce.getChildIdx(e,0)},ee.getHexValueArrayOfChildrenFromHex=function(e){var t,i=ce.getV,r=i(e,(t=ee.getPosArrayOfChildrenFromHex(e))[0]),s=i(e,t[1]),n=i(e,t[2]),a=i(e,t[3]),o=i(e,t[4]),c=i(e,t[5]),l=i(e,t[6]),u=i(e,t[7]),d=i(e,t[8]);return(t=new Array).push(r,s,n,a,o,c,l,u,d),t},ee.prototype.readPrivateKeyFromPEMString=function(e){var t=Ae(e),i=ee.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},ee.prototype.readPKCS5PrvKeyHex=function(e){var t=ee.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ee.prototype.readPKCS8PrvKeyHex=function(e){var t,i,r,s,n,a,o,c,l=ce,u=l.getVbyListEx;if(!1===l.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=u(e,0,[2,0,1],"02"),i=u(e,0,[2,0,2],"02"),r=u(e,0,[2,0,3],"02"),s=u(e,0,[2,0,4],"02"),n=u(e,0,[2,0,5],"02"),a=u(e,0,[2,0,6],"02"),o=u(e,0,[2,0,7],"02"),c=u(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,i,r,s,n,a,o,c)},ee.prototype.readPKCS5PubKeyHex=function(e){var t=ce,i=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var s=i(e,r[0]),n=i(e,r[1]);this.setPublic(s,n)},ee.prototype.readPKCS8PubKeyHex=function(e){var t=ce;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var i=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(i)},ee.prototype.readCertPubKeyHex=function(e,t){var i,r;(i=new st).readCertHex(e),r=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};new RegExp("[^0-9a-f]","gi");function tt(e,t){for(var i="",r=t/4-e.length,s=0;s<r;s++)i+="0";return i+e}function it(e,t,i){for(var r="",s=0;r.length<t;)r+=ve(i(xe(e+String.fromCharCode.apply(String,[(4278190080&s)>>24,(16711680&s)>>16,(65280&s)>>8,255&s])))),s+=1;return r}function rt(e){for(var t in ne.crypto.Util.DIGESTINFOHEAD){var i=ne.crypto.Util.DIGESTINFOHEAD[t],r=i.length;if(e.substring(0,r)==i)return[t,e.substring(r)]}return[]}function st(e){var t,i=ce,r=i.getChildIdx,s=i.getV,n=(i.dump,i.parse),a=i.getTLV,o=i.getVbyList,c=i.getVbyListEx,l=i.getTLVbyList,u=i.getTLVbyListEx,d=i.getIdxbyList,p=i.getIdxbyListEx,h=i.getVidx,m=i.getInt,f=i.oidname,g=i.hextooidstr,_=Ae,y=Error;try{t=ne.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=l(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=l(e,0,[0]),i=m(t,0);if(i<0||2<i)throw new Error("malformed version field");return this.version=i+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return c(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=u(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var i in t)if(e===t[i])return i;return f(c(e,0,[0],"06"))},this.getIssuer=function(e,t){return this.getX500Name(this.getIssuerHex(),e,t)},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(e,t){return this.getX500Name(this.getSubjectHex(),e,t)},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=o(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=o(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var e=this.getSPKI();return null==e?null:o(e,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return d(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return d(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return et.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return o(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),r=l(this.hex,0,[0],"30"),s=new ne.crypto.Signature({alg:t});return s.init(e),s.updateHex(r),s.verify(i)},this.parseExt=function(e){var t,n,a;if(void 0===e){if(a=this.hex,3!==this.version)return-1;t=d(a,0,[0,7,0],"30"),n=r(a,t)}else{a=Ae(e);var c=d(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=s(a,c))return void(this.aExtInfo=new Array);t=d(a,0,[0,3,0,1,0],"30"),n=r(a,t),this.hex=a}this.aExtInfo=new Array;for(var l=0;l<n.length;l++){var u={critical:!1},p=0;3===r(a,n[l]).length&&(u.critical=!0,p=1),u.oid=i.hextooidstr(o(a,n[l],[0],"06"));var m=d(a,n[l],[1+p]);u.vidx=h(a,m),this.aExtInfo.push(u)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=ne.asn1.x509.OID.name2oid(e)),""!==i)for(var r=0;r<t.length;r++)if(t[r].oid===i)return t[r]},this.getCriticalExtV=function(e,t,i){if(null!=t)return[t,i];var r=this.getExtInfo(e);return null==r?[null,null]:[a(this.hex,r.vidx),r.critical]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("basicConstraints");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var n=s(e,10),o=parseInt(n,16);return r.cA=!0,r.pathLen=o,r}throw new Error("hExtV parse error: "+e)},this.getExtNameConstraints=function(e,t){var i=this.getCriticalExtV("nameConstraints",e,t);if(e=i[0],t=i[1],null!=e){var s={extname:"nameConstraints"};t&&(s.critical=!0);for(var n=r(e,0),o=0;o<n.length;o++){for(var c=[],l=r(e,n[o]),u=0;u<l.length;u++){var d=a(e,l[u]),p=this.getGeneralSubtree(d);c.push(p)}var h=e.substr(n[o],2);"a0"==h?s.permit=c:"a1"==h&&(s.exclude=c)}return s}},this.getGeneralSubtree=function(e){var t=r(e,0),i=t.length;if(i<1||2<i)throw new Error("wrong num elements");for(var n=this.getGeneralName(a(e,t[0])),o=1;o<i;o++){var c=e.substr(t[o],2),l=s(e,t[o]),u=parseInt(l,16);"80"==c&&(n.min=u),"81"==c&&(n.max=u)}return n},this.getExtKeyUsage=function(e,t){var i=this.getCriticalExtV("keyUsage",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r}},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var i="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(i=i.slice(-8)),10==e.length&&(i=i.slice(-16)),""==(i=i.replace(/0+$/,""))&&(i="0"),i},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),i=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&i.push(st.KEYUSAGE_NAME[r]);return i.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectKeyIdentifier");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var n=s(e,0);return r.kid={hex:n},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var n={extname:"authorityKeyIdentifier"};t&&(n.critical=!0);for(var o=r(e,0),c=0;c<o.length;c++){var l=e.substr(o[c],2);if("80"===l&&(n.kid={hex:s(e,o[c])}),"a1"===l){var u=a(e,o[c]),d=this.getGeneralNames(u);n.issuer=d[0].dn}"82"===l&&(n.sn={hex:s(e,o[c])})}return n},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var n={extname:"extKeyUsage",array:[]};t&&(n.critical=!0);for(var o=r(e,0),c=0;c<o.length;c++)n.array.push(f(s(e,o[c])));return n},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,i=a(this.hex,e.vidx);if(""===i)return t;for(var n=r(i,0),o=0;o<n.length;o++)t.push(f(s(i,n[o])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectAltName");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("issuerAltName");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),i=[],s=0;s<t.length;s++){var n=this.getGeneralName(a(e,t[s]));void 0!==n&&i.push(n)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=s(e,0),r=ve(i);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:Oe(i)}:"a4"==t?{dn:this.getX500Name(i)}:"a0"==t?{other:this.getOtherName(e)}:void 0},this.getExtSubjectAltName2=function(){var e,t,i,n=this.getExtInfo("subjectAltName");if(void 0===n)return n;for(var o=new Array,c=a(this.hex,n.vidx),l=r(c,0),u=0;u<l.length;u++)i=c.substr(l[u],2),e=s(c,l[u]),"81"===i&&(t=ye(e),o.push(["MAIL",t])),"82"===i&&(t=ye(e),o.push(["DNS",t])),"84"===i&&(t=st.hex2dn(e,0),o.push(["DN",t])),"86"===i&&(t=ye(e),o.push(["URI",t])),"87"===i&&(t=Oe(e),o.push(["IP",t]));return o},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("cRLDistributionPoints");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"cRLDistributionPoints",array:[]};t&&(s.critical=!0);for(var n=r(e,0),o=0;o<n.length;o++){var c=a(e,n[o]);s.array.push(this.getDistributionPoint(c))}return s},this.getDistributionPoint=function(e){for(var t={},i=r(e,0),s=0;s<i.length;s++){var n=e.substr(i[s],2),o=a(e,i[s]);"a0"==n&&(t.dpname=this.getDistributionPointName(o))}return t},this.getDistributionPointName=function(e){for(var t={},i=r(e,0),s=0;s<i.length;s++){var n=e.substr(i[s],2),o=a(e,i[s]);"a0"==n&&(t.full=this.getGeneralNames(o))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtCRLDistributionPoints();if(null==e)return e;for(var t=e.array,i=[],r=0;r<t.length;r++)try{null!=t[r].dpname.full[0].uri&&i.push(t[r].dpname.full[0].uri)}catch(e){}return i},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},i=r(this.hex,e.vidx),s=0;s<i.length;s++){var n=o(this.hex,i[s],[0],"06"),a=o(this.hex,i[s],[1],"86");"2b06010505073001"===n&&t.ocsp.push(ye(a)),"2b06010505073002"===n&&t.caissuer.push(ye(a))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityInfoAccess");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"authorityInfoAccess",array:[]};t&&(s.critical=!0);for(var n=r(e,0),l=0;l<n.length;l++){var u=c(e,n[l],[0],"06"),d=ye(o(e,n[l],[1],"86"));if("2b06010505073001"==u)s.array.push({ocsp:d});else{if("2b06010505073002"!=u)throw new Error("unknown method: "+u);s.array.push({caissuer:d})}}return s},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("certificatePolicies");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"certificatePolicies",array:[]};t&&(s.critical=!0);for(var n=r(e,0),o=0;o<n.length;o++){var c=a(e,n[o]),l=this.getPolicyInformation(c);s.array.push(l)}return s},this.getPolicyInformation=function(e){var t={},i=o(e,0,[0],"06");t.policyoid=f(i);var s=p(e,0,[1],"30");if(-1!=s){t.array=[];for(var n=r(e,s),c=0;c<n.length;c++){var l=a(e,n[c]),u=this.getPolicyQualifierInfo(l);t.array.push(u)}}return t},this.getOtherName=function(e){var t={},i=r(e,0),s=o(e,i[0],[],"06"),a=o(e,i[1],[]);return t.oid=f(s),t.value=n(a),t},this.getPolicyQualifierInfo=function(e){var t={},i=o(e,0,[0],"06");if("2b06010505070201"===i){var r=c(e,0,[1],"16");t.cps=ve(r)}else if("2b06010505070202"===i){var s=l(e,0,[1],"30");t.unotice=this.getUserNotice(s)}return t},this.getUserNotice=function(e){var t=null;try{return t=i.parse(e),this._asn1ToUnotice(t)}catch(e){return}},this._asn1ToUnotice=function(e){try{for(var t={},i=Xe(e,"seq"),r=0;r<i.length;r++){var s=this._asn1ToNoticeRef(i[r]);null!=s&&(t.noticeref=s);var n=this.asn1ToDisplayText(i[r]);null!=n&&(t.exptext=n)}return Object.keys(t).length>0?t:void 0}catch(e){return}},this._asn1ToNoticeRef=function(e){try{for(var t={},i=Xe(e,"seq"),r=0;r<i.length;r++){var s=this._asn1ToNoticeNum(i[r]);null!=s&&(t.noticenum=s);var n=this.asn1ToDisplayText(i[r]);null!=n&&(t.org=n)}return Object.keys(t).length>0?t:void 0}catch(e){return}},this._asn1ToNoticeNum=function(e){try{for(var t=Xe(e,"seq"),i=[],r=0;r<t.length;r++){var s=t[r];i.push(parseInt(Xe(s,"int.hex"),16))}return i}catch(e){return}},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=ve(s(e,0)),t},this.asn1ToDisplayText=function(e){return null!=e.utf8str?{type:"utf8",str:e.utf8str.str}:null!=e.ia5str?{type:"ia5",str:e.ia5str.str}:null!=e.visstr?{type:"vis",str:e.visstr.str}:null!=e.bmpstr?{type:"bmp",str:e.bmpstr.str}:null!=e.prnstr?{type:"prn",str:e.prnstr.str}:void 0},this.getExtPolicyMappings=function(e,t){var i=this.getCriticalExtV("policyMappings",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"policyMappings"};t&&(r.critical=!0);try{for(var s=n(e).seq,a=[],o=0;o<s.length;o++){var c=s[o].seq;a.push([c[0].oid,c[1].oid])}r.array=a}catch(e){throw new y("malformed policyMappings")}return r}},this.getExtPolicyConstraints=function(e,t){var i=this.getCriticalExtV("policyConstraints",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"policyConstraints"};t&&(r.critical=!0);var s=n(e);try{for(var a=s.seq,o=0;o<a.length;o++){var c=a[o].tag;0==c.explicit&&("80"==c.tag&&(r.reqexp=parseInt(c.hex,16)),"81"==c.tag&&(r.inhibit=parseInt(c.hex,16)))}}catch(e){return new y("malformed policyConstraints value")}return r}},this.getExtInhibitAnyPolicy=function(e,t){var i=this.getCriticalExtV("inhibitAnyPolicy",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"inhibitAnyPolicy"};t&&(r.critical=!0);var s=m(e,0);return-1==s?new y("wrong value"):(r.skip=s,r)}},this.getExtCRLNumber=function(e,t){var i={extname:"cRLNumber"};if(t&&(i.critical=!0),"02"==e.substr(0,2))return i.num={hex:s(e,0)},i;throw new y("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var i={extname:"cRLReason"};if(t&&(i.critical=!0),"0a"==e.substr(0,2))return i.code=parseInt(s(e,0),16),i;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var i={extname:"ocspNonce"};t&&(i.critical=!0);var r=s(e,0);return i.hex=r,i},this.getExtOcspNoCheck=function(e,t){var i={extname:"ocspNoCheck"};return t&&(i.critical=!0),i},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("adobeTimeStamp");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"adobeTimeStamp"};t&&(s.critical=!0);var n=r(e,0);if(n.length>1){var o=a(e,n[1]),c=this.getGeneralName(o);null!=c.uri&&(s.uri=c.uri)}if(n.length>2){var l=a(e,n[2]);"0101ff"==l&&(s.reqauth=!0),"010100"==l&&(s.reqauth=!1)}return s},this.getExtSubjectDirectoryAttributes=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectDirectoryAttributes");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"subjectDirectoryAttributes"};t&&(r.critical=!0);try{for(var s=n(e),o=[],c=0;c<s.seq.length;c++){var l=s.seq[c],u=Xe(l,"seq.0.oid"),d=Xe(l,"seq.1.set");if(null==u||null==d)throw"error";o.push({attr:u,array:d})}return r.array=o,r}catch(e){throw new Error("malformed subjectDirectoryAttributes extension value")}};var b=function(e){var t={};try{var i=e.seq[0].oid,r=ne.asn1.x509.OID.name2oid(i);t.type=ne.asn1.x509.OID.oid2atype(r);var s=e.seq[1];if(null!=s.utf8str)t.ds="utf8",t.value=s.utf8str.str;else if(null!=s.numstr)t.ds="num",t.value=s.numstr.str;else if(null!=s.telstr)t.ds="tel",t.value=s.telstr.str;else if(null!=s.prnstr)t.ds="prn",t.value=s.prnstr.str;else if(null!=s.ia5str)t.ds="ia5",t.value=s.ia5str.str;else if(null!=s.visstr)t.ds="vis",t.value=s.visstr.str;else{if(null==s.bmpstr)throw"error";t.ds="bmp",t.value=s.bmpstr.str}return t}catch(e){throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},v=function(e){try{return e.set.map((function(e){return b(e)}))}catch(e){throw new Error("improper ASN.1 parsed RDN: "+e)}};this.getX500NameRule=function(e){for(var t=null,i=[],r=0;r<e.length;r++)for(var s=e[r],n=0;n<s.length;n++)i.push(s[n]);for(r=0;r<i.length;r++){var a=i[r],o=a.ds,c=a.value,l=a.type;if("prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=l)return"mixed";if(ne.lang.String.isMail(c))continue;return"mixed"}if("C"==l){if("prn"==o)continue;return"mixed"}if(null==t)t=o;else if(t!==o)return"mixed"}return null==t?"prn":t},this.getAttrTypeAndValue=function(e){var t=n(e);return b(t)},this.getRDN=function(e){var t=n(e);return v(t)},this.getX500NameArray=function(e){return function(e){try{return e.seq.map((function(e){return v(e)}))}catch(e){throw new Error("improper ASN.1 parsed X500Name: "+e)}}(n(e))},this.getX500Name=function(e,t,i){var r=this.getX500NameArray(e),s={str:this.dnarraytostr(r)};return s.array=r,1==i&&(s.hex=e),1==t&&(s.canon=this.c14nRDNArray(r)),s},this.readCertPEM=function(e){this.readCertHex(_(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{d(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(e){var t={};return null==e&&(e={}),t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(e.dncanon,e.dnhex),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(e.dncanon,e.dnhex),t.sbjpubkey=Ce(this.getPublicKeyHex(),"PUBLIC KEY"),null!=this.aExtInfo&&this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),1==e.tbshex&&(t.tbshex=l(this.hex,0,[0])),1==e.nodnarray&&(delete t.issuer.array,delete t.subject.array),t},this.getExtParamArray=function(e){null==e&&(-1!=p(this.hex,0,[0,"[3]"])&&(e=u(this.hex,0,[0,"[3]",0],"30")));for(var t=[],i=r(e,0),s=0;s<i.length;s++){var n=a(e,i[s]),o=this.getExtParam(n);null!=o&&t.push(o)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var i=g(o(e,0,[0],"06")),s=!1;3==t&&"0101ff"==l(e,0,[1])&&(s=!0);var a=l(e,0,[t-1,0]),c=void 0;if("2.5.29.14"==i?c=this.getExtSubjectKeyIdentifier(a,s):"2.5.29.15"==i?c=this.getExtKeyUsage(a,s):"2.5.29.17"==i?c=this.getExtSubjectAltName(a,s):"2.5.29.18"==i?c=this.getExtIssuerAltName(a,s):"2.5.29.19"==i?c=this.getExtBasicConstraints(a,s):"2.5.29.30"==i?c=this.getExtNameConstraints(a,s):"2.5.29.31"==i?c=this.getExtCRLDistributionPoints(a,s):"2.5.29.32"==i?c=this.getExtCertificatePolicies(a,s):"2.5.29.33"==i?c=this.getExtPolicyMappings(a,s):"2.5.29.35"==i?c=this.getExtAuthorityKeyIdentifier(a,s):"2.5.29.36"==i?c=this.getExtPolicyConstraints(a,s):"2.5.29.37"==i?c=this.getExtExtKeyUsage(a,s):"2.5.29.54"==i?c=this.getExtInhibitAnyPolicy(a,s):"1.3.6.1.5.5.7.1.1"==i?c=this.getExtAuthorityInfoAccess(a,s):"2.5.29.20"==i?c=this.getExtCRLNumber(a,s):"2.5.29.21"==i?c=this.getExtCRLReason(a,s):"2.5.29.9"==i?c=this.getExtSubjectDirectoryAttributes(a,s):"1.3.6.1.5.5.7.48.1.2"==i?c=this.getExtOcspNonce(a,s):"1.3.6.1.5.5.7.48.1.5"==i?c=this.getExtOcspNoCheck(a,s):"1.2.840.113583.1.1.9.1"==i?c=this.getExtAdobeTimeStamp(a,s):null!=st.EXT_PARSER[i]&&(c=st.EXT_PARSER[i](i,s,a)),null!=c)return c;var u={extname:i,extn:a};try{u.extn=n(a)}catch(e){}return s&&(u.critical=!0),u},this.findExt=function(e,t){for(var i=0;i<e.length;i++)if(e[i].extname==t)return e[i];return null},this.updateExtCDPFullURI=function(e,t){var i=this.findExt(e,"cRLDistributionPoints");if(null!=i&&null!=i.array)for(var r=i.array,s=0;s<r.length;s++)if(null!=r[s].dpname&&null!=r[s].dpname.full)for(var n=r[s].dpname.full,a=0;a<n.length;a++){var o=n[s];null!=o.uri&&(o.uri=t)}},this.updateExtAIAOCSP=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var r=i.array,s=0;s<r.length;s++)null!=r[s].ocsp&&(r[s].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var r=i.array,s=0;s<r.length;s++)null!=r[s].caissuer&&(r[s].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.setCanonicalizedDN=function(e){var t;if(null!=e.str&&null==e.array){var i=new ne.asn1.x509.X500Name({str:e.str}).tohex();t=this.getX500NameArray(i)}else t=e.array;null==e.canon&&(e.canon=this.c14nRDNArray(t))},this.c14nRDNArray=function(e){for(var t=[],i=0;i<e.length;i++){for(var r=e[i],s=[],n=0;n<r.length;n++){var a=r[n],o=a.value;o=(o=(o=(o=o.replace(/^\s*/,"")).replace(/\s*$/,"")).replace(/\s+/g," ")).toLowerCase(),s.push(a.type.toLowerCase()+"="+o)}t.push(s.join("+"))}return"/"+t.join("/")},this.getInfo=function(){var e,t,i,r=function(e){for(var t="",i="    ",r="\n",s=e.array,n=0;n<s.length;n++){var a=s[n];if(null!=a.dn&&(t+=i+"dn: "+a.dn.str+r),null!=a.ip&&(t+=i+"ip: "+a.ip+r),null!=a.rfc822&&(t+=i+"rfc822: "+a.rfc822+r),null!=a.dns&&(t+=i+"dns: "+a.dns+r),null!=a.uri&&(t+=i+"uri: "+a.uri+r),null!=a.other)t+=i+"other: "+a.other.oid+"="+JSON.stringify(a.other.value).replace(/\"/g,"")+r}return t=t.replace(/\n$/,"")},s=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var s=i[r];if(t+="    policy oid: "+s.policyoid+"\n",void 0!==s.array)for(var n=0;n<s.array.length;n++){var a=s.array[n];void 0!==a.cps&&(t+="    cps: "+a.cps+"\n")}}return t},n=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var s=i[r];try{void 0!==s.dpname.full[0].uri&&(t+="    "+s.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==s.dname.full[0].dn.hex&&(t+="    "+st.hex2dn(s.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},a=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var s=i[r];void 0!==s.caissuer&&(t+="    caissuer: "+s.caissuer+"\n"),void 0!==s.ocsp&&(t+="    ocsp: "+s.ocsp+"\n")}return t};if(e="Basic Fields\n",e+="  serial number: "+this.getSerialNumberHex()+"\n",e+="  signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+="  issuer: "+this.getIssuerString()+"\n",e+="  notBefore: "+this.getNotBefore()+"\n",e+="  notAfter: "+this.getNotAfter()+"\n",e+="  subject: "+this.getSubjectString()+"\n",e+="  subject public key info: \n",e+="    key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+="    n="+He(t.n.toString(16)).substr(0,16)+"...\n",e+="    e="+He(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var o=0;o<i.length;o++){var c=i[o],l=ne.asn1.x509.OID.oid2name(c.oid);""===l&&(l=c.oid);var u="";if(!0===c.critical&&(u="CRITICAL"),e+="  "+l+" "+u+":\n","basicConstraints"===l){var d=this.getExtBasicConstraints();void 0===d.cA?e+="    {}\n":(e+="    cA=true",void 0!==d.pathLen&&(e+=", pathLen="+d.pathLen),e+="\n")}else{var p;if("policyMappings"==l)e+="    "+this.getExtPolicyMappings().array.map((function(e){var t=e;return t[0]+":"+t[1]})).join(", ")+"\n";else if("policyConstraints"==l)e+="    ",null!=(p=this.getExtPolicyConstraints()).reqexp&&(e+=" reqexp="+p.reqexp),null!=p.inhibit&&(e+=" inhibit="+p.inhibit),e+="\n";else if("inhibitAnyPolicy"==l)e+="    skip="+(p=this.getExtInhibitAnyPolicy()).skip+"\n";else if("keyUsage"==l)e+="    "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"==l)e+="    "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"==l){var h=this.getExtAuthorityKeyIdentifier();void 0!==h.kid&&(e+="    kid="+h.kid.hex+"\n")}else{if("extKeyUsage"==l)e+="    "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"==l)e+=r(this.getExtSubjectAltName())+"\n";else if("cRLDistributionPoints"==l)e+=n(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"==l)e+=a(this.getExtAuthorityInfoAccess());else"certificatePolicies"==l&&(e+=s(this.getExtCertificatePolicies()))}}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):ne.lang.String.isHex(e)&&this.readCertHex(e))}ee.prototype.sign=function(e,t){var i=function(e){return ne.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(i,t)},ee.prototype.signWithMessageHash=function(e,t){var i=Q(ne.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return tt(this.doPrivate(i).toString(16),this.n.bitLength())},ee.prototype.signPSS=function(e,t,i){var r,s=(r=xe(e),ne.crypto.Util.hashHex(r,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(s,t,i)},ee.prototype.signWithMessageHashPSS=function(e,t,i){var r,s=ve(e),n=s.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),c=function(e){return ne.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=n;else if(-2===i)i=o-n-2;else if(i<-2)throw new Error("invalid salt length");if(o<n+i+2)throw new Error("data too long");var l="";i>0&&(l=new Array(i),(new X).nextBytes(l),l=String.fromCharCode.apply(String,l));var u=ve(c(xe("\0\0\0\0\0\0\0\0"+s+l))),d=[];for(r=0;r<o-i-n-2;r+=1)d[r]=0;var p=String.fromCharCode.apply(String,d)+""+l,h=it(u,p.length,c),m=[];for(r=0;r<p.length;r+=1)m[r]=p.charCodeAt(r)^h.charCodeAt(r);var f=65280>>8*o-a&255;for(m[0]&=~f,r=0;r<n;r++)m.push(u.charCodeAt(r));return m.push(188),tt(this.doPrivate(new v(m)).toString(16),this.n.bitLength())},ee.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=Q(t,16),r=this.n.bitLength();if(i.bitLength()>r)return!1;var s=this.doPublic(i).toString(16);if(s.length+3!=r/4)return!1;var n=rt(s.replace(/^1f+00/,""));if(0==n.length)return!1;var a=n[0],o=n[1],c=function(e){return ne.crypto.Util.hashString(e,a)}(e);return o==c},ee.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=Q(t,16);if(i.bitLength()>this.n.bitLength())return 0;var r=rt(this.doPublic(i).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==e},ee.prototype.verifyPSS=function(e,t,i,r){var s,n=(s=xe(e),ne.crypto.Util.hashHex(s,i));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(n,t,i,r)},ee.prototype.verifyWithMessageHashPSS=function(e,t,i,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var s,n=new v(t,16),a=function(e){return ne.crypto.Util.hashHex(e,i)},o=ve(e),c=o.length,l=this.n.bitLength()-1,u=Math.ceil(l/8);if(-1===r||void 0===r)r=c;else if(-2===r)r=u-c-2;else if(r<-2)throw new Error("invalid salt length");if(u<c+r+2)throw new Error("data too long");var d=this.doPublic(n).toByteArray();for(s=0;s<d.length;s+=1)d[s]&=255;for(;d.length<u;)d.unshift(0);if(188!==d[u-1])throw new Error("encoded message does not end in 0xbc");var p=(d=String.fromCharCode.apply(String,d)).substr(0,u-c-1),h=d.substr(p.length,c),m=65280>>8*u-l&255;if(p.charCodeAt(0)&m)throw new Error("bits beyond keysize not zero");var f=it(h,p.length,a),g=[];for(s=0;s<p.length;s+=1)g[s]=p.charCodeAt(s)^f.charCodeAt(s);g[0]&=~m;var _=u-c-r-2;for(s=0;s<_;s+=1)if(0!==g[s])throw new Error("leftmost octets not zero");if(1!==g[_])throw new Error("0x01 marker not found");return h===ve(a(xe("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,g.slice(-r)))))},ee.SALT_LEN_HLEN=-1,ee.SALT_LEN_MAX=-2,ee.SALT_LEN_RECOVER=-2,st.EXT_PARSER={},st.registExtParser=function(e,t){st.EXT_PARSER[e]=t},st.hex2dn=function(e,t){void 0===t&&(t=0);var i=new st;ce.getTLV(e,t);return i.getX500Name(e).str},st.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var i=new Array,r=ce.getChildIdx(e,t),s=0;s<r.length;s++)i.push(st.hex2attrTypeValue(e,r[s]));return i=i.map((function(e){return e.replace("+","\\+")})),i.join("+")},st.hex2attrTypeValue=function(e,t){var i=ce,r=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var s=i.getChildIdx(e,t);2!==s.length||e.substr(s[0],2);var n=r(e,s[0]),a=ne.asn1.ASN1Util.oidHexToInt(n);return ne.asn1.x509.OID.oid2atype(a)+"="+ve(r(e,s[1]))},st.getPublicKeyFromCertHex=function(e){var t=new st;return t.readCertHex(e),t.getPublicKey()},st.getPublicKeyFromCertPEM=function(e){var t=new st;return t.readCertPEM(e),t.getPublicKey()},st.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,r=ce.getVbyList,s={};return s.algparam=null,(t=new st).readCertPEM(e),i=t.getPublicKeyHex(),s.keyhex=r(i,0,[1],"03").substr(2),s.algoid=r(i,0,[0,0],"06"),"2a8648ce3d0201"===s.algoid&&(s.algparam=r(i,0,[0,1],"06")),s},st.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];void 0!==ne&&ne||(ne={}),void 0!==ne.jws&&ne.jws||(ne.jws={}),ne.jws.JWS=function(){var e=ne.jws.JWS.isSafeJSONString;this.parseJWS=function(t,i){if(void 0===this.parsedJWS||!i&&void 0===this.parsedJWS.sigvalH){var r=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=r[1],n=r[2],a=r[3],o=s+"."+n;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=n,this.parsedJWS.sigvalB64U=a,this.parsedJWS.si=o,!i){var c=ge(a),l=Q(c,16);this.parsedJWS.sigvalH=c,this.parsedJWS.sigvalBI=l}var u=oe(s),d=oe(n);if(this.parsedJWS.headS=u,this.parsedJWS.payloadS=d,!e(u,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+u}}},ne.jws.JWS.sign=function(e,t,i,r,s){var n,a,o,c=ne,l=c.jws.JWS,u=l.readSafeJSONString,d=l.isSafeJSONString,p=c.crypto,h=(p.ECDSA,p.Mac),m=p.Signature,f=JSON;if("string"!=typeof t&&"object"!=typeof t)throw"spHeader must be JSON string or object: "+t;if("object"==typeof t&&(a=t,n=f.stringify(a)),"string"==typeof t){if(!d(n=t))throw"JWS Head is not safe JSON string: "+n;a=u(n)}if(o=i,"object"==typeof i&&(o=f.stringify(i)),""!=e&&null!=e||void 0===a.alg||(e=a.alg),""!=e&&null!=e&&void 0===a.alg&&(a.alg=e,n=f.stringify(a)),e!==a.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+a.alg;var g=null;if(void 0===l.jwsalg2sigalg[e])throw"unsupported alg name: "+e;g=l.jwsalg2sigalg[e];var _=ae(n)+"."+ae(o),y="";if("Hmac"==g.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var b=new h({alg:g,prov:"cryptojs",pass:r});b.updateString(_),y=b.doFinal()}else if(-1!=g.indexOf("withECDSA")){(x=new m({alg:g})).init(r,s),x.updateString(_);var v=x.sign();y=ne.crypto.ECDSA.asn1SigToConcatSig(v)}else{var x;if("none"!=g)(x=new m({alg:g})).init(r,s),x.updateString(_),y=x.sign()}return _+"."+fe(y)},ne.jws.JWS.verify=function(e,t,i){var r,s=ne,n=s.jws.JWS,a=n.readSafeJSONString,o=s.crypto,c=o.ECDSA,l=o.Mac,u=o.Signature;if(r=ee,!qe(e))return!1;var d=e.split(".");if(3!==d.length)return!1;var p=d[0]+"."+d[1],h=ge(d[2]),m=a(oe(d[0])),f=null,g=null;if(void 0===m.alg)throw"algorithm not specified in header";if((g=(f=m.alg).substr(0,2),null!=i&&"[object Array]"===Object.prototype.toString.call(i)&&i.length>0)&&-1==(":"+i.join(":")+":").indexOf(":"+f+":"))throw"algorithm '"+f+"' not accepted in the list";if("none"!=f&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=et.getKey(t)),!("RS"!=g&&"PS"!=g||t instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==g&&!(t instanceof c))throw"key shall be a ECDSA obj for ES* algs";var _=null;if(void 0===n.jwsalg2sigalg[m.alg])throw"unsupported alg name: "+f;if("none"==(_=n.jwsalg2sigalg[f]))throw"not supported";if("Hmac"==_.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var y=new l({alg:_,pass:t});return y.updateString(p),h==y.doFinal()}if(-1!=_.indexOf("withECDSA")){var b,v=null;try{v=c.concatSigToASN1Sig(h)}catch(e){return!1}return(b=new u({alg:_})).init(t),b.updateString(p),b.verify(v)}return(b=new u({alg:_})).init(t),b.updateString(p),b.verify(h)},ne.jws.JWS.parse=function(e){var t,i,r,s=e.split("."),n={};if(2!=s.length&&3!=s.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=s[0],i=s[1],3==s.length&&(r=s[2]),n.headerObj=ne.jws.JWS.readSafeJSONString(oe(t)),n.payloadObj=ne.jws.JWS.readSafeJSONString(oe(i)),n.headerPP=JSON.stringify(n.headerObj,null,"  "),null==n.payloadObj?n.payloadPP=oe(i):n.payloadPP=JSON.stringify(n.payloadObj,null,"  "),void 0!==r&&(n.sigHex=ge(r)),n},ne.jws.JWS.verifyJWT=function(e,t,i){var r=ne.jws,s=r.JWS,n=s.readSafeJSONString,a=s.inArray,o=s.includedArray;if(!qe(e))return!1;var c=e.split(".");if(3!=c.length)return!1;var l=c[0],u=c[1],d=(ge(c[2]),n(oe(l))),p=n(oe(u));if(void 0===d.alg)return!1;if(void 0===i.alg)throw"acceptField.alg shall be specified";if(!a(d.alg,i.alg))return!1;if(void 0!==p.iss&&"object"==typeof i.iss&&!a(p.iss,i.iss))return!1;if(void 0!==p.sub&&"object"==typeof i.sub&&!a(p.sub,i.sub))return!1;if(void 0!==p.aud&&"object"==typeof i.aud)if("string"==typeof p.aud){if(!a(p.aud,i.aud))return!1}else if("object"==typeof p.aud&&!o(p.aud,i.aud))return!1;var h=r.IntDate.getNow();return void 0!==i.verifyAt&&"number"==typeof i.verifyAt&&(h=i.verifyAt),void 0!==i.gracePeriod&&"number"==typeof i.gracePeriod||(i.gracePeriod=0),!(void 0!==p.exp&&"number"==typeof p.exp&&p.exp+i.gracePeriod<h)&&(!(void 0!==p.nbf&&"number"==typeof p.nbf&&h<p.nbf-i.gracePeriod)&&(!(void 0!==p.iat&&"number"==typeof p.iat&&h<p.iat-i.gracePeriod)&&((void 0===p.jti||void 0===i.jti||p.jti===i.jti)&&!!s.verify(e,t,i.alg))))},ne.jws.JWS.includedArray=function(e,t){var i=ne.jws.JWS.inArray;if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(!i(e[r],t))return!1;return!0},ne.jws.JWS.inArray=function(e,t){if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1},ne.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ne.jws.JWS.isSafeJSONString=function(e,t,i){var r=null;try{return"object"!=typeof(r=se(e))||r.constructor===Array?0:(t&&(t[i]=r),1)}catch(e){return 0}},ne.jws.JWS.readSafeJSONString=function(e){var t=null;try{return"object"!=typeof(t=se(e))||t.constructor===Array?null:t}catch(e){return null}},ne.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==t)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},ne.jws.JWS.getJWKthumbprint=function(e){if("RSA"!==e.kty&&"EC"!==e.kty&&"oct"!==e.kty)throw"unsupported algorithm for JWK Thumprint";var t="{";if("RSA"===e.kty){if("string"!=typeof e.n||"string"!=typeof e.e)throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if("EC"===e.kty){if("string"!=typeof e.crv||"string"!=typeof e.x||"string"!=typeof e.y)throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if("oct"===e.kty){if("string"!=typeof e.k)throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var i=xe(t);return fe(ne.crypto.Util.hashHex(i,"sha256"))},ne.jws.IntDate={},ne.jws.IntDate.get=function(e){var t=ne.jws.IntDate,i=t.getNow,r=t.getZulu;if("now"==e)return i();if("now + 1hour"==e)return i()+3600;if("now + 1day"==e)return i()+86400;if("now + 1month"==e)return i()+2592e3;if("now + 1year"==e)return i()+31536e3;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},ne.jws.IntDate.getZulu=function(e){return Pe(e)},ne.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ne.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},ne.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},void 0!==ne&&ne||(ne={}),void 0!==ne.jws&&ne.jws||(ne.jws={}),ne.jws.JWSJS=function(){var e=ne.jws.JWS,t=e.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(e){this.init();var t=e.split(".");if(3!=t.length)throw"malformed input JWS";this.aHeader.push(t[0]),this.sPayload=t[1],this.aSignature.push(t[2])},this.addSignature=function(e,t,i,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var s=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var n=ne.jws.JWS.sign(e,t,this.sPayload,i,r).split(".");n[0],n[2];this.aHeader.push(n[0]),this.aSignature.push(n[2])}catch(e){throw this.aHeader.length>s&&this.aHeader.pop(),this.aSignature.length>s&&this.aSignature.pop(),"addSignature failed: "+e}},this.verifyAll=function(e){if(this.aHeader.length!==e.length||this.aSignature.length!==e.length)return!1;for(var t=0;t<e.length;t++){var i=e[t];if(2!==i.length)return!1;if(!1===this.verifyNth(t,i[0],i[1]))return!1}return!0},this.verifyNth=function(t,i,r){if(this.aHeader.length<=t||this.aSignature.length<=t)return!1;var s=this.aHeader[t],n=this.aSignature[t],a=s+"."+this.sPayload+"."+n,o=!1;try{o=e.verify(a,i,r)}catch(e){return!1}return o},this.readJWSJS=function(e){if("string"==typeof e){var i=t(e);if(null==i)throw"argument is not safe JSON object string";this.aHeader=i.headers,this.sPayload=i.payload,this.aSignature=i.signatures}else try{if(!(e.headers.length>0))throw"malformed header";if(this.aHeader=e.headers,"string"!=typeof e.payload)throw"malformed signatures";if(this.sPayload=e.payload,!(e.signatures.length>0))throw"malformed signatures";this.aSignature=e.signatures}catch(e){throw"malformed JWS-JS JSON object: "+e}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},e.SecureRandom=X,e.rng_seed_time=Z,e.BigInteger=v,e.RSAKey=ee,e.ECDSA=ne.crypto.ECDSA,e.DSA=ne.crypto.DSA,e.Signature=ne.crypto.Signature,e.MessageDigest=ne.crypto.MessageDigest,e.Mac=ne.crypto.Mac,e.KEYUTIL=et,e.ASN1HEX=ce,e.X509=st,e.X509CRL=function(e){var t=ne.lang.String.isHex,i=ce,r=i.getV,s=i.getTLV,n=i.getVbyList,a=i.getTLVbyList,o=i.getTLVbyListEx,c=i.getIdxbyList,l=i.getIdxbyListEx,u=i.getChildIdx,d=new st;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this.parsed=null,this._setPos=function(){var e=c(this.hex,0,[0,0]),t=this.hex.substr(e,2);if("02"==t)this.posSigAlg=1;else{if("30"!=t)throw new Error("malformed 1st item of TBSCertList: "+t);this.posSigAlg=0}var i,r=c(this.hex,0,[0,this.posSigAlg+3]),s=this.hex.substr(r,2);if("17"==s||"18"==s)i=c(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,-1!=i&&"30"==this.hex.substr(i,2)&&(this.posRevCert=this.posSigAlg+4);else if("30"==s)this.posRevCert=this.posSigAlg+3;else{if("a0"!=s)throw new Error("malformed nextUpdate or revCert tag: "+s);this.posRevCert=null}},this.getVersion=function(){return 0==this.posSigAlg?null:parseInt(n(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var e=a(this.hex,0,[0,this.posSigAlg],"30");return d.getAlgorithmIdentifierName(e)},this.getIssuer=function(){return d.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return a(this.hex,0,[0,this.posSigAlg+1],"30")},this.getThisUpdate=function(){var e=n(this.hex,0,[0,this.posSigAlg+2]);return result=ve(e)},this.getNextUpdate=function(){var e=c(this.hex,0,[0,this.posSigAlg+3]),t=this.hex.substr(e,2);return"17"!=t&&"18"!=t?null:ve(r(this.hex,e))},this.getRevCertArray=function(){if(null==this.posRevCert)return null;for(var e=[],t=c(this.hex,0,[0,this.posRevCert]),i=u(this.hex,t),r=0;r<i.length;r++){var n=s(this.hex,i[r]);e.push(this.getRevCert(n))}return e},this.getRevCert=function(e){var t={},i=u(e,0);return t.sn={hex:n(e,0,[0],"02")},t.date=ve(n(e,0,[1])),3==i.length&&(t.ext=d.getExtParamArray(a(e,0,[2]))),t},this.findRevCert=function(e){var t=new st(e).getSerialNumberHex();return this.findRevCertBySN(t)},this.findRevCertBySN=function(e){if(null==this.parsed&&this.getParam(),null==this.parsed.revcert)return null;for(var t=this.parsed.revcert,i=0;i<t.length;i++)if(e==t[i].sn.hex)return t[i];return null},this.getSignatureValueHex=function(){return n(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),r=a(this.hex,0,[0],"30"),s=new ne.crypto.Signature({alg:t});return s.init(e),s.updateHex(r),s.verify(i)},this.getParam=function(e){var t={},i=this.getVersion();null!=i&&(t.version=i),t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.thisupdate=this.getThisUpdate();var r=this.getNextUpdate();null!=r&&(t.nextupdate=r);var s=this.getRevCertArray();if(null!=s&&(t.revcert=s),-1!=l(this.hex,0,[0,"[0]"])){var n=o(this.hex,0,[0,"[0]",0]);t.ext=d.getExtParamArray(n)}return t.sighex=this.getSignatureValueHex(),this.parsed=t,"object"==typeof e&&(1==e.tbshex&&(t.tbshex=a(this.hex,0,[0])),1==e.nodnarray&&delete t.issuer.array),t},"string"==typeof e&&(t(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Ae(e)),this._setPos())},e.CryptoJS=m,e.b64tohex=y,e.b64toBA=b,e.ECFieldElementFp=te,e.ECPointFp=ie,e.ECCurveFp=re,e.stoBA=le,e.BAtos=ue,e.BAtohex=de,e.stohex=pe,e.stob64=function(e){return _(pe(e))},e.stob64u=function(e){return he(_(pe(e)))},e.b64utos=function(e){return ue(b(me(e)))},e.b64tob64u=he,e.b64utob64=me,e.hex2b64=_,e.hextob64u=fe,e.b64utohex=ge,e.utf8tob64u=ae,e.b64utoutf8=oe,e.utf8tob64=function(e){return _(ke(Ue(e)))},e.b64toutf8=function(e){return decodeURIComponent(Re(y(e)))},e.utf8tohex=_e,e.hextoutf8=ye,e.hextorstr=ve,e.rstrtohex=xe,e.hextob64=Se,e.hextob64nl=function(e){return we(Se(e),64)},e.b64nltohex=Ee,e.hextopem=Ce,e.pemtohex=Ae,e.hextoArrayBuffer=function(e){if(e.length%2!=0)throw"input is not even length";if(null==e.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),i=new DataView(t),r=0;r<e.length/2;r++)i.setUint8(r,parseInt(e.substr(2*r,2),16));return t},e.ArrayBuffertohex=function(e){for(var t="",i=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+i.getUint8(r).toString(16)).slice(-2);return t},e.zulutomsec=Te,e.msectozulu=function(e){var t=new Date(e),i=("0000"+t.getUTCFullYear()).slice(-4),r=("00"+(t.getUTCMonth()+1)).slice(-2),s=("00"+t.getUTCDate()).slice(-2),n=("00"+t.getUTCHours()).slice(-2),a=("00"+t.getUTCMinutes()).slice(-2),o=("00"+t.getUTCSeconds()).slice(-2),c=("000"+t.getUTCMilliseconds()).slice(-3);return i+r+s+n+a+o+(c=""!=(c=c.replace(/0+$/,""))?"."+c:c)+"Z"},e.zulutosec=Pe,e.zulutodate=function(e){return new Date(Te(e))},e.datetozulu=function(e,t,i){var r,s=e.getUTCFullYear();if(t){if(s<1950||2049<s)throw"not proper year for UTCTime: "+s;r=(""+s).slice(-2)}else r=("000"+s).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),i){var n=e.getUTCMilliseconds();0!==n&&(r+="."+(n=(n=("00"+n).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},e.uricmptohex=ke,e.hextouricmp=Re,e.ipv6tohex=Fe,e.hextoipv6=Be,e.hextoip=Oe,e.iptohex=De,e.ucs2hextoutf8=Le,e.encodeURIComponentAll=Ue,e.newline_toUnix=function(e){return e=e.replace(/\r\n/gm,"\n")},e.newline_toDos=function(e){return e=(e=e.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},e.hextoposhex=He,e.intarystrtohex=function(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,i){var r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}},e.strdiffidx=function(e,t){var i=e.length;e.length>t.length&&(i=t.length);for(var r=0;r<i;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?i:-1},e.oidtohex=ze,e.hextooid=Ve,e.strpad=We,e.bitstrtoint=Je,e.inttobitstr=$e,e.bitstrtobinstr=Ze,e.binstrtobitstr=function(e){if("string"!=typeof e)return null;if(null==e.match(/^[01]+$/))return null;try{return $e(parseInt(e,2))}catch(e){return null}},e.isBase64URLDot=qe,e.namearraytobinstr=Ye,e.extendClass=Qe,e.foldnl=we,e.b64topem=function(e,t){return"-----BEGIN "+t+"-----\r\n"+we(e,64)+"\r\n-----END "+t+"-----\r\n"},e.pemtob64=function(e){return-1==e.indexOf("-----BEGIN ")||-1==e.indexOf("-----END ")?null:(e=(e=(e=e.replace(/^[\s\S]*?-----BEGIN [^-]+-----/m,"")).replace(/-----END [\s\S]+$/m,"")).replace(/\s+/g,"")).match(/^[0-9a-zA-Z+/=]+$/)?e:null},e.timeogen=Ie,e.aryval=Xe,e.inttohex=Ke,e.twoscompl=Ge,e.KJUR=ne,e.crypto=ne.crypto,e.asn1=ne.asn1,e.jws=ne.jws,e.lang=ne.lang,e.VERSION="11.1.0",e.VERSION_FULL="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license"}}),require_jwt_decode_cjs=__commonJS({"../../node_modules/jwt-decode/build/jwt-decode.cjs.js"(e,t){"use strict";function i(e){this.message=e}i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new i("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,s,n=0,a=0,o="";s=t.charAt(a++);~s&&(r=n%4?64*r+s:s,n++%4)?o+=String.fromCharCode(255&r>>(-2*n&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return o};function s(e){this.message=e}function n(e,t){if("string"!=typeof e)throw new s("Invalid token specified");var i=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(r(t).replace(/(.)/g,(function(e,t){var i=t.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i})))}catch(e){return r(t)}}(e.split(".")[i]))}catch(e){throw new s("Invalid token specified: "+e.message)}}s.prototype=new Error,s.prototype.name="InvalidTokenError";var a=n;a.default=n,a.InvalidTokenError=s,t.exports=a}}),require_util4=__commonJS({"../../node_modules/zod/dist/cjs/v3/helpers/util.js"(e){"use strict";var t,i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.getParsedType=e.ZodParsedType=e.objectUtil=e.util=void 0,(i=t||(e.util=t={})).assertEqual=e=>{},i.assertIs=function(e){},i.assertNever=function(e){throw new Error},i.arrayToEnum=e=>{const t={};for(const i of e)t[i]=i;return t},i.getValidEnumValues=e=>{const t=i.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const i of t)r[i]=e[i];return i.objectValues(r)},i.objectValues=e=>i.objectKeys(e).map((function(t){return e[t]})),i.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},i.find=(e,t)=>{for(const i of e)if(t(i))return i},i.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,i.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},i.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(r||(e.objectUtil=r={})).mergeShapes=(e,t)=>({...e,...t}),e.ZodParsedType=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);e.getParsedType=t=>{switch(typeof t){case"undefined":return e.ZodParsedType.undefined;case"string":return e.ZodParsedType.string;case"number":return Number.isNaN(t)?e.ZodParsedType.nan:e.ZodParsedType.number;case"boolean":return e.ZodParsedType.boolean;case"function":return e.ZodParsedType.function;case"bigint":return e.ZodParsedType.bigint;case"symbol":return e.ZodParsedType.symbol;case"object":return Array.isArray(t)?e.ZodParsedType.array:null===t?e.ZodParsedType.null:t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch?e.ZodParsedType.promise:"undefined"!=typeof Map&&t instanceof Map?e.ZodParsedType.map:"undefined"!=typeof Set&&t instanceof Set?e.ZodParsedType.set:"undefined"!=typeof Date&&t instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}}}}),require_ZodError=__commonJS({"../../node_modules/zod/dist/cjs/v3/ZodError.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZodError=e.quotelessJson=e.ZodIssueCode=void 0;var t=require_util4();e.ZodIssueCode=t.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);e.quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");var i=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},i={_errors:[]},r=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(r);else if("invalid_return_type"===s.code)r(s.returnTypeError);else if("invalid_arguments"===s.code)r(s.argumentsError);else if(0===s.path.length)i._errors.push(t(s));else{let e=i,r=0;for(;r<s.path.length;){const i=s.path[r];r===s.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(s))):e[i]=e[i]||{_errors:[]},e=e[i],r++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},i=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):i.push(e(r));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}};e.ZodError=i,i.create=e=>new i(e)}}),require_en=__commonJS({"../../node_modules/zod/dist/cjs/v3/locales/en.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_ZodError(),i=require_util4();e.default=(e,r)=>{let s;switch(e.code){case t.ZodIssueCode.invalid_type:s=e.received===i.ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case t.ZodIssueCode.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,i.util.jsonStringifyReplacer)}`;break;case t.ZodIssueCode.unrecognized_keys:s=`Unrecognized key(s) in object: ${i.util.joinValues(e.keys,", ")}`;break;case t.ZodIssueCode.invalid_union:s="Invalid input";break;case t.ZodIssueCode.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${i.util.joinValues(e.options)}`;break;case t.ZodIssueCode.invalid_enum_value:s=`Invalid enum value. Expected ${i.util.joinValues(e.options)}, received '${e.received}'`;break;case t.ZodIssueCode.invalid_arguments:s="Invalid function arguments";break;case t.ZodIssueCode.invalid_return_type:s="Invalid function return type";break;case t.ZodIssueCode.invalid_date:s="Invalid date";break;case t.ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:i.util.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case t.ZodIssueCode.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case t.ZodIssueCode.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case t.ZodIssueCode.custom:s="Invalid input";break;case t.ZodIssueCode.invalid_intersection_types:s="Intersection results could not be merged";break;case t.ZodIssueCode.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case t.ZodIssueCode.not_finite:s="Number must be finite";break;default:s=r.defaultError,i.util.assertNever(e)}return{message:s}}}}),require_errors2=__commonJS({"../../node_modules/zod/dist/cjs/v3/errors.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultErrorMap=void 0,e.setErrorMap=function(e){r=e},e.getErrorMap=function(){return r};var i=t(require_en());e.defaultErrorMap=i.default;var r=i.default}}),require_parseUtil=__commonJS({"../../node_modules/zod/dist/cjs/v3/helpers/parseUtil.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.EMPTY_PATH=e.makeIssue=void 0,e.addIssueToContext=function(t,s){const n=(0,i.getErrorMap)(),a=(0,e.makeIssue)({issueData:s,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===r.default?void 0:r.default].filter((e=>!!e))});t.common.issues.push(a)};var i=require_errors2(),r=t(require_en());e.makeIssue=e=>{const{data:t,path:i,errorMaps:r,issueData:s}=e,n=[...i,...s.path||[]],a={...s,path:n};if(void 0!==s.message)return{...s,path:n,message:s.message};let o="";const c=r.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(a,{data:t,defaultError:o}).message;return{...s,path:n,message:o}},e.EMPTY_PATH=[];e.ParseStatus=class t{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,i){const r=[];for(const s of i){if("aborted"===s.status)return e.INVALID;"dirty"===s.status&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(e,i){const r=[];for(const e of i){const t=await e.key,i=await e.value;r.push({key:t,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(t,i){const r={};for(const s of i){const{key:i,value:n}=s;if("aborted"===i.status)return e.INVALID;if("aborted"===n.status)return e.INVALID;"dirty"===i.status&&t.dirty(),"dirty"===n.status&&t.dirty(),"__proto__"===i.value||void 0===n.value&&!s.alwaysSet||(r[i.value]=n.value)}return{status:t.value,value:r}}},e.INVALID=Object.freeze({status:"aborted"});e.DIRTY=e=>({status:"dirty",value:e});e.OK=e=>({status:"valid",value:e});e.isAborted=e=>"aborted"===e.status;e.isDirty=e=>"dirty"===e.status;e.isValid=e=>"valid"===e.status;e.isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise}}),require_typeAliases=__commonJS({"../../node_modules/zod/dist/cjs/v3/helpers/typeAliases.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})}}),require_errorUtil=__commonJS({"../../node_modules/zod/dist/cjs/v3/helpers/errorUtil.js"(e){"use strict";var t,i;Object.defineProperty(e,"__esModule",{value:!0}),e.errorUtil=void 0,(i=t||(e.errorUtil=t={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},i.toString=e=>"string"==typeof e?e:e?.message}}),require_types7=__commonJS({"../../node_modules/zod/dist/cjs/v3/types.js"(e){"use strict";var t,i,r=e&&e.__classPrivateFieldGet||function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},s=e&&e.__classPrivateFieldSet||function(e,t,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,i):s?s.value=i:t.set(e,i),i};Object.defineProperty(e,"__esModule",{value:!0}),e.discriminatedUnion=e.date=e.boolean=e.bigint=e.array=e.any=e.coerce=e.ZodFirstPartyTypeKind=e.late=e.ZodSchema=e.Schema=e.ZodReadonly=e.ZodPipeline=e.ZodBranded=e.BRAND=e.ZodNaN=e.ZodCatch=e.ZodDefault=e.ZodNullable=e.ZodOptional=e.ZodTransformer=e.ZodEffects=e.ZodPromise=e.ZodNativeEnum=e.ZodEnum=e.ZodLiteral=e.ZodLazy=e.ZodFunction=e.ZodSet=e.ZodMap=e.ZodRecord=e.ZodTuple=e.ZodIntersection=e.ZodDiscriminatedUnion=e.ZodUnion=e.ZodObject=e.ZodArray=e.ZodVoid=e.ZodNever=e.ZodUnknown=e.ZodAny=e.ZodNull=e.ZodUndefined=e.ZodSymbol=e.ZodDate=e.ZodBoolean=e.ZodBigInt=e.ZodNumber=e.ZodString=e.ZodType=void 0,e.NEVER=e.void=e.unknown=e.union=e.undefined=e.tuple=e.transformer=e.symbol=e.string=e.strictObject=e.set=e.record=e.promise=e.preprocess=e.pipeline=e.ostring=e.optional=e.onumber=e.oboolean=e.object=e.number=e.nullable=e.null=e.never=e.nativeEnum=e.nan=e.map=e.literal=e.lazy=e.intersection=e.instanceof=e.function=e.enum=e.effect=void 0,e.datetimeRegex=F,e.custom=Ce;var n=require_ZodError(),a=require_errors2(),o=require_errorUtil(),c=require_parseUtil(),l=require_util4(),u=class{constructor(e,t,i,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},d=(e,t)=>{if((0,c.isValid)(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new n.ZodError(e.common.issues);return this._error=t,this._error}}};function p(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:r,description:s}=e;if(t&&(i||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{const{message:n}=e;return"invalid_enum_value"===t.code?{message:n??s.defaultError}:void 0===s.data?{message:n??r??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:n??i??s.defaultError}},description:s}}var h=class{get description(){return this._def.description}_getType(e){return(0,l.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,l.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new c.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,l.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,c.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,l.getParsedType)(e)},r=this._parseSync({data:e,path:i.path,parent:i});return d(i,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,l.getParsedType)(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return(0,c.isValid)(i)?{value:i.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>(0,c.isValid)(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,l.getParsedType)(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await((0,c.isAsync)(r)?r:Promise.resolve(r));return d(i,s)}refine(e,t){const i=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const s=e(t),a=()=>r.addIssue({code:n.ZodIssueCode.custom,...i(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(a(),!1))):!!s||(a(),!1)}))}refinement(e,t){return this._refinement(((i,r)=>!!e(i)||(r.addIssue("function"==typeof t?t(i,r):t),!1)))}_refinement(e){return new he({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return me.create(this,this._def)}nullable(){return fe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return J.create(this)}promise(){return pe.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return te.create(this,e,this._def)}transform(e){return new he({...p(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ge({...p(this._def),innerType:this,defaultValue:t,typeName:xe.ZodDefault})}brand(){return new be({typeName:xe.ZodBranded,type:this,...p(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new _e({...p(this._def),innerType:this,catchValue:t,typeName:xe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ve.create(this,e)}readonly(){return we.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};e.ZodType=h,e.Schema=h,e.ZodSchema=h;var m,f=/^c[^\s-]{8,}$/i,g=/^[0-9a-z]+$/,_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,y=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,b=/^[a-z0-9_-]{21}$/i,v=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,S=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,E=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,C=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,A=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,T=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,P=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,I="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",k=new RegExp(`^${I}$`);function R(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function F(e){let t=`${I}T${R(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function B(e,t){if(!v.test(e))return!1;try{const[i]=e.split("."),r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),s=JSON.parse(atob(r));return"object"==typeof s&&null!==s&&((!("typ"in s)||"JWT"===s?.typ)&&(!!s.alg&&(!t||s.alg===t)))}catch{return!1}}function O(e,t){return!("v4"!==t&&t||!E.test(e))||!("v6"!==t&&t||!A.test(e))}var N=class e extends h{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==l.ZodParsedType.string){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.string,received:t.parsedType}),c.INVALID}const t=new c.ParseStatus;let i;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,s=e.data.length<a.value;(r||s)&&(i=this._getOrReturnCtx(e,i),r?(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)S.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"email",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)m||(m=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),m.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"emoji",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)y.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"uuid",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)b.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"nanoid",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)f.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"cuid",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)g.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"cuid2",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)_.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"ulid",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"url",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"regex",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){F(a).test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){k.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){new RegExp(`^${R(a)}$`).test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?x.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"duration",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?(r=e.data,("v4"!==(s=a.version)&&s||!w.test(r))&&("v6"!==s&&s||!C.test(r))&&(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"ip",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty())):"jwt"===a.kind?B(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"jwt",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?O(e.data,a.version)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"cidr",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?T.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"base64",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?P.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{validation:"base64url",code:n.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):l.util.assertNever(a);var r,s;return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement((t=>e.test(t)),{validation:t,code:n.ZodIssueCode.invalid_string,...o.errorUtil.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...o.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...o.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...o.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...o.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...o.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...o.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...o.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...o.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...o.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...o.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...o.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...o.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...o.errorUtil.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...o.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...o.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...o.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...o.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...o.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...o.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...o.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...o.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...o.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...o.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,o.errorUtil.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function D(e,t){const i=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=i>r?i:r;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}e.ZodString=N,N.create=e=>new N({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...p(e)});var j=class e extends h{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==l.ZodParsedType.number){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.number,received:t.parsedType}),c.INVALID}let t;const i=new c.ParseStatus;for(const r of this._def.checks)if("int"===r.kind)l.util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty())}else"multipleOf"===r.kind?0!==D(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.not_finite,message:r.message}),i.dirty()):l.util.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,o.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,o.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,o.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,o.errorUtil.toString(t))}setLimit(t,i,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:r,message:o.errorUtil.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:o.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:o.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:o.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:o.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:o.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:o.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:o.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:o.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:o.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&l.util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}};e.ZodNumber=j,j.create=e=>new j({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...p(e)});var L=class e extends h{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==l.ZodParsedType.bigint)return this._getInvalidInput(e);let t;const i=new c.ParseStatus;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):l.util.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.bigint,received:t.parsedType}),c.INVALID}gte(e,t){return this.setLimit("min",e,!0,o.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,o.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,o.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,o.errorUtil.toString(t))}setLimit(t,i,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:r,message:o.errorUtil.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:o.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:o.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:o.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:o.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:o.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};e.ZodBigInt=L,L.create=e=>new L({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...p(e)});var U=class extends h{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==l.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.boolean,received:t.parsedType}),c.INVALID}return(0,c.OK)(e.data)}};e.ZodBoolean=U,U.create=e=>new U({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...p(e)});var M=class e extends h{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==l.ZodParsedType.date){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.date,received:t.parsedType}),c.INVALID}if(Number.isNaN(e.data.getTime())){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_date}),c.INVALID}const t=new c.ParseStatus;let i;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):l.util.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:o.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:o.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};e.ZodDate=M,M.create=e=>new M({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...p(e)});var q=class extends h{_parse(e){if(this._getType(e)!==l.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.symbol,received:t.parsedType}),c.INVALID}return(0,c.OK)(e.data)}};e.ZodSymbol=q,q.create=e=>new q({typeName:xe.ZodSymbol,...p(e)});var H=class extends h{_parse(e){if(this._getType(e)!==l.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.undefined,received:t.parsedType}),c.INVALID}return(0,c.OK)(e.data)}};e.ZodUndefined=H,H.create=e=>new H({typeName:xe.ZodUndefined,...p(e)});var z=class extends h{_parse(e){if(this._getType(e)!==l.ZodParsedType.null){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.null,received:t.parsedType}),c.INVALID}return(0,c.OK)(e.data)}};e.ZodNull=z,z.create=e=>new z({typeName:xe.ZodNull,...p(e)});var V=class extends h{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,c.OK)(e.data)}};e.ZodAny=V,V.create=e=>new V({typeName:xe.ZodAny,...p(e)});var K=class extends h{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,c.OK)(e.data)}};e.ZodUnknown=K,K.create=e=>new K({typeName:xe.ZodUnknown,...p(e)});var G=class extends h{_parse(e){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.never,received:t.parsedType}),c.INVALID}};e.ZodNever=G,G.create=e=>new G({typeName:xe.ZodNever,...p(e)});var W=class extends h{_parse(e){if(this._getType(e)!==l.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.void,received:t.parsedType}),c.INVALID}return(0,c.OK)(e.data)}};e.ZodVoid=W,W.create=e=>new W({typeName:xe.ZodVoid,...p(e)});var J=class e extends h{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),r=this._def;if(t.parsedType!==l.ZodParsedType.array)return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:t.parsedType}),c.INVALID;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&((0,c.addIssueToContext)(t,{code:e?n.ZodIssueCode.too_big:n.ZodIssueCode.too_small,minimum:s?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&((0,c.addIssueToContext)(t,{code:n.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&((0,c.addIssueToContext)(t,{code:n.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map(((e,i)=>r.type._parseAsync(new u(t,e,t.path,i))))).then((e=>c.ParseStatus.mergeArray(i,e)));const s=[...t.data].map(((e,i)=>r.type._parseSync(new u(t,e,t.path,i))));return c.ParseStatus.mergeArray(i,s)}get element(){return this._def.type}min(t,i){return new e({...this._def,minLength:{value:t,message:o.errorUtil.toString(i)}})}max(t,i){return new e({...this._def,maxLength:{value:t,message:o.errorUtil.toString(i)}})}length(t,i){return new e({...this._def,exactLength:{value:t,message:o.errorUtil.toString(i)}})}nonempty(e){return this.min(1,e)}};function $(e){if(e instanceof Z){const t={};for(const i in e.shape){const r=e.shape[i];t[i]=me.create($(r))}return new Z({...e._def,shape:()=>t})}return e instanceof J?new J({...e._def,type:$(e.element)}):e instanceof me?me.create($(e.unwrap())):e instanceof fe?fe.create($(e.unwrap())):e instanceof ie?ie.create(e.items.map((e=>$(e)))):e}e.ZodArray=J,J.create=(e,t)=>new J({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...p(t)});var Z=class e extends h{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=l.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.ZodParsedType.object){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:t.parsedType}),c.INVALID}const{status:t,ctx:i}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof G&&"strip"===this._def.unknownKeys))for(const e in i.data)s.includes(e)||a.push(e);const o=[];for(const e of s){const t=r[e],s=i.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new u(i,s,i.path,e)),alwaysSet:e in i.data})}if(this._def.catchall instanceof G){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:i.data[e]}});else if("strict"===e)a.length>0&&((0,c.addIssueToContext)(i,{code:n.ZodIssueCode.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=i.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new u(i,r,i.path,t)),alwaysSet:t in i.data})}}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const i=await t.key,r=await t.value;e.push({key:i,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>c.ParseStatus.mergeObjectSync(t,e))):c.ParseStatus.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return o.errorUtil.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,i)=>{const r=this._def.errorMap?.(e,i).message??i.defaultError;return"unrecognized_keys"===e.code?{message:o.errorUtil.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:xe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const i={};for(const e of l.util.objectKeys(t))t[e]&&this.shape[e]&&(i[e]=this.shape[e]);return new e({...this._def,shape:()=>i})}omit(t){const i={};for(const e of l.util.objectKeys(this.shape))t[e]||(i[e]=this.shape[e]);return new e({...this._def,shape:()=>i})}deepPartial(){return $(this)}partial(t){const i={};for(const e of l.util.objectKeys(this.shape)){const r=this.shape[e];t&&!t[e]?i[e]=r:i[e]=r.optional()}return new e({...this._def,shape:()=>i})}required(t){const i={};for(const e of l.util.objectKeys(this.shape))if(t&&!t[e])i[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof me;)t=t._def.innerType;i[e]=t}return new e({...this._def,shape:()=>i})}keyof(){return le(l.util.objectKeys(this.shape))}};e.ZodObject=Z,Z.create=(e,t)=>new Z({shape:()=>e,unknownKeys:"strip",catchall:G.create(),typeName:xe.ZodObject,...p(t)}),Z.strictCreate=(e,t)=>new Z({shape:()=>e,unknownKeys:"strict",catchall:G.create(),typeName:xe.ZodObject,...p(t)}),Z.lazycreate=(e,t)=>new Z({shape:e,unknownKeys:"strip",catchall:G.create(),typeName:xe.ZodObject,...p(t)});var Y=class extends h{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;if(t.common.async)return Promise.all(i.map((async e=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const i=e.map((e=>new n.ZodError(e.ctx.common.issues)));return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_union,unionErrors:i}),c.INVALID}));{let e;const r=[];for(const s of i){const i={...t,common:{...t.common,issues:[]},parent:null},n=s._parseSync({data:t.data,path:t.path,parent:i});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:i}),i.common.issues.length&&r.push(i.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=r.map((e=>new n.ZodError(e)));return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_union,unionErrors:s}),c.INVALID}}get options(){return this._def.options}};e.ZodUnion=Y,Y.create=(e,t)=>new Y({options:e,typeName:xe.ZodUnion,...p(t)});var X=e=>e instanceof oe?X(e.schema):e instanceof he?X(e.innerType()):e instanceof ce?[e.value]:e instanceof ue?e.options:e instanceof de?l.util.objectValues(e.enum):e instanceof ge?X(e._def.innerType):e instanceof H?[void 0]:e instanceof z?[null]:e instanceof me?[void 0,...X(e.unwrap())]:e instanceof fe?[null,...X(e.unwrap())]:e instanceof be||e instanceof we?X(e.unwrap()):e instanceof _e?X(e._def.innerType):[],Q=class e extends h{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.ZodParsedType.object)return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:t.parsedType}),c.INVALID;const i=this.discriminator,r=t.data[i],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):((0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),c.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,i,r){const s=new Map;for(const e of i){const i=X(e.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const r of i){if(s.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);s.set(r,e)}}return new e({typeName:xe.ZodDiscriminatedUnion,discriminator:t,options:i,optionsMap:s,...p(r)})}};function ee(e,t){const i=(0,l.getParsedType)(e),r=(0,l.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(i===l.ZodParsedType.object&&r===l.ZodParsedType.object){const i=l.util.objectKeys(t),r=l.util.objectKeys(e).filter((e=>-1!==i.indexOf(e))),s={...e,...t};for(const i of r){const r=ee(e[i],t[i]);if(!r.valid)return{valid:!1};s[i]=r.data}return{valid:!0,data:s}}if(i===l.ZodParsedType.array&&r===l.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let r=0;r<e.length;r++){const s=ee(e[r],t[r]);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}return i===l.ZodParsedType.date&&r===l.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}e.ZodDiscriminatedUnion=Q;var te=class extends h{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=(e,r)=>{if((0,c.isAborted)(e)||(0,c.isAborted)(r))return c.INVALID;const s=ee(e.value,r.value);return s.valid?(((0,c.isDirty)(e)||(0,c.isDirty)(r))&&t.dirty(),{status:t.value,value:s.data}):((0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_intersection_types}),c.INVALID)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};e.ZodIntersection=te,te.create=(e,t,i)=>new te({left:e,right:t,typeName:xe.ZodIntersection,...p(i)});var ie=class e extends h{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==l.ZodParsedType.array)return(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:i.parsedType}),c.INVALID;if(i.data.length<this._def.items.length)return(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.INVALID;!this._def.rest&&i.data.length>this._def.items.length&&((0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...i.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new u(i,e,i.path,t)):null})).filter((e=>!!e));return i.common.async?Promise.all(r).then((e=>c.ParseStatus.mergeArray(t,e))):c.ParseStatus.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};e.ZodTuple=ie,ie.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:e,typeName:xe.ZodTuple,rest:null,...p(t)})};var re=class e extends h{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==l.ZodParsedType.object)return(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:i.parsedType}),c.INVALID;const r=[],s=this._def.keyType,a=this._def.valueType;for(const e in i.data)r.push({key:s._parse(new u(i,e,i.path,e)),value:a._parse(new u(i,i.data[e],i.path,e)),alwaysSet:e in i.data});return i.common.async?c.ParseStatus.mergeObjectAsync(t,r):c.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,i,r){return new e(i instanceof h?{keyType:t,valueType:i,typeName:xe.ZodRecord,...p(r)}:{keyType:N.create(),valueType:t,typeName:xe.ZodRecord,...p(i)})}};e.ZodRecord=re;var se=class extends h{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==l.ZodParsedType.map)return(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.map,received:i.parsedType}),c.INVALID;const r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map((([e,t],n)=>({key:r._parse(new u(i,e,i.path,[n,"key"])),value:s._parse(new u(i,t,i.path,[n,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of a){const r=await i.key,s=await i.value;if("aborted"===r.status||"aborted"===s.status)return c.INVALID;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const i of a){const r=i.key,s=i.value;if("aborted"===r.status||"aborted"===s.status)return c.INVALID;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}}}};e.ZodMap=se,se.create=(e,t,i)=>new se({valueType:t,keyType:e,typeName:xe.ZodMap,...p(i)});var ne=class e extends h{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==l.ZodParsedType.set)return(0,c.addIssueToContext)(i,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.set,received:i.parsedType}),c.INVALID;const r=this._def;null!==r.minSize&&i.data.size<r.minSize.value&&((0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&i.data.size>r.maxSize.value&&((0,c.addIssueToContext)(i,{code:n.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const s=this._def.valueType;function a(e){const i=new Set;for(const r of e){if("aborted"===r.status)return c.INVALID;"dirty"===r.status&&t.dirty(),i.add(r.value)}return{status:t.value,value:i}}const o=[...i.data.values()].map(((e,t)=>s._parse(new u(i,e,i.path,t))));return i.common.async?Promise.all(o).then((e=>a(e))):a(o)}min(t,i){return new e({...this._def,minSize:{value:t,message:o.errorUtil.toString(i)}})}max(t,i){return new e({...this._def,maxSize:{value:t,message:o.errorUtil.toString(i)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};e.ZodSet=ne,ne.create=(e,t)=>new ne({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...p(t)});var ae=class e extends h{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.ZodParsedType.function)return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.function,received:t.parsedType}),c.INVALID;function i(e,i){return(0,c.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,a.getErrorMap)(),a.defaultErrorMap].filter((e=>!!e)),issueData:{code:n.ZodIssueCode.invalid_arguments,argumentsError:i}})}function r(e,i){return(0,c.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,a.getErrorMap)(),a.defaultErrorMap].filter((e=>!!e)),issueData:{code:n.ZodIssueCode.invalid_return_type,returnTypeError:i}})}const s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof pe){const e=this;return(0,c.OK)((async function(...t){const a=new n.ZodError([]),c=await e._def.args.parseAsync(t,s).catch((e=>{throw a.addIssue(i(t,e)),a})),l=await Reflect.apply(o,this,c);return await e._def.returns._def.type.parseAsync(l,s).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return(0,c.OK)((function(...t){const a=e._def.args.safeParse(t,s);if(!a.success)throw new n.ZodError([i(t,a.error)]);const c=Reflect.apply(o,this,a.data),l=e._def.returns.safeParse(c,s);if(!l.success)throw new n.ZodError([r(c,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ie.create(t).rest(K.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,i,r){return new e({args:t||ie.create([]).rest(K.create()),returns:i||K.create(),typeName:xe.ZodFunction,...p(r)})}};e.ZodFunction=ae;var oe=class extends h{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};e.ZodLazy=oe,oe.create=(e,t)=>new oe({getter:e,typeName:xe.ZodLazy,...p(t)});var ce=class extends h{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{received:t.data,code:n.ZodIssueCode.invalid_literal,expected:this._def.value}),c.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};function le(e,t){return new ue({values:e,typeName:xe.ZodEnum,...p(t)})}e.ZodLiteral=ce,ce.create=(e,t)=>new ce({value:e,typeName:xe.ZodLiteral,...p(t)});var ue=class e extends h{constructor(){super(...arguments),t.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),i=this._def.values;return(0,c.addIssueToContext)(t,{expected:l.util.joinValues(i),received:t.parsedType,code:n.ZodIssueCode.invalid_type}),c.INVALID}if(r(this,t,"f")||s(this,t,new Set(this._def.values),"f"),!r(this,t,"f").has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return(0,c.addIssueToContext)(t,{received:t.data,code:n.ZodIssueCode.invalid_enum_value,options:i}),c.INVALID}return(0,c.OK)(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,i=this._def){return e.create(t,{...this._def,...i})}exclude(t,i=this._def){return e.create(this.options.filter((e=>!t.includes(e))),{...this._def,...i})}};e.ZodEnum=ue,t=new WeakMap,ue.create=le;var de=class extends h{constructor(){super(...arguments),i.set(this,void 0)}_parse(e){const t=l.util.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==l.ZodParsedType.string&&a.parsedType!==l.ZodParsedType.number){const e=l.util.objectValues(t);return(0,c.addIssueToContext)(a,{expected:l.util.joinValues(e),received:a.parsedType,code:n.ZodIssueCode.invalid_type}),c.INVALID}if(r(this,i,"f")||s(this,i,new Set(l.util.getValidEnumValues(this._def.values)),"f"),!r(this,i,"f").has(e.data)){const e=l.util.objectValues(t);return(0,c.addIssueToContext)(a,{received:a.data,code:n.ZodIssueCode.invalid_enum_value,options:e}),c.INVALID}return(0,c.OK)(e.data)}get enum(){return this._def.values}};e.ZodNativeEnum=de,i=new WeakMap,de.create=(e,t)=>new de({values:e,typeName:xe.ZodNativeEnum,...p(t)});var pe=class extends h{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.ZodParsedType.promise&&!1===t.common.async)return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.promise,received:t.parsedType}),c.INVALID;const i=t.parsedType===l.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,c.OK)(i.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}};e.ZodPromise=pe,pe.create=(e,t)=>new pe({type:e,typeName:xe.ZodPromise,...p(t)});var he=class extends h{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:e=>{(0,c.addIssueToContext)(i,e),e.fatal?t.abort():t.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===r.type){const e=r.transform(i.data,s);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return c.INVALID;const r=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===r.status?c.INVALID:"dirty"===r.status||"dirty"===t.value?(0,c.DIRTY)(r.value):r}));{if("aborted"===t.value)return c.INVALID;const r=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===r.status?c.INVALID:"dirty"===r.status||"dirty"===t.value?(0,c.DIRTY)(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,s);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const r=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===r.status?c.INVALID:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((i=>"aborted"===i.status?c.INVALID:("dirty"===i.status&&t.dirty(),e(i.value).then((()=>({status:t.value,value:i.value}))))))}if("transform"===r.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!(0,c.isValid)(e))return e;const n=r.transform(e.value,s);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>(0,c.isValid)(e)?Promise.resolve(r.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}l.util.assertNever(r)}};e.ZodEffects=he,e.ZodTransformer=he,he.create=(e,t,i)=>new he({schema:e,typeName:xe.ZodEffects,effect:t,...p(i)}),he.createWithPreprocess=(e,t,i)=>new he({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...p(i)});var me=class extends h{_parse(e){return this._getType(e)===l.ZodParsedType.undefined?(0,c.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodOptional=me,me.create=(e,t)=>new me({innerType:e,typeName:xe.ZodOptional,...p(t)});var fe=class extends h{_parse(e){return this._getType(e)===l.ZodParsedType.null?(0,c.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodNullable=fe,fe.create=(e,t)=>new fe({innerType:e,typeName:xe.ZodNullable,...p(t)});var ge=class extends h{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===l.ZodParsedType.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};e.ZodDefault=ge,ge.create=(e,t)=>new ge({innerType:e,typeName:xe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...p(t)});var _e=class extends h{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return(0,c.isAsync)(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new n.ZodError(i.common.issues)},input:i.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new n.ZodError(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};e.ZodCatch=_e,_e.create=(e,t)=>new _e({innerType:e,typeName:xe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...p(t)});var ye=class extends h{_parse(e){if(this._getType(e)!==l.ZodParsedType.nan){const t=this._getOrReturnCtx(e);return(0,c.addIssueToContext)(t,{code:n.ZodIssueCode.invalid_type,expected:l.ZodParsedType.nan,received:t.parsedType}),c.INVALID}return{status:"valid",value:e.data}}};e.ZodNaN=ye,ye.create=e=>new ye({typeName:xe.ZodNaN,...p(e)}),e.BRAND=Symbol("zod_brand");var be=class extends h{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}};e.ZodBranded=be;var ve=class e extends h{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?c.INVALID:"dirty"===e.status?(t.dirty(),(0,c.DIRTY)(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})()}{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?c.INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(t,i){return new e({in:t,out:i,typeName:xe.ZodPipeline})}};e.ZodPipeline=ve;var xe,Se,we=class extends h{_parse(e){const t=this._def.innerType._parse(e),i=e=>((0,c.isValid)(e)&&(e.value=Object.freeze(e.value)),e);return(0,c.isAsync)(t)?t.then((e=>i(e))):i(t)}unwrap(){return this._def.innerType}};function Ee(e,t){const i="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof i?{message:i}:i}function Ce(e,t={},i){return e?V.create().superRefine(((r,s)=>{const n=e(r);if(n instanceof Promise)return n.then((e=>{if(!e){const e=Ee(t,r),n=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:n})}}));if(!n){const e=Ee(t,r),n=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:n})}})):V.create()}e.ZodReadonly=we,we.create=(e,t)=>new we({innerType:e,typeName:xe.ZodReadonly,...p(t)}),e.late={object:Z.lazycreate},(Se=xe||(e.ZodFirstPartyTypeKind=xe={})).ZodString="ZodString",Se.ZodNumber="ZodNumber",Se.ZodNaN="ZodNaN",Se.ZodBigInt="ZodBigInt",Se.ZodBoolean="ZodBoolean",Se.ZodDate="ZodDate",Se.ZodSymbol="ZodSymbol",Se.ZodUndefined="ZodUndefined",Se.ZodNull="ZodNull",Se.ZodAny="ZodAny",Se.ZodUnknown="ZodUnknown",Se.ZodNever="ZodNever",Se.ZodVoid="ZodVoid",Se.ZodArray="ZodArray",Se.ZodObject="ZodObject",Se.ZodUnion="ZodUnion",Se.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Se.ZodIntersection="ZodIntersection",Se.ZodTuple="ZodTuple",Se.ZodRecord="ZodRecord",Se.ZodMap="ZodMap",Se.ZodSet="ZodSet",Se.ZodFunction="ZodFunction",Se.ZodLazy="ZodLazy",Se.ZodLiteral="ZodLiteral",Se.ZodEnum="ZodEnum",Se.ZodEffects="ZodEffects",Se.ZodNativeEnum="ZodNativeEnum",Se.ZodOptional="ZodOptional",Se.ZodNullable="ZodNullable",Se.ZodDefault="ZodDefault",Se.ZodCatch="ZodCatch",Se.ZodPromise="ZodPromise",Se.ZodBranded="ZodBranded",Se.ZodPipeline="ZodPipeline",Se.ZodReadonly="ZodReadonly";e.instanceof=(e,t={message:`Input not instance of ${e.name}`})=>Ce((t=>t instanceof e),t);var Ae=N.create;e.string=Ae;var Te=j.create;e.number=Te;var Pe=ye.create;e.nan=Pe;var Ie=L.create;e.bigint=Ie;var ke=U.create;e.boolean=ke;var Re=M.create;e.date=Re;var Fe=q.create;e.symbol=Fe;var Be=H.create;e.undefined=Be;var Oe=z.create;e.null=Oe;var Ne=V.create;e.any=Ne;var De=K.create;e.unknown=De;var je=G.create;e.never=je;var Le=W.create;e.void=Le;var Ue=J.create;e.array=Ue;var Me=Z.create;e.object=Me;var qe=Z.strictCreate;e.strictObject=qe;var He=Y.create;e.union=He;var ze=Q.create;e.discriminatedUnion=ze;var Ve=te.create;e.intersection=Ve;var Ke=ie.create;e.tuple=Ke;var Ge=re.create;e.record=Ge;var We=se.create;e.map=We;var Je=ne.create;e.set=Je;var $e=ae.create;e.function=$e;var Ze=oe.create;e.lazy=Ze;var Ye=ce.create;e.literal=Ye;var Xe=ue.create;e.enum=Xe;var Qe=de.create;e.nativeEnum=Qe;var et=pe.create;e.promise=et;var tt=he.create;e.effect=tt,e.transformer=tt;var it=me.create;e.optional=it;var rt=fe.create;e.nullable=rt;var st=he.createWithPreprocess;e.preprocess=st;var nt=ve.create;e.pipeline=nt;e.ostring=()=>Ae().optional();e.onumber=()=>Te().optional();e.oboolean=()=>ke().optional(),e.coerce={string:e=>N.create({...e,coerce:!0}),number:e=>j.create({...e,coerce:!0}),boolean:e=>U.create({...e,coerce:!0}),bigint:e=>L.create({...e,coerce:!0}),date:e=>M.create({...e,coerce:!0})},e.NEVER=c.INVALID}}),require_external=__commonJS({"../../node_modules/zod/dist/cjs/v3/external.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(require_errors2(),e),i(require_parseUtil(),e),i(require_typeAliases(),e),i(require_util4(),e),i(require_types7(),e),i(require_ZodError(),e)}}),require_v3=__commonJS({"../../node_modules/zod/dist/cjs/v3/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&t(r,e,s);return i(r,e),r},s=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;var n=r(require_external());e.z=n,s(require_external(),e),e.default=n}}),require_cjs12=__commonJS({"../../node_modules/zod/dist/cjs/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var s=r(require_v3());i(require_v3(),e),e.default=s.default}}),require_encoder=__commonJS({"../../node_modules/@skyway-sdk/token/dist/encoder.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.SkyWayAuthToken=void 0;var i=require_dist3(),r=t(require_jsrsasign()),s=t(require_jwt_decode_cjs()),n=require_cjs12(),a=require_dist4(),o=new i.Logger("packages/token/src/encoder.ts");e.SkyWayAuthToken=class e{constructor(e){let t;try{t=a.AuthTokenSchema.parse(e)}catch(e){throw n.z.ZodError,new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:new Error("Received invalid token. Please check your SkyWayAuthToken.")})}Object.assign(this,t)}static Decode(t){try{const i=(0,s.default)(t),r=new e(i);return r.tokenString=t,r}catch(e){throw new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:e})}}encode(e){const t={jti:this.jti,iat:this.iat,exp:this.exp,scope:this.scope,version:this.version};return this.tokenString=r.default.KJUR.jws.JWS.sign("HS256",JSON.stringify({alg:"HS256",typ:"JWT"}),JSON.stringify(t),e),this.tokenString}toJSON(){return{jti:this.jti,iat:this.iat,exp:this.exp,scope:this.scope,encoded:this.tokenString,version:this.version}}getAppId(){switch(this.version){case void 0:case 1:case 2:return this.scope.app.id;case 3:return this.scope.appId;default:throw new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:new Error(`invalid token version: version ${this.version} is not supported.`)})}}getAnalyticsEnabled(){var e,t,r;switch(this.version){case void 0:case 1:case 2:return null!==(e=this.scope.app.analytics)&&void 0!==e&&e;case 3:return null===(r=null===(t=this.scope.analytics)||void 0===t?void 0:t.enabled)||void 0===r||r;default:throw new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:new Error(`invalid token version: version ${this.version} is not supported.`)})}}}}}),require_sfu=__commonJS({"../../node_modules/@skyway-sdk/token/dist/scope/sfu.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sfuScopeSchema=void 0;var t=require_cjs12(),i=t.z.object({actions:t.z.array(t.z.enum(["create","write","delete"]).refine((e=>"string"==typeof e)))}).passthrough();e.sfuScopeSchema=t.z.object({actions:t.z.array(t.z.enum(["create","write","delete"]).refine((e=>"string"==typeof e))),forwardings:t.z.array(i)}).passthrough()}}),require_v1_2=__commonJS({"../../node_modules/@skyway-sdk/token/dist/scope/v1-2.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.appScopeSchema=e.memberActions=void 0;var t=require_cjs12(),i=require_sfu(),r=t.z.object({actions:t.z.array(t.z.enum(["write","create","delete","updateMetadata","enable","disable"]).refine((e=>"string"==typeof e)))}).passthrough(),s=t.z.object({actions:t.z.array(t.z.enum(["write","create","delete"]).refine((e=>"string"==typeof e)))}).passthrough();e.memberActions=["write","create","delete","updateMetadata","signal"];var n=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),a=t.z.intersection(n,t.z.object({actions:t.z.array(t.z.enum(e.memberActions).refine((e=>"string"==typeof e))),publication:r.optional(),subscription:s.optional()}).passthrough()),o=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),c=t.z.intersection(o,t.z.object({actions:t.z.array(t.z.enum(["write","read","create","delete","updateMetadata"]).refine((e=>"string"==typeof e))),members:t.z.array(a),sfuBots:t.z.array(i.sfuScopeSchema).optional()}).passthrough());e.appScopeSchema=t.z.object({id:t.z.string(),analytics:t.z.boolean().optional(),actions:t.z.array(t.z.enum(["listChannels","read","write"]).refine((e=>"string"==typeof e))).optional(),channels:t.z.array(c).optional(),turn:t.z.boolean().optional()}).passthrough()}}),require_v32=__commonJS({"../../node_modules/@skyway-sdk/token/dist/scope/v3.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.scopeV3Schema=void 0;var t=require_cjs12(),i=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),r=t.z.intersection(i,t.z.object({methods:t.z.array(t.z.enum(["publish","subscribe","updateMetadata"]).refine((e=>"string"==typeof e)))}).passthrough()),s=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),n=t.z.intersection(s,t.z.object({methods:t.z.array(t.z.enum(["create","close","updateMetadata"]).refine((e=>"string"==typeof e))),member:r.optional(),sfu:t.z.object({enabled:t.z.boolean().optional(),maxSubscribersLimit:t.z.number().optional()}).optional()}).passthrough());e.scopeV3Schema=t.z.object({appId:t.z.string(),analytics:t.z.object({enabled:t.z.boolean().optional()}).optional(),turn:t.z.object({enabled:t.z.boolean().optional()}).optional(),rooms:t.z.array(n)}).passthrough()}}),require_token=__commonJS({"../../node_modules/@skyway-sdk/token/dist/token.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AuthTokenSchema=void 0;var t=require_cjs12(),i=require_v1_2(),r=require_v32(),s=t.z.object({jti:t.z.string().uuid(),iat:t.z.number().nonnegative(),exp:t.z.number().nonnegative()}),n=t.z.intersection(s,t.z.object({scope:t.z.object({app:i.appScopeSchema}),version:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(void 0)]).optional()})),a=t.z.intersection(s,t.z.object({scope:r.scopeV3Schema,version:t.z.literal(3)}));e.AuthTokenSchema=t.z.union([n,a])}}),require_errors3=__commonJS({"../../node_modules/@skyway-sdk/token/dist/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenErrors=void 0,e.tokenErrors={invalidParameter:{name:"invalidParameter",detail:"failed to decode token",solution:"Use the correct token according to the specification"},invalidAppIdParameter:{name:"invalidAppIdParameter",detail:"failed to get AppId",solution:"Use the correct token according to the specification"},invalidAnalyticsParameter:{name:"invalidAnalyticsParameter",detail:"failed to get analytics scope",solution:"Use the correct token according to the specification"}}}}),require_util5=__commonJS({"../../node_modules/@skyway-sdk/token/dist/util.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.nowInSec=void 0;e.nowInSec=()=>Math.floor(Date.now()/1e3)}}),require_dist4=__commonJS({"../../node_modules/@skyway-sdk/token/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.uuidV4=void 0;var r=(init_esm_node(),__toCommonJS(esm_node_exports)).v4;e.uuidV4=r,i(require_encoder(),e),i(require_sfu(),e),i(require_v1_2(),e),i(require_v32(),e),i(require_token(),e),i(require_errors3(),e),i(require_util5(),e)}});function rng2(){return poolPtr2>rnds8Pool2.length-16&&(import_crypto36.default.randomFillSync(rnds8Pool2),poolPtr2=0),rnds8Pool2.slice(poolPtr2,poolPtr2+=16)}var regex_default2,validate_default2,init_rng2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/rng.js"(){import_crypto36=__toESM(require("crypto")),rnds8Pool2=new Uint8Array(256),poolPtr2=rnds8Pool2.length}}),init_regex2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/regex.js"(){regex_default2=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}});function validate2(e){return"string"==typeof e&&regex_default2.test(e)}var byteToHex2,stringify_default2,init_validate2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/validate.js"(){init_regex2(),validate_default2=validate2}});function unsafeStringify2(e,t=0){return byteToHex2[e[t+0]]+byteToHex2[e[t+1]]+byteToHex2[e[t+2]]+byteToHex2[e[t+3]]+"-"+byteToHex2[e[t+4]]+byteToHex2[e[t+5]]+"-"+byteToHex2[e[t+6]]+byteToHex2[e[t+7]]+"-"+byteToHex2[e[t+8]]+byteToHex2[e[t+9]]+"-"+byteToHex2[e[t+10]]+byteToHex2[e[t+11]]+byteToHex2[e[t+12]]+byteToHex2[e[t+13]]+byteToHex2[e[t+14]]+byteToHex2[e[t+15]]}function stringify2(e,t=0){const i=unsafeStringify2(e,t);if(!validate_default2(i))throw TypeError("Stringified UUID is invalid");return i}var _nodeId2,_clockseq2,_lastMSecs2,_lastNSecs2,v1_default2,init_stringify2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/stringify.js"(){init_validate2(),byteToHex2=[];for(let e=0;e<256;++e)byteToHex2.push((e+256).toString(16).slice(1));stringify_default2=stringify2}});function v12(e,t,i){let r=t&&i||0;const s=t||new Array(16);let n=(e=e||{}).node||_nodeId2,a=void 0!==e.clockseq?e.clockseq:_clockseq2;if(null==n||null==a){const t=e.random||(e.rng||rng2)();null==n&&(n=_nodeId2=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==a&&(a=_clockseq2=16383&(t[6]<<8|t[7]))}let o=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:_lastNSecs2+1;const l=o-_lastMSecs2+(c-_lastNSecs2)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||o>_lastMSecs2)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs2=o,_lastNSecs2=c,_clockseq2=a,o+=122192928e5;const u=(1e4*(268435455&o)+c)%4294967296;s[r++]=u>>>24&255,s[r++]=u>>>16&255,s[r++]=u>>>8&255,s[r++]=255&u;const d=o/4294967296*1e4&268435455;s[r++]=d>>>8&255,s[r++]=255&d,s[r++]=d>>>24&15|16,s[r++]=d>>>16&255,s[r++]=a>>>8|128,s[r++]=255&a;for(let e=0;e<6;++e)s[r+e]=n[e];return t||unsafeStringify2(s)}var parse_default2,init_v12=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v1.js"(){init_rng2(),init_stringify2(),_lastMSecs2=0,_lastNSecs2=0,v1_default2=v12}});function parse12(e){if(!validate_default2(e))throw TypeError("Invalid UUID");let t;const i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}var DNS2,URL3,init_parse2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/parse.js"(){init_validate2(),parse_default2=parse12}});function stringToBytes2(e){e=unescape(encodeURIComponent(e));const t=[];for(let i=0;i<e.length;++i)t.push(e.charCodeAt(i));return t}function v352(e,t,i){function r(e,r,s,n){var a;if("string"==typeof e&&(e=stringToBytes2(e)),"string"==typeof r&&(r=parse_default2(r)),16!==(null===(a=r)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let o=new Uint8Array(16+e.length);if(o.set(r),o.set(e,r.length),o=i(o),o[6]=15&o[6]|t,o[8]=63&o[8]|128,s){n=n||0;for(let e=0;e<16;++e)s[n+e]=o[e];return s}return unsafeStringify2(o)}try{r.name=e}catch(e){}return r.DNS=DNS2,r.URL=URL3,r}var import_crypto37,md5_default2,init_v352=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v35.js"(){init_stringify2(),init_parse2(),DNS2="6ba7b810-9dad-11d1-80b4-00c04fd430c8",URL3="6ba7b811-9dad-11d1-80b4-00c04fd430c8"}});function md52(e){return Array.isArray(e)?e=Buffer.from(e):"string"==typeof e&&(e=Buffer.from(e,"utf8")),import_crypto37.default.createHash("md5").update(e).digest()}var v32,v3_default2,import_crypto38,native_default2,v4_default2,init_md52=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/md5.js"(){import_crypto37=__toESM(require("crypto")),md5_default2=md52}}),init_v32=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v3.js"(){init_v352(),init_md52(),v32=v352("v3",48,md5_default2),v3_default2=v32}}),init_native2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js"(){import_crypto38=__toESM(require("crypto")),native_default2={randomUUID:import_crypto38.default.randomUUID}}});function v42(e,t,i){if(native_default2.randomUUID&&!t&&!e)return native_default2.randomUUID();const r=(e=e||{}).random||(e.rng||rng2)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=r[e];return t}return unsafeStringify2(r)}var import_crypto39,sha1_default2,init_v42=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v4.js"(){init_native2(),init_rng2(),init_stringify2(),v4_default2=v42}});function sha12(e){return Array.isArray(e)?e=Buffer.from(e):"string"==typeof e&&(e=Buffer.from(e,"utf8")),import_crypto39.default.createHash("sha1").update(e).digest()}var v52,v5_default2,nil_default2,version_default2,init_sha12=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/sha1.js"(){import_crypto39=__toESM(require("crypto")),sha1_default2=sha12}}),init_v52=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v5.js"(){init_v352(),init_sha12(),v52=v352("v5",80,sha1_default2),v5_default2=v52}}),init_nil2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/nil.js"(){nil_default2="00000000-0000-0000-0000-000000000000"}});function version2(e){if(!validate_default2(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}var init_version2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/version.js"(){init_validate2(),version_default2=version2}}),esm_node_exports2={};__export(esm_node_exports2,{NIL:()=>nil_default2,parse:()=>parse_default2,stringify:()=>stringify_default2,v1:()=>v1_default2,v3:()=>v3_default2,v4:()=>v4_default2,v5:()=>v5_default2,validate:()=>validate_default2,version:()=>version_default2});var init_esm_node2=__esm({"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/index.js"(){init_v12(),init_v32(),init_v42(),init_v52(),init_nil2(),init_version2(),init_validate2(),init_stringify2(),init_parse2()}}),require_clientEvent=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/clientEvent.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClientEvent=void 0;var t=(init_esm_node2(),__toCommonJS(esm_node_exports2));e.ClientEvent=class{constructor(e,i={}){if(this.event=e,this.payload=i,this.eventId=(0,t.v4)(),this.data=JSON.stringify({event:this.event,eventId:this.eventId,payload:this.payload}),this.data.length>20480)throw new Error("payload size exceeds the upper limit")}}}}),require_payloadTypes=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/payloadTypes.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isMember=e.isAcknowledgePayload=e.isMessagePayload=void 0;var t=["rateLimitExceeded","targetNotFound","payloadLengthExceeded","invalidPayload","unknown","parameterError","permissionError"];function i(e){return void 0!==e&&!Array.isArray(e)&&("object"==typeof e&&("string"==typeof e.id&&(void 0===e.name||"string"==typeof e.name)))}e.isMessagePayload=function(e){return!(!e||"object"!=typeof e)&&(!!i(e.src)&&!(!e.data||"object"!=typeof e.data))},e.isAcknowledgePayload=function(e){return!(!e||"object"!=typeof e)&&("string"==typeof e.eventId&&("boolean"==typeof e.ok&&!!(void 0===e.reason||"string"==typeof e.reason&&t.includes(e.reason))))},e.isMember=i}}),require_constants=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/constants.js"(e,t){"use strict";var i=["nodebuffer","arraybuffer","fragments"],r="undefined"!=typeof Blob;r&&i.push("blob"),t.exports={BINARY_TYPES:i,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:r,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}}}),require_buffer_util=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/buffer-util.js"(e,t){"use strict";var{EMPTY_BUFFER:i}=require_constants(),r=Buffer[Symbol.species];function s(e,t,i,r,s){for(let n=0;n<s;n++)i[r+n]=e[n]^t[3&n]}function n(e,t){for(let i=0;i<e.length;i++)e[i]^=t[3&i]}if(t.exports={concat:function(e,t){if(0===e.length)return i;if(1===e.length)return e[0];const s=Buffer.allocUnsafe(t);let n=0;for(let t=0;t<e.length;t++){const i=e[t];s.set(i,n),n+=i.length}return n<t?new r(s.buffer,s.byteOffset,n):s},mask:s,toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:function e(t){if(e.readOnly=!0,Buffer.isBuffer(t))return t;let i;return t instanceof ArrayBuffer?i=new r(t):ArrayBuffer.isView(t)?i=new r(t.buffer,t.byteOffset,t.byteLength):(i=Buffer.from(t),e.readOnly=!1),i},unmask:n},!process.env.WS_NO_BUFFER_UTIL)try{const e=require("bufferutil");t.exports.mask=function(t,i,r,n,a){a<48?s(t,i,r,n,a):e.mask(t,i,r,n,a)},t.exports.unmask=function(t,i){t.length<32?n(t,i):e.unmask(t,i)}}catch(e){}}}),require_limiter=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/limiter.js"(e,t){"use strict";var i=Symbol("kDone"),r=Symbol("kRun");t.exports=class{constructor(e){this[i]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[i])}}}}}),require_permessage_deflate=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/permessage-deflate.js"(e,t){"use strict";var i,r=require("zlib"),s=require_buffer_util(),n=require_limiter(),{kStatusCode:a}=require_constants(),o=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol("permessage-deflate"),u=Symbol("total-length"),d=Symbol("callback"),p=Symbol("buffers"),h=Symbol("error");function m(e){this[p].push(e),this[u]+=e.length}function f(e){this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload?this[p].push(e):(this[h]=new RangeError("Max payload size exceeded"),this[h].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[h][a]=1009,this.removeListener("data",f),this.reset())}function g(e){this[l]._inflate=null,this[h]?this[d](this[h]):(e[a]=1007,this[d](e))}t.exports=class{constructor(e,t,r){if(this._maxPayload=0|r,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!i){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;i=new n(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,i=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!i)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(i.server_no_context_takeover=!0),t.clientNoContextTakeover&&(i.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(i.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?i.client_max_window_bits=t.clientMaxWindowBits:!0!==i.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete i.client_max_window_bits,i}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let i=e[t];if(i.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(i=i[0],"client_max_window_bits"===t){if(!0!==i){const e=+i;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${i}`);i=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${i}`)}else if("server_max_window_bits"===t){const e=+i;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${i}`);i=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==i)throw new TypeError(`Invalid value for parameter "${t}": ${i}`)}e[t]=i}))})),e}decompress(e,t,r){i.add((i=>{this._decompress(e,t,((e,t)=>{i(),r(e,t)}))}))}compress(e,t,r){i.add((i=>{this._compress(e,t,((e,t)=>{i(),r(e,t)}))}))}_decompress(e,t,i){const n=this._isServer?"client":"server";if(!this._inflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[p]=[],this._inflate.on("error",g),this._inflate.on("data",f)}this._inflate[d]=i,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush((()=>{const e=this._inflate[h];if(e)return this._inflate.close(),this._inflate=null,void i(e);const r=s.concat(this._inflate[p],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[p]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),i(null,r)}))}_compress(e,t,i){const n=this._isServer?"server":"client";if(!this._deflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[p]=[],this._deflate.on("data",m)}this._deflate[d]=i,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=s.concat(this._deflate[p],this._deflate[u]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[p]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),i(null,e)}))}}}}),require_validation=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/validation.js"(e,t){"use strict";var{isUtf8:i}=require("buffer"),{hasBlob:r}=require_constants();function s(e){const t=e.length;let i=0;for(;i<t;)if(128&e[i])if(192==(224&e[i])){if(i+1===t||128!=(192&e[i+1])||192==(254&e[i]))return!1;i+=2}else if(224==(240&e[i])){if(i+2>=t||128!=(192&e[i+1])||128!=(192&e[i+2])||224===e[i]&&128==(224&e[i+1])||237===e[i]&&160==(224&e[i+1]))return!1;i+=3}else{if(240!=(248&e[i]))return!1;if(i+3>=t||128!=(192&e[i+1])||128!=(192&e[i+2])||128!=(192&e[i+3])||240===e[i]&&128==(240&e[i+1])||244===e[i]&&e[i+1]>143||e[i]>244)return!1;i+=4}else i++;return!0}if(t.exports={isBlob:function(e){return r&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:s,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},i)t.exports.isValidUTF8=function(e){return e.length<24?s(e):i(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{const e=require("utf-8-validate");t.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch(e){}}}),require_receiver=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/receiver.js"(e,t){"use strict";var{Writable:i}=require("stream"),r=require_permessage_deflate(),{BINARY_TYPES:s,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:o}=require_constants(),{concat:c,toArrayBuffer:l,unmask:u}=require_buffer_util(),{isValidStatusCode:d,isValidUTF8:p}=require_validation(),h=Buffer[Symbol.species];t.exports=class extends i{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||s[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[o]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,i){if(8===this._opcode&&0==this._state)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=new h(t.buffer,t.byteOffset+e,t.length-e),new h(t.buffer,t.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const i=this._buffers[0],r=t.length-e;e>=i.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(i.buffer,i.byteOffset,e),r),this._buffers[0]=new h(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return t}startLoop(e){this._loop=!0;do{switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:return void(this._loop=!1)}}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(48&t[0]){return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"))}const i=!(64&~t[0]);if(!i||this._extensions[r.extensionName]){if(this._fin=!(128&~t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(i){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(!this._fragmented){return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"))}this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented){return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}this._compressed=i}else{if(!(this._opcode>7&&this._opcode<11)){return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}if(!this._fin){return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"))}if(i){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength){return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=!(128&~t[1]),this._isServer){if(!this._masked){return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}}else if(this._masked){return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"))}126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}else{e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}}getPayloadLength16(e){this._bufferedBytes<2?this._loop=!1:(this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e))}getPayloadLength64(e){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),i=t.readUInt32BE(0);if(i>Math.pow(2,21)-1){e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"))}else this._payloadLength=i*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"))}else this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&u(t,this._mask)}if(this._opcode>7)this.controlMessage(t,e);else{if(this._compressed)return this._state=5,void this.decompress(t,e);t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,((e,i)=>{if(e)return t(e);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){const e=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");return void t(e)}this._fragments.push(i)}this.dataMessage(t),0===this._state&&this.startLoop(t)}))}dataMessage(e){if(!this._fin)return void(this._state=0);const t=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?c(i,t):"arraybuffer"===this._binaryType?l(c(i,t)):"blob"===this._binaryType?new Blob(i):i,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=0):(this._state=6,setImmediate((()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)})))}else{const r=c(i,t);if(!this._skipUTF8Validation&&!p(r)){const t=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void e(t)}5===this._state||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=0):(this._state=6,setImmediate((()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)})))}}controlMessage(e,t){if(8!==this._opcode)this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate((()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)})));else{if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{const i=e.readUInt16BE(0);if(!d(i)){const e=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");return void t(e)}const r=new h(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){const e=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void t(e)}this._loop=!1,this.emit("conclude",i,r),this.end()}this._state=0}}createError(e,t,i,r,s){this._loop=!1,this._errored=!0;const n=new e(i?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(n,this.createError),n.code=s,n[a]=r,n}}}}),require_sender=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/sender.js"(e,t){"use strict";var i,{Duplex:r}=require("stream"),{randomFillSync:s}=require("crypto"),n=require_permessage_deflate(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:c}=require_constants(),{isBlob:l,isValidStatusCode:u}=require_validation(),{mask:d,toBuffer:p}=require_buffer_util(),h=Symbol("kByteLength"),m=Buffer.alloc(4),f=8192,g=f;function _(e,t,i){"function"==typeof i&&i(t);for(let i=0;i<e._queue.length;i++){const r=e._queue[i],s=r[r.length-1];"function"==typeof s&&s(t)}}function y(e,t,i){_(e,t,i),e.onerror(t)}t.exports=class e{constructor(e,t,i){this._extensions=t||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=c,this[o]=void 0}static frame(e,t){let r,n,a=!1,o=2,c=!1;t.mask&&(r=t.maskBuffer||m,t.generateMask?t.generateMask(r):(g===f&&(void 0===i&&(i=Buffer.alloc(f)),s(i,0,f),g=0),r[0]=i[g++],r[1]=i[g++],r[2]=i[g++],r[3]=i[g++]),c=!(r[0]|r[1]|r[2]|r[3]),o=6),"string"==typeof e?n=t.mask&&!c||void 0===t[h]?(e=Buffer.from(e)).length:t[h]:(n=e.length,a=t.mask&&t.readOnly&&!c);let l=n;n>=65536?(o+=8,l=127):n>125&&(o+=2,l=126);const u=Buffer.allocUnsafe(a?n+o:o);return u[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(u[0]|=64),u[1]=l,126===l?u.writeUInt16BE(n,2):127===l&&(u[2]=u[3]=0,u.writeUIntBE(n,4,6)),t.mask?(u[1]|=128,u[o-4]=r[0],u[o-3]=r[1],u[o-2]=r[2],u[o-1]=r[3],c?[u,e]:a?(d(e,r,u,o,n),[u]):(d(e,r,e,0,n),[u,e])):[u,e]}close(t,i,r,s){let n;if(void 0===t)n=a;else{if("number"!=typeof t||!u(t))throw new TypeError("First argument must be a valid error code number");if(void 0!==i&&i.length){const e=Buffer.byteLength(i);if(e>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+e),n.writeUInt16BE(t,0),"string"==typeof i?n.write(i,2):n.set(i,2)}else n=Buffer.allocUnsafe(2),n.writeUInt16BE(t,0)}const o={[h]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(e.frame(n,o),s)}ping(t,i,r){let s,n;if("string"==typeof t?(s=Buffer.byteLength(t),n=!1):l(t)?(s=t.size,n=!1):(s=(t=p(t)).length,n=p.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");const a={[h]:s,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};l(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,a,r]):this.getBlobData(t,!1,a,r):0!==this._state?this.enqueue([this.dispatch,t,!1,a,r]):this.sendFrame(e.frame(t,a),r)}pong(t,i,r){let s,n;if("string"==typeof t?(s=Buffer.byteLength(t),n=!1):l(t)?(s=t.size,n=!1):(s=(t=p(t)).length,n=p.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");const a={[h]:s,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};l(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,a,r]):this.getBlobData(t,!1,a,r):0!==this._state?this.enqueue([this.dispatch,t,!1,a,r]):this.sendFrame(e.frame(t,a),r)}send(e,t,i){const r=this._extensions[n.extensionName];let s,a,o=t.binary?2:1,c=t.compress;"string"==typeof e?(s=Buffer.byteLength(e),a=!1):l(e)?(s=e.size,a=!1):(s=(e=p(e)).length,a=p.readOnly),this._firstFragment?(this._firstFragment=!1,c&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(c=s>=r._threshold),this._compress=c):(c=!1,o=0),t.fin&&(this._firstFragment=!0);const u={[h]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:a,rsv1:c};l(e)?0!==this._state?this.enqueue([this.getBlobData,e,this._compress,u,i]):this.getBlobData(e,this._compress,u,i):0!==this._state?this.enqueue([this.dispatch,e,this._compress,u,i]):this.dispatch(e,this._compress,u,i)}getBlobData(t,i,r,s){this._bufferedBytes+=r[h],this._state=2,t.arrayBuffer().then((t=>{if(this._socket.destroyed){const e=new Error("The socket was closed while the blob was being read");return void process.nextTick(_,this,e,s)}this._bufferedBytes-=r[h];const n=p(t);i?this.dispatch(n,i,r,s):(this._state=0,this.sendFrame(e.frame(n,r),s),this.dequeue())})).catch((e=>{process.nextTick(y,this,e,s)}))}dispatch(t,i,r,s){if(!i)return void this.sendFrame(e.frame(t,r),s);const a=this._extensions[n.extensionName];this._bufferedBytes+=r[h],this._state=1,a.compress(t,r.fin,((t,i)=>{if(this._socket.destroyed){_(this,new Error("The socket was closed while data was being compressed"),s)}else this._bufferedBytes-=r[h],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(i,r),s),this.dequeue()}))}dequeue(){for(;0===this._state&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[3][h],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][h],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}}}),require_event_target=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/event-target.js"(e,t){"use strict";var{kForOnEventAttribute:i,kListener:r}=require_constants(),s=Symbol("kCode"),n=Symbol("kData"),a=Symbol("kError"),o=Symbol("kMessage"),c=Symbol("kReason"),l=Symbol("kTarget"),u=Symbol("kType"),d=Symbol("kWasClean"),p=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(p.prototype,"target",{enumerable:!0}),Object.defineProperty(p.prototype,"type",{enumerable:!0});var h=class extends p{constructor(e,t={}){super(e),this[s]=void 0===t.code?0:t.code,this[c]=void 0===t.reason?"":t.reason,this[d]=void 0!==t.wasClean&&t.wasClean}get code(){return this[s]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(h.prototype,"code",{enumerable:!0}),Object.defineProperty(h.prototype,"reason",{enumerable:!0}),Object.defineProperty(h.prototype,"wasClean",{enumerable:!0});var m=class extends p{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[o]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[o]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var f=class extends p{constructor(e,t={}){super(e),this[n]=void 0===t.data?null:t.data}get data(){return this[n]}};Object.defineProperty(f.prototype,"data",{enumerable:!0});var g={addEventListener(e,t,s={}){for(const n of this.listeners(e))if(!s[i]&&n[r]===t&&!n[i])return;let n;if("message"===e)n=function(e,i){const r=new f("message",{data:i?e:e.toString()});r[l]=this,_(t,this,r)};else if("close"===e)n=function(e,i){const r=new h("close",{code:e,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,_(t,this,r)};else if("error"===e)n=function(e){const i=new m("error",{error:e,message:e.message});i[l]=this,_(t,this,i)};else{if("open"!==e)return;n=function(){const e=new p("open");e[l]=this,_(t,this,e)}}n[i]=!!s[i],n[r]=t,s.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(const s of this.listeners(e))if(s[r]===t&&!s[i]){this.removeListener(e,s);break}}};function _(e,t,i){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,i):e.call(t,i)}t.exports={CloseEvent:h,ErrorEvent:m,Event:p,EventTarget:g,MessageEvent:f}}}),require_extension2=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/extension.js"(e,t){"use strict";var{tokenChars:i}=require_validation();function r(e,t,i){void 0===e[t]?e[t]=[i]:e[t].push(i)}t.exports={format:function(e){return Object.keys(e).map((t=>{let i=e[t];return Array.isArray(i)||(i=[i]),i.map((e=>[t].concat(Object.keys(e).map((t=>{let i=e[t];return Array.isArray(i)||(i=[i]),i.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const t=Object.create(null);let s,n,a=Object.create(null),o=!1,c=!1,l=!1,u=-1,d=-1,p=-1,h=0;for(;h<e.length;h++)if(d=e.charCodeAt(h),void 0===s)if(-1===p&&1===i[d])-1===u&&(u=h);else if(0===h||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${h}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${h}`);-1===p&&(p=h);const i=e.slice(u,p);44===d?(r(t,i,a),a=Object.create(null)):s=i,u=p=-1}}else-1===p&&-1!==u&&(p=h);else if(void 0===n)if(-1===p&&1===i[d])-1===u&&(u=h);else if(32===d||9===d)-1===p&&-1!==u&&(p=h);else if(59===d||44===d){if(-1===u)throw new SyntaxError(`Unexpected character at index ${h}`);-1===p&&(p=h),r(a,e.slice(u,p),!0),44===d&&(r(t,s,a),a=Object.create(null),s=void 0),u=p=-1}else{if(61!==d||-1===u||-1!==p)throw new SyntaxError(`Unexpected character at index ${h}`);n=e.slice(u,h),u=p=-1}else if(c){if(1!==i[d])throw new SyntaxError(`Unexpected character at index ${h}`);-1===u?u=h:o||(o=!0),c=!1}else if(l)if(1===i[d])-1===u&&(u=h);else if(34===d&&-1!==u)l=!1,p=h;else{if(92!==d)throw new SyntaxError(`Unexpected character at index ${h}`);c=!0}else if(34===d&&61===e.charCodeAt(h-1))l=!0;else if(-1===p&&1===i[d])-1===u&&(u=h);else if(-1===u||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${h}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${h}`);-1===p&&(p=h);let i=e.slice(u,p);o&&(i=i.replace(/\\/g,""),o=!1),r(a,n,i),44===d&&(r(t,s,a),a=Object.create(null),s=void 0),n=void 0,u=p=-1}}else-1===p&&(p=h);if(-1===u||l||32===d||9===d)throw new SyntaxError("Unexpected end of input");-1===p&&(p=h);const m=e.slice(u,p);return void 0===s?r(t,m,a):(void 0===n?r(a,m,!0):r(a,n,o?m.replace(/\\/g,""):m),r(t,s,a)),t}}}}),require_websocket=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/websocket.js"(e,t){"use strict";var i=require("events"),r=require("https"),s=require("http"),n=require("net"),a=require("tls"),{randomBytes:o,createHash:c}=require("crypto"),{Duplex:l,Readable:u}=require("stream"),{URL:d}=require("url"),p=require_permessage_deflate(),h=require_receiver(),m=require_sender(),{isBlob:f}=require_validation(),{BINARY_TYPES:g,EMPTY_BUFFER:_,GUID:y,kForOnEventAttribute:b,kListener:v,kStatusCode:x,kWebSocket:S,NOOP:w}=require_constants(),{EventTarget:{addEventListener:E,removeEventListener:C}}=require_event_target(),{format:A,parse:T}=require_extension2(),{toBuffer:P}=require_buffer_util(),I=Symbol("kAborted"),k=[8,13],R=["CONNECTING","OPEN","CLOSING","CLOSED"],F=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,B=class e extends i{constructor(t,i,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=_,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==t?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===i?i=[]:Array.isArray(i)||("object"==typeof i&&null!==i?(r=i,i=[]):i=[i]),O(this,t,i,r)):(this._autoPong=r.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,i,r){const s=new h({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),n=new m(t,this._extensions,r.generateMask);this._receiver=s,this._sender=n,this._socket=t,s[S]=this,n[S]=this,t[S]=this,s.on("conclude",M),s.on("drain",q),s.on("error",H),s.on("message",V),s.on("ping",K),s.on("pong",G),n.onerror=J,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),i.length>0&&t.unshift(i),t.on("close",Z),t.on("data",Y),t.on("end",X),t.on("error",Q),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=e.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,i){if(this.readyState!==e.CLOSED)if(this.readyState!==e.CONNECTING)this.readyState!==e.CLOSING?(this._readyState=e.CLOSING,this._sender.close(t,i,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),$(this)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();else{const e="WebSocket was closed before the connection was established";L(this,this._req,e)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,i,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(r=t,t=i=void 0):"function"==typeof i&&(r=i,i=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===e.OPEN?(void 0===i&&(i=!this._isServer),this._sender.ping(t||_,i,r)):U(this,t,r)}pong(t,i,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(r=t,t=i=void 0):"function"==typeof i&&(r=i,i=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===e.OPEN?(void 0===i&&(i=!this._isServer),this._sender.pong(t||_,i,r)):U(this,t,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,i,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof i&&(r=i,i={}),"number"==typeof t&&(t=t.toString()),this.readyState!==e.OPEN)return void U(this,t,r);const s={binary:"string"!=typeof t,mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[p.extensionName]||(s.compress=!1),this._sender.send(t||_,s,r)}terminate(){if(this.readyState!==e.CLOSED)if(this.readyState!==e.CONNECTING)this._socket&&(this._readyState=e.CLOSING,this._socket.destroy());else{const e="WebSocket was closed before the connection was established";L(this,this._req,e)}}};function O(e,t,i,n){const a={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:k[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=a.autoPong,!k.includes(a.protocolVersion))throw new RangeError(`Unsupported protocol version: ${a.protocolVersion} (supported versions: ${k.join(", ")})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}"http:"===l.protocol?l.protocol="ws:":"https:"===l.protocol&&(l.protocol="wss:"),e._url=l.href;const u="wss:"===l.protocol,h="ws+unix:"===l.protocol;let m;if("ws:"===l.protocol||u||h?h&&!l.pathname?m="The URL's pathname is empty":l.hash&&(m="The URL contains a fragment identifier"):m='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',m){const t=new SyntaxError(m);if(0===e._redirects)throw t;return void N(e,t)}const f=u?443:80,g=o(16).toString("base64"),_=u?r.request:s.request,b=new Set;let v,x;if(a.createConnection=a.createConnection||(u?j:D),a.defaultPort=a.defaultPort||f,a.port=l.port||f,a.host=l.hostname.startsWith("[")?l.hostname.slice(1,-1):l.hostname,a.headers={...a.headers,"Sec-WebSocket-Version":a.protocolVersion,"Sec-WebSocket-Key":g,Connection:"Upgrade",Upgrade:"websocket"},a.path=l.pathname+l.search,a.timeout=a.handshakeTimeout,a.perMessageDeflate&&(v=new p(!0!==a.perMessageDeflate?a.perMessageDeflate:{},!1,a.maxPayload),a.headers["Sec-WebSocket-Extensions"]=A({[p.extensionName]:v.offer()})),i.length){for(const e of i){if("string"!=typeof e||!F.test(e)||b.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");b.add(e)}a.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(a.origin&&(a.protocolVersion<13?a.headers["Sec-WebSocket-Origin"]=a.origin:a.headers.Origin=a.origin),(l.username||l.password)&&(a.auth=`${l.username}:${l.password}`),h){const e=a.path.split(":");a.socketPath=e[0],a.path=e[1]}if(a.followRedirects){if(0===e._redirects){e._originalIpc=h,e._originalSecure=u,e._originalHostOrSocketPath=h?a.socketPath:l.host;const t=n&&n.headers;if(n={...n,headers:{}},t)for(const[e,i]of Object.entries(t))n.headers[e.toLowerCase()]=i}else if(0===e.listenerCount("redirect")){const t=h?!!e._originalIpc&&a.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete a.headers.authorization,delete a.headers.cookie,t||delete a.headers.host,a.auth=void 0)}a.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(a.auth).toString("base64")),x=e._req=_(a),e._redirects&&e.emit("redirect",e.url,x)}else x=e._req=_(a);a.timeout&&x.on("timeout",(()=>{L(e,x,"Opening handshake has timed out")})),x.on("error",(t=>{null===x||x[I]||(x=e._req=null,N(e,t))})),x.on("response",(r=>{const s=r.headers.location,o=r.statusCode;if(s&&a.followRedirects&&o>=300&&o<400){if(++e._redirects>a.maxRedirects)return void L(e,x,"Maximum redirects exceeded");let r;x.abort();try{r=new d(s,t)}catch(t){const i=new SyntaxError(`Invalid URL: ${s}`);return void N(e,i)}O(e,r,i,n)}else e.emit("unexpected-response",x,r)||L(e,x,`Unexpected server response: ${r.statusCode}`)})),x.on("upgrade",((t,i,r)=>{if(e.emit("upgrade",t),e.readyState!==B.CONNECTING)return;x=e._req=null;const s=t.headers.upgrade;if(void 0===s||"websocket"!==s.toLowerCase())return void L(e,i,"Invalid Upgrade header");const n=c("sha1").update(g+y).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void L(e,i,"Invalid Sec-WebSocket-Accept header");const o=t.headers["sec-websocket-protocol"];let l;if(void 0!==o?b.size?b.has(o)||(l="Server sent an invalid subprotocol"):l="Server sent a subprotocol but none was requested":b.size&&(l="Server sent no subprotocol"),l)return void L(e,i,l);o&&(e._protocol=o);const u=t.headers["sec-websocket-extensions"];if(void 0!==u){if(!v){return void L(e,i,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let t;try{t=T(u)}catch(t){return void L(e,i,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(1!==r.length||r[0]!==p.extensionName){return void L(e,i,"Server indicated an extension that was not requested")}try{v.accept(t[p.extensionName])}catch(t){return void L(e,i,"Invalid Sec-WebSocket-Extensions header")}e._extensions[p.extensionName]=v}e.setSocket(i,r,{allowSynchronousEvents:a.allowSynchronousEvents,generateMask:a.generateMask,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation})})),a.finishRequest?a.finishRequest(x,e):x.end()}function N(e,t){e._readyState=B.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function D(e){return e.path=e.socketPath,n.connect(e)}function j(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function L(e,t,i){e._readyState=B.CLOSING;const r=new Error(i);Error.captureStackTrace(r,L),t.setHeader?(t[I]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(N,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function U(e,t,i){if(t){const i=f(t)?t.size:P(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(i){const t=new Error(`WebSocket is not open: readyState ${e.readyState} (${R[e.readyState]})`);process.nextTick(i,t)}}function M(e,t){const i=this[S];i._closeFrameReceived=!0,i._closeMessage=t,i._closeCode=e,void 0!==i._socket[S]&&(i._socket.removeListener("data",Y),process.nextTick(W,i._socket),1005===e?i.close():i.close(e,t))}function q(){const e=this[S];e.isPaused||e._socket.resume()}function H(e){const t=this[S];void 0!==t._socket[S]&&(t._socket.removeListener("data",Y),process.nextTick(W,t._socket),t.close(e[x])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function z(){this[S].emitClose()}function V(e,t){this[S].emit("message",e,t)}function K(e){const t=this[S];t._autoPong&&t.pong(e,!this._isServer,w),t.emit("ping",e)}function G(e){this[S].emit("pong",e)}function W(e){e.resume()}function J(e){const t=this[S];t.readyState!==B.CLOSED&&(t.readyState===B.OPEN&&(t._readyState=B.CLOSING,$(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function $(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),3e4)}function Z(){const e=this[S];let t;this.removeListener("close",Z),this.removeListener("data",Y),this.removeListener("end",X),e._readyState=B.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[S]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",z),e._receiver.on("finish",z))}function Y(e){this[S]._receiver.write(e)||this.pause()}function X(){const e=this[S];e._readyState=B.CLOSING,e._receiver.end(),this.end()}function Q(){const e=this[S];this.removeListener("error",Q),this.on("error",w),e&&(e._readyState=B.CLOSING,this.destroy())}Object.defineProperty(B,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(B.prototype,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(B,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(B.prototype,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(B,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(B.prototype,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(B,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),Object.defineProperty(B.prototype,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(B.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(B.prototype,`on${e}`,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[b])return t[v];return null},set(t){for(const t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[b]:!0})}})})),B.prototype.addEventListener=E,B.prototype.removeEventListener=C,t.exports=B}}),require_stream=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/stream.js"(e,t){"use strict";require_websocket();var{Duplex:i}=require("stream");function r(e){e.emit("close")}function s(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}t.exports=function(e,t){let a=!0;const o=new i({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,i){const r=!i&&o._readableState.objectMode?t.toString():t;o.push(r)||e.pause()})),e.once("error",(function(e){o.destroyed||(a=!1,o.destroy(e))})),e.once("close",(function(){o.destroyed||o.push(null)})),o._destroy=function(t,i){if(e.readyState===e.CLOSED)return i(t),void process.nextTick(r,o);let s=!1;e.once("error",(function(e){s=!0,i(e)})),e.once("close",(function(){s||i(t),process.nextTick(r,o)})),a&&e.terminate()},o._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),o._readableState.endEmitted&&o.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){o._final(t)}))},o._read=function(){e.isPaused&&e.resume()},o._write=function(t,i,r){e.readyState!==e.CONNECTING?e.send(t,r):e.once("open",(function(){o._write(t,i,r)}))},o.on("end",s),o.on("error",n),o}}}),require_subprotocol=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/subprotocol.js"(e,t){"use strict";var{tokenChars:i}=require_validation();t.exports={parse:function(e){const t=new Set;let r=-1,s=-1,n=0;for(;n<e.length;n++){const a=e.charCodeAt(n);if(-1===s&&1===i[a])-1===r&&(r=n);else if(0===n||32!==a&&9!==a){if(44!==a)throw new SyntaxError(`Unexpected character at index ${n}`);{if(-1===r)throw new SyntaxError(`Unexpected character at index ${n}`);-1===s&&(s=n);const i=e.slice(r,s);if(t.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);t.add(i),r=s=-1}}else-1===s&&-1!==r&&(s=n)}if(-1===r||-1!==s)throw new SyntaxError("Unexpected end of input");const a=e.slice(r,n);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}}}}),require_websocket_server=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/lib/websocket-server.js"(e,t){"use strict";var i=require("events"),r=require("http"),{Duplex:s}=require("stream"),{createHash:n}=require("crypto"),a=require_extension2(),o=require_permessage_deflate(),c=require_subprotocol(),l=require_websocket(),{GUID:u,kWebSocket:d}=require_constants(),p=/^[+/0-9A-Za-z]{22}==$/;function h(e){e._state=2,e.emit("close")}function m(){this.destroy()}function f(e,t,i,s){i=i||r.STATUS_CODES[t],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...s},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(s).map((e=>`${e}: ${s[e]}`)).join("\r\n")+"\r\n\r\n"+i)}function g(e,t,i,r,s){if(e.listenerCount("wsClientError")){const r=new Error(s);Error.captureStackTrace(r,g),e.emit("wsClientError",r,i,t)}else f(i,r,s)}t.exports=class extends i{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=r.createServer(((e,t)=>{const i=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),t.end(i)})),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const i of Object.keys(t))e.on(i,t[i]);return function(){for(const i of Object.keys(t))e.removeListener(i,t[i])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,i,r)=>{this.handleUpgrade(t,i,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state)return e&&this.once("close",(()=>{e(new Error("The server is not running"))})),void process.nextTick(h,this);if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close((()=>{h(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,i,r){t.on("error",m);const s=e.headers["sec-websocket-key"],n=e.headers.upgrade,l=+e.headers["sec-websocket-version"];if("GET"!==e.method){return void g(this,e,t,405,"Invalid HTTP method")}if(void 0===n||"websocket"!==n.toLowerCase()){return void g(this,e,t,400,"Invalid Upgrade header")}if(void 0===s||!p.test(s)){return void g(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header")}if(8!==l&&13!==l){return void g(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header")}if(!this.shouldHandle(e))return void f(t,400);const u=e.headers["sec-websocket-protocol"];let d=new Set;if(void 0!==u)try{d=c.parse(u)}catch(i){return void g(this,e,t,400,"Invalid Sec-WebSocket-Protocol header")}const h=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&void 0!==h){const i=new o(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const e=a.parse(h);e[o.extensionName]&&(i.accept(e[o.extensionName]),_[o.extensionName]=i)}catch(i){return void g(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}if(this.options.verifyClient){const n={origin:e.headers[""+(8===l?"sec-websocket-origin":"origin")],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(n,((n,a,o,c)=>{if(!n)return f(t,a||401,o,c);this.completeUpgrade(_,s,d,e,t,i,r)}));if(!this.options.verifyClient(n))return f(t,401)}this.completeUpgrade(_,s,d,e,t,i,r)}completeUpgrade(e,t,i,r,s,c,l){if(!s.readable||!s.writable)return s.destroy();if(s[d])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return f(s,503);const p=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(t+u).digest("base64")}`],g=new this.options.WebSocket(null,void 0,this.options);if(i.size){const e=this.options.handleProtocols?this.options.handleProtocols(i,r):i.values().next().value;e&&(p.push(`Sec-WebSocket-Protocol: ${e}`),g._protocol=e)}if(e[o.extensionName]){const t=e[o.extensionName].params,i=a.format({[o.extensionName]:[t]});p.push(`Sec-WebSocket-Extensions: ${i}`),g._extensions=e}this.emit("headers",p,r),s.write(p.concat("\r\n").join("\r\n")),s.removeListener("error",m),g.setSocket(s,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(g),g.on("close",(()=>{this.clients.delete(g),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)}))),l(g,r)}}}}),require_ws=__commonJS({"../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/index.js"(e,t){"use strict";var i=require_websocket();i.createWebSocketStream=require_stream(),i.Server=require_websocket_server(),i.Receiver=require_receiver(),i.Sender=require_sender(),i.WebSocket=i,i.WebSocketServer=i.Server,t.exports=i}}),require_node5=__commonJS({"../../node_modules/.pnpm/isomorphic-ws@4.0.1_ws@8.18.2/node_modules/isomorphic-ws/node.js"(e,t){"use strict";t.exports=require_ws()}}),require_event3=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/utils/event.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0;e.Event=class{constructor(){this._listeners=new Map,this._listenerIndex=0,this.emit=e=>{this._listeners.forEach((t=>t(e)))},this.removeAllListeners=()=>{this._listeners.clear()},this.addListener=e=>{const t=this._listenerIndex;this._listeners.set(t,e),this._listenerIndex++;return{removeListener:()=>{this._listeners.delete(t)}}},this.addOneTimeListener=e=>{const t=this.addListener((i=>{t.removeListener(),e(i)}));return t},this.asPromise=e=>new Promise(((t,i)=>{let r=()=>{};const s=e&&setTimeout((()=>{i("Event asPromise timeout"),r()}),e),n=this.addOneTimeListener((e=>{s&&clearTimeout(s),t(e)}));r=n.removeListener}))}}}}),require_version=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/version.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PACKAGE_VERSION=void 0,e.PACKAGE_VERSION="1.0.4"}}),require_socket=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/socket.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Socket=void 0;var i=t(require_node5()),r=require_event3(),s=require_version(),n=["open","sendRequestSignalingMessage","sendResponseSignalingMessage","acknowledge"];e.Socket=class{constructor({channelId:e,channelName:t,memberId:i,memberName:s,sessionEndpoint:n,token:a,logger:o}){this._isOpen=!1,this._isDestroyed=!1,this._reconnectCount=0,this.connectionState="closed",this.onConnectionStateChanged=new r.Event,this.onOpened=new r.Event,this.onEventReceived=new r.Event,this.onConnectionFailed=new r.Event,this._sessionEndpoint=n,this._channelId=e,this._channelName=t,this._memberId=i,this._memberName=s,this._token=a,this._logger=o,this._connect()}_setConnectionState(e){this._logger.debug(`connectionState changed : ${e}`),this.connectionState=e,this.onConnectionStateChanged.emit(e)}_connect(){let e;try{const t=`SkyWayAuthToken!${this._token}`,r={channelId:this._channelId,channelName:this._channelName,memberId:this._memberId,memberName:this._memberName,platform:"javascript",version:s.PACKAGE_VERSION},n=Object.entries(r).filter((([e,t])=>void 0!==t)).map((e=>e.join("="))).join("&"),a=`${this._sessionEndpoint}?${n}`;e=new i.default(a,t),this._logger.debug(`Connecting to signaling-server: ${this._sessionEndpoint}`),e.onerror=t=>{this._logger.error("WebSocket error occurred",t.error),e.close(4202)}}catch(e){const t=e instanceof Error?e:new Error;return this._logger.error("Failed to create WebSocket instance",t),void this.reconnect()}e.onopen=()=>{this._logger.debug("Connected to signaling-server")},e.onclose=e=>{const t="Close event fired: "+JSON.stringify({code:e.code,reason:e.reason,type:e.type});4100<=e.code&&e.code<=4199?this._logger.error(t,new Error):this._logger.debug(t),1e3===e.code||4e3<=e.code&&e.code<=4199?4e3!==e.code&&(this._logger.debug("Closed the connection to signaling-server"),this.onConnectionFailed.emit(),this.destroy()):this.reconnect()},e.onmessage=e=>{this._messageHandler(e.data)},this._ws=e}updateAuthToken(e){this._token=e}reconnect(){if(void 0!==this._ws&&this._ws.close(4e3),this._ws=void 0,this._isOpen=!1,this._reconnectCount>=8)this.onConnectionFailed.emit(),this.destroy(),this._logger.error("Failed to reconnect for eight times",new Error);else{this._setConnectionState("reconnecting");const t=(e=this._reconnectCount,1e3*(Math.pow(2,e)+Math.random()));this._reconnectTimer=setTimeout((()=>{this._connect(),this._reconnectCount++,this._logger.debug(`Try to reconnect: count = ${this._reconnectCount}`)}),t)}var e}destroy(){this._isDestroyed=!0,this._setConnectionState("closed"),this.onConnectionStateChanged.removeAllListeners(),this.onOpened.removeAllListeners(),this.onEventReceived.removeAllListeners(),this.onConnectionFailed.removeAllListeners(),this._reconnectTimer&&clearTimeout(this._reconnectTimer),void 0!==this._ws&&this._ws.close(1e3)}send(e){return new Promise(((t,r)=>{const s=()=>{this.onOpened.addOneTimeListener((()=>{this.send(e).then((()=>{t()})).catch((e=>{r(e)}))})),this.onConnectionFailed.addOneTimeListener((()=>{r(new Error("Connection failed"))}))};if(this._isDestroyed)r(new Error("The socket is already destroyed"));else{if(void 0===this._ws||!this._isOpen)return this._logger.debug("Retry send the client event when connected because WebSocket is undefined or isOpen = false"),void s();this._logger.debug(`Send the event: ${e.data}`),this._ws.send(e.data,(e=>{if(e){if(void 0===this._ws||!this._isOpen||this._ws.readyState!==i.default.OPEN)return this._logger.debug("Retry send the client event when connected because WebSocket.send failed"),void s();r(e)}else t()}))}}))}_messageHandler(e){if("string"!=typeof e)return void this._logger.error("Received invalid message: not string",new Error);let t;try{t=JSON.parse(e)}catch(e){const t=e instanceof Error?e:new Error;return void this._logger.error("Received invalid message: parse error",t)}!function(e){return!(!e||"object"!=typeof e)&&(!("string"!=typeof e.event||!n.includes(e.event))&&("string"==typeof e.eventId&&(!e.payload||"object"==typeof e.payload)))}(t)?this._logger.error(`Received invalid message: ${t}`,new Error):"open"===t.event?(this._logger.debug("Received a open event"),this._isOpen=!0,this._setConnectionState("connected"),0!==this._reconnectCount&&(this._reconnectCount=0,this._logger.debug("Succeeded to reconnect")),this.onOpened.emit()):(this._logger.debug(`Received the event: ${t.event}, payload: ${JSON.stringify(t.payload)}`),this.onEventReceived.emit(t))}}}}),require_signalingClient=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/signalingClient.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.SignalingClient=void 0;var i=(init_esm_node2(),__toCommonJS(esm_node_exports2)),r=require_clientEvent(),s=require_payloadTypes(),n=require_socket(),a=require_event3(),o="signaling.skyway.ntt.com";function c(e){if(!e||"object"!=typeof e)throw new Error("the type of data must be object")}e.SignalingClient=class{constructor({token:e,channelId:t,channelName:i,memberId:r,memberName:s},n){this.onConnectionStateChanged=new a.Event,this.onConnectionFailed=new a.Event,this.onRequested=new a.Event,this._connectivityCheckTimers=new Map,this._responseCallbacks=new Map,this._acknowledgeCallbacks=new Map,this._token=e,this._channelId=t,this._channelName=i,this._memberId=r,this._memberName=s;const c={connectivityCheckIntervalSec:30,signalingServerDomain:o,secure:!0,logger:{debug:e=>{console.debug(e)},error:e=>{console.error(e)}}};this._options=Object.assign({},c,null!=n?n:{}),this._logger=this._options.logger,this._logger.debug(`Created instance with the options: ${this._options}`)}get connectionState(){var e,t;return null!==(t=null===(e=this._socket)||void 0===e?void 0:e.connectionState)&&void 0!==t?t:"closed"}connect(){return t(this,void 0,void 0,(function*(){const e=this._options.secure?"wss":"ws",t=this._options.signalingServerDomain||o;this._socket=new n.Socket({sessionEndpoint:`${e}://${t}/v1/ws`,channelId:this._channelId,channelName:this._channelName,memberId:this._memberId,memberName:this._memberName,token:this._token,logger:this._logger}),this._socket.onEventReceived.addListener((e=>{try{this._eventReceivedHandler(e)}catch(e){this._logger.error("in _eventReceivedHandler",e)}})),this._socket.onConnectionFailed.addListener((()=>{this.onConnectionFailed.emit()})),this._socket.onConnectionStateChanged.addListener((e=>{this.onConnectionStateChanged.emit(e)})),yield this._socket.onOpened.asPromise(15e3),this._startConnectivityCheck()}))}disconnect(){var e;this._stopConnectivityCheck(),null===(e=this._socket)||void 0===e||e.destroy(),this._socket=void 0,this._responseCallbacks.clear(),this._acknowledgeCallbacks.clear()}_startConnectivityCheck(){this._connectivityCheckInterval?this._logger.debug("connectivity check timer is already set"):(this._connectivityCheckInterval=setInterval((()=>{var e;const t=new r.ClientEvent("checkConnectivity");null===(e=this._socket)||void 0===e||e.send(t).catch((()=>{this._acknowledgeCallbacks.delete(t.eventId)})),this._connectivityCheckTimers.set(t.eventId,setTimeout((()=>{var e;this._acknowledgeCallbacks.delete(t.eventId),null===(e=this._socket)||void 0===e||e.reconnect(),this._logger.debug("connectivity check timer is expired")}),5e3)),this._setAcknowledgeCallback(t.eventId,(e=>{var i;const r=this._connectivityCheckTimers.get(t.eventId);r&&(clearTimeout(r),this._connectivityCheckTimers.delete(t.eventId)),e.ok||(null===(i=this._socket)||void 0===i||i.reconnect(),this._logger.debug("connectivity check response from server was not ok"))}))}),1e3*this._options.connectivityCheckIntervalSec),this._logger.debug("Started connectivity check timer"))}_stopConnectivityCheck(){if(this._connectivityCheckInterval){clearInterval(this._connectivityCheckInterval),this._connectivityCheckInterval=void 0,this._logger.debug("Stopped connectivity check timer");for(const[e,t]of this._connectivityCheckTimers)clearTimeout(t);this._connectivityCheckTimers.clear()}else this._logger.debug("connectivity check timer is not set")}request(e,t,n=10){return function(e){if(!(0,s.isMember)(e))throw new Error("the type of target must be {id: string, name: string}");if(!(0,i.validate)(e.id))throw new Error("the type of target.id must be uuid format")}(e),c(t),new Promise(((i,s)=>{if(void 0===this._socket)return void s(new Error("websocket is not connected"));const a={dst:e,data:t},o=new r.ClientEvent("sendRequestSignalingMessage",a),c=setTimeout((()=>{this._acknowledgeCallbacks.delete(o.eventId),s(new Error("request timeout"))}),1e3*n);this._setResponseCallback(o.eventId,(e=>{clearTimeout(c),i(e)})),this._setAcknowledgeCallback(o.eventId,(e=>{e.ok||(clearTimeout(c),s(e))})),this._socket.send(o).catch((e=>{this._acknowledgeCallbacks.delete(o.eventId),clearTimeout(c),s(e)}))}))}_response(e,t,i,s){return new Promise(((n,a)=>{if(c(i),void 0===this._socket)return void a(new Error("websocket is not connected"));const o={dst:e,requestEventId:t,data:i},l=new r.ClientEvent("sendResponseSignalingMessage",o),u=setTimeout((()=>{this._acknowledgeCallbacks.delete(l.eventId),a(new Error("response timeout"))}),1e3*s);this._setAcknowledgeCallback(l.eventId,(e=>{clearTimeout(u),e.ok?n():a(e)})),this._socket.send(l).catch((e=>{this._acknowledgeCallbacks.delete(l.eventId),clearTimeout(u),a(e)}))}))}updateSkyWayAuthToken(e,t=10){return new Promise(((i,s)=>{if(void 0===this._socket)return void s(new Error("websocket is not connected"));const n={token:e},a=new r.ClientEvent("updateSkyWayAuthToken",n),o=setTimeout((()=>{this._acknowledgeCallbacks.delete(a.eventId),s(new Error("updateSkyWayAuthToken timeout"))}),1e3*t);this._setAcknowledgeCallback(a.eventId,(t=>{if(clearTimeout(o),t.ok){if(void 0===this._socket)return void s(new Error("websocket is not connected"));this._socket.updateAuthToken(e),i()}else s(t)})),this._socket.send(a).catch((e=>{this._acknowledgeCallbacks.delete(a.eventId),clearTimeout(o),s(e)}))}))}_eventReceivedHandler(e){switch(e.event){case"acknowledge":this._acknowledgeHandler(e.payload);break;case"sendRequestSignalingMessage":this._eventMessageRequestHandler(e.payload);break;case"sendResponseSignalingMessage":this._eventMessageResponseHandler(e.payload);break;case"open":break;default:e.event;this._logger.debug(`Unknown event: ${e.event}`)}}_acknowledgeHandler(e){if(!(0,s.isAcknowledgePayload)(e))throw new Error("Invalid payload");const{eventId:t}=e;if(!this._acknowledgeCallbacks.has(t))throw new Error(`acknowledge event has unknown eventId: ${t}`);const i=this._acknowledgeCallbacks.get(t);i&&(this._acknowledgeCallbacks.delete(t),i(e))}_eventMessageRequestHandler(e){if(!(0,s.isMessagePayload)(e))throw new Error("Invalid payload");if(!e.requestEventId)throw new Error("Invalid payload");const i=e.src,r=e.requestEventId;this.onRequested.emit({data:e.data,reply:(e,s=10)=>t(this,void 0,void 0,(function*(){yield this._response(i,r,e,s)})),requestEventId:e.requestEventId,src:e.src})}_eventMessageResponseHandler(e){if(!(0,s.isMessagePayload)(e))throw new Error("Invalid payload");if(!e.requestEventId||!this._responseCallbacks.has(e.requestEventId))throw new Error(`received response has unknown eventId: ${e.requestEventId}`);const t=this._responseCallbacks.get(e.requestEventId);t&&(this._responseCallbacks.delete(e.requestEventId),t(e.data))}_setResponseCallback(e,t){this._responseCallbacks.set(e,t)}_setAcknowledgeCallback(e,t){this._acknowledgeCallbacks.set(e,t)}}}}),require_dist5=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+signaling-client@1.0.9_encoding@0.1.13/node_modules/@skyway-sdk/signaling-client/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0,i(require_signalingClient(),e);var r=require_event3();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return r.Event}})}}),require_cjs13=__commonJS({"../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"(e,t){"use strict";var i=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)};var r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function s(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((i=e,Array.isArray(i)?[]:{}),e,t):e;var i}function n(e,t,i){return e.concat(t).map((function(e){return s(e,i)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function c(e,t,i){var r={};return i.isMergeableObject(e)&&a(e).forEach((function(t){r[t]=s(e[t],i)})),a(t).forEach((function(n){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,n)||(o(e,n)&&i.isMergeableObject(t[n])?r[n]=function(e,t){if(!t.customMerge)return l;var i=t.customMerge(e);return"function"==typeof i?i:l}(n,i)(e[n],t[n],i):r[n]=s(t[n],i))})),r}function l(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||n,r.isMergeableObject=r.isMergeableObject||i,r.cloneUnlessOtherwiseSpecified=s;var a=Array.isArray(t);return a===Array.isArray(e)?a?r.arrayMerge(e,t,r):c(e,t,r):s(t,r)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,i){return l(e,i,t)}),{})};var u=l;t.exports=u}}),require_jsrsasign2=__commonJS({"../../node_modules/.pnpm/jsrsasign@11.1.0/node_modules/jsrsasign/lib/jsrsasign.js"(e){var t,i,r,s,n,a,o,c,l,u,d,p={userAgent:!1},h={},m=m||(t=Math,r=(i={}).lib={},s=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var i=new e;return t&&i.mixIn(t),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),n=r.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||o).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,s=e.sigBytes;if(this.clamp(),r%4)for(var n=0;n<s;n++){var a=i[n>>>2]>>>24-n%4*8&255;t[r+n>>>2]|=a<<24-(r+n)%4*8}else for(n=0;n<s;n+=4)t[r+n>>>2]=i[n>>>2];return this.sigBytes+=s,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var i=[],r=0;r<e;r+=4)i.push(4294967296*t.random()|0);return new n.init(i,e)}}),a=i.enc={},o=a.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s<i;s++){var n=t[s>>>2]>>>24-s%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new n.init(i,t/2)}},c=a.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s<i;s++){var n=t[s>>>2]>>>24-s%4*8&255;r.push(String.fromCharCode(n))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new n.init(i,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=r.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new n.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var i=this._data,r=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),c=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,l=t.min(4*c,s);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(r,u);var d=r.splice(0,c);i.sigBytes-=l}return new n.init(d,l)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),r.Hasher=u.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new d.HMAC.init(e,i).finalize(t)}}}),d=i.algo={},i);!function(){var e,t=(e=m).lib,i=t.Base,r=t.WordArray;(e=e.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),e.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,i=[],s=0;s<t;s++){var n=e[s];i.push(n.high),i.push(n.low)}return r.create(i,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,s=0;s<r;s++)t[s]=t[s].clone();return e}})}(),m.lib.Cipher||function(){var e=(p=m).lib,t=e.Base,i=e.WordArray,r=e.BufferedBlockAlgorithm,s=p.enc.Base64,n=p.algo.EvpKDF,a=e.Cipher=r.extend({cfg:t.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,r){return("string"==typeof i?h:d).encrypt(e,t,i,r)},decrypt:function(t,i,r){return("string"==typeof i?h:d).decrypt(e,t,i,r)}}}});e.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var o=p.mode={},c=function(e,t,i){var r=this._iv;r?this._iv=undefined:r=this._prevBlock;for(var s=0;s<i;s++)e[t+s]^=r[s]},l=(e.BlockCipherMode=t.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize;c.call(this,e,t,r),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,s=e.slice(t,t+r);i.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=s}}),o=o.CBC=l,l=(p.pad={}).Pkcs7={pad:function(e,t){for(var r,s=(r=(r=4*t)-e.sigBytes%r)<<24|r<<16|r<<8|r,n=[],a=0;a<r;a+=4)n.push(s);r=i.create(n,r),e.concat(r)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},e.BlockCipher=a.extend({cfg:a.cfg.extend({mode:o,padding:l}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=t.createEncryptor;else i=t.createDecryptor,this._minBufferSize=1;this._mode=i.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var u=e.CipherParams=t.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),d=(o=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(s)},parse:function(e){var t=(e=s.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var r=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return u.create({ciphertext:e,salt:r})}},e.SerializableCipher=t.extend({cfg:t.extend({format:o}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var s=e.createEncryptor(i,r);return t=s.finalize(t),s=s.cfg,u.create({ciphertext:t,key:i,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,r,s){return s||(s=i.random(8)),e=n.create({keySize:t+r}).compute(e,s),r=i.create(e.words.slice(t),4*r),e.sigBytes=4*t,u.create({key:e,iv:r,salt:s})}},h=e.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:p}),encrypt:function(e,t,i,r){return i=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize),r.iv=i.iv,(e=d.encrypt.call(this,e,t,i.key,r)).mixIn(i),e},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),i=r.kdf.execute(i,e.keySize,e.ivSize,t.salt),r.iv=i.iv,d.decrypt.call(this,e,t,i.key,r)}})}(),function(){for(var e=m,t=e.lib.BlockCipher,i=e.algo,r=[],s=[],n=[],a=[],o=[],c=[],l=[],u=[],d=[],p=[],h=[],f=0;256>f;f++)h[f]=128>f?f<<1:f<<1^283;var g=0,_=0;for(f=0;256>f;f++){var y=(y=_^_<<1^_<<2^_<<3^_<<4)>>>8^255&y^99;r[g]=y,s[y]=g;var b=h[g],v=h[b],x=h[v],S=257*h[y]^16843008*y;n[g]=S<<24|S>>>8,a[g]=S<<16|S>>>16,o[g]=S<<8|S>>>24,c[g]=S,S=16843009*x^65537*v^257*b^16843008*g,l[y]=S<<24|S>>>8,u[y]=S<<16|S>>>16,d[y]=S<<8|S>>>24,p[y]=S,g?(g=b^h[h[h[x^b]]],_^=h[h[_]]):g=_=1}var w=[0,1,2,4,8,16,32,64,128,27,54];i=i.AES=t.extend({_doReset:function(){for(var e=(i=this._key).words,t=i.sigBytes/4,i=4*((this._nRounds=t+6)+1),s=this._keySchedule=[],n=0;n<i;n++)if(n<t)s[n]=e[n];else{var a=s[n-1];n%t?6<t&&4==n%t&&(a=r[a>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a]):(a=r[(a=a<<8|a>>>24)>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a],a^=w[n/t|0]<<24),s[n]=s[n-t]^a}for(e=this._invKeySchedule=[],t=0;t<i;t++)n=i-t,a=t%4?s[n]:s[n-4],e[t]=4>t||4>=n?a:l[r[a>>>24]]^u[r[a>>>16&255]]^d[r[a>>>8&255]]^p[r[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,n,a,o,c,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,l,u,d,p,s),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,s,n,a,o){for(var c=this._nRounds,l=e[t]^i[0],u=e[t+1]^i[1],d=e[t+2]^i[2],p=e[t+3]^i[3],h=4,m=1;m<c;m++){var f=r[l>>>24]^s[u>>>16&255]^n[d>>>8&255]^a[255&p]^i[h++],g=r[u>>>24]^s[d>>>16&255]^n[p>>>8&255]^a[255&l]^i[h++],_=r[d>>>24]^s[p>>>16&255]^n[l>>>8&255]^a[255&u]^i[h++];p=r[p>>>24]^s[l>>>16&255]^n[u>>>8&255]^a[255&d]^i[h++],l=f,u=g,d=_}f=(o[l>>>24]<<24|o[u>>>16&255]<<16|o[d>>>8&255]<<8|o[255&p])^i[h++],g=(o[u>>>24]<<24|o[d>>>16&255]<<16|o[p>>>8&255]<<8|o[255&l])^i[h++],_=(o[d>>>24]<<24|o[p>>>16&255]<<16|o[l>>>8&255]<<8|o[255&u])^i[h++],p=(o[p>>>24]<<24|o[l>>>16&255]<<16|o[u>>>8&255]<<8|o[255&d])^i[h++],e[t]=f,e[t+1]=g,e[t+2]=_,e[t+3]=p},keySize:8});e.AES=t._createHelper(i)}(),function(){function e(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<<e}function t(e,t){var i=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<<e}var i=m,r=(s=i.lib).WordArray,s=s.BlockCipher,n=i.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=n.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;56>i;i++){var r=a[i]-1;t[i]=e[r>>>5]>>>31-r%32&1}for(e=this._subKeys=[],r=0;16>r;r++){var s=e[r]=[],n=c[r];for(i=0;24>i;i++)s[i/6|0]|=t[(o[i]-1+n)%28]<<31-i%6,s[4+(i/6|0)]|=t[28+(o[i+24]-1+n)%28]<<31-i%6;for(s[0]=s[0]<<1|s[0]>>>31,i=1;7>i;i++)s[i]>>>=4*(i-1)+3;s[7]=s[7]<<5|s[7]>>>27}for(t=this._invSubKeys=[],i=0;16>i;i++)t[i]=e[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(i,r,s){this._lBlock=i[r],this._rBlock=i[r+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var n=0;16>n;n++){for(var a=s[n],o=this._lBlock,c=this._rBlock,d=0,p=0;8>p;p++)d|=l[p][((c^a[p])&u[p])>>>0];this._lBlock=c,this._rBlock=o^d}s=this._lBlock,this._lBlock=this._rBlock,this._rBlock=s,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),i[r]=this._lBlock,i[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});i.DES=s._createHelper(d),n=n.TripleDES=s.extend({_doReset:function(){var e=this._key.words;this._des1=d.createEncryptor(r.create(e.slice(0,2))),this._des2=d.createEncryptor(r.create(e.slice(2,4))),this._des3=d.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),i.TripleDES=s._createHelper(n)}(),function(){var e=m,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp(),e=[];for(var s=0;s<i;s+=3)for(var n=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;4>a&&s+.75*a<i;a++)e.push(r.charAt(n>>>6*(3-a)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var i=e.length,r=this._map;(s=r.charAt(64))&&(-1!=(s=e.indexOf(s))&&(i=s));for(var s=[],n=0,a=0;a<i;a++)if(a%4){var o=r.indexOf(e.charAt(a-1))<<a%4*2,c=r.indexOf(e.charAt(a))>>>6-a%4*2;s[n>>>2]|=(o|c)<<24-n%4*8,n++}return t.create(s,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,i,r,s,n,a){return((e=e+(t&i|~t&r)+s+a)<<n|e>>>32-n)+t}function i(e,t,i,r,s,n,a){return((e=e+(t&r|i&~r)+s+a)<<n|e>>>32-n)+t}function r(e,t,i,r,s,n,a){return((e=e+(t^i^r)+s+a)<<n|e>>>32-n)+t}function s(e,t,i,r,s,n,a){return((e=e+(i^(t|~r))+s+a)<<n|e>>>32-n)+t}for(var n=m,a=(c=n.lib).WordArray,o=c.Hasher,c=n.algo,l=[],u=0;64>u;u++)l[u]=4294967296*e.abs(e.sin(u+1))|0;c=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,n){for(var a=0;16>a;a++){var o=e[c=n+a];e[c]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}a=this._hash.words;var c=e[n+0],u=(o=e[n+1],e[n+2]),d=e[n+3],p=e[n+4],h=e[n+5],m=e[n+6],f=e[n+7],g=e[n+8],_=e[n+9],y=e[n+10],b=e[n+11],v=e[n+12],x=e[n+13],S=e[n+14],w=e[n+15],E=t(E=a[0],T=a[1],A=a[2],C=a[3],c,7,l[0]),C=t(C,E,T,A,o,12,l[1]),A=t(A,C,E,T,u,17,l[2]),T=t(T,A,C,E,d,22,l[3]);E=t(E,T,A,C,p,7,l[4]),C=t(C,E,T,A,h,12,l[5]),A=t(A,C,E,T,m,17,l[6]),T=t(T,A,C,E,f,22,l[7]),E=t(E,T,A,C,g,7,l[8]),C=t(C,E,T,A,_,12,l[9]),A=t(A,C,E,T,y,17,l[10]),T=t(T,A,C,E,b,22,l[11]),E=t(E,T,A,C,v,7,l[12]),C=t(C,E,T,A,x,12,l[13]),A=t(A,C,E,T,S,17,l[14]),E=i(E,T=t(T,A,C,E,w,22,l[15]),A,C,o,5,l[16]),C=i(C,E,T,A,m,9,l[17]),A=i(A,C,E,T,b,14,l[18]),T=i(T,A,C,E,c,20,l[19]),E=i(E,T,A,C,h,5,l[20]),C=i(C,E,T,A,y,9,l[21]),A=i(A,C,E,T,w,14,l[22]),T=i(T,A,C,E,p,20,l[23]),E=i(E,T,A,C,_,5,l[24]),C=i(C,E,T,A,S,9,l[25]),A=i(A,C,E,T,d,14,l[26]),T=i(T,A,C,E,g,20,l[27]),E=i(E,T,A,C,x,5,l[28]),C=i(C,E,T,A,u,9,l[29]),A=i(A,C,E,T,f,14,l[30]),E=r(E,T=i(T,A,C,E,v,20,l[31]),A,C,h,4,l[32]),C=r(C,E,T,A,g,11,l[33]),A=r(A,C,E,T,b,16,l[34]),T=r(T,A,C,E,S,23,l[35]),E=r(E,T,A,C,o,4,l[36]),C=r(C,E,T,A,p,11,l[37]),A=r(A,C,E,T,f,16,l[38]),T=r(T,A,C,E,y,23,l[39]),E=r(E,T,A,C,x,4,l[40]),C=r(C,E,T,A,c,11,l[41]),A=r(A,C,E,T,d,16,l[42]),T=r(T,A,C,E,m,23,l[43]),E=r(E,T,A,C,_,4,l[44]),C=r(C,E,T,A,v,11,l[45]),A=r(A,C,E,T,w,16,l[46]),E=s(E,T=r(T,A,C,E,u,23,l[47]),A,C,c,6,l[48]),C=s(C,E,T,A,f,10,l[49]),A=s(A,C,E,T,S,15,l[50]),T=s(T,A,C,E,h,21,l[51]),E=s(E,T,A,C,v,6,l[52]),C=s(C,E,T,A,d,10,l[53]),A=s(A,C,E,T,y,15,l[54]),T=s(T,A,C,E,o,21,l[55]),E=s(E,T,A,C,g,6,l[56]),C=s(C,E,T,A,w,10,l[57]),A=s(A,C,E,T,m,15,l[58]),T=s(T,A,C,E,x,21,l[59]),E=s(E,T,A,C,p,6,l[60]),C=s(C,E,T,A,b,10,l[61]),A=s(A,C,E,T,u,15,l[62]),T=s(T,A,C,E,_,21,l[63]);a[0]=a[0]+E|0,a[1]=a[1]+T|0,a[2]=a[2]+A|0,a[3]=a[3]+C|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;i[s>>>5]|=128<<24-s%32;var n=e.floor(r/4294967296);for(i[15+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),i[14+(s+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(i.length+1),this._process(),i=(t=this._hash).words,r=0;4>r;r++)s=i[r],i[r]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8);return t},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.MD5=o._createHelper(c),n.HmacMD5=o._createHmacHelper(c)}(Math),function(){var e=m,t=(s=e.lib).WordArray,i=s.Hasher,r=[],s=e.algo.SHA1=i.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],n=i[1],a=i[2],o=i[3],c=i[4],l=0;80>l;l++){if(16>l)r[l]=0|e[t+l];else{var u=r[l-3]^r[l-8]^r[l-14]^r[l-16];r[l]=u<<1|u>>>31}u=(s<<5|s>>>27)+c+r[l],u=20>l?u+(1518500249+(n&a|~n&o)):40>l?u+(1859775393+(n^a^o)):60>l?u+((n&a|n&o|a&o)-1894007588):u+((n^a^o)-899497514),c=o,o=a,a=n<<30|n>>>2,n=s,s=u}i[0]=i[0]+s|0,i[1]=i[1]+n|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=i._createHelper(s),e.HmacSHA1=i._createHmacHelper(s)}(),function(e){for(var t=m,i=(s=t.lib).WordArray,r=s.Hasher,s=t.algo,n=[],a=[],o=function(e){return 4294967296*(e-(0|e))|0},c=2,l=0;64>l;){var u;e:{u=c;for(var d=e.sqrt(u),p=2;p<=d;p++)if(!(u%p)){u=!1;break e}u=!0}u&&(8>l&&(n[l]=o(e.pow(c,.5))),a[l]=o(e.pow(c,1/3)),l++),c++}var h=[];s=s.SHA256=r.extend({_doReset:function(){this._hash=new i.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],n=i[2],o=i[3],c=i[4],l=i[5],u=i[6],d=i[7],p=0;64>p;p++){if(16>p)h[p]=0|e[t+p];else{var m=h[p-15],f=h[p-2];h[p]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+h[p-7]+((f<<15|f>>>17)^(f<<13|f>>>19)^f>>>10)+h[p-16]}m=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+a[p]+h[p],f=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&s^r&n^s&n),d=u,u=l,l=c,c=o+m|0,o=n,n=s,s=r,r=m+f|0}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+n|0,i[3]=i[3]+o|0,i[4]=i[4]+c|0,i[5]=i[5]+l|0,i[6]=i[6]+u|0,i[7]=i[7]+d|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;return i[s>>>5]|=128<<24-s%32,i[14+(s+64>>>9<<4)]=e.floor(r/4294967296),i[15+(s+64>>>9<<4)]=r,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(s),t.HmacSHA256=r._createHmacHelper(s)}(Math),function(){var e=m,t=e.lib.WordArray,i=(r=e.algo).SHA256,r=r.SHA224=i.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=i._createHelper(r),e.HmacSHA224=i._createHmacHelper(r)}(),function(){function e(){return r.create.apply(r,arguments)}for(var t=m,i=t.lib.Hasher,r=(n=t.x64).Word,s=n.WordArray,n=t.algo,a=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],o=[],c=0;80>c;c++)o[c]=e();n=n.SHA512=i.extend({_doReset:function(){this._hash=new s.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=(d=this._hash.words)[0],r=d[1],s=d[2],n=d[3],c=d[4],l=d[5],u=d[6],d=d[7],p=i.high,h=i.low,m=r.high,f=r.low,g=s.high,_=s.low,y=n.high,b=n.low,v=c.high,x=c.low,S=l.high,w=l.low,E=u.high,C=u.low,A=d.high,T=d.low,P=p,I=h,k=m,R=f,F=g,B=_,O=y,N=b,D=v,j=x,L=S,U=w,M=E,q=C,H=A,z=T,V=0;80>V;V++){var K=o[V];if(16>V)var G=K.high=0|e[t+2*V],W=K.low=0|e[t+2*V+1];else{G=((W=(G=o[V-15]).high)>>>1|(J=G.low)<<31)^(W>>>8|J<<24)^W>>>7;var J=(J>>>1|W<<31)^(J>>>8|W<<24)^(J>>>7|W<<25),$=((W=($=o[V-2]).high)>>>19|(Z=$.low)<<13)^(W<<3|Z>>>29)^W>>>6,Z=(Z>>>19|W<<13)^(Z<<3|W>>>29)^(Z>>>6|W<<26),Y=(W=o[V-7]).high,X=(Q=o[V-16]).high,Q=Q.low;G=(G=(G=G+Y+((W=J+W.low)>>>0<J>>>0?1:0))+$+((W=W+Z)>>>0<Z>>>0?1:0))+X+((W=W+Q)>>>0<Q>>>0?1:0);K.high=G,K.low=W}Y=D&L^~D&M,Q=j&U^~j&q,K=P&k^P&F^k&F;var ee=I&R^I&B^R&B,te=(J=(P>>>28|I<<4)^(P<<30|I>>>2)^(P<<25|I>>>7),$=(I>>>28|P<<4)^(I<<30|P>>>2)^(I<<25|P>>>7),(Z=a[V]).high),ie=Z.low;X=H+((D>>>14|j<<18)^(D>>>18|j<<14)^(D<<23|j>>>9))+((Z=z+((j>>>14|D<<18)^(j>>>18|D<<14)^(j<<23|D>>>9)))>>>0<z>>>0?1:0),H=M,z=q,M=L,q=U,L=D,U=j,D=O+(X=(X=(X=X+Y+((Z=Z+Q)>>>0<Q>>>0?1:0))+te+((Z=Z+ie)>>>0<ie>>>0?1:0))+G+((Z=Z+W)>>>0<W>>>0?1:0))+((j=N+Z|0)>>>0<N>>>0?1:0)|0,O=F,N=B,F=k,B=R,k=P,R=I,P=X+(K=J+K+((W=$+ee)>>>0<$>>>0?1:0))+((I=Z+W|0)>>>0<Z>>>0?1:0)|0}h=i.low=h+I,i.high=p+P+(h>>>0<I>>>0?1:0),f=r.low=f+R,r.high=m+k+(f>>>0<R>>>0?1:0),_=s.low=_+B,s.high=g+F+(_>>>0<B>>>0?1:0),b=n.low=b+N,n.high=y+O+(b>>>0<N>>>0?1:0),x=c.low=x+j,c.high=v+D+(x>>>0<j>>>0?1:0),w=l.low=w+U,l.high=S+L+(w>>>0<U>>>0?1:0),C=u.low=C+q,u.high=E+M+(C>>>0<q>>>0?1:0),T=d.low=T+z,d.high=A+H+(T>>>0<z>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(r+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=i._createHelper(n),t.HmacSHA512=i._createHmacHelper(n)}(),function(){var e=m,t=(s=e.x64).Word,i=s.WordArray,r=(s=e.algo).SHA512,s=s.SHA384=r.extend({_doReset:function(){this._hash=new i.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=r._createHelper(s),e.HmacSHA384=r._createHmacHelper(s)}(),function(){var e=m,t=(r=e.lib).WordArray,i=r.Hasher,r=e.algo,s=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),n=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=t.create([0,1518500249,1859775393,2400959708,2840853838]),l=t.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=i.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;16>i;i++){var r=e[v=t+i];e[v]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var u,d,p,h,m,f,g,_,y,b,v=this._hash.words,x=(r=c.words,l.words),S=s.words,w=n.words,E=a.words,C=o.words;f=u=v[0],g=d=v[1],_=p=v[2],y=h=v[3],b=m=v[4];var A;for(i=0;80>i;i+=1)A=u+e[t+S[i]]|0,A=16>i?A+((d^p^h)+r[0]):32>i?A+((d&p|~d&h)+r[1]):48>i?A+(((d|~p)^h)+r[2]):64>i?A+((d&h|p&~h)+r[3]):A+((d^(p|~h))+r[4]),A=(A=(A|=0)<<E[i]|A>>>32-E[i])+m|0,u=m,m=h,h=p<<10|p>>>22,p=d,d=A,A=f+e[t+w[i]]|0,A=16>i?A+((g^(_|~y))+x[0]):32>i?A+((g&y|_&~y)+x[1]):48>i?A+(((g|~_)^y)+x[2]):64>i?A+((g&_|~g&y)+x[3]):A+((g^_^y)+x[4]),A=(A=(A|=0)<<C[i]|A>>>32-C[i])+b|0,f=b,b=y,y=_<<10|_>>>22,_=g,g=A;A=v[1]+p+y|0,v[1]=v[2]+h+b|0,v[2]=v[3]+m+f|0,v[3]=v[4]+u+g|0,v[4]=v[0]+d+_|0,v[0]=A},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;for(t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,i=0;5>i;i++)r=t[i],t[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.RIPEMD160=i._createHelper(r),e.HmacRIPEMD160=i._createHmacHelper(r)}(Math),function(){var e=m,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,i){e=this._hasher=new e.init,"string"==typeof i&&(i=t.parse(i));var r=e.blockSize,s=4*r;i.sigBytes>s&&(i=e.finalize(i)),i.clamp();for(var n=this._oKey=i.clone(),a=this._iKey=i.clone(),o=n.words,c=a.words,l=0;l<r;l++)o[l]^=1549556828,c[l]^=909522486;n.sigBytes=a.sigBytes=s,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),function(){var e,t=m,i=(e=t.lib).Base,r=e.WordArray,s=(e=t.algo).HMAC,n=e.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var i=this.cfg,n=s.create(i.hasher,e),a=r.create(),o=r.create([1]),c=a.words,l=o.words,u=i.keySize;for(i=i.iterations;c.length<u;){var d=n.update(t).finalize(o);n.reset();for(var p=d.words,h=p.length,m=d,f=1;f<i;f++){m=n.finalize(m),n.reset();for(var g=m.words,_=0;_<h;_++)p[_]^=g[_]}a.concat(d),l[0]++}return a.sigBytes=4*u,a}});t.PBKDF2=function(e,t,i){return n.create(i).compute(e,t)}}();var f,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function _(e){var t,i,r="";for(t=0;t+3<=e.length;t+=3)i=parseInt(e.substring(t,t+3),16),r+=g.charAt(i>>6)+g.charAt(63&i);for(t+1==e.length?(i=parseInt(e.substring(t,t+1),16),r+=g.charAt(i<<2)):t+2==e.length&&(i=parseInt(e.substring(t,t+2),16),r+=g.charAt(i>>2)+g.charAt((3&i)<<4)),"=";(3&r.length)>0;)r+="=";return r}function y(e){var t,i,r,s="",n=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t)(r=g.indexOf(e.charAt(t)))<0||(0==n?(s+=C(r>>2),i=3&r,n=1):1==n?(s+=C(i<<2|r>>4),i=15&r,n=2):2==n?(s+=C(i),s+=C(r>>2),i=3&r,n=3):(s+=C(i<<2|r>>4),s+=C(15&r),n=0));return 1==n&&(s+=C(i<<2)),s}function b(e){var t,i=y(e),r=new Array;for(t=0;2*t<i.length;++t)r[t]=parseInt(i.substring(2*t,2*t+2),16);return r}function v(e,t,i){null!=e&&("number"==typeof e?this.fromNumber(e,t,i):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function x(){return new v(null)}"Microsoft Internet Explorer"==p.appName?(v.prototype.am=function(e,t,i,r,s,n){for(var a=32767&t,o=t>>15;--n>=0;){var c=32767&this[e],l=this[e++]>>15,u=o*c+l*a;s=((c=a*c+((32767&u)<<15)+i[r]+(1073741823&s))>>>30)+(u>>>15)+o*l+(s>>>30),i[r++]=1073741823&c}return s},f=30):"Netscape"!=p.appName?(v.prototype.am=function(e,t,i,r,s,n){for(;--n>=0;){var a=t*this[e++]+i[r]+s;s=Math.floor(a/67108864),i[r++]=67108863&a}return s},f=26):(v.prototype.am=function(e,t,i,r,s,n){for(var a=16383&t,o=t>>14;--n>=0;){var c=16383&this[e],l=this[e++]>>14,u=o*c+l*a;s=((c=a*c+((16383&u)<<14)+i[r]+s)>>28)+(u>>14)+o*l,i[r++]=268435455&c}return s},f=28),v.prototype.DB=f,v.prototype.DM=(1<<f)-1,v.prototype.DV=1<<f;v.prototype.FV=Math.pow(2,52),v.prototype.F1=52-f,v.prototype.F2=2*f-52;var S,w,E=new Array;for(S="0".charCodeAt(0),w=0;w<=9;++w)E[S++]=w;for(S="a".charCodeAt(0),w=10;w<36;++w)E[S++]=w;for(S="A".charCodeAt(0),w=10;w<36;++w)E[S++]=w;function C(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function A(e,t){var i=E[e.charCodeAt(t)];return null==i?-1:i}function T(e){var t=x();return t.fromInt(e),t}function P(e){var t,i=1;return 0!=(t=e>>>16)&&(e=t,i+=16),0!=(t=e>>8)&&(e=t,i+=8),0!=(t=e>>4)&&(e=t,i+=4),0!=(t=e>>2)&&(e=t,i+=2),0!=(t=e>>1)&&(e=t,i+=1),i}function I(e){this.m=e}function k(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function R(e,t){return e&t}function F(e,t){return e|t}function B(e,t){return e^t}function O(e,t){return e&~t}function N(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function D(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function j(){}function L(e){return e}function U(e){this.r2=x(),this.q3=x(),v.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}I.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},I.prototype.revert=function(e){return e},I.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},I.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},k.prototype.convert=function(e){var t=x();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(v.ZERO)>0&&this.m.subTo(t,t),t},k.prototype.revert=function(e){var t=x();return e.copyTo(t),this.reduce(t),t},k.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=32767&e[t],r=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[i=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},k.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},k.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},v.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},v.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},v.prototype.fromString=function(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var r=e.length,s=!1,n=0;--r>=0;){var a=8==i?255&e[r]:A(e,r);a<0?"-"==e.charAt(r)&&(s=!0):(s=!1,0==n?this[this.t++]=a:n+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-n)-1)<<n,this[this.t++]=a>>this.DB-n):this[this.t-1]|=a<<n,(n+=i)>=this.DB&&(n-=this.DB))}8==i&&128&e[0]&&(this.s=-1,n>0&&(this[this.t-1]|=(1<<this.DB-n)-1<<n)),this.clamp(),s&&v.ZERO.subTo(this,this)},v.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},v.prototype.dlShiftTo=function(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s},v.prototype.drShiftTo=function(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s},v.prototype.lShiftTo=function(e,t){var i,r=e%this.DB,s=this.DB-r,n=(1<<s)-1,a=Math.floor(e/this.DB),o=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)t[i+a+1]=this[i]>>s|o,o=(this[i]&n)<<r;for(i=a-1;i>=0;--i)t[i]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()},v.prototype.rShiftTo=function(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t)t.t=0;else{var r=e%this.DB,s=this.DB-r,n=(1<<r)-1;t[0]=this[i]>>r;for(var a=i+1;a<this.t;++a)t[a-i-1]|=(this[a]&n)<<s,t[a-i]=this[a]>>r;r>0&&(t[this.t-i-1]|=(this.s&n)<<s),t.t=this.t-i,t.clamp()}},v.prototype.subTo=function(e,t){for(var i=0,r=0,s=Math.min(e.t,this.t);i<s;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()},v.prototype.multiplyTo=function(e,t){var i=this.abs(),r=e.abs(),s=i.t;for(t.t=s+r.t;--s>=0;)t[s]=0;for(s=0;s<r.t;++s)t[s+i.t]=i.am(0,r[s],t,s,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&v.ZERO.subTo(t,t)},v.prototype.squareTo=function(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var r=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,r,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()},v.prototype.divRemTo=function(e,t,i){var r=e.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=x());var n=x(),a=this.s,o=e.s,c=this.DB-P(r[r.t-1]);c>0?(r.lShiftTo(c,n),s.lShiftTo(c,i)):(r.copyTo(n),s.copyTo(i));var l=n.t,u=n[l-1];if(0!=u){var d=u*(1<<this.F1)+(l>1?n[l-2]>>this.F2:0),p=this.FV/d,h=(1<<this.F1)/d,m=1<<this.F2,f=i.t,g=f-l,_=null==t?x():t;for(n.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),v.ONE.dlShiftTo(l,_),_.subTo(n,n);n.t<l;)n[n.t++]=0;for(;--g>=0;){var y=i[--f]==u?this.DM:Math.floor(i[f]*p+(i[f-1]+m)*h);if((i[f]+=n.am(0,y,i,g,0,l))<y)for(n.dlShiftTo(g,_),i.subTo(_,i);i[f]<--y;)i.subTo(_,i)}null!=t&&(i.drShiftTo(l,t),a!=o&&v.ZERO.subTo(t,t)),i.t=l,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&v.ZERO.subTo(i,i)}}},v.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},v.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},v.prototype.exp=function(e,t){if(e>4294967295||e<1)return v.ONE;var i=x(),r=x(),s=t.convert(this),n=P(e)-1;for(s.copyTo(i);--n>=0;)if(t.sqrTo(i,r),(e&1<<n)>0)t.mulTo(r,s,i);else{var a=i;i=r,r=a}return t.revert(i)},v.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var i,r=(1<<t)-1,s=!1,n="",a=this.t,o=this.DB-a*this.DB%t;if(a-- >0)for(o<this.DB&&(i=this[a]>>o)>0&&(s=!0,n=C(i));a>=0;)o<t?(i=(this[a]&(1<<o)-1)<<t-o,i|=this[--a]>>(o+=this.DB-t)):(i=this[a]>>(o-=t)&r,o<=0&&(o+=this.DB,--a)),i>0&&(s=!0),s&&(n+=C(i));return s?n:"0"},v.prototype.negate=function(){var e=x();return v.ZERO.subTo(this,e),e},v.prototype.abs=function(){return this.s<0?this.negate():this},v.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var i=this.t;if(0!=(t=i-e.t))return this.s<0?-t:t;for(;--i>=0;)if(0!=(t=this[i]-e[i]))return t;return 0},v.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+P(this[this.t-1]^this.s&this.DM)},v.prototype.mod=function(e){var t=x();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(v.ZERO)>0&&e.subTo(t,t),t},v.prototype.modPowInt=function(e,t){var i;return i=e<256||t.isEven()?new I(t):new k(t),this.exp(e,i)},v.ZERO=T(0),v.ONE=T(1),j.prototype.convert=L,j.prototype.revert=L,j.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i)},j.prototype.sqrTo=function(e,t){e.squareTo(t)},U.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=x();return e.copyTo(t),this.reduce(t),t},U.prototype.revert=function(e){return e},U.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},U.prototype.mulTo=function(e,t,i){e.multiplyTo(t,i),this.reduce(i)},U.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var M=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],q=(1<<26)/M[M.length-1];function H(){this.i=0,this.j=0,this.S=new Array}v.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},v.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),r=T(i),s=x(),n=x(),a="";for(this.divRemTo(r,s,n);s.signum()>0;)a=(i+n.intValue()).toString(e).substr(1)+a,s.divRemTo(r,s,n);return n.intValue().toString(e)+a},v.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),s=!1,n=0,a=0,o=0;o<e.length;++o){var c=A(e,o);c<0?"-"==e.charAt(o)&&0==this.signum()&&(s=!0):(a=t*a+c,++n>=i&&(this.dMultiply(r),this.dAddOffset(a,0),n=0,a=0))}n>0&&(this.dMultiply(Math.pow(t,n)),this.dAddOffset(a,0)),s&&v.ZERO.subTo(this,this)},v.prototype.fromNumber=function(e,t,i){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(v.ONE.shiftLeft(e-1),F,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(v.ONE.shiftLeft(e-1),this);else{var r=new Array,s=7&e;r.length=1+(e>>3),t.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},v.prototype.bitwiseTo=function(e,t,i){var r,s,n=Math.min(e.t,this.t);for(r=0;r<n;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(s=e.s&this.DM,r=n;r<this.t;++r)i[r]=t(this[r],s);i.t=this.t}else{for(s=this.s&this.DM,r=n;r<e.t;++r)i[r]=t(s,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()},v.prototype.changeBit=function(e,t){var i=v.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i},v.prototype.addTo=function(e,t){for(var i=0,r=0,s=Math.min(e.t,this.t);i<s;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()},v.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},v.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},v.prototype.multiplyLowerTo=function(e,t,i){var r,s=Math.min(this.t+e.t,t);for(i.s=0,i.t=s;s>0;)i[--s]=0;for(r=i.t-this.t;s<r;++s)i[s+this.t]=this.am(0,e[s],i,s,0,this.t);for(r=Math.min(e.t,t);s<r;++s)this.am(0,e[s],i,s,0,t-s);i.clamp()},v.prototype.multiplyUpperTo=function(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)},v.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(0==t)i=this[0]%e;else for(var r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i},v.prototype.millerRabin=function(e){var t=this.subtract(v.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);(e=e+1>>1)>M.length&&(e=M.length);for(var s=x(),n=0;n<e;++n){s.fromInt(M[Math.floor(Math.random()*M.length)]);var a=s.modPow(r,this);if(0!=a.compareTo(v.ONE)&&0!=a.compareTo(t)){for(var o=1;o++<i&&0!=a.compareTo(t);)if(0==(a=a.modPowInt(2,this)).compareTo(v.ONE))return!1;if(0!=a.compareTo(t))return!1}}return!0},v.prototype.clone=function(){var e=x();return this.copyTo(e),e},v.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},v.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},v.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},v.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},v.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var i,r=this.DB-e*this.DB%8,s=0;if(e-- >0)for(r<this.DB&&(i=this[e]>>r)!=(this.s&this.DM)>>r&&(t[s++]=i|this.s<<this.DB-r);e>=0;)r<8?(i=(this[e]&(1<<r)-1)<<8-r,i|=this[--e]>>(r+=this.DB-8)):(i=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),128&i&&(i|=-256),0==s&&(128&this.s)!=(128&i)&&++s,(s>0||i!=this.s)&&(t[s++]=i);return t},v.prototype.equals=function(e){return 0==this.compareTo(e)},v.prototype.min=function(e){return this.compareTo(e)<0?this:e},v.prototype.max=function(e){return this.compareTo(e)>0?this:e},v.prototype.and=function(e){var t=x();return this.bitwiseTo(e,R,t),t},v.prototype.or=function(e){var t=x();return this.bitwiseTo(e,F,t),t},v.prototype.xor=function(e){var t=x();return this.bitwiseTo(e,B,t),t},v.prototype.andNot=function(e){var t=x();return this.bitwiseTo(e,O,t),t},v.prototype.not=function(){for(var e=x(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},v.prototype.shiftLeft=function(e){var t=x();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},v.prototype.shiftRight=function(e){var t=x();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},v.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+N(this[e]);return this.s<0?this.t*this.DB:-1},v.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=D(this[i]^t);return e},v.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)},v.prototype.setBit=function(e){return this.changeBit(e,F)},v.prototype.clearBit=function(e){return this.changeBit(e,O)},v.prototype.flipBit=function(e){return this.changeBit(e,B)},v.prototype.add=function(e){var t=x();return this.addTo(e,t),t},v.prototype.subtract=function(e){var t=x();return this.subTo(e,t),t},v.prototype.multiply=function(e){var t=x();return this.multiplyTo(e,t),t},v.prototype.divide=function(e){var t=x();return this.divRemTo(e,t,null),t},v.prototype.remainder=function(e){var t=x();return this.divRemTo(e,null,t),t},v.prototype.divideAndRemainder=function(e){var t=x(),i=x();return this.divRemTo(e,t,i),new Array(t,i)},v.prototype.modPow=function(e,t){var i,r,s=e.bitLength(),n=T(1);if(s<=0)return n;i=s<18?1:s<48?3:s<144?4:s<768?5:6,r=s<8?new I(t):t.isEven()?new U(t):new k(t);var a=new Array,o=3,c=i-1,l=(1<<i)-1;if(a[1]=r.convert(this),i>1){var u=x();for(r.sqrTo(a[1],u);o<=l;)a[o]=x(),r.mulTo(u,a[o-2],a[o]),o+=2}var d,p,h=e.t-1,m=!0,f=x();for(s=P(e[h])-1;h>=0;){for(s>=c?d=e[h]>>s-c&l:(d=(e[h]&(1<<s+1)-1)<<c-s,h>0&&(d|=e[h-1]>>this.DB+s-c)),o=i;!(1&d);)d>>=1,--o;if((s-=o)<0&&(s+=this.DB,--h),m)a[d].copyTo(n),m=!1;else{for(;o>1;)r.sqrTo(n,f),r.sqrTo(f,n),o-=2;o>0?r.sqrTo(n,f):(p=n,n=f,f=p),r.mulTo(f,a[d],n)}for(;h>=0&&!(e[h]&1<<s);)r.sqrTo(n,f),p=n,n=f,f=p,--s<0&&(s=this.DB-1,--h)}return r.revert(n)},v.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return v.ZERO;for(var i=e.clone(),r=this.clone(),s=T(1),n=T(0),a=T(0),o=T(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),t?(s.isEven()&&n.isEven()||(s.addTo(this,s),n.subTo(e,n)),s.rShiftTo(1,s)):n.isEven()||n.subTo(e,n),n.rShiftTo(1,n);for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(e,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);i.compareTo(r)>=0?(i.subTo(r,i),t&&s.subTo(a,s),n.subTo(o,n)):(r.subTo(i,r),t&&a.subTo(s,a),o.subTo(n,o))}return 0!=r.compareTo(v.ONE)?v.ZERO:o.compareTo(e)>=0?o.subtract(e):o.signum()<0?(o.addTo(e,o),o.signum()<0?o.add(e):o):o},v.prototype.pow=function(e){return this.exp(e,new j)},v.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var r=t;t=i,i=r}var s=t.getLowestSetBit(),n=i.getLowestSetBit();if(n<0)return t;for(s<n&&(n=s),n>0&&(t.rShiftTo(n,t),i.rShiftTo(n,i));t.signum()>0;)(s=t.getLowestSetBit())>0&&t.rShiftTo(s,t),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return n>0&&i.lShiftTo(n,i),i},v.prototype.isProbablePrime=function(e){var t,i=this.abs();if(1==i.t&&i[0]<=M[M.length-1]){for(t=0;t<M.length;++t)if(i[0]==M[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<M.length;){for(var r=M[t],s=t+1;s<M.length&&r<q;)r*=M[s++];for(r=i.modInt(r);t<s;)if(r%M[t++]==0)return!1}return i.millerRabin(e)},v.prototype.square=function(){var e=x();return this.squareTo(e),e},H.prototype.init=function(e){var t,i,r;for(t=0;t<256;++t)this.S[t]=t;for(i=0,t=0;t<256;++t)i=i+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[i],this.S[i]=r;this.i=0,this.j=0},H.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var z,V,K,G,W,J,$;function Z(){!function(e){V[K++]^=255&e,V[K++]^=e>>8&255,V[K++]^=e>>16&255,V[K++]^=e>>24&255,K>=256&&(K-=256)}((new Date).getTime())}if(null==V){if(V=new Array,K=0,void 0!==h&&(void 0!==h.crypto||void 0!==h.msCrypto))if((W=h.crypto||h.msCrypto).getRandomValues)for(J=new Uint8Array(32),W.getRandomValues(J),G=0;G<32;++G)V[K++]=J[G];else if("Netscape"==p.appName&&p.appVersion<"5")for($=h.crypto.random(32),G=0;G<$.length;++G)V[K++]=255&$.charCodeAt(G);for(;K<256;)G=Math.floor(65536*Math.random()),V[K++]=G>>>8,V[K++]=255&G;K=0,Z()}function Y(){if(null==z){for(Z(),(z=new H).init(V),K=0;K<V.length;++K)V[K]=0;K=0}return z.next()}function X(){}function Q(e,t){return new v(e,t)}function ee(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function te(e,t){this.x=t,this.q=e}function ie(e,t,i,r){this.curve=e,this.x=t,this.y=i,this.z=null==r?v.ONE:r,this.zinv=null}function re(e,t,i){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(i),this.infinity=new ie(this,null,null)}X.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=Y()},ee.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},ee.prototype.setPublic=function(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=Q(e,16),this.e=parseInt(t,16)}},ee.prototype.type="RSA",ee.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),i=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(i)<0;)t=t.add(this.p);return t.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},ee.prototype.setPrivate=function(e,t,i){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=i;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=Q(e,16),this.e=parseInt(t,16),this.d=Q(i,16)}},ee.prototype.setPrivateEx=function(e,t,i,r,s,n,a,o){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=Q(e,16),this.e=parseInt(t,16),this.d=Q(i,16),this.p=Q(r,16),this.q=Q(s,16),this.dmp1=Q(n,16),this.dmq1=Q(a,16),this.coeff=Q(o,16)},ee.prototype.generate=function(e,t){var i=new X,r=e>>1;this.e=parseInt(t,16);for(var s=new v(t,16),n=e/2-100,a=v.ONE.shiftLeft(n);;){for(;this.p=new v(e-r,1,i),0!=this.p.subtract(v.ONE).gcd(s).compareTo(v.ONE)||!this.p.isProbablePrime(10););for(;this.q=new v(r,1,i),0!=this.q.subtract(v.ONE).gcd(s).compareTo(v.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var c=this.q.subtract(this.p).abs();if(!(c.bitLength()<n||c.compareTo(a)<=0)){var l=this.p.subtract(v.ONE),u=this.q.subtract(v.ONE),d=l.multiply(u);if(0==d.gcd(s).compareTo(v.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=s.modInverse(d),this.dmp1=this.d.mod(l),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0},te.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.x.equals(e.x)},te.prototype.toBigInteger=function(){return this.x},te.prototype.negate=function(){return new te(this.q,this.x.negate().mod(this.q))},te.prototype.add=function(e){return new te(this.q,this.x.add(e.toBigInteger()).mod(this.q))},te.prototype.subtract=function(e){return new te(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))},te.prototype.multiply=function(e){return new te(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))},te.prototype.square=function(){return new te(this.q,this.x.square().mod(this.q))},te.prototype.divide=function(e){return new te(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))},te.prototype.sqrt=function(){return new te(this.q,this.x.sqrt().mod(this.q))},ie.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ie.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ie.prototype.equals=function(e){return e==this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(v.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(v.ZERO))},ie.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(v.ZERO)&&!this.y.toBigInteger().equals(v.ZERO)},ie.prototype.negate=function(){return new ie(this.curve,this.x,this.y.negate(),this.z)},ie.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),i=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(v.ZERO.equals(i))return v.ZERO.equals(t)?this.twice():this.curve.getInfinity();var r=new v("3"),s=this.x.toBigInteger(),n=this.y.toBigInteger(),a=(e.x.toBigInteger(),e.y.toBigInteger(),i.square()),o=a.multiply(i),c=s.multiply(a),l=t.square().multiply(this.z),u=l.subtract(c.shiftLeft(1)).multiply(e.z).subtract(o).multiply(i).mod(this.curve.q),d=c.multiply(r).multiply(t).subtract(n.multiply(o)).subtract(l.multiply(t)).multiply(e.z).add(t.multiply(o)).mod(this.curve.q),p=o.multiply(this.z).multiply(e.z).mod(this.curve.q);return new ie(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(d),p)},ie.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=new v("3"),t=this.x.toBigInteger(),i=this.y.toBigInteger(),r=i.multiply(this.z),s=r.multiply(i).mod(this.curve.q),n=this.curve.a.toBigInteger(),a=t.square().multiply(e);v.ZERO.equals(n)||(a=a.add(this.z.square().multiply(n)));var o=(a=a.mod(this.curve.q)).square().subtract(t.shiftLeft(3).multiply(s)).shiftLeft(1).multiply(r).mod(this.curve.q),c=a.multiply(e).multiply(t).subtract(s.shiftLeft(1)).shiftLeft(2).multiply(s).subtract(a.square().multiply(a)).mod(this.curve.q),l=r.square().multiply(r).shiftLeft(3).mod(this.curve.q);return new ie(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(c),l)},ie.prototype.multiply=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,i=e,r=i.multiply(new v("3")),s=this.negate(),n=this,a=this.curve.q.subtract(e),o=a.multiply(new v("3")),c=new ie(this.curve,this.x,this.y),l=c.negate();for(t=r.bitLength()-2;t>0;--t){n=n.twice();var u=r.testBit(t);u!=i.testBit(t)&&(n=n.add(u?this:s))}for(t=o.bitLength()-2;t>0;--t){c=c.twice();var d=o.testBit(t);d!=a.testBit(t)&&(c=c.add(d?c:l))}return n},ie.prototype.multiplyTwo=function(e,t,i){var r;r=e.bitLength()>i.bitLength()?e.bitLength()-1:i.bitLength()-1;for(var s=this.curve.getInfinity(),n=this.add(t);r>=0;)s=s.twice(),e.testBit(r)?s=i.testBit(r)?s.add(n):s.add(this):i.testBit(r)&&(s=s.add(t)),--r;return s},re.prototype.getQ=function(){return this.q},re.prototype.getA=function(){return this.a},re.prototype.getB=function(){return this.b},re.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)},re.prototype.getInfinity=function(){return this.infinity},re.prototype.fromBigInteger=function(e){return new te(this.q,e)},re.prototype.decodePointHex=function(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),i=(e.substr(2),this.fromBigInteger(new v(o,16))),r=this.getA(),s=this.getB(),n=i.square().add(r).multiply(i).add(s).sqrt();return"03"==t&&(n=n.negate()),new ie(this,i,n);case 4:case 6:case 7:var a=(e.length-2)/2,o=e.substr(2,a),c=e.substr(a+2,a);return new ie(this,this.fromBigInteger(new v(o,16)),this.fromBigInteger(new v(c,16)));default:return null}},te.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ie.prototype.getEncoded=function(e){var t=function(e,t){var i=e.toByteArrayUnsigned();if(t<i.length)i=i.slice(i.length-t);else for(;t>i.length;)i.unshift(0);return i},i=this.getX().toBigInteger(),r=this.getY().toBigInteger(),s=t(i,32);return e?r.isEven()?s.unshift(2):s.unshift(3):(s.unshift(4),s=s.concat(t(r,32))),s},ie.decodeFrom=function(e,t){t[0];var i=t.length-1,r=t.slice(1,1+i/2),s=t.slice(1+i/2,1+i);r.unshift(0),s.unshift(0);var n=new v(r),a=new v(s);return new ie(e,e.fromBigInteger(n),e.fromBigInteger(a))},ie.decodeFromHex=function(e,t){t.substr(0,2);var i=t.length-2,r=t.substr(2,i/2),s=t.substr(2+i/2,i/2),n=new v(r,16),a=new v(s,16);return new ie(e,e.fromBigInteger(n),e.fromBigInteger(a))},ie.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),i=e.y.subtract(this.y).divide(t),r=i.square().subtract(this.x).subtract(e.x),s=i.multiply(this.x.subtract(r)).subtract(this.y);return new ie(this.curve,r,s)},ie.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(v.valueOf(2)),t=this.curve.fromBigInteger(v.valueOf(3)),i=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),r=i.square().subtract(this.x.multiply(e)),s=i.multiply(this.x.subtract(r)).subtract(this.y);return new ie(this.curve,r,s)},ie.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,i=e,r=i.multiply(new v("3")),s=this.negate(),n=this;for(t=r.bitLength()-2;t>0;--t){n=n.twice();var a=r.testBit(t);a!=i.testBit(t)&&(n=n.add2D(a?this:s))}return n},ie.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),i=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),s=this.curve.getQ(),n=t.multiply(t).mod(s),a=e.multiply(e).multiply(e).add(i.multiply(e)).add(r).mod(s);return n.equals(a)},ie.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ie.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),i=this.getY().toBigInteger();if(t.compareTo(v.ONE)<0||t.compareTo(e.subtract(v.ONE))>0)throw new Error("x coordinate out of bounds");if(i.compareTo(v.ONE)<0||i.compareTo(e.subtract(v.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var se=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),i={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(e,t,r){return t?i[t]:String.fromCharCode(parseInt(r,16))}var s=new String(""),n=Object.hasOwnProperty;return function(i,a){var o,c,l=i.match(e),u=l[0],d=!1;"{"===u?o={}:"["===u?o=[]:(o=[],d=!0);for(var p=[o],h=1-d,m=l.length;h<m;++h){var f;switch((u=l[h]).charCodeAt(0)){default:(f=p[0])[c||f.length]=+u,c=void 0;break;case 34:if(-1!==(u=u.substring(1,u.length-1)).indexOf("\\")&&(u=u.replace(t,r)),f=p[0],!c){if(!(f instanceof Array)){c=u||s;break}c=f.length}f[c]=u,c=void 0;break;case 91:f=p[0],p.unshift(f[c||f.length]=[]),c=void 0;break;case 93:case 125:p.shift();break;case 102:(f=p[0])[c||f.length]=!1,c=void 0;break;case 110:(f=p[0])[c||f.length]=null,c=void 0;break;case 116:(f=p[0])[c||f.length]=!0,c=void 0;break;case 123:f=p[0],p.unshift(f[c||f.length]={}),c=void 0}}if(d){if(1!==p.length)throw new Error;o=o[0]}else if(p.length)throw new Error;if(a){var g=function(e,t){var i=e[t];if(i&&"object"==typeof i){var r=null;for(var s in i)if(n.call(i,s)&&i!==e){var o=g(i,s);void 0!==o?i[s]=o:(r||(r=[]),r.push(s))}if(r)for(var c=r.length;--c>=0;)delete i[r[c]]}return a.call(e,t,i)};o=g({"":o},"")}return o}}();void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),ne.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return Ge(e)},this.getPEMStringFromHex=function(e,t){return Ce(e,t)},this.newObject=function(e){var t=ne.asn1,i=t.ASN1Object,r=t.DERBoolean,s=t.DERInteger,n=t.DERBitString,a=t.DEROctetString,o=t.DERNull,c=t.DERObjectIdentifier,l=t.DEREnumerated,u=t.DERUTF8String,d=t.DERNumericString,p=t.DERPrintableString,h=t.DERTeletexString,m=t.DERIA5String,f=t.DERUTCTime,g=t.DERGeneralizedTime,_=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,v=t.DERSet,x=t.DERTaggedObject,S=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var w=Object.keys(e);if(1!=w.length)throw new Error("key of param shall be only one.");var E=w[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+E+":"))throw new Error("undefined key: "+E);if("bool"==E)return new r(e[E]);if("int"==E)return new s(e[E]);if("bitstr"==E)return new n(e[E]);if("octstr"==E)return new a(e[E]);if("null"==E)return new o(e[E]);if("oid"==E)return new c(e[E]);if("enum"==E)return new l(e[E]);if("utf8str"==E)return new u(e[E]);if("numstr"==E)return new d(e[E]);if("prnstr"==E)return new p(e[E]);if("telstr"==E)return new h(e[E]);if("ia5str"==E)return new m(e[E]);if("utctime"==E)return new f(e[E]);if("gentime"==E)return new g(e[E]);if("visstr"==E)return new _(e[E]);if("bmpstr"==E)return new y(e[E]);if("asn1"==E)return new i(e[E]);if("seq"==E){for(var C=e[E],A=[],T=0;T<C.length;T++){var P=S(C[T]);A.push(P)}return new b({array:A})}if("set"==E){for(C=e[E],A=[],T=0;T<C.length;T++){P=S(C[T]);A.push(P)}return new v({array:A})}if("tag"==E){var I=e[E];if("[object Array]"===Object.prototype.toString.call(I)&&3==I.length){var k=S(I[2]);return new x({tag:I[0],explicit:I[1],obj:k})}return new x(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).tohex()}},ne.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",i=parseInt(e.substr(0,2),16),r=(t=Math.floor(i/40)+"."+i%40,""),s=2;s<e.length;s+=2){var n=("00000000"+parseInt(e.substr(s,2),16).toString(2)).slice(-8);if(r+=n.substr(1,7),"0"==n.substr(0,1))t=t+"."+new v(r,2).toString(10),r=""}return t},ne.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",r=new v(e,10).toString(2),s=7-r.length%7;7==s&&(s=0);for(var n="",a=0;a<s;a++)n+="0";r=n+r;for(a=0;a<r.length-1;a+=7){var o=r.substr(a,7);a!=r.length-7&&(o="1"+o),i+=t(parseInt(o,2))}return i};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",s=e.split("."),n=40*parseInt(s[0])+parseInt(s[1]);r+=t(n),s.splice(0,2);for(var a=0;a<s.length;a++)r+=i(s[a]);return r},ne.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var i=t.length/2;if(i>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+e.toString(16));return(128+i).toString(16)+t},this.tohex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},ne.asn1.DERAbstractString=function(e){ne.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=_e(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},Qe(ne.asn1.DERAbstractString,ne.asn1.ASN1Object),ne.asn1.DERAbstractTime=function(e){ne.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,i){var r=this.zeroPadding,s=this.localDateToUTC(e),n=String(s.getFullYear());"utc"==t&&(n=n.substr(2,2));var a=n+r(String(s.getMonth()+1),2)+r(String(s.getDate()),2)+r(String(s.getHours()),2)+r(String(s.getMinutes()),2)+r(String(s.getSeconds()),2);if(!0===i){var o=s.getMilliseconds();if(0!=o){var c=r(String(o),3);a=a+"."+(c=c.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.setByParam=function(e){this.hV=null,this.hTLV=null,this.params=e},this.getString=function(){},this.setString=function(e){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.str=e},this.setByDate=function(e){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.date=e},this.setByDateValue=function(e,t,i,r,s,n){var a=new Date(Date.UTC(e,t-1,i,r,s,n,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},Qe(ne.asn1.DERAbstractTime,ne.asn1.ASN1Object),ne.asn1.DERAbstractStructured=function(e){ne.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},Qe(ne.asn1.DERAbstractStructured,ne.asn1.ASN1Object),ne.asn1.DERBoolean=function(e){ne.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},Qe(ne.asn1.DERBoolean,ne.asn1.ASN1Object),ne.asn1.DERInteger=function(e){ne.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=Ge;this.setByBigInteger=function(e){this.isModified=!0,this.params={bigint:e}},this.setByInteger=function(e){this.isModified=!0,this.params=e},this.setValueHex=function(e){this.isModified=!0,this.params={hex:e}},this.getFreshValueHex=function(){var e=this.params,i=null;if(null==e)throw new Error("value not set");if("object"==typeof e&&null!=e.hex)return this.hV=e.hex,this.hV;if("number"==typeof e)i=new v(String(e),10);else if(null!=e.int)i=new v(String(e.int),10);else{if(null==e.bigint)throw new Error("wrong parameter");i=e.bigint}return this.hV=t(i),this.hV},null!=e&&(this.params=e)},Qe(ne.asn1.DERInteger,ne.asn1.ASN1Object),ne.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ne.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}ne.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var i="0"+e;this.hTLV=null,this.isModified=!0,this.hV=i+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0),e+="0000000".substr(0,t);for(var i="",r=0;r<e.length-1;r+=8){var s=e.substr(r,8),n=parseInt(s,2).toString(16);1==n.length&&(n="0"+n),i+=n}this.hTLV=null,this.isModified=!0,this.hV="0"+t+i},this.setByBooleanArray=function(e){for(var t="",i=0;i<e.length;i++)1==e[i]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},Qe(ne.asn1.DERBitString,ne.asn1.ASN1Object),ne.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ne.asn1.ASN1Util.newObject(e.obj);e.hex=t.tohex()}ne.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},Qe(ne.asn1.DEROctetString,ne.asn1.DERAbstractString),ne.asn1.DERNull=function(){ne.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Qe(ne.asn1.DERNull,ne.asn1.ASN1Object),ne.asn1.DERObjectIdentifier=function(e){ne.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=ze(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=ne.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.DERObjectIdentifier,ne.asn1.ASN1Object),ne.asn1.DEREnumerated=function(e){ne.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Ge(e)},this.setByInteger=function(e){var t=new v(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},Qe(ne.asn1.DEREnumerated,ne.asn1.ASN1Object),ne.asn1.DERUTF8String=function(e){ne.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},Qe(ne.asn1.DERUTF8String,ne.asn1.DERAbstractString),ne.asn1.DERNumericString=function(e){ne.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},Qe(ne.asn1.DERNumericString,ne.asn1.DERAbstractString),ne.asn1.DERPrintableString=function(e){ne.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},Qe(ne.asn1.DERPrintableString,ne.asn1.DERAbstractString),ne.asn1.DERTeletexString=function(e){ne.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},Qe(ne.asn1.DERTeletexString,ne.asn1.DERAbstractString),ne.asn1.DERIA5String=function(e){ne.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},Qe(ne.asn1.DERIA5String,ne.asn1.DERAbstractString),ne.asn1.DERVisibleString=function(e){ne.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},Qe(ne.asn1.DERVisibleString,ne.asn1.DERAbstractString),ne.asn1.DERBMPString=function(e){ne.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},Qe(ne.asn1.DERBMPString,ne.asn1.DERAbstractString),ne.asn1.DERUTCTime=function(e){ne.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var e=this.params;if(null==this.params&&(e={date:new Date}),"string"==typeof e){if(!e.match(/^[0-9]{12}Z$/)&&!e.match(/^[0-9]{12}\.[0-9]+Z$/))throw new Error("malformed string for UTCTime: "+e);this.hV=pe(e)}else if(null!=e.str)this.hV=pe(e.str);else if(null==e.date&&1==e.millis){var t=new Date;this.hV=pe(this.formatDate(t,"utc",!0))}else if(null!=e.date&&e.date instanceof Date){var i=!0===e.millis;this.hV=pe(this.formatDate(e.date,"utc",i))}else e instanceof Date&&(this.hV=pe(this.formatDate(e,"utc")));if(null==this.hV)throw new Error("parameter not specified properly for UTCTime");return this.hV},null!=e&&this.setByParam(e)},Qe(ne.asn1.DERUTCTime,ne.asn1.DERAbstractTime),ne.asn1.DERGeneralizedTime=function(e){ne.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.params=e,this.getFreshValueHex=function(){var e=this.params;if(null==this.params&&(e={date:new Date}),"string"==typeof e){if(!e.match(/^[0-9]{14}Z$/)&&!e.match(/^[0-9]{14}\.[0-9]+Z$/))throw new Error("malformed string for GeneralizedTime: "+e);this.hV=pe(e)}else if(null!=e.str)this.hV=pe(e.str);else if(null==e.date&&1==e.millis){var t=new Date;this.hV=pe(this.formatDate(t,"gen",!0))}else if(null!=e.date&&e.date instanceof Date){var i=!0===e.millis;this.hV=pe(this.formatDate(e.date,"gen",i))}else e instanceof Date&&(this.hV=pe(this.formatDate(e,"gen")));if(null==this.hV)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},null!=e&&this.setByParam(e)},Qe(ne.asn1.DERGeneralizedTime,ne.asn1.DERAbstractTime),ne.asn1.DERSequence=function(e){ne.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].tohex()}return this.hV=e,this.hV}},Qe(ne.asn1.DERSequence,ne.asn1.DERAbstractStructured),ne.asn1.DERSet=function(e){ne.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var i=this.asn1Array[t];e.push(i.tohex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},Qe(ne.asn1.DERSet,ne.asn1.DERAbstractStructured),ne.asn1.DERTaggedObject=function(e){ne.asn1.DERTaggedObject.superclass.constructor.call(this);var t=ne.asn1,i=ce,r=i.getV,s=(i.isASN1HEX,t.ASN1Util.newObject);this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(e,t,i){this.params={tag:t,explicit:e,obj:i}},this.getFreshValueHex=function(){var e=this.params;if(null==e.explicit&&(e.explicit=!0),null!=e.tage&&(e.tag=e.tage,e.explicit=!0),null!=e.tagi&&(e.tag=e.tagi,e.explicit=!1),null!=e.str)this.hV=_e(e.str);else if(null!=e.hex)this.hV=e.hex;else{if(null==e.obj)throw new Error("str, hex nor obj not specified");var i;e.obj instanceof t.ASN1Object?i=e.obj.tohex():"object"==typeof e.obj&&(i=s(e.obj).tohex()),e.explicit?this.hV=i:this.hV=r(i,0)}return null==e.tag&&(e.tag="a0"),this.hT=e.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.DERTaggedObject,ne.asn1.ASN1Object);var ne,ae,oe,ce=new function(){};function le(e){for(var t=new Array,i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function ue(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t}function de(e){for(var t="",i=0;i<e.length;i++){var r=e[i].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function pe(e){return de(le(e))}function he(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function me(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function fe(e){return e.length%2==1&&(e="0"+e),he(_(e))}function ge(e){return y(me(e))}function _e(e){return ke(Ue(e)).toLowerCase()}function ye(e){try{return decodeURIComponent(Re(e))}catch(e){return null}}function be(e){return ye(function(e){for(var t=e.match(/.{1,2}/g),i=[],r=0;r<t.length;r++){var s=parseInt(t[r],16);161<=s&&s<=191?(i.push("c2"),i.push(t[r])):192<=s&&s<=255?(i.push("c3"),i.push((s-64).toString(16))):i.push(t[r])}return i.join("")}(e))}function ve(e){for(var t="",i=0;i<e.length-1;i+=2)t+=String.fromCharCode(parseInt(e.substr(i,2),16));return t}function xe(e){for(var t="",i=0;i<e.length;i++)t+=("0"+e.charCodeAt(i).toString(16)).slice(-2);return t}function Se(e){return _(e)}function we(e,t){return e=(e=e.replace(new RegExp("(.{"+t+"})","g"),"$1\r\n")).replace(/\s+$/,"")}function Ee(e){return y(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Ce(e,t){return"-----BEGIN "+t+"-----\r\n"+we(Se(e),64)+"\r\n-----END "+t+"-----\r\n"}function Ae(e,t){if(-1==e.indexOf("-----BEGIN "))throw new Error("can't find PEM header");return Ee(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Te(e){var t,i,r,s,n,a,o,c,l,u;if(u=(e=Ie(e)).match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return t=parseInt(u[1]),i=parseInt(u[2])-1,r=parseInt(u[3]),s=parseInt(u[4]),n=parseInt(u[5]),a=parseInt(u[6]),o=0,""!==(c=u[7])&&(l=(c.substr(1)+"00").substr(0,3),o=parseInt(l)),Date.UTC(t,i,r,s,n,a,o);throw new Error("unsupported zulu format: "+e)}function Pe(e){return Math.round(Te(e)/1e3)}function Ie(e){return e.match(/^[0-9]{12}Z$/)||e.match(/^[0-9]{12}[.][0-9]*Z$/)?e.match(/^[0-4]/)?"20"+e:"19"+e:e}function ke(e){return e.replace(/%/g,"")}function Re(e){return e.replace(/(..)/g,"%$1")}function Fe(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var i=(e=e.toLowerCase()).split(":").length-1;if(i<2)throw t;var r=":".repeat(7-i+2),s=(e=e.replace("::",r)).split(":");if(8!=s.length)throw t;for(var n=0;n<8;n++)s[n]=("0000"+s[n]).slice(-4);return s.join("")}function Be(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+e);var t=(e=e.toLowerCase()).match(/.{1,4}/g);t=t.map((function(e){return e.replace(/^0+/,"")})),t=t.map((function(e){return""==e?"0":e}));var i=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null==i)return e.slice(1,-1);var r=i.sort().slice(-1)[0];return"::"!=(e=e.replace(r.substr(0,r.length-1),":")).substr(0,2)&&(e=e.substr(1)),"::"!=e.substr(-2,2)&&(e=e.substr(0,e.length-1)),e}function Oe(e){var t=new Error("malformed hex value");if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8==e.length){try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}else{if(16!=e.length){if(32==e.length)return Be(e);if(64==e.length){try{return Be(e.substr(0,32))+"/"+Ne(e.substr(32))}catch(e){throw t}return}return e}try{return Oe(e.substr(0,8))+"/"+Ne(e.substr(8))}catch(e){throw t}}}function Ne(e){var t,i=new Error("malformed mask");try{t=new v(e,16).toString(2)}catch(e){throw i}if(!t.match(/^1*0*$/))throw i;return t.replace(/0+$/,"").length}function De(e){var t=new Error("malformed IP address");if(!(e=e.toLowerCase(e)).match(/^[0-9a-f.:/]+$/))throw t;if(!e.match(/^[0-9.]+$/)){var i;if(e.match(/^[0-9.]+\/[0-9]+$/))return De((i=e.split("/"))[0])+je(parseInt(i[1]),32);if(e.match(/^[0-9a-f:]+$/)&&-1!==e.indexOf(":"))return Fe(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&-1!==e.indexOf(":"))return Fe((i=e.split("/"))[0])+je(parseInt(i[1]),128);throw t}var r=e.split(".");if(4!==r.length)throw t;var s="";try{for(var n=0;n<4;n++){s+=("0"+parseInt(r[n]).toString(16)).slice(-2)}return s}catch(e){throw t}}function je(e,t){return 32==t&&0==e?"00000000":128==t&&0==e?"00000000000000000000000000000000":new v(Array(e+1).join("1")+Array(t-e+1).join("0"),2).toString(16)}function Le(e){var t=e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),i=parseInt(e.substr(2),16);if(0==t&i<128)return String.fromCharCode(i);if(t<8){var r=128|63&i;return ye((192|(7&t)<<3|(192&i)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&i)>>6;var s=128|63&i;return ye((224|(240&t)>>4).toString(16)+r.toString(16)+s.toString(16))}));return t.join("")}function Ue(e){for(var t=encodeURIComponent(e),i="",r=0;r<t.length;r++)"%"==t[r]?(i+=t.substr(r,3),r+=2):i=i+"%"+pe(t[r]);return i}function Me(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function qe(e){return!!e.match(/^[0-9A-Za-z-_.]+$/)}function He(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}ce.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var i=parseInt(e.substr(t+3,1));return 0==i?-1:0<i&&i<10?i+1:-2},ce.getL=function(e,t){var i=ce.getLblen(e,t);return i<1?"":e.substr(t+2,2*i)},ce.getVblen=function(e,t){var i;return""==(i=ce.getL(e,t))?-1:("8"===i.substr(0,1)?new v(i.substr(2),16):new v(i,16)).intValue()},ce.getVidx=function(e,t){var i=ce.getLblen(e,t);return i<0?i:t+2*(i+1)},ce.getV=function(e,t){var i=ce.getVidx(e,t),r=ce.getVblen(e,t);return e.substr(i,2*r)},ce.getTLV=function(e,t){return e.substr(t,2)+ce.getL(e,t)+ce.getV(e,t)},ce.getTLVblen=function(e,t){return 2+2*ce.getLblen(e,t)+2*ce.getVblen(e,t)},ce.getNextSiblingIdx=function(e,t){return ce.getVidx(e,t)+2*ce.getVblen(e,t)},ce.getChildIdx=function(e,t){var i,r,s,n=ce,a=[];i=n.getVidx(e,t),r=2*n.getVblen(e,t),"03"==e.substr(t,2)&&(i+=2,r-=2),s=0;for(var o=i;s<=r;){var c=n.getTLVblen(e,o);if((s+=c)<=r&&a.push(o),o+=c,s>=r)break}return a},ce.getNthChildIdx=function(e,t,i){return ce.getChildIdx(e,t)[i]},ce.getIdxbyList=function(e,t,i,r){var s,n,a=ce;return 0==i.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(s=i.shift())>=(n=a.getChildIdx(e,t)).length?-1:a.getIdxbyList(e,n[s],i,r)},ce.getIdxbyListEx=function(e,t,i,r){var s,n,a=ce;if(0==i.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;s=i.shift(),n=a.getChildIdx(e,t);for(var o=0,c=0;c<n.length;c++){var l=e.substr(n[c],2);if("number"==typeof s&&!a.isContextTag(l)&&o==s||"string"==typeof s&&a.isContextTag(l,s))return a.getIdxbyListEx(e,n[c],i,r);a.isContextTag(l)||o++}return-1},ce.getTLVbyList=function(e,t,i,r){var s=ce,n=s.getIdxbyList(e,t,i,r);return-1==n||n>=e.length?null:s.getTLV(e,n)},ce.getTLVbyListEx=function(e,t,i,r){var s=ce,n=s.getIdxbyListEx(e,t,i,r);return-1==n?null:s.getTLV(e,n)},ce.getVbyList=function(e,t,i,r,s){var n,a,o=ce;return-1==(n=o.getIdxbyList(e,t,i,r))||n>=e.length?null:(a=o.getV(e,n),!0===s&&(a=a.substr(2)),a)},ce.getVbyListEx=function(e,t,i,r,s){var n,a,o=ce;return-1==(n=o.getIdxbyListEx(e,t,i,r))?null:(a=o.getV(e,n),"03"==e.substr(n,2)&&!1!==s&&(a=a.substr(2)),a)},ce.getInt=function(e,t,i){null==i&&(i=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return i;var s=ce.getV(e,t);return"02"==r?parseInt(s,16):Je(s)}catch(e){return i}},ce.getOID=function(e,t,i){null==i&&(i=null);try{return"06"!=e.substr(t,2)?i:Ve(ce.getV(e,t))}catch(e){return i}},ce.getOIDName=function(e,t,i){null==i&&(i=null);try{var r=ce.getOID(e,t,i);if(r==i)return i;var s=ne.asn1.x509.OID.oid2name(r);return""==s?r:s}catch(e){return i}},ce.getString=function(e,t,i){null==i&&(i=null);try{return ve(ce.getV(e,t))}catch(e){return i}},ce.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},i=[],r=e.substr(0,2),s=parseInt(r,16);i[0]=new String(Math.floor(s/40)),i[1]=new String(s%40);for(var n=e.substr(2),a=[],o=0;o<n.length/2;o++)a.push(parseInt(n.substr(2*o,2),16));var c=[],l="";for(o=0;o<a.length;o++)128&a[o]?l+=t((127&a[o]).toString(2),7):(l+=t((127&a[o]).toString(2),7),c.push(new String(parseInt(l,2))),l="");var u=i.join(".");return c.length>0&&(u=u+"."+c.join(".")),u},ce.dump=function(e,t,i,r){var s=ce,n=s.getV,a=s.dump,o=s.getChildIdx,c=e;e instanceof ne.asn1.ASN1Object&&(c=e.tohex());var l=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===i&&(i=0),void 0===r&&(r="");var u,d=t.ommit_long_octet;if("01"==(u=c.substr(i,2)))return"00"==(p=n(c,i))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==u)return r+"INTEGER "+l(p=n(c,i),d)+"\n";if("03"==u){var p=n(c,i);if(s.isASN1HEX(p.substr(2))){var h=r+"BITSTRING, encapsulates\n";return h+=a(p.substr(2),t,0,r+"  ")}return r+"BITSTRING "+l(p,d)+"\n"}if("04"==u){p=n(c,i);if(s.isASN1HEX(p)){h=r+"OCTETSTRING, encapsulates\n";return h+=a(p,t,0,r+"  ")}return r+"OCTETSTRING "+l(p,d)+"\n"}if("05"==u)return r+"NULL\n";if("06"==u){var m=n(c,i),f=ne.asn1.ASN1Util.oidHexToInt(m),g=ne.asn1.x509.OID.oid2name(f),_=f.replace(/\./g," ");return""!=g?r+"ObjectIdentifier "+g+" ("+_+")\n":r+"ObjectIdentifier ("+_+")\n"}if("0a"==u)return r+"ENUMERATED "+parseInt(n(c,i))+"\n";if("0c"==u)return r+"UTF8String '"+ye(n(c,i))+"'\n";if("13"==u)return r+"PrintableString '"+ye(n(c,i))+"'\n";if("14"==u)return r+"TeletexString '"+ye(n(c,i))+"'\n";if("16"==u)return r+"IA5String '"+ye(n(c,i))+"'\n";if("17"==u)return r+"UTCTime "+ye(n(c,i))+"\n";if("18"==u)return r+"GeneralizedTime "+ye(n(c,i))+"\n";if("1a"==u)return r+"VisualString '"+ye(n(c,i))+"'\n";if("1e"==u)return r+"BMPString '"+Le(n(c,i))+"'\n";if("30"==u){if("3000"==c.substr(i,4))return r+"SEQUENCE {}\n";h=r+"SEQUENCE\n";var y=t;if((2==(x=o(c,i)).length||3==x.length)&&"06"==c.substr(x[0],2)&&"04"==c.substr(x[x.length-1],2)){g=s.oidname(n(c,x[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=g,y=b}for(var v=0;v<x.length;v++)h+=a(c,y,x[v],r+"  ");return h}if("31"==u){h=r+"SET\n";var x=o(c,i);for(v=0;v<x.length;v++)h+=a(c,t,x[v],r+"  ");return h}if(128&(u=parseInt(u,16))){var S=31&u;if(32&u){for(h=r+"["+S+"]\n",x=o(c,i),v=0;v<x.length;v++)h+=a(c,t,x[v],r+"  ");return h}p=n(c,i);if(ce.isASN1HEX(p)){var h=r+"["+S+"]\n";return h+=a(p,t,0,r+"  ")}return("68747470"==p.substr(0,8)||"subjectAltName"===t.x509ExtName&&2==S)&&(p=ye(p)),h=r+"["+S+"] "+p+"\n"}return r+"UNKNOWN("+u+") "+n(c,i)+"\n"},ce.parse=function(e){var t=ce,i=t.parse,r=t.isASN1HEX,s=t.getV,n=t.getTLV,a=t.getChildIdx,o=ne.asn1,c=o.ASN1Util.oidHexToInt,l=o.x509.OID.oid2name,u=ye,d=Le,p=be,h={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},m=e.substr(0,2),f={},g=s(e,0);if("01"==m)return"0101ff"==e?{bool:!0}:{bool:!1};if("02"==m)return{int:{hex:g}};if("03"==m)try{if("00"!=g.substr(0,2))throw"not encap";var _=g.substr(2);if(!r(_))throw"not encap";return{bitstr:{obj:i(_)}}}catch(e){var y=null;return g.length<=10&&(y=Ze(g)),null==y?{bitstr:{hex:g}}:{bitstr:{bin:y}}}else if("04"==m)try{if(!r(g))throw"not encap";return{octstr:{obj:i(g)}}}catch(e){return{octstr:{hex:g}}}else{if("05"==m)return{null:""};if("06"==m){var b=c(g),v=l(b);return""==v?{oid:b}:{oid:v}}if("0a"==m)return g.length>4?{enum:{hex:g}}:{enum:parseInt(g,16)};if("30"==m||"31"==m)return f[h[m]]=function(e){for(var t=[],r=a(e,0),s=0;s<r.length;s++){var o=r[s],c=n(e,o),l=i(c);t.push(l)}return t}(e),f;if("14"==m){var x=p(g);return f[h[m]]={str:x},f}if("1e"==m){x=d(g);return f[h[m]]={str:x},f}if(-1!=":0c:12:13:16:17:18:1a:".indexOf(m)){x=u(g);return f[h[m]]={str:x},f}if(m.match(/^8[0-9]$/))return null==(x=u(g))|""==x||null!=x.match(/[\x00-\x1F\x7F-\x9F]/)||null!=x.match(/[\u0000-\u001F\u0080–\u009F]/)?{tag:{tag:m,explicit:!1,hex:g}}:{tag:{tag:m,explicit:!1,str:x}};if(!m.match(/^a[0-9]$/)){var S=new ne.asn1.ASN1Object;return S.hV=g,{asn1:{tlv:m+S.getLengthHexFromValue()+g}}}try{if(!r(g))throw new Error("not encap");return{tag:{tag:m,explicit:!0,obj:i(g)}}}catch(e){return{tag:{tag:m,explicit:!0,hex:g}}}}},ce.isContextTag=function(e,t){var i,r;e=e.toLowerCase();try{i=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&i);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&i)&&(31&i)==r))}catch(e){return!1}},ce.isASN1HEX=function(e){var t=ce;if(e.length%2==1)return!1;var i=t.getVblen(e,0),r=e.substr(0,2),s=t.getL(e,0);return e.length-r.length-s.length==2*i},ce.checkStrictDER=function(e,t,i,r,s){var n=ce;if(void 0===i){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!ne.lang.String.isHex(e))throw new Error("not hex string");i=e.length,s=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(n.getL(e,t).length>2*s)throw new Error("L of TLV too long: idx="+t);var a=n.getVblen(e,t);if(a>r)throw new Error("value of L too long than hex: idx="+t);var o=n.getTLV(e,t),c=o.length-2-n.getL(e,t).length;if(c!==2*a)throw new Error("V string length and L's value not the same:"+c+"/"+2*a);if(0===t&&e.length!=o.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+o.length);var l=e.substr(t,2);if("02"===l){var u=n.getVidx(e,t);if("00"==e.substr(u,2)&&e.charCodeAt(u+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(l,16)){for(var d=n.getVblen(e,t),p=0,h=n.getChildIdx(e,t),m=0;m<h.length;m++){p+=n.getTLV(e,h[m]).length,n.checkStrictDER(e,h[m],i,r,s)}if(2*d!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*d+"!="+p)}},ce.oidname=function(e){var t=ne.asn1;ne.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var i=t.x509.OID.oid2name(e);return""===i&&(i=e),i},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.x509&&ne.asn1.x509||(ne.asn1.x509={}),ne.asn1.x509.Certificate=function(e){ne.asn1.x509.Certificate.superclass.constructor.call(this);var t=ne.asn1,i=t.DERBitString,r=t.DERSequence,s=t.x509,n=s.TBSCertificate,a=s.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var i=e.tbsobj.tohex(),r=new ne.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(i),e.sighex=r.sign()},this.getPEM=function(){return Ce(this.tohex(),"CERTIFICATE")},this.tohex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new n(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new i({hex:"00"+e.sighex})),new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&(this.params=e)},Qe(ne.asn1.x509.Certificate,ne.asn1.ASN1Object),ne.asn1.x509.TBSCertificate=function(e){ne.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=ne.asn1,i=t.x509,r=t.DERTaggedObject,s=t.DERInteger,n=t.DERSequence,a=i.AlgorithmIdentifier,o=i.Time,c=i.X500Name,l=i.Extensions,u=i.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var i=2;null!=t.version&&(i=t.version-1);var d=new r({obj:new s({int:i})});e.push(d)}return e.push(new s(t.serial)),e.push(new a({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new n({array:[new o(t.notbefore),new o(t.notafter)]})),e.push(new c(t.subject)),e.push(new u(et.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new l(t.ext)})),new ne.asn1.DERSequence({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.TBSCertificate,ne.asn1.ASN1Object),ne.asn1.x509.Extensions=function(e){ne.asn1.x509.Extensions.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.tohex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var s=this.aParam[t],n=s.extname,a=null;if(null!=s.extn)a=new r.PrivateExtension(s);else if("subjectKeyIdentifier"==n)a=new r.SubjectKeyIdentifier(s);else if("keyUsage"==n)a=new r.KeyUsage(s);else if("subjectAltName"==n)a=new r.SubjectAltName(s);else if("issuerAltName"==n)a=new r.IssuerAltName(s);else if("basicConstraints"==n)a=new r.BasicConstraints(s);else if("nameConstraints"==n)a=new r.NameConstraints(s);else if("cRLDistributionPoints"==n)a=new r.CRLDistributionPoints(s);else if("certificatePolicies"==n)a=new r.CertificatePolicies(s);else if("policyMappings"==n)a=new r.PolicyMappings(s);else if("policyConstraints"==n)a=new r.PolicyConstraints(s);else if("inhibitAnyPolicy"==n)a=new r.InhibitAnyPolicy(s);else if("authorityKeyIdentifier"==n)a=new r.AuthorityKeyIdentifier(s);else if("extKeyUsage"==n)a=new r.ExtKeyUsage(s);else if("authorityInfoAccess"==n)a=new r.AuthorityInfoAccess(s);else if("cRLNumber"==n)a=new r.CRLNumber(s);else if("cRLReason"==n)a=new r.CRLReason(s);else if("ocspNonce"==n)a=new r.OCSPNonce(s);else if("ocspNoCheck"==n)a=new r.OCSPNoCheck(s);else if("adobeTimeStamp"==n)a=new r.AdobeTimeStamp(s);else{if("subjectDirectoryAttributes"!=n)throw new Error("extension not supported:"+JSON.stringify(s));a=new r.SubjectDirectoryAttributes(s)}null!=a&&e.push(a)}return new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.x509.Extensions,ne.asn1.ASN1Object),ne.asn1.x509.Extension=function(e){ne.asn1.x509.Extension.superclass.constructor.call(this);var t=ne.asn1,i=t.DERObjectIdentifier,r=t.DEROctetString,s=(t.DERBitString,t.DERBoolean),n=t.DERSequence;this.tohex=function(){var e=new i({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),a=new Array;return a.push(e),this.critical&&a.push(new s),a.push(t),new n({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},Qe(ne.asn1.x509.Extension,ne.asn1.ASN1Object),ne.asn1.x509.KeyUsage=function(e){ne.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Error,i={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var e=this.getBinValue();return this.asn1ExtnValue=new ne.asn1.DERBitString({bin:e}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var e=this.params;if("object"!=typeof e||"object"!=typeof e.names&&"string"!=typeof e.bin)throw new t("parameter not yet set");if(null!=e.names)return Ye(e.names,i);if(null!=e.bin)return e.bin;throw new t("parameter not set properly")},this.oid="2.5.29.15",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.KeyUsage,ne.asn1.x509.Extension),ne.asn1.x509.BasicConstraints=function(e){ne.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERBoolean,r=t.DERInteger,s=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new i),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new s({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},Qe(ne.asn1.x509.BasicConstraints,ne.asn1.x509.Extension),ne.asn1.x509.CRLDistributionPoints=function(e){ne.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=ne.asn1,i=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(e){for(var r=[],s=0;s<e.length;s++)if(e[s]instanceof ne.asn1.ASN1Object)r.push(e[s]);else{var n=new i.DistributionPoint(e[s]);r.push(n)}this.asn1ExtnValue=new t.DERSequence({array:r})},this.setByOneURI=function(e){var t=new i.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},Qe(ne.asn1.x509.CRLDistributionPoints,ne.asn1.x509.Extension),ne.asn1.x509.DistributionPoint=function(e){ne.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=ne.asn1,i=t.x509.DistributionPointName;this.tohex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var i=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(i)}return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new i(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))},Qe(ne.asn1.x509.DistributionPoint,ne.asn1.ASN1Object),ne.asn1.x509.DistributionPointName=function(e){ne.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=ne.asn1,i=t.DERTaggedObject;if(this.tohex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new i({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},Qe(ne.asn1.x509.DistributionPointName,ne.asn1.ASN1Object),ne.asn1.x509.CertificatePolicies=function(e){ne.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=ne.asn1,i=t.x509,r=t.DERSequence,s=i.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new s(this.params.array[t]));var i=new r({array:e});return this.asn1ExtnValue=i,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.CertificatePolicies,ne.asn1.x509.Extension),ne.asn1.x509.PolicyInformation=function(e){ne.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,s=t.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],n=0;n<this.params.array.length;n++)t.push(new s(this.params.array[n]));t.length>0&&e.push(new i({array:t}))}return new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyInformation,ne.asn1.ASN1Object),ne.asn1.x509.PolicyQualifierInfo=function(e){ne.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERSequence,r=t.DERIA5String,s=t.DERObjectIdentifier,n=t.x509.UserNotice;this.params=null,this.tohex=function(){return void 0!==this.params.cps?new i({array:[new s({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).tohex():null!=this.params.unotice?new i({array:[new s({oid:"1.3.6.1.5.5.7.2.2"}),new n(this.params.unotice)]}).tohex():void 0},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyQualifierInfo,ne.asn1.ASN1Object),ne.asn1.x509.UserNotice=function(e){ne.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=ne.asn1.DERSequence,i=(ne.asn1.DERInteger,ne.asn1.x509.DisplayText),r=ne.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new i(this.params.exptext)),new t({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.UserNotice,ne.asn1.ASN1Object),ne.asn1.x509.NoticeReference=function(e){ne.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=ne.asn1.DERSequence,i=ne.asn1.DERInteger,r=ne.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var s=[],n=this.params.noticenum,a=0;a<n.length;a++)s.push(new i(n[a]));e.push(new t({array:s}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.NoticeReference,ne.asn1.ASN1Object),ne.asn1.x509.DisplayText=function(e){ne.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},Qe(ne.asn1.x509.DisplayText,ne.asn1.DERAbstractString),ne.asn1.x509.PolicyMappings=function(e){ne.asn1.x509.PolicyMappings.superclass.constructor.call(this,e);var t=ne.asn1,i=(t.x509,t.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){for(var e=this.params,t=[],r=0;r<e.array.length;r++){var s=e.array[r];t.push({seq:[{oid:s[0]},{oid:s[1]}]})}return this.asn1ExtnValue=i({seq:t}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyMappings,ne.asn1.x509.Extension),ne.asn1.x509.PolicyConstraints=function(e){ne.asn1.x509.PolicyConstraints.superclass.constructor.call(this,e);var t=ne.asn1,i=(t.x509,t.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[];return null!=e.reqexp&&t.push({tag:{tagi:"80",obj:{int:e.reqexp}}}),null!=e.inhibit&&t.push({tag:{tagi:"81",obj:{int:e.inhibit}}}),this.asn1ExtnValue=i({seq:t}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.PolicyConstraints,ne.asn1.x509.Extension),ne.asn1.x509.InhibitAnyPolicy=function(e){ne.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,e);var t=ne.asn1,i=(t.x509,t.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=i({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.InhibitAnyPolicy,ne.asn1.x509.Extension),ne.asn1.x509.NameConstraints=function(e){ne.asn1.x509.NameConstraints.superclass.constructor.call(this,e);var t=ne.asn1,i=t.x509,r=t.ASN1Util.newObject,s=i.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[];if(null!=e.permit&&null!=e.permit.length){for(var i=[],n=0;n<e.permit.length;n++)i.push(new s(e.permit[n]));t.push({tag:{tagi:"a0",obj:{seq:i}}})}if(null!=e.exclude&&null!=e.exclude.length){var a=[];for(n=0;n<e.exclude.length;n++)a.push(new s(e.exclude[n]));t.push({tag:{tagi:"a1",obj:{seq:a}}})}return this.asn1ExtnValue=r({seq:t}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.NameConstraints,ne.asn1.x509.Extension),ne.asn1.x509.GeneralSubtree=function(e){ne.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var t=ne.asn1,i=t.x509.GeneralName,r=t.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params,t=[new i(e)];return null!=e.min&&t.push({tag:{tagi:"80",obj:{int:e.min}}}),null!=e.max&&t.push({tag:{tagi:"81",obj:{int:e.max}}}),r({seq:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.GeneralSubtree,ne.asn1.ASN1Object),ne.asn1.x509.ExtKeyUsage=function(e){ne.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=ne.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var i=0;i<e.length;i++){var r=new t.DERObjectIdentifier(e[i]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},Qe(ne.asn1.x509.ExtKeyUsage,ne.asn1.x509.Extension),ne.asn1.x509.AuthorityKeyIdentifier=function(e){ne.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=ne,i=t.asn1,r=i.DERTaggedObject,s=i.x509.GeneralNames;t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new s([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new i.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new ne.asn1.DEROctetString(e);else if("object"==typeof e&&ne.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=et.getKey(e));var i=et.getKeyID(t);this.asn1KID=new ne.asn1.DEROctetString({hex:i})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new ne.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new ne.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new ne.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new st;t.readCertPEM(e);var i=t.getSerialNumberHex();this.asn1CertSN=new ne.asn1.DERInteger({hex:i})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},Qe(ne.asn1.x509.AuthorityKeyIdentifier,ne.asn1.x509.Extension),ne.asn1.x509.SubjectKeyIdentifier=function(e){ne.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=ne.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&ne.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var i=e;"string"==typeof e&&(i=et.getKey(e));var r=et.getKeyID(i);this.asn1KID=new ne.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},Qe(ne.asn1.x509.SubjectKeyIdentifier,ne.asn1.x509.Extension),ne.asn1.x509.AuthorityInfoAccess=function(e){ne.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,i=ne.asn1,r=i.DERSequence,s=i.DERObjectIdentifier,n=i.x509.GeneralName,a=0;a<e.length;a++){var o,c=e[a];if(void 0!==c.ocsp)o=new r({array:[new s({oid:"1.3.6.1.5.5.7.48.1"}),new n({uri:c.ocsp})]});else{if(void 0===c.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(c));o=new r({array:[new s({oid:"1.3.6.1.5.5.7.48.2"}),new n({uri:c.caissuer})]})}t.push(o)}this.asn1ExtnValue=new r({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},Qe(ne.asn1.x509.AuthorityInfoAccess,ne.asn1.x509.Extension),ne.asn1.x509.SubjectAltName=function(e){ne.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new ne.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},Qe(ne.asn1.x509.SubjectAltName,ne.asn1.x509.Extension),ne.asn1.x509.IssuerAltName=function(e){ne.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new ne.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},Qe(ne.asn1.x509.IssuerAltName,ne.asn1.x509.Extension),ne.asn1.x509.SubjectDirectoryAttributes=function(e){ne.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERSequence,r=t.ASN1Util.newObject,s=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var n=this.params.array[t];if(null==n.attr||null==n.array){var a={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={gentime:n.str};else if("placeOfBirth"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={utf8str:n.str};else if("gender"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={prnstr:n.str};else if("countryOfCitizenship"==n.attr)a.seq[0].oid=s(n.attr),a.seq[1].set[0]={prnstr:n.str};else{if("countryOfResidence"!=n.attr)throw new Error("unsupported attribute: "+n.attr);a.seq[0].oid=s(n.attr),a.seq[1].set[0]={prnstr:n.str}}e.push(new r(a))}else{var o={seq:[{oid:n.attr},{set:n.array}]};e.push(r(o))}}var c=new i({array:e});return this.asn1ExtnValue=c,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},Qe(ne.asn1.x509.SubjectDirectoryAttributes,ne.asn1.x509.Extension),ne.asn1.x509.PrivateExtension=function(e){ne.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=ne,i=t.lang.String.isHex,r=t.asn1,s=r.x509.OID.name2oid,n=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=s(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&i(e))return e;if("object"==typeof e)try{return n(e).tohex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},Qe(ne.asn1.x509.PrivateExtension,ne.asn1.x509.Extension),ne.asn1.x509.CRL=function(e){ne.asn1.x509.CRL.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.DERBitString,s=t.x509,n=s.AlgorithmIdentifier,a=s.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).tohex(),t=new ne.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return Ce(this.tohex(),"X509 CRL")},this.tohex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new n({name:e.sigalg})),t.push(new r({hex:"00"+e.sighex})),new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&(this.params=e)},Qe(ne.asn1.x509.CRL,ne.asn1.ASN1Object),ne.asn1.x509.TBSCertList=function(e){ne.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=ne.asn1,i=t.DERInteger,r=t.DERSequence,s=t.DERTaggedObject,n=(t.DERObjectIdentifier,t.x509),a=n.AlgorithmIdentifier,o=n.Time,c=n.Extensions,l=n.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,s=0;s<t.length;s++){var n=[new i(t[s].sn),new o(t[s].date)];null!=t[s].ext&&n.push(new c(t[s].ext)),e.push(new r({array:n}))}return new r({array:e})},this.tohex=function(){var e=[],t=this.params;if(null!=t.version){var n=t.version-1,u=new i({int:n});e.push(u)}if(e.push(new a({name:t.sigalg})),e.push(new l(t.issuer)),e.push(new o(t.thisupdate)),null!=t.nextupdate&&e.push(new o(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var d=new c(t.ext);e.push(new s({tag:"a0",explicit:!0,obj:d}))}return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.TBSCertList,ne.asn1.ASN1Object),ne.asn1.x509.CRLEntry=function(e){ne.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=ne.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.tohex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},Qe(ne.asn1.x509.CRLEntry,ne.asn1.ASN1Object),ne.asn1.x509.CRLNumber=function(e){ne.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},Qe(ne.asn1.x509.CRLNumber,ne.asn1.x509.Extension),ne.asn1.x509.CRLReason=function(e){ne.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},Qe(ne.asn1.x509.CRLReason,ne.asn1.x509.Extension),ne.asn1.x509.OCSPNonce=function(e){ne.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},Qe(ne.asn1.x509.OCSPNonce,ne.asn1.x509.Extension),ne.asn1.x509.OCSPNoCheck=function(e){ne.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ne.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},Qe(ne.asn1.x509.OCSPNoCheck,ne.asn1.x509.Extension),ne.asn1.x509.AdobeTimeStamp=function(e){ne.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=ne.asn1,i=t.DERInteger,r=t.DERBoolean,s=t.DERSequence,n=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new i(1)];return t.push(new n({uri:e.uri})),null!=e.reqauth&&t.push(new r(e.reqauth)),this.asn1ExtnValue=new s({array:t}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.AdobeTimeStamp,ne.asn1.x509.Extension),ne.asn1.x509.X500Name=function(e){ne.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=ne.asn1,i=t.x509,r=i.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.split("/");i.shift();for(var s=[],n=0;n<i.length;n++)if(i[n].match(/^[^=]+=.+$/))s.push(i[n]);else{var a=s.length-1;s[a]=s[a]+"/"+i[n]}for(n=0;n<s.length;n++)this.asn1Array.push(new r({str:s[n],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=i.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var i in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(i)){var s=new r({str:i+"="+e[i],rule:this.sRule});this.asn1Array?this.asn1Array.push(s):this.asn1Array=[s]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new st).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new st).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.tohex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i={array:this.paramArray[e]};"utf8"!=this.sRule&&(i.rule=this.sRule);var s=new r(i);this.asn1Array.push(s)}var n=new t.DERSequence({array:this.asn1Array});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.X500Name,ne.asn1.ASN1Object),ne.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),t=t.map((function(e){return e.replace(/,/,"\\,")})),t.join(",")},ne.asn1.x509.X500Name.onelineToLDAP=function(e){return ne.asn1.x509.X500Name.compatToLDAP(e)},ne.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),i=!1,r=[],s=0;t.length>0;s++){var n=t.shift();if(!0===i){var a=(r.pop()+","+n).replace(/\\,/g,",");r.push(a),i=!1}else r.push(n);"\\"===n.substr(-1,1)&&(i=!0)}return r=r.map((function(e){return e.replace("/","\\/")})),r.reverse(),"/"+r.join("/")},ne.asn1.x509.X500Name.ldapToOneline=function(e){return ne.asn1.x509.X500Name.ldapToCompat(e)},ne.asn1.x509.RDN=function(e){ne.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=ne.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new ne.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=ne.asn1.x509.RDN.parseString(e),i=0;i<t.length;i++)this.addByString(t[i])},this.tohex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var i=this.paramArray[e];void 0!==i.rule&&"utf8"!=this.sRule&&(i.rule=this.sRule);var r=new t(i);this.asn1Array.push(r)}var s=new ne.asn1.DERSet({array:this.asn1Array});return this.TLV=s.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.RDN,ne.asn1.ASN1Object),ne.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),i=!1,r=[],s=0;t.length>0;s++){var n=t.shift();if(!0===i){var a=(r.pop()+"+"+n).replace(/\\\+/g,"+");r.push(a),i=!1}else r.push(n);"\\"===n.substr(-1,1)&&(i=!0)}var o=!1,c=[];for(s=0;r.length>0;s++){n=r.shift();if(!0===o){var l=c.pop();if(n.match(/"$/)){a=(l+"+"+n).replace(/^([^=]+)="(.*)"$/,"$1=$2");c.push(a),o=!1}else c.push(l+"+"+n)}else c.push(n);n.match(/^[^=]+="/)&&(o=!0)}return c},ne.asn1.x509.AttributeTypeAndValue=function(e){ne.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=ne,i=t.asn1,r=i.DERSequence,s=i.DERUTF8String,n=i.DERPrintableString,a=i.DERTeletexString,o=i.DERIA5String,c=i.DERVisibleString,l=i.DERBMPString,u=t.lang.String.isMail,d=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var i=e.match(/^([^=]+)=(.+)$/);if(!i)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(i[1],i[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,i=this.sRule;return"prn"===i?"CN"==e&&u(t)?"ia5":d(t)?"prn":"utf8":"utf8"===i?"CN"==e&&u(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,i){void 0!==i&&(this.sRule=i),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new s({str:t});if("prn"==e)return new n({str:t});if("tel"==e)return new a({str:t});if("ia5"==e)return new o({str:t});if("vis"==e)return new c({str:t});if("bmp"==e)return new l({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.tohex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=ne.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),i=new r({array:[e,t]});return this.TLV=i.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.AttributeTypeAndValue,ne.asn1.ASN1Object),ne.asn1.x509.SubjectPublicKeyInfo=function(e){ne.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=ne,i=t.asn1,r=i.DERInteger,s=i.DERBitString,n=i.DERObjectIdentifier,a=i.DERSequence,o=i.ASN1Util.newObject,c=i.x509.AlgorithmIdentifier,l=t.crypto;l.ECDSA,l.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new a({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.tohex=function(){var e=this.getASN1Object();return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(e){try{if(e instanceof ee){var t=o({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).tohex();this.asn1AlgId=new c({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+t})}}catch(e){}try{if(e instanceof ne.crypto.ECDSA){var i=new n({name:e.curveName});this.asn1AlgId=new c({name:"ecPublicKey",asn1params:i}),this.asn1SubjPKey=new s({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof ne.crypto.DSA){i=new o({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new c({name:"dsa",asn1params:i});var a=new r({bigint:e.y});this.asn1SubjPKey=new s({hex:"00"+a.tohex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},Qe(ne.asn1.x509.SubjectPublicKeyInfo,ne.asn1.ASN1Object),ne.asn1.x509.Time=function(e){ne.asn1.x509.Time.superclass.constructor.call(this);var t=ne.asn1,i=t.DERUTCTime,r=t.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(e){this.timeParams=e},this.setByParam=function(e){this.params=e},this.getType=function(e){return e.match(/^[0-9]{12}Z$/)?"utc":e.match(/^[0-9]{14}Z$/)?"gen":e.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":e.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var e=this.params,t=null;if("string"==typeof e&&(e={str:e}),null==e||!e.str||null!=e.type&&null!=e.type||(e.type=this.getType(e.str)),null!=e&&e.str?("utc"==e.type&&(t=new i(e.str)),"gen"==e.type&&(t=new r(e.str))):t="gen"==this.type?new r:new i,null==t)throw new Error("wrong setting for Time");return this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},ne.asn1.x509.Time_bak=function(e){ne.asn1.x509.Time_bak.superclass.constructor.call(this);var t=ne.asn1,i=t.DERUTCTime,r=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.tohex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new i(this.timeParams):new r(this.timeParams):"utc"==this.type?new i:new r,this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},Qe(ne.asn1.x509.Time,ne.asn1.ASN1Object),ne.asn1.x509.AlgorithmIdentifier=function(e){ne.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=ne.asn1,i=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var r in i)r===this.nameAlg&&(e=i[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var s=[this.asn1Alg];null!==this.asn1Params&&s.push(this.asn1Params);var n=new t.DERSequence({array:s});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},Qe(ne.asn1.x509.AlgorithmIdentifier,ne.asn1.ASN1Object),ne.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},ne.asn1.x509.GeneralName=function(e){ne.asn1.x509.GeneralName.superclass.constructor.call(this);var t=ne.asn1,i=t.x509,r=i.X500Name,s=i.OtherName,n=t.DERIA5String,a=(t.DERPrintableString,t.DEROctetString),o=t.DERTaggedObject,c=t.ASN1Object,l=Error;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e,t,i=this.params,u=!1;if(void 0!==i.other)e="a0",t=new s(i.other);else if(void 0!==i.rfc822)e="81",t=new n({str:i.rfc822});else if(void 0!==i.dns)e="82",t=new n({str:i.dns});else if(void 0!==i.dn)e="a4",u=!0,t="string"==typeof i.dn?new r({str:i.dn}):i.dn instanceof ne.asn1.x509.X500Name?i.dn:new r(i.dn);else if(void 0!==i.ldapdn)e="a4",u=!0,t=new r({ldapstr:i.ldapdn});else if(void 0!==i.certissuer||void 0!==i.certsubj){var d,p;e="a4",u=!0;var h=null;if(void 0!==i.certsubj?(d=!1,p=i.certsubj):(d=!0,p=i.certissuer),p.match(/^[0-9A-Fa-f]+$/),-1!=p.indexOf("-----BEGIN ")&&(h=Ae(p)),null==h)throw new Error("certsubj/certissuer not cert");var m,f=new st;f.hex=h,m=d?f.getIssuerHex():f.getSubjectHex(),(t=new c).hTLV=m}else if(void 0!==i.uri)e="86",t=new n({str:i.uri});else{if(void 0===i.ip)throw new l("improper params");var g;e="87";var _=i.ip;try{if(_.match(/^[0-9a-f]+$/)){var y=_.length;if(8!=y&&16!=y&&32!=y&&64!=y)throw"err";g=_}else g=De(_)}catch(e){throw new l("malformed IP address: "+i.ip+":"+e.message)}t=new a({hex:g})}return new o({tag:e,explicit:u,obj:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.GeneralName,ne.asn1.ASN1Object),ne.asn1.x509.GeneralNames=function(e){ne.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=ne.asn1;this.setByParamArray=function(e){for(var i=0;i<e.length;i++){var r=new t.x509.GeneralName(e[i]);this.asn1Array.push(r)}},this.tohex=function(){return new t.DERSequence({array:this.asn1Array}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},Qe(ne.asn1.x509.GeneralNames,ne.asn1.ASN1Object),ne.asn1.x509.OtherName=function(e){ne.asn1.x509.OtherName.superclass.constructor.call(this);var t=ne.asn1,i=t.DERObjectIdentifier,r=t.DERSequence,s=t.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params;if(null==e.oid||null==e.value)throw new Error("oid or value not specified");var t=new i({oid:e.oid}),n=s({tag:{tag:"a0",explicit:!0,obj:e.value}});return new r({array:[t,n]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.x509.OtherName,ne.asn1.ASN1Object),ne.asn1.x509.OID=new function(){var e=ne.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.name2oidList[t])throw"Name of ObjectIdentifier not defined: "+t;var i=this.name2oidList[t],r=new e({oid:i});return this.objCache[t]=r,r},this.atype2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];var i;if(t.match(/^\d+\.\d+\.[0-9.]+$/))i=t;else if(void 0!==this.atype2oidList[t])i=this.atype2oidList[t];else{if(void 0===this.name2oidList[t])throw new Error("AttributeType name undefined: "+t);i=this.name2oidList[t]}var r=new e({oid:i});return this.objCache[t]=r,r},this.registerOIDs=function(e){if(this.checkOIDs(e))for(var t in e)this.name2oidList[t]=e[t]},this.checkOIDs=function(e){try{var t=Object.keys(e);return 0!=t.length&&(t.map((function(e,t,i){if(!this[e].match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")}),e),!0)}catch(e){return!1}}},ne.asn1.x509.OID.oid2name=function(e){var t=ne.asn1.x509.OID.name2oidList;for(var i in t)if(t[i]==e)return i;return""},ne.asn1.x509.OID.oid2atype=function(e){var t=ne.asn1.x509.OID.atype2oidList;for(var i in t)if(t[i]==e)return i;return e},ne.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=ne.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},ne.asn1.x509.X509Util={},ne.asn1.x509.X509Util.newCertPEM=function(e){var t=ne.asn1.x509;t.TBSCertificate;return new(0,t.Certificate)(e).getPEM()},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.cms&&ne.asn1.cms||(ne.asn1.cms={}),ne.asn1.cms.Attribute=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERSet,n=i.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(e){this.params=e},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var e=new n({oid:this.typeOid}),t=new s({array:this.getValueArray()});return new r({array:[e,t]}).tohex()},this.getEncodedHex=function(){return this.tohex()}},Qe(ne.asn1.cms.Attribute,ne.asn1.ASN1Object),ne.asn1.cms.ContentType=function(e){var t=ne.asn1;t.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new t.DERObjectIdentifier(this.params.type)]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ContentType,ne.asn1.cms.Attribute),ne.asn1.cms.MessageDigest=function(e){var t=ne.asn1,i=t.DEROctetString;t.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new i(this.params)]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.MessageDigest,ne.asn1.cms.Attribute),ne.asn1.cms.SigningTime=function(e){var t=ne.asn1;t.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new t.x509.Time(this.params)]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SigningTime,ne.asn1.cms.Attribute),ne.asn1.cms.SigningCertificate=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERSequence,n=r.cms,a=n.ESSCertID;i.crypto;n.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var i=this.params.array,r=[],n=0;n<i.length;n++){var o=i[n];0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!ce.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new a(o))}var c=new s({array:r});return[new s({array:[c]})]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SigningCertificate,ne.asn1.cms.Attribute),ne.asn1.cms.ESSCertID=function(e){ne.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,i=ne,r=i.asn1,s=r.DEROctetString,n=r.DERSequence,a=r.cms.IssuerSerial;this.params=null,this.getCertHash=function(e,r){if(null!=e.hash)return e.hash;if("string"==typeof e&&-1==e.indexOf("-----BEGIN")&&!ce.isASN1HEX(e))return e;var s,n,a;if("string"==typeof e)s=e;else{if(null==e.cert)throw new t("hash nor cert unspecified");s=e.cert}if(n=-1!=s.indexOf("-----BEGIN")?Ae(s):s,"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?n=Ae(e):ce.isASN1HEX(e)&&(n=e)),null!=e.alg)a=e.alg;else{if(null==r)throw new t("hash alg unspecified");a=r}return i.crypto.Util.hashHex(n,a)},this.tohex=function(){var e=this.params,t=this.getCertHash(e,"sha1"),i=[];return i.push(new s({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&i.push(new a(e)),new n({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ESSCertID,ne.asn1.ASN1Object),ne.asn1.cms.SigningCertificateV2=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERSequence,n=(r.x509,r.cms),a=n.ESSCertIDv2;i.crypto;n.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var i=this.params.array,r=[],n=0;n<i.length;n++){var o=i[n];null==e.alg&&0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!ce.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=e.alg&&(o.alg=e.alg),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new a(o))}var c=new s({array:r});return[new s({array:[c]})]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SigningCertificateV2,ne.asn1.cms.Attribute),ne.asn1.cms.ESSCertIDv2=function(e){ne.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);Error;var t=ne.asn1,i=t.DEROctetString,r=t.DERSequence,s=t.cms.IssuerSerial,n=t.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var e=this.params,t=this.getCertHash(e,"sha256"),a=[];return null!=e.alg&&"sha256"!=e.alg&&a.push(new n({name:e.alg})),a.push(new i({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&a.push(new s(e)),new r({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ESSCertIDv2,ne.asn1.cms.ESSCertID),ne.asn1.cms.IssuerSerial=function(e){var t=Error,i=ne.asn1,r=i.DERInteger,s=i.DERSequence,n=i.cms,a=i.x509.GeneralNames,o=st;n.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.tohex=function(){var e,i,n=this.params;if("string"==typeof n&&-1!=n.indexOf("-----BEGIN")||null!=n.cert){var c;c=null!=n.cert?n.cert:n;var l=new o;l.readCertPEM(c),e=l.getIssuer(),i={hex:l.getSerialNumberHex()}}else{if(null==n.issuer||!n.serial)throw new t("cert or issuer and serial parameter not specified");e=n.issuer,i=n.serial}var u=new a([{dn:e}]),d=new r(i);return new s({array:[u,d]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.IssuerSerial,ne.asn1.ASN1Object),ne.asn1.cms.SignerIdentifier=function(e){var t=ne.asn1,i=(t.DERInteger,t.DERSequence,t.cms),r=i.IssuerAndSerialNumber,s=i.SubjectKeyIdentifier;t.x509.X500Name,Error;i.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if("isssn"==e.type)return new r(e).tohex();if("skid"==e.type)return new s(e).tohex();throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SignerIdentifier,ne.asn1.ASN1Object),ne.asn1.cms.IssuerAndSerialNumber=function(e){var t=ne.asn1,i=t.DERInteger,r=t.DERSequence,s=t.cms,n=t.x509.X500Name,a=st,o=Error;s.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e,t,s=this.params;if("string"==typeof s&&-1!=s.indexOf("-----BEGIN")||null!=s.cert){var c;c=null!=s.cert?s.cert:s;var l=new a;l.readCertPEM(c),e=l.getIssuer(),t={hex:l.getSerialNumberHex()}}else{if(null==s.issuer||!s.serial)throw new o("cert or issuer and serial parameter not specified");e=s.issuer,t=s.serial}var u=new n(e),d=new i(t);return new r({array:[u,d]}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.IssuerAndSerialNumber,ne.asn1.ASN1Object),ne.asn1.cms.SubjectKeyIdentifier=function(e){var t=ne.asn1,i=(t.DERInteger,t.DERSequence,t.ASN1Util.newObject),r=t.cms,s=(r.IssuerAndSerialName,r.SubjectKeyIdentifier,t.x509.X500Name,st),n=Error;r.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var e,t=this.params;if(null==t.cert&&null==t.skid)throw new n("property cert nor skid undefined");null!=t.cert?e=new s(t.cert).getExtSubjectKeyIdentifier().kid.hex:null!=t.skid&&(e=t.skid);return i({tag:{tage:"a0",obj:{octstr:{hex:e}}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SubjectKeyIdentifier,ne.asn1.ASN1Object),ne.asn1.cms.AttributeList=function(e){var t=Error,i=ne.asn1,r=i.DERSet,s=i.cms;s.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params;if(null!=this.hTLV)return this.hTLV;var i=!0;null!=e.sortflag&&(i=e.sortflag);for(var n=e.array,a=[],o=0;o<n.length;o++){var c=n[o],l=c.attr;if("contentType"==l)a.push(new s.ContentType(c));else if("messageDigest"==l)a.push(new s.MessageDigest(c));else if("signingTime"==l)a.push(new s.SigningTime(c));else if("signingCertificate"==l)a.push(new s.SigningCertificate(c));else if("signingCertificateV2"==l)a.push(new s.SigningCertificateV2(c));else if("signaturePolicyIdentifier"==l)a.push(new ne.asn1.cades.SignaturePolicyIdentifier(c));else{if("signatureTimeStamp"!=l&&"timeStampToken"!=l)throw new t("unknown attr: "+l);a.push(new ne.asn1.cades.SignatureTimeStamp(c))}}var u=new r({array:a,sortflag:i});return this.hTLV=u.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.AttributeList,ne.asn1.ASN1Object),ne.asn1.cms.SignerInfo=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERInteger,n=r.DEROctetString,a=r.DERSequence,o=r.DERTaggedObject,c=r.cms,l=c.SignerIdentifier,u=c.AttributeList,d=(c.ContentType,c.EncapsulatedContentInfo,c.MessageDigest,c.SignedData,r.x509.AlgorithmIdentifier),p=i.crypto,h=et;c.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var e=this.params,t=e.sigalg,i=new u(e.sattrs).tohex(),r=h.getKey(e.signkey),s=new p.Signature({alg:t});s.init(r),s.updateHex(i);var n=s.sign();e.sighex=n},this.tohex=function(){var e=this.params,i=[];if(i.push(new s({int:e.version})),i.push(new l(e.id)),i.push(new d({name:e.hashalg})),null!=e.sattrs){var r=new u(e.sattrs);try{i.push(new o({tag:"a0",explicit:!1,obj:r}))}catch(e){throw new t("si sattr error: "+e)}}if(null!=e.sigalgfield?i.push(new d({name:e.sigalgfield})):i.push(new d({name:e.sigalg})),null==e.sighex&&null!=e.signkey&&this.sign(),i.push(new n({hex:e.sighex})),null!=e.uattrs){r=new u(e.uattrs);try{i.push(new o({tag:"a1",explicit:!1,obj:r}))}catch(e){throw new t("si uattr error: "+e)}}return new a({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SignerInfo,ne.asn1.ASN1Object),ne.asn1.cms.EncapsulatedContentInfo=function(e){var t=ne.asn1,i=t.DERTaggedObject,r=t.DERSequence,s=t.DERObjectIdentifier,n=t.DEROctetString;t.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];if(t.push(new s(e.type)),null!=e.content&&(null!=e.content.hex||null!=e.content.str)&&1!=e.isDetached){var a=new n(e.content),o=new i({tag:"a0",explicit:!0,obj:a});t.push(o)}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.EncapsulatedContentInfo,ne.asn1.ASN1Object),ne.asn1.cms.ContentInfo=function(e){var t=ne.asn1,i=t.DERTaggedObject,r=t.DERSequence,s=t.DERObjectIdentifier;t.x509.OID.name2obj;ne.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];t.push(new s(e.type));var n=new i({tag:"a0",explicit:!0,obj:e.obj});return t.push(n),new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.ContentInfo,ne.asn1.ASN1Object),ne.asn1.cms.SignedData=function(e){Error;var t=ne.asn1,i=(t.ASN1Object,t.DERInteger),r=t.DERSet,s=t.DERSequence,n=(t.DERTaggedObject,t.cms),a=n.EncapsulatedContentInfo,o=n.SignerInfo,c=n.ContentInfo,l=n.CertificateSet,u=n.RevocationInfoChoices,d=t.x509.AlgorithmIdentifier;ne.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var e=this.params;this._setDigestAlgs(e),this._setContentTypeByEContent(e),this._setMessageDigestByEContent(e),this._setSignerInfoVersion(e),this._setSignedDataVersion(e)},this._setDigestAlgs=function(e){for(var t={},i=e.sinfos,r=0;r<i.length;r++){t[i[r].hashalg]=1}e.hashalgs=Object.keys(t).sort()},this._setContentTypeByEContent=function(e){for(var t=e.econtent.type,i=e.sinfos,r=0;r<i.length;r++){var s=i[r];this._getAttrParamByName(s,"contentType").type=t}},this._setMessageDigestByEContent=function(e){var t=e.econtent,i=(e.econtent.type,t.content.hex);null==i&&"data"==t.type&&null!=t.content.str&&(i=xe(t.content.str));for(var r=e.sinfos,s=0;s<r.length;s++){var n=r[s],a=n.hashalg,o=this._getAttrParamByName(n,"messageDigest"),c=ne.crypto.Util.hashHex(i,a);o.hex=c}},this._getAttrParamByName=function(e,t){for(var i=e.sattrs.array,r=0;r<i.length;r++)if(i[r].attr==t)return i[r]},this._setSignerInfoVersion=function(e){for(var t=e.sinfos,i=0;i<t.length;i++){var r=t[i],s=1;"skid"==r.id.type&&(s=3),r.version=s}},this._setSignedDataVersion=function(e){var t=this._getSignedDataVersion(e);e.version=t},this._getSignedDataVersion=function(e){if(null!=e.revinfos)for(var t=e.revinfos,i=0;i<t.length;i++){if(null!=t[i].ocsp)return 5}var r=e.sinfos;for(i=0;i<r.length;i++){if(3==e.sinfos[i].version)return 3}return"data"!=e.econtent.type?3:1},this.tohex=function(){var e=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=e.fixed&&this.checkAndFixParam();var t=[];t.push(new i({int:e.version}));for(var n=[],c=0;c<e.hashalgs.length;c++){var p=e.hashalgs[c];n.push(new d({name:p}))}t.push(new r({array:n})),t.push(new a(e.econtent)),null!=e.certs&&t.push(new l(e.certs)),null!=e.revinfos&&t.push(new u(e.revinfos));var h=[];for(c=0;c<e.sinfos.length;c++){var m=e.sinfos[c];h.push(new o(m))}return t.push(new r({array:h})),new s({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){return new c({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.SignedData,ne.asn1.ASN1Object),ne.asn1.cms.CertificateSet=function(e){ne.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,i=ne.asn1,r=i.DERTaggedObject,s=i.DERSet,n=i.ASN1Object;this.params=null,this.tohex=function(){var e,i=this.params,a=[];if(i instanceof Array)e=i;else{if(null==i.array)throw new t("cert array not specified");e=i.array}for(var o=0;o<e.length;o++){var c=Ae(e[o]),l=new n;l.hTLV=c,a.push(l)}var u={array:a};0==i.sortflag&&(u.sortflag=!1);var d=new s(u);return new r({tag:"a0",explicit:!1,obj:d}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.CertificateSet,ne.asn1.ASN1Object),ne.asn1.cms.RevocationInfoChoices=function(e){ne.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(!e instanceof Array)throw new Error("params is not array");for(var t=[],i=0;i<e.length;i++)t.push(new ne.asn1.cms.RevocationInfoChoice(e[i]));return ne.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:t}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.RevocationInfoChoices,ne.asn1.ASN1Object),ne.asn1.cms.RevocationInfoChoice=function(e){ne.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(null!=e.crl&&"string"==typeof e.crl){var t=e.crl;return-1!=e.crl.indexOf("-----BEGIN")&&(t=Ae(e.crl)),t}if(null!=e.ocsp)return ne.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new ne.asn1.cms.OtherRevocationFormat(e)}}).tohex();throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.RevocationInfoChoice,ne.asn1.ASN1Object),ne.asn1.cms.OtherRevocationFormat=function(e){ne.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,i=ne,r=i.asn1.ASN1Util.newObject,s=i.lang.String.isHex;this.params=null,this.tohex=function(){var e=this.params;if(null==e.ocsp)throw new t("property ocsp not specified");if(!s(e.ocsp)||!ce.isASN1HEX(e.ocsp))throw new t("ocsp value not ASN.1 hex string");return r({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:e.ocsp}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cms.OtherRevocationFormat,ne.asn1.ASN1Object),ne.asn1.cms.CMSUtil=new function(){},ne.asn1.cms.CMSUtil.newSignedData=function(e){return new ne.asn1.cms.SignedData(e)},ne.asn1.cms.CMSUtil.verifySignedData=function(e){var t=ne,i=t.asn1,r=i.cms,s=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,i.cades.SignaturePolicyIdentifier,t.lang.String.isHex),n=ce,a=n.getVbyList,o=n.getTLVbyList,c=n.getIdxbyList,l=n.getChildIdx,u=n.getTLV,d=n.oidname,p=t.crypto.Util.hashHex;void 0===e.cms&&s(e.cms);var h=e.cms,m=function(e,t){var i=t.idx;t.signerid_issuer1=o(e,i,[1,0],"30"),t.signerid_serial1=a(e,i,[1,1],"02"),t.hashalg=d(a(e,i,[2,0],"06"));var r=c(e,i,[3],"a0");t.idxSignedAttrs=r,f(e,t,r);var s=l(e,i).length;if(s<6)throw"malformed SignerInfo";t.sigalg=d(a(e,i,[s-2,0],"06")),t.sigval=a(e,i,[s-1],"04")},f=function(e,t,i){var r=l(e,i);t.signedAttrIdxList=r;for(var s=0;s<r.length;s++){var n,o=r[s],c=a(e,o,[0],"06");"2a864886f70d010905"===c?(n=ye(a(e,o,[1,0])),t.saSigningTime=n):"2a864886f70d010904"===c&&(n=a(e,o,[1,0],"04"),t.saMessageDigest=n)}},g=function(e,t,i,r){i.verifyDetail={};var s=i.verifyDetail,n=t.parse.econtent,a=i.hashalg,o=i.saMessageDigest;s.validMessageDigest=!1,p(n,a)===o&&(s.validMessageDigest=!0),function(e,t,i){var r,s=t.parse.certsIdx;if(void 0===t.certs){r=[],t.certkeys=[];for(var n=l(e,s),a=0;a<n.length;a++){var o=u(e,n[a]),c=new st;c.readCertHex(o),r[a]=c,t.certkeys[a]=c.getPublicKey()}t.certs=r}else r=t.certs;for(t.cccc=r.length,t.cccci=n.length,a=0;a<r.length;a++){var d=c.getIssuerHex(),p=c.getSerialNumberHex();i.signerid_issuer1===d&&i.signerid_serial1===p&&(i.certkey_idx=a)}}(e,t,i),s.validSignatureValue=!1;var c=i.sigalg,d="31"+u(e,i.idxSignedAttrs).substr(2);i.signedattrshex=d;var h=t.certs[i.certkey_idx].getPublicKey(),m=new ne.crypto.Signature({alg:c});m.init(h),m.updateHex(d);var f=m.verify(i.sigval);s.validSignatureValue_isValid=f,!0===f&&(s.validSignatureValue=!0),i.isValid=!1,s.validMessageDigest&&s.validSignatureValue&&(i.isValid=!0)},_={isValid:!1,parse:{}};return function(e,t){if("2a864886f70d010702"!==a(e,0,[0],"06"))return t;t.cmsType="signedData",t.econtent=a(e,0,[1,0,2,1,0]),function(e,t){for(var i,r=3;r<6;r++)if(void 0!==(i=c(e,0,[1,0,r]))){var s=e.substr(i,2);"a0"===s&&(t.certsIdx=i),"a1"===s&&(t.revinfosIdx=i),"31"===s&&(t.signerinfosIdx=i)}}(e,t),t.signerInfos=[],function(e,t){var i=t.signerinfosIdx;if(void 0!==i){var r=l(e,i);t.signerInfoIdxList=r;for(var s=0;s<r.length;s++){var n={idx:r[s]};m(e,n),t.signerInfos.push(n)}}}(e,t)}(h,_.parse),function(e,t){for(var i=t.parse.signerInfos,r=i.length,s=!0,n=0;n<r;n++){var a=i[n];g(e,t,a,n),a.isValid||(s=!1)}t.isValid=s}(h,_),_},ne.asn1.cms.CMSParser=function(){var e=Error,t=st,i=new t,r=ce,s=r.getV,n=r.getTLV,a=(r.getIdxbyList,r.getTLVbyList),o=r.getTLVbyListEx,c=r.getVbyList,l=r.getVbyListEx,u=r.getChildIdx;this.getCMSSignedData=function(e){var t=a(e,0,[1,0]);return this.getSignedData(t)},this.getSignedData=function(e){var t=u(e,0),i={},r=s(e,t[0]),a=parseInt(r,16);i.version=a;var c=n(e,t[1]);i.hashalgs=this.getHashAlgArray(c);var l=n(e,t[2]);i.econtent=this.getEContent(l);var d=o(e,0,["[0]"]);null!=d&&(i.certs=this.getCertificateSet(d));o(e,0,["[1]"]);var p=o(e,0,[3]);return i.sinfos=this.getSignerInfos(p),i},this.getHashAlgArray=function(e){for(var i=u(e,0),r=new t,s=[],a=0;a<i.length;a++){var o=n(e,i[a]),c=r.getAlgorithmIdentifierName(o);s.push(c)}return s},this.getEContent=function(e){var t={},i=c(e,0,[0]),r=c(e,0,[1,0]);return t.type=ne.asn1.x509.OID.oid2name(ce.hextooidstr(i)),t.content={hex:r},t},this.getSignerInfos=function(e){for(var t=[],i=u(e,0),r=0;r<i.length;r++){var s=n(e,i[r]),a=this.getSignerInfo(s);t.push(a)}return t},this.getSignerInfo=function(e){var t={},s=u(e,0),a=r.getInt(e,s[0],-1);-1!=a&&(t.version=a);var c=n(e,s[1]),d=this.getIssuerAndSerialNumber(c);t.id=d;var p=n(e,s[2]),h=i.getAlgorithmIdentifierName(p);t.hashalg=h;var m=o(e,0,["[0]"]);if(null!=m){var f=this.getAttributeList(m);t.sattrs=f}var g=o(e,0,[3]),_=i.getAlgorithmIdentifierName(g);t.sigalg=_;var y=l(e,0,[4]);t.sighex=y;var b=o(e,0,["[1]"]);if(null!=b){var v=this.getAttributeList(b);t.uattrs=v}return t},this.getSignerIdentifier=function(e){if("30"==e.substr(0,2))return this.getIssuerAndSerialNumber(e);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(e){var t={type:"isssn"},r=u(e,0),a=n(e,r[0]);t.issuer=i.getX500Name(a);var o=s(e,r[1]);return t.serial={hex:o},t},this.getAttributeList=function(e){for(var t=[],i=u(e,0),r=0;r<i.length;r++){var s=n(e,i[r]),a=this.getAttribute(s);t.push(a)}return{array:t}},this.getAttribute=function(e){var t={},i=u(e,0),s=r.getOID(e,i[0]),a=ne.asn1.x509.OID.oid2name(s);t.attr=a;var o=n(e,i[1]),c=u(o,0);if(1==c.length)t.valhex=n(o,c[0]);else{for(var l=[],d=0;d<c.length;d++)l.push(n(o,c[d]));t.valhex=l}return"contentType"==a?this.setContentType(t):"messageDigest"==a?this.setMessageDigest(t):"signingTime"==a?this.setSigningTime(t):"signingCertificate"==a?this.setSigningCertificate(t):"signingCertificateV2"==a?this.setSigningCertificateV2(t):"signaturePolicyIdentifier"==a&&this.setSignaturePolicyIdentifier(t),t},this.setContentType=function(e){var t=r.getOIDName(e.valhex,0,null);null!=t&&(e.type=t,delete e.valhex)},this.setSigningTime=function(e){var t=ye(s(e.valhex,0));e.str=t,delete e.valhex},this.setMessageDigest=function(e){var t=s(e.valhex,0);e.hex=t,delete e.valhex},this.setSigningCertificate=function(e){var t=u(e.valhex,0);if(t.length>0){for(var i=n(e.valhex,t[0]),r=u(i,0),s=[],a=0;a<r.length;a++){var o=n(i,r[a]),c=this.getESSCertID(o);s.push(c)}e.array=s}if(t.length>1){var l=n(e.valhex,t[1]);e.polhex=l}delete e.valhex},this.setSignaturePolicyIdentifier=function(e){var i=u(e.valhex,0);if(i.length>0){var a=r.getOID(e.valhex,i[0]);e.oid=a}if(i.length>1){var o=new t,c=u(e.valhex,i[1]),l=n(e.valhex,c[0]),d=o.getAlgorithmIdentifierName(l);e.alg=d;var p=s(e.valhex,c[1]);e.hash=p}delete e.valhex},this.setSigningCertificateV2=function(e){var t=u(e.valhex,0);if(t.length>0){for(var i=n(e.valhex,t[0]),r=u(i,0),s=[],a=0;a<r.length;a++){var o=n(i,r[a]),c=this.getESSCertIDv2(o);s.push(c)}e.array=s}if(t.length>1){var l=n(e.valhex,t[1]);e.polhex=l}delete e.valhex},this.getESSCertID=function(e){var t={},i=u(e,0);if(i.length>0){var r=s(e,i[0]);t.hash=r}if(i.length>1){var a=n(e,i[1]),o=this.getIssuerSerial(a);null!=o.serial&&(t.serial=o.serial),null!=o.issuer&&(t.issuer=o.issuer)}return t},this.getESSCertIDv2=function(t){var r={},a=u(t,0);if(a.length<1||3<a.length)throw new e("wrong number of elements");var o=0;if("30"==t.substr(a[0],2)){var c=n(t,a[0]);r.alg=i.getAlgorithmIdentifierName(c),o++}else r.alg="sha256";var l=s(t,a[o]);if(r.hash=l,a.length>o+1){var d=n(t,a[o+1]),p=this.getIssuerSerial(d);r.issuer=p.issuer,r.serial=p.serial}return r},this.getIssuerSerial=function(e){var t={},r=u(e,0),a=n(e,r[0]),o=i.getGeneralNames(a)[0].dn;t.issuer=o;var c=s(e,r[1]);return t.serial={hex:c},t},this.getCertificateSet=function(e){for(var t=u(e,0),i=[],r=0;r<t.length;r++){var s=n(e,t[r]);if("30"==s.substr(0,2)){var a=Ce(s,"CERTIFICATE");i.push(a)}}return{array:i,sortflag:!1}}},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.tsp&&ne.asn1.tsp||(ne.asn1.tsp={}),ne.asn1.tsp.TimeStampToken=function(e){var t=ne.asn1.tsp;t.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var e=new t.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=e.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.TimeStampToken,ne.asn1.cms.SignedData),ne.asn1.tsp.TSTInfo=function(e){Error;var t=ne.asn1,i=t.DERSequence,r=t.DERInteger,s=t.DERBoolean,n=t.DERGeneralizedTime,a=t.DERObjectIdentifier,o=t.DERTaggedObject,c=t.tsp,l=c.MessageImprint,u=c.Accuracy,d=(t.x509.X500Name,t.x509.GeneralName);if(c.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var e=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(e.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(e.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(e.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");e.push(this.dGenTime),null!=this.dAccuracy&&e.push(this.dAccuracy),null!=this.dOrdering&&e.push(this.dOrdering),null!=this.dNonce&&e.push(this.dNonce),null!=this.dTsa&&e.push(this.dTsa);var t=new i({array:e});return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e){if("string"==typeof e.policy){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new a({oid:e.policy})}void 0!==e.messageImprint&&(this.dMessageImprint=new l(e.messageImprint)),void 0!==e.serial&&(this.dSerial=new r(e.serial)),void 0!==e.genTime&&(this.dGenTime=new n(e.genTime)),void 0!==e.accuracy&&(this.dAccuracy=new u(e.accuracy)),void 0!==e.ordering&&1==e.ordering&&(this.dOrdering=new s),void 0!==e.nonce&&(this.dNonce=new r(e.nonce)),void 0!==e.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new d({dn:e.tsa})}))}},Qe(ne.asn1.tsp.TSTInfo,ne.asn1.ASN1Object),ne.asn1.tsp.Accuracy=function(e){var t=ne.asn1,i=t.ASN1Util.newObject;t.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];return null!=e.seconds&&"number"==typeof e.seconds&&t.push({int:e.seconds}),null!=e.millis&&"number"==typeof e.millis&&t.push({tag:{tagi:"80",obj:{int:e.millis}}}),null!=e.micros&&"number"==typeof e.micros&&t.push({tag:{tagi:"81",obj:{int:e.micros}}}),i({seq:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.Accuracy,ne.asn1.ASN1Object),ne.asn1.tsp.MessageImprint=function(e){var t=ne.asn1,i=t.DERSequence,r=t.DEROctetString,s=t.x509.AlgorithmIdentifier;t.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=new s({name:e.alg}),n=new r({hex:e.hash});return new i({array:[t,n]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.tsp.MessageImprint,ne.asn1.ASN1Object),ne.asn1.tsp.TimeStampReq=function(e){var t=ne.asn1,i=t.DERSequence,r=t.DERInteger,s=t.DERBoolean,n=(t.ASN1Object,t.DERObjectIdentifier),a=t.tsp,o=a.MessageImprint;a.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];return t.push(new r({int:1})),e.messageImprint instanceof ne.asn1.ASN1Object?t.push(e.messageImprint):t.push(new o(e.messageImprint)),null!=e.policy&&t.push(new n(e.policy)),null!=e.nonce&&t.push(new r(e.nonce)),1==e.certreq&&t.push(new s),new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.TimeStampReq,ne.asn1.ASN1Object),ne.asn1.tsp.TimeStampResp=function(e){var t=ne.asn1,i=t.DERSequence,r=(t.ASN1Object,t.tsp),s=r.PKIStatusInfo;r.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,n=[];if(null!=e.econtent||null!=e.tst)if(null!=e.statusinfo?n.push(new s(e.statusinfo)):n.push(new s("granted")),null!=e.econtent)n.push(new r.TimeStampToken(e).getContentInfo());else{if(!(e.tst instanceof t.ASN1Object))throw new Error("improper member tst value");n.push(e.tst)}else{if(null==e.statusinfo)throw new Error("parameter for token nor statusinfo not specified");n.push(new s(e.statusinfo))}return new i({array:n}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.TimeStampResp,ne.asn1.ASN1Object),ne.asn1.tsp.PKIStatusInfo=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.tsp,n=s.PKIStatus,a=s.PKIFreeText,o=s.PKIFailureInfo;s.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,i=[];if("string"==typeof e)i.push(new n(e));else{if(null==e.status)throw new t("property 'status' unspecified");i.push(new n(e.status)),null!=e.statusstr&&i.push(new a(e.statusstr)),null!=e.failinfo&&i.push(new o(e.failinfo))}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIStatusInfo,ne.asn1.ASN1Object),ne.asn1.tsp.PKIStatus=function(e){var t=Error,i=ne.asn1,r=i.DERInteger;i.tsp.PKIStatus.superclass.constructor.call(this);var s={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var e,i=this.params;if("string"==typeof i)try{e=s[i]}catch(e){throw new t("undefined name: "+i)}else{if("number"!=typeof i)throw new t("unsupported params");e=i}return new r({int:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIStatus,ne.asn1.ASN1Object),ne.asn1.tsp.PKIFreeText=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERUTF8String;i.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(!e instanceof Array)throw new t("wrong params: not array");for(var i=[],n=0;n<e.length;n++)i.push(new s({str:e[n]}));return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIFreeText,ne.asn1.ASN1Object),ne.asn1.tsp.PKIFailureInfo=function(e){var t=Error,i=ne.asn1,r=i.DERBitString,s=i.tsp.PKIFailureInfo,n={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};s.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var e=this.params,i=0;if("number"==typeof e&&0<=e&&e<=25){for(var r=(i|=1<<e).toString(2),s="",a=r.length-1;a>=0;a--)s+=r[a];return s}if("string"==typeof e&&null!=n[e])return Ye([e],n);if("object"==typeof e&&null!=e.length)return Ye(e,n);throw new t("wrong params")},this.tohex=function(){this.params;var e=this.getBinValue();return new r({bin:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.tsp.PKIFailureInfo,ne.asn1.ASN1Object),ne.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(e,t){throw"not implemented yet"}},ne.asn1.tsp.SimpleTSAAdapter=function(e){var t=ne,i=t.asn1.tsp,r=t.crypto.Util.hashHex;i.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(e,t){var s=r(e,t);this.params.econtent.content.messageImprint={alg:t,hash:s},this.params.econtent.content.serial={int:this.serial++};var n=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:n},new i.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.tsp.SimpleTSAAdapter,ne.asn1.tsp.AbstractTSAAdapter),ne.asn1.tsp.FixedTSAAdapter=function(e){var t=ne,i=t.asn1.tsp,r=t.crypto.Util.hashHex;i.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(e,t){var s=r(e,t);return this.params.econtent.content.messageImprint={alg:t,hash:s},new i.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},Qe(ne.asn1.tsp.FixedTSAAdapter,ne.asn1.tsp.AbstractTSAAdapter),ne.asn1.tsp.TSPUtil=new function(){},ne.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new ne.asn1.tsp.TimeStampToken(e)},ne.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){return(new ne.asn1.tsp.TSPParser).getTimeStampReq(e)},ne.asn1.tsp.TSPUtil.parseMessageImprint=function(e){return(new ne.asn1.tsp.TSPParser).getMessageImprint(e)},ne.asn1.tsp.TSPParser=function(){Error;var e=new st,t=ce,i=t.getV,r=t.getTLV,s=t.getIdxbyList,n=(t.getTLVbyListEx,t.getChildIdx),a=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(e){var t=n(e,0);if(1==t.length)return this.getPKIStatusInfo(r(e,t[0]));if(t.length>1){var i=this.getPKIStatusInfo(r(e,t[0])),s=r(e,t[1]),a=this.getToken(s);return a.statusinfo=i,a}},this.getToken=function(e){var t=(new ne.asn1.cms.CMSParser).getCMSSignedData(e);return this.setTSTInfo(t),t},this.setTSTInfo=function(e){var t=e.econtent;if("tstinfo"==t.type){var i=t.content.hex,r=this.getTSTInfo(i);t.content=r}},this.getTSTInfo=function(t){var s={},a=n(t,0),o=i(t,a[1]);s.policy=Ve(o);var c=r(t,a[2]);s.messageImprint=this.getMessageImprint(c);var l=i(t,a[3]);s.serial={hex:l};var u=i(t,a[4]);s.genTime={str:ye(u)};var d=0;if(a.length>5&&"30"==t.substr(a[5],2)){var p=r(t,a[5]);s.accuracy=this.getAccuracy(p),d++}a.length>5+d&&"01"==t.substr(a[5+d],2)&&("ff"==i(t,a[5+d])&&(s.ordering=!0),d++);if(a.length>5+d&&"02"==t.substr(a[5+d],2)){var h=i(t,a[5+d]);s.nonce={hex:h},d++}if(a.length>5+d&&"a0"==t.substr(a[5+d],2)){var m=r(t,a[5+d]);m="30"+m.substr(2),pGeneralNames=e.getGeneralNames(m);var f=pGeneralNames[0].dn;s.tsa=f,d++}if(a.length>5+d&&"a1"==t.substr(a[5+d],2)){var g=r(t,a[5+d]);g="30"+g.substr(2);var _=e.getExtParamArray(g);s.ext=_,d++}return s},this.getAccuracy=function(e){for(var t={},r=n(e,0),s=0;s<r.length;s++){var a=e.substr(r[s],2),o=i(e,r[s]),c=parseInt(o,16);"02"==a?t.seconds=c:"80"==a?t.millis=c:"81"==a&&(t.micros=c)}return t},this.getMessageImprint=function(e){if("30"!=e.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var r={},a=(n(e,0),s(e,0,[0,0])),o=i(e,a),c=t.hextooidstr(o),l=ne.asn1.x509.OID.oid2name(c);if(""==l)throw new Error("hashAlg name undefined: "+c);var u=l,d=s(e,0,[1]);return r.alg=u,r.hash=i(e,d),r},this.getPKIStatusInfo=function(e){var t={},s=n(e,0),o=0;try{var c=i(e,s[0]),l=parseInt(c,16);t.status=a[l]}catch(e){}if(s.length>1&&"30"==e.substr(s[1],2)){var u=r(e,s[1]);t.statusstr=this.getPKIFreeText(u),o++}if(s.length>o&&"03"==e.substr(s[1+o],2)){var d=r(e,s[1+o]);t.failinfo=this.getPKIFailureInfo(d)}return t},this.getPKIFreeText=function(e){for(var i=[],r=n(e,0),s=0;s<r.length;s++)i.push(t.getString(e,r[s]));return i},this.getPKIFailureInfo=function(e){var i=t.getInt(e,0);return null!=o[i]?o[i]:i},this.getTimeStampReq=function(e){var s={certreq:!1},a=n(e,0);if(a.length<2)throw new Error("TimeStampReq must have at least 2 items");var o=r(e,a[1]);s.messageImprint=ne.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var c=2;c<a.length;c++){var l=a[c],u=e.substr(l,2);if("06"==u){var d=i(e,l);s.policy=t.hextooidstr(d)}"02"==u&&(s.nonce=i(e,l)),"01"==u&&(s.certreq=!0)}return s}},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.cades&&ne.asn1.cades||(ne.asn1.cades={}),ne.asn1.cades.SignaturePolicyIdentifier=function(e){var t=ne.asn1.cades,i=t.SignaturePolicyId;t.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.SignaturePolicyIdentifier,ne.asn1.cms.Attribute),ne.asn1.cades.SignaturePolicyId=function(e){var t=ne.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,s=(t.x509.AlgorithmIdentifier,t.cades),n=s.SignaturePolicyId,a=s.OtherHashAlgAndValue;n.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,t=[];return t.push(new r(e.oid)),t.push(new a(e)),new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.SignaturePolicyId,ne.asn1.ASN1Object),ne.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DEROctetString,n=i.x509.AlgorithmIdentifier;i.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if(null==e.alg)throw new t("property 'alg' not specified");if(null==e.hash&&null==e.cert)throw new t("property 'hash' nor 'cert' not specified");var i=null;if(null!=e.hash)i=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var a=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(a=Ae(e.cert)),i=ne.crypto.Util.hashHex(a,e.alg)}var o=[];return o.push(new n({name:e.alg})),o.push(new s({hex:i})),new r({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherHashAlgAndValue,ne.asn1.ASN1Object),ne.asn1.cades.OtherHashValue=function(e){ne.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,i=ne,r=(i.lang.String.isHex,i.asn1.DEROctetString);i.crypto.Util.hashHex;this.params=null,this.tohex=function(){var e=this.params;if(null==e.hash&&null==e.cert)throw new t("hash or cert not specified");var i=null;if(null!=e.hash)i=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var s=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(s=Ae(e.cert)),i=ne.crypto.Util.hashHex(s,"sha1")}return new r({hex:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherHashValue,ne.asn1.ASN1Object),ne.asn1.cades.SignatureTimeStamp=function(e){var t=Error,i=ne,r=i.lang.String.isHex,s=i.asn1,n=s.ASN1Object;s.x509;s.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var e=this.params;if(null!=e.tst){if(r(e.tst))return(s=new n).hTLV=e.tst,[s];if(e.tst instanceof n)return[e.tst];throw new t("params.tst has wrong value")}if(null!=e.res){var i=e.res;if(i instanceof n&&(i=i.tohex()),"string"!=typeof i||!r(i))throw new t("params.res has wrong value");var s;ce.getTLVbyList(i,0,[1]);return(s=new n).hTLV=e.tst,[s]}},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.SignatureTimeStamp,ne.asn1.cms.Attribute),ne.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,i=ne,r=i.asn1,s=r.DERSequence,n=r.cades,a=n.OtherCertID,o=i.lang.String.isHex;n.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var e=this.params,i=[],r=0;r<e.array.length;r++){var n=e.array[r];if("string"==typeof n)if(-1!=n.indexOf("-----BEGIN"))n={cert:n};else{if(!o(n))throw new t("unsupported value: "+n);n={hash:n}}null!=e.alg&&null==n.alg&&(n.alg=e.alg),null!=e.hasis&&null==n.hasis&&(n.hasis=e.hasis);var c=new a(n);i.push(c)}return[new s({array:i})]},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.CompleteCertificateRefs,ne.asn1.cms.Attribute),ne.asn1.cades.OtherCertID=function(e){var t=ne.asn1,i=t.DERSequence,r=t.cms.IssuerSerial,s=t.cades,n=s.OtherHashValue,a=s.OtherHashAlgAndValue;s.OtherCertID.superclass.constructor.call(this),this.params=e,this.tohex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:_isHex(e)&&(e={hash:e}));var t=[],s=null;if(s=null!=e.alg?new a(e):new n(e),t.push(s),null!=e.cert&&1==e.hasis||null!=e.issuer&&null!=e.serial){var o=new r(e);t.push(o)}return new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherCertID,ne.asn1.ASN1Object),ne.asn1.cades.OtherHash=function(e){Error;var t=ne,i=t.asn1,r=(i.cms,i.cades),s=r.OtherHashAlgAndValue,n=r.OtherHashValue,a=(t.crypto.Util.hashHex,t.lang.String.isHex);r.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:a(e)&&(e={hash:e}));return(null!=e.alg?new s(e):new n(e)).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.cades.OtherHash,ne.asn1.ASN1Object),ne.asn1.cades.CAdESUtil=new function(){},ne.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){return(new ne.asn1.cms.CMSParser).getCMSSignedData(e)},ne.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,i){var r=ce,s=r.getChildIdx,n=r.getTLV,a=r.getV,o=ne.asn1,c=o.ASN1Object,l=o.cms,u=l.AttributeList,d=l.SignerInfo,p={},h=s(e,t);if(6!=h.length)throw"not supported items for SignerInfo (!=6)";var m=h.shift();p.version=n(e,m);var f=h.shift();p.si=n(e,f);var g=h.shift();p.digalg=n(e,g);var _=h.shift();p.sattrs=n(e,_);var y=h.shift();p.sigalg=n(e,y);var b=h.shift();p.sig=n(e,b),p.sigval=a(e,b);var v=null;return p.obj=new d,(v=new c).hTLV=p.version,p.obj.dCMSVersion=v,(v=new c).hTLV=p.si,p.obj.dSignerIdentifier=v,(v=new c).hTLV=p.digalg,p.obj.dDigestAlgorithm=v,(v=new c).hTLV=p.sattrs,p.obj.dSignedAttrs=v,(v=new c).hTLV=p.sigalg,p.obj.dSigAlg=v,(v=new c).hTLV=p.sig,p.obj.dSig=v,p.obj.dUnsignedAttrs=new u,p},void 0!==ne.asn1.csr&&ne.asn1.csr||(ne.asn1.csr={}),ne.asn1.csr.CertificationRequest=function(e){var t=ne.asn1,i=t.DERBitString,r=t.DERSequence,s=t.csr,n=(t.x509,s.CertificationRequestInfo);s.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.sign=function(){var e=new n(this.params).tohex(),t=new ne.crypto.Signature({alg:this.params.sigalg});t.init(this.params.sbjprvkey),t.updateHex(e);var i=t.sign();this.params.sighex=i},this.getPEM=function(){return Ce(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var e=this.params,t=new ne.asn1.csr.CertificationRequestInfo(this.params),s=new ne.asn1.x509.AlgorithmIdentifier({name:e.sigalg});if(null==e.sighex&&null!=e.sbjprvkey&&this.sign(),null==e.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var n=new i({hex:"00"+e.sighex});return new r({array:[t,s,n]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.csr.CertificationRequest,ne.asn1.ASN1Object),ne.asn1.csr.CertificationRequestInfo=function(e){var t=ne.asn1,i=(t.DERBitString,t.DERSequence),r=t.DERInteger,s=t.DERUTF8String,n=t.DERTaggedObject,a=t.ASN1Util.newObject,o=t.csr,c=t.x509,l=c.X500Name,u=c.Extensions,d=c.SubjectPublicKeyInfo;o.AttributeList;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(e){null!=e&&(this.params=e)},this.tohex=function(){var e=this.params,t=[];if(t.push(new r({int:0})),t.push(new l(e.subject)),t.push(new d(et.getKey(e.sbjpubkey))),null!=e.attrs){var o=function(e){for(var t=Error,i=ne.asn1.x509.Extensions,r=[],s=0;s<e.length;s++){var n=e[s],a=n.attr;if("extensionRequest"==a){var o={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[new i(n.ext)]}]};r.push(o)}else if("unstructuredName"==a){o={seq:[{oid:"1.2.840.113549.1.9.2"},{set:n.names}]};r.push(o)}else{if("challengePassword"!=a)throw new t("unknown CSR attribute");o={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:n.password}]}]};r.push(o)}}return{set:r}}(e.attrs),c=a({tag:{tage:"a0",obj:o}});t.push(c)}else if(null!=e.extreq){var p=new u(e.extreq);c=a({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[p]}]}}});t.push(c)}else t.push(new n({tag:"a0",explicit:!1,obj:new s({str:""})}));return new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=e&&this.setByParam(e)},Qe(ne.asn1.csr.CertificationRequestInfo,ne.asn1.ASN1Object),ne.asn1.csr.AttributeList=function(e){},Qe(ne.asn1.csr.AttributeList,ne.asn1.ASN1Object),ne.asn1.csr.CSRUtil=new function(){},ne.asn1.csr.CSRUtil.newCSRPEM=function(e){return new ne.asn1.csr.CertificationRequest(e).getPEM()},ne.asn1.csr.CSRUtil.getParam=function(e,t){var i=ce,r=i.getV,s=i.getIdxbyList,n=i.getTLVbyList,a=i.getTLVbyListEx,o=i.getVbyListEx,c={};if(-1==e.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var l=Ae(e,"CERTIFICATE REQUEST");t&&(c.tbs=n(l,0,[0]));try{var u=a(l,0,[0,1]);if("3000"==u)c.subject={};else{var d=new st;c.subject=d.getX500Name(u)}}catch(e){}var p=a(l,0,[0,2]),h=et.getKey(p,null,"pkcs8pub");c.sbjpubkey=et.getPEM(h,"PKCS8PUB");var m,f,g=(f=s(m=l,0,[0,3,0,0],"06"),"2a864886f70d01090e"!=r(m,f)?null:n(m,0,[0,3,0,1,0],"30"));d=new st;null!=g&&(c.extreq=d.getExtParamArray(g));try{var _=a(l,0,[1],"30");d=new st;c.sigalg=d.getAlgorithmIdentifierName(_)}catch(e){}try{var y=o(l,0,[2]);c.sighex=y}catch(e){}return c},ne.asn1.csr.CSRUtil.verifySignature=function(e){try{var t=null;if("string"==typeof e&&-1!=e.indexOf("-----BEGIN CERTIFICATE REQUEST")?t=ne.asn1.csr.CSRUtil.getParam(e,!0):"object"==typeof e&&null!=e.sbjpubkey&&null!=e.sigalg&&null!=e.sighex&&null!=e.tbs&&(t=e),null==t)return!1;var i=new ne.crypto.Signature({alg:t.sigalg});return i.init(t.sbjpubkey),i.updateHex(t.tbs),i.verify(t.sighex)}catch(e){return alert(e),!1}},void 0!==ne&&ne||(ne={}),void 0!==ne.asn1&&ne.asn1||(ne.asn1={}),void 0!==ne.asn1.ocsp&&ne.asn1.ocsp||(ne.asn1.ocsp={}),ne.asn1.ocsp.DEFAULT_HASH="sha1",ne.asn1.ocsp.OCSPResponse=function(e){ne.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);ne.asn1.DEREnumerated;var t=ne.asn1.ASN1Util.newObject,i=ne.asn1.ocsp.ResponseBytes,r=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var e=this.params.resstatus;return"number"==typeof e?e:"string"!=typeof e?-1:r.indexOf(e)},this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params,r=this._getStatusCode();if(-1==r)throw new Error("responseStatus not supported: "+e.resstatus);if(0!=r)return t({seq:[{enum:{int:r}}]}).tohex();var s=new i(e);return t({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:s}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.OCSPResponse,ne.asn1.ASN1Object),ne.asn1.ocsp.ResponseBytes=function(e){ne.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.DERObjectIdentifier,s=t.DEROctetString,n=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(e){this.params=e},this.tohex=function(){var e=this.params;if("ocspBasic"!=e.restype)throw new Error("not supported responseType: "+e.restype);var t=new n(e),a=[];return a.push(new r({name:"ocspBasic"})),a.push(new s({hex:t.tohex()})),new i({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.ResponseBytes,ne.asn1.ASN1Object),ne.asn1.ocsp.BasicOCSPResponse=function(e){ne.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,i=ne.asn1,r=i.ASN1Object,s=i.DERSequence,n=(i.DERGeneralizedTime,i.DERTaggedObject),a=i.DERBitString,o=(i.x509.Extensions,i.x509.AlgorithmIdentifier),c=i.ocsp;c.ResponderID;_SingleResponseList=c.SingleResponseList,_ResponseData=c.ResponseData,this.params=null,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.tbsresp.tohex(),i=new ne.crypto.Signature({alg:e.sigalg});i.init(e.reskey),i.updateHex(t),e.sighex=i.sign()},this.tohex=function(){var e=this.params;null==e.tbsresp&&(e.tbsresp=new _ResponseData(e)),null==e.sighex&&null!=e.reskey&&this.sign();var i=[];if(i.push(e.tbsresp),i.push(new o({name:e.sigalg})),i.push(new a({hex:"00"+e.sighex})),null!=e.certs&&null!=e.certs.length){for(var c=[],l=0;l<e.certs.length;l++){var u=e.certs[l],d=null;if(ce.isASN1HEX(u))d=u;else{if(!u.match(/-----BEGIN/))throw new t("certs["+l+"] not hex or PEM");d=Ae(u)}c.push(new r({tlv:d}))}var p=new s({array:c});i.push(new n({tag:"a0",explicit:!0,obj:p}))}return new s({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.BasicOCSPResponse,ne.asn1.ASN1Object),ne.asn1.ocsp.ResponseData=function(e){ne.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERGeneralizedTime,n=i.DERTaggedObject,a=i.x509.Extensions,o=i.ocsp,c=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.tohex=function(){var e=this.params;null!=e.respid&&new t("respid not specified"),null!=e.prodat&&new t("prodat not specified"),null!=e.array&&new t("array not specified");var i=[];if(i.push(new c(e.respid)),i.push(new s(e.prodat)),i.push(new _SingleResponseList(e.array)),null!=e.ext){var o=new a(e.ext);i.push(new n({tag:"a1",explicit:!0,obj:o}))}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.ResponseData,ne.asn1.ASN1Object),ne.asn1.ocsp.ResponderID=function(e){ne.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=ne,i=t.asn1,r=i.ASN1Util.newObject,s=i.x509.X500Name,n=t.lang.String.isHex,a=Error;this.params=null,this.tohex=function(){var e=this.params;if(null!=e.key){var t,i=null;if("string"==typeof e.key){if(n(e.key)&&(i=e.key),e.key.match(/-----BEGIN CERTIFICATE/))null!=(t=new st(e.key).getExtSubjectKeyIdentifier())&&(i=t.kid.hex)}else if(e.key instanceof st)null!=(t=e.key.getExtSubjectKeyIdentifier())&&(i=t.kid.hex);if(null==i)throw new a("wrong key member value");return r({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:i}}}}).tohex()}if(null!=e.name){var o=null;if("string"==typeof e.name&&e.name.match(/-----BEGIN CERTIFICATE/))o=new st(e.name).getSubject();else e.name instanceof st?o=e.name.getSubject():"object"!=typeof e.name||null==e.name.array&&null==e.name.str||(o=e.name);if(null==o)throw new a("wrong name member value");return r({tag:{tag:"a1",explicit:!0,obj:new s(o)}}).tohex()}throw new a("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.ResponderID,ne.asn1.ASN1Object),ne.asn1.ocsp.SingleResponseList=function(e){ne.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=ne.asn1,i=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.tohex=function(){var e=this.params;if("object"!=typeof e||null==e.length)throw new Error("params not specified properly");for(var t=[],s=0;s<e.length;s++)t.push(new r(e[s]));return new i({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.SingleResponseList,ne.asn1.ASN1Object),ne.asn1.ocsp.SingleResponse=function(e){var t=Error,i=ne.asn1,r=i.DERSequence,s=i.DERGeneralizedTime,n=i.DERTaggedObject,a=i.ocsp,o=a.CertID,c=a.CertStatus,l=i.x509.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params,i=[];if(null==e.certid)throw new t("certid unspecified");if(null==e.status)throw new t("status unspecified");if(null==e.thisupdate)throw new t("thisupdate unspecified");if(i.push(new o(e.certid)),i.push(new c(e.status)),i.push(new s(e.thisupdate)),null!=e.nextupdate){var a=new s(e.nextupdate);i.push(new n({tag:"a0",explicit:!0,obj:a}))}if(null!=e.ext){var u=new l(e.ext);i.push(new n({tag:"a1",explicit:!0,obj:u}))}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.SingleResponse,ne.asn1.ASN1Object),ne.asn1.ocsp.CertID=function(e){var t=ne,i=t.asn1,r=i.DEROctetString,s=i.DERInteger,n=i.DERSequence,a=i.x509.AlgorithmIdentifier,o=i.ocsp,c=(o.DEFAULT_HASH,t.crypto.Util.hashHex),l=st,u=ce.getVbyList;o.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(e,t,i,r){null==r&&(r=this.DEFAULT_HASH),this.params={alg:r,issname:e,isskey:t,sbjsn:i}},this.setByCert=function(e,t,i){null==i&&(i=this.DEFAULT_HASH),this.params={alg:i,issuerCert:e,subjectCert:t}},this.getParamByCerts=function(e,t,i){null==i&&(i=this.DEFAULT_HASH);var r=new l(e),s=new l(t),n=c(r.getSubjectHex(),i),a=r.getPublicKeyHex();return{alg:i,issname:n,isskey:c(u(a,0,[1],"03",!0),i),sbjsn:s.getSerialNumberHex()}},this.tohex=function(){if("object"!=typeof this.params)throw new Error("params not set");var e,t,i,o,c=this.params;if(o=null==c.alg?this.DEFAULT_HASH:c.alg,null!=c.issuerCert&&null!=c.subjectCert){var l=this.getParamByCerts(c.issuerCert,c.subjectCert,o);e=l.issname,t=l.isskey,i=l.sbjsn}else{if(null==c.issname||null==c.isskey||null==c.sbjsn)throw new Error("required param members not defined");e=c.issname,t=c.isskey,i=c.sbjsn}var u=new a({name:o}),d=new r({hex:e}),p=new r({hex:t}),h=new s({hex:i}),m=new n({array:[u,d,p,h]});return this.hTLV=m.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.CertID,ne.asn1.ASN1Object),ne.asn1.ocsp.CertStatus=function(e){ne.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var e=this.params;if("good"==e.status)return"8000";if("unknown"==e.status)return"8200";if("revoked"==e.status){var t=[{gentime:{str:e.time}}];null!=e.reason&&t.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:e.reason}}}});var i={tag:"a1",explicit:!1,obj:{seq:t}};return ne.asn1.ASN1Util.newObject({tag:i}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},Qe(ne.asn1.ocsp.CertStatus,ne.asn1.ASN1Object),ne.asn1.ocsp.Request=function(e){var t=ne.asn1,i=t.DERSequence,r=t.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var e=[];if(null===this.dReqCert)throw"reqCert not set";e.push(this.dReqCert);var t=new i({array:e});return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e){var s=new r.CertID(e);this.dReqCert=s}},Qe(ne.asn1.ocsp.Request,ne.asn1.ASN1Object),ne.asn1.ocsp.TBSRequest=function(e){var t=ne.asn1,i=t.DERSequence,r=t.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(e){for(var t=[],i=0;i<e.length;i++){var s=new r.Request(e[0]);t.push(s)}this.dRequestList=t},this.tohex=function(){var e=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var t=new i({array:this.dRequestList});if(e.push(t),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new i({array:e});return this.hTLV=r.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&void 0!==e.reqList&&this.setRequestListByParam(e.reqList)},Qe(ne.asn1.ocsp.TBSRequest,ne.asn1.ASN1Object),ne.asn1.ocsp.OCSPRequest=function(e){var t=ne.asn1,i=t.DERSequence,r=t.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var e=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(e.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var t=new i({array:e});return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==e&&void 0!==e.reqList){var s=new r.TBSRequest(e);this.dTbsRequest=s}},Qe(ne.asn1.ocsp.OCSPRequest,ne.asn1.ASN1Object),ne.asn1.ocsp.OCSPUtil={},ne.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,i){var r=ne.asn1.ocsp;void 0===i&&(i=r.DEFAULT_HASH);var s={alg:i,issuerCert:e,subjectCert:t};return new r.OCSPRequest({reqList:[s]}).tohex()},ne.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=ce,i=t.getVbyList,r=t.getVbyListEx,s=t.getIdxbyList,n=(t.getIdxbyListEx,t.getV),a={};try{var o=r(e,0,[0],"0a");a.responseStatus=parseInt(o,16)}catch(e){}if(0!==a.responseStatus)return a;try{var c=s(e,0,[1,0,1,0,0,2,0,1]);"80"===e.substr(c,2)?a.certStatus="good":"a1"===e.substr(c,2)?(a.certStatus="revoked",a.revocationTime=ye(i(e,c,[0]))):"82"===e.substr(c,2)&&(a.certStatus="unknown")}catch(e){}try{var l=s(e,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=ye(n(e,l))}catch(e){}try{var u=s(e,0,[1,0,1,0,0,2,0,3]);"a0"===e.substr(u,2)&&(a.nextUpdate=ye(i(e,u,[0])))}catch(e){}return a},ne.asn1.ocsp.OCSPParser=function(){var e=Error,t=st,i=new t,r=ce,s=r.getV,n=r.getTLV,a=r.getIdxbyList,o=r.getVbyList,c=r.getTLVbyList,l=r.getVbyListEx,u=r.getTLVbyListEx,d=r.getChildIdx;this.getOCSPRequest=function(t){var i=d(t,0);if(1!=i.length&&2!=i.length)throw new e("wrong number elements: "+i.length);return this.getTBSRequest(n(t,i[0]))},this.getTBSRequest=function(e){var t={},r=u(e,0,[0],"30");t.array=this.getRequestList(r);var s=u(e,0,["[2]",0],"30");return null!=s&&(t.ext=i.getExtParamArray(s)),t},this.getRequestList=function(e){for(var t=[],i=d(e,0),r=0;r<i.length;r++){e=n(e,i[r]);t.push(this.getRequest(e))}return t},this.getRequest=function(t){var r=d(t,0);if(1!=r.length&&2!=r.length)throw new e("wrong number elements: "+r.length);var s=this.getCertID(n(t,r[0]));if(2==r.length){var o=a(t,0,[1,0]);s.ext=i.getExtParamArray(n(t,o))}return s},this.getCertID=function(i){var r=d(i,0);if(4!=r.length)throw new e("wrong number elements: "+r.length);var a=new t,o={};return o.alg=a.getAlgorithmIdentifierName(n(i,r[0])),o.issname=s(i,r[1]),o.isskey=s(i,r[2]),o.sbjsn=s(i,r[3]),o},this.getOCSPResponse=function(e){var t,i=d(e,0),r=s(e,i[0]),n=parseInt(r);if(1==i.length)return{resstatus:n};var a=c(e,0,[1,0]);return(t=this.getResponseBytes(a)).resstatus=n,t},this.getResponseBytes=function(e){var t,i=d(e,0),r=c(e,0,[1,0]);t=this.getBasicOCSPResponse(r);var n=s(e,i[0]);return t.restype=ne.asn1.x509.OID.oid2name(Ve(n)),t},this.getBasicOCSPResponse=function(e){var t,i=d(e,0);t=this.getResponseData(n(e,i[0]));var r=new st;t.alg=r.getAlgorithmIdentifierName(n(e,i[1]));var a=s(e,i[2]);t.sighex=a.substr(2);var o=l(e,0,["[0]"]);if(null!=o){for(var c=d(o,0),u=[],p=0;p<c.length;p++){var h=n(o,c[p]);u.push(h)}t.certs=u}return t},this.getResponseData=function(e){var t=d(e,0),i=t.length,r={},a=0;"a0"==e.substr(t[0],2)&&a++,r.respid=this.getResponderID(n(e,t[a++]));var o=s(e,t[a++]);if(r.prodat=ye(o),r.array=this.getSingleResponseList(n(e,t[a++])),"a1"==e.substr(t[i-1],2)){var l=c(e,t[i-1],[0]),u=new st;r.ext=u.getExtParamArray(l)}return r},this.getResponderID=function(e){var t={};if("a2"==e.substr(0,2)){var i=o(e,0,[0]);t.key=i}if("a1"==e.substr(0,2)){var r=c(e,0,[0]),s=new st;t.name=s.getX500Name(r)}return t},this.getSingleResponseList=function(e){for(var t=d(e,0),i=[],r=0;r<t.length;r++){var s=this.getSingleResponse(n(e,t[r]));i.push(s)}return i},this.getSingleResponse=function(e){var t=d(e,0),i={},r=this.getCertID(n(e,t[0]));i.certid=r;var a=this.getCertStatus(n(e,t[1]));if(i.status=a,"18"==e.substr(t[2],2)){var l=s(e,t[2]);i.thisupdate=ye(l)}for(var u=3;u<t.length;u++){if("a0"==e.substr(t[u],2)){var p=o(e,t[u],[0],"18");i.nextupdate=ye(p)}if("a1"==e.substr(t[u],2)){var h=new st,m=c(e,0,[u,0]);i.ext=h.getExtParamArray(m)}}return i},this.getCertStatus=function(e){var t={};if("8000"==e)return{status:"good"};if("8200"==e)return{status:"unknown"};if("a1"==e.substr(0,2)){t.status="revoked";var i=ye(o(e,0,[0]));t.time=i}return t}},void 0!==ne&&ne||(ne={}),void 0!==ne.lang&&ne.lang||(ne.lang={}),ne.lang.String=function(){},"function"==typeof Buffer?(ae=function(e){return he(Buffer.from(e,"utf8").toString("base64"))},oe=function(e){return Buffer.from(me(e),"base64").toString("utf8")}):(ae=function(e){return fe(ke(Ue(e)))},oe=function(e){return decodeURIComponent(Re(ge(e)))}),ne.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},ne.lang.String.isHex=function(e){return Me(e)},ne.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},ne.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=me(e),ne.lang.String.isBase64(e))},ne.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ne.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ne.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},ne.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};function ze(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},i=function(e){var i="",r=parseInt(e,10).toString(2),s=7-r.length%7;7==s&&(s=0);for(var n="",a=0;a<s;a++)n+="0";r=n+r;for(a=0;a<r.length-1;a+=7){var o=r.substr(a,7);a!=r.length-7&&(o="1"+o),i+=t(parseInt(o,2))}return i};try{if(!e.match(/^[0-9.]+$/))return null;var r="",s=e.split("."),n=40*parseInt(s[0],10)+parseInt(s[1],10);r+=t(n),s.splice(0,2);for(var a=0;a<s.length;a++)r+=i(s[a]);return r}catch(e){return null}}function Ve(e){if(!Me(e))return null;try{var t=[],i=e.substr(0,2),r=parseInt(i,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var s=e.substr(2),n=[],a=0;a<s.length/2;a++)n.push(parseInt(s.substr(2*a,2),16));var o=[],c="";for(a=0;a<n.length;a++)128&n[a]?c+=We((127&n[a]).toString(2),7):(c+=We((127&n[a]).toString(2),7),o.push(new String(parseInt(c,2))),c="");var l=t.join(".");return o.length>0&&(l=l+"."+o.join(".")),l}catch(e){return null}}function Ke(e){return Ge(new v(String(e),10))}function Ge(e){var t=e.toString(16);if("-"!=t.substr(0,1))return t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t),t;var i=t.substr(1).length;i%2==1?i+=1:t.match(/^[0-7]/)||(i+=2);for(var r="",s=0;s<i;s++)r+="f";return t=new v(r,16).xor(e).add(v.ONE).toString(16).replace(/^-/,"")}var We=function(e,t,i){return null==i&&(i="0"),e.length>=t?e:new Array(t-e.length+1).join(i)+e};function Je(e){if(e.length%2!=0)return-1;if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return-1;try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var i=parseInt(t,16);if(i>7)return-1;var r=e.substr(2),s=parseInt(r,16).toString(2);"0"==s&&(s="00000000"),s=s.slice(0,0-i);var n=parseInt(s,2);return NaN==n?-1:n}catch(e){return-1}}function $e(e){if("number"!=typeof e)return null;if(e<0)return null;var t=Number(e).toString(2),i=8-t.length%8;8==i&&(i=0),t+=We("",i,"0");var r=parseInt(t,2).toString(16);return r.length%2==1&&(r="0"+r),"0"+i+r}function Ze(e){if("string"!=typeof e)return null;if(e.length%2!=0)return null;if(!e.match(/^[0-9a-f]+$/))return null;try{var t=parseInt(e.substr(0,2),16);if(t<0||7<t)return null;for(var i=e.substr(2),r="",s=0;s<i.length;s+=2){var n=i.substr(s,2),a=parseInt(n,16).toString(2);r+=a=("0000000"+a).slice(-8)}return r.substr(0,r.length-t)}catch(e){return null}}function Ye(e,t){for(var i=0,r=0;r<e.length;r++)i|=1<<t[e[r]];var s=i.toString(2),n="";for(r=s.length-1;r>=0;r--)n+=s[r];return n}function Xe(e,t,i){if("object"==typeof e){t=String(t).split(".");for(var r=0;r<t.length&&e;r++){var s=t[r];s.match(/^[0-9]+$/)&&(s=parseInt(s)),e=e[s]}return e||!1===e?e:i}}function Qe(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:m.algo.MD5,sha1:m.algo.SHA1,sha224:m.algo.SHA224,sha256:m.algo.SHA256,sha384:m.algo.SHA384,sha512:m.algo.SHA512,ripemd160:m.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,i){var r=this.getDigestInfoHex(e,t),s=i/4;if(r.length+22>s)throw"key is too short for SigAlg: keylen="+i+","+t;for(var n="0001",a="00"+r,o="",c=s-4-a.length,l=0;l<c;l+=2)o+="ff";return n+o+a},this.hashString=function(e,t){return new ne.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new ne.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ee||e instanceof ne.crypto.DSA||e instanceof ne.crypto.ECDSA}},ne.crypto.Util.md5=function(e){return new ne.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},ne.crypto.Util.ripemd160=function(e){return new ne.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},ne.crypto.Util.SECURERANDOMGEN=new X,ne.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return ne.crypto.Util.SECURERANDOMGEN.nextBytes(t),de(t)},ne.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new v(ne.crypto.Util.getRandomHexOfNbytes(e),16)},ne.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,i=new Array((e-t)/8+1);return ne.crypto.Util.SECURERANDOMGEN.nextBytes(i),i[0]=(255<<t&255^255)&i[0],de(i)},ne.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new v(ne.crypto.Util.getRandomHexOfNbits(e),16)},ne.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var i=ne.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(i))return i}},ne.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var i=e.compareTo(t);if(1==i)throw"biMin is greater than biMax";if(0==i)return e;var r=t.subtract(e);return ne.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},ne.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=ne.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=ne.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=ne.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=m.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(m.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=ne.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ne.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},ne.crypto.MessageDigest.getHashLength=function(e){var t=ne.crypto.MessageDigest,i=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[i])throw"not supported algorithm: "+e;return t.HASHLENGTH[i]},ne.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ne.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=ne.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var i=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==t){try{var r=ne.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=m.algo.HMAC.create(r,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=m.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(m.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=xe(e)),void(this.pass=m.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=_e(e.utf8)),void 0!==e.rstr&&(t=xe(e.rstr)),void 0!==e.b64&&(t=y(e.b64)),void 0!==e.b64u&&(t=ge(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=m.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=ne.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ne.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var i="",r=t/4-e.length,s=0;s<r;s++)i+="0";return i+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ne.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var i=null;try{i=void 0===t?et.getKey(e):et.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===i.isPrivate)this.prvKey=i,this.state="SIGN";else{if(!0!==i.isPublic)throw"init failed.:"+i;this.pubKey=i,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ne.crypto.ECDSA&&(this.prvKey=new ne.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ee&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ee&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ne.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ne.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ne.crypto.ECDSA&&(this.pubKey=new ne.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ee&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ee&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==ne.crypto.ECDSA&&this.pubKey instanceof ne.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==ne.crypto.DSA&&this.pubKey instanceof ne.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=ne.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=et.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},ne.crypto.Cipher=function(e){},ne.crypto.Cipher.encrypt=function(e,t,i,r){if(null!=Xe(r,"enclag")&&(i=r.encalg),"string"==typeof i&&"-CBC"==i.substr(-4)){var s=t,n=e;null!=Xe(r,"key")&&(s=r.key),null!=Xe(r,"enc")&&(hEnc=r.enc);var a,o=m.enc.Hex.parse(s),c=m.enc.Hex.parse(n),l=m.enc.Hex.parse(r.iv);if("des-EDE3-CBC"==i)a=m.TripleDES.encrypt(c,o,{iv:l});else{if("aes128-CBC"!=i&&"aes256-CBC"!=i)throw new Error("unsupported algorithm: "+i);a=m.AES.encrypt(c,o,{iv:l})}return a+""}throw new Error("Cipher.encrypt: unsupported key or algorithm")},ne.crypto.Cipher.decrypt=function(e,t,i,r){if(null!=Xe(r,"enclag")&&(i=r.encalg),"string"==typeof i&&"-CBC"==i.substr(-4)){var s=t,n=e;null!=Xe(r,"key")&&(s=r.key),null!=Xe(r,"enc")&&(n=r.enc);var a,o=m.enc.Hex.parse(s),c=m.enc.Hex.parse(n),l=m.enc.Hex.parse(r.iv);if("des-EDE3-CBC"==i)a=m.TripleDES.decrypt({ciphertext:c},o,{iv:l});else{if("aes128-CBC"!=i&&"aes256-CBC"!=i)throw new Error("unsupported algorithm: "+i);a=m.AES.decrypt({ciphertext:c},o,{iv:l})}return m.enc.Hex.stringify(a)}throw new Error("Cipher.decrypt: unsupported key or algorithm")},ne.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.ECDSA=function(e){var t=Error,i=v,r=ie,s=ne.crypto.ECDSA,n=ne.crypto.ECParameterDB,a=s.getName,o=ce,c=o.getVbyListEx,l=o.isASN1HEX,u=new X;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(e){return new i(e.bitLength(),u).mod(e.subtract(i.ONE)).add(i.ONE)},this.setNamedCurve=function(e){this.ecparams=n.getByName(e),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=e},this.setPrivateKeyHex=function(e){this.isPrivate=!0,this.prvKeyHex=e},this.setPublicKeyHex=function(e){this.isPublic=!0,this.pubKeyHex=e},this.getPublicKeyXYHex=function(){var e=this.pubKeyHex;if("04"!==e.substr(0,2))throw"this method supports uncompressed format(04) only";var t=this.ecparams.keycharlen;if(e.length!==2+2*t)throw"malformed public key hex length";var i={};return i.x=e.substr(2,t),i.y=e.substr(2+t),i},this.getShortNISTPCurveName=function(){var e=this.curveName;return"secp256r1"===e||"NIST P-256"===e||"P-256"===e||"prime256v1"===e?"P-256":"secp384r1"===e||"NIST P-384"===e||"P-384"===e?"P-384":"secp521r1"===e||"NIST P-521"===e||"P-521"===e?"P-521":null},this.generateKeyPairHex=function(){var e=this.ecparams.n,t=this.getBigRandom(e),i=this.ecparams.keycharlen,r=("0000000000"+t.toString(16)).slice(-i);return this.setPrivateKeyHex(r),{ecprvhex:r,ecpubhex:this.generatePublicKeyHex()}},this.generatePublicKeyHex=function(){var e=new i(this.prvKeyHex,16),t=this.ecparams.G.multiply(e),r=t.getX().toBigInteger(),s=t.getY().toBigInteger(),n=this.ecparams.keycharlen,a="04"+("0000000000"+r.toString(16)).slice(-n)+("0000000000"+s.toString(16)).slice(-n);return this.setPublicKeyHex(a),a},this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)},this.signHex=function(e,t){var r=new i(t,16),n=this.ecparams.n,a=new i(e.substring(0,this.ecparams.keycharlen),16);do{var o=this.getBigRandom(n),c=this.ecparams.G.multiply(o).getX().toBigInteger().mod(n)}while(c.compareTo(i.ZERO)<=0);var l=o.modInverse(n).multiply(a.add(r.multiply(c))).mod(n);return s.biRSSigToASN1Sig(c,l)},this.sign=function(e,t){var r=t,s=this.ecparams.n,n=i.fromByteArrayUnsigned(e);do{var a=this.getBigRandom(s),o=this.ecparams.G.multiply(a).getX().toBigInteger().mod(s)}while(o.compareTo(v.ZERO)<=0);var c=a.modInverse(s).multiply(n.add(r.multiply(o))).mod(s);return this.serializeSig(o,c)},this.verifyWithMessageHash=function(e,t){return this.verifyHex(e,t,this.pubKeyHex)},this.verifyHex=function(e,t,n){try{var a,o,c=s.parseSigHex(t);a=c.r,o=c.s;var l=r.decodeFromHex(this.ecparams.curve,n),u=new i(e.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(u,a,o,l)}catch(e){return!1}},this.verify=function(e,t,s){var n,a,o;if(Bitcoin.Util.isArray(t)){var c=this.parseSig(t);n=c.r,a=c.s}else{if("object"!=typeof t||!t.r||!t.s)throw"Invalid value for signature";n=t.r,a=t.s}if(s instanceof ie)o=s;else{if(!Bitcoin.Util.isArray(s))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=r.decodeFrom(this.ecparams.curve,s)}var l=i.fromByteArrayUnsigned(e);return this.verifyRaw(l,n,a,o)},this.verifyRaw=function(e,t,r,s){var n=this.ecparams.n,a=this.ecparams.G;if(t.compareTo(i.ONE)<0||t.compareTo(n)>=0)return!1;if(r.compareTo(i.ONE)<0||r.compareTo(n)>=0)return!1;var o=r.modInverse(n),c=e.multiply(o).mod(n),l=t.multiply(o).mod(n);return a.multiply(c).add(s.multiply(l)).getX().toBigInteger().mod(n).equals(t)},this.serializeSig=function(e,t){var i=e.toByteArraySigned(),r=t.toByteArraySigned(),s=[];return s.push(2),s.push(i.length),(s=s.concat(i)).push(2),s.push(r.length),(s=s.concat(r)).unshift(s.length),s.unshift(48),s},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var r=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var s=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:i.fromByteArrayUnsigned(r),s:i.fromByteArrayUnsigned(s)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:i.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:i.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===l(e))throw new Error("not ASN.1 hex string");var t,i,r;try{t=c(e,0,["[0]",0],"06"),i=c(e,0,[1],"04");try{r=c(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=a(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(i),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===l(e))throw new t("not ASN.1 hex string");var i,r,s;try{c(e,0,[1,0],"06"),i=c(e,0,[1,1],"06"),r=c(e,0,[2,0,1],"04");try{s=c(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=a(i),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(s),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===l(e))throw new t("not ASN.1 hex string");var i,r;try{c(e,0,[0,0],"06"),i=c(e,0,[0,1],"06"),r=c(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=a(i),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(e,i){if(!1===l(e))throw new t("not ASN.1 hex string");var r,s;try{r=c(e,0,[0,5,0,1],"06"),s=c(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=a(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(s)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},ne.crypto.ECDSA.parseSigHex=function(e){var t=ne.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new v(t.r,16),s:new v(t.s,16)}},ne.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=ce,i=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var s=i(e,0);if(2!=s.length)throw new Error("signature shall have two elements");var n=s[0],a=s[1];if("02"!=e.substr(n,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(a,2))throw new Error("2nd item not ASN.1 integer");return{r:r(e,n),s:r(e,a)}},ne.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=ne.crypto.ECDSA.parseSigHexInHexRS(e),i=t.r,r=t.s;if(i.length>=130&&i.length<=134){if(i.length%2!=0)throw Error("unknown ECDSA sig r length error");if(r.length%2!=0)throw Error("unknown ECDSA sig s length error");"00"==i.substr(0,2)&&(i=i.substr(2)),"00"==r.substr(0,2)&&(r=r.substr(2));var s=Math.max(i.length,r.length);return(i=("000000"+i).slice(-s))+(r=("000000"+r).slice(-s))}if("00"==i.substr(0,2)&&i.length%32==2&&(i=i.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),i.length%32==30&&(i="00"+i),r.length%32==30&&(r="00"+r),i.length%32!=0)throw Error("unknown ECDSA sig r length error");if(r.length%32!=0)throw Error("unknown ECDSA sig s length error");return i+r},ne.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),i=e.substr(e.length/2);return ne.crypto.ECDSA.hexRSSigToASN1Sig(t,i)},ne.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var i=new v(e,16),r=new v(t,16);return ne.crypto.ECDSA.biRSSigToASN1Sig(i,r)},ne.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var i=ne.asn1,r=new i.DERInteger({bigint:e}),s=new i.DERInteger({bigint:t});return new i.DERSequence({array:[r,s]}).tohex()},ne.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":"2b81040023"===e?"secp521r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":-1!=="|secp521r1|NIST P-521|P-521|".indexOf(e)?"secp521r1":null},void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.ECParameterDB=new function(){var e={},t={};function i(e){return new v(e,16)}this.getByName=function(i){var r=i;if(void 0!==t[r]&&(r=t[i]),void 0!==e[r])return e[r];throw"unregistered EC curve name: "+r},this.regist=function(r,s,n,a,o,c,l,u,d,p,h,m){e[r]={};var f=i(n),g=i(a),_=i(o),y=i(c),b=i(l),v=new re(f,g,_),x=v.decodePointHex("04"+u+d);e[r].name=r,e[r].keylen=s,e[r].keycharlen=2*Math.ceil(s/8),e[r].curve=v,e[r].G=x,e[r].n=y,e[r].h=b,e[r].oid=h,e[r].info=m;for(var S=0;S<p.length;S++)t[p[S]]=r}},ne.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ne.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ne.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ne.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ne.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ne.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ne.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ne.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ne.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ne.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==ne&&ne||(ne={}),void 0!==ne.crypto&&ne.crypto||(ne.crypto={}),ne.crypto.DSA=function(){var e=ce,t=(e.getVbyList,e.getVbyListEx),i=e.isASN1HEX,r=v;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(e,t,i,r,s){this.isPrivate=!0,this.p=e,this.q=t,this.g=i,this.y=r,this.x=s},this.setPrivateHex=function(e,t,i,r,s){var n,a,o,c,l;n=new v(e,16),a=new v(t,16),o=new v(i,16),c="string"==typeof r&&r.length>1?new v(r,16):null,l=new v(s,16),this.setPrivate(n,a,o,c,l)},this.setPublic=function(e,t,i,r){this.isPublic=!0,this.p=e,this.q=t,this.g=i,this.y=r,this.x=null},this.setPublicHex=function(e,t,i,r){var s,n,a,o;s=new v(e,16),n=new v(t,16),a=new v(i,16),o=new v(r,16),this.setPublic(s,n,a,o)},this.signWithMessageHash=function(e){var t=this.p,i=this.q,r=this.g,s=(this.y,this.x),n=ne.crypto.Util.getRandomBigIntegerMinToMax(v.ONE.add(v.ONE),i.subtract(v.ONE)),a=new v(e.substr(0,i.bitLength()/4),16),o=r.modPow(n,t).mod(i),c=n.modInverse(i).multiply(a.add(s.multiply(o))).mod(i);return ne.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:c}}]})},this.verifyWithMessageHash=function(e,t){var i=this.p,r=this.q,s=this.g,n=this.y,a=this.parseASN1Signature(t),o=a[0],c=a[1],l=new v(e.substr(0,r.bitLength()/4),16);if(v.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(v.ZERO.compareTo(c)>=0||c.compareTo(r)>0)throw"invalid DSA signature";var u=c.modInverse(r),d=l.multiply(u).mod(r),p=o.multiply(u).mod(r);return 0==s.modPow(d,i).multiply(n.modPow(p,i)).mod(i).mod(r).compareTo(o)},this.parseASN1Signature=function(e){try{return[new r(t(e,0,[0],"02"),16),new r(t(e,0,[1],"02"),16)]}catch(e){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(e){var r,s,n,a,o;if(!1===i(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1],"02"),s=t(e,0,[2],"02"),n=t(e,0,[3],"02"),a=t(e,0,[4],"02"),o=t(e,0,[5],"02")}catch(e){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(r,s,n,a,o)},this.readPKCS8PrvKeyHex=function(e){var r,s,n,a;if(!1===i(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1,1,0],"02"),s=t(e,0,[1,1,1],"02"),n=t(e,0,[1,1,2],"02"),a=t(e,0,[2,0],"02")}catch(e){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(r,s,n,null,a)},this.readPKCS8PubKeyHex=function(e){var r,s,n,a;if(!1===i(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[0,1,0],"02"),s=t(e,0,[0,1,1],"02"),n=t(e,0,[0,1,2],"02"),a=t(e,0,[1,0],"02")}catch(e){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(r,s,n,a)},this.readCertPubKeyHex=function(e,r){var s,n,a,o;if(!1===i(e))throw new Error("not ASN.1 hex string");try{s=t(e,0,[0,5,0,1,0],"02"),n=t(e,0,[0,5,0,1,1],"02"),a=t(e,0,[0,5,0,1,2],"02"),o=t(e,0,[0,5,1,0],"02")}catch(e){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(s,n,a,o)}};var et=function(){var e=function(e,i,r){return t(m.AES,e,i,r)},t=function(e,t,i,r){var s=m.enc.Hex.parse(t),n=m.enc.Hex.parse(i),a=m.enc.Hex.parse(r),o={};o.key=n,o.iv=a,o.ciphertext=s;var c=e.decrypt(o,n,{iv:a});return m.enc.Hex.stringify(c)},i=function(e,t,i){return r(m.AES,e,t,i)},r=function(e,t,i,r){var s=m.enc.Hex.parse(t),n=m.enc.Hex.parse(i),a=m.enc.Hex.parse(r),o=e.encrypt(s,n,{iv:a}),c=m.enc.Hex.parse(o.toString());return m.enc.Base64.stringify(c)},s={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,i,r){return t(m.TripleDES,e,i,r)},eproc:function(e,t,i){return r(m.TripleDES,e,t,i)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,i,r){return t(m.DES,e,i,r)},eproc:function(e,t,i){return r(m.DES,e,t,i)},keylen:8,ivlen:8}},n=function(e){var t={},i=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));i&&(t.cipher=i[1],t.ivsalt=i[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var s=-1,n=0;-1!=e.indexOf("\r\n\r\n")&&(s=e.indexOf("\r\n\r\n"),n=2),-1!=e.indexOf("\n\n")&&(s=e.indexOf("\n\n"),n=1);var a=e.indexOf("-----END");if(-1!=s&&-1!=a){var o=e.substring(s+2*n,a-n);o=o.replace(/\s+/g,""),t.data=o}return t},a=function(e,t,i){for(var r=i.substring(0,16),n=m.enc.Hex.parse(r),a=m.enc.Utf8.parse(t),o=s[e].keylen+s[e].ivlen,c="",l=null;;){var u=m.algo.MD5.create();if(null!=l&&u.update(l),u.update(a),u.update(n),l=u.finalize(),(c+=m.enc.Hex.stringify(l)).length>=2*o)break}var d={};return d.keyhex=c.substr(0,2*s[e].keylen),d.ivhex=c.substr(2*s[e].keylen,2*s[e].ivlen),d},o=function(e,t,i,r){var n=m.enc.Base64.parse(e),a=m.enc.Hex.stringify(n);return(0,s[t].proc)(a,i,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return n(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,i){return a(e,t,i)},decryptKeyB64:function(e,t,i,r){return o(e,t,i,r)},getDecryptedKeyHex:function(e,t){var i=n(e),r=(i.type,i.cipher),s=i.ivsalt,c=i.data,l=a(r,t,s).keyhex;return o(c,r,l,s)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,i,r,n){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===s[r])throw new Error("KEYUTIL unsupported algorithm: "+r);if(void 0===n||null==n){var c=function(e){var t=m.lib.WordArray.random(e);return m.enc.Hex.stringify(t)}(s[r].ivlen);n=c.toUpperCase()}var l=function(e,t,i,r){return(0,s[t].eproc)(e,i,r)}(t,r,a(r,i,n).keyhex,n);o="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+n+"\r\n",o+="\r\n",o+=l.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},getEncryptedPKCS8PEM:function(e,t,i){return Ce(this.getEncryptedPKCS8Hex(e,t,i),"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(e,t,i){var r;(r=null==i||null==i?{}:JSON.parse(JSON.stringify(i))).plain=e,this.initPBES2Param(r),this.encryptPBES2Param(r,t);var s=this.generatePBES2ASN1Param(r);return ne.asn1.ASN1Util.newObject(s).tohex()},initPBES2Param:function(e){var t;(null==Xe(e,"encalg")&&(e.encalg="aes256-CBC"),null==Xe(e,"iter")&&(e.iter=2048),null==Xe(e,"prf")&&(e.prf="hmacWithSHA256"),null==Xe(e,"salt")&&(e.salt=m.enc.Hex.stringify(m.lib.WordArray.random(8))),null==Xe(e,"enciv"))&&("des-EDE3-CBC"==e.encalg&&(t=8),"aes128-CBC"==e.encalg&&(t=16),"aes256-CBC"==e.encalg&&(t=16),e.enciv=m.enc.Hex.stringify(m.lib.WordArray.random(t)))},encryptPBES2Param:function(e,t){var i=et.getDKFromPBES2Param(e,t);try{var r=ne.crypto.Cipher.encrypt(e.plain,i,e.encalg,{iv:e.enciv})}catch(t){throw new Error("encrypt error: "+e.plain+" "+i+" "+e.encalg+" "+e.enciv)}e.enc=r},generatePBES2ASN1Param:function(e){var t={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:e.salt}},{int:{hex:Ke(e.iter)}}]}]},{seq:[{oid:e.encalg},{octstr:{hex:e.enciv}}]}]}]},{octstr:{hex:e.enc}}]};return"hmacWithSHA1"!=e.prf&&t.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:e.prf},{null:""}]}),t},parseHexOfEncryptedPKCS8:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={},n=i(e,0);if(2!=n.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+n.length);s.ciphertext=r(e,n[1]);var a=i(e,n[0]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+a.length);if("2a864886f70d01050d"!=r(e,a[0]))throw new Error("this only supports pkcs5PBES2");var o=i(e,a[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var c=i(e,o[1]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length);if("2a864886f70d0307"!=r(e,c[0]))throw"this only supports TripleDES";s.encryptionSchemeAlg="TripleDES",s.encryptionSchemeIV=r(e,c[1]);var l=i(e,o[0]);if(2!=l.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length);if("2a864886f70d01050c"!=r(e,l[0]))throw new Error("this only supports pkcs5PBKDF2");var u=i(e,l[1]);if(u.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+u.length);s.pbkdf2Salt=r(e,u[0]);var d=r(e,u[1]);try{s.pbkdf2Iter=parseInt(d,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+d)}return s},getPBKDF2KeyHexFromParam:function(e,t){var i=m.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,s=m.PBKDF2(t,i,{keySize:6,iterations:r});return m.enc.Hex.stringify(s)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var i=Ae(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(i),s=et.getPBKDF2KeyHexFromParam(r,t),n={};n.ciphertext=m.enc.Hex.parse(r.ciphertext);var a=m.enc.Hex.parse(s),o=m.enc.Hex.parse(r.encryptionSchemeIV),c=m.TripleDES.decrypt(n,a,{iv:o});return m.enc.Hex.stringify(c)},parsePBES2:function(e){var t=ce.parse(e);if("pkcs5PBES2"!=Xe(t,"seq.0.seq.0.oid")||"pkcs5PBKDF2"!=Xe(t,"seq.0.seq.1.seq.0.seq.0.oid"))throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var i=Xe(t,"seq.0.seq.1.seq.0.seq.1.seq");if(null==i)throw new Error("PBKDF2 parameter not found");var r=Xe(i,"0.octstr.hex"),s=Xe(i,"1.int.hex"),n=Xe(i,"2.seq.0.oid","hmacWithSHA1"),a=-1;try{a=parseInt(s,16)}catch(e){throw new Error("iter not proper value")}var o=Xe(t,"seq.0.seq.1.seq.1.seq.0.oid"),c=Xe(t,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),l=Xe(t,"seq.1.octstr.hex");if(null==o||null==c||null==l)throw new Error("encalg, enciv or enc is undefined");return{salt:r,iter:a,prf:n,encalg:o,enciv:c,enc:l}},getDKFromPBES2Param:function(e,t){var i={hmacWithSHA1:m.algo.SHA1,hmacWithSHA224:m.algo.SHA224,hmacWithSHA256:m.algo.SHA256,hmacWithSHA384:m.algo.SHA384,hmacWithSHA512:m.algo.SHA512}[e.prf];if(null==i)throw new Error("unsupported prf");var r={"des-EDE3-CBC":6,"aes128-CBC":4,"aes256-CBC":8}[e.encalg];if(null==r)throw new Error("unsupported encalg");var s=m.enc.Hex.parse(e.salt),n=e.iter;try{var a=m.PBKDF2(t,s,{keySize:r,iterations:n,hasher:i});return m.enc.Hex.stringify(a)}catch(i){throw new Error("PBKDF2 error: "+i+" "+JSON.stringify(e)+" "+t)}},getPlainHexFromEncryptedPKCS8PEM:function(e,t){if(-1==e.indexOf("BEGIN ENCRYPTED PRIVATE KEY"))throw new Error("not Encrypted PKCS#8 PEM string");var i,r=Ae(e);try{i=et.parsePBES2(r)}catch(e){throw new Error("malformed PBES2 format: "+e.message)}var s=et.getDKFromPBES2Param(i,t);return ne.crypto.Cipher.decrypt(i.enc,s,i.encalg,{iv:i.enciv})},getKeyFromEncryptedPKCS8PEM:function(e,t){var i=this.getPlainHexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(i)},parsePlainPrivatePKCS8Hex:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var n=i(e,0);if(n.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(n[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=i(e,n[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(s.algoid=r(e,a[0]),"06"==e.substr(a[1],2)&&(s.algparam=r(e,a[1])),"04"!=e.substr(n[2],2))throw new Error("malformed PKCS8 private key(code:006)");return s.keyidx=t.getVidx(e,n[2]),s},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=Ae(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,i=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==i.algoid)t=new ee;else if("2a8648ce380401"==i.algoid)t=new ne.crypto.DSA;else{if("2a8648ce3d0201"!=i.algoid)throw new Error("unsupported private key algorithm");t=new ne.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,i=ce.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===i)t=new ee;else if("2a8648ce380401"===i)t=new ne.crypto.DSA;else{if("2a8648ce3d0201"!==i)throw new Error("unsupported PKCS#8 public key hex");t=new ne.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var n=i(e,0);if(2!=n.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(n[0],2))throw new Error("malformed RSA key(code:003)");if(s.n=r(e,n[0]),"02"!=e.substr(n[1],2))throw new Error("malformed RSA key(code:004)");return s.e=r(e,n[1]),s},parsePublicPKCS8Hex:function(e){var t=ce,i=t.getChildIdx,r=t.getV,s={algparam:null},n=i(e,0);if(2!=n.length)throw new Error("outer DERSequence shall have 2 elements: "+n.length);var a=n[0];if("30"!=e.substr(a,2))throw new Error("malformed PKCS8 public key(code:001)");var o=i(e,a);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(s.algoid=r(e,o[0]),"06"==e.substr(o[1],2)?s.algparam=r(e,o[1]):"30"==e.substr(o[1],2)&&(s.algparam={},s.algparam.p=t.getVbyList(e,o[1],[0],"02"),s.algparam.q=t.getVbyList(e,o[1],[1],"02"),s.algparam.g=t.getVbyList(e,o[1],[2],"02")),"03"!=e.substr(n[1],2))throw new Error("malformed PKCS8 public key(code:004)");return s.key=r(e,n[1]).substr(2),s}}}();et.getKey=function(e,t,i){var r=(g=ce).getChildIdx,s=(g.getV,g.getVbyList),n=ne.crypto,a=n.ECDSA,o=n.DSA,c=ee,l=Ae,u=et;if(void 0!==c&&e instanceof c)return e;if(void 0!==a&&e instanceof a)return e;if(void 0!==o&&e instanceof o)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new a({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new a({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new c).setPublic(e.n,e.e),P;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(P=new c).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),P;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(P=new c).setPrivate(e.n,e.e,e.d),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(P=new o).setPublic(e.p,e.q,e.g,e.y),P;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(P=new o).setPrivate(e.p,e.q,e.g,e.y,e.x),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(P=new c).setPublic(ge(e.n),ge(e.e)),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(P=new c).setPrivateEx(ge(e.n),ge(e.e),ge(e.d),ge(e.p),ge(e.q),ge(e.dp),ge(e.dq),ge(e.qi)),P;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(P=new c).setPrivate(ge(e.n),ge(e.e),ge(e.d)),P;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var d=(T=new a({curve:e.crv})).ecparams.keycharlen,p="04"+("0000000000"+ge(e.x)).slice(-d)+("0000000000"+ge(e.y)).slice(-d);return T.setPublicKeyHex(p),T}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){d=(T=new a({curve:e.crv})).ecparams.keycharlen,p="04"+("0000000000"+ge(e.x)).slice(-d)+("0000000000"+ge(e.y)).slice(-d);var h=("0000000000"+ge(e.d)).slice(-d);return T.setPublicKeyHex(p),T.setPrivateKeyHex(h),T}if("pkcs5prv"===i){var m,f=e,g=ce;if(9===(m=r(f,0)).length)(P=new c).readPKCS5PrvKeyHex(f);else if(6===m.length)(P=new o).readPKCS5PrvKeyHex(f);else{if(!(m.length>2&&"04"===f.substr(m[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(P=new a).readPKCS5PrvKeyHex(f)}return P}if("pkcs8prv"===i)return P=u.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===i)return u._getKeyFromPublicPKCS8Hex(e);if("x509pub"===i)return st.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return st.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var _=Ae(e,"PUBLIC KEY");return u._getKeyFromPublicPKCS8Hex(_)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=l(e,"RSA PRIVATE KEY");return u.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=s(R=l(e,"DSA PRIVATE KEY"),0,[1],"02"),x=s(R,0,[2],"02"),S=s(R,0,[3],"02"),w=s(R,0,[4],"02"),E=s(R,0,[5],"02");return(P=new o).setPrivate(new v(b,16),new v(x,16),new v(S,16),new v(w,16),new v(E,16)),P}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){y=l(e,"EC PRIVATE KEY");return u.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return u.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C=u.getDecryptedKeyHex(e,t),A=new ee;return A.readPKCS5PrvKeyHex(C),A}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var T,P=s(R=u.getDecryptedKeyHex(e,t),0,[1],"04"),I=s(R,0,[2,0],"06"),k=s(R,0,[3,0],"03").substr(2);if(void 0===ne.crypto.OID.oidhex2name[I])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);return(T=new a({curve:ne.crypto.OID.oidhex2name[I]})).setPublicKeyHex(k),T.setPrivateKeyHex(P),T.isPublic=!1,T}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var R;b=s(R=u.getDecryptedKeyHex(e,t),0,[1],"02"),x=s(R,0,[2],"02"),S=s(R,0,[3],"02"),w=s(R,0,[4],"02"),E=s(R,0,[5],"02");return(P=new o).setPrivate(new v(b,16),new v(x,16),new v(S,16),new v(w,16),new v(E,16)),P}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return u.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},et.generateKeypair=function(e,t){if("RSA"==e){var i=t;(a=new ee).generate(i,"10001"),a.isPrivate=!0,a.isPublic=!0;var r=new ee,s=a.n.toString(16),n=a.e.toString(16);return r.setPublic(s,n),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=r,o}if("EC"==e){var a,o,c=t,l=new ne.crypto.ECDSA({curve:c}).generateKeyPairHex();return(a=new ne.crypto.ECDSA({curve:c})).setPublicKeyHex(l.ecpubhex),a.setPrivateKeyHex(l.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(r=new ne.crypto.ECDSA({curve:c})).setPublicKeyHex(l.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=r,o}throw new Error("unknown algorithm: "+e)},et.getPEM=function(e,t,i,r,s,n){var a=ne,o=a.asn1,c=o.DERObjectIdentifier,l=o.DERInteger,u=o.ASN1Util.newObject,d=o.x509.SubjectPublicKeyInfo,p=a.crypto,h=p.DSA,m=p.ECDSA,f=ee;function g(e){return u({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function _(e){return u({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function y(e){return u({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==f&&e instanceof f||void 0!==h&&e instanceof h||void 0!==m&&e instanceof m)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Ce(S=new d(e).tohex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==f&&e instanceof f&&(void 0===i||null==i)&&1==e.isPrivate)return Ce(S=g(e).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===i||null==i)&&1==e.isPrivate){var b=new c({name:e.curveName}).tohex(),v=_(e).tohex(),x="";return x+=Ce(b,"EC PARAMETERS"),x+=Ce(v,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==h&&e instanceof h&&(void 0===i||null==i)&&1==e.isPrivate)return Ce(S=y(e).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==f&&e instanceof f&&void 0!==i&&null!=i&&1==e.isPrivate){var S=g(e).tohex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",S,i,r,n)}if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==i&&null!=i&&1==e.isPrivate){S=_(e).tohex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",S,i,r,n)}if("PKCS5PRV"==t&&void 0!==h&&e instanceof h&&void 0!==i&&null!=i&&1==e.isPrivate){S=y(e).tohex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",S,i,r,n)}var w=function(e,t){if("string"==typeof t)return et.getEncryptedPKCS8PEM(e,t);if("object"==typeof t&&null!=Xe(t,"passcode")){var i=JSON.parse(JSON.stringify(t)),r=i.passcode;return delete i.passcode,et.getEncryptedPKCS8PEM(e,r,i)}};if("PKCS8PRV"==t&&null!=f&&e instanceof f&&1==e.isPrivate){var E=g(e).tohex();S=u({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:E}}]}).tohex();return void 0===i||null==i?Ce(S,"PRIVATE KEY"):w(S,i)}if("PKCS8PRV"==t&&void 0!==m&&e instanceof m&&1==e.isPrivate){var C={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};"string"==typeof e.pubKeyHex&&C.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});E=new u(C).tohex(),S=u({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:E}}]}).tohex();return void 0===i||null==i?Ce(S,"PRIVATE KEY"):w(S,i)}if("PKCS8PRV"==t&&void 0!==h&&e instanceof h&&1==e.isPrivate){E=new l({bigint:e.x}).tohex(),S=u({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:E}}]}).tohex();return void 0===i||null==i?Ce(S,"PRIVATE KEY"):w(S,i)}throw new Error("unsupported object nor format")},et.getKeyFromCSRPEM=function(e){var t=Ae(e,"CERTIFICATE REQUEST");return et.getKeyFromCSRHex(t)},et.getKeyFromCSRHex=function(e){var t=et.parseCSRHex(e);return et.getKey(t.p8pubkeyhex,null,"pkcs8pub")},et.parseCSRHex=function(e){var t=ce,i=t.getChildIdx,r=t.getTLV,s={},n=e;if("30"!=n.substr(0,2))throw new Error("malformed CSR(code:001)");var a=i(n,0);if(a.length<1)throw new Error("malformed CSR(code:002)");if("30"!=n.substr(a[0],2))throw new Error("malformed CSR(code:003)");var o=i(n,a[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return s.p8pubkeyhex=r(n,o[2]),s},et.getKeyID=function(e){var t=et,i=ce;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=Ae(t.getPEM(e)),s=i.getIdxbyList(r,0,[1]),n=i.getV(r,s).substring(2);return ne.crypto.Util.hashHex(n,"sha1")},et.getJWK=function(e,t,i,r,s){var n,a,o={},c=ne.crypto.Util.hashHex;if("string"==typeof e)n=et.getKey(e),-1!=e.indexOf("CERTIFICATE")&&(a=Ae(e));else{if("object"!=typeof e)throw new Error("unsupported keyinfo type");e instanceof st?(n=e.getPublicKey(),a=e.hex):n=e}if(n instanceof ee&&n.isPrivate)o.kty="RSA",o.n=fe(n.n.toString(16)),o.e=fe(n.e.toString(16)),o.d=fe(n.d.toString(16)),o.p=fe(n.p.toString(16)),o.q=fe(n.q.toString(16)),o.dp=fe(n.dmp1.toString(16)),o.dq=fe(n.dmq1.toString(16)),o.qi=fe(n.coeff.toString(16));else if(n instanceof ee&&n.isPublic)o.kty="RSA",o.n=fe(n.n.toString(16)),o.e=fe(n.e.toString(16));else if(n instanceof ne.crypto.ECDSA&&n.isPrivate){if("P-256"!==(u=n.getShortNISTPCurveName())&&"P-384"!==u&&"P-521"!==u)throw new Error("unsupported curve name for JWT: "+u);var l=n.getPublicKeyXYHex();o.kty="EC",o.crv=u,o.x=fe(l.x),o.y=fe(l.y),o.d=fe(n.prvKeyHex)}else if(n instanceof ne.crypto.ECDSA&&n.isPublic){var u;if("P-256"!==(u=n.getShortNISTPCurveName())&&"P-384"!==u&&"P-521"!==u)throw new Error("unsupported curve name for JWT: "+u);l=n.getPublicKeyXYHex();o.kty="EC",o.crv=u,o.x=fe(l.x),o.y=fe(l.y)}if(null==o.kty)throw new Error("unsupported keyinfo");return n.isPrivate||1==t||(o.kid=ne.jws.JWS.getJWKthumbprint(o)),null!=a&&1!=i&&(o.x5c=[_(a)]),null!=a&&1!=r&&(o.x5t=he(_(c(a,"sha1")))),null!=a&&1!=s&&(o["x5t#S256"]=he(_(c(a,"sha256")))),o},et.getJWKFromKey=function(e){return et.getJWK(e,!0,!0,!0,!0)},ee.getPosArrayOfChildrenFromHex=function(e){return ce.getChildIdx(e,0)},ee.getHexValueArrayOfChildrenFromHex=function(e){var t,i=ce.getV,r=i(e,(t=ee.getPosArrayOfChildrenFromHex(e))[0]),s=i(e,t[1]),n=i(e,t[2]),a=i(e,t[3]),o=i(e,t[4]),c=i(e,t[5]),l=i(e,t[6]),u=i(e,t[7]),d=i(e,t[8]);return(t=new Array).push(r,s,n,a,o,c,l,u,d),t},ee.prototype.readPrivateKeyFromPEMString=function(e){var t=Ae(e),i=ee.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},ee.prototype.readPKCS5PrvKeyHex=function(e){var t=ee.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ee.prototype.readPKCS8PrvKeyHex=function(e){var t,i,r,s,n,a,o,c,l=ce,u=l.getVbyListEx;if(!1===l.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=u(e,0,[2,0,1],"02"),i=u(e,0,[2,0,2],"02"),r=u(e,0,[2,0,3],"02"),s=u(e,0,[2,0,4],"02"),n=u(e,0,[2,0,5],"02"),a=u(e,0,[2,0,6],"02"),o=u(e,0,[2,0,7],"02"),c=u(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,i,r,s,n,a,o,c)},ee.prototype.readPKCS5PubKeyHex=function(e){var t=ce,i=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var s=i(e,r[0]),n=i(e,r[1]);this.setPublic(s,n)},ee.prototype.readPKCS8PubKeyHex=function(e){var t=ce;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var i=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(i)},ee.prototype.readCertPubKeyHex=function(e,t){var i,r;(i=new st).readCertHex(e),r=i.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};new RegExp("[^0-9a-f]","gi");function tt(e,t){for(var i="",r=t/4-e.length,s=0;s<r;s++)i+="0";return i+e}function it(e,t,i){for(var r="",s=0;r.length<t;)r+=ve(i(xe(e+String.fromCharCode.apply(String,[(4278190080&s)>>24,(16711680&s)>>16,(65280&s)>>8,255&s])))),s+=1;return r}function rt(e){for(var t in ne.crypto.Util.DIGESTINFOHEAD){var i=ne.crypto.Util.DIGESTINFOHEAD[t],r=i.length;if(e.substring(0,r)==i)return[t,e.substring(r)]}return[]}function st(e){var t,i=ce,r=i.getChildIdx,s=i.getV,n=(i.dump,i.parse),a=i.getTLV,o=i.getVbyList,c=i.getVbyListEx,l=i.getTLVbyList,u=i.getTLVbyListEx,d=i.getIdxbyList,p=i.getIdxbyListEx,h=i.getVidx,m=i.getInt,f=i.oidname,g=i.hextooidstr,_=Ae,y=Error;try{t=ne.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=l(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=l(e,0,[0]),i=m(t,0);if(i<0||2<i)throw new Error("malformed version field");return this.version=i+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return c(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=u(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var i in t)if(e===t[i])return i;return f(c(e,0,[0],"06"))},this.getIssuer=function(e,t){return this.getX500Name(this.getIssuerHex(),e,t)},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(e,t){return this.getX500Name(this.getSubjectHex(),e,t)},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=o(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=o(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var e=this.getSPKI();return null==e?null:o(e,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return d(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return d(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return et.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return o(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),r=l(this.hex,0,[0],"30"),s=new ne.crypto.Signature({alg:t});return s.init(e),s.updateHex(r),s.verify(i)},this.parseExt=function(e){var t,n,a;if(void 0===e){if(a=this.hex,3!==this.version)return-1;t=d(a,0,[0,7,0],"30"),n=r(a,t)}else{a=Ae(e);var c=d(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=s(a,c))return void(this.aExtInfo=new Array);t=d(a,0,[0,3,0,1,0],"30"),n=r(a,t),this.hex=a}this.aExtInfo=new Array;for(var l=0;l<n.length;l++){var u={critical:!1},p=0;3===r(a,n[l]).length&&(u.critical=!0,p=1),u.oid=i.hextooidstr(o(a,n[l],[0],"06"));var m=d(a,n[l],[1+p]);u.vidx=h(a,m),this.aExtInfo.push(u)}},this.getExtInfo=function(e){var t=this.aExtInfo,i=e;if(e.match(/^[0-9.]+$/)||(i=ne.asn1.x509.OID.name2oid(e)),""!==i)for(var r=0;r<t.length;r++)if(t[r].oid===i)return t[r]},this.getCriticalExtV=function(e,t,i){if(null!=t)return[t,i];var r=this.getExtInfo(e);return null==r?[null,null]:[a(this.hex,r.vidx),r.critical]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("basicConstraints");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var n=s(e,10),o=parseInt(n,16);return r.cA=!0,r.pathLen=o,r}throw new Error("hExtV parse error: "+e)},this.getExtNameConstraints=function(e,t){var i=this.getCriticalExtV("nameConstraints",e,t);if(e=i[0],t=i[1],null!=e){var s={extname:"nameConstraints"};t&&(s.critical=!0);for(var n=r(e,0),o=0;o<n.length;o++){for(var c=[],l=r(e,n[o]),u=0;u<l.length;u++){var d=a(e,l[u]),p=this.getGeneralSubtree(d);c.push(p)}var h=e.substr(n[o],2);"a0"==h?s.permit=c:"a1"==h&&(s.exclude=c)}return s}},this.getGeneralSubtree=function(e){var t=r(e,0),i=t.length;if(i<1||2<i)throw new Error("wrong num elements");for(var n=this.getGeneralName(a(e,t[0])),o=1;o<i;o++){var c=e.substr(t[o],2),l=s(e,t[o]),u=parseInt(l,16);"80"==c&&(n.min=u),"81"==c&&(n.max=u)}return n},this.getExtKeyUsage=function(e,t){var i=this.getCriticalExtV("keyUsage",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r}},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var i="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(i=i.slice(-8)),10==e.length&&(i=i.slice(-16)),""==(i=i.replace(/0+$/,""))&&(i="0"),i},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),i=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&i.push(st.KEYUSAGE_NAME[r]);return i.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectKeyIdentifier");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var n=s(e,0);return r.kid={hex:n},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var n={extname:"authorityKeyIdentifier"};t&&(n.critical=!0);for(var o=r(e,0),c=0;c<o.length;c++){var l=e.substr(o[c],2);if("80"===l&&(n.kid={hex:s(e,o[c])}),"a1"===l){var u=a(e,o[c]),d=this.getGeneralNames(u);n.issuer=d[0].dn}"82"===l&&(n.sn={hex:s(e,o[c])})}return n},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var n={extname:"extKeyUsage",array:[]};t&&(n.critical=!0);for(var o=r(e,0),c=0;c<o.length;c++)n.array.push(f(s(e,o[c])));return n},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,i=a(this.hex,e.vidx);if(""===i)return t;for(var n=r(i,0),o=0;o<n.length;o++)t.push(f(s(i,n[o])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectAltName");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("issuerAltName");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),i=[],s=0;s<t.length;s++){var n=this.getGeneralName(a(e,t[s]));void 0!==n&&i.push(n)}return i},this.getGeneralName=function(e){var t=e.substr(0,2),i=s(e,0),r=ve(i);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:Oe(i)}:"a4"==t?{dn:this.getX500Name(i)}:"a0"==t?{other:this.getOtherName(e)}:void 0},this.getExtSubjectAltName2=function(){var e,t,i,n=this.getExtInfo("subjectAltName");if(void 0===n)return n;for(var o=new Array,c=a(this.hex,n.vidx),l=r(c,0),u=0;u<l.length;u++)i=c.substr(l[u],2),e=s(c,l[u]),"81"===i&&(t=ye(e),o.push(["MAIL",t])),"82"===i&&(t=ye(e),o.push(["DNS",t])),"84"===i&&(t=st.hex2dn(e,0),o.push(["DN",t])),"86"===i&&(t=ye(e),o.push(["URI",t])),"87"===i&&(t=Oe(e),o.push(["IP",t]));return o},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("cRLDistributionPoints");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"cRLDistributionPoints",array:[]};t&&(s.critical=!0);for(var n=r(e,0),o=0;o<n.length;o++){var c=a(e,n[o]);s.array.push(this.getDistributionPoint(c))}return s},this.getDistributionPoint=function(e){for(var t={},i=r(e,0),s=0;s<i.length;s++){var n=e.substr(i[s],2),o=a(e,i[s]);"a0"==n&&(t.dpname=this.getDistributionPointName(o))}return t},this.getDistributionPointName=function(e){for(var t={},i=r(e,0),s=0;s<i.length;s++){var n=e.substr(i[s],2),o=a(e,i[s]);"a0"==n&&(t.full=this.getGeneralNames(o))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtCRLDistributionPoints();if(null==e)return e;for(var t=e.array,i=[],r=0;r<t.length;r++)try{null!=t[r].dpname.full[0].uri&&i.push(t[r].dpname.full[0].uri)}catch(e){}return i},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},i=r(this.hex,e.vidx),s=0;s<i.length;s++){var n=o(this.hex,i[s],[0],"06"),a=o(this.hex,i[s],[1],"86");"2b06010505073001"===n&&t.ocsp.push(ye(a)),"2b06010505073002"===n&&t.caissuer.push(ye(a))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("authorityInfoAccess");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"authorityInfoAccess",array:[]};t&&(s.critical=!0);for(var n=r(e,0),l=0;l<n.length;l++){var u=c(e,n[l],[0],"06"),d=ye(o(e,n[l],[1],"86"));if("2b06010505073001"==u)s.array.push({ocsp:d});else{if("2b06010505073002"!=u)throw new Error("unknown method: "+u);s.array.push({caissuer:d})}}return s},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("certificatePolicies");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"certificatePolicies",array:[]};t&&(s.critical=!0);for(var n=r(e,0),o=0;o<n.length;o++){var c=a(e,n[o]),l=this.getPolicyInformation(c);s.array.push(l)}return s},this.getPolicyInformation=function(e){var t={},i=o(e,0,[0],"06");t.policyoid=f(i);var s=p(e,0,[1],"30");if(-1!=s){t.array=[];for(var n=r(e,s),c=0;c<n.length;c++){var l=a(e,n[c]),u=this.getPolicyQualifierInfo(l);t.array.push(u)}}return t},this.getOtherName=function(e){var t={},i=r(e,0),s=o(e,i[0],[],"06"),a=o(e,i[1],[]);return t.oid=f(s),t.value=n(a),t},this.getPolicyQualifierInfo=function(e){var t={},i=o(e,0,[0],"06");if("2b06010505070201"===i){var r=c(e,0,[1],"16");t.cps=ve(r)}else if("2b06010505070202"===i){var s=l(e,0,[1],"30");t.unotice=this.getUserNotice(s)}return t},this.getUserNotice=function(e){var t=null;try{return t=i.parse(e),this._asn1ToUnotice(t)}catch(e){return}},this._asn1ToUnotice=function(e){try{for(var t={},i=Xe(e,"seq"),r=0;r<i.length;r++){var s=this._asn1ToNoticeRef(i[r]);null!=s&&(t.noticeref=s);var n=this.asn1ToDisplayText(i[r]);null!=n&&(t.exptext=n)}return Object.keys(t).length>0?t:void 0}catch(e){return}},this._asn1ToNoticeRef=function(e){try{for(var t={},i=Xe(e,"seq"),r=0;r<i.length;r++){var s=this._asn1ToNoticeNum(i[r]);null!=s&&(t.noticenum=s);var n=this.asn1ToDisplayText(i[r]);null!=n&&(t.org=n)}return Object.keys(t).length>0?t:void 0}catch(e){return}},this._asn1ToNoticeNum=function(e){try{for(var t=Xe(e,"seq"),i=[],r=0;r<t.length;r++){var s=t[r];i.push(parseInt(Xe(s,"int.hex"),16))}return i}catch(e){return}},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=ve(s(e,0)),t},this.asn1ToDisplayText=function(e){return null!=e.utf8str?{type:"utf8",str:e.utf8str.str}:null!=e.ia5str?{type:"ia5",str:e.ia5str.str}:null!=e.visstr?{type:"vis",str:e.visstr.str}:null!=e.bmpstr?{type:"bmp",str:e.bmpstr.str}:null!=e.prnstr?{type:"prn",str:e.prnstr.str}:void 0},this.getExtPolicyMappings=function(e,t){var i=this.getCriticalExtV("policyMappings",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"policyMappings"};t&&(r.critical=!0);try{for(var s=n(e).seq,a=[],o=0;o<s.length;o++){var c=s[o].seq;a.push([c[0].oid,c[1].oid])}r.array=a}catch(e){throw new y("malformed policyMappings")}return r}},this.getExtPolicyConstraints=function(e,t){var i=this.getCriticalExtV("policyConstraints",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"policyConstraints"};t&&(r.critical=!0);var s=n(e);try{for(var a=s.seq,o=0;o<a.length;o++){var c=a[o].tag;0==c.explicit&&("80"==c.tag&&(r.reqexp=parseInt(c.hex,16)),"81"==c.tag&&(r.inhibit=parseInt(c.hex,16)))}}catch(e){return new y("malformed policyConstraints value")}return r}},this.getExtInhibitAnyPolicy=function(e,t){var i=this.getCriticalExtV("inhibitAnyPolicy",e,t);if(e=i[0],t=i[1],null!=e){var r={extname:"inhibitAnyPolicy"};t&&(r.critical=!0);var s=m(e,0);return-1==s?new y("wrong value"):(r.skip=s,r)}},this.getExtCRLNumber=function(e,t){var i={extname:"cRLNumber"};if(t&&(i.critical=!0),"02"==e.substr(0,2))return i.num={hex:s(e,0)},i;throw new y("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var i={extname:"cRLReason"};if(t&&(i.critical=!0),"0a"==e.substr(0,2))return i.code=parseInt(s(e,0),16),i;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var i={extname:"ocspNonce"};t&&(i.critical=!0);var r=s(e,0);return i.hex=r,i},this.getExtOcspNoCheck=function(e,t){var i={extname:"ocspNoCheck"};return t&&(i.critical=!0),i},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("adobeTimeStamp");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var s={extname:"adobeTimeStamp"};t&&(s.critical=!0);var n=r(e,0);if(n.length>1){var o=a(e,n[1]),c=this.getGeneralName(o);null!=c.uri&&(s.uri=c.uri)}if(n.length>2){var l=a(e,n[2]);"0101ff"==l&&(s.reqauth=!0),"010100"==l&&(s.reqauth=!1)}return s},this.getExtSubjectDirectoryAttributes=function(e,t){if(void 0===e&&void 0===t){var i=this.getExtInfo("subjectDirectoryAttributes");if(void 0===i)return;e=a(this.hex,i.vidx),t=i.critical}var r={extname:"subjectDirectoryAttributes"};t&&(r.critical=!0);try{for(var s=n(e),o=[],c=0;c<s.seq.length;c++){var l=s.seq[c],u=Xe(l,"seq.0.oid"),d=Xe(l,"seq.1.set");if(null==u||null==d)throw"error";o.push({attr:u,array:d})}return r.array=o,r}catch(e){throw new Error("malformed subjectDirectoryAttributes extension value")}};var b=function(e){var t={};try{var i=e.seq[0].oid,r=ne.asn1.x509.OID.name2oid(i);t.type=ne.asn1.x509.OID.oid2atype(r);var s=e.seq[1];if(null!=s.utf8str)t.ds="utf8",t.value=s.utf8str.str;else if(null!=s.numstr)t.ds="num",t.value=s.numstr.str;else if(null!=s.telstr)t.ds="tel",t.value=s.telstr.str;else if(null!=s.prnstr)t.ds="prn",t.value=s.prnstr.str;else if(null!=s.ia5str)t.ds="ia5",t.value=s.ia5str.str;else if(null!=s.visstr)t.ds="vis",t.value=s.visstr.str;else{if(null==s.bmpstr)throw"error";t.ds="bmp",t.value=s.bmpstr.str}return t}catch(e){throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},v=function(e){try{return e.set.map((function(e){return b(e)}))}catch(e){throw new Error("improper ASN.1 parsed RDN: "+e)}};this.getX500NameRule=function(e){for(var t=null,i=[],r=0;r<e.length;r++)for(var s=e[r],n=0;n<s.length;n++)i.push(s[n]);for(r=0;r<i.length;r++){var a=i[r],o=a.ds,c=a.value,l=a.type;if("prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=l)return"mixed";if(ne.lang.String.isMail(c))continue;return"mixed"}if("C"==l){if("prn"==o)continue;return"mixed"}if(null==t)t=o;else if(t!==o)return"mixed"}return null==t?"prn":t},this.getAttrTypeAndValue=function(e){var t=n(e);return b(t)},this.getRDN=function(e){var t=n(e);return v(t)},this.getX500NameArray=function(e){return function(e){try{return e.seq.map((function(e){return v(e)}))}catch(e){throw new Error("improper ASN.1 parsed X500Name: "+e)}}(n(e))},this.getX500Name=function(e,t,i){var r=this.getX500NameArray(e),s={str:this.dnarraytostr(r)};return s.array=r,1==i&&(s.hex=e),1==t&&(s.canon=this.c14nRDNArray(r)),s},this.readCertPEM=function(e){this.readCertHex(_(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{d(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(e){var t={};return null==e&&(e={}),t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(e.dncanon,e.dnhex),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(e.dncanon,e.dnhex),t.sbjpubkey=Ce(this.getPublicKeyHex(),"PUBLIC KEY"),null!=this.aExtInfo&&this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),1==e.tbshex&&(t.tbshex=l(this.hex,0,[0])),1==e.nodnarray&&(delete t.issuer.array,delete t.subject.array),t},this.getExtParamArray=function(e){null==e&&(-1!=p(this.hex,0,[0,"[3]"])&&(e=u(this.hex,0,[0,"[3]",0],"30")));for(var t=[],i=r(e,0),s=0;s<i.length;s++){var n=a(e,i[s]),o=this.getExtParam(n);null!=o&&t.push(o)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var i=g(o(e,0,[0],"06")),s=!1;3==t&&"0101ff"==l(e,0,[1])&&(s=!0);var a=l(e,0,[t-1,0]),c=void 0;if("2.5.29.14"==i?c=this.getExtSubjectKeyIdentifier(a,s):"2.5.29.15"==i?c=this.getExtKeyUsage(a,s):"2.5.29.17"==i?c=this.getExtSubjectAltName(a,s):"2.5.29.18"==i?c=this.getExtIssuerAltName(a,s):"2.5.29.19"==i?c=this.getExtBasicConstraints(a,s):"2.5.29.30"==i?c=this.getExtNameConstraints(a,s):"2.5.29.31"==i?c=this.getExtCRLDistributionPoints(a,s):"2.5.29.32"==i?c=this.getExtCertificatePolicies(a,s):"2.5.29.33"==i?c=this.getExtPolicyMappings(a,s):"2.5.29.35"==i?c=this.getExtAuthorityKeyIdentifier(a,s):"2.5.29.36"==i?c=this.getExtPolicyConstraints(a,s):"2.5.29.37"==i?c=this.getExtExtKeyUsage(a,s):"2.5.29.54"==i?c=this.getExtInhibitAnyPolicy(a,s):"1.3.6.1.5.5.7.1.1"==i?c=this.getExtAuthorityInfoAccess(a,s):"2.5.29.20"==i?c=this.getExtCRLNumber(a,s):"2.5.29.21"==i?c=this.getExtCRLReason(a,s):"2.5.29.9"==i?c=this.getExtSubjectDirectoryAttributes(a,s):"1.3.6.1.5.5.7.48.1.2"==i?c=this.getExtOcspNonce(a,s):"1.3.6.1.5.5.7.48.1.5"==i?c=this.getExtOcspNoCheck(a,s):"1.2.840.113583.1.1.9.1"==i?c=this.getExtAdobeTimeStamp(a,s):null!=st.EXT_PARSER[i]&&(c=st.EXT_PARSER[i](i,s,a)),null!=c)return c;var u={extname:i,extn:a};try{u.extn=n(a)}catch(e){}return s&&(u.critical=!0),u},this.findExt=function(e,t){for(var i=0;i<e.length;i++)if(e[i].extname==t)return e[i];return null},this.updateExtCDPFullURI=function(e,t){var i=this.findExt(e,"cRLDistributionPoints");if(null!=i&&null!=i.array)for(var r=i.array,s=0;s<r.length;s++)if(null!=r[s].dpname&&null!=r[s].dpname.full)for(var n=r[s].dpname.full,a=0;a<n.length;a++){var o=n[s];null!=o.uri&&(o.uri=t)}},this.updateExtAIAOCSP=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var r=i.array,s=0;s<r.length;s++)null!=r[s].ocsp&&(r[s].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var i=this.findExt(e,"authorityInfoAccess");if(null!=i&&null!=i.array)for(var r=i.array,s=0;s<r.length;s++)null!=r[s].caissuer&&(r[s].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.setCanonicalizedDN=function(e){var t;if(null!=e.str&&null==e.array){var i=new ne.asn1.x509.X500Name({str:e.str}).tohex();t=this.getX500NameArray(i)}else t=e.array;null==e.canon&&(e.canon=this.c14nRDNArray(t))},this.c14nRDNArray=function(e){for(var t=[],i=0;i<e.length;i++){for(var r=e[i],s=[],n=0;n<r.length;n++){var a=r[n],o=a.value;o=(o=(o=(o=o.replace(/^\s*/,"")).replace(/\s*$/,"")).replace(/\s+/g," ")).toLowerCase(),s.push(a.type.toLowerCase()+"="+o)}t.push(s.join("+"))}return"/"+t.join("/")},this.getInfo=function(){var e,t,i,r=function(e){for(var t="",i="    ",r="\n",s=e.array,n=0;n<s.length;n++){var a=s[n];if(null!=a.dn&&(t+=i+"dn: "+a.dn.str+r),null!=a.ip&&(t+=i+"ip: "+a.ip+r),null!=a.rfc822&&(t+=i+"rfc822: "+a.rfc822+r),null!=a.dns&&(t+=i+"dns: "+a.dns+r),null!=a.uri&&(t+=i+"uri: "+a.uri+r),null!=a.other)t+=i+"other: "+a.other.oid+"="+JSON.stringify(a.other.value).replace(/\"/g,"")+r}return t=t.replace(/\n$/,"")},s=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var s=i[r];if(t+="    policy oid: "+s.policyoid+"\n",void 0!==s.array)for(var n=0;n<s.array.length;n++){var a=s.array[n];void 0!==a.cps&&(t+="    cps: "+a.cps+"\n")}}return t},n=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var s=i[r];try{void 0!==s.dpname.full[0].uri&&(t+="    "+s.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==s.dname.full[0].dn.hex&&(t+="    "+st.hex2dn(s.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},a=function(e){for(var t="",i=e.array,r=0;r<i.length;r++){var s=i[r];void 0!==s.caissuer&&(t+="    caissuer: "+s.caissuer+"\n"),void 0!==s.ocsp&&(t+="    ocsp: "+s.ocsp+"\n")}return t};if(e="Basic Fields\n",e+="  serial number: "+this.getSerialNumberHex()+"\n",e+="  signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+="  issuer: "+this.getIssuerString()+"\n",e+="  notBefore: "+this.getNotBefore()+"\n",e+="  notAfter: "+this.getNotAfter()+"\n",e+="  subject: "+this.getSubjectString()+"\n",e+="  subject public key info: \n",e+="    key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+="    n="+He(t.n.toString(16)).substr(0,16)+"...\n",e+="    e="+He(t.e.toString(16))+"\n"),null!=(i=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var o=0;o<i.length;o++){var c=i[o],l=ne.asn1.x509.OID.oid2name(c.oid);""===l&&(l=c.oid);var u="";if(!0===c.critical&&(u="CRITICAL"),e+="  "+l+" "+u+":\n","basicConstraints"===l){var d=this.getExtBasicConstraints();void 0===d.cA?e+="    {}\n":(e+="    cA=true",void 0!==d.pathLen&&(e+=", pathLen="+d.pathLen),e+="\n")}else{var p;if("policyMappings"==l)e+="    "+this.getExtPolicyMappings().array.map((function(e){var t=e;return t[0]+":"+t[1]})).join(", ")+"\n";else if("policyConstraints"==l)e+="    ",null!=(p=this.getExtPolicyConstraints()).reqexp&&(e+=" reqexp="+p.reqexp),null!=p.inhibit&&(e+=" inhibit="+p.inhibit),e+="\n";else if("inhibitAnyPolicy"==l)e+="    skip="+(p=this.getExtInhibitAnyPolicy()).skip+"\n";else if("keyUsage"==l)e+="    "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"==l)e+="    "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"==l){var h=this.getExtAuthorityKeyIdentifier();void 0!==h.kid&&(e+="    kid="+h.kid.hex+"\n")}else{if("extKeyUsage"==l)e+="    "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"==l)e+=r(this.getExtSubjectAltName())+"\n";else if("cRLDistributionPoints"==l)e+=n(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"==l)e+=a(this.getExtAuthorityInfoAccess());else"certificatePolicies"==l&&(e+=s(this.getExtCertificatePolicies()))}}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):ne.lang.String.isHex(e)&&this.readCertHex(e))}ee.prototype.sign=function(e,t){var i=function(e){return ne.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(i,t)},ee.prototype.signWithMessageHash=function(e,t){var i=Q(ne.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return tt(this.doPrivate(i).toString(16),this.n.bitLength())},ee.prototype.signPSS=function(e,t,i){var r,s=(r=xe(e),ne.crypto.Util.hashHex(r,t));return void 0===i&&(i=-1),this.signWithMessageHashPSS(s,t,i)},ee.prototype.signWithMessageHashPSS=function(e,t,i){var r,s=ve(e),n=s.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),c=function(e){return ne.crypto.Util.hashHex(e,t)};if(-1===i||void 0===i)i=n;else if(-2===i)i=o-n-2;else if(i<-2)throw new Error("invalid salt length");if(o<n+i+2)throw new Error("data too long");var l="";i>0&&(l=new Array(i),(new X).nextBytes(l),l=String.fromCharCode.apply(String,l));var u=ve(c(xe("\0\0\0\0\0\0\0\0"+s+l))),d=[];for(r=0;r<o-i-n-2;r+=1)d[r]=0;var p=String.fromCharCode.apply(String,d)+""+l,h=it(u,p.length,c),m=[];for(r=0;r<p.length;r+=1)m[r]=p.charCodeAt(r)^h.charCodeAt(r);var f=65280>>8*o-a&255;for(m[0]&=~f,r=0;r<n;r++)m.push(u.charCodeAt(r));return m.push(188),tt(this.doPrivate(new v(m)).toString(16),this.n.bitLength())},ee.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var i=Q(t,16),r=this.n.bitLength();if(i.bitLength()>r)return!1;var s=this.doPublic(i).toString(16);if(s.length+3!=r/4)return!1;var n=rt(s.replace(/^1f+00/,""));if(0==n.length)return!1;var a=n[0],o=n[1],c=function(e){return ne.crypto.Util.hashString(e,a)}(e);return o==c},ee.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=Q(t,16);if(i.bitLength()>this.n.bitLength())return 0;var r=rt(this.doPublic(i).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==e},ee.prototype.verifyPSS=function(e,t,i,r){var s,n=(s=xe(e),ne.crypto.Util.hashHex(s,i));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(n,t,i,r)},ee.prototype.verifyWithMessageHashPSS=function(e,t,i,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var s,n=new v(t,16),a=function(e){return ne.crypto.Util.hashHex(e,i)},o=ve(e),c=o.length,l=this.n.bitLength()-1,u=Math.ceil(l/8);if(-1===r||void 0===r)r=c;else if(-2===r)r=u-c-2;else if(r<-2)throw new Error("invalid salt length");if(u<c+r+2)throw new Error("data too long");var d=this.doPublic(n).toByteArray();for(s=0;s<d.length;s+=1)d[s]&=255;for(;d.length<u;)d.unshift(0);if(188!==d[u-1])throw new Error("encoded message does not end in 0xbc");var p=(d=String.fromCharCode.apply(String,d)).substr(0,u-c-1),h=d.substr(p.length,c),m=65280>>8*u-l&255;if(p.charCodeAt(0)&m)throw new Error("bits beyond keysize not zero");var f=it(h,p.length,a),g=[];for(s=0;s<p.length;s+=1)g[s]=p.charCodeAt(s)^f.charCodeAt(s);g[0]&=~m;var _=u-c-r-2;for(s=0;s<_;s+=1)if(0!==g[s])throw new Error("leftmost octets not zero");if(1!==g[_])throw new Error("0x01 marker not found");return h===ve(a(xe("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,g.slice(-r)))))},ee.SALT_LEN_HLEN=-1,ee.SALT_LEN_MAX=-2,ee.SALT_LEN_RECOVER=-2,st.EXT_PARSER={},st.registExtParser=function(e,t){st.EXT_PARSER[e]=t},st.hex2dn=function(e,t){void 0===t&&(t=0);var i=new st;ce.getTLV(e,t);return i.getX500Name(e).str},st.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var i=new Array,r=ce.getChildIdx(e,t),s=0;s<r.length;s++)i.push(st.hex2attrTypeValue(e,r[s]));return i=i.map((function(e){return e.replace("+","\\+")})),i.join("+")},st.hex2attrTypeValue=function(e,t){var i=ce,r=i.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var s=i.getChildIdx(e,t);2!==s.length||e.substr(s[0],2);var n=r(e,s[0]),a=ne.asn1.ASN1Util.oidHexToInt(n);return ne.asn1.x509.OID.oid2atype(a)+"="+ve(r(e,s[1]))},st.getPublicKeyFromCertHex=function(e){var t=new st;return t.readCertHex(e),t.getPublicKey()},st.getPublicKeyFromCertPEM=function(e){var t=new st;return t.readCertPEM(e),t.getPublicKey()},st.getPublicKeyInfoPropOfCertPEM=function(e){var t,i,r=ce.getVbyList,s={};return s.algparam=null,(t=new st).readCertPEM(e),i=t.getPublicKeyHex(),s.keyhex=r(i,0,[1],"03").substr(2),s.algoid=r(i,0,[0,0],"06"),"2a8648ce3d0201"===s.algoid&&(s.algparam=r(i,0,[0,1],"06")),s},st.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];void 0!==ne&&ne||(ne={}),void 0!==ne.jws&&ne.jws||(ne.jws={}),ne.jws.JWS=function(){var e=ne.jws.JWS.isSafeJSONString;this.parseJWS=function(t,i){if(void 0===this.parsedJWS||!i&&void 0===this.parsedJWS.sigvalH){var r=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=r[1],n=r[2],a=r[3],o=s+"."+n;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=n,this.parsedJWS.sigvalB64U=a,this.parsedJWS.si=o,!i){var c=ge(a),l=Q(c,16);this.parsedJWS.sigvalH=c,this.parsedJWS.sigvalBI=l}var u=oe(s),d=oe(n);if(this.parsedJWS.headS=u,this.parsedJWS.payloadS=d,!e(u,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+u}}},ne.jws.JWS.sign=function(e,t,i,r,s){var n,a,o,c=ne,l=c.jws.JWS,u=l.readSafeJSONString,d=l.isSafeJSONString,p=c.crypto,h=(p.ECDSA,p.Mac),m=p.Signature,f=JSON;if("string"!=typeof t&&"object"!=typeof t)throw"spHeader must be JSON string or object: "+t;if("object"==typeof t&&(a=t,n=f.stringify(a)),"string"==typeof t){if(!d(n=t))throw"JWS Head is not safe JSON string: "+n;a=u(n)}if(o=i,"object"==typeof i&&(o=f.stringify(i)),""!=e&&null!=e||void 0===a.alg||(e=a.alg),""!=e&&null!=e&&void 0===a.alg&&(a.alg=e,n=f.stringify(a)),e!==a.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+a.alg;var g=null;if(void 0===l.jwsalg2sigalg[e])throw"unsupported alg name: "+e;g=l.jwsalg2sigalg[e];var _=ae(n)+"."+ae(o),y="";if("Hmac"==g.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var b=new h({alg:g,prov:"cryptojs",pass:r});b.updateString(_),y=b.doFinal()}else if(-1!=g.indexOf("withECDSA")){(x=new m({alg:g})).init(r,s),x.updateString(_);var v=x.sign();y=ne.crypto.ECDSA.asn1SigToConcatSig(v)}else{var x;if("none"!=g)(x=new m({alg:g})).init(r,s),x.updateString(_),y=x.sign()}return _+"."+fe(y)},ne.jws.JWS.verify=function(e,t,i){var r,s=ne,n=s.jws.JWS,a=n.readSafeJSONString,o=s.crypto,c=o.ECDSA,l=o.Mac,u=o.Signature;if(r=ee,!qe(e))return!1;var d=e.split(".");if(3!==d.length)return!1;var p=d[0]+"."+d[1],h=ge(d[2]),m=a(oe(d[0])),f=null,g=null;if(void 0===m.alg)throw"algorithm not specified in header";if((g=(f=m.alg).substr(0,2),null!=i&&"[object Array]"===Object.prototype.toString.call(i)&&i.length>0)&&-1==(":"+i.join(":")+":").indexOf(":"+f+":"))throw"algorithm '"+f+"' not accepted in the list";if("none"!=f&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=et.getKey(t)),!("RS"!=g&&"PS"!=g||t instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==g&&!(t instanceof c))throw"key shall be a ECDSA obj for ES* algs";var _=null;if(void 0===n.jwsalg2sigalg[m.alg])throw"unsupported alg name: "+f;if("none"==(_=n.jwsalg2sigalg[f]))throw"not supported";if("Hmac"==_.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var y=new l({alg:_,pass:t});return y.updateString(p),h==y.doFinal()}if(-1!=_.indexOf("withECDSA")){var b,v=null;try{v=c.concatSigToASN1Sig(h)}catch(e){return!1}return(b=new u({alg:_})).init(t),b.updateString(p),b.verify(v)}return(b=new u({alg:_})).init(t),b.updateString(p),b.verify(h)},ne.jws.JWS.parse=function(e){var t,i,r,s=e.split("."),n={};if(2!=s.length&&3!=s.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=s[0],i=s[1],3==s.length&&(r=s[2]),n.headerObj=ne.jws.JWS.readSafeJSONString(oe(t)),n.payloadObj=ne.jws.JWS.readSafeJSONString(oe(i)),n.headerPP=JSON.stringify(n.headerObj,null,"  "),null==n.payloadObj?n.payloadPP=oe(i):n.payloadPP=JSON.stringify(n.payloadObj,null,"  "),void 0!==r&&(n.sigHex=ge(r)),n},ne.jws.JWS.verifyJWT=function(e,t,i){var r=ne.jws,s=r.JWS,n=s.readSafeJSONString,a=s.inArray,o=s.includedArray;if(!qe(e))return!1;var c=e.split(".");if(3!=c.length)return!1;var l=c[0],u=c[1],d=(ge(c[2]),n(oe(l))),p=n(oe(u));if(void 0===d.alg)return!1;if(void 0===i.alg)throw"acceptField.alg shall be specified";if(!a(d.alg,i.alg))return!1;if(void 0!==p.iss&&"object"==typeof i.iss&&!a(p.iss,i.iss))return!1;if(void 0!==p.sub&&"object"==typeof i.sub&&!a(p.sub,i.sub))return!1;if(void 0!==p.aud&&"object"==typeof i.aud)if("string"==typeof p.aud){if(!a(p.aud,i.aud))return!1}else if("object"==typeof p.aud&&!o(p.aud,i.aud))return!1;var h=r.IntDate.getNow();return void 0!==i.verifyAt&&"number"==typeof i.verifyAt&&(h=i.verifyAt),void 0!==i.gracePeriod&&"number"==typeof i.gracePeriod||(i.gracePeriod=0),!(void 0!==p.exp&&"number"==typeof p.exp&&p.exp+i.gracePeriod<h)&&(!(void 0!==p.nbf&&"number"==typeof p.nbf&&h<p.nbf-i.gracePeriod)&&(!(void 0!==p.iat&&"number"==typeof p.iat&&h<p.iat-i.gracePeriod)&&((void 0===p.jti||void 0===i.jti||p.jti===i.jti)&&!!s.verify(e,t,i.alg))))},ne.jws.JWS.includedArray=function(e,t){var i=ne.jws.JWS.inArray;if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(!i(e[r],t))return!1;return!0},ne.jws.JWS.inArray=function(e,t){if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1},ne.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ne.jws.JWS.isSafeJSONString=function(e,t,i){var r=null;try{return"object"!=typeof(r=se(e))||r.constructor===Array?0:(t&&(t[i]=r),1)}catch(e){return 0}},ne.jws.JWS.readSafeJSONString=function(e){var t=null;try{return"object"!=typeof(t=se(e))||t.constructor===Array?null:t}catch(e){return null}},ne.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==t)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},ne.jws.JWS.getJWKthumbprint=function(e){if("RSA"!==e.kty&&"EC"!==e.kty&&"oct"!==e.kty)throw"unsupported algorithm for JWK Thumprint";var t="{";if("RSA"===e.kty){if("string"!=typeof e.n||"string"!=typeof e.e)throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if("EC"===e.kty){if("string"!=typeof e.crv||"string"!=typeof e.x||"string"!=typeof e.y)throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if("oct"===e.kty){if("string"!=typeof e.k)throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var i=xe(t);return fe(ne.crypto.Util.hashHex(i,"sha256"))},ne.jws.IntDate={},ne.jws.IntDate.get=function(e){var t=ne.jws.IntDate,i=t.getNow,r=t.getZulu;if("now"==e)return i();if("now + 1hour"==e)return i()+3600;if("now + 1day"==e)return i()+86400;if("now + 1month"==e)return i()+2592e3;if("now + 1year"==e)return i()+31536e3;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},ne.jws.IntDate.getZulu=function(e){return Pe(e)},ne.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ne.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},ne.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},void 0!==ne&&ne||(ne={}),void 0!==ne.jws&&ne.jws||(ne.jws={}),ne.jws.JWSJS=function(){var e=ne.jws.JWS,t=e.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(e){this.init();var t=e.split(".");if(3!=t.length)throw"malformed input JWS";this.aHeader.push(t[0]),this.sPayload=t[1],this.aSignature.push(t[2])},this.addSignature=function(e,t,i,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var s=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var n=ne.jws.JWS.sign(e,t,this.sPayload,i,r).split(".");n[0],n[2];this.aHeader.push(n[0]),this.aSignature.push(n[2])}catch(e){throw this.aHeader.length>s&&this.aHeader.pop(),this.aSignature.length>s&&this.aSignature.pop(),"addSignature failed: "+e}},this.verifyAll=function(e){if(this.aHeader.length!==e.length||this.aSignature.length!==e.length)return!1;for(var t=0;t<e.length;t++){var i=e[t];if(2!==i.length)return!1;if(!1===this.verifyNth(t,i[0],i[1]))return!1}return!0},this.verifyNth=function(t,i,r){if(this.aHeader.length<=t||this.aSignature.length<=t)return!1;var s=this.aHeader[t],n=this.aSignature[t],a=s+"."+this.sPayload+"."+n,o=!1;try{o=e.verify(a,i,r)}catch(e){return!1}return o},this.readJWSJS=function(e){if("string"==typeof e){var i=t(e);if(null==i)throw"argument is not safe JSON object string";this.aHeader=i.headers,this.sPayload=i.payload,this.aSignature=i.signatures}else try{if(!(e.headers.length>0))throw"malformed header";if(this.aHeader=e.headers,"string"!=typeof e.payload)throw"malformed signatures";if(this.sPayload=e.payload,!(e.signatures.length>0))throw"malformed signatures";this.aSignature=e.signatures}catch(e){throw"malformed JWS-JS JSON object: "+e}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},e.SecureRandom=X,e.rng_seed_time=Z,e.BigInteger=v,e.RSAKey=ee,e.ECDSA=ne.crypto.ECDSA,e.DSA=ne.crypto.DSA,e.Signature=ne.crypto.Signature,e.MessageDigest=ne.crypto.MessageDigest,e.Mac=ne.crypto.Mac,e.KEYUTIL=et,e.ASN1HEX=ce,e.X509=st,e.X509CRL=function(e){var t=ne.lang.String.isHex,i=ce,r=i.getV,s=i.getTLV,n=i.getVbyList,a=i.getTLVbyList,o=i.getTLVbyListEx,c=i.getIdxbyList,l=i.getIdxbyListEx,u=i.getChildIdx,d=new st;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this.parsed=null,this._setPos=function(){var e=c(this.hex,0,[0,0]),t=this.hex.substr(e,2);if("02"==t)this.posSigAlg=1;else{if("30"!=t)throw new Error("malformed 1st item of TBSCertList: "+t);this.posSigAlg=0}var i,r=c(this.hex,0,[0,this.posSigAlg+3]),s=this.hex.substr(r,2);if("17"==s||"18"==s)i=c(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,-1!=i&&"30"==this.hex.substr(i,2)&&(this.posRevCert=this.posSigAlg+4);else if("30"==s)this.posRevCert=this.posSigAlg+3;else{if("a0"!=s)throw new Error("malformed nextUpdate or revCert tag: "+s);this.posRevCert=null}},this.getVersion=function(){return 0==this.posSigAlg?null:parseInt(n(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var e=a(this.hex,0,[0,this.posSigAlg],"30");return d.getAlgorithmIdentifierName(e)},this.getIssuer=function(){return d.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return a(this.hex,0,[0,this.posSigAlg+1],"30")},this.getThisUpdate=function(){var e=n(this.hex,0,[0,this.posSigAlg+2]);return result=ve(e)},this.getNextUpdate=function(){var e=c(this.hex,0,[0,this.posSigAlg+3]),t=this.hex.substr(e,2);return"17"!=t&&"18"!=t?null:ve(r(this.hex,e))},this.getRevCertArray=function(){if(null==this.posRevCert)return null;for(var e=[],t=c(this.hex,0,[0,this.posRevCert]),i=u(this.hex,t),r=0;r<i.length;r++){var n=s(this.hex,i[r]);e.push(this.getRevCert(n))}return e},this.getRevCert=function(e){var t={},i=u(e,0);return t.sn={hex:n(e,0,[0],"02")},t.date=ve(n(e,0,[1])),3==i.length&&(t.ext=d.getExtParamArray(a(e,0,[2]))),t},this.findRevCert=function(e){var t=new st(e).getSerialNumberHex();return this.findRevCertBySN(t)},this.findRevCertBySN=function(e){if(null==this.parsed&&this.getParam(),null==this.parsed.revcert)return null;for(var t=this.parsed.revcert,i=0;i<t.length;i++)if(e==t[i].sn.hex)return t[i];return null},this.getSignatureValueHex=function(){return n(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),i=this.getSignatureValueHex(),r=a(this.hex,0,[0],"30"),s=new ne.crypto.Signature({alg:t});return s.init(e),s.updateHex(r),s.verify(i)},this.getParam=function(e){var t={},i=this.getVersion();null!=i&&(t.version=i),t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.thisupdate=this.getThisUpdate();var r=this.getNextUpdate();null!=r&&(t.nextupdate=r);var s=this.getRevCertArray();if(null!=s&&(t.revcert=s),-1!=l(this.hex,0,[0,"[0]"])){var n=o(this.hex,0,[0,"[0]",0]);t.ext=d.getExtParamArray(n)}return t.sighex=this.getSignatureValueHex(),this.parsed=t,"object"==typeof e&&(1==e.tbshex&&(t.tbshex=a(this.hex,0,[0])),1==e.nodnarray&&delete t.issuer.array),t},"string"==typeof e&&(t(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Ae(e)),this._setPos())},e.CryptoJS=m,e.b64tohex=y,e.b64toBA=b,e.ECFieldElementFp=te,e.ECPointFp=ie,e.ECCurveFp=re,e.stoBA=le,e.BAtos=ue,e.BAtohex=de,e.stohex=pe,e.stob64=function(e){return _(pe(e))},e.stob64u=function(e){return he(_(pe(e)))},e.b64utos=function(e){return ue(b(me(e)))},e.b64tob64u=he,e.b64utob64=me,e.hex2b64=_,e.hextob64u=fe,e.b64utohex=ge,e.utf8tob64u=ae,e.b64utoutf8=oe,e.utf8tob64=function(e){return _(ke(Ue(e)))},e.b64toutf8=function(e){return decodeURIComponent(Re(y(e)))},e.utf8tohex=_e,e.hextoutf8=ye,e.hextorstr=ve,e.rstrtohex=xe,e.hextob64=Se,e.hextob64nl=function(e){return we(Se(e),64)},e.b64nltohex=Ee,e.hextopem=Ce,e.pemtohex=Ae,e.hextoArrayBuffer=function(e){if(e.length%2!=0)throw"input is not even length";if(null==e.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),i=new DataView(t),r=0;r<e.length/2;r++)i.setUint8(r,parseInt(e.substr(2*r,2),16));return t},e.ArrayBuffertohex=function(e){for(var t="",i=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+i.getUint8(r).toString(16)).slice(-2);return t},e.zulutomsec=Te,e.msectozulu=function(e){var t=new Date(e),i=("0000"+t.getUTCFullYear()).slice(-4),r=("00"+(t.getUTCMonth()+1)).slice(-2),s=("00"+t.getUTCDate()).slice(-2),n=("00"+t.getUTCHours()).slice(-2),a=("00"+t.getUTCMinutes()).slice(-2),o=("00"+t.getUTCSeconds()).slice(-2),c=("000"+t.getUTCMilliseconds()).slice(-3);return i+r+s+n+a+o+(c=""!=(c=c.replace(/0+$/,""))?"."+c:c)+"Z"},e.zulutosec=Pe,e.zulutodate=function(e){return new Date(Te(e))},e.datetozulu=function(e,t,i){var r,s=e.getUTCFullYear();if(t){if(s<1950||2049<s)throw"not proper year for UTCTime: "+s;r=(""+s).slice(-2)}else r=("000"+s).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),i){var n=e.getUTCMilliseconds();0!==n&&(r+="."+(n=(n=("00"+n).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},e.uricmptohex=ke,e.hextouricmp=Re,e.ipv6tohex=Fe,e.hextoipv6=Be,e.hextoip=Oe,e.iptohex=De,e.ucs2hextoutf8=Le,e.encodeURIComponentAll=Ue,e.newline_toUnix=function(e){return e=e.replace(/\r\n/gm,"\n")},e.newline_toDos=function(e){return e=(e=e.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},e.hextoposhex=He,e.intarystrtohex=function(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,i){var r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}},e.strdiffidx=function(e,t){var i=e.length;e.length>t.length&&(i=t.length);for(var r=0;r<i;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?i:-1},e.oidtohex=ze,e.hextooid=Ve,e.strpad=We,e.bitstrtoint=Je,e.inttobitstr=$e,e.bitstrtobinstr=Ze,e.binstrtobitstr=function(e){if("string"!=typeof e)return null;if(null==e.match(/^[01]+$/))return null;try{return $e(parseInt(e,2))}catch(e){return null}},e.isBase64URLDot=qe,e.namearraytobinstr=Ye,e.extendClass=Qe,e.foldnl=we,e.b64topem=function(e,t){return"-----BEGIN "+t+"-----\r\n"+we(e,64)+"\r\n-----END "+t+"-----\r\n"},e.pemtob64=function(e){return-1==e.indexOf("-----BEGIN ")||-1==e.indexOf("-----END ")?null:(e=(e=(e=e.replace(/^[\s\S]*?-----BEGIN [^-]+-----/m,"")).replace(/-----END [\s\S]+$/m,"")).replace(/\s+/g,"")).match(/^[0-9a-zA-Z+/=]+$/)?e:null},e.timeogen=Ie,e.aryval=Xe,e.inttohex=Ke,e.twoscompl=Ge,e.KJUR=ne,e.crypto=ne.crypto,e.asn1=ne.asn1,e.jws=ne.jws,e.lang=ne.lang,e.VERSION="11.1.0",e.VERSION_FULL="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license"}}),require_jwt_decode_cjs2=__commonJS({"../../node_modules/.pnpm/jwt-decode@3.1.2/node_modules/jwt-decode/build/jwt-decode.cjs.js"(e,t){"use strict";function i(e){this.message=e}i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new i("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,s,n=0,a=0,o="";s=t.charAt(a++);~s&&(r=n%4?64*r+s:s,n++%4)?o+=String.fromCharCode(255&r>>(-2*n&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return o};function s(e){this.message=e}function n(e,t){if("string"!=typeof e)throw new s("Invalid token specified");var i=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(r(t).replace(/(.)/g,(function(e,t){var i=t.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i})))}catch(e){return r(t)}}(e.split(".")[i]))}catch(e){throw new s("Invalid token specified: "+e.message)}}s.prototype=new Error,s.prototype.name="InvalidTokenError";var a=n;a.default=n,a.InvalidTokenError=s,t.exports=a}}),require_util6=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/helpers/util.js"(e){"use strict";var t,i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.getParsedType=e.ZodParsedType=e.objectUtil=e.util=void 0,(i=t||(e.util=t={})).assertEqual=e=>{},i.assertIs=function(e){},i.assertNever=function(e){throw new Error},i.arrayToEnum=e=>{const t={};for(const i of e)t[i]=i;return t},i.getValidEnumValues=e=>{const t=i.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const i of t)r[i]=e[i];return i.objectValues(r)},i.objectValues=e=>i.objectKeys(e).map((function(t){return e[t]})),i.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},i.find=(e,t)=>{for(const i of e)if(t(i))return i},i.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,i.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},i.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(r||(e.objectUtil=r={})).mergeShapes=(e,t)=>({...e,...t}),e.ZodParsedType=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);e.getParsedType=t=>{switch(typeof t){case"undefined":return e.ZodParsedType.undefined;case"string":return e.ZodParsedType.string;case"number":return Number.isNaN(t)?e.ZodParsedType.nan:e.ZodParsedType.number;case"boolean":return e.ZodParsedType.boolean;case"function":return e.ZodParsedType.function;case"bigint":return e.ZodParsedType.bigint;case"symbol":return e.ZodParsedType.symbol;case"object":return Array.isArray(t)?e.ZodParsedType.array:null===t?e.ZodParsedType.null:t.then&&"function"==typeof t.then&&t.catch&&"function"==typeof t.catch?e.ZodParsedType.promise:"undefined"!=typeof Map&&t instanceof Map?e.ZodParsedType.map:"undefined"!=typeof Set&&t instanceof Set?e.ZodParsedType.set:"undefined"!=typeof Date&&t instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}}}}),require_ZodError2=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/ZodError.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZodError=e.quotelessJson=e.ZodIssueCode=void 0;var t=require_util6();e.ZodIssueCode=t.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);e.quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");var i=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},i={_errors:[]},r=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(r);else if("invalid_return_type"===s.code)r(s.returnTypeError);else if("invalid_arguments"===s.code)r(s.argumentsError);else if(0===s.path.length)i._errors.push(t(s));else{let e=i,r=0;for(;r<s.path.length;){const i=s.path[r];r===s.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(s))):e[i]=e[i]||{_errors:[]},e=e[i],r++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},i=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):i.push(e(r));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}};e.ZodError=i,i.create=e=>new i(e)}}),require_en2=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/locales/en.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=require_ZodError2(),i=require_util6();e.default=(e,r)=>{let s;switch(e.code){case t.ZodIssueCode.invalid_type:s=e.received===i.ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case t.ZodIssueCode.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,i.util.jsonStringifyReplacer)}`;break;case t.ZodIssueCode.unrecognized_keys:s=`Unrecognized key(s) in object: ${i.util.joinValues(e.keys,", ")}`;break;case t.ZodIssueCode.invalid_union:s="Invalid input";break;case t.ZodIssueCode.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${i.util.joinValues(e.options)}`;break;case t.ZodIssueCode.invalid_enum_value:s=`Invalid enum value. Expected ${i.util.joinValues(e.options)}, received '${e.received}'`;break;case t.ZodIssueCode.invalid_arguments:s="Invalid function arguments";break;case t.ZodIssueCode.invalid_return_type:s="Invalid function return type";break;case t.ZodIssueCode.invalid_date:s="Invalid date";break;case t.ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:i.util.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case t.ZodIssueCode.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case t.ZodIssueCode.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case t.ZodIssueCode.custom:s="Invalid input";break;case t.ZodIssueCode.invalid_intersection_types:s="Intersection results could not be merged";break;case t.ZodIssueCode.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case t.ZodIssueCode.not_finite:s="Number must be finite";break;default:s=r.defaultError,i.util.assertNever(e)}return{message:s}}}}),require_errors4=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/errors.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultErrorMap=void 0,e.setErrorMap=function(e){r=e},e.getErrorMap=function(){return r};var i=t(require_en2());e.defaultErrorMap=i.default;var r=i.default}}),require_parseUtil2=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/helpers/parseUtil.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.EMPTY_PATH=e.makeIssue=void 0,e.addIssueToContext=function(t,s){const n=(0,i.getErrorMap)(),a=(0,e.makeIssue)({issueData:s,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===r.default?void 0:r.default].filter((e=>!!e))});t.common.issues.push(a)};var i=require_errors4(),r=t(require_en2());e.makeIssue=e=>{const{data:t,path:i,errorMaps:r,issueData:s}=e,n=[...i,...s.path||[]],a={...s,path:n};if(void 0!==s.message)return{...s,path:n,message:s.message};let o="";const c=r.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(a,{data:t,defaultError:o}).message;return{...s,path:n,message:o}},e.EMPTY_PATH=[];e.ParseStatus=class t{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,i){const r=[];for(const s of i){if("aborted"===s.status)return e.INVALID;"dirty"===s.status&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(e,i){const r=[];for(const e of i){const t=await e.key,i=await e.value;r.push({key:t,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(t,i){const r={};for(const s of i){const{key:i,value:n}=s;if("aborted"===i.status)return e.INVALID;if("aborted"===n.status)return e.INVALID;"dirty"===i.status&&t.dirty(),"dirty"===n.status&&t.dirty(),"__proto__"===i.value||void 0===n.value&&!s.alwaysSet||(r[i.value]=n.value)}return{status:t.value,value:r}}},e.INVALID=Object.freeze({status:"aborted"});e.DIRTY=e=>({status:"dirty",value:e});e.OK=e=>({status:"valid",value:e});e.isAborted=e=>"aborted"===e.status;e.isDirty=e=>"dirty"===e.status;e.isValid=e=>"valid"===e.status;e.isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise}}),require_typeAliases2=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/helpers/typeAliases.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})}}),require_errorUtil2=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/helpers/errorUtil.js"(e){"use strict";var t,i;Object.defineProperty(e,"__esModule",{value:!0}),e.errorUtil=void 0,(i=t||(e.errorUtil=t={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},i.toString=e=>"string"==typeof e?e:e?.message}}),require_types8=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/types.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.discriminatedUnion=e.date=e.boolean=e.bigint=e.array=e.any=e.coerce=e.ZodFirstPartyTypeKind=e.late=e.ZodSchema=e.Schema=e.ZodReadonly=e.ZodPipeline=e.ZodBranded=e.BRAND=e.ZodNaN=e.ZodCatch=e.ZodDefault=e.ZodNullable=e.ZodOptional=e.ZodTransformer=e.ZodEffects=e.ZodPromise=e.ZodNativeEnum=e.ZodEnum=e.ZodLiteral=e.ZodLazy=e.ZodFunction=e.ZodSet=e.ZodMap=e.ZodRecord=e.ZodTuple=e.ZodIntersection=e.ZodDiscriminatedUnion=e.ZodUnion=e.ZodObject=e.ZodArray=e.ZodVoid=e.ZodNever=e.ZodUnknown=e.ZodAny=e.ZodNull=e.ZodUndefined=e.ZodSymbol=e.ZodDate=e.ZodBoolean=e.ZodBigInt=e.ZodNumber=e.ZodString=e.ZodType=void 0,e.NEVER=e.void=e.unknown=e.union=e.undefined=e.tuple=e.transformer=e.symbol=e.string=e.strictObject=e.set=e.record=e.promise=e.preprocess=e.pipeline=e.ostring=e.optional=e.onumber=e.oboolean=e.object=e.number=e.nullable=e.null=e.never=e.nativeEnum=e.nan=e.map=e.literal=e.lazy=e.intersection=e.instanceof=e.function=e.enum=e.effect=void 0,e.datetimeRegex=P,e.custom=xe;var t=require_ZodError2(),i=require_errors4(),r=require_errorUtil2(),s=require_parseUtil2(),n=require_util6(),a=class{constructor(e,t,i,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},o=(e,i)=>{if((0,s.isValid)(i))return{success:!0,data:i.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new t.ZodError(e.common.issues);return this._error=i,this._error}}};function c(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:r,description:s}=e;if(t&&(i||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{const{message:n}=e;return"invalid_enum_value"===t.code?{message:n??s.defaultError}:void 0===s.data?{message:n??r??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:n??i??s.defaultError}},description:s}}var l=class{get description(){return this._def.description}_getType(e){return(0,n.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,n.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new s.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,n.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,s.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,n.getParsedType)(e)},r=this._parseSync({data:e,path:i.path,parent:i});return o(i,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,n.getParsedType)(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return(0,s.isValid)(i)?{value:i.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>(0,s.isValid)(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,n.getParsedType)(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await((0,s.isAsync)(r)?r:Promise.resolve(r));return o(i,a)}refine(e,i){const r=e=>"string"==typeof i||void 0===i?{message:i}:"function"==typeof i?i(e):i;return this._refinement(((i,s)=>{const n=e(i),a=()=>s.addIssue({code:t.ZodIssueCode.custom,...r(i)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(a(),!1))):!!n||(a(),!1)}))}refinement(e,t){return this._refinement(((i,r)=>!!e(i)||(r.addIssue("function"==typeof t?t(i,r):t),!1)))}_refinement(e){return new le({schema:this,typeName:_e.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ue.create(this,this._def)}nullable(){return de.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this)}promise(){return ce.create(this,this._def)}or(e){return W.create([this,e],this._def)}and(e){return Y.create(this,e,this._def)}transform(e){return new le({...c(this._def),schema:this,typeName:_e.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new pe({...c(this._def),innerType:this,defaultValue:t,typeName:_e.ZodDefault})}brand(){return new fe({typeName:_e.ZodBranded,type:this,...c(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new he({...c(this._def),innerType:this,catchValue:t,typeName:_e.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};e.ZodType=l,e.Schema=l,e.ZodSchema=l;var u,d=/^c[^\s-]{8,}$/i,p=/^[0-9a-z]+$/,h=/^[0-9A-HJKMNP-TV-Z]{26}$/i,m=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,f=/^[a-z0-9_-]{21}$/i,g=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,y=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,b=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,v=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,x=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,S=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,w=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,E=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,C="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",A=new RegExp(`^${C}$`);function T(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function P(e){let t=`${C}T${T(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function I(e,t){if(!g.test(e))return!1;try{const[i]=e.split("."),r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),s=JSON.parse(atob(r));return"object"==typeof s&&null!==s&&((!("typ"in s)||"JWT"===s?.typ)&&(!!s.alg&&(!t||s.alg===t)))}catch{return!1}}function k(e,t){return!("v4"!==t&&t||!v.test(e))||!("v6"!==t&&t||!S.test(e))}var R=class e extends l{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==n.ZodParsedType.string){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.string,received:i.parsedType}),s.INVALID}const i=new s.ParseStatus;let r;for(const c of this._def.checks)if("min"===c.kind)e.data.length<c.value&&(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if("max"===c.kind)e.data.length>c.value&&(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if("length"===c.kind){const n=e.data.length>c.value,a=e.data.length<c.value;(n||a)&&(r=this._getOrReturnCtx(e,r),n?(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):a&&(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),i.dirty())}else if("email"===c.kind)y.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"email",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("emoji"===c.kind)u||(u=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),u.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"emoji",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("uuid"===c.kind)m.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"uuid",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("nanoid"===c.kind)f.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"nanoid",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("cuid"===c.kind)d.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"cuid",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("cuid2"===c.kind)p.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"cuid2",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("ulid"===c.kind)h.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"ulid",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty());else if("url"===c.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"url",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty()}else if("regex"===c.kind){c.regex.lastIndex=0;c.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"regex",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty())}else if("trim"===c.kind)e.data=e.data.trim();else if("includes"===c.kind)e.data.includes(c.value,c.position)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),i.dirty());else if("toLowerCase"===c.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===c.kind)e.data=e.data.toUpperCase();else if("startsWith"===c.kind)e.data.startsWith(c.value)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{startsWith:c.value},message:c.message}),i.dirty());else if("endsWith"===c.kind)e.data.endsWith(c.value)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{endsWith:c.value},message:c.message}),i.dirty());else if("datetime"===c.kind){P(c).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:"datetime",message:c.message}),i.dirty())}else if("date"===c.kind){A.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:"date",message:c.message}),i.dirty())}else if("time"===c.kind){new RegExp(`^${T(c)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:"time",message:c.message}),i.dirty())}else"duration"===c.kind?_.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"duration",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty()):"ip"===c.kind?(a=e.data,("v4"!==(o=c.version)&&o||!b.test(a))&&("v6"!==o&&o||!x.test(a))&&(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"ip",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty())):"jwt"===c.kind?I(e.data,c.alg)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"jwt",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty()):"cidr"===c.kind?k(e.data,c.version)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"cidr",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty()):"base64"===c.kind?w.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"base64",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty()):"base64url"===c.kind?E.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{validation:"base64url",code:t.ZodIssueCode.invalid_string,message:c.message}),i.dirty()):n.util.assertNever(c);var a,o;return{status:i.value,value:e.data}}_regex(e,i,s){return this.refinement((t=>e.test(t)),{validation:i,code:t.ZodIssueCode.invalid_string,...r.errorUtil.errToObj(s)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...r.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...r.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...r.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...r.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...r.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...r.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...r.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...r.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...r.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...r.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...r.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...r.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...r.errorUtil.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...r.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...r.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...r.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...r.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...r.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...r.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...r.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...r.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...r.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...r.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,r.errorUtil.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function F(e,t){const i=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=i>r?i:r;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}e.ZodString=R,R.create=e=>new R({checks:[],typeName:_e.ZodString,coerce:e?.coerce??!1,...c(e)});var B=class e extends l{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==n.ZodParsedType.number){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.number,received:i.parsedType}),s.INVALID}let i;const r=new s.ParseStatus;for(const a of this._def.checks)if("int"===a.kind)n.util.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else"multipleOf"===a.kind?0!==F(e.data,a.value)&&(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.not_finite,message:a.message}),r.dirty()):n.util.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,r.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,r.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,r.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,r.errorUtil.toString(t))}setLimit(t,i,s,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:s,message:r.errorUtil.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:r.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:r.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:r.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:r.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:r.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:r.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&n.util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}};e.ZodNumber=B,B.create=e=>new B({checks:[],typeName:_e.ZodNumber,coerce:e?.coerce||!1,...c(e)});var O=class e extends l{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==n.ZodParsedType.bigint)return this._getInvalidInput(e);let i;const r=new s.ParseStatus;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):n.util.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.bigint,received:i.parsedType}),s.INVALID}gte(e,t){return this.setLimit("min",e,!0,r.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,r.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,r.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,r.errorUtil.toString(t))}setLimit(t,i,s,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:s,message:r.errorUtil.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:r.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:r.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};e.ZodBigInt=O,O.create=e=>new O({checks:[],typeName:_e.ZodBigInt,coerce:e?.coerce??!1,...c(e)});var N=class extends l{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==n.ZodParsedType.boolean){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.boolean,received:i.parsedType}),s.INVALID}return(0,s.OK)(e.data)}};e.ZodBoolean=N,N.create=e=>new N({typeName:_e.ZodBoolean,coerce:e?.coerce||!1,...c(e)});var D=class e extends l{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==n.ZodParsedType.date){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.date,received:i.parsedType}),s.INVALID}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_date}),s.INVALID}const i=new s.ParseStatus;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):n.util.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:r.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:r.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};e.ZodDate=D,D.create=e=>new D({checks:[],coerce:e?.coerce||!1,typeName:_e.ZodDate,...c(e)});var j=class extends l{_parse(e){if(this._getType(e)!==n.ZodParsedType.symbol){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.symbol,received:i.parsedType}),s.INVALID}return(0,s.OK)(e.data)}};e.ZodSymbol=j,j.create=e=>new j({typeName:_e.ZodSymbol,...c(e)});var L=class extends l{_parse(e){if(this._getType(e)!==n.ZodParsedType.undefined){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.undefined,received:i.parsedType}),s.INVALID}return(0,s.OK)(e.data)}};e.ZodUndefined=L,L.create=e=>new L({typeName:_e.ZodUndefined,...c(e)});var U=class extends l{_parse(e){if(this._getType(e)!==n.ZodParsedType.null){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.null,received:i.parsedType}),s.INVALID}return(0,s.OK)(e.data)}};e.ZodNull=U,U.create=e=>new U({typeName:_e.ZodNull,...c(e)});var M=class extends l{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,s.OK)(e.data)}};e.ZodAny=M,M.create=e=>new M({typeName:_e.ZodAny,...c(e)});var q=class extends l{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,s.OK)(e.data)}};e.ZodUnknown=q,q.create=e=>new q({typeName:_e.ZodUnknown,...c(e)});var H=class extends l{_parse(e){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.never,received:i.parsedType}),s.INVALID}};e.ZodNever=H,H.create=e=>new H({typeName:_e.ZodNever,...c(e)});var z=class extends l{_parse(e){if(this._getType(e)!==n.ZodParsedType.undefined){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.void,received:i.parsedType}),s.INVALID}return(0,s.OK)(e.data)}};e.ZodVoid=z,z.create=e=>new z({typeName:_e.ZodVoid,...c(e)});var V=class e extends l{_parse(e){const{ctx:i,status:r}=this._processInputParams(e),o=this._def;if(i.parsedType!==n.ZodParsedType.array)return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.array,received:i.parsedType}),s.INVALID;if(null!==o.exactLength){const e=i.data.length>o.exactLength.value,n=i.data.length<o.exactLength.value;(e||n)&&((0,s.addIssueToContext)(i,{code:e?t.ZodIssueCode.too_big:t.ZodIssueCode.too_small,minimum:n?o.exactLength.value:void 0,maximum:e?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(null!==o.minLength&&i.data.length<o.minLength.value&&((0,s.addIssueToContext)(i,{code:t.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),null!==o.maxLength&&i.data.length>o.maxLength.value&&((0,s.addIssueToContext)(i,{code:t.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),i.common.async)return Promise.all([...i.data].map(((e,t)=>o.type._parseAsync(new a(i,e,i.path,t))))).then((e=>s.ParseStatus.mergeArray(r,e)));const c=[...i.data].map(((e,t)=>o.type._parseSync(new a(i,e,i.path,t))));return s.ParseStatus.mergeArray(r,c)}get element(){return this._def.type}min(t,i){return new e({...this._def,minLength:{value:t,message:r.errorUtil.toString(i)}})}max(t,i){return new e({...this._def,maxLength:{value:t,message:r.errorUtil.toString(i)}})}length(t,i){return new e({...this._def,exactLength:{value:t,message:r.errorUtil.toString(i)}})}nonempty(e){return this.min(1,e)}};function K(e){if(e instanceof G){const t={};for(const i in e.shape){const r=e.shape[i];t[i]=ue.create(K(r))}return new G({...e._def,shape:()=>t})}return e instanceof V?new V({...e._def,type:K(e.element)}):e instanceof ue?ue.create(K(e.unwrap())):e instanceof de?de.create(K(e.unwrap())):e instanceof X?X.create(e.items.map((e=>K(e)))):e}e.ZodArray=V,V.create=(e,t)=>new V({type:e,minLength:null,maxLength:null,exactLength:null,typeName:_e.ZodArray,...c(t)});var G=class e extends l{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=n.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==n.ZodParsedType.object){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.object,received:i.parsedType}),s.INVALID}const{status:i,ctx:r}=this._processInputParams(e),{shape:o,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof H&&"strip"===this._def.unknownKeys))for(const e in r.data)c.includes(e)||l.push(e);const u=[];for(const e of c){const t=o[e],i=r.data[e];u.push({key:{status:"valid",value:e},value:t._parse(new a(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof H){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of l)u.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)l.length>0&&((0,s.addIssueToContext)(r,{code:t.ZodIssueCode.unrecognized_keys,keys:l}),i.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of l){const i=r.data[t];u.push({key:{status:"valid",value:t},value:e._parse(new a(r,i,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of u){const i=await t.key,r=await t.value;e.push({key:i,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>s.ParseStatus.mergeObjectSync(i,e))):s.ParseStatus.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(t){return r.errorUtil.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,i)=>{const s=this._def.errorMap?.(e,i).message??i.defaultError;return"unrecognized_keys"===e.code?{message:r.errorUtil.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:_e.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const i={};for(const e of n.util.objectKeys(t))t[e]&&this.shape[e]&&(i[e]=this.shape[e]);return new e({...this._def,shape:()=>i})}omit(t){const i={};for(const e of n.util.objectKeys(this.shape))t[e]||(i[e]=this.shape[e]);return new e({...this._def,shape:()=>i})}deepPartial(){return K(this)}partial(t){const i={};for(const e of n.util.objectKeys(this.shape)){const r=this.shape[e];t&&!t[e]?i[e]=r:i[e]=r.optional()}return new e({...this._def,shape:()=>i})}required(t){const i={};for(const e of n.util.objectKeys(this.shape))if(t&&!t[e])i[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ue;)t=t._def.innerType;i[e]=t}return new e({...this._def,shape:()=>i})}keyof(){return ne(n.util.objectKeys(this.shape))}};e.ZodObject=G,G.create=(e,t)=>new G({shape:()=>e,unknownKeys:"strip",catchall:H.create(),typeName:_e.ZodObject,...c(t)}),G.strictCreate=(e,t)=>new G({shape:()=>e,unknownKeys:"strict",catchall:H.create(),typeName:_e.ZodObject,...c(t)}),G.lazycreate=(e,t)=>new G({shape:e,unknownKeys:"strip",catchall:H.create(),typeName:_e.ZodObject,...c(t)});var W=class extends l{_parse(e){const{ctx:i}=this._processInputParams(e),r=this._def.options;if(i.common.async)return Promise.all(r.map((async e=>{const t={...i,common:{...i.common,issues:[]},parent:null};return{result:await e._parseAsync({data:i.data,path:i.path,parent:t}),ctx:t}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const t of e)if("dirty"===t.result.status)return i.common.issues.push(...t.ctx.common.issues),t.result;const r=e.map((e=>new t.ZodError(e.ctx.common.issues)));return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_union,unionErrors:r}),s.INVALID}));{let e;const n=[];for(const t of r){const r={...i,common:{...i.common,issues:[]},parent:null},s=t._parseSync({data:i.data,path:i.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return i.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new t.ZodError(e)));return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_union,unionErrors:a}),s.INVALID}}get options(){return this._def.options}};e.ZodUnion=W,W.create=(e,t)=>new W({options:e,typeName:_e.ZodUnion,...c(t)});var J=e=>e instanceof re?J(e.schema):e instanceof le?J(e.innerType()):e instanceof se?[e.value]:e instanceof ae?e.options:e instanceof oe?n.util.objectValues(e.enum):e instanceof pe?J(e._def.innerType):e instanceof L?[void 0]:e instanceof U?[null]:e instanceof ue?[void 0,...J(e.unwrap())]:e instanceof de?[null,...J(e.unwrap())]:e instanceof fe||e instanceof be?J(e.unwrap()):e instanceof he?J(e._def.innerType):[],$=class e extends l{_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==n.ZodParsedType.object)return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.object,received:i.parsedType}),s.INVALID;const r=this.discriminator,a=i.data[r],o=this.optionsMap.get(a);return o?i.common.async?o._parseAsync({data:i.data,path:i.path,parent:i}):o._parseSync({data:i.data,path:i.path,parent:i}):((0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),s.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,i,r){const s=new Map;for(const e of i){const i=J(e.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const r of i){if(s.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);s.set(r,e)}}return new e({typeName:_e.ZodDiscriminatedUnion,discriminator:t,options:i,optionsMap:s,...c(r)})}};function Z(e,t){const i=(0,n.getParsedType)(e),r=(0,n.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(i===n.ZodParsedType.object&&r===n.ZodParsedType.object){const i=n.util.objectKeys(t),r=n.util.objectKeys(e).filter((e=>-1!==i.indexOf(e))),s={...e,...t};for(const i of r){const r=Z(e[i],t[i]);if(!r.valid)return{valid:!1};s[i]=r.data}return{valid:!0,data:s}}if(i===n.ZodParsedType.array&&r===n.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let r=0;r<e.length;r++){const s=Z(e[r],t[r]);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}return i===n.ZodParsedType.date&&r===n.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}e.ZodDiscriminatedUnion=$;var Y=class extends l{_parse(e){const{status:i,ctx:r}=this._processInputParams(e),n=(e,n)=>{if((0,s.isAborted)(e)||(0,s.isAborted)(n))return s.INVALID;const a=Z(e.value,n.value);return a.valid?(((0,s.isDirty)(e)||(0,s.isDirty)(n))&&i.dirty(),{status:i.value,value:a.data}):((0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_intersection_types}),s.INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};e.ZodIntersection=Y,Y.create=(e,t,i)=>new Y({left:e,right:t,typeName:_e.ZodIntersection,...c(i)});var X=class e extends l{_parse(e){const{status:i,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.ZodParsedType.array)return(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.array,received:r.parsedType}),s.INVALID;if(r.data.length<this._def.items.length)return(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.INVALID;!this._def.rest&&r.data.length>this._def.items.length&&((0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const o=[...r.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new a(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(o).then((e=>s.ParseStatus.mergeArray(i,e))):s.ParseStatus.mergeArray(i,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};e.ZodTuple=X,X.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new X({items:e,typeName:_e.ZodTuple,rest:null,...c(t)})};var Q=class e extends l{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.ZodParsedType.object)return(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.object,received:r.parsedType}),s.INVALID;const o=[],c=this._def.keyType,l=this._def.valueType;for(const e in r.data)o.push({key:c._parse(new a(r,e,r.path,e)),value:l._parse(new a(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?s.ParseStatus.mergeObjectAsync(i,o):s.ParseStatus.mergeObjectSync(i,o)}get element(){return this._def.valueType}static create(t,i,r){return new e(i instanceof l?{keyType:t,valueType:i,typeName:_e.ZodRecord,...c(r)}:{keyType:R.create(),valueType:t,typeName:_e.ZodRecord,...c(i)})}};e.ZodRecord=Q;var ee=class extends l{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.ZodParsedType.map)return(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.map,received:r.parsedType}),s.INVALID;const o=this._def.keyType,c=this._def.valueType,l=[...r.data.entries()].map((([e,t],i)=>({key:o._parse(new a(r,e,r.path,[i,"key"])),value:c._parse(new a(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const t of l){const r=await t.key,n=await t.value;if("aborted"===r.status||"aborted"===n.status)return s.INVALID;"dirty"!==r.status&&"dirty"!==n.status||i.dirty(),e.set(r.value,n.value)}return{status:i.value,value:e}}))}{const e=new Map;for(const t of l){const r=t.key,n=t.value;if("aborted"===r.status||"aborted"===n.status)return s.INVALID;"dirty"!==r.status&&"dirty"!==n.status||i.dirty(),e.set(r.value,n.value)}return{status:i.value,value:e}}}};e.ZodMap=ee,ee.create=(e,t,i)=>new ee({valueType:t,keyType:e,typeName:_e.ZodMap,...c(i)});var te=class e extends l{_parse(e){const{status:i,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.ZodParsedType.set)return(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.set,received:r.parsedType}),s.INVALID;const o=this._def;null!==o.minSize&&r.data.size<o.minSize.value&&((0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),i.dirty()),null!==o.maxSize&&r.data.size>o.maxSize.value&&((0,s.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),i.dirty());const c=this._def.valueType;function l(e){const t=new Set;for(const r of e){if("aborted"===r.status)return s.INVALID;"dirty"===r.status&&i.dirty(),t.add(r.value)}return{status:i.value,value:t}}const u=[...r.data.values()].map(((e,t)=>c._parse(new a(r,e,r.path,t))));return r.common.async?Promise.all(u).then((e=>l(e))):l(u)}min(t,i){return new e({...this._def,minSize:{value:t,message:r.errorUtil.toString(i)}})}max(t,i){return new e({...this._def,maxSize:{value:t,message:r.errorUtil.toString(i)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};e.ZodSet=te,te.create=(e,t)=>new te({valueType:e,minSize:null,maxSize:null,typeName:_e.ZodSet,...c(t)});var ie=class e extends l{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==n.ZodParsedType.function)return(0,s.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.function,received:r.parsedType}),s.INVALID;function a(e,n){return(0,s.makeIssue)({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter((e=>!!e)),issueData:{code:t.ZodIssueCode.invalid_arguments,argumentsError:n}})}function o(e,n){return(0,s.makeIssue)({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter((e=>!!e)),issueData:{code:t.ZodIssueCode.invalid_return_type,returnTypeError:n}})}const c={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof ce){const e=this;return(0,s.OK)((async function(...i){const r=new t.ZodError([]),s=await e._def.args.parseAsync(i,c).catch((e=>{throw r.addIssue(a(i,e)),r})),n=await Reflect.apply(l,this,s);return await e._def.returns._def.type.parseAsync(n,c).catch((e=>{throw r.addIssue(o(n,e)),r}))}))}{const e=this;return(0,s.OK)((function(...i){const r=e._def.args.safeParse(i,c);if(!r.success)throw new t.ZodError([a(i,r.error)]);const s=Reflect.apply(l,this,r.data),n=e._def.returns.safeParse(s,c);if(!n.success)throw new t.ZodError([o(s,n.error)]);return n.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:X.create(t).rest(q.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,i,r){return new e({args:t||X.create([]).rest(q.create()),returns:i||q.create(),typeName:_e.ZodFunction,...c(r)})}};e.ZodFunction=ie;var re=class extends l{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};e.ZodLazy=re,re.create=(e,t)=>new re({getter:e,typeName:_e.ZodLazy,...c(t)});var se=class extends l{_parse(e){if(e.data!==this._def.value){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{received:i.data,code:t.ZodIssueCode.invalid_literal,expected:this._def.value}),s.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};function ne(e,t){return new ae({values:e,typeName:_e.ZodEnum,...c(t)})}e.ZodLiteral=se,se.create=(e,t)=>new se({value:e,typeName:_e.ZodLiteral,...c(t)});var ae=class e extends l{_parse(e){if("string"!=typeof e.data){const i=this._getOrReturnCtx(e),r=this._def.values;return(0,s.addIssueToContext)(i,{expected:n.util.joinValues(r),received:i.parsedType,code:t.ZodIssueCode.invalid_type}),s.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const i=this._getOrReturnCtx(e),r=this._def.values;return(0,s.addIssueToContext)(i,{received:i.data,code:t.ZodIssueCode.invalid_enum_value,options:r}),s.INVALID}return(0,s.OK)(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,i=this._def){return e.create(t,{...this._def,...i})}exclude(t,i=this._def){return e.create(this.options.filter((e=>!t.includes(e))),{...this._def,...i})}};e.ZodEnum=ae,ae.create=ne;var oe=class extends l{_parse(e){const i=n.util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==n.ZodParsedType.string&&r.parsedType!==n.ZodParsedType.number){const e=n.util.objectValues(i);return(0,s.addIssueToContext)(r,{expected:n.util.joinValues(e),received:r.parsedType,code:t.ZodIssueCode.invalid_type}),s.INVALID}if(this._cache||(this._cache=new Set(n.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=n.util.objectValues(i);return(0,s.addIssueToContext)(r,{received:r.data,code:t.ZodIssueCode.invalid_enum_value,options:e}),s.INVALID}return(0,s.OK)(e.data)}get enum(){return this._def.values}};e.ZodNativeEnum=oe,oe.create=(e,t)=>new oe({values:e,typeName:_e.ZodNativeEnum,...c(t)});var ce=class extends l{unwrap(){return this._def.type}_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==n.ZodParsedType.promise&&!1===i.common.async)return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.promise,received:i.parsedType}),s.INVALID;const r=i.parsedType===n.ZodParsedType.promise?i.data:Promise.resolve(i.data);return(0,s.OK)(r.then((e=>this._def.type.parseAsync(e,{path:i.path,errorMap:i.common.contextualErrorMap}))))}};e.ZodPromise=ce,ce.create=(e,t)=>new ce({type:e,typeName:_e.ZodPromise,...c(t)});var le=class extends l{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{(0,s.addIssueToContext)(i,e),e.fatal?t.abort():t.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){const e=r.transform(i.data,a);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return s.INVALID;const r=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===r.status?s.INVALID:"dirty"===r.status||"dirty"===t.value?(0,s.DIRTY)(r.value):r}));{if("aborted"===t.value)return s.INVALID;const r=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===r.status?s.INVALID:"dirty"===r.status||"dirty"===t.value?(0,s.DIRTY)(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,a);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const r=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===r.status?s.INVALID:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((i=>"aborted"===i.status?s.INVALID:("dirty"===i.status&&t.dirty(),e(i.value).then((()=>({status:t.value,value:i.value}))))))}if("transform"===r.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!(0,s.isValid)(e))return s.INVALID;const n=r.transform(e.value,a);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>(0,s.isValid)(e)?Promise.resolve(r.transform(e.value,a)).then((e=>({status:t.value,value:e}))):s.INVALID))}n.util.assertNever(r)}};e.ZodEffects=le,e.ZodTransformer=le,le.create=(e,t,i)=>new le({schema:e,typeName:_e.ZodEffects,effect:t,...c(i)}),le.createWithPreprocess=(e,t,i)=>new le({schema:t,effect:{type:"preprocess",transform:e},typeName:_e.ZodEffects,...c(i)});var ue=class extends l{_parse(e){return this._getType(e)===n.ZodParsedType.undefined?(0,s.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodOptional=ue,ue.create=(e,t)=>new ue({innerType:e,typeName:_e.ZodOptional,...c(t)});var de=class extends l{_parse(e){return this._getType(e)===n.ZodParsedType.null?(0,s.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodNullable=de,de.create=(e,t)=>new de({innerType:e,typeName:_e.ZodNullable,...c(t)});var pe=class extends l{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===n.ZodParsedType.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};e.ZodDefault=pe,pe.create=(e,t)=>new pe({innerType:e,typeName:_e.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...c(t)});var he=class extends l{_parse(e){const{ctx:i}=this._processInputParams(e),r={...i,common:{...i.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return(0,s.isAsync)(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new t.ZodError(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new t.ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};e.ZodCatch=he,he.create=(e,t)=>new he({innerType:e,typeName:_e.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...c(t)});var me=class extends l{_parse(e){if(this._getType(e)!==n.ZodParsedType.nan){const i=this._getOrReturnCtx(e);return(0,s.addIssueToContext)(i,{code:t.ZodIssueCode.invalid_type,expected:n.ZodParsedType.nan,received:i.parsedType}),s.INVALID}return{status:"valid",value:e.data}}};e.ZodNaN=me,me.create=e=>new me({typeName:_e.ZodNaN,...c(e)}),e.BRAND=Symbol("zod_brand");var fe=class extends l{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}};e.ZodBranded=fe;var ge=class e extends l{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?s.INVALID:"dirty"===e.status?(t.dirty(),(0,s.DIRTY)(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})()}{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?s.INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(t,i){return new e({in:t,out:i,typeName:_e.ZodPipeline})}};e.ZodPipeline=ge;var _e,ye,be=class extends l{_parse(e){const t=this._def.innerType._parse(e),i=e=>((0,s.isValid)(e)&&(e.value=Object.freeze(e.value)),e);return(0,s.isAsync)(t)?t.then((e=>i(e))):i(t)}unwrap(){return this._def.innerType}};function ve(e,t){const i="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof i?{message:i}:i}function xe(e,t={},i){return e?M.create().superRefine(((r,s)=>{const n=e(r);if(n instanceof Promise)return n.then((e=>{if(!e){const e=ve(t,r),n=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:n})}}));if(!n){const e=ve(t,r),n=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:n})}})):M.create()}e.ZodReadonly=be,be.create=(e,t)=>new be({innerType:e,typeName:_e.ZodReadonly,...c(t)}),e.late={object:G.lazycreate},(ye=_e||(e.ZodFirstPartyTypeKind=_e={})).ZodString="ZodString",ye.ZodNumber="ZodNumber",ye.ZodNaN="ZodNaN",ye.ZodBigInt="ZodBigInt",ye.ZodBoolean="ZodBoolean",ye.ZodDate="ZodDate",ye.ZodSymbol="ZodSymbol",ye.ZodUndefined="ZodUndefined",ye.ZodNull="ZodNull",ye.ZodAny="ZodAny",ye.ZodUnknown="ZodUnknown",ye.ZodNever="ZodNever",ye.ZodVoid="ZodVoid",ye.ZodArray="ZodArray",ye.ZodObject="ZodObject",ye.ZodUnion="ZodUnion",ye.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ye.ZodIntersection="ZodIntersection",ye.ZodTuple="ZodTuple",ye.ZodRecord="ZodRecord",ye.ZodMap="ZodMap",ye.ZodSet="ZodSet",ye.ZodFunction="ZodFunction",ye.ZodLazy="ZodLazy",ye.ZodLiteral="ZodLiteral",ye.ZodEnum="ZodEnum",ye.ZodEffects="ZodEffects",ye.ZodNativeEnum="ZodNativeEnum",ye.ZodOptional="ZodOptional",ye.ZodNullable="ZodNullable",ye.ZodDefault="ZodDefault",ye.ZodCatch="ZodCatch",ye.ZodPromise="ZodPromise",ye.ZodBranded="ZodBranded",ye.ZodPipeline="ZodPipeline",ye.ZodReadonly="ZodReadonly";e.instanceof=(e,t={message:`Input not instance of ${e.name}`})=>xe((t=>t instanceof e),t);var Se=R.create;e.string=Se;var we=B.create;e.number=we;var Ee=me.create;e.nan=Ee;var Ce=O.create;e.bigint=Ce;var Ae=N.create;e.boolean=Ae;var Te=D.create;e.date=Te;var Pe=j.create;e.symbol=Pe;var Ie=L.create;e.undefined=Ie;var ke=U.create;e.null=ke;var Re=M.create;e.any=Re;var Fe=q.create;e.unknown=Fe;var Be=H.create;e.never=Be;var Oe=z.create;e.void=Oe;var Ne=V.create;e.array=Ne;var De=G.create;e.object=De;var je=G.strictCreate;e.strictObject=je;var Le=W.create;e.union=Le;var Ue=$.create;e.discriminatedUnion=Ue;var Me=Y.create;e.intersection=Me;var qe=X.create;e.tuple=qe;var He=Q.create;e.record=He;var ze=ee.create;e.map=ze;var Ve=te.create;e.set=Ve;var Ke=ie.create;e.function=Ke;var Ge=re.create;e.lazy=Ge;var We=se.create;e.literal=We;var Je=ae.create;e.enum=Je;var $e=oe.create;e.nativeEnum=$e;var Ze=ce.create;e.promise=Ze;var Ye=le.create;e.effect=Ye,e.transformer=Ye;var Xe=ue.create;e.optional=Xe;var Qe=de.create;e.nullable=Qe;var et=le.createWithPreprocess;e.preprocess=et;var tt=ge.create;e.pipeline=tt;e.ostring=()=>Se().optional();e.onumber=()=>we().optional();e.oboolean=()=>Ae().optional(),e.coerce={string:e=>R.create({...e,coerce:!0}),number:e=>B.create({...e,coerce:!0}),boolean:e=>N.create({...e,coerce:!0}),bigint:e=>O.create({...e,coerce:!0}),date:e=>D.create({...e,coerce:!0})},e.NEVER=s.INVALID}}),require_external2=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/external.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(require_errors4(),e),i(require_parseUtil2(),e),i(require_typeAliases2(),e),i(require_util6(),e),i(require_types8(),e),i(require_ZodError2(),e)}}),require_v33=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/v3/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&t(r,e,s);return i(r,e),r},s=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;var n=r(require_external2());e.z=n,s(require_external2(),e),e.default=n}}),require_cjs14=__commonJS({"../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/cjs/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var s=r(require_v33());i(require_v33(),e),e.default=s.default}}),require_encoder2=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/encoder.js"(e){"use strict";var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.SkyWayAuthToken=void 0;var i=require_dist(),r=t(require_jsrsasign2()),s=t(require_jwt_decode_cjs2()),n=require_cjs14(),a=require_dist6(),o=new i.Logger("packages/token/src/encoder.ts");e.SkyWayAuthToken=class e{constructor(e){let t;try{t=a.AuthTokenSchema.parse(e)}catch(e){throw n.z.ZodError,new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:new Error("Received invalid token. Please check your SkyWayAuthToken.")})}Object.assign(this,t)}static Decode(t){try{const i=(0,s.default)(t),r=new e(i);return r.tokenString=t,r}catch(e){throw new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:e})}}encode(e){const t={jti:this.jti,iat:this.iat,exp:this.exp,scope:this.scope,version:this.version};return this.tokenString=r.default.KJUR.jws.JWS.sign("HS256",JSON.stringify({alg:"HS256",typ:"JWT"}),JSON.stringify(t),e),this.tokenString}toJSON(){return{jti:this.jti,iat:this.iat,exp:this.exp,scope:this.scope,encoded:this.tokenString,version:this.version}}getAppId(){switch(this.version){case void 0:case 1:case 2:return this.scope.app.id;case 3:return this.scope.appId;default:throw new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:new Error(`invalid token version: version ${this.version} is not supported.`)})}}getAnalyticsEnabled(){var e,t,r;switch(this.version){case void 0:case 1:case 2:return null!==(e=this.scope.app.analytics)&&void 0!==e&&e;case 3:return null===(r=null===(t=this.scope.analytics)||void 0===t?void 0:t.enabled)||void 0===r||r;default:throw new i.SkyWayError({path:o.prefix,info:a.tokenErrors.invalidParameter,error:new Error(`invalid token version: version ${this.version} is not supported.`)})}}}}}),require_sfu2=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/scope/sfu.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sfuScopeSchema=void 0;var t=require_cjs14(),i=t.z.object({actions:t.z.array(t.z.enum(["create","write","delete"]).refine((e=>"string"==typeof e)))}).passthrough();e.sfuScopeSchema=t.z.object({actions:t.z.array(t.z.enum(["create","write","delete"]).refine((e=>"string"==typeof e))),forwardings:t.z.array(i)}).passthrough()}}),require_v1_22=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/scope/v1-2.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.appScopeSchema=e.memberActions=void 0;var t=require_cjs14(),i=require_sfu2(),r=t.z.object({actions:t.z.array(t.z.enum(["write","create","delete","updateMetadata","enable","disable"]).refine((e=>"string"==typeof e)))}).passthrough(),s=t.z.object({actions:t.z.array(t.z.enum(["write","create","delete"]).refine((e=>"string"==typeof e)))}).passthrough();e.memberActions=["write","create","delete","updateMetadata","signal"];var n=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),a=t.z.intersection(n,t.z.object({actions:t.z.array(t.z.enum(e.memberActions).refine((e=>"string"==typeof e))),publication:r.optional(),subscription:s.optional()}).passthrough()),o=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),c=t.z.intersection(o,t.z.object({actions:t.z.array(t.z.enum(["write","read","create","delete","updateMetadata"]).refine((e=>"string"==typeof e))),members:t.z.array(a),sfuBots:t.z.array(i.sfuScopeSchema).optional()}).passthrough());e.appScopeSchema=t.z.object({id:t.z.string(),analytics:t.z.boolean().optional(),actions:t.z.array(t.z.enum(["listChannels","read","write"]).refine((e=>"string"==typeof e))).optional(),channels:t.z.array(c).optional(),turn:t.z.boolean().optional()}).passthrough()}}),require_v34=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/scope/v3.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.scopeV3Schema=void 0;var t=require_cjs14(),i=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),r=t.z.intersection(i,t.z.object({methods:t.z.array(t.z.enum(["publish","subscribe","updateMetadata"]).refine((e=>"string"==typeof e)))}).passthrough()),s=t.z.object({id:t.z.string().optional(),name:t.z.string().optional()}).refine((e=>void 0!==e.id||void 0!==e.name),{message:"Either id or name is required."}),n=t.z.intersection(s,t.z.object({methods:t.z.array(t.z.enum(["create","close","updateMetadata"]).refine((e=>"string"==typeof e))),member:r.optional(),sfu:t.z.object({enabled:t.z.boolean().optional(),maxSubscribersLimit:t.z.number().optional()}).optional()}).passthrough());e.scopeV3Schema=t.z.object({appId:t.z.string(),analytics:t.z.object({enabled:t.z.boolean().optional()}).optional(),noiseCancelling:t.z.object({enabled:t.z.boolean().optional()}).optional(),turn:t.z.object({enabled:t.z.boolean().optional()}).optional(),rooms:t.z.array(n)}).passthrough()}}),require_token2=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/token.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AuthTokenSchema=void 0;var t=require_cjs14(),i=require_v1_22(),r=require_v34(),s=t.z.object({jti:t.z.string().uuid(),iat:t.z.number().nonnegative(),exp:t.z.number().nonnegative()}),n=t.z.intersection(s,t.z.object({scope:t.z.object({app:i.appScopeSchema}),version:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(void 0)]).optional()})),a=t.z.intersection(s,t.z.object({scope:r.scopeV3Schema,version:t.z.literal(3)}));e.AuthTokenSchema=t.z.union([n,a])}}),require_errors5=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenErrors=void 0,e.tokenErrors={invalidParameter:{name:"invalidParameter",detail:"failed to decode token",solution:"Use the correct token according to the specification"},invalidAppIdParameter:{name:"invalidAppIdParameter",detail:"failed to get AppId",solution:"Use the correct token according to the specification"},invalidAnalyticsParameter:{name:"invalidAnalyticsParameter",detail:"failed to get analytics scope",solution:"Use the correct token according to the specification"}}}}),require_util7=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/util.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.nowInSec=void 0;e.nowInSec=()=>Math.floor(Date.now()/1e3)}}),require_dist6=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+token@1.7.4/node_modules/@skyway-sdk/token/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.uuidV4=void 0;var r=(init_esm_node2(),__toCommonJS(esm_node_exports2)).v4;e.uuidV4=r,i(require_encoder2(),e),i(require_sfu2(),e),i(require_v1_22(),e),i(require_v34(),e),i(require_token2(),e),i(require_errors5(),e),i(require_util7(),e)}}),require_listCacheClear=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"(e,t){t.exports=function(){this.__data__=[],this.size=0}}}),require_eq=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js"(e,t){t.exports=function(e,t){return e===t||e!=e&&t!=t}}}),require_assocIndexOf=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js"(e,t){var i=require_eq();t.exports=function(e,t){for(var r=e.length;r--;)if(i(e[r][0],t))return r;return-1}}}),require_listCacheDelete=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"(e,t){var i=require_assocIndexOf(),r=Array.prototype.splice;t.exports=function(e){var t=this.__data__,s=i(t,e);return!(s<0)&&(s==t.length-1?t.pop():r.call(t,s,1),--this.size,!0)}}}),require_listCacheGet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"(e,t){var i=require_assocIndexOf();t.exports=function(e){var t=this.__data__,r=i(t,e);return r<0?void 0:t[r][1]}}}),require_listCacheHas=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"(e,t){var i=require_assocIndexOf();t.exports=function(e){return i(this.__data__,e)>-1}}}),require_listCacheSet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js"(e,t){var i=require_assocIndexOf();t.exports=function(e,t){var r=this.__data__,s=i(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this}}}),require_ListCache=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js"(e,t){var i=require_listCacheClear(),r=require_listCacheDelete(),s=require_listCacheGet(),n=require_listCacheHas(),a=require_listCacheSet();function o(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}o.prototype.clear=i,o.prototype.delete=r,o.prototype.get=s,o.prototype.has=n,o.prototype.set=a,t.exports=o}}),require_stackClear=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js"(e,t){var i=require_ListCache();t.exports=function(){this.__data__=new i,this.size=0}}}),require_stackDelete=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js"(e,t){t.exports=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}}}),require_stackGet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js"(e,t){t.exports=function(e){return this.__data__.get(e)}}}),require_stackHas=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),require_freeGlobal=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js"(e,t){var i="object"==typeof global&&global&&global.Object===Object&&global;t.exports=i}}),require_root=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js"(e,t){var i=require_freeGlobal(),r="object"==typeof self&&self&&self.Object===Object&&self,s=i||r||Function("return this")();t.exports=s}}),require_Symbol=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js"(e,t){var i=require_root().Symbol;t.exports=i}}),require_getRawTag=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js"(e,t){var i=require_Symbol(),r=Object.prototype,s=r.hasOwnProperty,n=r.toString,a=i?i.toStringTag:void 0;t.exports=function(e){var t=s.call(e,a),i=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=n.call(e);return r&&(t?e[a]=i:delete e[a]),o}}}),require_objectToString=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js"(e,t){var i=Object.prototype.toString;t.exports=function(e){return i.call(e)}}}),require_baseGetTag=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js"(e,t){var i=require_Symbol(),r=require_getRawTag(),s=require_objectToString(),n=i?i.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?r(e):s(e)}}}),require_isObject=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js"(e,t){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}}),require_isFunction=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js"(e,t){var i=require_baseGetTag(),r=require_isObject();t.exports=function(e){if(!r(e))return!1;var t=i(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}}}),require_coreJsData=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js"(e,t){var i=require_root()["__core-js_shared__"];t.exports=i}}),require_isMasked=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js"(e,t){var i,r=require_coreJsData(),s=(i=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"";t.exports=function(e){return!!s&&s in e}}}),require_toSource=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js"(e,t){var i=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return i.call(e)}catch(e){}try{return e+""}catch(e){}}return""}}}),require_baseIsNative=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js"(e,t){var i=require_isFunction(),r=require_isMasked(),s=require_isObject(),n=require_toSource(),a=/^\[object .+?Constructor\]$/,o=Function.prototype,c=Object.prototype,l=o.toString,u=c.hasOwnProperty,d=RegExp("^"+l.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!s(e)||r(e))&&(i(e)?d:a).test(n(e))}}}),require_getValue=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),require_getNative=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js"(e,t){var i=require_baseIsNative(),r=require_getValue();t.exports=function(e,t){var s=r(e,t);return i(s)?s:void 0}}}),require_Map=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js"(e,t){var i=require_getNative()(require_root(),"Map");t.exports=i}}),require_nativeCreate=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js"(e,t){var i=require_getNative()(Object,"create");t.exports=i}}),require_hashClear=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js"(e,t){var i=require_nativeCreate();t.exports=function(){this.__data__=i?i(null):{},this.size=0}}}),require_hashDelete=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js"(e,t){t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}}),require_hashGet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js"(e,t){var i=require_nativeCreate(),r=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(i){var s=t[e];return"__lodash_hash_undefined__"===s?void 0:s}return r.call(t,e)?t[e]:void 0}}}),require_hashHas=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js"(e,t){var i=require_nativeCreate(),r=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return i?void 0!==t[e]:r.call(t,e)}}}),require_hashSet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js"(e,t){var i=require_nativeCreate();t.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=i&&void 0===t?"__lodash_hash_undefined__":t,this}}}),require_Hash=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js"(e,t){var i=require_hashClear(),r=require_hashDelete(),s=require_hashGet(),n=require_hashHas(),a=require_hashSet();function o(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}o.prototype.clear=i,o.prototype.delete=r,o.prototype.get=s,o.prototype.has=n,o.prototype.set=a,t.exports=o}}),require_mapCacheClear=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js"(e,t){var i=require_Hash(),r=require_ListCache(),s=require_Map();t.exports=function(){this.size=0,this.__data__={hash:new i,map:new(s||r),string:new i}}}}),require_isKeyable=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js"(e,t){t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}}),require_getMapData=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js"(e,t){var i=require_isKeyable();t.exports=function(e,t){var r=e.__data__;return i(t)?r["string"==typeof t?"string":"hash"]:r.map}}}),require_mapCacheDelete=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js"(e,t){var i=require_getMapData();t.exports=function(e){var t=i(this,e).delete(e);return this.size-=t?1:0,t}}}),require_mapCacheGet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js"(e,t){var i=require_getMapData();t.exports=function(e){return i(this,e).get(e)}}}),require_mapCacheHas=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js"(e,t){var i=require_getMapData();t.exports=function(e){return i(this,e).has(e)}}}),require_mapCacheSet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js"(e,t){var i=require_getMapData();t.exports=function(e,t){var r=i(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this}}}),require_MapCache=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js"(e,t){var i=require_mapCacheClear(),r=require_mapCacheDelete(),s=require_mapCacheGet(),n=require_mapCacheHas(),a=require_mapCacheSet();function o(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}o.prototype.clear=i,o.prototype.delete=r,o.prototype.get=s,o.prototype.has=n,o.prototype.set=a,t.exports=o}}),require_stackSet=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js"(e,t){var i=require_ListCache(),r=require_Map(),s=require_MapCache();t.exports=function(e,t){var n=this.__data__;if(n instanceof i){var a=n.__data__;if(!r||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new s(a)}return n.set(e,t),this.size=n.size,this}}}),require_Stack=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"(e,t){var i=require_ListCache(),r=require_stackClear(),s=require_stackDelete(),n=require_stackGet(),a=require_stackHas(),o=require_stackSet();function c(e){var t=this.__data__=new i(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=s,c.prototype.get=n,c.prototype.has=a,c.prototype.set=o,t.exports=c}}),require_setCacheAdd=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js"(e,t){t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}}}),require_setCacheHas=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),require_SetCache=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js"(e,t){var i=require_MapCache(),r=require_setCacheAdd(),s=require_setCacheHas();function n(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new i;++t<r;)this.add(e[t])}n.prototype.add=n.prototype.push=r,n.prototype.has=s,t.exports=n}}),require_arraySome=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1}}}),require_cacheHas=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cacheHas.js"(e,t){t.exports=function(e,t){return e.has(t)}}}),require_equalArrays=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalArrays.js"(e,t){var i=require_SetCache(),r=require_arraySome(),s=require_cacheHas();t.exports=function(e,t,n,a,o,c){var l=1&n,u=e.length,d=t.length;if(u!=d&&!(l&&d>u))return!1;var p=c.get(e),h=c.get(t);if(p&&h)return p==t&&h==e;var m=-1,f=!0,g=2&n?new i:void 0;for(c.set(e,t),c.set(t,e);++m<u;){var _=e[m],y=t[m];if(a)var b=l?a(y,_,m,t,e,c):a(_,y,m,e,t,c);if(void 0!==b){if(b)continue;f=!1;break}if(g){if(!r(t,(function(e,t){if(!s(g,t)&&(_===e||o(_,e,n,a,c)))return g.push(t)}))){f=!1;break}}else if(_!==y&&!o(_,y,n,a,c)){f=!1;break}}return c.delete(e),c.delete(t),f}}}),require_Uint8Array=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js"(e,t){var i=require_root().Uint8Array;t.exports=i}}),require_mapToArray=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js"(e,t){t.exports=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}}}),require_setToArray=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToArray.js"(e,t){t.exports=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}}}),require_equalByTag=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalByTag.js"(e,t){var i=require_Symbol(),r=require_Uint8Array(),s=require_eq(),n=require_equalArrays(),a=require_mapToArray(),o=require_setToArray(),c=i?i.prototype:void 0,l=c?c.valueOf:void 0;t.exports=function(e,t,i,c,u,d,p){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new r(e),new r(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return s(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=a;case"[object Set]":var m=1&c;if(h||(h=o),e.size!=t.size&&!m)return!1;var f=p.get(e);if(f)return f==t;c|=2,p.set(e,t);var g=n(h(e),h(t),c,u,d,p);return p.delete(e),g;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}}}),require_arrayPush=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js"(e,t){t.exports=function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}}}),require_isArray=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"(e,t){var i=Array.isArray;t.exports=i}}),require_baseGetAllKeys=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetAllKeys.js"(e,t){var i=require_arrayPush(),r=require_isArray();t.exports=function(e,t,s){var n=t(e);return r(e)?n:i(n,s(e))}}}),require_arrayFilter=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var i=-1,r=null==e?0:e.length,s=0,n=[];++i<r;){var a=e[i];t(a,i,e)&&(n[s++]=a)}return n}}}),require_stubArray=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubArray.js"(e,t){t.exports=function(){return[]}}}),require_getSymbols=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getSymbols.js"(e,t){var i=require_arrayFilter(),r=require_stubArray(),s=Object.prototype.propertyIsEnumerable,n=Object.getOwnPropertySymbols,a=n?function(e){return null==e?[]:(e=Object(e),i(n(e),(function(t){return s.call(e,t)})))}:r;t.exports=a}}),require_baseTimes=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}}}),require_isObjectLike=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js"(e,t){t.exports=function(e){return null!=e&&"object"==typeof e}}}),require_baseIsArguments=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js"(e,t){var i=require_baseGetTag(),r=require_isObjectLike();t.exports=function(e){return r(e)&&"[object Arguments]"==i(e)}}}),require_isArguments=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js"(e,t){var i=require_baseIsArguments(),r=require_isObjectLike(),s=Object.prototype,n=s.hasOwnProperty,a=s.propertyIsEnumerable,o=i(function(){return arguments}())?i:function(e){return r(e)&&n.call(e,"callee")&&!a.call(e,"callee")};t.exports=o}}),require_stubFalse=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js"(e,t){t.exports=function(){return!1}}}),require_isBuffer=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isBuffer.js"(e,t){var i=require_root(),r=require_stubFalse(),s="object"==typeof e&&e&&!e.nodeType&&e,n=s&&"object"==typeof t&&t&&!t.nodeType&&t,a=n&&n.exports===s?i.Buffer:void 0,o=(a?a.isBuffer:void 0)||r;t.exports=o}}),require_isIndex=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js"(e,t){var i=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&i.test(e))&&e>-1&&e%1==0&&e<t}}}),require_isLength=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"(e,t){t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}}),require_baseIsTypedArray=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsTypedArray.js"(e,t){var i=require_baseGetTag(),r=require_isLength(),s=require_isObjectLike(),n={};n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,t.exports=function(e){return s(e)&&r(e.length)&&!!n[i(e)]}}}),require_baseUnary=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUnary.js"(e,t){t.exports=function(e){return function(t){return e(t)}}}}),require_nodeUtil=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nodeUtil.js"(e,t){var i=require_freeGlobal(),r="object"==typeof e&&e&&!e.nodeType&&e,s=r&&"object"==typeof t&&t&&!t.nodeType&&t,n=s&&s.exports===r&&i.process,a=function(){try{var e=s&&s.require&&s.require("util").types;return e||n&&n.binding&&n.binding("util")}catch(e){}}();t.exports=a}}),require_isTypedArray=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isTypedArray.js"(e,t){var i=require_baseIsTypedArray(),r=require_baseUnary(),s=require_nodeUtil(),n=s&&s.isTypedArray,a=n?r(n):i;t.exports=a}}),require_arrayLikeKeys=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js"(e,t){var i=require_baseTimes(),r=require_isArguments(),s=require_isArray(),n=require_isBuffer(),a=require_isIndex(),o=require_isTypedArray(),c=Object.prototype.hasOwnProperty;t.exports=function(e,t){var l=s(e),u=!l&&r(e),d=!l&&!u&&n(e),p=!l&&!u&&!d&&o(e),h=l||u||d||p,m=h?i(e.length,String):[],f=m.length;for(var g in e)!t&&!c.call(e,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,f))||m.push(g);return m}}}),require_isPrototype=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js"(e,t){var i=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||i)}}}),require_overArg=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js"(e,t){t.exports=function(e,t){return function(i){return e(t(i))}}}}),require_nativeKeys=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeys.js"(e,t){var i=require_overArg()(Object.keys,Object);t.exports=i}}),require_baseKeys=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeys.js"(e,t){var i=require_isPrototype(),r=require_nativeKeys(),s=Object.prototype.hasOwnProperty;t.exports=function(e){if(!i(e))return r(e);var t=[];for(var n in Object(e))s.call(e,n)&&"constructor"!=n&&t.push(n);return t}}}),require_isArrayLike=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js"(e,t){var i=require_isFunction(),r=require_isLength();t.exports=function(e){return null!=e&&r(e.length)&&!i(e)}}}),require_keys=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js"(e,t){var i=require_arrayLikeKeys(),r=require_baseKeys(),s=require_isArrayLike();t.exports=function(e){return s(e)?i(e):r(e)}}}),require_getAllKeys=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getAllKeys.js"(e,t){var i=require_baseGetAllKeys(),r=require_getSymbols(),s=require_keys();t.exports=function(e){return i(e,s,r)}}}),require_equalObjects=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalObjects.js"(e,t){var i=require_getAllKeys(),r=Object.prototype.hasOwnProperty;t.exports=function(e,t,s,n,a,o){var c=1&s,l=i(e),u=l.length;if(u!=i(t).length&&!c)return!1;for(var d=u;d--;){var p=l[d];if(!(c?p in t:r.call(t,p)))return!1}var h=o.get(e),m=o.get(t);if(h&&m)return h==t&&m==e;var f=!0;o.set(e,t),o.set(t,e);for(var g=c;++d<u;){var _=e[p=l[d]],y=t[p];if(n)var b=c?n(y,_,p,t,e,o):n(_,y,p,e,t,o);if(!(void 0===b?_===y||a(_,y,s,n,o):b)){f=!1;break}g||(g="constructor"==p)}if(f&&!g){var v=e.constructor,x=t.constructor;v==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof x&&x instanceof x||(f=!1)}return o.delete(e),o.delete(t),f}}}),require_DataView=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_DataView.js"(e,t){var i=require_getNative()(require_root(),"DataView");t.exports=i}}),require_Promise=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Promise.js"(e,t){var i=require_getNative()(require_root(),"Promise");t.exports=i}}),require_Set=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Set.js"(e,t){var i=require_getNative()(require_root(),"Set");t.exports=i}}),require_WeakMap=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_WeakMap.js"(e,t){var i=require_getNative()(require_root(),"WeakMap");t.exports=i}}),require_getTag=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getTag.js"(e,t){var i=require_DataView(),r=require_Map(),s=require_Promise(),n=require_Set(),a=require_WeakMap(),o=require_baseGetTag(),c=require_toSource(),l="[object Map]",u="[object Promise]",d="[object Set]",p="[object WeakMap]",h="[object DataView]",m=c(i),f=c(r),g=c(s),_=c(n),y=c(a),b=o;(i&&b(new i(new ArrayBuffer(1)))!=h||r&&b(new r)!=l||s&&b(s.resolve())!=u||n&&b(new n)!=d||a&&b(new a)!=p)&&(b=function(e){var t=o(e),i="[object Object]"==t?e.constructor:void 0,r=i?c(i):"";if(r)switch(r){case m:return h;case f:return l;case g:return u;case _:return d;case y:return p}return t}),t.exports=b}}),require_baseIsEqualDeep=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js"(e,t){var i=require_Stack(),r=require_equalArrays(),s=require_equalByTag(),n=require_equalObjects(),a=require_getTag(),o=require_isArray(),c=require_isBuffer(),l=require_isTypedArray(),u="[object Arguments]",d="[object Array]",p="[object Object]",h=Object.prototype.hasOwnProperty;t.exports=function(e,t,m,f,g,_){var y=o(e),b=o(t),v=y?d:a(e),x=b?d:a(t),S=(v=v==u?p:v)==p,w=(x=x==u?p:x)==p,E=v==x;if(E&&c(e)){if(!c(t))return!1;y=!0,S=!1}if(E&&!S)return _||(_=new i),y||l(e)?r(e,t,m,f,g,_):s(e,t,v,m,f,g,_);if(!(1&m)){var C=S&&h.call(e,"__wrapped__"),A=w&&h.call(t,"__wrapped__");if(C||A){var T=C?e.value():e,P=A?t.value():t;return _||(_=new i),g(T,P,m,f,_)}}return!!E&&(_||(_=new i),n(e,t,m,f,g,_))}}}),require_baseIsEqual=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js"(e,t){var i=require_baseIsEqualDeep(),r=require_isObjectLike();t.exports=function e(t,s,n,a,o){return t===s||(null==t||null==s||!r(t)&&!r(s)?t!=t&&s!=s:i(t,s,n,a,e,o))}}}),require_isEqual=__commonJS({"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isEqual.js"(e,t){var i=require_baseIsEqual();t.exports=function(e,t){return i(e,t)}}}),require_clientEvent2=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/clientEvent.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClientEvent=void 0;var t=(init_esm_node2(),__toCommonJS(esm_node_exports2));e.ClientEvent=class{constructor(e,i){this.id=(0,t.v4)(),this.type=e,this.payload=i}toJSON(){return{id:this.id,type:this.type,payload:this.payload}}}}}),require_payloadTypes2=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/payloadTypes.js"(e){"use strict";function t(e){return"object"==typeof e&&(null!==e&&!Array.isArray(e))}Object.defineProperty(e,"__esModule",{value:!0}),e.isAcknowledgePayload=e.isOpenServerEventPayload=e.isRecord=void 0,e.isRecord=t,e.isOpenServerEventPayload=function(e){if(!e||"object"!=typeof e)return!1;if(!e.statsRequest||"object"!=typeof e.statsRequest)return!1;if(!e.statsRequest.intervalSec||"number"!=typeof e.statsRequest.intervalSec)return!1;if(!e.statsRequest.types||!Array.isArray(e.statsRequest.types))return!1;for(const i of e.statsRequest.types){if(!i.type||"string"!=typeof i.type)return!1;if(!i.properties||!t(i.properties))return!1;for(const e of Object.keys(i.properties)){if(!("normalization"in i.properties[e])||"boolean"!=typeof i.properties[e].normalization)return!1;if(!i.properties[e].outputKey||"string"!=typeof i.properties[e].outputKey)return!1}}return!0};var i=["invalidPayload","unexpected"];e.isAcknowledgePayload=function(e){return!(!e||"object"!=typeof e)&&("string"==typeof e.eventId&&("boolean"==typeof e.ok&&!!(void 0===e.reason||"string"==typeof e.reason&&i.includes(e.reason))))}}}),require_event4=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/utils/event.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0;e.Event=class{constructor(){this._listeners=new Map,this._listenerIndex=0,this.emit=e=>{this._listeners.forEach((t=>t(e)))},this.removeAllListeners=()=>{this._listeners.clear()},this.addListener=e=>{const t=this._listenerIndex;this._listeners.set(t,e),this._listenerIndex++;return{removeListener:()=>{this._listeners.delete(t)}}},this.addOneTimeListener=e=>{const t=this.addListener((i=>{t.removeListener(),e(i)}));return t},this.asPromise=e=>new Promise(((t,i)=>{let r=()=>{};const s=e&&setTimeout((()=>{i("Event asPromise timeout"),r()}),e),n=this.addOneTimeListener((e=>{s&&clearTimeout(s),t(e)}));r=n.removeListener}))}}}}),require_socket2=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/socket.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Socket=void 0;var r=i(require_node5()),s=require_payloadTypes2(),n=require_event4(),a=["Open","Acknowledge"];e.Socket=class{constructor({sessionEndpoint:e,token:t,logger:i,sdkVersion:r,contextId:s}){this._isOpen=!1,this._isClosed=!1,this._reconnectCount=0,this.connectionState="connecting",this.onConnectionStateChanged=new n.Event,this.onOpened=new n.Event,this.onTokenExpired=new n.Event,this.onEventReceived=new n.Event,this.onConnectionFailed=new n.Event,this._resendClientEvents=[],this._sessionEndpoint=e,this._token=t,this._logger=i,this._sdkVersion=r,this._contextId=s,this._connect()}_setConnectionState(e){this.connectionState!==e&&(this._logger.debug(`connectionState changed : ${e}`),this.connectionState=e,this.onConnectionStateChanged.emit(e))}_connect(){let e;try{const t=`SkyWayAuthToken!${this._token}`,i={sdkPlatform:"js",sdkVersion:this._sdkVersion,contextId:this._contextId},s=Object.entries(i).filter((([e,t])=>void 0!==t)).map((e=>e.join("="))).join("&"),n=`${this._sessionEndpoint}?${s}`;e=new r.default(n,t),this._logger.debug(`Connecting to analytics-logging-server: ${this._sessionEndpoint}`),e.onerror=t=>{this._logger.error("WebSocket error occurred",t.error),e.close(4202)}}catch(e){const t=e instanceof Error?e:new Error;return this._logger.error("Failed to create WebSocket instance",t),void this.reconnect()}e.onopen=()=>{this._logger.debug("Connected to analytics-logging-server")},e.onclose=e=>{const t="Close event fired: "+JSON.stringify({code:e.code,reason:e.reason,type:e.type});4100<=e.code&&e.code<=4199||1009===e.code?this._logger.error(t,new Error):this._logger.debug(t),1e3===e.code||1009===e.code||4e3<=e.code&&e.code<=4199?(this._logger.debug("Closed the connection to analytics-logging-server"),this.onConnectionFailed.emit({code:e.code,reason:e.reason}),this.close()):4200===e.code?this.onTokenExpired.emit():this.reconnect()},e.onmessage=e=>{this._messageHandler(e.data)},this._ws=e}updateAuthToken(e){this._token=e}reconnect(){if(void 0!==this._ws&&this._ws.close(4e3),this._ws=void 0,this._isOpen=!1,this._reconnectCount>=5)this.onConnectionFailed.emit({}),this.close(),this._logger.error("Failed to reconnect for five times",new Error);else{this._setConnectionState("reconnecting");const t=(e=this._reconnectCount,1e3*(Math.pow(2,e)+Math.random()));this._reconnectTimer=setTimeout((()=>{this._connect(),this._reconnectCount++,this._logger.debug(`Try to reconnect: count = ${this._reconnectCount}`)}),t)}var e}close(){this._isClosed=!0,this.destroy()}destroy(){this._setConnectionState("closed"),this.onConnectionStateChanged.removeAllListeners(),this.onOpened.removeAllListeners(),this.onEventReceived.removeAllListeners(),this.onConnectionFailed.removeAllListeners(),this._reconnectTimer&&clearTimeout(this._reconnectTimer),void 0!==this._ws&&this._ws.close(1e3)}send(e){return t(this,void 0,void 0,(function*(){if(void 0===this._ws||!this._isOpen||this._ws.readyState!==r.default.OPEN)return this._logger.debug("Try to reconnect because connection is lost"),void this.resendAfterReconnect(e);const t=JSON.stringify(e.toJSON());this._ws.send(t,(t=>{if(t)return this._logger.debug(`Try to reconnect because failed to send: ${t.message}`),void this.resendAfterReconnect(e)}))}))}resendAfterReconnect(e){this._resendClientEvents.some((t=>t.id===e.id))||this._resendClientEvents.push(e),"reconnecting"!==this.connectionState&&this.reconnect()}pushResendClientEventsQueue(e){this._resendClientEvents.push(e)}isClosed(){return this._isClosed}_messageHandler(e){if("string"!=typeof e)return void this._logger.error("Received invalid message: not string",new Error);let t;try{t=JSON.parse(e)}catch(e){const t=e instanceof Error?e:new Error;return void this._logger.error("Received invalid message: parse error",t)}if(function(e){return!(!e||"object"!=typeof e)&&(!("string"!=typeof e.type||!a.includes(e.type))&&("string"==typeof e.id&&(!e.payload||"object"==typeof e.payload)))}(t))if("Open"===t.type){if(!(0,s.isOpenServerEventPayload)(t.payload))return void this._logger.error(`Received invalid message: ${JSON.stringify(t.payload)}`,new Error);if(this._logger.debug("Received a open event"),this._isOpen=!0,this._setConnectionState("connected"),0!==this._reconnectCount&&(this._reconnectCount=0,this._logger.debug("Succeeded to reconnect")),this._resendClientEvents.length>0){for(const e of this._resendClientEvents){if(void 0===this._ws||!this._isOpen||this._ws.readyState!==r.default.OPEN){this._logger.error(`Failed to resend event because connection lost after reconnect: ${e}`,new Error);continue}const t=JSON.stringify(e.toJSON());this._ws.send(t,(t=>{t?this._logger.error(`Failed to resend event: ${e}`,t):this._logger.debug(`Succeed to resend ClientEvent: ${e}`)}))}this._logger.debug("Process of resending ClientEvents is completed"),this._resendClientEvents=[]}this.onOpened.emit(t.payload)}else this._logger.debug(`Received the event: ${t.type}, payload: ${JSON.stringify(t.payload)}`),this.onEventReceived.emit(t);else this._logger.error(`Received invalid message: ${JSON.stringify(t)}`,new Error)}}}}),require_backoff=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/utils/backoff.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.BackOff=void 0;e.BackOff=class{constructor(e={}){this.count=0,this.times=8,this.interval=100,this.jitter=0,Object.assign(this,e)}wait(){return t(this,void 0,void 0,(function*(){if(this.exceeded)return!1;const e=this.timeout;return this.count++,yield new Promise((t=>setTimeout(t,e))),!0}))}get timeout(){return Math.pow(this.count,2)*this.interval+Math.pow(this.count,2)*this.jitter*Math.random()}get exceeded(){return this.count>=this.times}reset(){this.count=0}stop(){this.count=this.times}}}}),require_analyticsClient=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/analyticsClient.js"(e){"use strict";var t=e&&e.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{c(r.next(e))}catch(e){n(e)}}function o(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.AnalyticsClient=void 0;var i=require_clientEvent2(),r=require_payloadTypes2(),s=require_socket2(),n=require_backoff(),a=require_event4(),o="analytics-logging.skyway.ntt.com",c=class e{constructor({token:e,sdkVersion:t,contextId:i},r){this.onConnectionStateChanged=new a.Event,this.onConnectionFailed=new a.Event,this.onAnalyticsNotEnabledError=new a.Event,this._isClosed=!1,this._responseCallbacks=new Map,this._acknowledgeCallbacks=new Map,this._mediaDeviceVersion=new Map,this._encodingsVersion=new Map,this._preferredEncodingVersion=new Map,this._previousSubscriptionStats=new Map,this._statsRequest={intervalSec:5,types:[]},this._pendingSdkLogs=[],this._token=e,this._newToken=void 0,this._sdkVersion=t,this._contextId=i;const s={analyticsLoggingServerDomain:o,secure:!0,logger:{debug:(e,...t)=>{console.debug(e,...t)},warn:(e,...t)=>{console.warn(e,...t)},error:e=>{console.error(e)}}};this._options=Object.assign({},s,null!=r?r:{}),this._logger=this._options.logger,this._logger.debug(`Created instance with the options: ${this._options}`),this._sdkLogTimer=setInterval((()=>{if(this._pendingSdkLogs.length>0){const e=this._pendingSdkLogs.splice(0,this._pendingSdkLogs.length);this.sendSdkLogReport(e).catch((e=>{this._logger.warn("sendSdkLogReport (interval) failed",e)}))}}),5e3)}get connectionState(){var e,t;return null!==(t=null===(e=this._socket)||void 0===e?void 0:e.connectionState)&&void 0!==t?t:"closed"}connect(){return t(this,void 0,void 0,(function*(){const e=this._options.secure?"wss":"ws",t=this._options.analyticsLoggingServerDomain||o;this._socket=new s.Socket({sessionEndpoint:`${e}://${t}/v2/client/ws`,contextId:this._contextId,token:this._token,logger:this._logger,sdkVersion:this._sdkVersion}),this._socket.onEventReceived.addListener((e=>{try{this._eventReceivedHandler(e)}catch(e){this._logger.error("in _eventReceivedHandler",e)}})),this._socket.onConnectionFailed.addListener((e=>{4e3===e.code&&this.onAnalyticsNotEnabledError.emit(e),this.onConnectionFailed.emit(),this.dispose()})),this._socket.onConnectionStateChanged.addListener((e=>{var t;"closed"===e&&!this.isClosed()&&(null===(t=this._socket)||void 0===t?void 0:t.isClosed())&&(this._isClosed=!0,this.dispose()),this.onConnectionStateChanged.emit(e)})),this._socket.onTokenExpired.addListener((()=>{this._reconnectWithNewSkyWayAuthToken()}));const i=yield this._socket.onOpened.asPromise();return void 0!==i?void(this._statsRequest=i.statsRequest):(this._logger.error("First time connection payload is undefined",new Error),void this.onConnectionFailed.emit())}))}bufferOrSendSdkLog(t){const i="warn"===t.level||"error"===t.level;if(this._pendingSdkLogs.push(t),i||this._pendingSdkLogs.length>=e.MAX_PENDING_SDK_LOGS){const e=[...this._pendingSdkLogs];this._pendingSdkLogs.length=0,this.sendSdkLogReport(e).catch((e=>{this._logger.warn("sendSdkLogReport failed",e)}))}}dispose(){clearInterval(this._sdkLogTimer),this._disconnect(),this._cleanupAnalyticsClientMaps()}setNewSkyWayAuthToken(e){void 0!==this._socket&&(this._newToken=e,this._logger.debug("setNewSkyWayAuthToken is success"))}cleanupOnUnpublished(e){this._mediaDeviceVersion.delete(e),this._encodingsVersion.delete(e)}cleanupOnUnsubscribed(e){this._preferredEncodingVersion.delete(e),this._previousSubscriptionStats.delete(e)}_disconnect(){var e;null===(e=this._socket)||void 0===e||e.destroy(),this._socket=void 0,this._responseCallbacks.clear(),this._acknowledgeCallbacks.clear()}sendMediaDeviceReport(e){return t(this,void 0,void 0,(function*(){let t=this._mediaDeviceVersion.get(e.publicationId);void 0===t?t=0:t++,this._mediaDeviceVersion.set(e.publicationId,t);const r={publicationId:e.publicationId,mediaDeviceName:e.mediaDeviceName,mediaDeviceVersion:t,mediaDeviceTrigger:e.mediaDeviceTrigger,updatedAt:e.updatedAt},s=new i.ClientEvent("MediaDeviceReport",r);yield this._sendClientEvent(s).catch((e=>{this._logger.warn("_sendClientEvent in sendMediaDeviceReport is failed",e)}))}))}sendSdkLogReport(e){return t(this,void 0,void 0,(function*(){if(0===e.length)return;const t=e.map((e=>({timestamp:e.timestamp,level:e.level,message:Array.isArray(e.message)?e.message.map((e=>"string"==typeof e?e:JSON.stringify(e))).join(","):String(e.message)}))),r=new i.ClientEvent("SdkLog",{sdkLogs:t,contextId:this._contextId});yield this._sendClientEvent(r).catch((e=>{this._logger.warn("_sendClientEvent in sendSdkLogReport is failed",e)}))}))}sendBindingRtcPeerConnectionToSubscription(e){return t(this,void 0,void 0,(function*(){const t=new i.ClientEvent("BindingRtcPeerConnectionToSubscription",e);yield this._sendClientEvent(t).catch((e=>{this._logger.warn("_sendClientEvent in sendBindingRtcPeerConnectionToSubscription is failed",e)}))}))}filterStatsReport(e){const t=Array.from(e.values()).find((e=>"transport"===e.type&&"connected"===e.dtlsState)),i=[];if(t){const r=Array.from(e.values()).find((e=>"candidate-pair"===e.type&&e.nominated&&e.id===(null==t?void 0:t.selectedCandidatePairId)));r&&i.push(r.id,r.localCandidateId,r.remoteCandidateId,r.transportId)}else{const t=Array.from(e.values()).find((e=>"candidate-pair"===e.type&&e.nominated&&e.selected));t&&i.push(t.id,t.localCandidateId,t.remoteCandidateId,t.transportId)}const r=new Map,s=["candidate-pair","local-candidate","remote-candidate","transport"];for(const[t,n]of e.entries())s.includes(n.type)?i.includes(n.id)&&r.set(t,n):r.set(t,n);return r}bundleStatsReportByStatsType(e){const t={};for(const i of e.values())t[i.type]=i;return t}sendSubscriptionStatsReport(e,r){var s;return t(this,void 0,void 0,(function*(){const t=this._previousSubscriptionStats.get(r.subscriptionId);if(this._previousSubscriptionStats.set(r.subscriptionId,{stats:e,createdAt:r.createdAt}),void 0===t)return;const n=this.filterStatsReport(t.stats),a=this.bundleStatsReportByStatsType(n),o=t.createdAt,c=(r.createdAt-o)/1e3;if(c<=0)throw new Error("duration must be greater than 0. also sendSubscriptionStatsReport was duplicated.");const l=this.filterStatsReport(e),u=this.bundleStatsReportByStatsType(l),d={};for(const{type:e,properties:t}of this._statsRequest.types)for(const[i,{normalization:n,outputKey:o,contentType:l}]of Object.entries(t)){if(!l.includes(r.contentType))continue;const t=u[e];if(void 0!==t&&void 0!==t[i])if(n){const r=null===(s=a[e])||void 0===s?void 0:s[i];if(void 0===r){this._logger.warn(`${e} in previous statsReport is undefined`);continue}const n=(Number(t[i])-Number(r))/c;d[e]=Object.assign(Object.assign({},d[e]),{[o]:String(n)})}else d[e]=Object.assign(Object.assign({},d[e]),{[o]:String(t[i])})}const p={subscriptionId:r.subscriptionId,stats:d,role:r.role,createdAt:r.createdAt},h=new i.ClientEvent("SubscriptionStatsReport",p);yield this._sendClientEvent(h).catch((e=>{this._logger.warn("_sendClientEvent in sendSubscriptionStatsReport is failed",e)}))}))}sendRtcPeerConnectionEventReport(e){return t(this,void 0,void 0,(function*(){const t=new i.ClientEvent("RtcPeerConnectionEventReport",e);yield this._sendClientEvent(t).catch((e=>{this._logger.warn("_sendClientEvent in sendRtcPeerConnectionEventReport is failed",e)}))}))}sendPublicationUpdateEncodingsReport(e){return t(this,void 0,void 0,(function*(){let t=this._encodingsVersion.get(e.publicationId);void 0===t?t=0:t++,this._encodingsVersion.set(e.publicationId,t);const r={publicationId:e.publicationId,encodings:e.encodings,encodingsVersion:t,updatedAt:e.updatedAt},s=new i.ClientEvent("PublicationUpdateEncodingsReport",r);yield this._sendClientEvent(s).catch((e=>{this._logger.warn("_sendClientEvent in sendPublicationUpdateEncodingsReport is failed",e)}))}))}sendSubscriptionUpdatePreferredEncodingReport(e){return t(this,void 0,void 0,(function*(){let t=this._preferredEncodingVersion.get(e.subscriptionId);void 0===t?t=0:t++,this._preferredEncodingVersion.set(e.subscriptionId,t);const r={subscriptionId:e.subscriptionId,preferredEncodingIndex:e.preferredEncodingIndex,preferredEncodingVersion:t,updatedAt:e.updatedAt},s=new i.ClientEvent("SubscriptionUpdatePreferredEncodingReport",r);yield this._sendClientEvent(s).catch((e=>{this._logger.warn("_sendClientEvent in sendSubscriptionUpdatePreferredEncodingReport is failed",e)}))}))}sendJoinReport(e){return t(this,void 0,void 0,(function*(){const t=new i.ClientEvent("JoinReport",e);yield this._sendClientEvent(t).catch((e=>{this._logger.warn("_sendClientEvent in sendJoinReport is failed",e)}))}))}_sendClientEvent(e){return t(this,void 0,void 0,(function*(){return new Promise(((i,s)=>t(this,void 0,void 0,(function*(){if(void 0===this._socket||"closed"===this._socket.connectionState)return void s(new Error("websocket is not connected"));if("connecting"===this._socket.connectionState)return this._socket.pushResendClientEventsQueue(e),this._setAcknowledgeCallback(e.id,(r=>t(this,void 0,void 0,(function*(){r.ok?(this._acknowledgeCallbacks.delete(e.id),i()):(this._acknowledgeCallbacks.delete(e.id),s(r))})))),this._logger.debug(`pushResendClientEventsQueue and setAcknowledgeCallback. clientEvent.id: ${e.id}`),void s(new Error("websocket is connecting now"));const a=new n.BackOff({times:6,interval:500,jitter:100});for(;!a.exceeded;){const n=setTimeout((()=>t(this,void 0,void 0,(function*(){if(void 0===this._socket)return this._acknowledgeCallbacks.delete(e.id),void s(new Error("Socket closed when trying to resend"));this._socket.resendAfterReconnect(e),s(new Error("Timeout to send data"))}))),5e3);this._logger.debug(`send clientEvent, ${JSON.stringify(e)}`),this._socket.send(e).catch((t=>{this._acknowledgeCallbacks.delete(e.id),clearTimeout(n),s(t)}));const o=yield this._waitForAcknowledge(e.id).catch((e=>e));if(clearTimeout(n),!(0,r.isAcknowledgePayload)(o))return void i();if("unexpected"!==o.reason)return void s(o);yield a.wait()}s(new Error("unexpected has occurred at server"))}))))}))}_waitForAcknowledge(e){return t(this,void 0,void 0,(function*(){return new Promise(((i,r)=>{this._setAcknowledgeCallback(e,(s=>t(this,void 0,void 0,(function*(){s.ok?(this._acknowledgeCallbacks.delete(e),i()):(this._acknowledgeCallbacks.delete(e),r(s))}))))}))}))}_reconnectWithNewSkyWayAuthToken(){return t(this,void 0,void 0,(function*(){this._disconnect(),void 0!==this._newToken?(this._token=this._newToken,this._newToken=void 0,yield this.connect()):this._logger.warn("new token is not set. so not reconnect.")}))}_eventReceivedHandler(e){switch(e.type){case"Acknowledge":this._acknowledgeHandler(e.payload);break;case"Open":break;default:e.type;this._logger.warn(`Unknown event: ${e.type}`)}}_acknowledgeHandler(e){if(!(0,r.isAcknowledgePayload)(e))throw new Error("Invalid payload");const{eventId:t}=e;if(!this._acknowledgeCallbacks.has(t))throw new Error(`acknowledge event has unknown eventId: ${t}`);const i=this._acknowledgeCallbacks.get(t);i&&(this._acknowledgeCallbacks.delete(t),i(e))}_setAcknowledgeCallback(e,t){this._acknowledgeCallbacks.set(e,t)}_cleanupAnalyticsClientMaps(){this._mediaDeviceVersion.clear(),this._encodingsVersion.clear(),this._preferredEncodingVersion.clear(),this._previousSubscriptionStats.clear()}getIntervalSec(){return this._statsRequest.intervalSec}isConnectionEstablished(){return!(!this._socket||"connecting"===this._socket.connectionState||"closed"===this._socket.connectionState)}isClosed(){return this._isClosed}};e.AnalyticsClient=c,c.MAX_PENDING_SDK_LOGS=50}}),require_dist7=__commonJS({"../../node_modules/.pnpm/@skyway-sdk+analytics-client@1.1.1/node_modules/@skyway-sdk/analytics-client/dist/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),i=e&&e.__exportStar||function(e,i){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||t(i,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0,i(require_analyticsClient(),e);var r=require_event4();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return r.Event}})}}),index_exports={};__export(index_exports,{AnalyticsSession:()=>AnalyticsSession,ContextConfig:()=>ContextConfig,Event:()=>core_exports.Event,Events:()=>core_exports.Events,LocalAudioStream:()=>LocalAudioStream,LocalCustomVideoStream:()=>LocalCustomVideoStream,LocalDataStream:()=>LocalDataStream,LocalMediaStreamBase:()=>LocalMediaStreamBase,LocalP2PRoomMemberImpl:()=>LocalP2PRoomMemberImpl,LocalRoomMemberImpl:()=>LocalRoomMemberImpl,LocalSFURoomMemberImpl:()=>LocalSFURoomMemberImpl,LocalStreamBase:()=>LocalStreamBase,LocalVideoStream:()=>LocalVideoStream,MediaDevice:()=>MediaDevice,MediaStreamTrack:()=>MediaStreamTrack2,MediaStreamTrackFactory:()=>MediaStreamTrackFactory,P2PRoomImpl:()=>P2PRoomImpl,PACKAGE_VERSION:()=>PACKAGE_VERSION3,RemoteAudioStream:()=>RemoteAudioStream,RemoteDataStream:()=>RemoteDataStream,RemoteMediaStreamBase:()=>RemoteMediaStreamBase,RemoteRoomMemberImpl:()=>RemoteRoomMemberImpl,RemoteStreamBase:()=>RemoteStreamBase,RemoteVideoStream:()=>RemoteVideoStream,RoomImpl:()=>RoomImpl,RoomMemberImpl:()=>RoomMemberImpl,RoomPublicationImpl:()=>RoomPublicationImpl,RoomSubscriptionImpl:()=>RoomSubscriptionImpl,RtpBuilder:()=>RtpBuilder,RtpHeader:()=>RtpHeader,RtpPacket:()=>RtpPacket,SfuRoomImpl:()=>SfuRoomImpl,SkyWayAuthToken:()=>import_token6.SkyWayAuthToken,SkyWayContext:()=>SkyWayContext,SkyWayRoom:()=>SkyWayRoom,SkyWayStreamFactory:()=>SkyWayStreamFactory,Stream:()=>core_exports.Stream,SubscriptionOptions:()=>core_exports.SubscriptionOptions,SubscriptionState:()=>core_exports.SubscriptionState,TransportConnectionState:()=>core_exports.TransportConnectionState,TurnPolicy:()=>core_exports.TurnPolicy,TurnProtocol:()=>core_exports.TurnProtocol,VideoMediaTrackConstraints:()=>core_exports.VideoMediaTrackConstraints,WebRTCStats:()=>core_exports.WebRTCStats,createTestVideoTrack:()=>createTestVideoTrack,dePacketizeRtpPackets:()=>dePacketizeRtpPackets,detectDevice:()=>detectDevice,errors:()=>errors6,getBitrateFromPeerConnection:()=>getBitrateFromPeerConnection,getRtcRtpCapabilities:()=>getRtcRtpCapabilities,randomPort:()=>randomPort,roomTypes:()=>roomTypes,uuidV4:()=>import_token6.uuidV4}),module.exports=__toCommonJS(index_exports);var core_exports={};__export(core_exports,{AnalyticsSession:()=>AnalyticsSession,ContextConfig:()=>ContextConfig,IceManager:()=>IceManager,LocalAudioStream:()=>LocalAudioStream,LocalCustomVideoStream:()=>LocalCustomVideoStream,LocalDataStream:()=>LocalDataStream,LocalMediaStreamBase:()=>LocalMediaStreamBase,LocalPersonAdapter:()=>LocalPersonAdapter,LocalPersonImpl:()=>LocalPersonImpl,LocalStreamBase:()=>LocalStreamBase,LocalVideoStream:()=>LocalVideoStream,MediaDevice:()=>MediaDevice,MemberImpl:()=>MemberImpl,P2PConnection:()=>P2PConnection,PACKAGE_VERSION:()=>PACKAGE_VERSION,PublicationImpl:()=>PublicationImpl,RemoteAudioStream:()=>RemoteAudioStream,RemoteDataStream:()=>RemoteDataStream,RemoteMediaStreamBase:()=>RemoteMediaStreamBase,RemotePersonImpl:()=>RemotePersonImpl,RemoteStreamBase:()=>RemoteStreamBase,RemoteVideoStream:()=>RemoteVideoStream,SkyWayChannel:()=>SkyWayChannel,SkyWayChannelImpl:()=>SkyWayChannelImpl,SkyWayContext:()=>SkyWayContext,SkyWayPlugin:()=>SkyWayPlugin,SkyWayStreamFactory:()=>SkyWayStreamFactory,StreamFactory:()=>StreamFactory,SubscriptionImpl:()=>SubscriptionImpl,attachElement:()=>attachElement,convertConnectionState:()=>convertConnectionState,createError:()=>createError,createLocalPerson:()=>createLocalPerson,createLogPayload:()=>createLogPayload,createPublication:()=>createPublication,createRemoteStream:()=>createRemoteStream,createSubscription:()=>createSubscription,createTestVideoTrack:()=>createTestVideoTrack,createWarnPayload:()=>createWarnPayload,detachElement:()=>detachElement,detectDevice:()=>detectDevice,errors:()=>errors,fmtpConfigParser:()=>fmtpConfigParser,getBitrateFromPeerConnection:()=>getBitrateFromPeerConnection,getParameters:()=>getParameters,getRtcRtpCapabilities:()=>getRtcRtpCapabilities,getRuntimeInfo:()=>getRuntimeInfo,isRemoteMember:()=>isRemoteMember,isSafari:()=>isSafari,normalizeEncodings:()=>normalizeEncodings,objectFlag:()=>objectFlag,setEncodingParams:()=>setEncodingParams,setupAnalyticsSession:()=>setupAnalyticsSession,sortEncodingParameters:()=>sortEncodingParameters,statsToArray:()=>statsToArray,statsToJson:()=>statsToJson,waitForLocalStats:()=>waitForLocalStats});var src_exports={};__export(src_exports,{AnalyticsSession:()=>AnalyticsSession,ContextConfig:()=>ContextConfig,IceManager:()=>IceManager,LocalAudioStream:()=>LocalAudioStream,LocalCustomVideoStream:()=>LocalCustomVideoStream,LocalDataStream:()=>LocalDataStream,LocalMediaStreamBase:()=>LocalMediaStreamBase,LocalPersonAdapter:()=>LocalPersonAdapter,LocalPersonImpl:()=>LocalPersonImpl,LocalStreamBase:()=>LocalStreamBase,LocalVideoStream:()=>LocalVideoStream,MediaDevice:()=>MediaDevice,MemberImpl:()=>MemberImpl,P2PConnection:()=>P2PConnection,PACKAGE_VERSION:()=>PACKAGE_VERSION,PublicationImpl:()=>PublicationImpl,RemoteAudioStream:()=>RemoteAudioStream,RemoteDataStream:()=>RemoteDataStream,RemoteMediaStreamBase:()=>RemoteMediaStreamBase,RemotePersonImpl:()=>RemotePersonImpl,RemoteStreamBase:()=>RemoteStreamBase,RemoteVideoStream:()=>RemoteVideoStream,SkyWayChannel:()=>SkyWayChannel,SkyWayChannelImpl:()=>SkyWayChannelImpl,SkyWayContext:()=>SkyWayContext,SkyWayPlugin:()=>SkyWayPlugin,SkyWayStreamFactory:()=>SkyWayStreamFactory,StreamFactory:()=>StreamFactory,SubscriptionImpl:()=>SubscriptionImpl,attachElement:()=>attachElement,convertConnectionState:()=>convertConnectionState,createError:()=>createError,createLocalPerson:()=>createLocalPerson,createLogPayload:()=>createLogPayload,createPublication:()=>createPublication,createRemoteStream:()=>createRemoteStream,createSubscription:()=>createSubscription,createTestVideoTrack:()=>createTestVideoTrack,createWarnPayload:()=>createWarnPayload,detachElement:()=>detachElement,detectDevice:()=>detectDevice,errors:()=>errors,fmtpConfigParser:()=>fmtpConfigParser,getBitrateFromPeerConnection:()=>getBitrateFromPeerConnection,getParameters:()=>getParameters,getRtcRtpCapabilities:()=>getRtcRtpCapabilities,getRuntimeInfo:()=>getRuntimeInfo,isRemoteMember:()=>isRemoteMember,isSafari:()=>isSafari,normalizeEncodings:()=>normalizeEncodings,objectFlag:()=>objectFlag,setEncodingParams:()=>setEncodingParams,setupAnalyticsSession:()=>setupAnalyticsSession,sortEncodingParameters:()=>sortEncodingParameters,statsToArray:()=>statsToArray,statsToJson:()=>statsToJson,waitForLocalStats:()=>waitForLocalStats});var import_common74=__toESM(require_dist()),import_common75=__toESM(require_dist()),errors={internal:{name:"internal",detail:"",solution:""},timeout:{name:"timeout",detail:"",solution:""},missingProperty:{name:"missingProperty",detail:"",solution:""},notFound:{name:"notFound",detail:"",solution:""},invalidParameter:{name:"invalidParameter",detail:"",solution:""},invalidArgumentValue:{name:"invalidArgumentValue",detail:"引数の値が不正です",solution:"正しい値を引数に渡してください"},invalidContentType:{name:"invalidContentType",detail:"contentTypeが正しくありません",solution:"ContentTypeを確認してください"},localPersonNotJoinedChannel:{name:"localPersonNotJoinedChannel",detail:"操作しようとしたPersonがChannelに居ないので、操作できません The person who tried to operate is not in the channel, so the operation is not possible",solution:"Channelに居ないPersonを操作している可能性があるので確認してください Please check as you may be operating a person which is not in the channel"},alreadyLocalPersonExist:{name:"alreadyLocalPersonExist",detail:"ChannelにすでにLocalPersonが存在します。一つのChannelインスタンスにはLocalPersonが一つしかJoinできません",solution:"複数のLocalPersonを用意したい場合は個別にChannelインスタンスを用意してください。"},alreadySameNameMemberExist:{name:"alreadySameNameMemberExist",detail:"Channelにすでに同じNameのMemberが存在します",solution:"別のNameを使用してください"},alreadyPublishedStream:{name:"alreadyPublishedStream",detail:"すでにPublishしたStreamを再度Publishすることはできません You cannot re-publish a stream that has already been published",solution:"そのStreamをPublishしたPublicationをUnpublishするか、別の新しいStreamを作ってPublishしてください Unpublish the publication that published that stream, or create another new stream and publish it"},alreadySubscribedPublication:{name:"alreadySubscribedPublication",detail:"すでにSubscribeしたPublicationをSubscribeすることはできません",solution:"ありません"},invalidTrackKind:{name:"invalidTrackKind",detail:"Streamの種類とMediaStreamTrackの種類が一致しません",solution:"Streamの種類と同じMediaStreamTrackを利用してください"},cantMoveSameIdChannel:{name:"cantMoveSameIdChannel",detail:"moveChannelで同じidのChannelに移動することは出来ません",solution:"移動先のChannelが正しいか確かめてください"},alreadyChannelClosed:{name:"alreadyChannelClosed",detail:"ChannelがすでにCloseされています",solution:"ありません"},disabledDataStream:{name:"disabledDataStream",detail:"関連するPublicationがDisableなDataStreamには書き込みできません",solution:"関連するPublicationをEnableしてから書き込んでください"},publicationNotExist:{name:"publicationNotExist",detail:"channelに該当するPublicationが存在しません",solution:"publicationIdが正しいか確かめてください"},subscriptionNotExist:{name:"subscriptionNotExist",detail:"channelに該当するSubscriptionが存在しません",solution:"subscriptionIdが正しいか確かめてください"},unknownMemberType:{name:"unknownMemberType",detail:"対象のMemberのSubtypeのプラグインが登録されていません",solution:"対象のMemberのSubtypeのプラグイン(SfuBotなど)をSkyWayContextに登録してください"},streamNotExistInSubscription:{name:"streamNotExistInSubscription",detail:"SubscriptionにStreamがありません。RemoteMemberのSubscriptionのStreamにはアクセスできません",solution:"参照しているSubscriptionが目的のものか確かめてください。"},streamNotExistInPublication:{name:"streamNotExistInPublication",detail:"PublicationにStreamがありません。RemoteMemberのPublicationのStreamにはアクセスできません",solution:"参照しているPublicationが目的のものか確かめてください。"},dataStreamNotSupportEncoding:{name:"dataStreamNotSupportEncoding",detail:"dataStreamはEncode設定の変更に対応していません",solution:"ありません"},correspondingEncodeNotExistForId:{name:"correspondingEncodeNotExistForId",detail:"指定されたIDに対応するEncode設定が存在しません",solution:"正しいEncodingIDを指定してください"},updateIceParamsFailed:{name:"updateIceParamsFailed",detail:"iceParamsの更新に失敗しました",solution:"ありません"},invalidElement:{name:"invalidElement",detail:"渡されたHTML Elementが正しくありません",solution:"要求された正しいElementを渡してください"},connectRtcApiFailed:{name:"connectRtcApiFailed",detail:"RtcAPIへの接続に失敗しました",solution:"インターネットへ接続できているか、もしくはTokenのパラメータが正しいかを確かめてください"},rtcApiFatalError:{name:"rtcApiFatalError",detail:"RtcAPIの回復不能なエラーです。サーバー側の問題の可能性があります",solution:"インターネットへの接続が出来ているかを確かめてください"},invalidExpireTokenValue:{name:"invalidExpireTokenValue",detail:"tokenのExpire時刻が不正です",solution:"正しい時刻を指定してください"},invalidRemindExpireTokenValue:{name:"invalidRemindExpireTokenValue",detail:"tokenのExpireをリマインドする時間の値が不正です",solution:"正しい時間を指定してください"},invalidTokenAppId:{name:"invalidTokenAppId",detail:"tokenのappIdが正しくありません",solution:"正しいappIdを含むTokenを使用してください"},mediaDevicesNotFound:{name:"mediaDevicesNotFound",detail:"navigator.mediaDevicesがみつかりません",solution:"アプリケーションをhttps,localhost,127.0.0.1のいずれかの環境で動作させてください"},canNotUseReplaceStream:{name:"canNotUseReplaceStream",detail:"remoteのPublicationからreplaceStreamできません",solution:"対象のPublicationがLocalのものか確認してください"},canNotEnableRemotePublication:{name:"canNotEnableRemotePublication",detail:"remoteのPublicationをenableすることはできません",solution:"対象のPublicationがLocalのものか確認してください"},dataChannelSendError:{name:"dataChannelSendError",detail:"データ送信に失敗しました",solution:"接続が閉じられている、バッファに空き容量が無い、データサイズが大きすぎる等の理由で送信に失敗しています。再度publish もしくは 送信するデータを分割してください"},dataChannelGeneralError:{name:"dataChannelGeneralError",detail:"DataStreamの内部でエラーが発生しました",solution:"DataStreamを作り直して再度publishしてください"}},import_common71=__toESM(require_dist()),import_common2=__toESM(require_dist()),import_common=__toESM(require_dist()),import_sdp_transform=__toESM(require_lib()),import_ua_parser_js=__toESM(require_ua_parser()),log=new import_common.Logger("packages/core/src/util.ts");function getBitrateFromPeerConnection(e,t,i,r){let s=0;const n=setInterval((async()=>{const n=(await e.getStats(r)).find((e=>"inbound"===t?e?.id.includes("InboundRTPVideo")||e?.type.includes("inbound-rtp"):e?.id.includes("OutboundRTPVideo")||e?.type.includes("outbound-rtp")));if(!n)return;const a="inbound"===t?n.bytesReceived:n.bytesSent;i(8*(a-s)),s=a}),1e3);return()=>clearInterval(n)}function statsToArray(e){const t=[];return e.forEach((e=>{t.push(e)})),t}async function createLogPayload({operationName:e,channel:t}){const i={operationName:e,appId:t.appId,channelId:t.id};if(t.localPerson){const e=t.localPerson,r=await Promise.all(e.publications.map((async e=>{const t={id:e.id,contentType:e.contentType,state:e.state,stats:{},connectionStats:{}};if(e.stream)for(const{memberId:i,stats:r}of await e.stream._getStatsAll()){const s=r.find((e=>e.type.includes("local-candidate")));t.stats[i]={transportType:s?.protocol??"none",relayProtocol:s?.relayProtocol??"none",callType:e.subscriptions.find((e=>e.subscriber.id===i))?.subscriber.subtype,outbound:r.find((e=>e.type.includes("outbound-rtp"))),localCandidate:s}}if(e.stream)for(const{memberId:i,connectionState:r}of e.stream._getConnectionStateAll())t.connectionStats[i]=r;return t})));i.publishing=r;const s=await Promise.all(e.subscriptions.map((async e=>{const t={id:e.id,contentType:e.contentType,stats:{}};if(t.callType=e.publication.publisher.subtype,e.stream){const i=await e.stream.getStats();t.stats=i.find((e=>e.type.includes("inbound-rtp")));const r=i.find((e=>e.type.includes("local-candidate")));t.transportType=r?.protocol,t.relayProtocol=r?.relayProtocol}return e.stream&&(t.connectionState=e.stream.getConnectionState()),t})));i.subscribing=s}return i}function createWarnPayload({member:e,detail:t,channel:i,operationName:r,payload:s}){const n={operationName:r,payload:s,detail:t};return e&&(n.appId=e.channel.appId,n.channelId=e.channel.id,n.memberId=e.id),i&&(n.appId=i.appId,n.channelId=i.id),n}function createError({operationName:e,context:t,info:i,error:r,path:s,payload:n,channel:a}){const o={operationName:e,payload:n};return a&&(o.appId=a.appId,o.channelId=a.id,a.localPerson&&(o.memberId=a.localPerson.id)),t&&(o.info=t.info,o.plugins=t.plugins.map((e=>e.subtype))),new import_common.SkyWayError({error:r,info:i,payload:o,path:s})}var waitForLocalStats=async({stream:e,remoteMember:t,end:i,interval:r,timeout:s})=>new Promise((async(n,a)=>{r??(r=100),s??(s=1e4);for(let o=0;;o+=r){if(o>=s){a(createError({operationName:"Peer.waitForStats",info:{...errors.timeout,detail:"waitForStats timeout"},path:log.prefix}));break}const c=await e._getStats(t);if(i(c)){n(c);break}await new Promise((e=>setTimeout(e,r)))}}));async function getRtcRtpCapabilities(){const e=new RTCPeerConnection;e.addTransceiver("audio",{direction:"sendonly"}),e.addTransceiver("video",{direction:"sendonly"});const t=await e.createOffer();try{e.close()}catch(e){}const i=import_sdp_transform.default.parse(t.sdp),[r,s]=i.media;return{audio:r.rtp.map((e=>({...e,payload:e.payload,mimeType:"audio/"+e.codec,parameters:getParameters(r.fmtp,e.payload)}))),video:s.rtp.filter((e=>!["red","rtx","ulpfec"].includes(e.codec))).map((e=>({...e,payload:e.payload,mimeType:"video/"+e.codec,parameters:getParameters(s.fmtp,e.payload)})))}}var getParameters=(e,t)=>fmtpConfigParser(e.find((e=>e.payload===t))?.config??""),fmtpConfigParser=e=>e.split(";").reduce(((e,t)=>{const[i,r]=t.split("=");return i&&(e[i]=isNaN(Number(r))?r:Number(r)),e}),{});function createTestVideoTrack(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const r=i.getContext("2d"),s=()=>{r.clearRect(0,0,i.width,i.height),r.fillStyle="rgb(200, 200, 200)",r.fillRect(0,0,i.width,i.height);const e=new Date;r.font="45px Monaco,Consolas",r.textAlign="center",r.fillStyle="red";const t=("0"+e.getHours()).slice(-2),n=("0"+e.getMinutes()).slice(-2),a=("0"+e.getSeconds()).slice(-2),o=("00"+e.getMilliseconds()).slice(-3);r.fillText(`${t}:${n}:${a}.${o}`,i.width/2,i.height/2),requestAnimationFrame(s)};setTimeout((()=>s()),0);const[n]=i.captureStream().getVideoTracks();return n}var getRuntimeInfo=({isNotBrowser:e}={})=>{if(e)return e;return{browserName:"nodejs",browserVersion:"0.0.0",osName:"nodejs",osVersion:"0.0.0"}};function detectDevice(){if("object"==typeof navigator&&"ReactNative"===navigator.product){if("undefined"==typeof RTCPeerConnection)return;return"undefined"!=typeof RTCRtpTransceiver?"ReactNativeUnifiedPlan":"ReactNative"}if("object"!=typeof navigator||"string"!=typeof navigator.userAgent);else{const e=navigator.userAgent,t=new import_ua_parser_js.UAParser(e),i=t.getBrowser(),r=i.name?.toLowerCase()??"",s=parseInt(i.major??"0"),n=t.getEngine(),a=n.name?.toLowerCase()??"",o=t.getOS(),c=o.name?.toLowerCase()??"",l=parseFloat(o.version??"0"),u="ios"===c,d=["chrome","chromium","mobile chrome","chrome webview","chrome headless"].includes(r),p=["firefox","mobile firefox","mobile focus"].includes(r),h=["safari","mobile safari"].includes(r),m=["edge"].includes(r);if((d||m)&&!u&&s>=111)return"Chrome111";if(d&&!u&&s>=74||m&&!u&&s>=88)return"Chrome74";if(d&&!u&&s>=70)return"Chrome70";if(d&&!u&&s>=67)return"Chrome67";if(d&&!u&&s>=55)return"Chrome55";if(p&&!u&&s>=60)return"Firefox60";if(p&&u&&l>=14.3)return"Safari12";if(h&&s>=12&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(h&&s>=11)return"Safari11";if(m&&!u&&s>=11&&s<=18)return"Edge11";if("webkit"===a&&u&&l>=14.3&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if("blink"===a){const t=e.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);if(t){const e=Number(t[1]);return e>=111?"Chrome111":e>=74?"Chrome74":e>=70?"Chrome70":e>=67?"Chrome67":"Chrome55"}return"Chrome111"}}}var log2=new import_common2.Logger("packages/core/src/member/index.ts"),MemberImpl=class{constructor(e){this._state="joined",this._events=new import_common2.Events,this.onLeft=this._events.make(),this.onMetadataUpdated=this._events.make(),this.channel=e.channel,this.id=e.id,this.name=e.name,this._metadata=e.metadata,this.context=e.context}get metadata(){return this._metadata}get state(){return this._state}get publications(){return this.channel.publications.filter((e=>e.publisher.id===this.id))}get subscriptions(){return this.channel.subscriptions.filter((e=>e.subscriber.id===this.id))}toJSON(){return{id:this.id,name:this.name,type:this.type,subtype:this.subtype,metadata:this.metadata}}_left(){this._state="left",this.onLeft.emit(),this._events.dispose()}_metadataUpdated(e){this._metadata=e,this.onMetadataUpdated.emit(e)}async updateMetadata(e){await this.channel._updateMemberMetadata(this.id,e)}async leave(){const e=log2.info("[start] leave",await createLogPayload({operationName:"localPerson.leave",channel:this.channel}));if("left"===this.state)throw createError({operationName:"localPerson.leave",info:errors.localPersonNotJoinedChannel,path:log2.prefix,context:this.context,channel:this.channel});await this.channel.leave(this),log2.elapsed(e,"[end] leave")}},import_common3=__toESM(require_dist()),log3=new import_common3.Logger("packages/core/src/plugin/internal/unknown/connection.ts"),UnknownConnection=class{constructor(e,t){this.localPerson=e,this.remoteMember=t,this.type="unknown",this.onDisconnect=new import_common3.Event,this.onClose=new import_common3.Event,this.closed=!1}close(){this.closed=!0,this.onClose.emit()}async startPublishing(e){log3.debug(`this is unknown type connection. should install ${this.remoteMember.subtype} plugin`,{publication:e})}async stopPublishing(e){log3.debug(`this is unknown type connection. should install ${this.remoteMember.subtype} plugin`,{publication:e})}async startSubscribing(e){log3.debug(`this is unknown type connection. should install ${this.remoteMember.subtype} plugin`,{subscription:e})}async stopSubscribing(e){log3.debug(`this is unknown type connection. should install ${this.remoteMember.subtype} plugin`,{subscription:e})}},UnknownMemberImpl=class extends MemberImpl{constructor(e){super(e),this.type="bot",this.side="remote",this._connections={},this.plugin=e.plugin,this.subtype=e.subtype}_getConnection(e){return this._connections[e]}_getOrCreateConnection(e){return this._getConnection(e.id)??this._createConnection(e,this)}_createConnection(e,t){return new UnknownConnection(e,t)}_dispose(){}},import_common64=__toESM(require_dist()),import_common65=__toESM(require_dist()),import_common63=__toESM(require_dist()),import_common60=__toESM(require_dist()),import_common59=__toESM(require_dist()),import_bowser=__toESM(require_es5()),import_debug=__toESM(require_src2()),APP_NAME="mediasoup-client",Logger4=class{constructor(e){e?(this._debug=(0,import_debug.default)(`${APP_NAME}:${e}`),this._warn=(0,import_debug.default)(`${APP_NAME}:WARN:${e}`),this._error=(0,import_debug.default)(`${APP_NAME}:ERROR:${e}`)):(this._debug=(0,import_debug.default)(APP_NAME),this._warn=(0,import_debug.default)(`${APP_NAME}:WARN`),this._error=(0,import_debug.default)(`${APP_NAME}:ERROR`)),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}},import_events=require("events"),logger=new Logger4("EnhancedEventEmitter"),EnhancedEventEmitter=class extends import_events.EventEmitter{constructor(){super(),this.setMaxListeners(1/0)}safeEmit(e,...t){const i=this.listenerCount(e);try{return this.emit(e,...t)}catch(t){return logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,t),Boolean(i)}}async safeEmitAsPromise(e,...t){return new Promise(((i,r)=>{try{this.emit(e,...t,i,r)}catch(t){logger.error("safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),r(t)}}))}},UnsupportedError=class e extends Error{constructor(t){super(t),this.name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,e):this.stack=new Error(t).stack}},InvalidStateError=class e extends Error{constructor(t){super(t),this.name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,e):this.stack=new Error(t).stack}};function clone(e,t){return void 0===e?t:JSON.parse(JSON.stringify(e))}function generateRandomNumber(){return Math.round(1e7*Math.random())}var h264=__toESM(require_h264_profile_level_id()),RTP_PROBATOR_MID="probator",RTP_PROBATOR_SSRC=1234,RTP_PROBATOR_CODEC_PAYLOAD_TYPE=127;function validateRtpCapabilities(e){if("object"!=typeof e)throw new TypeError("caps is not an object");if(e.codecs&&!Array.isArray(e.codecs))throw new TypeError("caps.codecs is not an array");e.codecs||(e.codecs=[]);for(const t of e.codecs)validateRtpCodecCapability(t);if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("caps.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);for(const t of e.headerExtensions)validateRtpHeaderExtension(t)}function validateRtpCodecCapability(e){const t=new RegExp("^(audio|video)/(.+)","i");if("object"!=typeof e)throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");const i=t.exec(e.mimeType);if(!i)throw new TypeError("invalid codec.mimeType");if(e.kind=i[1].toLowerCase(),e.preferredPayloadType&&"number"!=typeof e.preferredPayloadType)throw new TypeError("invalid codec.preferredPayloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===e.kind?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let i=e.parameters[t];if(void 0===i&&(e.parameters[t]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError(`invalid codec parameter [key:${t}s, value:${i}]`);if("apt"===t&&"number"!=typeof i)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);for(const t of e.rtcpFeedback)validateRtcpFeedback(t)}function validateRtcpFeedback(e){if("object"!=typeof e)throw new TypeError("fb is not an object");if(!e.type||"string"!=typeof e.type)throw new TypeError("missing fb.type");e.parameter&&"string"==typeof e.parameter||(e.parameter="")}function validateRtpHeaderExtension(e){if("object"!=typeof e)throw new TypeError("ext is not an object");if(e.kind&&"string"==typeof e.kind||(e.kind=""),""!==e.kind&&"audio"!==e.kind&&"video"!==e.kind)throw new TypeError("invalid ext.kind");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.preferredId)throw new TypeError("missing ext.preferredId");if(e.preferredEncrypt&&"boolean"!=typeof e.preferredEncrypt)throw new TypeError("invalid ext.preferredEncrypt");if(e.preferredEncrypt||(e.preferredEncrypt=!1),e.direction&&"string"!=typeof e.direction)throw new TypeError("invalid ext.direction");e.direction||(e.direction="sendrecv")}function validateRtpParameters(e){if("object"!=typeof e)throw new TypeError("params is not an object");if(e.mid&&"string"!=typeof e.mid)throw new TypeError("params.mid is not a string");if(!Array.isArray(e.codecs))throw new TypeError("missing params.codecs");for(const t of e.codecs)validateRtpCodecParameters(t);if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("params.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);for(const t of e.headerExtensions)validateRtpHeaderExtensionParameters(t);if(e.encodings&&!Array.isArray(e.encodings))throw new TypeError("params.encodings is not an array");e.encodings||(e.encodings=[]);for(const t of e.encodings)validateRtpEncodingParameters(t);if(e.rtcp&&"object"!=typeof e.rtcp)throw new TypeError("params.rtcp is not an object");e.rtcp||(e.rtcp={}),validateRtcpParameters(e.rtcp)}function validateRtpCodecParameters(e){const t=new RegExp("^(audio|video)/(.+)","i");if("object"!=typeof e)throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");const i=t.exec(e.mimeType);if(!i)throw new TypeError("invalid codec.mimeType");if("number"!=typeof e.payloadType)throw new TypeError("missing codec.payloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===i[1].toLowerCase()?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let i=e.parameters[t];if(void 0===i&&(e.parameters[t]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError(`invalid codec parameter [key:${t}s, value:${i}]`);if("apt"===t&&"number"!=typeof i)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);for(const t of e.rtcpFeedback)validateRtcpFeedback(t)}function validateRtpHeaderExtensionParameters(e){if("object"!=typeof e)throw new TypeError("ext is not an object");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.id)throw new TypeError("missing ext.id");if(e.encrypt&&"boolean"!=typeof e.encrypt)throw new TypeError("invalid ext.encrypt");e.encrypt||(e.encrypt=!1),e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let i=e.parameters[t];if(void 0===i&&(e.parameters[t]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError("invalid header extension parameter")}}function validateRtpEncodingParameters(e){if("object"!=typeof e)throw new TypeError("encoding is not an object");if(e.ssrc&&"number"!=typeof e.ssrc)throw new TypeError("invalid encoding.ssrc");if(e.rid&&"string"!=typeof e.rid)throw new TypeError("invalid encoding.rid");if(e.rtx&&"object"!=typeof e.rtx)throw new TypeError("invalid encoding.rtx");if(e.rtx&&"number"!=typeof e.rtx.ssrc)throw new TypeError("missing encoding.rtx.ssrc");if(e.dtx&&"boolean"==typeof e.dtx||(e.dtx=!1),e.scalabilityMode&&"string"!=typeof e.scalabilityMode)throw new TypeError("invalid encoding.scalabilityMode")}function validateRtcpParameters(e){if("object"!=typeof e)throw new TypeError("rtcp is not an object");if(e.cname&&"string"!=typeof e.cname)throw new TypeError("invalid rtcp.cname");e.reducedSize&&"boolean"==typeof e.reducedSize||(e.reducedSize=!0)}function validateSctpCapabilities(e){if("object"!=typeof e)throw new TypeError("caps is not an object");if(!e.numStreams||"object"!=typeof e.numStreams)throw new TypeError("missing caps.numStreams");validateNumSctpStreams(e.numStreams)}function validateNumSctpStreams(e){if("object"!=typeof e)throw new TypeError("numStreams is not an object");if("number"!=typeof e.OS)throw new TypeError("missing numStreams.OS");if("number"!=typeof e.MIS)throw new TypeError("missing numStreams.MIS")}function validateSctpStreamParameters(e){if("object"!=typeof e)throw new TypeError("params is not an object");if("number"!=typeof e.streamId)throw new TypeError("missing params.streamId");let t=!1;if("boolean"==typeof e.ordered?t=!0:e.ordered=!0,e.maxPacketLifeTime&&"number"!=typeof e.maxPacketLifeTime)throw new TypeError("invalid params.maxPacketLifeTime");if(e.maxRetransmits&&"number"!=typeof e.maxRetransmits)throw new TypeError("invalid params.maxRetransmits");if(e.maxPacketLifeTime&&e.maxRetransmits)throw new TypeError("cannot provide both maxPacketLifeTime and maxRetransmits");if(t&&e.ordered&&(e.maxPacketLifeTime||e.maxRetransmits))throw new TypeError("cannot be ordered with maxPacketLifeTime or maxRetransmits");if(t||!e.maxPacketLifeTime&&!e.maxRetransmits||(e.ordered=!1),e.priority&&"string"!=typeof e.priority)throw new TypeError("invalid params.priority");if(e.label&&"string"!=typeof e.label)throw new TypeError("invalid params.label");if(e.protocol&&"string"!=typeof e.protocol)throw new TypeError("invalid params.protocol")}function getExtendedRtpCapabilities(e,t){const i={codecs:[],headerExtensions:[]};for(const r of t.codecs||[]){if(isRtxCodec(r))continue;const t=(e.codecs||[]).find((e=>matchCodecs(e,r,{strict:!0,modify:!0})));if(!t)continue;const s={mimeType:t.mimeType,kind:t.kind,clockRate:t.clockRate,channels:t.channels,localPayloadType:t.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:r.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:t.parameters,remoteParameters:r.parameters,rtcpFeedback:reduceRtcpFeedback(t,r)};i.codecs.push(s)}for(const r of i.codecs){const i=e.codecs.find((e=>isRtxCodec(e)&&e.parameters.apt===r.localPayloadType)),s=t.codecs.find((e=>isRtxCodec(e)&&e.parameters.apt===r.remotePayloadType));i&&s&&(r.localRtxPayloadType=i.preferredPayloadType,r.remoteRtxPayloadType=s.preferredPayloadType)}for(const r of t.headerExtensions){const t=e.headerExtensions.find((e=>matchHeaderExtensions(e,r)));if(!t)continue;const s={kind:r.kind,uri:r.uri,sendId:t.preferredId,recvId:r.preferredId,encrypt:t.preferredEncrypt,direction:"sendrecv"};switch(r.direction){case"sendrecv":s.direction="sendrecv";break;case"recvonly":s.direction="sendonly";break;case"sendonly":s.direction="recvonly";break;case"inactive":s.direction="inactive"}i.headerExtensions.push(s)}return i}function getRecvRtpCapabilities(e){const t={codecs:[],headerExtensions:[]};for(const i of e.codecs){const e={mimeType:i.mimeType,kind:i.kind,preferredPayloadType:i.remotePayloadType,clockRate:i.clockRate,channels:i.channels,parameters:i.localParameters,rtcpFeedback:i.rtcpFeedback};if(t.codecs.push(e),!i.remoteRtxPayloadType)continue;const r={mimeType:`${i.kind}/rtx`,kind:i.kind,preferredPayloadType:i.remoteRtxPayloadType,clockRate:i.clockRate,parameters:{apt:i.remotePayloadType},rtcpFeedback:[]};t.codecs.push(r)}for(const i of e.headerExtensions){if("sendrecv"!==i.direction&&"recvonly"!==i.direction)continue;const e={kind:i.kind,uri:i.uri,preferredId:i.recvId,preferredEncrypt:i.encrypt,direction:i.direction};t.headerExtensions.push(e)}return t}function getSendingRtpParameters(e,t){const i={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}};for(const r of t.codecs){if(r.kind!==e)continue;const t={mimeType:r.mimeType,payloadType:r.localPayloadType,clockRate:r.clockRate,channels:r.channels,parameters:r.localParameters,rtcpFeedback:r.rtcpFeedback};if(i.codecs.push(t),r.localRtxPayloadType){const e={mimeType:`${r.kind}/rtx`,payloadType:r.localRtxPayloadType,clockRate:r.clockRate,parameters:{apt:r.localPayloadType},rtcpFeedback:[]};i.codecs.push(e)}}for(const r of t.headerExtensions){if(r.kind&&r.kind!==e||"sendrecv"!==r.direction&&"sendonly"!==r.direction)continue;const t={uri:r.uri,id:r.sendId,encrypt:r.encrypt,parameters:{}};i.headerExtensions.push(t)}return i}function getSendingRemoteRtpParameters(e,t){const i={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}};for(const r of t.codecs){if(r.kind!==e)continue;const t={mimeType:r.mimeType,payloadType:r.localPayloadType,clockRate:r.clockRate,channels:r.channels,parameters:r.remoteParameters,rtcpFeedback:r.rtcpFeedback};if(i.codecs.push(t),r.localRtxPayloadType){const e={mimeType:`${r.kind}/rtx`,payloadType:r.localRtxPayloadType,clockRate:r.clockRate,parameters:{apt:r.localPayloadType},rtcpFeedback:[]};i.codecs.push(e)}}for(const r of t.headerExtensions){if(r.kind&&r.kind!==e||"sendrecv"!==r.direction&&"sendonly"!==r.direction)continue;const t={uri:r.uri,id:r.sendId,encrypt:r.encrypt,parameters:{}};i.headerExtensions.push(t)}if(i.headerExtensions.some((e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.uri)))for(const e of i.codecs)e.rtcpFeedback=(e.rtcpFeedback||[]).filter((e=>"goog-remb"!==e.type));else if(i.headerExtensions.some((e=>"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.uri)))for(const e of i.codecs)e.rtcpFeedback=(e.rtcpFeedback||[]).filter((e=>"transport-cc"!==e.type));else for(const e of i.codecs)e.rtcpFeedback=(e.rtcpFeedback||[]).filter((e=>"transport-cc"!==e.type&&"goog-remb"!==e.type));return i}function reduceCodecs(e,t){const i=[];if(t){for(let r=0;r<e.length;++r)if(matchCodecs(e[r],t,{strict:!0})){i.push(e[r]),isRtxCodec(e[r+1])&&i.push(e[r+1]);break}if(0===i.length)throw new TypeError("no matching codec found")}else i.push(e[0]),isRtxCodec(e[1])&&i.push(e[1]);return i}function generateProbatorRtpParameters(e){validateRtpParameters(e=clone(e,{}));const t={mid:RTP_PROBATOR_MID,codecs:[],headerExtensions:[],encodings:[{ssrc:RTP_PROBATOR_SSRC}],rtcp:{cname:"probator"}};return t.codecs.push(e.codecs[0]),t.codecs[0].payloadType=RTP_PROBATOR_CODEC_PAYLOAD_TYPE,t.headerExtensions=e.headerExtensions,t}function canSend(e,t){return t.codecs.some((t=>t.kind===e))}function canReceive(e,t){if(validateRtpParameters(e),0===e.codecs.length)return!1;const i=e.codecs[0];return t.codecs.some((e=>e.remotePayloadType===i.payloadType))}function isRtxCodec(e){return!!e&&/.+\/rtx$/i.test(e.mimeType)}function matchCodecs(e,t,{strict:i=!1,modify:r=!1}={}){const s=e.mimeType.toLowerCase();if(s!==t.mimeType.toLowerCase())return!1;if(e.clockRate!==t.clockRate)return!1;if(e.channels!==t.channels)return!1;switch(s){case"video/h264":{const s=e.parameters["packetization-mode"]??0,n=t.parameters["packetization-mode"]??0,a=e.parameters["level-asymmetry-allowed"]??1,o=t.parameters["level-asymmetry-allowed"]??1;if(s!==n)return!1;if(a!==o)return!1;if(i){if(!h264.isSameProfile(e.parameters,t.parameters))return!1;let i;try{i=h264.generateProfileLevelIdForAnswer(e.parameters,t.parameters)}catch(e){return!1}r&&(i?(e.parameters["profile-level-id"]=i,t.parameters["profile-level-id"]=i):(delete e.parameters["profile-level-id"],delete t.parameters["profile-level-id"]))}break}case"video/vp9":if(i){if((e.parameters["profile-id"]||0)!==(t.parameters["profile-id"]||0))return!1}}return!0}function matchHeaderExtensions(e,t){return(!e.kind||!t.kind||e.kind===t.kind)&&e.uri===t.uri}function reduceRtcpFeedback(e,t){const i=[];for(const r of e.rtcpFeedback||[]){const e=(t.rtcpFeedback||[]).find((e=>e.type===r.type&&(e.parameter===r.parameter||!e.parameter&&!r.parameter)));e&&i.push(e)}return i}var import_awaitqueue=__toESM(require_lib2()),logger2=new Logger4("Producer"),Producer=class extends EnhancedEventEmitter{constructor({id:e,localId:t,rtpSender:i,track:r,rtpParameters:s,stopTracks:n,disableTrackOnPause:a,zeroRtpOnPause:o,appData:c}){super(),this._closed=!1,this._observer=new EnhancedEventEmitter,logger2.debug("constructor()"),this._id=e,this._localId=t,this._rtpSender=i,this._track=r,this._kind=r.kind,this._rtpParameters=s,this._paused=!!a&&!r.enabled,this._maxSpatialLayer=void 0,this._stopTracks=n,this._disableTrackOnPause=a,this._zeroRtpOnPause=o,this._appData=c,this._onTrackEnded=this._onTrackEnded.bind(this),this._handleTrack()}get id(){return this._id}get localId(){return this._localId}get closed(){return this._closed}get kind(){return this._kind}get rtpSender(){return this._rtpSender}get track(){return this._track}get rtpParameters(){return this._rtpParameters}get paused(){return this._paused}get maxSpatialLayer(){return this._maxSpatialLayer}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(logger2.debug("close()"),this._closed=!0,this._destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(logger2.debug("transportClosed()"),this._closed=!0,this._destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}async getStats(){if(this._closed)throw new InvalidStateError("closed");return this.safeEmitAsPromise("@getstats")}pause(){logger2.debug("pause()"),this._closed?logger2.error("pause() | Producer closed"):(this._paused=!0,this._track&&this._disableTrackOnPause&&(this._track.enabled=!1),this._zeroRtpOnPause&&this.safeEmitAsPromise("@replacetrack",null).catch((()=>{})),this._observer.safeEmit("pause"))}resume(){logger2.debug("resume()"),this._closed?logger2.error("resume() | Producer closed"):(this._paused=!1,this._track&&this._disableTrackOnPause&&(this._track.enabled=!0),this._zeroRtpOnPause&&this.safeEmitAsPromise("@replacetrack",this._track).catch((()=>{})),this._observer.safeEmit("resume"))}async replaceTrack({track:e}){if(logger2.debug("replaceTrack() [track:%o]",e),this._closed){if(e&&this._stopTracks)try{e.stop()}catch(e){}throw new InvalidStateError("closed")}e!==this._track?(this._zeroRtpOnPause&&this._paused||await this.safeEmitAsPromise("@replacetrack",e),this._destroyTrack(),this._track=e,this._track&&this._disableTrackOnPause&&(this._paused?this._paused&&(this._track.enabled=!1):this._track.enabled=!0),this._handleTrack()):logger2.debug("replaceTrack() | same track, ignored")}async setMaxSpatialLayer(e){if(this._closed)throw new InvalidStateError("closed");if("video"!==this._kind)throw new UnsupportedError("not a video Producer");if("number"!=typeof e)throw new TypeError("invalid spatialLayer");e!==this._maxSpatialLayer&&(await this.safeEmitAsPromise("@setmaxspatiallayer",e),this._maxSpatialLayer=e)}async setRtpEncodingParameters(e){if(this._closed)throw new InvalidStateError("closed");if("object"!=typeof e)throw new TypeError("invalid params");await this.safeEmitAsPromise("@setrtpencodingparameters",e)}_onTrackEnded(){logger2.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}_handleTrack(){this._track&&this._track.addEventListener("ended",this._onTrackEnded)}_destroyTrack(){if(this._track)try{this._track.removeEventListener("ended",this._onTrackEnded),this._stopTracks&&this._track.stop()}catch(e){}}},logger3=new Logger4("Consumer"),Consumer=class extends EnhancedEventEmitter{constructor({id:e,localId:t,producerId:i,rtpReceiver:r,track:s,rtpParameters:n,appData:a}){super(),this._closed=!1,this._observer=new EnhancedEventEmitter,logger3.debug("constructor()"),this._id=e,this._localId=t,this._producerId=i,this._rtpReceiver=r,this._track=s,this._rtpParameters=n,this._paused=!s.enabled,this._appData=a,this._onTrackEnded=this._onTrackEnded.bind(this),this._handleTrack()}get id(){return this._id}get localId(){return this._localId}get producerId(){return this._producerId}get closed(){return this._closed}get kind(){return this._track.kind}get rtpReceiver(){return this._rtpReceiver}get track(){return this._track}get rtpParameters(){return this._rtpParameters}get paused(){return this._paused}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(logger3.debug("close()"),this._closed=!0,this._destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(logger3.debug("transportClosed()"),this._closed=!0,this._destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}async getStats(){if(this._closed)throw new InvalidStateError("closed");return this.safeEmitAsPromise("@getstats")}pause(){logger3.debug("pause()"),this._closed?logger3.error("pause() | Consumer closed"):(this._paused=!0,this._track.enabled=!1,this._observer.safeEmit("pause"))}resume(){logger3.debug("resume()"),this._closed?logger3.error("resume() | Consumer closed"):(this._paused=!1,this._track.enabled=!0,this._observer.safeEmit("resume"))}_onTrackEnded(){logger3.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}_handleTrack(){this._track.addEventListener("ended",this._onTrackEnded)}_destroyTrack(){try{this._track.removeEventListener("ended",this._onTrackEnded),this._track.stop()}catch(e){}}},logger4=new Logger4("DataProducer"),DataProducer=class extends EnhancedEventEmitter{constructor({id:e,dataChannel:t,sctpStreamParameters:i,appData:r}){super(),this._closed=!1,this._observer=new EnhancedEventEmitter,logger4.debug("constructor()"),this._id=e,this._dataChannel=t,this._sctpStreamParameters=i,this._appData=r,this._handleDataChannel()}get id(){return this._id}get closed(){return this._closed}get sctpStreamParameters(){return this._sctpStreamParameters}get readyState(){return this._dataChannel.readyState}get label(){return this._dataChannel.label}get protocol(){return this._dataChannel.protocol}get bufferedAmount(){return this._dataChannel.bufferedAmount}get bufferedAmountLowThreshold(){return this._dataChannel.bufferedAmountLowThreshold}set bufferedAmountLowThreshold(e){this._dataChannel.bufferedAmountLowThreshold=e}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(logger4.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(logger4.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}send(e){if(logger4.debug("send()"),this._closed)throw new InvalidStateError("closed");this._dataChannel.send(e)}_handleDataChannel(){this._dataChannel.addEventListener("open",(()=>{this._closed||(logger4.debug('DataChannel "open" event'),this.safeEmit("open"))})),this._dataChannel.addEventListener("error",(e=>{if(this._closed)return;let{error:t}=e;t||(t=new Error("unknown DataChannel error")),"sctp-failure"===t.errorDetail?logger4.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",t.sctpCauseCode,t.message):logger4.error('DataChannel "error" event: %o',t),this.safeEmit("error",t)})),this._dataChannel.addEventListener("close",(()=>{this._closed||(logger4.warn('DataChannel "close" event'),this._closed=!0,this.emit("@close"),this.safeEmit("close"))})),this._dataChannel.addEventListener("message",(()=>{this._closed||logger4.warn('DataChannel "message" event in a DataProducer, message discarded')})),this._dataChannel.addEventListener("bufferedamountlow",(()=>{this._closed||this.safeEmit("bufferedamountlow")}))}},logger5=new Logger4("DataConsumer"),DataConsumer=class extends EnhancedEventEmitter{constructor({id:e,dataProducerId:t,dataChannel:i,sctpStreamParameters:r,appData:s}){super(),this._closed=!1,this._observer=new EnhancedEventEmitter,logger5.debug("constructor()"),this._id=e,this._dataProducerId=t,this._dataChannel=i,this._sctpStreamParameters=r,this._appData=s,this._handleDataChannel()}get id(){return this._id}get dataProducerId(){return this._dataProducerId}get closed(){return this._closed}get sctpStreamParameters(){return this._sctpStreamParameters}get readyState(){return this._dataChannel.readyState}get label(){return this._dataChannel.label}get protocol(){return this._dataChannel.protocol}get binaryType(){return this._dataChannel.binaryType}set binaryType(e){this._dataChannel.binaryType=e}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(logger5.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(logger5.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}_handleDataChannel(){this._dataChannel.addEventListener("open",(()=>{this._closed||(logger5.debug('DataChannel "open" event'),this.safeEmit("open"))})),this._dataChannel.addEventListener("error",(e=>{if(this._closed)return;let{error:t}=e;t||(t=new Error("unknown DataChannel error")),"sctp-failure"===t.errorDetail?logger5.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",t.sctpCauseCode,t.message):logger5.error('DataChannel "error" event: %o',t),this.safeEmit("error",t)})),this._dataChannel.addEventListener("close",(()=>{this._closed||(logger5.warn('DataChannel "close" event'),this._closed=!0,this.emit("@close"),this.safeEmit("close"))})),this._dataChannel.addEventListener("message",(e=>{this._closed||this.safeEmit("message",e.data)}))}},logger6=new Logger4("Transport"),Transport=class extends EnhancedEventEmitter{constructor({direction:e,id:t,iceParameters:i,iceCandidates:r,dtlsParameters:s,sctpParameters:n,iceServers:a,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:l,appData:u,handlerFactory:d,extendedRtpCapabilities:p,canProduceByKind:h}){super(),this._closed=!1,this._connectionState="new",this._producers=new Map,this._consumers=new Map,this._dataProducers=new Map,this._dataConsumers=new Map,this._probatorConsumerCreated=!1,this._awaitQueue=new import_awaitqueue.AwaitQueue({ClosedErrorClass:InvalidStateError}),this._observer=new EnhancedEventEmitter,logger6.debug("constructor() [id:%s, direction:%s]",t,e),this._id=t,this._direction=e,this._extendedRtpCapabilities=p,this._canProduceByKind=h,this._maxSctpMessageSize=n?n.maxMessageSize:null,delete(c=clone(c,{})).iceServers,delete c.iceTransportPolicy,delete c.bundlePolicy,delete c.rtcpMuxPolicy,delete c.sdpSemantics,this._handler=d(),this._handler.run({direction:e,iceParameters:i,iceCandidates:r,dtlsParameters:s,sctpParameters:n,iceServers:a,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:l,extendedRtpCapabilities:p}),this._appData=u,this.pc=this._handler._pc,this._handleHandler()}get id(){return this._id}get closed(){return this._closed}get direction(){return this._direction}get handler(){return this._handler}get connectionState(){return this._connectionState}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){if(!this._closed){logger6.debug("close()"),this._closed=!0,this._awaitQueue.close(),this._handler.close();for(const e of this._producers.values())e.transportClosed();this._producers.clear();for(const e of this._consumers.values())e.transportClosed();this._consumers.clear();for(const e of this._dataProducers.values())e.transportClosed();this._dataProducers.clear();for(const e of this._dataConsumers.values())e.transportClosed();this._dataConsumers.clear(),this._observer.safeEmit("close")}}async getStats(){if(this._closed)throw new InvalidStateError("closed");return this._handler.getTransportStats()}async restartIce({iceParameters:e}){if(logger6.debug("restartIce()"),this._closed)throw new InvalidStateError("closed");if(!e)throw new TypeError("missing iceParameters");return this._awaitQueue.push((async()=>this._handler.restartIce(e)),"transport.restartIce()")}async updateIceServers({iceServers:e}={}){if(logger6.debug("updateIceServers()"),this._closed)throw new InvalidStateError("closed");if(!Array.isArray(e))throw new TypeError("missing iceServers");return this._awaitQueue.push((async()=>this._handler.updateIceServers(e)),"transport.updateIceServers()")}async produce({track:e,encodings:t,codecOptions:i,codec:r,stopTracks:s=!0,disableTrackOnPause:n=!0,zeroRtpOnPause:a=!1,appData:o={}}={}){if(logger6.debug("produce() [track:%o]",e),!e)throw new TypeError("missing track");if("send"!==this._direction)throw new UnsupportedError("not a sending Transport");if(!this._canProduceByKind[e.kind])throw new UnsupportedError(`cannot produce ${e.kind}`);if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(0===this.listenerCount("produce"))throw new TypeError('no "produce" listener set into this transport');if(o&&"object"!=typeof o)throw new TypeError("if given, appData must be an object");return this._awaitQueue.push((async()=>{let c;if(t&&!Array.isArray(t))throw TypeError("encodings must be an array");t&&0===t.length?c=void 0:t&&(c=t.map((e=>{const t={active:!0};return!1===e.active&&(t.active=!1),"boolean"==typeof e.dtx&&(t.dtx=e.dtx),"string"==typeof e.scalabilityMode&&(t.scalabilityMode=e.scalabilityMode),"number"==typeof e.scaleResolutionDownBy&&(t.scaleResolutionDownBy=e.scaleResolutionDownBy),"number"==typeof e.maxBitrate&&(t.maxBitrate=e.maxBitrate),"number"==typeof e.maxFramerate&&(t.maxFramerate=e.maxFramerate),"boolean"==typeof e.adaptivePtime&&(t.adaptivePtime=e.adaptivePtime),"string"==typeof e.priority&&(t.priority=e.priority),"string"==typeof e.networkPriority&&(t.networkPriority=e.networkPriority),t})));const{localId:l,rtpParameters:u,rtpSender:d}=await this._handler.send({track:e,encodings:c,codecOptions:i,codec:r});try{validateRtpParameters(u);const{id:t}=await this.safeEmitAsPromise("produce",{kind:e.kind,rtpParameters:u,appData:o}),i=new Producer({id:t,localId:l,rtpSender:d,track:e,rtpParameters:u,stopTracks:s,disableTrackOnPause:n,zeroRtpOnPause:a,appData:o});return this._producers.set(i.id,i),this._handleProducer(i),this._observer.safeEmit("newproducer",i),i}catch(e){throw this._handler.stopSending(l).catch((()=>{})),e}}),"transport.produce()").catch((t=>{if(s)try{e.stop()}catch(e){}throw t}))}async consume({id:e,producerId:t,kind:i,rtpParameters:r,appData:s={}}){if(logger6.debug("consume()"),r=clone(r,void 0),this._closed)throw new InvalidStateError("closed");if("recv"!==this._direction)throw new UnsupportedError("not a receiving Transport");if("string"!=typeof e)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("missing producerId");if("audio"!==i&&"video"!==i)throw new TypeError(`invalid kind '${i}'`);if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(s&&"object"!=typeof s)throw new TypeError("if given, appData must be an object");return this._awaitQueue.push((async()=>{if(!canReceive(r,this._extendedRtpCapabilities))throw new UnsupportedError("cannot consume this Producer");const{localId:n,rtpReceiver:a,track:o}=await this._handler.receive({trackId:e,kind:i,rtpParameters:r}),c=new Consumer({id:e,localId:n,producerId:t,rtpReceiver:a,track:o,rtpParameters:r,appData:s});if(this._consumers.set(c.id,c),this._handleConsumer(c),!this._probatorConsumerCreated&&"video"===i)try{const e=generateProbatorRtpParameters(c.rtpParameters);await this._handler.receive({trackId:"probator",kind:"video",rtpParameters:e}),logger6.debug("consume() | Consumer for RTP probation created"),this._probatorConsumerCreated=!0}catch(e){logger6.error("consume() | failed to create Consumer for RTP probation:%o",e)}return this._observer.safeEmit("newconsumer",c),c}),"transport.consume()")}async produceData({ordered:e=!0,maxPacketLifeTime:t,maxRetransmits:i,priority:r="low",label:s="",protocol:n="",appData:a={}}={}){if(logger6.debug("produceData()"),"send"!==this._direction)throw new UnsupportedError("not a sending Transport");if(!this._maxSctpMessageSize)throw new UnsupportedError("SCTP not enabled by remote Transport");if(!["very-low","low","medium","high"].includes(r))throw new TypeError("wrong priority");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(0===this.listenerCount("producedata"))throw new TypeError('no "producedata" listener set into this transport');if(a&&"object"!=typeof a)throw new TypeError("if given, appData must be an object");return(t||i)&&(e=!1),this._awaitQueue.push((async()=>{const{dataChannel:o,sctpStreamParameters:c}=await this._handler.sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,priority:r,label:s,protocol:n});validateSctpStreamParameters(c);const{id:l}=await this.safeEmitAsPromise("producedata",{sctpStreamParameters:c,label:s,protocol:n,appData:a}),u=new DataProducer({id:l,dataChannel:o,sctpStreamParameters:c,appData:a});return this._dataProducers.set(u.id,u),this._handleDataProducer(u),this._observer.safeEmit("newdataproducer",u),u}),"transport.produceData()")}async consumeData({id:e,dataProducerId:t,sctpStreamParameters:i,label:r="",protocol:s="",appData:n={}}){if(logger6.debug("consumeData()"),i=clone(i,void 0),this._closed)throw new InvalidStateError("closed");if("recv"!==this._direction)throw new UnsupportedError("not a receiving Transport");if(!this._maxSctpMessageSize)throw new UnsupportedError("SCTP not enabled by remote Transport");if("string"!=typeof e)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("missing dataProducerId");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(n&&"object"!=typeof n)throw new TypeError("if given, appData must be an object");return validateSctpStreamParameters(i),this._awaitQueue.push((async()=>{const{dataChannel:a}=await this._handler.receiveDataChannel({sctpStreamParameters:i,label:r,protocol:s}),o=new DataConsumer({id:e,dataProducerId:t,dataChannel:a,sctpStreamParameters:i,appData:n});return this._dataConsumers.set(o.id,o),this._handleDataConsumer(o),this._observer.safeEmit("newdataconsumer",o),o}),"transport.consumeData()")}_handleHandler(){const e=this._handler;e.on("@connect",(({dtlsParameters:e},t,i)=>{this._closed?i(new InvalidStateError("closed")):this.safeEmit("connect",{dtlsParameters:e},t,i)})),e.on("@connectionstatechange",(e=>{e!==this._connectionState&&(logger6.debug("connection state changed to %s",e),this._connectionState=e,this._closed||this.safeEmit("connectionstatechange",e))}))}_handleProducer(e){e.on("@close",(()=>{this._producers.delete(e.id),this._closed||this._awaitQueue.push((async()=>this._handler.stopSending(e.localId)),"producer @close event").catch((e=>logger6.warn("producer.close() failed:%o",e)))})),e.on("@replacetrack",((t,i,r)=>{this._awaitQueue.push((async()=>this._handler.replaceTrack(e.localId,t)),"producer @replacetrack event").then(i).catch(r)})),e.on("@setmaxspatiallayer",((t,i,r)=>{this._awaitQueue.push((async()=>this._handler.setMaxSpatialLayer(e.localId,t)),"producer @setmaxspatiallayer event").then(i).catch(r)})),e.on("@setrtpencodingparameters",((t,i,r)=>{this._awaitQueue.push((async()=>this._handler.setRtpEncodingParameters(e.localId,t)),"producer @setrtpencodingparameters event").then(i).catch(r)})),e.on("@getstats",((t,i)=>{if(this._closed)return i(new InvalidStateError("closed"));this._handler.getSenderStats(e.localId).then(t).catch(i)}))}_handleConsumer(e){e.on("@close",(()=>{this._consumers.delete(e.id),this._closed||this._awaitQueue.push((async()=>this._handler.stopReceiving(e.localId)),"consumer @close event").catch((()=>{}))})),e.on("@getstats",((t,i)=>{if(this._closed)return i(new InvalidStateError("closed"));this._handler.getReceiverStats(e.localId).then(t).catch(i)}))}_handleDataProducer(e){e.on("@close",(()=>{this._dataProducers.delete(e.id)}))}_handleDataConsumer(e){e.on("@close",(()=>{this._dataConsumers.delete(e.id)}))}},sdpTransform4=__toESM(require_lib3()),sdpTransform2=__toESM(require_lib3());function extractRtpCapabilities({sdpObject:e}){const t=new Map,i=[];let r=!1,s=!1;for(const n of e.media){const e=n.type;switch(e){case"audio":if(r)continue;r=!0;break;case"video":if(s)continue;s=!0;break;default:continue}for(const i of n.rtp){const r={kind:e,mimeType:`${e}/${i.codec}`,preferredPayloadType:i.payload,clockRate:i.rate,channels:i.encoding,parameters:{},rtcpFeedback:[]};t.set(r.preferredPayloadType,r)}for(const e of n.fmtp||[]){const i=sdpTransform2.parseParams(e.config),r=t.get(e.payload);r&&(i&&i.hasOwnProperty("profile-level-id")&&(i["profile-level-id"]=String(i["profile-level-id"])),r.parameters=i)}for(const e of n.rtcpFb||[]){const i=t.get(e.payload);if(!i)continue;const r={type:e.type,parameter:e.subtype};r.parameter||delete r.parameter,i.rtcpFeedback.push(r)}for(const t of n.ext||[]){if(t["encrypt-uri"])continue;const r={kind:e,uri:t.uri,preferredId:t.value};i.push(r)}}return{codecs:Array.from(t.values()),headerExtensions:i}}function extractDtlsParameters({sdpObject:e}){const t=(e.media||[]).find((e=>e.iceUfrag&&0!==e.port));if(!t)throw new Error("no active media section found");const i=t.fingerprint||e.fingerprint;let r;switch(t.setup){case"active":r="client";break;case"passive":r="server";break;case"actpass":r="auto"}return{role:r,fingerprints:[{algorithm:i.type,value:i.hash}]}}function getCname({offerMediaObject:e}){const t=(e.ssrcs||[]).find((e=>"cname"===e.attribute));return t?t.value:""}function applyCodecParameters({offerRtpParameters:e,answerMediaObject:t}){for(const i of e.codecs){const e=i.mimeType.toLowerCase();if("audio/opus"!==e)continue;if(!(t.rtp||[]).find((e=>e.payload===i.payloadType)))continue;t.fmtp=t.fmtp||[];let r=t.fmtp.find((e=>e.payload===i.payloadType));r||(r={payload:i.payloadType,config:""},t.fmtp.push(r));const s=sdpTransform2.parseParams(r.config);switch(e){case"audio/opus":{const e=i.parameters["sprop-stereo"];void 0!==e&&(s.stereo=e?1:0);break}}r.config="";for(const e of Object.keys(s))r.config&&(r.config+=";"),r.config+=`${e}=${s[e]}`}}function getRtpEncodings({offerMediaObject:e}){const t=new Set;for(const i of e.ssrcs||[]){const e=i.id;t.add(e)}if(0===t.size)throw new Error("no a=ssrc lines found");const i=new Map;for(const r of e.ssrcGroups||[]){if("FID"!==r.semantics)continue;let[e,s]=r.ssrcs.split(/\s+/);e=Number(e),s=Number(s),t.has(e)&&(t.delete(e),t.delete(s),i.set(e,s))}for(const e of t)i.set(e,null);const r=[];for(const[e,t]of i){const i={ssrc:e};t&&(i.rtx={ssrc:t}),r.push(i)}return r}function addLegacySimulcast({offerMediaObject:e,numStreams:t}){if(t<=1)throw new TypeError("numStreams must be greater than 1");const i=(e.ssrcs||[]).find((e=>"msid"===e.attribute));if(!i)throw new Error("a=ssrc line with msid information not found");const[r,s]=i.value.split(" "),n=i.id;let a;(e.ssrcGroups||[]).some((e=>{if("FID"!==e.semantics)return!1;const t=e.ssrcs.split(/\s+/);return Number(t[0])===n&&(a=Number(t[1]),!0)}));const o=e.ssrcs.find((e=>"cname"===e.attribute));if(!o)throw new Error("a=ssrc line with cname information not found");const c=o.value,l=[],u=[];for(let e=0;e<t;++e)l.push(n+e),a&&u.push(a+e);e.ssrcGroups=[],e.ssrcs=[],e.ssrcGroups.push({semantics:"SIM",ssrcs:l.join(" ")});for(let t=0;t<l.length;++t){const i=l[t];e.ssrcs.push({id:i,attribute:"cname",value:c}),e.ssrcs.push({id:i,attribute:"msid",value:`${r} ${s}`})}for(let t=0;t<u.length;++t){const i=l[t],n=u[t];e.ssrcs.push({id:n,attribute:"cname",value:c}),e.ssrcs.push({id:n,attribute:"msid",value:`${r} ${s}`}),e.ssrcGroups.push({semantics:"FID",ssrcs:`${i} ${n}`})}}var HandlerInterface=class extends EnhancedEventEmitter{constructor(){super()}},sdpTransform3=__toESM(require_lib3()),MediaSection=class{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,planB:r=!1}){if(this._mediaObject={},this._planB=r,e&&this.setIceParameters(e),t){this._mediaObject.candidates=[];for(const e of t){const t={component:1};t.foundation=e.foundation,t.ip=e.ip,t.port=e.port,t.priority=e.priority,t.transport=e.protocol,t.type=e.type,e.tcpType&&(t.tcptype=e.tcpType),this._mediaObject.candidates.push(t)}this._mediaObject.endOfCandidates="end-of-candidates",this._mediaObject.iceOptions="renomination"}i&&this.setDtlsRole(i.role)}get mid(){return String(this._mediaObject.mid)}get closed(){return 0===this._mediaObject.port}getObject(){return this._mediaObject}setIceParameters(e){this._mediaObject.iceUfrag=e.usernameFragment,this._mediaObject.icePwd=e.password}disable(){this._mediaObject.direction="inactive",delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids}close(){this._mediaObject.direction="inactive",this._mediaObject.port=0,delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids,delete this._mediaObject.extmapAllowMixed}},AnswerMediaSection=class extends MediaSection{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,sctpParameters:r,plainRtpParameters:s,planB:n=!1,offerMediaObject:a,offerRtpParameters:o,answerRtpParameters:c,codecOptions:l,extmapAllowMixed:u=!1}){switch(super({iceParameters:e,iceCandidates:t,dtlsParameters:i,planB:n}),this._mediaObject.mid=String(a.mid),this._mediaObject.type=a.type,this._mediaObject.protocol=a.protocol,s?(this._mediaObject.connection={ip:s.ip,version:s.ipVersion},this._mediaObject.port=s.port):(this._mediaObject.connection={ip:"127.0.0.1",version:4},this._mediaObject.port=7),a.type){case"audio":case"video":this._mediaObject.direction="recvonly",this._mediaObject.rtp=[],this._mediaObject.rtcpFb=[],this._mediaObject.fmtp=[];for(const e of c.codecs){const t={payload:e.payloadType,codec:getCodecName(e),rate:e.clockRate};e.channels>1&&(t.encoding=e.channels),this._mediaObject.rtp.push(t);const i=clone(e.parameters,{});if(l){const{opusStereo:t,opusFec:r,opusDtx:s,opusMaxPlaybackRate:n,opusMaxAverageBitrate:a,opusPtime:c,videoGoogleStartBitrate:u,videoGoogleMaxBitrate:d,videoGoogleMinBitrate:p}=l,h=o.codecs.find((t=>t.payloadType===e.payloadType));switch(e.mimeType.toLowerCase()){case"audio/opus":void 0!==t&&(h.parameters["sprop-stereo"]=t?1:0,i.stereo=t?1:0),void 0!==r&&(h.parameters.useinbandfec=r?1:0,i.useinbandfec=r?1:0),void 0!==s&&(h.parameters.usedtx=s?1:0,i.usedtx=s?1:0),void 0!==n&&(i.maxplaybackrate=n),void 0!==a&&(i.maxaveragebitrate=a),void 0!==c&&(h.parameters.ptime=c,i.ptime=c);break;case"video/vp8":case"video/vp9":case"video/h264":case"video/h265":void 0!==u&&(i["x-google-start-bitrate"]=u),void 0!==d&&(i["x-google-max-bitrate"]=d),void 0!==p&&(i["x-google-min-bitrate"]=p)}}const r={payload:e.payloadType,config:""};for(const e of Object.keys(i))r.config&&(r.config+=";"),r.config+=`${e}=${i[e]}`;r.config&&this._mediaObject.fmtp.push(r);for(const t of e.rtcpFeedback)this._mediaObject.rtcpFb.push({payload:e.payloadType,type:t.type,subtype:t.parameter})}this._mediaObject.payloads=c.codecs.map((e=>e.payloadType)).join(" "),this._mediaObject.ext=[];for(const e of c.headerExtensions){(a.ext||[]).some((t=>t.uri===e.uri))&&this._mediaObject.ext.push({uri:e.uri,value:e.id})}if(u&&"extmap-allow-mixed"===a.extmapAllowMixed&&(this._mediaObject.extmapAllowMixed="extmap-allow-mixed"),a.simulcast){this._mediaObject.simulcast={dir1:"recv",list1:a.simulcast.list1},this._mediaObject.rids=[];for(const e of a.rids||[])"send"===e.direction&&this._mediaObject.rids.push({id:e.id,direction:"recv"})}else if(a.simulcast_03){this._mediaObject.simulcast_03={value:a.simulcast_03.value.replace(/send/g,"recv")},this._mediaObject.rids=[];for(const e of a.rids||[])"send"===e.direction&&this._mediaObject.rids.push({id:e.id,direction:"recv"})}this._mediaObject.rtcpMux="rtcp-mux",this._mediaObject.rtcpRsize="rtcp-rsize",this._planB&&"video"===this._mediaObject.type&&(this._mediaObject.xGoogleFlag="conference");break;case"application":"number"==typeof a.sctpPort?(this._mediaObject.payloads="webrtc-datachannel",this._mediaObject.sctpPort=r.port,this._mediaObject.maxMessageSize=r.maxMessageSize):a.sctpmap&&(this._mediaObject.payloads=r.port,this._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:r.port,maxMessageSize:r.maxMessageSize})}}setDtlsRole(e){switch(e){case"client":this._mediaObject.setup="active";break;case"server":this._mediaObject.setup="passive";break;case"auto":this._mediaObject.setup="actpass"}}},OfferMediaSection=class extends MediaSection{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,sctpParameters:r,plainRtpParameters:s,planB:n=!1,mid:a,kind:o,offerRtpParameters:c,streamId:l,trackId:u,oldDataChannelSpec:d=!1}){switch(super({iceParameters:e,iceCandidates:t,dtlsParameters:i,planB:n}),this._mediaObject.mid=String(a),this._mediaObject.type=o,s?(this._mediaObject.connection={ip:s.ip,version:s.ipVersion},this._mediaObject.protocol="RTP/AVP",this._mediaObject.port=s.port):(this._mediaObject.connection={ip:"127.0.0.1",version:4},this._mediaObject.protocol=r?"UDP/DTLS/SCTP":"UDP/TLS/RTP/SAVPF",this._mediaObject.port=7),o){case"audio":case"video":{this._mediaObject.direction="sendonly",this._mediaObject.rtp=[],this._mediaObject.rtcpFb=[],this._mediaObject.fmtp=[],this._planB||(this._mediaObject.msid=`${l||"-"} ${u}`);for(const e of c.codecs){const t={payload:e.payloadType,codec:getCodecName(e),rate:e.clockRate};e.channels>1&&(t.encoding=e.channels),this._mediaObject.rtp.push(t);const i={payload:e.payloadType,config:""};for(const t of Object.keys(e.parameters))i.config&&(i.config+=";"),i.config+=`${t}=${e.parameters[t]}`;i.config&&this._mediaObject.fmtp.push(i);for(const t of e.rtcpFeedback)this._mediaObject.rtcpFb.push({payload:e.payloadType,type:t.type,subtype:t.parameter})}this._mediaObject.payloads=c.codecs.map((e=>e.payloadType)).join(" "),this._mediaObject.ext=[];for(const e of c.headerExtensions)this._mediaObject.ext.push({uri:e.uri,value:e.id});this._mediaObject.rtcpMux="rtcp-mux",this._mediaObject.rtcpRsize="rtcp-rsize";const e=c.encodings[0],t=e.ssrc,i=e.rtx&&e.rtx.ssrc?e.rtx.ssrc:void 0;this._mediaObject.ssrcs=[],this._mediaObject.ssrcGroups=[],c.rtcp.cname&&this._mediaObject.ssrcs.push({id:t,attribute:"cname",value:c.rtcp.cname}),this._planB&&this._mediaObject.ssrcs.push({id:t,attribute:"msid",value:`${l||"-"} ${u}`}),i&&(c.rtcp.cname&&this._mediaObject.ssrcs.push({id:i,attribute:"cname",value:c.rtcp.cname}),this._planB&&this._mediaObject.ssrcs.push({id:i,attribute:"msid",value:`${l||"-"} ${u}`}),this._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:`${t} ${i}`}));break}case"application":d?(this._mediaObject.payloads=r.port,this._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:r.port,maxMessageSize:r.maxMessageSize}):(this._mediaObject.payloads="webrtc-datachannel",this._mediaObject.sctpPort=r.port,this._mediaObject.maxMessageSize=r.maxMessageSize)}}setDtlsRole(e){this._mediaObject.setup="actpass"}planBReceive({offerRtpParameters:e,streamId:t,trackId:i}){const r=e.encodings[0],s=r.ssrc,n=r.rtx&&r.rtx.ssrc?r.rtx.ssrc:void 0;e.rtcp.cname&&this._mediaObject.ssrcs.push({id:s,attribute:"cname",value:e.rtcp.cname}),this._mediaObject.ssrcs.push({id:s,attribute:"msid",value:`${t||"-"} ${i}`}),n&&(e.rtcp.cname&&this._mediaObject.ssrcs.push({id:n,attribute:"cname",value:e.rtcp.cname}),this._mediaObject.ssrcs.push({id:n,attribute:"msid",value:`${t||"-"} ${i}`}),this._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:`${s} ${n}`}))}planBStopReceiving({offerRtpParameters:e}){const t=e.encodings[0],i=t.ssrc,r=t.rtx&&t.rtx.ssrc?t.rtx.ssrc:void 0;this._mediaObject.ssrcs=this._mediaObject.ssrcs.filter((e=>e.id!==i&&e.id!==r)),r&&(this._mediaObject.ssrcGroups=this._mediaObject.ssrcGroups.filter((e=>e.ssrcs!==`${i} ${r}`)))}};function getCodecName(e){const t=new RegExp("^(audio|video)/(.+)","i").exec(e.mimeType);if(!t)throw new TypeError("invalid codec.mimeType");return t[2]}var logger7=new Logger4("RemoteSdp"),RemoteSdp=class{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,sctpParameters:r,plainRtpParameters:s,planB:n=!1}){if(this._mediaSections=[],this._midToIndex=new Map,this._iceParameters=e,this._iceCandidates=t,this._dtlsParameters=i,this._sctpParameters=r,this._plainRtpParameters=s,this._planB=n,this._sdpObject={version:0,origin:{address:"0.0.0.0",ipVer:4,netType:"IN",sessionId:1e4,sessionVersion:0,username:"mediasoup-client"},name:"-",timing:{start:0,stop:0},media:[]},e&&e.iceLite&&(this._sdpObject.icelite="ice-lite"),i){this._sdpObject.msidSemantic={semantic:"WMS",token:"*"};const e=this._dtlsParameters.fingerprints.length;this._sdpObject.fingerprint={type:i.fingerprints[e-1].algorithm,hash:i.fingerprints[e-1].value},this._sdpObject.groups=[{type:"BUNDLE",mids:""}]}s&&(this._sdpObject.origin.address=s.ip,this._sdpObject.origin.ipVer=s.ipVersion)}updateIceParameters(e){logger7.debug("updateIceParameters() [iceParameters:%o]",e),this._iceParameters=e,this._sdpObject.icelite=e.iceLite?"ice-lite":void 0;for(const t of this._mediaSections)t.setIceParameters(e)}updateDtlsRole(e){logger7.debug("updateDtlsRole() [role:%s]",e),this._dtlsParameters.role=e;for(const t of this._mediaSections)t.setDtlsRole(e)}getNextMediaSectionIdx(){for(let e=0;e<this._mediaSections.length;++e){const t=this._mediaSections[e];if(t.closed)return{idx:e,reuseMid:t.mid}}return{idx:this._mediaSections.length}}send({offerMediaObject:e,reuseMid:t,offerRtpParameters:i,answerRtpParameters:r,codecOptions:s,extmapAllowMixed:n=!1}){const a=new AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,planB:this._planB,offerMediaObject:e,offerRtpParameters:i,answerRtpParameters:r,codecOptions:s,extmapAllowMixed:n});t?this._replaceMediaSection(a,t):this._midToIndex.has(a.mid)?this._replaceMediaSection(a):this._addMediaSection(a)}receive({mid:e,kind:t,offerRtpParameters:i,streamId:r,trackId:s}){const n=this._midToIndex.get(e);let a;if(void 0!==n&&(a=this._mediaSections[n]),a)a.planBReceive({offerRtpParameters:i,streamId:r,trackId:s}),this._replaceMediaSection(a);else{a=new OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,planB:this._planB,mid:e,kind:t,offerRtpParameters:i,streamId:r,trackId:s});const n=this._mediaSections.find((e=>e.closed));n?this._replaceMediaSection(a,n.mid):this._addMediaSection(a)}}disableMediaSection(e){const t=this._midToIndex.get(e);if(void 0===t)throw new Error(`no media section found with mid '${e}'`);this._mediaSections[t].disable()}closeMediaSection(e){const t=this._midToIndex.get(e);if(void 0===t)throw new Error(`no media section found with mid '${e}'`);const i=this._mediaSections[t];if(e===this._firstMid)return logger7.debug("closeMediaSection() | cannot close first media section, disabling it instead [mid:%s]",e),void this.disableMediaSection(e);i.close(),this._regenerateBundleMids()}planBStopReceiving({mid:e,offerRtpParameters:t}){const i=this._midToIndex.get(e);if(void 0===i)throw new Error(`no media section found with mid '${e}'`);const r=this._mediaSections[i];r.planBStopReceiving({offerRtpParameters:t}),this._replaceMediaSection(r)}sendSctpAssociation({offerMediaObject:e}){const t=new AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:e});this._addMediaSection(t)}receiveSctpAssociation({oldDataChannelSpec:e=!1}={}){const t=new OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,mid:"datachannel",kind:"application",oldDataChannelSpec:e});this._addMediaSection(t)}getSdp(){return this._sdpObject.origin.sessionVersion++,sdpTransform3.write(this._sdpObject)}_addMediaSection(e){this._firstMid||(this._firstMid=e.mid),this._mediaSections.push(e),this._midToIndex.set(e.mid,this._mediaSections.length-1),this._sdpObject.media.push(e.getObject()),this._regenerateBundleMids()}_replaceMediaSection(e,t){if("string"==typeof t){const i=this._midToIndex.get(t);if(void 0===i)throw new Error(`no media section found for reuseMid '${t}'`);const r=this._mediaSections[i];this._mediaSections[i]=e,this._midToIndex.delete(r.mid),this._midToIndex.set(e.mid,i),this._sdpObject.media[i]=e.getObject(),this._regenerateBundleMids()}else{const t=this._midToIndex.get(e.mid);if(void 0===t)throw new Error(`no media section found with mid '${e.mid}'`);this._mediaSections[t]=e,this._sdpObject.media[t]=e.getObject()}}_regenerateBundleMids(){this._dtlsParameters&&(this._sdpObject.groups[0].mids=this._mediaSections.filter((e=>!e.closed)).map((e=>e.mid)).join(" "))}},ScalabilityModeRegex=new RegExp("^[LS]([1-9]\\d{0,1})T([1-9]\\d{0,1})");function parse(e){const t=ScalabilityModeRegex.exec(e||"");return t?{spatialLayers:Number(t[1]),temporalLayers:Number(t[2])}:{spatialLayers:1,temporalLayers:1}}var logger8=new Logger4("Chrome74"),SCTP_NUM_STREAMS={OS:1024,MIS:1024},Chrome74=class e extends HandlerInterface{constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Chrome74"}close(){if(logger8.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger8.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=sdpTransform4.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger8.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger8.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger8.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger8.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger8.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger8.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger8.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger8.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger8.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&t.length>1&&t.forEach(((e,t)=>{e.rid=`r${t}`}));const s=clone(this._sendingRtpParametersByKind[e.kind],{});s.codecs=reduceCodecs(s.codecs,r);const n=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});n.codecs=reduceCodecs(n.codecs,r);const a=this._remoteSdp.getNextMediaSectionIdx(),o=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream],sendEncodings:t});let c,l=await this._pc.createOffer(),u=sdpTransform4.parse(l.sdp);this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:u});let d=!1;const p=parse((t||[{}])[0].scalabilityMode);t&&1===t.length&&p.spatialLayers>1&&"video/vp9"===s.codecs[0].mimeType.toLowerCase()&&(logger8.debug("send() | enabling legacy simulcast for VP9 SVC"),d=!0,u=sdpTransform4.parse(l.sdp),c=u.media[a.idx],addLegacySimulcast({offerMediaObject:c,numStreams:p.spatialLayers}),l={type:"offer",sdp:sdpTransform4.write(u)}),logger8.debug("send() | calling pc.setLocalDescription() [offer:%o]",l),await this._pc.setLocalDescription(l);const h=o.mid;if(s.mid=h,u=sdpTransform4.parse(this._pc.localDescription.sdp),c=u.media[a.idx],s.rtcp.cname=getCname({offerMediaObject:c}),t)if(1===t.length){let e=getRtpEncodings({offerMediaObject:c});Object.assign(e[0],t[0]),d&&(e=[e[0]]),s.encodings=e}else s.encodings=t;else s.encodings=getRtpEncodings({offerMediaObject:c});if(s.encodings.length>1&&("video/vp8"===s.codecs[0].mimeType.toLowerCase()||"video/h264"===s.codecs[0].mimeType.toLowerCase()))for(const e of s.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:c,reuseMid:a.reuseMid,offerRtpParameters:s,answerRtpParameters:n,codecOptions:i,extmapAllowMixed:!0});const m={type:"answer",sdp:this._remoteSdp.getSdp()};return logger8.debug("send() | calling pc.setRemoteDescription() [answer:%o]",m),await this._pc.setRemoteDescription(m),this._mapMidTransceiver.set(h,o),{localId:h,rtpParameters:s,rtpSender:o.sender}}async stopSending(e){this._assertSendDirection(),logger8.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid);const i=await this._pc.createOffer();logger8.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger8.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){this._assertSendDirection(),t?logger8.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger8.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this._assertSendDirection(),logger8.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(r)}async setRtpEncodingParameters(e,t){this._assertSendDirection(),logger8.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.sender.setParameters(r)}async getSenderStats(e){this._assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s,priority:n};logger8.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform4.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger8.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger8.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger8.debug("receive() [trackId:%s, kind:%s]",e,t);const r=i.mid||String(this._mapMidTransceiver.size);this._remoteSdp.receive({mid:r,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const s={type:"offer",sdp:this._remoteSdp.getSdp()};logger8.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let n=await this._pc.createAnswer();const a=sdpTransform4.parse(n.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:a.media.find((e=>String(e.mid)===r))}),n={type:"answer",sdp:sdpTransform4.write(a)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:a}),logger8.debug("receive() | calling pc.setLocalDescription() [answer:%o]",n),await this._pc.setLocalDescription(n);const o=this._pc.getTransceivers().find((e=>e.mid===r));if(!o)throw new Error("new RTCRtpTransceiver not found");return this._mapMidTransceiver.set(r,o),{localId:r,track:o.receiver.track,rtpReceiver:o.receiver}}async stopReceiving(e){this._assertRecvDirection(),logger8.debug("stopReceiving() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(t.mid);const i={type:"offer",sdp:this._remoteSdp.getSdp()};logger8.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);const r=await this._pc.createAnswer();logger8.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this._assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a,protocol:i};logger8.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger8.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform4.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger8.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform4.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform5=__toESM(require_lib3()),logger9=new Logger4("Chrome70"),SCTP_NUM_STREAMS2={OS:1024,MIS:1024},Chrome70=class e extends HandlerInterface{constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Chrome70"}close(){if(logger9.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger9.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=sdpTransform5.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger9.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS2}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger9.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger9.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger9.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger9.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger9.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger9.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger9.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger9.debug("send() [kind:%s, track.id:%s]",e.kind,e.id);const s=clone(this._sendingRtpParametersByKind[e.kind],{});s.codecs=reduceCodecs(s.codecs,r);const n=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});n.codecs=reduceCodecs(n.codecs,r);const a=this._remoteSdp.getNextMediaSectionIdx(),o=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream]});let c,l=await this._pc.createOffer(),u=sdpTransform5.parse(l.sdp);this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:u}),t&&t.length>1&&(logger9.debug("send() | enabling legacy simulcast"),u=sdpTransform5.parse(l.sdp),c=u.media[a.idx],addLegacySimulcast({offerMediaObject:c,numStreams:t.length}),l={type:"offer",sdp:sdpTransform5.write(u)});let d=!1;const p=parse((t||[{}])[0].scalabilityMode);if(t&&1===t.length&&p.spatialLayers>1&&"video/vp9"===s.codecs[0].mimeType.toLowerCase()&&(logger9.debug("send() | enabling legacy simulcast for VP9 SVC"),d=!0,u=sdpTransform5.parse(l.sdp),c=u.media[a.idx],addLegacySimulcast({offerMediaObject:c,numStreams:p.spatialLayers}),l={type:"offer",sdp:sdpTransform5.write(u)}),logger9.debug("send() | calling pc.setLocalDescription() [offer:%o]",l),await this._pc.setLocalDescription(l),t){logger9.debug("send() | applying given encodings");const e=o.sender.getParameters();for(let i=0;i<(e.encodings||[]).length;++i){const r=e.encodings[i],s=t[i];if(!s)break;e.encodings[i]=Object.assign(r,s)}await o.sender.setParameters(e)}const h=o.mid;if(s.mid=h,u=sdpTransform5.parse(this._pc.localDescription.sdp),c=u.media[a.idx],s.rtcp.cname=getCname({offerMediaObject:c}),s.encodings=getRtpEncodings({offerMediaObject:c}),t)for(let e=0;e<s.encodings.length;++e)t[e]&&Object.assign(s.encodings[e],t[e]);if(d&&(s.encodings=[s.encodings[0]]),s.encodings.length>1&&("video/vp8"===s.codecs[0].mimeType.toLowerCase()||"video/h264"===s.codecs[0].mimeType.toLowerCase()))for(const e of s.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:c,reuseMid:a.reuseMid,offerRtpParameters:s,answerRtpParameters:n,codecOptions:i});const m={type:"answer",sdp:this._remoteSdp.getSdp()};return logger9.debug("send() | calling pc.setRemoteDescription() [answer:%o]",m),await this._pc.setRemoteDescription(m),this._mapMidTransceiver.set(h,o),{localId:h,rtpParameters:s,rtpSender:o.sender}}async stopSending(e){this._assertSendDirection(),logger9.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid);const i=await this._pc.createOffer();logger9.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger9.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){this._assertSendDirection(),t?logger9.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger9.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this._assertSendDirection(),logger9.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(r)}async setRtpEncodingParameters(e,t){this._assertSendDirection(),logger9.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.sender.setParameters(r)}async getSenderStats(e){this._assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s,priority:n};logger9.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS2.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform5.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger9.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger9.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger9.debug("receive() [trackId:%s, kind:%s]",e,t);const r=i.mid||String(this._mapMidTransceiver.size);this._remoteSdp.receive({mid:r,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const s={type:"offer",sdp:this._remoteSdp.getSdp()};logger9.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let n=await this._pc.createAnswer();const a=sdpTransform5.parse(n.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:a.media.find((e=>String(e.mid)===r))}),n={type:"answer",sdp:sdpTransform5.write(a)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:a}),logger9.debug("receive() | calling pc.setLocalDescription() [answer:%o]",n),await this._pc.setLocalDescription(n);const o=this._pc.getTransceivers().find((e=>e.mid===r));if(!o)throw new Error("new RTCRtpTransceiver not found");return this._mapMidTransceiver.set(r,o),{localId:r,track:o.receiver.track,rtpReceiver:o.receiver}}async stopReceiving(e){this._assertRecvDirection(),logger9.debug("stopReceiving() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(t.mid);const i={type:"offer",sdp:this._remoteSdp.getSdp()};logger9.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);const r=await this._pc.createAnswer();logger9.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this._assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:a,protocol:i};logger9.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger9.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform5.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger9.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform5.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform6=__toESM(require_lib3());function getRtpEncodings2({offerMediaObject:e,track:t}){let i;const r=new Set;for(const s of e.ssrcs||[]){if("msid"!==s.attribute)continue;if(s.value.split(" ")[1]===t.id){const e=s.id;r.add(e),i||(i=e)}}if(0===r.size)throw new Error(`a=ssrc line with msid information not found [track.id:${t.id}]`);const s=new Map;for(const t of e.ssrcGroups||[]){if("FID"!==t.semantics)continue;let[e,i]=t.ssrcs.split(/\s+/);e=Number(e),i=Number(i),r.has(e)&&(r.delete(e),r.delete(i),s.set(e,i))}for(const e of r)s.set(e,null);const n=[];for(const[e,t]of s){const i={ssrc:e};t&&(i.rtx={ssrc:t}),n.push(i)}return n}function addLegacySimulcast2({offerMediaObject:e,track:t,numStreams:i}){if(i<=1)throw new TypeError("numStreams must be greater than 1");let r,s,n;if(!(e.ssrcs||[]).find((e=>{if("msid"!==e.attribute)return!1;return e.value.split(" ")[1]===t.id&&(r=e.id,n=e.value.split(" ")[0],!0)})))throw new Error(`a=ssrc line with msid information not found [track.id:${t.id}]`);(e.ssrcGroups||[]).some((e=>{if("FID"!==e.semantics)return!1;const t=e.ssrcs.split(/\s+/);return Number(t[0])===r&&(s=Number(t[1]),!0)}));const a=e.ssrcs.find((e=>"cname"===e.attribute&&e.id===r));if(!a)throw new Error(`a=ssrc line with cname information not found [track.id:${t.id}]`);const o=a.value,c=[],l=[];for(let e=0;e<i;++e)c.push(r+e),s&&l.push(s+e);e.ssrcGroups=e.ssrcGroups||[],e.ssrcs=e.ssrcs||[],e.ssrcGroups.push({semantics:"SIM",ssrcs:c.join(" ")});for(let i=0;i<c.length;++i){const r=c[i];e.ssrcs.push({id:r,attribute:"cname",value:o}),e.ssrcs.push({id:r,attribute:"msid",value:`${n} ${t.id}`})}for(let i=0;i<l.length;++i){const r=c[i],s=l[i];e.ssrcs.push({id:s,attribute:"cname",value:o}),e.ssrcs.push({id:s,attribute:"msid",value:`${n} ${t.id}`}),e.ssrcGroups.push({semantics:"FID",ssrcs:`${r} ${s}`})}}var logger10=new Logger4("Chrome67"),SCTP_NUM_STREAMS3={OS:1024,MIS:1024},Chrome67=class e extends HandlerInterface{constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdRtpSender=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Chrome67"}close(){if(logger10.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger10.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=sdpTransform6.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger10.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS3}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger10.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger10.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger10.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger10.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger10.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger10.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger10.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger10.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),r&&logger10.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addTrack(e,this._sendStream);let s,n=await this._pc.createOffer(),a=sdpTransform6.parse(n.sdp);const o=clone(this._sendingRtpParametersByKind[e.kind],{});o.codecs=reduceCodecs(o.codecs);const c=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(c.codecs=reduceCodecs(c.codecs),this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:a}),"video"===e.kind&&t&&t.length>1&&(logger10.debug("send() | enabling simulcast"),a=sdpTransform6.parse(n.sdp),s=a.media.find((e=>"video"===e.type)),addLegacySimulcast2({offerMediaObject:s,track:e,numStreams:t.length}),n={type:"offer",sdp:sdpTransform6.write(a)}),logger10.debug("send() | calling pc.setLocalDescription() [offer:%o]",n),await this._pc.setLocalDescription(n),a=sdpTransform6.parse(this._pc.localDescription.sdp),s=a.media.find((t=>t.type===e.kind)),o.rtcp.cname=getCname({offerMediaObject:s}),o.encodings=getRtpEncodings2({offerMediaObject:s,track:e}),t)for(let e=0;e<o.encodings.length;++e)t[e]&&Object.assign(o.encodings[e],t[e]);if(o.encodings.length>1&&"video/vp8"===o.codecs[0].mimeType.toLowerCase())for(const e of o.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:s,offerRtpParameters:o,answerRtpParameters:c,codecOptions:i});const l={type:"answer",sdp:this._remoteSdp.getSdp()};logger10.debug("send() | calling pc.setRemoteDescription() [answer:%o]",l),await this._pc.setRemoteDescription(l);const u=String(this._nextSendLocalId);this._nextSendLocalId++;const d=this._pc.getSenders().find((t=>t.track===e));return this._mapSendLocalIdRtpSender.set(u,d),{localId:u,rtpParameters:o,rtpSender:d}}async stopSending(e){this._assertSendDirection(),logger10.debug("stopSending() [localId:%s]",e);const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");this._pc.removeTrack(t),t.track&&this._sendStream.removeTrack(t.track),this._mapSendLocalIdRtpSender.delete(e);const i=await this._pc.createOffer();logger10.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void logger10.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger10.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){this._assertSendDirection(),t?logger10.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger10.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const r=i.track;await i.replaceTrack(t),r&&this._sendStream.removeTrack(r),t&&this._sendStream.addTrack(t)}async setMaxSpatialLayer(e,t){this._assertSendDirection(),logger10.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const r=i.getParameters();r.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.setParameters(r)}async setRtpEncodingParameters(e,t){this._assertSendDirection(),logger10.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const r=i.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.setParameters(r)}async getSenderStats(e){this._assertSendDirection();const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");return t.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s,priority:n};logger10.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS3.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform6.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger10.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger10.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger10.debug("receive() [trackId:%s, kind:%s]",e,t);const r=e,s=t;this._remoteSdp.receive({mid:s,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const n={type:"offer",sdp:this._remoteSdp.getSdp()};logger10.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",n),await this._pc.setRemoteDescription(n);let a=await this._pc.createAnswer();const o=sdpTransform6.parse(a.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:o.media.find((e=>String(e.mid)===s))}),a={type:"answer",sdp:sdpTransform6.write(o)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:o}),logger10.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);const c=this._pc.getReceivers().find((e=>e.track&&e.track.id===r));if(!c)throw new Error("new RTCRtpReceiver not");return this._mapRecvLocalIdInfo.set(r,{mid:s,rtpParameters:i,rtpReceiver:c}),{localId:r,track:c.track,rtpReceiver:c}}async stopReceiving(e){this._assertRecvDirection(),logger10.debug("stopReceiving() [localId:%s]",e);const{mid:t,rtpParameters:i}=this._mapRecvLocalIdInfo.get(e)||{};this._mapRecvLocalIdInfo.delete(e),this._remoteSdp.planBStopReceiving({mid:t,offerRtpParameters:i});const r={type:"offer",sdp:this._remoteSdp.getSdp()};logger10.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",r),await this._pc.setRemoteDescription(r);const s=await this._pc.createAnswer();logger10.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s)}async getReceiverStats(e){this._assertRecvDirection();const{rtpReceiver:t}=this._mapRecvLocalIdInfo.get(e)||{};if(!t)throw new Error("associated RTCRtpReceiver not found");return t.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:a,protocol:i};logger10.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger10.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform6.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger10.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform6.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform7=__toESM(require_lib3()),logger11=new Logger4("Chrome55"),SCTP_NUM_STREAMS4={OS:1024,MIS:1024},Chrome55=class e extends HandlerInterface{constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdTrack=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Chrome55"}close(){if(logger11.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger11.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=sdpTransform7.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger11.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS4}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger11.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger11.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger11.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger11.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger11.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger11.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger11.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger11.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),r&&logger11.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addStream(this._sendStream);let s,n=await this._pc.createOffer(),a=sdpTransform7.parse(n.sdp);const o=clone(this._sendingRtpParametersByKind[e.kind],{});o.codecs=reduceCodecs(o.codecs);const c=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(c.codecs=reduceCodecs(c.codecs),this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:a}),"video"===e.kind&&t&&t.length>1&&(logger11.debug("send() | enabling simulcast"),a=sdpTransform7.parse(n.sdp),s=a.media.find((e=>"video"===e.type)),addLegacySimulcast2({offerMediaObject:s,track:e,numStreams:t.length}),n={type:"offer",sdp:sdpTransform7.write(a)}),logger11.debug("send() | calling pc.setLocalDescription() [offer:%o]",n),await this._pc.setLocalDescription(n),a=sdpTransform7.parse(this._pc.localDescription.sdp),s=a.media.find((t=>t.type===e.kind)),o.rtcp.cname=getCname({offerMediaObject:s}),o.encodings=getRtpEncodings2({offerMediaObject:s,track:e}),t)for(let e=0;e<o.encodings.length;++e)t[e]&&Object.assign(o.encodings[e],t[e]);if(o.encodings.length>1&&"video/vp8"===o.codecs[0].mimeType.toLowerCase())for(const e of o.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:s,offerRtpParameters:o,answerRtpParameters:c,codecOptions:i});const l={type:"answer",sdp:this._remoteSdp.getSdp()};logger11.debug("send() | calling pc.setRemoteDescription() [answer:%o]",l),await this._pc.setRemoteDescription(l);const u=String(this._nextSendLocalId);return this._nextSendLocalId++,this._mapSendLocalIdTrack.set(u,e),{localId:u,rtpParameters:o}}async stopSending(e){this._assertSendDirection(),logger11.debug("stopSending() [localId:%s]",e);const t=this._mapSendLocalIdTrack.get(e);if(!t)throw new Error("track not found");this._mapSendLocalIdTrack.delete(e),this._sendStream.removeTrack(t),this._pc.addStream(this._sendStream);const i=await this._pc.createOffer();logger11.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void logger11.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger11.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){throw new UnsupportedError("not implemented")}async setMaxSpatialLayer(e,t){throw new UnsupportedError(" not implemented")}async setRtpEncodingParameters(e,t){throw new UnsupportedError("not supported")}async getSenderStats(e){throw new UnsupportedError("not implemented")}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s,priority:n};logger11.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS4.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform7.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger11.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger11.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger11.debug("receive() [trackId:%s, kind:%s]",e,t);const r=e,s=t,n=i.rtcp.cname;this._remoteSdp.receive({mid:s,kind:t,offerRtpParameters:i,streamId:n,trackId:e});const a={type:"offer",sdp:this._remoteSdp.getSdp()};logger11.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",a),await this._pc.setRemoteDescription(a);let o=await this._pc.createAnswer();const c=sdpTransform7.parse(o.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:c.media.find((e=>String(e.mid)===s))}),o={type:"answer",sdp:sdpTransform7.write(c)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:c}),logger11.debug("receive() | calling pc.setLocalDescription() [answer:%o]",o),await this._pc.setLocalDescription(o);const l=this._pc.getRemoteStreams().find((e=>e.id===n)).getTrackById(r);if(!l)throw new Error("remote track not found");return this._mapRecvLocalIdInfo.set(r,{mid:s,rtpParameters:i}),{localId:r,track:l}}async stopReceiving(e){this._assertRecvDirection(),logger11.debug("stopReceiving() [localId:%s]",e);const{mid:t,rtpParameters:i}=this._mapRecvLocalIdInfo.get(e)||{};this._mapRecvLocalIdInfo.delete(e),this._remoteSdp.planBStopReceiving({mid:t,offerRtpParameters:i});const r={type:"offer",sdp:this._remoteSdp.getSdp()};logger11.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",r),await this._pc.setRemoteDescription(r);const s=await this._pc.createAnswer();logger11.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s)}async getReceiverStats(e){throw new UnsupportedError("not implemented")}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:a,protocol:i};logger11.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger11.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform7.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger11.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform7.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform8=__toESM(require_lib3()),logger12=new Logger4("Firefox60"),SCTP_NUM_STREAMS5={OS:16,MIS:2048},Firefox60=class e extends HandlerInterface{constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Firefox60"}close(){if(logger12.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger12.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),t=document.createElement("canvas");t.getContext("2d");const i=t.captureStream().getVideoTracks()[0];try{e.addTransceiver("audio",{direction:"sendrecv"});const r=e.addTransceiver(i,{direction:"sendrecv"}),s=r.sender.getParameters(),n=[{rid:"r0",maxBitrate:1e5},{rid:"r1",maxBitrate:5e5}];s.encodings=n,await r.sender.setParameters(s);const a=await e.createOffer();try{t.remove()}catch(e){}try{i.stop()}catch(e){}try{e.close()}catch(e){}const o=sdpTransform8.parse(a.sdp);return extractRtpCapabilities({sdpObject:o})}catch(r){try{t.remove()}catch(e){}try{i.stop()}catch(e){}try{e.close()}catch(e){}throw r}}async getNativeSctpCapabilities(){return logger12.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS5}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger12.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){throw new UnsupportedError("not supported")}async restartIce(e){if(logger12.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger12.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger12.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger12.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger12.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger12.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&(t=clone(t,[])).length>1&&(t.forEach(((e,t)=>{e.rid=`r${t}`})),t.reverse());const s=clone(this._sendingRtpParametersByKind[e.kind],{});s.codecs=reduceCodecs(s.codecs,r);const n=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});n.codecs=reduceCodecs(n.codecs,r);const a=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream]});if(t){const e=a.sender.getParameters();e.encodings=t,await a.sender.setParameters(e)}const o=await this._pc.createOffer();let c=sdpTransform8.parse(o.sdp);this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:c}),logger12.debug("send() | calling pc.setLocalDescription() [offer:%o]",o),await this._pc.setLocalDescription(o);const l=a.mid;s.mid=l,c=sdpTransform8.parse(this._pc.localDescription.sdp);const u=c.media[c.media.length-1];if(s.rtcp.cname=getCname({offerMediaObject:u}),t)if(1===t.length){const e=getRtpEncodings({offerMediaObject:u});Object.assign(e[0],t[0]),s.encodings=e}else s.encodings=t.reverse();else s.encodings=getRtpEncodings({offerMediaObject:u});if(s.encodings.length>1&&("video/vp8"===s.codecs[0].mimeType.toLowerCase()||"video/h264"===s.codecs[0].mimeType.toLowerCase()))for(const e of s.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:u,offerRtpParameters:s,answerRtpParameters:n,codecOptions:i,extmapAllowMixed:!0});const d={type:"answer",sdp:this._remoteSdp.getSdp()};return logger12.debug("send() | calling pc.setRemoteDescription() [answer:%o]",d),await this._pc.setRemoteDescription(d),this._mapMidTransceiver.set(l,a),{localId:l,rtpParameters:s,rtpSender:a.sender}}async stopSending(e){logger12.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated transceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.disableMediaSection(t.mid);const i=await this._pc.createOffer();logger12.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger12.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){this._assertSendDirection(),t?logger12.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger12.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this._assertSendDirection(),logger12.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated transceiver not found");const r=i.sender.getParameters();t=r.encodings.length-1-t,r.encodings.forEach(((e,i)=>{e.active=i>=t})),await i.sender.setParameters(r)}async setRtpEncodingParameters(e,t){this._assertSendDirection(),logger12.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.sender.setParameters(r)}async getSenderStats(e){this._assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s,priority:n};logger12.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS5.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform8.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger12.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger12.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger12.debug("receive() [trackId:%s, kind:%s]",e,t);const r=i.mid||String(this._mapMidTransceiver.size);this._remoteSdp.receive({mid:r,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const s={type:"offer",sdp:this._remoteSdp.getSdp()};logger12.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let n=await this._pc.createAnswer();const a=sdpTransform8.parse(n.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:a.media.find((e=>String(e.mid)===r))}),n={type:"answer",sdp:sdpTransform8.write(a)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:a}),logger12.debug("receive() | calling pc.setLocalDescription() [answer:%o]",n),await this._pc.setLocalDescription(n);const o=this._pc.getTransceivers().find((e=>e.mid===r));if(!o)throw new Error("new RTCRtpTransceiver not found");return this._mapMidTransceiver.set(r,o),{localId:r,track:o.receiver.track,rtpReceiver:o.receiver}}async stopReceiving(e){this._assertRecvDirection(),logger12.debug("stopReceiving() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(t.mid);const i={type:"offer",sdp:this._remoteSdp.getSdp()};logger12.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);const r=await this._pc.createAnswer();logger12.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this._assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a,protocol:i};logger12.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger12.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform8.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger12.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform8.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform9=__toESM(require_lib3()),logger13=new Logger4("Safari12"),SCTP_NUM_STREAMS6={OS:1024,MIS:1024},Safari12=class e extends HandlerInterface{constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Safari12"}close(){if(logger13.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger13.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=sdpTransform9.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger13.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS6}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger13.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger13.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger13.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger13.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger13.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger13.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger13.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger13.debug("send() [kind:%s, track.id:%s]",e.kind,e.id);const s=clone(this._sendingRtpParametersByKind[e.kind],{});s.codecs=reduceCodecs(s.codecs,r);const n=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});n.codecs=reduceCodecs(n.codecs,r);const a=this._remoteSdp.getNextMediaSectionIdx(),o=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream]});let c,l=await this._pc.createOffer(),u=sdpTransform9.parse(l.sdp);this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:u}),t&&t.length>1&&(logger13.debug("send() | enabling legacy simulcast"),u=sdpTransform9.parse(l.sdp),c=u.media[a.idx],addLegacySimulcast({offerMediaObject:c,numStreams:t.length}),l={type:"offer",sdp:sdpTransform9.write(u)}),logger13.debug("send() | calling pc.setLocalDescription() [offer:%o]",l),await this._pc.setLocalDescription(l);const d=o.mid;if(s.mid=d,u=sdpTransform9.parse(this._pc.localDescription.sdp),c=u.media[a.idx],s.rtcp.cname=getCname({offerMediaObject:c}),s.encodings=getRtpEncodings({offerMediaObject:c}),t)for(let e=0;e<s.encodings.length;++e)t[e]&&Object.assign(s.encodings[e],t[e]);if(s.encodings.length>1&&("video/vp8"===s.codecs[0].mimeType.toLowerCase()||"video/h264"===s.codecs[0].mimeType.toLowerCase()))for(const e of s.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:c,reuseMid:a.reuseMid,offerRtpParameters:s,answerRtpParameters:n,codecOptions:i});const p={type:"answer",sdp:this._remoteSdp.getSdp()};return logger13.debug("send() | calling pc.setRemoteDescription() [answer:%o]",p),await this._pc.setRemoteDescription(p),this._mapMidTransceiver.set(d,o),{localId:d,rtpParameters:s,rtpSender:o.sender}}async stopSending(e){this._assertSendDirection(),logger13.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.closeMediaSection(t.mid);const i=await this._pc.createOffer();logger13.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger13.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){this._assertSendDirection(),t?logger13.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger13.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this._assertSendDirection(),logger13.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(r)}async setRtpEncodingParameters(e,t){this._assertSendDirection(),logger13.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.sender.setParameters(r)}async getSenderStats(e){this._assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s,priority:n};logger13.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS6.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform9.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger13.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger13.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger13.debug("receive() [trackId:%s, kind:%s]",e,t);const r=i.mid||String(this._mapMidTransceiver.size);this._remoteSdp.receive({mid:r,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const s={type:"offer",sdp:this._remoteSdp.getSdp()};logger13.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let n=await this._pc.createAnswer();const a=sdpTransform9.parse(n.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:a.media.find((e=>String(e.mid)===r))}),n={type:"answer",sdp:sdpTransform9.write(a)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:a}),logger13.debug("receive() | calling pc.setLocalDescription() [answer:%o]",n),await this._pc.setLocalDescription(n);const o=this._pc.getTransceivers().find((e=>e.mid===r));if(!o)throw new Error("new RTCRtpTransceiver not found");return this._mapMidTransceiver.set(r,o),{localId:r,track:o.receiver.track,rtpReceiver:o.receiver}}async stopReceiving(e){this._assertRecvDirection(),logger13.debug("stopReceiving() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(t.mid);const i={type:"offer",sdp:this._remoteSdp.getSdp()};logger13.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);const r=await this._pc.createAnswer();logger13.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){this._assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a,protocol:i};logger13.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger13.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform9.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger13.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform9.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform10=__toESM(require_lib3()),logger14=new Logger4("Safari11"),SCTP_NUM_STREAMS7={OS:1024,MIS:1024},Safari11=class e extends HandlerInterface{constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdRtpSender=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Safari11"}close(){if(logger14.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger14.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=sdpTransform10.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger14.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS7}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger14.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger14.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger14.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger14.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger14.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger14.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger14.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger14.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),r&&logger14.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addTrack(e,this._sendStream);let s,n=await this._pc.createOffer(),a=sdpTransform10.parse(n.sdp);const o=clone(this._sendingRtpParametersByKind[e.kind],{});o.codecs=reduceCodecs(o.codecs);const c=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(c.codecs=reduceCodecs(c.codecs),this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:a}),"video"===e.kind&&t&&t.length>1&&(logger14.debug("send() | enabling simulcast"),a=sdpTransform10.parse(n.sdp),s=a.media.find((e=>"video"===e.type)),addLegacySimulcast2({offerMediaObject:s,track:e,numStreams:t.length}),n={type:"offer",sdp:sdpTransform10.write(a)}),logger14.debug("send() | calling pc.setLocalDescription() [offer:%o]",n),await this._pc.setLocalDescription(n),a=sdpTransform10.parse(this._pc.localDescription.sdp),s=a.media.find((t=>t.type===e.kind)),o.rtcp.cname=getCname({offerMediaObject:s}),o.encodings=getRtpEncodings2({offerMediaObject:s,track:e}),t)for(let e=0;e<o.encodings.length;++e)t[e]&&Object.assign(o.encodings[e],t[e]);if(o.encodings.length>1&&"video/vp8"===o.codecs[0].mimeType.toLowerCase())for(const e of o.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:s,offerRtpParameters:o,answerRtpParameters:c,codecOptions:i});const l={type:"answer",sdp:this._remoteSdp.getSdp()};logger14.debug("send() | calling pc.setRemoteDescription() [answer:%o]",l),await this._pc.setRemoteDescription(l);const u=String(this._nextSendLocalId);this._nextSendLocalId++;const d=this._pc.getSenders().find((t=>t.track===e));return this._mapSendLocalIdRtpSender.set(u,d),{localId:u,rtpParameters:o,rtpSender:d}}async stopSending(e){this._assertSendDirection();const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");t.track&&this._sendStream.removeTrack(t.track),this._mapSendLocalIdRtpSender.delete(e);const i=await this._pc.createOffer();logger14.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void logger14.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger14.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){this._assertSendDirection(),t?logger14.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger14.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const r=i.track;await i.replaceTrack(t),r&&this._sendStream.removeTrack(r),t&&this._sendStream.addTrack(t)}async setMaxSpatialLayer(e,t){this._assertSendDirection(),logger14.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const r=i.getParameters();r.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.setParameters(r)}async setRtpEncodingParameters(e,t){this._assertSendDirection(),logger14.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const r=i.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.setParameters(r)}async getSenderStats(e){this._assertSendDirection();const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");return t.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s,priority:n};logger14.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS7.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform10.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger14.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger14.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger14.debug("receive() [trackId:%s, kind:%s]",e,t);const r=e,s=t;this._remoteSdp.receive({mid:s,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const n={type:"offer",sdp:this._remoteSdp.getSdp()};logger14.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",n),await this._pc.setRemoteDescription(n);let a=await this._pc.createAnswer();const o=sdpTransform10.parse(a.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:o.media.find((e=>String(e.mid)===s))}),a={type:"answer",sdp:sdpTransform10.write(o)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:o}),logger14.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);const c=this._pc.getReceivers().find((e=>e.track&&e.track.id===r));if(!c)throw new Error("new RTCRtpReceiver not");return this._mapRecvLocalIdInfo.set(r,{mid:s,rtpParameters:i,rtpReceiver:c}),{localId:r,track:c.track,rtpReceiver:c}}async stopReceiving(e){this._assertRecvDirection(),logger14.debug("stopReceiving() [localId:%s]",e);const{mid:t,rtpParameters:i}=this._mapRecvLocalIdInfo.get(e)||{};this._mapRecvLocalIdInfo.delete(e),this._remoteSdp.planBStopReceiving({mid:t,offerRtpParameters:i});const r={type:"offer",sdp:this._remoteSdp.getSdp()};logger14.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",r),await this._pc.setRemoteDescription(r);const s=await this._pc.createAnswer();logger14.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s)}async getReceiverStats(e){this._assertRecvDirection();const{rtpReceiver:t}=this._mapRecvLocalIdInfo.get(e)||{};if(!t)throw new Error("associated RTCRtpReceiver not found");return t.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a,protocol:i};logger14.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger14.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform10.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger14.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform10.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}};function getCapabilities(){const e=clone(RTCRtpReceiver.getCapabilities(),{});for(const t of e.codecs){if(t.channels=t.numChannels,delete t.numChannels,t.mimeType=t.mimeType||`${t.kind}/${t.name}`,t.parameters){const e=t.parameters;e.apt&&(e.apt=Number(e.apt)),e["packetization-mode"]&&(e["packetization-mode"]=Number(e["packetization-mode"]))}for(const e of t.rtcpFeedback||[])e.parameter||(e.parameter="")}return e}function mangleRtpParameters(e){const t=clone(e,{});t.mid&&(t.muxId=t.mid,delete t.mid);for(const e of t.codecs)e.channels&&(e.numChannels=e.channels,delete e.channels),e.mimeType&&!e.name&&(e.name=e.mimeType.split("/")[1]),delete e.mimeType;return t}var logger15=new Logger4("Edge11"),Edge11=class e extends HandlerInterface{constructor(){super(),this._rtpSenders=new Map,this._rtpReceivers=new Map,this._nextSendLocalId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"Edge11"}close(){logger15.debug("close()");try{this._iceGatherer.close()}catch(e){}try{this._iceTransport.stop()}catch(e){}try{this._dtlsTransport.stop()}catch(e){}for(const e of this._rtpSenders.values())try{e.stop()}catch(e){}for(const e of this._rtpReceivers.values())try{e.stop()}catch(e){}}async getNativeRtpCapabilities(){return logger15.debug("getNativeRtpCapabilities()"),getCapabilities()}async getNativeSctpCapabilities(){return logger15.debug("getNativeSctpCapabilities()"),{numStreams:{OS:0,MIS:0}}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger15.debug("run()"),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._remoteIceParameters=t,this._remoteIceCandidates=i,this._remoteDtlsParameters=r,this._cname=`CNAME-${generateRandomNumber()}`,this._setIceGatherer({iceServers:n,iceTransportPolicy:a}),this._setIceTransport(),this._setDtlsTransport()}async updateIceServers(e){throw new UnsupportedError("not supported")}async restartIce(e){if(logger15.debug("restartIce()"),this._remoteIceParameters=e,this._transportReady){logger15.debug("restartIce() | calling iceTransport.start()"),this._iceTransport.start(this._iceGatherer,e,"controlling");for(const e of this._remoteIceCandidates)this._iceTransport.addRemoteCandidate(e);this._iceTransport.addRemoteCandidate({})}}async getTransportStats(){return this._iceTransport.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){logger15.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),this._transportReady||await this._setupTransport({localDtlsRole:"server"}),logger15.debug("send() | calling new RTCRtpSender()");const s=new RTCRtpSender(e,this._dtlsTransport),n=clone(this._sendingRtpParametersByKind[e.kind],{});n.codecs=reduceCodecs(n.codecs,r);const a=n.codecs.some((e=>/.+\/rtx$/i.test(e.mimeType)));t||(t=[{}]);for(const e of t)e.ssrc=generateRandomNumber(),a&&(e.rtx={ssrc:generateRandomNumber()});n.encodings=t,n.rtcp={cname:this._cname,reducedSize:!0,mux:!0};const o=mangleRtpParameters(n);logger15.debug("send() | calling rtpSender.send() [params:%o]",o),await s.send(o);const c=String(this._nextSendLocalId);return this._nextSendLocalId++,this._rtpSenders.set(c,s),{localId:c,rtpParameters:n,rtpSender:s}}async stopSending(e){logger15.debug("stopSending() [localId:%s]",e);const t=this._rtpSenders.get(e);if(!t)throw new Error("RTCRtpSender not found");this._rtpSenders.delete(e);try{logger15.debug("stopSending() | calling rtpSender.stop()"),t.stop()}catch(e){throw logger15.warn("stopSending() | rtpSender.stop() failed:%o",e),e}}async replaceTrack(e,t){t?logger15.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):logger15.debug("replaceTrack() [localId:%s, no track]",e);const i=this._rtpSenders.get(e);if(!i)throw new Error("RTCRtpSender not found");i.setTrack(t)}async setMaxSpatialLayer(e,t){logger15.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._rtpSenders.get(e);if(!i)throw new Error("RTCRtpSender not found");const r=i.getParameters();r.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.setParameters(r)}async setRtpEncodingParameters(e,t){logger15.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._rtpSenders.get(e);if(!i)throw new Error("RTCRtpSender not found");const r=i.getParameters();r.encodings.forEach(((e,i)=>{r.encodings[i]={...e,...t}})),await i.setParameters(r)}async getSenderStats(e){const t=this._rtpSenders.get(e);if(!t)throw new Error("RTCRtpSender not found");return t.getStats()}async sendDataChannel(e){throw new UnsupportedError("not implemented")}async receive({trackId:e,kind:t,rtpParameters:i}){logger15.debug("receive() [trackId:%s, kind:%s]",e,t),this._transportReady||await this._setupTransport({localDtlsRole:"server"}),logger15.debug("receive() | calling new RTCRtpReceiver()");const r=new RTCRtpReceiver(this._dtlsTransport,t);r.addEventListener("error",(e=>{logger15.error('rtpReceiver "error" event [event:%o]',e)}));const s=mangleRtpParameters(i);logger15.debug("receive() | calling rtpReceiver.receive() [params:%o]",s),await r.receive(s);const n=e;return this._rtpReceivers.set(n,r),{localId:n,track:r.track,rtpReceiver:r}}async stopReceiving(e){logger15.debug("stopReceiving() [localId:%s]",e);const t=this._rtpReceivers.get(e);if(!t)throw new Error("RTCRtpReceiver not found");this._rtpReceivers.delete(e);try{logger15.debug("stopReceiving() | calling rtpReceiver.stop()"),t.stop()}catch(e){logger15.warn("stopReceiving() | rtpReceiver.stop() failed:%o",e)}}async getReceiverStats(e){const t=this._rtpReceivers.get(e);if(!t)throw new Error("RTCRtpReceiver not found");return t.getStats()}async receiveDataChannel(e){throw new UnsupportedError("not implemented")}_setIceGatherer({iceServers:e,iceTransportPolicy:t}){const i=new RTCIceGatherer({iceServers:e||[],gatherPolicy:t||"all"});i.addEventListener("error",(e=>{logger15.error('iceGatherer "error" event [event:%o]',e)}));try{i.gather()}catch(e){logger15.debug("_setIceGatherer() | iceGatherer.gather() failed: %s",e.toString())}this._iceGatherer=i}_setIceTransport(){const e=new RTCIceTransport(this._iceGatherer);e.addEventListener("statechange",(()=>{switch(e.state){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}})),e.addEventListener("icestatechange",(()=>{switch(e.state){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}})),e.addEventListener("candidatepairchange",(e=>{logger15.debug('iceTransport "candidatepairchange" event [pair:%o]',e.pair)})),this._iceTransport=e}_setDtlsTransport(){const e=new RTCDtlsTransport(this._iceTransport);e.addEventListener("statechange",(()=>{logger15.debug('dtlsTransport "statechange" event [state:%s]',e.state)})),e.addEventListener("dtlsstatechange",(()=>{logger15.debug('dtlsTransport "dtlsstatechange" event [state:%s]',e.state),"closed"===e.state&&this.emit("@connectionstatechange","closed")})),e.addEventListener("error",(e=>{logger15.error('dtlsTransport "error" event [event:%o]',e)})),this._dtlsTransport=e}async _setupTransport({localDtlsRole:e}){logger15.debug("_setupTransport()");const t=this._dtlsTransport.getLocalParameters();t.role=e,await this.safeEmitAsPromise("@connect",{dtlsParameters:t}),this._iceTransport.start(this._iceGatherer,this._remoteIceParameters,"controlling");for(const e of this._remoteIceCandidates)this._iceTransport.addRemoteCandidate(e);this._iceTransport.addRemoteCandidate({}),this._remoteDtlsParameters.fingerprints=this._remoteDtlsParameters.fingerprints.filter((e=>"sha-256"===e.algorithm||"sha-384"===e.algorithm||"sha-512"===e.algorithm)),this._dtlsTransport.start(this._remoteDtlsParameters),this._transportReady=!0}},sdpTransform11=__toESM(require_lib3()),logger16=new Logger4("ReactNative"),SCTP_NUM_STREAMS8={OS:1024,MIS:1024},ReactNative=class e extends HandlerInterface{constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdTrack=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}static createFactory(){return()=>new e}get name(){return"ReactNative"}close(){if(logger16.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){logger16.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=sdpTransform11.parse(t.sdp);return extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return logger16.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS8}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger16.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection({iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b",...o},c),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){logger16.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(logger16.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});logger16.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};logger16.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger16.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();logger16.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger16.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),r&&logger16.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addStream(this._sendStream);let s,n=await this._pc.createOffer(),a=sdpTransform11.parse(n.sdp);const o=clone(this._sendingRtpParametersByKind[e.kind],{});o.codecs=reduceCodecs(o.codecs);const c=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(c.codecs=reduceCodecs(c.codecs),this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:a}),"video"===e.kind&&t&&t.length>1&&(logger16.debug("send() | enabling simulcast"),a=sdpTransform11.parse(n.sdp),s=a.media.find((e=>"video"===e.type)),addLegacySimulcast2({offerMediaObject:s,track:e,numStreams:t.length}),n={type:"offer",sdp:sdpTransform11.write(a)}),logger16.debug("send() | calling pc.setLocalDescription() [offer:%o]",n),await this._pc.setLocalDescription(n),a=sdpTransform11.parse(this._pc.localDescription.sdp),s=a.media.find((t=>t.type===e.kind)),o.rtcp.cname=getCname({offerMediaObject:s}),o.encodings=getRtpEncodings2({offerMediaObject:s,track:e}),t)for(let e=0;e<o.encodings.length;++e)t[e]&&Object.assign(o.encodings[e],t[e]);if(o.encodings.length>1&&("video/vp8"===o.codecs[0].mimeType.toLowerCase()||"video/h264"===o.codecs[0].mimeType.toLowerCase()))for(const e of o.encodings)e.scalabilityMode="S1T3";this._remoteSdp.send({offerMediaObject:s,offerRtpParameters:o,answerRtpParameters:c,codecOptions:i});const l={type:"answer",sdp:this._remoteSdp.getSdp()};logger16.debug("send() | calling pc.setRemoteDescription() [answer:%o]",l),await this._pc.setRemoteDescription(l);const u=String(this._nextSendLocalId);return this._nextSendLocalId++,this._mapSendLocalIdTrack.set(u,e),{localId:u,rtpParameters:o}}async stopSending(e){this._assertSendDirection(),logger16.debug("stopSending() [localId:%s]",e);const t=this._mapSendLocalIdTrack.get(e);if(!t)throw new Error("track not found");this._mapSendLocalIdTrack.delete(e),this._sendStream.removeTrack(t),this._pc.addStream(this._sendStream);const i=await this._pc.createOffer();logger16.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void logger16.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger16.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r)}async replaceTrack(e,t){throw new UnsupportedError("not implemented")}async setMaxSpatialLayer(e,t){throw new UnsupportedError("not implemented")}async setRtpEncodingParameters(e,t){throw new UnsupportedError("not implemented")}async getSenderStats(e){throw new UnsupportedError("not implemented")}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s,priority:n};logger16.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS8.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform11.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger16.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger16.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger16.debug("receive() [trackId:%s, kind:%s]",e,t);const r=e,s=t;let n=i.rtcp.cname;logger16.debug("receive() | forcing a random remote streamId to avoid well known bug in react-native-webrtc"),n+=`-hack-${generateRandomNumber()}`,this._remoteSdp.receive({mid:s,kind:t,offerRtpParameters:i,streamId:n,trackId:e});const a={type:"offer",sdp:this._remoteSdp.getSdp()};logger16.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",a),await this._pc.setRemoteDescription(a);let o=await this._pc.createAnswer();const c=sdpTransform11.parse(o.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:c.media.find((e=>String(e.mid)===s))}),o={type:"answer",sdp:sdpTransform11.write(c)},this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:c}),logger16.debug("receive() | calling pc.setLocalDescription() [answer:%o]",o),await this._pc.setLocalDescription(o);const l=this._pc.getRemoteStreams().find((e=>e.id===n)).getTrackById(r);if(!l)throw new Error("remote track not found");return this._mapRecvLocalIdInfo.set(r,{mid:s,rtpParameters:i}),{localId:r,track:l}}async stopReceiving(e){this._assertRecvDirection(),logger16.debug("stopReceiving() [localId:%s]",e);const{mid:t,rtpParameters:i}=this._mapRecvLocalIdInfo.get(e)||{};this._mapRecvLocalIdInfo.delete(e),this._remoteSdp.planBStopReceiving({mid:t,offerRtpParameters:i});const r={type:"offer",sdp:this._remoteSdp.getSdp()};logger16.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",r),await this._pc.setRemoteDescription(r);const s=await this._pc.createAnswer();logger16.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s)}async getReceiverStats(e){throw new UnsupportedError("not implemented")}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:a,protocol:i};logger16.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger16.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform11.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger16.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform11.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},sdpTransform12=__toESM(require_lib3()),logger17=new Logger4("werift"),SCTP_NUM_STREAMS9={OS:1024,MIS:1024},Werift=class e extends HandlerInterface{constructor(e){super(),this.nativeRtpCapabilities=e,this._mapMidTransceiver=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1,this.nativeRtpCapabilities.headerExtensions||(this.nativeRtpCapabilities.headerExtensions={}),this.nativeRtpCapabilities.headerExtensions?.audio||(this.nativeRtpCapabilities.headerExtensions.audio=[]),this.nativeRtpCapabilities.headerExtensions?.video||(this.nativeRtpCapabilities.headerExtensions.video=[])}static createFactory(t){return()=>new e(t)}get name(){return"werift"}close(){if(logger17.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}async getNativeRtpCapabilities(){let e=96;const t=[...(this.nativeRtpCapabilities.codecs.video||[]).map((({mimeType:t,clockRate:i,rtcpFeedback:r,parameters:s})=>{const n=s?codecParametersFromString(s):{};for(const e of Object.keys(n))try{const t=Number(n[e]);Number.isNaN(t)||(n[e]=t)}catch(e){}return{kind:"video",mimeType:t,clockRate:i,rtcpFeedback:r,preferredPayloadType:e++,parameters:n}})),...(this.nativeRtpCapabilities.codecs.audio||[]).map((({mimeType:t,clockRate:i,channels:r})=>({kind:"audio",mimeType:t,clockRate:i,channels:r,preferredPayloadType:e++})))];let i=1;return{codecs:t,headerExtensions:[...(this.nativeRtpCapabilities.headerExtensions?.audio??[]).map((({uri:e})=>({uri:e,preferredId:i++}))),...(this.nativeRtpCapabilities.headerExtensions?.video??[]).map((({uri:e})=>({uri:e,preferredId:i++})))]}}async getNativeSctpCapabilities(){return logger17.debug("getNativeSctpCapabilities()"),{numStreams:SCTP_NUM_STREAMS9}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:l}){logger17.debug("run()"),this._direction=e,this._remoteSdp=new RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s}),this._sendingRtpParametersByKind={audio:getSendingRtpParameters("audio",l),video:getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:getSendingRemoteRtpParameters("audio",l),video:getSendingRemoteRtpParameters("video",l)};const u={iceServers:n||[],iceTransportPolicy:a||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...this.nativeRtpCapabilities,...o};logger17.debug("run() | calling new RTCPeerConnection() peerConfig",u),this._pc=new RTCPeerConnection2(u),this._pc.connectionStateChange.subscribe((e=>{switch(e){case"connecting":this.emit("@connectionstatechange","connecting");break;case"connected":this.emit("@connectionstatechange","connected")}}))}async updateIceServers(e){}async restartIce(e){}async getTransportStats(){}async send({track:e,encodings:t,codecOptions:i,codec:r}){this._assertSendDirection(),logger17.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&t.length>1&&t.forEach(((e,t)=>{e.rid=`r${t}`}));const s=clone(this._sendingRtpParametersByKind[e.kind],{});s.codecs=reduceCodecs(s.codecs,r);const n=clone(this._sendingRemoteRtpParametersByKind[e.kind],{});n.codecs=reduceCodecs(n.codecs,r);const a=this._remoteSdp.getNextMediaSectionIdx(),o=this._pc.addTransceiver(e,{direction:"sendonly"}),c=await this._pc.createOffer();let l,u=sdpTransform12.parse(c.sdp);this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:u}),logger17.debug("send() | calling pc.setLocalDescription() [offer:%o]",c),await this._pc.setLocalDescription(c);const d=o.mid;if(s.mid=d,u=sdpTransform12.parse(this._pc.localDescription.sdp),l=u.media[a.idx],s.rtcp.cname=getCname({offerMediaObject:l}),t)if(1===t.length){const e=getRtpEncodings({offerMediaObject:l});Object.assign(e[0],t[0]),s.encodings=e}else s.encodings=t;else s.encodings=getRtpEncodings({offerMediaObject:l});this._remoteSdp.send({offerMediaObject:l,reuseMid:a.reuseMid,offerRtpParameters:s,answerRtpParameters:n,codecOptions:i,extmapAllowMixed:!0});const p={type:"answer",sdp:this._remoteSdp.getSdp()};return logger17.debug("send() | calling pc.setRemoteDescription() [answer:%o]",p),await this._pc.setRemoteDescription(p),this._mapMidTransceiver.set(d,o),{localId:d,rtpParameters:s,rtpSender:o.sender}}async stopSending(e){}async replaceTrack(e,t){}async setMaxSpatialLayer(e,t){}async setRtpEncodingParameters(e,t){}async getSenderStats(e){}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:r,protocol:s,priority:n}){this._assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s,priority:n};logger17.debug("sendDataChannel() [options:%o]",a);const o=this._pc.createDataChannel(r||"",a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%SCTP_NUM_STREAMS9.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=sdpTransform12.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this._setupTransport({localDtlsRole:"server",localSdpObject:t}),logger17.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const r={type:"answer",sdp:this._remoteSdp.getSdp()};logger17.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",r),await this._pc.setRemoteDescription(r),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive({trackId:e,kind:t,rtpParameters:i}){this._assertRecvDirection(),logger17.debug("receive() [trackId:%s, kind:%s]",e,t);const r=i.mid||String(this._mapMidTransceiver.size);this._remoteSdp.receive({mid:r,kind:t,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:e});const s=new RTCSessionDescription(this._remoteSdp.getSdp(),"offer");logger17.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let n=await this._pc.createAnswer();const a=sdpTransform12.parse(n.sdp);applyCodecParameters({offerRtpParameters:i,answerMediaObject:a.media.find((e=>String(e.mid)===r))}),n=new RTCSessionDescription(sdpTransform12.write(a),"answer"),this._transportReady||await this._setupTransport({localDtlsRole:"client",localSdpObject:a}),logger17.debug("receive() | calling pc.setLocalDescription() [answer:%o]",n),await this._pc.setLocalDescription(n);const o=this._pc.getTransceivers().find((e=>e.mid===r));if(!o)throw new Error("new RTCRtpTransceiver not found");return this._mapMidTransceiver.set(r,o),{localId:r,track:o.receiver.tracks[0],rtpReceiver:o.receiver}}async stopReceiving(e){this._assertRecvDirection(),logger17.debug("stopReceiving() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(t.mid);const i=new RTCSessionDescription(this._remoteSdp.getSdp(),"offer");logger17.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",i),await this._pc.setRemoteDescription(i);const r=await this._pc.createAnswer();logger17.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",r),await this._pc.setLocalDescription(r)}async getReceiverStats(e){}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this._assertRecvDirection();const{streamId:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a}=e,o={negotiated:!0,id:r,ordered:s,maxPacketLifeTime:n,maxRetransmits:a,protocol:i};logger17.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t||"",o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};logger17.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=sdpTransform12.parse(t.sdp);await this._setupTransport({localDtlsRole:"client",localSdpObject:e})}logger17.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async _setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=sdpTransform12.parse(this._pc.localDescription.sdp));const i=extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await this.safeEmitAsPromise("@connect",{dtlsParameters:i}),this._transportReady=!0}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},logger18=new Logger4("Device");function detectDevice2(){if("object"==typeof navigator&&"ReactNative"===navigator.product)return"undefined"==typeof RTCPeerConnection?void logger18.warn("this._detectDevice() | unsupported ReactNative without RTCPeerConnection"):(logger18.debug("this._detectDevice() | ReactNative handler chosen"),"ReactNative");if("object"==typeof navigator&&"string"==typeof navigator.userAgent){const e=navigator.userAgent,t=import_bowser.default.getParser(e),i=t.getEngine();if(t.satisfies({chrome:">=74",chromium:">=74"}))return"Chrome74";if(t.satisfies({chrome:">=70",chromium:">=70"}))return"Chrome70";if(t.satisfies({chrome:">=67",chromium:">=67"}))return"Chrome67";if(t.satisfies({chrome:">=55",chromium:">=55"}))return"Chrome55";if(t.satisfies({firefox:">=60"}))return"Firefox60";if(t.satisfies({safari:">=12.0"})&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(t.satisfies({safari:">=11"}))return"Safari11";if(t.satisfies({"microsoft edge":">=11"})&&t.satisfies({"microsoft edge":"<=18"}))return"Edge11";if(i.name&&"blink"===i.name.toLowerCase()){const t=e.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);if(t){const e=Number(t[1]);return e>=74?"Chrome74":e>=70?"Chrome70":e>=67?"Chrome67":"Chrome55"}return"Chrome74"}return logger18.warn("this._detectDevice() | browser not supported [name:%s, version:%s]",t.getBrowserName(),t.getBrowserVersion()),"werift"}return"werift"}var Device=class{constructor(e,{handlerName:t,handlerFactory:i,Handler:r}={}){if(this._loaded=!1,this._observer=new EnhancedEventEmitter,logger18.debug("constructor()"),r){if(logger18.warn("constructor() | Handler option is DEPRECATED, use handlerName or handlerFactory instead"),"string"!=typeof r)throw new TypeError("non string Handler option no longer supported, use handlerFactory instead");t=r}if(t&&i)throw new TypeError("just one of handlerName or handlerInterface can be given");if(i)this._handlerFactory=i;else{if(t)logger18.debug("constructor() | handler given: %s",t);else{if(!(t=detectDevice2()))throw new UnsupportedError("device not supported");logger18.debug("constructor() | detected handler: %s",t)}switch(t){case"Chrome74":this._handlerFactory=Chrome74.createFactory();break;case"Chrome70":this._handlerFactory=Chrome70.createFactory();break;case"Chrome67":this._handlerFactory=Chrome67.createFactory();break;case"Chrome55":this._handlerFactory=Chrome55.createFactory();break;case"Firefox60":this._handlerFactory=Firefox60.createFactory();break;case"Safari12":this._handlerFactory=Safari12.createFactory();break;case"Safari11":this._handlerFactory=Safari11.createFactory();break;case"Edge11":this._handlerFactory=Edge11.createFactory();break;case"ReactNative":this._handlerFactory=ReactNative.createFactory();break;case"werift":this._handlerFactory=Werift.createFactory(e);break;default:throw new TypeError(`unknown handlerName "${t}"`)}}const s=this._handlerFactory();this._handlerName=s.name,s.close(),this._extendedRtpCapabilities=void 0,this._recvRtpCapabilities=void 0,this._canProduceByKind={audio:!1,video:!1},this._sctpCapabilities=void 0}get handlerName(){return this._handlerName}get loaded(){return this._loaded}get rtpCapabilities(){if(!this._loaded)throw new InvalidStateError("not loaded");return this._recvRtpCapabilities}get sctpCapabilities(){if(!this._loaded)throw new InvalidStateError("not loaded");return this._sctpCapabilities}get observer(){return this._observer}async load({routerRtpCapabilities:e}){let t;logger18.debug("load() [routerRtpCapabilities:%o]",e),e=clone(e,void 0);try{if(this._loaded)throw new InvalidStateError("already loaded");validateRtpCapabilities(e),t=this._handlerFactory();const i=await t.getNativeRtpCapabilities();logger18.debug("load() | got native RTP capabilities:%o",i),validateRtpCapabilities(i),this._extendedRtpCapabilities=getExtendedRtpCapabilities(i,e),logger18.debug("load() | got extended RTP capabilities:%o",this._extendedRtpCapabilities),this._canProduceByKind.audio=canSend("audio",this._extendedRtpCapabilities),this._canProduceByKind.video=canSend("video",this._extendedRtpCapabilities),this._recvRtpCapabilities=getRecvRtpCapabilities(this._extendedRtpCapabilities),validateRtpCapabilities(this._recvRtpCapabilities),logger18.debug("load() | got receiving RTP capabilities:%o",this._recvRtpCapabilities),this._sctpCapabilities=await t.getNativeSctpCapabilities(),logger18.debug("load() | got native SCTP capabilities:%o",this._sctpCapabilities),validateSctpCapabilities(this._sctpCapabilities),logger18.debug("load() succeeded"),this._loaded=!0,t.close()}catch(e){throw t&&t.close(),e}}canProduce(e){if(!this._loaded)throw new InvalidStateError("not loaded");if("audio"!==e&&"video"!==e)throw new TypeError(`invalid kind "${e}"`);return this._canProduceByKind[e]}createSendTransport({id:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,appData:l={}}){return logger18.debug("createSendTransport()"),this._createTransport({direction:"send",id:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,appData:l})}createRecvTransport({id:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,appData:l={}}){return logger18.debug("createRecvTransport()"),this._createTransport({direction:"recv",id:e,iceParameters:t,iceCandidates:i,dtlsParameters:r,sctpParameters:s,iceServers:n,iceTransportPolicy:a,additionalSettings:o,proprietaryConstraints:c,appData:l})}_createTransport({direction:e,id:t,iceParameters:i,iceCandidates:r,dtlsParameters:s,sctpParameters:n,iceServers:a,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:l,appData:u={}}){if(!this._loaded)throw new InvalidStateError("not loaded");if("string"!=typeof t)throw new TypeError("missing id");if("object"!=typeof i)throw new TypeError("missing iceParameters");if(!Array.isArray(r))throw new TypeError("missing iceCandidates");if("object"!=typeof s)throw new TypeError("missing dtlsParameters");if(n&&"object"!=typeof n)throw new TypeError("wrong sctpParameters");if(u&&"object"!=typeof u)throw new TypeError("if given, appData must be an object");const d=new Transport({direction:e,id:t,iceParameters:i,iceCandidates:r,dtlsParameters:s,sctpParameters:n,iceServers:a,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:l,appData:u,handlerFactory:this._handlerFactory,extendedRtpCapabilities:this._extendedRtpCapabilities,canProduceByKind:this._canProduceByKind});return this._observer.safeEmit("newtransport",d),d}},import_crypto=require("crypto"),import_jspack=__toESM(require_jspack());function random16(){return import_jspack.jspack.Unpack("!H",(0,import_crypto.randomBytes)(2))[0]}function random32(){return import_jspack.jspack.Unpack("!L",(0,import_crypto.randomBytes)(4))[0]}var BitWriter=class{constructor(e){this.bitLength=e,__publicField(this,"value",0)}set(e,t,i){return i&=(1<<e)-1,this.value|=i<<this.bitLength-e-t,this}get buffer(){const e=Math.ceil(this.bitLength/8),t=Buffer.alloc(e);return t.writeUIntBE(this.value,0,e),t}},BitWriter2=class{constructor(e){if(this.bitLength=e,__publicField(this,"_value",0n),__publicField(this,"offset",0n),e>32)throw new Error}set(e,t=1){let i=BigInt(e);const r=BigInt(t);return i&=(1n<<r)-1n,this._value|=i<<BigInt(this.bitLength)-r-this.offset,this.offset+=r,this}get value(){return Number(this._value)}get buffer(){const e=Math.ceil(this.bitLength/8),t=Buffer.alloc(e);return t.writeUIntBE(this.value,0,e),t}};function getBit(e,t,i=1){let r=e.toString(2).split("");r=[...Array(8-r.length).fill("0"),...r];const s=r.slice(t,t+i).join("");return Number.parseInt(s,2)}function paddingByte(e){const t=e.toString(2).split("");return[...[...Array(8-t.length)].map((()=>"0")),...t].join("")}function bufferWriter(e,t){return createBufferWriter(e)(t)}function createBufferWriter(e,t){const i=e.reduce(((e,t)=>e+t),0),r=t?Buffer.alloc(i):void 0;return t=>{const s=r||Buffer.alloc(i);let n=0;return t.forEach(((t,i)=>{const r=e[i];8===r?s.writeBigUInt64BE(t,n):s.writeUIntBE(t,n,r),n+=r})),s}}function bufferWriterLE(e,t){const i=e.reduce(((e,t)=>e+t),0),r=Buffer.alloc(i);let s=0;return t.forEach(((t,i)=>{const n=e[i];8===n?r.writeBigUInt64LE(t,s):r.writeUIntLE(t,s,n),s+=n})),r}function bufferReader(e,t){let i=0;return t.map((t=>{let r;return r=8===t?e.readBigUInt64BE(i):e.readUIntBE(i,t),i+=t,r}))}var BitStream=class{constructor(e){this.uint8Array=e,__publicField(this,"position",0),__publicField(this,"bitsPending",0)}writeBits(e,t){if(0==e)return this;let i;return t&=4294967295>>>32-e,this.bitsPending>0?this.bitsPending>e?(this.uint8Array[this.position-1]|=t<<this.bitsPending-e,i=e,this.bitsPending-=e):this.bitsPending==e?(this.uint8Array[this.position-1]|=t,i=e,this.bitsPending=0):(this.uint8Array[this.position-1]|=t>>e-this.bitsPending,i=this.bitsPending,this.bitsPending=0):(i=Math.min(8,e),this.bitsPending=8-i,this.uint8Array[this.position++]=t>>e-i<<this.bitsPending),(e-=i)>0&&this.writeBits(e,t),this}readBits(e){return this._readBits(e)}_readBits(e,t){if(void 0===t&&(t=0),0==e)return t;let i,r;if(this.bitsPending>0){const t=this.uint8Array[this.position-1]&255>>8-this.bitsPending;r=Math.min(this.bitsPending,e),this.bitsPending-=r,i=t>>this.bitsPending}else r=Math.min(8,e),this.bitsPending=8-r,i=this.uint8Array[this.position++]>>this.bitsPending;return t=t<<r|i,(e-=r)>0?this._readBits(e,t):t}seekTo(e){this.position=e/8|0,this.bitsPending=e%8,this.bitsPending>0&&(this.bitsPending=8-this.bitsPending,this.position++)}};function uint8Add(e,t){return e+t&255}function uint16Add(e,t){return e+t&65535}function uint32Add(e,t){return Number(BigInt(e)+BigInt(t)&0xffffffffn)}function uint24(e){return 16777215&e}function uint16Gt(e,t){return e<t&&t-e>32768||e>t&&e-t<32768}function uint16Gte(e,t){return e===t||uint16Gt(e,t)}function uint32Gt(e,t){const i=2147483648;return e<t&&t-e>i||e>t&&e-t<i}function uint32Gte(e,t){return e===t||uint32Gt(e,t)}var int=e=>Number.parseInt(e,10),import_dgram=require("dgram"),interfaceAddress=(e,t)=>t?t[e]:void 0;async function randomPort(e="udp4",t){const i=(0,import_dgram.createSocket)(e);setImmediate((()=>i.bind({port:0,address:interfaceAddress(e,t)}))),await new Promise((e=>{i.once("error",e),i.once("listening",e)}));const r=i.address()?.port;return await new Promise((e=>i.close((()=>e())))),r}async function findPort(e,t,i="udp4",r){let s;for(let n=e;n<=t;n++){const a=(0,import_dgram.createSocket)(i);setImmediate((()=>a.bind({port:n,address:interfaceAddress(i,r)})));if(await new Promise((e=>{a.once("error",(t=>e(t))),a.once("listening",(()=>e()))})))await new Promise((e=>a.close((()=>e()))));else if(s=a.address()?.port,await new Promise((e=>a.close((()=>e())))),e<=s&&s<=t)break}if(!s)throw new Error("port not found");return s}function normalizeFamilyNodeV18(e){return"IPv4"===e?4:"IPv6"===e?6:e}var import_debug2=__toESM(require_src3()),debug2=import_debug2.default.debug,Event3=class{constructor(){__publicField(this,"event",{stack:[],promiseStack:[],eventId:0}),__publicField(this,"ended",!1),__publicField(this,"onended"),__publicField(this,"onerror",(e=>{})),__publicField(this,"execute",((...e)=>{if(!this.ended){for(const t of this.event.stack)t.execute(...e);(async()=>{for(const t of this.event.promiseStack)await t.execute(...e)})().catch((e=>{this.onerror(e)}))}})),__publicField(this,"complete",(()=>{if(!this.ended){for(const e of this.event.stack)e.complete&&e.complete();this.allUnsubscribe(),this.ended=!0,this.onended&&(this.onended(),this.onended=void 0)}})),__publicField(this,"error",(e=>{if(!this.ended){for(const t of this.event.stack)t.error&&t.error(e);this.allUnsubscribe()}})),__publicField(this,"allUnsubscribe",(()=>{if(this.ended)throw new Error("event completed");this.event={stack:[],promiseStack:[],eventId:0}})),__publicField(this,"subscribe",((e,t,i)=>{const r=this.event.eventId;this.event.stack.push({execute:e,id:r,complete:t,error:i}),this.event.eventId++;const s=()=>{this.event.stack=this.event.stack.filter((e=>e.id!==r&&e))};return{unSubscribe:s,disposer:e=>{e.push(s)}}})),__publicField(this,"queuingSubscribe",((e,t,i)=>{if(this.ended)throw new Error("event completed");const r=this.event.eventId;this.event.promiseStack.push({execute:e,id:r,complete:t,error:i}),this.event.eventId++;const s=()=>{this.event.stack=this.event.stack.filter((e=>e.id!==r&&e))};return{unSubscribe:s,disposer:e=>{e.push(s)}}})),__publicField(this,"once",((e,t,i)=>{const r=this.subscribe(((...t)=>{r.unSubscribe(),e(...t)}),t,i)})),__publicField(this,"watch",((e,t)=>new Promise(((i,r)=>{const s=t&&setTimeout((()=>{r("Event watch timeout")}),t),{unSubscribe:n}=this.subscribe(((...t)=>{e(...t)&&(s&&clearTimeout(s),n(),i(t))}))})))),__publicField(this,"asPromise",(e=>new Promise(((t,i)=>{const r=e&&setTimeout((()=>{i("Event asPromise timeout")}),e);this.once(((...e)=>{r&&clearTimeout(r),t(e)}),(()=>{r&&clearTimeout(r),t([])}),(e=>{r&&clearTimeout(r),i(e)}))}))))}pipe(e){this.subscribe(((...t)=>{e.execute(...t)}))}get returnTrigger(){const{execute:e,error:t,complete:i}=this;return{execute:e,error:t,complete:i}}get returnListener(){const{subscribe:e,once:t,asPromise:i}=this;return{subscribe:e,once:t,asPromise:i}}get length(){return this.event.stack.length}},EventDisposer=class{constructor(){__publicField(this,"_disposer",[])}push(e){this._disposer.push(e)}dispose(){this._disposer.forEach((e=>e())),this._disposer=[]}},import_dgram2=require("dgram"),import_net=__toESM(require("net")),import_net2=require("net"),log4=debug2("werift-ice:packages/ice/src/transport.ts"),UdpTransport=class e{constructor(e,t={}){this.socketType=e,this.options=t,__publicField(this,"type","udp"),__publicField(this,"socket"),__publicField(this,"rinfo"),__publicField(this,"onData",(()=>{})),__publicField(this,"closed",!1),__publicField(this,"send",(async(e,t)=>{if(t&&!import_net.default.isIP(t[0]))return new Promise(((i,r)=>{this.socket.send(e,t[1],t[0],(s=>{s?(log4("send error",t,e),r(s)):i()}))}));t=t??[this.rinfo?.address,this.rinfo?.port],this.socket.send(e,t[1],t[0])})),__publicField(this,"close",(()=>new Promise((e=>{this.closed=!0,this.socket.once("close",e);try{this.socket.close()}catch(t){e()}})))),this.socket=(0,import_dgram2.createSocket)(e),this.socket.on("message",((e,t)=>{6===normalizeFamilyNodeV18(t.family)&&([t.address]=t.address.split("%")),this.rinfo=t;try{this.onData(e,[t.address,t.port])}catch(e){log4("onData error",e)}}))}static async init(t,i={}){const r=new e(t,i);return await r.init(),r}async init(){const e=interfaceAddress(this.socketType,this.options.interfaceAddresses);if(this.options.port)this.socket.bind({port:this.options.port,address:e});else if(this.options.portRange){const t=await findPort(this.options.portRange[0],this.options.portRange[1],this.socketType,this.options.interfaceAddresses);this.socket.bind({port:t,address:e})}else this.socket.bind({address:e});await new Promise((e=>this.socket.once("listening",e)))}get address(){return this.socket.address()}get host(){return this.socket.address().address}get port(){return this.socket.address().port}},TcpTransport=class e{constructor(e){this.addr=e,__publicField(this,"type","tcp"),__publicField(this,"connecting"),__publicField(this,"client"),__publicField(this,"onData",(()=>{})),__publicField(this,"closed",!1),__publicField(this,"send",(async(e,t)=>{await this.connecting,this.client.write(e,(e=>{e&&console.log("err",e)}))})),__publicField(this,"close",(async()=>{this.closed=!0,this.client.destroy()})),this.connect()}connect(){this.closed||(this.client&&this.client.destroy(),this.connecting=new Promise(((e,t)=>{try{this.client=(0,import_net2.connect)({port:this.addr[1],host:this.addr[0]},e)}catch(e){t(e)}})),this.client.on("data",(e=>{const t=[this.client.remoteAddress,this.client.remotePort];this.onData(e,t)})),this.client.on("end",(()=>{this.connect()})),this.client.on("error",(e=>{console.log("error",e)})))}async init(){await this.connecting}static async init(t){const i=new e(t);return await i.init(),i}get address(){return{}}},import_crypto4=require("crypto"),import_x509=__toESM(require_build2()),x509=__toESM(require_x509_cjs()),import_binary_data2=__toESM(require_src4()),SignatureAlgorithm={rsa_1:1,ecdsa_3:3},HashAlgorithm={sha256_4:4},CipherSuite={TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_49195:49195,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256_49199:49199},CipherSuiteList=Object.values(CipherSuite),NamedCurveAlgorithm={x25519_29:29,secp256r1_23:23},NamedCurveAlgorithmList=Object.values(NamedCurveAlgorithm),CurveType={named_curve_3:3},SignatureScheme={rsa_pkcs1_sha256:1025,ecdsa_secp256r1_sha256:1027},certificateTypes=[1,64],signatures=[{hash:HashAlgorithm.sha256_4,signature:SignatureAlgorithm.rsa_1},{hash:HashAlgorithm.sha256_4,signature:SignatureAlgorithm.ecdsa_3}],import_crypto3=require("crypto"),import_binary_data=__toESM(require_src4()),import_tweetnacl=__toESM(require_nacl_fast());function anumber(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function isBytes(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function abytes(e,...t){if(!isBytes(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ahash(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");anumber(e.outputLen),anumber(e.blockLen)}function aexists(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function aoutput(e,t){abytes(e);const i=t.outputLen;if(e.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}var nc=__toESM(require("node:crypto"),1),crypto2=nc&&"object"==typeof nc&&"webcrypto"in nc?nc.webcrypto:nc&&"object"==typeof nc&&"randomBytes"in nc?nc:void 0;function createView(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rotr(e,t){return e<<32-t|e>>>t}function utf8ToBytes(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){return"string"==typeof e&&(e=utf8ToBytes(e)),abytes(e),e}function concatBytes(...e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];abytes(r),t+=r.length}const i=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const s=e[t];i.set(s,r),r+=s.length}return i}var Hash=class{clone(){return this._cloneInto()}};function wrapConstructor(e){const t=t=>e().update(toBytes(t)).digest(),i=e();return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=()=>e(),t}function randomBytes2(e=32){if(crypto2&&"function"==typeof crypto2.getRandomValues)return crypto2.getRandomValues(new Uint8Array(e));if(crypto2&&"function"==typeof crypto2.randomBytes)return crypto2.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(e,t,i,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,i,r);const s=BigInt(32),n=BigInt(4294967295),a=Number(i>>s&n),o=Number(i&n),c=r?4:0,l=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+l,o,r)}function Chi(e,t,i){return e&t^~e&i}function Maj(e,t,i){return e&t^e&i^t&i}var HashMD=class extends Hash{constructor(e,t,i,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){aexists(this);const{view:t,buffer:i,blockLen:r}=this,s=(e=toBytes(e)).length;for(let n=0;n<s;){const a=Math.min(r-this.pos,s-n);if(a!==r)i.set(e.subarray(n,n+a),this.pos),this.pos+=a,n+=a,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=createView(e);for(;r<=s-n;n+=r)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){aexists(this),aoutput(e,this),this.finished=!0;const{buffer:t,view:i,blockLen:r,isLE:s}=this;let{pos:n}=this;t[n++]=128,this.buffer.subarray(n).fill(0),this.padOffset>r-n&&(this.process(i,0),n=0);for(let e=n;e<r;e++)t[e]=0;setBigUint64(i,r-8,BigInt(8*this.length),s),this.process(i,0);const a=createView(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=o/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)a.setUint32(4*e,l[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:i,length:r,finished:s,destroyed:n,pos:a}=this;return e.length=r,e.pos=a,e.finished=s,e.destroyed=n,r%t&&e.buffer.set(i),e}},SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64),SHA256=class extends HashMD{constructor(){super(64,32,8,!1),this.A=0|SHA256_IV[0],this.B=0|SHA256_IV[1],this.C=0|SHA256_IV[2],this.D=0|SHA256_IV[3],this.E=0|SHA256_IV[4],this.F=0|SHA256_IV[5],this.G=0|SHA256_IV[6],this.H=0|SHA256_IV[7]}get(){const{A:e,B:t,C:i,D:r,E:s,F:n,G:a,H:o}=this;return[e,t,i,r,s,n,a,o]}set(e,t,i,r,s,n,a,o){this.A=0|e,this.B=0|t,this.C=0|i,this.D=0|r,this.E=0|s,this.F=0|n,this.G=0|a,this.H=0|o}process(e,t){for(let i=0;i<16;i++,t+=4)SHA256_W[i]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=SHA256_W[e-15],i=SHA256_W[e-2],r=rotr(t,7)^rotr(t,18)^t>>>3,s=rotr(i,17)^rotr(i,19)^i>>>10;SHA256_W[e]=s+SHA256_W[e-7]+r+SHA256_W[e-16]|0}let{A:i,B:r,C:s,D:n,E:a,F:o,G:c,H:l}=this;for(let e=0;e<64;e++){const t=l+(rotr(a,6)^rotr(a,11)^rotr(a,25))+Chi(a,o,c)+SHA256_K[e]+SHA256_W[e]|0,u=(rotr(i,2)^rotr(i,13)^rotr(i,22))+Maj(i,r,s)|0;l=c,c=o,o=a,a=n+t|0,n=s,s=r,r=i,i=t+u|0}i=i+this.A|0,r=r+this.B|0,s=s+this.C|0,n=n+this.D|0,a=a+this.E|0,o=o+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(i,r,s,n,a,o,c,l)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},sha256=wrapConstructor((()=>new SHA256)),HMAC=class extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ahash(e);const i=toBytes(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(i.length>r?e.create().update(i).digest():i);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),s.fill(0)}update(e){return aexists(this),this.iHash.update(e),this}digestInto(e){aexists(this),abytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:i,finished:r,destroyed:s,blockLen:n,outputLen:a}=this;return e.finished=r,e.destroyed=s,e.blockLen=n,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},hmac=(e,t,i)=>new HMAC(e,t).update(i).digest();hmac.create=(e,t)=>new HMAC(e,t);var utils_exports2={};__export(utils_exports2,{aInRange:()=>aInRange,abool:()=>abool,abytes:()=>abytes2,bitGet:()=>bitGet,bitLen:()=>bitLen,bitMask:()=>bitMask,bitSet:()=>bitSet,bytesToHex:()=>bytesToHex,bytesToNumberBE:()=>bytesToNumberBE,bytesToNumberLE:()=>bytesToNumberLE,concatBytes:()=>concatBytes2,createHmacDrbg:()=>createHmacDrbg,ensureBytes:()=>ensureBytes,equalBytes:()=>equalBytes,hexToBytes:()=>hexToBytes,hexToNumber:()=>hexToNumber,inRange:()=>inRange,isBytes:()=>isBytes2,memoized:()=>memoized,notImplemented:()=>notImplemented,numberToBytesBE:()=>numberToBytesBE,numberToBytesLE:()=>numberToBytesLE,numberToHexUnpadded:()=>numberToHexUnpadded,numberToVarBytesBE:()=>numberToVarBytesBE,utf8ToBytes:()=>utf8ToBytes2,validateObject:()=>validateObject});var _0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2);function isBytes2(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function abytes2(e){if(!isBytes2(e))throw new Error("Uint8Array expected")}function abool(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}var hexes=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function bytesToHex(e){abytes2(e);let t="";for(let i=0;i<e.length;i++)t+=hexes[e[i]];return t}function numberToHexUnpadded(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function hexToNumber(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?_0n:BigInt("0x"+e)}var asciis={_0:48,_9:57,A:65,F:70,a:97,f:102};function asciiToBase16(e){return e>=asciis._0&&e<=asciis._9?e-asciis._0:e>=asciis.A&&e<=asciis.F?e-(asciis.A-10):e>=asciis.a&&e<=asciis.f?e-(asciis.a-10):void 0}function hexToBytes(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,i=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(i);for(let t=0,s=0;t<i;t++,s+=2){const i=asciiToBase16(e.charCodeAt(s)),n=asciiToBase16(e.charCodeAt(s+1));if(void 0===i||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[t]=16*i+n}return r}function bytesToNumberBE(e){return hexToNumber(bytesToHex(e))}function bytesToNumberLE(e){return abytes2(e),hexToNumber(bytesToHex(Uint8Array.from(e).reverse()))}function numberToBytesBE(e,t){return hexToBytes(e.toString(16).padStart(2*t,"0"))}function numberToBytesLE(e,t){return numberToBytesBE(e,t).reverse()}function numberToVarBytesBE(e){return hexToBytes(numberToHexUnpadded(e))}function ensureBytes(e,t,i){let r;if("string"==typeof t)try{r=hexToBytes(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!isBytes2(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const s=r.length;if("number"==typeof i&&s!==i)throw new Error(e+" of length "+i+" expected, got "+s);return r}function concatBytes2(...e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];abytes2(r),t+=r.length}const i=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const s=e[t];i.set(s,r),r+=s.length}return i}function equalBytes(e,t){if(e.length!==t.length)return!1;let i=0;for(let r=0;r<e.length;r++)i|=e[r]^t[r];return 0===i}function utf8ToBytes2(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}var isPosBig=e=>"bigint"==typeof e&&_0n<=e;function inRange(e,t,i){return isPosBig(e)&&isPosBig(t)&&isPosBig(i)&&t<=e&&e<i}function aInRange(e,t,i,r){if(!inRange(t,i,r))throw new Error("expected valid "+e+": "+i+" <= n < "+r+", got "+t)}function bitLen(e){let t;for(t=0;e>_0n;e>>=_1n,t+=1);return t}function bitGet(e,t){return e>>BigInt(t)&_1n}function bitSet(e,t,i){return e|(i?_1n:_0n)<<BigInt(t)}var bitMask=e=>(_2n<<BigInt(e-1))-_1n,u8n=e=>new Uint8Array(e),u8fr=e=>Uint8Array.from(e);function createHmacDrbg(e,t,i){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof i)throw new Error("hmacFn must be a function");let r=u8n(e),s=u8n(e),n=0;const a=()=>{r.fill(1),s.fill(0),n=0},o=(...e)=>i(s,r,...e),c=(e=u8n())=>{s=o(u8fr([0]),e),r=o(),0!==e.length&&(s=o(u8fr([1]),e),r=o())},l=()=>{if(n++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const i=[];for(;e<t;){r=o();const t=r.slice();i.push(t),e+=r.length}return concatBytes2(...i)};return(e,t)=>{let i;for(a(),c(e);!(i=t(l()));)c();return a(),i}}var validatorFns={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||isBytes2(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function validateObject(e,t,i={}){const r=(t,i,r)=>{const s=validatorFns[i];if("function"!=typeof s)throw new Error("invalid validator function");const n=e[t];if(!(r&&void 0===n||s(n,e)))throw new Error("param "+String(t)+" is invalid. Expected "+i+", got "+n)};for(const[e,i]of Object.entries(t))r(e,i,!1);for(const[e,t]of Object.entries(i))r(e,t,!0);return e}var notImplemented=()=>{throw new Error("not implemented")};function memoized(e){const t=new WeakMap;return(i,...r)=>{const s=t.get(i);if(void 0!==s)return s;const n=e(i,...r);return t.set(i,n),n}}var _0n2=BigInt(0),_1n2=BigInt(1),_2n2=BigInt(2),_3n=BigInt(3),_4n=BigInt(4),_5n=BigInt(5),_8n=BigInt(8),_9n=BigInt(9),_16n=BigInt(16);function mod(e,t){const i=e%t;return i>=_0n2?i:t+i}function pow(e,t,i){if(t<_0n2)throw new Error("invalid exponent, negatives unsupported");if(i<=_0n2)throw new Error("invalid modulus");if(i===_1n2)return _0n2;let r=_1n2;for(;t>_0n2;)t&_1n2&&(r=r*e%i),e=e*e%i,t>>=_1n2;return r}function invert(e,t){if(e===_0n2)throw new Error("invert: expected non-zero number");if(t<=_0n2)throw new Error("invert: expected positive modulus, got "+t);let i=mod(e,t),r=t,s=_0n2,n=_1n2,a=_1n2,o=_0n2;for(;i!==_0n2;){const e=r/i,t=r%i,c=s-a*e,l=n-o*e;r=i,i=t,s=a,n=o,a=c,o=l}if(r!==_1n2)throw new Error("invert: does not exist");return mod(s,t)}function tonelliShanks(e){const t=(e-_1n2)/_2n2;let i,r,s;for(i=e-_1n2,r=0;i%_2n2===_0n2;i/=_2n2,r++);for(s=_2n2;s<e&&pow(s,t,e)!==e-_1n2;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const t=(e+_1n2)/_4n;return function(e,i){const r=e.pow(i,t);if(!e.eql(e.sqr(r),i))throw new Error("Cannot find square root");return r}}const n=(i+_1n2)/_2n2;return function(e,a){if(e.pow(a,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let o=r,c=e.pow(e.mul(e.ONE,s),i),l=e.pow(a,n),u=e.pow(a,i);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let i=e.sqr(u);t<o&&!e.eql(i,e.ONE);t++)i=e.sqr(i);const i=e.pow(c,_1n2<<BigInt(o-t-1));c=e.sqr(i),l=e.mul(l,i),u=e.mul(u,c),o=t}return l}}function FpSqrt(e){if(e%_4n===_3n){const t=(e+_1n2)/_4n;return function(e,i){const r=e.pow(i,t);if(!e.eql(e.sqr(r),i))throw new Error("Cannot find square root");return r}}if(e%_8n===_5n){const t=(e-_5n)/_8n;return function(e,i){const r=e.mul(i,_2n2),s=e.pow(r,t),n=e.mul(i,s),a=e.mul(e.mul(n,_2n2),s),o=e.mul(n,e.sub(a,e.ONE));if(!e.eql(e.sqr(o),i))throw new Error("Cannot find square root");return o}}return tonelliShanks(e)}var FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(e){return validateObject(e,FIELD_FIELDS.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function FpPow(e,t,i){if(i<_0n2)throw new Error("invalid exponent, negatives unsupported");if(i===_0n2)return e.ONE;if(i===_1n2)return t;let r=e.ONE,s=t;for(;i>_0n2;)i&_1n2&&(r=e.mul(r,s)),s=e.sqr(s),i>>=_1n2;return r}function FpInvertBatch(e,t){const i=new Array(t.length),r=t.reduce(((t,r,s)=>e.is0(r)?t:(i[s]=t,e.mul(t,r))),e.ONE),s=e.inv(r);return t.reduceRight(((t,r,s)=>e.is0(r)?t:(i[s]=e.mul(t,i[s]),e.mul(t,r))),s),i}function nLength(e,t){const i=void 0!==t?t:e.toString(2).length;return{nBitLength:i,nByteLength:Math.ceil(i/8)}}function Field(e,t,i=!1,r={}){if(e<=_0n2)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:n}=nLength(e,t);if(n>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let a;const o=Object.freeze({ORDER:e,isLE:i,BITS:s,BYTES:n,MASK:bitMask(s),ZERO:_0n2,ONE:_1n2,create:t=>mod(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return _0n2<=t&&t<e},is0:e=>e===_0n2,isOdd:e=>(e&_1n2)===_1n2,neg:t=>mod(-t,e),eql:(e,t)=>e===t,sqr:t=>mod(t*t,e),add:(t,i)=>mod(t+i,e),sub:(t,i)=>mod(t-i,e),mul:(t,i)=>mod(t*i,e),pow:(e,t)=>FpPow(o,e,t),div:(t,i)=>mod(t*invert(i,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>invert(t,e),sqrt:r.sqrt||(t=>(a||(a=FpSqrt(e)),a(o,t))),invertBatch:e=>FpInvertBatch(o,e),cmov:(e,t,i)=>i?t:e,toBytes:e=>i?numberToBytesLE(e,n):numberToBytesBE(e,n),fromBytes:e=>{if(e.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);return i?bytesToNumberLE(e):bytesToNumberBE(e)}});return Object.freeze(o)}function getFieldBytesLength(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function getMinHashLength(e){const t=getFieldBytesLength(e);return t+Math.ceil(t/2)}function mapHashToField(e,t,i=!1){const r=e.length,s=getFieldBytesLength(t),n=getMinHashLength(t);if(r<16||r<n||r>1024)throw new Error("expected "+n+"-1024 bytes of input, got "+r);const a=mod(i?bytesToNumberLE(e):bytesToNumberBE(e),t-_1n2)+_1n2;return i?numberToBytesLE(a,s):numberToBytesBE(a,s)}var _0n3=BigInt(0),_1n3=BigInt(1);function constTimeNegate(e,t){const i=t.negate();return e?i:t}function validateW(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function calcWOpts(e,t){validateW(e,t);return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}function validateMSMPoints(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,i)=>{if(!(e instanceof t))throw new Error("invalid point at index "+i)}))}function validateMSMScalars(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,i)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+i)}))}var pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(e){return pointWindowSizes.get(e)||1}function wNAF(e,t){return{constTimeNegate:constTimeNegate,hasPrecomputes:e=>1!==getW(e),unsafeLadder(t,i,r=e.ZERO){let s=t;for(;i>_0n3;)i&_1n3&&(r=r.add(s)),s=s.double(),i>>=_1n3;return r},precomputeWindow(e,i){const{windows:r,windowSize:s}=calcWOpts(i,t),n=[];let a=e,o=a;for(let e=0;e<r;e++){o=a,n.push(o);for(let e=1;e<s;e++)o=o.add(a),n.push(o);a=o.double()}return n},wNAF(i,r,s){const{windows:n,windowSize:a}=calcWOpts(i,t);let o=e.ZERO,c=e.BASE;const l=BigInt(2**i-1),u=2**i,d=BigInt(i);for(let e=0;e<n;e++){const t=e*a;let i=Number(s&l);s>>=d,i>a&&(i-=u,s+=_1n3);const n=t,p=t+Math.abs(i)-1,h=e%2!=0,m=i<0;0===i?c=c.add(constTimeNegate(h,r[n])):o=o.add(constTimeNegate(m,r[p]))}return{p:o,f:c}},wNAFUnsafe(i,r,s,n=e.ZERO){const{windows:a,windowSize:o}=calcWOpts(i,t),c=BigInt(2**i-1),l=2**i,u=BigInt(i);for(let e=0;e<a;e++){const t=e*o;if(s===_0n3)break;let i=Number(s&c);if(s>>=u,i>o&&(i-=l,s+=_1n3),0===i)continue;let a=r[t+Math.abs(i)-1];i<0&&(a=a.negate()),n=n.add(a)}return n},getPrecomputes(e,t,i){let r=pointPrecomputes.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&pointPrecomputes.set(t,i(r))),r},wNAFCached(e,t,i){const r=getW(e);return this.wNAF(r,this.getPrecomputes(r,e,i),t)},wNAFCachedUnsafe(e,t,i,r){const s=getW(e);return 1===s?this.unsafeLadder(e,t,r):this.wNAFUnsafe(s,this.getPrecomputes(s,e,i),t,r)},setWindowSize(e,i){validateW(i,t),pointWindowSizes.set(e,i),pointPrecomputes.delete(e)}}}function pippenger(e,t,i,r){if(validateMSMPoints(i,e),validateMSMScalars(r,t),i.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,n=bitLen(BigInt(i.length)),a=n>12?n-3:n>4?n-2:n?2:1,o=(1<<a)-1,c=new Array(o+1).fill(s);let l=s;for(let e=Math.floor((t.BITS-1)/a)*a;e>=0;e-=a){c.fill(s);for(let t=0;t<r.length;t++){const s=r[t],n=Number(s>>BigInt(e)&BigInt(o));c[n]=c[n].add(i[t])}let t=s;for(let e=c.length-1,i=s;e>0;e--)i=i.add(c[e]),t=t.add(i);if(l=l.add(t),0!==e)for(let e=0;e<a;e++)l=l.double()}return l}function validateBasic(e){return validateField(e.Fp),validateObject(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function validateSigVerOpts(e){void 0!==e.lowS&&abool("lowS",e.lowS),void 0!==e.prehash&&abool("prehash",e.prehash)}function validatePointOpts(e){const t=validateBasic(e);validateObject(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:i,Fp:r,a:s}=t;if(i){if(!r.eql(s,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof i||"bigint"!=typeof i.beta||"function"!=typeof i.splitScalar)throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:b2n,hexToBytes:h2b}=utils_exports2,DERErr=class extends Error{constructor(e=""){super(e)}},DER={Err:DERErr,_tlv:{encode:(e,t)=>{const{Err:i}=DER;if(e<0||e>256)throw new i("tlv.encode: wrong tag");if(1&t.length)throw new i("tlv.encode: unpadded data");const r=t.length/2,s=numberToHexUnpadded(r);if(s.length/2&128)throw new i("tlv.encode: long form length too big");const n=r>127?numberToHexUnpadded(s.length/2|128):"";return numberToHexUnpadded(e)+n+s+t},decode(e,t){const{Err:i}=DER;let r=0;if(e<0||e>256)throw new i("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new i("tlv.decode: wrong tlv");const s=t[r++];let n=0;if(!!(128&s)){const e=127&s;if(!e)throw new i("tlv.decode(long): indefinite length not supported");if(e>4)throw new i("tlv.decode(long): byte length is too big");const a=t.subarray(r,r+e);if(a.length!==e)throw new i("tlv.decode: length bytes not complete");if(0===a[0])throw new i("tlv.decode(long): zero leftmost byte");for(const e of a)n=n<<8|e;if(r+=e,n<128)throw new i("tlv.decode(long): not minimal encoding")}else n=s;const a=t.subarray(r,r+n);if(a.length!==n)throw new i("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+n)}}},_int:{encode(e){const{Err:t}=DER;if(e<_0n4)throw new t("integer: negative integers are not allowed");let i=numberToHexUnpadded(e);if(8&Number.parseInt(i[0],16)&&(i="00"+i),1&i.length)throw new t("unexpected DER parsing assertion: unpadded hex");return i},decode(e){const{Err:t}=DER;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return b2n(e)}},toSig(e){const{Err:t,_int:i,_tlv:r}=DER,s="string"==typeof e?h2b(e):e;abytes2(s);const{v:n,l:a}=r.decode(48,s);if(a.length)throw new t("invalid signature: left bytes after parsing");const{v:o,l:c}=r.decode(2,n),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:i.decode(o),s:i.decode(l)}},hexFromSig(e){const{_tlv:t,_int:i}=DER,r=t.encode(2,i.encode(e.r))+t.encode(2,i.encode(e.s));return t.encode(48,r)}},_0n4=BigInt(0),_1n4=BigInt(1),_2n3=BigInt(2),_3n2=BigInt(3),_4n2=BigInt(4);function weierstrassPoints(e){const t=validatePointOpts(e),{Fp:i}=t,r=Field(t.n,t.nBitLength),s=t.toBytes||((e,t,r)=>{const s=t.toAffine();return concatBytes2(Uint8Array.from([4]),i.toBytes(s.x),i.toBytes(s.y))}),n=t.fromBytes||(e=>{const t=e.subarray(1);return{x:i.fromBytes(t.subarray(0,i.BYTES)),y:i.fromBytes(t.subarray(i.BYTES,2*i.BYTES))}});function a(e){const{a:r,b:s}=t,n=i.sqr(e),a=i.mul(n,e);return i.add(i.add(a,i.mul(e,r)),s)}if(!i.eql(i.sqr(t.Gy),a(t.Gx)))throw new Error("bad generator point: equation left != right");function o(e){const{allowedPrivateKeyLengths:i,nByteLength:r,wrapPrivateKey:s,n:n}=t;if(i&&"bigint"!=typeof e){if(isBytes2(e)&&(e=bytesToHex(e)),"string"!=typeof e||!i.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*r,"0")}let a;try{a="bigint"==typeof e?e:bytesToNumberBE(ensureBytes("private key",e,r))}catch(t){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof e)}return s&&(a=mod(a,n)),aInRange("private key",a,_1n4,n),a}function c(e){if(!(e instanceof d))throw new Error("ProjectivePoint expected")}const l=memoized(((e,t)=>{const{px:r,py:s,pz:n}=e;if(i.eql(n,i.ONE))return{x:r,y:s};const a=e.is0();null==t&&(t=a?i.ONE:i.inv(n));const o=i.mul(r,t),c=i.mul(s,t),l=i.mul(n,t);if(a)return{x:i.ZERO,y:i.ZERO};if(!i.eql(l,i.ONE))throw new Error("invZ was invalid");return{x:o,y:c}})),u=memoized((e=>{if(e.is0()){if(t.allowInfinityPoint&&!i.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:s}=e.toAffine();if(!i.isValid(r)||!i.isValid(s))throw new Error("bad point: x or y not FE");const n=i.sqr(s),o=a(r);if(!i.eql(n,o))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!i.isValid(e))throw new Error("x required");if(null==t||!i.isValid(t))throw new Error("y required");if(null==r||!i.isValid(r))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!i.isValid(t)||!i.isValid(r))throw new Error("invalid affine point");if(e instanceof d)throw new Error("projective point not allowed");const s=e=>i.eql(e,i.ZERO);return s(t)&&s(r)?d.ZERO:new d(t,r,i.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=i.invertBatch(e.map((e=>e.pz)));return e.map(((e,i)=>e.toAffine(t[i]))).map(d.fromAffine)}static fromHex(e){const t=d.fromAffine(n(ensureBytes("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(o(e))}static msm(e,t){return pippenger(d,r,e,t)}_setWindowSize(e){h.setWindowSize(this,e)}assertValidity(){u(this)}hasEvenY(){const{y:e}=this.toAffine();if(i.isOdd)return!i.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){c(e);const{px:t,py:r,pz:s}=this,{px:n,py:a,pz:o}=e,l=i.eql(i.mul(t,o),i.mul(n,s)),u=i.eql(i.mul(r,o),i.mul(a,s));return l&&u}negate(){return new d(this.px,i.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,s=i.mul(r,_3n2),{px:n,py:a,pz:o}=this;let c=i.ZERO,l=i.ZERO,u=i.ZERO,p=i.mul(n,n),h=i.mul(a,a),m=i.mul(o,o),f=i.mul(n,a);return f=i.add(f,f),u=i.mul(n,o),u=i.add(u,u),c=i.mul(e,u),l=i.mul(s,m),l=i.add(c,l),c=i.sub(h,l),l=i.add(h,l),l=i.mul(c,l),c=i.mul(f,c),u=i.mul(s,u),m=i.mul(e,m),f=i.sub(p,m),f=i.mul(e,f),f=i.add(f,u),u=i.add(p,p),p=i.add(u,p),p=i.add(p,m),p=i.mul(p,f),l=i.add(l,p),m=i.mul(a,o),m=i.add(m,m),p=i.mul(m,f),c=i.sub(c,p),u=i.mul(m,h),u=i.add(u,u),u=i.add(u,u),new d(c,l,u)}add(e){c(e);const{px:r,py:s,pz:n}=this,{px:a,py:o,pz:l}=e;let u=i.ZERO,p=i.ZERO,h=i.ZERO;const m=t.a,f=i.mul(t.b,_3n2);let g=i.mul(r,a),_=i.mul(s,o),y=i.mul(n,l),b=i.add(r,s),v=i.add(a,o);b=i.mul(b,v),v=i.add(g,_),b=i.sub(b,v),v=i.add(r,n);let x=i.add(a,l);return v=i.mul(v,x),x=i.add(g,y),v=i.sub(v,x),x=i.add(s,n),u=i.add(o,l),x=i.mul(x,u),u=i.add(_,y),x=i.sub(x,u),h=i.mul(m,v),u=i.mul(f,y),h=i.add(u,h),u=i.sub(_,h),h=i.add(_,h),p=i.mul(u,h),_=i.add(g,g),_=i.add(_,g),y=i.mul(m,y),v=i.mul(f,v),_=i.add(_,y),y=i.sub(g,y),y=i.mul(m,y),v=i.add(v,y),g=i.mul(_,v),p=i.add(p,g),g=i.mul(x,v),u=i.mul(b,u),u=i.sub(u,g),g=i.mul(b,_),h=i.mul(x,h),h=i.add(h,g),new d(u,p,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return h.wNAFCached(this,e,d.normalizeZ)}multiplyUnsafe(e){const{endo:r,n:s}=t;aInRange("scalar",e,_0n4,s);const n=d.ZERO;if(e===_0n4)return n;if(this.is0()||e===_1n4)return this;if(!r||h.hasPrecomputes(this))return h.wNAFCachedUnsafe(this,e,d.normalizeZ);let{k1neg:a,k1:o,k2neg:c,k2:l}=r.splitScalar(e),u=n,p=n,m=this;for(;o>_0n4||l>_0n4;)o&_1n4&&(u=u.add(m)),l&_1n4&&(p=p.add(m)),m=m.double(),o>>=_1n4,l>>=_1n4;return a&&(u=u.negate()),c&&(p=p.negate()),p=new d(i.mul(p.px,r.beta),p.py,p.pz),u.add(p)}multiply(e){const{endo:r,n:s}=t;let n,a;if(aInRange("scalar",e,_1n4,s),r){const{k1neg:t,k1:s,k2neg:o,k2:c}=r.splitScalar(e);let{p:l,f:u}=this.wNAF(s),{p:p,f:m}=this.wNAF(c);l=h.constTimeNegate(t,l),p=h.constTimeNegate(o,p),p=new d(i.mul(p.px,r.beta),p.py,p.pz),n=l.add(p),a=u.add(m)}else{const{p:t,f:i}=this.wNAF(e);n=t,a=i}return d.normalizeZ([n,a])[0]}multiplyAndAddUnsafe(e,t,i){const r=d.BASE,s=(e,t)=>t!==_0n4&&t!==_1n4&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),n=s(this,t).add(s(e,i));return n.is0()?void 0:n}toAffine(e){return l(this,e)}isTorsionFree(){const{h:e,isTorsionFree:i}=t;if(e===_1n4)return!0;if(i)return i(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:i}=t;return e===_1n4?this:i?i(d,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return abool("isCompressed",e),this.assertValidity(),s(d,this,e)}toHex(e=!0){return abool("isCompressed",e),bytesToHex(this.toRawBytes(e))}}d.BASE=new d(t.Gx,t.Gy,i.ONE),d.ZERO=new d(i.ZERO,i.ONE,i.ZERO);const p=t.nBitLength,h=wNAF(d,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:o,weierstrassEquation:a,isWithinCurveOrder:function(e){return inRange(e,_1n4,t.n)}}}function validateOpts(e){const t=validateBasic(e);return validateObject(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function weierstrass(e){const t=validateOpts(e),{Fp:i,n:r}=t,s=i.BYTES+1,n=2*i.BYTES+1;function a(e){return mod(e,r)}function o(e){return invert(e,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:d}=weierstrassPoints({...t,toBytes(e,t,r){const s=t.toAffine(),n=i.toBytes(s.x),a=concatBytes2;return abool("isCompressed",r),r?a(Uint8Array.from([t.hasEvenY()?2:3]),n):a(Uint8Array.from([4]),n,i.toBytes(s.y))},fromBytes(e){const t=e.length,r=e[0],a=e.subarray(1);if(t!==s||2!==r&&3!==r){if(t===n&&4===r){return{x:i.fromBytes(a.subarray(0,i.BYTES)),y:i.fromBytes(a.subarray(i.BYTES,2*i.BYTES))}}throw new Error("invalid Point, expected length of "+s+", or uncompressed "+n+", got "+t)}{const e=bytesToNumberBE(a);if(!inRange(e,_1n4,i.ORDER))throw new Error("Point is not on curve");const t=u(e);let s;try{s=i.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return!(1&~r)!==((s&_1n4)===_1n4)&&(s=i.neg(s)),{x:e,y:s}}}}),p=e=>bytesToHex(numberToBytesBE(e,t.nByteLength));function h(e){return e>r>>_1n4}const m=(e,t,i)=>bytesToNumberBE(e.slice(t,i));class f{constructor(e,t,i){this.r=e,this.s=t,this.recovery=i,this.assertValidity()}static fromCompact(e){const i=t.nByteLength;return e=ensureBytes("compactSignature",e,2*i),new f(m(e,0,i),m(e,i,2*i))}static fromDER(e){const{r:t,s:i}=DER.toSig(ensureBytes("DER",e));return new f(t,i)}assertValidity(){aInRange("r",this.r,_1n4,r),aInRange("s",this.s,_1n4,r)}addRecoveryBit(e){return new f(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:s,recovery:n}=this,l=b(ensureBytes("msgHash",e));if(null==n||![0,1,2,3].includes(n))throw new Error("recovery id invalid");const u=2===n||3===n?r+t.n:r;if(u>=i.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&n?"03":"02",h=c.fromHex(d+p(u)),m=o(u),f=a(-l*m),g=a(s*m),_=c.BASE.multiplyAndAddUnsafe(h,f,g);if(!_)throw new Error("point at infinify");return _.assertValidity(),_}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new f(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}const g={isValidPrivateKey(e){try{return l(e),!0}catch(e){return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const e=getMinHashLength(t.n);return mapHashToField(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function _(e){const t=isBytes2(e),i="string"==typeof e,r=(t||i)&&e.length;return t?r===s||r===n:i?r===2*s||r===2*n:e instanceof c}const y=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const i=bytesToNumberBE(e),r=8*e.length-t.nBitLength;return r>0?i>>BigInt(r):i},b=t.bits2int_modN||function(e){return a(y(e))},v=bitMask(t.nBitLength);function x(e){return aInRange("num < 2^"+t.nBitLength,e,_0n4,v),numberToBytesBE(e,t.nByteLength)}function S(e,r,s=w){if(["recovered","canonical"].some((e=>e in s)))throw new Error("sign() legacy options not supported");const{hash:n,randomBytes:u}=t;let{lowS:p,prehash:m,extraEntropy:g}=s;null==p&&(p=!0),e=ensureBytes("msgHash",e),validateSigVerOpts(s),m&&(e=ensureBytes("prehashed msgHash",n(e)));const _=b(e),v=l(r),S=[x(v),x(_)];if(null!=g&&!1!==g){const e=!0===g?u(i.BYTES):g;S.push(ensureBytes("extraEntropy",e))}const E=concatBytes2(...S),C=_;return{seed:E,k2sig:function(e){const t=y(e);if(!d(t))return;const i=o(t),r=c.BASE.multiply(t).toAffine(),s=a(r.x);if(s===_0n4)return;const n=a(i*a(C+s*v));if(n===_0n4)return;let l=(r.x===s?0:2)|Number(r.y&_1n4),u=n;return p&&h(n)&&(u=function(e){return h(e)?a(-e):e}(n),l^=1),new f(s,u,l)}}}const w={lowS:t.lowS,prehash:!1},E={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,i=!0){if(_(e))throw new Error("first arg must be private key");if(!_(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(l(e)).toRawBytes(i)},sign:function(e,i,r=w){const{seed:s,k2sig:n}=S(e,i,r),a=t;return createHmacDrbg(a.hash.outputLen,a.nByteLength,a.hmac)(s,n)},verify:function(e,i,r,s=E){const n=e;i=ensureBytes("msgHash",i),r=ensureBytes("publicKey",r);const{lowS:l,prehash:u,format:d}=s;if(validateSigVerOpts(s),"strict"in s)throw new Error("options.strict was renamed to lowS");if(void 0!==d&&"compact"!==d&&"der"!==d)throw new Error("format must be compact or der");const p="string"==typeof n||isBytes2(n),h=!p&&!d&&"object"==typeof n&&null!==n&&"bigint"==typeof n.r&&"bigint"==typeof n.s;if(!p&&!h)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let m,g;try{if(h&&(m=new f(n.r,n.s)),p){try{"compact"!==d&&(m=f.fromDER(n))}catch(e){if(!(e instanceof DER.Err))throw e}m||"der"===d||(m=f.fromCompact(n))}g=c.fromHex(r)}catch(e){return!1}if(!m)return!1;if(l&&m.hasHighS())return!1;u&&(i=t.hash(i));const{r:_,s:y}=m,v=b(i),x=o(y),S=a(v*x),w=a(_*x),C=c.BASE.multiplyAndAddUnsafe(g,S,w)?.toAffine();return!!C&&a(C.x)===_},ProjectivePoint:c,Signature:f,utils:g}}function getHash(e){return{hash:e,hmac:(t,...i)=>hmac(e,t,concatBytes(...i)),randomBytes:randomBytes2}}function createCurve(e,t){const i=t=>weierstrass({...e,...getHash(t)});return{...i(t),create:i}}var Fp256=Field(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),CURVE_A=Fp256.create(BigInt("-3")),CURVE_B=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),p256=createCurve({a:CURVE_A,b:CURVE_B,Fp:Fp256,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},sha256),p256Keypair=()=>{const e=p256.utils.randomPrivateKey(),t=p256.getPublicKey(e,!1);return{privateKey:Buffer.from(e),publicKey:Buffer.from(t)}},p256PreMasterSecret=({publicKey:e,privateKey:t})=>{const i=p256.getSharedSecret(t,e);return Buffer.from(i).subarray(1)};function prfPreMasterSecret(e,t,i){switch(i){case NamedCurveAlgorithm.secp256r1_23:return p256PreMasterSecret({publicKey:e,privateKey:t});case NamedCurveAlgorithm.x25519_29:return Buffer.from(import_tweetnacl.default.scalarMult(t,e));default:throw new Error}}function hmac2(e,t,i){const r=(0,import_crypto3.createHmac)(e,t);return r.update(i),r.digest()}function prfPHash(e,t,i,r="sha256"){const s=i,n=[];let a=t;do{a=hmac2(r,e,a);const s=hmac2(r,e,Buffer.concat([a,t]));n.push(s),i-=s.length}while(i>0);return Buffer.concat(n,s)}function prfMasterSecret(e,t,i){return prfPHash(e,Buffer.concat([Buffer.from("master secret"),t,i]),48)}function prfExtendedMasterSecret(e,t){const i=hash("sha256",t);return prfPHash(e,Buffer.concat([Buffer.from("extended master secret"),i]),48)}function exportKeyingMaterial(e,t,i,r,s,n){const a=n?r:s,o=n?s:r;return prfPHash(i,Buffer.concat([Buffer.from(e),a,o]),t)}function hash(e,t){return(0,import_crypto3.createHash)(e).update(t).digest()}function prfVerifyData(e,t,i,r=12){const s=hash("sha256",t);return prfPHash(e,Buffer.concat([Buffer.from(i),s]),r)}function prfVerifyDataClient(e,t){return prfVerifyData(e,t,"client finished")}function prfVerifyDataServer(e,t){return prfVerifyData(e,t,"server finished")}function prfEncryptionKeys(e,t,i,r,s,n,a="sha256"){const o=2*r+2*s,c=e,l=Buffer.concat([i,t]),u=prfPHash(c,Buffer.concat([Buffer.from("key expansion"),l]),o,a),d=(0,import_binary_data.createDecode)(u),p=d.readBuffer(r),h=d.readBuffer(r),m=d.readBuffer(s),f=d.readBuffer(s),g=Buffer.alloc(n,0),_=Buffer.alloc(n,0);return m.copy(g,0),f.copy(_,0),{clientWriteKey:p,serverWriteKey:h,clientNonce:g,serverNonce:_}}var SessionType={CLIENT:1,SERVER:2},AbstractCipher=class{constructor(){__publicField(this,"id",0),__publicField(this,"name"),__publicField(this,"hashAlgorithm"),__publicField(this,"verifyDataLength",12),__publicField(this,"blockAlgorithm"),__publicField(this,"kx")}init(...e){throw new Error("not implemented")}encrypt(...e){throw new Error("not implemented")}decrypt(...e){throw new Error("not implemented")}toString(){return this.name}},crypto3=import_crypto4.webcrypto;x509.cryptoProvider.set(crypto3);var CipherContext=class{constructor(e,t,i,r){this.sessionType=e,this.certPem=t,this.keyPem=i,__publicField(this,"localRandom"),__publicField(this,"remoteRandom"),__publicField(this,"cipherSuite"),__publicField(this,"remoteCertificate"),__publicField(this,"remoteKeyPair"),__publicField(this,"localKeyPair"),__publicField(this,"masterSecret"),__publicField(this,"cipher"),__publicField(this,"namedCurve"),__publicField(this,"signatureHashAlgorithm"),__publicField(this,"localCert"),__publicField(this,"localPrivateKey"),t&&i&&r&&this.parseX509(t,i,r)}encryptPacket(e){const t=e.recordLayerHeader,i=t.protocolVersion.major<<8|t.protocolVersion.minor,r=this.cipher.encrypt(this.sessionType,e.fragment,{type:t.contentType,version:i,epoch:t.epoch,sequenceNumber:t.sequenceNumber});return e.fragment=r,e.recordLayerHeader.contentLen=r.length,e}decryptPacket(e){const t=e.recordLayerHeader,i=t.protocolVersion.major<<8|t.protocolVersion.minor;return this.cipher.decrypt(this.sessionType,e.fragment,{type:t.contentType,version:i,epoch:t.epoch,sequenceNumber:t.sequenceNumber})}verifyData(e){return this.sessionType===SessionType.CLIENT?prfVerifyDataClient(this.masterSecret,e):prfVerifyDataServer(this.masterSecret,e)}signatureData(e,t){const i=(0,import_crypto4.createSign)(t).update(e),r=this.localPrivateKey.toPEM().toString();return i.sign(r)}generateKeySignature(e){const t=this.sessionType===SessionType.CLIENT?this.localRandom:this.remoteRandom,i=this.sessionType===SessionType.SERVER?this.localRandom:this.remoteRandom,r=this.valueKeySignature(t.serialize(),i.serialize(),this.localKeyPair.publicKey,this.namedCurve);return this.localPrivateKey.sign(r,e)}parseX509(e,t,i){const r=import_x509.Certificate.fromPEM(Buffer.from(e)),s=import_x509.PrivateKey.fromPEM(Buffer.from(t));this.localCert=r.raw,this.localPrivateKey=s,this.signatureHashAlgorithm=i}valueKeySignature(e,t,i,r){const s=Buffer.from((0,import_binary_data2.encode)({type:CurveType.named_curve_3,curve:r,len:i.length},{type:import_binary_data2.types.uint8,curve:import_binary_data2.types.uint16be,len:import_binary_data2.types.uint8}).slice());return Buffer.concat([e,t,s,i])}};__publicField(CipherContext,"createSelfSignedCertificateWithKey",(async(e,t)=>{const i=(()=>{switch(e.signature){case SignatureAlgorithm.rsa_1:return"RSASSA-PKCS1-v1_5";case SignatureAlgorithm.ecdsa_3:return"ECDSA"}})(),r=(()=>{if(e.hash===HashAlgorithm.sha256_4)return"SHA-256"})(),s=(()=>{switch(t){case NamedCurveAlgorithm.secp256r1_23:return"P-256";case NamedCurveAlgorithm.x25519_29:return"ECDSA"===i?"P-256":"X25519";default:if("ECDSA"===i)return"P-256";if("RSASSA-PKCS1-v1_5"===i)return"X25519"}})(),n=(()=>{switch(i){case"ECDSA":return{name:i,hash:r,namedCurve:s};case"RSASSA-PKCS1-v1_5":return{name:i,hash:r,publicExponent:new Uint8Array([1,0,1]),modulusLength:2048}}})(),a=await crypto3.subtle.generateKey(n,!0,["sign","verify"]);return{certPem:(await x509.X509CertificateGenerator.createSelfSigned({serialNumber:(0,import_crypto4.randomBytes)(8).toString("hex"),name:"C=AU, ST=Some-State, O=Internet Widgits Pty Ltd",notBefore:new Date,notAfter:new Date(Date.now()+31536e7),signingAlgorithm:n,keys:a})).toString("pem"),keyPem:x509.PemConverter.encode(await crypto3.subtle.exportKey("pkcs8",a.privateKey),"private key"),signatureHash:e}}));var SrtpContext=class{constructor(){__publicField(this,"srtpProfile")}static findMatchingSRTPProfile(e,t){for(const i of t)if(e.includes(i))return i}},import_binary_data6=__toESM(require_src4()),import_binary_data3=__toESM(require_src4()),dumpBuffer=e=>"0x"+e.toString("hex").replace(/(.)(.)/g,"$1$2 ").split(" ").filter((e=>null!=e&&e.length>0)).join(",0x"),getObjectSummary=e=>Object.entries({...e}).reduce(((e,[t,i])=>("number"!=typeof i&&"string"!=typeof i||(e[t]=i),Buffer.isBuffer(i)&&(e[t]=dumpBuffer(i)),e)),{}),_FragmentedHandshake=class e{constructor(e,t,i,r,s,n){this.msg_type=e,this.length=t,this.message_seq=i,this.fragment_offset=r,this.fragment_length=s,this.fragment=n}get summary(){return getObjectSummary(this)}static createEmpty(){return new e(void 0,void 0,void 0,void 0,void 0,void 0)}static deSerialize(t){return new e(...Object.values((0,import_binary_data3.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data3.encode)(this,e.spec).slice();return Buffer.from(t)}chunk(t){let i=0;const r=this.fragment.length;if(0===r)return[new e(this.msg_type,r,this.message_seq,i,0,this.fragment)];const s=[];for(t||(t=1240);i<r;){const n=Math.min(t,r-i),a=Buffer.from(this.fragment.slice(i,i+n));if(a.length<=0)throw new Error("Zero or less bytes processed while fragmenting handshake message.");s.push(new e(this.msg_type,r,this.message_seq,i,a.length,a)),i+=a.length}return s}static assemble(t){if(!t?.length)throw new Error("cannot reassemble handshake from empty array");t=t.sort(((e,t)=>e.fragment_offset-t.fragment_offset));const i=Buffer.alloc(t[0].length);for(const e of t)e.fragment.copy(i,e.fragment_offset);return new e(t[0].msg_type,t[0].length,t[0].message_seq,0,i.length,i)}static findAllFragments(e,t){const i=e.find((e=>e.msg_type===t));return i&&e?.length?e.filter((e=>e.msg_type===i.msg_type&&e.message_seq===i.message_seq&&e.length===i.length)):[]}};__publicField(_FragmentedHandshake,"spec",{msg_type:import_binary_data3.types.uint8,length:import_binary_data3.types.uint24be,message_seq:import_binary_data3.types.uint16be,fragment_offset:import_binary_data3.types.uint24be,fragment_length:import_binary_data3.types.uint24be,fragment:import_binary_data3.types.buffer((e=>e.current.fragment_length))});var FragmentedHandshake=_FragmentedHandshake,import_binary_data4=__toESM(require_src4()),{uint16be:uint16be,uint24be:uint24be,buffer:buffer,array:array,uint8:uint8,string:string}=import_binary_data4.types,Extension={type:uint16be,data:buffer(uint16be)},ExtensionList=array(Extension,uint16be,"bytes"),ASN11Cert=buffer(uint24be),ClientCertificateType=uint8,DistinguishedName=string(uint16be),SignatureHashAlgorithm={hash:uint8,signature:uint8},ProtocolVersion={major:uint8,minor:uint8},import_crypto5=require("crypto"),import_binary_data5=__toESM(require_src4()),_DtlsRandom=class e{constructor(e=Math.floor(Date.now()/1e3),t=(0,import_crypto5.randomBytes)(28)){this.gmt_unix_time=e,this.random_bytes=t}static deSerialize(t){return new e(...Object.values((0,import_binary_data5.decode)(t,e.spec)))}static from(t){return new e(...Object.values(t))}serialize(){const t=(0,import_binary_data5.encode)(this,e.spec).slice();return Buffer.from(t)}};__publicField(_DtlsRandom,"spec",{gmt_unix_time:import_binary_data5.types.uint32be,random_bytes:import_binary_data5.types.buffer(28)});var DtlsRandom=_DtlsRandom,_ClientHello=class e{constructor(e,t,i,r,s,n,a){this.clientVersion=e,this.random=t,this.sessionId=i,this.cookie=r,this.cipherSuites=s,this.compressionMethods=n,this.extensions=a,__publicField(this,"msgType",1),__publicField(this,"messageSeq",0)}static createEmpty(){return new e(void 0,void 0,void 0,void 0,void 0,void 0,void 0)}static deSerialize(t){return new e(...Object.values((0,import_binary_data6.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data6.encode)(this,e.spec).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ClientHello,"spec",{clientVersion:{major:import_binary_data6.types.uint8,minor:import_binary_data6.types.uint8},random:DtlsRandom.spec,sessionId:import_binary_data6.types.buffer(import_binary_data6.types.uint8),cookie:import_binary_data6.types.buffer(import_binary_data6.types.uint8),cipherSuites:import_binary_data6.types.array(import_binary_data6.types.uint16be,import_binary_data6.types.uint16be,"bytes"),compressionMethods:import_binary_data6.types.array(import_binary_data6.types.uint8,import_binary_data6.types.uint8,"bytes"),extensions:ExtensionList});var ClientHello=_ClientHello,import_promises=require("timers/promises"),import_binary_data7=__toESM(require_src4()),_MACHeader=class e{constructor(e,t,i,r,s){this.epoch=e,this.sequenceNumber=t,this.contentType=i,this.protocolVersion=r,this.contentLen=s}static createEmpty(){return new e(void 0,void 0,void 0,void 0,void 0)}static deSerialize(t){return new e(...Object.values((0,import_binary_data7.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data7.encode)(this,e.spec).slice();return Buffer.from(t)}};__publicField(_MACHeader,"spec",{epoch:import_binary_data7.types.uint16be,sequenceNumber:import_binary_data7.types.uint48be,contentType:import_binary_data7.types.uint8,protocolVersion:ProtocolVersion,contentLen:import_binary_data7.types.uint16be});var MACHeader=_MACHeader,DtlsPlaintext=class e{constructor(e,t){this.recordLayerHeader=e,this.fragment=t}get summary(){return{header:this.recordLayerHeader,fragment:dumpBuffer(this.fragment)}}static createEmpty(){return new e(void 0,void 0)}static deSerialize(t){if(t.length<13)throw new Error("Invalid DTLS record: buffer is too short");const i=t.readUInt8(0),r=t.readUInt8(1),s=t.readUInt8(2),n=t.readUInt16BE(3),a=t.slice(5,11).readUIntBE(0,6),o=t.readUInt16BE(11);if(t.length<13+o)throw new Error("Invalid DTLS record: fragment length exceeds buffer");const c=t.slice(13,13+o);return new e({contentType:i,protocolVersion:{major:r,minor:s},epoch:n,sequenceNumber:a,contentLen:o},c)}serialize(){const e=this.fragment.length,t=13+e,i=Buffer.alloc(t);return i.writeUInt8(this.recordLayerHeader.contentType,0),i.writeUInt8(this.recordLayerHeader.protocolVersion.major,1),i.writeUInt8(this.recordLayerHeader.protocolVersion.minor,2),i.writeUInt16BE(this.recordLayerHeader.epoch,3),i.writeUIntBE(this.recordLayerHeader.sequenceNumber,5,6),i.writeUInt16BE(e,11),this.fragment.copy(i,13),i}computeMACHeader(){return new MACHeader(this.recordLayerHeader.epoch,this.recordLayerHeader.sequenceNumber,this.recordLayerHeader.contentType,this.recordLayerHeader.protocolVersion,this.recordLayerHeader.contentLen).serialize()}},createFragments=e=>t=>(e.lastFlight=t,t.flatMap((t=>{t.messageSeq=e.sequenceNumber++;return t.toFragment().chunk()}))),createPlaintext=e=>(t,i)=>t.map((t=>new DtlsPlaintext({contentType:t.type,protocolVersion:e.version,epoch:e.epoch,sequenceNumber:i,contentLen:t.fragment.length},t.fragment))),AlertDesc=(e=>(e[e.CloseNotify=0]="CloseNotify",e[e.UnexpectedMessage=10]="UnexpectedMessage",e[e.BadRecordMac=20]="BadRecordMac",e[e.DecryptionFailed=21]="DecryptionFailed",e[e.RecordOverflow=22]="RecordOverflow",e[e.DecompressionFailure=30]="DecompressionFailure",e[e.HandshakeFailure=40]="HandshakeFailure",e[e.NoCertificate=41]="NoCertificate",e[e.BadCertificate=42]="BadCertificate",e[e.UnsupportedCertificate=43]="UnsupportedCertificate",e[e.CertificateRevoked=44]="CertificateRevoked",e[e.CertificateExpired=45]="CertificateExpired",e[e.CertificateUnknown=46]="CertificateUnknown",e[e.IllegalParameter=47]="IllegalParameter",e[e.UnknownCa=48]="UnknownCa",e[e.AccessDenied=49]="AccessDenied",e[e.DecodeError=50]="DecodeError",e[e.DecryptError=51]="DecryptError",e[e.ExportRestriction=60]="ExportRestriction",e[e.ProtocolVersion=70]="ProtocolVersion",e[e.InsufficientSecurity=71]="InsufficientSecurity",e[e.InternalError=80]="InternalError",e[e.UserCanceled=90]="UserCanceled",e[e.NoRenegotiation=100]="NoRenegotiation",e[e.UnsupportedExtension=110]="UnsupportedExtension",e))(AlertDesc||{}),warn=debug2("werift-dtls : packages/dtls/src/flight/flight.ts : warn"),err=debug2("werift-dtls : packages/dtls/src/flight/flight.ts : err"),_Flight=class e{constructor(e,t,i,r){this.transport=e,this.dtls=t,this.flight=i,this.nextFlight=r,__publicField(this,"state","PREPARING"),__publicField(this,"send",(e=>Promise.all(e.map((e=>this.transport.send(e))))))}createPacket(e){const t=createFragments(this.dtls)(e);this.dtls.bufferHandshakeCache(t,!0,this.flight);return createPlaintext(this.dtls)(t.map((e=>({type:22,fragment:e.serialize()}))),++this.dtls.recordSequenceNumber)}async transmit(t){let i=0;for(;i<=e.RetransmitCount;i++){if(this.setState("SENDING"),this.send(t).catch((e=>{err("fail to send",err)})),this.setState("WAITING"),void 0===this.nextFlight){this.setState("FINISHED");break}if(await(0,import_promises.setTimeout)((i+1)/2*1e3),this.dtls.flight>=this.nextFlight){this.setState("FINISHED");break}warn(this.dtls.sessionId,"retransmit",i,this.dtls.flight)}if(i>e.RetransmitCount)throw err(this.dtls.sessionId,"retransmit failed",i),new Error(`over retransmitCount : ${this.flight} ${this.nextFlight}`)}setState(e){this.state=e}};__publicField(_Flight,"RetransmitCount",10);var Flight=_Flight,Flight1=class extends Flight{constructor(e,t,i){super(e,t,1,3),this.cipher=i}async exec(e){if(1===this.dtls.flight)throw new Error;this.dtls.flight=1;const t=new ClientHello({major:254,minor:253},new DtlsRandom,Buffer.from([]),Buffer.from([]),CipherSuiteList,[0],e);this.dtls.version=t.clientVersion,this.cipher.localRandom=DtlsRandom.from(t.random);const i=this.createPacket([t]),r=Buffer.concat(i.map((e=>e.serialize())));await this.transmit([r])}},log5=debug2("werift-dtls : packages/dtls/src/flight/client/flight3.ts : log"),Flight3=class extends Flight{constructor(e,t){super(e,t,3,5)}async exec(e){if(3===this.dtls.flight)throw new Error;this.dtls.flight=3,this.dtls.handshakeCache=[];const[t]=this.dtls.lastFlight;log5("dtls version",t.clientVersion),t.cookie=e.cookie,this.dtls.cookie=e.cookie;const i=this.createPacket([t]),r=Buffer.concat(i.map((e=>e.serialize())));await this.transmit([r])}},signTypes={NULL:0,ECDHE:1},keyTypes={NULL:0,RSA:1,ECDSA:2,PSK:3},kxTypes={NULL:0,RSA:1,ECDHE_RSA:2,ECDHE_ECDSA:3,PSK:4,ECDHE_PSK:5},KeyExchange=class{constructor(){__publicField(this,"id",0),__publicField(this,"name"),__publicField(this,"signType"),__publicField(this,"keyType")}toString(){return this.name}};function createRSAKeyExchange(){const e=new KeyExchange;return e.id=kxTypes.RSA,e.name="RSA",e.keyType=keyTypes.RSA,e}function createECDHERSAKeyExchange(){const e=new KeyExchange;return e.id=kxTypes.ECDHE_RSA,e.name="ECDHE_RSA",e.signType=signTypes.ECDHE,e.keyType=keyTypes.RSA,e}function createECDHEECDSAKeyExchange(){const e=new KeyExchange;return e.id=kxTypes.ECDHE_ECDSA,e.name="ECDHE_ECDSA",e.signType=signTypes.ECDHE,e.keyType=keyTypes.ECDSA,e}function createPSKKeyExchange(){const e=new KeyExchange;return e.id=kxTypes.PSK,e.name="PSK",e.signType=signTypes.NULL,e.keyType=keyTypes.PSK,e}function createECDHEPSKKeyExchange(){const e=new KeyExchange;return e.id=kxTypes.ECDHE_PSK,e.name="ECDHE_PSK",e.signType=signTypes.ECDHE,e.keyType=keyTypes.PSK,e}var import_crypto6=require("crypto"),err2=debug2("werift-dtls : packages/dtls/src/cipher/suites/aead.ts : err"),AEADCipher=class extends AbstractCipher{constructor(){super(),__publicField(this,"keyLength",0),__publicField(this,"nonceLength",0),__publicField(this,"ivLength",0),__publicField(this,"authTagLength",0),__publicField(this,"nonceImplicitLength",0),__publicField(this,"nonceExplicitLength",0),__publicField(this,"clientWriteKey"),__publicField(this,"serverWriteKey"),__publicField(this,"clientNonce"),__publicField(this,"serverNonce")}get summary(){return getObjectSummary(this)}init(e,t,i){const r=prfEncryptionKeys(e,i,t,this.keyLength,this.ivLength,this.nonceLength,this.hashAlgorithm);this.clientWriteKey=r.clientWriteKey,this.serverWriteKey=r.serverWriteKey,this.clientNonce=r.clientNonce,this.serverNonce=r.serverNonce}encrypt(e,t,i){const r=e===SessionType.CLIENT,s=r?this.clientNonce:this.serverNonce,n=r?this.clientWriteKey:this.serverWriteKey;if(!s||!n)throw new Error;s.writeUInt16BE(i.epoch,this.nonceImplicitLength),s.writeUIntBE(i.sequenceNumber,this.nonceImplicitLength+2,6);const a=s.slice(this.nonceImplicitLength),o=this.encodeAdditionalBuffer(i,t.length),c=(0,import_crypto6.createCipheriv)(this.blockAlgorithm,n,s,{authTagLength:this.authTagLength});c.setAAD(o,{plaintextLength:t.length});const l=c.update(t),u=c.final(),d=c.getAuthTag();return Buffer.concat([a,l,u,d])}encodeAdditionalBuffer(e,t){const i=Buffer.alloc(13);return i.writeUInt16BE(e.epoch,0),i.writeUintBE(e.sequenceNumber,2,6),i.writeUInt8(e.type,8),i.writeUInt16BE(e.version,9),i.writeUInt16BE(t,11),i}decrypt(e,t,i){const r=e===SessionType.CLIENT,s=r?this.serverNonce:this.clientNonce,n=r?this.serverWriteKey:this.clientWriteKey;if(!s||!n)throw new Error;t.subarray(0,this.nonceExplicitLength).copy(s,this.nonceImplicitLength);const a=t.subarray(this.nonceExplicitLength,t.length-this.authTagLength),o=t.subarray(t.length-this.authTagLength),c=this.encodeAdditionalBuffer(i,a.length),l=(0,import_crypto6.createDecipheriv)(this.blockAlgorithm,n,s,{authTagLength:this.authTagLength});l.setAuthTag(o),l.setAAD(c,{plaintextLength:a.length});const u=l.update(a);try{const e=l.final();return e.length>0?Buffer.concat([u,e]):u}catch(r){throw err2("decrypt failed",r,e,dumpBuffer(t),i,this.summary),r}}},cipherSuites={TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:49195,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:49196,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:49199,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:49200,TLS_RSA_WITH_AES_128_GCM_SHA256:156,TLS_RSA_WITH_AES_256_GCM_SHA384:157,TLS_PSK_WITH_AES_128_GCM_SHA256:168,TLS_PSK_WITH_AES_256_GCM_SHA384:169,TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256:53249,TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384:53250,TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256:52396,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:52393,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:52392,TLS_PSK_WITH_CHACHA20_POLY1305_SHA256:52395},AEAD_AES_128_GCM={K_LEN:16,N_MIN:12,N_MAX:12,P_MAX:2**36-31,A_MAX:2**53-1,C_MAX:2**36-15},AEAD_AES_256_GCM={K_LEN:32,N_MIN:12,N_MAX:12,P_MAX:2**36-31,A_MAX:2**53-1,C_MAX:2**36-15},RSA_KEY_EXCHANGE=createRSAKeyExchange(),ECDHE_RSA_KEY_EXCHANGE=createECDHERSAKeyExchange(),ECDHE_ECDSA_KEY_EXCHANGE=createECDHEECDSAKeyExchange(),PSK_KEY_EXCHANGE=createPSKKeyExchange(),ECDHE_PSK_KEY_EXCHANGE=createECDHEPSKKeyExchange();function createCipher(e){switch(e){case cipherSuites.TLS_RSA_WITH_AES_128_GCM_SHA256:return createAEADCipher(cipherSuites.TLS_RSA_WITH_AES_128_GCM_SHA256,"TLS_RSA_WITH_AES_128_GCM_SHA256","aes-128-gcm",RSA_KEY_EXCHANGE,AEAD_AES_128_GCM);case cipherSuites.TLS_RSA_WITH_AES_256_GCM_SHA384:return createAEADCipher(cipherSuites.TLS_RSA_WITH_AES_256_GCM_SHA384,"TLS_RSA_WITH_AES_256_GCM_SHA384","aes-256-gcm",RSA_KEY_EXCHANGE,AEAD_AES_256_GCM,"sha384");case cipherSuites.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:return createAEADCipher(cipherSuites.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","aes-128-gcm",ECDHE_RSA_KEY_EXCHANGE,AEAD_AES_128_GCM);case cipherSuites.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:return createAEADCipher(cipherSuites.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","aes-256-gcm",ECDHE_RSA_KEY_EXCHANGE,AEAD_AES_256_GCM,"sha384");case cipherSuites.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:return createAEADCipher(cipherSuites.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","aes-128-gcm",ECDHE_ECDSA_KEY_EXCHANGE,AEAD_AES_128_GCM);case cipherSuites.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:return createAEADCipher(cipherSuites.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","aes-256-gcm",ECDHE_ECDSA_KEY_EXCHANGE,AEAD_AES_256_GCM,"sha384");case cipherSuites.TLS_PSK_WITH_AES_128_GCM_SHA256:return createAEADCipher(cipherSuites.TLS_PSK_WITH_AES_128_GCM_SHA256,"TLS_PSK_WITH_AES_128_GCM_SHA256","aes-128-gcm",PSK_KEY_EXCHANGE,AEAD_AES_128_GCM,"sha256");case cipherSuites.TLS_PSK_WITH_AES_256_GCM_SHA384:return createAEADCipher(cipherSuites.TLS_PSK_WITH_AES_256_GCM_SHA384,"TLS_PSK_WITH_AES_256_GCM_SHA384","aes-256-gcm",PSK_KEY_EXCHANGE,AEAD_AES_256_GCM,"sha384");case cipherSuites.TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256:return createAEADCipher(cipherSuites.TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,"TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256","aes-128-gcm",ECDHE_PSK_KEY_EXCHANGE,AEAD_AES_128_GCM,"sha256");case cipherSuites.TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384:return createAEADCipher(cipherSuites.TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384,"TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384","aes-256-gcm",ECDHE_PSK_KEY_EXCHANGE,AEAD_AES_256_GCM,"sha384")}return null}function createAEADCipher(e,t,i,r,s,n="sha256"){const a=new AEADCipher;return a.id=e,a.name=t,a.blockAlgorithm=i,a.kx=r,a.hashAlgorithm=n,a.keyLength=s.K_LEN,a.nonceLength=s.N_MAX,a.nonceImplicitLength=4,a.nonceExplicitLength=8,a.ivLength=a.nonceImplicitLength,a.authTagLength=16,a}var import_tweetnacl2=__toESM(require_nacl_fast());function generateKeyPair(e){switch(e){case NamedCurveAlgorithm.secp256r1_23:{const{privateKey:t,publicKey:i}=p256Keypair();return{curve:e,privateKey:t,publicKey:i}}case NamedCurveAlgorithm.x25519_29:{const t=import_tweetnacl2.default.box.keyPair();return{curve:e,privateKey:Buffer.from(t.secretKey.buffer),publicKey:Buffer.from(t.publicKey.buffer)}}default:throw new Error}}var ExtendedMasterSecret=class{};__publicField(ExtendedMasterSecret,"type",23);var import_binary_data8=__toESM(require_src4()),_RenegotiationIndication=class e{constructor(t={}){__publicField(this,"type",e.type),__publicField(this,"data",0),Object.assign(this,t)}static createEmpty(){return new e}static deSerialize(t){return new e((0,import_binary_data8.decode)(t,e.spec))}serialize(){const t=(0,import_binary_data8.encode)(this,e.spec).slice();return Buffer.from(t)}get extension(){return{type:this.type,data:this.serialize().slice(2)}}};__publicField(_RenegotiationIndication,"type",65281),__publicField(_RenegotiationIndication,"spec",{type:import_binary_data8.types.uint16be,data:import_binary_data8.types.uint8});var RenegotiationIndication=_RenegotiationIndication,import_binary_data9=__toESM(require_src4()),_UseSRTP=class e{constructor(t={}){__publicField(this,"type",e.type),__publicField(this,"data",Buffer.from([])),__publicField(this,"profiles",[]),__publicField(this,"mki",Buffer.from([0])),Object.assign(this,t)}static create(t,i){return new e({profiles:t,mki:i})}static deSerialize(t){const i=new e((0,import_binary_data9.decode)(t,e.spec)),r=i.data.readUInt16BE(),s=new Array(r/2);for(let e=0;e<s.length;e++)s[e]=i.data.readUInt16BE(2*e+2);return i.profiles=s,i.mki=i.data.slice(r+2),i}serialize(){const t=Buffer.alloc(2);t.writeUInt16BE(2*this.profiles.length);const i=Buffer.concat([t,...this.profiles.map((e=>{const t=Buffer.alloc(2);return t.writeUInt16BE(e),t})),this.mki]);this.data=i;const r=(0,import_binary_data9.encode)(this,e.spec).slice();return Buffer.from(r)}static fromData(t){const i=Buffer.alloc(4);return i.writeUInt16BE(e.type),i.writeUInt16BE(t.length,2),e.deSerialize(Buffer.concat([i,t]))}get extension(){return{type:this.type,data:this.serialize().slice(4)}}};__publicField(_UseSRTP,"type",14),__publicField(_UseSRTP,"spec",{type:import_binary_data9.types.uint16be,data:import_binary_data9.types.buffer(import_binary_data9.types.uint16be)});var UseSRTP=_UseSRTP,import_binary_data10=__toESM(require_src4()),_Certificate=class e{constructor(e){this.certificateList=e,__publicField(this,"msgType",11),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0)}static deSerialize(t){return new e(...Object.values((0,import_binary_data10.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data10.encode)(this,e.spec).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_Certificate,"spec",{certificateList:import_binary_data10.types.array(ASN11Cert,import_binary_data10.types.uint24be,"bytes")});var Certificate2=_Certificate,import_binary_data11=__toESM(require_src4()),_ChangeCipherSpec=class e{constructor(e=1){this.type=e}static createEmpty(){return new e}static deSerialize(t){return new e(...Object.values((0,import_binary_data11.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data11.encode)(this,e.spec).slice();return Buffer.from(t)}};__publicField(_ChangeCipherSpec,"spec",{type:import_binary_data11.types.uint8});var ChangeCipherSpec=_ChangeCipherSpec,import_binary_data12=__toESM(require_src4()),_CertificateVerify=class e{constructor(e,t){this.algorithm=e,this.signature=t,__publicField(this,"msgType",15),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0,void 0)}static deSerialize(t){const i=(0,import_binary_data12.decode)(t,e.spec);return new e(...Object.values(i))}serialize(){const t=(0,import_binary_data12.encode)(this,e.spec).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_CertificateVerify,"spec",{algorithm:import_binary_data12.types.uint16be,signature:import_binary_data12.types.buffer(import_binary_data12.types.uint16be)});var CertificateVerify=_CertificateVerify,import_binary_data13=__toESM(require_src4()),_ClientKeyExchange=class e{constructor(e){this.publicKey=e,__publicField(this,"msgType",16),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0)}static deSerialize(t){const i=(0,import_binary_data13.decode)(t,e.spec);return new e(...Object.values(i))}serialize(){const t=(0,import_binary_data13.encode)(this,e.spec).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ClientKeyExchange,"spec",{publicKey:import_binary_data13.types.buffer(import_binary_data13.types.uint8)});var ClientKeyExchange=_ClientKeyExchange,Finished=class e{constructor(e){this.verifyData=e,__publicField(this,"msgType",20),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0)}static deSerialize(t){return new e(t)}serialize(){return this.verifyData}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}},import_binary_data14=__toESM(require_src4()),_ServerCertificateRequest=class e{constructor(e,t,i){this.certificateTypes=e,this.signatures=t,this.authorities=i,__publicField(this,"msgType",13),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0,void 0,void 0)}static deSerialize(t){return new e(...Object.values((0,import_binary_data14.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data14.encode)(this,e.spec).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ServerCertificateRequest,"spec",{certificateTypes:import_binary_data14.types.array(ClientCertificateType,import_binary_data14.types.uint8,"bytes"),signatures:import_binary_data14.types.array(SignatureHashAlgorithm,import_binary_data14.types.uint16be,"bytes"),authorities:import_binary_data14.types.array(DistinguishedName,import_binary_data14.types.uint16be,"bytes")});var ServerCertificateRequest=_ServerCertificateRequest,import_binary_data15=__toESM(require_src4()),_ServerHello=class e{constructor(e,t,i,r,s,n){this.serverVersion=e,this.random=t,this.sessionId=i,this.cipherSuite=r,this.compressionMethod=s,this.extensions=n,__publicField(this,"msgType",2),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0,void 0,void 0,void 0,void 0,void 0)}static deSerialize(t){const i=(0,import_binary_data15.decode)(t,e.spec),r=new e(...Object.values(i));return r.serialize().length<t.length?new e(...Object.values((0,import_binary_data15.decode)(t,{...e.spec,extensions:ExtensionList}))):r}serialize(){const t=void 0===this.extensions?(0,import_binary_data15.encode)(this,e.spec).slice():(0,import_binary_data15.encode)(this,{...e.spec,extensions:ExtensionList}).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ServerHello,"spec",{serverVersion:ProtocolVersion,random:DtlsRandom.spec,sessionId:import_binary_data15.types.buffer(import_binary_data15.types.uint8),cipherSuite:import_binary_data15.types.uint16be,compressionMethod:import_binary_data15.types.uint8});var ServerHello=_ServerHello,import_binary_data16=__toESM(require_src4()),_ServerHelloDone=class e{constructor(){__publicField(this,"msgType",14),__publicField(this,"messageSeq")}static createEmpty(){return new e}static deSerialize(t){return new e(...Object.values((0,import_binary_data16.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data16.encode)(this,e.spec).slice();return Buffer.from(t)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ServerHelloDone,"spec",{});var ServerHelloDone=_ServerHelloDone,import_binary_data18=__toESM(require_src4()),import_binary_data17=__toESM(require_src4());function encodeBuffer(e,t){return Buffer.from((0,import_binary_data17.encode)(e,t).slice())}var _ServerKeyExchange=class e{constructor(e,t,i,r,s,n,a,o){this.ellipticCurveType=e,this.namedCurve=t,this.publicKeyLength=i,this.publicKey=r,this.hashAlgorithm=s,this.signatureAlgorithm=n,this.signatureLength=a,this.signature=o,__publicField(this,"msgType",12),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}static deSerialize(t){const i=(0,import_binary_data18.decode)(t,e.spec);return new e(...Object.values(i))}serialize(){return encodeBuffer(this,e.spec)}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ServerKeyExchange,"spec",{ellipticCurveType:import_binary_data18.types.uint8,namedCurve:import_binary_data18.types.uint16be,publicKeyLength:import_binary_data18.types.uint8,publicKey:import_binary_data18.types.buffer((e=>e.current.publicKeyLength)),hashAlgorithm:import_binary_data18.types.uint8,signatureAlgorithm:import_binary_data18.types.uint8,signatureLength:import_binary_data18.types.uint16be,signature:import_binary_data18.types.buffer((e=>e.current.signatureLength))});var ServerKeyExchange=_ServerKeyExchange,ProtectionProfileAes128CmHmacSha1_80=1,ProtectionProfileAeadAes128Gcm=7,keyLength=e=>{switch(e){case ProtectionProfileAes128CmHmacSha1_80:case ProtectionProfileAeadAes128Gcm:return 16}},saltLength=e=>{switch(e){case ProtectionProfileAes128CmHmacSha1_80:return 14;case ProtectionProfileAeadAes128Gcm:return 12}},import_leb128=__toESM(require_dist2()),log6=debug2("werift-rtp : packages/rtp/src/codec/av1.ts"),_AV1RtpPayload=class{constructor(){__publicField(this,"zBit_RtpStartsWithFragment"),__publicField(this,"yBit_RtpEndsWithFragment"),__publicField(this,"w_RtpNumObus"),__publicField(this,"nBit_RtpStartsNewCodedVideoSequence"),__publicField(this,"obu_or_fragment",[])}static isDetectedFinalPacketInSequence(e){return e.marker}get isKeyframe(){return 1===this.nBit_RtpStartsNewCodedVideoSequence}static getFrame(e){const t=[],i=e.flatMap((e=>e.obu_or_fragment)).reduce(((e,t,i)=>(e[i]=t,e)),{}),r=Object.keys(i).length;for(const e of Object.keys(i).map(Number)){const s=i[e];if(!s)continue;const{data:n,isFragment:a}=s;if(a){let s=[];for(let t=e;t<r;t++){const e=i[t];if(!e.isFragment)break;s.push(e.data),delete i[t]}s.length<=1&&(log6("fragment lost, maybe packet lost"),s=[]),t.push(Buffer.concat(s))}else t.push(n)}const s=t.map((e=>AV1Obu.deSerialize(e))),n=s.pop();return Buffer.concat([...s.map((e=>(e.obu_has_size_field=1,e.serialize()))),n.serialize()])}};__publicField(_AV1RtpPayload,"deSerialize",(e=>{const t=new _AV1RtpPayload;let i=0;if(t.zBit_RtpStartsWithFragment=getBit(e[i],0),t.yBit_RtpEndsWithFragment=getBit(e[i],1),t.w_RtpNumObus=getBit(e[i],2,2),t.nBit_RtpStartsNewCodedVideoSequence=getBit(e[i],4),i++,t.nBit_RtpStartsNewCodedVideoSequence&&t.zBit_RtpStartsWithFragment)throw new Error;[...Array(t.w_RtpNumObus-1).keys()].forEach((r=>{const[s,n]=leb128decode(e.subarray(i)),a=i+n,o=a+s;let c=!1;t.zBit_RtpStartsWithFragment&&0===r&&(c=!0),t.obu_or_fragment.push({data:e.subarray(a,o),isFragment:c}),i+=n+s}));let r=!1;return(t.yBit_RtpEndsWithFragment||1===t.w_RtpNumObus&&t.zBit_RtpStartsWithFragment)&&(r=!0),t.obu_or_fragment.push({data:e.subarray(i),isFragment:r}),t}));var AV1RtpPayload=_AV1RtpPayload,AV1Obu=class e{constructor(){__publicField(this,"obu_forbidden_bit"),__publicField(this,"obu_type"),__publicField(this,"obu_extension_flag"),__publicField(this,"obu_has_size_field"),__publicField(this,"obu_reserved_1bit"),__publicField(this,"payload")}static deSerialize(t){const i=new e;let r=0;return i.obu_forbidden_bit=getBit(t[r],0),i.obu_type=OBU_TYPES[getBit(t[r],1,4)],i.obu_extension_flag=getBit(t[r],5),i.obu_has_size_field=getBit(t[r],6),i.obu_reserved_1bit=getBit(t[r],7),r++,i.payload=t.subarray(r),i}serialize(){const e=new BitWriter2(8).set(this.obu_forbidden_bit).set(OBU_TYPE_IDS[this.obu_type],4).set(this.obu_extension_flag).set(this.obu_has_size_field).set(this.obu_reserved_1bit).buffer;let t=Buffer.alloc(0);return this.obu_has_size_field&&(t=import_leb128.LEB128.encode(this.payload.length)),Buffer.concat([e,t,this.payload])}};function leb128decode(e){let t=0,i=0;for(let r=0;r<8;r++){const s=e.readUInt8(r);if(t|=(127&s)<<7*r,i++,!(128&s))break}return[t,i]}var OBU_TYPES={0:"Reserved",1:"OBU_SEQUENCE_HEADER",2:"OBU_TEMPORAL_DELIMITER",3:"OBU_FRAME_HEADER",4:"OBU_TILE_GROUP",5:"OBU_METADATA",6:"OBU_FRAME",7:"OBU_REDUNDANT_FRAME_HEADER",8:"OBU_TILE_LIST",15:"OBU_PADDING"},OBU_TYPE_IDS=Object.entries(OBU_TYPES).reduce(((e,[t,i])=>(e[i]=Number(t),e)),{}),H264RtpPayload=class e{constructor(){__publicField(this,"f"),__publicField(this,"nri"),__publicField(this,"nalUnitType"),__publicField(this,"s"),__publicField(this,"e"),__publicField(this,"r"),__publicField(this,"nalUnitPayloadType"),__publicField(this,"payload"),__publicField(this,"fragment")}static deSerialize(t,i){const r=new e;let s=0;const n=t[s];if(r.f=getBit(n,0),r.nri=getBit(n,1,2),r.nalUnitType=getBit(n,3,5),s++,r.s=getBit(t[s],0),r.e=getBit(t[s],1),r.r=getBit(t[s],2),r.nalUnitPayloadType=getBit(t[s],3,5),s++,0<r.nalUnitType&&r.nalUnitType<NalUnitType.stap_a)r.payload=this.packaging(t);else if(r.nalUnitType===NalUnitType.stap_a){let e=stap_aHeaderSize,i=Buffer.alloc(0);for(;e<t.length;){const r=t.readUInt16BE(e);e+=stap_aNALULengthSize,i=Buffer.concat([i,this.packaging(t.subarray(e,e+r))]),e+=r}r.payload=i}else if(r.nalUnitType===NalUnitType.fu_a){i||(i=Buffer.alloc(0));const e=t.subarray(s);if(r.fragment=Buffer.concat([i,e]),r.e){const e=new BitStream(Buffer.alloc(1)).writeBits(1,0).writeBits(2,r.nri).writeBits(5,r.nalUnitPayloadType),t=Buffer.concat([e.uint8Array,r.fragment]);r.fragment=void 0,r.payload=this.packaging(t)}}return r}static packaging(e){return Buffer.concat([annex_bNALUStartCode,e])}static isDetectedFinalPacketInSequence(e){return e.marker}get isKeyframe(){return this.nalUnitType===NalUnitType.idrSlice||this.nalUnitPayloadType===NalUnitType.idrSlice}get isPartitionHead(){return this.nalUnitType!==NalUnitType.fu_a&&this.nalUnitType!==NalUnitType.fu_b||0!==this.s}},NalUnitType={idrSlice:5,stap_a:24,stap_b:25,mtap16:26,mtap24:27,fu_a:28,fu_b:29},annex_bNALUStartCode=Buffer.from([0,0,0,1]),stap_aHeaderSize=1,stap_aNALULengthSize=2,OpusRtpPayload=class e{constructor(){__publicField(this,"payload")}static deSerialize(t){const i=new e;return i.payload=t,i}static isDetectedFinalPacketInSequence(e){return!0}get isKeyframe(){return!0}static createCodecPrivate(e=48e3){return Buffer.concat([Buffer.from("OpusHead"),bufferWriter([1,1],[1,2]),bufferWriterLE([2,4,2,1],[312,e,0,0])])}},Vp8RtpPayload=class e{constructor(){__publicField(this,"xBit"),__publicField(this,"nBit"),__publicField(this,"sBit"),__publicField(this,"pid"),__publicField(this,"iBit"),__publicField(this,"lBit"),__publicField(this,"tBit"),__publicField(this,"kBit"),__publicField(this,"mBit"),__publicField(this,"pictureId"),__publicField(this,"payload"),__publicField(this,"size0",0),__publicField(this,"hBit"),__publicField(this,"ver"),__publicField(this,"pBit"),__publicField(this,"size1",0),__publicField(this,"size2",0)}static deSerialize(t){const i=new e;let r=0;if(i.xBit=getBit(t[r],0),i.nBit=getBit(t[r],2),i.sBit=getBit(t[r],3),i.pid=getBit(t[r],5,3),r++,i.xBit&&(i.iBit=getBit(t[r],0),i.lBit=getBit(t[r],1),i.tBit=getBit(t[r],2),i.kBit=getBit(t[r],3),r++),i.iBit)if(i.mBit=getBit(t[r],0),i.mBit){const e=paddingByte(getBit(t[r],1,7)),s=paddingByte(t[r+1]);i.pictureId=Number.parseInt(e+s,2),r+=2}else i.pictureId=getBit(t[r],1,7),r++;return i.lBit&&r++,(i.lBit||i.kBit)&&(i.tBit,i.kBit,r++),i.payload=t.subarray(r),i.payloadHeaderExist&&(i.size0=getBit(t[r],0,3),i.hBit=getBit(t[r],3),i.ver=getBit(t[r],4,3),i.pBit=getBit(t[r],7),r++,i.size1=t[r],r++,i.size2=t[r]),i}static isDetectedFinalPacketInSequence(e){return e.marker}get isKeyframe(){return 0===this.pBit}get isPartitionHead(){return 1===this.sBit}get payloadHeaderExist(){return 1===this.sBit&&0===this.pid}get size(){if(this.payloadHeaderExist){return this.size0+8*this.size1+2048*this.size2}return 0}},Vp9RtpPayload=class e{constructor(){__publicField(this,"iBit"),__publicField(this,"pBit"),__publicField(this,"lBit"),__publicField(this,"fBit"),__publicField(this,"bBit"),__publicField(this,"eBit"),__publicField(this,"vBit"),__publicField(this,"zBit"),__publicField(this,"m"),__publicField(this,"pictureId"),__publicField(this,"tid"),__publicField(this,"u"),__publicField(this,"sid"),__publicField(this,"d"),__publicField(this,"tl0PicIdx"),__publicField(this,"pDiff",[]),__publicField(this,"n_s"),__publicField(this,"y"),__publicField(this,"g"),__publicField(this,"width",[]),__publicField(this,"height",[]),__publicField(this,"n_g",0),__publicField(this,"pgT",[]),__publicField(this,"pgU",[]),__publicField(this,"pgP_Diff",[]),__publicField(this,"payload")}static deSerialize(e){const{p:t,offset:i}=this.parseRtpPayload(e);return t.payload=e.subarray(i),t}static parseRtpPayload(t){const i=new e;let r=0;if(i.iBit=getBit(t[r],0),i.pBit=getBit(t[r],1),i.lBit=getBit(t[r],2),i.fBit=getBit(t[r],3),i.bBit=getBit(t[r],4),i.eBit=getBit(t[r],5),i.vBit=getBit(t[r],6),i.zBit=getBit(t[r],7),r++,i.iBit)if(i.m=getBit(t[r],0),i.m){const e=paddingByte(getBit(t[r],1,7)),s=paddingByte(t[r+1]);i.pictureId=Number.parseInt(e+s,2),r+=2}else i.pictureId=getBit(t[r],1,7),r++;if(i.lBit&&(i.tid=getBit(t[r],0,3),i.u=getBit(t[r],3),i.sid=getBit(t[r],4,3),i.d=getBit(t[r],7),r++,0===i.fBit&&(i.tl0PicIdx=t[r],r++)),i.fBit&&i.pBit)for(;;){i.pDiff=[...i.pDiff,getBit(t[r],0,7)];const e=getBit(t[r],7);if(r++,0===e)break}return i.vBit&&(i.n_s=getBit(t[r],0,3),i.y=getBit(t[r],3),i.g=getBit(t[r],4),r++,i.y&&[...Array(i.n_s+1)].forEach((()=>{i.width.push(t.readUInt16BE(r)),r+=2,i.height.push(t.readUInt16BE(r)),r+=2})),i.g&&(i.n_g=t[r],r++),i.n_g>0&&[...Array(i.n_g).keys()].forEach((e=>{i.pgT.push(getBit(t[r],0,3)),i.pgU.push(getBit(t[r],3));const s=getBit(t[r],4,2);r++,i.pgP_Diff[e]=[],s>0&&[...Array(s)].forEach((()=>{i.pgP_Diff[e].push(t[r]),r++}))}))),{offset:r,p:i}}static isDetectedFinalPacketInSequence(e){return e.marker}get isKeyframe(){return!(this.pBit||!this.bBit||this.sid&&this.lBit)}get isPartitionHead(){return this.bBit&&(!this.lBit||!this.d)}};function dePacketizeRtpPackets(e,t,i){const r=e=>{const r=[];for(const s of t){const t=e.deSerialize(s.payload,i);t.fragment?(i??(i=Buffer.alloc(0)),i=t.fragment):t.payload&&(i=void 0),r.push(t)}return{isKeyframe:!!r.find((e=>e.isKeyframe)),data:Buffer.concat(r.map((e=>e.payload)).filter((e=>e))),sequence:t.at(-1)?.header.sequenceNumber??0,timestamp:t.at(-1)?.header.timestamp??0,frameFragmentBuffer:i}};switch(e.toUpperCase()){case"AV1":{const e=t.map((e=>AV1RtpPayload.deSerialize(e.payload)));return{isKeyframe:!!e.find((e=>e.isKeyframe)),data:AV1RtpPayload.getFrame(e),sequence:t.at(-1)?.header.sequenceNumber??0,timestamp:t.at(-1)?.header.timestamp??0}}case"MPEG4/ISO/AVC":return r(H264RtpPayload);case"VP8":return r(Vp8RtpPayload);case"VP9":return r(Vp9RtpPayload);case"OPUS":return r(OpusRtpPayload);default:throw new Error}}function enumerate(e){return e.map(((e,t)=>[t,e]))}function growBufferSize(e,t){const i=Buffer.alloc(t);return e.copy(i),i}function Int(e){return Number.parseInt(e.toString(),10)}var timer={setTimeout:(...e)=>{const t=setTimeout(...e);return()=>clearTimeout(t)},setInterval:(...e)=>{const t=setInterval((()=>{e[0]()}),...e.slice(1));return()=>clearInterval(t)}};function isMedia(e){const t=e[0];return t>127&&t<192}var RTCP_HEADER_SIZE=4,RtcpHeader=class e{constructor(e={}){__publicField(this,"version",2),__publicField(this,"padding",!1),__publicField(this,"count",0),__publicField(this,"type",0),__publicField(this,"length",0),Object.assign(this,e)}static serialize(t,i,r,s){const n=new e({type:t,count:i,version:2,length:s}).serialize();return Buffer.concat([n,r])}serialize(){const e=new BitWriter(8);e.set(2,0,this.version),this.padding&&e.set(1,2,1),e.set(5,3,this.count);return bufferWriter([1,1,2],[e.value,this.type,this.length])}static deSerialize(t){const[i,r,s]=bufferReader(t,[1,1,2]),n=getBit(i,0,2),a=getBit(i,2,1)>0,o=getBit(i,3,5);return new e({version:n,padding:a,count:o,type:r,length:s})}},_FullIntraRequest=class e{constructor(t={}){__publicField(this,"count",e.count),__publicField(this,"senderSsrc"),__publicField(this,"mediaSsrc"),__publicField(this,"fir",[]),Object.assign(this,t)}get length(){return Math.floor(this.serialize().length/4-1)}static deSerialize(t){const[i,r]=bufferReader(t,[4,4]),s=[];for(let e=8;e<t.length;e+=8)s.push({ssrc:t.readUInt32BE(e),sequenceNumber:t[e+4]});return new e({senderSsrc:i,mediaSsrc:r,fir:s})}serialize(){const e=bufferWriter([4,4],[this.senderSsrc,this.mediaSsrc]),t=Buffer.alloc(8*this.fir.length);return this.fir.forEach((({ssrc:e,sequenceNumber:i},r)=>{t.writeUInt32BE(e,8*r),t[8*r+4]=i})),Buffer.concat([e,t])}};__publicField(_FullIntraRequest,"count",4);var FullIntraRequest=_FullIntraRequest,_PictureLossIndication=class e{constructor(t={}){__publicField(this,"count",e.count),__publicField(this,"length",2),__publicField(this,"senderSsrc"),__publicField(this,"mediaSsrc"),Object.assign(this,t)}static deSerialize(t){const[i,r]=bufferReader(t,[4,4]);return new e({senderSsrc:i,mediaSsrc:r})}serialize(){return bufferWriter([4,4],[this.senderSsrc,this.mediaSsrc])}};__publicField(_PictureLossIndication,"count",1);var PictureLossIndication=_PictureLossIndication,_ReceiverEstimatedMaxBitrate=class e{constructor(t={}){__publicField(this,"length"),__publicField(this,"count",e.count),__publicField(this,"senderSsrc"),__publicField(this,"mediaSsrc"),__publicField(this,"uniqueID","REMB"),__publicField(this,"ssrcNum",0),__publicField(this,"brExp"),__publicField(this,"brMantissa"),__publicField(this,"bitrate"),__publicField(this,"ssrcFeedbacks",[]),Object.assign(this,t)}static deSerialize(t){const[i,r,s,n,a]=bufferReader(t,[4,4,4,1,1]),o=getBit(a,0,6),c=(getBit(a,6,2)<<16)+(t[14]<<8)+t[15],l=o>46?18446744073709551615n:BigInt(c)<<BigInt(o),u=[];for(let e=16;e<t.length;e+=4){const i=t.slice(e).readUIntBE(0,4);u.push(i)}return new e({senderSsrc:i,mediaSsrc:r,uniqueID:bufferWriter([4],[s]).toString(),ssrcNum:n,brExp:o,brMantissa:c,ssrcFeedbacks:u,bitrate:l})}serialize(){const e=Buffer.concat([bufferWriter([4,4],[this.senderSsrc,this.mediaSsrc]),Buffer.from(this.uniqueID),bufferWriter([1],[this.ssrcNum])]),t=new BitWriter(24);t.set(6,0,this.brExp).set(18,6,this.brMantissa);const i=Buffer.concat(this.ssrcFeedbacks.map((e=>bufferWriter([4],[e])))),r=Buffer.concat([e,bufferWriter([3],[t.value]),i]);return this.length=r.length/4,r}};__publicField(_ReceiverEstimatedMaxBitrate,"count",15);var ReceiverEstimatedMaxBitrate=_ReceiverEstimatedMaxBitrate,log7=debug2("werift-rtp: /rtcp/psfb/index"),_RtcpPayloadSpecificFeedback=class e{constructor(t={}){__publicField(this,"type",e.type),__publicField(this,"feedback"),Object.assign(this,t)}serialize(){const e=this.feedback.serialize();return RtcpHeader.serialize(this.type,this.feedback.count,e,this.feedback.length)}static deSerialize(t,i){let r;switch(i.count){case FullIntraRequest.count:r=FullIntraRequest.deSerialize(t);break;case PictureLossIndication.count:r=PictureLossIndication.deSerialize(t);break;case ReceiverEstimatedMaxBitrate.count:r=ReceiverEstimatedMaxBitrate.deSerialize(t);break;default:log7("unknown psfb packet",i.count)}return new e({feedback:r})}};__publicField(_RtcpPayloadSpecificFeedback,"type",206);var RtcpPayloadSpecificFeedback=_RtcpPayloadSpecificFeedback,_RtcpRrPacket=class e{constructor(t={}){__publicField(this,"ssrc",0),__publicField(this,"reports",[]),__publicField(this,"type",e.type),Object.assign(this,t)}serialize(){let t=bufferWriter([4],[this.ssrc]);return t=Buffer.concat([t,...this.reports.map((e=>e.serialize()))]),RtcpHeader.serialize(e.type,this.reports.length,t,Math.floor(t.length/4))}static deSerialize(t,i){const[r]=bufferReader(t,[4]);let s=4;const n=[];for(let e=0;e<i;e++)n.push(RtcpReceiverInfo.deSerialize(t.slice(s,s+24))),s+=24;return new e({ssrc:r,reports:n})}};__publicField(_RtcpRrPacket,"type",201);var RtcpRrPacket=_RtcpRrPacket,RtcpReceiverInfo=class e{constructor(e={}){__publicField(this,"ssrc"),__publicField(this,"fractionLost"),__publicField(this,"packetsLost"),__publicField(this,"highestSequence"),__publicField(this,"jitter"),__publicField(this,"lsr"),__publicField(this,"dlsr"),Object.assign(this,e)}toJSON(){return{ssrc:this.ssrc,fractionLost:this.fractionLost,packetsLost:this.packetsLost,highestSequence:this.highestSequence,jitter:this.jitter,lsr:this.lsr,dlsr:this.dlsr}}serialize(){return bufferWriter([4,1,3,4,4,4,4],[this.ssrc,this.fractionLost,this.packetsLost,this.highestSequence,this.jitter,this.lsr,this.dlsr])}static deSerialize(t){const[i,r,s,n,a,o,c]=bufferReader(t,[4,1,3,4,4,4,4]);return new e({ssrc:i,fractionLost:r,packetsLost:s,highestSequence:n,jitter:a,lsr:o,dlsr:c})}},RtcpTransportLayerFeedbackType=205,_GenericNack=class e{constructor(t={}){__publicField(this,"count",e.count),__publicField(this,"header"),__publicField(this,"senderSsrc"),__publicField(this,"mediaSourceSsrc"),__publicField(this,"lost",[]),Object.assign(this,t),this.header||(this.header=new RtcpHeader({type:RtcpTransportLayerFeedbackType,count:this.count,version:2}))}toJSON(){return{lost:this.lost,senderSsrc:this.senderSsrc,mediaSourceSsrc:this.mediaSourceSsrc}}static deSerialize(t,i){const[r,s]=bufferReader(t,[4,4]),n=[];for(let e=8;e<t.length;e+=4){const[i,r]=bufferReader(t.subarray(e),[2,2]);n.push(i);for(let e=0;e<16;e++)r>>e&1&&n.push(i+e+1)}return new e({header:i,senderSsrc:r,mediaSourceSsrc:s,lost:n})}serialize(){const e=bufferWriter([4,4],[this.senderSsrc,this.mediaSourceSsrc]),t=[];if(this.lost.length>0){let e=this.lost[0],i=0;this.lost.slice(1).forEach((r=>{const s=r-e-1;s>=0&&s<16?i|=1<<s:(t.push(bufferWriter([2,2],[e,i])),e=r,i=0)})),t.push(bufferWriter([2,2],[e,i]))}const i=Buffer.concat([e,Buffer.concat(t)]);return this.header.length=i.length/4,Buffer.concat([this.header.serialize(),i])}};__publicField(_GenericNack,"count",1);var GenericNack=_GenericNack,log8=debug2("werift/rtp/rtcp/rtpfb/twcc"),_TransportWideCC=class e{constructor(t={}){__publicField(this,"count",e.count),__publicField(this,"length",2),__publicField(this,"senderSsrc"),__publicField(this,"mediaSourceSsrc"),__publicField(this,"baseSequenceNumber"),__publicField(this,"packetStatusCount"),__publicField(this,"referenceTime"),__publicField(this,"fbPktCount"),__publicField(this,"packetChunks",[]),__publicField(this,"recvDeltas",[]),__publicField(this,"header"),Object.assign(this,t),this.header||(this.header=new RtcpHeader({type:205,count:this.count,version:2}))}static deSerialize(t,i){const[r,s,n,a,o,c]=bufferReader(t,[4,4,2,2,3,1]),l=[],u=[];let d=16;for(let e=0;e<a;){let i;switch(getBit(t.slice(d,d+1)[0],0,1)){case 0:{const r=RunLengthChunk.deSerialize(t.slice(d,d+2));i=r;const s=Math.min(a-e,r.runLength);if(1===r.packetStatus||2===r.packetStatus)for(let e=0;e<s;e++)u.push(new RecvDelta({type:r.packetStatus}));e+=s}break;case 1:{const r=StatusVectorChunk.deSerialize(t.slice(d,d+2));i=r,0===r.symbolSize&&r.symbolList.forEach((e=>{1===e&&u.push(new RecvDelta({type:1}))})),1===r.symbolSize&&r.symbolList.forEach((e=>{1!==e&&2!==e||u.push(new RecvDelta({type:e}))})),e+=r.symbolList.length}}if(!i)throw new Error;d+=2,l.push(i)}let p=d;return u.forEach((e=>{1===e.type&&(e.deSerialize(t.slice(p,p+1)),p++),2===e.type&&(e.deSerialize(t.slice(p,p+2)),p+=2)})),new e({senderSsrc:r,mediaSourceSsrc:s,baseSequenceNumber:n,packetStatusCount:a,referenceTime:o,fbPktCount:c,recvDeltas:u,packetChunks:l,header:i})}serialize(){const e=bufferWriter([4,4,2,2,3,1],[this.senderSsrc,this.mediaSourceSsrc,this.baseSequenceNumber,this.packetStatusCount,this.referenceTime,this.fbPktCount]),t=Buffer.concat(this.packetChunks.map((e=>e.serialize()))),i=Buffer.concat(this.recvDeltas.map((e=>{try{return e.serialize()}catch(e){return void log8(e?.message)}})).filter((e=>e))),r=Buffer.concat([e,t,i]);if(this.header.padding&&r.length%4!=0){const e=4-r.length%4,t=Buffer.alloc(e);return t[t.length-1]=t.length,this.header.length=Math.floor((r.length+t.length)/4),Buffer.concat([this.header.serialize(),r,t])}return this.header.length=Math.floor(r.length/4),Buffer.concat([this.header.serialize(),r])}get packetResults(){const e=this.baseSequenceNumber-1,t=this.packetChunks.filter((e=>e instanceof RunLengthChunk)).flatMap((t=>t.results(e)));let i=0;let r=64n*BigInt(this.referenceTime);for(const e of t){const t=this.recvDeltas[i];e.received&&t&&(r+=BigInt(t.delta)/1000n,e.delta=t.delta,e.receivedAtMs=Number(r),i++)}return t}};__publicField(_TransportWideCC,"count",15);var TransportWideCC=_TransportWideCC,RunLengthChunk=class e{constructor(e={}){__publicField(this,"type"),__publicField(this,"packetStatus"),__publicField(this,"runLength"),Object.assign(this,e),this.type=0}static deSerialize(t){const i=getBit(t[0],1,2),r=(getBit(t[0],3,5)<<8)+t[1];return new e({type:0,packetStatus:i,runLength:r})}serialize(){return new BitWriter2(16).set(0).set(this.packetStatus,2).set(this.runLength,13).buffer}results(e){const t=1===this.packetStatus||2===this.packetStatus,i=[];for(let r=0;r<=this.runLength;++r)i.push(new PacketResult({sequenceNumber:++e,received:t}));return i}},StatusVectorChunk=class e{constructor(e={}){__publicField(this,"type"),__publicField(this,"symbolSize"),__publicField(this,"symbolList",[]),Object.assign(this,e)}static deSerialize(t){let i=getBit(t[0],1,1);const r=[];function s(e,t){for(let i=0;i<e;i++)t(i)}switch(i){case 0:s(6,(e=>r.push(getBit(t[0],2+e,1)))),s(8,(e=>r.push(getBit(t[1],e,1))));break;case 1:s(3,(e=>r.push(getBit(t[0],2+2*e,2)))),s(4,(e=>r.push(getBit(t[1],2*e,2))));break;default:i=(getBit(t[0],2,6)<<8)+t[1]}return new e({type:1,symbolSize:i,symbolList:r})}serialize(){const e=Buffer.alloc(2),t=new BitWriter2(16).set(1).set(this.symbolSize),i=0===this.symbolSize?1:2;return this.symbolList.forEach((e=>{t.set(e,i)})),e.writeUInt16BE(t.value),e}},RecvDelta=class e{constructor(e={}){__publicField(this,"type"),__publicField(this,"delta"),__publicField(this,"parsed",!1),Object.assign(this,e)}static deSerialize(t){let i,r;if(1===t.length?(i=1,r=250*t[0]):2===t.length&&(i=2,r=250*t.readInt16BE()),void 0===i||void 0===r)throw new Error;return new e({type:i,delta:r})}deSerialize(t){const i=e.deSerialize(t);this.delta=i.delta}parseDelta(){this.delta=Math.floor(this.delta/250),this.delta<0||this.delta>255?(this.delta>32767&&(this.delta=32767),this.delta<-32768&&(this.delta=-32768),this.type||(this.type=2)):this.type||(this.type=1),this.parsed=!0}serialize(){if(this.parsed||this.parseDelta(),1===this.type){const e=Buffer.alloc(1);return e.writeUInt8(this.delta),e}if(2===this.type){const e=Buffer.alloc(2);return e.writeInt16BE(this.delta),e}throw new Error("errDeltaExceedLimit "+this.delta+" "+this.type)}},PacketResult=class{constructor(e){__publicField(this,"sequenceNumber",0),__publicField(this,"delta",0),__publicField(this,"received",!1),__publicField(this,"receivedAtMs",0),Object.assign(this,e)}},log9=debug2("werift-rtp:packages/rtp/rtcp/rtpfb/index"),_RtcpTransportLayerFeedback=class e{constructor(t={}){__publicField(this,"type",e.type),__publicField(this,"feedback"),__publicField(this,"header"),Object.assign(this,t)}serialize(){return this.feedback.serialize()}static deSerialize(t,i){let r;switch(i.count){case GenericNack.count:r=GenericNack.deSerialize(t,i);break;case TransportWideCC.count:r=TransportWideCC.deSerialize(t,i);break;default:log9("unknown rtpfb packet",i.count)}return new e({feedback:r,header:i})}};__publicField(_RtcpTransportLayerFeedback,"type",RtcpTransportLayerFeedbackType);var RtcpTransportLayerFeedback=_RtcpTransportLayerFeedback,_RtcpSourceDescriptionPacket=class e{constructor(t){__publicField(this,"type",e.type),__publicField(this,"chunks",[]),Object.assign(this,t)}get length(){let e=0;return this.chunks.forEach((t=>e+=t.length)),e}serialize(){let e=Buffer.concat(this.chunks.map((e=>e.serialize())));for(;e.length%4;)e=Buffer.concat([e,Buffer.from([0])]);return RtcpHeader.serialize(this.type,this.chunks.length,e,e.length/4)}static deSerialize(t,i){const r=[];for(let e=0;e<t.length;){const i=SourceDescriptionChunk.deSerialize(t.slice(e));r.push(i),e+=i.length}return new e({chunks:r})}};__publicField(_RtcpSourceDescriptionPacket,"type",202);var RtcpSourceDescriptionPacket=_RtcpSourceDescriptionPacket,SourceDescriptionChunk=class e{constructor(e={}){__publicField(this,"source"),__publicField(this,"items",[]),Object.assign(this,e)}get length(){let e=4;return this.items.forEach((t=>e+=t.length)),e+=1,e+=getPadding(e),e}serialize(){const e=Buffer.concat([bufferWriter([4],[this.source]),Buffer.concat(this.items.map((e=>e.serialize())))]);return Buffer.concat([e,Buffer.alloc(getPadding(e.length))])}static deSerialize(t){const i=t.readUInt32BE(),r=[];for(let e=4;e<t.length;){if(0===t[e])break;const i=SourceDescriptionItem.deSerialize(t.slice(e));r.push(i),e+=i.length}return new e({source:i,items:r})}},SourceDescriptionItem=class e{constructor(e){__publicField(this,"type"),__publicField(this,"text"),Object.assign(this,e)}get length(){return 2+Buffer.from(this.text).length}serialize(){const e=Buffer.from(this.text);return Buffer.concat([bufferWriter([1,1],[this.type,e.length]),e])}static deSerialize(t){const i=t[0],r=t[1],s=t.slice(2,2+r).toString();return new e({type:i,text:s})}};function getPadding(e){return e%4==0?0:4-e%4}var _RtcpSrPacket=class e{constructor(t){__publicField(this,"ssrc",0),__publicField(this,"senderInfo"),__publicField(this,"reports",[]),__publicField(this,"type",e.type),Object.assign(this,t)}toJSON(){return{ssrc:this.ssrc,senderInfo:this.senderInfo.toJSON(),reports:this.reports.map((e=>e.toJSON()))}}serialize(){let t=Buffer.alloc(4);return t.writeUInt32BE(this.ssrc),t=Buffer.concat([t,this.senderInfo.serialize()]),t=Buffer.concat([t,...this.reports.map((e=>e.serialize()))]),RtcpHeader.serialize(e.type,this.reports.length,t,Math.floor(t.length/4))}static deSerialize(t,i){const r=t.readUInt32BE(),s=RtcpSenderInfo.deSerialize(t.subarray(4,24));let n=24;const a=[];for(let e=0;e<i;e++)a.push(RtcpReceiverInfo.deSerialize(t.subarray(n,n+24))),n+=24;return new e({ssrc:r,senderInfo:s,reports:a})}};__publicField(_RtcpSrPacket,"type",200);var RtcpSrPacket=_RtcpSrPacket,RtcpSenderInfo=class e{constructor(e={}){__publicField(this,"ntpTimestamp"),__publicField(this,"rtpTimestamp"),__publicField(this,"packetCount"),__publicField(this,"octetCount"),Object.assign(this,e)}toJSON(){return{ntpTimestamp:ntpTime2Sec(this.ntpTimestamp),rtpTimestamp:this.rtpTimestamp}}serialize(){return bufferWriter([8,4,4,4],[this.ntpTimestamp,this.rtpTimestamp,this.packetCount,this.octetCount])}static deSerialize(t){const[i,r,s,n]=bufferReader(t,[8,4,4,4]);return new e({ntpTimestamp:i,rtpTimestamp:r,packetCount:s,octetCount:n})}},ntpTime2Sec=e=>{const[t,i]=bufferReader(bufferWriter([8],[e]),[4,4]);return Number(`${t}.${i}`)},log10=debug2("werift-rtp:packages/rtp/src/rtcp/rtcp.ts"),RtcpPacketConverter=class{static deSerialize(e){let t=0;const i=[];for(;t<e.length;){const r=RtcpHeader.deSerialize(e.subarray(t,t+RTCP_HEADER_SIZE));t+=RTCP_HEADER_SIZE;let s=e.subarray(t);t+=4*r.length,r.padding&&(s=s.subarray(0,s.length-s.subarray(-1)[0]));try{switch(r.type){case RtcpSrPacket.type:i.push(RtcpSrPacket.deSerialize(s,r.count));break;case RtcpRrPacket.type:i.push(RtcpRrPacket.deSerialize(s,r.count));break;case RtcpSourceDescriptionPacket.type:i.push(RtcpSourceDescriptionPacket.deSerialize(s,r));break;case RtcpTransportLayerFeedback.type:i.push(RtcpTransportLayerFeedback.deSerialize(s,r));break;case RtcpPayloadSpecificFeedback.type:i.push(RtcpPayloadSpecificFeedback.deSerialize(s,r))}}catch(e){log10("deSerialize RTCP",e)}}return i}};function isRtcp(e){return e.length>=2&&e[1]>=192&&e[1]<=208}var RTP_EXTENSION_URI={sdesMid:"urn:ietf:params:rtp-hdrext:sdes:mid",sdesRTPStreamID:"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",repairedRtpStreamId:"urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id",transportWideCC:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",absSendTime:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",dependencyDescriptor:"https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension",audioLevelIndication:"urn:ietf:params:rtp-hdrext:ssrc-audio-level",videoOrientation:"urn:3gpp:video-orientation"};function rtpHeaderExtensionsParser(e,t){return e.map((e=>{const i=t[e.id];if(!i)return{uri:"unknown",value:e.payload};switch(i){case RTP_EXTENSION_URI.sdesMid:case RTP_EXTENSION_URI.sdesRTPStreamID:case RTP_EXTENSION_URI.repairedRtpStreamId:return{uri:i,value:deserializeString(e.payload)};case RTP_EXTENSION_URI.transportWideCC:return{uri:i,value:deserializeUint16BE(e.payload)};case RTP_EXTENSION_URI.absSendTime:return{uri:i,value:deserializeAbsSendTime(e.payload)};case RTP_EXTENSION_URI.audioLevelIndication:return{uri:i,value:deserializeAudioLevelIndication(e.payload)};case RTP_EXTENSION_URI.videoOrientation:return{uri:i,value:deserializeVideoOrientation(e.payload)};default:return{uri:i,value:e.payload}}})).reduce(((e,t)=>(t&&(e[t.uri]=t.value),e)),{})}function serializeSdesMid(e){return Buffer.from(e)}function serializeSdesRTPStreamID(e){return Buffer.from(e)}function serializeRepairedRtpStreamId(e){return Buffer.from(e)}function serializeTransportWideCC(e){return bufferWriter([2],[e])}function serializeAbsSendTime(e){const t=Buffer.alloc(3),i=e>>14n&0x00ffffffn;return t.writeUIntBE(Number(i),0,3),t}function deserializeString(e){return e.toString()}function deserializeUint16BE(e){return e.readUInt16BE()}function deserializeAbsSendTime(e){return bufferReader(e,[3])[0]}function deserializeAudioLevelIndication(e){const t=new BitStream(e);return{v:1===t.readBits(1),level:t.readBits(7)}}function deserializeVideoOrientation(e){const t=new BitStream(e);t.readBits(4);return{c:t.readBits(1),f:t.readBits(1),r1:t.readBits(1),r0:t.readBits(1)}}var log11=debug2("packages/rtp/src/rtp/red/packet.ts"),Red=class e{constructor(){__publicField(this,"header"),__publicField(this,"blocks",[])}static deSerialize(t){const i=t instanceof ArrayBuffer?Buffer.from(t):t,r=new e;let s=0;return[r.header,s]=RedHeader.deSerialize(i),r.header.fields.forEach((({blockLength:e,timestampOffset:t,blockPT:n})=>{if(e&&t){const a=i.subarray(s,s+e);r.blocks.push({block:a,blockPT:n,timestampOffset:t}),s+=e}else{const e=i.subarray(s);r.blocks.push({block:e,blockPT:n})}})),r}serialize(){this.header=new RedHeader;for(const{timestampOffset:e,blockPT:t,block:i}of this.blocks)e?this.header.fields.push({fBit:1,blockPT:t,blockLength:i.length,timestampOffset:e}):this.header.fields.push({fBit:0,blockPT:t});let e=this.header.serialize();for(const{block:t}of this.blocks)e=Buffer.concat([e,t]);return e}},RedHeader=class e{constructor(){__publicField(this,"fields",[])}static deSerialize(t){let i=0;const r=new e;for(;;){const e={};r.fields.push(e);const s=new BitStream(t.subarray(i));if(e.fBit=s.readBits(1),e.blockPT=s.readBits(7),i++,0===e.fBit)break;e.timestampOffset=s.readBits(14),e.blockLength=s.readBits(10),i+=3}return[r,i]}serialize(){let e=Buffer.alloc(0);for(const t of this.fields)try{if(t.timestampOffset&&t.blockLength){const i=new BitStream(Buffer.alloc(4)).writeBits(1,t.fBit).writeBits(7,t.blockPT).writeBits(14,t.timestampOffset).writeBits(10,t.blockLength);e=Buffer.concat([e,i.uint8Array])}else{const i=new BitStream(Buffer.alloc(1)).writeBits(1,0).writeBits(7,t.blockPT);e=Buffer.concat([e,i.uint8Array])}}catch(e){log11(e?.message)}return e}},RedEncoder=class{constructor(e=1){this.distance=e,__publicField(this,"cache",[]),__publicField(this,"cacheSize",10)}push(e){this.cache.push(e),this.cache.length>this.cacheSize&&this.cache.shift()}build(){const e=new Red,t=this.cache.slice(-(this.distance+1)),i=t.pop();return i?(t.forEach((t=>{const r=uint32Add(i.timestamp,-t.timestamp);r>Max14Uint||e.blocks.push({block:t.block,blockPT:t.blockPT,timestampOffset:r})})),e.blocks.push({block:i.block,blockPT:i.blockPT}),e):e}},Max14Uint=16383,RedHandler=class{constructor(){__publicField(this,"size",150),__publicField(this,"sequenceNumbers",[])}push(e,t){const i=[];e.blocks.forEach((({blockPT:r,timestampOffset:s,block:n},a)=>{const o=uint16Add(t.header.sequenceNumber,-(e.blocks.length-(a+1)));s?i.push(new RtpPacket(new RtpHeader({timestamp:uint32Add(t.header.timestamp,-s),payloadType:r,ssrc:t.header.ssrc,sequenceNumber:o,marker:!0}),n)):i.push(new RtpPacket(new RtpHeader({timestamp:t.header.timestamp,payloadType:r,ssrc:t.header.ssrc,sequenceNumber:o,marker:!0}),n))}));return i.filter((e=>!this.sequenceNumbers.includes(e.header.sequenceNumber)&&(this.sequenceNumbers.length>this.size&&this.sequenceNumbers.shift(),this.sequenceNumbers.push(e.header.sequenceNumber),!0)))}},ExtensionProfiles={OneByte:48862,TwoByte:4096},seqNumOffset=2,timestampOffset=4,ssrcOffset=8,csrcOffset=12,csrcSize=4,RtpHeader=class e{constructor(e={}){__publicField(this,"version",2),__publicField(this,"padding",!1),__publicField(this,"paddingSize",0),__publicField(this,"extension",!1),__publicField(this,"marker",!1),__publicField(this,"payloadOffset",0),__publicField(this,"payloadType",0),__publicField(this,"sequenceNumber",0),__publicField(this,"timestamp",0),__publicField(this,"ssrc",0),__publicField(this,"csrcLength",0),__publicField(this,"csrc",[]),__publicField(this,"extensionProfile",ExtensionProfiles.OneByte),__publicField(this,"extensionLength"),__publicField(this,"extensions",[]),Object.assign(this,e)}static deSerialize(t){const i=new e;let r=0;const s=t[r++];i.version=getBit(s,0,2),i.padding=getBit(s,2)>0,i.extension=getBit(s,3)>0,i.csrcLength=getBit(s,4,4),i.csrc=[...Array(i.csrcLength)].map((()=>{const e=t.readUInt32BE(r);return r+=4,e})),r+=csrcOffset-1;const n=t[1];i.marker=getBit(n,0)>0,i.payloadType=getBit(n,1,7),i.sequenceNumber=t.readUInt16BE(seqNumOffset),i.timestamp=t.readUInt32BE(timestampOffset),i.ssrc=t.readUInt32BE(ssrcOffset);for(let e=0;e<i.csrc.length;e++){const r=csrcOffset+e*csrcSize;i.csrc[e]=t.subarray(r).readUInt32BE()}if(i.extension){i.extensionProfile=t.subarray(r).readUInt16BE(),r+=2;const e=4*t.subarray(r).readUInt16BE();switch(i.extensionLength=e,r+=2,i.extensionProfile){case ExtensionProfiles.OneByte:{const s=r+e;for(;r<s;){if(0===t[r]){r++;continue}const e=t[r]>>4,s=1+(t[r]&(240^t[r]));if(r++,15===e)break;const n={id:e,payload:t.subarray(r,r+s)};i.extensions=[...i.extensions,n],r+=s}}break;case ExtensionProfiles.TwoByte:{const s=r+e;for(;r<s;){if(0===t[r]){r++;continue}const e=t[r];r++;const s=t[r];r++;const n={id:e,payload:t.subarray(r,r+s)};i.extensions=[...i.extensions,n],r+=s}}break;default:{const s={id:0,payload:t.subarray(r,r+e)};i.extensions=[...i.extensions,s],r+=i.extensions[0].payload.length}}}return i.payloadOffset=r,i.padding&&(i.paddingSize=t[t.length-1]),i}get serializeSize(){const{csrc:e,extensionProfile:t,extensions:i}=this;let r=12+e.length*csrcSize;if(i.length>0||!0===this.extension){let e=4;switch(t){case ExtensionProfiles.OneByte:for(const t of i)e+=1+t.payload.length;break;case ExtensionProfiles.TwoByte:for(const t of i)e+=2+t.payload.length;break;default:e+=i[0].payload.length}r+=4*Math.floor((e+3)/4)}return r}serialize(e){const t=Buffer.alloc(e);let i=0;const r=new BitWriter(8);r.set(2,0,this.version),this.padding&&r.set(1,2,1),this.extensions.length>0&&(this.extension=!0),this.extension&&r.set(1,3,1),r.set(4,4,this.csrc.length),t.writeUInt8(r.value,i++);const s=new BitWriter(8);this.marker&&s.set(1,0,1),s.set(7,1,this.payloadType),t.writeUInt8(s.value,i++),t.writeUInt16BE(this.sequenceNumber,seqNumOffset),i+=2,t.writeUInt32BE(this.timestamp,timestampOffset),i+=4,t.writeUInt32BE(this.ssrc,ssrcOffset),i+=4;for(const e of this.csrc)t.writeUInt32BE(e,i),i+=4;if(this.extension){const e=i;t.writeUInt16BE(this.extensionProfile,i),i+=4;const r=i;switch(this.extensionProfile){case ExtensionProfiles.OneByte:for(const e of this.extensions)t.writeUInt8(e.id<<4|e.payload.length-1,i++),e.payload.copy(t,i),i+=e.payload.length;break;case ExtensionProfiles.TwoByte:for(const e of this.extensions)t.writeUInt8(e.id,i++),t.writeUInt8(e.payload.length,i++),e.payload.copy(t,i),i+=e.payload.length;break;default:{const e=this.extensions[0].payload.length;if(e%4!=0)throw new Error;this.extensions[0].payload.copy(t,i),i+=e}}const s=i-r,n=4*Math.trunc((s+3)/4);t.writeUInt16BE(Math.trunc(n/4),e+2);for(let e=0;e<n-s;e++)t.writeUInt8(0,i),i++}return this.payloadOffset=i,t}},RtpPacket=class e{constructor(e,t){this.header=e,this.payload=t}get serializeSize(){return this.header.serializeSize+this.payload.length}clone(){return new e(new RtpHeader({...this.header}),this.payload)}serialize(){let e=this.header.serialize(this.header.serializeSize+this.payload.length);const{payloadOffset:t}=this.header;if(this.payload.copy(e,t),this.header.padding){const t=Buffer.alloc(this.header.paddingSize);t.writeUInt8(this.header.paddingSize,this.header.paddingSize-1),e=Buffer.concat([e,t])}return e}static deSerialize(t){const i=RtpHeader.deSerialize(t);return new e(i,t.subarray(i.payloadOffset,t.length-i.paddingSize))}clear(){this.payload=null}},import_jspack2=__toESM(require_jspack());function unwrapRtx(e,t,i){return new RtpPacket(new RtpHeader({payloadType:t,marker:e.header.marker,sequenceNumber:import_jspack2.jspack.Unpack("!H",e.payload.subarray(0,2))[0],timestamp:e.header.timestamp,ssrc:i}),e.payload.subarray(2))}function wrapRtx(e,t,i,r){return new RtpPacket(new RtpHeader({payloadType:t,marker:e.header.marker,sequenceNumber:i,timestamp:e.header.timestamp,ssrc:r,csrc:e.header.csrc,extensions:e.header.extensions}),Buffer.concat([Buffer.from(import_jspack2.jspack.Pack("!H",[e.header.sequenceNumber])),e.payload]))}var import_crypto9=require("crypto"),import_aes_js=__toESM(require_aes_js()),import_crypto7=require("crypto"),CipherAesBase=class{constructor(e,t,i,r){this.srtpSessionKey=e,this.srtpSessionSalt=t,this.srtcpSessionKey=i,this.srtcpSessionSalt=r}encryptRtp(e,t,i){return Buffer.from([])}decryptRtp(e,t){return[]}encryptRTCP(e,t){return Buffer.from([])}decryptRTCP(e){return[]}},CipherAesCtr=class extends CipherAesBase{constructor(e,t,i,r,s,n){super(e,t,i,r),this.srtpSessionAuthTag=s,this.srtcpSessionAuthTag=n,__publicField(this,"authTagLength",10)}encryptRtp(e,t,i){const r=e.serialize(e.serializeSize),s=this.generateCounter(e.sequenceNumber,i,e.ssrc,this.srtpSessionSalt),n=(0,import_crypto7.createCipheriv)("aes-128-ctr",this.srtpSessionKey,s).update(t),a=this.generateSrtpAuthTag(i,r,n);return Buffer.concat([r,n,a])}decryptRtp(e,t){const i=RtpHeader.deSerialize(e),r=e.length-this.authTagLength;e=e.subarray(0,e.length-this.authTagLength);const s=this.generateCounter(i.sequenceNumber,t,i.ssrc,this.srtpSessionSalt),n=(0,import_crypto7.createDecipheriv)("aes-128-ctr",this.srtpSessionKey,s),a=e.subarray(i.payloadOffset),o=n.update(a);return[Buffer.concat([e.subarray(0,i.payloadOffset),o,Buffer.alloc(r-i.payloadOffset-o.length)]),i]}encryptRTCP(e,t){let i=Buffer.from(e);const r=i.readUInt32BE(4),s=this.generateCounter(65535&t,t>>16,r,this.srtcpSessionSalt);(0,import_crypto7.createCipheriv)("aes-128-ctr",this.srtcpSessionKey,s).update(i.slice(8)).copy(i,8),i=Buffer.concat([i,Buffer.alloc(4)]),i.writeUInt32BE(t,i.length-4),i[i.length-4]|=128;const n=this.generateSrtcpAuthTag(i);return i=Buffer.concat([i,n]),i}decryptRTCP(e){const t=RtcpHeader.deSerialize(e),i=e.length-(this.authTagLength+srtcpIndexSize),r=Buffer.from(e).slice(0,i);if(0===e[i]>>7)return[r,t];let s=e.readUInt32BE(i);s&=~(1<<31);const n=e.readUInt32BE(4),a=(e.subarray(e.length-10),this.generateCounter(65535&s,s>>16,n,this.srtcpSessionSalt));return(0,import_crypto7.createDecipheriv)("aes-128-ctr",this.srtcpSessionKey,a).update(r.subarray(8)).copy(r,8),[r,t]}generateSrtcpAuthTag(e){return(0,import_crypto7.createHmac)("sha1",this.srtcpSessionAuthTag).update(e).digest().slice(0,10)}generateCounter(e,t,i,r){const s=Buffer.alloc(16);s.writeUInt32BE(i,4),s.writeUInt32BE(t,8),s.writeUInt32BE(Number(BigInt(e)<<16n),12);for(let e=0;e<r.length;e++)s[e]^=r[e];return s}generateSrtpAuthTag(e,...t){const i=(0,import_crypto7.createHmac)("sha1",this.srtpSessionAuthTag),r=Buffer.alloc(4);r.writeUInt32BE(e);for(const e of t)i.update(e);return i.update(r).digest().subarray(0,10)}},srtcpIndexSize=4,import_crypto8=require("crypto"),CipherAesGcm=class extends CipherAesBase{constructor(e,t,i,r){super(e,t,i,r),__publicField(this,"aeadAuthTagLen",16),__publicField(this,"rtpIvWriter",createBufferWriter([2,4,4,2],!0)),__publicField(this,"rtcpIvWriter",createBufferWriter([2,4,2,4],!0)),__publicField(this,"aadWriter",createBufferWriter([4],!0))}encryptRtp(e,t,i){const r=e.serialize(e.serializeSize),s=this.rtpInitializationVector(e,i),n=(0,import_crypto8.createCipheriv)("aes-128-gcm",this.srtpSessionKey,s);n.setAAD(r);const a=n.update(t);n.final();const o=n.getAuthTag();return Buffer.concat([r,a,o])}decryptRtp(e,t){const i=RtpHeader.deSerialize(e);let r=Buffer.from([]);r=growBufferSize(r,e.length-this.aeadAuthTagLen),e.slice(0,i.payloadOffset).copy(r);const s=this.rtpInitializationVector(i,t),n=e.slice(i.payloadOffset,e.length-this.aeadAuthTagLen);return(0,import_crypto8.createDecipheriv)("aes-128-gcm",this.srtpSessionKey,s).update(n).copy(r,i.payloadOffset),[r,i]}encryptRTCP(e,t){const i=e.readUInt32BE(4),r=e.length+this.aeadAuthTagLen;let s=Buffer.from([]);s=growBufferSize(s,r+srtcpIndexSize2),e.slice(0,8).copy(s);const n=this.rtcpInitializationVector(i,t),a=this.rtcpAdditionalAuthenticatedData(e,t),o=(0,import_crypto8.createCipheriv)("aes-128-gcm",this.srtcpSessionKey,n);o.setAAD(a);const c=o.update(e.slice(8));o.final(),c.copy(s,8);return o.getAuthTag().copy(s,8+c.length),a.slice(8,12).copy(s,r),s}decryptRTCP(e){const t=RtcpHeader.deSerialize(e),i=e.length-srtcpIndexSize2,r=Buffer.alloc(i-this.aeadAuthTagLen);e.slice(0,8).copy(r);const s=e.readUInt32BE(4);let n=e.readUInt32BE(e.length-4);n&=~(rtcpEncryptionFlag<<24);const a=this.rtcpInitializationVector(s,n),o=this.rtcpAdditionalAuthenticatedData(e,n),c=(0,import_crypto8.createDecipheriv)("aes-128-gcm",this.srtcpSessionKey,a);c.setAAD(o);return c.update(e.slice(8,i)).copy(r,8),[r,t]}rtpInitializationVector(e,t){const i=this.rtpIvWriter([0,e.ssrc,t,e.sequenceNumber]);for(let e=0;e<i.length;e++)i[e]^=this.srtpSessionSalt[e];return i}rtcpInitializationVector(e,t){const i=this.rtcpIvWriter([0,e,0,t]);for(let e=0;e<i.length;e++)i[e]^=this.srtcpSessionSalt[e];return i}rtcpAdditionalAuthenticatedData(e,t){const i=Buffer.concat([e.subarray(0,8),this.aadWriter([t])]);return i[8]|=rtcpEncryptionFlag,i}},srtcpIndexSize2=4,rtcpEncryptionFlag=128,Context=class{constructor(e,t,i){this.masterKey=e,this.masterSalt=t,this.profile=i,__publicField(this,"srtpSSRCStates",{}),__publicField(this,"srtpSessionKey"),__publicField(this,"srtpSessionSalt"),__publicField(this,"srtpSessionAuthTag"),__publicField(this,"srtpSessionAuth"),__publicField(this,"srtcpSSRCStates",{}),__publicField(this,"srtcpSessionKey"),__publicField(this,"srtcpSessionSalt"),__publicField(this,"srtcpSessionAuthTag"),__publicField(this,"srtcpSessionAuth"),__publicField(this,"cipher");{const e=14-t.length;e>0&&(this.masterSalt=Buffer.concat([t,Buffer.alloc(e)]))}switch(this.srtpSessionKey=this.generateSessionKey(0),this.srtpSessionSalt=this.generateSessionSalt(2),this.srtpSessionAuthTag=this.generateSessionAuthTag(1),this.srtpSessionAuth=(0,import_crypto9.createHmac)("sha1",this.srtpSessionAuthTag),this.srtcpSessionKey=this.generateSessionKey(3),this.srtcpSessionSalt=this.generateSessionSalt(5),this.srtcpSessionAuthTag=this.generateSessionAuthTag(4),this.srtcpSessionAuth=(0,import_crypto9.createHmac)("sha1",this.srtcpSessionAuthTag),i){case ProtectionProfileAes128CmHmacSha1_80:this.cipher=new CipherAesCtr(this.srtpSessionKey,this.srtpSessionSalt,this.srtcpSessionKey,this.srtcpSessionSalt,this.srtpSessionAuthTag,this.srtcpSessionAuthTag);break;case ProtectionProfileAeadAes128Gcm:this.cipher=new CipherAesGcm(this.srtpSessionKey,this.srtpSessionSalt,this.srtcpSessionKey,this.srtcpSessionSalt)}}generateSessionKey(e){let t=Buffer.from(this.masterSalt);const i=Buffer.from([e,0,0,0,0,0,0]);for(let e=i.length-1,r=t.length-1;e>=0;e--,r--)t[r]=t[r]^i[e];t=Buffer.concat([t,Buffer.from([0,0])]);const r=new import_aes_js.default.AES(this.masterKey);return Buffer.from(r.encrypt(t))}generateSessionSalt(e){let t=Buffer.from(this.masterSalt);const i=Buffer.from([e,0,0,0,0,0,0]);for(let e=i.length-1,r=t.length-1;e>=0;e--,r--)t[r]=t[r]^i[e];t=Buffer.concat([t,Buffer.from([0,0])]);const r=new import_aes_js.default.AES(this.masterKey);return t=Buffer.from(r.encrypt(t)),t.subarray(0,14)}generateSessionAuthTag(e){const t=Buffer.from(this.masterSalt),i=Buffer.from([e,0,0,0,0,0,0]);for(let e=i.length-1,r=t.length-1;e>=0;e--,r--)t[r]=t[r]^i[e];let r=Buffer.concat([t,Buffer.from([0,0])]),s=Buffer.concat([t,Buffer.from([0,1])]);const n=new import_aes_js.default.AES(this.masterKey);return r=Buffer.from(n.encrypt(r)),s=Buffer.from(n.encrypt(s)),Buffer.concat([r,s.subarray(0,4)])}getSrtpSsrcState(e){let t=this.srtpSSRCStates[e];return t||(t={ssrc:e,rolloverCounter:0,lastSequenceNumber:0},this.srtpSSRCStates[e]=t,t)}getSrtcpSsrcState(e){let t=this.srtcpSSRCStates[e];return t||(t={srtcpIndex:0,ssrc:e},this.srtcpSSRCStates[e]=t,t)}updateRolloverCount(e,t){t.rolloverHasProcessed?0===e?t.lastSequenceNumber>MaxROCDisorder&&t.rolloverCounter++:t.lastSequenceNumber<MaxROCDisorder&&e>MaxSequenceNumber-MaxROCDisorder?t.rolloverCounter>0&&t.rolloverCounter--:e<MaxROCDisorder&&t.lastSequenceNumber>MaxSequenceNumber-MaxROCDisorder&&t.rolloverCounter++:t.rolloverHasProcessed=!0,t.lastSequenceNumber=e}generateSrtpAuthTag(e,t){this.srtpSessionAuth=(0,import_crypto9.createHmac)("sha1",this.srtpSessionAuthTag);const i=Buffer.alloc(4);return i.writeUInt32BE(t),this.srtpSessionAuth.update(e).update(i).digest().slice(0,10)}index(e){const t=this.srtcpSSRCStates[e];return t?t.srtcpIndex:0}setIndex(e,t){this.getSrtcpSsrcState(e).srtcpIndex=t%2147483647}},MaxROCDisorder=100,MaxSequenceNumber=65535,SrtcpContext=class extends Context{constructor(e,t,i){super(e,t,i)}encryptRTCP(e){const t=e.readUInt32BE(4),i=this.getSrtcpSsrcState(t);i.srtcpIndex++,i.srtcpIndex>>maxSRTCPIndex&&(i.srtcpIndex=0);return this.cipher.encryptRTCP(e,i.srtcpIndex)}decryptRTCP(e){return this.cipher.decryptRTCP(e)}},maxSRTCPIndex=2147483647,Session=class{constructor(e){this.ContextCls=e,__publicField(this,"localContext"),__publicField(this,"remoteContext"),__publicField(this,"onData")}start(e,t,i,r,s){this.localContext=new this.ContextCls(e,t,s),this.remoteContext=new this.ContextCls(i,r,s)}},SrtcpSession=class extends Session{constructor(e){super(SrtcpContext),this.config=e,__publicField(this,"decrypt",(e=>{const[t]=this.remoteContext.decryptRTCP(e);return t})),this.start(e.keys.localMasterKey,e.keys.localMasterSalt,e.keys.remoteMasterKey,e.keys.remoteMasterSalt,e.profile)}encrypt(e){return this.localContext.encryptRTCP(e)}},SrtpContext2=class extends Context{constructor(e,t,i){super(e,t,i)}encryptRtp(e,t){const i=this.getSrtpSsrcState(t.ssrc);this.updateRolloverCount(t.sequenceNumber,i);return this.cipher.encryptRtp(t,e,i.rolloverCounter)}decryptRtp(e){const t=RtpHeader.deSerialize(e),i=this.getSrtpSsrcState(t.ssrc);this.updateRolloverCount(t.sequenceNumber,i);return this.cipher.decryptRtp(e,i.rolloverCounter)}},SrtpSession=class extends Session{constructor(e){super(SrtpContext2),this.config=e,__publicField(this,"decrypt",(e=>{const[t]=this.remoteContext.decryptRtp(e);return t})),this.start(e.keys.localMasterKey,e.keys.localMasterSalt,e.keys.remoteMasterKey,e.keys.remoteMasterSalt,e.profile)}encrypt(e,t){return this.localContext.encryptRtp(e,t)}},RtpBuilder=class{constructor(e){this.props=e,__publicField(this,"sequenceNumber",random16()),__publicField(this,"timestamp",random32())}create(e){this.sequenceNumber=uint16Add(this.sequenceNumber,1);const t=this.props.between*this.props.clockRate/1e3;this.timestamp=uint32Add(this.timestamp,t);const i=new RtpHeader({sequenceNumber:this.sequenceNumber,timestamp:Number(this.timestamp),payloadType:96,extension:!0,marker:!1,padding:!1});return new RtpPacket(i,e)}},log12=debug2("werift-dtls : packages/dtls/src/flight/client/flight5.ts : log"),Flight5=class extends Flight{constructor(e,t,i,r){super(e,t,5,7),this.cipher=i,this.srtp=r}handleHandshake(e){this.dtls.bufferHandshakeCache([e],!1,4);const t=(()=>{switch(e.msg_type){case 2:return ServerHello.deSerialize(e.fragment);case 11:return Certificate2.deSerialize(e.fragment);case 12:return ServerKeyExchange.deSerialize(e.fragment);case 13:return ServerCertificateRequest.deSerialize(e.fragment);case 14:return ServerHelloDone.deSerialize(e.fragment)}})();t&&handlers[t.msgType]({dtls:this.dtls,cipher:this.cipher,srtp:this.srtp})(t)}async exec(){if(5===this.dtls.flight)return log12(this.dtls.sessionId,"flight5 twice"),void this.send(this.dtls.lastMessage);this.dtls.flight=5;const e=this.dtls.requestedCertificateTypes.length>0;log12(this.dtls.sessionId,"send flight5",e);const t=[e&&this.sendCertificate(),this.sendClientKeyExchange(),e&&this.sendCertificateVerify(),this.sendChangeCipherSpec(),this.sendFinished()].filter((e=>e));this.dtls.lastMessage=t,await this.transmit(t)}sendCertificate(){const e=new Certificate2([Buffer.from(this.cipher.localCert)]),t=this.createPacket([e]);return Buffer.concat(t.map((e=>e.serialize())))}sendClientKeyExchange(){if(!this.cipher.localKeyPair)throw new Error;const e=new ClientKeyExchange(this.cipher.localKeyPair.publicKey),t=this.createPacket([e]),i=Buffer.concat(t.map((e=>e.serialize()))),r=this.cipher.localKeyPair,s=this.cipher.remoteKeyPair;if(!s.publicKey)throw new Error("not exist");const n=prfPreMasterSecret(s.publicKey,r.privateKey,r.curve);log12(this.dtls.sessionId,"extendedMasterSecret",this.dtls.options.extendedMasterSecret,this.dtls.remoteExtendedMasterSecret);const a=Buffer.concat(this.dtls.sortedHandshakeCache.map((e=>e.serialize())));return this.cipher.masterSecret=this.dtls.options.extendedMasterSecret&&this.dtls.remoteExtendedMasterSecret?prfExtendedMasterSecret(n,a):prfMasterSecret(n,this.cipher.localRandom.serialize(),this.cipher.remoteRandom.serialize()),this.cipher.cipher=createCipher(this.cipher.cipherSuite),this.cipher.cipher.init(this.cipher.masterSecret,this.cipher.remoteRandom.serialize(),this.cipher.localRandom.serialize()),log12(this.dtls.sessionId,"cipher",this.cipher.cipher.summary),i}sendCertificateVerify(){const e=Buffer.concat(this.dtls.sortedHandshakeCache.map((e=>e.serialize()))),t=this.cipher.signatureData(e,"sha256"),i=(()=>{switch(this.cipher.signatureHashAlgorithm?.signature){case SignatureAlgorithm.ecdsa_3:return SignatureScheme.ecdsa_secp256r1_sha256;case SignatureAlgorithm.rsa_1:return SignatureScheme.rsa_pkcs1_sha256}})();if(!i)throw new Error;log12(this.dtls.sessionId,"signatureScheme",this.cipher.signatureHashAlgorithm?.signature,i);const r=new CertificateVerify(i,t),s=this.createPacket([r]);return Buffer.concat(s.map((e=>e.serialize())))}sendChangeCipherSpec(){const e=ChangeCipherSpec.createEmpty().serialize(),t=createPlaintext(this.dtls)([{type:20,fragment:e}],++this.dtls.recordSequenceNumber);return Buffer.concat(t.map((e=>e.serialize())))}sendFinished(){const e=Buffer.concat(this.dtls.sortedHandshakeCache.map((e=>e.serialize()))),t=this.cipher.verifyData(e),i=new Finished(t);this.dtls.epoch=1;const[r]=this.createPacket([i]);this.dtls.recordSequenceNumber=0;const s=this.cipher.encryptPacket(r).serialize();return log12(this.dtls.sessionId,"finished",this.cipher.cipher.summary),s}},handlers={2:({cipher:e,srtp:t,dtls:i})=>r=>{log12(i.sessionId,"serverHello",r.cipherSuite),e.remoteRandom=DtlsRandom.from(r.random),e.cipherSuite=r.cipherSuite,log12(i.sessionId,"selected cipherSuite",e.cipherSuite),r.extensions&&r.extensions.forEach((e=>{switch(e.type){case UseSRTP.type:{const r=UseSRTP.fromData(e.data),s=SrtpContext.findMatchingSRTPProfile(r.profiles,i.options.srtpProfiles||[]);if(log12(i.sessionId,"selected srtp profile",s),null==s)return;t.srtpProfile=s}break;case ExtendedMasterSecret.type:i.remoteExtendedMasterSecret=!0;break;case RenegotiationIndication.type:log12(i.sessionId,"RenegotiationIndication")}}))},11:({cipher:e,dtls:t})=>i=>{log12(t.sessionId,"handshake certificate",i),e.remoteCertificate=i.certificateList[0]},12:({cipher:e,dtls:t})=>i=>{if(!e.localRandom||!e.remoteRandom)throw new Error;log12(t.sessionId,"ServerKeyExchange",i),log12(t.sessionId,"selected curve",i.namedCurve),e.remoteKeyPair={curve:i.namedCurve,publicKey:i.publicKey},e.localKeyPair=generateKeyPair(i.namedCurve)},13:({dtls:e})=>t=>{log12(e.sessionId,"certificate_request",t),e.requestedCertificateTypes=t.certificateTypes,e.requestedSignatureAlgorithms=t.signatures},14:({dtls:e})=>t=>{log12(e.sessionId,"server_hello_done",t)}},import_binary_data19=__toESM(require_src4()),_ServerHelloVerifyRequest=class e{constructor(e,t){this.serverVersion=e,this.cookie=t,__publicField(this,"msgType",3),__publicField(this,"messageSeq")}static createEmpty(){return new e(void 0,void 0)}static deSerialize(t){return new e(...Object.values((0,import_binary_data19.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data19.encode)(this,e.spec).slice();return Buffer.from(t)}get version(){return{major:255-this.serverVersion.major,minor:255-this.serverVersion.minor}}toFragment(){const e=this.serialize();return new FragmentedHandshake(this.msgType,e.length,this.messageSeq,0,e.length,e)}};__publicField(_ServerHelloVerifyRequest,"spec",{serverVersion:ProtocolVersion,cookie:import_binary_data19.types.buffer(import_binary_data19.types.uint8)});var ServerHelloVerifyRequest=_ServerHelloVerifyRequest,import_binary_data23=__toESM(require_src4()),import_promises2=require("timers/promises"),log13=debug2("werift-dtls : packages/dtls/src/context/dtls.ts : log"),DtlsContext=class{constructor(e,t){this.options=e,this.sessionType=t,__publicField(this,"version",{major:254,minor:253}),__publicField(this,"lastFlight",[]),__publicField(this,"lastMessage",[]),__publicField(this,"recordSequenceNumber",0),__publicField(this,"sequenceNumber",0),__publicField(this,"epoch",0),__publicField(this,"flight",0),__publicField(this,"handshakeCache",{}),__publicField(this,"cookie"),__publicField(this,"requestedCertificateTypes",[]),__publicField(this,"requestedSignatureAlgorithms",[]),__publicField(this,"remoteExtendedMasterSecret",!1),__publicField(this,"checkHandshakesExist",(e=>!e.find((e=>null==this.sortedHandshakeCache.find((t=>t.msg_type===e))))))}get sessionId(){return this.cookie?this.cookie.toString("hex").slice(0,10):""}get sortedHandshakeCache(){return Object.entries(this.handshakeCache).sort((([e],[t])=>Number(e)-Number(t))).flatMap((([,{data:e}])=>e.sort(((e,t)=>e.message_seq-t.message_seq))))}bufferHandshakeCache(e,t,i){this.handshakeCache[i]||(this.handshakeCache[i]={data:[],isLocal:t,flight:i});const r=e.filter((e=>{const r=this.handshakeCache[i].data.find((t=>t.msg_type===e.msg_type));return!r||(log13(this.sessionId,"exist",r.summary,t,i),!1)}));this.handshakeCache[i].data=[...this.handshakeCache[i].data,...r]}},TransportContext=class{constructor(e){this.socket=e,__publicField(this,"send",(e=>this.socket.send(e)))}},import_binary_data20=__toESM(require_src4()),_EllipticCurves=class e{constructor(t={}){__publicField(this,"type",e.type),__publicField(this,"data",[]),Object.assign(this,t)}static createEmpty(){return new e}static fromData(t){return new e({type:e.type,data:(0,import_binary_data20.decode)(t,e.spec.data)})}static deSerialize(t){return new e((0,import_binary_data20.decode)(t,e.spec))}serialize(){return Buffer.from((0,import_binary_data20.encode)(this,e.spec).slice())}get extension(){return{type:this.type,data:this.serialize().slice(2)}}};__publicField(_EllipticCurves,"type",10),__publicField(_EllipticCurves,"spec",{type:import_binary_data20.types.uint16be,data:import_binary_data20.types.array(import_binary_data20.types.uint16be,import_binary_data20.types.uint16be,"bytes")});var EllipticCurves=_EllipticCurves,import_binary_data21=__toESM(require_src4()),_Signature=class e{constructor(t={}){__publicField(this,"type",e.type),__publicField(this,"data",[]),Object.assign(this,t)}static createEmpty(){return new e}static deSerialize(t){return new e((0,import_binary_data21.decode)(t,e.spec))}serialize(){const t=(0,import_binary_data21.encode)(this,e.spec).slice();return Buffer.from(t)}static fromData(t){const i=Buffer.alloc(2);return i.writeUInt16BE(e.type),e.deSerialize(Buffer.concat([i,t]))}get extension(){return{type:this.type,data:this.serialize().slice(2)}}};__publicField(_Signature,"type",13),__publicField(_Signature,"spec",{type:import_binary_data21.types.uint16be,data:import_binary_data21.types.array({hash:import_binary_data21.types.uint8,signature:import_binary_data21.types.uint8},import_binary_data21.types.uint16be,"bytes")});var Signature=_Signature,import_binary_data22=__toESM(require_src4()),_Alert=class e{constructor(e,t){this.level=e,this.description=t}static deSerialize(t){return new e(...Object.values((0,import_binary_data22.decode)(t,e.spec)))}serialize(){const t=(0,import_binary_data22.encode)(this,e.spec).slice();return Buffer.from(t)}};__publicField(_Alert,"spec",{level:import_binary_data22.types.uint8,description:import_binary_data22.types.uint8});var Alert=_Alert,log14=debug2("werift-dtls : packages/dtls/record/receive.ts : log"),err3=debug2("werift-dtls : packages/dtls/record/receive.ts : err"),parsePacket=e=>{let t=0;const i=[];for(;e.length>t;){const r=e.readUInt16BE(t+11);if(e.length<t+(12+r))break;const s=DtlsPlaintext.deSerialize(e.subarray(t));i.push(s),t+=13+r}return i},parsePlainText=(e,t)=>i=>{switch(i.recordLayerHeader.contentType){case 20:return log14(e.sessionId,"change cipher spec"),[{type:20,data:void 0}];case 22:{let r=i.fragment;try{i.recordLayerHeader.epoch>0&&(log14(e.sessionId,"decrypt handshake"),r=t.decryptPacket(i))}catch(t){throw err3(e.sessionId,"decrypt failed",t),t}try{let e=0;const t=[];for(;r.length>e;){const i=FragmentedHandshake.deSerialize(r.subarray(e));t.push({type:22,data:i}),e+=i.fragment_length+12}return t}catch(t){throw err3(e.sessionId,"decSerialize failed",t,r),t}}case 23:return[{type:23,data:t.decryptPacket(i)}];case 21:{let r=Alert.deSerialize(i.fragment);if(null==AlertDesc[r.description]){const e=t.decryptPacket(i);r=Alert.deSerialize(e)}if(err3(e.sessionId,"ContentType.alert",r,AlertDesc[r.description],"flight",e.flight,"lastFlight",e.lastFlight),r.level>1)throw new Error("alert fatal error");return[{type:21,data:void 0}]}default:return[{type:21,data:void 0}]}},log15=debug2("werift-dtls : packages/dtls/src/socket.ts : log"),err4=debug2("werift-dtls : packages/dtls/src/socket.ts : err"),DtlsSocket=class{constructor(e,t){this.options=e,this.sessionType=t,__publicField(this,"onConnect",new Event3),__publicField(this,"onData",new Event3),__publicField(this,"onError",new Event3),__publicField(this,"onClose",new Event3),__publicField(this,"transport"),__publicField(this,"cipher"),__publicField(this,"dtls"),__publicField(this,"srtp",new SrtpContext),__publicField(this,"connected",!1),__publicField(this,"extensions",[]),__publicField(this,"onHandleHandshakes"),__publicField(this,"bufferFragmentedHandshakes",[]),__publicField(this,"udpOnMessage",(e=>{const t=parsePacket(e);for(const e of t)try{const t=parsePlainText(this.dtls,this.cipher)(e);for(const e of t)switch(e.type){case 22:{const t=e.data,i=this.handleFragmentHandshake([t]),r=Object.values(i.reduce(((e,t)=>(e[t.msg_type]||(e[t.msg_type]=[]),e[t.msg_type].push(t),e)),{})).map((e=>FragmentedHandshake.assemble(e))).sort(((e,t)=>e.msg_type-t.msg_type));this.onHandleHandshakes(r).catch((e=>{err4(this.dtls.sessionId,"onHandleHandshakes error",e),this.onError.execute(e)}))}break;case 23:this.onData.execute(e.data);break;case 21:this.onClose.execute()}}catch(e){err4(this.dtls.sessionId,"catch udpOnMessage error",e)}})),__publicField(this,"waitForReady",(e=>new Promise((async(t,i)=>{for(let i=0;i<10;i++){if(e()){t();break}await(0,import_promises2.setTimeout)(100*i)}i("waitForReady timeout")})))),__publicField(this,"send",(async e=>{const t=createPlaintext(this.dtls)([{type:23,fragment:e}],++this.dtls.recordSequenceNumber)[0];await this.transport.send(this.cipher.encryptPacket(t).serialize())})),this.dtls=new DtlsContext(this.options,this.sessionType),this.cipher=new CipherContext(this.sessionType,this.options.cert,this.options.key,this.options.signatureHash),this.transport=new TransportContext(this.options.transport),this.setupExtensions(),this.transport.socket.onData=this.udpOnMessage}renegotiation(){log15("renegotiation",this.sessionType),this.connected=!1,this.cipher=new CipherContext(this.sessionType,this.options.cert,this.options.key,this.options.signatureHash),this.dtls=new DtlsContext(this.options,this.sessionType),this.srtp=new SrtpContext,this.extensions=[],this.bufferFragmentedHandshakes=[]}setupExtensions(){if(log15(this.dtls.sessionId,"support srtpProfiles",this.options.srtpProfiles),this.options.srtpProfiles&&this.options.srtpProfiles.length>0){const e=UseSRTP.create(this.options.srtpProfiles,Buffer.from([0]));this.extensions.push(e.extension)}{const e=EllipticCurves.createEmpty();e.data=NamedCurveAlgorithmList,this.extensions.push(e.extension)}{const e=Signature.createEmpty();e.data=signatures,this.extensions.push(e.extension)}this.options.extendedMasterSecret&&this.extensions.push({type:ExtendedMasterSecret.type,data:Buffer.alloc(0)});{const e=RenegotiationIndication.createEmpty();this.extensions.push(e.extension)}}handleFragmentHandshake(e){let t=e.filter((e=>e.fragment_length===e.length||(this.bufferFragmentedHandshakes.push(e),!1)));if(this.bufferFragmentedHandshakes.length>1){const[e]=this.bufferFragmentedHandshakes.slice(-1);e.fragment_offset+e.fragment_length===e.length&&(t=[...this.bufferFragmentedHandshakes,...t],this.bufferFragmentedHandshakes=[])}return t}close(){this.transport.socket.close()}extractSessionKeys(e,t){const i=this.exportKeyingMaterial("EXTRACTOR-dtls_srtp",2*e+2*t),{clientKey:r,serverKey:s,clientSalt:n,serverSalt:a}=(0,import_binary_data23.decode)(i,{clientKey:import_binary_data23.types.buffer(e),serverKey:import_binary_data23.types.buffer(e),clientSalt:import_binary_data23.types.buffer(t),serverSalt:import_binary_data23.types.buffer(t)});return this.sessionType===SessionType.CLIENT?{localKey:r,localSalt:n,remoteKey:s,remoteSalt:a}:{localKey:s,localSalt:a,remoteKey:r,remoteSalt:n}}exportKeyingMaterial(e,t){return exportKeyingMaterial(e,t,this.cipher.masterSecret,this.cipher.localRandom.serialize(),this.cipher.remoteRandom.serialize(),this.sessionType===SessionType.CLIENT)}},log16=debug2("werift-dtls : packages/dtls/src/client.ts : log"),DtlsClient=class extends DtlsSocket{constructor(e){super(e,SessionType.CLIENT),__publicField(this,"flight5"),__publicField(this,"handleHandshakes",(async e=>{log16(this.dtls.sessionId,"handleHandshakes",e.map((e=>e.msg_type)));for(const t of e)switch(t.msg_type){case 3:{const e=ServerHelloVerifyRequest.deSerialize(t.fragment);await new Flight3(this.transport,this.dtls).exec(e)}break;case 2:if(this.connected)return;this.flight5=new Flight5(this.transport,this.dtls,this.cipher,this.srtp),this.flight5.handleHandshake(t);break;case 11:case 12:case 13:await this.waitForReady((()=>!!this.flight5)),this.flight5?.handleHandshake(t);break;case 14:{await this.waitForReady((()=>!!this.flight5)),this.flight5?.handleHandshake(t);const e=[11,12,this.options.certificateRequest&&13].filter((e=>"number"==typeof e));await this.waitForReady((()=>this.dtls.checkHandshakesExist(e))),await(this.flight5?.exec())}break;case 20:this.dtls.flight=7,this.connected=!0,this.onConnect.execute(),log16(this.dtls.sessionId,"dtls connected")}})),this.onHandleHandshakes=this.handleHandshakes,log16(this.dtls.sessionId,"start client")}async connect(){await new Flight1(this.transport,this.dtls,this.cipher).exec(this.extensions)}},import_crypto10=require("crypto"),log17=debug2("werift-dtls : packages/dtls/flight/server/flight2.ts : log"),flight2=(e,t,i,r)=>s=>{log17("dtls version",s.clientVersion),t.flight=2,t.recordSequenceNumber=0,t.sequenceNumber=0,s.extensions.forEach((e=>{switch(e.type){case EllipticCurves.type:{const r=EllipticCurves.fromData(e.data).data;log17(t.sessionId,"curves",r);const s=r.filter((e=>NamedCurveAlgorithmList.includes(e)))[0];i.namedCurve=s,log17(t.sessionId,"curve selected",i.namedCurve)}break;case Signature.type:{if(!i.signatureHashAlgorithm)throw new Error("need to set certificate");const r=Signature.fromData(e.data).data;log17(t.sessionId,"hash,signature",r);const s=r.find((e=>e.signature===i.signatureHashAlgorithm?.signature))?.signature,n=r.find((e=>e.hash===i.signatureHashAlgorithm?.hash))?.hash;if(null==s||null==n)throw new Error("invalid signatureHash")}break;case UseSRTP.type:{if(!t.options?.srtpProfiles)return;if(0===t.options.srtpProfiles.length)return;const i=UseSRTP.fromData(e.data);log17(t.sessionId,"srtp profiles",i.profiles);const s=SrtpContext.findMatchingSRTPProfile(i.profiles,t.options?.srtpProfiles);if(!s)throw new Error;r.srtpProfile=s,log17(t.sessionId,"srtp profile selected",r.srtpProfile)}break;case ExtendedMasterSecret.type:t.remoteExtendedMasterSecret=!0;break;case RenegotiationIndication.type:log17(t.sessionId,"RenegotiationIndication",e.data);break;case 43:{const t=[...e.data.subarray(1)].map((e=>e.toString(10)));log17("dtls supported version",t)}}})),i.localRandom=new DtlsRandom,i.remoteRandom=DtlsRandom.from(s.random);const n=s.cipherSuites;log17(t.sessionId,"cipher suites",n);const a=(()=>{switch(i.signatureHashAlgorithm?.signature){case SignatureAlgorithm.ecdsa_3:return CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_49195;case SignatureAlgorithm.rsa_1:return CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256_49199}})();if(void 0===a||!n.includes(a))throw new Error("dtls cipher suite negotiation failed");i.cipherSuite=a,log17(t.sessionId,"selected cipherSuite",i.cipherSuite),i.localKeyPair=generateKeyPair(i.namedCurve),t.cookie||(t.cookie=(0,import_crypto10.randomBytes)(20));const o=new ServerHelloVerifyRequest({major:254,minor:253},t.cookie),c=createFragments(t)([o]),l=createPlaintext(t)(c.map((e=>({type:22,fragment:e.serialize()}))),++t.recordSequenceNumber).map((e=>e.serialize()));for(const t of l)e.send(t)},log18=debug2("werift-dtls : packages/dtls/flight/server/flight4.ts : log"),Flight4=class extends Flight{constructor(e,t,i,r){super(e,t,4,6),this.cipher=i,this.srtp=r}async exec(e,t=!1){if(4===this.dtls.flight)return log18(this.dtls.sessionId,"flight4 twice"),void this.send(this.dtls.lastMessage);this.dtls.flight=4,this.dtls.sequenceNumber=1,this.dtls.bufferHandshakeCache([e],!1,4);const i=[this.sendServerHello(),this.sendCertificate(),this.sendServerKeyExchange(),t&&this.sendCertificateRequest(),this.sendServerHelloDone()].filter((e=>e));this.dtls.lastMessage=i,await this.transmit(i)}sendServerHello(){const e=[];this.srtp.srtpProfile&&e.push(UseSRTP.create([this.srtp.srtpProfile],Buffer.from([0])).extension),this.dtls.options.extendedMasterSecret&&e.push({type:ExtendedMasterSecret.type,data:Buffer.alloc(0)});const t=RenegotiationIndication.createEmpty();e.push(t.extension);const i=new ServerHello(this.dtls.version,this.cipher.localRandom,Buffer.from([0]),this.cipher.cipherSuite,0,e),r=this.createPacket([i]);return Buffer.concat(r.map((e=>e.serialize())))}sendCertificate(){const e=new Certificate2([Buffer.from(this.cipher.localCert)]),t=this.createPacket([e]);return Buffer.concat(t.map((e=>e.serialize())))}sendServerKeyExchange(){const e=this.cipher.generateKeySignature("sha256");if(!this.cipher.signatureHashAlgorithm)throw new Error("not exist");const t=new ServerKeyExchange(CurveType.named_curve_3,this.cipher.namedCurve,this.cipher.localKeyPair.publicKey.length,this.cipher.localKeyPair.publicKey,this.cipher.signatureHashAlgorithm.hash,this.cipher.signatureHashAlgorithm.signature,e.length,e),i=this.createPacket([t]);return Buffer.concat(i.map((e=>e.serialize())))}sendCertificateRequest(){const e=new ServerCertificateRequest(certificateTypes,signatures,[]);log18(this.dtls.sessionId,"sendCertificateRequest",e);const t=this.createPacket([e]);return Buffer.concat(t.map((e=>e.serialize())))}sendServerHelloDone(){const e=new ServerHelloDone,t=this.createPacket([e]);return Buffer.concat(t.map((e=>e.serialize())))}},log19=debug2("werift-dtls : packages/dtls/flight/server/flight6.ts"),Flight6=class extends Flight{constructor(e,t,i){super(e,t,6),this.cipher=i}handleHandshake(e){this.dtls.bufferHandshakeCache([e],!1,5);const t=(()=>{switch(e.msg_type){case 11:return Certificate2.deSerialize(e.fragment);case 15:return CertificateVerify.deSerialize(e.fragment);case 16:return ClientKeyExchange.deSerialize(e.fragment);case 20:return Finished.deSerialize(e.fragment)}})();if(t){const e=handlers2[t.msgType];if(!e)return;e({dtls:this.dtls,cipher:this.cipher})(t)}}async exec(){if(6===this.dtls.flight)return log19(this.dtls.sessionId,"flight6 twice"),void this.send(this.dtls.lastMessage);this.dtls.flight=6;const e=[this.sendChangeCipherSpec(),this.sendFinished()];this.dtls.lastMessage=e,await this.transmit(e)}sendChangeCipherSpec(){const e=ChangeCipherSpec.createEmpty().serialize(),t=createPlaintext(this.dtls)([{type:20,fragment:e}],++this.dtls.recordSequenceNumber);return Buffer.concat(t.map((e=>e.serialize())))}sendFinished(){const e=Buffer.concat(this.dtls.sortedHandshakeCache.map((e=>e.serialize()))),t=this.cipher.verifyData(e),i=new Finished(t);this.dtls.epoch=1;const[r]=this.createPacket([i]);this.dtls.recordSequenceNumber=0;return this.cipher.encryptPacket(r).serialize()}},handlers2={16:({cipher:e,dtls:t})=>i=>{if(e.remoteKeyPair={curve:e.namedCurve,publicKey:i.publicKey},!(e.remoteKeyPair.publicKey&&e.localKeyPair&&e.remoteRandom&&e.localRandom))throw new Error("not exist");const r=prfPreMasterSecret(e.remoteKeyPair.publicKey,e.localKeyPair.privateKey,e.localKeyPair.curve);log19(t.sessionId,"extendedMasterSecret",t.options.extendedMasterSecret,t.remoteExtendedMasterSecret);const s=Buffer.concat(t.sortedHandshakeCache.map((e=>e.serialize())));e.masterSecret=t.options.extendedMasterSecret&&t.remoteExtendedMasterSecret?prfExtendedMasterSecret(r,s):prfMasterSecret(r,e.remoteRandom.serialize(),e.localRandom.serialize()),e.cipher=createCipher(e.cipherSuite),e.cipher.init(e.masterSecret,e.localRandom.serialize(),e.remoteRandom.serialize()),log19(t.sessionId,"setup cipher",e.cipher.summary)},20:({dtls:e})=>t=>{log19(e.sessionId,"finished",t)}},log20=debug2("werift-dtls : packages/dtls/src/server.ts : log"),DtlsServer=class extends DtlsSocket{constructor(e){super(e,SessionType.SERVER),__publicField(this,"flight6"),__publicField(this,"handleHandshakes",(async e=>{log20(this.dtls.sessionId,"handleHandshakes",e.map((e=>e.msg_type)));for(const t of e)switch(t.msg_type){case 1:{this.connected&&this.renegotiation();const e=ClientHello.deSerialize(t.fragment);0===e.cookie.length?(log20(this.dtls.sessionId,"send flight2"),flight2(this.transport,this.dtls,this.cipher,this.srtp)(e)):this.dtls.cookie&&e.cookie.equals(this.dtls.cookie)?(log20(this.dtls.sessionId,"send flight4"),await new Flight4(this.transport,this.dtls,this.cipher,this.srtp).exec(t,this.options.certificateRequest)):log20("wrong state",{dtlsCookie:this.dtls.cookie?.toString("hex").slice(10),helloCookie:e.cookie.toString("hex").slice(10)})}break;case 11:case 15:case 16:if(this.connected)return;this.flight6=new Flight6(this.transport,this.dtls,this.cipher),this.flight6.handleHandshake(t);break;case 20:await this.waitForReady((()=>!!this.flight6)),this.flight6?.handleHandshake(t),await this.waitForReady((()=>this.dtls.checkHandshakesExist([16]))),await(this.flight6?.exec()),this.connected=!0,this.onConnect.execute(),log20(this.dtls.sessionId,"dtls connected")}})),this.onHandleHandshakes=this.handleHandshakes,log20(this.dtls.sessionId,"start server")}},COOKIE=554869826,FINGERPRINT_LENGTH=8,FINGERPRINT_XOR=1398035790,HEADER_LENGTH=20,INTEGRITY_LENGTH=24,IPV4_PROTOCOL=1,IPV6_PROTOCOL=2,RETRY_MAX=6,RETRY_RTO=50,classes=(e=>(e[e.REQUEST=0]="REQUEST",e[e.INDICATION=16]="INDICATION",e[e.RESPONSE=256]="RESPONSE",e[e.ERROR=272]="ERROR",e))(classes||{}),methods=(e=>(e[e.BINDING=1]="BINDING",e[e.SHARED_SECRET=2]="SHARED_SECRET",e[e.ALLOCATE=3]="ALLOCATE",e[e.REFRESH=4]="REFRESH",e[e.SEND=6]="SEND",e[e.DATA=7]="DATA",e[e.CREATE_PERMISSION=8]="CREATE_PERMISSION",e[e.CHANNEL_BIND=9]="CHANNEL_BIND",e))(methods||{}),import_crypto12=require("crypto");function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var CRC_TABLE=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 ensureBuffer(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 bufferizeInt(e){const t=ensureBuffer(4);return t.writeInt32BE(e,0),t}function _crc32(e,t){e=ensureBuffer(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let i=~t;for(var r=0;r<e.length;r++)i=CRC_TABLE[255&(i^e[r])]^i>>>8;return~i}function crc32(){return bufferizeInt(_crc32.apply(null,arguments))}crc32.signed=function(){return _crc32.apply(null,arguments)},crc32.unsigned=function(){return _crc32.apply(null,arguments)>>>0};var bufferCrc32=crc32,index=getDefaultExportFromCjs(bufferCrc32),import_crypto11=require("crypto");function randomString(e){return(0,import_crypto11.randomBytes)(e).toString("hex").substring(0,e)}function randomTransactionId(){return(0,import_crypto11.randomBytes)(12)}function bufferXor(e,t){if(e.length!==t.length)throw new TypeError("[webrtc-stun] You can not XOR buffers which length are different");const i=e.length,r=Buffer.allocUnsafe(i);for(let s=0;s<i;s++)r[s]=e[s]^t[s];return r}var storage,PQueue=class{constructor(){__publicField(this,"queue",[]),__publicField(this,"wait",new Event3)}put(e){this.queue.push(e),1===this.queue.length&&this.wait.execute(e)}get(){const e=this.queue.shift();return e||new Promise((e=>{this.wait.subscribe((t=>{this.queue.shift(),e(t)}))}))}},cancelable=e=>{let t,i;const r=new Promise(((e,r)=>{t=e,i=r}));r.then((()=>{s.execute(void 0),s.complete()})).catch((e=>{s.execute(e??new Error),s.complete()}));const s=new Event3;return e(t,i,s).catch((()=>{})),{awaitable:r,resolve:t,reject:i}},UNDEFINED="undefined",BUFFER=UNDEFINED!==typeof Buffer&&Buffer,UINT8ARRAY=UNDEFINED!==typeof Uint8Array&&Uint8Array,ARRAYBUFFER=UNDEFINED!==typeof ArrayBuffer&&ArrayBuffer,ZERO=[0,0,0,0,0,0,0,0],isArray=Array.isArray||_isArray,BIT32=4294967296,BIT24=16777216,Uint64BE=factory("Uint64BE",!0,!0),Int64BE=factory("Int64BE",!0,!1);function factory(e,t,i){var r=t?0:4,s=t?4:0,n=t?0:3,a=t?1:2,o=t?2:1,c=t?3:0,l=t?fromPositiveBE:fromPositiveLE,u=t?fromNegativeBE:fromNegativeLE,d=m.prototype,p="is"+e,h="_"+p;return d.buffer=void 0,d.offset=0,d[h]=!0,d.toNumber=f,d.toString=function(e){var t=this.buffer,n=this.offset,a=_(t,n+r),o=_(t,n+s),c="",l=!i&&2147483648&a;l&&(a=~a,o=BIT32-o);e=e||10;for(;;){var u=a%e*BIT32+o;if(a=Math.floor(a/e),o=Math.floor(u/e),c=(u%e).toString(e)+c,!a&&!o)break}l&&(c="-"+c);return c},d.toJSON=f,d.toArray=toArray,BUFFER&&(d.toBuffer=toBuffer),UINT8ARRAY&&(d.toArrayBuffer=toArrayBuffer),m[p]=function(e){return!(!e||!e[h])},m;function m(e,t,i,n){return this instanceof m?function(e,t,i,n,a){UINT8ARRAY&&ARRAYBUFFER&&(t instanceof ARRAYBUFFER&&(t=new UINT8ARRAY(t)),n instanceof ARRAYBUFFER&&(n=new UINT8ARRAY(n)));if(!(t||i||n||storage))return void(e.buffer=newArray(ZERO,0));if(!isValidBuffer(t,i)){var o=storage||Array;a=i,n=t,i=0,t=storage===BUFFER?BUFFER.alloc(8):new o(8)}if(e.buffer=t,e.offset=i|=0,UNDEFINED===typeof n)return;"string"==typeof n?function(e,t,i,n){var a=0,o=i.length,c=0,l=0;"-"===i[0]&&a++;var u=a;for(;a<o;){var d=parseInt(i[a++],n);if(!(d>=0))break;l=l*n+d,c=c*n+Math.floor(l/BIT32),l%=BIT32}u&&(c=~c,l?l=BIT32-l:c++);g(e,t+r,c),g(e,t+s,l)}(t,i,n,a||10):isValidBuffer(n,a)?fromArray(t,i,n,a):"number"==typeof a?(g(t,i+r,n),g(t,i+s,a)):n>0?l(t,i,n):n<0?u(t,i,n):fromArray(t,i,ZERO,0)}(this,e,t,i,n):new m(e,t,i,n)}function f(){var e=this.buffer,t=this.offset,n=_(e,t+r),a=_(e,t+s);return i||(n|=0),n?n*BIT32+a:a}function g(e,t,i){e[t+c]=255&i,i>>=8,e[t+o]=255&i,i>>=8,e[t+a]=255&i,i>>=8,e[t+n]=255&i}function _(e,t){return e[t+n]*BIT24+(e[t+a]<<16)+(e[t+o]<<8)+e[t+c]}}function toArray(e){var t=this.buffer,i=this.offset;return storage=null,!1!==e&&isArray(t)?8===t.length?t:t.slice(i,i+8):newArray(t,i)}function toBuffer(e){var t=this.buffer,i=this.offset;return storage=BUFFER,!1!==e&&BUFFER.isBuffer(t)?8===t.length?t:t.slice(i,i+8):BUFFER.from(toArrayBuffer.call(this,e))}function toArrayBuffer(e){var t=this.buffer,i=this.offset,r=t.buffer;if(storage=UINT8ARRAY,!1!==e&&!t.offset&&r instanceof ARRAYBUFFER)return 8===r.byteLength?r:r.slice(i,i+8);var s=new UINT8ARRAY(8);return fromArray(s,0,t,i),s.buffer}function isValidBuffer(e,t){var i=e&&e.length;return t|=0,i&&t+8<=i&&"string"!=typeof e[t]}function fromArray(e,t,i,r){t|=0,r|=0;for(var s=0;s<8;s++)e[t++]=255&i[r++]}function newArray(e,t){return Array.prototype.slice.call(e,t,t+8)}function fromPositiveBE(e,t,i){for(var r=t+8;r>t;)e[--r]=255&i,i/=256}function fromNegativeBE(e,t,i){var r=t+8;for(i++;r>t;)e[--r]=255&-i^255,i/=256}function fromPositiveLE(e,t,i){for(var r=t+8;t<r;)e[t++]=255&i,i/=256}function fromNegativeLE(e,t,i){var r=t+8;for(i++;t<r;)e[t++]=255&-i^255,i/=256}function _isArray(e){return!!e&&"[object Array]"==Object.prototype.toString.call(e)}var import_ip=__toESM(require_ip());function packAddress(e){const[t]=e,i=import_ip.default.isV4Format(t)?IPV4_PROTOCOL:IPV6_PROTOCOL,r=Buffer.alloc(4);return r.writeUInt8(0,0),r.writeUInt8(i,1),r.writeUInt16BE(e[1],2),Buffer.concat([r,import_ip.default.toBuffer(t)])}function unpackErrorCode(e){if(e.length<4)throw new Error("STUN error code is less than 4 bytes");return[100*e.readUInt8(2)+e.readUInt8(3),e.slice(4).toString("utf8")]}function unpackAddress(e){if(e.length<4)throw new Error("STUN address length is less than 4 bytes");const t=e.readUInt8(1),i=e.readUInt16BE(2),r=e.slice(4);switch(t){case IPV4_PROTOCOL:if(4!=r.length)throw new Error("STUN address has invalid length for IPv4");return[import_ip.default.toString(r),i];case IPV6_PROTOCOL:if(16!=r.length)throw new Error("STUN address has invalid length for IPv6");return[import_ip.default.toString(r),i];default:throw new Error("STUN address has unknown protocol")}}var cookieBuffer=Buffer.alloc(6);function xorAddress(e,t){const i=[...cookieBuffer,...t];let r=e.slice(0,2);for(let t=2;t<e.length;t++){const s=e[t]^i[t-2],n=Buffer.alloc(1);n.writeUIntBE(s,0,1),r=Buffer.concat([r,n])}return r}function unpackXorAddress(e,t){return unpackAddress(xorAddress(e,t))}function packErrorCode(e){const t=Buffer.alloc(4);t.writeUInt16BE(0,0),t.writeUInt8(Math.floor(e[0]/100),2),t.writeUInt8(e[0]%100,3);const i=Buffer.from(e[1],"utf8");return Buffer.concat([t,i])}function packXorAddress(e,t){return xorAddress(packAddress(e),t)}cookieBuffer.writeUInt16BE(COOKIE>>16,0),cookieBuffer.writeUInt32BE(COOKIE,2);var packUnsigned=e=>{const t=Buffer.alloc(4);return t.writeUInt32BE(e,0),t},unpackUnsigned=e=>e.readUInt32BE(0),packUnsignedShort=e=>{const t=Buffer.alloc(4);return t.writeUInt16BE(e,0),t},unpackUnsignedShort=e=>e.readUInt16BE(0),packUnsigned64=e=>new Int64BE(e.toString()).toBuffer(),unpackUnsigned64=e=>{const t=new Int64BE(e);return BigInt(t.toString())},packString=e=>Buffer.from(e,"utf8"),unpackString=e=>e.toString("utf8"),packBytes=e=>e,unpackBytes=e=>e,packNone=e=>Buffer.from([]),unpackNone=e=>null,ATTRIBUTES=[[1,"MAPPED-ADDRESS",packAddress,unpackAddress],[3,"CHANGE-REQUEST",packUnsigned,unpackUnsigned],[4,"SOURCE-ADDRESS",packAddress,unpackAddress],[5,"CHANGED-ADDRESS",packAddress,unpackAddress],[6,"USERNAME",packString,unpackString],[8,"MESSAGE-INTEGRITY",packBytes,unpackBytes],[9,"ERROR-CODE",packErrorCode,unpackErrorCode],[12,"CHANNEL-NUMBER",packUnsignedShort,unpackUnsignedShort],[13,"LIFETIME",packUnsigned,unpackUnsigned],[18,"XOR-PEER-ADDRESS",packXorAddress,unpackXorAddress],[19,"DATA",packBytes,unpackBytes],[20,"REALM",packString,unpackString],[21,"NONCE",packBytes,unpackBytes],[22,"XOR-RELAYED-ADDRESS",packXorAddress,unpackXorAddress],[25,"REQUESTED-TRANSPORT",packUnsigned,unpackUnsigned],[32,"XOR-MAPPED-ADDRESS",packXorAddress,unpackXorAddress],[36,"PRIORITY",packUnsigned,unpackUnsigned],[37,"USE-CANDIDATE",packNone,unpackNone],[32802,"SOFTWARE",packString,unpackString],[32808,"FINGERPRINT",packUnsigned,unpackUnsigned],[32809,"ICE-CONTROLLED",packUnsigned64,unpackUnsigned64],[32810,"ICE-CONTROLLING",packUnsigned64,unpackUnsigned64],[32811,"RESPONSE-ORIGIN",packAddress,unpackAddress],[32812,"OTHER-ADDRESS",packAddress,unpackAddress]],AttributeRepository=class{constructor(e=[]){this.attributes=e}getAttributes(){return this.attributes}setAttribute(e,t){const i=this.attributes.find((t=>t[0]===e));return i?i[1]=t:this.attributes.push([e,t]),this}getAttributeValue(e){const t=this.attributes.find((t=>t[0]===e));if(t)return t[1]}get attributesKeys(){return this.attributes.map((e=>e[0]))}clear(){this.attributes=[]}},ATTRIBUTES_BY_TYPE=ATTRIBUTES.reduce(((e,t)=>(e[t[0]]=t,e)),{}),ATTRIBUTES_BY_NAME=ATTRIBUTES.reduce(((e,t)=>(e[t[1]]=t,e)),{});function parseMessage(e,t){if(e.length<HEADER_LENGTH)return;const i=e.readUint16BE(2);if(e.length!==HEADER_LENGTH+i)return;const r=e.readUint16BE(0),s=Buffer.from(e.slice(HEADER_LENGTH-12,HEADER_LENGTH)),n=new AttributeRepository;for(let i=HEADER_LENGTH;i<=e.length-4;){const r=e.readUInt16BE(i),a=e.readUInt16BE(i+2),o=e.slice(i+4,i+4+a),c=4*Math.floor((a+3)/4)-a;if(Object.keys(ATTRIBUTES_BY_TYPE).includes(r.toString())){const[,a,,c]=ATTRIBUTES_BY_TYPE[r];if(c.name===unpackXorAddress.name?n.setAttribute(a,c(o,s)):n.setAttribute(a,c(o)),"FINGERPRINT"===a){const t=messageFingerprint(e.slice(0,i));if(n.getAttributeValue("FINGERPRINT")!==t)return}else if("MESSAGE-INTEGRITY"===a&&t){const r=messageIntegrity(e.slice(0,i),t),s=n.getAttributeValue("MESSAGE-INTEGRITY");if(!r.equals(s))return}}i+=4+a+c}const a=n.getAttributes();return n.clear(),new Message(16111&r,272&r,s,a)}var Message=class extends AttributeRepository{constructor(e,t,i=randomTransactionId(),r=[]){super(r),this.messageMethod=e,this.messageClass=t,this.transactionId=i}toJSON(){return this.json}get json(){return{messageMethod:methods[this.messageMethod],messageClass:classes[this.messageClass],attributes:this.attributes}}get transactionIdHex(){return this.transactionId.toString("hex")}get bytes(){let e=Buffer.from([]);for(const t of this.attributesKeys){const i=this.getAttributeValue(t),[r,,s]=ATTRIBUTES_BY_NAME[t],n=s.name===packXorAddress.name?s(i,this.transactionId):s(i),a=n.length,o=4*Math.floor((a+3)/4)-a,c=Buffer.alloc(4);c.writeUInt16BE(r,0),c.writeUInt16BE(a,2),e=Buffer.concat([e,c,n,Buffer.alloc(o,0)])}const t=Buffer.alloc(8);return t.writeUInt16BE(this.messageMethod|this.messageClass,0),t.writeUInt16BE(e.length,2),t.writeUInt32BE(COOKIE,4),Buffer.concat([t,this.transactionId,e])}addMessageIntegrity(e){return this.setAttribute("MESSAGE-INTEGRITY",this.messageIntegrity(e)),this}messageIntegrity(e){const t=setBodyLength(this.bytes,this.bytes.length-HEADER_LENGTH+INTEGRITY_LENGTH);return Buffer.from((0,import_crypto12.createHmac)("sha1",e).update(t).digest("hex"),"hex")}addFingerprint(){this.setAttribute("FINGERPRINT",messageFingerprint(this.bytes))}},setBodyLength=(e,t)=>{const i=Buffer.alloc(e.length);return e.copy(i,0,0,2),i.writeUInt16BE(t,2),e.copy(i,4,4),i};function messageFingerprint(e){const t=setBodyLength(e,e.length-HEADER_LENGTH+FINGERPRINT_LENGTH),i=index(t),r=Buffer.alloc(4);r.writeInt32BE(FINGERPRINT_XOR,0);return bufferXor(i,r).readUInt32BE(0)}function messageIntegrity(e,t){const i=setBodyLength(e,e.length-HEADER_LENGTH+INTEGRITY_LENGTH);return Buffer.from((0,import_crypto12.createHmac)("sha1",t).update(i).digest("hex"),"hex")}function paddingLength(e){const t=e%4;return 0===t?0:4-t}var TransactionError=class extends Error{constructor(){super(...arguments),__publicField(this,"response"),__publicField(this,"addr")}},TransactionFailed=class extends TransactionError{constructor(e,t){super(),this.response=e,this.addr=t}get str(){let e="STUN transaction failed";const t=this.response.getAttributeValue("ERROR-CODE");if(t){const[i,r]=t;e+=` (${i} - ${r})`}return e}},TransactionTimeout=class extends TransactionError{get str(){return"STUN transaction timed out"}},log21=debug2("werift-ice:packages/ice/src/stun/transaction.ts"),Transaction=class{constructor(e,t,i,r){this.request=e,this.addr=t,this.protocol=i,this.retransmissions=r,__publicField(this,"timeoutDelay",RETRY_RTO),__publicField(this,"ended",!1),__publicField(this,"tries",0),__publicField(this,"triesMax"),__publicField(this,"onResponse",new Event3),__publicField(this,"responseReceived",((e,t)=>{this.onResponse.length>0&&(256===e.messageClass?(this.onResponse.execute(e,t),this.onResponse.complete()):this.onResponse.error(new TransactionFailed(e,t)))})),__publicField(this,"run",(async()=>{try{this.retry().catch((e=>{log21("retry failed",e)}));return await this.onResponse.asPromise()}catch(e){throw e}finally{this.cancel()}})),__publicField(this,"retry",(async()=>{for(;this.tries<this.triesMax&&!this.ended&&(this.protocol.sendStun(this.request,this.addr).catch((e=>{log21("send stun failed",e)})),await new Promise((e=>setTimeout(e,this.timeoutDelay))),!this.ended);)this.timeoutDelay*=2,this.tries++;this.tries>=this.triesMax&&(log21(`retry failed times:${this.tries} maxLimit:${this.triesMax}`),this.onResponse.error(new TransactionTimeout))})),this.triesMax=1+(this.retransmissions?this.retransmissions:RETRY_MAX)}cancel(){this.ended=!0}},log22=debug2("werift-ice : packages/ice/src/stun/protocol.ts"),_StunProtocol=class e{constructor(){__publicField(this,"type",e.type),__publicField(this,"transport"),__publicField(this,"transactions",{}),__publicField(this,"localCandidate"),__publicField(this,"sentMessage"),__publicField(this,"localIp"),__publicField(this,"onRequestReceived",new Event3),__publicField(this,"onDataReceived",new Event3),__publicField(this,"connectionMade",(async(e,t,i)=>{this.transport=e?await UdpTransport.init("udp4",{portRange:t,interfaceAddresses:i}):await UdpTransport.init("udp6",{portRange:t,interfaceAddresses:i}),this.transport.onData=(e,t)=>{this.datagramReceived(e,t)}}))}get transactionsKeys(){return Object.keys(this.transactions)}datagramReceived(e,t){try{const i=parseMessage(e);if(!i)return void(this.localCandidate&&this.onDataReceived.execute(e));if(256!==i.messageClass&&272!==i.messageClass||!this.transactionsKeys.includes(i.transactionIdHex))0===i.messageClass&&this.onRequestReceived.execute(i,t,e);else{this.transactions[i.transactionIdHex].responseReceived(i,t)}}catch(e){log22("datagramReceived error",e)}}getExtraInfo(){const{address:e,port:t}=this.transport.address;return[e,t]}async sendStun(e,t){if(this.transport.closed)return;const i=e.bytes;await this.transport.send(i,t).catch((()=>{log22("sendStun failed",t,e)}))}async sendData(e,t){this.transport.closed||await this.transport.send(e,t)}async request(e,t,i,r){if(this.transactionsKeys.includes(e.transactionIdHex))throw new Error("already request ed");i&&(e.addMessageIntegrity(i),e.addFingerprint());const s=new Transaction(e,t,this,r);this.transactions[e.transactionIdHex]=s;try{return await s.run()}catch(e){throw e}finally{delete this.transactions[e.transactionIdHex]}}async close(){Object.values(this.transactions).forEach((e=>{e.cancel()})),await this.transport.close(),this.onRequestReceived.complete(),this.onDataReceived.complete()}};__publicField(_StunProtocol,"type","stun");var StunProtocol=_StunProtocol,import_crypto13=require("crypto"),import_jspack3=__toESM(require_jspack()),import_promises3=require("timers/promises"),log23=debug2("werift-ice:packages/ice/src/turn/protocol.ts"),DEFAULT_CHANNEL_REFRESH_TIME=500,DEFAULT_ALLOCATION_LIFETIME=600,UDP_TRANSPORT=285212672,_StunOverTurnProtocol=class e{constructor(t){this.turn=t,__publicField(this,"type",e.type),__publicField(this,"localCandidate"),__publicField(this,"disposer",new EventDisposer),__publicField(this,"onRequestReceived",new Event3),__publicField(this,"onDataReceived",new Event3),__publicField(this,"handleStunMessage",((e,t)=>{try{const i=parseMessage(e);if(!i)return void this.onDataReceived.execute(e);if(256===i.messageClass||272===i.messageClass){const e=this.turn.transactions[i.transactionIdHex];e&&e.responseReceived(i,t)}else 0===i.messageClass&&this.onRequestReceived.execute(i,t,e)}catch(e){log23("datagramReceived error",e)}})),t.onData.subscribe(((e,t)=>{this.handleStunMessage(e,t)})).disposer(this.disposer)}async request(e,t,i){if(this.turn.transactions[e.transactionIdHex])throw new Error("exist");i&&(e.addMessageIntegrity(i),e.addFingerprint());const r=new Transaction(e,t,this);this.turn.transactions[e.transactionIdHex]=r;try{return await r.run()}catch(e){throw e}finally{delete this.turn.transactions[e.transactionIdHex]}}async connectionMade(){}async sendData(e,t){await this.turn.sendData(e,t)}async sendStun(e,t){await this.turn.sendData(e.bytes,t)}async close(){return this.disposer.dispose(),this.turn.close()}};__publicField(_StunOverTurnProtocol,"type","turn");var StunOverTurnProtocol=_StunOverTurnProtocol,_TurnProtocol=class e{constructor(t,i,r,s,n,a={}){this.server=t,this.username=i,this.password=r,this.lifetime=s,this.transport=n,this.options=a,__publicField(this,"type",e.type),__publicField(this,"onData",new Event3),__publicField(this,"onRequestReceived",new Event3),__publicField(this,"onDataReceived",new Event3),__publicField(this,"integrityKey"),__publicField(this,"nonce"),__publicField(this,"realm"),__publicField(this,"relayedAddress"),__publicField(this,"mappedAddress"),__publicField(this,"localCandidate"),__publicField(this,"transactions",{}),__publicField(this,"refreshHandle"),__publicField(this,"channelNumber",16384),__publicField(this,"channelByAddr",{}),__publicField(this,"addrByChannel",{}),__publicField(this,"channelRefreshTime"),__publicField(this,"channelBinding"),__publicField(this,"channelRefreshAt",0),__publicField(this,"tcpBuffer",Buffer.alloc(0)),__publicField(this,"permissionByAddr",{}),__publicField(this,"creatingPermission",Promise.resolve()),__publicField(this,"refresh",(e=>{this.refreshHandle=cancelable((async(t,i,r)=>{let s=!0;for(r.once((()=>{s=!1}));s;){const t=5/6*e*1e3;log23("refresh delay",t,{exp:e}),await(0,import_promises3.setTimeout)(t);const i=new Message(4,0);i.setAttribute("LIFETIME",e);try{const[t]=await this.requestWithRetry(i,this.server);e=t.getAttributeValue("LIFETIME"),log23("refresh",{exp:e})}catch(e){log23("refresh error",e)}}}))})),this.channelRefreshTime=this.options.channelRefreshTime??DEFAULT_CHANNEL_REFRESH_TIME}async connectionMade(){this.transport.onData=(e,t)=>{this.dataReceived(e,t)};const e=new Message(3,0);e.setAttribute("LIFETIME",this.lifetime).setAttribute("REQUESTED-TRANSPORT",UDP_TRANSPORT);const[t]=await this.requestWithRetry(e,this.server).catch((e=>{throw log23("connect error",e),e}));this.relayedAddress=t.getAttributeValue("XOR-RELAYED-ADDRESS"),this.mappedAddress=t.getAttributeValue("XOR-MAPPED-ADDRESS");const i=t.getAttributeValue("LIFETIME");log23("connect",this.relayedAddress,this.mappedAddress,{exp:i}),this.refresh(i)}handleChannelData(e){const[t,i]=import_jspack3.jspack.Unpack("!HH",e.slice(0,4)),r=this.addrByChannel[t];if(r){const t=e.subarray(4,4+i);this.onData.execute(t,r)}}handleSTUNMessage(e,t){try{const i=parseMessage(e);if(!i)throw new Error("not stun message");if(256===i.messageClass||272===i.messageClass){const e=this.transactions[i.transactionIdHex];e&&e.responseReceived(i,t)}else 0===i.messageClass&&this.onData.execute(e,t);if(i.getAttributeValue("DATA")){const e=i.getAttributeValue("DATA");this.onData.execute(e,t)}}catch(t){log23("parse error",e.toString())}}dataReceived(e,t){const i=(e,t)=>{e.length>=4&&isChannelData(e)?this.handleChannelData(e):this.handleSTUNMessage(e,t)};if("tcp"===this.transport.type)for(this.tcpBuffer=Buffer.concat([this.tcpBuffer,e]);this.tcpBuffer.length>=4;){let[,e]=bufferReader(this.tcpBuffer.subarray(0,4),[2,2]);e+=paddingLength(e);const r=isChannelData(this.tcpBuffer)?4+e:20+e;if(this.tcpBuffer.length<r)break;i(this.tcpBuffer.subarray(0,r),t),this.tcpBuffer=this.tcpBuffer.subarray(r)}else i(e,t)}async send(e,t){if(!this.transport.closed)if("tcp"===this.transport.type){const i=paddingLength(e.length);await this.transport.send(i>0?Buffer.concat([e,Buffer.alloc(i)]):e,t)}else await this.transport.send(e,t)}async createPermission(e){const t=new Message(8,0);t.setAttribute("XOR-PEER-ADDRESS",e).setAttribute("USERNAME",this.username).setAttribute("REALM",this.realm).setAttribute("NONCE",this.nonce),await this.request(t,this.server).catch((e=>{throw e}))}async request(e,t){if(this.transactions[e.transactionIdHex])throw new Error("exist");this.integrityKey&&e.setAttribute("USERNAME",this.username).setAttribute("REALM",this.realm).setAttribute("NONCE",this.nonce).addMessageIntegrity(this.integrityKey).addFingerprint();const i=new Transaction(e,t,this);this.transactions[e.transactionIdHex]=i;try{return await i.run()}catch(e){throw e}finally{delete this.transactions[e.transactionIdHex]}}async requestWithRetry(e,t){let i,r;try{[i,r]=await this.request(e,t)}catch(t){if(t instanceof TransactionFailed==0)throw log23("requestWithRetry error",t),t;this.server=t.addr;const[s]=t.response.getAttributeValue("ERROR-CODE"),n=t.response.getAttributeValue("NONCE"),a=t.response.getAttributeValue("REALM");if(!(401===s&&a||438===s&&this.realm)||!n)throw t;log23("retry with nonce",s),this.nonce=n,401===s&&(this.realm=a),this.integrityKey=makeIntegrityKey(this.username,this.realm,this.password),e.transactionId=randomTransactionId(),[i,r]=await this.request(e,this.server)}return[i,r]}async sendData(e,t){const i=await this.getChannel(t).catch((e=>new Error("channelBind error")));if(i instanceof Error){await this.getPermission(t);const i=new Message(6,16).setAttribute("DATA",e).setAttribute("XOR-PEER-ADDRESS",t);return void await this.sendStun(i,this.server)}const r=import_jspack3.jspack.Pack("!HH",[i.number,e.length]);await this.send(Buffer.concat([Buffer.from(r),e]),this.server)}async getPermission(e){await this.creatingPermission;this.permissionByAddr[e.join(":")]||(this.creatingPermission=this.createPermission(e),this.permissionByAddr[e.join(":")]=!0,await this.creatingPermission.catch((e=>{throw log23("createPermission error",e),e})))}async getChannel(e){this.channelBinding&&await this.channelBinding;let t=this.channelByAddr[e.join(":")];return t?this.channelRefreshAt<int(Date.now()/1e3)&&(this.channelBinding=this.channelBind(t.number,e),this.channelRefreshAt=int(Date.now()/1e3)+this.channelRefreshTime,await this.channelBinding.catch((e=>{throw log23("channelBind error",e),e})),this.channelBinding=void 0,log23("channelBind refresh",t)):(this.channelByAddr[e.join(":")]={number:this.channelNumber++,address:e},t=this.channelByAddr[e.join(":")],this.addrByChannel[t.number]=e,this.channelBinding=this.channelBind(t.number,e),await this.channelBinding.catch((e=>{throw log23("channelBind error",e),e})),this.channelRefreshAt=int(Date.now()/1e3)+this.channelRefreshTime,this.channelBinding=void 0,log23("channelBind",t)),t}async channelBind(e,t){const i=new Message(9,0);i.setAttribute("CHANNEL-NUMBER",e).setAttribute("XOR-PEER-ADDRESS",t);const[r]=await this.requestWithRetry(i,this.server);if(9!==r.messageMethod)throw new Error("should be CHANNEL_BIND")}async sendStun(e,t){await this.send(e.bytes,t)}async close(){this.refreshHandle?.resolve?.(),await this.transport.close()}};__publicField(_TurnProtocol,"type","turn");var TurnProtocol=_TurnProtocol;async function createTurnClient({address:e,username:t,password:i},{lifetime:r,portRange:s,interfaceAddresses:n,transport:a}={}){r??(r=DEFAULT_ALLOCATION_LIFETIME),a??(a="udp");const o="udp"===a?await UdpTransport.init("udp4",{portRange:s,interfaceAddresses:n}):await TcpTransport.init(e),c=new TurnProtocol(e,t,i,r,o);return await c.connectionMade(),c}async function createStunOverTurnClient({address:e,username:t,password:i},{lifetime:r,portRange:s,interfaceAddresses:n,transport:a}={}){const o=await createTurnClient({address:e,username:t,password:i},{lifetime:r,portRange:s,interfaceAddresses:n,transport:a});return new StunOverTurnProtocol(o)}function makeIntegrityKey(e,t,i){return(0,import_crypto13.createHash)("md5").update(Buffer.from([e,t,i].join(":"))).digest()}function isChannelData(e){return 64==(192&e[0])}var import_crypto14=require("crypto"),import_net3=require("net"),Candidate=class e{constructor(e,t,i,r,s,n,a,o,c,l,u,d){this.foundation=e,this.component=t,this.transport=i,this.priority=r,this.host=s,this.port=n,this.type=a,this.relatedAddress=o,this.relatedPort=c,this.tcptype=l,this.generation=u,this.ufrag=d}static fromSdp(t){const i=t.split(" ");if(i.length<8)throw new Error("SDP does not have enough properties");const r={foundation:i[0],component:Number(i[1]),transport:i[2],priority:Number(i[3]),host:i[4],port:Number(i[5]),type:i[7]};for(let e=8,t=i.length-1;e<t;e+=2)"raddr"===i[e]?r.related_address=i[e+1]:"rport"===i[e]?r.related_port=Number(i[e+1]):"tcptype"===i[e]?r.tcptype=i[e+1]:"generation"===i[e]?r.generation=Number(i[e+1]):"ufrag"===i[e]&&(r.ufrag=i[e+1]);const{foundation:s,component:n,transport:a,priority:o,host:c,port:l,type:u}=r;return new e(s,n,a,o,c,l,u,r.related_address,r.related_port,r.tcptype,r.generation,r.ufrag)}canPairWith(e){const t=(0,import_net3.isIPv4)(this.host),i=(0,import_net3.isIPv4)(e.host);return this.component===e.component&&this.transport.toLowerCase()===e.transport.toLowerCase()&&t===i}toSdp(){let e=`${this.foundation} ${this.component} ${this.transport} ${this.priority} ${this.host} ${this.port} typ ${this.type}`;return this.relatedAddress&&(e+=` raddr ${this.relatedAddress}`),null!=this.relatedPort&&(e+=` rport ${this.relatedPort}`),this.tcptype&&(e+=` tcptype ${this.tcptype}`),null!=this.generation&&(e+=` generation ${this.generation}`),null!=this.ufrag&&(e+=` ufrag ${this.ufrag}`),e}};function candidateFoundation(e,t,i){const r=`${e}|${t}|${i}`;return(0,import_crypto14.createHash)("md5").update(r,"ascii").digest("hex").slice(7)}function candidatePriority(e,t=65535){let i=0;return i="host"===e?126:"prflx"===e?110:"srflx"===e?100:0,(1<<24)*i+256*t+255}var import_crypto16=require("crypto"),import_net4=require("net"),import_fast_deep_equal=__toESM(require_fast_deep_equal()),import_promises4=__toESM(require("timers/promises")),import_multicast_dns=__toESM(require_multicast_dns()),MdnsLookup=class{constructor(){__publicField(this,"cache",new Map),__publicField(this,"mdnsInstance",(0,import_multicast_dns.default)()),this.mdnsInstance.setMaxListeners(50)}lookup(e){return new Promise(((t,i)=>{const r=()=>{this.mdnsInstance.removeListener("response",n),clearTimeout(s)},s=setTimeout((()=>{r(),i(new Error("No mDNS response"))}),1e4),n=i=>{const s=i.answers?.[0];"A"===s?.type&&s.name===e&&(r(),t(s.data))};this.mdnsInstance.on("response",n),this.mdnsInstance.query(e,"A")}))}close(){this.mdnsInstance.destroy()}},import_crypto15=require("crypto"),log24=debug2("werift-ice : packages/ice/src/ice.ts : log"),CandidatePair=class{constructor(e,t,i){this.protocol=e,this.remoteCandidate=t,this.iceControlling=i,__publicField(this,"id",(0,import_crypto15.randomUUID)().toString()),__publicField(this,"handle"),__publicField(this,"nominated",!1),__publicField(this,"remoteNominated",!1),__publicField(this,"_state",0),__publicField(this,"packetsSent",0),__publicField(this,"packetsReceived",0),__publicField(this,"bytesSent",0),__publicField(this,"bytesReceived",0),__publicField(this,"rtt"),__publicField(this,"totalRoundTripTime",0),__publicField(this,"roundTripTimeMeasurements",0)}get state(){return this._state}toJSON(){return this.json}get json(){return{protocol:this.protocol.type,localCandidate:this.localCandidate.toSdp(),remoteCandidate:this.remoteCandidate.toSdp()}}updateState(e){this._state=e}get localCandidate(){if(!this.protocol.localCandidate)throw new Error("localCandidate not exist");return this.protocol.localCandidate}get remoteAddr(){return[this.remoteCandidate.host,this.remoteCandidate.port]}get component(){return this.localCandidate.component}get priority(){return candidatePairPriority(this.localCandidate,this.remoteCandidate,this.iceControlling)}get foundation(){return this.localCandidate.foundation}},ICE_COMPLETED=1,ICE_FAILED=2,CONSENT_INTERVAL=5,CONSENT_FAILURES=6,defaultOptions={useIpv4:!0,useIpv6:!0};function validateRemoteCandidate(e){if(!["host","relay","srflx"].includes(e.type))throw new Error(`Unexpected candidate type "${e.type}"`);return e}function sortCandidatePairs(e,t){return e.sort(((e,i)=>candidatePairPriority(e.localCandidate,e.remoteCandidate,t)-candidatePairPriority(i.localCandidate,i.remoteCandidate,t))).reverse()}function candidatePairPriority(e,t,i){const r=i&&e.priority||t.priority,s=i&&t.priority||e.priority;return 1*Math.min(r,s)+2*Math.max(r,s)+(r>s?1:0)}async function serverReflexiveCandidate(e,t){const i=new Message(1,0);try{const[r]=await e.request(i,t),s=e.localCandidate;if(!s)throw new Error("not exist");return new Candidate(candidateFoundation("srflx","udp",s.host),s.component,s.transport,candidatePriority("srflx"),r.getAttributeValue("XOR-MAPPED-ADDRESS")[0],r.getAttributeValue("XOR-MAPPED-ADDRESS")[1],"srflx",s.host,s.port)}catch(e){log24("error serverReflexiveCandidate",e)}}function validateAddress(e){return e&&Number.isNaN(e[1])?[e[0],443]:e}var import_os=__toESM(require("os")),import_ip2=__toESM(require_ip()),logger19=debug2("werift-ice : packages/ice/src/utils.ts");function isLinkLocalAddress(e){return 4===normalizeFamilyNodeV18(e.family)&&e.address?.startsWith("169.254.")||6===normalizeFamilyNodeV18(e.family)&&e.address?.startsWith("fe80::")}function nodeIpAddress(e,{useLinkLocalAddress:t}={}){const i=["ipsec","tun","utun","tap"],r=["vmnet","veth"],s=import_os.default.networkInterfaces();logger19(s);const n=Object.keys(s).map((n=>{for(const e of[...i,...r])if(n.startsWith(e))return{nic:n,addresses:[]};return{nic:n,addresses:s[n].filter((i=>!(normalizeFamilyNodeV18(i.family)!==e||import_ip2.default.isLoopback(i.address)||!t&&isLinkLocalAddress(i)))).map((e=>e.address))}})).filter((e=>!!e));return n.sort(((e,t)=>e.nic.localeCompare(t.nic))),Object.values(n).flatMap((e=>e.addresses))}function getHostAddresses(e,t,i={}){const r=[];return e&&r.push(...nodeIpAddress(4,i)),t&&r.push(...nodeIpAddress(6,i)),r}var log25=debug2("werift-ice : packages/ice/src/ice.ts : log"),Connection=class{constructor(e,t){this._iceControlling=e,__publicField(this,"localUsername",randomString(4)),__publicField(this,"localPassword",randomString(22)),__publicField(this,"remoteIsLite",!1),__publicField(this,"remotePassword",""),__publicField(this,"remoteUsername",""),__publicField(this,"checkList",[]),__publicField(this,"localCandidates",[]),__publicField(this,"stunServer"),__publicField(this,"turnServer"),__publicField(this,"options"),__publicField(this,"remoteCandidatesEnd",!1),__publicField(this,"localCandidatesEnd",!1),__publicField(this,"generation",-1),__publicField(this,"userHistory",{}),__publicField(this,"tieBreaker",BigInt(new Uint64BE((0,import_crypto16.randomBytes)(64)).toString())),__publicField(this,"state","new"),__publicField(this,"lookup"),__publicField(this,"_remoteCandidates",[]),__publicField(this,"nominated"),__publicField(this,"nominating",!1),__publicField(this,"checkListDone",!1),__publicField(this,"checkListState",new PQueue),__publicField(this,"earlyChecks",[]),__publicField(this,"earlyChecksDone",!1),__publicField(this,"localCandidatesStart",!1),__publicField(this,"protocols",[]),__publicField(this,"queryConsentHandle"),__publicField(this,"onData",new Event3),__publicField(this,"stateChanged",new Event3),__publicField(this,"onIceCandidate",new Event3),__publicField(this,"queryConsent",(()=>{this.queryConsentHandle&&this.queryConsentHandle.resolve(),this.queryConsentHandle=cancelable((async(e,t,i)=>{let r=0,s=!1;const n=new AbortController;i.once((()=>{s=!0,r+=CONSENT_FAILURES,n.abort(),this.queryConsentHandle=void 0}));const{localUsername:a,remoteUsername:o,iceControlling:c}=this;try{for(;"closed"!==this.state&&!s;){await import_promises4.default.setTimeout(CONSENT_INTERVAL*(.8+.4*Math.random())*1e3,void 0,{signal:n.signal});const e=this.nominated;if(!e||s)break;const t=this.buildRequest({nominate:!1,localUsername:a,remoteUsername:o,iceControlling:c});try{await e.protocol.request(t,e.remoteAddr,Buffer.from(this.remotePassword,"utf8"),0),r=0,"disconnected"===this.state&&this.setState("connected")}catch(t){if(e.id===this.nominated?.id){log25("no stun response"),r++,this.setState("disconnected");break}}if(r>=CONSENT_FAILURES){log25("Consent to send expired"),this.queryConsentHandle=void 0,this.setState("closed");break}}}catch(e){}}))})),__publicField(this,"send",(async e=>{const t=this.nominated;t&&(await t.protocol.sendData(e,t.remoteAddr),t.packetsSent++,t.bytesSent+=e.length)})),__publicField(this,"checkStart",(e=>cancelable((async t=>{log25("check start",e.toJSON()),e.updateState(2);const i={},{remotePassword:r,remoteUsername:s,generation:n}=this,a=e.localCandidate.ufrag??this.localUsername,o=this.iceControlling&&!this.remoteIsLite,c=this.buildRequest({nominate:o,localUsername:a,remoteUsername:s,iceControlling:this.iceControlling}),l=performance.now();try{const[t,o]=await e.protocol.request(c,e.remoteAddr,Buffer.from(r,"utf8"),4),u=(performance.now()-l)/1e3;e.rtt=u,e.totalRoundTripTime+=u,e.roundTripTimeMeasurements++,log25("response received",c.toJSON(),t.toJSON(),o,{localUsername:a,remoteUsername:s,remotePassword:r,generation:n,rtt:u}),i.response=t,i.addr=o}catch(i){const o=i;return log25("failure case",c.toJSON(),o.response?JSON.stringify(o.response.toJSON(),null,2):i,{localUsername:a,remoteUsername:s,remotePassword:r,generation:n},e.remoteAddr),487===o.response?.getAttributeValue("ERROR-CODE")[0]?(c.attributesKeys.includes("ICE-CONTROLLED")?this.switchRole(!0):c.attributesKeys.includes("ICE-CONTROLLING")&&this.switchRole(!1),await this.checkStart(e).awaitable,void t()):401===o.response?.getAttributeValue("ERROR-CODE")[0]?(log25("retry 401",e.toJSON()),await this.checkStart(e).awaitable,void t()):(log25("checkStart CandidatePairState.FAILED",e.toJSON()),e.updateState(4),this.checkComplete(e),void t())}if(!(0,import_fast_deep_equal.default)(i.addr,e.remoteAddr))return e.updateState(4),this.checkComplete(e),void t();if(o||e.remoteNominated)e.nominated=!0;else if(this.iceControlling&&!this.nominating){this.nominating=!0;const t=this.buildRequest({nominate:!0,localUsername:a,remoteUsername:s,iceControlling:this.iceControlling});try{await e.protocol.request(t,e.remoteAddr,Buffer.from(this.remotePassword,"utf8"))}catch(t){return e.updateState(4),void this.checkComplete(e)}e.nominated=!0}e.updateState(3),this.checkComplete(e),t()})))),__publicField(this,"pairRemoteCandidate",(e=>{for(const t of this.protocols)this.tryPair(t,e)})),this.options={...defaultOptions,...t};const{stunServer:i,turnServer:r}=this.options;this.stunServer=validateAddress(i)??["stun.l.google.com",19302],this.turnServer=validateAddress(r),this.restart(),log25("new Connection",this.options)}get iceControlling(){return this._iceControlling}set iceControlling(e){if(!(this.generation>0||this.nominated)){this._iceControlling=e;for(const t of this.checkList)t.iceControlling=e}}async restart(){this.generation++,this.localUsername=randomString(4),this.localPassword=randomString(22),this.options.localPasswordPrefix&&(this.localPassword=this.options.localPasswordPrefix+this.localPassword.slice(this.options.localPasswordPrefix.length)),this.userHistory[this.localUsername]=this.localPassword,this.remoteUsername="",this.remotePassword="",this.localCandidates=[],this._remoteCandidates=[],this.remoteCandidatesEnd=!1,this.localCandidatesEnd=!1,this.state="new",this.lookup?.close?.(),this.lookup=void 0,this.nominated=void 0,this.nominating=!1,this.checkList=[],this.checkListDone=!1,this.checkListState=new PQueue,this.earlyChecks=[],this.earlyChecksDone=!1,this.localCandidatesStart=!1;for(const e of this.protocols)e.localCandidate&&(e.localCandidate.generation=this.generation,e.localCandidate.ufrag=this.localUsername);this.queryConsentHandle?.resolve?.(),this.queryConsentHandle=void 0}resetNominatedPair(){log25("resetNominatedPair"),this.nominated=void 0,this.nominating=!1}setRemoteParams({iceLite:e,usernameFragment:t,password:i}){log25("setRemoteParams",{iceLite:e,usernameFragment:t,password:i}),this.remoteIsLite=e,this.remoteUsername=t,this.remotePassword=i}async gatherCandidates(){if(!this.localCandidatesStart){this.localCandidatesStart=!0;let e=getHostAddresses(this.options.useIpv4,this.options.useIpv6,{useLinkLocalAddress:this.options.useLinkLocalAddress});const{interfaceAddresses:t}=this.options;if(t){const i=e.filter((e=>Object.values(t).includes(e)));i.length&&(e=i)}this.options.additionalHostAddresses&&(e=Array.from(new Set([...this.options.additionalHostAddresses,...e])));const i=this.getCandidatePromises(e,5);await Promise.allSettled(i),this.localCandidatesEnd=!0}this.setState("completed")}appendLocalCandidate(e){this.localCandidates.push(e),this.onIceCandidate.execute(e)}ensureProtocol(e){e.onRequestReceived.subscribe(((t,i,r)=>{if(1!==t.messageMethod)return void this.respondError(t,i,e,[400,"Bad Request"]);const s=t.getAttributeValue("USERNAME"),{remoteUsername:n}=decodeTxUsername(s),a=this.userHistory[n]??this.localPassword,{iceControlling:o}=this;if(o&&t.attributesKeys.includes("ICE-CONTROLLING")){if(this.tieBreaker>=t.getAttributeValue("ICE-CONTROLLING"))return void this.respondError(t,i,e,[487,"Role Conflict"]);this.switchRole(!1)}else if(!o&&t.attributesKeys.includes("ICE-CONTROLLED")){if(!(this.tieBreaker<t.getAttributeValue("ICE-CONTROLLED")))return void this.switchRole(!0);this.respondError(t,i,e,[487,"Role Conflict"])}if(this.options.filterStunResponse&&!this.options.filterStunResponse(t,i,e))return;const c=new Message(1,256,t.transactionId);c.setAttribute("XOR-MAPPED-ADDRESS",i).addMessageIntegrity(Buffer.from(a,"utf8")).addFingerprint(),e.sendStun(c,i).catch((e=>{log25("sendStun error",e)})),0!==this.checkList.length||this.earlyChecksDone?this.checkIncoming(t,i,e):this.earlyChecks.push([t,i,e])})),e.onDataReceived.subscribe((t=>{try{const i=this.nominated;i&&i.protocol===e&&(i.packetsReceived++,i.bytesReceived+=t.length),this.onData.execute(t)}catch(e){log25("dataReceived",e)}}))}getCandidatePromises(e,t=5){let i=[];const r=(e=e.filter((e=>!this.protocols.find((t=>t.localIp===e))))).map((async e=>{const t=new StunProtocol;this.ensureProtocol(t);try{await t.connectionMade((0,import_net4.isIPv4)(e),this.options.portRange,this.options.interfaceAddresses),t.localIp=e,this.protocols.push(t),log25("protocol",t.localIp);const i=[e,t.getExtraInfo()[1]];return t.localCandidate=new Candidate(candidateFoundation("host","udp",i[0]),1,"udp",candidatePriority("host"),i[0],i[1],"host",void 0,void 0,void 0,this.generation,this.localUsername),this.pairLocalProtocol(t),this.appendLocalCandidate(t.localCandidate),t}catch(e){log25("error protocol STUN",e)}}));i.push(...r.map((e=>e.then((e=>e?.localCandidate)))));const{stunServer:s,turnServer:n}=this;if(s){const e=r.map((async e=>{const i=await e;if(!i)return;return new Promise((async(e,r)=>{const n=setTimeout(r,1e3*t);if(i.localCandidate?.host&&(0,import_net4.isIPv4)(i.localCandidate?.host)){const t=await serverReflexiveCandidate(i,s).catch((e=>{log25("error",e)}));t&&this.appendLocalCandidate(t),clearTimeout(n),e(t)}else clearTimeout(n),e()})).catch((e=>{log25("query STUN server",e)}))}));i.push(...e)}const{turnUsername:a,turnPassword:o}=this.options;if(n&&a&&o){const e=(async()=>{const e=await createStunOverTurnClient({address:n,username:a,password:o},{portRange:this.options.portRange,interfaceAddresses:this.options.interfaceAddresses,transport:"tcp"===this.options.turnTransport?"tcp":"udp"}).catch((async e=>{if("tcp"!==this.options.turnTransport)return await createStunOverTurnClient({address:n,username:a,password:o},{portRange:this.options.portRange,interfaceAddresses:this.options.interfaceAddresses,transport:"tcp"});throw e}));this.ensureProtocol(e),this.protocols.push(e);const t=e.turn.relayedAddress,i=e.turn.mappedAddress;return log25("turn candidateAddress",t),e.localCandidate=new Candidate(candidateFoundation("relay","udp",t[0]),1,"udp",candidatePriority("relay"),t[0],t[1],"relay",i[0],i[1],void 0,this.generation,this.localUsername),this.appendLocalCandidate(e.localCandidate),e.localCandidate})().catch((e=>{log25("query TURN server",e)}));this.options.forceTurn&&(i=[]),i.push(e)}return i}async connect(){if(log25("start connect ice"),!this.localCandidatesEnd&&!this.localCandidatesStart)throw new Error("Local candidates gathering was not performed");if(!this.remoteUsername||!this.remotePassword)throw new Error("Remote username or password is missing");for(const e of this.remoteCandidates)this.pairRemoteCandidate(e);this.sortCheckList(),this.unfreezeInitial(),log25("earlyChecks",this.localPassword,this.earlyChecks.length);for(const e of this.earlyChecks)this.checkIncoming(...e);for(this.earlyChecks=[],this.earlyChecksDone=!0;"closed"!==this.state&&this.schedulingChecks();)await import_promises4.default.setTimeout(20);let e=ICE_FAILED;for(;this.checkList.length>0&&e===ICE_FAILED;)e=await this.checkListState.get(),log25("checkListState",e);for(const e of this.checkList)e.handle?.resolve?.();if(e!==ICE_COMPLETED)throw new Error("ICE negotiation failed");this.queryConsent(),this.setState("connected")}unfreezeInitial(){const[e]=this.checkList;if(!e)return;0===e.state&&e.updateState(1);const t=new Set(e.localCandidate.foundation);for(const i of this.checkList)i.component!==e.component||t.has(i.localCandidate.foundation)||0!==i.state||(i.updateState(1),t.add(i.localCandidate.foundation))}schedulingChecks(){{const e=this.checkList.filter((e=>!this.options.forceTurn||e.protocol.type!==StunProtocol.type)).find((e=>1===e.state));if(e)return e.handle=this.checkStart(e),!0}{const e=this.checkList.find((e=>0===e.state));if(e)return e.handle=this.checkStart(e),!0}return!this.remoteCandidatesEnd&&!this.checkListDone}async close(){this.setState("closed"),this.queryConsentHandle?.resolve?.(),this.checkList&&!this.checkListDone&&this.checkListState.put(new Promise((e=>{e(ICE_FAILED)}))),this.nominated=void 0;for(const e of this.protocols)e.close&&await e.close();this.protocols=[],this.localCandidates=[],this.lookup?.close?.(),this.lookup=void 0}setState(e){this.state=e,this.stateChanged.execute(e)}async addRemoteCandidate(e){if(e){if(e.host.includes(".local"))try{this.lookup||(this.lookup=new MdnsLookup);const t=await this.lookup.lookup(e.host);e.host=t}catch(e){return}try{validateRemoteCandidate(e)}catch(e){return}log25("addRemoteCandidate",e),this._remoteCandidates.push(e),this.pairRemoteCandidate(e),this.sortCheckList()}else this.remoteCandidatesEnd=!0}getDefaultCandidate(){const e=this.localCandidates.sort(((e,t)=>e.priority-t.priority)),[t]=e;return t}set remoteCandidates(e){if(this.remoteCandidatesEnd)throw new Error("Cannot set remote candidates after end-of-candidates.");this._remoteCandidates=[];for(const t of e){try{validateRemoteCandidate(t)}catch(e){continue}this._remoteCandidates.push(t)}this.remoteCandidatesEnd=!0}get remoteCandidates(){return this._remoteCandidates}get candidatePairs(){return this.checkList}sortCheckList(){sortCandidatePairs(this.checkList,this.iceControlling)}findPair(e,t){return this.checkList.find((i=>(0,import_fast_deep_equal.default)(i.protocol,e)&&(0,import_fast_deep_equal.default)(i.remoteCandidate,t)))}switchRole(e){log25("switch role",e),this.iceControlling=e,this.sortCheckList()}checkComplete(e){if(e.handle=void 0,3===e.state){if(e.nominated&&(null==e.remoteCandidate.generation||e.remoteCandidate.generation===this.generation)&&null==this.nominated){log25("nominated",e.toJSON()),this.nominated=e,this.nominating=!1;for(const t of this.checkList)t.component===e.component&&[1,0].includes(t.state)&&t.updateState(4)}if(this.nominated)return void(this.checkListDone||(log25("ICE completed"),this.checkListState.put(new Promise((e=>e(ICE_COMPLETED)))),this.checkListDone=!0));log25("not completed",e.toJSON());for(const t of this.checkList)t.localCandidate.foundation===e.localCandidate.foundation&&0===t.state&&t.updateState(1)}{const e=[3,4];if(this.checkList.find((({state:t})=>!e.includes(t))))return}if(!this.iceControlling){const e=3;if(this.checkList.find((({state:t})=>t===e)))return}this.checkListDone||(log25("ICE failed"),this.checkListState.put(new Promise((e=>{e(ICE_FAILED)}))))}addPair(e){this.checkList.push(e),this.sortCheckList()}checkIncoming(e,t,i){const r=e.getAttributeValue("USERNAME"),{remoteUsername:s}=decodeTxUsername(r);let n;const[a,o]=t;for(const e of this.remoteCandidates)if(e.host===a&&e.port===o){n=e;break}n||(n=new Candidate(randomString(10),1,"udp",e.getAttributeValue("PRIORITY"),a,o,"prflx",void 0,void 0,void 0,void 0,void 0),this._remoteCandidates.push(n));let c=this.findPair(i,n);c||(c=new CandidatePair(i,n,this.iceControlling),c.updateState(1),this.addPair(c)),c.localCandidate.ufrag=s,log25("Triggered Checks",e.toJSON(),c.toJSON(),{localUsername:this.localUsername,remoteUsername:this.remoteUsername,localPassword:this.localPassword,remotePassword:this.remotePassword,generation:this.generation}),[1,4].includes(c.state)&&(c.handle=this.checkStart(c)),e.attributesKeys.includes("USE-CANDIDATE")&&!this.iceControlling&&(c.remoteNominated=!0,3===c.state&&(c.nominated=!0,this.checkComplete(c)))}tryPair(e,t){if(e.localCandidate?.canPairWith(t)&&!this.findPair(e,t)){const i=new CandidatePair(e,t,this.iceControlling);if(this.options.filterCandidatePair&&!this.options.filterCandidatePair(i))return;i.updateState(1),this.addPair(i)}}pairLocalProtocol(e){for(const t of this.remoteCandidates)this.tryPair(e,t)}buildRequest({nominate:e,remoteUsername:t,localUsername:i,iceControlling:r}){const s=encodeTxUsername({remoteUsername:t,localUsername:i}),n=new Message(1,0);return n.setAttribute("USERNAME",s).setAttribute("PRIORITY",candidatePriority("prflx")),r?(n.setAttribute("ICE-CONTROLLING",this.tieBreaker),e&&n.setAttribute("USE-CANDIDATE",null)):n.setAttribute("ICE-CONTROLLED",this.tieBreaker),n}respondError(e,t,i,r){const s=new Message(e.messageMethod,272,e.transactionId);s.setAttribute("ERROR-CODE",r).addMessageIntegrity(Buffer.from(this.localPassword,"utf8")).addFingerprint(),i.sendStun(s,t).catch((e=>{log25("sendStun error",e)}))}},encodeTxUsername=({remoteUsername:e,localUsername:t})=>`${e}:${t}`,decodeTxUsername=e=>{const[t,i]=e.split(":");return{remoteUsername:t,localUsername:i}},import_events2=__toESM(require("events"));function enumerate2(e){return e.map(((e,t)=>[t,e]))}function divide(e,t){const i=e.split(t);return[i[0],i.slice(1).join(t)]}var EventTarget2=class extends import_events2.default{constructor(){super(...arguments),__publicField(this,"addEventListener",((e,t)=>{this.addListener(e,t)})),__publicField(this,"removeEventListener",((e,t)=>{this.removeListener(e,t)}))}},log26=debug2("werift:packages/webrtc/src/dataChannel.ts"),RTCDataChannel=class extends EventTarget2{constructor(e,t,i=!0){if(super(),this.sctp=e,this.parameters=t,this.sendOpen=i,__publicField(this,"stateChange",new Event3),__publicField(this,"stateChanged",new Event3),__publicField(this,"onMessage",new Event3),__publicField(this,"error",new Event3),__publicField(this,"bufferedAmountLow",new Event3),__publicField(this,"onopen"),__publicField(this,"onclose"),__publicField(this,"onclosing"),__publicField(this,"onmessage"),__publicField(this,"onerror"),__publicField(this,"isCreatedByRemote",!1),__publicField(this,"id"),__publicField(this,"readyState","connecting"),__publicField(this,"bufferedAmount",0),__publicField(this,"_bufferedAmountLowThreshold",0),__publicField(this,"messagesSent",0),__publicField(this,"bytesSent",0),__publicField(this,"messagesReceived",0),__publicField(this,"bytesReceived",0),this.id=this.parameters.id,t.negotiated){if(null==this.id||this.id<0||this.id>65534)throw new Error("ID must be in range 0-65534 if data channel is negotiated out-of-band");this.sctp.dataChannelAddNegotiated(this)}else i&&(this.sendOpen=!1,this.sctp.dataChannelOpen(this))}get ordered(){return this.parameters.ordered}get maxRetransmits(){return this.parameters.maxRetransmits}get maxPacketLifeTime(){return this.parameters.maxPacketLifeTime}get label(){return this.parameters.label}get protocol(){return this.parameters.protocol}get negotiated(){return this.parameters.negotiated}get bufferedAmountLowThreshold(){return this._bufferedAmountLowThreshold}set bufferedAmountLowThreshold(e){if(e<0||e>4294967295)throw new Error("bufferedAmountLowThreshold must be in range 0 - 4294967295");this._bufferedAmountLowThreshold=e}setId(e){this.id=e}setReadyState(e){if(e!==this.readyState){switch(this.readyState=e,this.stateChange.execute(e),this.stateChanged.execute(e),e){case"open":this.onopen&&this.onopen(),this.emit("open");break;case"closed":this.onclose&&this.onclose(),this.emit("close");break;case"closing":this.onclosing&&this.onclosing()}log26("change state",e)}}addBufferedAmount(e){const t=this.bufferedAmount>this.bufferedAmountLowThreshold&&this.bufferedAmount+e<=this.bufferedAmountLowThreshold;this.bufferedAmount+=e,t&&(this.bufferedAmountLow.execute(),this.emit("bufferedamountlow"))}send(e){const t=Buffer.isBuffer(e)?e.length:Buffer.byteLength(e);this.messagesSent++,this.bytesSent+=t,this.sctp.datachannelSend(this,e)}close(){this.sctp.dataChannelClose(this)}},RTCDataChannelParameters=class{constructor(e={}){__publicField(this,"label",""),__publicField(this,"maxPacketLifeTime"),__publicField(this,"maxRetransmits"),__publicField(this,"ordered",!0),__publicField(this,"protocol",""),__publicField(this,"negotiated",!1),__publicField(this,"id"),Object.assign(this,e)}},useNACK=()=>({type:"nack"}),usePLI=()=>({type:"nack",parameter:"pli"}),useREMB=()=>({type:"goog-remb"}),useTWCC=()=>({type:"transport-cc"}),RTCRtpCodecParameters2=class{constructor(e){__publicField(this,"payloadType"),__publicField(this,"mimeType"),__publicField(this,"clockRate"),__publicField(this,"channels"),__publicField(this,"rtcpFeedback",[]),__publicField(this,"parameters"),__publicField(this,"direction","all"),Object.assign(this,e)}get name(){return this.mimeType.split("/")[1]}get contentType(){return this.mimeType.split("/")[0]}get str(){let e=`${this.name}/${this.clockRate}`;return 2===this.channels&&(e+="/2"),e}},RTCRtpHeaderExtensionParameters2=class{constructor(e){__publicField(this,"id"),__publicField(this,"uri"),Object.assign(this,e)}},RTCRtcpFeedback=class{constructor(e={}){__publicField(this,"type"),__publicField(this,"parameter"),Object.assign(this,e)}},RTCRtpRtxParameters=class{constructor(e={}){__publicField(this,"ssrc"),Object.assign(this,e)}},RTCRtpCodingParameters=class{constructor(e){__publicField(this,"ssrc"),__publicField(this,"payloadType"),__publicField(this,"rtx"),Object.assign(this,e)}},RTCRtpSimulcastParameters=class{constructor(e){__publicField(this,"rid"),__publicField(this,"direction"),Object.assign(this,e)}},useH264=(e={})=>new RTCRtpCodecParameters2({mimeType:"video/h264",clockRate:9e4,rtcpFeedback:[useNACK(),usePLI(),useREMB()],parameters:"profile-level-id=42e01f;packetization-mode=1;level-asymmetry-allowed=1",...e}),useVP8=(e={})=>new RTCRtpCodecParameters2({mimeType:"video/VP8",clockRate:9e4,rtcpFeedback:[useNACK(),usePLI(),useREMB()],...e}),useVP9=(e={})=>new RTCRtpCodecParameters2({mimeType:"video/VP9",clockRate:9e4,rtcpFeedback:[useNACK(),usePLI(),useREMB()],...e}),useAV1X=(e={})=>new RTCRtpCodecParameters2({mimeType:"video/AV1X",clockRate:9e4,rtcpFeedback:[useNACK(),usePLI(),useREMB()],...e}),useOPUS=(e={})=>new RTCRtpCodecParameters2({mimeType:"audio/OPUS",clockRate:48e3,channels:2,...e}),usePCMU=(e={})=>new RTCRtpCodecParameters2({mimeType:"audio/PCMU",clockRate:8e3,channels:1,payloadType:0,...e}),supportedCodecs=[useAV1X(),useVP9(),useVP8(),useH264(),useOPUS(),usePCMU()].map((e=>e.mimeType)),supportedVideoCodecs=supportedCodecs.filter((e=>e.toLowerCase().startsWith("video/"))),supportedAudioCodecs=supportedCodecs.filter((e=>e.toLowerCase().startsWith("audio/")));function useSdesMid(){return new RTCRtpHeaderExtensionParameters2({uri:RTP_EXTENSION_URI.sdesMid})}function useAbsSendTime(){return new RTCRtpHeaderExtensionParameters2({uri:RTP_EXTENSION_URI.absSendTime})}function useAudioLevelIndication(){return new RTCRtpHeaderExtensionParameters2({uri:RTP_EXTENSION_URI.audioLevelIndication})}var import_crypto25=require("crypto"),import_promises7=require("timers/promises"),import_crypto19=require("crypto"),import_dgram3=require("dgram"),import_perf_hooks=require("perf_hooks"),import_crypto17=require("crypto"),DATA_CHANNEL_ACK=2,DATA_CHANNEL_OPEN=3,DATA_CHANNEL_RELIABLE=0,WEBRTC_DCEP=50,WEBRTC_STRING=51,WEBRTC_BINARY=53,WEBRTC_STRING_EMPTY=56,WEBRTC_BINARY_EMPTY=57,DISCARD_HOST="0.0.0.0",DISCARD_PORT=9,DTLS_ROLE_SETUP={auto:"actpass",client:"active",server:"passive"},DTLS_SETUP_ROLE=Object.keys(DTLS_ROLE_SETUP).reduce(((e,t)=>(e[DTLS_ROLE_SETUP[t]]=t,e)),{}),FMTP_INT_PARAMETERS=["apt","max-fr","max-fs","maxplaybackrate","minptime","stereo","useinbandfec"],SSRC_INFO_ATTRS=["cname","msid","mslabel","label"],SRTP_PROFILE={SRTP_AES128_CM_HMAC_SHA1_80:ProtectionProfileAes128CmHmacSha1_80,SRTP_AEAD_AES_128_GCM:ProtectionProfileAeadAes128Gcm},SenderDirections=["sendonly","sendrecv"],ReceiverDirection=["sendrecv","recvonly"],RTCStatsReport=class extends Map{constructor(e){if(super(),e)for(const t of e)this.set(t.id,t)}};function generateStatsId(e,...t){return`${e}_${t.filter((e=>void 0!==e)).join("_")}`}function getStatsTimestamp(){return performance.now()}var RTCRtpTransceiver3=class{constructor(e,t,i,r,s){this.kind=e,this.receiver=i,this.sender=r,this._direction=s,__publicField(this,"id",(0,import_crypto17.randomUUID)().toString()),__publicField(this,"onTrack",new Event3),__publicField(this,"mid"),__publicField(this,"mLineIndex"),__publicField(this,"usedForSender",!1),__publicField(this,"_currentDirection"),__publicField(this,"offerDirection"),__publicField(this,"_codecs",[]),__publicField(this,"headerExtensions",[]),__publicField(this,"options",{}),__publicField(this,"stopping",!1),__publicField(this,"stopped",!1),t&&this.setDtlsTransport(t)}set codecs(e){this._codecs=e}get codecs(){return this._codecs}get dtlsTransport(){return this.receiver.dtlsTransport}get direction(){return this._direction}setDirection(e){this._direction=e,SenderDirections.includes(this._currentDirection??"")&&(this.usedForSender=!0)}get currentDirection(){return this._currentDirection}setCurrentDirection(e){this._currentDirection=e}setDtlsTransport(e){this.receiver.setDtlsTransport(e),this.sender.setDtlsTransport(e)}get msid(){return`${this.sender.streamId} ${this.sender.trackId}`}addTrack(e){this.receiver.addTrack(e)&&this.onTrack.execute(e,this)}stop(){this.stopping||(this.stopping=!0)}getPayloadType(e){return this.codecs.find((t=>t.mimeType.toLowerCase().includes(e.toLowerCase())))?.payloadType}getCodecStats(){const e=getStatsTimestamp(),t=[];if(!this.dtlsTransport)return t;const i=generateStatsId("transport",this.dtlsTransport.id);for(const r of this.codecs){const s={type:"codec",id:generateStatsId("codec",r.payloadType,i),timestamp:e,payloadType:r.payloadType,transportId:i,mimeType:r.mimeType,clockRate:r.clockRate,channels:r.channels,sdpFmtpLine:r.parameters};t.push(s)}return t}},Inactive="inactive",Sendonly="sendonly",Recvonly="recvonly",Sendrecv="sendrecv",Directions=[Inactive,Sendonly,Recvonly,Sendrecv],import_crypto18=require("crypto"),MediaStreamTrack2=class extends EventTarget2{constructor(e){super(),__publicField(this,"uuid",(0,import_crypto18.randomUUID)().toString()),__publicField(this,"streamId"),__publicField(this,"remote",!1),__publicField(this,"label"),__publicField(this,"kind"),__publicField(this,"id"),__publicField(this,"ssrc"),__publicField(this,"rid"),__publicField(this,"header"),__publicField(this,"codec"),__publicField(this,"enabled",!0),__publicField(this,"onReceiveRtp",new Event3),__publicField(this,"onReceiveRtcp",new Event3),__publicField(this,"onSourceChanged",new Event3),__publicField(this,"stopped",!1),__publicField(this,"muted",!0),__publicField(this,"stop",(()=>{this.stopped=!0,this.muted=!0,this.onReceiveRtp.complete(),this.emit("ended")})),__publicField(this,"writeRtp",(e=>{if(this.remote)throw new Error("this is remoteTrack");if(this.stopped)return;const t=Buffer.isBuffer(e)?RtpPacket.deSerialize(e):e;t.header.payloadType=this.codec?.payloadType??t.header.payloadType,this.onReceiveRtp.execute(t)})),Object.assign(this,e),this.onReceiveRtp.subscribe((e=>{this.muted=!1,this.header=e.header})),this.label=`${this.remote?"remote":"local"} ${this.kind}`}},MediaStream2=class{constructor(e){__publicField(this,"id"),__publicField(this,"tracks",[]),Array.isArray(e)?this.tracks=e:Object.assign(this,e),this.id??(this.id=(0,import_crypto18.randomUUID)().toString())}addTrack(e){e.streamId=this.id,this.tracks.push(e)}getTracks(){return this.tracks}getAudioTracks(){return this.tracks.filter((e=>"audio"===e.kind))}getVideoTracks(){return this.tracks.filter((e=>"video"===e.kind))}},log27=debug2("werift:packages/webrtc/src/utils.ts");function fingerprint(e,t){const i=(0,import_crypto19.createHash)(t).update(e).digest("hex");return(e=>e.match(/(.{2})/g).join(":"))(i.toUpperCase())}function isDtls(e){const t=e[0];return t>19&&t<64}var andDirection=(e,t)=>Directions[Directions.indexOf(e)&Directions.indexOf(t)];function reverseDirection(e){return"sendonly"===e?"recvonly":"recvonly"===e?"sendonly":e}var milliTime=Date.now,startupTimestampInMicroseconds=1000n*BigInt(Date.now())-process.hrtime.bigint()/1000n,microTime=()=>startupTimestampInMicroseconds+process.hrtime.bigint()/1000n,timestampSeconds=()=>Date.now()/1e3,ntpTime=()=>{const e=(import_perf_hooks.performance.timeOrigin+import_perf_hooks.performance.now()-Date.UTC(1900,0,1))/1e3,[t,i]=e.toString().split(".").map(Number);return bufferWriter([4,4],[t,i]).readBigUInt64BE()},compactNtp=e=>{const t=bufferWriter([8],[e]),[,i,r]=bufferReader(t,[2,2,2,2]);return bufferWriter([2,2],[i,r]).readUInt32BE()};function parseIceServers(e){const t=e=>{if(!e)return;const[t,i]=e.split(":");return[t,Number.parseInt(i)]},i=t(e.find((({urls:e})=>e.includes("stun:")))?.urls.slice(5)),r=t(e.find((({urls:e})=>e.includes("turn:")))?.urls.slice(5)),{credential:s,username:n}=e.find((({urls:e})=>e.includes("turn:")))||{},a={stunServer:i,turnServer:r,turnUsername:n,turnPassword:s};return log27("iceOptions",a),a}var createSelfSignedCertificate=CipherContext.createSelfSignedCertificateWithKey,MediaStreamTrackFactory=class{static async rtpSource({port:e,kind:t,cb:i}){e??(e=await randomPort());const r=new MediaStreamTrack2({kind:t}),s=(0,import_dgram3.createSocket)("udp4");s.bind(e);const n=e=>{i&&(e=i(e)),r.writeRtp(e)};s.addListener("message",n);return[r,e,()=>{s.removeListener("message",n);try{s.close()}catch(e){}}]}},deepMerge=(e,t)=>{if(!e||"object"!=typeof e)return null!==t&&"object"==typeof t?t:e;if(!t||"object"!=typeof t)return null==t?e:t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];null!=r&&(e[i]=r)}return e},log28=debug2("werift:packages/webrtc/src/media/receiver/nack.ts"),LOST_SIZE=150,NackHandler=class{constructor(e){this.receiver=e,__publicField(this,"newEstSeqNum",0),__publicField(this,"_lost",{}),__publicField(this,"nackLoop"),__publicField(this,"onPacketLost",new Event3),__publicField(this,"mediaSourceSsrc"),__publicField(this,"retryCount",10),__publicField(this,"closed",!1),__publicField(this,"sendNack",(()=>new Promise(((e,t)=>{if(this.lostSeqNumbers.length>0&&this.mediaSourceSsrc){const i=new GenericNack({senderSsrc:this.receiver.rtcpSsrc,mediaSourceSsrc:this.mediaSourceSsrc,lost:this.lostSeqNumbers}),r=new RtcpTransportLayerFeedback({feedback:i});this.receiver.dtlsTransport.sendRtcp([r]).then(e).catch(t),this.updateRetryCount(),this.onPacketLost.execute(i)}}))))}get lostSeqNumbers(){return Object.keys(this._lost).map(Number).sort()}getLost(e){return this._lost[e]}setLost(e,t){this._lost[e]=t,this.nackLoop||this.closed||(this.nackLoop=setInterval((async()=>{try{await this.sendNack(),Object.keys(this._lost).length||(clearInterval(this.nackLoop),this.nackLoop=void 0)}catch(e){log28("failed to send nack",e)}}),5))}removeLost(e){delete this._lost[e]}addPacket(e){const{sequenceNumber:t,ssrc:i}=e.header;if(this.mediaSourceSsrc=i,0!==this.newEstSeqNum){if(this.getLost(t))this.removeLost(t);else if(t===uint16Add(this.newEstSeqNum,1))this.newEstSeqNum=t;else if(t>uint16Add(this.newEstSeqNum,1)){for(let e=uint16Add(this.newEstSeqNum,1);e<t;e=uint16Add(e,1))this.setLost(e,1);this.newEstSeqNum=t,this.pruneLost()}}else this.newEstSeqNum=t}pruneLost(){this.lostSeqNumbers.length>LOST_SIZE&&(this._lost=Object.entries(this._lost).slice(-LOST_SIZE).reduce(((e,[t,i])=>(e[t]=i,e)),{}))}close(){this.closed=!0,clearInterval(this.nackLoop),this._lost={}}updateRetryCount(){this.lostSeqNumbers.forEach((e=>{if(this._lost[e]++>this.retryCount)return this.removeLost(e),e}))}},import_promises5=require("timers/promises"),log29=debug2("werift:packages/webrtc/media/receiver/receiverTwcc"),ReceiverTWCC=class{constructor(e,t,i){this.dtlsTransport=e,this.rtcpSsrc=t,this.mediaSourceSsrc=i,__publicField(this,"extensionInfo",{}),__publicField(this,"twccRunning",!1),__publicField(this,"fbPktCount",0),__publicField(this,"lastTimestamp"),this.runTWCC()}handleTWCC(e){this.extensionInfo[e]={tsn:e,timestamp:microTime()},Object.keys(this.extensionInfo).length>10&&this.sendTWCC()}async runTWCC(){for(;this.twccRunning;)this.sendTWCC(),await(0,import_promises5.setTimeout)(100)}sendTWCC(){if(0===Object.keys(this.extensionInfo).length)return;const e=Object.values(this.extensionInfo).sort(((e,t)=>e.tsn-t.tsn)),t=e[0].tsn,i=e.slice(-1)[0].tsn,r=[],s=e[0].tsn,n=uint16Add(i-t,1);let a,o;const c=[];for(let e=t;e<=i;e++){const t=this.extensionInfo[e]?.timestamp;if(t){this.lastTimestamp||(this.lastTimestamp=t),a||(a=this.lastTimestamp);const s=t-this.lastTimestamp;this.lastTimestamp=t;const n=new RecvDelta({delta:Number(s)});n.parseDelta(),c.push(n),null!=o&&o.status!==n.type&&(r.push(new RunLengthChunk({packetStatus:o.status,runLength:e-o.minTSN})),o={minTSN:e,status:n.type}),e===i&&(null!=o?r.push(new RunLengthChunk({packetStatus:o.status,runLength:e-o.minTSN+1})):r.push(new RunLengthChunk({packetStatus:n.type,runLength:1}))),null==o&&(o={minTSN:e,status:n.type})}}if(!a)return;const l=new RtcpTransportLayerFeedback({feedback:new TransportWideCC({senderSsrc:this.rtcpSsrc,mediaSourceSsrc:this.mediaSourceSsrc,baseSequenceNumber:s,packetStatusCount:n,referenceTime:uint24(Math.floor(Number(a/1000n/64n))),fbPktCount:this.fbPktCount,recvDeltas:c,packetChunks:r})});this.dtlsTransport.sendRtcp([l]).catch((e=>{log29(e)})),this.extensionInfo={},this.fbPktCount=uint8Add(this.fbPktCount,1)}},StreamStatistics=class{constructor(e){__publicField(this,"base_seq"),__publicField(this,"max_seq"),__publicField(this,"cycles",0),__publicField(this,"packets_received",0),__publicField(this,"clockRate"),__publicField(this,"jitter_q4",0),__publicField(this,"last_arrival"),__publicField(this,"last_timestamp"),__publicField(this,"expected_prior",0),__publicField(this,"received_prior",0),this.clockRate=e}add(e,t=Date.now()/1e3){const i=null==this.max_seq||uint16Gt(e.header.sequenceNumber,this.max_seq);if(this.packets_received++,null==this.base_seq&&(this.base_seq=e.header.sequenceNumber),i){const i=int(t*this.clockRate);if(null!=this.max_seq&&e.header.sequenceNumber<this.max_seq&&(this.cycles+=65536),this.max_seq=e.header.sequenceNumber,e.header.timestamp!==this.last_timestamp&&this.packets_received>1){const t=Math.abs(i-(this.last_arrival??0)-(e.header.timestamp-(this.last_timestamp??0)));this.jitter_q4+=t-(this.jitter_q4+8>>4)}this.last_arrival=i,this.last_timestamp=e.header.timestamp}}get fraction_lost(){const e=this.packets_expected-this.expected_prior;this.expected_prior=this.packets_expected;const t=this.packets_received-this.received_prior;this.received_prior=this.packets_received;const i=e-t;return 0==e||i<=0?0:Math.floor((i<<8)/e)}get jitter(){return this.jitter_q4>>4}get packets_expected(){return this.cycles+(this.max_seq??0)-(this.base_seq??0)+1}get packets_lost(){const e=this.packets_expected-this.packets_received;return e<0?0:e}},import_crypto24=require("crypto"),import_net5=require("net"),import_x5092=__toESM(require_build2()),import_crypto20=require("crypto"),import_promises6=require("timers/promises"),log30=debug2("werift:packages/webrtc/src/transport/dtls.ts"),_RTCDtlsTransport=class e{constructor(t,i,r,s=[]){this.config=t,this.iceTransport=i,this.localCertificate=r,this.srtpProfiles=s,__publicField(this,"id",(0,import_crypto20.randomUUID)().toString()),__publicField(this,"state","new"),__publicField(this,"role","auto"),__publicField(this,"srtpStarted",!1),__publicField(this,"transportSequenceNumber",0),__publicField(this,"bytesSent",0),__publicField(this,"bytesReceived",0),__publicField(this,"packetsSent",0),__publicField(this,"packetsReceived",0),__publicField(this,"dataReceiver",(()=>{})),__publicField(this,"dtls"),__publicField(this,"srtp"),__publicField(this,"srtcp"),__publicField(this,"onStateChange",new Event3),__publicField(this,"onRtcp",new Event3),__publicField(this,"onRtp",new Event3),__publicField(this,"remoteParameters"),__publicField(this,"sendData",(async e=>{if(!(this.config.debug.outboundPacketLoss&&this.config.debug.outboundPacketLoss/100<Math.random())){if(!this.dtls)throw new Error("dtls not established");await this.dtls.send(e)}})),this.localCertificate??(this.localCertificate=e.localCertificate)}get localParameters(){return new RTCDtlsParameters(this.localCertificate?this.localCertificate.getFingerprints():[],this.role)}static async SetupCertificate(){return this.localCertificate?this.localCertificate:(this.localCertificatePromise||(this.localCertificatePromise=(async()=>{const{certPem:e,keyPem:t,signatureHash:i}=await CipherContext.createSelfSignedCertificateWithKey({signature:SignatureAlgorithm.ecdsa_3,hash:HashAlgorithm.sha256_4},NamedCurveAlgorithm.secp256r1_23);return this.localCertificate=new RTCCertificate(t,e,i),this.localCertificate})()),this.localCertificatePromise)}setRemoteParams(e){this.remoteParameters=e}async start(){if("new"!==this.state)throw new Error("state must be new");if(0===this.remoteParameters?.fingerprints.length)throw new Error("remote fingerprint not exist");"auto"===this.role&&("controlling"===this.iceTransport.role?this.role="server":this.role="client"),this.setState("connecting"),await new Promise((async(e,t)=>{"server"===this.role?this.dtls=new DtlsServer({cert:this.localCertificate?.certPem,key:this.localCertificate?.privateKey,signatureHash:this.localCertificate?.signatureHash,transport:createIceTransport(this.iceTransport.connection),srtpProfiles:this.srtpProfiles,extendedMasterSecret:!0}):this.dtls=new DtlsClient({cert:this.localCertificate?.certPem,key:this.localCertificate?.privateKey,signatureHash:this.localCertificate?.signatureHash,transport:createIceTransport(this.iceTransport.connection),srtpProfiles:this.srtpProfiles,extendedMasterSecret:!0}),this.dtls.onData.subscribe((e=>{this.config.debug.inboundPacketLoss&&this.config.debug.inboundPacketLoss/100<Math.random()||this.dataReceiver(e)})),this.dtls.onClose.subscribe((()=>{this.setState("closed")})),this.dtls.onConnect.once(e),this.dtls.onError.once((e=>{this.setState("failed"),log30("dtls failed",e),t(e)})),this.dtls instanceof DtlsClient&&(await(0,import_promises6.setTimeout)(100),this.dtls.connect().catch((e=>{this.setState("failed"),log30("dtls connect failed",e),t(e)})))})),this.srtpProfiles.length>0&&this.startSrtp(),this.dtls.onConnect.subscribe((()=>{this.updateSrtpSession(),this.setState("connected")})),this.setState("connected"),log30("dtls connected")}updateSrtpSession(){if(!this.dtls)throw new Error;const e=this.dtls.srtp.srtpProfile;if(!e)throw new Error("need srtpProfile");log30("selected SRTP Profile",e);const{localKey:t,localSalt:i,remoteKey:r,remoteSalt:s}=this.dtls.extractSessionKeys(keyLength(e),saltLength(e)),n={keys:{localMasterKey:t,localMasterSalt:i,remoteMasterKey:r,remoteMasterSalt:s},profile:e};this.srtp=new SrtpSession(n),this.srtcp=new SrtcpSession(n)}startSrtp(){this.srtpStarted||(this.srtpStarted=!0,this.updateSrtpSession(),this.iceTransport.connection.onData.subscribe((e=>{if(!(this.config.debug.inboundPacketLoss&&this.config.debug.inboundPacketLoss/100<Math.random())&&isMedia(e))if(this.bytesReceived+=e.length,this.packetsReceived++,isRtcp(e)){const t=this.srtcp.decrypt(e),i=RtcpPacketConverter.deSerialize(t);for(const e of i)try{this.onRtcp.execute(e)}catch(e){log30("RTCP error",e)}}else{const t=this.srtp.decrypt(e),i=RtpPacket.deSerialize(t);try{this.onRtp.execute(i)}catch(e){log30("RTP error",e)}}})))}async sendRtp(e,t){try{const i=this.srtp.encrypt(e,t);return this.config.debug.outboundPacketLoss&&this.config.debug.outboundPacketLoss/100<Math.random()||(this.bytesSent+=i.length,this.packetsSent++,await this.iceTransport.connection.send(i).catch((()=>{}))),i.length}catch(e){return log30("failed to send",e),0}}async sendRtcp(e){const t=Buffer.concat(e.map((e=>e.serialize()))),i=this.srtcp.encrypt(t);if(this.config.debug.outboundPacketLoss&&this.config.debug.outboundPacketLoss/100<Math.random())return i.length;this.bytesSent+=i.length,this.packetsSent++,await this.iceTransport.connection.send(i).catch((()=>{}))}setState(e){e!=this.state&&(this.state=e,this.onStateChange.execute(e))}async stop(){this.setState("closed"),await this.iceTransport.stop()}async getStats(){const e=getStatsTimestamp(),t=[],i={type:"transport",id:generateStatsId("transport",this.id),timestamp:e,bytesSent:this.bytesSent,bytesReceived:this.bytesReceived,packetsSent:this.packetsSent,packetsReceived:this.packetsReceived,dtlsState:this.state,iceState:this.iceTransport.state,selectedCandidatePairId:this.iceTransport.connection.nominated?generateStatsId("candidate-pair",this.iceTransport.connection.nominated.localCandidate.foundation,this.iceTransport.connection.nominated.remoteCandidate.foundation):void 0,localCertificateId:this.localCertificate?generateStatsId("certificate","local"):void 0,remoteCertificateId:this.remoteParameters?generateStatsId("certificate","remote"):void 0,dtlsRole:"auto"===this.role?void 0:this.role};if(t.push(i),this.localCertificate){const i=this.localCertificate.getFingerprints();if(i.length>0){const r={type:"certificate",id:generateStatsId("certificate","local"),timestamp:e,fingerprint:i[0].value,fingerprintAlgorithm:i[0].algorithm,base64Certificate:Buffer.from(this.localCertificate.certPem).toString("base64")};t.push(r)}}if(this.remoteParameters&&this.remoteParameters.fingerprints.length>0){const i={type:"certificate",id:generateStatsId("certificate","remote"),timestamp:e,fingerprint:this.remoteParameters.fingerprints[0].value,fingerprintAlgorithm:this.remoteParameters.fingerprints[0].algorithm,base64Certificate:""};t.push(i)}const r=await this.iceTransport.getStats();return t.push(...r),t}};__publicField(_RTCDtlsTransport,"localCertificate"),__publicField(_RTCDtlsTransport,"localCertificatePromise");var RTCDtlsTransport2=_RTCDtlsTransport,RTCCertificate=class{constructor(e,t,i){this.certPem=t,this.signatureHash=i,__publicField(this,"publicKey"),__publicField(this,"privateKey");const r=import_x5092.Certificate.fromPEM(Buffer.from(t));this.publicKey=r.publicKey.toPEM(),this.privateKey=import_x5092.PrivateKey.fromPEM(Buffer.from(e)).toPEM()}getFingerprints(){return[new RTCDtlsFingerprint("sha-256",fingerprint(import_x5092.Certificate.fromPEM(Buffer.from(this.certPem)).raw,"sha256"))]}},RTCDtlsFingerprint=class{constructor(e,t){this.algorithm=e,this.value=t}},RTCDtlsParameters=class{constructor(e=[],t){this.fingerprints=e,this.role=t}},IceTransport=class{constructor(e){this.ice=e,__publicField(this,"closed",!1),__publicField(this,"onData",(()=>{})),__publicField(this,"type","ice"),__publicField(this,"send",(e=>this.ice.send(e))),e.onData.subscribe((e=>{isDtls(e)&&this.onData&&this.onData(e)}))}get address(){return{}}async close(){this.closed=!0,this.ice.close()}},createIceTransport=e=>new IceTransport(e),import_crypto21=require("crypto"),log31=debug2("werift:packages/webrtc/src/transport/ice.ts"),RTCIceTransport2=class{constructor(e){this.iceGather=e,__publicField(this,"id",(0,import_crypto21.randomUUID)().toString()),__publicField(this,"connection"),__publicField(this,"state","new"),__publicField(this,"waitStart"),__publicField(this,"renominating",!1),__publicField(this,"onStateChange",new Event3),__publicField(this,"onIceCandidate",new Event3),__publicField(this,"onNegotiationNeeded",new Event3),__publicField(this,"addRemoteCandidate",(e=>{if(!this.connection.remoteCandidatesEnd)return e?this.connection.addRemoteCandidate(candidateToIce(e)):this.connection.addRemoteCandidate(void 0)})),this.connection=this.iceGather.connection,this.connection.stateChanged.subscribe((e=>{this.setState(e)})),this.iceGather.onIceCandidate=e=>{this.onIceCandidate.execute(e)}}get role(){return this.connection.iceControlling?"controlling":"controlled"}get gatheringState(){return this.iceGather.gatheringState}get localCandidates(){return this.iceGather.localCandidates}get localParameters(){return this.iceGather.localParameters}setState(e){e!==this.state&&(this.state=e,this.onStateChange.execute(e))}gather(){return this.iceGather.gather()}setRemoteParams(e,t=!1){t&&(this.renominating=!0),this.connection.remoteUsername&&this.connection.remotePassword&&(this.connection.remoteUsername!==e.usernameFragment||this.connection.remotePassword!==e.password)&&(this.renominating?(log31("renomination",e),this.connection.resetNominatedPair(),this.renominating=!1):(log31("restart",e),this.restart())),this.connection.setRemoteParams(e)}restart(){this.connection.restart(),this.setState("new"),this.iceGather.gatheringState="new",this.waitStart=void 0,this.onNegotiationNeeded.execute()}async start(){if("closed"===this.state)throw new Error("RTCIceTransport is closed");if(!this.connection.remotePassword||!this.connection.remoteUsername)throw new Error("remoteParams missing");this.waitStart&&await this.waitStart.asPromise(),this.waitStart=new Event3,this.setState("checking");try{await this.connection.connect()}catch(e){throw this.setState("failed"),e}this.waitStart.execute(),this.waitStart.complete(),this.waitStart=void 0}async stop(){"closed"!==this.state&&(this.setState("closed"),await this.connection.close()),this.onStateChange.complete(),this.onIceCandidate.complete(),this.onNegotiationNeeded.complete()}async getStats(){const e=getStatsTimestamp(),t=[];for(const i of this.localCandidates){const r={type:"local-candidate",id:generateStatsId("local-candidate",i.foundation),timestamp:e,transportId:generateStatsId("transport",this.id),address:i.ip,port:i.port,protocol:i.protocol,candidateType:i.type,priority:i.priority,foundation:i.foundation};t.push(r)}for(const i of this.connection.remoteCandidates){const r=candidateFromIce(i),s={type:"remote-candidate",id:generateStatsId("remote-candidate",r.foundation),timestamp:e,transportId:generateStatsId("transport",this.id),address:r.ip,port:r.port,protocol:r.protocol,candidateType:r.type,priority:r.priority,foundation:r.foundation};t.push(s)}const i=this.connection?.candidatePairs?[...this.connection.candidatePairs.filter((e=>e.nominated)),...this.connection.candidatePairs.filter((e=>!e.nominated))]:[];for(const r of i){const i={type:"candidate-pair",id:generateStatsId("candidate-pair",r.foundation),timestamp:e,transportId:generateStatsId("transport",this.id),localCandidateId:generateStatsId("local-candidate",r.localCandidate.foundation),remoteCandidateId:generateStatsId("remote-candidate",r.remoteCandidate.foundation),state:r.state,nominated:r.nominated,packetsSent:r.packetsSent,packetsReceived:r.packetsReceived,bytesSent:r.bytesSent,bytesReceived:r.bytesReceived,currentRoundTripTime:r.rtt};t.push(i)}return t}},RTCIceGatherer2=class{constructor(e={}){this.options=e,__publicField(this,"onIceCandidate",(()=>{})),__publicField(this,"gatheringState","new"),__publicField(this,"connection"),__publicField(this,"onGatheringStateChange",new Event3),this.connection=new Connection(!1,this.options),this.connection.onIceCandidate.subscribe((e=>{this.onIceCandidate(candidateFromIce(e))}))}async gather(){"new"===this.gatheringState&&(this.setState("gathering"),await this.connection.gatherCandidates(),this.onIceCandidate(void 0),this.setState("complete"))}get localCandidates(){return this.connection.localCandidates.map(candidateFromIce)}get localParameters(){return new RTCIceParameters({usernameFragment:this.connection.localUsername,password:this.connection.localPassword})}setState(e){e!==this.gatheringState&&(this.gatheringState=e,this.onGatheringStateChange.execute(e))}};function candidateFromIce(e){const t=new IceCandidate(e.component,e.foundation,e.host,e.port,e.priority,e.transport,e.type,e.generation,e.ufrag);return t.relatedAddress=e.relatedAddress,t.relatedPort=e.relatedPort,t.tcpType=e.tcptype,t}function candidateToIce(e){return new Candidate(e.foundation,e.component,e.protocol,e.priority,e.ip,e.port,e.type,e.relatedAddress,e.relatedPort,e.tcpType,e.generation,e.ufrag)}var RTCIceCandidate=class{constructor(e){__publicField(this,"candidate"),__publicField(this,"sdpMid"),__publicField(this,"sdpMLineIndex"),__publicField(this,"usernameFragment"),Object.assign(this,e)}static fromSdp(e){return candidateFromIce(Candidate.fromSdp(e)).toJSON()}static isThis(e){if("string"==typeof e?.candidate)return!0}toJSON(){return{candidate:this.candidate,sdpMid:this.sdpMid,sdpMLineIndex:this.sdpMLineIndex,usernameFragment:this.usernameFragment}}},IceCandidate=class{constructor(e,t,i,r,s,n,a,o,c){this.component=e,this.foundation=t,this.ip=i,this.port=r,this.priority=s,this.protocol=n,this.type=a,this.generation=o,this.ufrag=c,__publicField(this,"relatedAddress"),__publicField(this,"relatedPort"),__publicField(this,"sdpMid"),__publicField(this,"sdpMLineIndex"),__publicField(this,"tcpType")}toJSON(){return new RTCIceCandidate({candidate:candidateToSdp(this),sdpMLineIndex:this.sdpMLineIndex,sdpMid:this.sdpMid,usernameFragment:this.ufrag})}static fromJSON(e){try{if(!e.candidate)throw new Error("candidate is required");const t=candidateFromSdp(e.candidate);return t.sdpMLineIndex=e.sdpMLineIndex??void 0,t.sdpMid=e.sdpMid??void 0,t}catch(e){}}},RTCIceParameters=class{constructor(e={}){__publicField(this,"iceLite",!1),__publicField(this,"usernameFragment"),__publicField(this,"password"),Object.assign(this,e)}},import_crypto23=require("crypto"),import_jspack6=__toESM(require_jspack()),import_crypto22=require("crypto"),import_jspack5=__toESM(require_jspack()),import_crc32c=__toESM(require_crc32c()),_Chunk=class e{constructor(e=0,t=Buffer.from("")){this.flags=e,this._body=t}get body(){return this._body}set body(e){this._body=e}get type(){return e.type}get bytes(){if(!this.body)throw new Error;const e=Buffer.alloc(4);e.writeUInt8(this.type,0),e.writeUInt8(this.flags,1),e.writeUInt16BE(this.body.length+4,2);return Buffer.concat([e,this.body,...[...Array(padL(this.body.length))].map((()=>Buffer.from("\0")))])}};__publicField(_Chunk,"type",-1);var Chunk=_Chunk,BaseInitChunk=class extends Chunk{constructor(e=0,t){super(e,t),this.flags=e,__publicField(this,"initiateTag"),__publicField(this,"advertisedRwnd"),__publicField(this,"outboundStreams"),__publicField(this,"inboundStreams"),__publicField(this,"initialTsn"),__publicField(this,"params"),t?(this.initiateTag=t.readUInt32BE(0),this.advertisedRwnd=t.readUInt32BE(4),this.outboundStreams=t.readUInt16BE(8),this.inboundStreams=t.readUInt16BE(10),this.initialTsn=t.readUInt32BE(12),this.params=decodeParams(t.slice(16))):(this.initiateTag=0,this.advertisedRwnd=0,this.outboundStreams=0,this.inboundStreams=0,this.initialTsn=0,this.params=[])}get body(){const e=Buffer.alloc(16);return e.writeUInt32BE(this.initiateTag,0),e.writeUInt32BE(this.advertisedRwnd,4),e.writeUInt16BE(this.outboundStreams,8),e.writeUInt16BE(this.inboundStreams,10),e.writeUInt32BE(this.initialTsn,12),Buffer.concat([e,encodeParams(this.params)])}},_InitChunk=class e extends BaseInitChunk{get type(){return e.type}};__publicField(_InitChunk,"type",1);var InitChunk=_InitChunk,_InitAckChunk=class e extends BaseInitChunk{get type(){return e.type}};__publicField(_InitAckChunk,"type",2);var InitAckChunk=_InitAckChunk,_ReConfigChunk=class e extends BaseInitChunk{get type(){return e.type}};__publicField(_ReConfigChunk,"type",130);var ReConfigChunk=_ReConfigChunk,_ForwardTsnChunk=class e extends Chunk{constructor(e=0,t){if(super(e,t),this.flags=e,__publicField(this,"streams",[]),__publicField(this,"cumulativeTsn"),t){this.cumulativeTsn=t.readUInt32BE(0);let e=4;for(;e<t.length;)this.streams.push([t.readUInt16BE(e),t.readUInt16BE(e+2)]),e+=4}else this.cumulativeTsn=0}get type(){return e.type}set body(e){}get body(){const e=Buffer.alloc(4);return e.writeUInt32BE(this.cumulativeTsn,0),Buffer.concat([e,...this.streams.map((([e,t])=>{const i=Buffer.alloc(4);return i.writeUInt16BE(e,0),i.writeUInt16BE(t,2),i}))])}};__publicField(_ForwardTsnChunk,"type",192);var ForwardTsnChunk=_ForwardTsnChunk,_DataChunk=class e extends Chunk{constructor(e=0,t){super(e,t),this.flags=e,__publicField(this,"tsn",0),__publicField(this,"streamId",0),__publicField(this,"streamSeqNum",0),__publicField(this,"protocol",0),__publicField(this,"userData",Buffer.from("")),__publicField(this,"abandoned",!1),__publicField(this,"acked",!1),__publicField(this,"misses",0),__publicField(this,"retransmit",!1),__publicField(this,"sentCount",0),__publicField(this,"bookSize",0),__publicField(this,"expiry"),__publicField(this,"maxRetransmits"),__publicField(this,"sentTime"),t&&(this.tsn=t.readUInt32BE(0),this.streamId=t.readUInt16BE(4),this.streamSeqNum=t.readUInt16BE(6),this.protocol=t.readUInt32BE(8),this.userData=t.slice(12))}get type(){return e.type}get bytes(){const e=16+this.userData.length,t=Buffer.alloc(16);t.writeUInt8(this.type,0),t.writeUInt8(this.flags,1),t.writeUInt16BE(e,2),t.writeUInt32BE(this.tsn,4),t.writeUInt16BE(this.streamId,8),t.writeUInt16BE(this.streamSeqNum,10),t.writeUInt32BE(this.protocol,12);let i=Buffer.concat([t,this.userData]);return e%4&&(i=Buffer.concat([i,...[...Array(padL(e))].map((()=>Buffer.from("\0")))])),i}};__publicField(_DataChunk,"type",0);var DataChunk=_DataChunk,_CookieEchoChunk=class e extends Chunk{get type(){return e.type}};__publicField(_CookieEchoChunk,"type",10);var CookieEchoChunk=_CookieEchoChunk,_CookieAckChunk=class e extends Chunk{get type(){return e.type}};__publicField(_CookieAckChunk,"type",11);var CookieAckChunk=_CookieAckChunk,BaseParamsChunk=class extends Chunk{constructor(e=0,t=void 0){super(e,t),this.flags=e,__publicField(this,"params",[]),t&&(this.params=decodeParams(t))}get body(){return encodeParams(this.params)}},_AbortChunk=class e extends BaseParamsChunk{get type(){return e.type}};__publicField(_AbortChunk,"type",6);var AbortChunk=_AbortChunk,_ErrorChunk=class e extends BaseParamsChunk{get type(){return e.type}get descriptions(){return this.params.map((([t,i])=>({name:(Object.entries(e.CODE).find((([,e])=>e===t))||[])[0],body:i})))}};__publicField(_ErrorChunk,"type",9),__publicField(_ErrorChunk,"CODE",{InvalidStreamIdentifier:1,MissingMandatoryParameter:2,StaleCookieError:3,OutofResource:4,UnresolvableAddress:5,UnrecognizedChunkType:6,InvalidMandatoryParameter:7,UnrecognizedParameters:8,NoUserData:9,CookieReceivedWhileShuttingDown:10,RestartofanAssociationwithNewAddresses:11,UserInitiatedAbort:12,ProtocolViolation:13});var ErrorChunk=_ErrorChunk,_HeartbeatChunk=class e extends BaseParamsChunk{get type(){return e.type}};__publicField(_HeartbeatChunk,"type",4);var HeartbeatChunk=_HeartbeatChunk,_HeartbeatAckChunk=class e extends BaseParamsChunk{get type(){return e.type}};__publicField(_HeartbeatAckChunk,"type",5);var HeartbeatAckChunk=_HeartbeatAckChunk,_ReconfigChunk=class e extends BaseParamsChunk{get type(){return e.type}};__publicField(_ReconfigChunk,"type",130);var ReconfigChunk=_ReconfigChunk,_SackChunk=class e extends Chunk{constructor(e=0,t){if(super(e,t),this.flags=e,__publicField(this,"gaps",[]),__publicField(this,"duplicates",[]),__publicField(this,"cumulativeTsn",0),__publicField(this,"advertisedRwnd",0),t){this.cumulativeTsn=t.readUInt32BE(0),this.advertisedRwnd=t.readUInt32BE(4);const e=t.readUInt16BE(8),i=t.readUInt16BE(10);let r=12;[...Array(e)].forEach((()=>{this.gaps.push([t.readUInt16BE(r),t.readUInt16BE(r+2)]),r+=4})),[...Array(i)].forEach((()=>{this.duplicates.push(t.readUInt32BE(r)),r+=4}))}}get type(){return e.type}get bytes(){const e=16+4*(this.gaps.length+this.duplicates.length),t=Buffer.alloc(16);t.writeUInt8(this.type,0),t.writeUInt8(this.flags,1),t.writeUInt16BE(e,2),t.writeUInt32BE(this.cumulativeTsn,4),t.writeUInt32BE(this.advertisedRwnd,8),t.writeUInt16BE(this.gaps.length,12),t.writeUInt16BE(this.duplicates.length,14);let i=Buffer.concat([t,...this.gaps.map((e=>{const t=Buffer.alloc(4);return t.writeUInt16BE(e[0],0),t.writeUInt16BE(e[1],2),t}))]);return i=Buffer.concat([i,...this.duplicates.map((e=>{const t=Buffer.alloc(4);return t.writeUInt32BE(e,0),t}))]),i}};__publicField(_SackChunk,"type",3);var SackChunk=_SackChunk,_ShutdownChunk=class e extends Chunk{constructor(e=0,t){super(e,t),this.flags=e,__publicField(this,"cumulativeTsn",0),t&&(this.cumulativeTsn=t.readUInt32BE(0))}get type(){return e.type}get body(){const e=Buffer.alloc(4);return e.writeUInt32BE(this.cumulativeTsn,0),e}};__publicField(_ShutdownChunk,"type",7);var ShutdownChunk=_ShutdownChunk,_ShutdownAckChunk=class e extends Chunk{get type(){return e.type}};__publicField(_ShutdownAckChunk,"type",8);var ShutdownAckChunk=_ShutdownAckChunk,_ShutdownCompleteChunk=class e extends Chunk{get type(){return e.type}};__publicField(_ShutdownCompleteChunk,"type",14);var ShutdownCompleteChunk=_ShutdownCompleteChunk,CHUNK_CLASSES=[DataChunk,InitChunk,InitAckChunk,SackChunk,HeartbeatChunk,HeartbeatAckChunk,AbortChunk,ShutdownChunk,ShutdownAckChunk,ErrorChunk,CookieEchoChunk,CookieAckChunk,ShutdownCompleteChunk,ReconfigChunk,ForwardTsnChunk],CHUNK_BY_TYPE=CHUNK_CLASSES.reduce(((e,t)=>(e[t.type]=t,e)),{});function padL(e){const t=e%4;return t?4-t:0}function encodeParams(e){let t=Buffer.from(""),i=Buffer.from("");return e.forEach((([e,r])=>{const s=r.length+4,n=Buffer.alloc(4);n.writeUInt16BE(e,0),n.writeUInt16BE(s,2),t=Buffer.concat([t,i,n,r]),i=Buffer.concat([...Array(padL(s))].map((()=>Buffer.from("\0"))))})),t}function decodeParams(e){const t=[];let i=0;for(;i<=e.length-4;){const r=e.readUInt16BE(i),s=e.readUInt16BE(i+2);t.push([r,e.slice(i+4,i+s)]),i+=s+padL(s)}return t}function parsePacket2(e){if(e.length<12)throw new Error("SCTP packet length is less than 12 bytes");const t=e.readUInt16BE(0),i=e.readUInt16BE(2),r=e.readUInt32BE(4);if(e.readUInt32LE(8)!==(0,import_crc32c.default)(Buffer.concat([e.slice(0,8),Buffer.from("\0\0\0\0"),e.slice(12)])))throw new Error("SCTP packet has invalid checksum");const s=[];let n=12;for(;n+4<=e.length;){const t=e.readUInt8(n),i=e.readUInt8(n+1),r=e.readUInt16BE(n+2),a=e.slice(n+4,n+r),o=CHUNK_BY_TYPE[t.toString()];if(!o)throw new Error("unknown");s.push(new o(i,a)),n+=r+padL(r)}return[t,i,r,s]}function serializePacket(e,t,i,r){const s=Buffer.alloc(8);s.writeUInt16BE(e,0),s.writeUInt16BE(t,2),s.writeUInt32BE(i,4);const n=r.bytes,a=(0,import_crc32c.default)(Buffer.concat([s,Buffer.from("\0\0\0\0"),n])),o=Buffer.alloc(4);o.writeUInt32LE(a,0);return Buffer.concat([s,o,n])}function enumerate3(e){return e.map(((e,t)=>[t,e]))}function createEventsFromList(e){return e.reduce(((e,t)=>(e[t]=new Event3,e)),{})}var import_jspack4=__toESM(require_jspack()),_OutgoingSSNResetRequestParam=class e{constructor(e,t,i,r){this.requestSequence=e,this.responseSequence=t,this.lastTsn=i,this.streams=r}get type(){return e.type}get bytes(){const e=Buffer.from(import_jspack4.jspack.Pack("!LLL",[this.requestSequence,this.responseSequence,this.lastTsn]));return Buffer.concat([e,...this.streams.map((e=>Buffer.from(import_jspack4.jspack.Pack("!H",[e]))))])}static parse(t){const[i,r,s]=import_jspack4.jspack.Unpack("!LLL",t),n=[];for(let e=12;e<t.length;e+=2)n.push(import_jspack4.jspack.Unpack("!H",t.slice(e))[0]);return new e(i,r,s,n)}};__publicField(_OutgoingSSNResetRequestParam,"type",13);var OutgoingSSNResetRequestParam=_OutgoingSSNResetRequestParam,_StreamAddOutgoingParam=class e{constructor(e,t){this.requestSequence=e,this.newStreams=t}get type(){return e.type}get bytes(){return Buffer.from(import_jspack4.jspack.Pack("!LHH",[this.requestSequence,this.newStreams,0]))}static parse(t){const[i,r]=import_jspack4.jspack.Unpack("!LHH",t);return new e(i,r)}};__publicField(_StreamAddOutgoingParam,"type",17);var StreamAddOutgoingParam=_StreamAddOutgoingParam,reconfigResult={ReconfigResultSuccessPerformed:1,BadSequenceNumber:5},_ReconfigResponseParam=class e{constructor(e,t){this.responseSequence=e,this.result=t}get type(){return e.type}get bytes(){return Buffer.from(import_jspack4.jspack.Pack("!LL",[this.responseSequence,this.result]))}static parse(t){const[i,r]=import_jspack4.jspack.Unpack("!LL",t);return new e(i,r)}};__publicField(_ReconfigResponseParam,"type",16);var ReconfigResponseParam=_ReconfigResponseParam,RECONFIG_PARAM_BY_TYPES={13:OutgoingSSNResetRequestParam,16:ReconfigResponseParam,17:StreamAddOutgoingParam},log32=debug2("werift/sctp/sctp"),COOKIE_LENGTH=24,COOKIE_LIFETIME=60,MAX_STREAMS=65535,USERDATA_MAX_LENGTH=1200,SCTP_DATA_LAST_FRAG=1,SCTP_DATA_FIRST_FRAG=2,SCTP_DATA_UNORDERED=4,SCTP_MAX_ASSOCIATION_RETRANS=10,SCTP_MAX_INIT_RETRANS=8,SCTP_RTO_ALPHA=1/8,SCTP_RTO_BETA=1/4,SCTP_RTO_INITIAL=3,SCTP_RTO_MIN=1,SCTP_RTO_MAX=60,SCTP_TSN_MODULO=2**32,RECONFIG_MAX_STREAMS=135,SCTP_STATE_COOKIE=7,SCTP_SUPPORTED_CHUNK_EXT=32776,SCTP_PRSCTP_SUPPORTED=49152,SCTPConnectionStates=["new","closed","connected","connecting"],SCTP=class e{constructor(e,t=5e3){this.transport=e,this.port=t,__publicField(this,"flush",new Event3),__publicField(this,"stateChanged",createEventsFromList(SCTPConnectionStates)),__publicField(this,"onReconfigStreams",new Event3),__publicField(this,"onReceive",new Event3),__publicField(this,"onSackReceived",(async()=>{})),__publicField(this,"associationState",1),__publicField(this,"started",!1),__publicField(this,"state","new"),__publicField(this,"isServer",!0),__publicField(this,"hmacKey",(0,import_crypto22.randomBytes)(16)),__publicField(this,"localPartialReliability",!0),__publicField(this,"localPort"),__publicField(this,"localVerificationTag",random32()),__publicField(this,"remoteExtensions",[]),__publicField(this,"remotePartialReliability",!0),__publicField(this,"remotePort"),__publicField(this,"remoteVerificationTag",0),__publicField(this,"advertisedRwnd",1048576),__publicField(this,"inboundStreams",{}),__publicField(this,"_inboundStreamsCount",0),__publicField(this,"_inboundStreamsMax",MAX_STREAMS),__publicField(this,"lastReceivedTsn"),__publicField(this,"sackDuplicates",[]),__publicField(this,"sackMisOrdered",new Set),__publicField(this,"sackNeeded",!1),__publicField(this,"sackTimeout"),__publicField(this,"cwnd",3*USERDATA_MAX_LENGTH),__publicField(this,"fastRecoveryExit"),__publicField(this,"fastRecoveryTransmit",!1),__publicField(this,"forwardTsnChunk"),__publicField(this,"flightSize",0),__publicField(this,"outboundQueue",[]),__publicField(this,"outboundStreamSeq",{}),__publicField(this,"_outboundStreamsCount",MAX_STREAMS),__publicField(this,"localTsn",Number(random32())),__publicField(this,"lastSackedTsn",tsnMinusOne(this.localTsn)),__publicField(this,"advancedPeerAckTsn",tsnMinusOne(this.localTsn)),__publicField(this,"partialBytesAcked",0),__publicField(this,"sentQueue",[]),__publicField(this,"reconfigRequestSeq",this.localTsn),__publicField(this,"reconfigResponseSeq",0),__publicField(this,"reconfigRequest"),__publicField(this,"reconfigQueue",[]),__publicField(this,"srtt"),__publicField(this,"rttvar"),__publicField(this,"rto",SCTP_RTO_INITIAL),__publicField(this,"timer1Handle"),__publicField(this,"timer1Chunk"),__publicField(this,"timer1Failures",0),__publicField(this,"timer2Handle"),__publicField(this,"timer2Chunk"),__publicField(this,"timer2Failures",0),__publicField(this,"timer3Handle"),__publicField(this,"timerReconfigHandle"),__publicField(this,"timerReconfigFailures",0),__publicField(this,"ssthresh"),__publicField(this,"send",(async(e,t,i,{expiry:r,maxRetransmits:s,ordered:n}={expiry:void 0,maxRetransmits:void 0,ordered:!0})=>{const a=n&&this.outboundStreamSeq[e]||0,o=Math.ceil(i.length/USERDATA_MAX_LENGTH);let c=0;const l=[];for(let u=0;u<o;u++){const d=new DataChunk(0,void 0);d.flags=0,n||(d.flags=SCTP_DATA_UNORDERED),0===u&&(d.flags|=SCTP_DATA_FIRST_FRAG),u===o-1&&(d.flags|=SCTP_DATA_LAST_FRAG),d.tsn=this.localTsn,d.streamId=e,d.streamSeqNum=a,d.protocol=t,d.userData=i.slice(c,c+USERDATA_MAX_LENGTH),d.bookSize=d.userData.length,d.expiry=r,d.maxRetransmits=s,c+=USERDATA_MAX_LENGTH,this.localTsn=tsnPlusOne(this.localTsn),l.push(d)}l.forEach((e=>{this.outboundQueue.push(e)})),n&&(this.outboundStreamSeq[e]=uint16Add(a,1)),this.timer3Handle?this.outboundQueue.length?await this.flush.asPromise():await new Promise((e=>setImmediate(e))):await this.transmit()})),__publicField(this,"timer1Expired",(()=>{this.timer1Failures++,this.timer1Handle=void 0,this.timer1Failures>SCTP_MAX_INIT_RETRANS?this.setState(1):(setImmediate((()=>{this.sendChunk(this.timer1Chunk).catch((e=>{log32("send timer1 chunk failed",e.message)}))})),this.timer1Handle=setTimeout(this.timer1Expired,1e3*this.rto))})),__publicField(this,"timer2Expired",(()=>{this.timer2Failures++,this.timer2Handle=void 0,this.timer2Failures>SCTP_MAX_ASSOCIATION_RETRANS?this.setState(1):(setImmediate((()=>{this.sendChunk(this.timer2Chunk).catch((e=>{log32("send timer2Chunk failed",e.message)}))})),this.timer2Handle=setTimeout(this.timer2Expired,1e3*this.rto))})),__publicField(this,"timer3Expired",(()=>{this.timer3Handle=void 0,this.sentQueue.forEach((e=>{this.maybeAbandon(e)||(e.retransmit=!0)})),this.updateAdvancedPeerAckPoint(),this.fastRecoveryExit=void 0,this.flightSize=0,this.partialBytesAcked=0,this.ssthresh=Math.max(Math.floor(this.cwnd/2),4*USERDATA_MAX_LENGTH),this.cwnd=USERDATA_MAX_LENGTH,this.transmit()})),__publicField(this,"timerReconfigHandleExpired",(async()=>{this.timerReconfigFailures++,this.rto=Math.ceil(1.5*this.rto),this.timerReconfigFailures>SCTP_MAX_ASSOCIATION_RETRANS?(log32("timerReconfigFailures",this.timerReconfigFailures),this.setState(1),this.timerReconfigHandle=void 0):this.reconfigRequest&&(log32("timerReconfigHandleExpired",this.timerReconfigFailures,this.rto),await this.sendReconfigParam(this.reconfigRequest),this.timerReconfigHandle=setTimeout(this.timerReconfigHandleExpired,1e3*this.rto))})),this.localPort=this.port,this.transport.onData=e=>{this.handleData(e)}}get maxChannels(){if(this._inboundStreamsCount>0)return Math.min(this._inboundStreamsCount,this._outboundStreamsCount)}static client(t,i=5e3){const r=new e(t,i);return r.isServer=!1,r}static server(t,i=5e3){const r=new e(t,i);return r.isServer=!0,r}async handleData(e){let t;const[,,i,r]=parsePacket2(e);if(r.filter((e=>e.type===InitChunk.type)).length>0){if(1!=r.length)throw new Error;t=0}else t=this.localVerificationTag;if(i===t){for(const e of r)await this.receiveChunk(e);this.sackNeeded&&await this.sendSack()}}async sendSack(){if(this.sackTimeout)return;if(await new Promise((e=>this.sackTimeout=setImmediate(e))),this.sackTimeout=void 0,!this.sackNeeded)return;const e=[];let t;[...this.sackMisOrdered].sort().forEach((i=>{const r=(i-this.lastReceivedTsn)%SCTP_TSN_MODULO;i===t?e[e.length-1][1]=r:e.push([r,r]),t=tsnPlusOne(i)}));const i=new SackChunk(0,void 0);i.cumulativeTsn=this.lastReceivedTsn,i.advertisedRwnd=Math.max(0,this.advertisedRwnd),i.duplicates=[...this.sackDuplicates],i.gaps=e,await this.sendChunk(i).catch((e=>{log32("send sack failed",e.message)})),this.sackDuplicates=[],this.sackNeeded=!1}async receiveChunk(e){switch(e.type){case DataChunk.type:this.receiveDataChunk(e);break;case InitChunk.type:{if(!this.isServer)return;const t=e;log32("receive init",t),this.lastReceivedTsn=tsnMinusOne(t.initialTsn),this.reconfigResponseSeq=tsnMinusOne(t.initialTsn),this.remoteVerificationTag=t.initiateTag,this.ssthresh=t.advertisedRwnd,this.getExtensions(t.params),this._inboundStreamsCount=Math.min(t.outboundStreams,this._inboundStreamsMax),this._outboundStreamsCount=Math.min(this._outboundStreamsCount,t.inboundStreams);const i=new InitAckChunk;i.initiateTag=this.localVerificationTag,i.advertisedRwnd=this.advertisedRwnd,i.outboundStreams=this._outboundStreamsCount,i.inboundStreams=this._inboundStreamsCount,i.initialTsn=this.localTsn,this.setExtensions(i.params);const r=Date.now()/1e3;let s=Buffer.from(import_jspack5.jspack.Pack("!L",[r]));s=Buffer.concat([s,(0,import_crypto22.createHmac)("sha1",this.hmacKey).update(s).digest()]),i.params.push([SCTP_STATE_COOKIE,s]),log32("send initAck",i),await this.sendChunk(i).catch((e=>{log32("send initAck failed",e.message)}))}break;case InitAckChunk.type:{if(2!=this.associationState)return;const t=e;this.timer1Cancel(),this.lastReceivedTsn=tsnMinusOne(t.initialTsn),this.reconfigResponseSeq=tsnMinusOne(t.initialTsn),this.remoteVerificationTag=t.initiateTag,this.ssthresh=t.advertisedRwnd,this.getExtensions(t.params),this._inboundStreamsCount=Math.min(t.outboundStreams,this._inboundStreamsMax),this._outboundStreamsCount=Math.min(this._outboundStreamsCount,t.inboundStreams);const i=new CookieEchoChunk;for(const[e,r]of t.params)if(e===SCTP_STATE_COOKIE){i.body=r;break}await this.sendChunk(i).catch((e=>{log32("send echo failed",e.message)})),this.timer1Start(i),this.setState(3)}break;case SackChunk.type:await this.receiveSackChunk(e);break;case HeartbeatChunk.type:{const t=new HeartbeatAckChunk;t.params=e.params,await this.sendChunk(t).catch((e=>{log32("send heartbeat ack failed",e.message)}))}break;case AbortChunk.type:this.setState(1);break;case ShutdownChunk.type:{this.timer2Cancel(),this.setState(7);const e=new ShutdownAckChunk;await this.sendChunk(e).catch((e=>{log32("send shutdown ack failed",e.message)})),this.t2Start(e),this.setState(6)}break;case ErrorChunk.type:log32("ErrorChunk",e.descriptions);break;case CookieEchoChunk.type:{if(!this.isServer)return;const t=e.body,i=(0,import_crypto22.createHmac)("sha1",this.hmacKey).update(t.slice(0,4)).digest();if(t?.length!=COOKIE_LENGTH||!t.slice(4).equals(i))return void log32("x State cookie is invalid");const r=Date.now()/1e3,s=import_jspack5.jspack.Unpack("!L",t)[0];if(s<r-COOKIE_LIFETIME||s>r){const e=new ErrorChunk(0,void 0);return e.params.push([ErrorChunk.CODE.StaleCookieError,Buffer.concat([...Array(8)].map((()=>Buffer.from("\0"))))]),void await this.sendChunk(e).catch((e=>{log32("send errorChunk failed",e.message)}))}const n=new CookieAckChunk;await this.sendChunk(n).catch((e=>{log32("send cookieAck failed",e.message)})),this.setState(4)}break;case CookieAckChunk.type:if(3!=this.associationState)return;this.timer1Cancel(),this.setState(4);break;case ShutdownCompleteChunk.type:if(8!=this.associationState)return;this.timer2Cancel(),this.setState(1);break;case ReconfigChunk.type:{if(4!=this.associationState)return;const t=e;for(const[e,i]of t.params){const t=RECONFIG_PARAM_BY_TYPES[e];t&&await this.receiveReconfigParam(t.parse(i))}}break;case ForwardTsnChunk.type:this.receiveForwardTsnChunk(e)}}getExtensions(e){for(const[t,i]of e)t===SCTP_PRSCTP_SUPPORTED?this.remotePartialReliability=!0:t===SCTP_SUPPORTED_CHUNK_EXT&&(this.remoteExtensions=[...i])}async receiveReconfigParam(e){switch(log32("receiveReconfigParam",RECONFIG_PARAM_BY_TYPES[e.type]),e.type){case OutgoingSSNResetRequestParam.type:{const t=e,i=new ReconfigResponseParam(t.requestSequence,reconfigResult.ReconfigResultSuccessPerformed);this.reconfigResponseSeq=t.requestSequence,await this.sendReconfigParam(i),await Promise.all(t.streams.map((async e=>{delete this.inboundStreams[e],this.outboundStreamSeq[e]&&(this.reconfigQueue.includes(e)||this.reconfigQueue.push(e))}))),await this.transmitReconfigRequest(),this.onReconfigStreams.execute(t.streams)}break;case ReconfigResponseParam.type:{const t=e;if(t.result!==reconfigResult.ReconfigResultSuccessPerformed)log32("OutgoingSSNResetRequestParam failed",Object.keys(reconfigResult).find((e=>reconfigResult[e]===t.result)));else if(t.responseSequence===this.reconfigRequest?.requestSequence){const e=this.reconfigRequest.streams.map((e=>(delete this.outboundStreamSeq[e],e)));this.onReconfigStreams.execute(e),this.reconfigRequest=void 0,this.timerReconfigCancel(),this.rto=SCTP_RTO_INITIAL,this.timerReconfigFailures=0,this.reconfigQueue.length>0&&await this.transmitReconfigRequest()}}break;case StreamAddOutgoingParam.type:{const t=e;this._inboundStreamsCount+=t.newStreams;const i=new ReconfigResponseParam(t.requestSequence,1);this.reconfigResponseSeq=t.requestSequence,await this.sendReconfigParam(i)}}}receiveDataChunk(e){if(this.sackNeeded=!0,this.markReceived(e.tsn))return;const t=this.getInboundStream(e.streamId);t.addChunk(e),this.advertisedRwnd-=e.userData.length;for(const e of t.popMessages())this.advertisedRwnd+=e[2].length,this.receive(...e)}async receiveSackChunk(e){if(uint32Gt(this.lastSackedTsn,e.cumulativeTsn))return;const t=Date.now()/1e3;this.lastSackedTsn=e.cumulativeTsn;const i=this.flightSize>=this.cwnd;let r=0,s=0;for(;this.sentQueue.length>0&&uint32Gte(this.lastSackedTsn,this.sentQueue[0].tsn);){const e=this.sentQueue.shift();r++,e?.acked||(s+=e.bookSize,this.flightSizeDecrease(e)),1===r&&1===e.sentCount&&this.updateRto(t-e.sentTime)}this.sentQueue.length||(this.sentQueue=[]);let n=!1;if(e.gaps.length>0){const t=new Set;let i;e.gaps.forEach((r=>{for(let s=r[0];s<r[1]+1;s++)i=(e.cumulativeTsn+s)%SCTP_TSN_MODULO,t.add(i)}));let r=e.cumulativeTsn;for(const e of this.sentQueue){if(uint32Gt(e.tsn,i))break;t.has(e.tsn)&&!e.acked&&(s+=e.bookSize,e.acked=!0,this.flightSizeDecrease(e),r=e.tsn)}for(const e of this.sentQueue){if(uint32Gt(e.tsn,r))break;t.has(e.tsn)||(e.misses++,3===e.misses&&(e.misses=0,this.maybeAbandon(e)||(e.retransmit=!0),e.acked=!1,this.flightSizeDecrease(e),n=!0))}}void 0===this.fastRecoveryExit?(r&&i&&(this.cwnd<=this.ssthresh?this.cwnd+=Math.min(s,USERDATA_MAX_LENGTH):(this.partialBytesAcked+=s,this.partialBytesAcked>=this.cwnd&&(this.partialBytesAcked-=this.cwnd,this.cwnd+=USERDATA_MAX_LENGTH))),n&&(this.ssthresh=Math.max(Math.floor(this.cwnd/2),4*USERDATA_MAX_LENGTH),this.cwnd=this.ssthresh,this.partialBytesAcked=0,this.fastRecoveryExit=this.sentQueue[this.sentQueue.length-1].tsn,this.fastRecoveryTransmit=!0)):uint32Gte(e.cumulativeTsn,this.fastRecoveryExit)&&(this.fastRecoveryExit=void 0),0===this.sentQueue.length?this.timer3Cancel():r>0&&this.timer3Restart(),this.updateAdvancedPeerAckPoint(),await this.onSackReceived(),await this.transmit()}receiveForwardTsnChunk(e){if(this.sackNeeded=!0,uint32Gte(this.lastReceivedTsn,e.cumulativeTsn))return;const t=e=>uint32Gt(e,this.lastReceivedTsn);this.lastReceivedTsn=e.cumulativeTsn,this.sackMisOrdered=new Set([...this.sackMisOrdered].filter(t));for(const e of[...this.sackMisOrdered].sort()){if(e!==tsnPlusOne(this.lastReceivedTsn))break;this.lastReceivedTsn=e}this.sackDuplicates=this.sackDuplicates.filter(t),this.sackMisOrdered=new Set([...this.sackMisOrdered].filter(t));for(const[t,i]of e.streams){const e=this.getInboundStream(t);e.streamSequenceNumber=uint16Add(i,1);for(const t of e.popMessages())this.advertisedRwnd+=t[2].length,this.receive(...t)}Object.values(this.inboundStreams).forEach((e=>{this.advertisedRwnd+=e.pruneChunks(this.lastReceivedTsn)}))}updateRto(e){this.srtt?(this.rttvar=(1-SCTP_RTO_BETA)*this.rttvar+SCTP_RTO_BETA*Math.abs(this.srtt-e),this.srtt=(1-SCTP_RTO_ALPHA)*this.srtt+SCTP_RTO_ALPHA*e):(this.rttvar=e/2,this.srtt=e),this.rto=Math.max(SCTP_RTO_MIN,Math.min(this.srtt+4*this.rttvar,SCTP_RTO_MAX))}receive(e,t,i){this.onReceive.execute(e,t,i)}getInboundStream(e){return this.inboundStreams[e]||(this.inboundStreams[e]=new InboundStream),this.inboundStreams[e]}markReceived(e){if(uint32Gte(this.lastReceivedTsn,e)||this.sackMisOrdered.has(e))return this.sackDuplicates.push(e),!0;this.sackMisOrdered.add(e);for(const e of[...this.sackMisOrdered].sort()){if(e!==tsnPlusOne(this.lastReceivedTsn))break;this.lastReceivedTsn=e}const t=e=>uint32Gt(e,this.lastReceivedTsn);return this.sackDuplicates=this.sackDuplicates.filter(t),this.sackMisOrdered=new Set([...this.sackMisOrdered].filter(t)),!1}async transmit(){this.forwardTsnChunk&&(await this.sendChunk(this.forwardTsnChunk).catch((e=>{log32("send forwardTsn failed",e.message)})),this.forwardTsnChunk=void 0,this.timer3Handle||this.timer3Start());const e=null!=this.fastRecoveryExit?2*USERDATA_MAX_LENGTH:4*USERDATA_MAX_LENGTH,t=Math.min(this.flightSize+e,this.cwnd);let i=!0;for(const e of this.sentQueue){if(e.retransmit){if(this.fastRecoveryTransmit)this.fastRecoveryTransmit=!1;else if(this.flightSize>=t)return;this.flightSizeIncrease(e),e.misses=0,e.retransmit=!1,e.sentCount++,await this.sendChunk(e).catch((e=>{log32("send data failed",e.message)})),i&&this.timer3Restart()}i=!1}for(;this.outboundQueue.length>0;){const e=this.outboundQueue.shift();if(!e)return;this.sentQueue.push(e),this.flightSizeIncrease(e),e.sentCount++,e.sentTime=Date.now()/1e3,await this.sendChunk(e).catch((e=>{log32("send data outboundQueue failed",e.message)})),this.timer3Handle||this.timer3Start()}this.outboundQueue=[],this.flush.execute()}async transmitReconfigRequest(){if(this.reconfigQueue.length>0&&4===this.associationState&&!this.reconfigRequest){const e=[...new Set(this.reconfigQueue)],t=e.slice(0,RECONFIG_MAX_STREAMS);this.reconfigQueue=e.slice(RECONFIG_MAX_STREAMS);const i=new OutgoingSSNResetRequestParam(this.reconfigRequestSeq,this.reconfigResponseSeq,tsnMinusOne(this.localTsn),t);this.reconfigRequestSeq=tsnPlusOne(this.reconfigRequestSeq),this.reconfigRequest=i,await this.sendReconfigParam(i),this.timerReconfigHandleStart()}}async sendReconfigParam(e){log32("sendReconfigParam",e);const t=new ReconfigChunk;t.params.push([e.type,e.bytes]),await this.sendChunk(t).catch((e=>{log32("send reconfig failed",e.message)}))}async sendResetRequest(e){log32("sendResetRequest",e);const t=new DataChunk(0,void 0);t.streamId=e,this.outboundQueue.push(t),this.timer3Handle||await this.transmit()}flightSizeIncrease(e){this.flightSize+=e.bookSize}flightSizeDecrease(e){this.flightSize=Math.max(0,this.flightSize-e.bookSize)}timer1Start(e){if(this.timer1Handle)throw new Error;this.timer1Chunk=e,this.timer1Failures=0,this.timer1Handle=setTimeout(this.timer1Expired,1e3*this.rto)}timer1Cancel(){this.timer1Handle&&(clearTimeout(this.timer1Handle),this.timer1Handle=void 0,this.timer1Chunk=void 0)}t2Start(e){if(this.timer2Handle)throw new Error;this.timer2Chunk=e,this.timer2Failures=0,this.timer2Handle=setTimeout(this.timer2Expired,1e3*this.rto)}timer2Cancel(){this.timer2Handle&&(clearTimeout(this.timer2Handle),this.timer2Handle=void 0,this.timer2Chunk=void 0)}timer3Start(){if(this.timer3Handle)throw new Error;this.timer3Handle=setTimeout(this.timer3Expired,1e3*this.rto)}timer3Restart(){this.timer3Cancel(),this.timer3Handle=setTimeout(this.timer3Expired,this.rto)}timer3Cancel(){this.timer3Handle&&(clearTimeout(this.timer3Handle),this.timer3Handle=void 0)}timerReconfigHandleStart(){this.timerReconfigHandle||(log32("timerReconfigHandleStart",{rto:this.rto}),this.timerReconfigFailures=0,this.timerReconfigHandle=setTimeout(this.timerReconfigHandleExpired,1e3*this.rto))}timerReconfigCancel(){this.timerReconfigHandle&&(log32("timerReconfigCancel"),clearTimeout(this.timerReconfigHandle),this.timerReconfigHandle=void 0,this.timerReconfigFailures=0)}updateAdvancedPeerAckPoint(){uint32Gt(this.lastSackedTsn,this.advancedPeerAckTsn)&&(this.advancedPeerAckTsn=this.lastSackedTsn);let e=0;const t={};for(;this.sentQueue.length>0&&this.sentQueue[0].abandoned;){const i=this.sentQueue.shift();this.advancedPeerAckTsn=i.tsn,e++,i.flags&SCTP_DATA_UNORDERED||(t[i.streamId]=i.streamSeqNum)}this.sentQueue.length||(this.sentQueue=[]),e&&(this.forwardTsnChunk=new ForwardTsnChunk(0,void 0),this.forwardTsnChunk.cumulativeTsn=this.advancedPeerAckTsn,this.forwardTsnChunk.streams=Object.entries(t).map((([e,t])=>[Number(e),t])))}maybeAbandon(e){if(e.abandoned)return!0;if(!(!!e.maxRetransmits&&e.maxRetransmits<e.sentCount||!!e.expiry&&e.expiry<Date.now()/1e3))return!1;const t=this.sentQueue.findIndex((t=>t.type===e.type));for(let e=t;e>=0;e--){const t=this.sentQueue[e];if(t.abandoned=!0,t.retransmit=!1,t.flags&SCTP_DATA_LAST_FRAG)break}for(let e=t;e<this.sentQueue.length;e++){const t=this.sentQueue[e];if(t.abandoned=!0,t.retransmit=!1,t.flags&SCTP_DATA_LAST_FRAG)break}return!0}static getCapabilities(){return new RTCSctpCapabilities(65536)}setRemotePort(e){this.remotePort=e}async start(e){this.started||(this.started=!0,this.setConnectionState("connecting"),e&&this.setRemotePort(e),this.isServer||await this.init())}async init(){const e=new InitChunk;e.initiateTag=this.localVerificationTag,e.advertisedRwnd=this.advertisedRwnd,e.outboundStreams=this._outboundStreamsCount,e.inboundStreams=this._inboundStreamsMax,e.initialTsn=this.localTsn,this.setExtensions(e.params),log32("send init",e);try{await this.sendChunk(e),this.timer1Start(e),this.setState(2)}catch(e){log32("send init failed",e.message)}}setExtensions(e){const t=[];this.localPartialReliability&&(e.push([SCTP_PRSCTP_SUPPORTED,Buffer.from("")]),t.push(ForwardTsnChunk.type)),t.push(ReConfigChunk.type),e.push([SCTP_SUPPORTED_CHUNK_EXT,Buffer.from(t)])}async sendChunk(e){if("closed"===this.state)return;if(void 0===this.remotePort)throw new Error("invalid remote port");const t=serializePacket(this.localPort,this.remotePort,this.remoteVerificationTag,e);await this.transport.send(t)}setState(e){e!=this.associationState&&(this.associationState=e),4===e?this.setConnectionState("connected"):1===e&&(this.timer1Cancel(),this.timer2Cancel(),this.timer3Cancel(),this.timerReconfigCancel(),this.setConnectionState("closed"),this.removeAllListeners())}setConnectionState(e){this.state=e,log32("setConnectionState",e),this.stateChanged[e].execute()}async stop(){1!==this.associationState&&await this.abort(),this.setState(1),clearTimeout(this.timer1Handle),clearTimeout(this.timer2Handle),clearTimeout(this.timer3Handle),clearTimeout(this.timerReconfigHandle)}async abort(){const e=new AbortChunk;await this.sendChunk(e).catch((e=>{log32("send abort failed",e.message)}))}removeAllListeners(){Object.values(this.stateChanged).forEach((e=>e.allUnsubscribe()))}},InboundStream=class{constructor(){__publicField(this,"reassembly",[]),__publicField(this,"streamSequenceNumber",0)}addChunk(e){if(0===this.reassembly.length||uint32Gt(e.tsn,this.reassembly[this.reassembly.length-1].tsn))this.reassembly.push(e);else for(const[t,i]of enumerate3(this.reassembly)){if(i.tsn===e.tsn)throw new Error("duplicate chunk in reassembly");if(uint32Gt(i.tsn,e.tsn)){this.reassembly.splice(t,0,e);break}}}*popMessages(){let e,t,i,r=0;for(;r<this.reassembly.length;){const s=this.reassembly[r];if(void 0===e){if(i=!(s.flags&SCTP_DATA_UNORDERED),!(s.flags&SCTP_DATA_FIRST_FRAG)){if(i)break;r++;continue}if(i&&uint16Gt(s.streamSeqNum,this.streamSequenceNumber))break;t=s.tsn,e=r}else if(s.tsn!==t){if(i)break;e=void 0,r++;continue}if(s.flags&SCTP_DATA_LAST_FRAG){const t=this.reassembly.slice(e,r+1).map((e=>e.userData)).reduce(((e,t)=>(e.push(t),e.push(Buffer.from("")),e)),[]);t.pop();const n=Buffer.concat(t);this.reassembly=[...this.reassembly.slice(0,e),...this.reassembly.slice(r+1)],i&&s.streamSeqNum===this.streamSequenceNumber&&(this.streamSequenceNumber=uint16Add(this.streamSequenceNumber,1)),r=e,yield[s.streamId,s.protocol,n]}else r++;t=tsnPlusOne(t)}}pruneChunks(e){let t=-1,i=0;for(const[r,s]of this.reassembly.entries()){if(!uint32Gte(e,s.tsn))break;t=r,i+=s.userData.length}return this.reassembly=this.reassembly.slice(t+1),i}},RTCSctpCapabilities=class{constructor(e){this.maxMessageSize=e}};function tsnMinusOne(e){return(e-1)%SCTP_TSN_MODULO}function tsnPlusOne(e){return(e+1)%SCTP_TSN_MODULO}var log33=debug2("werift:packages/webrtc/src/transport/sctp.ts"),RTCSctpTransport=class{constructor(e=5e3){this.port=e,__publicField(this,"dtlsTransport"),__publicField(this,"sctp"),__publicField(this,"onDataChannel",new Event3),__publicField(this,"id",(0,import_crypto23.randomUUID)().toString()),__publicField(this,"mid"),__publicField(this,"mLineIndex"),__publicField(this,"bundled",!1),__publicField(this,"dataChannels",{}),__publicField(this,"dataChannelQueue",[]),__publicField(this,"dataChannelId"),__publicField(this,"eventDisposer",[]),__publicField(this,"datachannelReceive",(async(e,t,i)=>{if(t===WEBRTC_DCEP&&i.length>0)switch(log33("DCEP",e,t,i),i[0]){case DATA_CHANNEL_OPEN:{if(i.length<12)return void log33("DATA_CHANNEL_OPEN data.length not enough");if(Object.keys(this.dataChannels).includes(e.toString()))log33("datachannel already opened","retransmit ack");else{const[,t,,r,s,n]=import_jspack6.jspack.Unpack("!BBHLHH",i);let a=12;const o=i.slice(a,a+s).toString("utf8");a+=s;const c=i.slice(a,a+n).toString("utf8");log33("DATA_CHANNEL_OPEN",{channelType:t,reliability:r,streamId:e,label:o,protocol:c});const l=new RTCDataChannelParameters({label:o,ordered:!(128&t),maxPacketLifeTime:2==(3&t)?r:void 0,maxRetransmits:1==(3&t)?r:void 0,protocol:c,id:e}),u=new RTCDataChannel(this,l,!1);u.isCreatedByRemote=!0,this.dataChannels[e]=u,this.onDataChannel.execute(u),u.setReadyState("open")}const t=this.dataChannels[e];this.dataChannelQueue.push([t,WEBRTC_DCEP,Buffer.from(import_jspack6.jspack.Pack("!B",[DATA_CHANNEL_ACK]))]),await this.dataChannelFlush()}break;case DATA_CHANNEL_ACK:{log33("DATA_CHANNEL_ACK",e,t);const i=this.dataChannels[e];if(!i)throw new Error("channel not found");i.setReadyState("open")}}else{const r=this.dataChannels[e];if(r){const e=(()=>{switch(t){case WEBRTC_STRING:return i.toString("utf8");case WEBRTC_STRING_EMPTY:return"";case WEBRTC_BINARY:return i;case WEBRTC_BINARY_EMPTY:return Buffer.from([]);default:throw new Error}})();r.messagesReceived++,r.bytesReceived+=i.length,r.onMessage.execute(e),r.emit("message",{data:e}),r.onmessage&&r.onmessage({data:e})}}})),__publicField(this,"datachannelSend",((e,t)=>{e.addBufferedAmount(t.length),this.dataChannelQueue.push("string"==typeof t?[e,WEBRTC_STRING,Buffer.from(t)]:[e,WEBRTC_BINARY,t]),4!==this.sctp.associationState&&log33("sctp not established",this.sctp.associationState),this.dataChannelFlush()}))}setDtlsTransport(e){this.dtlsTransport&&this.dtlsTransport.id===e.id||(this.eventDisposer.forEach((e=>e())),this.dtlsTransport=e,this.sctp=new SCTP(new BridgeDtls(this.dtlsTransport),this.port),this.eventDisposer=[...[this.sctp.onReceive.subscribe(this.datachannelReceive),this.sctp.onReconfigStreams.subscribe((e=>{e.forEach((e=>{const t=this.dataChannels[e];t&&(t.setReadyState("closing"),t.setReadyState("closed"),delete this.dataChannels[e])}))})),this.sctp.stateChanged.connected.subscribe((()=>{Object.values(this.dataChannels).forEach((e=>{e.negotiated&&"open"!==e.readyState&&e.setReadyState("open")})),this.dataChannelFlush()})),this.sctp.stateChanged.closed.subscribe((()=>{Object.values(this.dataChannels).forEach((e=>{e.setReadyState("closed")})),this.dataChannels={}})),this.dtlsTransport.onStateChange.subscribe((e=>{"closed"===e&&this.sctp.setState(1)}))].map((e=>e.unSubscribe)),()=>this.sctp.onSackReceived=async()=>{}],this.sctp.onSackReceived=async()=>{await this.dataChannelFlush()})}get isServer(){return"controlling"!==this.dtlsTransport.iceTransport.role}channelByLabel(e){return Object.values(this.dataChannels).find((t=>t.label===e))}dataChannelAddNegotiated(e){if(null==e.id)throw new Error;if(this.dataChannels[e.id])throw new Error;this.dataChannels[e.id]=e,4===this.sctp.associationState&&e.setReadyState("open")}dataChannelOpen(e){if(e.id){if(this.dataChannels[e.id])throw new Error(`Data channel with ID ${e.id} already registered`);this.dataChannels[e.id]=e}let t=DATA_CHANNEL_RELIABLE;let i=0;e.ordered||(t=128),e.maxRetransmits?(t=1,i=e.maxRetransmits):e.maxPacketLifeTime&&(t=2,i=e.maxPacketLifeTime);const r=import_jspack6.jspack.Pack("!BBHLHH",[DATA_CHANNEL_OPEN,t,0,i,e.label.length,e.protocol.length]),s=Buffer.concat([Buffer.from(r),Buffer.from(e.label,"utf8"),Buffer.from(e.protocol,"utf8")]);this.dataChannelQueue.push([e,WEBRTC_DCEP,s]),this.dataChannelFlush()}async dataChannelFlush(){if(4==this.sctp.associationState&&!(this.sctp.outboundQueue.length>0)){for(;this.dataChannelQueue.length>0;){const[e,t,i]=this.dataChannelQueue.shift();let r=e.id;if(void 0===r){for(r=this.dataChannelId;Object.keys(this.dataChannels).includes(r.toString());)r+=2;this.dataChannels[r]=e,e.setId(r)}if(t===WEBRTC_DCEP)await this.sctp.send(r,t,i,{ordered:!0});else{const s=e.maxPacketLifeTime?Date.now()+e.maxPacketLifeTime/1e3:void 0;await this.sctp.send(r,t,i,{expiry:s,maxRetransmits:e.maxRetransmits,ordered:e.ordered}),e.addBufferedAmount(-i.length)}}this.dataChannelQueue=[]}}static getCapabilities(){return new RTCSctpCapabilities2(65536)}setRemotePort(e){this.sctp.setRemotePort(e)}async start(e){this.isServer?this.dataChannelId=0:this.dataChannelId=1,this.sctp.isServer=this.isServer,await this.sctp.start(e)}async stop(){this.dtlsTransport.dataReceiver=()=>{},await this.sctp.stop()}dataChannelClose(e){["closing","closed"].includes(e.readyState)||(e.setReadyState("closing"),4===this.sctp.associationState?(this.sctp.reconfigQueue.includes(e.id)||this.sctp.reconfigQueue.push(e.id),1===this.sctp.reconfigQueue.length&&this.sctp.transmitReconfigRequest()):(this.dataChannelQueue=this.dataChannelQueue.filter((t=>t[0].id!==e.id)),this.sctp.reconfigQueue=this.sctp.reconfigQueue.filter((t=>t!==e.id)),e.id&&delete this.dataChannels[e.id],e.setReadyState("closed")))}},RTCSctpCapabilities2=class{constructor(e){this.maxMessageSize=e}},BridgeDtls=class{constructor(e){this.dtls=e,__publicField(this,"send",(e=>this.dtls.sendData(e)))}set onData(e){this.dtls.dataReceiver=e}close(){}},SessionDescription=class e{constructor(){__publicField(this,"version",0),__publicField(this,"origin"),__publicField(this,"name","-"),__publicField(this,"time","0 0"),__publicField(this,"host"),__publicField(this,"group",[]),__publicField(this,"extMapAllowMixed",!0),__publicField(this,"msidSemantic",[]),__publicField(this,"media",[]),__publicField(this,"type"),__publicField(this,"dtlsRole"),__publicField(this,"iceOptions"),__publicField(this,"iceLite"),__publicField(this,"icePassword"),__publicField(this,"iceUsernameFragment"),__publicField(this,"dtlsFingerprints",[])}static parse(t){const[i,r]=groupLines(t),s=new e;i.forEach((e=>{if(e.startsWith("v="))s.version=Number.parseInt(e.slice(2),10);else if(e.startsWith("o="))s.origin=e.slice(2);else if(e.startsWith("s="))s.name=e.slice(2);else if(e.startsWith("c="))s.host=ipAddressFromSdp(e.slice(2));else if(e.startsWith("t="))s.time=e.slice(2);else if(e.startsWith("a=")){const[t,i]=parseAttr(e);switch(t){case"fingerprint":{const[e,t]=i?.split(" ")||[];s.dtlsFingerprints.push(new RTCDtlsFingerprint(e,t))}break;case"ice-lite":s.iceLite=!0;break;case"ice-options":s.iceOptions=i;break;case"ice-pwd":s.icePassword=i;break;case"ice-ufrag":s.iceUsernameFragment=i;break;case"group":parseGroup(s.group,i);break;case"msid-semantic":parseGroup(s.msidSemantic,i);break;case"setup":s.dtlsRole=DTLS_SETUP_ROLE[i];break;case"extmap-allow-mixed":s.extMapAllowMixed=!0}}}));const n=s.group.find((e=>"BUNDLE"===e.semantic));return r.forEach((e=>{const t=e[0].match(/^m=([^ ]+) ([0-9]+) ([A-Z/]+) (.+)/);if(!t)throw new Error("m line not found");const i=t[1],r=t[4].split(" "),a=["audio","video"].includes(i)?r.map((e=>Number(e))):void 0,o=new MediaDescription(i,Number.parseInt(t[2]),t[3],a||r);if(o.dtlsParams=new RTCDtlsParameters([...s.dtlsFingerprints],s.dtlsRole),o.iceParams=new RTCIceParameters({iceLite:s.iceLite,usernameFragment:s.iceUsernameFragment,password:s.icePassword}),o.iceOptions=s.iceOptions,s.media.push(o),e.slice(1).forEach((e=>{if(e.startsWith("c="))o.host=ipAddressFromSdp(e.slice(2));else if(e.startsWith("a=")){const[t,i]=parseAttr(e);switch(t){case"candidate":if(!i)throw new Error;o.iceCandidates.push(candidateFromSdp(i));break;case"end-of-candidates":o.iceCandidatesComplete=!0;break;case"extmap":{let[e,t]=i.split(" ");e.includes("/")&&([e]=e.split("/")),o.rtp.headerExtensions.push(new RTCRtpHeaderExtensionParameters2({id:Number.parseInt(e),uri:t}))}break;case"fingerprint":{if(!i)throw new Error;const[e,t]=i.split(" ");o.dtlsParams?.fingerprints.push(new RTCDtlsFingerprint(e,t))}break;case"ice-options":o.iceOptions=i;break;case"ice-pwd":o.iceParams.password=i;break;case"ice-ufrag":o.iceParams.usernameFragment=i;break;case"ice-lite":o.iceParams.iceLite=!0;break;case"max-message-size":o.sctpCapabilities=new RTCSctpCapabilities2(Number.parseInt(i,10));break;case"mid":o.rtp.muxId=i;break;case"msid":o.msid=i;break;case"rtcp":{const[e,t]=divide(i," ");o.rtcpPort=Number.parseInt(e),o.rtcpHost=ipAddressFromSdp(t)}break;case"rtcp-mux":o.rtcpMux=!0;break;case"setup":o.dtlsParams.role=DTLS_SETUP_ROLE[i];break;case"recvonly":case"sendonly":case"sendrecv":case"inactive":o.direction=t;break;case"rtpmap":{const[e,t]=divide(i," "),[r,s,n]=t.split("/");let a;"audio"===o.kind&&(a=n?Number.parseInt(n):1);const c=new RTCRtpCodecParameters2({mimeType:o.kind+"/"+r,channels:a,clockRate:Number.parseInt(s),payloadType:Number.parseInt(e)});o.rtp.codecs.push(c)}break;case"sctpmap":{if(!i)throw new Error;const[e,t]=divide(i," ");o.sctpMap[Number.parseInt(e)]=t,o.sctpPort=Number.parseInt(e)}break;case"sctp-port":if(!i)throw new Error;o.sctpPort=Number.parseInt(i);break;case"ssrc":{const[e,t]=divide(i," "),r=Number.parseInt(e),[s,n]=divide(t,":");let a=o.ssrc.find((e=>e.ssrc===r));a||(a=new SsrcDescription({ssrc:r}),o.ssrc.push(a)),SSRC_INFO_ATTRS.includes(s)&&(a[s]=n)}break;case"ssrc-group":parseGroup(o.ssrcGroup,i);break;case"rid":{const[e,t]=divide(i," ");o.simulcastParameters.push(new RTCRtpSimulcastParameters({rid:e,direction:t}))}}}})),(!o.iceParams.usernameFragment||!o.iceParams.password)&&o.rtp.muxId&&n&&n.items.includes(o.rtp.muxId))for(let e=0;e<n.items.length;e++){if(!n.items.includes(e.toString()))continue;const t=s.media[e];if(t.iceParams?.usernameFragment&&t.iceParams.password){o.iceParams={...t.iceParams};break}}o.dtlsParams.role||(o.dtlsParams=void 0);e.slice(1).forEach((e=>{if(e.startsWith("a=")){const[i,r]=parseAttr(e);if("fmtp"===i){const[e,i]=divide(r," ");(t=Number(e),o.rtp.codecs.find((e=>e.payloadType===t))).parameters=i}else if("rtcp-fb"===i){const[e,t,i]=r.split(" ");o.rtp.codecs.forEach((r=>{["*",r.payloadType.toString()].includes(e)&&r.rtcpFeedback.push(new RTCRtcpFeedback({type:t,parameter:i}))}))}}var t}))})),s}webrtcTrackId(e){if(e.msid?.includes(" ")){const t=e.msid.split(" ");for(const e of this.msidSemantic)if("WMS"===e.semantic&&(e.items.includes(t[0])||e.items.includes("*")))return t[1]}}get string(){const e=[`v=${this.version}`,`o=${this.origin}`,`s=${this.name}`];this.host&&e.push(`c=${ipAddressToSdp(this.host)}`),e.push(`t=${this.time}`),this.group.forEach((t=>e.push(`a=group:${t.str}`))),this.extMapAllowMixed&&e.push("a=extmap-allow-mixed"),this.msidSemantic.forEach((t=>e.push(`a=msid-semantic:${t.str}`)));const t=this.media.map((e=>e.toString())).join("");return e.join("\r\n")+"\r\n"+t}toJSON(){return new RTCSessionDescription(this.string,this.type)}toSdp(){return{type:this.type,sdp:this.string}}},MediaDescription=class{constructor(e,t,i,r){this.kind=e,this.port=t,this.profile=i,this.fmt=r,__publicField(this,"host"),__publicField(this,"direction"),__publicField(this,"msid"),__publicField(this,"rtcpPort"),__publicField(this,"rtcpHost"),__publicField(this,"rtcpMux",!1),__publicField(this,"ssrc",[]),__publicField(this,"ssrcGroup",[]),__publicField(this,"rtp",{codecs:[],headerExtensions:[]}),__publicField(this,"sctpCapabilities"),__publicField(this,"sctpMap",{}),__publicField(this,"sctpPort"),__publicField(this,"dtlsParams"),__publicField(this,"iceParams"),__publicField(this,"iceCandidates",[]),__publicField(this,"iceCandidatesComplete",!1),__publicField(this,"iceOptions"),__publicField(this,"simulcastParameters",[])}toString(){const e=[];if(e.push(`m=${this.kind} ${this.port} ${this.profile} ${this.fmt.map((e=>e.toString())).join(" ")}`),this.host&&e.push(`c=${ipAddressToSdp(this.host)}`),this.iceCandidates.forEach((t=>{e.push(`a=candidate:${candidateToSdp(t)}`)})),this.iceCandidatesComplete&&e.push("a=end-of-candidates"),this.iceParams?.usernameFragment&&e.push(`a=ice-ufrag:${this.iceParams.usernameFragment}`),this.iceParams?.password&&e.push(`a=ice-pwd:${this.iceParams.password}`),this.iceParams?.iceLite&&e.push("a=ice-lite"),this.iceOptions&&e.push(`a=ice-options:${this.iceOptions}`),this.dtlsParams&&(this.dtlsParams.fingerprints.forEach((t=>{e.push(`a=fingerprint:${t.algorithm} ${t.value}`)})),e.push(`a=setup:${DTLS_ROLE_SETUP[this.dtlsParams.role]}`)),this.direction&&e.push(`a=${this.direction}`),this.rtp.muxId&&e.push(`a=mid:${this.rtp.muxId}`),this.msid&&e.push(`a=msid:${this.msid}`),this.rtcpPort&&this.rtcpHost&&(e.push(`a=rtcp:${this.rtcpPort} ${ipAddressToSdp(this.rtcpHost)}`),this.rtcpMux&&e.push("a=rtcp-mux")),this.ssrcGroup.forEach((t=>{e.push(`a=ssrc-group:${t.str}`)})),this.ssrc.forEach((t=>{SSRC_INFO_ATTRS.forEach((i=>{const r=t[i];void 0!==r&&e.push(`a=ssrc:${t.ssrc} ${i}:${r}`)}))})),this.rtp.codecs.forEach((t=>{e.push(`a=rtpmap:${t.payloadType} ${t.str}`),t.rtcpFeedback.forEach((i=>{let r=i.type;i.parameter&&(r+=` ${i.parameter}`),e.push(`a=rtcp-fb:${t.payloadType} ${r}`)})),t.parameters&&e.push(`a=fmtp:${t.payloadType} ${t.parameters}`)})),Object.keys(this.sctpMap).forEach((t=>{const i=this.sctpMap[Number(t)];e.push(`a=sctpmap:${t} ${i}`)})),this.sctpPort&&e.push(`a=sctp-port:${this.sctpPort}`),this.sctpCapabilities&&e.push(`a=max-message-size:${this.sctpCapabilities.maxMessageSize}`),this.rtp.headerExtensions.forEach((t=>e.push(`a=extmap:${t.id} ${t.uri}`))),this.simulcastParameters.length){this.simulcastParameters.forEach((t=>{e.push(`a=rid:${t.rid} ${t.direction}`)}));let t="a=simulcast:";const i=this.simulcastParameters.filter((e=>"recv"===e.direction));i.length&&(t+=`recv ${i.map((e=>e.rid)).join(";")} `);const r=this.simulcastParameters.filter((e=>"send"===e.direction));r.length&&(t+=`send ${r.map((e=>e.rid)).join(";")}`),e.push(t)}return e.join("\r\n")+"\r\n"}},GroupDescription=class{constructor(e,t){this.semantic=e,this.items=t}get str(){return`${this.semantic} ${this.items.join(" ")}`}};function ipAddressFromSdp(e){const t=e.match(/^IN (IP4|IP6) ([^ ]+)$/);if(!t)throw new Error("exception");return t[2]}function ipAddressToSdp(e){return`IN IP${(0,import_net5.isIPv4)(e)?4:6} ${e}`}function candidateToSdp(e){let t=`${e.foundation} ${e.component} ${e.protocol} ${e.priority} ${e.ip} ${e.port} typ ${e.type}`;return null!=e.relatedAddress&&(t+=` raddr ${e.relatedAddress}`),null!=e.relatedPort&&(t+=` rport ${e.relatedPort}`),null!=e.tcpType&&(t+=` tcptype ${e.tcpType}`),null!=e.generation&&(t+=` generation ${e.generation}`),null!=e.ufrag&&(t+=` ufrag ${e.ufrag}`),t}function groupLines(e){const t=[],i=[];let r=e.split("\r\n");return 1===r.length&&(r=e.split("\n")),r.forEach((e=>{e.startsWith("m=")?i.push([e]):i.length>0?i[i.length-1].push(e):t.push(e)})),[t,i]}function parseAttr(e){if(e.includes(":")){const t=divide(e.slice(2),":");return[t[0],t[1]]}return[e.slice(2),void 0]}function parseGroup(e,t,i=e=>e.toString()){const r=t.split(" ");r.length>0&&e.push(new GroupDescription(r[0],r.slice(1).map(i)))}function candidateFromSdp(e){return candidateFromIce(Candidate.fromSdp(e))}var RTCSessionDescription=class{constructor(e,t){this.sdp=e,this.type=t}static isThis(e){if("string"==typeof e?.sdp)return!0}toSdp(){return{sdp:this.sdp,type:this.type}}};function addSDPHeader(e,t){const i=new Uint64BE((0,import_crypto24.randomBytes)(64)).toString().slice(0,8);t.origin=`- ${i} 0 IN IP4 0.0.0.0`,t.msidSemantic.push(new GroupDescription("WMS",["*"])),t.type=e}function codecParametersFromString(e){const t={};return e.split(";").forEach((e=>{if(e.includes("=")){const[i,r]=divide(e,"=");FMTP_INT_PARAMETERS.includes(i)?t[i]=Number(r):t[i]=r}else if(e.includes(":")){const[i,r]=e.split(":");t[i]=Number.isNaN(Number(r))?r:Number(r)}else t[e]=void 0})),t}var SsrcDescription=class{constructor(e){__publicField(this,"ssrc"),__publicField(this,"cname"),__publicField(this,"msid"),__publicField(this,"msLabel"),__publicField(this,"label"),Object.assign(this,e)}},log34=debug2("werift:packages/webrtc/src/media/rtpReceiver.ts"),RTCRtpReceiver2=class{constructor(e,t,i){this.config=e,this.kind=t,this.rtcpSsrc=i,__publicField(this,"codecs",{}),__publicField(this,"ssrcByRtx",{}),__publicField(this,"nack",new NackHandler(this)),__publicField(this,"audioRedHandler",new RedHandler),__publicField(this,"type","receiver"),__publicField(this,"uuid",(0,import_crypto25.randomUUID)().toString()),__publicField(this,"tracks",[]),__publicField(this,"trackBySSRC",{}),__publicField(this,"trackByRID",{}),__publicField(this,"lastSRtimestamp",{}),__publicField(this,"receiveLastSRTimestamp",{}),__publicField(this,"onPacketLost",this.nack.onPacketLost),__publicField(this,"onRtcp",new Event3),__publicField(this,"dtlsTransport"),__publicField(this,"sdesMid"),__publicField(this,"latestRid"),__publicField(this,"latestRepairedRid"),__publicField(this,"receiverTWCC"),__publicField(this,"stopped",!1),__publicField(this,"remoteStreamId"),__publicField(this,"remoteTrackId"),__publicField(this,"rtcpRunning",!1),__publicField(this,"rtcpCancel",new AbortController),__publicField(this,"remoteStreams",{}),__publicField(this,"handleRtpBySsrc",((e,t)=>{const i=this.trackBySSRC[e.header.ssrc];this.handleRTP(e,t,i)})),__publicField(this,"handleRtpByRid",((e,t,i)=>{const r=this.trackByRID[t];this.trackBySSRC[e.header.ssrc]||(this.trackBySSRC[e.header.ssrc]=r),this.handleRTP(e,i,r)}))}get codecArray(){return Object.values(this.codecs).sort(((e,t)=>e.payloadType-t.payloadType))}setDtlsTransport(e){this.dtlsTransport=e}get track(){return this.tracks[0]??new MediaStreamTrack2({kind:this.kind})}get nackEnabled(){return this.codecArray[0]?.rtcpFeedback.find((e=>"nack"===e.type))}get twccEnabled(){return this.codecArray[0]?.rtcpFeedback.find((e=>e.type===useTWCC().type))}get pliEnabled(){return this.codecArray[0]?.rtcpFeedback.find((e=>e.type===usePLI().type))}prepareReceive(e){e.codecs.forEach((e=>{this.codecs[e.payloadType]=e})),e.encodings.forEach((e=>{e.rtx&&(this.ssrcByRtx[e.rtx.ssrc]=e.ssrc)}))}setupTWCC(e){this.twccEnabled&&!this.receiverTWCC&&(this.receiverTWCC=new ReceiverTWCC(this.dtlsTransport,this.rtcpSsrc,e))}addTrack(e){return!this.tracks.find((t=>t.rid?t.rid===e.rid:t.ssrc?t.ssrc===e.ssrc:void 0))&&(this.tracks.push(e),e.ssrc&&(this.trackBySSRC[e.ssrc]=e),e.rid&&(this.trackByRID[e.rid]=e),!0)}stop(){this.stopped=!0,this.rtcpRunning=!1,this.rtcpCancel.abort(),this.receiverTWCC&&(this.receiverTWCC.twccRunning=!1),this.nack.close()}async runRtcp(){if(!this.rtcpRunning&&!this.stopped){this.rtcpRunning=!0;try{for(;this.rtcpRunning;){await(0,import_promises7.setTimeout)(500+1e3*Math.random(),void 0,{signal:this.rtcpCancel.signal});const e=Object.entries(this.remoteStreams).map((([e,t])=>{let i=0,r=0;if(this.lastSRtimestamp[e]){i=this.lastSRtimestamp[e];const t=timestampSeconds()-this.receiveLastSRTimestamp[e];t>0&&t<65536&&(r=int(65536*t))}return new RtcpReceiverInfo({ssrc:Number(e),fractionLost:t.fraction_lost,packetsLost:t.packets_lost,highestSequence:t.max_seq,jitter:t.jitter,lsr:i,dlsr:r})})),t=new RtcpRrPacket({ssrc:this.rtcpSsrc,reports:e});try{this.config.debug.receiverReportDelay&&await(0,import_promises7.setTimeout)(this.config.debug.receiverReportDelay),await this.dtlsTransport.sendRtcp([t])}catch(e){log34("sendRtcp failed",e),await(0,import_promises7.setTimeout)(500+1e3*Math.random())}}}catch(e){}}}async getStats(){const e=getStatsTimestamp(),t=[];if(!this.dtlsTransport)return t;const i=generateStatsId("transport",this.dtlsTransport.id);for(const r of this.tracks){if(!r.ssrc)continue;const s=this.remoteStreams[r.ssrc];if(!s)continue;const n={type:"inbound-rtp",id:generateStatsId("inbound-rtp",r.ssrc),timestamp:e,ssrc:r.ssrc,kind:this.kind,transportId:i,codecId:this.codecs[0]?generateStatsId("codec",this.codecs[0].payloadType,i):void 0,mid:this.sdesMid,trackIdentifier:r.id,packetsReceived:s.packets_received,packetsLost:s.packets_lost,jitter:s.jitter};if(t.push(n),this.lastSRtimestamp[r.ssrc]){const s={type:"remote-outbound-rtp",id:generateStatsId("remote-outbound-rtp",r.ssrc),timestamp:e,ssrc:r.ssrc,kind:this.kind,transportId:i,codecId:n.codecId,localId:n.id,remoteTimestamp:1e3*this.receiveLastSRTimestamp[r.ssrc]};t.push(s)}}return t}async sendRtcpPLI(e){if(!this.pliEnabled)return void log34("pli not supported",{mediaSsrc:e});if(this.stopped)return;log34("sendRtcpPLI",{mediaSsrc:e});const t=new RtcpPayloadSpecificFeedback({feedback:new PictureLossIndication({senderSsrc:this.rtcpSsrc,mediaSsrc:e})});try{await this.dtlsTransport.sendRtcp([t])}catch(e){log34(e)}}handleRtcpPacket(e){if(e.type===RtcpSrPacket.type){const t=e;this.lastSRtimestamp[t.ssrc]=compactNtp(t.senderInfo.ntpTimestamp),this.receiveLastSRTimestamp[t.ssrc]=timestampSeconds();const i=this.trackBySSRC[e.ssrc];i&&i.onReceiveRtcp.execute(e)}this.onRtcp.execute(e)}handleRTP(e,t,i){if(this.stopped)return;const r=this.codecs[e.header.payloadType];if(!r)return;if(this.remoteStreams[e.header.ssrc]=this.remoteStreams[e.header.ssrc]??new StreamStatistics(r.clockRate),this.remoteStreams[e.header.ssrc].add(e),this.receiverTWCC){const e=t[RTP_EXTENSION_URI.transportWideCC];if(null==!e)throw new Error("undefined");this.receiverTWCC.handleTWCC(e)}else this.twccEnabled&&this.setupTWCC(e.header.ssrc);if("rtx"===r.name.toLowerCase()){const t=this.ssrcByRtx[e.header.ssrc],s=codecParametersFromString(r.parameters??""),n=this.codecs[s.apt];if(e.payload.length<2)return;e=unwrapRtx(e,n.payloadType,t),i=this.trackBySSRC[t]}let s;if("red"!==r.name.toLowerCase()||(s=Red.deSerialize(e.payload),Object.keys(this.codecs).includes(s.header.fields[0].blockPT.toString()))){if("video"===i?.kind&&this.nackEnabled&&this.nack.addPacket(e),i)if(s){if("audio"===i.kind){const r=this.audioRedHandler.push(s,e);for(const e of r)i.onReceiveRtp.execute(e.clone(),t)}}else i.onReceiveRtp.execute(e.clone(),t);this.runRtcp()}}},log35=debug2("werift:packages/webrtc/src/media/router.ts"),RtpRouter=class{constructor(){__publicField(this,"ssrcTable",{}),__publicField(this,"ridTable",{}),__publicField(this,"extIdUriMap",{}),__publicField(this,"routeRtp",(e=>{const t=rtpHeaderExtensionsParser(e.header.extensions,this.extIdUriMap);let i=this.ssrcTable[e.header.ssrc];const r=t[RTP_EXTENSION_URI.sdesRTPStreamID];if("string"==typeof r?(i=this.ridTable[r],i.latestRid=r,i.handleRtpByRid(e,r,t)):i?i.handleRtpBySsrc(e,t):(i=Object.values(this.ridTable).filter((e=>e instanceof RTCRtpReceiver2)).find((t=>t.trackBySSRC[e.header.ssrc])),i&&(log35("simulcast register receiver by ssrc",e.header.ssrc),this.registerRtpReceiver(i,e.header.ssrc),i.handleRtpBySsrc(e,t))),!i)return void log35("ssrcReceiver not found");const s=t[RTP_EXTENSION_URI.sdesMid];"string"==typeof s&&(i.sdesMid=s);const n=t[RTP_EXTENSION_URI.repairedRtpStreamId];"string"==typeof n&&(i.latestRepairedRid=n)})),__publicField(this,"routeRtcp",(e=>{const t=[];switch(e.type){case RtcpSrPacket.type:t.push(this.ssrcTable[e.ssrc]);break;case RtcpRrPacket.type:e.reports.forEach((e=>{t.push(this.ssrcTable[e.ssrc])}));break;case RtcpSourceDescriptionPacket.type:break;case RtcpTransportLayerFeedback.type:{const i=e;i.feedback&&t.push(this.ssrcTable[i.feedback.mediaSourceSsrc])}break;case RtcpPayloadSpecificFeedback.type:{const i=e;if(i.feedback.count===ReceiverEstimatedMaxBitrate.count){const e=i.feedback;t.push(this.ssrcTable[e.ssrcFeedbacks[0]])}else t.push(this.ssrcTable[i.feedback.senderSsrc]||this.ssrcTable[i.feedback.mediaSsrc])}}t.filter((e=>e)).forEach((t=>t.handleRtcpPacket(e)))}))}registerRtpSender(e){this.ssrcTable[e.ssrc]=e}registerRtpReceiver(e,t){log35("registerRtpReceiver",t),this.ssrcTable[t]=e}registerRtpReceiverBySsrc(e,t){log35("registerRtpReceiverBySsrc",t),t.encodings.filter((e=>null!=e.ssrc)).forEach(((i,r)=>{this.registerRtpReceiver(e.receiver,i.ssrc),e.addTrack(new MediaStreamTrack2({ssrc:i.ssrc,kind:e.kind,id:e.sender.trackId,remote:!0,codec:t.codecs[r]})),i.rtx&&this.registerRtpReceiver(e.receiver,i.rtx.ssrc)})),t.headerExtensions.forEach((e=>{this.extIdUriMap[e.id]=e.uri}))}registerRtpReceiverByRid(e,t,i){const[r]=i.codecs;log35("registerRtpReceiverByRid",t),e.addTrack(new MediaStreamTrack2({rid:t.rid,kind:e.kind,id:e.sender.trackId,remote:!0,codec:r})),this.ridTable[t.rid]=e.receiver}},import_crypto26=require("crypto"),import_jspack7=__toESM(require_jspack()),import_crypto27=require("crypto"),import_promises8=require("timers/promises"),CumulativeResult=class{constructor(){__publicField(this,"numPackets",0),__publicField(this,"totalSize",0),__publicField(this,"firstPacketSentAtMs",0),__publicField(this,"lastPacketSentAtMs",0),__publicField(this,"firstPacketReceivedAtMs",0),__publicField(this,"lastPacketReceivedAtMs",0)}addPacket(e,t,i){0===this.numPackets?(this.firstPacketSentAtMs=t,this.firstPacketReceivedAtMs=i,this.lastPacketSentAtMs=t,this.lastPacketReceivedAtMs=i):(t<this.firstPacketSentAtMs&&(this.firstPacketSentAtMs=t),i<this.firstPacketReceivedAtMs&&(this.firstPacketReceivedAtMs=i),t>this.lastPacketSentAtMs&&(this.lastPacketSentAtMs=t),i>this.lastPacketReceivedAtMs&&(this.lastPacketReceivedAtMs=i)),this.numPackets++,this.totalSize+=e}reset(){this.numPackets=0,this.totalSize=0,this.firstPacketSentAtMs=0,this.lastPacketSentAtMs=0,this.firstPacketReceivedAtMs=0,this.lastPacketReceivedAtMs=0}get receiveBitrate(){const e=this.lastPacketReceivedAtMs-this.firstPacketReceivedAtMs;return Int(this.totalSize/e*8*1e3)}get sendBitrate(){const e=this.lastPacketSentAtMs-this.firstPacketSentAtMs;return Int(this.totalSize/e*8*1e3)}},COUNTER_MAX=20,SCORE_MAX=10,SenderBandwidthEstimator=class{constructor(){__publicField(this,"congestion",!1),__publicField(this,"onAvailableBitrate",new Event3),__publicField(this,"onCongestion",new Event3),__publicField(this,"onCongestionScore",new Event3),__publicField(this,"congestionCounter",0),__publicField(this,"cumulativeResult",new CumulativeResult),__publicField(this,"sentInfos",{}),__publicField(this,"_congestionScore",1),__publicField(this,"_availableBitrate",0)}get congestionScore(){return this._congestionScore}set congestionScore(e){this._congestionScore=e,this.onCongestionScore.execute(e)}get availableBitrate(){return this._availableBitrate}set availableBitrate(e){this._availableBitrate=e,this.onAvailableBitrate.execute(e)}receiveTWCC(e){const t=milliTime()-this.cumulativeResult.firstPacketSentAtMs;t>1e3&&(this.cumulativeResult.reset(),this.congestionCounter<COUNTER_MAX?this.congestionCounter++:this.congestionScore<SCORE_MAX&&this.congestionScore++,this.congestionCounter>=COUNTER_MAX&&!this.congestion&&(this.congestion=!0,this.onCongestion.execute(this.congestion)));for(const t of e.packetResults){if(!t.received)continue;const e=t.sequenceNumber,i=this.sentInfos[e];i&&(t.receivedAtMs&&this.cumulativeResult.addPacket(i.size,i.sendingAtMs,t.receivedAtMs))}if(t>=100&&this.cumulativeResult.numPackets>=20){if(this.availableBitrate=Math.min(this.cumulativeResult.sendBitrate,this.cumulativeResult.receiveBitrate),this.cumulativeResult.reset(),this.congestionCounter>-COUNTER_MAX){const e=Int(COUNTER_MAX/2)+1,t=e-(e-(Int(COUNTER_MAX/4)+1))/10*this.congestionScore;this.congestionCounter=this.congestionCounter-t}this.congestionCounter<=-COUNTER_MAX&&(this.congestionScore>1&&(this.congestionScore--,this.onCongestion.execute(!1)),this.congestionCounter=0),this.congestionCounter<=0&&this.congestion&&(this.congestion=!1,this.onCongestion.execute(this.congestion))}}rtpPacketSent(e){Object.keys(e).map((e=>Number(e))).sort().filter((t=>t<e.wideSeq)).forEach((e=>{delete this.sentInfos[e]})),this.sentInfos[e.wideSeq]=e}},log36=debug2("werift:packages/webrtc/src/media/rtpSender.ts"),RTP_HISTORY_SIZE=128,RTT_ALPHA=.85,RTCRtpSender2=class{constructor(e){this.trackOrKind=e,__publicField(this,"type","sender"),__publicField(this,"kind"),__publicField(this,"ssrc",import_jspack7.jspack.Unpack("!L",(0,import_crypto26.randomBytes)(4))[0]),__publicField(this,"rtxSsrc",import_jspack7.jspack.Unpack("!L",(0,import_crypto26.randomBytes)(4))[0]),__publicField(this,"streamId",(0,import_crypto27.randomUUID)().toString()),__publicField(this,"trackId",(0,import_crypto27.randomUUID)().toString()),__publicField(this,"onReady",new Event3),__publicField(this,"onRtcp",new Event3),__publicField(this,"onPictureLossIndication",new Event3),__publicField(this,"onGenericNack",new Event3),__publicField(this,"senderBWE",new SenderBandwidthEstimator),__publicField(this,"cname"),__publicField(this,"mid"),__publicField(this,"rtpStreamId"),__publicField(this,"repairedRtpStreamId"),__publicField(this,"rtxPayloadType"),__publicField(this,"rtxSequenceNumber",random16()),__publicField(this,"redRedundantPayloadType"),__publicField(this,"_redDistance",2),__publicField(this,"redEncoder",new RedEncoder(this._redDistance)),__publicField(this,"headerExtensions",[]),__publicField(this,"disposeTrack"),__publicField(this,"lastSRtimestamp"),__publicField(this,"lastSentSRTimestamp"),__publicField(this,"ntpTimestamp",0n),__publicField(this,"rtpTimestamp",0),__publicField(this,"octetCount",0),__publicField(this,"packetCount",0),__publicField(this,"rtt"),__publicField(this,"receiverEstimatedMaxBitrate",0n),__publicField(this,"sequenceNumber"),__publicField(this,"timestamp"),__publicField(this,"timestampOffset",0),__publicField(this,"seqOffset",0),__publicField(this,"rtpCache",[]),__publicField(this,"codec"),__publicField(this,"dtlsTransport"),__publicField(this,"dtlsDisposer",[]),__publicField(this,"track"),__publicField(this,"stopped",!1),__publicField(this,"rtcpRunning",!1),__publicField(this,"rtcpCancel",new AbortController),this.kind="string"==typeof this.trackOrKind?this.trackOrKind:this.trackOrKind.kind,"string"!=typeof e&&(e.streamId&&(this.streamId=e.streamId),this.registerTrack(e))}setDtlsTransport(e){this.dtlsTransport&&this.dtlsDisposer.forEach((e=>e())),this.dtlsTransport=e,this.dtlsDisposer=[this.dtlsTransport.onStateChange.subscribe((e=>{"connected"===e&&this.onReady.execute()})).unSubscribe]}get redDistance(){return this._redDistance}set redDistance(e){this._redDistance=e,this.redEncoder.distance=e}prepareSend(e){this.cname=e.rtcp?.cname,this.mid=e.muxId,this.headerExtensions=e.headerExtensions,this.rtpStreamId=e.rtpStreamId,this.repairedRtpStreamId=e.repairedRtpStreamId,this.codec=e.codecs[0],this.track&&(this.track.codec=this.codec),e.codecs.forEach((e=>{const t=codecParametersFromString(e.parameters??"");"rtx"===e.name.toLowerCase()&&t.apt===this.codec?.payloadType&&(this.rtxPayloadType=e.payloadType),"red"===e.name.toLowerCase()&&(this.redRedundantPayloadType=Number((e.parameters??"").split("/")[0]))}))}registerTrack(e){if(e.stopped)throw new Error("track is ended");this.disposeTrack&&this.disposeTrack(),e.id=this.trackId;const{unSubscribe:t}=e.onReceiveRtp.subscribe((async e=>{await this.sendRtp(e)}));this.track=e,this.disposeTrack=t,this.codec&&(e.codec=this.codec),e.onSourceChanged.subscribe((e=>{this.replaceRTP(e)}))}async replaceTrack(e){if(null!==e){if(e.stopped)throw new Error("track is ended");if(null!=this.sequenceNumber){const t=e.header||(await e.onReceiveRtp.asPromise())[0].header;this.replaceRTP(t)}this.registerTrack(e),log36("replaceTrack","ssrc",e.ssrc,"rid",e.rid)}}stop(){this.stopped=!0,this.rtcpRunning=!1,this.rtcpCancel.abort(),this.disposeTrack&&this.disposeTrack(),this.track=void 0}async runRtcp(){if(!this.rtcpRunning&&!this.stopped){this.rtcpRunning=!0;try{for(;this.rtcpRunning;){await(0,import_promises8.setTimeout)(500+1e3*Math.random(),void 0,{signal:this.rtcpCancel.signal});const e=[new RtcpSrPacket({ssrc:this.ssrc,senderInfo:new RtcpSenderInfo({ntpTimestamp:this.ntpTimestamp,rtpTimestamp:this.rtpTimestamp,packetCount:this.packetCount,octetCount:this.octetCount})})];this.lastSRtimestamp=compactNtp(this.ntpTimestamp),this.lastSentSRTimestamp=timestampSeconds(),this.cname&&e.push(new RtcpSourceDescriptionPacket({chunks:[new SourceDescriptionChunk({source:this.ssrc,items:[new SourceDescriptionItem({type:1,text:this.cname})]})]}));try{await this.dtlsTransport.sendRtcp(e)}catch(e){log36("sendRtcp failed",e),await(0,import_promises8.setTimeout)(500+1e3*Math.random())}}}catch(e){}}}replaceRTP({sequenceNumber:e,timestamp:t},i=!1){null!=this.sequenceNumber&&(this.seqOffset=uint16Add(this.sequenceNumber,-e),i&&(this.seqOffset=uint16Add(this.seqOffset,2))),null!=this.timestamp&&(this.timestampOffset=uint32Add(this.timestamp,-t),i&&(this.timestampOffset=uint16Add(this.timestampOffset,1))),this.rtpCache=[],log36("replaceRTP",this.sequenceNumber,e,this.seqOffset)}async sendRtp(e){if("connected"!==this.dtlsTransport.state||!this.codec)return;e=Buffer.isBuffer(e)?RtpPacket.deSerialize(e):e;const{header:t,payload:i}=e;t.ssrc=this.ssrc,t.payloadType=this.codec.payloadType,t.timestamp=uint32Add(t.timestamp,this.timestampOffset),t.sequenceNumber=uint16Add(t.sequenceNumber,this.seqOffset),this.timestamp=t.timestamp,this.sequenceNumber=t.sequenceNumber;const r=ntpTime(),s=[...t.extensions];t.extensions=this.headerExtensions.map((e=>{const t=(()=>{switch(e.uri){case RTP_EXTENSION_URI.sdesMid:return this.mid?serializeSdesMid(this.mid):void 0;case RTP_EXTENSION_URI.sdesRTPStreamID:return this.rtpStreamId?serializeSdesRTPStreamID(this.rtpStreamId):void 0;case RTP_EXTENSION_URI.repairedRtpStreamId:return this.repairedRtpStreamId?serializeRepairedRtpStreamId(this.repairedRtpStreamId):void 0;case RTP_EXTENSION_URI.transportWideCC:return this.dtlsTransport.transportSequenceNumber=uint16Add(this.dtlsTransport.transportSequenceNumber,1),serializeTransportWideCC(this.dtlsTransport.transportSequenceNumber);case RTP_EXTENSION_URI.absSendTime:return serializeAbsSendTime(r)}})();if(t)return{id:e.id,payload:t}})).filter((e=>e));for(const e of s){const i=t.extensions.find((t=>t.id===e.id));i?i.payload=e.payload:t.extensions.push(e)}t.extensions=t.extensions.sort(((e,t)=>e.id-t.id)),this.ntpTimestamp=r,this.rtpTimestamp=t.timestamp,this.octetCount+=i.length,this.packetCount=uint32Add(this.packetCount,1),this.rtpCache[t.sequenceNumber%RTP_HISTORY_SIZE]=e;let n=i;if(this.redRedundantPayloadType){this.redEncoder.push({block:n,timestamp:t.timestamp,blockPT:this.redRedundantPayloadType});n=this.redEncoder.build().serialize()}const a=await this.dtlsTransport.sendRtp(n,t);this.runRtcp();const o=milliTime(),c={wideSeq:this.dtlsTransport.transportSequenceNumber,size:a,sendingAtMs:o,sentAtMs:o};this.senderBWE.rtpPacketSent(c)}handleRtcpPacket(e){switch(e.type){case RtcpSrPacket.type:case RtcpRrPacket.type:e.reports.filter((e=>e.ssrc===this.ssrc)).forEach((e=>{if(this.lastSRtimestamp===e.lsr&&e.dlsr&&this.lastSentSRTimestamp){const t=timestampSeconds()-this.lastSentSRTimestamp-e.dlsr/65536;void 0===this.rtt?this.rtt=t:this.rtt=RTT_ALPHA*this.rtt+(1-RTT_ALPHA)*t}}));break;case RtcpTransportLayerFeedback.type:{const t=e;switch(t.feedback.count){case TransportWideCC.count:{const e=t.feedback;this.senderBWE.receiveTWCC(e)}break;case GenericNack.count:{const e=t.feedback;e.lost.forEach((async e=>{let t=this.rtpCache[e%RTP_HISTORY_SIZE];t&&t.header.sequenceNumber!==e&&(t=void 0),t&&(null!=this.rtxPayloadType&&(t=wrapRtx(t,this.rtxPayloadType,this.rtxSequenceNumber,this.rtxSsrc),this.rtxSequenceNumber=uint16Add(this.rtxSequenceNumber,1)),await this.dtlsTransport.sendRtp(t.payload,t.header))})),this.onGenericNack.execute(e)}}}break;case RtcpPayloadSpecificFeedback.type:{const t=e;switch(t.feedback.count){case ReceiverEstimatedMaxBitrate.count:{const e=t.feedback;this.receiverEstimatedMaxBitrate=e.bitrate}break;case PictureLossIndication.count:this.onPictureLossIndication.execute()}}}this.onRtcp.execute(e)}getParameters(){return{encodings:[]}}setParameters(e){}async getStats(){const e=getStatsTimestamp(),t=[];if(!this.dtlsTransport)return t;const i=generateStatsId("transport",this.dtlsTransport.id),r={type:"outbound-rtp",id:generateStatsId("outbound-rtp",this.ssrc),timestamp:e,ssrc:this.ssrc,kind:this.kind,transportId:i,codecId:this.codec?generateStatsId("codec",this.codec.payloadType,i):void 0,mid:this.mid,packetsSent:this.packetCount,bytesSent:this.octetCount,rtxSsrc:this.rtxPayloadType?this.rtxSsrc:void 0};if(t.push(r),this.track){const i={type:"media-source",id:generateStatsId("media-source",this.trackId),timestamp:e,trackIdentifier:this.trackId,kind:this.kind};t.push(i)}if(void 0!==this.rtt){const s={type:"remote-inbound-rtp",id:generateStatsId("remote-inbound-rtp",this.ssrc),timestamp:e,ssrc:this.ssrc,kind:this.kind,transportId:i,codecId:r.codecId,localId:r.id,roundTripTime:this.rtt};t.push(s)}return t}},import_crypto28=require("crypto"),log37=debug2("werift:packages/webrtc/src/transport/sctpManager.ts"),SctpTransportManager=class{constructor(){__publicField(this,"sctpTransport"),__publicField(this,"sctpRemotePort"),__publicField(this,"dataChannelsOpened",0),__publicField(this,"dataChannelsClosed",0),__publicField(this,"dataChannels",[]),__publicField(this,"onDataChannel",new Event3)}createSctpTransport(){const e=new RTCSctpTransport;return e.mid=void 0,e.onDataChannel.subscribe((e=>{this.dataChannelsOpened++,this.dataChannels.push(e),this.onDataChannel.execute(e)})),this.sctpTransport=e,e}createDataChannel(e,t={}){const i={protocol:"",ordered:!0,negotiated:!1,...t};if(i.maxPacketLifeTime&&i.maxRetransmits)throw new Error("can not select both");this.sctpTransport||(this.sctpTransport=this.createSctpTransport());const r=new RTCDataChannelParameters({id:i.id,label:e,maxPacketLifeTime:i.maxPacketLifeTime,maxRetransmits:i.maxRetransmits,negotiated:i.negotiated,ordered:i.ordered,protocol:i.protocol}),s=new RTCDataChannel(this.sctpTransport,r);return this.dataChannelsOpened++,this.dataChannels.push(s),s.stateChange.subscribe((e=>{if("closed"===e){this.dataChannelsClosed++;const e=this.dataChannels.indexOf(s);-1!==e&&this.dataChannels.splice(e,1)}})),s}async connectSctp(){this.sctpTransport&&this.sctpRemotePort&&(await this.sctpTransport.start(this.sctpRemotePort),await this.sctpTransport.sctp.stateChanged.connected.asPromise(),log37("sctp connected"))}setRemoteSCTP(e,t){if(this.sctpTransport){if(this.sctpRemotePort=e.sctpPort,!this.sctpRemotePort)throw new Error("sctpRemotePort not exist");this.sctpTransport.setRemotePort(this.sctpRemotePort),this.sctpTransport.mLineIndex=t,this.sctpTransport.mid||(this.sctpTransport.mid=e.rtp.muxId)}}async close(){this.sctpTransport&&await this.sctpTransport.stop(),this.onDataChannel.allUnsubscribe()}async getStats(){const e=getStatsTimestamp(),t=[];for(const i of this.dataChannels){const r={type:"data-channel",id:generateStatsId("data-channel",i.id),timestamp:e,label:i.label,protocol:i.protocol,dataChannelIdentifier:i.id,state:i.readyState,messagesSent:i.messagesSent||0,bytesSent:i.bytesSent||0,messagesReceived:i.messagesReceived||0,bytesReceived:i.bytesReceived||0};t.push(r)}return t}},SDPManager=class{constructor({cname:e,midSuffix:t,bundlePolicy:i}){__publicField(this,"currentLocalDescription"),__publicField(this,"currentRemoteDescription"),__publicField(this,"pendingLocalDescription"),__publicField(this,"pendingRemoteDescription"),__publicField(this,"cname"),__publicField(this,"midSuffix"),__publicField(this,"bundlePolicy"),__publicField(this,"seenMid",new Set),this.cname=e,this.midSuffix=t??!1,this.bundlePolicy=i}get localDescription(){if(this._localDescription)return this._localDescription.toJSON()}get remoteDescription(){if(this._remoteDescription)return this._remoteDescription.toJSON()}get _localDescription(){return this.pendingLocalDescription||this.currentLocalDescription}get _remoteDescription(){return this.pendingRemoteDescription||this.currentRemoteDescription}get inactiveRemoteMedia(){return this._remoteDescription?.media?.find?.((e=>"inactive"===e.direction))}createMediaDescriptionForTransceiver(e,t){const i=new MediaDescription(e.kind,9,"UDP/TLS/RTP/SAVPF",e.codecs.map((e=>e.payloadType)));return i.direction=t,i.msid=e.msid,i.rtp={codecs:e.codecs,headerExtensions:e.headerExtensions,muxId:e.mid},i.rtcpHost="0.0.0.0",i.rtcpPort=9,i.rtcpMux=!0,i.ssrc=[new SsrcDescription({ssrc:e.sender.ssrc,cname:this.cname})],e.options.simulcast&&(i.simulcastParameters=e.options.simulcast.map((e=>new RTCRtpSimulcastParameters(e)))),i.rtp.codecs.find((e=>"rtx"===e.name.toLowerCase()))&&(i.ssrc.push(new SsrcDescription({ssrc:e.sender.rtxSsrc,cname:this.cname})),i.ssrcGroup=[new GroupDescription("FID",[e.sender.ssrc.toString(),e.sender.rtxSsrc.toString()])]),this.addTransportDescription(i,e.dtlsTransport),i}createMediaDescriptionForSctp(e){const t=new MediaDescription("application",DISCARD_PORT,"UDP/DTLS/SCTP",["webrtc-datachannel"]);return t.sctpPort=e.port,t.rtp.muxId=e.mid,t.sctpCapabilities=RTCSctpTransport.getCapabilities(),this.addTransportDescription(t,e.dtlsTransport),t}addTransportDescription(e,t){const i=t.iceTransport;e.iceCandidates=i.localCandidates,e.iceCandidatesComplete="complete"===i.gatheringState,e.iceParams=i.localParameters,e.iceOptions="trickle",e.host=DISCARD_HOST,e.port=DISCARD_PORT,"inactive"===e.direction&&(e.port=0,e.msid=void 0),e.dtlsParams||(e.dtlsParams=t.localParameters,e.dtlsParams.fingerprints||(e.dtlsParams.fingerprints=t.localParameters.fingerprints))}allocateMid(e=""){let t="";for(let i=0;t=(i++).toString()+e,this.seenMid.has(t););return this.seenMid.add(t),t}parseSdp({sdp:e,isLocal:t,signalingState:i,type:r}){const s=SessionDescription.parse(e);return this.validateDescription({description:s,isLocal:t,signalingState:i}),s.type=r,s}validateDescription({description:e,isLocal:t,signalingState:i}){if(t){if("offer"===e.type){if(!["stable","have-local-offer"].includes(i))throw new Error("Cannot handle offer in signaling state")}else if("answer"===e.type&&!["have-remote-offer","have-local-pranswer"].includes(i))throw new Error("Cannot handle answer in signaling state")}else if("offer"===e.type){if(!["stable","have-remote-offer"].includes(i))throw new Error("Cannot handle offer in signaling state")}else if("answer"===e.type&&!["have-local-offer","have-remote-pranswer"].includes(i))throw new Error("Cannot handle answer in signaling state")}buildOfferSdp(e,t){const i=new SessionDescription;addSDPHeader("offer",i);(this.currentLocalDescription?.media??[]).forEach(((r,s)=>{const n=r.rtp.muxId;if(n)if("application"===r.kind){if(!t)throw new Error("sctpTransport not found");t.mLineIndex=s,i.media.push(this.createMediaDescriptionForSctp(t))}else{const t=e.find((e=>e.mid===n));if(!t){if("inactive"===r.direction)return void i.media.push(r);throw new Error("transceiver not found")}t.mLineIndex=s,i.media.push(this.createMediaDescriptionForTransceiver(t,t.direction))}}));for(const t of e.filter((e=>!i.media.find((t=>t.rtp.muxId===e.mid))))){null==t.mid&&(t.mid=this.allocateMid(this.midSuffix?"av":""));const e=this.createMediaDescriptionForTransceiver(t,t.direction);void 0===t.mLineIndex?(t.mLineIndex=i.media.length,i.media.push(e)):i.media[t.mLineIndex]=e}if(t&&!i.media.find((e=>"application"===e.kind))&&(t.mLineIndex=i.media.length,null==t.mid&&(t.mid=this.allocateMid(this.midSuffix?"dc":"")),i.media.push(this.createMediaDescriptionForSctp(t))),"disable"!==this.bundlePolicy){const e=i.media.map((e=>"inactive"!==e.direction?e.rtp.muxId:void 0)).filter((e=>e));if(e.length){const t=new GroupDescription("BUNDLE",e);i.group.push(t)}}return i}buildAnswerSdp({transceivers:e,sctpTransport:t,signalingState:i}){if(!["have-remote-offer","have-local-pranswer"].includes(i))throw new Error("createAnswer failed");if(!this._remoteDescription)throw new Error("wrong state");const r=new SessionDescription;addSDPHeader("answer",r);for(const i of this._remoteDescription.media){let s,n;if(["audio","video"].includes(i.kind)){const t=e.find((e=>e.mid===i.rtp.muxId));if(!t)throw new Error(`Transceiver with mid=${i.rtp.muxId} not found`);n=this.createMediaDescriptionForTransceiver(t,andDirection(t.direction,t.offerDirection)),s=t.dtlsTransport}else{if("application"!==i.kind)throw new Error("invalid kind");if(!t||!t.mid)throw new Error("sctpTransport not found");n=this.createMediaDescriptionForSctp(t),s=t.dtlsTransport}n.dtlsParams&&("auto"===s.role?n.dtlsParams.role="client":n.dtlsParams.role=s.role),i.simulcastParameters&&i.simulcastParameters.length>0&&(n.simulcastParameters=i.simulcastParameters.map((e=>({...e,direction:"send"===e.direction?"recv":"send"})))),r.media.push(n)}if("disable"!==this.bundlePolicy){const e=new GroupDescription("BUNDLE",[]);for(const t of r.media)"inactive"!==t.direction&&e.items.push(t.rtp.muxId);r.group.push(e)}return r}setLocalDescription(e){this.currentLocalDescription=e,"answer"===e.type?this.pendingLocalDescription=void 0:this.pendingLocalDescription=e}setRemoteDescription(e,t){if(!e.sdp||!e.type||"rollback"===e.type||"pranswer"===e.type)throw new Error("invalid sessionDescription");const i=this.parseSdp({sdp:e.sdp,isLocal:!1,signalingState:t,type:e.type});return"answer"===i.type?(this.currentRemoteDescription=i,this.pendingRemoteDescription=void 0):this.pendingRemoteDescription=i,i}registerMid(e){this.seenMid.add(e)}get remoteIsBundled(){const e=this._remoteDescription;if(!e)return;return e.group.find((e=>"BUNDLE"===e.semantic&&"disable"!==this.bundlePolicy))}setLocal(e,t,i){e.media.filter((e=>["audio","video"].includes(e.kind))).forEach(((e,i)=>{this.addTransportDescription(e,t[i].dtlsTransport)}));const r=e.media.find((e=>"application"===e.kind));i&&r&&this.addTransportDescription(r,i.dtlsTransport),this.setLocalDescription(e)}},log38=debug2("werift:packages/webrtc/src/transport/secureTransportManager.ts"),SecureTransportManager=class{constructor({config:e,transceiverManager:t,sctpManager:i}){if(__publicField(this,"connectionState","new"),__publicField(this,"iceConnectionState","new"),__publicField(this,"iceGatheringState","new"),__publicField(this,"certificate"),__publicField(this,"iceGatheringStateChange",new Event3),__publicField(this,"iceConnectionStateChange",new Event3),__publicField(this,"onIceCandidate",new Event3),__publicField(this,"connectionStateChange",new Event3),__publicField(this,"config"),__publicField(this,"transceiverManager"),__publicField(this,"sctpManager"),this.config=e,this.transceiverManager=t,this.sctpManager=i,this.config.dtls){const{keys:e}=this.config.dtls;e&&this.setupCertificate(e)}}get dtlsTransports(){return[...this.transceiverManager.getTransceivers().map((e=>e.dtlsTransport)),this.sctpManager.sctpTransport?.dtlsTransport].filter((e=>null!=e)).reduce(((e,t)=>(e.map((e=>e.id)).includes(t.id)||e.push(t),e)),[])}get iceTransports(){return this.dtlsTransports.map((e=>e.iceTransport))}setupCertificate(e){this.certificate=new RTCCertificate(e.keyPem,e.certPem,e.signatureHash)}createTransport(){const[e]=this.iceTransports,t=new RTCIceGatherer2({...parseIceServers(this.config.iceServers),forceTurn:"relay"===this.config.iceTransportPolicy,portRange:this.config.icePortRange,interfaceAddresses:this.config.iceInterfaceAddresses,additionalHostAddresses:this.config.iceAdditionalHostAddresses,filterStunResponse:this.config.iceFilterStunResponse,filterCandidatePair:this.config.iceFilterCandidatePair,localPasswordPrefix:this.config.icePasswordPrefix,useIpv4:this.config.iceUseIpv4,useIpv6:this.config.iceUseIpv6,turnTransport:!0===this.config.forceTurnTCP?"tcp":"udp",useLinkLocalAddress:this.config.iceUseLinkLocalAddress});e&&(t.connection.localUsername=e.connection.localUsername,t.connection.localPassword=e.connection.localPassword),t.onGatheringStateChange.subscribe((()=>{this.updateIceGatheringState()})),this.updateIceGatheringState();const i=new RTCIceTransport2(t);i.onStateChange.subscribe((()=>{this.updateIceConnectionState()}));return new RTCDtlsTransport2(this.config,i,this.certificate,srtpProfiles)}handleNewIceCandidate({candidate:e,media:t,remoteIsBundled:i,transceiver:r,sctpTransport:s,bundlePolicy:n}){return"max-bundle"===n||i?(e.sdpMLineIndex=0,t&&(e.sdpMid=t.rtp.muxId)):(r&&(e.sdpMLineIndex=r.mLineIndex,e.sdpMid=r.mid),s&&(e.sdpMLineIndex=s.mLineIndex,e.sdpMid=s.mid)),e.foundation&&!e.foundation.startsWith("candidate:")&&(e.foundation="candidate:"+e.foundation),this.onIceCandidate.execute(e),e}async addIceCandidate(e,t){const i=IceCandidate.fromJSON(t);if(!i)return;let r;"number"==typeof i.sdpMid&&(r=this.getTransportByMid(i.sdpMid)),r||"number"!=typeof i.sdpMLineIndex||(r=this.getTransportByMLineIndex(e,i.sdpMLineIndex)),r||(r=this.iceTransports[0]),r?await r.addRemoteCandidate(i):log38("iceTransport not found for candidate",i)}getTransportByMid(e){let t;const i=this.transceiverManager.getTransceivers().find((t=>t.mid===e));return i?t=i.dtlsTransport.iceTransport:t||this.sctpManager.sctpTransport?.mid!==e||(t=this.sctpManager.sctpTransport.dtlsTransport.iceTransport),t}getTransportByMLineIndex(e,t){const i=e.media[t];if(!i)return;return this.getTransportByMid(i.rtp.muxId)}restartIce(){for(const e of this.iceTransports)e.restart()}setLocalRole({type:e,role:t}){for(const i of this.dtlsTransports){const r=i.iceTransport;r.connection.iceControlling="offer"===e,r.connection.remoteIsLite&&(r.connection.iceControlling=!0),"answer"===e&&t&&(i.role=t)}}updateIceGatheringState(){const e=this.iceTransports;function t(...t){return e.filter((e=>t.includes(e.gatheringState))).length===e.length}let i;i=e.length&&t("complete")?"complete":!e.length||t("new","complete")?"new":e.map((e=>e.gatheringState)).includes("gathering")?"gathering":"new",this.iceGatheringState!==i&&(this.iceGatheringState=i,this.iceGatheringStateChange.execute(i))}updateIceConnectionState(){const e=this.iceTransports;let t;function i(...t){return e.filter((e=>t.includes(e.state))).length===e.length}function r(...t){return e.some((e=>t.includes(e.state)))}t="closed"===this.connectionState?"closed":r("failed")?"failed":r("disconnected")?"disconnected":i("new","closed")?"new":r("new","checking")?"checking":i("completed","closed")?"completed":i("connected","completed","closed")?"connected":"new",this.iceConnectionState!==t&&(log38("iceConnectionStateChange",t),this.iceConnectionState=t,this.iceConnectionStateChange.execute(t))}async gatherCandidates(e){const t=this.iceTransports.find((e=>"connected"===e.state||"completed"===e.state));e&&t?log38("skipping ICE gathering for bundled connection"):await Promise.allSettled(this.iceTransports.map((e=>e.gather()))).catch((e=>{log38("gatherCandidates failed",e)}))}setConnectionState(e){log38("connectionStateChange",e),this.connectionState=e,this.connectionStateChange.execute(e)}async getStats(){const e=[];for(const t of this.dtlsTransports){const i=await t.getStats();i&&e.push(...i)}return e}async ensureCerts(){this.certificate||(this.certificate=await RTCDtlsTransport2.SetupCertificate());for(const e of this.dtlsTransports)e.localCertificate=this.certificate}async close(){this.setConnectionState("closed"),await Promise.allSettled([...this.dtlsTransports.map((e=>e.stop()))]),this.iceGatheringStateChange.allUnsubscribe(),this.iceConnectionStateChange.allUnsubscribe(),this.onIceCandidate.allUnsubscribe(),this.connectionStateChange.allUnsubscribe()}},srtpProfiles=[SRTP_PROFILE.SRTP_AEAD_AES_128_GCM,SRTP_PROFILE.SRTP_AES128_CM_HMAC_SHA1_80],log39=debug2("werift:packages/webrtc/src/peerConnection.ts"),RTCPeerConnection2=class extends EventTarget2{constructor(e={}){super(),__publicField(this,"cname",(0,import_crypto28.randomUUID)().toString()),__publicField(this,"config",generateDefaultPeerConfig()),__publicField(this,"signalingState","stable"),__publicField(this,"negotiationneeded",!1),__publicField(this,"needRestart",!1),__publicField(this,"router",new RtpRouter),__publicField(this,"sdpManager"),__publicField(this,"transceiverManager"),__publicField(this,"sctpManager"),__publicField(this,"secureManager"),__publicField(this,"isClosed",!1),__publicField(this,"shouldNegotiationneeded",!1),__publicField(this,"iceGatheringStateChange",new Event3),__publicField(this,"iceConnectionStateChange",new Event3),__publicField(this,"signalingStateChange",new Event3),__publicField(this,"connectionStateChange",new Event3),__publicField(this,"onDataChannel",new Event3),__publicField(this,"onRemoteTransceiverAdded",new Event3),__publicField(this,"onTransceiverAdded",new Event3),__publicField(this,"onIceCandidate",new Event3),__publicField(this,"onNegotiationneeded",new Event3),__publicField(this,"onTrack",new Event3),__publicField(this,"ondatachannel"),__publicField(this,"onicecandidate"),__publicField(this,"onicecandidateerror"),__publicField(this,"onicegatheringstatechange"),__publicField(this,"onnegotiationneeded"),__publicField(this,"onsignalingstatechange"),__publicField(this,"ontrack"),__publicField(this,"onconnectionstatechange"),__publicField(this,"oniceconnectionstatechange"),__publicField(this,"needNegotiation",(async()=>{this.shouldNegotiationneeded=!0,this.negotiationneeded||"stable"!==this.signalingState||(this.shouldNegotiationneeded=!1,setImmediate((()=>{this.negotiationneeded=!0,this.onNegotiationneeded.execute(),this.onnegotiationneeded&&this.onnegotiationneeded({})})))})),this.setConfiguration(e),this.sdpManager=new SDPManager({cname:this.cname,bundlePolicy:this.config.bundlePolicy}),this.transceiverManager=new TransceiverManager(this.cname,this.config,this.router),this.transceiverManager.onTransceiverAdded.pipe(this.onTransceiverAdded),this.transceiverManager.onRemoteTransceiverAdded.pipe(this.onRemoteTransceiverAdded),this.transceiverManager.onTrack.subscribe((({track:e,stream:t,transceiver:i})=>{const r={track:e,streams:[t],transceiver:i,receiver:i.receiver};this.onTrack.execute(e),this.emit("track",r),this.ontrack&&this.ontrack(r)})),this.transceiverManager.onNegotiationNeeded.subscribe((()=>this.needNegotiation())),this.sctpManager=new SctpTransportManager,this.sctpManager.onDataChannel.subscribe((e=>{this.onDataChannel.execute(e);const t={channel:e};this.ondatachannel?.(t),this.emit("datachannel",t)})),this.secureManager=new SecureTransportManager({config:this.config,sctpManager:this.sctpManager,transceiverManager:this.transceiverManager}),this.secureManager.iceGatheringStateChange.pipe(this.iceGatheringStateChange),this.secureManager.iceConnectionStateChange.subscribe((e=>{"closed"===e&&this.close(),this.iceConnectionStateChange.execute(e)})),this.secureManager.connectionStateChange.subscribe((e=>{this.connectionStateChange.execute(e),this.onconnectionstatechange?.(),this.emit("connectionstatechange")})),this.secureManager.onIceCandidate.subscribe((e=>{const t=e?e.toJSON():void 0;this.onIceCandidate.execute(t),this.onicecandidate?.({candidate:t}),this.emit("icecandidate",{candidate:t})}))}get connectionState(){return this.secureManager.connectionState}get iceConnectionState(){return this.secureManager.iceConnectionState}get iceGathererState(){return this.secureManager.iceGatheringState}get iceGatheringState(){return this.secureManager.iceGatheringState}get dtlsTransports(){return this.secureManager.dtlsTransports}get sctpTransport(){return this.sctpManager.sctpTransport}get sctpRemotePort(){return this.sctpManager.sctpRemotePort}get iceTransports(){return this.secureManager.iceTransports}get extIdUriMap(){return this.router.extIdUriMap}get iceGeneration(){return this.iceTransports[0].connection.generation}get localDescription(){return this.sdpManager.localDescription}get remoteDescription(){return this.sdpManager.remoteDescription}get remoteIsBundled(){return this.sdpManager.remoteIsBundled}get _localDescription(){return this.sdpManager._localDescription}get _remoteDescription(){return this.sdpManager._remoteDescription}getTransceivers(){return this.transceiverManager.getTransceivers()}getSenders(){return this.transceiverManager.getSenders()}getReceivers(){return this.transceiverManager.getReceivers()}setConfiguration(e){if(deepMerge(this.config,e),this.config.icePortRange){const[e,t]=this.config.icePortRange;if(e===t)throw new Error("should not be same value");if(e>=t)throw new Error("The min must be less than max")}for(const[e,t]of enumerate2([...this.config.codecs.audio||[],...this.config.codecs.video||[]]))if(null==t.payloadType)switch(t.payloadType=96+e,t.name.toLowerCase()){case"rtx":t.parameters="apt="+(t.payloadType-1);break;case"red":if("audio"===t.contentType){const e=t.payloadType+1;t.parameters=`${e}/${e}`,t.payloadType=63}}[...this.config.headerExtensions.audio||[],...this.config.headerExtensions.video||[]].forEach(((e,t)=>{e.id=1+t}))}getConfiguration(){return this.config}async createOffer({iceRestart:e}={}){(e||this.needRestart)&&(this.needRestart=!1,this.secureManager.restartIce()),await this.secureManager.ensureCerts();for(const e of this.transceiverManager.getTransceivers())0===e.codecs.length&&this.transceiverManager.assignTransceiverCodecs(e),0===e.headerExtensions.length&&(e.headerExtensions=this.config.headerExtensions[e.kind]??[]);return this.sdpManager.buildOfferSdp(this.transceiverManager.getTransceivers(),this.sctpTransport).toJSON()}createSctpTransport(){const e=this.sctpManager.createSctpTransport(),t=this.findOrCreateTransport();return e.setDtlsTransport(t),e}createDataChannel(e,t={}){this.sctpTransport||(this.createSctpTransport(),this.needNegotiation());const i=this.sctpManager.createDataChannel(e,t);if(!i.sctp.dtlsTransport){const e=this.findOrCreateTransport();i.sctp.setDtlsTransport(e)}return i}removeTrack(e){if(this.isClosed)throw new Error("peer closed");this.transceiverManager.removeTrack(e),this.needNegotiation()}findOrCreateTransport(){const[e]=this.iceTransports;if(("max-bundle"===this.sdpManager.bundlePolicy||"disable"!==this.sdpManager.bundlePolicy&&this.remoteIsBundled)&&e)return this.dtlsTransports[0];const t=this.secureManager.createTransport();t.onRtp.subscribe((e=>{this.router.routeRtp(e)})),t.onRtcp.subscribe((e=>{this.router.routeRtcp(e)}));const i=t.iceTransport;return i.onNegotiationNeeded.subscribe((()=>{this.needNegotiation()})),i.onIceCandidate.subscribe((e=>{if(this.localDescription)return e?void(this._localDescription?this.secureManager.handleNewIceCandidate({candidate:e,bundlePolicy:this.sdpManager.bundlePolicy,remoteIsBundled:!!this.sdpManager.remoteIsBundled,media:this._localDescription.media[0],transceiver:this.transceiverManager.getTransceivers().find((e=>e.dtlsTransport.iceTransport.id===i.id)),sctpTransport:this.sctpTransport?.dtlsTransport.iceTransport.id===i.id?this.sctpTransport:void 0}):log39("localDescription not found when ice candidate was gathered")):(this.sdpManager.setLocal(this._localDescription,this.transceiverManager.getTransceivers(),this.sctpTransport),this.onIceCandidate.execute(void 0),this.onicecandidate&&this.onicecandidate({candidate:void 0}),void this.emit("icecandidate",{candidate:void 0}));log39("localDescription not found when ice candidate was gathered")})),t}async setLocalDescription(e){e=e??(["stable","have-local-offer","have-remote-pranswer"].includes(this.signalingState)?await this.createOffer():await this.createAnswer());const t=this.sdpManager.parseSdp({sdp:e.sdp,isLocal:!0,signalingState:this.signalingState,type:e.type});"offer"===t.type?this.setSignalingState("have-local-offer"):"answer"===t.type&&this.setSignalingState("stable");for(const[e,i]of enumerate2(t.media)){const t=i.rtp.muxId;if(this.sdpManager.registerMid(t),["audio","video"].includes(i.kind)){const i=this.transceiverManager.getTransceiverByMLineIndex(e);i&&(i.mid=t)}"application"===i.kind&&this.sctpTransport&&(this.sctpTransport.mid=t)}const i=t.media.find((e=>e.dtlsParams))?.dtlsParams?.role;if(this.secureManager.setLocalRole({type:t.type,role:i}),["answer","pranswer"].includes(t.type))for(const e of this.transceiverManager.getTransceivers()){const t=andDirection(e.direction,e.offerDirection);e.setCurrentDirection(t)}return this.sdpManager.setLocal(t,this.transceiverManager.getTransceivers(),this.sctpTransport),await this.gatherCandidates().catch((e=>{log39("gatherCandidates failed",e)})),"answer"===t.type&&this.connect().catch((e=>{log39("connect failed",e),this.secureManager.setConnectionState("failed")})),this.sdpManager.setLocal(t,this.transceiverManager.getTransceivers(),this.sctpTransport),this.shouldNegotiationneeded&&this.needNegotiation(),t}async gatherCandidates(){await this.secureManager.gatherCandidates(!!this.sdpManager.remoteIsBundled)}async addIceCandidate(e){const t=this.sdpManager.buildOfferSdp(this.transceiverManager.getTransceivers(),this.sctpTransport);await this.secureManager.addIceCandidate(t,e)}async connect(){log39("start connect");(await Promise.allSettled(this.dtlsTransports.map((async e=>{const{iceTransport:t}=e;if("connected"===t.state)return;const i=()=>"connected"===e.state;i()||(this.secureManager.setConnectionState("connecting"),await t.start().catch((e=>{throw log39("iceTransport.start failed",e),e})),i()||(await e.start().catch((e=>{throw log39("dtlsTransport.start failed",e),e})),this.sctpTransport&&this.sctpTransport.dtlsTransport.id===e.id&&await this.sctpManager.connectSctp()))})))).find((e=>"rejected"===e.status))?this.secureManager.setConnectionState("failed"):this.secureManager.setConnectionState("connected")}restartIce(){this.needRestart=!0,this.needNegotiation()}async setRemoteDescription(e){e instanceof SessionDescription&&(e=e.toSdp());const t=this.sdpManager.setRemoteDescription(e,this.signalingState);let i;const r=(e,t)=>e.kind===t.kind&&[void 0,t.rtp.muxId].includes(e.mid);let s=t.media.map(((s,n)=>{let a;if(["audio","video"].includes(s.kind)){let o=this.transceiverManager.getTransceivers().find((e=>r(e,s)));if(o){if("inactive"===o.direction&&o.stopping)return o.stopped=!0,void("answer"===e.type&&o.setCurrentDirection("inactive"))}else o=this.addTransceiver(s.kind,{direction:"recvonly"}),o.mid=s.rtp.muxId,this.onRemoteTransceiverAdded.execute(o);this.sdpManager.remoteIsBundled&&(i?o.setDtlsTransport(i):i=o.dtlsTransport),a=o.dtlsTransport,this.transceiverManager.setRemoteRTP(o,s,t.type,n)}else{if("application"!==s.kind)throw new Error("invalid media kind");{let e=this.sctpTransport;e||(e=this.createSctpTransport(),e.mid=s.rtp.muxId),this.sdpManager.remoteIsBundled&&(i?e.setDtlsTransport(i):i=e.dtlsTransport),a=e.dtlsTransport,this.sctpManager.setRemoteSCTP(s,n)}}const o=a.iceTransport;if(s.iceParams){const e=!!this.sdpManager.inactiveRemoteMedia;o.setRemoteParams(s.iceParams,e),s.iceParams?.iceLite&&(o.connection.iceControlling=!0)}return s.dtlsParams&&a.setRemoteParams(s.dtlsParams),s.iceCandidates.forEach(o.addRemoteCandidate),s.iceCandidatesComplete&&o.addRemoteCandidate(void 0),"answer"===t.type&&s.dtlsParams?.role&&(a.role="client"===s.dtlsParams.role?"server":"client"),o}));s=s.filter((e=>!!e));const n=this.transceiverManager.getTransceivers().filter((e=>null==t.media.find((t=>r(e,t)))));if("answer"===e.type)for(const e of n)e.stop(),e.stopped=!0;"offer"===t.type?this.setSignalingState("have-remote-offer"):"answer"===t.type&&this.setSignalingState("stable"),"answer"===t.type&&(log39("caller start connect"),this.connect().catch((e=>{log39("connect failed",e),this.secureManager.setConnectionState("failed")}))),this.negotiationneeded=!1,this.shouldNegotiationneeded&&this.needNegotiation()}addTransceiver(e,t={}){const i=this.findOrCreateTransport(),r=this.transceiverManager.addTransceiver(e,i,t);return this.secureManager.updateIceConnectionState(),this.needNegotiation(),r}addTrack(e,t){if(this.isClosed)throw new Error("is closed");const i=this.transceiverManager.addTrack(e,t);if(!i.dtlsTransport){const e=this.findOrCreateTransport();i.setDtlsTransport(e)}return this.needNegotiation(),i.sender}async createAnswer(){this.assertNotClosed(),await this.secureManager.ensureCerts();return this.sdpManager.buildAnswerSdp({transceivers:this.transceiverManager.getTransceivers(),sctpTransport:this.sctpTransport,signalingState:this.signalingState}).toJSON()}assertNotClosed(){if(this.isClosed)throw new Error("RTCPeerConnection is closed")}setSignalingState(e){log39("signalingStateChange",e),this.signalingState=e,this.signalingStateChange.execute(e),this.onsignalingstatechange&&this.onsignalingstatechange({})}createPeerConnectionStats(){const e=getStatsTimestamp();return{type:"peer-connection",id:generateStatsId("peer-connection"),timestamp:e,dataChannelsOpened:this.sctpManager.dataChannelsOpened,dataChannelsClosed:this.sctpManager.dataChannelsClosed}}async getStats(e){const t=[];t.push(this.createPeerConnectionStats());const i=await this.transceiverManager.getStats(e);t.push(...i);const r=await this.secureManager.getStats();if(t.push(...r),this.sctpTransport){const e=await this.sctpManager.getStats();e&&t.push(...e)}return new RTCStatsReport(t)}async close(){this.isClosed||(this.isClosed=!0,this.setSignalingState("closed"),this.transceiverManager.close(),await this.secureManager.close(),await this.sctpManager.close(),this.onDataChannel.allUnsubscribe(),this.iceGatheringStateChange.allUnsubscribe(),this.iceConnectionStateChange.allUnsubscribe(),this.signalingStateChange.allUnsubscribe(),this.onTransceiverAdded.allUnsubscribe(),this.onRemoteTransceiverAdded.allUnsubscribe(),this.onIceCandidate.allUnsubscribe(),log39("peerConnection closed"))}},findCodecByMimeType=(e,t)=>e.find((e=>e.mimeType.toLowerCase()===t.mimeType.toLowerCase()))?t:void 0;function generateDefaultPeerConfig(){return{codecs:{audio:[useOPUS(),usePCMU()],video:[useVP8()]},headerExtensions:{audio:[],video:[]},iceTransportPolicy:"all",iceServers:[{urls:"stun:stun.l.google.com:19302"}],icePortRange:void 0,iceInterfaceAddresses:void 0,iceAdditionalHostAddresses:void 0,iceUseIpv4:!0,iceUseIpv6:!0,iceFilterStunResponse:void 0,iceFilterCandidatePair:void 0,icePasswordPrefix:void 0,iceUseLinkLocalAddress:void 0,dtls:{},bundlePolicy:"max-compat",debug:{},midSuffix:!1,forceTurnTCP:!1}}var defaultPeerConfig=generateDefaultPeerConfig(),log40=debug2("werift:packages/webrtc/src/media/rtpTransceiverManager.ts"),TransceiverManager=class{constructor(e,t,i){this.cname=e,this.config=t,this.router=i,__publicField(this,"transceivers",[]),__publicField(this,"onTransceiverAdded",new Event3),__publicField(this,"onRemoteTransceiverAdded",new Event3),__publicField(this,"onTrack",new Event3),__publicField(this,"onNegotiationNeeded",new Event3)}getTransceivers(){return this.transceivers}getSenders(){return this.getTransceivers().map((e=>e.sender))}getReceivers(){return this.getTransceivers().map((e=>e.receiver))}getTransceiverByMLineIndex(e){return this.transceivers.find((t=>t.mLineIndex===e))}pushTransceiver(e){this.transceivers.push(e)}replaceTransceiver(e,t){this.transceivers[t]=e}addTransceiver(e,t,i={}){const r="string"==typeof e?e:e.kind,s=i.direction||"sendrecv",n=new RTCRtpSender2(e),a=new RTCRtpReceiver2(this.config,r,n.ssrc),o=new RTCRtpTransceiver3(r,t,a,n,s);o.options=i,this.router.registerRtpSender(o.sender);const c=this.transceivers.findIndex((e=>"inactive"===e.currentDirection)),l=this.transceivers.find((e=>"inactive"===e.currentDirection));return c>-1&&l?(this.replaceTransceiver(o,c),o.mLineIndex=l.mLineIndex,l.setCurrentDirection(void 0)):this.pushTransceiver(o),this.onTransceiverAdded.execute(o),o}addTrack(e,t){if(this.getSenders().find((t=>t.track?.uuid===e.uuid)))throw new Error("Track already added");const i=this.transceivers.find((t=>null==t.sender.track&&t.kind===e.kind&&!0===SenderDirections.includes(t.direction)));if(i){return i.sender.registerTrack(e),i}const r=this.transceivers.find((t=>null==t.sender.track&&t.kind===e.kind&&!1===SenderDirections.includes(t.direction)&&!t.usedForSender));if(r){switch(r.sender.registerTrack(e),r.direction){case"recvonly":r.setDirection("sendrecv");break;case"inactive":r.setDirection("sendonly")}return r}return this.addTransceiver(e,void 0,{direction:"sendrecv"})}removeTrack(e){if(!this.getSenders().find((({ssrc:t})=>e.ssrc===t)))throw new Error("Sender does not exist");const t=this.transceivers.find((({sender:{ssrc:t}})=>e.ssrc===t));if(!t)throw new Error("No matching transceiver found");e.stop(),"recvonly"!==t.currentDirection?t.stopping||t.stopped?t.setDirection("inactive"):"sendrecv"===t.direction?t.setDirection("recvonly"):"sendonly"!==t.direction&&"recvonly"!==t.direction||t.setDirection("inactive"):this.onNegotiationNeeded.execute()}assignTransceiverCodecs(e){const t=this.config.codecs[e.kind].filter((t=>{switch(t.direction){case"recvonly":return!!ReceiverDirection.includes(e.direction);case"sendonly":return!!SenderDirections.includes(e.direction);case"sendrecv":return!![Sendrecv,Recvonly,Sendonly].includes(e.direction);case"all":return!0;default:return!1}}));e.codecs=t}getLocalRtpParams(e){if(null==e.mid)throw new Error("mid not assigned");return{codecs:e.codecs,muxId:e.mid,headerExtensions:e.headerExtensions,rtcp:{cname:this.cname,ssrc:e.sender.ssrc,mux:!0}}}getRemoteRtpParams(e,t){return{muxId:e.rtp.muxId,rtcp:e.rtp.rtcp,codecs:t.codecs,headerExtensions:t.headerExtensions,encodings:Object.values(t.codecs.reduce(((t,i)=>{if("rtx"===i.name.toLowerCase()){const r=t[codecParametersFromString(i.parameters??"").apt];return r&&2===e.ssrc.length&&(r.rtx=new RTCRtpRtxParameters({ssrc:e.ssrc[1].ssrc})),t}return t[i.payloadType]=new RTCRtpCodingParameters({ssrc:e.ssrc[0]?.ssrc,payloadType:i.payloadType}),t}),{}))}}setRemoteRTP(e,t,i,r){if(e.mid||(e.mid=t.rtp.muxId),e.mLineIndex=r,e.codecs=t.rtp.codecs.filter((e=>{const i=this.config.codecs[t.kind]||[],r=findCodecByMimeType(i,e);if(!r)return!1;if("rtx"===r?.name.toLowerCase()){const e=codecParametersFromString(r.parameters??"").apt,s=t.rtp.codecs.find((t=>t.payloadType===e));return!!s&&!!findCodecByMimeType(i,s)}return!0})),log40("negotiated codecs",e.codecs),0===e.codecs.length)throw new Error("negotiate codecs failed.");e.headerExtensions=t.rtp.headerExtensions.filter((e=>(this.config.headerExtensions[t.kind]||[]).find((t=>t.uri===e.uri))));const s=t.direction??"inactive",n=reverseDirection(s);["answer","pranswer"].includes(i)?e.setCurrentDirection(n):e.offerDirection=n;const a=this.getLocalRtpParams(e);if(e.sender.prepareSend(a),["recvonly","sendrecv"].includes(e.direction)){const i=this.getRemoteRtpParams(t,e);for(const r of t.simulcastParameters)this.router.registerRtpReceiverByRid(e,r,i);e.receiver.prepareReceive(i),this.router.registerRtpReceiverBySsrc(e,i)}if(["sendonly","sendrecv"].includes(s)){if(t.msid){const[i,r]=t.msid.split(" ");e.receiver.remoteStreamId=i,e.receiver.remoteTrackId=r}this.onTrack.execute({track:e.receiver.track,transceiver:e,stream:new MediaStream2({id:e.receiver.remoteStreamId,tracks:[e.receiver.track]})})}t.ssrc[0]?.ssrc&&e.receiver.setupTWCC(t.ssrc[0].ssrc)}async getStats(e){const t=[];for(const i of this.transceivers){const r=!e||i.sender.track===e||i.receiver.track===e;if(i.sender){const e=await i.sender.getStats();if(e)for(const i of e)"outbound-rtp"===i.type||"media-source"===i.type?r&&t.push(i):t.push(i)}if(i.receiver){const e=await i.receiver.getStats();if(e)for(const i of e)"inbound-rtp"===i.type||"remote-outbound-rtp"===i.type?r&&t.push(i):t.push(i)}if(r){const e=i.getCodecStats();e&&t.push(...e)}}return t}close(){for(const e of this.transceivers)e.receiver.stop(),e.sender.stop();this.onTransceiverAdded.allUnsubscribe(),this.onRemoteTransceiverAdded.allUnsubscribe(),this.onTrack.allUnsubscribe(),this.onNegotiationNeeded.allUnsubscribe()}},import_mp4box=__toESM(require_mp4box_all()),import_mp4box2=__toESM(require_mp4box_all());import_mp4box2.BoxParser.dOpsBox.prototype.write=function(e){this.size=11,this.writeHeader(e),e.writeUint8(0),e.writeUint8(this.OutputChannelCount),e.writeUint16(this.PreSkip),e.writeUint32(this.InputSampleRate),e.writeUint16(0),e.writeUint8(0)};var UNKNOWN_SIZE=new Uint8Array([1,255,255,255,255,255,255,255]),ID={EBML:Uint8Array.of(26,69,223,163),EBMLVersion:Uint8Array.of(66,134),EBMLReadVersion:Uint8Array.of(66,247),EBMLMaxIDLength:Uint8Array.of(66,242),EBMLMaxSizeLength:Uint8Array.of(66,243),DocType:Uint8Array.of(66,130),DocTypeVersion:Uint8Array.of(66,135),DocTypeReadVersion:Uint8Array.of(66,133),Void:Uint8Array.of(236),CRC32:Uint8Array.of(191),Segment:Uint8Array.of(24,83,128,103),SeekHead:Uint8Array.of(17,77,155,116),Seek:Uint8Array.of(77,187),SeekID:Uint8Array.of(83,171),SeekPosition:Uint8Array.of(83,172),Info:Uint8Array.of(21,73,169,102),SegmentUID:Uint8Array.of(115,164),SegmentFilename:Uint8Array.of(115,132),PrevUID:Uint8Array.of(60,185,35),PrevFilename:Uint8Array.of(60,131,171),NextUID:Uint8Array.of(62,185,35),NextFilename:Uint8Array.of(62,131,187),SegmentFamily:Uint8Array.of(68,68),ChapterTranslate:Uint8Array.of(105,36),ChapterTranslateEditionUID:Uint8Array.of(105,252),ChapterTranslateCodec:Uint8Array.of(105,191),ChapterTranslateID:Uint8Array.of(105,165),TimecodeScale:Uint8Array.of(42,215,177),Duration:Uint8Array.of(68,137),DateUTC:Uint8Array.of(68,97),Title:Uint8Array.of(123,169),MuxingApp:Uint8Array.of(77,128),WritingApp:Uint8Array.of(87,65),Cluster:Uint8Array.of(31,67,182,117),Timecode:Uint8Array.of(231),SilentTracks:Uint8Array.of(88,84),SilentTrackNumber:Uint8Array.of(88,215),Position:Uint8Array.of(167),PrevSize:Uint8Array.of(171),SimpleBlock:Uint8Array.of(163),BlockGroup:Uint8Array.of(160),Block:Uint8Array.of(161),BlockAdditions:Uint8Array.of(117,161),BlockMore:Uint8Array.of(166),BlockAddID:Uint8Array.of(238),BlockAdditional:Uint8Array.of(165),BlockDuration:Uint8Array.of(155),ReferencePriority:Uint8Array.of(250),ReferenceBlock:Uint8Array.of(251),CodecState:Uint8Array.of(164),DiscardPadding:Uint8Array.of(117,162),Slices:Uint8Array.of(142),TimeSlice:Uint8Array.of(232),LaceNumber:Uint8Array.of(204),Tracks:Uint8Array.of(22,84,174,107),TrackEntry:Uint8Array.of(174),TrackNumber:Uint8Array.of(215),TrackUID:Uint8Array.of(115,197),TrackType:Uint8Array.of(131),FlagEnabled:Uint8Array.of(185),FlagDefault:Uint8Array.of(136),FlagForced:Uint8Array.of(85,170),FlagLacing:Uint8Array.of(156),MinCache:Uint8Array.of(109,231),MaxCache:Uint8Array.of(109,248),DefaultDuration:Uint8Array.of(35,227,131),DefaultDecodedFieldDuration:Uint8Array.of(35,78,122),MaxBlockAdditionID:Uint8Array.of(85,238),Name:Uint8Array.of(83,110),Language:Uint8Array.of(34,181,156),CodecID:Uint8Array.of(134),CodecPrivate:Uint8Array.of(99,162),CodecName:Uint8Array.of(37,134,136),AttachmentLink:Uint8Array.of(116,70),CodecDecodeAll:Uint8Array.of(170),TrackOverlay:Uint8Array.of(111,171),CodecDelay:Uint8Array.of(86,170),SeekPreRoll:Uint8Array.of(86,187),TrackTranslate:Uint8Array.of(102,36),TrackTranslateEditionUID:Uint8Array.of(102,252),TrackTranslateCodec:Uint8Array.of(102,191),TrackTranslateTrackID:Uint8Array.of(102,165),Video:Uint8Array.of(224),FlagInterlaced:Uint8Array.of(154),FieldOrder:Uint8Array.of(157),StereoMode:Uint8Array.of(83,184),AlphaMode:Uint8Array.of(83,192),PixelWidth:Uint8Array.of(176),PixelHeight:Uint8Array.of(186),PixelCropBottom:Uint8Array.of(84,170),PixelCropTop:Uint8Array.of(84,187),PixelCropLeft:Uint8Array.of(84,204),PixelCropRight:Uint8Array.of(84,221),DisplayWidth:Uint8Array.of(84,176),DisplayHeight:Uint8Array.of(84,186),DisplayUnit:Uint8Array.of(84,178),AspectRatioType:Uint8Array.of(84,179),ColourSpace:Uint8Array.of(46,181,36),Colour:Uint8Array.of(85,176),MatrixCoefficients:Uint8Array.of(85,177),BitsPerChannel:Uint8Array.of(85,178),ChromaSubsamplingHorz:Uint8Array.of(85,179),ChromaSubsamplingVert:Uint8Array.of(85,180),CbSubsamplingHorz:Uint8Array.of(85,181),CbSubsamplingVert:Uint8Array.of(85,182),ChromaSitingHorz:Uint8Array.of(85,183),ChromaSitingVert:Uint8Array.of(85,184),Range:Uint8Array.of(85,185),TransferCharacteristics:Uint8Array.of(85,186),Primaries:Uint8Array.of(85,187),MaxCLL:Uint8Array.of(85,188),MaxFALL:Uint8Array.of(85,189),MasteringMetadata:Uint8Array.of(85,208),PrimaryRChromaticityX:Uint8Array.of(85,209),PrimaryRChromaticityY:Uint8Array.of(85,210),PrimaryGChromaticityX:Uint8Array.of(85,211),PrimaryGChromaticityY:Uint8Array.of(85,212),PrimaryBChromaticityX:Uint8Array.of(85,213),PrimaryBChromaticityY:Uint8Array.of(85,214),WhitePointChromaticityX:Uint8Array.of(85,215),WhitePointChromaticityY:Uint8Array.of(85,216),LuminanceMax:Uint8Array.of(85,217),LuminanceMin:Uint8Array.of(85,218),Audio:Uint8Array.of(225),SamplingFrequency:Uint8Array.of(181),OutputSamplingFrequency:Uint8Array.of(120,181),Channels:Uint8Array.of(159),BitDepth:Uint8Array.of(98,100),TrackOperation:Uint8Array.of(226),TrackCombinePlanes:Uint8Array.of(227),TrackPlane:Uint8Array.of(228),TrackPlaneUID:Uint8Array.of(229),TrackPlaneType:Uint8Array.of(230),TrackJoinBlocks:Uint8Array.of(233),TrackJoinUID:Uint8Array.of(237),ContentEncodings:Uint8Array.of(109,128),ContentEncoding:Uint8Array.of(98,64),ContentEncodingOrder:Uint8Array.of(80,49),ContentEncodingScope:Uint8Array.of(80,50),ContentEncodingType:Uint8Array.of(80,51),ContentCompression:Uint8Array.of(80,52),ContentCompAlgo:Uint8Array.of(66,84),ContentCompSettings:Uint8Array.of(66,85),ContentEncryption:Uint8Array.of(80,53),ContentEncAlgo:Uint8Array.of(71,225),ContentEncKeyID:Uint8Array.of(71,226),ContentSignature:Uint8Array.of(71,227),ContentSigKeyID:Uint8Array.of(71,228),ContentSigAlgo:Uint8Array.of(71,229),ContentSigHashAlgo:Uint8Array.of(71,230),Cues:Uint8Array.of(28,83,187,107),CuePoint:Uint8Array.of(187),CueTime:Uint8Array.of(179),CueTrackPositions:Uint8Array.of(183),CueTrack:Uint8Array.of(247),CueClusterPosition:Uint8Array.of(241),CueRelativePosition:Uint8Array.of(240),CueDuration:Uint8Array.of(178),CueBlockNumber:Uint8Array.of(83,120),CueCodecState:Uint8Array.of(234),CueReference:Uint8Array.of(219),CueRefTime:Uint8Array.of(150),Attachments:Uint8Array.of(25,65,164,105),AttachedFile:Uint8Array.of(97,167),FileDescription:Uint8Array.of(70,126),FileName:Uint8Array.of(70,110),FileMimeType:Uint8Array.of(70,96),FileData:Uint8Array.of(70,92),FileUID:Uint8Array.of(70,174),Chapters:Uint8Array.of(16,67,167,112),EditionEntry:Uint8Array.of(69,185),EditionUID:Uint8Array.of(69,188),EditionFlagHidden:Uint8Array.of(69,189),EditionFlagDefault:Uint8Array.of(69,219),EditionFlagOrdered:Uint8Array.of(69,221),EncryptionAlgorithm:Uint8Array.of(71,225),EncryptionKeyID:Uint8Array.of(71,226),ContentEncAESSettings:Uint8Array.of(71,231),AESSettingsCipherMode:Uint8Array.of(71,232),ChapterAtom:Uint8Array.of(182),ChapterUID:Uint8Array.of(115,196),ChapterStringUID:Uint8Array.of(86,84),ChapterTimeStart:Uint8Array.of(145),ChapterTimeEnd:Uint8Array.of(146),ChapterFlagHidden:Uint8Array.of(152),ChapterFlagEnabled:Uint8Array.of(69,152),ChapterSegmentUID:Uint8Array.of(110,103),ChapterSegmentEditionUID:Uint8Array.of(110,188),ChapterPhysicalEquiv:Uint8Array.of(99,195),ChapterTrack:Uint8Array.of(143),ChapterTrackNumber:Uint8Array.of(137),ChapterDisplay:Uint8Array.of(128),ChapString:Uint8Array.of(133),ChapLanguage:Uint8Array.of(67,124),ChapCountry:Uint8Array.of(67,126),ChapProcess:Uint8Array.of(105,68),ChapProcessCodecID:Uint8Array.of(105,85),ChapProcessPrivate:Uint8Array.of(69,13),ChapProcessCommand:Uint8Array.of(105,17),ChapProcessTime:Uint8Array.of(105,34),ChapProcessData:Uint8Array.of(105,51),Tags:Uint8Array.of(18,84,195,103),Tag:Uint8Array.of(115,115),Targets:Uint8Array.of(99,192),TargetTypeValue:Uint8Array.of(104,202),TargetType:Uint8Array.of(99,202),TagTrackUID:Uint8Array.of(99,197),TagEditionUID:Uint8Array.of(99,201),TagChapterUID:Uint8Array.of(99,196),TagAttachmentUID:Uint8Array.of(99,198),SimpleTag:Uint8Array.of(103,200),TagName:Uint8Array.of(69,163),TagLanguage:Uint8Array.of(68,122),TagDefault:Uint8Array.of(68,132),TagString:Uint8Array.of(68,135),TagBinary:Uint8Array.of(68,133),Projection:Uint8Array.of(118,112),ProjectionType:Uint8Array.of(118,113),ProjectionPrivate:Uint8Array.of(118,114),ProjectionPoseYaw:Uint8Array.of(118,115),ProjectionPosePitch:Uint8Array.of(118,116),ProjectionPoseRoll:Uint8Array.of(118,117)},path="werift-rtp : packages/rtp/src/processor/depacketizer.ts",log41=debug2(path),DepacketizeBase=class{constructor(e,t={}){this.codec=e,this.options=t,__publicField(this,"rtpBuffer",[]),__publicField(this,"frameFragmentBuffer"),__publicField(this,"lastSeqNum"),__publicField(this,"frameBroken",!1),__publicField(this,"keyframeReceived",!1),__publicField(this,"count",0),__publicField(this,"onNeedKeyFrame",new Event3),__publicField(this,"internalStats",{})}toJSON(){return{...this.internalStats,codec:this.codec,bufferingLength:this.rtpBuffer.length,lastSeqNum:this.lastSeqNum,count:this.count}}processInput(e){const t=[];if(!e.rtp)return e.eol&&(t.push({eol:!0}),this.stop()),t;if(this.options.isFinalPacketInSequence){if(this.checkFinalPacket(e))try{const{data:e,isKeyframe:i,sequence:r,timestamp:s,frameFragmentBuffer:n}=dePacketizeRtpPackets(this.codec,this.rtpBuffer.map((e=>e.rtp)),this.frameFragmentBuffer);if(this.frameFragmentBuffer=n,i&&(this.keyframeReceived=!0),this.options.waitForKeyframe&&!1===this.keyframeReceived)return this.onNeedKeyFrame.execute(),[];if(!this.frameBroken&&e.length>0){const n=this.rtpBuffer.at(-1)?.time??0;t.push({frame:{data:e,isKeyframe:i,time:n,sequence:this.count++,rtpSeq:r,timestamp:s}}),this.internalStats.depacketizer=(new Date).toISOString()}return this.frameBroken&&(this.frameBroken=!1),this.clearBuffer(),t}catch(t){log41("error",t,{input:e,codec:this.codec}),this.clearBuffer()}}else try{const{data:i,isKeyframe:r,sequence:s,timestamp:n,frameFragmentBuffer:a}=dePacketizeRtpPackets(this.codec,[e.rtp],this.frameFragmentBuffer);return this.frameFragmentBuffer=a,t.push({frame:{data:i,isKeyframe:r,time:e.time,sequence:this.count++,rtpSeq:s,timestamp:n}}),this.internalStats.depacketizer=(new Date).toISOString(),t}catch(t){log41("error",t,{input:e,codec:this.codec})}return[]}stop(){this.clearBuffer(),this.onNeedKeyFrame.allUnsubscribe()}clearBuffer(){this.rtpBuffer.forEach((e=>e.rtp.clear())),this.rtpBuffer=[],this.frameFragmentBuffer=void 0}checkFinalPacket({rtp:e,time:t}){var i,r;if(!this.options.isFinalPacketInSequence)throw new Error("isFinalPacketInSequence not exist");const{sequenceNumber:s}=e.header;if(null!=this.lastSeqNum){const e=uint16Add(this.lastSeqNum,1);if(uint16Gt(e,s))return this.internalStats.unExpect={expect:e,sequenceNumber:s,codec:this.codec,at:(new Date).toISOString(),count:(this.internalStats.unExpect?.count??0)+1},!1;uint16Gt(s,e)&&((i=this.internalStats).packetLost??(i.packetLost=[]),this.internalStats.packetLost.length>10&&this.internalStats.packetLost.shift(),this.internalStats.packetLost.push({expect:e,sequenceNumber:s,codec:this.codec,at:(new Date).toISOString()}),(r=this.internalStats).packetLostCount??(r.packetLostCount=0),this.internalStats.packetLostCount++,this.frameBroken=!0,this.clearBuffer())}let n;this.rtpBuffer.push({rtp:e,time:t}),this.lastSeqNum=s;for(const[e,{rtp:t}]of enumerate(this.rtpBuffer))if(this.options.isFinalPacketInSequence(t.header)){n=e;break}return null!=n}},SimpleProcessorCallbackBase=e=>class extends e{constructor(){super(...arguments),__publicField(this,"cb"),__publicField(this,"destructor"),__publicField(this,"pipe",((e,t)=>(this.cb=e,this.destructor=t,e=void 0,t=void 0,this))),__publicField(this,"input",(e=>{for(const t of this.processInput(e))this.cb&&this.cb(t)})),__publicField(this,"destroy",(()=>{this.destructor&&(this.destructor(),this.destructor=void 0),this.cb=void 0}))}},DepacketizeCallback=class extends(SimpleProcessorCallbackBase(DepacketizeBase)){},import_crypto29=require("crypto"),DtxBase=class{constructor(e,t){this.ptime=e,this.dummyPacket=t,__publicField(this,"id",(0,import_crypto29.randomUUID)().toString()),__publicField(this,"previousTimestamp"),__publicField(this,"fillCount",0),__publicField(this,"internalStats",{})}toJSON(){return{...this.internalStats,id:this.id,fillCount:this.fillCount}}processInput({frame:e,eol:t}){if(t)return this.stop(),[{eol:!0}];if(e){if(!this.previousTimestamp)return this.previousTimestamp=e.time,this.internalStats.dtx=(new Date).toISOString(),[{frame:e}];if(e.time!=this.previousTimestamp+this.ptime){const t=[];for(let i=this.previousTimestamp;i<e.time;i+=this.ptime)t.push({frame:{time:i,isKeyframe:e.isKeyframe,data:this.dummyPacket}}),this.fillCount++;return this.previousTimestamp=e.time,this.internalStats.dtx=(new Date).toISOString(),[...t,{frame:e}]}return this.previousTimestamp=e.time,this.internalStats.dtx=(new Date).toISOString(),[{frame:e}]}return[]}stop(){this.dummyPacket=void 0}},DtxCallback=class extends(SimpleProcessorCallbackBase(DtxBase)){},JitterBufferBase=class{constructor(e,t={}){this.clockRate=e,__publicField(this,"options"),__publicField(this,"presentSeqNum"),__publicField(this,"rtpBuffer",{}),__publicField(this,"internalStats",{}),this.options={latency:t.latency??200,bufferSize:t.bufferSize??1e4}}get expectNextSeqNum(){return uint16Add(this.presentSeqNum,1)}toJSON(){return{...this.internalStats,rtpBufferLength:Object.values(this.rtpBuffer).length,presentSeqNum:this.presentSeqNum,expectNextSeqNum:this.expectNextSeqNum}}stop(){this.rtpBuffer={}}processInput(e){const t=[];if(!e.rtp){if(e.eol){const e=this.sortAndClearBuffer(this.rtpBuffer);for(const i of e)t.push({rtp:i});t.push({eol:!0}),this.stop()}return t}const{packets:i,timeoutSeqNum:r}=this.processRtp(e.rtp);if(null!=r){const s={from:this.expectNextSeqNum,to:r};if(this.presentSeqNum=e.rtp.header.sequenceNumber,t.push({isPacketLost:s}),i)for(const r of[...i,e.rtp])t.push({rtp:r});return this.internalStats.jitterBuffer=(new Date).toISOString(),t}if(i){for(const e of i)t.push({rtp:e});return this.internalStats.jitterBuffer=(new Date).toISOString(),t}return[]}processRtp(e){const{sequenceNumber:t,timestamp:i}=e.header;if(null==this.presentSeqNum)return this.presentSeqNum=t,{packets:[e]};if(uint16Gte(this.presentSeqNum,t))return this.internalStats.duplicate={count:(this.internalStats.duplicate?.count??0)+1,sequenceNumber:t,timestamp:(new Date).toISOString()},{nothing:void 0};if(t===this.expectNextSeqNum){this.presentSeqNum=t;const r=this.resolveBuffer(uint16Add(t,1));return this.presentSeqNum=r.at(-1)?.header.sequenceNumber??this.presentSeqNum,this.disposeTimeoutPackets(i),{packets:[e,...r]}}this.pushRtpBuffer(e);const{latestTimeoutSeqNum:r,sorted:s}=this.disposeTimeoutPackets(i);return r?{timeoutSeqNum:r,packets:s}:{nothing:void 0}}pushRtpBuffer(e){Object.values(this.rtpBuffer).length>this.options.bufferSize?this.internalStats.buffer_overflow={count:(this.internalStats.buffer_overflow?.count??0)+1,timestamp:(new Date).toISOString()}:this.rtpBuffer[e.header.sequenceNumber]=e}resolveBuffer(e){const t=[];for(let i=e;;i=uint16Add(i,1)){const e=this.rtpBuffer[i];if(!e)break;t.push(e),delete this.rtpBuffer[i]}return t}sortAndClearBuffer(e){const t=[];for(let i=this.presentSeqNum??0;;i=uint16Add(i,1)){const r=e[i];if(r&&(t.push(r),delete e[i]),0===Object.values(e).length)break}return t}disposeTimeoutPackets(e){let t;const i=Object.values(this.rtpBuffer).map((i=>{const{timestamp:r,sequenceNumber:s}=i.header;if(uint32Gt(r,e))return;const n=uint32Add(e,-r)/this.clockRate;if(1e3*n>this.options.latency){this.internalStats.timeout_packet={count:(this.internalStats.timeout_packet?.count??0)+1,at:(new Date).toISOString(),sequenceNumber:s,elapsedSec:n,baseTimestamp:e,timestamp:r},null==t&&(t=s),uint16Add(s,-this.presentSeqNum)>uint16Add(t,-this.presentSeqNum)&&(t=s);const i=this.rtpBuffer[s];return delete this.rtpBuffer[s],i}})).flatMap((e=>e)).filter((e=>e)),r=this.sortAndClearBuffer(i.reduce(((e,t)=>(e[t.header.sequenceNumber]=t,e)),{}));return{latestTimeoutSeqNum:t,sorted:r}}},JitterBufferCallback=class extends(SimpleProcessorCallbackBase(JitterBufferBase)){},log42=debug2("werift-rtp : packages/rtp/src/processor/nack.ts"),LOST_SIZE2=150,NackHandlerBase=class{constructor(e,t){this.senderSsrc=e,this.onNack=t,__publicField(this,"newEstSeqNum",0),__publicField(this,"_lost",{}),__publicField(this,"clearNackInterval"),__publicField(this,"internalStats",{}),__publicField(this,"onNackSent",new Event3),__publicField(this,"onPacketLost",new Event3),__publicField(this,"mediaSourceSsrc"),__publicField(this,"retryCount",10),__publicField(this,"stopped",!1),__publicField(this,"processInput",(e=>e.rtp?(this.addPacket(e.rtp),this.internalStats.nackHandler=(new Date).toISOString(),[e]):(this.stop(),[e]))),__publicField(this,"sendNack",(()=>new Promise(((e,t)=>{if(this.lostSeqNumbers.length>0&&this.mediaSourceSsrc){this.internalStats.count=(this.internalStats.count??0)+1;const i=new GenericNack({senderSsrc:this.senderSsrc,mediaSourceSsrc:this.mediaSourceSsrc,lost:this.lostSeqNumbers}),r=new RtcpTransportLayerFeedback({feedback:i});this.onNack(r).then(e).catch(t),this.updateRetryCount(),this.onNackSent.execute(i)}}))))}toJSON(){return{...this.internalStats,newEstSeqNum:this.newEstSeqNum,lostLength:Object.values(this._lost).length,senderSsrc:this.senderSsrc,mediaSourceSsrc:this.mediaSourceSsrc}}get lostSeqNumbers(){return Object.keys(this._lost).map(Number).sort()}getLost(e){return this._lost[e]}setLost(e,t){this._lost[e]=t,this.clearNackInterval||this.stopped||(this.clearNackInterval=timer.setInterval((async()=>{try{await this.sendNack(),Object.keys(this._lost).length||(this.clearNackInterval?.(),this.clearNackInterval=void 0)}catch(e){log42("failed to send nack",e)}}),5))}removeLost(e){delete this._lost[e]}addPacket(e){const{sequenceNumber:t,ssrc:i}=e.header;if(this.mediaSourceSsrc=i,0!==this.newEstSeqNum){if(this.getLost(t))this.removeLost(t);else if(t===uint16Add(this.newEstSeqNum,1))this.newEstSeqNum=t;else if(t>uint16Add(this.newEstSeqNum,1)){for(let e=uint16Add(this.newEstSeqNum,1);e<t;e++)this.setLost(e,1);this.newEstSeqNum=t,this.pruneLost()}}else this.newEstSeqNum=t}pruneLost(){this.lostSeqNumbers.length>LOST_SIZE2&&(this._lost=Object.entries(this._lost).slice(-LOST_SIZE2).reduce(((e,[t,i])=>(e[t]=i,e)),{}))}stop(){this.stopped=!0,this._lost={},this.clearNackInterval?.(),this.onNackSent.allUnsubscribe(),this.onPacketLost.allUnsubscribe(),this.onNack=void 0}updateRetryCount(){this.lostSeqNumbers.forEach((e=>{this._lost[e]++>this.retryCount&&(this.removeLost(e),this.onPacketLost.execute(e))}))}},NackHandlerCallback=class extends(SimpleProcessorCallbackBase(NackHandlerBase)){},import_crypto30=require("crypto"),Max32Uint=Number(0x01n<<32n)-1,MaxSinged16Int=32767,NtpTimeBase=class{constructor(e){this.clockRate=e,__publicField(this,"id",(0,import_crypto30.randomUUID)().toString()),__publicField(this,"baseNtpTimestamp"),__publicField(this,"baseRtpTimestamp"),__publicField(this,"latestNtpTimestamp"),__publicField(this,"latestRtpTimestamp"),__publicField(this,"currentElapsed",0),__publicField(this,"buffer",[]),__publicField(this,"internalStats",{}),__publicField(this,"started",!1)}toJSON(){return{...this.internalStats,id:this.id,baseRtpTimestamp:this.baseRtpTimestamp,latestRtpTimestamp:this.latestRtpTimestamp,baseNtpTimestamp:this.baseNtpTimestamp&&ntpTime2Sec(this.baseNtpTimestamp),latestNtpTimestamp:this.latestNtpTimestamp&&ntpTime2Sec(this.latestNtpTimestamp),bufferLength:this.buffer.length,currentElapsed:this.currentElapsed,clockRate:this.clockRate}}stop(){this.buffer=[],this.internalStats={}}processInput({rtcp:e,rtp:t,eol:i}){if(i)return this.stop(),[{eol:!0}];if(e&&e.type===RtcpSrPacket.type){const{ntpTimestamp:t,rtpTimestamp:i}=e.senderInfo;this.latestNtpTimestamp=t,this.latestRtpTimestamp=i,null==this.baseNtpTimestamp&&(this.baseNtpTimestamp=t,this.baseRtpTimestamp=i),this.internalStats.ntpReceived=(new Date).toISOString(),this.started=!0}if(t){this.buffer.push(t),this.internalStats.payloadType=t.header.payloadType;const e=[];if(null==this.baseRtpTimestamp||null==this.baseNtpTimestamp||null==this.latestNtpTimestamp||null==this.latestRtpTimestamp)return[];for(const t of this.buffer){const i=1e3*this.updateNtp(t.header.timestamp),r=Math.round(i);e.push({rtp:t,time:r}),this.internalStats.timeSource=(new Date).toISOString()+" time:"+r}return this.buffer=[],e}return[]}calcNtp({rtpTimestamp:e,baseNtpTimestamp:t,baseRtpTimestamp:i,elapsedOffset:r}){const s=(Math.abs(e-i)>Max32Uint/4*3?e+Max32Uint-i:e-i)/this.clockRate;return{ntp:ntpTime2Sec(t)+r+s,elapsedSec:s}}updateNtp(e){this.internalStats.inputRtp=e;const t=this.calcNtp({rtpTimestamp:e,baseNtpTimestamp:this.baseNtpTimestamp,baseRtpTimestamp:this.baseRtpTimestamp,elapsedOffset:this.currentElapsed}),i=this.calcNtp({rtpTimestamp:e,baseNtpTimestamp:this.latestNtpTimestamp,baseRtpTimestamp:this.latestRtpTimestamp,elapsedOffset:0});return this.internalStats.calcBaseNtp=t.ntp,this.internalStats.calcLatestNtp=i.ntp,t.ntp<i.ntp?(this.baseNtpTimestamp=this.latestNtpTimestamp,this.baseRtpTimestamp=this.latestRtpTimestamp,this.currentElapsed=0,this.internalStats.calcNtp=i.ntp,i.ntp):(this.currentElapsed+=t.elapsedSec,this.baseRtpTimestamp=e,this.internalStats.calcNtp=t.ntp,t.ntp)}},NtpTimeCallback=class extends(SimpleProcessorCallbackBase(NtpTimeBase)){},RtpTimeBase=class{constructor(e){this.clockRate=e,__publicField(this,"baseTimestamp"),__publicField(this,"elapsed",0)}toJSON(){return{baseTimestamp:this.baseTimestamp,elapsed:this.elapsed}}processInput({rtp:e,eol:t}){if(t)return[{eol:!0}];if(e){return[{rtp:e,time:this.update(e.header.timestamp)}]}return[]}update(e){null==this.baseTimestamp&&(this.baseTimestamp=e);const t=Math.abs(e-this.baseTimestamp)>Max32Uint/4*3?e+Max32Uint-this.baseTimestamp:e-this.baseTimestamp;return this.elapsed+=int(t/this.clockRate*1e3),this.baseTimestamp=e,this.elapsed}},RtpTimeCallback=class extends(SimpleProcessorCallbackBase(RtpTimeBase)){},import_crypto31=require("crypto"),import_dgram4=require("dgram"),import_jspack8=__toESM(require_jspack()),Navigator=class{constructor(e={}){__publicField(this,"mediaDevices"),this.mediaDevices=new MediaDevices(e)}},MediaDevices=class extends EventTarget{constructor(e){super(),this.props=e,__publicField(this,"video"),__publicField(this,"audio"),__publicField(this,"getUserMedia",(async e=>{const t=e.video?new MediaStreamTrack2({kind:"video"}):void 0;t&&this.video?.onReceiveRtp.subscribe((e=>{const i=e.clone();i.header.ssrc=import_jspack8.jspack.Unpack("!L",(0,import_crypto31.randomBytes)(4))[0],t.onReceiveRtp.execute(i)}));const i=e.audio?new MediaStreamTrack2({kind:"audio"}):void 0;if(i&&this.audio?.onReceiveRtp.subscribe((e=>{const t=e.clone();t.header.ssrc=import_jspack8.jspack.Unpack("!L",(0,import_crypto31.randomBytes)(4))[0],i.onReceiveRtp.execute(t)})),e.video&&e.audio)return new MediaStream2([t,i]);if(e.audio)return new MediaStream2([i]);if(e.video)return new MediaStream2([t]);throw new Error("Not implemented")})),__publicField(this,"getDisplayMedia",this.getUserMedia),__publicField(this,"getUdpMedia",(({port:e,codec:t})=>{const i=t.mimeType.toLowerCase().includes("video")?"video":"audio",r=new MediaStreamTrack2({kind:i,codec:new RTCRtpCodecParameters2(t)}),s=(0,import_dgram4.createSocket)("udp4");s.bind(e),s.on("message",(e=>{r.writeRtp(e)}));return{track:r,disposer:()=>{s.close()}}})),this.video=e.video,this.audio=e.audio}},navigator2=new Navigator,import_common58=__toESM(require_dist()),import_token=__toESM(require_dist4()),LocalStreamBase=class{constructor(e){this.contentType=e,this.side="local",this.onConnectionStateChanged=new import_common58.Event,this._onConnectionStateChanged=new import_common58.Event,this.id=(0,import_token.uuidV4)(),this._label="",this.published=!1,this._getTransportCallbacks={},this._getStatsCallbacks={},this._connectionState={},this._onConnectionStateChanged.pipe(this.onConnectionStateChanged)}_setLabel(e){this._label=e}_unpublished(){this.published=!1,this._getTransportCallbacks={},this._getStatsCallbacks={}}_getTransport(e){const t="string"==typeof e?e:e.id;return this._getTransportCallbacks[t]?.()}_setConnectionState(e,t){this._connectionState[e.id]!==t&&(this._connectionState[e.id]=t,this._onConnectionStateChanged.emit({remoteMember:e,state:t}))}getStats(e){return this._getStats(e)}_getStats(e){const t="string"==typeof e?e:e.id;return this._getStatsCallbacks[t]?.()??[]}_getStatsAll(){return Promise.all(Object.entries(this._getStatsCallbacks).map((async([e,t])=>({memberId:e,stats:await t().catch((()=>[]))}))))}getRTCPeerConnection(e){return this._getRTCPeerConnection(e)}_getRTCPeerConnection(e){return this._getTransport(e)?.rtcPeerConnection}getConnectionState(e){return this._getConnectionState(e)}_getConnectionState(e){const t="string"==typeof e?e:e.id;return this._connectionState[t]??"new"}_getConnectionStateAll(){return Object.keys(this._getTransportCallbacks).map((e=>({memberId:e,connectionState:this._getConnectionState(e)})))}toJSON(){return{label:this._label,contentType:this.contentType,id:this.id,side:this.side}}},logger20=new import_common59.Logger("packages/core/src/media/stream/local/media.ts"),LocalMediaStreamBase=class extends LocalStreamBase{constructor(e,t,i={}){super(t),this.onTrackUpdated=new import_common59.Event,this.onDestroyed=new import_common59.Event,this._disposer=new import_common59.EventDisposer,this._trackConstraints={},this._replacingTrack=!1,this._onReplacingTrackDone=new import_common59.Event,this._onEnableChanged=new import_common59.Event,this._track=e,this._listenTrackEvent(),this._options=i,this._trackConstraints={...i}}get trackConstraints(){return this._trackConstraints}toJSON(){return{...super.toJSON(),trackConstraints:this.trackConstraints,isEnabled:this.isEnabled,_options:this._options}}get track(){return this._track}attach(e){}detach(){}_disable(e){this._options.stopTrackWhenDisabled?(this._trackConstraints={...this.trackConstraints},this.track.stop()):this._oldTrack=this.track;const t="video"===e?emptyVideoTrack:emptyAudioTrack;t.enabled=!1,this._onEnableChanged.emit(t),this._updateTrack(t)}_updateTrack(e){this._track=e,this._element&&this.attach(this._element),this.onTrackUpdated.emit(e),this._listenTrackEvent()}_listenTrackEvent(){const e=()=>{logger20.info("onDestroyed",this.toJSON()),this.onDestroyed.emit()};this._track.addEventListener("ended",e),this._disposer.push((()=>this._track.removeEventListener("ended",e)))}release(){this._disposer.dispose(),this._track.stop()}},emptyAudioTrack=new MediaStreamTrack2({kind:"audio"}),emptyVideoTrack=new MediaStreamTrack2({kind:"video"}),log43=new import_common60.Logger("packages/core/src/media/stream/local/audio.ts"),LocalAudioStream=class extends LocalMediaStreamBase{constructor(e,t={}){if(super(e,"audio",t),this.contentType="audio",this._isEnabled=!0,this._promiseQueue=new import_common60.PromiseQueue,"audio"!==e.kind)throw createError({operationName:"LocalAudioStream.constructor",path:log43.prefix,info:errors.invalidTrackKind,payload:{track:e}})}async setEnabled(e){await this._promiseQueue.push((async()=>{!0===this._isEnabled&&!1===e?(this._isEnabled=e,this._disable("audio"),log43.debug("stopped")):!1===this._isEnabled&&!0===e&&(this._isEnabled=e,this._options.stopTrackWhenDisabled||this._oldTrack&&(this._updateTrack(this._oldTrack),this._onEnableChanged.emit(this._oldTrack)),log43.debug("resumed"))}))}get isEnabled(){return this._isEnabled}},import_common61=__toESM(require_dist()),log44=new import_common61.Logger("packages/core/src/media/stream/local/customVideo.ts"),LocalCustomVideoStream=class extends LocalMediaStreamBase{constructor(e={}){super(emptyVideoTrack,"video",e),this.contentType="video",this._isEnabled=!0,this._promiseQueue=new import_common61.PromiseQueue,this._stream=null}async setStream(e){if(this._stream)throw new Error("ProcessedStream is already exists");this._stream=e,this._updateTrack(e.track)}async setEnabled(e){await this._promiseQueue.push((async()=>{await(this._stream?.setEnabled(e))}))}async updateTrack(e){this._updateTrack(e),this._onEnableChanged.emit(e)}get isEnabled(){return this._isEnabled}release(){this._stream?.dispose().catch((()=>{log44.error("release failed")}))}},import_common62=__toESM(require_dist()),log45=new import_common62.Logger("packages/core/src/media/stream/local/video.ts"),LocalVideoStream=class extends LocalMediaStreamBase{constructor(e,t={}){if(super(e,"video",t),this.contentType="video",this._isEnabled=!0,this._promiseQueue=new import_common62.PromiseQueue,"video"!==e.kind)throw createError({operationName:"LocalVideoStream.constructor",path:log45.prefix,info:errors.invalidTrackKind,payload:{track:e}});log45.debug("LocalVideoStream spawned",this.toJSON())}async setEnabled(e){await this._promiseQueue.push((async()=>{!0===this._isEnabled&&!1===e?(this._isEnabled=e,this._disable("video"),log45.debug("stopped",this.toJSON())):!1===this._isEnabled&&!0===e&&(this._isEnabled=e,this._options.stopTrackWhenDisabled||this._oldTrack&&(this._updateTrack(this._oldTrack),this._onEnableChanged.emit(this._oldTrack)),log45.debug("resumed",this.toJSON()))}))}get isEnabled(){return this._isEnabled}},log46=new import_common63.Logger("packages/core/src/media/stream/local/data.ts"),LocalDataStream=class extends LocalStreamBase{constructor(e={}){super("data"),this.options=e,this.contentType="data",this._onWriteData=new import_common63.Event,this._isEnabled=!0,this._setLabel("LocalDataStream")}get isEnabled(){return this._isEnabled}setIsEnabled(e){this._isEnabled=e}write(e){if(!this._isEnabled)throw createError({operationName:"LocalDataStream.write",path:log46.prefix,info:errors.disabledDataStream});!(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||"string"==typeof e)&&(e=objectFlag+JSON.stringify(e)),this._onWriteData.emit(e)}},objectFlag="skyway_object:";function createPublication(e,{publisherId:t,stream:i,origin:r,metadata:s,codecCapabilities:n,encodings:a,contentType:o,id:c,isEnabled:l}){const u=e._getPublication(c);if(u)return u;o=o.toLowerCase();const d=r?e._getPublication(r):void 0;d&&0===a.length&&(a=d.encodings);return new PublicationImpl({id:c,channel:e,publisher:e._getMember(t),contentType:o,metadata:s,origin:d,stream:i,codecCapabilities:n??[],encodings:a,isEnabled:l})}var log47=new import_common64.Logger("packages/core/src/publication/index.ts"),PublicationImpl=class{constructor(e){this._codecCapabilities=[],this._encodings=[],this._state="enabled",this._events=new import_common64.Events,this.onCanceled=this._events.make(),this.onSubscribed=this._events.make(),this.onUnsubscribed=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.onMetadataUpdated=this._events.make(),this.onEnabled=this._events.make(),this.onDisabled=this._events.make(),this.onStateChanged=this._events.make(),this.onConnectionStateChanged=new import_common65.Event,this._onEncodingsChanged=this._events.make(),this._onReplaceStream=this._events.make(),this._onEnabled=this._events.make(),this.streamEventDisposer=new import_common64.EventDisposer,this.cancel=()=>new Promise(((e,t)=>{let i=!1;this._channel._unpublish(this.id).catch((e=>{i=!0,t(e)})),this._setStream(void 0),this.onCanceled.asPromise(this._context.config.rtcApi.timeout).then((()=>e())).catch((e=>{i||t(e)}))})),this.updateMetadata=e=>new Promise((async(t,i)=>{const r=log47.info("[start] updateMetadata",await createLogPayload({operationName:"Publication.updateMetadata",channel:this._channel}),this);let s=!1;this._channel._updatePublicationMetadata(this.id,e).catch((e=>{s=!0,i(e)})),this.onMetadataUpdated.watch((t=>t.metadata===e),this._context.config.rtcApi.timeout).then((async()=>{t(),log47.elapsed(r,"[end] updateMetadata",await createLogPayload({operationName:"Publication.updateMetadata",channel:this._channel}),this)})).catch((e=>{if(!s)throw createError({operationName:"PublicationImpl.updateMetadata",info:{...errors.timeout,detail:"publication onMetadataUpdated"},path:log47.prefix,context:this._context,channel:this._channel,error:e})}))})),this.disable=()=>new Promise((async(e,t)=>{if("disabled"===this.state)return void e();const i=log47.info("[start] disable",await createLogPayload({operationName:"Publication.disable",channel:this._channel}),this);await this._disableStream();let r=!1;this._channel._disablePublication(this.id).catch((e=>{r=!0,t(e)})),this.onDisabled.asPromise(this._context.config.rtcApi.timeout).then((async()=>{e(),log47.elapsed(i,"[end] disable",await createLogPayload({operationName:"Publication.disable",channel:this._channel}),this)})).catch((e=>{r||t(e)}))})),this.enable=()=>new Promise((async(e,t)=>{if(null==this.stream)return void t(createError({operationName:"Publication.enable",context:this._context,info:errors.canNotEnableRemotePublication,path:log47.prefix}));if("enabled"===this.state)return void e();const i=log47.info("[start] enable",await createLogPayload({operationName:"Publication.enable",channel:this._channel}),this);let r=!1;this._channel._enablePublication(this.id).catch((e=>{r=!0,t(e)})),this._onEnabled.asPromise(this._context.config.rtcApi.timeout).then((async()=>{await this._enableStream(),this.onEnabled.emit(),this.onStateChanged.emit(),log47.elapsed(i,"[end] enable",await createLogPayload({operationName:"Publication.enable",channel:this._channel}),this),e()})).catch((e=>{r||t(e)}))})),this.id=e.id,this._channel=e.channel,this._context=this._channel._context,this.publisher=e.publisher,this.contentType=e.contentType,this._metadata=e.metadata,this.origin=e.origin,this.setCodecCapabilities(e.codecCapabilities??[]),this.setEncodings(normalizeEncodings(e.encodings??[])),this._state=e.isEnabled?"enabled":"disabled",e.stream&&this._setStream(e.stream),this._analytics=this._channel.localPerson?._analytics,log47.debug("publication spawned",this.toJSON())}get codecCapabilities(){return this._codecCapabilities}setCodecCapabilities(e){this._codecCapabilities=e}get encodings(){return this._encodings}setEncodings(e){this._encodings=e}get stream(){return this._stream}_setStream(e){this._stream=e,e?e._onConnectionStateChanged.add((e=>{log47.debug("onConnectionStateChanged",this.id,e),this.onConnectionStateChanged.emit(e)})).disposer(this.streamEventDisposer):this.streamEventDisposer.dispose()}get metadata(){return this._metadata}get state(){return this._state}get deviceName(){if(!(this.stream instanceof LocalDataStream)){return this.stream.track.label}}get subscriptions(){return this._channel.subscriptions.filter((e=>e.publication.id===this.id))}_updateMetadata(e){this._metadata=e,this.onMetadataUpdated.emit({metadata:e})}async _disable(){await this._disableStream(),this.onDisabled.emit(),this.onStateChanged.emit()}_enable(){this.stream?this._onEnabled.emit():(this._state="enabled",this.onEnabled.emit(),this.onStateChanged.emit())}_unpublished(){this._state="canceled",this.stream&&this.stream._unpublished(),this.onCanceled.emit(),this.onStateChanged.emit(),this._dispose()}_subscribed(e){this.onSubscribed.emit({subscription:e}),this.onSubscriptionListChanged.emit()}_unsubscribed(e){this.onUnsubscribed.emit({subscription:e}),this.onSubscriptionListChanged.emit()}updateEncodings(e){log47.info("updateEncodings",{encodings:e},this),this.setEncodings(normalizeEncodings(sortEncodingParameters(e))),this._onEncodingsChanged.emit(e),this._analytics&&!this._analytics.isClosed()&&this._analytics.client.sendPublicationUpdateEncodingsReport({publicationId:this.id,encodings:this.encodings,updatedAt:Date.now()})}async _disableStream(){"disabled"!==this.state&&(this._state="disabled",this.stream&&("data"===this.stream.contentType?this.stream.setIsEnabled(!1):await this.stream.setEnabled(!1).catch((e=>{log47.warn(createWarnPayload({channel:this._channel,operationName:"Publication._disableStream",payload:e,detail:"setEnabled failed"}))})),createLogPayload({operationName:"Publication._disableStream",channel:this._channel}).then((e=>log47.info("publication _disableStream",e,{publication:this}))).catch((()=>{}))))}async _enableStream(){"enabled"!==this.state&&(this._state="enabled",this.stream&&(createLogPayload({operationName:"Publication._enableStream",channel:this._channel}).then((e=>log47.info("publication _enableStream",e,{publication:this}))).catch((()=>{})),"data"===this.stream.contentType?this.stream.setIsEnabled(!0):await this.stream.setEnabled(!0).catch((e=>{log47.warn(createWarnPayload({channel:this._channel,operationName:"Publication._disableStream",payload:e,detail:"setEnabled failed"}))}))))}replaceStream(e,t={}){if(log47.info("replaceStream",{stream:e,options:t},this),!this.stream)throw createError({operationName:"PublicationImpl.replaceStream",context:this._context,info:errors.canNotUseReplaceStream,path:log47.prefix});if(e.contentType!==this.contentType)throw createError({operationName:"PublicationImpl.replaceStream",context:this._context,info:errors.invalidContentType,path:log47.prefix});if(t.releaseOldStream??1){this.stream.release()}createLogPayload({operationName:"PublicationImpl.replaceStream",channel:this._channel}).then((t=>log47.debug(t,{old:this.stream,new:e}))).catch((e=>e)),e.setEnabled(this.stream.isEnabled).catch((e=>{log47.error("replaceStream stream.setEnabled",e,this.toJSON())}));const i=this._stream;this._setStream(e),this._onReplaceStream.emit({newStream:e,oldStream:i}),this._analytics&&!this._analytics.isClosed()&&this._analytics.client.sendMediaDeviceReport({publicationId:this.id,mediaDeviceName:this.deviceName,mediaDeviceTrigger:"replaceStream",updatedAt:Date.now()})}getStats(e){if(!this.stream)throw createError({operationName:"PublicationImpl.getStats",context:this._context,info:errors.streamNotExistInSubscription,path:log47.prefix});return this.stream._getStats(e)}getRTCPeerConnection(e){if(!this.stream)throw createError({operationName:"PublicationImpl.getRTCPeerConnection",context:this._context,info:errors.streamNotExistInSubscription,path:log47.prefix});return this.stream._getRTCPeerConnection(e)}getConnectionState(e){if(!this.stream)throw createError({operationName:"PublicationImpl.getConnectionState",context:this._context,info:errors.streamNotExistInSubscription,path:log47.prefix});return this.stream._getConnectionState(e)}toJSON(){return{id:this.id,channelId:this._channel.id,publisherId:this.publisher.id,origin:this.origin?.id,contentType:this.contentType,metadata:this.metadata,codecCapabilities:this.codecCapabilities,encodings:this.encodings,state:this.state,stream:this.stream}}_dispose(){this._events.dispose()}},normalizeEncodings=e=>e.map(((e,t)=>({...e,id:e.id??t.toString()}))),sortEncodingParameters=e=>{const[t]=e;return t.maxBitrate?e.sort(((e,t)=>e.maxBitrate-t.maxBitrate)):t.scaleResolutionDownBy?e.sort(((e,t)=>t.scaleResolutionDownBy-e.scaleResolutionDownBy)):t.maxFramerate?e.sort(((e,t)=>e.maxFramerate-t.maxFramerate)):e};function isRemoteMember(e){return null!=e&&"remote"===e.side}var import_common66=__toESM(require_dist()),log48=new import_common66.Logger("packages/core/src/dataPlane/agent/publishing.ts"),PublishingAgent=class{constructor(e){this._localPerson=e,this.context=this._localPerson.context}async startPublishing(e){if(this.context.config.internal.disableDPlane)return void await new Promise((e=>setTimeout(e,500)));const t=e.publication,i=e.subscriber;t.stream||await this._localPerson.onStreamPublished.watch((e=>e.publication.id===t.id),this.context.config.rtcApi.timeout).catch((e=>{throw createError({operationName:"PublishingAgent.startPublishing",context:this.context,channel:this._localPerson.channel,info:{...errors.timeout,detail:"PublishingAgent onStreamPublished"},path:log48.prefix,payload:{publication:t},error:e})}));const r=i._getOrCreateConnection(this._localPerson);r.startPublishing&&await r.startPublishing(t,e.id)}async stopPublishing(e,t){const i=t._getConnection(this._localPerson.id);i?.stopPublishing&&i.stopPublishing(e).catch((e=>{log48.error("stopPublishing failed",e)}))}},SubscribingAgent=class{constructor(e){this._localPerson=e,this._disposers={},this._context=this._localPerson.context}async startSubscribing(e){if(this._context.config.internal.disableDPlane)return void await new Promise((e=>setTimeout(e,500)));const t=e.publication.publisher._getOrCreateConnection(this._localPerson);if(t.startSubscribing){await t.startSubscribing(e);const{removeListener:i}=e._onChangeEncoding.add((async()=>{await(t.changePreferredEncoding?.(e))}));this._disposers[e.id]=i}}async stopSubscribing(e){const t=e.publication.publisher._getConnection(this._localPerson.id);t?.stopSubscribing&&(await t.stopSubscribing(e),this._disposers[e.id]?.())}},import_common67=__toESM(require_dist()),LocalPersonAdapter=class{constructor(e){this._impl=e,this._events=new import_common67.Events,this.onLeft=this._events.make(),this.onMetadataUpdated=this._events.make(),this.onMemberStateChanged=this._events.make(),this.onStreamPublished=this._events.make(),this.onStreamUnpublished=this._events.make(),this.onPublicationListChanged=this._events.make(),this.onPublicationSubscribed=this._events.make(),this.onPublicationUnsubscribed=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.onFatalError=this._events.make(),this.apply(e)}get keepaliveIntervalSec(){return this._impl.keepaliveIntervalSec}get keepaliveIntervalGapSec(){return this._impl.keepaliveIntervalGapSec}get disableSignaling(){return this._impl.disableSignaling}get disableAnalytics(){return this._impl.disableAnalytics}get type(){return this._impl.type}get subtype(){return this._impl.subtype}get side(){return this._impl.side}get id(){return this._impl.id}get name(){return this._impl.name}get channel(){return this._impl.channel}get metadata(){return this._impl.metadata}get state(){return this._impl.state}get publications(){return this._impl.publications}get subscriptions(){return this._impl.subscriptions}apply(e){this._impl=e,e.onLeft.pipe(this.onLeft),e.onMetadataUpdated.pipe(this.onMetadataUpdated),e.onStreamPublished.pipe(this.onStreamPublished),e.onStreamUnpublished.pipe(this.onStreamUnpublished),e.onPublicationListChanged.pipe(this.onPublicationListChanged),e.onPublicationSubscribed.pipe(this.onPublicationSubscribed),e.onPublicationUnsubscribed.pipe(this.onPublicationUnsubscribed),e.onSubscriptionListChanged.pipe(this.onSubscriptionListChanged),e.onFatalError.pipe(this.onFatalError)}subscribe(e,t){return this._impl.subscribe(e,t)}unsubscribe(e){return this._impl.unsubscribe(e)}publish(e,t={}){return this._impl.publish(e,t)}unpublish(e){return this._impl.unpublish(e)}updateMetadata(e){return this._impl.updateMetadata(e)}async leave(){await this._impl.leave()}dispose(){this._impl.dispose()}},import_common70=__toESM(require_dist()),MaxIceParamServerTTL=86400,import_common68=__toESM(require_dist()),log49=new import_common68.Logger("packages/core/src/external/ice.ts"),IceManager=class{constructor(e){this.args=e,this.domain=this.args.domain,this.version=this.args.version,this.secure=this.args.secure,this.memberId=this.args.memberId,this.channelId=this.args.channelId,this.ttl=this.args.ttl,this.context=this.args.context,this._stunServers=[],this._turnServers=[],this._endpoint=`http${this.secure?"s":""}://${this.domain}/v${this.version}`,this.http=new import_common68.HttpClient(this._endpoint)}async updateIceParams(){const e={memberId:this.memberId,channelId:this.channelId,ttl:this.ttl};log49.debug("[start] fetch iceParams");const t=new import_common68.BackOff({times:6,interval:500,jitter:100}),{turn:i,stun:r}=await this.http.post("/ice-params",e,{headers:{authorization:`Bearer ${this.context.authTokenString}`},retry:()=>t.wait()});i&&(this._turnServers=[{credential:i.credential,urls:`turn:${i.domain}:${i.port}?transport=tcp`,username:i.username},{credential:i.credential,urls:`turn:${i.domain}:${i.port}?transport=udp`,username:i.username},{credential:i.credential,urls:`turns:${i.domain}:${i.port}?transport=tcp`,username:i.username}]),this._stunServers=[{urls:`stun:${r.domain}:${r.port}`}],log49.debug("[end] fetch iceParams",{turn:i,stun:r})}get iceServers(){let e=[...this._stunServers];const t=this._turnServers.filter((e=>{const t=e.urls;switch(this.context.config.rtcConfig.turnProtocol){case"all":return!0;case"udp":return t.endsWith("udp");case"tcp":return!t.startsWith("turns")&&t.endsWith("tcp");case"tls":return t.startsWith("turns")}}));return"disable"!==this.context.config.rtcConfig.turnPolicy&&(e=[...e,...t]),e}},import_common69=__toESM(require_dist()),import_signaling_client=__toESM(require_dist5()),import_token2=__toESM(require_dist4()),log50=new import_common69.Logger("packages/core/src/external/signaling.ts");async function setupSignalingSession(e,t,i){const{signalingService:r}=e.config,s=new import_signaling_client.SignalingClient({token:e.authTokenString,channelId:t.id,channelName:t.name,memberId:i.id,memberName:i.name},{logger:{error:async i=>{log50.error("SignalingClient error",createError({operationName:"SignalingClient.logger",context:e,info:{...errors.internal,detail:"signalingClient error"},error:i,path:log50.prefix,channel:t}))},debug:e=>{}},signalingServerDomain:r.domain,secure:r.secure}),n=new SignalingSession(s,e);return await n.connect(),n}var SignalingSession=class{constructor(e,t){this._client=e,this.context=t,this.onConnectionFailed=new import_common69.Event,this.onConnectionStateChanged=new import_common69.Event,this.onMessage=new import_common69.Event,this.closed=!1,this._chunkedMessageBuffer={},this._backoffUpdateSkyWayAuthToken=new import_common69.BackOff({times:8,interval:100,jitter:100}),this._disposer=new import_common69.EventDisposer,this._listen(),t._onTokenUpdated.add((async e=>{await this._updateSkyWayAuthToken(e)})).disposer(this._disposer)}updateClient(e){this._client=e,this._listen()}_listen(){this._client.onConnectionFailed.addOneTimeListener((()=>{this.onConnectionFailed.emit({})})),this._client.onConnectionStateChanged.addListener((e=>{log50.debug("signalingClient onConnectionStateChanged",e),this.onConnectionStateChanged.emit(e)})),this._client.onRequested.addListener((async({data:e,src:t,reply:i})=>{const r=e,{chunk:s,length:n,offset:a,id:o,type:c}=r;if(c===messageType){if(0===n)this.onMessage.emit({src:t,data:JSON.parse(s)});else if(this._chunkedMessageBuffer[o]=[...this._chunkedMessageBuffer[o]??[],r.chunk],n===a){const e=this._chunkedMessageBuffer[o].join("");delete this._chunkedMessageBuffer[o],this.onMessage.emit({src:t,data:JSON.parse(e)})}await i({}).catch((e=>{this.closed||log50.warn("failed to reply",createWarnPayload({operationName:"SignalingSession.reply",detail:"SignalingClient failed to reply"}),e)}))}}))}async _updateSkyWayAuthToken(e){if(this._backoffUpdateSkyWayAuthToken.exceeded)return void log50.error("[failed] updateSkyWayAuthToken");await this._backoffUpdateSkyWayAuthToken.wait(),log50.debug("[start] updateSkyWayAuthToken",{count:this._backoffUpdateSkyWayAuthToken.count});const t=await this._client.updateSkyWayAuthToken(e).catch((e=>e));if(t)return log50.warn("[retry] updateSkyWayAuthToken",createWarnPayload({operationName:"SignalingSession._updateSkyWayAuthToken",detail:"[retry] updateSkyWayAuthToken"}),t),void await this._updateSkyWayAuthToken(e);log50.debug("[end] updateSkyWayAuthToken"),this._backoffUpdateSkyWayAuthToken.reset()}get connectionState(){return this._client.connectionState}async connect(){log50.debug("[start] connect signalingService"),await this._client.connect().catch((e=>{throw createError({operationName:"signalingSession.connect",path:log50.prefix,info:{...errors.internal,detail:"signalingClient failed to connect Server"},context:this.context,error:e})})),log50.debug("[end] connect signalingService")}close(){this.closed=!0,this._disposer.dispose(),this._client.disconnect()}async send(e,t,i=1e4){try{const r=JSON.stringify(t),s=(0,import_token2.uuidV4)();if(r.length>20480){const t=r.match(/.{1,20480}/g)??[];let n=0;for(const r of t){const a={type:messageType,length:t.length-1,offset:n++,chunk:r,id:s};await this._client.request(e,a,i/1e3)}}else{const t={type:messageType,length:0,offset:0,chunk:r,id:s};await this._client.request(e,t,i/1e3)}}catch(i){if(this.closed||"joined"!==e.state)return;throw createError({operationName:"SignalingSession.send",context:this.context,info:{...errors.internal,detail:"signalingClient"},error:i,path:log50.prefix,payload:{target:e,data:t}})}}},messageType="signalingMessage",log51=new import_common70.Logger("packages/core/src/member/person/local/factory.ts");async function createLocalPerson(e,t,i,{keepaliveIntervalSec:r,keepaliveIntervalGapSec:s,preventAutoLeaveOnBeforeUnload:n,disableSignaling:a}={}){log51.debug("createLocalPerson",{channel:t,memberDto:i,keepaliveIntervalSec:r,keepaliveIntervalGapSec:s,preventAutoLeaveOnBeforeUnload:n});const{iceParamServer:o}=e.config,c=!0===a?void 0:await setupSignalingSession(e,t,i),l=new IceManager({...o,memberId:i.id,channelId:t.id,ttl:MaxIceParamServerTTL,context:e});await l.updateIceParams().catch((i=>{throw createError({operationName:"createLocalPerson",context:e,channel:t,info:{...errors.internal,detail:"updateIceParams failed"},path:log51.prefix,error:i})}));const u=await LocalPersonImpl.Create({iceManager:l,channel:t,signaling:c,analytics:e.analyticsSession,metadata:i.metadata,name:i.name,id:i.id,keepaliveIntervalSec:r,keepaliveIntervalGapSec:s,preventAutoLeaveOnBeforeUnload:n,context:e});for(const t of e.plugins)await(t._whenCreateLocalPerson?.(u)),u._onDisposed.once((async()=>{await(t._whenDisposeLocalPerson?.(u))}));return u}var log52=new import_common71.Logger("packages/core/src/member/localPerson/index.ts"),LocalPersonImpl=class e extends MemberImpl{constructor(e){super(e),this.args=e,this.type="person",this.subtype="person",this.side="local",this.keepaliveIntervalSec=this.args.keepaliveIntervalSec,this.keepaliveIntervalGapSec=this.args.keepaliveIntervalGapSec,this.preventAutoLeaveOnBeforeUnload=this.args.preventAutoLeaveOnBeforeUnload,this.disableSignaling=this.args.disableSignaling,this.disableAnalytics=this.args.disableAnalytics,this.config=this.context.config,this.onStreamPublished=this._events.make(),this.onStreamUnpublished=this._events.make(),this.onPublicationListChanged=this._events.make(),this.onPublicationSubscribed=this._events.make(),this.onPublicationUnsubscribed=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.onFatalError=this._events.make(),this._onStreamSubscribeFailed=this._events.make(),this._onDisposed=this._events.make(),this._disposer=new import_common71.EventDisposer,this._subscribing={},this._requestQueue=new import_common71.PromiseQueue,this.iceManager=this.args.iceManager,this._disposed=!1,this._publishingAgent=new PublishingAgent(this),this._subscribingAgent=new SubscribingAgent(this),this._signaling=e.signaling,this._analytics=e.analytics,this._listenChannelEvent(),this._listenBeforeUnload()}static async Create(...t){const i=new e(...t);return await i._setupTtlTimer(),i._analytics&&i._analytics.client.sendJoinReport({memberId:i.id}),i}_listenChannelEvent(){this.channel.onPublicationSubscribed.add((async({subscription:e})=>{await this._handleOnPublicationSubscribe(e).catch((e=>log52.error("_handleOnStreamSubscribe",e)))})).disposer(this._disposer),this.channel.onPublicationUnsubscribed.add((async({subscription:e})=>{await this._handleOnPublicationUnsubscribe(e).catch((e=>log52.error("_handleOnStreamUnsubscribe",e)))})).disposer(this._disposer),this.channel._onDisposed.once((()=>{this.dispose()})),this.onLeft.once((()=>{this.dispose()}))}async _setupTtlTimer(){const{keepaliveIntervalSec:e,keepaliveIntervalGapSec:t}=this;if(null==e)return;if(log52.debug("_setupTtlTimer",this.toJSON(),{keepaliveIntervalSec:e,keepaliveIntervalGapSec:t}),-1===e)return;const i=async()=>{if(this._disposed)return;const i=await this.context._api.getServerUnixtimeInSec();this.ttlSec=Math.floor(i+e+(t??0));try{await this.channel._updateMemberTtl(this.id,this.ttlSec),log52.debug("updateTtl",this.toJSON(),{now:i,ttlSec:this.ttlSec,keepaliveIntervalSec:e??0,keepaliveIntervalGapSec:t??0,diff:this.ttlSec-i})}catch(e){if(this._disposed)return;throw e}};await i(),this.ttlInterval=setInterval((async()=>{await i().catch((e=>{this._disposed||(this.onFatalError.emit(createError({operationName:"localPerson._setupTtlTimer",path:log52.prefix,info:{...errors.internal,detail:"updateMemberTtl failed"},channel:this.channel,context:this.context,error:e})),this.dispose())}))}),1e3*e)}_listenBeforeUnload(){}async _handleOnPublicationSubscribe(e){if(e.subscriber.id===this.id)try{const t=log52.info("[start] startSubscribing",await createLogPayload({operationName:"onPublicationSubscribed",channel:this.channel}),{subscription:e}),i=this._subscribing[e.publication.id]?.options;i&&(e.preferredEncoding=i.preferredEncodingId),await this._subscribingAgent.startSubscribing(e),this.onPublicationSubscribed.emit({subscription:e,stream:e.stream}),this.onSubscriptionListChanged.emit(),log52.elapsed(t,"[end] startSubscribing",await createLogPayload({operationName:"onPublicationSubscribed",channel:this.channel}),{subscription:e})}catch(t){throw this._onStreamSubscribeFailed.emit({error:t,subscription:e}),t}if(e.publication.publisher.id===this.id){if(e.subscriber.id===this.id)throw createError({operationName:"localPerson._handleOnStreamSubscribe",path:log52.prefix,info:{...errors.internal,detail:"can not subscribe own Publication"},channel:this.channel,context:this.context});const t=log52.info("[start] startPublishing",await createLogPayload({operationName:"onPublicationSubscribed",channel:this.channel}),{subscription:e});await this._publishingAgent.startPublishing(e).catch((t=>{throw log52.error("[failed] startPublishing",t,{subscription:e}),t})),log52.elapsed(t,"[end] startPublishing",await createLogPayload({operationName:"onPublicationSubscribed",channel:this.channel}),{subscription:e})}}async _handleOnPublicationUnsubscribe(e){if(e.publication.publisher.id===this.id){const t=log52.info("[start] stopPublishing",await createLogPayload({operationName:"onPublicationUnsubscribed",channel:this.channel}),{subscription:e});await this._publishingAgent.stopPublishing(e.publication,e.subscriber).catch((t=>{throw log52.error("[failed] stopPublishing",t,{subscription:e}),t})),log52.elapsed(t,"[end] stopPublishing",await createLogPayload({operationName:"onPublicationUnsubscribed",channel:this.channel}),{subscription:e})}if(e.subscriber.id===this.id){const t=log52.info("[start] stopSubscribing",await createLogPayload({operationName:"onPublicationUnsubscribed",channel:this.channel}),{subscription:e});await this._subscribingAgent.stopSubscribing(e).catch((t=>{throw log52.error("[failed] stopSubscribing",{subscription:e},t),t})),this.onPublicationUnsubscribed.emit({subscription:e}),this.onSubscriptionListChanged.emit(),log52.elapsed(t,"[end] stopSubscribing",await createLogPayload({operationName:"onPublicationUnsubscribed",channel:this.channel}),{subscription:e})}}async publish(e,t={}){const i=log52.info("[start] publish",await createLogPayload({operationName:"localPerson.publish",channel:this.channel}),{options:t});if("joined"!==this.state)throw createError({operationName:"localPerson.publish",info:errors.localPersonNotJoinedChannel,path:log52.prefix,channel:this.channel,context:this.context});if(e.published)throw createError({operationName:"localPerson.publish",channel:this.channel,context:this.context,info:errors.alreadyPublishedStream,path:log52.prefix});e.published=!0,t.codecCapabilities&&(t.codecCapabilities=t.codecCapabilities.filter((e=>null!=e)));const r={metadata:t.metadata,publisher:this.id,channel:this.channel.id,contentType:e.contentType,codecCapabilities:t.codecCapabilities??[],isEnabled:t.isEnabled};"data"!==e.contentType&&0===r.codecCapabilities.length&&(r.codecCapabilities=this.context.config.codecCapabilities.filter((e=>"audio"===r.contentType?e.mimeType.toLowerCase().startsWith("audio/"):e.mimeType.toLowerCase().startsWith("video/")))),"video"===e.contentType&&0===r.codecCapabilities.length&&(r.codecCapabilities=[{mimeType:"video/vp8"}]),t.encodings&&t.encodings.length>0&&(r.encodings=normalizeEncodings(sortEncodingParameters(t.encodings)));const s=await this._requestQueue.push((()=>this.channel._publish(r).catch((e=>{throw createError({operationName:"localPerson.publish",context:this.context,channel:this.channel,info:e.info,path:log52.prefix,error:e})}))));"data"===e.contentType?e.setIsEnabled(s.isEnabled):await e.setEnabled(s.isEnabled);const n=this.channel._addPublication(s);if(n._setStream(e),r.codecCapabilities?.length&&n.setCodecCapabilities(r.codecCapabilities),r.encodings?.length&&n.setEncodings(r.encodings),await this._handleOnStreamPublish(n),log52.elapsed(i,"[end] publish",await createLogPayload({operationName:"localPerson.publish",channel:this.channel}),{publication:n}),["video","audio"].includes(n.contentType)&&this._analytics&&!this._analytics.isClosed()){this._analytics.client.sendMediaDeviceReport({publicationId:n.id,mediaDeviceName:n.deviceName,mediaDeviceTrigger:"publish",updatedAt:Date.now()});const e=r.encodings??[];this._analytics.client.sendPublicationUpdateEncodingsReport({publicationId:n.id,encodings:e,updatedAt:Date.now()})}return n}async _handleOnStreamPublish(e){log52.info("onStreamPublished",await createLogPayload({operationName:"onStreamPublished",channel:this.channel})),this.onStreamPublished.emit({publication:e}),this.onPublicationListChanged.emit()}async unpublish(e){const t=log52.info("[start] unpublish",await createLogPayload({operationName:"localPerson.unpublish",channel:this.channel})),i="string"==typeof e?e:e.id;if("joined"!==this.state)throw createError({operationName:"localPerson.unpublish",info:errors.localPersonNotJoinedChannel,path:log52.prefix,context:this.context,channel:this.channel});const r=this.channel._getPublication(i);if(!r)throw createError({operationName:"localPerson.unpublish",info:errors.publicationNotExist,path:log52.prefix,context:this.context,channel:this.channel,payload:{publicationId:i}});r.stream&&r.stream._unpublished(),await this._requestQueue.push((()=>this.channel._unpublish(i))),r.subscriptions.map((e=>e.subscriber)).forEach((e=>{isRemoteMember(e)&&this._publishingAgent.stopPublishing(r,e).catch((e=>{log52.error("[failed] stopPublishing",e,{publication:r})}))})),await this._handleOnStreamUnpublished(r),log52.elapsed(t,"[end] unpublish",await createLogPayload({operationName:"localPerson.unpublish",channel:this.channel}),{publication:r})}async _handleOnStreamUnpublished(e){log52.info("onStreamUnpublished",await createLogPayload({operationName:"onStreamUnpublished",channel:this.channel})),this.onStreamUnpublished.emit({publication:e}),this.onPublicationListChanged.emit()}async subscribe(e,t={}){const i=log52.info("[start] subscribe",await createLogPayload({operationName:"localPerson.subscribe",channel:this.channel}),{target:e}),r="string"==typeof e?e:e.id;if("joined"!==this.state)throw createError({operationName:"localPerson.subscribe",info:errors.localPersonNotJoinedChannel,path:log52.prefix,context:this.context,channel:this.channel,payload:{target:e}});const s=this.channel._getPublication(r);if(null==s)throw createError({operationName:"localPerson.subscribe",info:errors.publicationNotExist,path:log52.prefix,context:this.context,channel:this.channel,payload:s});this._validatePublicationForSubscribe(s),this._subscribing[s.id]={options:t,processing:!0};const n=this._subscribing[s.id];try{const e=await this._requestQueue.push((()=>this.channel._subscribe(this.id,r)));log52.elapsed(i,"[elapsed] subscribe / subscriptionDto received",{subscriptionDto:e});const t=this.channel._addSubscription(e);return t.stream||await Promise.race([new Promise(((e,i)=>{this.onPublicationSubscribed.watch((({subscription:e})=>e.publication.id===r),this.context.config.rtcApi.timeout).then(e).catch((async e=>{n.processing&&i(createError({operationName:"localPerson.subscribe",info:{...errors.timeout,detail:"failed to subscribe publication. maybe publisher already left room"},path:log52.prefix,context:this.context,channel:this.channel,payload:{subscription:t,publication:s},error:e}))}))})),new Promise(((e,i)=>{this.channel.onMemberLeft.watch((e=>e.member.id===s.publisher.id),this.context.config.rtcApi.timeout+1e3).then((()=>{n.processing&&i(createError({operationName:"localPerson.subscribe",info:{...errors.internal,detail:"failed to subscribe publication. publisher already left room"},path:log52.prefix,context:this.context,channel:this.channel,payload:{subscription:t,publication:s}}))})).catch(e)})),new Promise(((e,i)=>{this._onStreamSubscribeFailed.watch((e=>e.subscription.publication.id===s.id),this.context.config.rtcApi.timeout+1e3).then((e=>{if(n.processing){const r=e?.error?.info??{...errors.internal,detail:"subscribe _onStreamSubscribeFailed"};i(createError({operationName:"localPerson.subscribe",info:r,path:log52.prefix,context:this.context,channel:this.channel,error:e.error,payload:{subscription:t,publication:s}}))}})).catch(e)}))]),n.processing=!1,log52.elapsed(i,"[end] subscribe",await createLogPayload({operationName:"localPerson.subscribe",channel:this.channel}),{subscription:t,publication:s}),{subscription:t,stream:t.stream}}catch(e){throw n.processing=!1,log52.warn("[failed] subscribe",e,{publication:s}),e}}_validatePublicationForSubscribe(e){if(e.publisher.id===this.id)throw createError({operationName:"localPerson._validatePublicationForSubscribe",info:errors.publicationNotExist,path:log52.prefix,context:this.context,channel:this.channel,payload:{publication:e}});if(e.publisher instanceof UnknownMemberImpl)throw createError({operationName:"localPerson._validatePublicationForSubscribe",info:errors.unknownMemberType,path:log52.prefix,context:this.context,channel:this.channel,payload:{publication:e}});if(this.subscriptions.find((t=>t.publication.id===e.id)))throw createError({operationName:"localPerson._validatePublicationForSubscribe",info:errors.alreadySubscribedPublication,path:log52.prefix,context:this.context,channel:this.channel,payload:{publication:e}})}async unsubscribe(e){const t=log52.info("[start] unsubscribe",await createLogPayload({operationName:"localPerson.unsubscribe",channel:this.channel})),i="string"==typeof e?e:e.id;if("joined"!==this.state)throw createError({operationName:"localPerson.unsubscribe",info:errors.localPersonNotJoinedChannel,path:log52.prefix,context:this.context,channel:this.channel});const r=this.subscriptions.find((e=>e.id===i));if(!r)throw createError({operationName:"localPerson.unsubscribe",info:errors.subscriptionNotExist,path:log52.prefix,context:this.context,channel:this.channel,payload:{subscriptionId:i}});delete this._subscribing[r.publication.id],await this._requestQueue.push((()=>this.channel._unsubscribe(i))),log52.elapsed(t,"[end] unsubscribe",await createLogPayload({operationName:"localPerson.unsubscribe",channel:this.channel}),{subscription:r})}_getConnections(){return this.channel.members.map((e=>e._getConnection(this.id))).filter((e=>!1===e?.closed))}dispose(){this._disposed||(this._disposed=!0,log52.debug("disposed",this.toJSON()),clearInterval(this.ttlInterval),this._signaling&&this._signaling.close(),this._analytics&&this._analytics.close(),this._getConnections().forEach((e=>e.close({reason:"localPerson disposed"}))),this._onDisposed.emit(),this._events.dispose(),this._disposer.dispose())}},import_common72=__toESM(require_dist()),import_common73=__toESM(require_dist()),log53=new import_common72.Logger("packages/core/src/subscription/index.ts"),SubscriptionImpl=class{constructor(e){this._disposer=new import_common72.EventDisposer,this._state="enabled",this.onCanceled=new import_common73.Event,this.onStreamAttached=new import_common73.Event,this.onConnectionStateChanged=new import_common73.Event,this._onChangeEncoding=new import_common73.Event,this.cancel=()=>new Promise(((e,t)=>{let i=!1;this._channel._unsubscribe(this.id).catch((e=>{i=!0,t(e)})),this.onCanceled.asPromise(this._context.config.rtcApi.timeout).then((()=>e())).catch((e=>{i||t(e)}))})),this._channel=e.channel,this._context=this._channel._context,this.id=e.id,this.contentType=e.contentType,this.subscriber=e.subscriber,this.publication=e.publication,log53.debug("subscription spawned",this.toJSON()),this._handlePublicationEnabled()}get state(){return this._state}_handlePublicationEnabled(){this.publication.onDisabled.add((()=>{this.stream&&(log53.debug("disabled",this),this.stream.setIsEnabled(!1))})).disposer(this._disposer),this.publication.onEnabled.add((()=>{this.stream&&(log53.debug("enabled",this),this.stream.setIsEnabled(!0))})).disposer(this._disposer),this.stream&&this.stream.setIsEnabled("enabled"===this.publication.state)}_setStream(e){this._stream=e,this.onStreamAttached.emit(),e._onConnectionStateChanged.add((e=>{log53.debug("onConnectionStateChanged",this.id,e),this.onConnectionStateChanged.emit(e)}))}get stream(){return this._stream}toJSON(){return{id:this.id,contentType:this.contentType,subscriber:this.subscriber,publication:this.publication,channelId:this._channel.id,state:this.state,stream:this.stream}}_canceled(){this._state="canceled",this.onCanceled.emit(),this._disposer.dispose()}changePreferredEncoding(e){if(!this.stream)throw createError({operationName:"SubscriptionImpl.changePreferredEncoding",info:errors.streamNotExistInSubscription,path:log53.prefix,context:this._context,channel:this._channel});if("data"===this.stream.contentType)throw createError({operationName:"SubscriptionImpl.changePreferredEncoding",info:errors.dataStreamNotSupportEncoding,path:log53.prefix,context:this._context,channel:this._channel});if(!this.publication.encodings.map((e=>e.id)).includes(e))throw createError({operationName:"SubscriptionImpl.changePreferredEncoding",info:errors.correspondingEncodeNotExistForId,path:log53.prefix,context:this._context,channel:this._channel});this.preferredEncoding=e,this._onChangeEncoding.emit()}getStats(){if(!this.stream)throw createError({operationName:"SubscriptionImpl.getStats",info:errors.streamNotExistInSubscription,path:log53.prefix,context:this._context,channel:this._channel});return this.stream._getStats()}getRTCPeerConnection(){if(!this.stream)throw createError({operationName:"SubscriptionImpl.getRTCPeerConnection",info:errors.streamNotExistInSubscription,path:log53.prefix,context:this._context,channel:this._channel});return this.stream._getRTCPeerConnection()}getConnectionState(){if(!this.stream)throw createError({operationName:"SubscriptionImpl.getConnectionState",info:errors.streamNotExistInSubscription,path:log53.prefix,context:this._context,channel:this._channel});return this.stream._getConnectionState()}};function createSubscription(e,{subscriberId:t,publicationId:i,id:r}){const s=e._getSubscription(r);if(s)return s;const n=e._getPublication(i).contentType;return new SubscriptionImpl({channel:e,id:r,subscriber:e._getMember(t),publication:e._getPublication(i),contentType:n})}var log54=new import_common74.Logger("packages/core/src/channel/index.ts"),SkyWayChannelImpl=class{constructor(e,t){this._context=e,this._channelImpl=t,this.id=this._channelImpl.id,this.name=this._channelImpl.name,this.appId=this._context.appId,this.disposed=!1,this.config=this._context.config,this._state="opened",this._api=this._context._api,this._members={},this._getMember=e=>this._members[e],this._publications={},this._getPublication=e=>this._publications[e],this._subscriptions={},this._getSubscription=e=>this._subscriptions[e],this._events=new import_common75.Events,this.onClosed=this._events.make(),this.onMetadataUpdated=this._events.make(),this.onMemberListChanged=this._events.make(),this.onMemberJoined=this._events.make(),this.onMemberLeft=this._events.make(),this.onMemberMetadataUpdated=this._events.make(),this.onPublicationListChanged=this._events.make(),this.onStreamPublished=this._events.make(),this.onStreamUnpublished=this._events.make(),this.onPublicationMetadataUpdated=this._events.make(),this.onPublicationEnabled=this._events.make(),this.onPublicationDisabled=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.onPublicationSubscribed=this._events.make(),this.onPublicationUnsubscribed=this._events.make(),this._onDisposed=this._events.make(),this.leave=async e=>this._channelImpl.leave(this.id,e.id),this.updateMetadata=e=>this._channelImpl.updateChannelMetadata(e),this.close=()=>new Promise((async(e,t)=>{if("closed"===this.state)return void t(createError({operationName:"SkyWayChannelImpl.close",path:log54.prefix,info:errors.alreadyChannelClosed,channel:this,context:this._context,payload:this.toJSON()}));const i=log54.info("[start] close channel",await createLogPayload({operationName:"SkyWayChannelImpl.close",channel:this}));try{await this._channelImpl.close().catch((e=>{throw createError({operationName:"SkyWayChannelImpl.close",context:this._context,info:{...errors.internal,detail:"_api.deleteChannel failed"},error:e,path:log54.prefix,channel:this})})),"closed"!==this._state&&await this.onClosed.asPromise(this._context.config.rtcApi.timeout).catch((e=>{throw createError({operationName:"SkyWayChannelImpl.close",context:this._context,info:{...errors.timeout,detail:"channel.onClosed"},error:e,path:log54.prefix,channel:this})}))}catch(e){log54.error(e.message,e),t(e)}log54.elapsed(i,"[end] close channel",await createLogPayload({operationName:"SkyWayChannelImpl.close",channel:this})),e()})),this._updateMemberTtl=(e,t)=>this._channelImpl.updateMemberTtl(e,t),this._updateMemberMetadata=(e,t)=>this._channelImpl.updateMemberMetadata(e,t),this._publish=e=>this._channelImpl.publish(e),this._unpublish=async e=>this._channelImpl.unpublish(e),this._subscribe=(e,t)=>{const i=this._getPublication(t),r=this._getMember(e);if(null==r)throw createError({operationName:"SkyWayChannelImpl._subscribe",path:log54.prefix,info:{...errors.internal,detail:"subscriber not found"},channel:this,context:this._context,payload:{subscriberId:e,publicationId:t}});return this._channelImpl.subscribe({publication:i.toJSON(),subscriber:r.toJSON()})},this._unsubscribe=async e=>{if(!this._getSubscription(e))throw createError({operationName:"SkyWayChannelImpl._unsubscribe",path:log54.prefix,info:{...errors.internal,detail:"can't unsubscribe not exist subscription"},channel:this,context:this._context,payload:{subscriptionId:e}});await this._channelImpl.unsubscribe(e)},this._updatePublicationMetadata=(e,t)=>this._channelImpl.updatePublicationMetadata(e,t),this._disablePublication=e=>this._channelImpl.disablePublication(e),this._enablePublication=e=>this._channelImpl.enablePublication(e),this._setupPropertiesFromChannel(),this._setupListenChannelEvent(),e._onDisposed.once((()=>{this.dispose()})),log54.debug("channel spawned",this.toJSON())}_addMember(e){const t=this._getMember(e.id);if(t)return t;const i=this._context._createRemoteMember(this,e);return this._members[i.id]=i,i}_removeMember(e){delete this._members[e]}_addPublication(e){const t=this._getPublication(e.id);if(t)return t;const i=createPublication(this,e);return this._publications[e.id]=i,i}_removePublication(e){delete this._publications[e]}_addSubscription(e){const t=this._getSubscription(e.id);if(t)return t;const i=createSubscription(this,e);return this._subscriptions[e.id]=i,i}_removeSubscription(e){delete this._subscriptions[e]}get localPerson(){return this._localPerson}get members(){return Object.values(this._members)}get bots(){return this.members.filter((e=>"bot"===e.type))}get publications(){return Object.values(this._publications)}get subscriptions(){return Object.values(this._subscriptions)}get metadata(){return this._channelImpl.metadata}get state(){return this._state}toJSON(){return{id:this.id,name:this.name,appId:this.appId,metadata:this.metadata,members:this.members,publications:this.publications,subscriptions:this.subscriptions}}_setupPropertiesFromChannel(){this._channelImpl.members.forEach((e=>{this._addMember(e)})),this._channelImpl.publications.forEach((e=>{this._addPublication(e)})),this._channelImpl.subscriptions.forEach((e=>{this._addSubscription(e)}))}_setupListenChannelEvent(){this._channelImpl.onClosed.add((()=>this._handleOnChannelClose())),this._channelImpl.onMetadataUpdated.add((({channel:e})=>this._handleOnChannelMetadataUpdate(e.metadata))),this._channelImpl.onMemberJoined.add((({member:e})=>{this._handleOnMemberJoin(e)})),this._channelImpl.onMemberLeft.add((({member:e})=>{this._handleOnMemberLeft(e)})),this._channelImpl.onMemberListChanged.pipe(this.onMemberListChanged),this._channelImpl.onMemberMetadataUpdated.add((({member:e})=>{this._handleOnMemberMetadataUpdate(e,e.metadata)})),this._channelImpl.onStreamPublished.add((({publication:e})=>{this._handleOnStreamPublish(e)})),this._channelImpl.onStreamUnpublished.add((({publication:e})=>{this._handleOnStreamUnpublish(e)})),this._channelImpl.onPublicationListChanged.pipe(this.onPublicationListChanged),this._channelImpl.onPublicationMetadataUpdated.add((({publication:e})=>{this._handleOnPublicationMetadataUpdate(e,e.metadata)})),this._channelImpl.onPublicationEnabled.add((async({publication:e})=>await this._handleOnPublicationEnabled(e))),this._channelImpl.onPublicationDisabled.add((async({publication:e})=>await this._handleOnPublicationDisabled(e))),this._channelImpl.onPublicationSubscribed.add((({subscription:e})=>{this._handleOnStreamSubscribe(e)})),this._channelImpl.onPublicationUnsubscribed.add((({subscription:e})=>{this._handleOnStreamUnsubscribe(e)})),this._channelImpl.onSubscriptionListChanged.pipe(this.onSubscriptionListChanged)}_handleOnChannelClose(){this._state="closed",this.onClosed.emit({}),this.dispose()}_handleOnChannelMetadataUpdate(e){this.onMetadataUpdated.emit({metadata:e})}_handleOnMemberJoin(e){const t=this._addMember(e);this.onMemberJoined.emit({member:t})}_handleOnMemberLeft(e){const t=this._getMember(e.id);this._removeMember(t.id),t._left(),this.localPerson?.id===e.id&&(this.localPerson._left(),this._localPerson=void 0),this.onMemberLeft.emit({member:t})}_handleOnMemberMetadataUpdate(e,t){const i=this._getMember(e.id);i._metadataUpdated(t),this.localPerson?.id===e.id&&this.localPerson._metadataUpdated(t),this.onMemberMetadataUpdated.emit({member:i,metadata:t})}_handleOnStreamPublish(e){const t=this._addPublication(e);this.onStreamPublished.emit({publication:t})}_handleOnStreamUnpublish(e){const t=this._getPublication(e.id);this._removePublication(t.id),t._unpublished(),this.onStreamUnpublished.emit({publication:t})}_handleOnPublicationMetadataUpdate(e,t){const i=this._getPublication(e.id);i._updateMetadata(t),this.onPublicationMetadataUpdated.emit({publication:i,metadata:t})}async _handleOnPublicationEnabled(e){const t=this._getPublication(e.id);t._enable(),this.onPublicationEnabled.emit({publication:t})}async _handleOnPublicationDisabled(e){const t=this._getPublication(e.id);await t._disable(),this.onPublicationDisabled.emit({publication:t})}_handleOnStreamSubscribe(e){const t=this._addSubscription(e);this._getPublication(t.publication.id)._subscribed(t),this.onPublicationSubscribed.emit({subscription:t})}_handleOnStreamUnsubscribe(e){const t=this._getSubscription(e.id);this._removeSubscription(t.id),t._canceled();this._getPublication(t.publication.id)._unsubscribed(t),this.onPublicationUnsubscribed.emit({subscription:t})}async join(e={}){const t=log54.info("[start] join",await createLogPayload({operationName:"SkyWayChannelImpl.join",channel:this}));if(this._localPerson)throw createError({operationName:"SkyWayChannelImpl.join",path:log54.prefix,info:errors.alreadyLocalPersonExist,channel:this,context:this._context});if(null!=e.name){if(this.members.find((t=>t.name===e.name)))throw createError({operationName:"SkyWayChannelImpl.join",path:log54.prefix,info:errors.alreadySameNameMemberExist,channel:this,context:this._context,payload:e})}e.keepaliveIntervalSec??(e.keepaliveIntervalSec=this.config.member.keepaliveIntervalSec),e.keepaliveIntervalGapSec??(e.keepaliveIntervalGapSec=this.config.member.keepaliveIntervalGapSec),e.preventAutoLeaveOnBeforeUnload??(e.preventAutoLeaveOnBeforeUnload=this.config.member.preventAutoLeaveOnBeforeUnload);const i={...e,type:"person",subtype:"person"};null!==e.keepaliveIntervalSec&&(i.ttlSec=await this._context._api.getServerUnixtimeInSec()+e.keepaliveIntervalSec);const r=await this._channelImpl.joinChannel(i).catch((e=>{throw log54.error("[failed] join",e),e}));log54.elapsed(t,"[elapsed] join / channelImpl.joinChannel",{member:r});const s=await this._createLocalPerson(r,e),n=new LocalPersonAdapter(s);return log54.elapsed(t,"[end] join",{person:s}),n}async moveChannel(e){if(this._localPerson)throw createError({operationName:"SkyWayChannelImpl.moveChannel",path:log54.prefix,info:errors.alreadyLocalPersonExist,channel:this,context:this._context});if(!(e instanceof LocalPersonAdapter))throw createError({operationName:"SkyWayChannelImpl.moveChannel",path:log54.prefix,info:errors.invalidArgumentValue,channel:this,context:this._context});const t=e.channel;if(this.id===t.id)throw createError({operationName:"SkyWayChannelImpl.moveChannel",path:log54.prefix,info:errors.cantMoveSameIdChannel,channel:this,context:this._context});await t.leave(e);const i={name:e.name,type:e.type,subtype:e.subtype,metadata:e.metadata};null!=e.keepaliveIntervalSec&&(i.ttlSec=await this._context._api.getServerUnixtimeInSec()+e.keepaliveIntervalSec);const r=await this._channelImpl.joinChannel(i),s=await this._createLocalPerson(r,{keepaliveIntervalSec:e.keepaliveIntervalSec,keepaliveIntervalGapSec:e.keepaliveIntervalGapSec,disableSignaling:e.disableSignaling,disableAnalytics:e.disableAnalytics});e.apply(s)}async _createLocalPerson(e,t){const i=await createLocalPerson(this._context,this,e,t);return this._localPerson=i,i}dispose(){this.disposed||(this.disposed=!0,log54.debug("disposed",this.toJSON()),this._channelImpl.dispose(),this._onDisposed.emit(),this._events.dispose())}},SkyWayChannel=class{static async Create(e,t={}){const i=log54.info("[start] createChannel",{operationName:"SkyWayChannel.Create"}),r=await e._api.createChannel(t).catch((e=>{throw log54.error("[failed] createChannel",e),e})),s=new SkyWayChannelImpl(e,r);return log54.elapsed(i,"[end] createChannel"),s}static async Find(e,t){const i=log54.info("[start] findChannel",{operationName:"SkyWayChannel.Find"}),r=await e._api.findChannel(t).catch((e=>{throw log54.error("[failed] findChannel",e),e})),s=new SkyWayChannelImpl(e,r);return log54.elapsed(i,"[end] findChannel"),s}static async FindOrCreate(e,t){const i=log54.info("[start] findOrCreateChannel",{operationName:"SkyWayChannel.FindOrCreate"}),r=await e._api.findOrCreateChannel(t).catch((e=>{throw log54.error("[failed] findOrCreateChannel",e),e})),s=new SkyWayChannelImpl(e,r);return log54.elapsed(i,"[end] findOrCreateChannel"),s}constructor(){}},import_deepmerge2=__toESM(require_cjs13()),import_common82=__toESM(require_dist()),import_common83=__toESM(require_dist()),import_deepmerge=__toESM(require_cjs13()),import_common78=__toESM(require_dist()),defaultDomain="rtc-api.skyway.ntt.com",rpcTimeout=2e4,MaxRetry=8,errors2={timeout:{name:"timeout",detail:"",solution:""},internalError:{name:"internalError",detail:"",solution:""},invalidParameter:{name:"invalidParameter",detail:"",solution:""},connectionDisconnected:{name:"connectionDisconnected",detail:"",solution:""},websocketConnectionFailure:{name:"connectionFailure",detail:"サーバへの接続に失敗しました",solution:"ネットワーク接続状況およびフリープランをご利用の場合はリソース利用量を確認してください"},rpcResponseError:{name:"rpcResponseError",detail:"",solution:"",error:{}},onClosedWhileRequesting:{name:"onClosedWhileRequesting",detail:"request中にクライアントが終了されました",solution:"リクエストの完了を確認してからクライアントを終了させてください"},failedToConnectRtcAPI:{name:"failedToConnectRtcAPI",detail:"rtc-api serverへの接続に失敗しました",solution:"インターネット接続状況とTokenの内容が正しいか、またフリープランをご利用の場合はリソース利用量を確かめてください"},failedToUpdateMemberTTL:{name:"failedToUpdateMemberTTL",detail:"updateMemberTTLを再試行しましたが、失敗しました",solution:"インターネット接続状況を確認してください"}},import_common77=__toESM(require_dist()),import_isomorphic_ws=__toESM(require_node5());init_esm_node2();var import_common76=__toESM(require_dist());function createError2({operationName:e,info:t,error:i,path:r,payload:s,channelId:n,appId:a,memberId:o}){return new import_common76.SkyWayError({error:i,info:t,payload:{payload:s,operationName:e,channelId:n,appId:a,memberId:o},path:r})}function createWarnPayload2({appId:e,detail:t,channelId:i,operationName:r,payload:s,memberId:n}){return{operationName:r,payload:s,detail:t,appId:e,channelId:i,memberId:n}}var log55=new import_common77.Logger("packages/rtc-rpc-api-client/src/rpc.ts"),WS_CLOSE_CODE_USAGE_LIMIT_EXCEEDED=4291,RPC=class{constructor(){this._id=v4_default2(),this.closed=!1,this.negotiated=!1,this._reconnecting=!1,this._pendingRequests=[],this._events=new import_common77.Events,this._onMessage=this._events.make(),this.onNotify=this._events.make(),this.onFatalError=this._events.make(),this.onDisconnected=this._events.make(),this.onClosed=this._events.make(),this._send=e=>new Promise((async(t,i)=>{await new Promise((e=>setTimeout(e,0))),this._ws.readyState===this._ws.OPEN?(this._ws.send(JSON.stringify(e),(e=>{if(e)throw i(createError2({operationName:"RPC._send",info:{...errors2.internalError,detail:"failed to send rpc message"},path:log55.prefix,error:e}))})),t()):i(createError2({operationName:"RPC._send",info:{...errors2.internalError,detail:"wrong state"},path:log55.prefix,payload:{request:e,wsReadyState:wsStates[this._ws.readyState]}}))}))}set reconnecting(e){this._reconnecting=e}get reconnecting(){return this._reconnecting}async connect({domain:e,token:t,secure:i}){const r=t;this._ws=new import_isomorphic_ws.default(`${i?"wss":"ws"}://${e}/ws`,r),this._ws.onmessage=e=>{this._onMessage.emit(JSON.parse(e.data))},this._ws.onclose=async e=>{log55.debug("websocket closed",{id:this._id,code:e.code,reason:e.reason}),e.code===WS_CLOSE_CODE_USAGE_LIMIT_EXCEEDED?this.close():this.onDisconnected.emit()},this._onMessage.add((e=>{isNotifyMessage(e)&&this.onNotify.emit(e)}));const s=await new Promise(((e,t)=>{const i=setTimeout((()=>{t(createError2({operationName:"RPC.connect",info:{...errors2.timeout,detail:"ws.open"},path:log55.prefix}))}),1e4);this._ws.onerror=e=>{t(createError2({operationName:"RPC.connect",info:errors2.websocketConnectionFailure,path:log55.prefix,error:e}))},this._ws.onopen=()=>{clearTimeout(i),e()}})).catch((e=>e));if(s)throw s;this.negotiated=!0}close(){this.closed||(this.closed=!0,log55.debug("closed"),this._ws.close(),this.onClosed.emit(),this._events.dispose())}resolvePendingRequests(){log55.debug("resolve pendingRequests",[...this._pendingRequests]),this._pendingRequests.forEach((async e=>{await this._send(e)})),this._pendingRequests=[]}async request(e,t){if(this.closed)throw createError2({operationName:"RPC.request",info:{...errors2.internalError,detail:"rpc closed"},path:log55.prefix,payload:{method:e,params:t,id:this._id}});let i=!1;try{const r=buildRequest(e,t),s=async()=>await this._onMessage.watch((e=>e.id===r.id),rpcTimeout).catch((()=>{if(!i)throw createError2({operationName:"RPC.request",info:{...errors2.timeout,detail:"rpc request timeout"},path:log55.prefix,payload:{rpcTimeout:rpcTimeout,method:e,params:t,wsReadyState:wsStates[this._ws.readyState],id:this._id}})})),n=async()=>{log55.warn("[start] reconnecting. pending request",createWarnPayload2({operationName:"RPC.request",detail:"[start] reconnecting. pending request",payload:{request:r,id:this._id}})),this._pendingRequests.push(r);const e=await Promise.race([s(),this.onFatalError.asPromise(rpcTimeout+100).then((e=>{throw i||log55.error("[failed] reconnecting. pending request",createError2({operationName:"RPC.request",info:{...errors2.internalError,detail:"onFatalError while request"},path:log55.prefix}),e),e}))]);return i=!0,log55.warn("[end] reconnecting. pending request",createWarnPayload2({operationName:"RPC.request",detail:"[end] reconnecting. pending request",payload:{request:r,id:this._id}})),e};let a;if(this._reconnecting?a=await n():(this._send(r).catch((e=>{log55.error("send error",e)})),a=await Promise.race([s(),(async()=>{const e=await this.onDisconnected.asPromise(rpcTimeout+100).catch((e=>e));if((i||this.closed)&&e)return{};try{const e=await n();return log55.warn(createWarnPayload2({operationName:"request.pendingRequest",detail:"success to handle disconnected"})),e}catch(e){throw createError2({operationName:"RPC.request",info:errors2.connectionDisconnected,path:log55.prefix,error:e})}})(),this.onFatalError.asPromise(rpcTimeout+100).then((e=>{if(i||this.closed)return{};throw createError2({operationName:"RPC.request",info:{...errors2.internalError,detail:"onFatalError while requesting"},path:log55.prefix,error:e})})).catch((()=>{if(i||this.closed)return{}})),this.onClosed.asPromise(rpcTimeout+100).then((()=>{if(i||this.closed)return{};throw createError2({operationName:"RPC.request",info:errors2.onClosedWhileRequesting,path:log55.prefix,payload:{method:e,params:t}})})).catch((()=>{if(i||this.closed)return{}}))]),i=!0),a.error)throw log55.warn("[failed] request ",{message:a,method:e,params:t}),createError2({operationName:"RPC.request",info:{...errors2.rpcResponseError,detail:e,error:a.error},payload:{message:a,method:e,params:t},path:log55.prefix});return a.result}catch(e){throw i=!0,e}}async notify(e,t){const i=buildRequest(e,t,!0);await this._send(i)}async batch(e){const t=e.map((({method:e,params:t})=>buildRequest(e,t)));this._send(t).catch((e=>{throw e}));return await Promise.all(t.map((async({id:e})=>await this._onMessage.watch((t=>t.id===e),rpcTimeout))))}},buildRequest=(e,t,i)=>{if(i)return{jsonrpc:"2.0",method:e,params:t};return{jsonrpc:"2.0",method:e,params:t,id:v4_default2()}},isNotifyMessage=e=>{const t=e;return!(!t.method||null!=t.id)},wsStates=["CONNECTING","OPEN","CLOSING","CLOSED"],log56=new import_common78.Logger("packages/rtc-rpc-api-client/src/client.ts"),RtcRpcApiClient=class{constructor(e){this.config=e,this.closed=!1,this._domain=this.config.domain??defaultDomain,this._secure=this.config.secure??!0,this._token=this.config.token,this._rpc=new RPC,this._subscribingChannelEvents=new Set,this._subscribingChannelVersions={},this._httpClient=new import_common78.HttpClient(`http${this.config.secure?"s":""}://${this.config.domain}`),this._reconnectCount=0,this._reconnectLimit=MaxRetry,this._events=new import_common78.Events,this.onEvent=this._events.make(),this.onFatalError=this._events.make(),this.onClose=this._events.make(),this.onReconnected=this._events.make(),import_common78.Logger.level=e.log?.level??import_common78.Logger.level,import_common78.Logger.format=e.log?.format??import_common78.Logger.format,log56.debug("RtcRpcApiClient spawned",e),this._rpc.onNotify.add((e=>{if("channelEventNotification"===e.method){const t=e.params;this._subscribingChannelVersions[t.data.channel.id]=t.data.channel.version,this.onEvent.emit({channelId:t.data.channel.id,event:t})}})),this._rpc.onDisconnected.add((async()=>{!this._rpc.negotiated||this._rpc.closed||this._rpc.reconnecting||await this._reconnect()})),this._rpc.onFatalError.once((e=>{log56.error("fatal error",e),this.onFatalError.emit(e),this.close()}))}get token(){return this._token}async _reconnect(){if(this._reconnectCount>=this._reconnectLimit)return this._rpc.onFatalError.emit(createError2({operationName:"RtcRpcApiClient._reconnect",info:{name:"failed to reconnect",detail:"_reconnectLimit exceeded",solution:""},path:log56.prefix})),void this.close();this._rpc.reconnecting=!0,log56.warn("[start] reconnect",createWarnPayload2({operationName:"RtcRpcApiClient._reconnect",detail:"reconnect start",payload:{reconnectCount:this._reconnectCount,limit:this._reconnectLimit}})),this._reconnectCount++;const e=this._reconnectCount**2*100+this._reconnectCount**2*100*Math.random();await new Promise((t=>setTimeout(t,e)));try{await this.connect().catch((e=>{throw log56.warn("[failed] reconnect rtc api",createWarnPayload2({operationName:"RtcRpcApiClient._reconnect",detail:"connect rpc failed",payload:{reconnectCount:this._reconnectCount}}),e),e})),this._rpc.reconnecting=!1,this._reconnectCount=0,this._rpc.resolvePendingRequests(),await Promise.all([...this._subscribingChannelEvents].map((async e=>{const[t,i]=e.split(":"),r=this._subscribingChannelVersions[i];await this.subscribeChannelEvents({appId:t,channelId:i,offset:r})}))).catch((e=>{throw log56.warn("subscribeChannelEvents failed",createWarnPayload2({operationName:"RtcRpcApiClient._reconnect",detail:"subscribeChannelEvents failed",payload:{reconnectCount:this._reconnectCount}}),e),e})),log56.warn("[end] reconnect",createWarnPayload2({operationName:"RtcRpcApiClient._reconnect",detail:"reconnect finished",payload:{reconnectCount:this._reconnectCount}})),this.onReconnected.emit()}catch(e){log56.warn("[failed] reconnect",createWarnPayload2({operationName:"RtcRpcApiClient._reconnect",detail:"reconnect failed",payload:{reconnectCount:this._reconnectCount}}),e),await this._reconnect()}}async updateToken(e){log56.debug("token update",{token:e}),this._token=e,await this._updateAuthToken()}close(){this.closed||(this.closed=!0,log56.debug("closed"),this._rpc.close(),this.onClose.emit(),this._events.dispose())}async health(){return await this._httpClient.get("/health")}async connect(){log56.debug("connect to rtc api rpc",this._domain),await this._rpc.connect({domain:this._domain,token:this.token,secure:this._secure}).catch((e=>{throw createError2({operationName:"RtcRpcApiClient.connect",info:errors2.failedToConnectRtcAPI,error:e,path:log56.prefix})}))}_channelSubscribed(e,t){this._subscribingChannelEvents.add(e+":"+t),log56.debug("_channelSubscribed",{appId:e,channelId:t,_subscribingChannelEvents:[...this._subscribingChannelEvents]})}_isSubscribingChannel(e,t){return this._subscribingChannelEvents.has(e+":"+t)}async createChannel({name:e,metadata:t,appId:i}){const{channel:r}=await this._rpc.request("createChannel",{name:e,metadata:t,appId:i,authToken:this.token});return this._channelSubscribed(i,r.id),r}async findOrCreateChannel({name:e,metadata:t,appId:i}){const{channel:r}=await this._rpc.request("findOrCreateChannel",{name:e,metadata:t,appId:i,authToken:this.token});return this._channelSubscribed(i,r.id),r}async getChannel({appId:e,id:t}){const i=await this._rpc.request("getChannel",{id:t,appId:e,authToken:this.token});return this._isSubscribingChannel(e,t)||(this._channelSubscribed(e,t),await this.subscribeChannelEvents({appId:e,channelId:t,offset:i.channel.version})),i.channel}async getChannelByName({name:e,appId:t}){const i=await this._rpc.request("getChannelByName",{name:e,appId:t,authToken:this.token}),r=i.channel.id;return this._isSubscribingChannel(t,r)||(this._channelSubscribed(t,r),await this.subscribeChannelEvents({appId:t,channelId:r,offset:i.channel.version})),i.channel}async deleteChannel({id:e,appId:t}){await this._rpc.request("deleteChannel",{id:e,appId:t,authToken:this.token})}async updateChannelMetadata({id:e,metadata:t,appId:i}){await this._rpc.request("updateChannelMetadata",{id:e,metadata:t,appId:i,authToken:this.token})}async addMember({channelId:e,name:t,metadata:i,subscribeChannelEvents:r,appId:s,ttlSec:n,subtype:a,type:o}){return await this._rpc.request("addMember",{channelId:e,name:t,metadata:i,subscribeChannelEvents:r,appId:s,ttlSec:n&&parseInt(n.toString()),authToken:this.token,subtype:a,type:o})}async updateMemberTtl(e,t=new import_common78.BackOff({times:8})){const{appId:i,channelId:r,memberId:s,ttlSec:n}=e;try{await this._rpc.request("updateMemberTtl",{appId:i,channelId:r,memberId:s,ttlSec:n&&parseInt(n.toString()),authToken:this.token})}catch(n){if(t.exceeded){throw new import_common78.SkyWayError({path:log56.prefix,info:errors2.failedToUpdateMemberTTL,error:n})}log56.warn("retry updateMemberTtl",createWarnPayload2({operationName:"RtcRpcApiClient.updateMemberTtl",detail:"retry updateMemberTtl",appId:i,channelId:r,memberId:s,payload:{backoff:t.count}}),n),await t.wait(),await this.updateMemberTtl(e,t)}}async updateMemberMetadata({channelId:e,memberId:t,metadata:i,appId:r}){await this._rpc.request("updateMemberMetadata",{channelId:e,memberId:t,metadata:i,appId:r,authToken:this.token})}async leaveChannel({channelId:e,id:t,appId:i}){await this._rpc.request("removeMember",{channelId:e,id:t,appId:i,authToken:this.token})}async publishStream({appId:e,channelId:t,publisherId:i,contentType:r,metadata:s,origin:n,codecCapabilities:a,encodings:o,isEnabled:c}){return{publicationId:(await this._rpc.request("publishStream",{channelId:t,publisherId:i,contentType:r[0].toUpperCase()+r.slice(1),metadata:s,origin:n,codecCapabilities:a,encodings:o?.map((e=>({id:e.id}))),isEnabled:c,appId:e,authToken:this.token})).id}}async disablePublication({channelId:e,publicationId:t,appId:i}){await this._rpc.request("disablePublication",{channelId:e,appId:i,publicationId:t,authToken:this.token})}async enablePublication({channelId:e,publicationId:t,appId:i}){await this._rpc.request("enablePublication",{channelId:e,appId:i,publicationId:t,authToken:this.token})}async updatePublicationMetadata({channelId:e,publicationId:t,appId:i,metadata:r}){await this._rpc.request("updatePublicationMetadata",{channelId:e,publicationId:t,metadata:r,appId:i,authToken:this.token})}async unpublishStream({channelId:e,publicationId:t,appId:i}){await this._rpc.request("unpublishStream",{channelId:e,publicationId:t,appId:i,authToken:this.token})}async subscribeStream({channelId:e,subscriberId:t,publicationId:i,appId:r}){return{subscriptionId:(await this._rpc.request("subscribeStream",{channelId:e,subscriberId:t,publicationId:i,appId:r,authToken:this.token})).id}}async unsubscribeStream({channelId:e,subscriptionId:t,appId:i}){await this._rpc.request("unsubscribeStream",{channelId:e,subscriptionId:t,appId:i,authToken:this.token})}async getServerUnixtime(e,t=new import_common78.BackOff({times:8})){const{appId:i}=e;try{return(await this._rpc.request("getServerUnixtime",{appId:i,authToken:this.token})).unixtime}catch(r){if(t.exceeded)throw r;return log56.warn(createWarnPayload2({operationName:"RtcRpcApiClient.getServerUnixtime",detail:"retry getServerUnixtime",appId:i,payload:{backoff:t.count}}),r),await t.wait(),this.getServerUnixtime(e,t)}}async _updateAuthToken(){await this._rpc.request("updateAuthToken",{authToken:this.token})}async subscribeChannelEvents({appId:e,channelId:t,offset:i}){try{log56.debug("[start] subscribeChannelEvents",{offset:i}),await this._rpc.request("subscribeChannelEvents",{appId:e,authToken:this.token,channelId:t,offset:i}),log56.debug("[end] subscribeChannelEvents",{offset:i})}catch(r){if(!(r instanceof import_common78.SkyWayError&&r.info.name===errors2.connectionDisconnected.name))throw log56.error("[failed] subscribeChannelEvents",createError2({operationName:"RtcRpcApiClient.subscribeChannelEvents",info:{...errors2.internalError,detail:"subscribeChannelEvents failed"},path:log56.prefix,error:r,payload:{offset:i},appId:e,channelId:t})),r;log56.warn("reconnect happened while subscribeChannelEvents. retry",createWarnPayload2({operationName:"RtcRpcApiClient.subscribeChannelEvents",detail:"reconnect happened while subscribeChannelEvents. retry",appId:e,channelId:t,payload:{offset:i}}),r),await this.subscribeChannelEvents({appId:e,channelId:t,offset:i})}}},Config=class{constructor(e={}){this.rtcApi={domain:"rtc-api.skyway.ntt.com",timeout:3e4,secure:!0,eventSubscribeTimeout:5e3},this.log={level:"error",format:"object"},Object.assign(this,(0,import_deepmerge.default)(this,e))}},import_common80=__toESM(require_dist()),import_token3=__toESM(require_dist6()),errors3={...errors2,invalidParameter:{name:"invalidParameter",detail:"",solution:""},notFound:{name:"notFound",detail:"",solution:""},timeout:{name:"timeout",detail:"",solution:""},internalError:{name:"internalError",detail:"",solution:""},invalidRequestParameter:{name:"invalidRequestParameter",detail:"リクエストのパラメーターが正しくありません",solution:"API仕様を確認し正しい値を入力してください"},insufficientPermissions:{name:"insufficientPermissions",detail:"tokenの権限が不足しています Token permissions are insufficient",solution:"Tokenに必要な権限を加えてください Add the necessary permissions to the Token"},publicationNestedTooMuch:{name:"publicationNestedTooMuch",detail:"originが設定されているPublicationをPublicationのoriginに指定することは出来ません It is not possible to specify the origin of a publication for which Origin has been set",solution:"仕様上の制約なので解決法はありません There is no solution because it is a specification limitation"},channelNotFound:{name:"channelNotFound",detail:"参照しようとしたchannelは存在しません The channel you tried to reference does not exist.",solution:"channelIdやchannelNameが正しいか確かめてください Make sure that the Channel id and channel name are correct."},memberNotFound:{name:"memberNotFound",detail:"参照しようとしたMemberは存在しません The member you tried to reference does not exist.",solution:"memberIdやmemberNameが正しいか確かめてください Make sure that the member id and member name is correct."},publicationNotFound:{name:"publicationNotFound",detail:"参照しようとしたPublicationは存在しません The Publication you tried to reference does not exist.",solution:"publicationIdが正しいか確かめてください Make sure that the publication id is correct."},subscriptionNotFound:{name:"subscriptionNotFound",detail:"参照しようとしたSubscriptionは存在しません The Subscription you tried to reference does not exist.",solution:"subscriptionIdが正しいか確かめてください Make sure that the subscription id is correct."},operationConflicted:{name:"operationConflicted",detail:"与えられた名前のチャネルは、今までの競合する要求によって、すでに作成されています The channel with the given name has already been created by a conflicting request up to now",solution:"別の名前を使ってchannelを作成してください"},channelNameDuplicated:{name:"channelNameDuplicated",detail:"その名前のChannelはすでに存在します A channel with that name already exists",solution:"別の名前を使ってchannelを作成してください"},memberNameDuplicated:{name:"memberNameDuplicated",detail:"その名前のMemberはすでに存在します A member with that name already exists",solution:"別の名前を使ってmemberを作成してください"},subscriptionAlreadyExists:{name:"subscriptionAlreadyExists",detail:"PublicationはすでにSubscribeされています",solution:"publicationIdが正しいか確かめてください"},rateLimitExceeded:{name:"rateLimitExceeded",detail:"リソースを規定仕様以上に消費しています",solution:"リソースの消費量を減らしてください"},projectUsageLimitExceeded:{name:"projectUsageLimitExceeded",detail:"フリープランプロジェクトのリソース利用上限に達しています",solution:"エンタープライズプランにアップグレードしてください"},invalidAuthToken:{name:"invalidAuthToken",detail:"AuthTokenが無効です",solution:"適切なAuthTokenを使用してください"},authTokenExpired:{name:"authTokenExpired",detail:"AuthTokenが期限切れです",solution:"適切なExpを設定したAuthTokenを使用してください"},serverBusy:{name:"serverBusy",detail:"サービス側の問題です",solution:"しばらく時間を置いて再試行してください"}},ErrorNames=Object.keys(errors3),import_common79=__toESM(require_dist());function createWarnPayload3({appId:e,detail:t,channelId:i,operationName:r,payload:s}){return{operationName:r,payload:s,detail:t,appId:e,channelId:i}}function createError3({operationName:e,info:t,error:i,path:r,channelId:s,appId:n,payload:a}){return new import_common79.SkyWayError({error:i,info:t,payload:{payload:a,operationName:e,channelId:s,appId:n},path:r})}var log57=new import_common80.Logger("packages/rtc-api-client/src/infrastructure/api.ts"),RtcApiImpl=class{constructor(e){this._client=e,this.closed=!1,this.onClose=new import_common80.Event,this.onFatalError=new import_common80.Event,this._token=import_token3.SkyWayAuthToken.Decode(this._client.token),e.onClose.once((()=>{this.close()})),e.onFatalError.add((e=>{this.onFatalError.emit(e)}))}async connect(){await this._client.connect()}async updateAuthToken(e){this._token=import_token3.SkyWayAuthToken.Decode(e),await this._client.updateToken(e).catch((e=>{const{info:t}=e;if(429001===t?.error?.data?.code)throw createError3({operationName:"RtcApiImpl.updateAuthToken",path:log57.prefix,info:errors3.projectUsageLimitExceeded,error:e});const i=this._commonError("RtcApiImpl.updateAuthToken",t?.error?.code??-1,e);if(i)throw i;if(401===t?.error?.code)throw createError3({operationName:"RtcApiImpl.updateAuthToken",path:log57.prefix,info:errors3.invalidAuthToken,error:e});throw createError3({operationName:"RtcApiImpl.updateAuthToken",path:log57.prefix,info:errors3.internalError,error:e})}))}close(){this.closed||(this.closed=!0,log57.debug("closed"),this._client.close(),this.onClose.emit(),this.onClose.removeAllListeners())}_commonError(e,t,i){switch(t){case-32602:return createError3({operationName:e,info:errors3.invalidRequestParameter,path:log57.prefix,error:i});case-32603:return createError3({operationName:e,info:errors3.internalError,path:log57.prefix,error:i});case 403:case 4030:return createError3({operationName:e,info:errors3.insufficientPermissions,path:log57.prefix,error:i});case 429:return createError3({operationName:e,info:errors3.rateLimitExceeded,path:log57.prefix,error:i})}}async createChannel(e,t){const{id:i}=await this._client.createChannel({appId:e,name:t.name,metadata:t.metadata}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.createChannel",t?.error?.code??-1,e);if(i)throw i;switch(t?.error?.code){case 404:throw createError3({operationName:"RtcApiImpl.createChannel",path:log57.prefix,info:errors3.channelNotFound,error:e});case 409:throw createError3({operationName:"RtcApiImpl.createChannel",path:log57.prefix,info:errors3.channelNameDuplicated,error:e});default:throw createError3({operationName:"RtcApiImpl.createChannel",path:log57.prefix,info:errors3.internalError,error:e})}}));return await this.getChannel(e,{id:i})}async getChannel(e,{name:t,id:i}){if(i)return await this._client.getChannel({appId:e,id:i}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.getChannel",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.getChannel",path:log57.prefix,info:errors3.channelNotFound,error:e});throw createError3({operationName:"RtcApiImpl.getChannel",path:log57.prefix,info:errors3.internalError,error:e})}));if(t)return await this._client.getChannelByName({appId:e,name:t}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.getChannel",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"getChannel",path:log57.prefix,info:errors3.channelNotFound,error:e});throw createError3({operationName:"getChannel",path:log57.prefix,info:errors3.internalError,error:e})}));throw createError3({operationName:"RtcApiImpl.createChannel",path:log57.prefix,info:errors3.invalidRequestParameter})}async findOrCreateChannel(e,t){return this._client.findOrCreateChannel({...t,appId:e}).catch((i=>{const{info:r}=i,s=this._commonError("RtcApiImpl.findOrCreateChannel",r?.error?.code??-1,i);if(s)throw s;if(t.name&&409===r?.error?.code)return this.getChannel(e,{name:t.name});switch(r?.error?.code){case 404:throw createError3({operationName:"RtcApiImpl.findOrCreateChannel",path:log57.prefix,info:errors3.channelNotFound,error:i});case 409:throw createError3({operationName:"RtcApiImpl.findOrCreateChannel",path:log57.prefix,info:errors3.channelNameDuplicated,error:i});default:throw createError3({operationName:"RtcApiImpl.findOrCreateChannel",path:log57.prefix,info:errors3.internalError,error:i})}}))}async deleteChannel(e,t){await this._client.deleteChannel({appId:e,id:t}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.deleteChannel",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.deleteChannel",path:log57.prefix,info:errors3.channelNotFound,error:e});throw createError3({operationName:"RtcApiImpl.deleteChannel",path:log57.prefix,info:errors3.internalError,error:e})}))}async updateChannelMetadata(e,t,i){await this._client.updateChannelMetadata({appId:e,id:t,metadata:i}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.updateChannelMetadata",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.updateChannelMetadata",path:log57.prefix,info:errors3.channelNotFound,error:e});throw createError3({operationName:"RtcApiImpl.updateChannelMetadata",path:log57.prefix,info:errors3.internalError,error:e})}))}async join(e,t,i){const{memberId:r}=await this._client.addMember({appId:e,channelId:t,name:i.name,metadata:i.metadata,ttlSec:i.ttlSec,type:i.type,subtype:i.subtype}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.addMember",t?.error?.code??-1,e);if(i)throw i;switch(t?.error?.code){case 404:throw createError3({operationName:"RtcApiImpl.addMember",path:log57.prefix,info:errors3.channelNotFound,error:e});case 409:throw createError3({operationName:"RtcApiImpl.addMember",path:log57.prefix,info:errors3.memberNameDuplicated,error:e});default:throw createError3({operationName:"RtcApiImpl.addMember",path:log57.prefix,info:errors3.internalError,error:e})}}));return{id:r,name:i.name,type:i.type,subtype:i.subtype,metadata:i.metadata}}async updateMemberTtl(e,t,i,r){await this._client.updateMemberTtl({appId:e,channelId:t,memberId:i,ttlSec:r}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.updateMemberTtl",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.updateMemberTtl",path:log57.prefix,info:errors3.memberNotFound,error:e});throw createError3({operationName:"RtcApiImpl.updateMemberTtl",path:log57.prefix,info:errors3.internalError,error:e})}))}async getServerUnixtime(e){return await this._client.getServerUnixtime({appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.getServerUnixtime",t?.error?.code??-1,e);if(i)throw i;throw createError3({operationName:"RtcApiImpl.getServerUnixtime",path:log57.prefix,info:errors3.internalError,error:e})}))}async updateMemberMetadata(e,t,i,r){await this._client.updateMemberMetadata({appId:e,channelId:t,memberId:i,metadata:r}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.updateMemberMetadata",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.updateMemberMetadata",path:log57.prefix,info:errors3.memberNotFound,error:e});throw createError3({operationName:"RtcApiImpl.updateMemberMetadata",path:log57.prefix,info:errors3.internalError,error:e})}))}async leave(e,t,i){await this._client.leaveChannel({channelId:t,id:i,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.leaveChannel",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.leaveChannel",path:log57.prefix,info:errors3.memberNotFound,error:e});throw createError3({operationName:"RtcApiImpl.leaveChannel",path:log57.prefix,info:errors3.internalError,error:e})}))}async publish(e,t){const{publicationId:i}=await this._client.publishStream({channelId:t.channel,publisherId:t.publisher,contentType:t.contentType,metadata:t.metadata,origin:t.origin,codecCapabilities:t.codecCapabilities,encodings:t.encodings,isEnabled:t.isEnabled,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.publish",t?.error?.code??-1,e);if(i)throw i;throw createError3({operationName:"RtcApiImpl.publish",path:log57.prefix,info:errors3.internalError,error:e})}));return i}async updatePublicationMetadata(e,t,i,r){await this._client.updatePublicationMetadata({channelId:t,publicationId:i,metadata:r,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.updatePublicationMetadata",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.updatePublicationMetadata",path:log57.prefix,info:errors3.publicationNotFound,error:e});throw createError3({operationName:"RtcApiImpl.updatePublicationMetadata",path:log57.prefix,info:errors3.internalError,error:e})}))}async disablePublication(e,t,i){await this._client.disablePublication({channelId:t,publicationId:i,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.disablePublication",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.disablePublication",path:log57.prefix,info:errors3.publicationNotFound,error:e});throw createError3({operationName:"RtcApiImpl.disablePublication",path:log57.prefix,info:errors3.internalError,error:e})}))}async enablePublication(e,t,i){await this._client.enablePublication({channelId:t,publicationId:i,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.enablePublication",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.enablePublication",path:log57.prefix,info:errors3.publicationNotFound,error:e});throw createError3({operationName:"RtcApiImpl.enablePublication",path:log57.prefix,info:errors3.internalError,error:e})}))}async unpublish(e,t,i){await this._client.unpublishStream({channelId:t,publicationId:i,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.unpublishStream",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.unpublishStream",path:log57.prefix,info:errors3.publicationNotFound,error:e});throw createError3({operationName:"RtcApiImpl.unpublishStream",path:log57.prefix,info:errors3.internalError,error:e})}))}async subscribe(e,t){const{subscriptionId:i}=await this._client.subscribeStream({channelId:t.channel.id,subscriberId:t.subscriber.id,publicationId:t.publication.id,appId:e}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.subscribeStream",t?.error?.code??-1,e);if(i)throw i;switch(t?.error?.code){case 404:throw createError3({operationName:"RtcApiImpl.subscribeStream",path:log57.prefix,info:errors3.publicationNotFound,error:e});case 409:throw createError3({operationName:"RtcApiImpl.subscribeStream",path:log57.prefix,info:errors3.subscriptionAlreadyExists,error:e});default:throw createError3({operationName:"RtcApiImpl.subscribeStream",path:log57.prefix,info:errors3.internalError,error:e})}}));return i}async unsubscribe(e,t,i){await this._client.unsubscribeStream({appId:e,channelId:t,subscriptionId:i}).catch((e=>{const{info:t}=e,i=this._commonError("RtcApiImpl.unsubscribeStream",t?.error?.code??-1,e);if(i)throw i;if(404===t?.error?.code)throw createError3({operationName:"RtcApiImpl.unsubscribeStream",path:log57.prefix,info:errors3.publicationNotFound,error:e});throw createError3({operationName:"RtcApiImpl.unsubscribeStream",path:log57.prefix,info:errors3.internalError,error:e})}))}},import_common81=__toESM(require_dist()),log58=new import_common81.Logger("packages/rtc-api-client/src/infrastructure/eventObserver.ts"),EventObserverImpl=class{constructor(e,t,i,r){this.onEvent=new import_common81.Event,this._disposer=[];const s=new EventJitterBuffer(i.version,(async n=>{await t.subscribeChannelEvents({appId:e,channelId:i.id,offset:n}),await new Promise((e=>setTimeout(e,r.eventSubscribeTimeout))),s.packetLostHappened&&log58.error(createError3({operationName:"EventObserverImpl.eventJitterBuffer",info:{...errors3.internalError,detail:"failed to resolve event lost"},channelId:i.id,appId:e,path:log58.prefix}))}));this._disposer=[t.onEvent.add((async({channelId:e,event:t})=>{e===i.id&&s.push({event:t,version:t.data.channel.version})})).removeListener,s.onEvent.add((e=>{this.onEvent.emit(e)})).removeListener]}dispose(){this._disposer.forEach((e=>e())),this.onEvent.removeAllListeners()}},EventJitterBuffer=class{constructor(e,t,i=1e3){this.presentVersion=e,this.onPacketLost=t,this.packetLifetime=i,this.onEvent=new import_common81.Event,this.eventBuffer={},this.packetLostHappened=!1}get expectNextVersion(){return this.presentVersion+1}push(e){const t=e.version;if(t<this.expectNextVersion)log58.debug("duplicate event",{...e,presentVersion:this.presentVersion});else{if(t>this.expectNextVersion)return log58.debug("maybe miss order event received",{...e,presentVersion:this.presentVersion}),this.eventBuffer[t]=e,void this.handlePacketLifetime();this.packetLostHappened&&(log58.warn("event packetLost resolved",createWarnPayload3({operationName:"EventJitterBuffer.push",detail:"event packetLost resolved",payload:{eventFrame:e}})),this.packetLostHappened=!1),this.eventBuffer[t]=e,this.resolveEvents()}}handlePacketLifetime(){const[e]=Object.keys(this.eventBuffer).sort().map((e=>this.eventBuffer[Number(e)]));null==this.packetLifeTimer&&e&&(log58.debug("set event packetLost timer",{...e,presentVersion:this.presentVersion}),this.packetLifeTimer=setTimeout((async()=>{if(this.presentVersion<e.version){if(log58.warn("event packetLost",createWarnPayload3({operationName:"EventJitterBuffer.handlePacketLifetime",detail:"eventPacket lost",payload:{oldestBufferedEvent:e,eventBufferLength:Object.keys(this.eventBuffer).length,presentVersion:this.presentVersion}})),this.packetLostHappened)return;this.packetLostHappened=!0,await this.onPacketLost(this.expectNextVersion)}this.packetLifeTimer=void 0,this.handlePacketLifetime()}),this.packetLifetime))}resolveEvents(){const e=[];for(let t=this.expectNextVersion;;t++){const i=this.eventBuffer[t];if(!i)break;e.push(i),delete this.eventBuffer[t]}e.length>0&&(this.presentVersion=e.slice(-1)[0].version,e.forEach((e=>{this.onEvent.emit(e.event)})))}},log59=new import_common82.Logger("packages/rtc-api-client/src/client.ts"),RtcApiClient=class e{constructor(e,t,i,r){this.appId=e,this.config=t,this.apiClient=i,this._eventObserverFactory=r,this.closed=!1,this.onFatalError=new import_common83.Event,this.apiClient.onFatalError.pipe(this.onFatalError)}static async Create(t){const i=new Config(t);i.log&&(import_common82.Logger.level=i.log.level,import_common82.Logger.format=i.log.format),log59.debug("RtcApiClient spawned",i);const r=new RtcRpcApiClient({...i.rtcApi,token:t.token,log:i.log}),s=new RtcApiImpl(r);await s.connect();return new e(t.appId,i,s,((e,t)=>new EventObserverImpl(e,r,t,i.rtcApi)))}async updateAuthToken(e){await this.apiClient.updateAuthToken(e)}async getServerUnixtimeInMs(){return this.apiClient.getServerUnixtime(this.appId)}async getServerUnixtimeInSec(){return Math.floor(await this.getServerUnixtimeInMs()/1e3)}async createChannel(e={}){log59.debug("[start] apiClient.createChannel",{init:e});const t=await this.apiClient.createChannel(this.appId,e).catch((t=>{throw log59.debug("[failed] apiClient.createChannel",{init:e,e:t}),t}));log59.debug("[end] apiClient.createChannel",{init:e,channelDto:t});return channelFactory(this.appId,this._eventObserverFactory(this.appId,t),this.apiClient,t,this.config)}async findChannel(e){log59.debug("[start] apiClient.getChannel",{query:e});const t=await this.apiClient.getChannel(this.appId,e).catch((t=>{throw log59.debug("[failed] apiClient.getChannel",{query:e,e:t}),t})),i=channelFactory(this.appId,this._eventObserverFactory(this.appId,t),this.apiClient,t,this.config);return log59.debug("[end] apiClient.getChannel",{channelId:i.id}),i}async findOrCreateChannel(e){log59.debug("[start] apiClient.findOrCreateChannel",{query:e});const t=await this.apiClient.findOrCreateChannel(this.appId,e).catch((t=>{throw log59.debug("[failed] apiClient.findOrCreateChannel",{query:e,e:t}),t}));log59.debug("[end] apiClient.findOrCreateChannel",{query:e});return channelFactory(this.appId,this._eventObserverFactory(this.appId,t),this.apiClient,t,this.config)}deleteChannel(e){return this.apiClient.deleteChannel(this.appId,e)}close(){this.closed||(this.closed=!0,log59.debug("closed",{appid:this.appId}),this.apiClient.close())}},import_common84=__toESM(require_dist()),event_exports={},log60=new import_common84.Logger("packages/rtc-api-client/src/domain/channel.ts"),ChannelImpl=class{constructor(e,{id:t,name:i,members:r,metadata:s,publications:n,subscriptions:a,version:o},c,l,u){this.appId=e,this.eventObserver=c,this.apiClient=l,this.config=u,this.disposed=!1,this._events=new import_common84.Events,this.onClosed=this._events.make(),this.onMetadataUpdated=this._events.make(),this.onMemberListChanged=this._events.make(),this.onMemberJoined=this._events.make(),this.onMemberLeft=this._events.make(),this.onMemberMetadataUpdated=this._events.make(),this.onPublicationDisabled=this._events.make(),this.onPublicationEnabled=this._events.make(),this.onPublicationListChanged=this._events.make(),this.onStreamPublished=this._events.make(),this.onStreamUnpublished=this._events.make(),this.onPublicationMetadataUpdated=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.onPublicationSubscribed=this._events.make(),this.onPublicationUnsubscribed=this._events.make(),this.updateChannelMetadata=e=>new Promise(((t,i)=>{let r=!1;this.apiClient.updateChannelMetadata(this.appId,this.id,e).catch((e=>{r=!0,i(e)})),this.onMetadataUpdated.watch((t=>t.channel.metadata===e)).then((()=>t())).catch((e=>{r||i(createError3({operationName:"ChannelImpl.updateChannelMetadata",info:{...errors3.timeout,detail:"onMetadataUpdated"},path:log60.prefix,error:e,appId:this.appId,channelId:this.id}))}))})),this.leave=(e,t)=>new Promise(((i,r)=>{let s=!1;this.apiClient.leave(this.appId,e,t).catch((e=>{s=!0,r(e)})),this.onMemberLeft.watch((e=>e.member.id===t),this.config.rtcApi.timeout).then((()=>i())).catch((e=>{s||r(createError3({operationName:"ChannelImpl.leave",info:{...errors3.timeout,detail:"onMemberLeft"},path:log60.prefix,error:e,appId:this.appId,channelId:this.id}))}))})),this.updateMemberMetadata=(e,t)=>new Promise(((i,r)=>{let s=!1;this.apiClient.updateMemberMetadata(this.appId,this.id,e,t).catch((e=>{s=!0,r(e)})),this.onMemberMetadataUpdated.watch((i=>i.member.id===e&&i.member.metadata===t)).then((()=>i())).catch((e=>{s||r(createError3({operationName:"ChannelImpl.updateMemberMetadata",info:{...errors3.timeout,detail:"onMemberMetadataUpdated"},path:log60.prefix,error:e,appId:this.appId,channelId:this.id}))}))})),this.unpublish=e=>new Promise(((t,i)=>{let r=!1;this.apiClient.unpublish(this.appId,this.id,e).catch((e=>{r=!0,i(e)})),this.onStreamUnpublished.watch((t=>t.publication.id===e)).then((()=>t())).catch((t=>{r||i(createError3({operationName:"ChannelImpl.unpublish",info:{...errors3.timeout,detail:"onStreamUnpublished"},path:log60.prefix,error:t,payload:{publicationId:e},appId:this.appId,channelId:this.id}))}))})),this.updatePublicationMetadata=(e,t)=>new Promise(((i,r)=>{let s=!1;this.apiClient.updatePublicationMetadata(this.appId,this.id,e,t).catch((e=>{s=!0,r(e)})),this.onPublicationMetadataUpdated.watch((i=>i.publication.id===e&&i.publication.metadata===t)).then((()=>i())).catch((t=>{s||r(createError3({operationName:"ChannelImpl.updatePublicationMetadata",info:{...errors3.timeout,detail:"onPublicationMetadataUpdated"},path:log60.prefix,error:t,payload:{publicationId:e},appId:this.appId,channelId:this.id}))}))})),this.disablePublication=e=>new Promise(((t,i)=>{let r=!1;this.apiClient.disablePublication(this.appId,this.id,e).catch((e=>{r=!0,i(e)})),this.onPublicationDisabled.watch((t=>t.publication.id===e)).then((()=>t())).catch((t=>{r||i(createError3({operationName:"ChannelImpl.disablePublication",info:{...errors3.timeout,detail:"onPublicationDisabled"},path:log60.prefix,error:t,payload:{publicationId:e},appId:this.appId,channelId:this.id}))}))})),this.enablePublication=e=>new Promise(((t,i)=>{let r=!1;this.apiClient.enablePublication(this.appId,this.id,e).catch((e=>{r=!0,i(e)})),this.onPublicationEnabled.watch((t=>t.publication.id===e)).then((()=>t())).catch((t=>{r||i(createError3({operationName:"ChannelImpl.enablePublication",info:{...errors3.timeout,detail:"onPublicationEnabled"},path:log60.prefix,error:t,payload:{publicationId:e},appId:this.appId,channelId:this.id}))}))})),this.unsubscribe=e=>new Promise(((t,i)=>{let r=!1;this.apiClient.unsubscribe(this.appId,this.id,e).catch((e=>{r=!0,i(e)})),this.onPublicationUnsubscribed.watch((t=>t.subscription.id===e)).then((()=>t())).catch((t=>{r||i(createError3({operationName:"ChannelImpl.unsubscribe",info:{...errors3.timeout,detail:"onPublicationUnsubscribed"},path:log60.prefix,error:t,payload:{subscriptionId:e},appId:this.appId,channelId:this.id}))}))})),this.id=t,this.name=i,this.metadata=s,this.members=r,this.publications=n,this.subscriptions=a,this.version=o,c.onEvent.add((e=>{log60.debug("received event: ",e),this.version=e.data.channel.version;try{switch(e.type){case"ChannelDeleted":this._channelClosed();break;case"ChannelMetadataUpdated":this._channelMetadataUpdated(e.data);break;case"MemberAdded":this._memberJoined(e.data);break;case"MemberRemoved":this._memberLeft(e.data);break;case"MemberMetadataUpdated":this._memberMetadataUpdated(e.data);break;case"StreamPublished":this._streamPublished(e.data);break;case"StreamUnpublished":this._streamUnpublished(e.data);break;case"PublicationMetadataUpdated":this._publicationMetadataUpdated(e.data);break;case"PublicationDisabled":this._publicationDisabled(e.data);break;case"PublicationEnabled":this._publicationEnabled(e.data);break;case"StreamSubscribed":this._streamSubscribed(e.data);break;case"StreamUnsubscribed":this._streamUnsubscribed(e.data)}}catch(e){log60.error(e)}})),l.onClose.once((()=>{this.dispose()}))}getMember(e){return this.members.find((t=>t.id===e))}addMember(e){const t=this.getMember(e.id);return t||(this.members.push(e),e)}deleteMember(e){this.members=this.members.filter((t=>t.id!==e))}getPublication(e){return this.publications.find((t=>t.id===e))}addPublication(e){const t=this.getPublication(e.id);if(t)return t;const i={...e,channelId:this.id,codecCapabilities:e.codecCapabilities??[],encodings:e.encodings??[]};return this.publications.push(i),i}deletePublication(e){this.publications=this.publications.filter((t=>t.id!==e))}getSubscription(e){return this.subscriptions.find((t=>t.id===e))}addSubscription(e){const t=this.getSubscription(e.id);if(t)return t;const i=this.getPublication(e.publicationId),r={...e,channelId:this.id,publisherId:i.publisherId,contentType:i.contentType};return this.subscriptions.push(r),r}deleteSubscription(e){this.subscriptions=this.subscriptions.filter((t=>t.id!==e))}_channelClosed(){this.onClosed.emit({})}_channelMetadataUpdated(e){this.metadata=e.channel.metadata,this.onMetadataUpdated.emit(e)}_memberJoined(e){this.addMember(e.member),this.onMemberJoined.emit(e),this.onMemberListChanged.emit({})}_memberLeft(e){const t=this.getMember(e.member.id);if(!t)throw createError3({operationName:"ChannelImpl._memberLeft",info:errors3.memberNotFound,path:log60.prefix,payload:{event:e},appId:this.appId,channelId:this.id});this.deleteMember(t.id),this.onMemberLeft.emit({member:t}),this.onMemberListChanged.emit({})}_memberMetadataUpdated(e){const t=this.getMember(e.member.id);if(!t)throw createError3({operationName:"ChannelImpl._memberMetadataUpdated",info:errors3.memberNotFound,path:log60.prefix,payload:{event:e},appId:this.appId,channelId:this.id});t.metadata=e.member.metadata,this.onMemberMetadataUpdated.emit(e)}_streamPublished(e){const t=this.addPublication(e.publication),i={...e,publication:t};this.onStreamPublished.emit(i),this.onPublicationListChanged.emit({})}_streamUnpublished(e){const t=this.getPublication(e.publication.id);if(!t)throw createError3({operationName:"ChannelImpl._streamUnpublished",info:errors3.publicationNotFound,path:log60.prefix,payload:{event:e},appId:this.appId,channelId:this.id});this.deletePublication(t.id);const i={...e,publication:t};this.onStreamUnpublished.emit(i),this.onPublicationListChanged.emit({})}_publicationMetadataUpdated(e){const t=this.getPublication(e.publication.id);if(!t)throw createError3({operationName:"ChannelImpl._publicationMetadataUpdated",info:errors3.publicationNotFound,path:log60.prefix,payload:{event:e},appId:this.appId,channelId:this.id});t.metadata=e.publication.metadata;const i={...e,publication:t};this.onPublicationMetadataUpdated.emit(i)}_publicationDisabled(e){const t=this.getPublication(e.publication.id);if(!t)throw createError3({operationName:"ChannelImpl._publicationDisabled",info:errors3.publicationNotFound,path:log60.prefix,payload:{event:e},appId:this.appId,channelId:this.id});t.isEnabled=e.publication.isEnabled;const i={publication:t};this.onPublicationDisabled.emit(i)}_publicationEnabled(e){const t=this.getPublication(e.publication.id);if(!t)throw createError3({operationName:"ChannelImpl._publicationEnabled",info:errors3.publicationNotFound,path:log60.prefix,payload:{event:event_exports},appId:this.appId,channelId:this.id});t.isEnabled=e.publication.isEnabled;const i={publication:t};this.onPublicationEnabled.emit(i)}_streamSubscribed(e){const t=this.addSubscription(e.subscription),i={...e,subscription:t};this.onPublicationSubscribed.emit(i),this.onSubscriptionListChanged.emit({})}_streamUnsubscribed(e){const t=this.getSubscription(e.subscription.id);if(!t)throw createError3({operationName:"ChannelImpl._streamUnsubscribed",info:errors3.subscriptionNotFound,path:log60.prefix,payload:{event:e},appId:this.appId,channelId:this.id});this.deleteSubscription(t.id);const i={...e,subscription:t};this.onPublicationUnsubscribed.emit(i),this.onSubscriptionListChanged.emit({})}async joinChannel(e){e.type&&(e.type=e.type[0].toUpperCase()+e.type.slice(1)),e.subtype&&(e.subtype=e.subtype[0].toUpperCase()+e.subtype.slice(1)),log60.debug("[start] joinChannel",{memberInit:e});const t=await this.apiClient.join(this.appId,this.id,{...e}),i=this.getMember(t.id)??(await this.onMemberJoined.watch((e=>e.member.id===t.id),this.config.rtcApi.timeout).catch((e=>{throw createError3({operationName:"ChannelImpl.joinChannel",info:{...errors3.timeout,detail:"onMemberJoined"},path:log60.prefix,error:e,appId:this.appId,channelId:this.id})}))).member;return log60.debug("[end] joinChannel",{member:i}),i}updateMemberTtl(e,t){return this.apiClient.updateMemberTtl(this.appId,this.id,e,t)}async publish(e){const t=log60.debug("[start] apiClient.publish",{init:e}),i=this.id,r=await this.apiClient.publish(this.appId,{...e,channel:i}),s={id:r,channelId:i,publisherId:e.publisher,origin:e.origin,contentType:e.contentType,metadata:e.metadata,codecCapabilities:e.codecCapabilities??[],encodings:e.encodings??[],isEnabled:e.isEnabled??!0};log60.elapsed(t,"[ongoing] apiClient.publish",{publicationDto:s});const n=this.getPublication(r);if(n)return n;const{publication:a}=await this.onStreamPublished.watch((e=>e.publication.id===r),this.config.rtcApi.timeout).catch((e=>{throw createError3({operationName:"ChannelImpl.publish",info:{...errors3.timeout,detail:"onStreamPublished"},path:log60.prefix,error:e,payload:{publicationDto:s},appId:this.appId,channelId:this.id})}));return log60.elapsed(t,"[end] apiClient.publish",{publicationDto:s}),a}async subscribe(e){const t=log60.debug("[start] apiClient.subscribe",{init:e}),i=await this.apiClient.subscribe(this.appId,{...e,channel:this}),r={id:i,publicationId:e.publication.id,channelId:this.id,publisherId:e.publication.publisherId,subscriberId:e.subscriber.id,contentType:e.publication.contentType};log60.elapsed(t,"[ongoing] apiClient.subscribe",{subscriptionDto:r});const s=this.getSubscription(i);if(s)return log60.elapsed(t,"[end] apiClient.subscribe",{subscriptionDto:r}),s;const{subscription:n}=await this.onPublicationSubscribed.watch((e=>e.subscription.id===i),this.config.rtcApi.timeout).catch((e=>{throw log60.elapsed(t,"[fail] apiClient.subscribe",e),createError3({operationName:"ChannelImpl.subscribe",info:{...errors3.timeout,detail:"onPublicationSubscribed"},path:log60.prefix,error:e,payload:{subscriptionDto:r}})}));return log60.elapsed(t,"[end] apiClient.subscribe",{subscriptionDto:r}),n}close(){return this.apiClient.deleteChannel(this.appId,this.id)}dispose(){this.disposed||(this.disposed=!0,log60.debug("disposed",{id:this.id}),this.eventObserver.dispose(),this._events.dispose())}};function channelFactory(e,t,i,r,s){return new ChannelImpl(e,r,t,i,s)}var ContextConfig=class{constructor(e={}){this.rtcApi={domain:"rtc-api.skyway.ntt.com",timeout:3e4,secure:!0,eventSubscribeTimeout:5e3},this.iceParamServer={domain:"ice-params.skyway.ntt.com",version:1,secure:!0},this.signalingService={domain:"signaling.skyway.ntt.com",secure:!0},this.analyticsService={domain:"analytics-logging.skyway.ntt.com",secure:!0},this.rtcConfig={timeout:3e4,turnPolicy:"enable",turnProtocol:"all",encodedInsertableStreams:!1,iceDisconnectBufferTimeout:5e3,iceUseLinkLocalAddress:!0},this.token={updateReminderSec:30},this.log={level:"error",format:"string"},this.internal={disableDPlane:!1},this.member={keepaliveIntervalGapSec:30,keepaliveIntervalSec:30,preventAutoLeaveOnBeforeUnload:!1},Object.assign(this,(0,import_deepmerge2.default)(this,e))}},import_common96=__toESM(require_dist()),import_token5=__toESM(require_dist4());init_esm_node2();var import_common85=__toESM(require_dist()),SkyWayPlugin=class{constructor(){this._onContextAttached=new import_common85.Event}_attachContext(e){this._context=e,this._onContextAttached.emit(e)}},import_common86=__toESM(require_dist()),log61=new import_common86.Logger("packages/core/src/plugin/internal/person/connection/messageBuffer.ts"),MessageBuffer=class{constructor(e){this.signaling=e,this._indicateMessageBuffer={},this._excludeConnectionIndicateBuffering=new Set,this._disposer=new import_common86.EventDisposer,this.signaling.onMessage.add((e=>{const t=e.src.id+e.src.name;this._excludeConnectionIndicateBuffering.has(t)||(this._indicateMessageBuffer[t]||(this._indicateMessageBuffer[t]=[]),this._indicateMessageBuffer[t].push(e))})).disposer(this._disposer)}resolveMessagingBuffer({id:e,name:t}){const i=e+t,r=this._indicateMessageBuffer[i];r?.length>0&&(log61.debug("resolveMessagingBuffer",{length:r.length}),r.forEach((e=>{this.signaling.onMessage.emit(e)})),delete this._indicateMessageBuffer[i]),this._excludeConnectionIndicateBuffering.add(i)}close(){this._disposer.dispose(),this._indicateMessageBuffer={},this._excludeConnectionIndicateBuffering=new Set}},import_common95=__toESM(require_dist()),import_common94=__toESM(require_dist());init_esm_node2();var import_common92=__toESM(require_dist()),sdpTransform13=__toESM(require_lib());init_esm_node2();var import_common89=__toESM(require_dist()),import_common87=__toESM(require_dist()),RemoteStreamBase=class{constructor(e,t){this.id=e,this.contentType=t,this.side="remote",this.onConnectionStateChanged=new import_common87.Event,this._onConnectionStateChanged=new import_common87.Event,this._connectionState="new",this._getTransport=()=>{},this.getStats=()=>this._getStats(),this._getStats=async()=>[],this._onConnectionStateChanged.pipe(this.onConnectionStateChanged)}_setConnectionState(e){this._connectionState!==e&&(this._connectionState=e,this._onConnectionStateChanged.emit(e))}getRTCPeerConnection(){return this._getRTCPeerConnection()}_getRTCPeerConnection(){return this._getTransport()?.rtcPeerConnection}getConnectionState(){return this._getConnectionState()}_getConnectionState(){return this._connectionState}toJSON(){return{contentType:this.contentType,id:this.id,codec:this.codec,side:this.side}}},RemoteMediaStreamBase=class extends RemoteStreamBase{constructor(e,t,i){super(e,t),this.id=e,this.contentType=t,this.track=i}get isEnabled(){return this.track.enabled}setIsEnabled(e){this.track.enabled=e}attach(e){}detach(){}},RemoteAudioStream=class extends RemoteMediaStreamBase{constructor(e,t){super(e,"audio",t),this.track=t,this.contentType="audio"}},import_common88=__toESM(require_dist()),RemoteDataStream=class extends RemoteStreamBase{constructor(e,t){super(e,"data"),this._datachannel=t,this._isEnabled=!0,this.contentType="data",this.onData=new import_common88.Event,t.onmessage=({data:e})=>{this.isEnabled&&("string"==typeof e&&e.includes(objectFlag)&&(e=JSON.parse(e.slice(objectFlag.length))),this.onData.emit(e))}}get isEnabled(){return this._isEnabled}setIsEnabled(e){this._isEnabled=e}},RemoteVideoStream=class extends RemoteMediaStreamBase{constructor(e,t){super(e,"video",t),this.track=t,this.contentType="video"}},log62=new import_common89.Logger("packages/core/src/media/stream/remote/factory.ts"),createRemoteStream=(e,t,i)=>{if(t instanceof RTCDataChannel){const r=new RemoteDataStream(e,t);return r.codec=i,r}if("audio"===t.kind){const r=new RemoteAudioStream(e,t);return r.codec=i,r}if("video"===t.kind){const r=new RemoteVideoStream(e,t);return r.codec=i,r}throw createError({operationName:"createRemoteStream",path:log62.prefix,info:{...errors.invalidArgumentValue,detail:"invalid stream type"}})},import_common90=__toESM(require_dist()),log63=new import_common90.Logger("packages/core/src/plugin/internal/person/util.ts"),setEncodingParams=async(e,t)=>{const i=log63.createBlock({label:"setEncodingParams"}),r=e.getParameters();i.debug("getParameters",{params:r,newEncodings:t}),null==r.encodings&&(r.encodings=[]),r.encodings=t.map(((e,t)=>({...r.encodings[t]||{},...e}))),await e.setParameters(r)},isSafari=()=>"Safari12"===detectDevice()||"Safari11"===detectDevice();function convertConnectionState(e){switch(e){case"closed":case"disconnected":case"failed":return"disconnected";case"connected":return"connected";case"connecting":return"connecting";case"new":return"new";case"reconnecting":return"reconnecting"}}var statsToJson=e=>{const t=[];return e.forEach((e=>{t.push(JSON.parse(JSON.stringify(e)))})),t},DataChannelNegotiationLabel=class e{constructor(e,t){this.publicationId=e,this.streamId=t}static fromLabel(t){const{p:i,s:r}=JSON.parse(t);return new e(i,r)}toLabel(){return JSON.stringify({p:this.publicationId,s:this.streamId})}},import_common91=__toESM(require_dist()),import_token4=__toESM(require_dist4()),log64=new import_common91.Logger("packages/core/src/plugin/internal/person/connection/peer.ts"),Peer=class{constructor(e,t,i,r,s,n,a){this._context=e,this._iceManager=t,this.signaling=i,this.analytics=r,this.localPerson=s,this.endpoint=n,this.role=a,this._pendingCandidates=[],this.pc=new RTCPeerConnection2({...this._context.config.rtcConfig,iceTransportPolicy:"turnOnly"===this._context.config.rtcConfig.turnPolicy?"relay":void 0,iceServers:this._iceManager.iceServers,headerExtensions:{audio:[useAudioLevelIndication()]}}),this.onSignalingStateChanged=new import_common91.Event,this.onPeerConnectionStateChanged=new import_common91.Event,this.onDisconnect=new import_common91.Event,this.connected=!1,this.disconnected=!1,this.rtcPeerConnectionId=(0,import_token4.uuidV4)(),this._onICECandidate=async e=>{if(null==e.candidate||""===e.candidate||"closed"===this.pc.connectionState)return;const t={kind:"iceCandidateMessage",payload:{candidate:e.candidate,role:this.role}};log64.debug("[start] send candidate",{message:t,localPerson:this.localPerson}),this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"iceCandidate",data:{candidate:JSON.stringify(e.candidate)},createdAt:Date.now()});try{await this.signaling.send(this.endpoint,t),log64.debug("[end] send candidate",{message:t,localPerson:this.localPerson})}catch(e){log64.warn("[failed] send candidate",createWarnPayload({operationName:"Peer._onICECandidate",channel:this.localPerson.channel,detail:"[failed] send candidate",payload:{message:t}}),e)}},this._onICECandidateError=async e=>{this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"iceCandidateError",data:{event:JSON.stringify(e)},createdAt:Date.now()})},this._onIceGatheringStateChange=async e=>{if(this.localPerson._analytics&&!this.localPerson._analytics.isClosed()){const e=this.pc.iceGatheringState;this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"iceGatheringStateChange",data:{event:e},createdAt:Date.now()})}},this._onConnectionStateChange=async()=>{const e=this.pc.connectionState;if(this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"connectionStateChange",data:{connectionState:e},createdAt:Date.now()}),"connected"===e)this.connected=!0,this._pendingCandidates=[];this.onPeerConnectionStateChanged.emit(this.pc.connectionState)},this._onIceConnectionStateChange=async()=>{if(this.localPerson._analytics&&!this.localPerson._analytics.isClosed()){const e=this.pc.iceConnectionState;this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"iceConnectionStateChange",data:{iceConnectionState:e},createdAt:Date.now()})}},this._onSignalingStateChange=async()=>{if(this.localPerson._analytics&&!this.localPerson._analytics.isClosed()){const e=this.pc.signalingState;this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"signalingStateChange",data:{signalingState:e},createdAt:Date.now()})}},this.waitForSignalingState=async(e,t=1e4)=>{this.pc.signalingState!==e&&await this.onSignalingStateChanged.watch((()=>this.pc.signalingState===e),t).catch((e=>{throw createError({operationName:"Peer.waitForSignalingState",info:{...errors.timeout,detail:"waitForSignalingState timeout"},path:log64.prefix,context:this._context,channel:this.localPerson.channel,error:e})}))},this.waitForConnectionState=async(e,t=1e4)=>{e!==this.pc.connectionState&&await this.onPeerConnectionStateChanged.watch((()=>e===this.pc.connectionState),t).catch((e=>{throw createError({operationName:"Peer.waitForConnectionState",info:{...errors.timeout,detail:"waitForConnectionState timeout"},path:log64.prefix,context:this._context,channel:this.localPerson.channel,error:e})}))},this.setPeerConnectionListener();const o=this.pc?.peerIdentity;o&&o.catch((e=>{log64.debug("firefox peerIdentity",e)}))}setPeerConnectionListener(){this.pc.onicecandidate=this._onICECandidate,this.pc.onicecandidateerror=this._onICECandidateError,this.pc.onicegatheringstatechange=this._onIceGatheringStateChange,this.pc.onconnectionstatechange=this._onConnectionStateChange,this.pc.oniceconnectionstatechange=this._onIceConnectionStateChange,this.pc.onsignalingstatechange=()=>{this._onSignalingStateChange(),this.onSignalingStateChanged.emit(this.pc.signalingState)}}unSetPeerConnectionListener(){this.pc.onicecandidate=null,this.pc.onicecandidateerror=null,this.pc.onicegatheringstatechange=null,this.pc.onconnectionstatechange=null,this.pc.oniceconnectionstatechange=null,this.pc.onsignalingstatechange=null}async handleCandidate(e){this._pendingCandidates.push(e),this.pc.remoteDescription&&await this.resolveCandidates()}async resolveCandidates(){const e=[...this._pendingCandidates];this._pendingCandidates=[],log64.debug("addIceCandidates",e),await Promise.all(e.map((e=>{"closed"!==this.pc.signalingState&&this.pc.addIceCandidate(e).catch((e=>{log64.warn("[failed] add ice candidate",createWarnPayload({operationName:"Peer.resolveCandidates",channel:this.localPerson.channel,detail:"[failed] send candidate",payload:{endpointId:this.endpoint.id}}),e)}))})))}},log65=new import_common92.Logger("packages/core/src/plugin/internal/person/connection/receiver.ts"),Receiver=class extends Peer{constructor(e,t,i,r,s,n){super(e,t,i,r,s,n,"receiver"),this.id=v4_default2(),this.onConnectionStateChanged=new import_common92.Event,this.onStreamAdded=new import_common92.Event,this.onError=new import_common92.Event,this._connectionState="new",this._publicationInfo={},this.streams={},this._subscriptions={},this._promiseQueue=new import_common92.PromiseQueue,this._disposer=new import_common92.EventDisposer,this._log=log65.createBlock({localPersonId:this.localPerson.id,id:this.id}),this._log.debug("spawned"),this.signaling.onMessage.add((async({src:e,data:t})=>{if(e.id!==n.id||e.name!==n.name)return;const i=t;switch(i.kind){case"senderProduceMessage":this._promiseQueue.push((()=>this._handleSenderProduce(i.payload))).catch((e=>this._log.error("handle senderProduceMessage failed",e,{localPersonId:this.localPerson.id,endpointId:this.endpoint.id})));break;case"senderUnproduceMessage":this._promiseQueue.push((()=>this._handleSenderUnproduce(i.payload))).catch((e=>this._log.error("handle handleSenderUnproduce",e,{localPersonId:this.localPerson.id,endpointId:this.endpoint.id})));break;case"senderRestartIceMessage":this._promiseQueue.push((()=>this._handleSenderRestartIce(i.payload))).catch((e=>this._log.error("_handleSenderRestartIce",e,{localPersonId:this.localPerson.id,endpointId:this.endpoint.id})));break;case"iceCandidateMessage":{const{role:e,candidate:t}=i.payload;"sender"===e&&await this.handleCandidate(t)}}})).disposer(this._disposer),this.pc.ontrack=async({track:e,transceiver:t})=>{if(!t.mid)throw createError({operationName:"Receiver.pc.ontrack",info:{...errors.missingProperty,detail:"mid missing"},path:log65.prefix,context:this._context,channel:this.localPerson.channel});const i=Object.values(this._publicationInfo).find((e=>e.mid===t.mid?.toString()));if(!i){const e=createError({operationName:"Receiver.pc.ontrack",info:{...errors.notFound,detail:"publicationInfo not found"},path:log65.prefix,context:this._context,channel:s.channel,payload:{endpointId:this.endpoint.id,publicationInfo:this._publicationInfo,mid:t.mid}});return this.onError.emit(e),void this._log.error(e)}const r=sdpTransform13.parse(this.pc.remoteDescription.sdp),n=this._getCodecFromSdp(r,t,e.kind),a=createRemoteStream(i.streamId,e,n);a.codec=n,this._setupTransportAccessForStream(a),this.streams[i.publicationId]=a,this._log.debug("MediaStreamTrack added",i,e,n),this.onStreamAdded.emit({publicationId:i.publicationId,stream:a})},this.pc.ondatachannel=async({channel:e})=>{const{publicationId:t,streamId:i}=DataChannelNegotiationLabel.fromLabel(e.label),r={mimeType:"datachannel"},s=createRemoteStream(i,e,r);this._setupTransportAccessForStream(s),this.streams[t]=s,this._log.debug("DataChannel added",t,e,r),this.onStreamAdded.emit({publicationId:t,stream:s})},this.onPeerConnectionStateChanged.add((e=>{switch(e){case"connecting":case"connected":this._setConnectionState(e);break;case"failed":case"closed":this._setConnectionState("disconnected")}})).disposer(this._disposer)}_setConnectionState(e){this._connectionState!==e&&(this._log.debug("onConnectionStateChanged",this.id,this._connectionState,e),this._connectionState=e,this.onConnectionStateChanged.emit(e))}_setupTransportAccessForStream(e){e._getTransport=()=>({rtcPeerConnection:this.pc,connectionState:convertConnectionState(this.pc.connectionState)}),this._disposer.push((()=>{e._getTransport=()=>{}})),this.onConnectionStateChanged.add((t=>{e._setConnectionState(t),this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"skywayConnectionStateChange",data:{skywayConnectionState:t},createdAt:Date.now()})})).disposer(this._disposer)}_getCodecFromSdp(e,t,i){const r=e.media.find((e=>e.mid?.toString()===t.mid?.toString()));if(!r)throw createError({operationName:"Receiver._getCodecFromSdp",info:{...errors.notFound,detail:"m-line not exist"},path:log65.prefix,context:this._context,channel:this.localPerson.channel});const s=r.payloads?.toString().split(" ")[0],n=`${i}/${r.rtp.find((e=>e.payload.toString()===s)).codec}`.toLowerCase();let a={};const o=r.fmtp.find((e=>e.payload.toString()===s));o?.config&&(a=fmtpConfigParser(o.config));return{mimeType:n,parameters:a}}get hasMedia(){const e=Object.values(this.streams).length;return this._log.debug("hasMedia",{count:e}),e>0}close(){this._log.debug("closed"),this.unSetPeerConnectionListener(),this.pc.close(),this._setConnectionState("disconnected"),this._disposer.dispose()}add(e){this._subscriptions[e.id]=e}remove(e){const t=this._subscriptions[e];if(!t)return;delete this._subscriptions[t.id];const i=t.publication.id;this.streams[i]&&delete this.streams[i]}_validateRemoteOffer(e){const t=sdpTransform13.parse(e);this._log.debug("_validateRemoteOffer",{sdpObject:t});for(const e of t.media){if("inactive"===e.direction)continue;if(!Object.values(this._publicationInfo).find((t=>e.mid?.toString()===t.mid))){const i=createError({operationName:"Receiver._validateRemoteOffer",info:{...errors.notFound,detail:"mismatch between sdp and state"},path:log65.prefix,context:this._context,channel:this.localPerson.channel,payload:{sdpMedia:t.media,sdpMediaLine:e,info:this._publicationInfo}});throw this.onError.emit(i),i}}}get isWrongSignalingState(){return"have-local-offer"===this.pc.signalingState&&this.pc.remoteDescription||"have-remote-offer"===this.pc.signalingState}async _handleSenderProduce({sdp:e,publicationId:t,info:i}){if("closed"!==this.pc.signalingState){if("stable"!==this.pc.signalingState){if(this.isWrongSignalingState)return this._log.warn("_handleSenderProduce wait for be stable",createWarnPayload({operationName:"Receiver._handleSenderProduce",channel:this.localPerson.channel,detail:"_handleSenderProduce wait for be stable",payload:{signalingState:this.pc.signalingState}})),await this.waitForSignalingState("stable"),void await this._handleSenderProduce({sdp:e,publicationId:t,info:i});throw createError({operationName:"Receiver._handleSenderProduce",context:this._context,channel:this.localPerson.channel,info:{...errors.internal,detail:"wrong signalingState"},payload:{signalingState:this.pc.signalingState},path:log65.prefix})}this._log.debug("_handleSenderProduce",{info:i,publicationId:t,publicationInfo:Object.values(this._publicationInfo)}),this._publicationInfo[i.publicationId]=i,this._validateRemoteOffer(e.sdp),await this.sendAnswer(e),await this.resolveCandidates()}}async _handleSenderUnproduce({sdp:e,publicationId:t}){if("closed"!==this.pc.signalingState){if(this._log.debug("<handleSenderUnproduce> start",{sdp:e,publicationId:t}),"stable"!==this.pc.signalingState){if(this.isWrongSignalingState)return this._log.warn("signalingState is not stable",createWarnPayload({channel:this.localPerson.channel,detail:"signalingState is not stable",operationName:"Receiver._handleSenderUnproduce",payload:{signalingState:this.pc.signalingState}})),await this.waitForSignalingState("stable"),void await this._handleSenderUnproduce({sdp:e,publicationId:t});throw createError({operationName:"Receiver._handleSenderProduce",context:this._context,channel:this.localPerson.channel,info:{...errors.internal,detail:"wrong signalingState"},payload:{signalingState:this.pc.signalingState},path:log65.prefix})}delete this._publicationInfo[t],await this.sendAnswer(e),await this.resolveCandidates(),this._log.debug("<handleSenderUnproduce> end",{publicationId:t})}else this._log.warn("signalingState closed",createWarnPayload({channel:this.localPerson.channel,detail:"signalingState closed",operationName:"Receiver._handleSenderUnproduce"}))}async _handleSenderRestartIce({sdp:e}){if("closed"!==this.pc.signalingState){if("stable"!==this.pc.signalingState){if(this.isWrongSignalingState)return this._log.warn("signalingState is not stable",createWarnPayload({channel:this.localPerson.channel,detail:"signalingState is not stable",operationName:"Receiver._handleSenderRestartIce",payload:{signalingState:this.pc.signalingState}})),await this.waitForSignalingState("stable"),void await this._handleSenderRestartIce({sdp:e});throw createError({operationName:"Receiver._handleSenderRestartIce",context:this._context,channel:this.localPerson.channel,info:{...errors.internal,detail:"wrong signalingState"},payload:{signalingState:this.pc.signalingState},path:log65.prefix})}this._setConnectionState("reconnecting"),await this.sendAnswer(e),await this.resolveCandidates(),"connected"===this.pc.connectionState&&this._setConnectionState("connected")}}async sendAnswer(e){this._log.debug("[receiver] start: sendAnswer"),await this.pc.setRemoteDescription(e);const t=await this.pc.createAnswer();this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"answer",data:{answer:JSON.stringify(t)},createdAt:Date.now()});const i=sdpTransform13.parse(this.pc.remoteDescription.sdp),r=sdpTransform13.parse(t.sdp);i.media.forEach(((e,t)=>{const i=r.media[t];i.fmtp=(0,import_common92.deepCopy)(i.fmtp).map((t=>{const i=e.fmtp.find((e=>e.payload===t.payload));return i||t}))}));const s=sdpTransform13.write(r);await this.pc.setLocalDescription({type:"answer",sdp:s});const n={kind:"receiverAnswerMessage",payload:{sdp:this.pc.localDescription}};await this.signaling.send(this.endpoint,n).catch((e=>this._log.error("failed to send answer",e,{localPersonId:this.localPerson.id,endpointId:this.endpoint.id}))),this._log.debug("[receiver] end: sendAnswer")}get subscriptions(){return this._subscriptions}},import_common93=__toESM(require_dist()),import_isEqual=__toESM(require_isEqual()),sdpTransform14=__toESM(require_lib());init_esm_node2();var log66=new import_common93.Logger("packages/core/src/plugin/internal/person/connection/sender.ts"),Sender=class extends Peer{constructor(e,t,i,r,s,n){super(e,t,i,r,s,n,"sender"),this.id=v4_default2(),this.onConnectionStateChanged=new import_common93.Event,this.publications={},this.transceivers={},this.datachannels={},this._pendingPublications=[],this._isNegotiating=!1,this.promiseQueue=new import_common93.PromiseQueue,this._disposer=new import_common93.EventDisposer,this._ms=new MediaStream2([]),this._backoffIceRestarted=new import_common93.BackOff({times:8,interval:100,jitter:100}),this._connectionState="new",this._log=log66.createBlock({localPersonId:this.localPerson.id,id:this.id}),this._unsubscribeStreamEnableChange={},this._cleanupStreamCallbacks={},this.restartIce=async()=>{if(this._backoffIceRestarted.exceeded)return this._log.error(createError({operationName:"Sender.restartIce",context:this._context,channel:this.localPerson.channel,info:{...errors.internal,detail:"restartIce limit exceeded"},path:log66.prefix})),void this._setConnectionState("disconnected");this._log.warn("[start] restartIce",createWarnPayload({operationName:"Sender.restartIce",detail:"start restartIce",channel:this.localPerson.channel,payload:{count:this._backoffIceRestarted.count}}));const e=()=>"left"===this.endpoint.state?(this._log.warn("endpointMemberLeft",createWarnPayload({operationName:"restartIce",detail:"endpointMemberLeft",channel:this.localPerson.channel,payload:{endpointId:this.endpoint.id}})),this._setConnectionState("disconnected"),!0):"connected"===this.pc.connectionState?(this._log.warn("[end] restartIce",createWarnPayload({operationName:"restartIce",detail:"reconnected",channel:this.localPerson.channel,payload:{count:this._backoffIceRestarted.count}})),this._backoffIceRestarted.reset(),this._setConnectionState("connected"),this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.id,type:"restartIce",data:void 0,createdAt:Date.now()}),!0):void 0;if(this._setConnectionState("reconnecting"),await this._backoffIceRestarted.wait(),e())return;let t=await this._iceManager.updateIceParams().catch((e=>e));if(t)return this._log.warn("[failed] restartIce",createWarnPayload({operationName:"restartIce",detail:"update IceParams failed",channel:this.localPerson.channel,payload:{count:this._backoffIceRestarted.count}}),t),void await this.restartIce();if(this.pc.setConfiguration&&(this.pc.setConfiguration({...this.pc.getConfiguration(),iceServers:this._iceManager.iceServers}),this._log.debug("<restartIce> setConfiguration",{iceServers:this._iceManager.iceServers})),e())return;if("connected"!==this.signaling.connectionState){if(this._log.warn("<restartIce> reconnect signaling service",createWarnPayload({operationName:"restartIce",detail:"reconnect signaling service",channel:this.localPerson.channel,payload:{count:this._backoffIceRestarted.count}})),t=await this.signaling.onConnectionStateChanged.watch((e=>"connected"===e),1e4).catch((e=>e)).then((()=>{})),t instanceof import_common93.SkyWayError)return void await this.restartIce();if(e())return}const i=await this.pc.createOffer({iceRestart:!0});this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"offer",data:{offer:JSON.stringify(i)},createdAt:Date.now()}),await this.pc.setLocalDescription(i);const r={kind:"senderRestartIceMessage",payload:{sdp:this.pc.localDescription}};if(t=await this.signaling.send(this.endpoint,r,1e4).catch((e=>e)),t)return this._log.warn("<restartIce> [failed]",createWarnPayload({operationName:"restartIce",detail:"timeout send signaling message",channel:this.localPerson.channel,payload:{count:this._backoffIceRestarted.count}}),t),void await this.restartIce();t=await this.waitForConnectionState("connected",this._context.config.rtcConfig.iceDisconnectBufferTimeout).catch((e=>e)),!t&&e()||await this.restartIce()},this._log.debug("spawned"),this.signaling.onMessage.add((async({src:e,data:t})=>{if(e.id!==n.id||e.name!==n.name)return;const i=t;switch(i.kind){case"receiverAnswerMessage":this.promiseQueue.push((()=>this._handleReceiverAnswer(i.payload))).catch((e=>this._log.error("handle receiverAnswerMessage",{localPersonId:this.localPerson.id,endpointId:this.endpoint.id,err:e})));break;case"iceCandidateMessage":{const{role:e,candidate:t}=i.payload;"receiver"===e&&await this.handleCandidate(t)}}})).disposer(this._disposer),this.onPeerConnectionStateChanged.add((async t=>{try{switch(log66.debug("onPeerConnectionStateChanged",{state:t}),t){case"disconnected":case"failed":await this.waitForConnectionState("connected",e.config.rtcConfig.iceDisconnectBufferTimeout).catch((e=>e))&&"reconnecting"!==this._connectionState&&await this.restartIce();break;case"connecting":case"connected":this._setConnectionState(t);break;case"closed":this._setConnectionState("disconnected")}}catch(e){log66.error("onPeerConnectionStateChanged",e,this.id)}})).disposer(this._disposer)}_setConnectionState(e){this._connectionState!==e&&(this._log.debug("onConnectionStateChanged",this.id,this._connectionState,e),this._connectionState=e,this.onConnectionStateChanged.emit(e))}get hasMedia(){const e=Object.keys(this.publications).length;return this._log.debug("hasMedia",{count:e}),e>0}_getMid(e,t){if("data"===e.contentType){const e=t.media.find((e=>"application"===e.type));if(null==e?.mid)throw createError({operationName:"Sender._getMid",info:{...errors.missingProperty,detail:"datachannel mid undefined"},path:log66.prefix,context:this._context,channel:this.localPerson.channel});return e.mid.toString()}{const t=this.transceivers[e.id].mid;if(null==t)throw createError({operationName:"Sender._getMid",info:{...errors.missingProperty,detail:"media mid undefined"},path:log66.prefix,context:this._context,channel:this.localPerson.channel});return t.toString()}}_listenStreamEnableChange(e,t){this._unsubscribeStreamEnableChange[t]&&this._unsubscribeStreamEnableChange[t]();const{removeListener:i}=e._onEnableChanged.add((async e=>{await this._replaceTrack(t,e).catch((e=>{log66.warn(createWarnPayload({member:this.localPerson,detail:"_replaceTrack failed",operationName:"Sender._listenStreamEnableChange",payload:e}))}))}));this._unsubscribeStreamEnableChange[t]=i}async add(e){if(this._isNegotiating||"stable"!==this.pc.signalingState)return this._pendingPublications.push(e),void this._log.debug("<add> isNegotiating",{publication:e,isNegotiating:this._isNegotiating,signalingState:this.pc.signalingState,pendingPublications:this._pendingPublications.length});this._isNegotiating=!0,this._log.debug("<add> add publication",{publication:e}),this.publications[e.id]=e;const t=e.stream;if(!t)throw createError({operationName:"Sender.add",info:{...errors.missingProperty,detail:"<add> stream not found"},path:log66.prefix,context:this._context,channel:this.localPerson.channel});if(this._cleanupStreamCallbacks[t.id]=this._setupTransportAccessForStream(t),"data"===t.contentType){const i=this.pc.createDataChannel(new DataChannelNegotiationLabel(e.id,t.id).toLabel(),t.options);i.onerror=e=>{"error"in e&&e.error.errorDetail.includes("data-channel")?this._log.error("datachannel.send failed",createError({operationName:"RTCDataChannel.onerror",info:errors.dataChannelSendError,path:log66.prefix,context:this._context,channel:this.localPerson.channel})):this._log.error("datachannel operation failed",createError({operationName:"RTCDataChannel.onerror",info:errors.dataChannelGeneralError,path:log66.prefix,context:this._context,channel:this.localPerson.channel}))},t._onWriteData.add((e=>{"open"===i.readyState?i.send(e):this._log.error("datachannel.send failed",createError({operationName:"RTCDataChannel.onerror",info:errors.dataChannelSendError,path:log66.prefix,context:this._context,channel:this.localPerson.channel}))})).disposer(this._disposer),this.datachannels[e.id]=i}else{e._onReplaceStream.add((async({newStream:t,oldStream:i})=>{t._replacingTrack=!0,this._listenStreamEnableChange(t,e.id),this._cleanupStreamCallbacks[i.id]&&this._cleanupStreamCallbacks[i.id](),this._cleanupStreamCallbacks[t.id]=this._setupTransportAccessForStream(t),await this._replaceTrack(e.id,t.track),t._replacingTrack=!1,t._onReplacingTrackDone.emit()})).disposer(this._disposer),this._listenStreamEnableChange(t,e.id);const i=this.pc.addTransceiver(t.track,{direction:"sendonly",streams:[this._ms]});e._onEncodingsChanged.add((async e=>{await setEncodingParams(i.sender,e).catch((e=>{this._log.error("_onEncodingsChanged failed",e)}))})).disposer(this._disposer),this.transceivers[e.id]=i}const i=await this.pc.createOffer().catch((e=>{throw createError({operationName:"Sender.add",info:{...errors.internal,detail:"can't create offer"},path:log66.prefix,context:this._context,channel:this.localPerson.channel,error:e})}));this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"offer",data:{offer:JSON.stringify(i)},createdAt:Date.now()}),await this.pc.setLocalDescription(i);const r=sdpTransform14.parse(this.pc.localDescription.sdp);this._log.debug("<add> create offer base",r);const s=this._getMid(e,r);if("data"!==e.contentType){applyCodecCapabilities(e.codecCapabilities??[],s,r);const t=sdpTransform14.write(r);if(await this.pc.setLocalDescription({type:"offer",sdp:t}),this._log.debug("<add> create offer",this.pc.localDescription),e.encodings?.length>0)if(isSafari());else{const t=this.transceivers[e.id];await setEncodingParams(t.sender,[e.encodings[0]])}}const n={kind:"senderProduceMessage",payload:{sdp:this.pc.localDescription,publicationId:e.id,info:{publicationId:e.id,streamId:t.id,mid:s}}};this._log.debug("[start] send message",n),await this.signaling.send(this.endpoint,n).catch((e=>{throw this._log.error("[failed] send message :",e,{localPersonId:this.localPerson.id,endpointId:this.endpoint.id}),e})),this._log.debug("[end] send message",n)}_setupTransportAccessForStream(e){e._getTransportCallbacks[this.endpoint.id]=()=>({rtcPeerConnection:this.pc,connectionState:this._connectionState});const t=()=>{delete e._getTransportCallbacks[this.endpoint.id],delete e._getStatsCallbacks[this.endpoint.id]};return this._disposer.push((()=>{t()})),this.onConnectionStateChanged.add((t=>{e._setConnectionState(this.endpoint,t),this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"skywayConnectionStateChange",data:{skywayConnectionState:t},createdAt:Date.now()})})).disposer(this._disposer),t}async remove(e){const t=this.publications[e];if(!t)return void this._log.warn("<remove> publication not found",createWarnPayload({operationName:"Sender.remove",detail:"publication already removed",channel:this.localPerson.channel,payload:{publicationId:e}}));if(delete this.publications[e],this._isNegotiating||"stable"!==this.pc.signalingState)return this._pendingPublications.push(e),void this._log.debug("<remove> isNegotiating",{publicationId:e,_isNegotiating:this._isNegotiating,signalingState:this.pc.signalingState});this._isNegotiating=!0,this._log.debug("<remove> [start]",{publicationId:e});const i=t.stream;if(!i)throw createError({operationName:"Sender.remove",info:{...errors.missingProperty,detail:"<remove> publication not have stream"},path:log66.prefix,context:this._context,channel:this.localPerson.channel,payload:{publication:t}});if("data"===i.contentType){this.datachannels[e].close(),delete this.datachannels[e]}else{this.transceivers[e].stop(),delete this.transceivers[e]}const r=await this.pc.createOffer().catch((e=>{throw createError({operationName:"Sender.remove",info:{...errors.internal,detail:"<remove> can't create offer"},path:log66.prefix,context:this._context,channel:this.localPerson.channel,error:e})}));this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.rtcPeerConnectionId,type:"offer",data:{offer:JSON.stringify(r)},createdAt:Date.now()}),await this.pc.setLocalDescription(r);const s={kind:"senderUnproduceMessage",payload:{sdp:this.pc.localDescription,publicationId:e}};this._log.debug("<remove> send message",{message:s}),await this.signaling.send(this.endpoint,s).catch((e=>{throw this._log.error("<remove> in remote error :",e,{localPersonId:this.localPerson.id,endpointId:this.endpoint.id}),e})),this._log.debug("<remove> [end]",{publicationId:e})}async _replaceTrack(e,t){const i=this.transceivers[e];i?await i.sender.replaceTrack(t).catch((e=>{throw createError({operationName:"Sender._replaceTrack",context:this._context,info:errors.internal,error:e,path:log66.prefix,channel:this.localPerson.channel})})):this._log.warn("can't replace track, transceiver not found",createWarnPayload({operationName:"Sender._replaceTrack",detail:"transceiver already removed",channel:this.localPerson.channel,payload:{publicationId:e}}))}async _handleReceiverAnswer({sdp:e}){"closed"!==this.pc.signalingState&&(this._log.debug("<handleReceiverAnswer> [start]"),await this.pc.setRemoteDescription(e).catch((t=>{const i=createError({operationName:"Sender._handleReceiverAnswer",context:this._context,info:{...errors.internal,detail:"failed to setRemoteDescription"},path:log66.prefix,payload:{sdp:e},channel:this.localPerson.channel,error:t});throw this._log.error(i),i})),this._log.debug("<handleReceiverAnswer> sRD"),await this.resolveCandidates(),this._log.debug("<handleReceiverAnswer> resolveCandidates"),await this.waitForSignalingState("stable"),this._log.debug("<handleReceiverAnswer> waitForSignalingState"),this._isNegotiating=!1,await this._resolvePendingSender(),this._log.debug("<handleReceiverAnswer> _resolvePendingSender",this._pendingPublications.length),this._log.debug("<handleReceiverAnswer> [end]"))}async _resolvePendingSender(){const e=this._pendingPublications.shift();e&&(this._log.debug("resolve pending sender",{publication:e}),"string"==typeof e?await this.remove(e):await this.add(e))}close(){this._log.debug("closed"),this.unSetPeerConnectionListener(),Object.values(this._unsubscribeStreamEnableChange).forEach((e=>e())),this.pc.close(),this._setConnectionState("disconnected"),this._disposer.dispose()}};function applyCodecCapabilities(e,t,i){const r=i.media.find((e=>e.mid?.toString()===t));if(!r)throw createError({operationName:"applyCodecCapabilities",info:{...errors.notFound,detail:"media not found"},path:log66.prefix});e.forEach((e=>{if(e.parameters)for(const[t,i]of Object.entries(e.parameters??{})){if(!1===i||!e.parameters[t])return;"usedtx"===t&&i&&(e.parameters[t]=1)}}));const s=(e,t,i)=>{const r=t.map((e=>({...e,parameters:getParameters(i,e.payload)}))),s=mimeTypeToCodec(e.mimeType);if(!s)return;return r.find((t=>t.codec.toLowerCase()===s.toLowerCase()&&(0===Object.keys(e.parameters??{}).length||("audio"===mimeTypeToContentType(e.mimeType)||(0,import_isEqual.default)(t.parameters,e.parameters??{})))))??void 0},n=e.map((e=>s(e,r.rtp,r.fmtp))).filter((e=>null!=e)),a=[...n,...r.rtp.filter((e=>!n.find((t=>t.payload===e.payload))))];for(const t of r.fmtp){const i=t.payload,n=a.find((e=>e.payload===i));if(n){const i=e.find((e=>s(e,[n],r.fmtp)));i&&i.parameters&&Object.keys(i.parameters).length>0&&(t.config="",Object.entries(i.parameters).forEach((([e,i])=>{!1===i||t.config.includes(e)||(t.config.length>0?t.config+=`;${e}=${i}`:t.config=`${e}=${i}`)})))}const o=a.find((e=>"opus"===e.codec.toLowerCase())),c=e.find((e=>"opus"===mimeTypeToCodec(e.mimeType).toLowerCase()))?.parameters?.usedtx;o&&!1!==c&&t.payload===o.payload&&!t.config.includes("usedtx")&&(t.config.length>0?t.config+=";usedtx=1":t.config="usedtx=1")}r.payloads=a.map((e=>e.payload.toString())).join(" ")}var mimeTypeToCodec=e=>e.split("/")[1],mimeTypeToContentType=e=>e.split("/")[0],log67=new import_common94.Logger("packages/core/src/plugin/internal/person/connection/index.ts"),P2PConnection=class{constructor(e,t,i,r,s,n,a){this._iceManager=e,this._signaling=t,this._analytics=i,this._context=r,this.channelId=s,this.localPerson=n,this.remoteMember=a,this.id=v4_default2(),this.type="p2p",this.onDisconnect=new import_common94.Event,this.onClose=new import_common94.Event,this.closed=!1,this.disconnected=!1,this._log=log67.createBlock({id:this.id,localPersonId:this.localPerson.id}),this._pubsubQueue=new import_common94.PromiseQueue,this.sendSubscriptionStatsReportTimers=new Map,this._waitingSendSubscriptionStatsReportsFromPublish=new Map,this._waitingSendSubscriptionStatsReportsFromSubscribe=[],this.sender=new Sender(this._context,this._iceManager,this._signaling,this._analytics,this.localPerson,this.remoteMember),this.receiver=new Receiver(this._context,this._iceManager,this._signaling,this._analytics,this.localPerson,this.remoteMember),this.sender.onDisconnect.once((()=>{this.disconnected=!0,this.onDisconnect.emit()})),this.receiver.onDisconnect.once((()=>{this.disconnected=!0,this.onDisconnect.emit()})),this._analytics&&this._analytics.onConnectionStateChanged.add((e=>{if("connected"===e){if(this._waitingSendSubscriptionStatsReportsFromPublish.size>0){for(const[e,t]of this._waitingSendSubscriptionStatsReportsFromPublish){const i=this.sender.publications[t];i&&this.startSendSubscriptionStatsReportTimer(i,e)}this._waitingSendSubscriptionStatsReportsFromPublish.clear()}if(this._waitingSendSubscriptionStatsReportsFromSubscribe.length>0){for(const e of this._waitingSendSubscriptionStatsReportsFromSubscribe){const t=this.receiver.subscriptions[e];t&&this.startSendSubscriptionStatsReportTimer(t,e)}this._waitingSendSubscriptionStatsReportsFromSubscribe=[]}}}))}async startPublishing(e,t){await this._pubsubQueue.push((async()=>{this._log.debug("startPublishing",{publication:e}),await this.sender.add(e)})),this._analytics&&!this._analytics.isClosed()&&(this._analytics.client.sendBindingRtcPeerConnectionToSubscription({subscriptionId:t,role:"sender",rtcPeerConnectionId:this.sender.rtcPeerConnectionId}),this._analytics.client.isConnectionEstablished()?this.startSendSubscriptionStatsReportTimer(e,t):this._waitingSendSubscriptionStatsReportsFromPublish.set(t,e.id))}async stopPublishing(e){await this._pubsubQueue.push((async()=>{this._log.debug("<stopPublishing> start",{publication:e}),this.sender.remove(e.id).then((()=>{this._log.debug("<stopPublishing> removed",{publication:e})})).catch((t=>{this._log.error("<stopPublishing> remove failed",t,{publication:e})})),this._closeIfNeeded(),this._log.debug("<stopPublishing> end",{publication:e})}));const t=this.sendSubscriptionStatsReportTimers.get(e.id);t&&(clearInterval(t),this.sendSubscriptionStatsReportTimers.delete(e.id))}async startSubscribing(e){await this._pubsubQueue.push((async()=>{this._log.debug("startSubscribing",{subscription:e}),this.receiver.add(e);const t=e.publication.id;let i=this.receiver.streams[t];i||(await this.receiver.onStreamAdded.watch((e=>e.publicationId===t),this._context.config.rtcConfig.timeout).catch((()=>{throw createError({operationName:"P2PConnection.startSubscribing",info:{...errors.timeout,detail:"onStreamAdded"},path:log67.prefix,context:this._context,channel:this.localPerson.channel,payload:{subscription:e}})})),i=this.receiver.streams[t]),i.setIsEnabled("enabled"===e.publication.state),e.codec=i.codec,e._setStream(i),this._analytics&&!this._analytics.isClosed()&&(this._analytics.client.sendBindingRtcPeerConnectionToSubscription({subscriptionId:e.id,role:"receiver",rtcPeerConnectionId:this.receiver.rtcPeerConnectionId}),this._analytics.client.isConnectionEstablished()?this.startSendSubscriptionStatsReportTimer(e,e.id):this._waitingSendSubscriptionStatsReportsFromSubscribe.push(e.id))}))}async stopSubscribing(e){await this._pubsubQueue.push((async()=>{this._log.debug("stopSubscribing",{subscription:e}),this.receiver.remove(e.id),this._closeIfNeeded()}));const t=this.sendSubscriptionStatsReportTimers.get(e.id);t&&(clearInterval(t),this.sendSubscriptionStatsReportTimers.delete(e.id))}_closeIfNeeded(){this.sender.hasMedia||this.receiver.hasMedia||this.close({reason:"no media"})}close({reason:e}={}){if(!this.closed){this.closed=!0,this._log.debug("closed",{endpointId:this.remoteMember.id,reason:e,sender:this.sender.id,receiver:this.receiver.id,id:this.id}),this.sender.close(),this.receiver.close();for(const e of this.sendSubscriptionStatsReportTimers.values())clearInterval(e);this.sendSubscriptionStatsReportTimers.clear(),this._waitingSendSubscriptionStatsReportsFromPublish.clear(),this._waitingSendSubscriptionStatsReportsFromSubscribe=[],this.onClose.emit()}}startSendSubscriptionStatsReportTimer(e,t){if(this._analytics){const t=this._analytics.client.getIntervalSec();this.sendSubscriptionStatsReportTimers.set(e.id,setInterval((async()=>{if(!this._analytics)throw createError({operationName:"P2PConnection.sendSubscriptionStatsReportTimer",info:{...errors.missingProperty,detail:"AnalyticsSession not exist"},path:log67.prefix,context:this._context,channel:this.localPerson.channel});if(this._analytics.isClosed()){const t=this.sendSubscriptionStatsReportTimers.get(e.id);t&&(clearInterval(t),this.sendSubscriptionStatsReportTimers.delete(e.id))}else;}),1e3*t))}}},log68=new import_common95.Logger("packages/core/src/plugin/internal/person/member.ts"),RemotePersonImpl=class extends MemberImpl{constructor(e){super(e),this.args=e,this.type="person",this.subtype="person",this.side="remote",this._connections={},this._context=this.args.channel._context,this._disposer=new import_common95.EventDisposer,this.onPublicationSubscribed=this._events.make(),this.onPublicationUnsubscribed=this._events.make(),this.onPublicationListChanged=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.subscribe=e=>new Promise(((t,i)=>{let r=!1;this.channel._subscribe(this.id,e).catch((e=>{r=!0,i(e)})),this.onPublicationSubscribed.watch((({subscription:t})=>t.publication.id===e),this._context.config.rtcApi.timeout).then((({subscription:e})=>{t({subscription:e})})).catch((()=>{r||i(createError({operationName:"RemotePersonImpl.subscribe",info:{...errors.timeout,detail:"onPublicationSubscribed"},path:log68.prefix,context:this._context,channel:this.channel}))}))})),this.plugin=e.plugin,this.channel.onPublicationUnsubscribed.add((({subscription:e})=>{e.subscriber.id===this.id&&(this.onPublicationUnsubscribed.emit({subscription:e}),this.onSubscriptionListChanged.emit())})).disposer(this._disposer),this.channel.onPublicationSubscribed.add((({subscription:e})=>{e.subscriber.id===this.id&&(this.onPublicationSubscribed.emit({subscription:e}),this.onSubscriptionListChanged.emit())})).disposer(this._disposer),this.channel.onStreamPublished.add((({publication:e})=>{e.publisher.id===this.id&&this.onPublicationListChanged.emit()})).disposer(this._disposer),this.channel.onStreamUnpublished.add((({publication:e})=>{e.publisher.id===this.id&&this.onPublicationListChanged.emit()})).disposer(this._disposer),this.onLeft.once((()=>{log68.debug("RemotePerson left: ",this.toJSON()),Object.values(this._connections).forEach((e=>{e.close({reason:"remote person left"})})),this._connections={}}))}_getConnection(e){return this._connections[e]}_getOrCreateConnection(e){return this._getConnection(e.id)??this._createConnection(this.channel,e,this)}_createConnection(e,t,i){if("local"!==t.side)throw createError({operationName:"RemotePersonImpl._createConnection",info:{...errors.invalidArgumentValue,detail:"wrong localPerson type"},path:log68.prefix,context:this._context,channel:this.channel});if(!t._signaling)throw createError({operationName:"RemotePersonImpl._createConnection",info:{...errors.missingProperty,detail:"signalingSession not exist"},path:log68.prefix,context:this._context,channel:this.channel});const r=new P2PConnection(t.iceManager,t._signaling,t._analytics,this._context,e.id,t,i);return this.plugin._messageBuffers[t.id].resolveMessagingBuffer(i),r.onClose.once((()=>{log68.debug("connection closed",this.toJSON(),{connectionId:r.id}),delete this._connections[t.id]})),this._connections[t.id]=r,r}async unsubscribe(e){await this.channel._unsubscribe(e)}_dispose(){this._disposer.dispose()}},PersonPlugin=class extends SkyWayPlugin{constructor(){super(...arguments),this.subtype="person",this._messageBuffers={},this._whenCreateLocalPerson=async e=>{e._signaling&&(this._messageBuffers[e.id]=new MessageBuffer(e._signaling))},this._whenDisposeLocalPerson=async e=>{const t=this._messageBuffers[e.id];t&&(t.close(),delete this._messageBuffers[e.id])},this._createRemoteMember=(e,t)=>new RemotePersonImpl({...this._context,context:this._context,channel:e,metadata:t.metadata,id:t.id,name:t.name,plugin:this})}},registerPersonPlugin=e=>{const t=new PersonPlugin;return e.registerPlugin(t),t},UnknownPlugin=class extends SkyWayPlugin{constructor(){super(...arguments),this.subtype="unknown",this._createRemoteMember=(e,t)=>new UnknownMemberImpl({...this._context,context:this._context,channel:e,metadata:t.metadata,id:t.id,name:t.name,plugin:this,subtype:t.subtype})}},PACKAGE_VERSION="1.15.2",log69=new import_common96.Logger("packages/core/src/context.ts"),_SkyWayContext=class e{constructor(e,t,i,r){this.config=t,this.authToken=i,this.info=r,this.disposed=!1,this.plugins=[],this._unknownPlugin=new UnknownPlugin,this._reminderSec=this.config.token.updateReminderSec,this._events=new import_common96.Events,this.onTokenUpdateReminder=this._events.make(),this.onTokenExpired=this._events.make(),this.onFatalError=this._events.make(),this._onTokenUpdated=this._events.make(),this._onDisposed=this._events.make(),this._authTokenString=i.tokenString,this.appId=this.authToken.getAppId(),registerPersonPlugin(this),this._api=e,this._api.onFatalError.once((e=>{log69.error("onFatalError",{appId:this.appId,error:e}),this.onFatalError.emit(createError({operationName:"SkyWayContext._api.onFatalError",context:this,info:errors.rtcApiFatalError,error:e,path:log69.prefix})),this.dispose()}))}static async Create(t,i){const r=new ContextConfig(i);import_common96.Logger.level=r.log.level,import_common96.Logger.format=r.log.format;const s=import_token5.SkyWayAuthToken.Decode(t),{osName:n,osVersion:a,browserName:o,browserVersion:c}=getRuntimeInfo({isNotBrowser:{browserName:"nodejs",browserVersion:"0.0.0",osName:"nodejs",osVersion:"0.0.0"}}),l={sdkName:"core",sdkVersion:this.version,osName:n,osVersion:a,browserName:o,browserVersion:c},u={rapi:r.rtcApi.domain,signaling:r.signalingService.domain,ice:r.iceParamServer.domain};log69.info("core sdk spawned",{operationName:"SkyWayContext.Create",runtime:l,endpoint:u,config:r,token:s});try{const i=s.getAppId(),n=await RtcApiClient.Create({appId:i,token:t,log:r.log,rtcApi:r.rtcApi}),a=new e(n,r,s,{endpoint:u,runtime:l});return await a._setTokenExpireTimer(),s.getAnalyticsEnabled(),a}catch(e){throw createError({operationName:"SkyWayContext.Create",info:errors.connectRtcApiFailed,error:e,path:log69.prefix})}}get authTokenString(){return this._authTokenString}async _setTokenExpireTimer(){const e=await this._api.getServerUnixtimeInSec(),t=this.authToken.exp-e;if(t<0)throw createError({operationName:"SkyWayContext._setTokenExpireTimer",context:this,info:errors.invalidExpireTokenValue,path:log69.prefix,payload:{exp:this.authToken.exp,now:e}});this.tokenUpdateReminderTimer&&clearTimeout(this.tokenUpdateReminderTimer);const i=t-this._reminderSec;if(i<0)throw createError({operationName:"SkyWayContext._setTokenExpireTimer",context:this,info:errors.invalidRemindExpireTokenValue,path:log69.prefix,payload:{expiresInSec:t,reminderSec:this._reminderSec}});log69.debug("_setTokenExpireTimer",{expiresInSec:t,tokenExpireReminderTimeSec:i}),this.tokenUpdateReminderTimer=setTimeout((()=>{log69.debug("tokenUpdateReminder",{appid:this.appId}),this.onTokenUpdateReminder.emit()}),1e3*i),this.tokenExpiredTimer&&clearTimeout(this.tokenExpiredTimer),this.tokenExpiredTimer=setTimeout((()=>{log69.debug("tokenExpired",{appid:this.appId}),this.onTokenExpired.emit()}),1e3*t)}async updateAuthToken(e){const t=import_token5.SkyWayAuthToken.Decode(e),i=t.getAppId();if(log69.info({operationName:"SkyWayContext.updateAuthToken"},{oldToken:this.authToken,newToken:t}),i!==this.appId)throw createError({operationName:"SkyWayContext.updateAuthToken",context:this,info:errors.invalidTokenAppId,path:log69.prefix,payload:{invalid:i,expect:this.appId}});this._authTokenString=e,this.authToken=t,this._onTokenUpdated.emit(e),await this._setTokenExpireTimer(),await this._api.updateAuthToken(e).catch((e=>{throw log69.warn("[failed] SkyWayContext.updateAuthToken",{detail:e}),e instanceof import_common96.SkyWayError&&"projectUsageLimitExceeded"===e.info?.name&&(this.dispose(),clearTimeout(this.tokenExpiredTimer)),e}))}registerPlugin(e){this.plugins.find((t=>t.subtype===e.subtype))||(e._attachContext(this),this.plugins.push(e))}_createRemoteMember(e,t){const i=e._getMember(t.id);if(i)return i;log69.debug("createRemoteMember",{memberDto:t}),t.type=t.type.toLowerCase(),t.subtype=t.subtype.toLowerCase();let r=this.plugins.find((e=>e.subtype===t.subtype));r||(r=this._unknownPlugin);return r._createRemoteMember(e,t)}dispose(){this.disposed||(this.disposed=!0,log69.debug("disposed",{appid:this.appId}),clearTimeout(this.tokenUpdateReminderTimer),this._onDisposed.emit(),this._events.dispose(),this._api.close())}};_SkyWayContext.version=PACKAGE_VERSION,_SkyWayContext.id=v4_default2();var SkyWayContext=_SkyWayContext,import_analytics_client=__toESM(require_dist7()),import_common97=__toESM(require_dist()),LOGGER_PREFIX="packages/core/src/external/analytics.ts",log70=new import_common97.Logger(LOGGER_PREFIX);async function setupAnalyticsSession(e){const{analyticsService:t}=e.config,i=new import_analytics_client.AnalyticsClient({token:e.authTokenString,sdkVersion:SkyWayContext.version,contextId:SkyWayContext.id},{logger:{error:async(t,i)=>{log70.error(`AnalyticsClient error: ${t}`,createError({operationName:"AnalyticsClient.logger",context:e,info:{...errors.internal,detail:"AnalyticsClient error"},error:i,path:log70.prefix}))},debug:(e,...t)=>{log70.debug("[analytics]:",e,...t)},warn:(e,...t)=>{log70.warn("[analytics]:",e,...t)}},analyticsLoggingServerDomain:t.domain,secure:t.secure}),r=new AnalyticsSession(i,e);return import_common97.Logger._onLogForAnalytics=e=>{e.prefix!==LOGGER_PREFIX&&i.bufferOrSendSdkLog(e)},r.connectWithTimeout().catch((t=>{r.close(),log70.error(`AnalyticsClient error: ${t.message}`,createError({operationName:"AnalyticsClient.logger",context:e,info:{...errors.internal,detail:"AnalyticsClient error"},error:t,path:log70.prefix})),r.onConnectionFailed.emit({})})),r}var AnalyticsSession=class{constructor(e,t){this.client=e,this.context=t,this.onConnectionFailed=new import_common97.Event,this.onConnectionStateChanged=new import_common97.Event,this.onMessage=new import_common97.Event,this._isClosed=!1,this._listen(),t._onTokenUpdated.add((e=>{this.client.setNewSkyWayAuthToken(e)}))}_listen(){this.client.onConnectionFailed.addOneTimeListener((()=>{this.onConnectionFailed.emit({})})),this.client.onConnectionStateChanged.addListener((e=>{"closed"===e&&!this.isClosed()&&this.client.isClosed()&&this.close(),this.onConnectionStateChanged.emit(e)}))}get connectionState(){return this.client.connectionState}async _connect(){log70.debug("[start] connect analyticsService"),await this.client.connect().then((()=>{log70.debug("[end] connect analyticsService")})).catch((e=>{this.close(),log70.debug("[end] failed connect analyticsService: also unreachable to server"),log70.error(`AnalyticsClient error: ${e.message}`,createError({operationName:"AnalyticsClient.logger",info:{...errors.internal,detail:"AnalyticsClient error"},error:e,path:log70.prefix})),this.onConnectionFailed.emit({})}))}async connectWithTimeout(){let e;const t=new Promise(((t,i)=>{e=setTimeout((()=>{log70.debug("[end] failed connect analyticsService: no initial response from the server"),i(new Error("failed connect analyticsService"))}),3e4)})),i=new Promise(((e,t)=>{this.client.onAnalyticsNotEnabledError.addOneTimeListener((t=>{log70.warn(`[end] failed connect analyticsService: ${t.reason}`),e()}))}));return Promise.race([this._connect(),t,i]).finally((()=>{clearTimeout(e)}))}close(){this._isClosed=!0,this.onConnectionFailed.removeAllListeners(),this.onConnectionStateChanged.removeAllListeners(),this.onMessage.removeAllListeners()}isClosed(){return this._isClosed}},import_common98=__toESM(require_dist()),log71=new import_common98.Logger("packages/core/src/media/factory.ts"),StreamFactory=class{constructor(e={}){this.navigator=new Navigator(e)}registerMediaDevices(e){this.navigator.mediaDevices=new MediaDevices({...this.navigator.mediaDevices.props,...e})}registerNodeGtkGst(e){this.gst=e}async registerAudioTestSrc({wave:e,rtpProcessor:t,gst:i}={}){e??(e="ticks"),i&&this.registerNodeGtkGst(i);const[r,s,n]=await MediaStreamTrackFactory.rtpSource({kind:"audio",cb:t}),a=this.gst.parseLaunch(`audiotestsrc wave=${e} ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay ! udpsink host=127.0.0.1 port=${s}`);return a.setState(this.gst.State.PLAYING),SkyWayStreamFactory.registerMediaDevices({audio:r}),()=>{n(),a.setState(this.gst.State.NULL)}}async registerVideoTestSrc({keyframeIntervalSec:e,codec:t,gst:i}){e??(e=2),i&&this.registerNodeGtkGst(i);const r=Math.round(30*e),[s,n,a]=await MediaStreamTrackFactory.rtpSource({kind:"video"}),o=this.gst.parseLaunch("h264"===t?`videotestsrc ! video/x-raw,width=640,height=480,format=I420 ! x264enc key-int-max=${r} ! rtph264pay ! udpsink host=127.0.0.1 port=${n}`:`videotestsrc ! video/x-raw,width=640,height=480,format=I420 ! vp8enc keyframe-max-dist=${r} ! rtpvp8pay picture-id-mode=1 ! udpsink host=127.0.0.1 port=${n}`);return o.setState(this.gst.State.PLAYING),SkyWayStreamFactory.registerMediaDevices({video:s}),()=>{a(),o.setState(this.gst.State.NULL)}}async createCameraVideoStream(e={}){e.stopTrackWhenDisabled=e.stopTrackWhenDisabled??!0;const[t]=(await this.navigator.mediaDevices.getUserMedia({video:e})).getTracks(),i=new LocalVideoStream(t,e);return i._setLabel("camera"),i}async createMicrophoneAudioStream(e={}){e.stopTrackWhenDisabled=e.stopTrackWhenDisabled??!0;const[t]=(await this.navigator.mediaDevices.getUserMedia({audio:e})).getTracks(),i=new LocalAudioStream(t,e);return i._setLabel("microphone"),i}async createDisplayStreams(e={}){const t=e.video??{};t.stopTrackWhenDisabled??(t.stopTrackWhenDisabled=!0);let i=e.audio;i&&(i="boolean"==typeof i?{}:i,i.stopTrackWhenDisabled??(i.stopTrackWhenDisabled=!0)),e={audio:i,video:t};const r=await this.navigator.mediaDevices.getDisplayMedia(e),[s]=r.getVideoTracks(),[n]=r.getAudioTracks();e.audio&&!n&&log71.warn(createWarnPayload({operationName:"StreamFactory.createDisplayStreams",detail:"This client does not support device audio capture"}));const a=new LocalVideoStream(s,{...t,isDisplayMedia:!0});a._setLabel("displayVideo");const o=n?new LocalAudioStream(n,{isDisplayMedia:!0}):void 0;return o&&o._setLabel("displayAudio"),{video:a,audio:o}}async createDataStream(e={}){return new LocalDataStream(e)}async createMicrophoneAudioAndCameraStream({audio:e,video:t}={}){const i=await this.navigator.mediaDevices.getUserMedia({audio:e??!0,video:t??!0}),[r]=i.getAudioTracks(),[s]=i.getVideoTracks();(e=e??{}).stopTrackWhenDisabled=e.stopTrackWhenDisabled??!0;const n=new LocalAudioStream(r,e);n._setLabel("microphone"),(t=t??{}).stopTrackWhenDisabled=t.stopTrackWhenDisabled??!0;const a=new LocalVideoStream(s,t);return a._setLabel("camera"),{audio:n,video:a}}},SkyWayStreamFactory=new StreamFactory,MediaDevice=class{constructor(e){this.id=e.deviceId,this.label=e.label,this.kind=e.kind}},import_common99=__toESM(require_dist()),log72=new import_common99.Logger("packages/core/src/media/stream/base.ts");function attachElement(e,t){if(void 0===(e??{})?.srcObject)throw createError({operationName:"attachElement",info:errors.invalidElement,payload:{element:e},path:log72.prefix});if(e.srcObject){const i=e.srcObject,r=i.getTracks().find((e=>"ended"===e.readyState));r&&i.removeTrack(r);const s=i.getTracks().find((e=>e.kind===t.kind));s&&i.removeTrack(s),i.addTrack(t)}else e.srcObject=new MediaStream([t])}function detachElement(e,t){if(void 0===(e??{})?.srcObject)throw createError({operationName:"attachElement",info:errors.invalidElement,payload:{element:e},path:log72.prefix});const i=e.srcObject;i.getTracks().length>0&&i.removeTrack(t),0===i.getTracks().length&&(e.srcObject=null)}__reExport(src_exports,__toESM(require_dist())),__reExport(src_exports,__toESM(require_dist4())),__reExport(core_exports,src_exports);var import_common105=__toESM(require_dist()),import_common101=__toESM(require_dist()),defaultSfuApiOptions={domain:"sfu.skyway.ntt.com",secure:!0,version:4},errors4={invalidParameter:{name:"invalidParameter",detail:"",solution:""},invalidRequestParameter:{name:"invalidRequestParameter",detail:"リクエストの値が不正です",solution:"正しい値を入力してください"},notFound:{name:"notFound",detail:"対象のリソースが見つかりません",solution:"対象のリソースが存在するか確かめてください"},maxSubscriberExceededError:{name:"maxSubscribersExceededError",detail:"forwardingのmaxSubscribersの制限を超えています。maxSubscribersの値を超えてSubscribeすることはできません",solution:"maxSubscribersの範囲内でご利用ください"},quotaExceededError:{name:"quotaExceededError",detail:"リソースの制限量を超えてリソースを利用することはできません",solution:"リソース制限量の範囲内でご利用ください"},timeout:{name:"timeout",detail:"",solution:""},insufficientPermissions:{name:"insufficientPermissions",detail:"tokenの権限が不足しています",solution:"tokenに必要な権限を付与してください"},backendError:{name:"backendError:",detail:"",solution:""},notAllowedConsumeError:{name:"notAllowedConsumeError",detail:"ForwardingからのConsume許可がありません",solution:"Forwardingしているmemberによる許可操作が必要です"}},import_common100=__toESM(require_dist());function createError5({operationName:e,info:t,error:i,path:r,payload:s}){return new import_common100.SkyWayError({error:i,info:t,payload:{payload:s,operationName:e},path:r})}function createWarnPayload4({appId:e,detail:t,channelId:i,operationName:r,payload:s,memberId:n,botId:a}){return{operationName:r,payload:s,detail:t,appId:e,channelId:i,memberId:n,botId:a}}var log73=new import_common101.Logger("packages/sfu-api-client/src/api.ts"),SfuRestApiClient=class{constructor(e,t){this._token=e,this._headers={authorization:`Bearer ${this._token}`},this.options={...defaultSfuApiOptions,...t},this.endpoint=`http${this.options.secure?"s":""}://${this.options.domain}/v${this.options.version}`,this.http=new import_common101.HttpClient(this.endpoint),import_common101.Logger.level=this.options.log.level,import_common101.Logger.format=this.options.log.format,log73.debug("SfuRestApiClient spawned",{endpoint:this.endpoint})}updateToken(e){this._token=e}_commonErrorHandler(e,t){switch(e?.status){case 401:return createError5({operationName:t,info:errors4.invalidRequestParameter,path:log73.prefix,payload:e});case 403:return createError5({operationName:t,info:errors4.insufficientPermissions,path:log73.prefix,payload:e});case 404:return createError5({operationName:t,info:errors4.notFound,path:log73.prefix,payload:e});case 429:return createError5({operationName:t,info:errors4.quotaExceededError,path:log73.prefix,payload:e});default:return createError5({operationName:t,info:errors4.backendError,path:log73.prefix,payload:e})}}async createBot({appId:e,channelId:t}){return(await this.http.post("/bots",{appId:e,channelId:t},{headers:{authorization:`Bearer ${this._token}`}}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.createBot")}))).id}async deleteBot({botId:e}){await this.http.delete(`/bots/${e}`,{headers:{authorization:`Bearer ${this._token}`}}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.deleteBot")}))}async startForwarding({botId:e,publicationId:t,maxSubscribers:i,contentType:r,publisherId:s}){const n=new import_common101.BackOff,a={publicationId:t,maxSubscribers:i,contentType:r[0].toUpperCase()+r.slice(1),publisherId:s},o=await this.http.post(`/bots/${e}/forwardings`,a,{headers:{authorization:`Bearer ${this._token}`},retry:async e=>![400,403,429].includes(e.status)&&await n.wait()}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.startForwarding")}));return n.count>0&&log73.warn("success to retry startForwarding",createWarnPayload4({operationName:"SfuRestApiClient.startForwarding",detail:"success to retry startForwarding",botId:e,memberId:s,payload:{publicationId:t,count:n.count}})),o}async createProducer({botId:e,forwardingId:t,transportId:i,producerOptions:r}){const s=new import_common101.BackOff,n=await this.http.put(`/bots/${e}/forwardings/${t}/transports/producers`,{transportId:i,producerOptions:r},{headers:{authorization:`Bearer ${this._token}`},retry:async()=>await s.wait()}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.createProducer")}));return s.count>0&&log73.warn("success to retry createProducer",createWarnPayload4({operationName:"SfuRestApiClient.createProducer",detail:"success to retry createProducer",botId:e,payload:{forwardingId:t,transportId:i,count:s.count}})),n}async createConsumer({botId:e,forwardingId:t,rtpCapabilities:i,subscriptionId:r,subscriberId:s,spatialLayer:n,originPublicationId:a}){const o=new import_common101.BackOff({times:5,interval:100}),c={rtpCapabilities:i,subscriptionId:r,subscriberId:s,spatialLayer:n,originPublicationId:a},l=await this.http.post(`/bots/${e}/forwardings/${t}/transports/consumers`,c,{retry:async e=>![400,403,429].includes(e.status)&&await o.wait(),headers:{authorization:`Bearer ${this._token}`}}).catch((e=>{throw 429===e.status?createError5({operationName:"SfuRestApiClient.createConsumer",info:errors4.maxSubscriberExceededError,path:log73.prefix,payload:e}):403===e.status?createError5({operationName:"SfuRestApiClient.createConsumer",info:errors4.notAllowedConsumeError,path:log73.prefix,payload:e}):this._commonErrorHandler(e,"SfuRestApiClient.createConsumer")}));return o.count>0&&log73.warn("success to retry createConsumer",createWarnPayload4({operationName:"SfuRestApiClient.createConsumer",detail:"success to retry createConsumer",botId:e,payload:{forwardingId:t,count:o.count}})),log73.debug("response of createConsumer",l),l}async connect({transportId:e,dtlsParameters:t}){const i=new import_common101.BackOff,r={transportId:e,dtlsParameters:t},s=await this.http.put("/transports/connections",r,{headers:{authorization:`Bearer ${this._token}`},retry:async()=>await i.wait()}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.connect")}));return i.count>0&&log73.warn("success to retry connect",createWarnPayload4({operationName:"SfuRestApiClient.connect",detail:"success to retry connect",payload:{transportId:e,count:i.count}})),s}async changeConsumerLayer({transportId:e,consumerId:t,spatialLayer:i,publicationId:r}){return await this.http.put(`transports/consumers/${t}/layers`,{transportId:e,spatialLayer:i,publicationId:r},{headers:{authorization:`Bearer ${this._token}`}}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.changeConsumerLayer")}))}stopForwarding({botId:e,forwardingId:t}){let i=!1;return{promise:this.http.delete(`/bots/${e}/forwardings/${t}`,{headers:{authorization:`Bearer ${this._token}`}}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.stopForwarding")})).then((e=>{i=e})),fulfilled:i}}async iceRestart({transportId:e}){return(await this.http.put("/transports/connections/ice",{transportId:e},{headers:this._headers}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.iceRestart")}))).iceParameters}async getRtpCapabilities({botId:e,forwardingId:t,originPublicationId:i}){const r=new import_common101.BackOff,s=await this.http.get(`/bots/${e}/forwardings/${t}/transports/rtp-capabilities?originPublicationId=${i}`,{headers:{authorization:`Bearer ${this._token}`},retry:async()=>await r.wait()}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.getRtpCapabilities")}));return r.count>0&&log73.warn("getCapabilities to retry connect",createWarnPayload4({operationName:"SfuRestApiClient.getRtpCapabilities",detail:"getCapabilities to retry connect",botId:e,payload:{forwardingId:t,count:r.count}})),s.rtpCapabilities}async confirmSubscription({forwardingId:e,subscriptionId:t,identifierKey:i}){const r={forwardingId:e,subscriptionId:t,identifierKey:i},s=await this.http.post("/confirm-subscription",r,{headers:{authorization:`Bearer ${this._token}`}}).catch((e=>{throw this._commonErrorHandler(e,"SfuRestApiClient.confirmSubscription")}));return log73.debug("response of confirmSubscription",s),s}},errors5={...errors4,invalidParameter:{name:"invalidParameter",detail:"",solution:""},timeout:{name:"timeout",detail:"",solution:""},internal:{name:"internal",detail:"",solution:""},sfuBotNotInChannel:{name:"sfuBotNotInChannel",detail:"SfuBotがChannelに存在しません",solution:"操作しようとしているSfuBotが正しいか確かめてください"},remotePublisherId:{name:"remotePublisherId",detail:"publisherがremoteのPublicationをForwardingすることはできません",solution:"PublicationがLocalでPublishされたものか確かめてください"},dataStreamNotSupported:{name:"dataStreamNotSupported",detail:"dataStreamはSFUに対応していません",solution:"ありません"},streamNotExistInPublication:{name:"streamNotExistInPublication",detail:"PublicationにStreamがありません。RemoteMemberのPublicationのStreamにはアクセスできません",solution:"参照しているPublicationが目的のものか確かめてください。"},invalidPreferredEncoding:{name:"invalidPreferredEncoding",detail:"preferredEncodingの値が不正です。エンコード設定切り替え機能が使えません",solution:"正しい文字列を入力してください"},invalidEncodings:{name:"invalidEncodings",detail:"エンコード設定が設定されていません。エンコード設定切り替え機能が使えません",solution:"エンコード設定切り替え機能を利用する場合はエンコード設定をしたPublicationをForwardingしてください"},receiverNotFound:{name:"receiverNotFound",detail:"SFUはRemoteMemberのSubscriptionを操作できません",solution:"SFUでsubscriptionの操作をする際にはLocalPersonがSubscribeしているSubscriptionインスタンスを利用してください"},consumerNotFound:{name:"consumerNotFound",detail:"SFUはLocalPersonがUnsubscribeしたSubscriptionを操出来ません",solution:"操作対象のSubscriptionが正しいか確かめてください"},forwardingNotFound:{name:"forwardingNotFound",detail:"存在しないForwardingを操作しようとしています",solution:"対象のForwardingが正しいか確かめてください"},netWorkError:{name:"netWorkError",detail:"通信環境に問題があります",solution:"ネットワーク接続状況を確認してください"},confirmSubscriptionFailed:{name:"confirmSubscriptionFailed",detail:"Forwardingのconsume許可を出すのに失敗しました",solution:"ありません"}},core_exports2={};function getLayerFromEncodings(e,t){let i=0;for(;i<t.length;i++){if(t[i].id===e)break}return i}function createWarnPayload5({channel:e,detail:t,operationName:i,payload:r,bot:s}){const n={operationName:i,payload:r,detail:t};return e&&(n.appId=e.appId,n.channelId=e.id,e.localPerson&&(n.memberId=e.localPerson.id)),s&&(n.botId=s.id,n.appId=s.channel.appId,n.channelId=s.channel.id,n.memberId=s.channel.localPerson?.id),n}__export(core_exports2,{AnalyticsSession:()=>AnalyticsSession,ContextConfig:()=>ContextConfig,IceManager:()=>IceManager,LocalAudioStream:()=>LocalAudioStream,LocalCustomVideoStream:()=>LocalCustomVideoStream,LocalDataStream:()=>LocalDataStream,LocalMediaStreamBase:()=>LocalMediaStreamBase,LocalPersonAdapter:()=>LocalPersonAdapter,LocalPersonImpl:()=>LocalPersonImpl,LocalStreamBase:()=>LocalStreamBase,LocalVideoStream:()=>LocalVideoStream,MediaDevice:()=>MediaDevice,MemberImpl:()=>MemberImpl,P2PConnection:()=>P2PConnection,PACKAGE_VERSION:()=>PACKAGE_VERSION,PublicationImpl:()=>PublicationImpl,RemoteAudioStream:()=>RemoteAudioStream,RemoteDataStream:()=>RemoteDataStream,RemoteMediaStreamBase:()=>RemoteMediaStreamBase,RemotePersonImpl:()=>RemotePersonImpl,RemoteStreamBase:()=>RemoteStreamBase,RemoteVideoStream:()=>RemoteVideoStream,SkyWayChannel:()=>SkyWayChannel,SkyWayChannelImpl:()=>SkyWayChannelImpl,SkyWayContext:()=>SkyWayContext,SkyWayPlugin:()=>SkyWayPlugin,SkyWayStreamFactory:()=>SkyWayStreamFactory,StreamFactory:()=>StreamFactory,SubscriptionImpl:()=>SubscriptionImpl,attachElement:()=>attachElement,convertConnectionState:()=>convertConnectionState,createError:()=>createError,createLocalPerson:()=>createLocalPerson,createLogPayload:()=>createLogPayload,createPublication:()=>createPublication,createRemoteStream:()=>createRemoteStream,createSubscription:()=>createSubscription,createTestVideoTrack:()=>createTestVideoTrack,createWarnPayload:()=>createWarnPayload,detachElement:()=>detachElement,detectDevice:()=>detectDevice,errors:()=>errors,fmtpConfigParser:()=>fmtpConfigParser,getBitrateFromPeerConnection:()=>getBitrateFromPeerConnection,getParameters:()=>getParameters,getRtcRtpCapabilities:()=>getRtcRtpCapabilities,getRuntimeInfo:()=>getRuntimeInfo,isRemoteMember:()=>isRemoteMember,isSafari:()=>isSafari,normalizeEncodings:()=>normalizeEncodings,objectFlag:()=>objectFlag,setEncodingParams:()=>setEncodingParams,setupAnalyticsSession:()=>setupAnalyticsSession,sortEncodingParameters:()=>sortEncodingParameters,statsToArray:()=>statsToArray,statsToJson:()=>statsToJson,waitForLocalStats:()=>waitForLocalStats}),__reExport(core_exports2,src_exports);var import_common102=__toESM(require_dist()),log74=new import_common102.Logger("packages/sfu-bot/src/connection/receiver.ts"),Receiver2=class{constructor(e,t,i,r,s,n,a){this.subscription=e,this._api=t,this._transportRepository=i,this._localPerson=r,this._bot=s,this._iceManager=n,this._context=a,this._disposer=new import_common102.EventDisposer,this.sendSubscriptionStatsReportTimer=null,this._waitingSendSubscriptionStatsReports=[];const o=this._localPerson._analytics;o&&o.onConnectionStateChanged.add((e=>{if("connected"===e&&this._waitingSendSubscriptionStatsReports.length>0){for(const e of this._waitingSendSubscriptionStatsReports)this.consumer&&this.consumer.id===e&&this.startSendSubscriptionStatsReportTimer();this._waitingSendSubscriptionStatsReports=[]}}))}toJSON(){return{transport:this.transport,subscription:this.subscription}}async consume(){let e=this._transportRepository.rtpCapabilities;e||(log74.debug("[start] getCapabilities"),e=await this._api.getRtpCapabilities({botId:this._bot.id,forwardingId:this.subscription.publication.id,originPublicationId:this.subscription.publication.origin.id}),log74.debug("[end] getCapabilities"),await this._transportRepository.loadDevice(e).catch((e=>{throw createError({operationName:"Receiver.consume",context:this._context,channel:this._localPerson.channel,info:{...errors5.internal,detail:"sfu loadDevice failed"},path:log74.prefix,error:e})})));const t=this.subscription.preferredEncoding?getLayerFromEncodings(this.subscription.preferredEncoding,this.subscription.publication.origin?.encodings??[]):void 0;log74.debug("[start] createConsumer",{subscription:this.subscription});const{consumerOptions:i,transportOptions:r,transportId:s,producerId:n}=await this._api.createConsumer({botId:this._bot.id,forwardingId:this.subscription.publication.id,rtpCapabilities:e,subscriptionId:this.subscription.id,subscriberId:this.subscription.subscriber.id,spatialLayer:t,originPublicationId:this.subscription.publication.origin.id});r&&this._transportRepository.createTransport(this._localPerson.id,this._bot,r,"recv",this._iceManager,this._localPerson._analytics),this.transport=this._transportRepository.getTransport(this._localPerson.id,s),this.transport||(log74.warn("transport is under race condition",{transportId:s}),await this._transportRepository.onTransportCreated.watch((e=>e===s),this._bot.options.endpointTimeout).catch((e=>{throw createError({operationName:"Receiver.consume",context:this._context,channel:this._localPerson.channel,info:{...errors5.timeout,detail:"receiver sfuTransport not found"},path:log74.prefix,error:e,payload:{transportOptions:r,transportId:s,producerId:n,consumerOptions:i,subscription:this.subscription}})})),this.transport=this._transportRepository.getTransport(this._localPerson.id,s)),this._localPerson._analytics&&!this._localPerson._analytics.isClosed()&&this._localPerson._analytics.client.sendBindingRtcPeerConnectionToSubscription({subscriptionId:this.subscription.id,role:"receiver",rtcPeerConnectionId:this.transport.id}),log74.debug("[end] createConsumer"),log74.debug("[start] consume",{consumerOptions:i,subscription:this.subscription});const a=await this.transport.msTransport.consume({...i,producerId:n}).catch((e=>{throw createError({operationName:"Receiver.consume",context:this._context,channel:this._localPerson.channel,info:{...errors5.internal,detail:"consume failed, maybe subscribing unsupported codec"},path:log74.prefix,error:e})}));this.consumer=a,log74.debug("[end] consume",{subscription:this.subscription});const[o]=a.rtpParameters.codecs,c=createRemoteStream((0,core_exports2.uuidV4)(),a.track,o),l={mimeType:o.mimeType,parameters:o.parameters};this._setupTransportAccessForStream(c,a);const u=this._localPerson._analytics;return u&&!u.isClosed()&&(u.client.isConnectionEstablished()?this.startSendSubscriptionStatsReportTimer():this._waitingSendSubscriptionStatsReports.push(a.id)),{stream:c,codec:l}}_setupTransportAccessForStream(e,t){const i=this.transport,r=this.pc;e._getTransport=()=>({rtcPeerConnection:r,connectionState:i.connectionState,info:this}),this._disposer.push((()=>{e._getTransport=()=>{}})),i.onConnectionStateChanged.add((t=>{log74.debug("transport connection state changed",i.id,t),e._setConnectionState(t)}))}unconsume(){this.consumer?(this.consumer.close(),this.consumer=void 0,this.sendSubscriptionStatsReportTimer&&clearInterval(this.sendSubscriptionStatsReportTimer)):log74.debug("unconsume failed, consumer not exist",{subscription:this.subscription})}close(){this._disposer.dispose()}get pc(){return this.transport?.pc}startSendSubscriptionStatsReportTimer(){const e=this._localPerson._analytics;if(e){const t=e.client.getIntervalSec();this.sendSubscriptionStatsReportTimer=setInterval((async()=>{if(e&&!e.isClosed()){if(this.consumer){const t=await this.consumer.getStats();t&&e.client.sendSubscriptionStatsReport(t,{subscriptionId:this.subscription.id,role:"receiver",contentType:this.subscription.contentType,createdAt:Date.now()})}}else this.sendSubscriptionStatsReportTimer&&clearInterval(this.sendSubscriptionStatsReportTimer)}),1e3*t)}}},import_common104=__toESM(require_dist()),import_isEqual2=__toESM(require_isEqual()),import_common103=__toESM(require_dist()),log75=new import_common103.Logger("packages/sfu-bot/src/connection/sender.ts"),Forwarding=class{constructor(e){this.props=e,this.state="started",this.configure=this.props.configure,this.originPublication=this.props.originPublication,this.relayingPublication=this.props.relayingPublication,this._identifierKey=this.props.identifierKey,this._api=this.props.api,this._context=this.props.context,this.onStopped=new import_common103.Event,this.relayingPublication.onSubscribed.add((async e=>{await this.confirmSubscription(e.subscription).catch((e=>e))})),this.relayingPublication.subscriptions.forEach((async e=>{await this.confirmSubscription(e).catch((e=>e))}))}get id(){return this.relayingPublication.id}_stop(){this.state="stopped",this.onStopped.emit()}toJSON(){return{id:this.id,configure:this.configure,originPublication:this.originPublication,relayingPublication:this.relayingPublication}}async confirmSubscription(e){log75.debug("[start] Forwarding confirmSubscription");const{message:t}=await this._api.confirmSubscription({forwardingId:this.id,subscriptionId:e.id,identifierKey:this._identifierKey}).catch((e=>{throw log75.error("Forwarding confirmSubscription failed:",e),createError({operationName:"Forwarding.confirmSubscription",context:this._context,info:errors5.confirmSubscriptionFailed,path:log75.prefix,payload:e})}));log75.debug("[end] Forwarding confirmSubscription",{message:t})}},log76=new import_common104.Logger("packages/sfu-bot/src/connection/sender.ts"),Sender2=class{constructor(e,t,i,r,s,n,a,o){this.publication=e,this.channel=t,this._api=i,this._transportRepository=r,this._localPerson=s,this._bot=n,this._iceManager=a,this._context=o,this._disposer=new import_common104.EventDisposer,this._connectionState="new",this.onConnectionStateChanged=new import_common104.Event,this.closed=!1,this.sendSubscriptionStatsReportTimer=null,this._waitingSendSubscriptionStatsReports=[];const c=this._localPerson._analytics;c&&c.onConnectionStateChanged.add((e=>{if("connected"===e&&this._waitingSendSubscriptionStatsReports.length>0){for(const e of this._waitingSendSubscriptionStatsReports)this._producer&&this._producer.id===e&&this.startSendSubscriptionStatsReportTimer();this._waitingSendSubscriptionStatsReports=[]}}))}_setConnectionState(e){this._connectionState!==e&&(log76.debug("_setConnectionState",{state:e,forwardingId:this.forwardingId}),this._connectionState=e,this.onConnectionStateChanged.emit(e))}toJSON(){return{forwarding:this.forwarding,broadcasterTransport:this._broadcasterTransport,_connectionState:this._connectionState}}async startForwarding(e){if("data"===this.publication.contentType)throw createError({operationName:"Sender.startForwarding",context:this._context,info:errors5.dataStreamNotSupported,path:log76.prefix,channel:this.channel});const t=this.publication.stream;if(!t)throw createError({operationName:"Sender.startForwarding",context:this._context,info:errors5.streamNotExistInPublication,path:log76.prefix,channel:this.channel});this.onConnectionStateChanged.add((e=>{log76.debug("transport connection state changed",this._broadcasterTransport?.id,e),t._setConnectionState(this._bot,e)})).disposer(this._disposer),log76.debug("[start] Sender startForwarding",{botId:this._bot.id,publicationId:this.publication.id,contentType:this.publication.contentType,maxSubscribers:e.maxSubscribers});const{forwardingId:i,broadcasterTransportId:r,broadcasterTransportOptions:s,rtpCapabilities:n,identifierKey:a}=await this._api.startForwarding({botId:this._bot.id,publicationId:this.publication.id,contentType:this.publication.contentType,maxSubscribers:e.maxSubscribers,publisherId:this.publication.publisher.id});if(this.forwardingId=i,s&&(log76.debug("sender create new transport",{broadcasterTransportOptions:s}),await this._transportRepository.loadDevice(n),this._broadcasterTransport=this._transportRepository.createTransport(this._localPerson.id,this._bot,s,"send",this._iceManager,this._localPerson._analytics)),this._broadcasterTransport=this._transportRepository.getTransport(this._localPerson.id,r),!this._broadcasterTransport)throw createError({operationName:"Sender.startForwarding",context:this._context,info:{...errors5.internal,detail:"_broadcasterTransport not found"},path:log76.prefix,channel:this.channel,payload:{broadcasterTransportOptions:s}});this._broadcasterTransport.onConnectionStateChanged.add((e=>{this._setConnectionState(e)})).disposer(this._disposer),this._setConnectionState(this._broadcasterTransport.connectionState);const o=await this._produce(t,this._broadcasterTransport);this._cleanupStreamCallbacks=this._setupTransportAccessForStream(t,this._broadcasterTransport,o);const c=this._localPerson._analytics;c&&!c.isClosed()&&(c.client.isConnectionEstablished()?this.startSendSubscriptionStatsReportTimer():this._waitingSendSubscriptionStatsReports.push(o.id)),log76.debug("[end] Sender startForwarding",{forwardingId:i});let l=this.channel._getPublication(i);l||(l=(await this.channel.onStreamPublished.watch((e=>e.publication.id===i),this._context.config.rtcApi.timeout).catch((()=>{throw createError({operationName:"Sender.startForwarding",context:this._context,info:{...errors5.timeout,detail:"SfuBotMember onStreamPublished"},path:log76.prefix,channel:this.channel,payload:{forwardingId:i}})}))).publication);const u=new Forwarding({configure:e,originPublication:this.publication,relayingPublication:l,api:this._api,context:this._context,identifierKey:a});this.forwarding=u;const d=this.channel.subscriptions.find((e=>e.publication.id===this.publication.id)),[p]=o.rtpParameters.codecs;return d.codec=p,this._localPerson._analytics&&"closed"!==this._localPerson._analytics.client.connectionState&&this._localPerson._analytics.client.sendBindingRtcPeerConnectionToSubscription({subscriptionId:d.id,role:"sender",rtcPeerConnectionId:this._broadcasterTransport.id}),isSafari()&&waitForLocalStats({stream:t,remoteMember:this._bot.id,end:e=>{const t=e.find((e=>e.id.includes("RTCOutboundRTP")||e.type.includes("outbound-rtp")));return t?.keyFramesEncoded>0},interval:10}).then((async()=>{const e=this.publication.encodings;e?.length>0&&await setEncodingParams(o.rtpSender,e).catch((e=>{log76.error("_onEncodingsChanged failed",e,this)}))})).catch((e=>{log76.error("setEncodingParams waitForLocalStats failed",e,this)})),waitForLocalStats({stream:t,remoteMember:this._bot.id,end:e=>!!e.find((e=>e.type.includes("local-candidate")))}).then((async()=>{const e=await createLogPayload({operationName:"startForwarding/waitForLocalStats",channel:this.channel});log76.debug(e,"forwarding connection connected",{broadcasterTransportId:r})})).catch((()=>{})),u}_listenStreamEnableChange(e){this._unsubscribeStreamEnableChange&&this._unsubscribeStreamEnableChange();const{removeListener:t}=e._onEnableChanged.add((async e=>{await this._replaceTrack(e).catch((e=>{log76.warn(createWarnPayload5({detail:"replaceTrack failed",operationName:"Sender._listenStreamEnableChange",bot:this._bot,payload:e}))}))}));this._unsubscribeStreamEnableChange=t}async _produce(e,t){this.publication._onReplaceStream.add((async({newStream:e})=>{if(!this._broadcasterTransport)throw createError({operationName:"Sender._produce",context:this._context,info:{...errors5.internal,detail:"_broadcasterTransport not found"},path:log76.prefix,channel:this.channel});this._listenStreamEnableChange(e),this._cleanupStreamCallbacks&&this._cleanupStreamCallbacks(),this._cleanupStreamCallbacks=this._setupTransportAccessForStream(e,this._broadcasterTransport,l),await this._replaceTrack(e.track)})).disposer(this._disposer),this._listenStreamEnableChange(e);const i=(0,core_exports2.uuidV4)(),r={track:e.track,stopTracks:!1,appData:{transactionId:i},disableTrackOnPause:!1},s=this.publication.encodings;s&&(r.encodings=s),this.publication._onEncodingsChanged.add((async e=>{await setEncodingParams(l.rtpSender,e).catch((e=>{log76.error("_onEncodingsChanged failed",e,this)}))})).disposer(this._disposer);const n=this.publication.codecCapabilities,[a]=n,o=a.mimeType.split("/")[0],c={...a,kind:o,clockRate:9e4};if("audio"===o&&(c.channels??(c.channels=2),c.clockRate=48e3),log76.debug("selected codec",{codec:c}),r.codec=c,"video"===e.contentType&&this._fixVideoCodecWithParametersOrder(c),"audio"===e.contentType){const e=n.find((e=>"audio/opus"===e.mimeType.toLowerCase()))?.parameters?.usedtx;!1!==e&&(r.codecOptions={...r.codecOptions,opusDtx:!0});const t=n.find((e=>"audio/opus"===e.mimeType.toLowerCase()))?.parameters?.stereo;t&&(r.codecOptions={...r.codecOptions,opusStereo:!0});const i=n.find((e=>"audio/opus"===e.mimeType.toLowerCase()))?.parameters?.useinbandfec;i&&(r.codecOptions={...r.codecOptions,opusFec:!0})}t.onProduce.watch((e=>e.producerOptions.appData?.transactionId===i),this._context.config.rtcConfig.timeout).then((async e=>{try{const{producerId:i}=await this._api.createProducer({botId:this._bot.id,transportId:t.id,forwardingId:this.forwardingId,producerOptions:e.producerOptions});e.callback({id:i})}catch(t){e.errback(t)}})).catch((e=>{log76.error("onProduce failed",e,this)})),log76.debug("[start] msTransport.produce",this);const l=await t.msTransport.produce(r).catch((e=>{throw createError({operationName:"Sender._produce",context:this._context,info:{...errors5.internal,detail:"msTransport.produce failed"},path:log76.prefix,channel:this.channel,error:e})}));return log76.debug("[end] msTransport.produce",this),this._producer=l,l}_fixVideoCodecWithParametersOrder(e){const t=this._broadcasterTransport.msTransport._handler,i=t=>t.mimeType===e.mimeType&&(!(e.parameters&&Object.keys(e.parameters).length>0)||!!(0,import_isEqual2.default)(t.parameters,e.parameters)),r=(e,t)=>{for(const i of Object.keys(e))"payloadType"!==i&&(e[i]=t[i])};if(t._sendingRtpParametersByKind){const e=t._sendingRtpParametersByKind.video,s=e.codecs.find(i);if(e&&s){const t=JSON.parse(JSON.stringify(e)),[i]=e.codecs,n=JSON.parse(JSON.stringify(i));r(i,s),r(s,n),log76.debug("sort _sendingRtpParametersByKind",{origin:t,new:e.codecs})}}if(t._sendingRemoteRtpParametersByKind){const e=t._sendingRemoteRtpParametersByKind.video,s=e.codecs.find(i);if(e&&s){const t=JSON.parse(JSON.stringify(e)),[i]=e.codecs,n=JSON.parse(JSON.stringify(i));r(i,s),r(s,n),log76.debug("sort _sendingRemoteRtpParametersByKind",{origin:t,new:e.codecs})}}}_setupTransportAccessForStream(e,t,i){e._getTransportCallbacks[this._bot.id]=()=>({rtcPeerConnection:t.pc,connectionState:t.connectionState,info:this});const r=()=>{delete e._getTransportCallbacks[this._bot.id],delete e._getStatsCallbacks[this._bot.id]};return this._disposer.push((()=>{r()})),r}unproduce(){this._producer&&(this._producer.close(),this._producer=void 0,this.sendSubscriptionStatsReportTimer&&clearInterval(this.sendSubscriptionStatsReportTimer))}async _replaceTrack(e){await(this._producer?.replaceTrack?.({track:e}).catch((e=>{throw createError({operationName:"Sender._replaceTrack",context:this._context,info:errors5.internal,error:e,path:log76.prefix,channel:this.channel})})))}close(){this.closed=!0,this._unsubscribeStreamEnableChange&&this._unsubscribeStreamEnableChange(),this._setConnectionState("disconnected"),this._disposer.dispose()}get pc(){return this._broadcasterTransport?.pc}startSendSubscriptionStatsReportTimer(){const e=this._localPerson._analytics,t=this._bot.subscriptions.find((e=>e.publication.id===this.publication.id));if(t&&e){const i=e.client.getIntervalSec();this.sendSubscriptionStatsReportTimer=setInterval((async()=>{if(e&&!e.isClosed()){if(this._producer){const i=await this._producer.getStats();i&&e.client.sendSubscriptionStatsReport(i,{subscriptionId:t.id,role:"sender",contentType:this.publication.contentType,createdAt:Date.now()})}}else this.sendSubscriptionStatsReportTimer&&clearInterval(this.sendSubscriptionStatsReportTimer)}),1e3*i)}}},log77=new import_common105.Logger("packages/sfu-bot/src/connection/index.ts"),SFUConnection=class{constructor(e,t,i,r,s,n){this._api=e,this.channel=t,this.localPerson=i,this.remoteMember=r,this._transportRepository=s,this._context=n,this.type="sfu",this.onDisconnect=new import_common105.Event,this.onClose=new import_common105.Event,this.closed=!1,this._receivers={},this._senders={}}addSender(e){const t=new Sender2(e,this.channel,this._api,this._transportRepository,this.localPerson,this.remoteMember,this.localPerson.iceManager,this._context);return this._senders[e.id]=t,t}removeSender(e){log77.debug("removeSender",e);const t=this._senders[e];t&&t.unproduce()}async startSubscribing(e){const t=new Receiver2(e,this._api,this._transportRepository,this.localPerson,this.remoteMember,this.localPerson.iceManager,this._context);this._receivers[e.id]=t;const i=log77.debug("[start] _startSubscribing consume"),{stream:r,codec:s}=await t.consume().catch((t=>{throw log77.error("[failed] _startSubscribing consume",createError({operationName:"SFUConnection.startSubscribing",context:this._context,channel:this.channel,info:{...errors5.internal,detail:"failed to receiver.consume"},error:t,path:log77.prefix,payload:{subscription:e.toJSON()}})),t}));if(log77.elapsed(i,"[end] _startSubscribing consume"),r.setIsEnabled("enabled"===e.publication.state),e.codec=s,e._setStream(r),this.localPerson._analytics&&!this.localPerson._analytics.isClosed()){const t=e.preferredEncoding,i=e.publication.origin?.encodings;if(!t||!i||0===i.length)return;const r=getLayerFromEncodings(t,i);this.localPerson._analytics.client.sendSubscriptionUpdatePreferredEncodingReport({subscriptionId:e.id,preferredEncodingIndex:r,updatedAt:Date.now()})}}async stopSubscribing(e){const t=this._receivers[e.id];t&&t.unconsume()}async stopPublishing(e){this.removeSender(e.id)}close({reason:e}={}){this.closed||(log77.debug("close sfu connection",{remote:this.remoteMember,local:this.localPerson,reason:e}),this.closed=!0,Object.values(this._senders).forEach((e=>{e.close()})),Object.values(this._receivers).forEach((e=>{e.close()})),this._senders={},this._receivers={},this.onClose.emit())}_getReceiver(e){return this._receivers[e]}async changePreferredEncoding(e){const t=e.preferredEncoding,i=e.publication.origin?.encodings;if(log77.debug("changePreferredEncoding",{preferredEncoding:t,encodings:i,subscription:e}),!t)throw createError({operationName:"SFUConnection.changePreferredEncoding",context:this._context,channel:this.channel,info:errors5.invalidPreferredEncoding,path:log77.prefix,payload:{subscription:e}});if(!i||0===i.length)throw createError({operationName:"SFUConnection.changePreferredEncoding",context:this._context,channel:this.channel,info:errors5.invalidEncodings,path:log77.prefix,payload:{subscription:e}});const r=getLayerFromEncodings(t,i),s=this._getReceiver(e.id);if(!s)throw createError({operationName:"SFUConnection.changePreferredEncoding",context:this._context,channel:this.channel,info:errors5.receiverNotFound,path:log77.prefix,payload:{subscription:e}});const n=s.transport;if(!n)throw createError({operationName:"SFUConnection.changePreferredEncoding",context:this._context,channel:this.channel,info:{...errors5.internal,detail:"transport not found"},path:log77.prefix,payload:{subscription:e}});const a=s.consumer;if(!a)throw createError({operationName:"SFUConnection.changePreferredEncoding",context:this._context,channel:this.channel,info:errors5.consumerNotFound,path:log77.prefix,payload:{subscription:e}});await this._api.changeConsumerLayer({transportId:n.id,consumerId:a.id,publicationId:e.publication.id,spatialLayer:r}),this.localPerson._analytics&&!this.localPerson._analytics.isClosed()&&this.localPerson._analytics.client.sendSubscriptionUpdatePreferredEncodingReport({subscriptionId:e.id,preferredEncodingIndex:r,updatedAt:Date.now()})}},import_common106=__toESM(require_dist()),defaultMaxSubscribers=10,log78=new import_common106.Logger("packages/sfu-bot/src/member.ts"),_SfuBotMember=class e extends MemberImpl{constructor(t){super(t),this.side="remote",this.subtype=e.subtype,this.type="bot",this._connections={},this.onForwardingStarted=new import_common106.Event,this.onForwardingStopped=new import_common106.Event,this.onForwardingListChanged=new import_common106.Event,this._startForwardQueue=new import_common106.PromiseQueue,this._forwardings={},this.stopForwarding=e=>new Promise((async(t,i)=>{const r=log78.info("[start] stopForwarding",await createLogPayload({operationName:"SfuBotMember.stopForwarding",channel:this.channel}));if("joined"!==this.state)return void i(createError({operationName:"SfuBotMember.stopForwarding",context:this._context,info:errors5.sfuBotNotInChannel,path:log78.prefix,channel:this.channel,payload:{status:this.state}}));const s="string"==typeof e?e:e.id,n=this._forwardings[s];if(!n)return void i(createError({operationName:"SfuBotMember.stopForwarding",context:this._context,info:errors5.forwardingNotFound,path:log78.prefix,channel:this.channel,payload:{forwardingId:s,_forwardings:Object.keys(this._forwardings)}}));delete this._forwardings[n.id];const{promise:a,fulfilled:o}=this._api.stopForwarding({botId:this.id,forwardingId:s});let c=!1;a.catch((e=>{c=!0,i(e)})),this.onForwardingStopped.watch((e=>e.forwarding.id===s),this._context.config.rtcApi.timeout).then((async()=>{log78.elapsed(r,"[end] stopForwarding",await createLogPayload({operationName:"SfuBotMember.stopForwarding",channel:this.channel})),t()})).catch((e=>{c||i(createError({operationName:"SfuBotMember.stopForwarding",context:this._context,info:{...errors5.timeout,detail:"onForwardingStopped"},path:log78.prefix,channel:this.channel,payload:{fulfilled:o},error:e}))}))})),this._api=t.api,this._context=t.context,this._transportRepository=t.transportRepository,this.options=t.options,this.onLeft.once((()=>{log78.debug("SfuBotMember left: ",{id:this.id}),Object.values(this._connections).forEach((e=>{e.close({reason:"sfu bot left"})})),this._connections={}}))}get forwardings(){return Object.values(this._forwardings)}_getConnection(e){return this._connections[e]}_getOrCreateConnection(e){return this._getConnection(e.id)??this._createConnection(this.channel,e,this)}_createConnection(e,t,i){const r=new SFUConnection(i._api,e,t,i,this._transportRepository,this._context);return r.onClose.once((()=>{delete this._connections[t.id]})),this._connections[t.id]=r,r}async startForwarding(e,t={}){const i=log78.info("[start] startForwarding",await createLogPayload({operationName:"SfuBotMember.startForwarding",channel:this.channel})),r=await this._startForwardQueue.push((()=>this._startForwarding(e,t)));return log78.elapsed(i,"[end] startForwarding",await createLogPayload({operationName:"SfuBotMember.startForwarding",channel:this.channel})),r}async _startForwarding(e,t){if(null==t.maxSubscribers&&(t.maxSubscribers=defaultMaxSubscribers),"joined"!==this.state)throw createError({operationName:"SfuBotMember._startForwarding",context:this._context,channel:this.channel,info:errors5.sfuBotNotInChannel,path:log78.prefix,payload:{status:this.state}});if(!this.channel._getPublication(e.id))throw createError({operationName:"SfuBotMember._startForwarding",context:this._context,channel:this.channel,info:errors.publicationNotExist,path:log78.prefix});const i=this.channel.localPerson;if(!i)throw createError({operationName:"SfuBotMember._startForwarding",context:this._context,channel:this.channel,info:errors.localPersonNotJoinedChannel,path:log78.prefix});if(i.id!==e.publisher.id)throw createError({operationName:"SfuBotMember._startForwarding",context:this._context,info:errors5.remotePublisherId,path:log78.prefix,channel:this.channel});const r=log78.debug("[start] SfuBotMember startForwarding",{publication:e.toJSON(),configure:t}),s=this._getOrCreateConnection(i).addSender(e),n=await s.startForwarding(t).catch((t=>{throw createError({operationName:"SfuBotMember._startForwarding",context:this._context,info:{...errors5.internal,detail:"[failed] SfuBotMember startForwarding"},path:log78.prefix,channel:this.channel,error:t,payload:{publication:e.toJSON()}})}));return this._forwardings[n.id]=n,this.listenStopForwardEvent(n),this.onForwardingStarted.emit({forwarding:n}),this.onForwardingListChanged.emit(),log78.elapsed(r,"[end] SfuBotMember startForwarding",{forwarding:n.toJSON()}),n}listenStopForwardEvent(e){const{removeListener:t}=this.channel.onStreamUnpublished.add((i=>{if(i.publication.id===e.id){t(),e._stop();const i=e.originPublication,r=this._getConnection(i.publisher.id);r&&r.removeSender(i.id),this.onForwardingStopped.emit({forwarding:e}),this.onForwardingListChanged.emit()}}))}_dispose(){}};_SfuBotMember.subtype="sfu";var SfuBotMember=_SfuBotMember,defaultSfuBotPluginOptions={...defaultSfuApiOptions,endpointTimeout:3e4,ackTimeout:1e4,disableRestartIce:!1},import_common109=__toESM(require_dist()),import_common108=__toESM(require_dist()),import_common107=__toESM(require_dist()),log79=new core_exports2.Logger("packages/sfu-bot/src/connection/transport/transport.ts"),SfuTransport=class{constructor(e,t,i,r,s,n){this.msTransport=e,this._bot=t,this._iceManager=i,this._sfuApi=r,this._context=s,this._analyticsSession=n,this._backoffIceRestart=new import_common107.BackOff({times:8,interval:100,jitter:100}),this._connectionState="new",this.onProduce=new import_common107.Event,this.onProduceData=new import_common107.Event,this.onMediasoupConnectionStateChanged=new import_common107.Event,this.onConnectionStateChanged=new import_common107.Event,this.restartIce=async()=>{if(this._backoffIceRestart.exceeded)return log79.error("_iceRestartedCount exceeded",createError({operationName:"SfuTransport.restartIce",context:this._context,info:errors5.netWorkError,path:log79.prefix})),void this._setConnectionState("disconnected");log79.warn("[start] restartIce",createWarnPayload5({bot:this._bot,detail:"start restartIce",operationName:"SfuTransport.restartIce",payload:{count:this._backoffIceRestart.count,transport:this}}));const e=()=>"left"===this._bot.state?(log79.debug("bot already left",this),this._setConnectionState("disconnected"),log79.warn("[end] restartIce",createWarnPayload5({bot:this._bot,detail:"end restartIce",operationName:"SfuTransport.restartIce",payload:{count:this._backoffIceRestart.count,transport:this}})),!0):"connected"===this.msTransport.connectionState?(this._backoffIceRestart.reset(),this._setConnectionState("connected"),log79.warn("[end] restartIce",createWarnPayload5({bot:this._bot,detail:"end restartIce",operationName:"SfuTransport.restartIce",payload:{count:this._backoffIceRestart.count,transport:this}})),this._analyticsSession&&!this._analyticsSession.isClosed()&&this._analyticsSession.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.id,type:"restartIce",data:void 0,createdAt:Date.now()}),!0):void 0;if(this._setConnectionState("reconnecting"),await this._backoffIceRestart.wait(),e())return;let t=await this._iceManager.updateIceParams().catch((e=>e));if(t)return log79.warn("updateIceParams failed",createWarnPayload5({operationName:"SfuTransport.restartIce",detail:"updateIceParams failed",bot:this._bot,payload:{transport:this}}),t),void await this.restartIce();if(await this.msTransport.updateIceServers({iceServers:this._iceManager.iceServers}),e())return;const i=await this._mediasoupRestartIce();if(t=await this._waitForMsConnectionState("connected",this._context.config.rtcConfig.iceDisconnectBufferTimeout).catch((e=>e)),!t&&e())return i;await this.restartIce()},this._waitForMsConnectionState=async(e,t=1e4)=>{e!==this.msTransport.connectionState&&await this.onMediasoupConnectionStateChanged.watch((()=>e===this.msTransport.connectionState),t).catch((e=>{throw createError({operationName:"SfuTransport._waitForMsConnectionState",context:this._context,info:{...errors5.timeout,detail:"waitForConnectionState timeout"},error:e,path:log79.prefix})}))},this._onConnect=e=>async({dtlsParameters:t},i,r)=>{try{log79.debug("[start] transport connect",{transportId:e}),await this._sfuApi.connect({transportId:e,dtlsParameters:t}),log79.debug("[end] transport connect",{transportId:e}),i()}catch(t){log79.error("[failed] transport connect",{error:t,transportId:e}),r(t)}};const a=s.plugins.find((e=>e.subtype===SfuBotPlugin.subtype));this._options=a.options,log79.debug("peerConfig",this.pc?.getConfiguration?.()??{}),e.on("connect",((t,i,r)=>this._onConnect(e.id)(t,i,r))),e.on("connectionstatechange",(e=>{this.onMediasoupConnectionStateChanged.emit(e),this._analyticsSession&&!this._analyticsSession.isClosed()&&this._analyticsSession.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.id,type:"connectionStateChange",data:{connectionState:e},createdAt:Date.now()})})),e.on("produce",((e,t,i)=>{this.onProduce.emit({producerOptions:e,callback:t,errback:i})})),e.on("producedata",((e,t,i)=>{this.onProduceData.emit({producerOptions:e,callback:t,errback:i})})),this.onMediasoupConnectionStateChanged.add((async e=>{switch(createLogPayload({operationName:"onMediasoupConnectionStateChanged",channel:this._bot.channel}).then((i=>{log79.debug(i,{state:e,transportId:this.id,bot:t})})).catch((()=>{})),e){case"disconnected":case"failed":if("reconnecting"===this._connectionState)return;await this._waitForMsConnectionState("connected",s.config.rtcConfig.iceDisconnectBufferTimeout).catch((e=>e))&&"reconnecting"!==this._connectionState&&!0!==t.options.disableRestartIce&&await this.restartIce();break;case"connecting":case"connected":this._setConnectionState(e);break;case"closed":this._setConnectionState("disconnected")}log79.debug("onMediasoupConnectionStateChanged",this)}))}get pc(){return this.msTransport?._handler?._pc??{}}get id(){return this.msTransport.id}get connectionState(){return this._connectionState}toJSON(){return{id:this.id,direction:this.msTransport.direction,connectionState:this._connectionState}}close(){log79.debug("close",this.id),this.pc?.peerIdentity&&this.pc.peerIdentity.catch((()=>{})),this.msTransport.close(),this._setConnectionState("disconnected")}_setConnectionState(e){this._connectionState!==e&&(log79.debug("onConnectionStateChanged",this._connectionState,e,this),this._connectionState=e,this.onConnectionStateChanged.emit(e),this._analyticsSession&&!this._analyticsSession.isClosed()&&this._analyticsSession.client.sendRtcPeerConnectionEventReport({rtcPeerConnectionId:this.id,type:"skywayConnectionStateChange",data:{skywayConnectionState:e},createdAt:Date.now()}))}async _mediasoupRestartIce(){const e=await this._sfuApi.iceRestart({transportId:this.id}).catch((e=>e));return e instanceof Error?(log79.warn("iceRestart failed",createWarnPayload5({operationName:"SfuTransport._mediasoupRestartIce",detail:"iceRestart failed",bot:this._bot,payload:{transport:this}}),e),void await this.restartIce()):(await this.msTransport.restartIce({iceParameters:e}),e)}},log80=new import_common108.Logger("packages/sfu-bot/src/connection/transport/transportRepository.ts"),TransportRepository=class{constructor(e,t){this._context=e,this._api=t,this.onTransportCreated=new import_common108.Event,this._transports={},this.getTransport=(e,t)=>this._transports[e+t];const{browserName:i,browserVersion:r}=getRuntimeInfo({isNotBrowser:{browserName:"nodejs",browserVersion:"0.0.0",osName:"nodejs",osVersion:"0.0.0"}});log80.debug("runtime info",{browserName:i,browserVersion:r});const s=[...(()=>{const e=[],t=[0,1],i=["42001f","42e01f","4d001f"],r=[0,1];for(const s of t)for(const t of i)for(const i of r)e.push(new RTCRtpCodecParameters2({mimeType:"video/H264",clockRate:9e4,payloadType:101,rtcpFeedback:[useNACK(),usePLI(),useREMB()],parameters:`packetization-mode:${s};profile-level-id:${t};level-asymmetry-allowed:${i}`}));return e})(),new RTCRtpCodecParameters2({mimeType:"video/VP8",clockRate:9e4,payloadType:102,rtcpFeedback:[useNACK(),usePLI(),useREMB()]})];this._device=new Device({headerExtensions:{video:[useSdesMid(),useAbsSendTime()],audio:[useSdesMid(),useAbsSendTime(),useAudioLevelIndication()]},codecs:{audio:[new RTCRtpCodecParameters2({mimeType:"audio/opus",clockRate:48e3,payloadType:100,rtcpFeedback:[],channels:2})],video:s}})}get rtpCapabilities(){if(this._device.loaded)return this._device.rtpCapabilities}async loadDevice(e){this._device.loaded||(await this._device.load({routerRtpCapabilities:e}).catch((t=>{throw createError({operationName:"TransportRepository.loadDevice",context:this._context,info:{...errors5.internal,detail:"loadDevice failed"},path:log80.prefix,payload:{rtpCapabilities:e},error:t})})),log80.debug("device loaded",{routerRtpCapabilities:e,rtpCapabilities:this._device.rtpCapabilities}))}createTransport(e,t,i,r,s,n){const a=("send"===r?e=>this._device.createSendTransport(e):e=>this._device.createRecvTransport(e))({...i,iceServers:s.iceServers,iceTransportPolicy:"turnOnly"===this._context.config.rtcConfig.turnPolicy?"relay":void 0,additionalSettings:this._context.config.rtcConfig}),o=new SfuTransport(a,t,s,this._api,this._context,n);return this._transports[e+a.id]=o,this.onTransportCreated.emit(a.id),o}deleteTransports(e){Object.entries({...this._transports}).forEach((([t,i])=>{t.includes(e)&&(i.close(),delete this._transports[t])}))}},PACKAGE_VERSION2="1.14.3",log81=new import_common109.Logger("packages/sfu-bot/src/plugin.ts"),_SfuBotPlugin=class e extends SkyWayPlugin{constructor(t={}){super(),this.subtype=e.subtype,this._createRemoteMember=(e,t)=>new SfuBotMember({...this._context,channel:e,id:t.id,name:t.name,metadata:t.metadata,plugin:this,api:this._api,context:this._context,transportRepository:this._transportRepository,options:this.options}),this.createBot=async e=>{const t=log81.info("[start] createBot",await createLogPayload({operationName:"SfuBotPlugin.createBot",channel:e})),i=this._context.authToken.getAppId(),r=await this._api.createBot({appId:i,channelId:e.id}),s=e._getMember(r)??(await e.onMemberJoined.watch((e=>e.member.id===r),this._context.config.rtcApi.timeout).catch((e=>{throw createError({operationName:"SfuBotPlugin.createBot",info:{...errors5.timeout,detail:"onMemberJoined"},path:log81.prefix,error:e,context:this._context})}))).member;return log81.elapsed(t,"[end] createBot",await createLogPayload({operationName:"SfuBotPlugin.createBot",channel:e})),s},this.deleteBot=async(e,t)=>new Promise((async(i,r)=>{const s=log81.info("[start] deleteBot",await createLogPayload({operationName:"SfuBotPlugin.deleteBot",channel:e}));let n=!1;this._api.deleteBot({botId:t}).catch((e=>{n=!0,r(e)})),e.onMemberLeft.watch((e=>e.member.id===t),this._context.config.rtcApi.timeout).then((async()=>{log81.elapsed(s,"[end] deleteBot",await createLogPayload({operationName:"SfuBotPlugin.deleteBot",channel:e})),i()})).catch((t=>{n||r(createError({operationName:"SfuBotPlugin.deleteBot",info:{...errors5.timeout,detail:"onMemberLeft"},path:log81.prefix,channel:e,error:t,context:this._context}))}))})),this.options={...defaultSfuBotPluginOptions,...t},this._onContextAttached.once((e=>{import_common109.Logger.level=e.config.log.level,import_common109.Logger.format=e.config.log.format,log81.info("SfuBotPlugin spawned",{operationName:"SfuBotPlugin.constructor",endpoint:{sfu:this.options.domain},options:this.options,sdkName:"sfu-bot",sdkVersion:PACKAGE_VERSION2}),this._api=new SfuRestApiClient(e.authTokenString,{...this.options,log:e.config.log}),this._transportRepository=new TransportRepository(e,this._api),e._onTokenUpdated.add((e=>{this._api.updateToken(e)}))})),this._whenDisposeLocalPerson=async e=>{this._transportRepository.deleteTransports(e.id)}}};_SfuBotPlugin.subtype=SfuBotMember.subtype;var SfuBotPlugin=_SfuBotPlugin,roomErrors={invalidParameter:{name:"invalidParameter",detail:"",solution:""},timeout:{name:"timeout",detail:"",solution:""},internal:{name:"internal",detail:"",solution:""},notImplemented:{name:"notImplemented",detail:"対応していないRoomTypeです",solution:"正しいRoomTypeを指定してください"},roomNotOpened:{name:"roomNotOpened",detail:"RoomがOpenされていません",solution:"Roomの状態を確かめてください"},subscribeOtherMemberType:{name:"subscribeOtherMemberType",detail:"RemoteMemberにSubscribe/Unsubscribeさせる場合、対象のMemberのTypeはPersonである必要があります",solution:"対象のRemoteMemberが正しいか確認してください"},sfuRoomNotSupportDataStream:{name:"sfuRoomNotSupportDataStream",detail:"SFURoomでDataStreamを使うことは出来ません",solution:"ありません"},publicationNotHasOrigin:{name:"publicationNotHasOrigin",detail:"SfuRoomで操作するPublicationはOriginをもつ必要があります",solution:"SfuRoomとP2PRoomを同一のIDで混在させていないか確かめてください"},notFound:{name:"notFound",detail:"参照しようとしていたものが見つかりません",solution:"参照しようとしたものが存在するか確かめてください"}},errors6={...errors,...errors5,...roomErrors},import_common110=__toESM(require_dist()),RoomMemberImpl=class{constructor(e,t){this.member=e,this.room=t,this.onLeft=new import_common110.Event;const{removeListener:i}=t.onMemberLeft.add((e=>{e.member.id===this.member.id&&(i(),this.onLeft.emit())}));this.onMetadataUpdated=e.onMetadataUpdated}get id(){return this.member.id}get name(){return this.member.name}get roomId(){return this.room.id}get roomName(){return this.room.name}get roomType(){return this.room.type}get state(){return this.member.state}get metadata(){return this.member.metadata}get _member(){return this.member}get publications(){return this.room.publications.filter((e=>e.publisher.id===this.id))}get subscriptions(){return this.member.subscriptions.map((e=>this.room._getSubscription(e.id)))}updateMetadata(e){return this.member.updateMetadata(e)}leave(){return this.member.leave()}toJSON(){return{id:this.id,name:this.name,metadata:this.metadata}}},import_common111=__toESM(require_dist()),LocalRoomMemberImpl=class extends RoomMemberImpl{constructor(e,t){super(e,t),this.side="local",this._local=this._member,this.onStreamPublished=new import_common111.Event,this.onStreamUnpublished=new import_common111.Event,this.onPublicationListChanged=new import_common111.Event,this.onPublicationSubscribed=new import_common111.Event,this.onPublicationUnsubscribed=new import_common111.Event,this.onSubscriptionListChanged=new import_common111.Event,this.onFatalError=new import_common111.Event,this._context=this.room._context,this._local.onPublicationSubscribed.add((async e=>{const i=t._addSubscription(e.subscription);this.onPublicationSubscribed.emit({subscription:i,stream:e.stream})})),this._local.onFatalError.pipe(this.onFatalError),this._listenRoomEvent(),this.onStreamPublished.add((()=>this.onPublicationListChanged.emit())),this.onStreamUnpublished.add((()=>this.onPublicationListChanged.emit())),this.onPublicationSubscribed.add((()=>this.onSubscriptionListChanged.emit())),this.onPublicationUnsubscribed.add((()=>this.onSubscriptionListChanged.emit()))}get subscriptions(){return this.member.subscriptions.map((e=>this.room._getSubscription(e.id))).filter((e=>e.stream))}_listenRoomEvent(){this.room.onPublicationUnsubscribed.add((e=>{e.subscription.subscriber._member.id===this._local.id&&this.onPublicationUnsubscribed.emit(e)}))}},import_common113=__toESM(require_dist()),import_common112=__toESM(require_dist());function createError6({operationName:e,context:t,info:i,error:r,path:s,payload:n,room:a}){const o={operationName:e,payload:n};return a&&(o.appId=a._channel.appId,o.roomId=a.id,a.localRoomMember&&(o.memberId=a.localRoomMember.id)),t&&(o.info=t.info,o.plugins=t.plugins.map((e=>e.subtype))),new import_common112.SkyWayError({error:r,info:i,payload:o,path:s})}var log82=new import_common113.Logger("packages/room/src/member/local/p2p.ts"),LocalP2PRoomMemberImpl=class extends LocalRoomMemberImpl{constructor(e,t){super(e,t)}async publish(e,t={}){const i=await this._local.publish(e,t),r=this.room._addPublication(i);return this.onStreamPublished.emit({publication:r}),r}async unpublish(e){const t="string"==typeof e?e:e.id;this._local.unpublish(t).catch((t=>{log82.error("unpublish",t,{target:e},this.toJSON())}));const{publication:i}=await this.room.onStreamUnpublished.watch((e=>e.publication.id===t),this._context.config.rtcApi.timeout).catch((e=>{throw createError6({operationName:"LocalP2PRoomMemberImpl.unpublish",context:this._context,room:this.room,info:{...errors6.timeout,detail:"onStreamUnpublished"},path:log82.prefix,error:e})}));this.onStreamUnpublished.emit({publication:i})}async subscribe(e){const t="string"==typeof e?e:e.id,{subscription:i,stream:r}=await this._local.subscribe(t);return{subscription:this.room._addSubscription(i),stream:r}}async unsubscribe(e){const t="string"==typeof e?e:e.id;this._local.unsubscribe(t).catch((t=>{log82.error("unsubscribe",t,{target:e},this.toJSON())})),await this.room.onPublicationUnsubscribed.watch((e=>e.subscription.id===t),this._context.config.rtcApi.timeout).catch((e=>{throw createError6({operationName:"LocalP2PRoomMemberImpl.unsubscribe",context:this._context,room:this.room,info:{...errors6.timeout,detail:"onPublicationUnsubscribed"},path:log82.prefix,error:e})}))}_updateRoom(e){log82.debug("_updateRoom",{memberId:this.id}),this.room=e,this._listenRoomEvent()}},import_common114=__toESM(require_dist()),defaultMaxSubscribers2=10,log83=new import_common114.Logger("packages/room/src/member/local/sfu.ts"),LocalSFURoomMemberImpl=class extends LocalRoomMemberImpl{constructor(e,t){super(e,t)}async publish(e,t={}){if(e instanceof LocalDataStream)throw createError6({operationName:"LocalSFURoomMemberImpl.publish",context:this._context,room:this.room,info:errors6.sfuRoomNotSupportDataStream,path:log83.prefix});t.maxSubscribers=t.maxSubscribers??defaultMaxSubscribers2;const i=await this._local.publish(e,t),r=this.room._channel.members.find((e=>e.subtype===SfuBotMember.subtype));if(!r)throw createError6({operationName:"LocalSFURoomMemberImpl.publish",context:this._context,room:this.room,info:errors5.sfuBotNotInChannel,path:log83.prefix});const s=(await r.startForwarding(i,{maxSubscribers:t.maxSubscribers})).relayingPublication,n=this.room._addPublication(s);return this.onStreamPublished.emit({publication:n}),n}async unpublish(e){const t="string"==typeof e?e:e.id,i=this.room._getPublication(t),r=i._publication.origin;if(!r)throw createError6({operationName:"LocalSFURoomMemberImpl.unpublish",context:this._context,room:this.room,info:errors6.publicationNotHasOrigin,path:log83.prefix});this._local.unpublish(r.id).catch((t=>{log83.error("unpublish error",t,{target:e},this.toJSON())})),await this.room.onStreamUnpublished.watch((e=>e.publication.id===t),this._context.config.rtcApi.timeout).catch((e=>{throw createError6({operationName:"LocalSFURoomMemberImpl.unpublish",context:this._context,room:this.room,info:{...errors6.timeout,detail:"onStreamUnpublished"},path:log83.prefix,error:e})})),this.onStreamUnpublished.emit({publication:i})}async subscribe(e,t){const i="string"==typeof e?e:e.id,{subscription:r,stream:s}=await this._local.subscribe(i,t);return{subscription:this.room._addSubscription(r),stream:s}}async unsubscribe(e){const t="string"==typeof e?e:e.id;this._local.unsubscribe(t).catch((t=>{log83.error("unsubscribe error",t,{target:e},this.toJSON())})),await this.room.onPublicationUnsubscribed.watch((e=>e.subscription.id===t),this._context.config.rtcApi.timeout).catch((e=>{throw createError6({operationName:"LocalSFURoomMemberImpl.unsubscribe",context:this._context,room:this.room,info:{...errors6.timeout,detail:"onPublicationUnsubscribed"},path:log83.prefix,error:e})}))}_updateRoom(e){log83.debug("_updateRoom",{memberId:this.id}),this.room=e,this._listenRoomEvent()}},import_common115=__toESM(require_dist()),log84=new import_common115.Logger("packages/room/src/member/remote/base.ts"),RemoteRoomMemberImpl=class extends RoomMemberImpl{constructor(e,t){super(e,t),this.side="remote",this.onPublicationSubscribed=new import_common115.Event,this.onPublicationUnsubscribed=new import_common115.Event,this.onSubscriptionListChanged=new import_common115.Event,this.onPublicationListChanged=new import_common115.Event,this._disposer=new import_common115.EventDisposer,this.subscribe=e=>new Promise(((t,i)=>{if(!(this.member instanceof RemotePersonImpl))return void i(createError6({operationName:"RemoteRoomMemberImpl.subscribe",context:this.room._context,room:this.room,info:errors6.subscribeOtherMemberType,path:log84.prefix}));let r=!1;this.member.subscribe(e).catch((e=>{r=!0,i(e)})),this.onPublicationSubscribed.watch((t=>t.subscription.publication.id===e)).then((e=>t(e))).catch((e=>{r||i(e)}))})),this.unsubscribe=e=>new Promise(((t,i)=>{if(!(this.member instanceof RemotePersonImpl))return void i(createError6({operationName:"RemoteRoomMemberImpl.unsubscribe",context:this.room._context,room:this.room,info:errors6.subscribeOtherMemberType,path:log84.prefix}));let r=!1;this.member.unsubscribe(e).catch((e=>{r=!0,i(e)})),this.onPublicationUnsubscribed.watch((t=>t.subscription.id===e)).then((()=>t())).catch((e=>{r||i(e)}))})),t.onPublicationSubscribed.add((t=>{t.subscription.subscriber._member.id===e.id&&(this.onPublicationSubscribed.emit(t),this.onSubscriptionListChanged.emit())})).disposer(this._disposer),t.onPublicationUnsubscribed.add((t=>{t.subscription.subscriber._member.id===e.id&&(this.onPublicationUnsubscribed.emit(t),this.onSubscriptionListChanged.emit())})).disposer(this._disposer),e instanceof RemotePersonImpl&&e.onPublicationListChanged.pipe(this.onPublicationListChanged).disposer(this._disposer)}_dispose(){this._disposer.dispose()}},import_common116=__toESM(require_dist()),import_common117=__toESM(require_dist()),path2="packages/room/src/publication/index.ts",logger21=new import_common116.Logger(path2),RoomPublicationImpl=class{constructor(e,t){this._publication=e,this._room=t,this._disposer=new import_common116.EventDisposer,this._events=new import_common117.Events,this.onCanceled=this._events.make(),this.onSubscribed=this._events.make(),this.onUnsubscribed=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.onMetadataUpdated=this._events.make(),this.onEnabled=this._events.make(),this.onDisabled=this._events.make(),this.onStateChanged=this._events.make(),this.onConnectionStateChanged=new import_common117.Event,this.enable=()=>new Promise(((e,t)=>{"enabled"!==this.state?this._origin?Promise.all([this._origin.enable(),this._publication.onEnabled.asPromise()]).then((()=>e())).catch(t):this._publication.enable().then(e).catch(t):e()})),this.disable=()=>new Promise(((e,t)=>{"disabled"!==this.state?this._origin?Promise.all([this._origin.disable(),this._publication.onDisabled.asPromise()]).then((()=>e())).catch(t):this._publication.disable().then(e).catch(t):e()})),this.replaceStream=(e,t={})=>{this._preferredPublication.replaceStream(e,t)},this.id=e.id,this.contentType=e.contentType,this._origin=e.origin;{const e=this._origin??this._publication;this.publisher=this._room._getMember(e.publisher.id)}this._setEvents()}_setEvents(){this._room.onStreamUnpublished.add((e=>{e.publication.id===this.id&&this._dispose()})),this._room.onPublicationSubscribed.add((e=>{e.subscription.publication.id===this.id&&(this.onSubscribed.emit({subscription:e.subscription}),this.onSubscriptionListChanged.emit())})).disposer(this._disposer),this._room.onPublicationUnsubscribed.add((e=>{e.subscription.publication.id===this.id&&(this.onUnsubscribed.emit({subscription:e.subscription}),this.onSubscriptionListChanged.emit())})).disposer(this._disposer),this._publication.onEnabled.pipe(this.onEnabled),this._publication.onDisabled.pipe(this.onDisabled),this._publication.onStateChanged.pipe(this.onStateChanged);(this._origin??this._publication).onMetadataUpdated.pipe(this.onMetadataUpdated);this._origin?this._origin.onConnectionStateChanged.add((e=>{logger21.debug("this._origin.onConnectionStateChanged",this.id,e),this.onConnectionStateChanged.emit({state:e.state})})):this._publication.onConnectionStateChanged.add((e=>{logger21.debug("this._publication.onConnectionStateChanged",this.id,e),this.onConnectionStateChanged.emit({state:e.state,remoteMember:this._room._getMember(e.remoteMember.id)})}))}get subscriptions(){return this._publication.subscriptions.map((e=>this._room._getSubscription(e.id)))}get _preferredPublication(){return this._origin??this._publication}get codecCapabilities(){return this._preferredPublication.codecCapabilities}get encodings(){return this._preferredPublication.encodings}get stream(){return this._preferredPublication.stream}get state(){return this._preferredPublication.state}get metadata(){return this._preferredPublication.metadata}async cancel(){await Promise.all([this._preferredPublication.cancel(),this.onCanceled.asPromise()])}async updateMetadata(e){await this._preferredPublication.updateMetadata(e)}updateEncodings(e){this._preferredPublication.updateEncodings(e)}_dispose(){this.onCanceled.emit(),this._events.dispose(),this._disposer.dispose()}getStats(e){if(this._origin){const e=this._origin.subscriptions.find((e=>e.subscriber.subtype===SfuBotMember.subtype))?.subscriber;if(!e)throw createError6({operationName:"RoomPublicationImpl.getStats",room:this._room,path:path2,info:{...errors6.notFound,detail:"bot not found"}});return this._origin.getStats(e)}{const t="string"==typeof e?e:e.id;return this._publication.getStats(t)}}getRTCPeerConnection(e){if(this._origin){const e=this._origin.subscriptions.find((e=>e.subscriber.subtype===SfuBotMember.subtype))?.subscriber;if(!e)throw createError6({operationName:"RoomPublicationImpl.getRTCPeerConnection",room:this._room,path:path2,info:{...errors6.notFound,detail:"bot not found"}});return this._origin.getRTCPeerConnection(e)}{const t="string"==typeof e?e:e.id;return this._publication.getRTCPeerConnection(t)}}getConnectionState(e){if(this._origin){const e=this._origin.subscriptions.find((e=>e.subscriber.subtype===SfuBotMember.subtype))?.subscriber;if(!e)throw createError6({operationName:"RoomPublicationImpl.getConnectionState",room:this._room,path:path2,info:{...errors6.notFound,detail:"bot not found"}});return this._origin.getConnectionState(e)}{const t="string"==typeof e?e:e.id;return this._publication.getConnectionState(t)}}toJSON(){return{id:this.id,contentType:this.contentType,metadata:this.metadata,publisher:this.publisher,subscriptions:this.subscriptions,codecCapabilities:this.codecCapabilities,encodings:this.encodings,state:this.state}}},import_common122=__toESM(require_dist());init_esm_node2();var PACKAGE_VERSION3="1.15.6",import_common120=__toESM(require_dist()),import_common119=__toESM(require_dist());init_esm_node2();var import_common118=__toESM(require_dist()),log85=new import_common118.Logger("packages/room/src/subscription/index.ts"),RoomSubscriptionImpl=class{constructor(e,t){this._subscription=e,this._room=t,this._context=this._room._context,this.onStreamAttached=new core_exports.Event,this.onCanceled=new core_exports.Event,this.onConnectionStateChanged=new core_exports.Event,this.id=e.id,this.contentType=e.contentType,this.publication=this._room._getPublication(e.publication.id),this.subscriber=this._room._getMember(e.subscriber.id),e.onStreamAttached.pipe(this.onStreamAttached),e.onCanceled.pipe(this.onCanceled),e.onConnectionStateChanged.add((e=>{log85.debug("_subscription.onConnectionStateChanged",this.id,e),this.onConnectionStateChanged.emit(e)}))}get stream(){return this._subscription.stream}get state(){return this._subscription.state}get codec(){return this._subscription.codec}get preferredEncoding(){return this._subscription.preferredEncoding}changePreferredEncoding(e){this._subscription.changePreferredEncoding(e)}async cancel(){this._subscription.cancel().catch((e=>{log85.error("subscription.cancel",e,this.toJSON())})),await this._room.onPublicationUnsubscribed.watch((e=>e.subscription.id===this.id),this._context.config.rtcApi.timeout).catch((e=>{throw createError6({operationName:"RoomSubscriptionImpl.cancel",context:this._context,room:this._room,info:{...errors6.timeout,detail:"onPublicationUnsubscribed"},error:e,path:log85.prefix})}))}toJSON(){return{id:this.id,contentType:this.contentType,publication:this.publication,codec:this.codec}}getStats(){return this._subscription.getStats()}getRTCPeerConnection(){return this._subscription.getRTCPeerConnection()}getConnectionState(){return this._subscription.getConnectionState()}},log86=new import_common119.Logger("packages/room/src/room/base.ts"),RoomImpl=class{constructor(e,t){this._channel=t,this._members={},this._publications={},this._subscriptions={},this._context=this._channel._context,this._events=new import_common119.Events,this.onClosed=this._events.make(),this.onMetadataUpdated=this._events.make(),this.onMemberJoined=this._events.make(),this.onMemberLeft=this._events.make(),this.onMemberListChanged=this._events.make(),this.onMemberMetadataUpdated=this._events.make(),this.onStreamPublished=this._events.make(),this.onStreamUnpublished=this._events.make(),this.onPublicationListChanged=this._events.make(),this.onPublicationMetadataUpdated=this._events.make(),this.onPublicationEnabled=this._events.make(),this.onPublicationDisabled=this._events.make(),this.onPublicationSubscribed=this._events.make(),this.onPublicationUnsubscribed=this._events.make(),this.onSubscriptionListChanged=this._events.make(),this.type=e,this._channel.onClosed.pipe(this.onClosed),this._channel.onMetadataUpdated.pipe(this.onMetadataUpdated),this._channel.onMemberMetadataUpdated.add((e=>{this._handleOnMemberMetadataUpdate(e)}))}_getMember(e){return this._members[e]}_getPublication(e){return this._publications[e]}_addPublication(e){const t=this._publications[e.id];if(t)return t;const i=new RoomPublicationImpl(e,this);return this._publications[e.id]=i,i}_getSubscription(e){return this._subscriptions[e]}_addSubscription(e){const t=this._subscriptions[e.id];if(t)return t;const i=new RoomSubscriptionImpl(e,this);return this._subscriptions[e.id]=i,i}get id(){return this._channel.id}get name(){return this._channel.name}get metadata(){return this._channel.metadata}get state(){return this._channel.state}get disposed(){return this._channel.disposed}_handleOnMemberMetadataUpdate(e){const t=this._getMember(e.member.id);this.onMemberMetadataUpdated.emit({member:t,metadata:e.metadata})}get members(){return Object.values(this._members)}get publications(){return Object.values(this._publications)}get subscriptions(){return Object.values(this._subscriptions)}async joinChannel(e={}){if("opened"!==this.state)throw createError6({operationName:"RoomImpl.joinChannel",context:this._context,room:this,info:errors6.roomNotOpened,path:log86.prefix});e.name=e.name??v4_default2();const t=await this._channel.join(e);return this._getMember(t.id)||await this.onMemberJoined.watch((e=>e.member._member.id===t.id),this._context.config.rtcApi.timeout).catch((e=>{throw createError6({operationName:"RoomImpl.joinChannel",context:this._context,room:this,info:{...errors6.timeout,detail:"RoomImpl onMemberJoined"},path:log86.prefix,error:e})})),t}async leave(e){await this._channel.leave(e._member)}async moveRoom(e){return await this._channel.moveChannel(e._local),e._updateRoom(this),e}updateMetadata(e){return this._channel.updateMetadata(e)}async close(){await this._channel.close()}async dispose(){return this._channel.dispose()}toJSON(){return{type:this.type,id:this.id,name:this.name,metadata:this.metadata,members:this.members,publications:this.publications,subscriptions:this.subscriptions}}},log87=new import_common120.Logger("packages/room/src/room/p2p.ts"),P2PRoomImpl=class extends RoomImpl{constructor(e){super("p2p",e),this.setChannelState(),this.setChannelListener()}setChannelState(){this._channel.members.forEach((e=>{const t=new RemoteRoomMemberImpl(e,this);this._members[e.id]=t})),this._channel.publications.forEach((e=>{this._addPublication(e)})),this._channel.subscriptions.forEach((e=>{this._addSubscription(e)}))}setChannelListener(){this._channel.onMemberJoined.add((e=>this._handleOnMemberJoin(e.member))),this._channel.onMemberLeft.add((e=>this._handleOnMemberLeft(e.member))),this._channel.onStreamPublished.add((e=>this._handleOnStreamPublish(e.publication))),this._channel.onStreamUnpublished.add((e=>this._handleOnStreamUnpublish(e.publication))),this._channel.onPublicationMetadataUpdated.add((e=>{this._handleOnPublicationMetadataUpdate(e.publication)})),this._channel.onPublicationEnabled.add((e=>{this._handleOnPublicationEnabled(e.publication)})),this._channel.onPublicationDisabled.add((e=>{this._handleOnPublicationDisabled(e.publication)})),this._channel.onPublicationSubscribed.add((e=>this._handleOnStreamSubscribe(e.subscription))),this._channel.onPublicationUnsubscribed.add((e=>this._handleOnStreamUnsubscribe(e.subscription)))}_handleOnMemberJoin(e){if(this._getMember(e.id))return;const t=new RemoteRoomMemberImpl(e,this);this._members[e.id]=t,this.onMemberJoined.emit({member:t}),this.onMemberListChanged.emit({})}_handleOnMemberLeft(e){const t=this._getMember(e.id);delete this._members[e.id],t._dispose(),this.onMemberLeft.emit({member:t}),this.onMemberListChanged.emit({})}_handleOnStreamPublish(e){if(this._getPublication(e.id))return;const t=this._addPublication(e);this.onStreamPublished.emit({publication:t}),this.onPublicationListChanged.emit({})}_handleOnStreamUnpublish(e){const t=this._getPublication(e.id);delete this._publications[e.id],this.onStreamUnpublished.emit({publication:t}),this.onPublicationListChanged.emit({})}_handleOnPublicationMetadataUpdate(e){const t=this._getPublication(e.id);this.onPublicationMetadataUpdated.emit({publication:t,metadata:t.metadata})}_handleOnPublicationEnabled(e){const t=this._getPublication(e.id);this.onPublicationEnabled.emit({publication:t})}_handleOnPublicationDisabled(e){const t=this._getPublication(e.id);this.onPublicationDisabled.emit({publication:t})}_handleOnStreamSubscribe(e){if(this._getSubscription(e.id))return;const t=this._addSubscription(e);this.onPublicationSubscribed.emit({subscription:t}),this.onSubscriptionListChanged.emit({})}_handleOnStreamUnsubscribe(e){const t=this._getSubscription(e.id);delete this._subscriptions[e.id],this.onPublicationUnsubscribed.emit({subscription:t}),this.onSubscriptionListChanged.emit({})}async join(e={}){const t=await this.joinChannel(e),i=new LocalP2PRoomMemberImpl(t,this);return log87.debug("member joined",e),this.localRoomMember=i,i.onLeft.once((()=>{this.localRoomMember=void 0})),i}},import_common121=__toESM(require_dist()),log88=new import_common121.Logger("packages/room/src/room/sfu.ts"),SfuRoomImpl=class e extends RoomImpl{constructor(e,t){super("sfu",e),this._plugin=t,this.setChannelState(),this.setChannelListener()}static async Create(t,i){const r=t.plugins.find((e=>"sfu"===e.subtype));i.members.find((e=>e.subtype===SfuBotMember.subtype))||await r.createBot(i);return new e(i,r)}setChannelState(){this._channel.members.forEach((e=>{if("bot"===e.type)return;const t=new RemoteRoomMemberImpl(e,this);this._members[e.id]=t})),this._channel.publications.forEach((e=>{e.origin&&this._addPublication(e)})),this._channel.subscriptions.forEach((e=>{"bot"!==e.subscriber.type&&this._addSubscription(e)}))}setChannelListener(){this._channel.onMemberJoined.add((e=>this._handleOnMemberJoin(e.member))),this._channel.onMemberLeft.add((e=>this._handleOnMemberLeft(e.member))),this._channel.onStreamPublished.add((e=>{this._handleOnStreamPublish(e.publication)})),this._channel.onStreamUnpublished.add((e=>this._handleOnStreamUnpublish(e.publication))),this._channel.onPublicationMetadataUpdated.add((e=>{this._handleOnPublicationMetadataUpdate(e.publication)})),this._channel.onPublicationEnabled.add((e=>{this._handleOnPublicationEnabled(e.publication)})),this._channel.onPublicationDisabled.add((e=>{this._handleOnPublicationDisabled(e.publication)})),this._channel.onPublicationSubscribed.add((e=>{this._handleOnStreamSubscribe(e.subscription)})),this._channel.onPublicationUnsubscribed.add((e=>this._handleOnStreamUnsubscribe(e.subscription)))}_handleOnMemberJoin(e){if("bot"===e.type)return;const t=new RemoteRoomMemberImpl(e,this);this._members[e.id]=t,this.onMemberJoined.emit({member:t}),this.onMemberListChanged.emit({})}_handleOnMemberLeft(e){const t=this._getMember(e.id);t&&(delete this._members[e.id],t._dispose(),this.onMemberLeft.emit({member:t}),this.onMemberListChanged.emit({}))}_handleOnStreamPublish(e){if(!e.origin?.id)return;const t=this._addPublication(e);this.onStreamPublished.emit({publication:t}),this.onPublicationListChanged.emit({})}_handleOnStreamUnpublish(e){if(!e.origin?.id)return;const t=this._getPublication(e.id);delete this._publications[e.id],this.onStreamUnpublished.emit({publication:t}),this.onPublicationListChanged.emit({})}_getRelayedPublication(e){return this.publications.find((t=>t._publication.origin?.id===e))}_handleOnPublicationMetadataUpdate(e){const t=this._getRelayedPublication(e.id);t&&this.onPublicationMetadataUpdated.emit({publication:t,metadata:t.metadata})}_handleOnPublicationEnabled(e){const t=this._getRelayedPublication(e.id);t&&this.onPublicationEnabled.emit({publication:t})}_handleOnPublicationDisabled(e){const t=this._getRelayedPublication(e.id);t&&this.onPublicationDisabled.emit({publication:t})}_handleOnStreamSubscribe(e){if("bot"===e.subscriber.type)return;const t=this._addSubscription(e);this.onPublicationSubscribed.emit({subscription:t}),this.onSubscriptionListChanged.emit({})}_handleOnStreamUnsubscribe(e){if("bot"===e.subscriber.type)return;const t=this._getSubscription(e.id);delete this._subscriptions[e.id],this.onPublicationUnsubscribed.emit({subscription:t}),this.onSubscriptionListChanged.emit({})}async join(e={}){const t=await this.joinChannel({...e,disableSignaling:!0}),i=new LocalSFURoomMemberImpl(t,this);return this.localRoomMember=i,i.onLeft.once((()=>{this.localRoomMember=void 0})),log88.debug("member joined",e),i}},log89=new import_common122.Logger("packages/room/src/room/index.ts"),_SkyWayRoom=class{constructor(){}};_SkyWayRoom.Create=async(e,t)=>{log89.info("room created",{operationName:"SkyWayRoom._Factory",sdkName:"room",sdkVersion:PACKAGE_VERSION3,init:t});const i=new SfuBotPlugin(t?.options?.sfu);e.registerPlugin(i);const r=await SkyWayChannel.Create(e,{name:t.name??v4_default2(),metadata:t.metadata});return await _SkyWayRoom._Factory(e,t.type,r)},_SkyWayRoom.Find=async(e,t,i,r)=>{const s=new SfuBotPlugin(r?.sfu);e.registerPlugin(s);const n=await SkyWayChannel.Find(e,t);return await _SkyWayRoom._Factory(e,i,n)},_SkyWayRoom.FindOrCreate=async(e,t)=>{const i=new SfuBotPlugin(t?.options?.sfu);e.registerPlugin(i);const r=await SkyWayChannel.FindOrCreate(e,{...t});return await _SkyWayRoom._Factory(e,t.type,r)},_SkyWayRoom._Factory=async(e,t,i)=>{switch(t){case"p2p":return new P2PRoomImpl(i);case"sfu":return await SfuRoomImpl.Create(e,i);default:throw createError({operationName:"SkyWayRoom._Factory",context:e,channel:i,info:errors6.notImplemented,path:log89.prefix})}};var SkyWayRoom=_SkyWayRoom,roomTypes=["sfu","p2p"];__reExport(index_exports,__toESM(require_dist()),module.exports),__reExport(index_exports,__toESM(require_dist4()),module.exports);var import_token6=__toESM(require_dist4());
/*! Bundled license information:

mime-db/index.js:
mime-db/index.js:
  (*!
   * mime-db
   * Copyright(c) 2014 Jonathan Ong
   * Copyright(c) 2015-2022 Douglas Christopher Wilson
   * MIT Licensed
   *)

mime-types/index.js:
mime-types/index.js:
  (*!
   * mime-types
   * Copyright(c) 2014 Jonathan Ong
   * Copyright(c) 2015 Douglas Christopher Wilson
   * MIT Licensed
   *)

axios/dist/node/axios.cjs:
  (*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors *)

reflect-metadata/Reflect.js:
  (*! *****************************************************************************
  Copyright (C) Microsoft. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** *)

pvtsutils/build/index.js:
  (*!
   * MIT License
   * 
   * Copyright (c) 2017-2024 Peculiar Ventures, LLC
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   * 
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   * 
   *)

pvutils/build/utils.js:
  (*!
   Copyright (c) Peculiar Ventures, LLC
  *)

asn1js/build/index.js:
  (*!
   * Copyright (c) 2014, GMO GlobalSign
   * Copyright (c) 2015-2022, Peculiar Ventures
   * All rights reserved.
   * 
   * Author 2014-2019, Yury Strozhevsky
   * 
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
   * 
   * * Redistributions of source code must retain the above copyright notice, this
   *   list of conditions and the following disclaimer.
   * 
   * * Redistributions in binary form must reproduce the above copyright notice, this
   *   list of conditions and the following disclaimer in the documentation and/or
   *   other materials provided with the distribution.
   * 
   * * Neither the name of the copyright holder nor the names of its
   *   contributors may be used to endorse or promote products derived from
   *   this software without specific prior written permission.
   * 
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
   * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   *)

tslib/tslib.es6.js:
  (*! *****************************************************************************
  Copyright (c) Microsoft Corporation.
  
  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.
  
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** *)

@peculiar/x509/build/x509.cjs.js:
  (*!
   * MIT License
   * 
   * Copyright (c) Peculiar Ventures. All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   * 
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   * 
   *)

isobject/index.js:
  (*!
   * isobject <https://github.com/jonschlinkert/isobject>
   *
   * Copyright (c) 2014-2017, Jon Schlinkert.
   * Released under the MIT License.
   *)

is-plain-object/index.js:
  (*!
   * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
   *
   * Copyright (c) 2014-2017, Jon Schlinkert.
   * Released under the MIT License.
   *)

aes-js/index.js:
  (*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. *)

axios/dist/node/axios.cjs:
  (*! Axios v1.9.0 Copyright (c) 2025 Matt Zabriskie and contributors *)

jsrsasign/lib/jsrsasign.js:
jsrsasign/lib/jsrsasign.js:
  (*! CryptoJS v3.1.2 core-fix.js
   * code.google.com/p/crypto-js
   * (c) 2009-2013 by Jeff Mott. All rights reserved.
   * code.google.com/p/crypto-js/wiki/License
   * THIS IS FIX of 'core.js' to fix Hmac issue.
   * https://code.google.com/p/crypto-js/issues/detail?id=84
   * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
   *)
  (*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
   *)
  (*! (c) Tom Wu, Kenji Urushima | http://www-cs-students.stanford.edu/~tjw/jsbn/
   *)
  (*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
   *)
  (*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
   *)

@noble/hashes/esm/utils.js:
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)

@noble/curves/esm/abstract/utils.js:
@noble/curves/esm/abstract/modular.js:
@noble/curves/esm/abstract/curve.js:
@noble/curves/esm/abstract/weierstrass.js:
@noble/curves/esm/_shortw_utils.js:
@noble/curves/esm/p256.js:
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
*/
//# sourceMappingURL=/sm/f5dff7dfd058d223dccd879f40724ebb9a7b7d7461c2d8dd446f881f0ec7adc4.map