UNPKG

trtc-sdk-v5

Version:
3 lines 374 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).TRTCVideoDecoder=n()}(this,function(){"use strict";function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function n(e,n,t,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void t(e)}s.done?n(c):Promise.resolve(c).then(r,o)}function t(e){return function(){var t=this,r=arguments;return new Promise(function(o,a){var i=e.apply(t,r);function s(e){n(i,o,a,s,c,"next",e)}function c(e){n(i,o,a,s,c,"throw",e)}s(void 0)})}}function r(e,n,t){return n=d(n),function(e,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(n,t||[],d(e).constructor):n.apply(e,t))}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function i(e,n,t){return n&&a(e.prototype,n),t&&a(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=w(e))||n){t&&(e=t);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==t.return||t.return()}finally{if(s)throw a}}}}function c(e,n,t){return(n=g(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function u(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&m(e,n)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(){ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function a(t,r,o,a){var c=r&&r.prototype instanceof s?r:s,d=Object.create(c.prototype);return p(d,"_invoke",function(t,r,o){var a,s,c,d=0,u=o||[],l=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(n,t){return a=n,s=0,c=e,f.n=t,i}};function p(t,r){for(s=t,c=r,n=0;!l&&d&&!o&&n<u.length;n++){var o,a=u[n],p=f.p,m=a[2];t>3?(o=m===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=t<2&&p<a[1])?(s=0,f.v=r,f.n=a[1]):p<m&&(o=t<3||a[0]>r||r>m)&&(a[4]=t,a[5]=r,f.n=m,s=0))}if(o||t>1)return i;throw l=!0,r}return function(o,u,m){if(d>1)throw TypeError("Generator is already running");for(l&&1===u&&p(u,m),s=u,c=m;(n=s<2?e:c)||!l;){a||(s?s<3?(s>1&&(f.n=-1),p(s,c)):f.n=c:f.v=c);try{if(d=2,a){if(s||(o="next"),n=a[o]){if(!(n=n.call(a,c)))throw TypeError("iterator result is not an object");if(!n.done)return n;c=n.value,s<2&&(s=0)}else 1===s&&(n=a.return)&&n.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((n=(l=f.n<0)?c:t.call(r,f))!==i)break}catch(n){a=e,s=1,c=n}finally{d=1}}return{value:n,done:l}}}(t,o,a),!0),d}var i={};function s(){}function c(){}function d(){}n=Object.getPrototypeOf;var u=[][r]?n(n([][r]())):(p(n={},r,function(){return this}),n),l=d.prototype=s.prototype=Object.create(u);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,p(e,o,"GeneratorFunction")),e.prototype=Object.create(l),e}return c.prototype=d,p(l,"constructor",d),p(d,"constructor",c),c.displayName="GeneratorFunction",p(d,o,"GeneratorFunction"),p(l),p(l,o,"Generator"),p(l,r,function(){return this}),p(l,"toString",function(){return"[object Generator]"}),(f=function(){return{w:a,m:m}})()}function p(e,n,t,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,n,t,r){function a(n,t){p(e,n,function(e){return this._invoke(n,t,e)})}n?o?o(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(a("next",0),a("throw",1),a("return",2))},p(e,n,t,r)}function m(e,n){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},m(e,n)}function h(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,i,s=[],c=!0,d=!1;try{if(a=(t=t.call(e)).next,0===n);else for(;!(c=(r=a.call(t)).done)&&(s.push(r.value),s.length!==n);c=!0);}catch(e){d=!0,o=e}finally{try{if(!c&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(d)throw o}}return s}}(e,n)||w(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(n){return function(n){if(Array.isArray(n))return e(n)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||w(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){var n=function(e,n){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof n?n:n+""}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function w(n,t){if(n){if("string"==typeof n)return e(n,t);var r={}.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(n,t):void 0}}function _(e){var n="function"==typeof Map?new Map:void 0;return _=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(n){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return function(e,n,t){if(l())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,n);var o=new(e.bind.apply(e,r));return t&&m(o,t.prototype),o}(e,arguments,d(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),m(t,e)},_(e)}var b=Object.create,E=Object.defineProperty,S=Object.defineProperties,T=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols,P=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,I=function(e,n,t){return n in e?E(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t},M=function(e,n){for(var t in n||(n={}))D.call(n,t)&&I(e,t,n[t]);if(C){var r,o=s(C(n));try{for(o.s();!(r=o.n()).done;){t=r.value;A.call(n,t)&&I(e,t,n[t])}}catch(e){o.e(e)}finally{o.f()}}return e},R=function(e,n){return S(e,k(n))},O=function(e,n){return function(){return n||(0,e[F(e)[0]])((n={exports:{}}).exports,n),n.exports}},L=function(e,n,t){return t=null!=e?b(P(e)):{},function(e,n,t,r){if(n&&"object"===y(n)||"function"==typeof n){var o,a=s(F(n));try{var i=function(){var a=o.value;D.call(e,a)||a===t||E(e,a,{get:function(){return n[a]},enumerable:!(r=T(n,a))||r.enumerable})};for(a.s();!(o=a.n()).done;)i()}catch(e){a.e(e)}finally{a.f()}}return e}(E(t,"default",{value:e,enumerable:!0}),e)},x=function(e,n,t,r){for(var o,a=T(n,t),i=e.length-1;i>=0;i--)(o=e[i])&&(a=o(n,t,a)||a);return a&&E(n,t,a),a},U=function(e,n,t){return I(e,"symbol"!==y(n)?n+"":n,t)},N=O({"../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js":function(e,n){var t=Object.prototype.hasOwnProperty,r="~";function o(){}function a(e,n,t){this.fn=e,this.context=n,this.once=t||!1}function i(e,n,t,o,i){if("function"!=typeof t)throw new TypeError("The listener must be a function");var s=new a(t,o||e,i),c=r?r+n:n;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,n){0===--e._eventsCount?e._events=new o:delete e._events[n]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var n=r?r+e:e,t=this._events[n];if(!t)return[];if(t.fn)return[t.fn];for(var o=0,a=t.length,i=new Array(a);o<a;o++)i[o]=t[o].fn;return i},c.prototype.listenerCount=function(e){var n=r?r+e:e,t=this._events[n];return t?t.fn?1:t.length:0},c.prototype.emit=function(e,n,t,o,a,i){var s=r?r+e:e;if(!this._events[s])return!1;var c,d,u=this._events[s],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,n),!0;case 3:return u.fn.call(u.context,n,t),!0;case 4:return u.fn.call(u.context,n,t,o),!0;case 5:return u.fn.call(u.context,n,t,o,a),!0;case 6:return u.fn.call(u.context,n,t,o,a,i),!0}for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u.fn.apply(u.context,c)}else{var f,p=u.length;for(d=0;d<p;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,n);break;case 3:u[d].fn.call(u[d].context,n,t);break;case 4:u[d].fn.call(u[d].context,n,t,o);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];u[d].fn.apply(u[d].context,c)}}return!0},c.prototype.on=function(e,n,t){return i(this,e,n,t,!1)},c.prototype.once=function(e,n,t){return i(this,e,n,t,!0)},c.prototype.removeListener=function(e,n,t,o){var a=r?r+e:e;if(!this._events[a])return this;if(!n)return s(this,a),this;var i=this._events[a];if(i.fn)i.fn!==n||o&&!i.once||t&&i.context!==t||s(this,a);else{for(var c=0,d=[],u=i.length;c<u;c++)(i[c].fn!==n||o&&!i[c].once||t&&i[c].context!==t)&&d.push(i[c]);d.length?this._events[a]=1===d.length?d[0]:d:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var n;return e?(n=r?r+e:e,this._events[n]&&s(this,n)):(this._events=new o,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,void 0!==n&&(n.exports=c)}}),H=O({"../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/grammar.js":function(e,n){var t=n.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 n="candidate:%s %d %s %d %s %d typ %s";return n+=null!=e.raddr?" raddr %s rport %d":"%v%v",n+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(n+=" generation %d"),n+=null!=e["network-id"]?" network-id %d":"%v",n+=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 n="ssrc:%d";return null!=e.attribute&&(n+=" %s",null!=e.value&&(n+=":%s")),n}},{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 n="mediaclk:";return n+=null!=e.id?"id=%s %s":"%v%s",n+=null!=e.mediaClockValue?"=%s":"",n+=null!=e.rateNumerator?" rate=%s":"",n+=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(t).forEach(function(e){t[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})}}),$=O({"../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/parser.js":function(e){var n=function(e){return String(Number(e))===e?Number(e):e},t=function(e,t,r){var o=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:o&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:o?t[e.name]:t;!function(e,t,r,o){if(o&&!r)t[o]=n(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(t[r[a]]=n(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},r=H(),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var n={},a=[],i=n;return e.split(/(\r\n|\r|\n)/).filter(o).forEach(function(e){var n=e[0],o=e.slice(2);"m"===n&&(a.push({rtp:[],fmtp:[]}),i=a[a.length-1]);for(var s=0;s<(r[n]||[]).length;s+=1){var c=r[n][s];if(c.reg.test(o))return t(c,i,o)}}),n.media=a,n};var a=function(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=n(r[1]):1===r.length&&t.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(n),o=0;o<r.length;o+=3)t.push({component:r[o],ip:r[o+1],port:r[o+2]});return t},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=n(e):(t=n(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}}}),B=O({"../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/writer.js":function(e,n){var t=H(),r=/%[sdv%]/g,o=function(e){var n=1,t=arguments,o=t.length;return e.replace(r,function(e){if(n>=o)return e;var r=t[n];switch(n+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}})},a=function(e,n,t){var r=[e+"="+(n.format instanceof Function?n.format(n.push?t:t[n.name]):n.format)];if(n.names)for(var a=0;a<n.names.length;a+=1){var i=n.names[a];n.name?r.push(t[n.name][i]):r.push(t[n.names[a]])}else r.push(t[n.name]);return o.apply(null,r)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];n.exports=function(e,n){n=n||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var r=n.outerOrder||i,o=n.innerOrder||s,c=[];return r.forEach(function(n){t[n].forEach(function(t){t.name in e&&null!=e[t.name]?c.push(a(n,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){c.push(a(n,t,e))})})}),e.media.forEach(function(e){c.push(a("m",t.m[0],e)),o.forEach(function(n){t[n].forEach(function(t){t.name in e&&null!=e[t.name]?c.push(a(n,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){c.push(a(n,t,e))})})})}),c.join("\r\n")+"\r\n"}}}),W=O({"../node_modules/.pnpm/sdp-transform@2.15.0/node_modules/sdp-transform/lib/index.js":function(e){var n=$(),t=B(),r=H();e.grammar=r,e.write=t,e.parse=n.parse,e.parseParams=n.parseParams,e.parseFmtpConfig=n.parseFmtpConfig,e.parsePayloads=n.parsePayloads,e.parseRemoteCandidates=n.parseRemoteCandidates,e.parseImageAttributes=n.parseImageAttributes,e.parseSimulcastStreamList=n.parseSimulcastStreamList}}),j=L(N()),z=Symbol("instance"),V=Symbol("cacheResult"),q=function(){return i(function e(n,t,r){o(this,e),this.oldState=n,this.newState=t,this.action=r,this.aborted=!1},[{key:"abort",value:function(e){this.aborted=!0,Z.call(e,this.oldState,new Error("action '".concat(this.action,"' aborted")))}},{key:"toString",value:function(){return"".concat(this.action,"ing")}}])}(),K=function(e){function n(e,t,a){var i;return o(this,n),(i=r(this,n,[t])).state=e,i.message=t,i.cause=a,i}return u(n,e),i(n)}(_(Error));var G=new Map;function Q(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(r,o,a){var i=t.action||o;if(!t.context){var s=G.get(r)||[];G.has(r)||G.set(r,s),s.push({from:e,to:n,action:i})}var c=a.value;a.value=function(){for(var r,o=this,a=this,s=arguments.length,d=new Array(s),u=0;u<s;u++)d[u]=arguments[u];t.context&&(a=ee.get("function"==typeof t.context?(r=t.context).call.apply(r,[this].concat(d)):t.context));if(a.state===n)return t.sync?a[V]:Promise.resolve(a[V]);a.state instanceof q&&a.state.action==t.abortAction&&a.state.abort(a);var l=null;Array.isArray(e)?0==e.length?a.state instanceof q&&a.state.abort(a):"string"==typeof a.state&&e.includes(a.state)||(l=new K(a._state,"".concat(a.name," ").concat(i," to ").concat(n," failed: current state ").concat(a._state," not from ").concat(e.join("|")))):e!==a.state&&(l=new K(a._state,"".concat(a.name," ").concat(i," to ").concat(n," failed: current state ").concat(a._state," not from ").concat(e)));var f=function(e){if(t.fail&&t.fail.call(o,e),t.sync){if(t.ignoreError)return e;throw e}return t.ignoreError?Promise.resolve(e):Promise.reject(e)};if(l)return f(l);var p=a.state,m=new q(p,n,i);Z.call(a,m);var h,v=function(e){var r;return a[V]=e,m.aborted||(Z.call(a,n),null===(r=t.success)||void 0===r||r.call(o,a[V])),e},g=function(e){return Z.call(a,p,e),f(e)};try{var w=c.apply(this,d);return"object"===y(h=w)&&h&&"then"in h?w.then(v).catch(g):t.sync?v(w):Promise.resolve(v(w))}catch(t){return g(new K(a._state,"".concat(a.name," ").concat(i," from ").concat(e," to ").concat(n," failed: ").concat(t),t instanceof Error?t:new Error(String(t))))}}}}var Y,X,J=(Y="undefined"!=typeof window&&window.__AFSM__,X="undefined"!=typeof importScripts,Y?function(e,n){window.dispatchEvent(new CustomEvent(e,{detail:n}))}:X?function(e,n){postMessage({type:e,payload:n})}:function(){});function Z(e,n){var t=this._state;this._state=e;var r=e.toString();e&&this.emit(r,t),this.emit(ee.STATECHANGED,e,t,n),this.updateDevTools({value:e,old:t,err:n instanceof Error?n.message:String(n)})}var ee=function(e){function n(e,t,a){var i;o(this,n),(i=r(this,n)).name=e,i.groupName=t,i._state=n.INIT,e||(e=Date.now().toString(36)),a?Object.setPrototypeOf(i,a):a=Object.getPrototypeOf(i),t||(i.groupName=i.constructor.name);var s=a[z];return s?i.name=s.name+"-"+s.count++:a[z]={name:i.name,count:0},i.updateDevTools({diagram:i.stateDiagram}),i}return u(n,e),i(n,[{key:"stateDiagram",get:function(){var e=Object.getPrototypeOf(this),n=G.get(e)||[],t=new Set,r=[],o=[],a=new Set,i=Object.getPrototypeOf(e);G.has(i)&&(i.stateDiagram.forEach(function(e){return t.add(e)}),i.allStates.forEach(function(e){return a.add(e)})),n.forEach(function(e){var n=e.from,t=e.to,a=e.action;"string"==typeof n?r.push({from:n,to:t,action:a}):n.length?n.forEach(function(e){r.push({from:e,to:t,action:a})}):o.push({to:t,action:a})}),r.forEach(function(e){var n=e.from,r=e.to,o=e.action;a.add(n),a.add(r),a.add(o+"ing"),t.add("".concat(n," --\x3e ").concat(o,"ing : ").concat(o)),t.add("".concat(o,"ing --\x3e ").concat(r," : ").concat(o," 🟢")),t.add("".concat(o,"ing --\x3e ").concat(n," : ").concat(o," 🔴"))}),o.forEach(function(e){var n=e.to,r=e.action;t.add("".concat(r,"ing --\x3e ").concat(n," : ").concat(r," 🟢")),a.forEach(function(e){e!==n&&t.add("".concat(e," --\x3e ").concat(r,"ing : ").concat(r))})});var s=v(t);return Object.defineProperties(e,{stateDiagram:{value:s},allStates:{value:a}}),s}},{key:"updateDevTools",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};J(n.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},e))}},{key:"state",get:function(){return this._state},set:function(e){Z.call(this,e)}}],[{key:"get",value:function(e){var t;return"string"==typeof e?(t=n.instances.get(e))||n.instances.set(e,t=new n(e,void 0,Object.create(n.prototype))):(t=n.instances2.get(e))||n.instances2.set(e,t=new n(e.constructor.name,void 0,Object.create(n.prototype))),t}},{key:"getState",value:function(e){var t;return null===(t=n.get(e))||void 0===t?void 0:t.state}}])}(j.default);ee.STATECHANGED="stateChanged",ee.UPDATEAFSM="updateAFSM",ee.INIT="[*]",ee.ON="on",ee.OFF="off",ee.instances=new Map,ee.instances2=new WeakMap;var ne=function(e){function n(){var e;return o(this,n),e=r(this,n,arguments),U(e,"decoder"),U(e,"config"),e}return u(n,e),i(n,[{key:"initialize",value:(a=t(f().m(function e(){var n=this;return f().w(function(e){for(;;)switch(e.n){case 0:this.decoder=new VideoDecoder({output:function(e){n.emit("videoFrame",e)},error:function(e){n.close(),n.emit("error",e)}});case 1:return e.a(2)}},e,this)})),function(){return a.apply(this,arguments)})},{key:"configure",value:function(e){this.config=e,e.description||"av1"===e.codec||(this.config[e.codec]={format:"annexb"}),this.decoder.configure(R(M({},e),{codec:this.getCodec(e)}))}},{key:"getCodec",value:function(e){switch(e.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return e.codec}}},{key:"decode",value:function(e){"configured"===this.decoder.state&&this.decoder.decode(new EncodedVideoChunk(e))}},{key:"flush",value:function(){this.decoder.flush()}},{key:"reset",value:function(){this.decoder.reset()}},{key:"close",value:function(){"closed"!==this.decoder.state&&this.decoder.close()}}]);var a}(ee);function te(){var e;self.onmessage=function(n){if("init"===n.data.type){var t=n.data,r=t.canvas,o=t.wasmScript,a=t.wasmBinary,i=null==r?void 0:r.getContext("2d"),s=0,c=0,d={wasmBinary:a,postRun:function(){e=new d.VideoDecoder({videoInfo:function(e,n){s=e,c=n,console.log("video info",e,n)},yuvData:function(e,n){var t=s*c,o=t>>2,a=d.HEAPU32[e>>2],u=d.HEAPU32[1+(e>>2)],l=d.HEAPU32[2+(e>>2)],f=d.HEAPU8.subarray(a,a+t),p=d.HEAPU8.subarray(u,u+o),m=d.HEAPU8.subarray(l,l+o),h=new Uint8Array(t+o+o);h.set(f),h.set(p,t),h.set(m,t+o);var v=new VideoFrame(h,{codedWidth:s,codedHeight:c,format:"I420",timestamp:n});r?(null==i||i.drawImage(v,0,0,r.width,r.height),null==i||i.commit()):self.postMessage({type:"yuvData",videoFrame:v},[v])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+o)()(d)}else if("decode"===n.data.type){var u=n.data.packet;null==e||e.decode(u.data,"key"==u.type,u.timestamp)}else if("setCodec"===n.data.type){var l=n.data,f=l.codec,p=l.format,m=l.description;null==e||e.setCodec(f,p,null!=m?m:"")}}}x([Q([ee.INIT,"closed"],"initialized")],ne.prototype,"initialize"),x([Q("initialized","configured",{sync:!0})],ne.prototype,"configure"),x([function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(e,t,r){var o=r.value,a=t;r.value=function(){if(!n.includes(this.state.toString()))throw new K(this.state,"".concat(this.name," ").concat(a," failed: current state ").concat(this.state," not in ").concat(n));for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.apply(this,t)}}}("configured")],ne.prototype,"decode"),x([Q([],ee.INIT,{sync:!0})],ne.prototype,"reset"),x([Q([],"closed",{ignoreError:!0,sync:!0})],ne.prototype,"close");var re=function(e){function n(e,t){var a,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0,c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o(this,n),(a=r(this,n)).createModule=e,a.wasmBinary=t,a.workerMode=i,a.canvas=s,a.yuvMode=c,U(a,"worker"),U(a,"decoder"),U(a,"config"),U(a,"module",{}),U(a,"width",0),U(a,"height",0),a}return u(n,e),i(n,[{key:"initialize",value:(a=t(f().m(function e(n){var t,r,o,a,i,s=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(!this.workerMode){e.n=2;break}return r=new RegExp("\\{(.+)\\}","s").exec(te.toString())[1],this.worker=new Worker(URL.createObjectURL(new Blob([r],{type:"text/javascript"}))),o=null==(t=this.canvas)?void 0:t.transferControlToOffscreen(),e.n=1,this.wasmBinary;case 1:return a=e.v,console.warn("worker mode",a),this.worker.postMessage({type:"init",canvas:o,wasmScript:this.createModule.toString(),wasmBinary:a},o?[o,a]:[a]),e.a(2,new Promise(function(e){s.worker.onmessage=function(n){if("ready"===n.data.type)delete s.wasmBinary,e(),console.warn("worker mode initialize success");else if("yuvData"===n.data.type){var t=n.data.videoFrame;s.emit("videoFrame",t)}}}));case 2:if(i=this.module,!this.wasmBinary){e.n=4;break}return e.n=3,this.wasmBinary;case 3:i.wasmBinary=e.v;case 4:return i.print=function(e){return console.log(e)},i.printErr=function(e){return console.log("[JS] ERROR: ".concat(e))},i.onAbort=function(){return console.log("[JS] FATAL: WASM ABORTED")},e.a(2,new Promise(function(e){i.postRun=function(n){s.decoder=new s.module.VideoDecoder(s),console.log("video soft decoder initialize success"),e()},n&&Object.assign(i,n),s.createModule(i)}))}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"configure",value:function(e){var n,t,r;this.config=e;var o=this.config.codec.startsWith("avc")?"avc":"hevc",a=this.config.description?"avc"==o?"avcc":"hvcc":"annexb";null==(t=this.decoder)||t.setCodec(o,a,null!=(n=this.config.description)?n:""),null==(r=this.worker)||r.postMessage({type:"setCodec",codec:o,format:a,description:this.config.description})}},{key:"decode",value:function(e){var n,t;null==(n=this.decoder)||n.decode(e.data,"key"==e.type,e.timestamp),"configured"===this.state&&(null==(t=this.worker)||t.postMessage({type:"decode",packet:e}))}},{key:"flush",value:function(){}},{key:"reset",value:function(){this.config=void 0,this.decoder&&this.decoder.clear()}},{key:"close",value:function(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}},{key:"videoInfo",value:function(e,n){this.width=e,this.height=n;var t={width:e,height:n};this.emit("videoCodecInfo",t)}},{key:"yuvData",value:function(e,n){if(this.module){var t=this.width*this.height,r=t>>2,o=this.module.HEAPU32[e>>2],a=this.module.HEAPU32[1+(e>>2)],i=this.module.HEAPU32[2+(e>>2)],s=this.module.HEAPU8.subarray(o,o+t),c=this.module.HEAPU8.subarray(a,a+r),d=this.module.HEAPU8.subarray(i,i+r);if(this.yuvMode)this.emit("videoFrame",{y:s,u:c,v:d,timestamp:n});else{var u=new Uint8Array(t+r+r);u.set(s),u.set(c,t),u.set(d,t+r),this.emit("videoFrame",new VideoFrame(u,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:n}))}}}},{key:"errorInfo",value:function(e){var n={errMsg:e};this.emit("error",n)}}]);var a}(ee);x([Q([ee.INIT,"closed"],"initialized")],re.prototype,"initialize"),x([Q("initialized","configured",{sync:!0})],re.prototype,"configure"),x([Q([],ee.INIT,{sync:!0})],re.prototype,"reset"),x([Q([],"closed",{sync:!0})],re.prototype,"close");var oe,ae=(oe="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t;a.ready=new Promise(function(t,r){e=t,n=r});var s=Object.assign({},a),d="./this.program",l="object"==("undefined"==typeof window?"undefined":y(window)),f="function"==typeof importScripts;"object"==("undefined"==typeof process?"undefined":y(process))&&"object"==y(process.versions)&&process.versions.node;var p,m,h,v="";(l||f)&&(f?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),oe&&(v=oe),v=0!==v.indexOf("blob:")?v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1):"",p=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(null),n.responseText},f&&(h=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),m=function(e,n,t){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?n(r.response):t()},r.onerror=t,r.send(null)});var g,w,b,E=a.print||console.log.bind(console),S=a.printErr||console.error.bind(console);Object.assign(a,s),s=null,a.arguments&&a.arguments,a.thisProgram&&(d=a.thisProgram),a.quit&&a.quit,a.wasmBinary&&(g=a.wasmBinary),a.noExitRuntime,"object"!=("undefined"==typeof WebAssembly?"undefined":y(WebAssembly))&&K("no native wasm support detected");var T,k,F,C,P,D,A,I,M,R=!1,O=[],L=[],x=[];function U(e){O.unshift(e)}function N(e){x.unshift(e)}var H,$,B,W,j=0,z=null;function V(e){j++,a.monitorRunDependencies&&a.monitorRunDependencies(j)}function q(e){if(j--,a.monitorRunDependencies&&a.monitorRunDependencies(j),0==j&&z){var n=z;z=null,n()}}function K(e){a.onAbort&&a.onAbort(e),S(e="Aborted("+e+")"),R=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}function G(e){return e.startsWith("data:application/octet-stream;base64,")}function Q(e){if(e==H&&g)return new Uint8Array(g);if(h)return h(e);throw"both async and sync fetching of the wasm failed"}function Y(e,n,t){return function(e){return g||!l&&!f||"function"!=typeof fetch?Promise.resolve().then(function(){return Q(e)}):fetch(e,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+e+"'";return n.arrayBuffer()}).catch(function(){return Q(e)})}(e).then(function(e){return WebAssembly.instantiate(e,n)}).then(function(e){return e}).then(t,function(e){S("failed to asynchronously prepare wasm: "+e),K(e)})}G(H="videodec.wasm")||($=H,H=a.locateFile?a.locateFile($,v):v+$);var X=function(e){for(;e.length>0;)e.shift()(a)};function J(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){D[this.ptr+4>>2]=e},this.get_type=function(){return D[this.ptr+4>>2]},this.set_destructor=function(e){D[this.ptr+8>>2]=e},this.get_destructor=function(){return D[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,T[this.ptr+12|0]=e},this.get_caught=function(){return 0!=T[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,T[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=T[this.ptr+13|0]},this.init=function(e,n){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(n)},this.set_adjusted_ptr=function(e){D[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return D[this.ptr+16>>2]},this.get_exception_ptr=function(){if(rt(this.get_type()))return D[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var Z={isAbs:function(e){return"/"===e.charAt(0)},splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,n){for(var t=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),t++):t&&(e.splice(r,1),t--)}if(n)for(;t;t--)e.unshift("..");return e},normalize:function(e){var n=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter(function(e){return!!e}),!n).join("/"))||n||(e="."),e&&t&&(e+="/"),(n?"/":"")+e},dirname:function(e){var n=Z.splitPath(e),t=n[0],r=n[1];return t||r?(r&&(r=r.substr(0,r.length-1)),t+r):"."},basename:function(e){if("/"===e)return"/";var n=(e=(e=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===n?e:e.substr(n+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:function(e,n){return Z.normalize(e+"/"+n)}},ee=function(e){return(ee=function(){if("object"==("undefined"==typeof crypto?"undefined":y(crypto))&&"function"==typeof crypto.getRandomValues)return function(e){return crypto.getRandomValues(e)};K("initRandomDevice")}())(e)},ne={resolve:function(){for(var e="",n=!1,t=arguments.length-1;t>=-1&&!n;t--){var r=t>=0?arguments[t]:he.cwd();if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";e=r+"/"+e,n=Z.isAbs(r)}return(n?"/":"")+(e=Z.normalizeArray(e.split("/").filter(function(e){return!!e}),!n).join("/"))||"."},relative:function(e,n){function t(e){for(var n=0;n<e.length&&""===e[n];n++);for(var t=e.length-1;t>=0&&""===e[t];t--);return n>t?[]:e.slice(n,t-n+1)}e=ne.resolve(e).substr(1),n=ne.resolve(n).substr(1);for(var r=t(e.split("/")),o=t(n.split("/")),a=Math.min(r.length,o.length),i=a,s=0;s<a;s++)if(r[s]!==o[s]){i=s;break}var c=[];for(s=i;s<r.length;s++)c.push("..");return(c=c.concat(o.slice(i))).join("/")}},te="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,re=function(e,n,t){for(var r=n+t,o=n;e[o]&&!(o>=r);)++o;if(o-n>16&&e.buffer&&te)return te.decode(e.subarray(n,o));for(var a="";n<o;){var i=e[n++];if(128&i){var s=63&e[n++];if(192!=(224&i)){var c=63&e[n++];if((i=224==(240&i)?(15&i)<<12|s<<6|c:(7&i)<<18|s<<12|c<<6|63&e[n++])<65536)a+=String.fromCharCode(i);else{var d=i-65536;a+=String.fromCharCode(55296|d>>10,56320|1023&d)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},ae=[],ie=function(e){for(var n=0,t=0;t<e.length;++t){var r=e.charCodeAt(t);r<=127?n++:r<=2047?n+=2:r>=55296&&r<=57343?(n+=4,++t):n+=3}return n},se=function(e,n,t,r){if(!(r>0))return 0;for(var o=t,a=t+r-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;n[t++]=s}else if(s<=2047){if(t+1>=a)break;n[t++]=192|s>>6,n[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;n[t++]=224|s>>12,n[t++]=128|s>>6&63,n[t++]=128|63&s}else{if(t+3>=a)break;n[t++]=240|s>>18,n[t++]=128|s>>12&63,n[t++]=128|s>>6&63,n[t++]=128|63&s}}return n[t]=0,t-o};function ce(e,n,t){var r=ie(e)+1,o=new Array(r),a=se(e,o,0,o.length);return o.length=a,o}var de={ttys:[],init:function(){},shutdown:function(){},register:function(e,n){de.ttys[e]={input:[],output:[],ops:n},he.registerDevice(e,de.stream_ops)},stream_ops:{open:function(e){var n=de.ttys[e.node.rdev];if(!n)throw new he.ErrnoError(43);e.tty=n,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,n,t,r,o){if(!e.tty||!e.tty.ops.get_char)throw new he.ErrnoError(60);for(var a=0,i=0;i<r;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new he.ErrnoError(29)}if(void 0===s&&0===a)throw new he.ErrnoError(6);if(null==s)break;a++,n[t+i]=s}return a&&(e.node.timestamp=Date.now()),a},write:function(e,n,t,r,o){if(!e.tty||!e.tty.ops.put_char)throw new he.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,n[t+a])}catch(e){throw new he.ErrnoError(29)}return r&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:function(e){return function(){if(!ae.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n"),!e)return null;ae=ce(e)}return ae.shift()}()},put_char:function(e,n){null===n||10===n?(E(re(e.output,0)),e.output=[]):0!=n&&e.output.push(n)},fsync:function(e){e.output&&e.output.length>0&&(E(re(e.output,0)),e.output=[])},ioctl_tcgets:function(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets:function(e,n,t){return 0},ioctl_tiocgwinsz:function(e){return[24,80]}},default_tty1_ops:{put_char:function(e,n){null===n||10===n?(S(re(e.output,0)),e.output=[]):0!=n&&e.output.push(n)},fsync:function(e){e.output&&e.output.length>0&&(S(re(e.output,0)),e.output=[])}}},ue=function(e){K()},le={ops_table:null,mount:function(e){return le.createNode(null,"/",16895,0)},createNode:function(e,n,t,r){if(he.isBlkdev(t)||he.isFIFO(t))throw new he.ErrnoError(63);le.ops_table||(le.ops_table={dir:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr,lookup:le.node_ops.lookup,mknod:le.node_ops.mknod,rename:le.node_ops.rename,unlink:le.node_ops.unlink,rmdir:le.node_ops.rmdir,readdir:le.node_ops.readdir,symlink:le.node_ops.symlink},stream:{llseek:le.stream_ops.llseek}},file:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr},stream:{llseek:le.stream_ops.llseek,read:le.stream_ops.read,write:le.stream_ops.write,allocate:le.stream_ops.allocate,mmap:le.stream_ops.mmap,msync:le.stream_ops.msync}},link:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr,readlink:le.node_ops.readlink},stream:{}},chrdev:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr},stream:he.chrdev_stream_ops}});var o=he.createNode(e,n,t,r);return he.isDir(o.mode)?(o.node_ops=le.ops_table.dir.node,o.stream_ops=le.ops_table.dir.stream,o.contents={}):he.isFile(o.mode)?(o.node_ops=le.ops_table.file.node,o.stream_ops=le.ops_table.file.stream,o.usedBytes=0,o.contents=null):he.isLink(o.mode)?(o.node_ops=le.ops_table.link.node,o.stream_ops=le.ops_table.link.stream):he.isChrdev(o.mode)&&(o.node_ops=le.ops_table.chrdev.node,o.stream_ops=le.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[n]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,n){var t=e.contents?e.contents.length:0;if(!(t>=n)){n=Math.max(n,t*(t<1048576?2:1.125)>>>0),0!=t&&(n=Math.max(n,256));var r=e.contents;e.contents=new Uint8Array(n),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,n){if(e.usedBytes!=n)if(0==n)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(n),t&&e.contents.set(t.subarray(0,Math.min(n,e.usedBytes))),e.usedBytes=n}},node_ops:{getattr:function(e){var n={};return n.dev=he.isChrdev(e.mode)?e.id:1,n.ino=e.id,n.mode=e.mode,n.nlink=1,n.uid=0,n.gid=0,n.rdev=e.rdev,he.isDir(e.mode)?n.size=4096:he.isFile(e.mode)?n.size=e.usedBytes:he.isLink(e.mode)?n.size=e.link.length:n.size=0,n.atime=new Date(e.timestamp),n.mtime=new Date(e.timestamp),n.ctime=new Date(e.timestamp),n.blksize=4096,n.blocks=Math.ceil(n.size/n.blksize),n},setattr:function(e,n){void 0!==n.mode&&(e.mode=n.mode),void 0!==n.timestamp&&(e.timestamp=n.timestamp),void 0!==n.size&&le.resizeFileStorage(e,n.size)},lookup:function(e,n){throw he.genericErrors[44]},mknod:function(e,n,t,r){return le.createNode(e,n,t,r)},rename:function(e,n,t){if(he.isDir(e.mode)){var r;try{r=he.lookupNode(n,t)}catch(e){}if(r)for(var o in r.contents)throw new he.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,n.contents[t]=e,n.timestamp=e.parent.timestamp,e.parent=n},unlink:function(e,n){delete e.contents[n],e.timestamp=Date.now()},rmdir:function(e,n){var t=he.lookupNode(e,n);for(var r in t.contents)throw new he.ErrnoError(55);delete e.contents[n],e.timestamp=Date.now()},readdir:function(e){var n=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&n.push(t);return n},symlink:function(e,n,t){var r=le.createNode(e,n,41471,0);return r.link=t,r},readlink:function(e){if(!he.isLink(e.mode))throw new he.ErrnoError(28);return e.link}},stream_ops:{read:function(e,n,t,r,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,r);if(i>8&&a.subarray)n.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)n[t+s]=a[o+s];return i},write:function(e,n,t,r,o,a){if(!r)return 0;var i=e.node;if(i.timestamp=Date.now(),n.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=n.subarray(t,t+r),i.usedBytes=r,r;if(0===i.usedBytes&&0===o)return i.contents=n.slice(t,t+r),i.usedBytes=r,r;if(o+r<=i.usedBytes)return i.contents.set(n.subarray(t,t+r),o),r}if(le.expandFileStorage(i,o+r),i.contents.subarray&&n.subarray)i.contents.set(n.subarray(t,t+r),o);else for(var s=0;s<r;s++)i.contents[o+s]=n[t+s];return i.usedBytes=Math.max(i.usedBytes,o+r),r},llseek:function(e,n,t){var r=n;if(1===t?r+=e.position:2===t&&he.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new he.ErrnoError(28);return r},allocate:function(e,n,t){le.expandFileStorage(e.node,n+t),e.node.usedBytes=Math.max(e.node.usedBytes,n+t)},mmap:function(e,n,t,r,o){if(!he.isFile(e.node.mode))throw new he.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||s.buffer!==T.buffer){if((t>0||t+n<s.length)&&(s=s.subarray?s.subarray(t,t+n):Array.prototype.slice.call(s,t,t+n)),i=!0,!(a=ue()))throw new he.ErrnoError(48);T.set(s,a)}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:function(e,n,t,r,o){return le.stream_ops.write(e,n,0,r,t,!1),0}}},fe=function(e,n,t,r){var o="al ".concat(e);m(e,function(t){var r,a;r=t,a='Loading data file "'.concat(e,'" failed (no arrayBuffer).'),r||K(a),n(new Uint8Array(t)),o&&q()},function(n){if(!t)throw'Loading data file "'.concat(e,'" failed.');t()}),o&&V()},pe=a.preloadPlugins||[];function me(e,n){var t=0;return e&&(t|=365),n&&(t|=146),t}var he={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ne.resolve(e)))return{path:"",node:null};if((n=Object.assign({follow_mount:!0,recurse_count:0},n)).recurse_count>8)throw new he.ErrnoError(32);for(var t=e.split("/").filter(function(e){return!!e}),r=he.root,o="/",a=0;a<t.length;a++){var i=a===t.length-1;if(i&&n.parent)break;if(r=he.lookupNode(r,t[a]),o=Z.join2(o,t[a]),he.isMountpoint(r)&&(!i||i&&n.follow_mount)&&(r=r.mounted.root),!i||n.follow)for(var s=0;he.isLink(r.mode);){var c=he.readlink(o);if(o=ne.resolve(Z.dirname(o),c),r=he.lookupPath(o,{recurse_count:n.recurse_count+1}).node,s++>40)throw new he.ErrnoError(32)}}return{path:o,node:r}},getPath:function(e){for(var n;;){if(he.isRoot(e)){var t=e.mount.mountpoint;return n?"/"!==t[t.length-1]?"".concat(t,"/").concat(n):t+n:t}n=n?"".concat(e.name,"/").concat(n):e.name,e=e.parent}},hashName:function(e,n){for(var t=0,r=0;r<n.length;r++)t=(t<<5)-t+n.charCodeAt(r)|0;return(e+t>>>0)%he.nameTable.length},hashAddNode:function(e){var n=he.hashName(e.parent.id,e.name);e.name_next=he.nameTable[n],he.nameTable[n]=e},hashRemoveNode:function(e){var n=he.hashName(e.parent.id,e.name);if(he.nameTable[n]===e)he.nameTable[n]=e.name_next;else for(var t=he.nameTable[n];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,n){var t=he.mayLookup(e);if(t)throw new he.ErrnoError(t,e);for(var r=he.hashName(e.id,n),o=he.nameTable[r];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===n)return o}return he.lookup(e,n)},createNode:function(e,n,t,r){var o=new he.FSNode(e,n,t,r);return he.hashAddNode(o),o},destroyNode:function(e){he.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return!(49152&~e)},flagsToPermissionString:function(e){var n=["r","w","rw"][3&e];return 512&e&&(n+="w"),n},nodePermissions:function(e,n){return he.ignorePermissions||(!n.includes("r")||292&e.mode)&&(!n.includes("w")||146&e.mode)&&(!n.includes("x")||73&e.mode)?0:2},mayLookup:function(e){var n=he.nodePermissions(e,"x");return n||(e.node_ops.lookup?0:2)},mayCreate:function(e,n){try{return he.lookupNode(e,n),20}catch(e){}return he.nodePermissions(e,"wx")},mayDelete:function(e,n,t){var r;try{r=he.lookupNode(e,n)}catch(e){return e.errno}var o=he.nodePermissions(e,"wx");if(o)return o;if(t){if(!he.isDir(r.mode))return 54;if(he.isRoot(r)||he.getPath(r)===he.cwd())return 10}else if(he.isDir(r.mode))return 31;return 0},mayOpen:function(e,n){return e?he.isLink(e.mode)?32:he.isDir(e.mode)&&("r"!==he.flagsToPermissionString(n)||512&n)?31:he.nodePermissions(e,he.flagsT