@flowplayer/player 3.34.1 → 3.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/package.json +1 -1
- package/plugins/ads.js +2 -2
- package/plugins/analytics.js +1 -1
- package/plugins/rts.js +1 -1
- package/plugins/ssai.js +1 -1
package/plugins/rts.js
CHANGED
|
@@ -15,7 +15,7 @@ read:function(e,t,n,r,s){var i,o,a=8*s-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?s-1:0,p=n?
|
|
|
15
15
|
*/
|
|
16
16
|
(function(e){const t=An,n=jn,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function i(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let r=i(n);const s=r.write(e,t);return s!==n&&(r=r.slice(0,s)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(ee(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(ee(e,ArrayBuffer)||e&&ee(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ee(e,SharedArrayBuffer)||e&&ee(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const s=function(e){if(o.isBuffer(e)){const t=0|p(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||te(e.length)?i(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(s)return s;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),i(e<0?0:0|p(e))}function u(e){const t=e.length<0?0:0|p(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ee(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Q(e).length;default:if(s)return r?-1:J(e).length;t=(""+t).toLowerCase(),s=!0}}function h(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),te(n=+n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,s){let i,o=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(s){let r=-1;for(i=n;i<a;i++)if(l(e,i)===l(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*o}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(l(e,i+r)!==l(t,r)){n=!1;break}if(n)return i}return-1}function v(e,t,n,r){n=Number(n)||0;const s=e.length-n;r?(r=Number(r))>s&&(r=s):r=s;const i=t.length;let o;for(r>i/2&&(r=i/2),o=0;o<r;++o){const r=parseInt(t.substr(2*o,2),16);if(te(r))return o;e[n+o]=r}return o}function w(e,t,n,r){return q(J(t,e.length-n),e,n,r)}function _(e,t,n,r){return q(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function R(e,t,n,r){return q(Q(t),e,n,r)}function E(e,t,n,r){return q(function(e,t){let n,r,s;const i=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,s=n%256,i.push(s),i.push(r);return i}(t,e.length-n),e,n,r)}function k(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let s=t;for(;s<n;){const t=e[s];let i=null,o=t>239?4:t>223?3:t>191?2:1;if(s+o<=n){let n,r,a,c;switch(o){case 1:t<128&&(i=t);break;case 2:n=e[s+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[s+1],r=e[s+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[s+1],r=e[s+2],a=e[s+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,o=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),s+=o}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=T));return n}(r)}e.kMaxLength=s,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return a(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(ee(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),ee(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let s=0,i=Math.min(n,r);s<i;++s)if(e[s]!==t[s]){n=e[s],r=t[s];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let s=0;for(n=0;n<e.length;++n){let t=e[n];if(ee(t,Uint8Array))s+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,s)):Uint8Array.prototype.set.call(r,t,s);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,s)}s+=t.length}return r},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):h.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,s){if(ee(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(s>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const c=Math.min(i,a),l=this.slice(r,s),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){i=l[e],a=u[e];break}return i<a?-1:a<i?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const s=this.length-t;if((void 0===n||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":case"latin1":case"binary":return _(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function A(e,t,n){let r="";n=Math.min(e.length,n);for(let s=t;s<n;++s)r+=String.fromCharCode(127&e[s]);return r}function L(e,t,n){let r="";n=Math.min(e.length,n);for(let s=t;s<n;++s)r+=String.fromCharCode(e[s]);return r}function O(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let s="";for(let r=t;r<n;++r)s+=ne[e[r]];return s}function N(e,t,n){const r=e.slice(t,n);let s="";for(let e=0;e<r.length-1;e+=2)s+=String.fromCharCode(r[e]+256*r[e+1]);return s}function M(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,s,i){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function U(e,t,n,r,s){z(t,r,s,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function j(e,t,n,r,s){z(t,r,s,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function V(e,t,n,r,s,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function W(e,t,r,s,i){return t=+t,r>>>=0,i||V(e,0,r,4),n.write(e,t,r,s,23,4),r+4}function Z(e,t,r,s,i){return t=+t,r>>>=0,i||V(e,0,r,8),n.write(e,t,r,s,52,8),r+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);let r=this[e],s=1,i=0;for(;++i<t&&(s*=256);)r+=this[e+i]*s;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);let r=this[e+--t],s=1;for(;t>0&&(s*=256);)r+=this[e+--t]*s;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=re(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&$(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,s=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(s)<<BigInt(32))}),o.prototype.readBigUInt64BE=re(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&$(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],s=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(s)}),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);let r=this[e],s=1,i=0;for(;++i<t&&(s*=256);)r+=this[e+i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);let r=t,s=1,i=this[e+--r];for(;r>0&&(s*=256);)i+=this[e+--r]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=re(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&$(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),o.prototype.readBigInt64BE=re(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&$(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)}),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){D(this,e,t,n,Math.pow(2,8*n)-1,0)}let s=1,i=0;for(this[t]=255&e;++i<n&&(s*=256);)this[t+i]=e/s&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){D(this,e,t,n,Math.pow(2,8*n)-1,0)}let s=n-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=re(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=re(function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);D(this,e,t,n,r-1,-r)}let s=0,i=1,o=0;for(this[t]=255&e;++s<n&&(i*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/i|0)-o&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);D(this,e,t,n,r-1,-r)}let s=n-1,i=1,o=0;for(this[t+s]=255&e;--s>=0&&(i*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/i|0)-o&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=re(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=re(function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeFloatLE=function(e,t,n){return W(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return W(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return Z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return Z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&0!==r&&(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const s=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),s},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{const i=o.isBuffer(e)?e:o.from(e,r),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=i[s%a]}return this};const G={};function B(e,t,n){G[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name="".concat(this.name," [").concat(e,"]"),this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}}function Y(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function z(e,t,n,r,s,i){if(e>n||e<t){const n="bigint"==typeof t?"n":"";let r;throw r=0===t||t===BigInt(0)?">= 0".concat(n," and < 2").concat(n," ** ").concat(8*(i+1)).concat(n):">= -(2".concat(n," ** ").concat(8*(i+1)-1).concat(n,") and < 2 ** ")+"".concat(8*(i+1)-1).concat(n),new G.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){K(t,"offset"),(void 0===e[t]||void 0===e[t+n])&&$(t,e.length-(n+1))}(r,s,i)}function K(e,t){if("number"!=typeof e)throw new G.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,n){throw Math.floor(e)!==e?(K(e,n),new G.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new G.ERR_BUFFER_OUT_OF_BOUNDS:new G.ERR_OUT_OF_RANGE("offset",">= 0 and <= ".concat(t),e)}B("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)},TypeError),B("ERR_OUT_OF_RANGE",function(e,t,n){let r='The value of "'.concat(e,'" is out of range.'),s=n;return Number.isInteger(n)&&Math.abs(n)>2**32?s=Y(String(n)):"bigint"==typeof n&&(s=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(s=Y(s)),s+="n"),r+=" It must be ".concat(t,". Received ").concat(s),r},RangeError);const H=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let s=null;const i=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!s){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}s=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),s=n;continue}n=65536+(s-55296<<10|n-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Q(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){let s;for(s=0;s<r&&!(s+n>=t.length||s>=e.length);++s)t[s+n]=e[s];return s}function ee(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function te(e){return e!=e}const ne=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let s=0;s<16;++s)t[r+s]=e[n]+e[s]}return t}();function re(e){return typeof BigInt>"u"?se:e}function se(){throw new Error("BigInt not supported")}})(xn),
|
|
17
17
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
18
|
-
function(e,t){var n=xn,r=n.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=i),i.prototype=Object.create(r.prototype),s(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var s=r(e);return void 0!==t?"string"==typeof n?s.fill(t,n):s.fill(t):s.fill(0),s},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Cn,Cn.exports);var Vn=65536;var Wn=Cn.exports.Buffer,Zn=Ue.crypto||Ue.msCrypto;Zn&&Zn.getRandomValues?In.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=Wn.allocUnsafe(e);if(e>0)if(e>Vn)for(var r=0;r<e;r+=Vn)Zn.getRandomValues(n.slice(r,r+Vn));else Zn.getRandomValues(n);return"function"==typeof t?Ie.nextTick(function(){t(null,n)}):n}:In.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};const Gn=In.exports;let Bn=class Js{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Js(this.ufrag,this.pwd);return e.setLite(this.lite),e.setEndOfCandidates(this.endOfCandidates),e}plain(){const e={ufrag:this.ufrag,pwd:this.pwd};return this.lite&&(e.lite=this.lite),this.endOfCandidates&&(e.endOfCandidates=this.endOfCandidates),e}getUfrag(){return this.ufrag}getPwd(){return this.pwd}isLite(){return this.lite}setLite(e){this.lite=e}isEndOfCandidates(){return this.endOfCandidates}setEndOfCandidates(e){this.endOfCandidates=e}};Bn.generate=function(e){const t=new Bn,n=Gn(8),r=Gn(24);return t.ufrag=n.toString("hex"),t.pwd=r.toString("hex"),t.lite=e,t},Bn.expand=function(e){if("ICEInfo"===e.constructor.name)return e;const t=new Bn(e.ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t},Bn.clone=function(e){return"ICEInfo"===e.constructor.name?e.clone():Bn.expand(e)};var Yn=Bn;const zn=yn("SEND","RECV");zn.byValue=function(e){return zn[e.toUpperCase()]},zn.toString=function(e){switch(e){case zn.SEND:return"send";case zn.RECV:return"recv"}},zn.reverse=function(e){switch(e){case zn.SEND:return zn.RECV;case zn.RECV:return zn.SEND}};var Xn=zn;const Kn=Xn;let $n=class ei{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ei(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:Kn.toString(this.direction)};for(var[t,n]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=n;return e}getId(){return this.id}getDirection(){return this.direction}setDirection(e){this.direction=e}getFormats(){return this.formats}setFormats(e){this.formats=[];for(let t=0;t<e.length;++t)this.formats.push(parseInt(e[t]))}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}};$n.expand=function(e){if("RIDInfo"===e.constructor.name)return e;const t=new $n(e.id,Kn.byValue(e.direction));for(const[n,r]of Object.entries(e.params||{}))t.addParam(n,r);return e.formats&&t.setFormats(e.formats),t},$n.clone=function(e){return"RIDInfo"===e.constructor.name?e.clone():$n.expand(e)};var Hn=$n;let Jn=class ti{constructor(e,t){this.paused=t,this.id=e}clone(){return new ti(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}};Jn.expand=function(e){return"SimulcastStreamInfo"===e.constructor.name?e:new Jn(e.id,e.paused)},Jn.clone=function(e){return"SimulcastStreamInfo"===e.constructor.name?e.clone():Jn.expand(e)};var Qn=Jn;const qn=Qn,er=Xn;let tr=class ri{constructor(){this.send=[],this.recv=[]}clone(){const e=new ri;for(const t of this.send)e.addSimulcastAlternativeStreams(er.SEND,t.map(e=>e.clone()));for(const t of this.recv)e.addSimulcastAlternativeStreams(er.RECV,t.map(e=>e.clone()));return e}plain(){const e={send:[],recv:[]};for(const t of this.send)e.send.push(t.map(e=>e.plain()));for(const t of this.recv)e.recv.push(t.map(e=>e.plain()));return e}addSimulcastAlternativeStreams(e,t){return e===er.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===er.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===er.SEND?this.send:this.recv}};tr.expand=function(e){if("SimulcastInfo"===e.constructor.name)return e;const t=new tr;for(const n of e.send||[])t.addSimulcastAlternativeStreams(er.SEND,n.map(qn.expand));for(const n of e.recv||[])t.addSimulcastAlternativeStreams(er.RECV,n.map(qn.expand));return t},tr.clone=function(e){return"SimulcastInfo"===e.constructor.name?e.clone():tr.expand(e)};var nr=tr;const rr=yn("SENDRECV","SENDONLY","RECVONLY","INACTIVE");rr.byValue=function(e){return rr[e.toUpperCase()]},rr.toString=function(e){switch(e){case rr.SENDRECV:return"sendrecv";case rr.SENDONLY:return"sendonly";case rr.RECVONLY:return"recvonly";case rr.INACTIVE:return"inactive"}},rr.reverse=function(e){switch(e){case rr.SENDRECV:return rr.SENDRECV;case rr.SENDONLY:return rr.RECVONLY;case rr.RECVONLY:return rr.SENDONLY;case rr.INACTIVE:return rr.INACTIVE}};var sr=rr;let ir=class ni{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new ni(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}};ir.expand=function(e){return"DataChannelInfo"===e.constructor.name?e:new ir(e.port,e.maxMessageSize)},ir.clone=function(e){return"DataChannelInfo"===e.constructor.name?e.clone():ir.expand(e)};var or=ir;const ar=gn,cr=Hn,ur=nr,dr=sr,pr=Xn,fr=or;let hr=class Wr{constructor(e,t){this.id=e,this.type=t,this.direction=dr.SENDRECV,this.extensions=new Map,this.codecs=new Map,this.rids=new Map,this.simulcast=null,this.bitrate=0,this.control=null,this.dataChannel=null}clone(){const e=new Wr(this.id,this.type);e.setDirection(this.direction),e.setBitrate(this.bitrate);for(const t of this.codecs.values())e.addCodec(t.clone());for(const[t,n]of this.extensions.entries())e.addExtension(t,n);for(const t of this.rids.values())e.addRID(t.clone());return this.simulcast&&e.setSimulcast(this.simulcast.clone()),this.control&&e.setControl(this.control),this.dataChannel&&e.setDataChannel(this.dataChannel.clone()),e}plain(){const e={id:this.id,type:this.type,direction:dr.toString(this.direction),codecs:[]};this.dataChannel&&(e.dataChannel=this.dataChannel.plain()),this.bitrate&&(e.bitrate=this.bitrate);for(const t of this.codecs.values())e.codecs.push(t.plain());for(const[t,n]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=n;for(const t of this.rids.values())e.rids||(e.rids=[]),e.rids.push(t.plain());return this.simulcast&&(e.simulcast=this.simulcast.plain()),this.control&&(e.control=this.control),e}getType(){return this.type}getId(){return this.id}setId(e){this.id=e}addExtension(e,t){this.extensions.set(e,t)}addRID(e){this.rids.set(e.getId(),e)}addCodec(e){this.codecs.set(e.getType(),e)}setCodecs(e){this.codecs=e}getCodecForType(e){return this.codecs.get(e)}getCodec(e){for(const t of this.codecs.values())if(t.getCodec().toLowerCase()===e.toLowerCase())return t;return null}hasCodec(e){return null!==this.getCodec(e)}getCodecs(){return this.codecs}hasRTX(){for(const e of this.codecs.values())if(e.hasRTX())return!0;return!1}getExtensions(){return this.extensions}getRIDs(){return this.rids}getRID(e){return this.rids.get(e)}getBitrate(){return this.bitrate}setBitrate(e){this.bitrate=e}getDirection(){return this.direction}setDirection(e){this.direction=e}hasControl(){return!!this.control}getControl(){return this.control}setControl(e){this.control=e}hasDataChannel(){return!!this.dataChannel}getDataChannel(){return this.dataChannel}setDataChannel(e){this.dataChannel=e}answer(e){const t=new Wr(this.id,this.type);if(e){t.setDirection(dr.reverse(this.direction));const{codecs:n,dataChannel:r}=e;if(n){let r;r=Array.isArray(n)?ar.MapFromNames(n,e.rtx,e.rtcpfbs):n;for(let e of this.codecs.values())for(let n of r.values()){if(n.getCodec().toLowerCase()!==e.getCodec().toLowerCase()||"h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0")||"h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id")||"multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const r=n.clone();r.setType(e.getType()),r.hasRTX()&&r.setRTX(e.getRTX()),e.hasChannels()&&r.setChannels(e.getChannels()),r.addParams(e.getParams()),t.addCodec(r);break}}const s=new Set(e.extensions);for(let[e,n]of this.extensions)s.has(n)&&t.addExtension(e,n);if(e.simulcast&&this.simulcast){const e=new ur,n=this.simulcast.getSimulcastStreams(pr.SEND);if(n)for(const t of n){const n=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(pr.RECV,n)}const r=this.simulcast.getSimulcastStreams(pr.RECV);if(r)for(const t of r){const n=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(pr.SEND,n)}for(const e of this.rids.values()){const n=e.clone();n.setDirection(pr.reverse(e.getDirection())),t.addRID(n)}t.setSimulcast(e)}if(r&&this.dataChannel){const e=new fr(this.dataChannel.getPort(),r.maxMessageSize?r.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(e)}}else t.setDirection(dr.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}};function gr(e){const t=e.toString();if(!/^\d+$/.test(t))throw new Error("invalid integer ".concat(t));return parseInt(t)}hr.create=function(e,t,n){!n&&"string"!=typeof t&&(n=t,t=e);const r=new hr(e,t);if(n){const{codecs:e}=n;e&&(Array.isArray(e)?r.setCodecs(ar.MapFromNames(e,n.rtx,n.rtcpfbs)):r.setCodecs(e))}else r.setDirection(dr.INACTIVE);return r},hr.expand=function(e){if("MediaInfo"===e.constructor.name)return e;const t=new hr(e.id,e.type);if(e.direction&&t.setDirection(dr.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const n=fr.expand(e.dataChannel);n&&t.setDataChannel(n)}for(const[n,r]of Object.entries(e.extensions))t.addExtension(gr(n),r);for(const n of e.codecs){const e=ar.expand(n);e&&t.addCodec(e)}for(const n of e.rids||[]){const e=cr.expand(n);t.addRID(e)}return e.simulcast&&t.setSimulcast(ur.expand(e.simulcast)),e.control&&t.setControl(e.control),t},hr.clone=function(e){return"MediaInfo"===e.constructor.name?e.clone():hr.expand(e)};var vr=hr;let br=class ai{constructor(e,t){this.semantics=e,this.ssrcs=[];for(let e=0;e<t.length;++e)this.ssrcs.push(parseInt(t[e]))}clone(){return new ai(this.semantics,this.ssrcs)}plain(){const e={semantics:this.semantics,ssrcs:[]};for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);return e}getSemantics(){return this.semantics}getSSRCs(){return this.ssrcs}};br.expand=function(e){return"SourceGroupInfo"===e.constructor.name?e:new br(e.semantics,e.ssrcs)},br.clone=function(e){return"SourceGroupInfo"===e.constructor.name?e.clone():br.expand(e)};var wr=br;let Sr=class ci{constructor(e){this.ssrc=e}clone(){const e=new ci(this.ssrc);return e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId),e}plain(){const e={ssrc:this.ssrc};return this.cname&&(e.cname=this.cname),this.streamId&&(e.streamId=this.streamId),this.trackId&&(e.trackId=this.trackId),e}getCName(){return this.cname}setCName(e){this.cname=e}getStreamId(){return this.streamId}setStreamId(e){this.streamId=e}getTrackId(){return this.trackId}setTrackId(e){this.trackId=e}getSSRC(){return this.ssrc}};Sr.expand=function(e){if("SourceInfo"===e.constructor.name)return e;const t=new Sr(e.ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t},Sr.clone=function(e){return"SourceInfo"===e.constructor.name?e.clone():Sr.expand(e)};var _r=Sr;const Rr=gn;let Er=class ui{constructor(e,t=!1){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ui(this.id,this.paused);for(let t of this.codecs.values())e.addCodec(t.clone());return e.setParams(this.params),e}plain(){var e={id:this.id,paused:this.paused,codecs:{},params:{}};for(var[t,n]of this.codecs.entries())e.codecs[t]=n.plain();for(var[t,r]of this.params.entries())e.params[t]=r;return e}getId(){return this.id}getCodecs(){return this.codecs}addCodec(e){this.codecs.set(e.getType(),e)}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}isPaused(){return this.paused}};Er.expand=function(e){if("TrackEncodingInfo"===e.constructor.name)return e;const t=new Er(e.id,e.paused);for(const n of Object.values(e.codecs||{}))t.addCodec(Rr.expand(n));for(const[n,r]of Object.entries(e.params||{}))t.addParam(n,r);return t},Er.clone=function(e){return"TrackEncodingInfo"===e.constructor.name?e.clone():Er.expand(e)};var kr=Er;const Ir=wr,Cr=kr;let xr=class di{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new di(this.media,this.id);this.mediaId&&e.setMediaId(this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.addSSRC(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.addSourceGroup(this.groups[t].clone());for(let t=0;t<this.encodings.length;++t){const n=[];for(let e=0;e<this.encodings[t].length;++e)n.push(this.encodings[t][e].clone());e.addAlternativeEncodings(n)}return e}plain(){const e={media:this.media,id:this.id,ssrcs:[]};this.mediaId&&(e.mediaId=this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.groups||(e.groups=[]),e.groups.push(this.groups[t].plain());for(let t=0;t<this.encodings.length;++t){const n=[];for(let e=0;e<this.encodings[t].length;++e)n.push(this.encodings[t][e].plain());n.length&&(e.encodings||(e.encodings=[]),e.encodings.push(n))}return e}getMedia(){return this.media}setMediaId(e){this.mediaId=e}getMediaId(){return this.mediaId}getId(){return this.id}addSSRC(e){this.ssrcs.push(e)}getSSRCs(){return this.ssrcs}addSourceGroup(e){this.groups.push(e)}getSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return t;return null}getSourceGroups(){return this.groups}getSourceGroupsForMediaSSRC(e){return this.groups.filter(t=>t.getSSRCs()[0]===e)}hasSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return!0;return!1}getEncodings(){return this.encodings}addEncoding(e){this.encodings.push([e])}addAlternativeEncodings(e){this.encodings.push(e)}setEncodings(e){this.encodings=e}getEncodingSources(){const e=[];if(this.encodings.length)for(const t of this.encodings)for(const n of t){const t={id:n.getId(),rid:n.getId()},r=n.getParams(),s=null==r?void 0:r.get("ssrc");if(void 0!==s){t.media=parseInt(s);for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}else if(this.hasSourceGroup("SIM")){const t=this.getSourceGroup("SIM").getSSRCs();this.getSourceGroups();for(const n of t){const t={id:String(n),media:n};for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}e.push(t)}}else{const t={id:""};if(this.ssrcs.length){t.media=this.ssrcs[0];for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}return e}};xr.expand=function(e){var t,n;if("TrackInfo"===e.constructor.name)return e;const r=new xr(e.media,e.id);if(e.mediaId&&r.setMediaId(e.mediaId),Array.isArray(e.ssrcs))for(const t of e.ssrcs)r.addSSRC(t);else if(void 0!==(null===(t=e.ssrcs)||void 0===t?void 0:t.media)){const t=e.ssrcs.media;if(r.addSSRC(t),void 0!==e.ssrcs.rtx){const n=e.ssrcs.rtx;r.addSSRC(n),r.addSourceGroup(new Ir("FID",[t,n]))}if(void 0!==e.ssrcs.fec){const n=e.ssrcs.fec;r.addSSRC(n),r.addSourceGroup(new Ir("FEC-FR",[t,n]))}}if(e.rid){const t=new Cr(e.rid);void 0!==(null===(n=e.ssrcs)||void 0===n?void 0:n.media)&&t.addParam("ssrc",e.ssrcs.media),r.addAlternativeEncodings([t])}for(const t of e.groups||[])r.addSourceGroup(Ir.expand(t));for(const t of e.encodings||[]){const e=[];for(const n of t)e.push(Cr.expand(n));r.addAlternativeEncodings(e)}return r},xr.clone=function(e){return"TrackInfo"===e.constructor.name?e.clone():xr.expand(e)};var Tr=xr;const Ar=Tr;let Lr=class fi{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new fi(this.id);for(const t of this.tracks.values())e.addTrack(t.clone());return e}plain(){const e={id:this.id,tracks:[]};for(const t of this.tracks.values())e.tracks.push(t.plain());return e}getId(){return this.id}addTrack(e){this.tracks.set(e.getId(),e)}removeTrack(e){return this.tracks.delete(e.getId())}removeTrackById(e){return this.tracks.delete(e)}getFirstTrack(e){for(let t of this.tracks.values())if(t.getMedia().toLowerCase()===e.toLowerCase())return t;return null}getTracks(){return this.tracks}removeAllTracks(){this.tracks.clear()}getTrack(e){return this.tracks.get(e)}};Lr.expand=function(e){if("StreamInfo"===e.constructor.name)return e;const t=new Lr(e.id);for(const n of e.tracks||[]){const e=Ar.expand(n);e&&t.addTrack(e)}return t},Lr.clone=function(e){return"StreamInfo"===e.constructor.name?e.clone():Lr.expand(e)};var Pr=Lr;const Or=Ht,Nr=function(e){const t=new Intl.Collator(e,{sensitivity:"base"});return(e,n)=>0==t.compare(e,n)}("en-US"),Mr=dn,Dr=gn,Fr=fn,Ur=Rn,jr=kn,Vr=Yn,Zr=vr,Gr=bn,Br=sr,Yr=Xn,zr=wr,Xr=_r,Kr=Pr,$r=Tr,Hr=kr,Jr=nr,Qr=Qn,qr=Hn,es=or;let ts=class lr{constructor(e){this.version=e||1,this.streams=new Map,this.medias=new Array,this.candidates=new Array,this.ice=null,this.dtls=null,this.crypto=null,this.extmapAllowMixed=!0}clone(){const e=new lr(this.version);for(const t of this.medias)e.addMedia(t.clone());for(const t of this.streams.values())e.addStream(t.clone());for(const t of this.candidates)e.addCandidate(t.clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExtmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(const t of this.medias)e.medias.push(t.plain());for(const t of this.streams.values())e.streams.push(t.plain());for(const t of this.candidates)e.candidates.push(t.plain());return this.ice&&(e.ice=this.ice.plain()),this.dtls&&(e.dtls=this.dtls.plain()),this.crypto&&(e.crypto=this.crypto.plain()),this.extmapAllowMixed||(e.extmapAllowMixedNotSupported=!this.extmapAllowMixed),e}unify(){const e=new lr(this.version);for(const t of this.medias)e.addMedia(t.clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const n of this.streams.values()){const r=n.clone();for(const n of r.getTracks().values()){let r=t[n.getMedia()].pop();r||(r=this.getMedia(n.getMedia()).clone(),r.setId(n.getId()),e.addMedia(r)),n.setMediaId(r.getId())}e.addStream(r)}for(const t of this.candidates)e.addCandidate(t.clone());return this.ice&&e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e}setVersion(e){this.version=e}addMedia(e){this.medias.push(e)}getMedia(e){for(let t in this.medias){let n=this.medias[t];if(Nr(n.getType(),e))return n}return null}getMediasByType(e){let t=[];for(let n in this.medias){let r=this.medias[n];Nr(r.getType(),e)&&t.push(r)}return t}getMediaById(e){for(const t of this.medias)if(Nr(t.getId(),e))return t;return null}replaceMedia(e){for(let t in this.medias)if(this.medias[t].getId()==e.getId())return this.medias[t]=e,!0;return!1}getMedias(){return this.medias}getVersion(){return this.version}getDTLS(){return this.dtls}setDTLS(e){this.dtls=e}hasCrypto(){return!!this.crypto}getCrypto(){return this.crypto}setCrypto(e){this.crypto=e}hasICE(){return!!this.ice}getICE(){return this.ice}setICE(e){this.ice=e}addCandidate(e){for(const t of this.candidates)if(t.equals(e))return;this.candidates.push(e)}addCandidates(e){for(const t of e)this.addCandidate(t)}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(const e of this.streams.values())return e;return null}addStream(e){this.streams.set(e.getId(),e)}removeStream(e){return this.streams.delete(e.getId())}removeAllStreams(){this.streams.clear()}getTracksByMediaType(e){let t=[];for(const n of this.streams.values())for(const[r,s]of n.getTracks())Nr(s.getMedia(),e)&&t.push(s);return t}getTrackByMediaId(e){for(const t of this.streams.values())for(const[n,r]of t.getTracks())if(r.getMediaId()==e)return r;return null}getStreamByMediaId(e){for(const t of this.streams.values())for(const[n,r]of t.getTracks())if(r.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new lr;e.ice&&(e.ice instanceof Vr?t.setICE(e.ice.clone()):t.setICE(Vr.expand(e.ice))),e.dtls&&(e.dtls instanceof Ur?t.setDTLS(e.dtls):t.setDTLS(Ur.expand(e.dtls))),e.crypto&&(e.crypto instanceof jr?t.setCrypto(e.crypto):t.setCrypto(jr.expand(e.crypto)));for(let n=0;e.candidates&&n<e.candidates.length;++n)e.candidates[n]instanceof Mr?t.addCandidate(e.candidates[n].clone()):t.addCandidate(Mr.expand(e.candidates[n]));for(const n of this.medias){const r=e&&e.capabilities&&e.capabilities[n.getType()];t.addMedia(n.answer(r))}return t.setExtmapAllowMixed(this.extmapAllowMixed),t}toString(){let e={version:0,media:[]};e.version=0,e.origin={username:"-",sessionId:(new Date).getTime(),sessionVersion:this.version,netType:"IN",ipVer:4,address:"127.0.0.1"},e.name="semantic-sdp",e.connection={version:4,ip:"0.0.0.0"},e.timing={start:0,stop:0},this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),e.msidSemantic={semantic:"WMS",token:"*"},e.groups=[],this.extmapAllowMixed&&(e.extmapAllowMixed="extmap-allow-mixed");const t=[];for(const n of this.medias){let r={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};r.direction=Br.toString(n.getDirection()),this.extmapAllowMixed&&(r.extmapAllowMixed="extmap-allow-mixed"),r.mid=n.getId(),t.push(n.getId()),n.hasControl()&&(r.control=n.getControl()),n.getBitrate()>0&&(r.bandwidth.push({type:"AS",limit:n.getBitrate()}),r.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let s=this.getCandidates();for(const e of s)r.candidates.push({foundation:e.getFoundation(),component:e.getComponentId(),transport:e.getTransport(),priority:e.getPriority(),ip:e.getAddress(),port:e.getPort(),type:e.getType(),raddr:e.getRelAddr(),rport:e.getRelPort()});if(this.getICE()&&(r.iceUfrag=this.getICE().getUfrag(),r.icePwd=this.getICE().getPwd()),Nr("audio",n.getType())||Nr("video",n.getType())){r.rtcpMux="rtcp-mux",r.rtcpRsize="rtcp-rsize",this.getDTLS()?(r.protocol="UDP/TLS/RTP/SAVPF",r.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},r.setup=Gr.toString(this.getDTLS().getSetup())):this.getCrypto()?(r.protocol="RTP/SAVPF",r.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):r.protocol="RTP/AVP";for(const e of n.getCodecs().values()){Nr("video",n.getType())?r.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):Nr("opus",e.getCodec())||Nr("multiopus",e.getCodec())?r.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):r.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())r.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(r.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),r.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const n={payload:e.getType(),config:""};for(const e in t)n.config.length&&(n.config+=";"),Object.hasOwnProperty.call(t,e)?n.config+=e+"="+t[e]:n.config+=e;r.fmtp.push(n)}}const e=[];for(const t of r.rtp)e.push(t.payload);r.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())r.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:Yr.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[n,r]of e.getParams().entries())t.params+=(t.params.length?";":"")+n+"="+r;r.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;r.simulcast={};const n=t.getSimulcastStreams(Yr.SEND),s=t.getSimulcastStreams(Yr.RECV);if(n&&n.length){let t="";for(const e of n){let n="";for(const t of e)n+=(n.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+n}r.simulcast["dir"+e]="send",r.simulcast["list"+e]=t,e++}if(s&&s.length){let t="";for(const e of s){let n="";for(const t of e)n+=(n.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+n}r.simulcast["dir"+e]="recv",r.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){r.protocol="UDP/DTLS/SCTP",r.payloads="webrtc-datachannel";const e=n.getDataChannel();r.sctpPort=e.getPort(),r.maxMessageSize=e.getMaxMessageSize()}e.media.push(r)}for(let t of this.streams.values())for(let n of t.getTracks().values())for(let r in e.media){let s=e.media[r];if(n.getMediaId()){if(n.getMediaId()==s.mid){let e=n.getSourceGroups();for(let t in e){let n=e[t];s.ssrcGroups.push({semantics:n.getSemantics(),ssrcs:n.getSSRCs().join(" ")})}let r=n.getSSRCs();for(let e in r)s.ssrcs.push({id:r[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:r[e],attribute:"msid",value:t.getId()+" "+n.getId()});s.msid=t.getId()+" "+n.getId();break}}else if(Nr(s.type,n.getMedia())){let e=n.getSourceGroups();for(let t in e){let n=e[t];s.ssrcGroups.push({semantics:n.getSemantics(),ssrcs:n.getSSRCs().join(" ")})}let r=n.getSSRCs();for(let e in r)s.ssrcs.push({id:r[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:r[e],attribute:"msid",value:t.getId()+" "+n.getId()});break}}const n={type:"BUNDLE",mids:t.join(" ")};return e.groups.push(n),Or.write(e)}toIceFragmentString(){let e={version:0,media:[],candidates:[]};this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),this.getICE()&&(e.iceUfrag=this.getICE().getUfrag(),e.icePwd=this.getICE().getPwd());for(const t of this.getCandidates())e.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()});return Or.write(e).slice(10)}};ts.create=function(e){var t;const n=new ts;if(e.streams)for(const t of e.streams)n.addStream(Kr.expand(t));e.ice&&(e.ice instanceof Vr?n.setICE(e.ice.clone()):n.setICE(Vr.expand(e.ice))),e.dtls&&(e.dtls instanceof Ur?n.setDTLS(e.dtls):n.setDTLS(Ur.expand(e.dtls))),e.crypto&&(e.crypto instanceof jr?n.setCrypto(e.crypto):n.setCrypto(jr.expand(e.crypto)));for(const t of e.candidates||[])t instanceof Mr?n.addCandidate(t.clone()):n.addCandidate(Mr.expand(t));let r=96,s=1,i=0;for(const[o,a]of Object.entries(e.capabilities||{}))if(e.unified&&null!==(t=e.streams)&&void 0!==t&&t.length)for(const e of n.getTracksByMediaType(o)){const t=Zr.create(e.getMediaId(),o,a);for(const[e,n]of t.getCodecs())n.getType()>=96&&n.setType(r++),n.getRTX()&&n.setRTX(r++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);n.addMedia(t)}else{const t=Zr.create(e.unified?String(i++):o,o,a);for(const[e,n]of t.getCodecs())n.getType()>=96&&n.setType(r++),n.getRTX()&&n.setRTX(r++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);n.addMedia(t)}return n},ts.expand=function(e){if("SDPInfo"===e.constructor.name)return e;const t=new ts(e.version);for(const n of e.medias||[]){const e=Zr.expand(n);e&&t.addMedia(e)}for(const n of e.streams||[]){const e=Kr.expand(n);e&&t.addStream(e)}for(const n of e.candidates||[]){const e=Mr.expand(n);e&&t.addCandidate(e)}return e.ice&&t.setICE(Vr.expand(e.ice)),e.dtls&&t.setDTLS(Ur.expand(e.dtls)),e.crypto&&t.setCrypto(jr.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},ts.clone=function(e){return"SDPInfo"===e.constructor.name?e.clone():ts.expand(e)},ts.process=function(e){return ts.parse(e)},ts.parse=function(e){const t=Or.parse(e),n=new ts;if(n.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),r=String(t.icePwd),s=new Vr(e,r);s.setLite("ice-lite"==t.icelite),s.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),n.setICE(s)}for(let e in t.media){const r=t.media[e],s=r.type,i=r.mid?r.mid.toString():e,o=new Zr(i,s);if(r.iceUfrag&&r.icePwd){const e=String(r.iceUfrag),s=String(r.icePwd),i=new Vr(e,s);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==r.endOfCandidates),n.setICE(i)}for(let e=0;r.candidates&&e<r.candidates.length;++e){const t=r.candidates[e],s=new Mr(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);n.addCandidate(s)}const a=r.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let s=Gr.ACTPASS;r.setup&&(s=Gr.byValue(r.setup)),n.setDTLS(new Ur(s,e,t))}if(r.crypto){const e=r.crypto[0];n.setCrypto(new jr(e.id,e.suite,e.config,e.sessionConfig))}let c=Br.SENDRECV;r.direction&&(c=Br.byValue(r.direction),o.setDirection(c)),r.control&&o.setControl(r.control),n.setExtmapAllowMixed("extmap-allow-mixed"==r.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const l=new Map;for(let e in r.rtp){const t=r.rtp[e],n=t.payload,s=t.codec;if("RED"===s.toUpperCase()||"ULPFEC"===s.toUpperCase())continue;let i={};for(let e in r.fmtp){const t=r.fmtp[e];if(t.payload===n){const e=t.config.split(";");for(let t in e){const n=e[t].split("="),r=n[0].trim(),s=n.splice(1).join("=").trim();i[r]=s}}}if("RTX"===s.toUpperCase())l.set(parseInt(i.apt),n);else{const e=new Dr(s,n,i);t.encoding>1&&e.setChannels(t.encoding),o.addCodec(e)}}for(let e of l.entries()){const t=o.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;r.rtcpFb&&e<r.rtcpFb.length;++e){const t=o.getCodecForType(r.rtcpFb[e].payload);if(t){const n=r.rtcpFb[e].type,s=r.rtcpFb[e].subtype?r.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new Fr(n,s))}}const u=r.ext;for(let e in u){const t=u[e];o.addExtension(t.value,t.uri)}const d=r.rids;for(let e in d){const t=d[e],n=new qr(t.id,Yr.byValue(t.direction));let r=[];const s=new Map;if(t.params){const e=Or.parseParams(t.params);for(let t in e)"pt"===t?r=e[t].split(","):s.set(t,e[t]);n.setFormats(r),n.setParams(s)}o.addRID(n)}const p=[];if(r.simulcast){const e=new Jr;if(r.simulcast.dir1){const t=Yr.byValue(r.simulcast.dir1),n=Or.parseSimulcastStreamList(r.simulcast.list1);for(let r=0;r<n.length;++r){const s=[];for(let e=0;e<n[r].length;++e)s.push(new Qr(n[r][e].scid,n[r][e].paused));e.addSimulcastAlternativeStreams(t,s)}}if(r.simulcast.dir2){const t=Yr.byValue(r.simulcast.dir2),n=Or.parseSimulcastStreamList(r.simulcast.list2);for(let r=0;r<n.length;++r){const s=[];for(let e=0;e<n[r].length;++e)s.push(new Qr(n[r][e].scid,n[r][e].paused));e.addSimulcastAlternativeStreams(t,s)}}for(let t of e.getSimulcastStreams(Yr.SEND)){const e=[];for(let n=0;n<t.length;n++){const r=new Hr(t[n].getId(),t[n].isPaused()),s=o.getRID(r.getId());if(s){const t=s.getFormats();for(let e=0;t&&e<t.length;++e){const n=o.getCodecForType(t[e]);n&&r.addCodec(n)}r.setParams(s.getParams()),e.push(r)}}e.length&&p.push(e)}o.setSimulcast(e)}const f=new Map;if(r.ssrcs)for(let e in r.ssrcs){let t=r.ssrcs[e],o=t.id,a=t.attribute,c=t.value,l=f.get(o);if(l||(l=new Xr(o),f.set(l.getSSRC(),l)),Nr("cname",a))l.setCName(c);else if(Nr("msid",a)){let e=c.split(" "),t=e[0],r=e[1];l.setStreamId(t),l.setTrackId(r);let a=n.getStream(t);a||(a=new Kr(t),n.addStream(a));let u=a.getTrack(r);u||(u=new $r(s,r),u.setMediaId(i),u.setEncodings(p),a.addTrack(u)),u.addSSRC(o)}}if(r.msid){let e=r.msid.split(" "),t=e[0],o=e[1],a=n.getStream(t);a||(a=new Kr(t),n.addStream(a));let c=a.getTrack(o);c||(c=new $r(s,o),c.setMediaId(i),c.setEncodings(p),a.addTrack(c));for(let[e,n]of f.entries())n.getStreamId()||(n.setStreamId(t),n.setTrackId(o),c.addSSRC(e))}for(let[e,t]of f.entries())if(!t.getStreamId()){let r=t.getCName(),o=i;t.setStreamId(r),t.setTrackId(o);let a=n.getStream(r);a||(a=new Kr(r),n.addStream(a));let c=a.getTrack(o);c||(c=new $r(s,o),c.setMediaId(i),c.setEncodings(p),a.addTrack(c)),c.addSSRC(e)}if(r.ssrcGroups)for(let e in r.ssrcGroups){let t=r.ssrcGroups[e],s=t.ssrcs.split(" "),i=new zr(t.semantics,s),o=f.get(parseInt(s[0]));o&&n.getStream(o.getStreamId()).getTrack(o.getTrackId()).addSourceGroup(i)}if("application"==r.type&&"webrtc-datachannel"==r.payloads){const e=new es(r.sctpPort,r.maxMessageSize);o.setDataChannel(e)}n.addMedia(o)}return n};var ns=ts;Object.defineProperty($t,"__esModule",{value:!0});var rs=$t.SDPInfo=ns;$t.CandidateInfo=dn,$t.CodecInfo=gn,$t.DTLSInfo=Rn,$t.CryptoInfo=kn,$t.ICEInfo=Yn;var ss=$t.MediaInfo=vr;$t.Setup=bn,$t.SourceGroupInfo=wr,$t.SourceInfo=_r,$t.StreamInfo=Pr,$t.TrackInfo=Tr,$t.RTCPFeedbackInfo=fn,$t.TrackEncodingInfo=kr,$t.RIDInfo=Hn,$t.SimulcastInfo=nr,$t.SimulcastStreamInfo=Qn,$t.DataChannelInfo=or;var is=$t.Direction=sr,os={exports:{}};!function(e,t){!function(n,r){var s="function",i="undefined",o="object",a="string",c="major",l="model",u="name",d="type",p="vendor",f="version",h="architecture",m="console",g="mobile",y="tablet",v="smarttv",w="wearable",_="embedded",R="Amazon",E="Apple",k="ASUS",I="BlackBerry",T="Browser",A="Chrome",L="Firefox",O="Google",N="Huawei",M="LG",D="Microsoft",U="Motorola",j="Opera",V="Samsung",W="Sharp",Z="Sony",G="Xiaomi",B="Zebra",Y="Facebook",z="Chromium OS",K="Mac OS",$=" Browser",H=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},J=function(e,t){return typeof e===a&&-1!==Q(t).indexOf(Q(e))},Q=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,500)},ee=function(e,t){for(var n,i,a,c,l,u,d=0;d<t.length&&!l;){var p=t[d],f=t[d+1];for(n=i=0;n<p.length&&!l&&p[n];)if(l=p[n++].exec(e))for(a=0;a<f.length;a++)u=l[++i],typeof(c=f[a])===o&&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}},te=function(e,t){for(var n in t)if(typeof t[n]===o&&t[n].length>0){for(var s=0;s<t[n].length;s++)if(J(t[n][s],e))return"?"===n?r:n}else if(J(t[n],e))return"?"===n?r:n;return t.hasOwnProperty("*")?t["*"]:e},ne={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"},re={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,j+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[u,j+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[u,j]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/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)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[u,"Smart Lenovo "+T]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+T],f],[/\bfocus\/([\w\.]+)/i],[f,[u,L+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[f,[u,L]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360"+$]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+$],f],[/samsungbrowser\/([\w\.]+)/i],[f,[u,V+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,Y],f],[/(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,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,A+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,A+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,te,{"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,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/(wolvic)\/([\w\.]+)/i],[u,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,L+" 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,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,Q]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",Q]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,Q]]],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,V],[d,y]],[/\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,V],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[p,E],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[p,E],[d,y]],[/(macintosh);/i],[l,[p,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[p,W],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[p,N],[d,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[p,N],[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,G],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[p,G],[d,y]],[/; (\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,y]],[/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,U],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[p,U],[d,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[p,M],[d,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[p,M],[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,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[p,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[p,O],[d,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[p,O],[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,Z],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[p,Z],[d,y]],[/ (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,R],[d,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[p,R],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,p,[d,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[p,I],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[p,k],[d,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[p,k],[d,g]],[/(nexus 9)/i],[l,[p,"HTC"],[d,y]],[/(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,y]],[/(itel) ((\w+))/i],[[p,Q],l,[d,te,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[p,"Acer"],[d,y]],[/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]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[p,"Nothing"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/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]],[/(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,y]],[/(surface duo)/i],[l,[p,D],[d,y]],[/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,y]],[/\b(venue[\d ]{2,7}) b/i],[l,[p,"Dell"],[d,y]],[/\b(q(?:mv|ta)\w+) b/i],[l,[p,"Verizon"],[d,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[p,"Barnes & Noble"],[d,y]],[/\b(tm\d{3}\w+) b/i],[l,[p,"NuVision"],[d,y]],[/\b(k88) b/i],[l,[p,"ZTE"],[d,y]],[/\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,y]],[/\b((zeki)?tb.*\b) b/i],[l,[p,"Zeki"],[d,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],l,[d,y]],[/\b(ns-?\w{0,9}) b/i],[l,[p,"Insignia"],[d,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[p,"NextBook"],[d,y]],[/\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,y]],[/\b(trio[-\w\. ]+) b/i],[l,[p,"MachSpeed"],[d,y]],[/\btu_(1491) b/i],[l,[p,"Rotor"],[d,y]],[/(shield[\w ]+) b/i],[l,[p,"Nvidia"],[d,y]],[/(sprint) (\w+)/i],[p,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[p,D],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[p,B],[d,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[p,B],[d,g]],[/smart-tv.+(samsung)/i],[p,[d,v]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[p,V],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,M],[d,v]],[/(apple) ?tv/i],[p,[l,E+" TV"],[d,v]],[/crkey/i],[[l,A+"cast"],[p,O],[d,v]],[/droid.+aft(\w+)( bui|\))/i],[l,[p,R],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[p,W],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[l,[p,Z],[d,v]],[/(mitv-\w{5}) bui/i],[l,[p,G],[d,v]],[/Hbbtv.*(technisat) (.*);/i],[p,l,[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,q],[l,q],[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,l,[d,m]],[/droid.+; (shield) bui/i],[l,[p,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[l,[p,Z],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[p,D],[d,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[l,[p,V],[d,w]],[/((pebble))app/i],[p,l,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[p,E],[d,w]],[/droid.+; (glass) \d/i],[l,[p,O],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[p,B],[d,w]],[/(quest( \d| pro)?)/i],[l,[p,Y],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,_]],[/(aeobc)\b/i],[l,[p,R],[d,_]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[f,te,ne]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,te,ne],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,K],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,I]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,L+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[u,A+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,z],f],[/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,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,f]]},se=function(e,t){if(typeof e===o&&(t=e,e=r),!(this instanceof se))return new se(e,t).getResult();var m=typeof n!==i&&n.navigator?n.navigator:r,v=e||(m&&m.userAgent?m.userAgent:""),w=m&&m.userAgentData?m.userAgentData:r,_=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(re,t):re,R=m&&m.userAgent==v;return this.getBrowser=function(){var e={};return e[u]=r,e[f]=r,ee.call(e,v,_.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:r}(e[f]),R&&m&&m.brave&&typeof m.brave.isBrave==s&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[h]=r,ee.call(e,v,_.cpu),e},this.getDevice=function(){var e={};return e[p]=r,e[l]=r,e[d]=r,ee.call(e,v,_.device),R&&!e[d]&&w&&w.mobile&&(e[d]=g),R&&"Macintosh"==e[l]&&m&&typeof m.standalone!==i&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[l]="iPad",e[d]=y),e},this.getEngine=function(){var e={};return e[u]=r,e[f]=r,ee.call(e,v,_.engine),e},this.getOS=function(){var e={};return e[u]=r,e[f]=r,ee.call(e,v,_.os),R&&!e[u]&&w&&w.platform&&"Unknown"!=w.platform&&(e[u]=w.platform.replace(/chrome os/i,z).replace(/macos/i,K)),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 v},this.setUA=function(e){return v=typeof e===a&&e.length>500?q(e,500):e,this},this.setUA(v),this};se.VERSION="0.7.39",se.BROWSER=H([u,f,c]),se.CPU=H([h]),se.DEVICE=H([l,p,d,m,g,v,y,w,_]),se.ENGINE=se.OS=H([u,f]),e.exports&&(t=e.exports=se),t.UAParser=se;var ie=typeof n!==i&&(n.jQuery||n.Zepto);if(ie&&!ie.ua){var oe=new se;ie.ua=oe.getResult(),ie.ua.get=function(){return oe.getUA()},ie.ua.set=function(e){oe.setUA(e);var t=oe.getResult();for(var n in t)ie.ua[n]=t[n]}}}("object"==typeof window?window:Ue)}(os,os.exports);const as=je(os.exports),cs=["iOS"];class Yt extends as{constructor(){super(window.navigator.userAgent)}isChromium(){return this.getUA().match(/Chrome/i)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let n=!0;return n=!new RegExp(cs.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&n}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const ls=St.get("SdpParser"),us=Array.from({length:31},(e,t)=>t+35),ds=Array.from({length:32},(e,t)=>t+96),fs=Array.from({length:14},(e,t)=>t+1),hs=Array.from({length:240},(e,t)=>t+16),ms={setSimulcast(e,t){if(ls.info("Setting simulcast. Codec: ",t),!(new Yt).isChromium())return ls.warn("Your browser does not appear to support Simulcast. For a better experience, use a Chromium based browser."),e;if("h264"!==t&&"vp8"!==t)return ls.warn("Your selected codec ".concat(t," does not appear to support Simulcast. To broadcast using simulcast, please use H.264 or VP8.")),e;if(!/m=video/.test(e))return ls.warn("There is no available video for simulcast to be enabled."),e;try{const t=new RegExp("m=video.*?a=ssrc:(\\d*) cname:(.+?)\\r\\n","s"),n=new RegExp("m=video.*?a=ssrc:(\\d*) msid:(.+?)\\r\\n","s"),r=t.exec(e),s=r[1],i=r[2],o=n.exec(e)[2],a=2,c=[s];for(let t=0;t<a;++t){const n=100+2*t,r=n+1;c.push(n),e+="a=ssrc-group:FID "+n+" "+r+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+c.join(" ")+"\r\n",ls.info("Simulcast setted"),ls.debug("Simulcast SDP: ",e),e}catch(e){throw ls.error("Error setting SDP for simulcast: ",e),e}},setStereo:e=>(ls.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),ls.info("Replaced SDP response for support stereo"),ls.debug("New SDP value: ",e),e),setDTX:e=>(ls.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),ls.info("Replaced SDP response for support dtx"),ls.debug("New SDP value: ",e),e),setAbsoluteCaptureTime(e){const t="a=extmap:"+ms.getAvailableHeaderExtensionIdRange(e)[0]+" http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,n,r)=>n+t+r),ls.info("Replaced SDP response for setting absolute capture time"),ls.debug("New SDP value: ",e),e},setDependencyDescriptor(e){const t="a=extmap:"+ms.getAvailableHeaderExtensionIdRange(e)[0]+" https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,n,r)=>n+t+r),ls.info("Replaced SDP response for setting depency descriptor"),ls.debug("New SDP value: ",e),e},setVideoBitrate(e,t){if(t<1)ls.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const n=rs.parse(e),r=n.getMedia("video");ls.info("Setting video bitrate"),r.setBitrate(t),e=n.toString()}return e},removeSdpLine:(e,t)=>(ls.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),ls.debug("SDP trimmed result: ",e),e),adaptCodecName(e,t,n){if(!e)return e;const r=new RegExp("".concat(t),"i");return e.replace(r,n)},setMultiopus(e,t){if(!(new Yt).isFirefox()&&(!t||gs(t)))if(e.includes("multiopus/48000/6"))ls.info("Multiopus already setted");else{ls.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],n=ms.getAvailablePayloadTypeRange(e)[0],r=t.replace("\r\n"," ")+n+"\r\na=rtpmap:"+n+" multiopus/48000/6\r\na=fmtp:"+n+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,r),ls.info("Multiopus offer created"),ls.debug("SDP parsed for multioups: ",e)}return e},getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let n=ds.concat(us);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));n=n.filter(e=>!t.includes(e))}return n},getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let n=fs.concat(hs);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));n=n.filter(e=>!t.includes(e))}return n},renegotiate(e,t){const n=rs.parse(e),r=rs.parse(t);for(const e of n.getMedias()){let t=r.getMediaById(e.getId());if(!t){t=new ss(e.getId(),e.getType()),t.setDirection(is.reverse(e.getDirection()));const n=r.getMedia(e.getType());if(n){t.setCodecs(n.getCodecs());for(const[e,r]of n.getExtensions())t.addExtension(e,r)}r.addMedia(t)}}return r.toString()},updateMissingVideoExtensions(e,t){var n;const r=rs.parse(e),s=null==(n=rs.parse(t).getMediasByType("video")[0])?void 0:n.getExtensions();if(s||s.length){for(const t of r.getMediasByType("video")){const n=t.getExtensions();s.forEach((r,s)=>{if(!n.get(s)){const n=t.getId(),i="a=extmap:"+s+" "+r+"\r\n",o=new RegExp("(a=mid:"+n+"\r\n(?:.*\r\n)*?)","g");e=e.replace(o,(e,t,n)=>t+i)}})}return e}},getCodecPayloadType(e){const t=e.matchAll(/a=rtpmap:(\d+) (\w+)\/\d+/g),n={};for(const e of t)n[e[1]]=e[2];return n}},gs=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2),ys={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1",H265:"h265"},vs={OPUS:"opus",MULTIOPUS:"multiopus"},bs=St.get("PeerConnection"),ws="Viewer",Ss={track:"track",connectionStateChange:"connectionStateChange"},_s={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class tt extends jt{constructor(){super(),this.mode=null,this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null,this.transceiverMap=new Map}async createRTCPeer(e={autoInitStats:!0,statsIntervalMs:1e3},t=ws){bs.info("Creating new RTCPeerConnection"),bs.debug("RTC configuration provided by user: ",e),this.peer=ks(this,e),this.mode=t,e.autoInitStats&&this.initStats(e)}getRTCPeer(){return bs.info("Getting RTC Peer"),this.peer}async closeRTCPeer(){var e;bs.info("Closing RTCPeerConnection"),null==(e=this.peer)||e.close(),this.peer=null,this.stopStats(),this.emit(Ss.connectionStateChange,"closed")}async setRTCRemoteSDP(e){bs.info("Setting RTC Remote SDP");const t={type:"answer",sdp:e};try{await this.peer.setRemoteDescription(t),bs.info("RTC Remote SDP was set successfully."),bs.debug("RTC Remote SDP new value: ",e)}catch(e){throw bs.error("Error while setting RTC Remote SDP: ",e),e}}async getRTCLocalSDP(e=_s){bs.info("Getting RTC Local SDP"),e=Ne(Ne({},_s),e),bs.debug("Options: ",e);const t=Es(e.mediaStream);t?xs(this.peer,t,e):Ts(this.peer,e),bs.info("Creating peer offer");const n=await this.peer.createOffer();return bs.info("Peer offer created"),bs.debug("Peer offer response: ",n.sdp),this.sessionDescription=n,e.disableAudio||(e.stereo&&(this.sessionDescription.sdp=ms.setStereo(this.sessionDescription.sdp)),e.dtx&&(this.sessionDescription.sdp=ms.setDTX(this.sessionDescription.sdp)),this.sessionDescription.sdp=ms.setMultiopus(this.sessionDescription.sdp,t)),!e.disableVideo&&e.simulcast&&(this.sessionDescription.sdp=ms.setSimulcast(this.sessionDescription.sdp,e.codec)),e.absCaptureTime&&(this.sessionDescription.sdp=ms.setAbsoluteCaptureTime(this.sessionDescription.sdp)),e.dependencyDescriptor&&(this.sessionDescription.sdp=ms.setDependencyDescriptor(this.sessionDescription.sdp)),e.setSDPToPeer&&(await this.peer.setLocalDescription(this.sessionDescription),bs.info("Peer local description set")),this.sessionDescription.sdp}async addRemoteTrack(e,t){return new Promise((n,r)=>{try{const r=this.peer.addTransceiver(e,{direction:"recvonly",streams:t});this.transceiverMap.set(r,n)}catch(e){r(e)}})}updateBandwidthRestriction(e,t){if(this.mode===ws)throw bs.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");return bs.info("Updating bandwidth restriction, bitrate value: ",t),bs.debug("SDP value: ",e),ms.setVideoBitrate(e,t)}async updateBitrate(e=0){if(this.mode===ws)throw bs.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");if(!this.peer)throw bs.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");bs.info("Updating bitrate to value: ",e),this.sessionDescription=await this.peer.createOffer(),await this.peer.setLocalDescription(this.sessionDescription);const t=this.updateBandwidthRestriction(this.peer.remoteDescription.sdp,e);await this.setRTCRemoteSDP(t),bs.info("Bitrate restrictions updated: ","".concat(e>0?e:"unlimited"," kbps"))}getRTCPeerStatus(){if(bs.info("Getting RTC peer status"),!this.peer)return null;const e=As(this.peer);return bs.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void bs.error("Could not change track if there is not an active connection.");const t=this.peer.getSenders().find(t=>t.track.kind===e.kind);t?t.replaceTrack(e):bs.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Yt,n=RTCRtpSender.getCapabilities(e);if(n){const r={};let s=new RegExp("^video/(".concat(Object.values(ys).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(vs).join("|"),")$"),"i"),t.isChrome()&&(r.multiopus={mimeType:"audio/multiopus",channels:6}));for(const e of n.codecs){const t=e.mimeType.match(s);if(t){const n=t[1].toLowerCase();if(r[n]=Me(Ne({},r[n]),{mimeType:e.mimeType}),e.scalabilityModes){let t=r[n].scalabilityModes||[];t=[...t,...e.scalabilityModes],r[n].scalabilityModes=[...new Set(t)]}e.channels&&(r[n].channels=e.channels)}}n.codecs=Object.keys(r).map(e=>Ne({codec:e},r[e]))}return n}getTracks(){var e,t;return null==(t=null==(e=this.peer)?void 0:e.getSenders())?void 0:t.map(e=>e.track)}initStats(e){this.peerConnectionStats?bs.warn("PeerConnection.initStats() has already been called. Automatic initialization occurs via View.connect(), Publish.connect() or this.createRTCPeer(). See options"):this.peer?(this.peerConnectionStats=new Ji(this.peer,e),Gt(this.peerConnectionStats,this,[Kt])):bs.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null==(e=this.peerConnectionStats)||e.stop(),this.peerConnectionStats=null}}const Rs=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,Es=e=>{if(!e)return null;if(e instanceof MediaStream&&Rs(e))return e;if(!(e instanceof MediaStream)){bs.info("Creating MediaStream to add received tracks.");const t=new MediaStream;for(const n of e)t.addTrack(n);if(Rs(t))return t}throw bs.error("MediaStream must have 1 audio track and 1 video track, or at least one of them."),new Error("MediaStream must have 1 audio track and 1 video track, or at least one of them.")},ks=(e,t)=>{const n=new RTCPeerConnection(t);return Cs(e,n),n};async function Is(e){return new Promise(t=>setTimeout(t,e))}const Cs=(e,t)=>{t.ontrack=async t=>{bs.info("New track from peer."),bs.debug("Track event value: ",t);const n=e.transceiverMap.get(t.transceiver);if(n){for(;!t.transceiver.mid;)await Is(100);n(t.transceiver),e.transceiverMap.delete(t.transceiver)}setTimeout(()=>{e.emit(Ss.track,t)},0)},t.connectionState?t.onconnectionstatechange=n=>{bs.info("Peer connection state change: ",t.connectionState),e.emit(Ss.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=n=>{bs.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(Ss.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=async e=>{if(!t.remoteDescription)return;bs.info("Peer onnegotiationneeded, updating local description");const n=await t.createOffer();bs.info("Peer onnegotiationneeded, got local offer",n.sdp),n.sdp=ms.updateMissingVideoExtensions(n.sdp,t.remoteDescription.sdp),await t.setLocalDescription(n);const r=ms.renegotiate(n.sdp,t.remoteDescription.sdp);bs.info("Peer onnegotiationneeded, updating remote description",r),await t.setRemoteDescription({type:"answer",sdp:r}),bs.info("Peer onnegotiationneeded, renegotiation done")}},xs=(e,t,n)=>{bs.info("Adding mediaStream tracks to RTCPeerConnection");for(const r of t.getTracks()){const s={streams:[t]};"audio"===r.kind&&(s.direction=n.disableAudio?"inactive":"sendonly"),"video"===r.kind&&(s.direction=n.disableVideo?"inactive":"sendonly",n.scalabilityMode&&(new Yt).isChrome()?(bs.debug("Video track with scalability mode: ".concat(n.scalabilityMode,".")),s.sendEncodings=[{scalabilityMode:n.scalabilityMode}]):n.scalabilityMode&&bs.warn("SVC is only supported in Google Chrome")),e.addTransceiver(r,s),bs.info("Track '".concat(r.label,"' added: "),"id: ".concat(r.id),"kind: ".concat(r.kind))}},Ts=(e,t)=>{const n=new Yt;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});n.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let n=0;n<t.multiplexedAudioTracks;n++)e.addTransceiver("audio",{direction:"recvonly"})},As=e=>{var t;const n=null!=(t=e.connectionState)?t:e.iceConnectionState;switch(n){case"checking":return"connecting";case"completed":return"connected";default:return n}};var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.TypedEmitter=Ut.EventEmitter;const{TypedEmitter:Ps}=Ls;class ia extends Ps{constructor(e,t){super(),this.namespace=e,this.tm=t}cmd(e,t){return this.tm.cmd(e,t,this.namespace)}event(e,t){return this.tm.event(e,t,this.namespace)}close(){return this.tm.namespaces.delete(this.namespace)}}var Os=class oa extends Ps{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=e=>{let t;try{t=JSON.parse(e.utf8Data||e.data||e)}catch(e){return}switch(t.type){case"cmd":const{transId:e}=t,r={name:t.name,data:t.data,namespace:t.namespace,accept:t=>{this._send({type:"response",transId:e,data:t})},reject:t=>{this._send({type:"error",transId:e,data:t})}};if(r.namespace){const e=this.namespaces.get(r.namespace);e?e.emit("cmd",r):this.emit("cmd",r)}else this.emit("cmd",r);break;case"response":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.resolve(t.data);break}case"error":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.reject(t.data);break}case"event":const s={name:t.name,data:t.data,namespace:t.namespace};if(s.namespace){var n=this.namespaces.get(s.namespace);n?n.emit("event",s):this.emit("event",s)}else this.emit("event",s)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}_send(e){this.transport.send(JSON.stringify(e))}cmd(e,t,n=void 0){return new Promise((r,s)=>{if(!e||0===e.length)throw new Error("Bad command name");const i={type:"cmd",transId:this.maxId++,name:e,data:t};n&&(i.namespace=n),this.transactions.set(i.transId,Me(Ne({},i),{resolve:r,reject:s}));try{this._send(i)}catch(e){throw this.transactions.delete(i.transId),e}})}event(e,t,n=void 0){if(!e||0===e.length)throw new Error("Bad event name");const r={type:"event",name:e,data:t};n&&(r.namespace=n),this._send(r)}namespace(e){let t=this.namespaces.get(e);return t||(t=new ia(e,this),this.namespaces.set(e,t),t)}close(){for(const e of this.namespaces.values())e.close();this.transport.removeListener?this.transport.removeListener("message",this.listener):this.transport.removeEventListener("message",this.listener)}};const Ns=je(Os),Ms=St.get("Signaling"),Ds="wsConnectionSuccess",Fs="wsConnectionError",js="wsConnectionClose",Vs="broadcastEvent";class mi extends jt{constructor(e={streamName:null,url:"ws://localhost:8080/"}){super(),this.streamName=e.streamName,this.wsUrl=e.url,this.webSocket=null,this.transactionManager=null,this.serverId=null,this.clusterId=null,this.streamViewId=null}async connect(){var e;return Ms.info("Connecting to Signaling Server"),this.transactionManager&&(null==(e=this.webSocket)?void 0:e.readyState)===WebSocket.OPEN?(Ms.info("Connected to server: ",this.webSocket.url),Ms.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(Ds,{ws:this.webSocket,tm:this.transactionManager}),this.webSocket):new Promise((e,t)=>{this.webSocket=new WebSocket(this.wsUrl),this.transactionManager=new Ns(this.webSocket),this.webSocket.onopen=()=>{Ms.info("WebSocket opened"),this.transactionManager.on("event",e=>{this.emit(Vs,e)}),Ms.info("Connected to server: ",this.webSocket.url),Ms.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(Ds,{ws:this.webSocket,tm:this.transactionManager}),e(this.webSocket)},this.webSocket.onerror=()=>{Ms.error("WebSocket not connected: ",this.webSocket.url),this.emit(Fs,this.webSocket.url),t(this.webSocket.url)},this.webSocket.onclose=()=>{this.webSocket=null,this.transactionManager=null,Ms.info("Connection closed with Signaling Server."),this.emit(js)}})}close(){var e;Ms.info("Closing connection with Signaling Server."),null==(e=this.webSocket)||e.close()}async subscribe(e,t,n=null,r=null){var s,i,o,a;Ms.info("Starting subscription to streamName: ",this.streamName),Ms.debug("Subcription local description: ",e);const c=Ws(t,n,r),l={sdp:e=ms.adaptCodecName(e,"AV1X",ys.AV1),streamId:this.streamName,pinnedSourceId:c.pinnedSourceId,excludedSourceIds:c.excludedSourceIds,events:["active","inactive","layers","viewercount","vad","updated","migrate","stopped"]};c.vad&&(l.vad=!0),Array.isArray(c.events)&&(l.events=c.events),c.forcePlayoutDelay&&(l.forcePlayoutDelay=c.forcePlayoutDelay),c.layer&&(l.layer=c.layer);try{if(c.disableVideo&&c.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),Ms.info("Sending view command");const e=await this.transactionManager.cmd("view",l),t=null==(a=null==(o=null==(i=null==(s=RTCRtpReceiver.getCapabilities)?void 0:s.call(RTCRtpReceiver,"video"))?void 0:i.codecs)?void 0:o.find)?void 0:a.call(o,e=>"video/AV1X"===e.mimeType);return e.sdp=t?ms.adaptCodecName(e.sdp,ys.AV1,"AV1X"):e.sdp,Ms.info("Command sent, subscriberId: ",e.subscriberId),Ms.debug("Command result: ",e),this.serverId=e.subscriberId,this.clusterId=e.clusterId,this.streamViewId=e.streamViewId,nt(this.streamName),st(this.serverId),it(e.streamViewId),lt(this.clusterId),e.sdp}catch(e){throw Ms.error("Error sending view command, error: ",e),e}}async publish(e,t,n=null,r=null){var s,i,o,a,c,l,u,d;const p=Zs(t,n,r);Ms.info("Starting publishing to streamName: ".concat(this.streamName,", codec: ").concat(p.codec)),Ms.debug("Publishing local description: ",e);const f=null!=(a=null==(o=null==(i=null==(s=tt.getCapabilities)?void 0:s.call(tt,"video"))?void 0:i.codecs)?void 0:o.map(e=>e.codec))?a:[],h=Object.values(ys);if(-1===h.indexOf(p.codec))throw Ms.error("Invalid codec ".concat(p.codec,". Possible values are: "),h),new Error("Invalid codec ".concat(p.codec,". Possible values are: ").concat(h));if(f.length>0&&-1===f.indexOf(p.codec))throw Ms.error("Unsupported codec ".concat(p.codec,". Possible values are: "),f),new Error("Unsupported codec ".concat(p.codec,". Possible values are: ").concat(f));p.codec===ys.AV1&&(e=ms.adaptCodecName(e,"AV1X",ys.AV1));const m={name:this.streamName,sdp:e,codec:p.codec,sourceId:p.sourceId};if(p.priority){if(!(Number.isInteger(p.priority)&&p.priority>=-2147483648&&p.priority<=2147483647))throw new Error("Invalid value for priority option. It should be a decimal integer between the range [-2^31, +2^31 - 1]");m.priority=p.priority}null!==p.record&&(m.record=p.record),Array.isArray(p.events)&&(m.events=p.events);try{if(p.disableVideo&&p.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),Ms.info("Sending publish command");const e=await this.transactionManager.cmd("publish",m);if(p.codec===ys.AV1){const t=null==(d=null==(u=null==(l=null==(c=RTCRtpSender.getCapabilities)?void 0:c.call(RTCRtpSender,"video"))?void 0:l.codecs)?void 0:u.find)?void 0:d.call(u,e=>"video/AV1X"===e.mimeType);e.sdp=t?ms.adaptCodecName(e.sdp,ys.AV1,"AV1X"):e.sdp}return Ms.info("Command sent, publisherId: ",e.publisherId),Ms.debug("Command result: ",e),this.serverId=e.publisherId,this.clusterId=e.clusterId,nt(this.streamName),st(this.serverId),ot(e.feedId),lt(this.clusterId),e.sdp}catch(e){throw Ms.error("Error sending publish command, error: ",e),e}}async cmd(e,t){return Ms.info("Sending cmd: ".concat(e)),this.transactionManager.cmd(e,t)}}const Ws=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={vad:e,pinnedSourceId:t,excludedSourceIds:n}),r},Zs=(e,t,n)=>{let r="object"==typeof e?e:{};if(0===Object.keys(r).length){r={codec:null!=e?e:ys.H264,record:t,sourceId:n}}return r};class mr extends Error{constructor(e,t){super(e),this.name="FetchError",this.status=t}}const zs=St.get("Director"),Xs="WebRtc";let Ks="";let Hs="https://director.millicast.com";const Qs={setEndpoint:e=>{Hs=e.replace(/\/$/,"")},getEndpoint:()=>Hs,setLiveDomain:e=>{Ks=e.replace(/\/$/,"")},getLiveDomain:()=>Ks,getPublisher:async(e,t=null,n=Xs)=>{const r=qs(e,t,n);zs.info("Getting publisher connection path for stream name: ",r.streamName);const s={streamName:r.streamName,streamType:r.streamType},i={"Content-Type":"application/json",Authorization:"Bearer ".concat(r.token)},o="".concat(Qs.getEndpoint(),"/api/director/publish");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=ii(t),zs.debug("Getting publisher response: ",t),et(t.data.streamAccountId),t.data}catch(e){throw zs.error("Error while getting publisher connection path. ",e),e}},getSubscriber:async(e,t=null,n=null)=>{const r=si(e,t,n);et(r.streamAccountId),zs.info("Getting subscriber connection data for stream name: ".concat(r.streamName," and account id: ").concat(r.streamAccountId));const s={streamAccountId:r.streamAccountId,streamName:r.streamName};let i={"Content-Type":"application/json"};r.subscriberToken&&(i=Me(Ne({},i),{Authorization:"Bearer ".concat(r.subscriberToken)}));const o="".concat(Qs.getEndpoint(),"/api/director/subscribe");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=ii(t),zs.debug("Getting subscriber response: ",t),r.subscriberToken&&(t.data.subscriberToken=r.subscriberToken),t.data}catch(e){throw zs.error("Error while getting subscriber connection path. ",e),e}}},qs=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={token:e,streamName:t,streamType:n}),r},si=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={streamName:e,streamAccountId:t,subscriberToken:n}),r},ii=e=>{if(Qs.getLiveDomain()){const t=/\/\/(.*?)\//,n=e.data.urls.map(e=>{const n=t.exec(e);return e.replace(n[1],Qs.getLiveDomain())});e.data.urls=n}if(e.data.drmObject){const t=e.data.drmObject.playReadyUrl;t&&(e.data.drmObject.playReadyUrl="".concat(Qs.getEndpoint()).concat(t));const n=e.data.drmObject.widevineUrl;n&&(e.data.drmObject.widevineUrl="".concat(Qs.getEndpoint()).concat(n));const r=e.data.drmObject.fairPlayUrl;r&&(e.data.drmObject.fairPlayUrl="".concat(Qs.getEndpoint()).concat(r));const s=e.data.drmObject.fairPlayCertUrl;s&&(e.data.drmObject.fairPlayCertUrl="".concat(Qs.getEndpoint()).concat(s))}return e};function oi(e){this.message=e}oi.prototype=new Error,oi.prototype.name="InvalidCharacterError";var li=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new oi("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,i=0,o="";r=t.charAt(i++);~r&&(n=s%4?64*n+r:r,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};function pi(e){this.message=e}function hi(e,t){if("string"!=typeof e)throw new pi("Invalid token specified");var n=!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 function(e){return decodeURIComponent(li(e).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return li(t)}}(e.split(".")[n]))}catch(e){throw new pi("Invalid token specified: "+e.message)}}pi.prototype=new Error,pi.prototype.name="InvalidTokenError";var gi={exports:{}};!function(e,t){!function(n){if(null!=t&&"number"!=typeof t.nodeType)e.exports=n();else{var r=n(),s=typeof self<"u"?self:$.global;"function"!=typeof s.btoa&&(s.btoa=r.btoa),"function"!=typeof s.atob&&(s.atob=r.atob)}}(function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(n){for(var r,s,i,o,a=String(n),c=0,l="";c<a.length;){if(r=a.charCodeAt(c++),s=a.charCodeAt(c++),i=a.charCodeAt(c++),r>255||s>255||i>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");l+=e.charAt((o=r<<16|s<<8|i)>>18&63)+e.charAt(o>>12&63)+e.charAt(o>>6&63)+e.charAt(63&o)}switch(a.length%3){case 0:return l;case 1:return l.slice(0,-2)+"==";case 2:return l.slice(0,-1)+"="}},atob:function(n){var r=String(n).replace(/[=]+$/,"");if(r.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,i,o=0,a=0,c="";i=r.charAt(a++);~i&&(s=o%4?64*s+i:i,o++%4)?c+=String.fromCharCode(255&s>>(-2*o&6)):0)i=e.indexOf(i);return c}}})}(gi,gi.exports);var yi={exports:{}};let vi;!function(e){!function(t,n){e.exports=n()}(self,()=>{return e={7629:(e,t,n)=>{const r=n(375),s=n(8571),i=n(9474),o=n(1687),a=n(8652),c=n(8160),l=n(3292),u=n(6354),d=n(8901),p=n(9708),f=n(6914),h=n(2294),m=n(6133),g=n(1152),y=n(8863),v=n(2036),w={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return r("function"==typeof p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return c.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){r(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),r(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const n in e){const s=e[n];r("function"==typeof s,"Alteration adjuster for",n,"must be a function"),t.$_terms.alterations.push({target:n,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return r(void 0!==e,"Artifact cannot be undefined"),r(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return r(!1===e||"string"==typeof e,"Invalid to value"),r(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return r(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return r(e,"Missing error"),r(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return r(void 0!==e,"Missing example"),c.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(r(!t,"Cannot combine options with description"),t=e.description,e=e.method),r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(r("string"==typeof e,"id must be a non-empty string"),r(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return r(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return r(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){r(e.length,"Missing notes");for(const t of e)r(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return r("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){r(e,"Missing preferences"),r(void 0===e.context,"Cannot override context"),r(void 0===e.externals,"Cannot override externals"),r(void 0===e.warnings,"Cannot override warnings"),r(void 0===e.debug,"Cannot override debug"),c.checkPreferences(e);const t=this.clone();return t._preferences=c.preferences(t._preferences,e),t}presence(e){return r(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return r(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),n=void 0!==e&&!e;return t._preferences=c.preferences(t._preferences,{convert:n}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){r(e.length,"Missing tags");for(const t of e)r(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return r(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){c.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const n=this.clone();n.$_terms.whens||(n.$_terms.whens=[]);const s=l.when(n,e,t);if(!["any","link"].includes(n.type)){const e=s.is?[s]:s.switch;for(const t of e)r(!t.then||"any"===t.then.type||t.then.type===n.type,"Cannot combine",n.type,"with",t.then&&t.then.type),r(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===n.type,"Cannot combine",n.type,"with",t.otherwise&&t.otherwise.type)}return n.$_terms.whens.push(s),n.$_mutateRebuild()}cache(e){r(!this._inRuleset(),"Cannot set caching inside a ruleset"),r(!this._cache,"Cannot override schema cache"),r(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||a.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){r(c.isSchema(e),"Invalid schema object"),r("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),r(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),r(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const n=e.clone();for(const e of Object.keys(t))"type"!==e&&(n[e]=t[e]);t=n}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?c.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const n of e._singleRules.keys())t._singleRules.has(n)&&(t._rules=t._rules.filter(e=>e.keep||e.name!==n),t._singleRules.delete(n));for(const n of e._rules)e._definition.rules[n.method].multi||t._singleRules.set(n.name,n),t._rules.push(n);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else o(t._flags,e._flags);for(const n in e.$_terms){const r=e.$_terms[n];r?t.$_terms[n]?t.$_terms[n]=t.$_terms[n].concat(r):t.$_terms[n]=r.slice():t.$_terms[n]||(t.$_terms[n]=r)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return r(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){r(!this._inRuleset(),"Cannot fork inside a ruleset");let n=this;for(let r of[].concat(e))r=Array.isArray(r)?r:r.split("."),n=n._ids.fork(r,t,n);return n.$_temp.ruleset=!1,n}rule(e){const t=this._definition;c.assertOptions(e,Object.keys(t.modifiers)),r(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const n=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;r(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const i=this.clone();for(let o=n;o<i._rules.length;++o){const n=i._rules[o],a=s(n);for(const s in e)t.modifiers[s](a,e[s]),r(a.name===n.name,"Cannot change rule name");i._rules[o]=a,i._singleRules.get(a.name)===n&&i._singleRules.set(a.name,a)}return i.$_temp.ruleset=!1,i.$_mutateRebuild()}get ruleset(){r(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),r(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:n,adjuster:s}of this.$_terms.alterations)e.includes(n)&&(t=s(t),r(c.isSchema(t),"Alteration adjuster for",n,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),r(e&&"object"==typeof e,"Invalid options"),r(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)r("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const n=this._definition.rules[t.method],s=t.args;r(n,"Unknown rule",t.method);const i=this.clone();if(s){r(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let o=s[e];if(n.argsByName){const a=n.argsByName.get(e);if(a.ref&&c.isResolvable(o))t._resolve.push(e),i.$_mutateRegister(o);else if(a.normalize&&(o=a.normalize(o),s[e]=o),a.assert){const t=c.validateArg(o,e,a);r(!t,t,"or reference")}}void 0!==o?s[e]=o:delete s[e]}}return n.multi||(i._ruleRemove(t.name,{clone:!1}),i._singleRules.set(t.name,t)),!1===i.$_temp.ruleset&&(i.$_temp.ruleset=null),n.priority?i._rules.unshift(t):i._rules.push(t),i}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,n,r,s,i={}){const o=!1!==i.flags?this._flags:{},a=i.messages?f.merge(this._definition.messages,i.messages):this._definition.messages;return new u.Report(e,t,n,o,a,r,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,n,r){(n=Object.assign({},n)).abortEarly=!0,n._externals=!1,t.snapshot();const s=!y.validate(e,this,t,n,r).errors;return t.restore(),s}$_modify(e){return c.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){return r(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:n,path:r,key:s})=>{const i=this._definition[t][n]&&this._definition[t][n].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:n}={}){this._refs.register(e,t),this._ids.register(e,{key:n})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,n={}){r("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(i(t,s.default)&&(t=void 0),i(t,this._flags[e]))return this;const o=!1!==n.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][c.symbols.parent].call(this,...t)}$_validate(e,t,n){return y.validate(e,this,t,n)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const n in t){const r=t[n];e.$_terms[n]=r.init}return e.$_mutateRebuild()}_default(e,t,n={}){return c.assertOptions(n,"literal"),r(void 0!==t,"Missing",e,"value"),r("function"==typeof t||!n.literal,"Only function value supports literal option"),"function"==typeof t&&n.literal&&(t={[c.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,n){if(!this.$_terms.whens)return{schema:this};const r=[],s=[];for(let i=0;i<this.$_terms.whens.length;++i){const o=this.$_terms.whens[i];if(o.concat){r.push(o.concat),s.push("".concat(i,".concat"));continue}const a=o.ref?o.ref.resolve(e,t,n):e,c=o.is?[o]:o.switch,l=s.length;for(let l=0;l<c.length;++l){const{is:u,then:d,otherwise:p}=c[l],f="".concat(i).concat(o.switch?"."+l:"");if(u.$_match(a,t.nest(u,"".concat(f,".is")),n)){if(d){const i=t.localize([...t.path,"".concat(f,".then")],t.ancestors,t.schemas),{schema:o,id:a}=d._generate(e,i,n);r.push(o),s.push("".concat(f,".then").concat(a?"(".concat(a,")"):""));break}}else if(p){const i=t.localize([...t.path,"".concat(f,".otherwise")],t.ancestors,t.schemas),{schema:o,id:a}=p._generate(e,i,n);r.push(o),s.push("".concat(f,".otherwise").concat(a?"(".concat(a,")"):""));break}}if(o.break&&s.length>l)break}const i=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",i),!i)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,n));for(const e of r)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...r]),this.$_temp.whens[i]=o,{schema:o,id:i}}_inner(e,t,n={}){r(!this._inRuleset(),"Cannot set ".concat(e," inside a ruleset"));const s=this.clone();return s.$_terms[e]&&!n.override||(s.$_terms[e]=[]),n.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const n=!1!==t.clone?this.clone():this;n._singleRules.delete(e);const r=[];for(let t=0;t<n._rules.length;++t){const s=n._rules[t];s.name!==e||s.keep?r.push(s):n._inRuleset()&&t<n.$_temp.ruleset&&--n.$_temp.ruleset}return n._rules=r,n}_values(e,t){c.verifyFlat(e,t.slice(1,-1));const n=this.clone(),s=e[0]===c.symbols.override;if(s&&(e=e.slice(1)),!n[t]&&e.length?n[t]=new v:s&&(n[t]=e.length?new v:null,n.$_mutateRebuild()),!n[t])return n;s&&n[t].override();for(const s of e){r(void 0!==s,"Cannot call allow/valid/invalid with undefined"),r(s!==c.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";n[e]&&(n[e].remove(s),n[e].length||(r("_valids"===t||!n._flags.only,"Setting invalid value",s,"leaves schema rejecting all values due to previous valid rule"),n[e]=null)),n[t].add(s,n._refs)}return n}}};w.Base.prototype[c.symbols.any]={version:c.version,compile:l.compile,root:"$_root"},w.Base.prototype.isImmutable=!0,w.Base.prototype.deny=w.Base.prototype.invalid,w.Base.prototype.disallow=w.Base.prototype.invalid,w.Base.prototype.equal=w.Base.prototype.valid,w.Base.prototype.exist=w.Base.prototype.required,w.Base.prototype.not=w.Base.prototype.invalid,w.Base.prototype.options=w.Base.prototype.prefs,w.Base.prototype.preferences=w.Base.prototype.prefs,e.exports=new w.Base},8652:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){i.assertOptions(e,["max"]),r(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let n=this._map.get(e);if(n)return n.value=t,void this._list.first(n);n=this._list.unshift({key:e,value:t}),this._map.set(e,n),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:n}=e;return t.prev=n,n&&(n.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,n)=>{const r=n(375),s=n(7916),i=n(5934);let o,a;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=i.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,n="Options"){r(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter(e=>!t.includes(e));r(0===s.length,"".concat(n," contain unknown keys: ").concat(s))},t.checkPreferences=function(e){a=a||n(3378);const t=a.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,n){switch(n){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,n={}){const s=e&&e[t.symbols.any];return!!s&&(r(n.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,r){o=o||n(6914),e=e||{},r=r||{};const s=Object.assign({},e,r);return r.errors&&e.errors&&(s.errors=Object.assign({},e.errors,r.errors),s.errors.wrap=Object.assign({},e.errors.wrap,r.errors.wrap)),r.messages&&(s.messages=o.compile(r.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,n={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,n.append&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},t.validateArg=function(e,n,{assert:r,message:s}){if(t.isSchema(r)){const t=r.validate(e);return t.error?t.error.message:void 0}if(!r(e))return n?"".concat(n," ").concat(s):s},t.verifyFlat=function(e,t){for(const n of e)r(!Array.isArray(n),"Method no longer accepts array arguments:",t)}},3292:(e,t,n)=>{const r=n(375),s=n(8160),i=n(6133),o={};t.schema=function(e,t,n={}){s.assertOptions(n,["appendPath","override"]);try{return o.schema(e,t,n)}catch(e){throw n.appendPath&&void 0!==e.path&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},o.schema=function(e,t,n){r(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(r(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const i=(t,...r)=>!1!==n.override?t.valid(e.override,...r):t.valid(...r);if(o.simple(t))return i(e,t);if("function"==typeof t)return e.custom(t);if(r("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return i(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const n of t)if(!o.simple(n))return e.alternatives().try(...t);return i(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?i(e.date(),t):(r(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return i.isRef(e)?e:i.create(e,t)},t.compile=function(e,n,i={}){s.assertOptions(i,["legacy"]);const a=n&&n[s.symbols.any];if(a)return r(i.legacy||a.version===s.version,"Cannot mix different versions of joi schemas:",a.version,s.version),n;if("object"!=typeof n||!i.legacy)return t.schema(e,n,{appendPath:!0});const c=o.walk(n);return c?c.compile(c.root,n):t.schema(e,n,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};r(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const n=o.walk(e[t]);if(n)return n}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,n,a){if(void 0===a&&(r(n&&"object"==typeof n,"Missing options"),a=n,n=i.create(".")),Array.isArray(a)&&(a={switch:a}),s.assertOptions(a,["is","not","then","otherwise","switch","break"]),s.isSchema(n))return r(void 0===a.is,'"is" can not be used with a schema condition'),r(void 0===a.not,'"not" can not be used with a schema condition'),r(void 0===a.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:n,then:a.then,otherwise:a.otherwise,break:a.break});if(r(i.isRef(n)||"string"==typeof n,"Invalid condition:",n),r(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let c=a;void 0!==a.not&&(c={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return r(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),r(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||i.isRef(a.is)||s.isSchema(a.is)||(l=l.required()),o.condition(e,{ref:t.ref(n),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}r(Array.isArray(a.switch),'"switch" must be an array'),r(void 0===a.is,'Cannot combine "switch" with "is"'),r(void 0===a.not,'Cannot combine "switch" with "not"'),r(void 0===a.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(n),switch:[],break:a.break};for(let t=0;t<a.switch.length;++t){const n=a.switch[t],o=t===a.switch.length-1;s.assertOptions(n,o?["is","then","otherwise"]:["is","then"]),r(void 0!==n.is,'Switch statement missing "is"'),r(void 0!==n.then,'Switch statement missing "then"');const l={is:e.$_compile(n.is),then:e.$_compile(n.then)};if(i.isRef(n.is)||s.isSchema(n.is)||(l.is=l.is.required()),o){r(void 0===a.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==a.otherwise?a.otherwise:n.otherwise;void 0!==t&&(r(void 0===c.break,"Cannot specify both otherwise and break"),l.otherwise=e.$_compile(t))}c.switch.push(l)}return c},o.condition=function(e,t){for(const n of["then","otherwise"])void 0===t[n]?delete t[n]:t[n]=e.$_compile(t[n]);return t}},6354:(e,t,n)=>{const r=n(5688),s=n(8160),i=n(3328);t.Report=class{constructor(e,n,r,s,i,o,a){if(this.code=e,this.flags=s,this.messages=i,this.path=o.path,this.prefs=a,this.state=o,this.value=n,this.message=null,this.template=null,this.local=r||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?'Error code "'.concat(e,'" is not defined, your custom type is missing the correct messages definition'):(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,n){return t.template(this.value,e,n||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const n of e)"object"!=typeof n&&("string"==typeof n?(t&&(t+="."),t+=n):t+="[".concat(n,"]"));return t},t.template=function(e,t,n,r,o){if(!t)return;if(i.isTemplate(t))return"root"!==n?t:null;let a=o.errors.language;if(s.isResolvable(a)&&(a=a.resolve(e,r,o)),a&&t[a]){if(void 0!==t[a][n])return t[a][n];if(void 0!==t[a]["*"])return t[a]["*"]}return t[n]?t[n]:t["*"]},t.label=function(e,n,r,s){if(!r.errors.label)return"";if(e.label)return e.label;let i=n.path;return"key"===r.errors.label&&n.path.length>1&&(i=n.path.slice(-1)),t.path(i)||t.template(null,r.messages,"root",n,r)||s&&t.template(null,s,"root",n,r)||"value"},t.process=function(e,n,r){if(!e)return null;const{override:s,message:i,details:o}=t.details(e);if(s)return s;if(r.errors.stack)return new t.ValidationError(i,o,n);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(i,o,n);return Error.stackTraceLimit=a,c},t.details=function(e,t={}){let n=[];const r=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();n.push(e),r.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();n.push(e),r.push({message:e,path:s.path.filter(e=>"object"!=typeof e),type:s.code,context:s.local})}return n.length>1&&(n=[...new Set(n)]),{message:n.join(". "),details:r}},t.ValidationError=class extends Error{constructor(e,t,n){super(e),this._original=n,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=r.error},8901:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8160),o=n(6914),a={};t.type=function(e,t){const n=Object.getPrototypeOf(e),c=s(n),l=e._assign(Object.create(c)),u=Object.assign({},t);delete u.base,c._definition=u;const d=n._definition||{};u.messages=o.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const p=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];r(void 0===l.$_terms[e],"Invalid term override for",u.type,e),l.$_terms[e]=t.init,p[e]=t}u.terms=p,u.args||(u.args=d.args),u.prepare=a.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=a.coerce(u.coerce,d.coerce),u.validate=a.validate(u.validate,d.validate);const f=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];r("object"==typeof t,"Invalid rule definition for",u.type,e);let n=t.method;if(void 0===n&&(n=function(){return this.$_addRule(e)}),n&&(r(!c[e],"Rule conflict in",u.type,e),c[e]=n),r(!f[e],"Rule conflict in",u.type,e),f[e]=t,t.alias){const e=[].concat(t.alias);for(const n of e)c[n]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map(e=>("string"==typeof e&&(e={name:e}),r(!t.argsByName.has(e.name),"Duplicated argument name",e.name),i.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e)))}u.rules=f;const h=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){r(!c[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];r("function"==typeof t,"Invalid modifier definition for",u.type,e);const n=function(t){return this.rule({[e]:t})};c[e]=n,h[e]=t}if(u.modifiers=h,u.overrides){c._super=n,l.$_super={};for(const e in u.overrides)r(n[e],"Cannot override missing",e),u.overrides[e][i.symbols.parent]=n[e],l.$_super[e]=n[e].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=a.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=a.rebuild(u.rebuild,d.rebuild),l},a.build=function(e,t){return e&&t?function(n,r){return t(e(n,r),r)}:e||t},a.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(n,r){let s;if((!t.from||t.from.includes(typeof n))&&(s=t.method(n,r),s)){if(s.errors||void 0===s.value)return s;n=s.value}if(!e.from||e.from.includes(typeof n)){const t=e.method(n,r);if(t)return t}return s}}:e||t},a.prepare=function(e,t){return e&&t?function(n,r){const s=e(n,r);if(s){if(s.errors||void 0===s.value)return s;n=s.value}return t(n,r)||s}:e||t},a.rebuild=function(e,t){return e&&t?function(n){t(n),e(n)}:e||t},a.validate=function(e,t){return e&&t?function(n,r){const s=t(n,r);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;n=s.value}return e(n,r)||s}:e||t}},5107:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8652),o=n(8160),a=n(3292),c=n(6354),l=n(8901),u=n(9708),d=n(6133),p=n(3328),f=n(1152);let h;const m={types:{alternatives:n(4946),any:n(8068),array:n(546),boolean:n(4937),date:n(7500),function:n(390),link:n(8785),number:n(3832),object:n(8966),string:n(7417),symbol:n(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(m.types))};for(const t of e._types)e[t]=function(...e){return r(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const n=m.aliases[t];e[t]=e[n]}return e.x=e.expression,f.setup&&f.setup(e),e}};m.methods={ValidationError:c.ValidationError,version:o.version,cache:i.provider,assert(e,t,...n){m.assert(e,t,!0,n)},attempt:(e,t,...n)=>m.assert(e,t,!1,n),build(e){return r("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return a.compile(this,e,t)},defaults(e){r("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const n of t._types){const s=e(t[n]());r(o.isSchema(s),"modifier must return a valid schema object"),t[n]=function(...e){return m.generate(this,s,e)}}return t},expression:(...e)=>new p(...e),extend(...e){o.verifyFlat(e,"extend"),h=h||n(3378),r(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let n of e){"function"==typeof n&&(n=n(t)),this.assert(n,h.extension);const e=m.expandExtension(n,t);for(const n of e){r(void 0===t[n.type]||t._types.has(n.type),"Cannot override name",n.type);const e=n.base||this.any(),s=l.type(e,n);t._types.add(n.type),t[n.type]=function(...e){return m.generate(this,s,e)}}}return t},isError:c.ValidationError.isError,isExpression:p.isTemplate,isRef:d.isRef,isSchema:o.isSchema,in:(...e)=>d.in(...e),override:o.symbols.override,ref:(...e)=>d.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,n,r){const i=r[0]instanceof Error||"string"==typeof r[0]?r[0]:null,a=null!==i?r[1]:r[0],l=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let u=l.error;if(!u)return l.value;if(i instanceof Error)throw i;const d=n&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==0&&(u=s(u)),u.message=i?"".concat(i," ").concat(d):d,u},m.generate=function(e,t,n){return r(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&n.length?t._definition.args(t,...n):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const n=[];for(const r of t._types)if(e.type.test(r)){const s=Object.assign({},e);s.type=r,s.base=t[r](),n.push(s)}return n},e.exports=m.root()},6914:(e,t,n)=>{const r=n(375),s=n(8571),i=n(3328);t.compile=function(e,t){if("string"==typeof e)return r(!t,"Cannot set single message string"),new i(e);if(i.isTemplate(e))return r(!t,"Cannot set single message template"),e;r("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let n in e){const s=e[n];if("root"===n||i.isTemplate(s)){t[n]=s;continue}if("string"==typeof s){t[n]=new i(s);continue}r("object"==typeof s&&!Array.isArray(s),"Invalid message for",n);const o=n;for(n in t[o]=t[o]||{},s){const e=s[n];"root"===n||i.isTemplate(e)?t[o][n]=e:(r("string"==typeof e,"Invalid message for",n,"in",o),t[o][n]=new i(e))}}return t},t.decompile=function(e){const t={};for(let n in e){const r=e[n];if("root"===n){t.root=r;continue}if(i.isTemplate(r)){t[n]=r.describe({compact:!0});continue}const s=n;for(n in t[s]={},r){const e=r[n];"root"!==n?t[s][n]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,n){if(!e)return t.compile(n);if(!n)return e;if("string"==typeof n)return new i(n);if(i.isTemplate(n))return n;const o=s(e);for(let e in n){const t=n[e];if("root"===e||i.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new i(t);continue}r("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in o[s]=o[s]||{},t){const n=t[e];"root"===e||i.isTemplate(n)?o[s][e]=n:(r("string"==typeof n,"Invalid message for",e,"in",s),o[s][e]=new i(n))}}return o}},2294:(e,t,n)=>{const r=n(375),s=n(8160),i=n(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,n]of e._byId.entries())r(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,n);for(const[t,n]of e._byKey.entries())r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,n)}fork(e,t,n){const i=this._collect(e);i.push({schema:n});const a=i.shift();let c={id:a.id,schema:t(a.schema)};r(s.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of i)c={id:e.id,schema:o.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const n=e[0],r=this._get(n);if(!r)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,r.schema._flags.label||n],s.length?r.schema._ids.labels(s,t):t.join(".")}reach(e,t=[]){const n=e[0],s=this._get(n);r(s,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?s.schema._ids.reach(i,[...t,n]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const t=this._byId.get(n);r(!t||t.schema===e,"Cannot add different schemas with the same id:",n),r(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}t&&(r(!this._byKey.has(t),"Schema already contains key:",t),r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],n=[]){const s=e[0],i=this._get(s);r(i,"Schema does not contain path",[...t,...e].join(".")),n=[i,...n];const o=e.slice(1);return o.length?i.schema._ids._collect(o,[...t,s],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.fork=function(e,n,r){const s=t.schema(e,{each:(e,{key:t})=>{if(n===(e._flags.id||t))return r},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let n;for(const r in e._flags){if("_"===r[0])continue;const s=o.scan(e._flags[r],{source:"flags",name:r},t);void 0!==s&&(n=n||e.clone(),n._flags[r]=s)}for(let r=0;r<e._rules.length;++r){const s=e._rules[r],i=o.scan(s.args,{source:"rules",name:s.name},t);if(void 0!==i){n=n||e.clone();const t=Object.assign({},s);t.args=i,n._rules[r]=t,n._singleRules.get(s.name)===s&&n._singleRules.set(s.name,t)}}for(const r in e.$_terms){if("_"===r[0])continue;const s=o.scan(e.$_terms[r],{source:"terms",name:r},t);void 0!==s&&(n=n||e.clone(),n.$_terms[r]=s)}return n},o.scan=function(e,t,n,r,a){const c=r||[];if(null===e||"object"!=typeof e)return;let l;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const s="terms"===t.source&&"keys"===t.name&&e[r].key,i=o.scan(e[r],t,n,[r,...c],s);void 0!==i&&(l=l||e.slice(),l[r]=i)}return l}if(!1!==n.schema&&s.isSchema(e)||!1!==n.ref&&i.isRef(e)){const r=n.each(e,Me(Ne({},t),{path:c,key:a}));return r===e?void 0:r}for(const r in e){if("_"===r[0])continue;const s=o.scan(e[r],t,n,[r,...c],a);void 0!==s&&(l=l||Object.assign({},e),l[r]=s)}return l}},6133:(e,t,n)=>{const r=n(375),s=n(8571),i=n(9621),o=n(8160);let a;const c={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){r("string"==typeof e,"Invalid reference key:",e),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),r(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const n=Object.assign({},c.defaults,t);delete n.prefix;const s=n.separator,i=c.context(e,s,t.prefix);if(n.type=i.type,e=i.key,"value"===n.type)if(i.root&&(r(!s||e[0]!==s,"Cannot specify relative path with root prefix"),n.ancestor="root",e||(e=null)),s&&s===e)e=null,n.ancestor=0;else if(void 0!==n.ancestor)r(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,r]=c.ancestor(e,s);r&&""===(e=e.slice(r))&&(e=null),n.ancestor=t}return n.path=s?null===e?[]:e.split(s):[e],new c.Ref(n)},t.in=function(e,n={}){return t.create(e,Me(Ne({},n),{in:!0}))},t.isRef=function(e){return!!e&&!!e[o.symbols.ref]},c.Ref=class{constructor(e){r("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),r([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),r(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),r(!e.map||Array.isArray(e.map),"options.map must be an array"),r(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,c.defaults,e),r("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,n,s,i={}){return r(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(n.context,t,i):"local"===this.type?this._resolve(s,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(r(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,n){let r;if("value"===this.type&&t.mainstay.shadow&&!1!==n.shadow&&(r=t.mainstay.shadow.get(this.absolute(t))),void 0===r&&(r=i(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(r=this.adjust(r)),this.map){const e=this.map.get(r);void 0!==e&&(r=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,r),r}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new c.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display="ref:".concat(this.type,":").concat(e));if(!this.separator)return void(this.display="ref:".concat(e));if(!this.ancestor)return void(this.display="ref:".concat(this.separator).concat(e));if("root"===this.ancestor)return void(this.display="ref:root:".concat(e));if(1===this.ancestor)return void(this.display="ref:".concat(e||".."));const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display="ref:".concat(t).concat(e||"")}},c.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},c.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new c.Ref(e)},c.context=function(e,t,n={}){if(e=e.trim(),n){const r=void 0===n.global?"$":n.global;if(r!==t&&e.startsWith(r))return{key:e.slice(r.length),type:"global"};const s=void 0===n.local?"#":n.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const i=void 0===n.root?"/":n.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},c.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let n=2;for(;e[n]===t;)++n;return[n-1,n]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root}),a=a||n(3328),a.isTemplate(e)&&this.register(e.refs(),r)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter(e=>!e.ancestor).map(e=>e.root)}}},3378:(e,t,n)=>{const r=n(5107),s={};s.wrap=r.string().min(1).max(2).allow(!1),t.preferences=r.object({allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),context:r.object(),convert:r.boolean(),dateFormat:r.valid("date","iso","string","time","utc"),debug:r.boolean(),errors:{escapeHtml:r.boolean(),label:r.valid("path","key",!1),language:[r.string(),r.object().ref()],render:r.boolean(),stack:r.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:r.boolean(),messages:r.object(),noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:r.valid("required","optional","forbidden"),skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=r.object({alias:r.array().items(r.string().pattern(s.nameRx)).single(),args:r.array().items(r.string(),r.object({name:r.string().pattern(s.nameRx).required(),ref:r.boolean(),assert:r.alternatives([r.function(),r.object().schema()]).conditional("ref",{is:!0,then:r.required()}),normalize:r.function(),message:r.string().when("assert",{is:r.function(),then:r.required()})})),convert:r.boolean(),manifest:r.boolean(),method:r.function().allow(!1),multi:r.boolean(),validate:r.function()}),t.extension=r.object({type:r.alternatives([r.string(),r.object().regex()]).required(),args:r.function(),cast:r.object().pattern(s.nameRx,r.object({from:r.function().maxArity(1).required(),to:r.function().minArity(1).maxArity(2).required()})),base:r.object().schema().when("type",{is:r.object().regex(),then:r.forbidden()}),coerce:[r.function().maxArity(3),r.object({method:r.function().maxArity(3).required(),from:r.array().items(r.string()).single()})],flags:r.object().pattern(s.nameRx,r.object({setter:r.string(),default:r.any()})),manifest:{build:r.function().arity(2)},messages:[r.object(),r.string()],modifiers:r.object().pattern(s.nameRx,r.function().minArity(1).maxArity(2)),overrides:r.object().pattern(s.nameRx,r.function()),prepare:r.function().maxArity(3),rebuild:r.function().arity(1),rules:r.object().pattern(s.nameRx,s.rule),terms:r.object().pattern(s.nameRx,r.object({init:r.array().allow(null).required(),manifest:r.object().pattern(/.+/,[r.valid("schema","single"),r.object({mapped:r.object({from:r.string().required(),to:r.string().required()}).required()})])})),validate:r.function().maxArity(3)}).strict(),t.extensions=r.array().items(r.object(),r.function().arity(1)).strict(),s.desc={buffer:r.object({buffer:r.string()}),func:r.object({function:r.function().required(),options:{literal:!0}}),override:r.object({override:!0}),ref:r.object({ref:r.object({type:r.valid("value","global","local"),path:r.array().required(),separator:r.string().length(1).allow(!1),ancestor:r.number().min(0).integer().allow("root"),map:r.array().items(r.array().length(2)).min(1),adjust:r.function(),iterables:r.boolean(),in:r.boolean(),render:r.boolean()}).required()}),regex:r.object({regex:r.string().min(3)}),special:r.object({special:r.valid("deep").required()}),template:r.object({template:r.string().required(),options:r.object()}),value:r.object({value:r.alternatives([r.object(),r.array()]).required()})},s.desc.entity=r.alternatives([r.array().items(r.link("...")),r.boolean(),r.function(),r.number(),r.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,r.link("/")]),s.desc.values=r.array().items(null,r.boolean(),r.function(),r.number().allow(1/0,-1/0),r.string().allow(""),r.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=r.object().pattern(/.+/,[r.string(),s.desc.template,r.object().pattern(/.+/,[r.string(),s.desc.template])]),t.description=r.object({type:r.string().required(),flags:r.object({cast:r.string(),default:r.any(),description:r.string(),empty:r.link("/"),failover:s.desc.entity,id:r.string(),label:r.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:r.boolean(),unit:r.string()}).unknown(),preferences:{allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),convert:r.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:r.boolean(),label:["path","key"],language:[r.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:r.boolean(),messages:s.desc.messages,noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:["required","optional","forbidden"],skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:r.array().min(1).items({name:r.string().required(),args:r.object().min(1),keep:r.boolean(),message:[r.string(),s.desc.messages],warn:r.boolean()}),keys:r.object().pattern(/.*/,r.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,r.any())},493:(e,t,n)=>{const r=n(8571),s=n(9621),i=n(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,n){this.path=e,this.ancestors=t,this.mainstay=n.mainstay,this.schemas=n.schemas,this.debug=null}localize(e,t=null,n=null){const r=new o.State(e,t,this);return n&&r.schemas&&(r.schemas=[o.schemas(n),...r.schemas]),r}nest(e,t){const n=new o.State(this.path,this.ancestors,this);return n.schemas=n.schemas&&[o.schemas(e),...n.schemas],n.debug=t,n}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=r(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return i.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,n){if(!e.length||"strip"===n&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let r=this._values;for(let t=0;t<e.length;++t){const n=e[t];let s=r.get(n);s||(s=new Map,r.set(n,s)),r=s}r[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.value]}node(e){if(this._values)return s(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const n=e.slice(0,-1),r=e[e.length-1],i=s(this._values,n,{iterables:!0});t?i.set(r,t):i&&i.delete(r)}}},3328:(e,t,n)=>{const r=n(375),s=n(8571),i=n(5277),o=n(1447),a=n(8160),c=n(6354),l=n(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(r("string"==typeof e,"Template source must be a string"),r(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const e=t,{functions:n}=e,i=Fe(e,["functions"]);this._settings=Object.keys(i).length?s(i):void 0,this._functions=n,this._functions&&(r(Object.keys(this._functions).every(e=>"string"==typeof e),"Functions keys must be strings"),r(Object.values(this._functions).every(e=>"function"==typeof e),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let n=!1;const r=[],s=t.shift();s&&r.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",i=e.indexOf(s);if(-1===i||"{"===e[1]){r.push("{".concat(u.decode(e)));continue}let o=e.slice(t?0:1,i);const a=":"===o[0];a&&(o=o.slice(1));const c=this._ref(u.decode(o),{raw:t,wrapped:a});r.push(c),"string"!=typeof c&&(n=!0);const l=e.slice(i+s.length);l&&r.push(u.decode(l))}n?this._template=r:this.rendered=r.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?Me(Ne({},e.options),{functions:e.functions}):void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[a.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,n,r){return this._template&&1===this._template.length?this._part(this._template[0],e,t,n,r,{}):this.render(e,t,n,r)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,n,r,s={}){if(!this.isDynamic())return this.rendered;const o=[];for(const a of this._template)if("string"==typeof a)o.push(a);else{const c=this._part(a,e,t,n,r,s),l=u.stringify(c,e,t,n,r,s);if(void 0!==l){const e=a.raw||!1===(s.errors&&s.errors.escapeHtml)?l:i(l);o.push(u.wrap(e,a.wrapped&&n.errors.wrap.label))}}return o.join("")}_ref(e,{raw:t,wrapped:n}){const r=[],s=e=>{const t=l.create(e,this._settings);return r.push(t),e=>{const n=t.resolve(...e);return void 0!==n?n:null}};try{const t=this._functions?Ne(Ne({},u.functions),this._functions):u.functions;var i=new o.Parser(e,{reference:s,functions:t,constants:u.constants})}catch(t){throw t.message='Invalid template variable "'.concat(e,'" fails due to: ').concat(t.message),t}if(i.single){if("reference"===i.single.type){const e=r[0];return{ref:e,raw:t,refs:r,wrapped:n||"local"===e.type&&"label"===e.key}}return u.stringify(i.single.value)}return{formula:i,raw:t,refs:r}}toString(){return this.source}},u.Template.prototype[a.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,(e,t)=>u.opens.slice(0,t.length)).replace(/\\(\}+)/g,(e,t)=>u.closes.slice(0,t.length))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let n="";for(let r=0;r<e.length;++r){const s=e[r];if("{"===s){let s="";for(;r+1<e.length&&"{"===e[r+1];)s+="{",++r;t.push(n),n=s}else n+=s}return t.push(n),t},u.wrap=function(e,t){return t?1===t.length?"".concat(t).concat(e).concat(t):"".concat(t[0]).concat(e).concat(t[1]):e},u.stringify=function(e,t,n,r,s,i={}){const o=typeof e,a=r&&r.errors&&r.errors.wrap||{};let c=!1;if(l.isRef(e)&&e.render&&(c=e.in,e=e.resolve(t,n,r,s,Ne({in:e.in},i))),null===e)return"null";if("string"===o)return u.wrap(e,i.arrayItems&&a.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,r);if(e instanceof Map){const t=[];for(const[n,r]of e.entries())t.push("".concat(n.toString()," -> ").concat(r.toString()));e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const o of e)d.push(u.stringify(o,t,n,r,s,Ne({arrayItems:!0},i)));return u.wrap(d.join(", "),!c&&a.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,n)=>e?t:n,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,n,r,s,i]=this,o=i.messages;if(!o)return"";const a=c.template(t,o[0],e,n,r)||c.template(t,o[1],e,n,r);return a?a.render(t,n,r,s,i):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,n)=>{const r=n(375),s=n(1687),i=n(8068),o=n(8160),a=n(3292),c=n(6354),l=n(6133),u={};e.exports=i.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:n,error:r,state:i,prefs:o}=t;if(n._flags.match){const t=[],a=[];for(let r=0;r<n.$_terms.matches.length;++r){const s=n.$_terms.matches[r],c=i.nest(s.schema,"match.".concat(r));c.snapshot();const l=s.schema.$_validate(e,c,o);l.errors?(a.push(l.errors),c.restore()):(t.push(l.value),c.commit())}if(0===t.length)return{errors:r("alternatives.any",{details:a.map(e=>c.details(e,{override:!1}))})};if("one"===n._flags.match)return 1===t.length?{value:t[0]}:{errors:r("alternatives.one")};if(t.length!==n.$_terms.matches.length)return{errors:r("alternatives.all",{details:a.map(e=>c.details(e,{override:!1}))})};const l=e=>e.$_terms.matches.some(e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema));return l(n)?{value:t.reduce((e,t)=>s(e,t,{mergeArrays:!1}))}:{value:t[t.length-1]}}const a=[];for(let t=0;t<n.$_terms.matches.length;++t){const r=n.$_terms.matches[t];if(r.schema){const n=i.nest(r.schema,"match.".concat(t));n.snapshot();const s=r.schema.$_validate(e,n,o);if(!s.errors)return n.commit(),s;n.restore(),a.push({schema:r.schema,reports:s.errors});continue}const s=r.ref?r.ref.resolve(e,i,o):e,c=r.is?[r]:r.switch;for(let n=0;n<c.length;++n){const a=c[n],{is:l,then:u,otherwise:d}=a,p="match.".concat(t).concat(r.switch?"."+n:"");if(l.$_match(s,i.nest(l,"".concat(p,".is")),o)){if(u)return u.$_validate(e,i.nest(u,"".concat(p,".then")),o)}else if(d)return d.$_validate(e,i.nest(d,"".concat(p,".otherwise")),o)}}return u.errors(a,t)},rules:{conditional:{method(e,t){r(!this._flags._endedSwitch,"Unreachable condition"),r(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),r(void 0===t.break,"Cannot use break option with alternatives conditional");const n=this.clone(),s=a.when(n,e,t),i=s.is?[s]:s.switch;for(const e of i)if(e.then&&e.otherwise){n.$_setFlag("_endedSwitch",!0,{clone:!1});break}return n.$_terms.matches.push(s),n.$_mutateRebuild()}},match:{method(e){if(r(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)r(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(...e){r(e.length,"Missing alternative schemas"),o.verifyFlat(e,"try"),r(!this._flags._endedSwitch,"Unreachable condition");const t=this.clone();for(const n of e)t.$_terms.matches.push({schema:t.$_compile(n)});return t.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,n)=>"is"!==n.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const n of t.matches){const{schema:t,ref:r,is:s,not:i,then:o,otherwise:a}=n;e=t?e.try(t):r?e.conditional(r,{is:s,then:o,not:i,otherwise:a,switch:n.switch}):e.conditional(s,{then:o,otherwise:a})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:n}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const r=new Set,s=[];for(const{reports:i,schema:o}of e){if(i.length>1)return u.unmatched(e,t);const a=i[0];if(a instanceof c.Report==0)return u.unmatched(e,t);if(a.state.path.length!==n.path.length){s.push({type:o.type,report:a});continue}if("any.only"===a.code){for(const e of a.local.valids)r.add(e);continue}const[l,d]=a.code.split(".");"base"!==d?s.push({type:o.type,report:a}):"object.base"===a.code?r.add(a.local.type):r.add(l)}return s.length?1===s.length?{errors:s[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...r]})}},u.unmatched=function(e,t){const n=[];for(const t of e)n.push(...t.reports);return{errors:t("alternatives.match",c.details(n,{override:!1}))}}},8068:(e,t,n)=>{const r=n(375),s=n(7629),i=n(8160),o=n(6914);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:n}){try{return n(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){r(i.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return r(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:n,local:r})=>t.error(n,r),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=o.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const n in t){const r=t[n];if(["examples","externals","metas","notes","tags"].includes(n))for(const t of r)e=e[n.slice(0,-1)](t);else if("alterations"!==n)if("whens"!==n){if("shared"===n)for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:n,is:r,not:s,then:i,otherwise:o,concat:a}=t;e=a?e.concat(a):n?e.when(n,{is:r,not:s,then:i,otherwise:o,switch:t.switch,break:t.break}):e.when(r,{then:i,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:n}of r)t[e]=n;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,n)=>{const r=n(375),s=n(9474),i=n(9621),o=n(8068),a=n(8160),c=n(3292),l={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:n,prefs:r}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,n,r):void 0}},validate(e,{schema:t,error:n}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[a.symbols.arraySingle]=!0,{value:t}}return{errors:n("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:n,error:r},{schema:s}){const i=[e,...t.ancestors];for(let r=0;r<e.length;++r){const o=t.localize([...t.path,r],i,s);if(s.$_match(e[r],o,n))return e}const o=s._flags.label;return o?r("array.hasKnown",{patternLabel:o}):r("array.hasUnknown",null)},multi:!0},items:{method(...e){a.verifyFlat(e,"items");const t=this.$_addRule("items");for(let n=0;n<e.length;++n){const r=a.tryWithPath(()=>this.$_compile(e[n]),n,{append:!0});t.$_terms.items.push(r)}return t.$_mutateRebuild()},validate(e,{schema:t,error:n,state:r,prefs:s,errorsArray:i}){const o=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...o],d=!e[a.symbols.arraySingle];delete e[a.symbols.arraySingle];const p=i();let f=e.length;for(let i=0;i<f;++i){const a=e[i];let h=!1,m=!1;const g=d?i:new Number(i),y=[...r.path,g];if(!t._flags.sparse&&void 0===a){if(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly)return p;c.shift();continue}const v=[e,...r.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(a,r.localize(y,v,e),s,{presence:"ignore"})){if(p.push(n("array.excludes",{pos:i,value:a},r.localize(y))),s.abortEarly)return p;h=!0,c.shift();break}if(h)continue;if(t.$_terms.ordered.length){if(c.length){const o=c.shift(),u=o.$_validate(a,r.localize(y,v,o),s);if(u.errors){if(p.push(...u.errors),s.abortEarly)return p}else if("strip"===o._flags.result)l.fastSplice(e,i),--i,--f;else{if(!t._flags.sparse&&void 0===u.value){if(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly)return p;continue}e[i]=u.value}continue}if(!t.$_terms.items.length){if(p.push(n("array.orderedLength",{pos:i,limit:t.$_terms.ordered.length})),s.abortEarly)return p;break}}const w=[];let _=o.length;for(let c=0;c<_;++c){const u=r.localize(y,v,o[c]);u.snapshot();const d=o[c].$_validate(a,u,s);if(w[c]=d,!d.errors){if(u.commit(),e[i]=d.value,m=!0,l.fastSplice(o,c),--c,--_,!t._flags.sparse&&void 0===d.value&&(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly))return p;break}u.restore()}if(m)continue;const R=s.stripUnknown&&!!s.stripUnknown.arrays||!1;_=u.length;for(const c of u){let u;const d=o.indexOf(c);if(-1!==d)u=w[d];else{const o=r.localize(y,v,c);if(o.snapshot(),u=c.$_validate(a,o,s),!u.errors){o.commit(),"strip"===c._flags.result?(l.fastSplice(e,i),--i,--f):t._flags.sparse||void 0!==u.value?e[i]=u.value:(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),h=!0),m=!0;break}o.restore()}if(1===_){if(R){l.fastSplice(e,i),--i,--f,m=!0;break}if(p.push(...u.errors),s.abortEarly)return p;h=!0;break}}if(!h&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m){if(R){l.fastSplice(e,i),--i,--f;continue}if(p.push(n("array.includes",{pos:i,value:a},r.localize(y))),s.abortEarly)return p}}return o.length&&l.fillMissedErrors(t,p,o,e,r,s),c.length&&(l.fillOrderedErrors(t,p,c,e,r,s),p.length||l.fillDefault(c,e,r,s)),p.length?p:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:r,operator:s,args:i})=>a.compare(e.length,n,s)?e:t.error("array."+r,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){a.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let n=0;n<e.length;++n){const r=a.tryWithPath(()=>this.$_compile(e[n]),n,{append:!0});l.validateSingle(r,t),t.$_mutateRegister(r),t.$_terms.ordered.push(r)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return r(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){a.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),r(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:n,prefs:r,schema:s},{options:i}){const{value:o,errors:a}=l.sort(s,e,i,n,r);if(a)return a;for(let n=0;n<e.length;++n)if(e[n]!==o[n])return t("array.sort",{order:i.order,by:i.by?i.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e,t={}){r(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),a.assertOptions(t,["ignoreUndefined","separator"]);const n={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const r=a.default(t.separator,".");n.path=r?e.split(r):[e]}else n.comparator=e;return this.$_addRule(n)},validate(e,{state:t,error:n,schema:o},{comparator:a,options:c},{comparator:l,path:u}){const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},p=l||s,f=c.ignoreUndefined;for(let s=0;s<e.length;++s){const o=u?i(e[s],u):e[s],c=l?d.custom:d[typeof o];if(r(c,"Failed to find unique map container for type",typeof o),c instanceof Map){const r=c.entries();let i;for(;!(i=r.next()).done;)if(p(i.value[0],o)){const r=t.localize([...t.path,s],[e,...t.ancestors]),o={pos:s,value:e[s],dupePos:i.value[1],dupeValue:e[i.value[1]]};return u&&(o.path=a),n("array.unique",o,r)}c.set(o,s)}else{if((!f||void 0!==o)&&void 0!==c[o]){const r={pos:s,value:e[s],dupePos:c[o],dupeValue:e[c[o]]};return u&&(r.path=a),n("array.unique",r,t.localize([...t.path,s],[e,...t.ancestors]))}c[o]=s}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,n,r,s,i){const o=[];let a=0;for(const e of n){const t=e._flags.label;t?o.push(t):++a}o.length?a?t.push(e.$_createError("array.includesRequiredBoth",r,{knownMisses:o,unknownMisses:a},s,i)):t.push(e.$_createError("array.includesRequiredKnowns",r,{knownMisses:o},s,i)):t.push(e.$_createError("array.includesRequiredUnknowns",r,{unknownMisses:a},s,i))},l.fillOrderedErrors=function(e,t,n,r,s,i){const o=[];for(const e of n)"required"===e._flags.presence&&o.push(e);o.length&&l.fillMissedErrors(e,t,o,r,s,i)},l.fillDefault=function(e,t,n,r){const s=[];let i=!0;for(let o=e.length-1;o>=0;--o){const a=e[o],c=[t,...n.ancestors],l=a.$_validate(void 0,n.localize(n.path,c,a),r).value;if(i){if(void 0===l)continue;i=!1}s.unshift(l)}s.length&&t.push(...s)},l.fastSplice=function(e,t){let n=t;for(;n<e.length;)e[n++]=e[n];--e.length},l.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(r(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},l.sort=function(e,t,n,r,s){const i="ascending"===n.order?1:-1,o=-1*i,a=i,c=(c,u)=>{let d=l.compare(c,u,o,a);if(null!==d||(n.by&&(c=n.by.resolve(c,r,s),u=n.by.resolve(u,r,s)),d=l.compare(c,u,o,a),null!==d))return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,r,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},r,s);return"number"===p?(c-u)*i:c<u?o:a};try{return{value:t.slice().sort(c)}}catch(e){return{errors:e}}},l.compare=function(e,t,n,r){return e===t?0:void 0===e?1:void 0===t?-1:null===e?r:null===t?n:null}},4937:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(2036),a={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const n=t._flags.sensitive?e:e.toLowerCase();e="true"===n||"false"!==n&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){i.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new o;for(let n=0;n<e.length;++n){const s=e[n];r(void 0!==s,"Cannot call truthy with undefined"),t.$_terms.truthy.add(s)}return t}},falsy:{method(...e){i.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new o;for(let n=0;n<e.length;++n){const s=e[n];r(void 0!==s,"Cannot call falsy with undefined"),t.$_terms.falsy.add(s)}return t}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:a.isBool,to:(e,t)=>e?1:0},string:{from:a.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(3328),a={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:a.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:n,prefs:r}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return r.convert&&s&&"string"==typeof e?{value:e,errors:n("date.format",{format:s})}:{value:e,errors:n("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:n},{name:r,operator:s,args:o}){const a="now"===n?Date.now():n.getTime();return i.compare(e.getTime(),a,s)?e:t.error("date."+r,{limit:o.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:a.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return r(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return r(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:a.isDate,to:(e,t)=>e.getTime()},string:{from:a.isDate,to:(e,{prefs:t})=>o.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),a.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e))||/^\s*$/.test(e))return null;if("iso"===t)return i.isIsoDate(e)?a.date(e.toString()):null;const n=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return a.date(1*e);if("unix"===t)return a.date(1e3*e);if("string"==typeof n)return null}return a.date(e)},a.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,n)=>{const r=n(375),s=n(7824);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return r(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:n})=>e.length===n?e:t.error("function.arity",{n:n})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return r(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:n})=>e.length>=n?e:t.error("function.minArity",{n:n})},maxArity:{method(e){return r(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:n})=>e.length<=n?e:t.error("function.maxArity",{n:n})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,n)=>{const r=n(978),s=n(375),i=n(8571),o=n(3652),a=n(8068),c=n(8160),l=n(3292),u=n(6354),d=n(6133),p=n(3328),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=a.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:n,state:r,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:n("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,s);const i=[];if(t.$_terms.renames&&!f.rename(t,e,r,s,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const o=new Set(Object.keys(e));if(t.$_terms.keys){const n=[e,...r.ancestors];for(const a of t.$_terms.keys){const t=a.key,c=e[t];o.delete(t);const l=r.localize([...r.path,t],n,a),u=a.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),i.push(...u.errors)}else"strip"===a.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(o.size||t._flags._hasPatternMatch){const n=f.unknown(t,e,o,i,r,s);if(n)return n}if(t.$_terms.dependencies)for(const n of t.$_terms.dependencies){if(null!==n.key&&!1===f.isPresent(n.options)(n.key.resolve(e,r,s,null,{shadow:!1})))continue;const o=f.dependencies[n.rel](t,n,e,r,s);if(o){const n=t.$_createError(o.code,e,o.context,r,s);if(s.abortEarly)return{value:e,errors:n};i.push(n)}}return{value:e,errors:i}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,n){p.isTemplate(e)||(e=l.ref(e)),s(void 0===n||"string"==typeof n,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const r=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:n}});return r.$_mutateRegister(e),r.$_mutateRegister(t),r},validate(e,{error:t,prefs:n,state:r},{subject:s,schema:i,message:o}){const a=s.resolve(e,r,n),c=d.isRef(s)?s.absolute(r):[];return i.$_match(a,r.localize(c,[e,...r.ancestors],i),n)?e:t("object.assert",{subject:s,message:o})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:n,name:r})=>e instanceof n?e:t.error("object.instance",{type:r,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter(t=>!e.hasOwnProperty(t.key)):new f.Keys;for(const n in e)c.tryWithPath(()=>t.$_terms.keys.push({key:n,schema:this.$_compile(e[n])}),n)}else t.$_terms.keys=new f.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:r,operator:s,args:i})=>c.compare(Object.keys(e).length,n,s)?e:t.error("object."+r,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,t,n={}){const r=e instanceof RegExp;r||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(n,["fallthrough","matches"]),r&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const o={[r?"regex":"schema"]:e,rule:t};return n.matches&&(o.matches=this.$_compile(n.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),i.$_mutateRegister(o.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),n.fallthrough&&(o.fallthrough=!0),i.$_terms.patterns.push(o),i.$_mutateRegister(t),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,n={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof p,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(n,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const t of i.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&i.$_mutateRegister(t),i.$_terms.renames.push({from:e,to:t,options:r(f.renameDefaults,n)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:n})=>!c.isSchema(e)||"any"!==n&&e.type!==n?t.error("object.schema",{type:n}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,n={}){return f.dependency(this,"with",e,t,n)}},without:{method(e,t,n={}){return f.dependency(this,"without",e,t,n)}},xor:{method(...e){return c.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new o.Sorter;for(const n of e.$_terms.keys)c.tryWithPath(()=>t.add(n,{after:n.schema.$_rootReferences(),group:n.key}),n.key);e.$_terms.keys=new f.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:n,key:r=null,peers:s,options:i}of t.dependencies)e=f.dependency(e,n,r,s,i);if(t.patterns)for(const{regex:n,schema:r,rule:s,fallthrough:i,matches:o}of t.patterns)e=e.pattern(n||r,s,{fallthrough:i,matches:o});if(t.renames)for(const{from:n,to:r,options:s}of t.renames)e=e.rename(n,r,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return i(e,{shallow:!0});const n=Object.create(Object.getPrototypeOf(e));return Object.assign(n,e),n}const n=function(...t){return e.apply(this,t)};return n.prototype=i(e.prototype),Object.defineProperty(n,"name",{value:e.name,writable:!1}),Object.defineProperty(n,"length",{value:e.length,writable:!1}),Object.assign(n,e),n},f.dependency=function(e,t,n,r,i){s(null===n||"string"==typeof n,t,"key must be a strings"),i||(i=r.length>1&&"object"==typeof r[r.length-1]?r.pop():{}),c.assertOptions(i,["separator","isPresent"]),r=[].concat(r);const o=c.default(i.separator,"."),a=[];for(const e of r)s("string"==typeof e,t,"peers must be strings"),a.push(l.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==n&&(n=l.ref(n,{separator:o,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new f.Dependency(t,n,a,r,i)),u},f.dependencies={and(e,t,n,r,s){const i=[],o=[],a=t.peers.length,c=f.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(n,r,s,null,{shadow:!1}))?i.push(e.key):o.push(e.key);if(i.length!==a&&o.length!==a)return{code:"object.and",context:{present:o,presentWithLabels:f.keysToLabels(e,o),missing:i,missingWithLabels:f.keysToLabels(e,i)}}},nand(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(i.length!==t.peers.length)return;const a=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:a,mainWithLabel:f.keysToLabels(e,a),peers:c,peersWithLabels:f.keysToLabels(e,c)}}},or(e,t,n,r,s){const i=f.isPresent(t.options);for(const e of t.peers)if(i(e.resolve(n,r,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(!i.length||1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.oxor",context:a}},with(e,t,n,r,s){const i=f.isPresent(t.options);for(const o of t.peers)if(!1===i(o.resolve(n,r,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},without(e,t,n,r,s){const i=f.isPresent(t.options);for(const o of t.peers)if(i(o.resolve(n,r,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},xor(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===i.length?{code:"object.missing",context:a}:(a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.xor",context:a})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map(t=>e.$_mapLabels(t)):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,n,r,s){const i={};for(const o of e.$_terms.renames){const a=[],c="string"!=typeof o.from;if(c)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined||e===o.to)continue;const n=o.from.exec(e);n&&a.push({from:e,to:o.to,match:n})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||a.push(o);for(const l of a){const a=l.from;let u=l.to;if(u instanceof p&&(u=u.render(t,n,r,l.match)),a!==u){if(!o.options.multiple&&i[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:a,to:u,pattern:c},n,r)),r.abortEarly)||Object.prototype.hasOwnProperty.call(t,u)&&!o.options.override&&!i[u]&&(s.push(e.$_createError("object.rename.override",t,{from:a,to:u,pattern:c},n,r)),r.abortEarly))return!1;void 0===t[a]?delete t[u]:t[u]=t[a],i[u]=!0,o.options.alias||delete t[a]}}}return!0},f.unknown=function(e,t,n,r,s,i){if(e.$_terms.patterns){let o=!1;const a=e.$_terms.patterns.map(e=>{if(e.matches)return o=!0,[]}),c=[t,...s.ancestors];for(const o of n){const l=t[o],u=[...s.path,o];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(o);if(s.mainstay.tracer.debug(s,"rule","pattern.".concat(d),e?"pass":"error"),!e)continue}else if(!p.schema.$_match(o,s.nest(p.schema,"pattern.".concat(d)),i))continue;n.delete(o);const f=s.localize(u,c,{schema:p.rule,key:o}),h=p.rule.$_validate(l,f,i);if(h.errors){if(i.abortEarly)return{value:t,errors:h.errors};r.push(...h.errors)}if(p.matches&&a[d].push(o),t[o]=h.value,!p.fallthrough)break}}if(o)for(let n=0;n<a.length;++n){const o=a[n];if(!o)continue;const l=e.$_terms.patterns[n].matches,d=s.localize(s.path,c,l),p=l.$_validate(o,d,i);if(p.errors){const n=u.details(p.errors,{override:!1});n.matches=o;const a=e.$_createError("object.pattern.match",t,n,s,i);if(i.abortEarly)return{value:t,errors:a};r.push(a)}}}if(n.size&&(e.$_terms.keys||e.$_terms.patterns)){if(i.stripUnknown&&void 0===e._flags.unknown||i.skipFunctions){const e=!(!i.stripUnknown||!0!==i.stripUnknown&&!i.stripUnknown.objects);for(const r of n)e?(delete t[r],n.delete(r)):"function"==typeof t[r]&&n.delete(r)}if(!c.default(e._flags.unknown,i.allowUnknown))for(const o of n){const n=s.localize([...s.path,o],[]),a=e.$_createError("object.unknown",t[o],{child:o},n,i,{flags:!1});if(i.abortEarly)return{value:t,errors:a};r.push(a)}}},f.Dependency=class{constructor(e,t,n,r,s){this.rel=e,this.key=t,this.peers=n,this.paths=r,this.options=s}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options=Me(Ne({},e.options),{separator:this.peers[0].separator})),this.options.isPresent&&(e.options=Me(Ne({},e.options),{isPresent:this.options.isPresent})),e}},f.Keys=class extends Array{concat(e){const t=this.slice(),n=new Map;for(let e=0;e<t.length;++e)n.set(t[e].key,e);for(const r of e){const e=r.key,s=n.get(e);void 0!==s?t[s]={key:e,schema:t[s].schema.concat(r.schema)}:t.push(r)}return t}}},8785:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(3292),a=n(6354),c={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:n,prefs:s}){r(t.$_terms.link,"Uninitialized link schema");const i=c.generate(t,e,n,s),o=t.$_terms.link[0].ref;return i.$_validate(e,n.nest(i,"link:".concat(o.display,":").concat(i.type)),s)},generate:(e,t,n,r)=>c.generate(e,t,n,r),rules:{ref:{method(e){r(!this.$_terms.link,"Cannot reinitialize schema"),e=o.ref(e),r("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),r("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){r(this.$_terms.link,"Uninitialized link schema"),r(i.isSchema(e),"Invalid schema object"),r("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(r(t.link,"Invalid link description missing link"),e.ref(t.link))}}),c.generate=function(e,t,n,r){let s=n.mainstay.links.get(e);if(s)return s._generate(t,n,r).schema;const i=e.$_terms.link[0].ref,{perspective:o,path:a}=c.perspective(i,n);c.assert(o,"which is outside of schema boundaries",i,e,n,r);try{s=a.length?o.$_reach(a):o}catch(t){c.assert(!1,"to non-existing schema",i,e,n,r)}return c.assert("link"!==s.type,"which is another link",i,e,n,r),e._flags.relative||n.mainstay.links.set(e,s),s._generate(t,n,r).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:n,key:r}of t.schemas){if((n._flags.id||r)===e.path[0])return{perspective:n,path:e.path.slice(1)};if(n.$_terms.shared)for(const t of n.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,n,s,i,o){e||r(!1,'"'.concat(a.label(s._flags,i,o),'" contains link reference "').concat(n.display,'" ').concat(t))}},3832:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),n=t.indexOf("."),r=t.indexOf("e");return(n<0?0:(r<0?t.length:r)-n-1)+(r<0?0:Math.max(0,-parseInt(t.slice(r+1))))}};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:n}){if(!e.match(o.numberRx))return;e=e.trim();const r={value:parseFloat(e)};if(0===r.value&&(r.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(o.extractSignificantDigits(e)!==o.extractSignificantDigits(String(r.value)))return r.errors=n("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==o.normalizeDecimal(e))return r.errors=n("number.unsafe"),r}return r}},validate(e,{schema:t,error:n,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:n("number.infinity")};if(!i.isNumber(e))return{value:e,errors:n("number.base")};const s={value:e};if(r.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(s.errors=n("number.unsafe")),s},rules:{compare:{method:!1,validate:(e,t,{limit:n},{name:r,operator:s,args:o})=>i.compare(e,n,s)?e:t.error("number."+r,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?o.decimalPlaces(e):null,n=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:n}})},validate:(e,t,{base:n,baseDecimalPlace:r,pfactor:s},i)=>o.decimalPlaces(e)>r?t.error("number.multiple",{multiple:i.args.base,value:e}):Math.round(s*e)%Math.round(s*n)==0?e:t.error("number.multiple",{multiple:i.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return r(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:n}){const r=e.toString().match(o.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=n?e:t.error("number.precision",{limit:n,value:e})},convert:!0},sign:{method(e){return r(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:n})=>"negative"===n&&e<0||"positive"===n&&e>0?e:t.error("number.".concat(n))},unsafe:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,n)=>{const r=n(7824);e.exports=r.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,n)=>{const r=n(375),s=n(5380),i=n(1745),o=n(9959),a=n(6064),c=n(9926),l=n(5752),u=n(8068),d=n(8160),p={tlds:c instanceof Set&&{tlds:{allow:c,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:n,prefs:r}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const n of t.$_terms.replacements)e=e.replace(n.pattern,n.replacement);const a=t.$_getRule("hex");if(a&&a.args.options.byteAligned&&e.length%2!=0&&(e="0".concat(e)),t.$_getRule("isoDate")){const t=p.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let i=s.args.limit;if(d.isResolvable(i)&&(i=i.resolve(e,n,r),!d.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},n,r)};e=e.slice(0,i)}}return{value:e}}},validate(e,{schema:t,error:n}){if("string"!=typeof e)return{value:e,errors:n("string.base")};if(""===e){const r=t.$_getRule("min");return r&&0===r.args.limit?void 0:{value:e,errors:n("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return d.assertOptions(e,["paddingRequired","urlSafe"]),e=Ne({urlSafe:!1,paddingRequired:!0},e),r("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),r("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:n})=>p.base64Regex[n.paddingRequired][n.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return r(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:n})=>"lower"===n&&e===e.toLocaleLowerCase()||"upper"===n&&e===e.toLocaleUpperCase()?e:t.error("string.".concat(n,"case")),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let n=e.length,r=0,s=1;for(;n--;){const t=e.charAt(n)*s;r+=t-9*(t>9),s^=3}return r>0&&r%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return d.assertOptions(e,["paddingRequired"]),e=Ne({paddingRequired:!0},e),r("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:n}){const r=e.match(p.dataUriRegex);return!r||r[2]&&"base64"===r[2]&&!p.base64Regex[n.paddingRequired].false.test(r[3])?t.error("string.dataUri"):e}},domain:{method(e){e&&d.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=p.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,n,{address:r})=>s.isValid(e,r)?e:t.error("string.domain")},email:{method(e={}){d.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),r(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=p.addressOptions(e),n=new RegExp("\\s*[".concat(e.separator?a(e.separator):",","]\\s*"));return this.$_addRule({name:"email",args:{options:e},regex:n,address:t})},validate(e,t,{options:n},{regex:r,address:s}){const o=n.multiple?e.split(r):[e],a=[];for(const e of o)i.isValid(e,s)||a.push(e);return a.length?t.error("string.email",{value:e,invalids:a}):e}},guid:{alias:"uuid",method(e={}){d.assertOptions(e,["version","separator"]);let t="";if(e.version){const n=[].concat(e.version);r(n.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;e<n.length;++e){const i=n[e];r("string"==typeof i,"version at position "+e+" must be a string");const o=p.guidVersions[i.toLowerCase()];r(o,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),r(!s.has(o),"version at position "+e+" must not be a duplicate"),t+=o,s.add(o)}}r(p.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const n=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":"\\".concat(e.separator),s=new RegExp("^([\\[{\\(]?)[0-9A-F]{8}(".concat(n,")[0-9A-F]{4}\\2?[").concat(t||"0-9A-F","][0-9A-F]{3}\\2?[").concat(t?"89AB":"0-9A-F","][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$"),"i");return this.$_addRule({name:"guid",args:{options:e},regex:s})},validate(e,t,n,{regex:r}){const s=r.exec(e);return s?p.guidBrackets[s[1]]!==s[s.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(e={}){return d.assertOptions(e,["byteAligned","prefix"]),e=Ne({byteAligned:!1,prefix:!1},e),r("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),r("boolean"==typeof e.prefix||"optional"===e.prefix,'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:e}})},validate:(e,t,{options:n})=>("optional"===n.prefix?p.hexRegex.withOptionalPrefix:!0===n.prefix?p.hexRegex.withPrefix:p.hexRegex.withoutPrefix).test(e)?n.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>s.isValid(e,{minDomainSegments:1})||p.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){d.assertOptions(e,["cidr","version"]);const{cidr:t,versions:n,regex:r}=o.regex(e),s=e.version?n:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:r})},validate:(e,t,{options:n},{regex:r})=>r.test(e)?e:n.version?t.error("string.ipVersion",{value:e,cidr:n.cidr,version:n.version}):t.error("string.ip",{value:e,cidr:n.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>p.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>p.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return p.length(this,"length",e,"=",t)},validate(e,t,{limit:n,encoding:r},{name:s,operator:i,args:o}){const a=!r&&e.length;return d.compare(a,n,i)?e:t.error("string."+s,{limit:o.limit,value:e,encoding:r})},args:[{name:"limit",ref:!0,assert:d.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return p.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return p.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return r(p.normalizationForms.includes(e),"normalization form must be one of "+p.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:n})=>e===e.normalize(n)?e:t("string.normalize",{value:e,form:n}),convert:!0},pattern:{alias:"regex",method(e,t={}){r(e instanceof RegExp,"regex must be a RegExp"),r(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),d.assertOptions(t,["invert","name"]);const n=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:n})},validate:(e,t,{regex:n,options:r},{errorCode:s})=>n.test(e)^r.invert?e:t.error(s,{name:r.name,regex:n,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(a(e),"g")),r(e instanceof RegExp,"pattern must be a RegExp"),r("string"==typeof t,"replacement must be a String");const n=this.clone();return n.$_terms.replacements||(n.$_terms.replacements=[]),n.$_terms.replacements.push({pattern:e,replacement:t}),n}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:n})=>n&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){d.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),e.domain&&d.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:n}=l.regex(e),r=e.domain?p.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:r,scheme:n})},validate(e,t,{options:n},{regex:r,domain:i,scheme:o}){if(["http:/","https:/"].includes(e))return t.error("string.uri");let a=r.exec(e);if(!a&&t.prefs.convert&&n.encodeUri){const t=encodeURI(e);a=r.exec(t),a&&(e=t)}if(a){const r=a[1]||a[2];return!i||n.allowRelative&&!r||s.isValid(r,i)?e:t.error("string.domain",{value:r})}return n.relativeOnly?t.error("string.uriRelativeOnly"):n.scheme?t.error("string.uriCustomScheme",{scheme:o,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:n,replacement:r}of t.replacements)e=e.replace(n,r);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),p.addressOptions=function(e){if(!e)return p.tlds||e;if(r(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),r(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return r(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.tlds);r("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),r(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),r(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),p.validateTlds(e.tlds.deny,"tlds.deny"),e;const n=e.tlds.allow;return n?!0===n?(r(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.tlds)):(Array.isArray(n)&&(e=Object.assign({},e,{tlds:{allow:new Set(n)}})),r(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),p.validateTlds(e.tlds.allow,"tlds.allow"),e):e},p.validateTlds=function(e,t){for(const n of e)r(s.isValid(n,{minDomainSegments:1,maxDomainSegments:1}),"".concat(t," must contain valid top level domain names"))},p.isoDate=function(e){if(!d.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},p.length=function(e,t,n,s,i){return r(!i||!1,"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:n,encoding:i},operator:s})}},8826:(e,t,n)=>{const r=n(375),s=n(8068),i={};i.Map=class extends Map{slice(){return new i.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new i.Map}},coerce:{method(e,{schema:t,error:n}){const r=t.$_terms.map.get(e);return r&&(e=r),t._flags.only&&"symbol"!=typeof e?{value:e,errors:n("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),r(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),n=[];for(const s of e){r(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,i]=s;r("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),r("symbol"==typeof i,"Value must be a Symbol"),t.$_terms.map.set(e,i),n.push(i)}return t.valid(...n)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,n)=>{const r=n(375),s=n(8571),i=n(738),o=n(9621),a=n(8160),c=n(6354),l=n(493),u={result:Symbol("result")};t.entry=function(e,t,n){let s=a.defaults;n&&(r(void 0===n.warnings,"Cannot override warnings preference in synchronous validation"),r(void 0===n.artifacts,"Cannot override artifacts preference in synchronous validation"),s=a.preferences(a.defaults,n));const i=u.entry(e,t,s);r(!i.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:i.value};return i.error&&(o.error=i.error),i.mainstay.warnings.length&&(o.warning=c.details(i.mainstay.warnings)),i.mainstay.debug&&(o.debug=i.mainstay.debug),i.mainstay.artifacts&&(o.artifacts=i.mainstay.artifacts),o},t.entryAsync=async function(e,t,n){let r=a.defaults;n&&(r=a.preferences(a.defaults,n));const s=u.entry(e,t,r),i=s.mainstay;if(s.error)throw i.debug&&(s.error.debug=i.debug),s.error;if(i.externals.length){let t=s.value;const l=[];for(const s of i.externals){const d=s.state.path,p="link"===s.schema.type?i.links.get(s.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?o(e,d):e;if(d.length){f=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);h=g[0],m=h[f]}try{const e=(e,t)=>(p||s.schema).$_createError(e,m,t,s.state,r),o=await s.method(m,{schema:s.schema,linked:p,state:s.state,prefs:n,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>i.warnings.push((p||s.schema).$_createError(e,m,t,s.state,r)),message:(e,t)=>(p||s.schema).$_createError("external",m,t,s.state,r,{messages:e})});if(void 0===o||o===m)continue;if(o instanceof c.Report){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(o),r.abortEarly)break;continue}if(Array.isArray(o)&&o[a.symbols.errors]){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(...o),r.abortEarly)break;continue}h?(i.tracer.value(s.state,"rule",m,o,"external"),h[f]=o):(i.tracer.value(s.state,"rule",t,o,"external"),t=o)}catch(e){throw r.errors.label&&(e.message+=" (".concat(s.label,")")),e}}if(s.value=t,l.length)throw s.error=c.process(l,e,r),i.debug&&(s.error.debug=i.debug),s.error}if(!r.warnings&&!r.debug&&!r.artifacts)return s.value;const l={value:s.value};return i.warnings.length&&(l.warning=c.details(i.warnings)),i.debug&&(l.debug=i.debug),i.artifacts&&(l.artifacts=i.artifacts),l},u.Mainstay=class{constructor(e,t,n){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=n,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,n,r){const{tracer:s,cleanup:i}=u.tracer(n,r),o=r.debug?[]:null,a=n._ids._schemaChain?new Map:null,d=new u.Mainstay(s,o,a),p=n._ids._schemaChain?[{schema:n}]:null,f=new l([],[],{mainstay:d,schemas:p}),h=t.validate(e,n,f,r);i&&n.$_root.untrace();const m=c.process(h.errors,e,r);return{value:h.value,error:m,mainstay:d}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(r(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,n,r,s={}){if(t.$_terms.whens&&(t=t._generate(e,n,r).schema),t._preferences&&(r=u.prefs(t,r)),t._cache&&r.cache){const r=t._cache.get(e);if(n.mainstay.tracer.debug(n,"validate","cached",!!r),r)return r}const i=(s,i,o)=>t.$_createError(s,e,i,o||n,r),o={original:e,prefs:r,schema:t,state:n,error:i,errorsArray:u.errorsArray,warn:(e,t,r)=>n.mainstay.warnings.push(i(e,t,r)),message:(s,i)=>t.$_createError("custom",e,i,n,r,{messages:s})};n.mainstay.tracer.entry(t,n);const c=t._definition;if(c.prepare&&void 0!==e&&r.convert){const t=c.prepare(e,o);if(t){if(n.mainstay.tracer.value(n,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(c.coerce&&void 0!==e&&r.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,o);if(t){if(n.mainstay.tracer.value(n,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}const l=t._flags.empty;l&&l.$_match(u.trim(e,t),n.nest(l),a.defaults)&&(n.mainstay.tracer.value(n,"empty",e,void 0),e=void 0);const d=s.presence||t._flags.presence||(t._flags._endedSwitch?null:r.presence);if(void 0===e){if("forbidden"===d)return u.finalize(e,null,o);if("required"===d)return u.finalize(e,[t.$_createError("any.required",e,null,n,r)],o);if("optional"===d){if(t._flags.default!==a.symbols.deepDefault)return u.finalize(e,null,o);n.mainstay.tracer.value(n,"default",e,{}),e={}}}else if("forbidden"===d)return u.finalize(e,[t.$_createError("any.unknown",e,null,n,r)],o);const p=[];if(t._valids){const s=t._valids.get(e,n,r,t._flags.insensitive);if(s)return r.convert&&(n.mainstay.tracer.value(n,"valids",e,s.value),e=s.value),n.mainstay.tracer.filter(t,n,"valid",s),u.finalize(e,null,o);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},n,r);if(r.abortEarly)return u.finalize(e,[s],o);p.push(s)}}if(t._invalids){const s=t._invalids.get(e,n,r,t._flags.insensitive);if(s){n.mainstay.tracer.filter(t,n,"invalid",s);const i=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},n,r);if(r.abortEarly)return u.finalize(e,[i],o);p.push(i)}}if(c.validate){const t=c.validate(e,o);if(t&&(n.mainstay.tracer.value(n,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),u.finalize(e,p,o);if(t.errors.length)return p.push(...t.errors),u.finalize(e,p,o)}}return t._rules.length?u.rules(e,p,o):u.finalize(e,p,o)},u.rules=function(e,t,n){const{schema:r,state:s,prefs:i}=n;for(const o of r._rules){const c=r._definition.rules[o.method];if(c.convert&&i.convert){s.mainstay.tracer.log(r,s,"rule",o.name,"full");continue}let l,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const n=c.argsByName.get(t),o=d[t].resolve(e,s,i),u=n.normalize?n.normalize(o):o,p=a.validateArg(u,null,n);if(p){l=r.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},s,i);break}d[t]=u}}l=l||c.validate(e,n,d,o);const p=u.rule(l,o);if(p.errors){if(s.mainstay.tracer.log(r,s,"rule",o.name,"error"),o.warn){s.mainstay.warnings.push(...p.errors);continue}if(i.abortEarly)return u.finalize(e,p.errors,n);t.push(...p.errors)}else s.mainstay.tracer.log(r,s,"rule",o.name,"pass"),s.mainstay.tracer.value(s,"rule",e,p.value,o.name),e=p.value}return u.finalize(e,t,n)},u.rule=function(e,t){return e instanceof c.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[a.symbols.errors]?(e.forEach(e=>u.error(e,t)),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,n){t=t||[];const{schema:s,state:i,prefs:o}=n;if(t.length){const r=u.default("failover",void 0,t,n);void 0!==r&&(i.mainstay.tracer.value(i,"failover",e,r),e=r,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)r(e instanceof Error||e instanceof c.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const r=u.default("default",e,t,n);i.mainstay.tracer.value(i,"default",e,r),e=r}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const r=t.to(e,n);i.mainstay.tracer.value(i,"cast",e,r,s._flags.cast),e=r}}if(s.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of s.$_terms.externals)i.mainstay.externals.push({method:e,schema:s,state:i,label:c.label(s._flags,i,o)});const a={value:e,errors:t.length?t:null};return s._flags.result&&(a.value="strip"===s._flags.result?void 0:n.original,i.mainstay.tracer.value(i,s._flags.result,e,a.value),i.shadow(e,s._flags.result)),s._cache&&!1!==o.cache&&!s._refs.length&&s._cache.set(n.original,a),void 0===e||a.errors||void 0===s._flags.artifact||(i.mainstay.artifacts=i.mainstay.artifacts||new Map,i.mainstay.artifacts.has(s._flags.artifact)||i.mainstay.artifacts.set(s._flags.artifact,[]),i.mainstay.artifacts.get(s._flags.artifact).push(i.path)),a},u.prefs=function(e,t){const n=t===a.defaults;return n&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),n&&(e._preferences[a.symbols.prefs]=t),t)},u.default=function(e,t,n,r){const{schema:i,state:o,prefs:c}=r,l=i._flags[e];if(c.noDefaults||void 0===l)return t;if(o.mainstay.tracer.log(i,o,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[s(o.ancestors[0]),r]:[];try{return l(...t)}catch(t){return void n.push(i.$_createError("any.".concat(e),null,{error:t},o,c))}}return"object"!=typeof l?l:l[a.symbols.literal]?l.literal:a.isResolvable(l)?l.resolve(t,o,c):s(l)},u.trim=function(e,t){if("string"!=typeof e)return e;const n=t.$_getRule("trim");return n&&n.args.enabled?e.trim():e},u.ignore={active:!1,debug:i,entry:i,filter:i,log:i,resolve:i,value:i},u.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}},2036:(e,t,n)=>{const r=n(375),s=n(9474),i=n(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){i.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,n){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const n of[...t._values,...t._refs])e.add(n)}if(n)for(const t of[...n._values,...n._refs])e.remove(t);return e.length?e:null}remove(e){i.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,n,r){return!!this.get(e,t,n,r)}get(e,t,n,r){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&r){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const i of this._refs){const o=i.resolve(e,t,n,null,{in:!0});if(void 0===o)continue;const a=i.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];for(const t of a)if(typeof t==typeof e)if(r&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:i}}else if(s(t,e))return{value:t,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){r(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[i.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const n of e)"string"==typeof n&&t.set(n.toLowerCase(),n);return t}},978:(e,t,n)=>{const r=n(375),s=n(8571),i=n(1687),o=n(9621),a={};e.exports=function(e,t,n={}){if(r(e&&"object"==typeof e,"Invalid defaults value: must be an object"),r(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),r("object"==typeof n,"Invalid options: must be an object"),!t)return null;if(n.shallow)return a.applyToDefaultsWithShallow(e,t,n);const o=s(e);if(!0===t)return o;const c=void 0!==n.nullOverride&&n.nullOverride;return i(o,t,{nullOverride:c,mergeArrays:!1})},a.applyToDefaultsWithShallow=function(e,t,n){const c=n.shallow;r(Array.isArray(c),"Invalid keys");const l=new Map,u=!0===t?null:new Set;for(let n of c){n=Array.isArray(n)?n:n.split(".");const r=o(e,n);r&&"object"==typeof r?l.set(r,u&&o(t,n)||r):u&&u.add(n)}const d=s(e,{},l);if(!u)return d;for(const e of u)a.reachCopy(d,t,e);const p=void 0!==n.nullOverride&&n.nullOverride;return i(d,t,{nullOverride:p,mergeArrays:!1})},a.reachCopy=function(e,t,n){for(const e of n){if(!(e in t))return;const n=t[e];if("object"!=typeof n||null===n)return;t=n}const r=t;let s=e;for(let e=0;e<n.length-1;++e){const t=n[e];"object"!=typeof s[t]&&(s[t]={}),s=s[t]}s[n[n.length-1]]=r}},375:(e,t,n)=>{const r=n(7916);e.exports=function(e,...t){if(!e)throw 1===t.length&&t[0]instanceof Error?t[0]:new r(t)}},8571:(e,t,n)=>{const r=n(9621),s=n(4277),i=n(7043),o={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=o.clone=function(e,t={},n=null){if("object"!=typeof e||null===e)return e;let r=o.clone,a=n;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);r=e=>e}else if(a){const t=a.get(e);if(t)return t}else a=new Map;const c=s.getInternalProto(e);if(c===s.buffer)return!1;if(c===s.date)return new Date(e.getTime());if(c===s.regex)return new RegExp(e);const l=o.base(e,c,t);if(l===e)return e;if(a&&a.set(e,l),c===s.set)for(const n of e)l.add(r(n,t,a));else if(c===s.map)for(const[n,s]of e)l.set(n,r(s,t,a));const u=i.keys(e,t);for(const n of u){if("__proto__"===n)continue;if(c===s.array&&"length"===n){l.length=e.length;continue}const i=Object.getOwnPropertyDescriptor(e,n);i?i.get||i.set?Object.defineProperty(l,n,i):i.enumerable?l[n]=r(e[n],t,a):Object.defineProperty(l,n,{enumerable:!1,writable:!0,configurable:!0,value:r(e[n],t,a)}):Object.defineProperty(l,n,{enumerable:!0,writable:!0,configurable:!0,value:r(e[n],t,a)})}return l},o.cloneWithShallow=function(e,t){const n=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of n){const n=r(e,t);"object"!=typeof n&&"function"!=typeof n||s.set(n,n)}return o.clone(e,t,s)},o.base=function(e,t,n){if(!1===n.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===s.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(t===s.array){const e=[];return r!==t&&Object.setPrototypeOf(e,r),e}if(o.needsProtoHack.has(t)){const e=new r.constructor;return r!==t&&Object.setPrototypeOf(e,r),e}return Object.create(r)}},9474:(e,t,n)=>{const r=n(4277),s={mismatched:null};e.exports=function(e,t,n){return n=Object.assign({prototype:!0},n),!!s.isDeepEqual(e,t,n,[])},s.isDeepEqual=function(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t||null===e||null===t)return!1;if("function"===o){if(!n.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const a=s.getSharedType(e,t,!!n.prototype);switch(a){case r.buffer:return!1;case r.promise:return e===t;case r.regex:return e.toString()===t.toString();case s.mismatched:return!1}for(let n=i.length-1;n>=0;--n)if(i[n].isSame(e,t))return!0;i.push(new s.SeenEntry(e,t));try{return!!s.isDeepEqualObj(a,e,t,n,i)}finally{i.pop()}},s.getSharedType=function(e,t,n){if(n)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?s.mismatched:r.getInternalProto(e);const i=r.getInternalProto(e);return i!==r.getInternalProto(t)?s.mismatched:i},s.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},s.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},s.isSetSimpleEqual=function(e,t){for(const n of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,n))return!1;return!0},s.isDeepEqualObj=function(e,t,n,i,o){const{isDeepEqual:a,valueOf:c,hasOwnEnumerableProperty:l}=s,{keys:u,getOwnPropertySymbols:d}=Object;if(e===r.array){if(!i.part){if(t.length!==n.length)return!1;for(let e=0;e<t.length;++e)if(!a(t[e],n[e],i,o))return!1;return!0}for(const e of t)for(const t of n)if(a(e,t,i,o))return!0}else if(e===r.set){if(t.size!==n.size)return!1;if(!s.isSetSimpleEqual(t,n)){const e=new Set(Set.prototype.values.call(n));for(const n of Set.prototype.values.call(t)){if(e.delete(n))continue;let t=!1;for(const r of e)if(a(n,r,i,o)){e.delete(r),t=!0;break}if(!t)return!1}}}else if(e===r.map){if(t.size!==n.size)return!1;for(const[e,r]of Map.prototype.entries.call(t))if(void 0===r&&!Map.prototype.has.call(n,e)||!a(r,Map.prototype.get.call(n,e),i,o))return!1}else if(e===r.error&&(t.name!==n.name||t.message!==n.message))return!1;const p=c(t),f=c(n);if((t!==p||n!==f)&&!a(p,f,i,o))return!1;const h=u(t);if(!i.part&&h.length!==u(n).length&&!i.skip)return!1;let m=0;for(const e of h)if(i.skip&&i.skip.includes(e))void 0===n[e]&&++m;else if(!l(n,e)||!a(t[e],n[e],i,o))return!1;if(!i.part&&h.length-m!==u(n).length)return!1;if(!1!==i.symbols){const e=d(t),r=new Set(d(n));for(const s of e){if(!i.skip||!i.skip.includes(s))if(l(t,s)){if(!l(n,s)||!a(t[s],n[s],i,o))return!1}else if(l(n,s))return!1;r.delete(s)}for(const e of r)if(l(n,e))return!1}return!0},s.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,n)=>{const r=n(8761);e.exports=class extends Error{constructor(e){super(e.filter(e=>""!==e).map(e=>"string"==typeof e?e:e instanceof Error?e.message:r(e)).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{const t={};e.exports=function(e){if(!e)return"";let n="";for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);t.isSafe(s)?n+=e[r]:n+=t.escapeHtmlChar(s)}return n},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":"&#x".concat(e.toString(16).padStart(2,"0"),";"))},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{e.exports=function(){}},1687:(e,t,n)=>{const r=n(375),s=n(8571),i=n(7043),o={};e.exports=o.merge=function(e,t,n){if(r(e&&"object"==typeof e,"Invalid target value: must be an object"),r(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(n=Object.assign({nullOverride:!0,mergeArrays:!0},n),Array.isArray(t)){r(Array.isArray(e),"Cannot merge array onto an object"),n.mergeArrays||(e.length=0);for(let r=0;r<t.length;++r)e.push(s(t[r],{symbols:n.symbols}));return e}const a=i.keys(t,n);for(let r=0;r<a.length;++r){const i=a[r];if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(t,i))continue;const c=t[i];if(c&&"object"==typeof c){if(e[i]===c)continue;!e[i]||"object"!=typeof e[i]||Array.isArray(e[i])!==Array.isArray(c)||c instanceof Date||c instanceof RegExp?e[i]=s(c,{symbols:n.symbols}):o.merge(e[i],c,n)}else(null!=c||n.nullOverride)&&(e[i]=c)}return e}},9621:(e,t,n)=>{const r=n(375),s={};e.exports=function(e,t,n){if(!1===t||null==t)return e;"string"==typeof(n=n||{})&&(n={separator:n});const i=Array.isArray(t);r(!i||!n.separator,"Separator option is not valid for array-based chain");const o=i?t:t.split(n.separator||".");let a=e;for(let e=0;e<o.length;++e){let i=o[e];const c=n.iterables&&s.iterables(a);if(Array.isArray(a)||"set"===c){const e=Number(i);Number.isInteger(e)&&(i=e<0?a.length+e:e)}if(!a||"function"==typeof a&&!1===n.functions||!c&&void 0===a[i]){r(!n.strict||e+1===o.length,"Missing segment",i,"in reach path ",t),r("object"==typeof a||!0===n.functions||"function"!=typeof a,"Invalid segment",i,"in reach path ",t),a=n.default;break}a=c?"set"===c?[...a][i]:a.get(i):a[i]}return a},s.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{const n={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},n.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const r=Object.prototype.toString.call(e);return n.typeMap.get(r)||t.generic}},7043:(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,n)=>{const r=n(375),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const n=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),i=t.group||"?",o=t.sort||0;r(!n.includes(i),"Item cannot come before itself: ".concat(i)),r(!n.includes("?"),"Item cannot come before unassociated items"),r(!s.includes(i),"Item cannot come after itself: ".concat(i)),r(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:o,before:n,after:s,group:i,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();r(e,"item","?"!==i?"added into group ".concat(i):"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return r(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return r(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),n=Object.create(null);for(const r of this._items){const s=r.seq,i=r.group;n[i]=n[i]||[],n[i].push(s),e[s]=r.before;for(const e of r.after)t[e]=t[e]||[],t[e].push(s)}for(const t in e){const r=[];for(const s in e[t]){const i=e[t][s];n[i]=n[i]||[],r.push(...n[i])}e[t]=r}for(const r in t)if(n[r])for(const s of n[r])e[s].push(...t[r]);const r={};for(const t in e){const n=e[t];for(const e of n)r[e]=r[e]||[],r[e].push(t)}const s={},i=[];for(let e=0;e<this._items.length;++e){let t=e;if(r[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===s[e])continue;r[e]||(r[e]=[]);const n=r[e].length;let i=0;for(let t=0;t<n;++t)s[r[e][t]]&&++i;if(i===n){t=e;break}}}null!==t&&(s[t]=!0,i.push(t))}if(i.length!==this._items.length)return!1;const o={};for(const e of this._items)o[e.seq]=e;this._items=[],this.nodes=[];for(const e of i){const t=o[e];this.nodes.push(t.node),this._items.push(t)}return!0}},s.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,n)=>{const r=n(443),s=n(2178),i={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:r.URL||URL};t.analyze=function(e,t={}){if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(i.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(i.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=i.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const n=t.minDomainSegments||i.minDomainSegments,r=e.split(".");if(r.length<n)return s.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&r.length>t.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=r[r.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<r.length;++e){const t=r[e];if(!t.length)return s.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return s.code("DOMAIN_LONG_SEGMENT");if(e<r.length-1){if(!i.domainSegmentRx.test(t))return s.code("DOMAIN_INVALID_CHARS")}else if(!i.tldSegmentRx.test(t))return s.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,n){return!t.analyze(e,n)},i.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new i.URL("http://".concat(e)).host}catch(t){return e}}},1745:(e,t,n)=>{const r=n(9848),s=n(5380),i=n(2178),o={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(r.TextEncoder||TextEncoder)};t.analyze=function(e,t){return o.email(e,t)},t.isValid=function(e,t){return!o.email(e,t)},o.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return i.code("EMPTY_STRING");const n=!o.nonAsciiRx.test(e);if(!n){if(!1===t.allowUnicode)return i.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(2!==r.length)return r.length>2?i.code("MULTIPLE_AT_CHAR"):i.code("MISSING_AT_CHAR");const[a,c]=r;if(!a)return i.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return i.code("ADDRESS_TOO_LONG");if(o.encoder.encode(a).length>64)return i.code("LOCAL_TOO_LONG")}return o.local(a,n)||s.analyze(c,t)},o.local=function(e,t){const n=e.split(".");for(const e of n){if(!e.length)return i.code("EMPTY_LOCAL_SEGMENT");if(t){if(!o.atextRx.test(e))return i.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(o.atextRx.test(t))continue;const e=o.binary(t);if(!o.atomRx.test(e))return i.code("INVALID_LOCAL_CHARS")}}},o.binary=function(e){return Array.from(o.encoder.encode(e)).map(e=>String.fromCharCode(e)).join("")},o.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,o.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,n)=>{const r=n(375),s=n(5752);t.regex=function(e={}){r(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";r(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),r(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let n=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(n)||(n=[n]),r(n.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<n.length;++e)r("string"==typeof n[e],"options.version must only contain strings"),n[e]=n[e].toLowerCase(),r(["ipv4","ipv6","ipvfuture"].includes(n[e]),"options.version contains unknown version "+n[e]+" - must be one of ipv4, ipv6, ipvfuture");n=Array.from(new Set(n));const i="(?:".concat(n.map(e=>{if("forbidden"===t)return s.ip[e];const n="\\/".concat("ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr);return"required"===t?"".concat(s.ip[e]).concat(n):"".concat(s.ip[e],"(?:").concat(n,")?")}).join("|"),")"),o=new RegExp("^".concat(i,"$"));return{cidr:t,versions:n,regex:o,raw:i}}},5752:(e,t,n)=>{const r=n(375),s=n(6064),i={generate:function(){const e={},t="\\dA-Fa-f",n="["+t+"]",r="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",i="%"+t,o=r+i+s+":@",a="["+o+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=n+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,p="::(?:"+l+":){5}"+u,f="(?:"+l+")?::(?:"+l+":){4}"+u,h="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,g="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,y="(?:(?:"+l+":){0,4}"+l+")?::"+u,v="(?:(?:"+l+":){0,5}"+l+")?::"+l,w="(?:(?:"+l+":){0,6}"+l+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+p+"|"+f+"|"+h+"|"+m+"|"+g+"|"+y+"|"+v+"|"+w+")",e.ipvFuture="v"+n+"+\\.["+r+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+r+i+s+":]*",R="["+r+i+s+"]{1,255}",E="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+R+")",k="(?:"+_+"@)?"+E+"(?::\\d*)?",I="(?:"+_+"@)?("+E+")(?::\\d*)?",T=a+"*",A=a+"+",L="(?:\\/"+T+")*",O="\\/(?:"+A+L+")?",N=A+L,M="["+r+i+s+"@]+"+L,D="(?:\\/\\/\\/"+T+L+")";return e.hierPart="(?:(?:\\/\\/"+k+L+")|"+O+"|"+N+"|"+D+")",e.hierPartCapture="(?:(?:\\/\\/"+I+L+")|"+O+"|"+N+")",e.relativeRef="(?:(?:\\/\\/"+k+L+")|"+O+"|"+M+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+I+L+")|"+O+"|"+M+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",e}};i.rfc3986=i.generate(),t.ip={v4Cidr:i.rfc3986.ipv4Cidr,v6Cidr:i.rfc3986.ipv6Cidr,ipv4:i.rfc3986.ipv4address,ipv6:i.rfc3986.ipv6address,ipvfuture:i.rfc3986.ipvFuture},i.createRegex=function(e){const t=i.rfc3986,n="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",o=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return i.wrap(o+n);let a="";if(e.scheme){r(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const n=[].concat(e.scheme);r(n.length>=1,"scheme must have at least 1 scheme specified");const i=[];for(let e=0;e<n.length;++e){const o=n[e];r(o instanceof RegExp||"string"==typeof o,"scheme at position "+e+" must be a RegExp or String"),o instanceof RegExp?i.push(o.source.toString()):(r(t.schemeRegex.test(o),"scheme at position "+e+" must be a valid scheme"),i.push(s(o)))}a=i.join("|")}const c="(?:"+(a?"(?:"+a+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",l=e.allowRelative?"(?:"+c+"|"+o+")":c;return i.wrap(l+n,a)},i.wrap=function(e,t){return{raw:e="(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])".concat(e),regex:new RegExp("^".concat(e,"$")),scheme:t}},i.uriRegex=i.createRegex({}),t.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?i.createRegex(e):i.uriRegex}},1447:(e,t)=>{const n={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[n.settings]&&t.constants)for(const e in t.constants){const n=t.constants[e];if(null!==n&&!["boolean","number","string"].includes(typeof n))throw new Error("Formula constant ".concat(e," contains invalid ").concat(typeof n," value type"))}this.settings=t[n.settings]?t:Object.assign({[n.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let r=[],s="",i=0,o=!1;const a=e=>{if(i)throw new Error("Formula missing closing parenthesis");const a=r.length?r[r.length-1]:null;if(o||s||e){if(a&&"reference"===a.type&&")"===e)return a.type="function",a.value=this._subFormula(s,a.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);r.push({type:"segment",value:e})}else if(o){if("]"===o)return r.push({type:"reference",value:s}),void(s="");r.push({type:"literal",value:s})}else if(n.operatorCharacters.includes(s))a&&"operator"===a.type&&n.operators.includes(a.value+s)?a.value+=s:r.push({type:"operator",value:s});else if(s.match(n.numberRx))r.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])r.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(n.tokenRx))throw new Error("Formula contains invalid token: ".concat(s));r.push({type:"reference",value:s})}s=""}};for(const t of e)o?t===o?(a(),o=!1):s+=t:i?"("===t?(s+=t,++i):")"===t?(--i,i?s+=t:a(t)):s+=t:t in n.literals?o=n.literals[t]:"("===t?(a(),++i):n.operatorCharacters.includes(t)?(a(),s=t,a()):" "!==t?s+=t:a();a(),r=r.map((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==r[t-1].type?e:{type:"operator",value:"n"});let c=!1;for(const e of r){if("operator"===e.type){if(n.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!n.operators.includes(e.value))throw new Error("Formula contains an unknown operator ".concat(e.value))}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===r.length&&["reference","literal","constant"].includes(r[0].type)&&(this.single={type:"reference"===r[0].type?"reference":"value",value:r[0].value}),this._parts=r.map(e=>{if("operator"===e.type)return n.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error("Formula contains invalid reference ".concat(e.value));return this.settings.reference?this.settings.reference(e.value):n.reference(e.value)})}_subFormula(e,r){const s=this.settings.functions[r];if("function"!=typeof s)throw new Error("Formula contains unknown function ".concat(r));let i=[];if(e){let t="",s=0,o=!1;const a=()=>{if(!t)throw new Error("Formula contains function ".concat(r," with invalid arguments ").concat(e));i.push(t),t=""};for(let r=0;r<e.length;++r){const i=e[r];o?(t+=i,i===o&&(o=!1)):i in n.literals&&!s?(t+=i,o=n.literals[i]):","!==i||s?(t+=i,"("===i?++s:")"===i&&--s):a()}a()}return i=i.map(e=>new t.Parser(e,this.settings)),function(e){const t=[];for(const n of i)t.push(n.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let r=t.length-2;r>=0;--r){const s=t[r];if(s&&"operator"===s.type){const i=t[r+1];t.splice(r+1,1);const o=n.evaluate(i,e);t[r]=n.single(s.value,o)}}return n.operatorsOrder.forEach(r=>{for(let s=1;s<t.length-1;)if(r.includes(t[s])){const r=t[s],i=n.evaluate(t[s-1],e),o=n.evaluate(t[s+1],e);t.splice(s,2);const a=n.calculate(r,i,o);t[s-1]=0===a?0:a}else s+=2}),n.evaluate(t[0],e)}},t.Parser.prototype[n.symbol]=!0,n.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},n.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[n.symbol]?e.evaluate(t):e},n.single=function(e,t){if("!"===e)return!t;const n=-t;return 0===n?0:n},n.calculate=function(e,t,r){if("??"===e)return n.exists(t)?t:r;if("string"==typeof t||"string"==typeof r){if("+"===e)return(t=n.exists(t)?t:"")+(n.exists(r)?r:"")}else switch(e){case"^":return Math.pow(t,r);case"*":return t*r;case"/":return t/r;case"%":return t%r;case"+":return t+r;case"-":return t-r}switch(e){case"<":return t<r;case"<=":return t<=r;case">":return t>r;case">=":return t>=r;case"==":return t===r;case"!=":return t!==r;case"&&":return t&&r;case"||":return t||r}return null},n.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{e.exports=JSON.parse('{"version":"17.13.3"}')}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}(5107);var e,t})}(yi);class bi extends jt{constructor(e,t,n,r){if(super(),vi=n,!t)throw vi.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new tt,this.signaling=null,this.autoReconnect=r,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.isReconnecting=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;vi.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null==(e=this.signaling)||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new tt}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return vi.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Fs,()=>{(this.firstReconnection||!this.alreadyDisconnected)&&(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(Ss.connectionStateChange,e=>{ct(e),"connected"===e&&at(new Date),("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}async reconnect(e){try{vi.info("Attempting to reconnect..."),!this.isActive()&&!this.stopReconnection&&!this.isReconnecting&&(this.stop(),this.emit("reconnect",{timeout:wi(this.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),this.isReconnecting=!0,await this.connect(this.options),this.alreadyDisconnected=!1,this.reconnectionInterval=1e3,this.firstReconnection=!0,this.isReconnecting=!1)}catch(e){this.isReconnecting=!1,this.reconnectionInterval=wi(this.reconnectionInterval),vi.error("Reconnection failed, retrying in ".concat(this.reconnectionInterval,"ms. "),e),setTimeout(()=>this.reconnect({error:e}),this.reconnectionInterval)}}}const wi=e=>e<32e3?2*e:e,Si=window.RTCRtpSender&&!!RTCRtpSender.prototype.createEncodedStreams&&window.RTCRtpReceiver&&!!RTCRtpReceiver.prototype.createEncodedStreams,_i="RTCRtpScriptTransform"in window,Ri="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBGPXR5cGVvZiBnbG9iYWxUaGlzPCJ1Ij9nbG9iYWxUaGlzOnR5cGVvZiB3aW5kb3c8InUiP3dpbmRvdzp0eXBlb2YgZ2xvYmFsPCJ1Ij9nbG9iYWw6dHlwZW9mIHNlbGY8InUiP3NlbGY6e307ZnVuY3Rpb24gVyhuKXtyZXR1cm4gbiYmbi5fX2VzTW9kdWxlJiZPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwiZGVmYXVsdCIpP24uZGVmYXVsdDpufXZhciBCPXtleHBvcnRzOnt9fTsvKiEKICoganMtbG9nZ2VyIC0gaHR0cDovL2dpdGh1Yi5jb20vam9ubnlyZWV2ZXMvanMtbG9nZ2VyCiAqIEpvbm55IFJlZXZlcywgaHR0cDovL2pvbm55cmVldmVzLmNvLnVrLwogKiBqcy1sb2dnZXIgbWF5IGJlIGZyZWVseSBkaXN0cmlidXRlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UuCiAqLyhmdW5jdGlvbihuKXsoZnVuY3Rpb24odCl7dmFyIGU9e307ZS5WRVJTSU9OPSIxLjYuMSI7dmFyIHMscj17fSxvPWZ1bmN0aW9uKGksdSl7cmV0dXJuIGZ1bmN0aW9uKCl7cmV0dXJuIHUuYXBwbHkoaSxhcmd1bWVudHMpfX0sYT1mdW5jdGlvbigpe3ZhciBpPWFyZ3VtZW50cyx1PWlbMF0saCxjO2ZvcihjPTE7YzxpLmxlbmd0aDtjKyspZm9yKGggaW4gaVtjXSkhKGggaW4gdSkmJmlbY10uaGFzT3duUHJvcGVydHkoaCkmJih1W2hdPWlbY11baF0pO3JldHVybiB1fSxkPWZ1bmN0aW9uKGksdSl7cmV0dXJue3ZhbHVlOmksbmFtZTp1fX07ZS5UUkFDRT1kKDEsIlRSQUNFIiksZS5ERUJVRz1kKDIsIkRFQlVHIiksZS5JTkZPPWQoMywiSU5GTyIpLGUuVElNRT1kKDQsIlRJTUUiKSxlLldBUk49ZCg1LCJXQVJOIiksZS5FUlJPUj1kKDgsIkVSUk9SIiksZS5PRkY9ZCg5OSwiT0ZGIik7dmFyIGw9ZnVuY3Rpb24oaSl7dGhpcy5jb250ZXh0PWksdGhpcy5zZXRMZXZlbChpLmZpbHRlckxldmVsKSx0aGlzLmxvZz10aGlzLmluZm99O2wucHJvdG90eXBlPXtzZXRMZXZlbDpmdW5jdGlvbihpKXtpJiYidmFsdWUiaW4gaSYmKHRoaXMuY29udGV4dC5maWx0ZXJMZXZlbD1pKX0sZ2V0TGV2ZWw6ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5jb250ZXh0LmZpbHRlckxldmVsfSxlbmFibGVkRm9yOmZ1bmN0aW9uKGkpe3ZhciB1PXRoaXMuY29udGV4dC5maWx0ZXJMZXZlbDtyZXR1cm4gaS52YWx1ZT49dS52YWx1ZX0sdHJhY2U6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLlRSQUNFLGFyZ3VtZW50cyl9LGRlYnVnOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5ERUJVRyxhcmd1bWVudHMpfSxpbmZvOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5JTkZPLGFyZ3VtZW50cyl9LHdhcm46ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLldBUk4sYXJndW1lbnRzKX0sZXJyb3I6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLkVSUk9SLGFyZ3VtZW50cyl9LHRpbWU6ZnVuY3Rpb24oaSl7dHlwZW9mIGk9PSJzdHJpbmciJiZpLmxlbmd0aD4wJiZ0aGlzLmludm9rZShlLlRJTUUsW2ksInN0YXJ0Il0pfSx0aW1lRW5kOmZ1bmN0aW9uKGkpe3R5cGVvZiBpPT0ic3RyaW5nIiYmaS5sZW5ndGg+MCYmdGhpcy5pbnZva2UoZS5USU1FLFtpLCJlbmQiXSl9LGludm9rZTpmdW5jdGlvbihpLHUpe3MmJnRoaXMuZW5hYmxlZEZvcihpKSYmcyh1LGEoe2xldmVsOml9LHRoaXMuY29udGV4dCkpfX07dmFyIGY9bmV3IGwoe2ZpbHRlckxldmVsOmUuT0ZGfSk7KGZ1bmN0aW9uKCl7dmFyIGk9ZTtpLmVuYWJsZWRGb3I9byhmLGYuZW5hYmxlZEZvciksaS50cmFjZT1vKGYsZi50cmFjZSksaS5kZWJ1Zz1vKGYsZi5kZWJ1ZyksaS50aW1lPW8oZixmLnRpbWUpLGkudGltZUVuZD1vKGYsZi50aW1lRW5kKSxpLmluZm89byhmLGYuaW5mbyksaS53YXJuPW8oZixmLndhcm4pLGkuZXJyb3I9byhmLGYuZXJyb3IpLGkubG9nPWkuaW5mb30pKCksZS5zZXRIYW5kbGVyPWZ1bmN0aW9uKGkpe3M9aX0sZS5zZXRMZXZlbD1mdW5jdGlvbihpKXtmLnNldExldmVsKGkpO2Zvcih2YXIgdSBpbiByKXIuaGFzT3duUHJvcGVydHkodSkmJnJbdV0uc2V0TGV2ZWwoaSl9LGUuZ2V0TGV2ZWw9ZnVuY3Rpb24oKXtyZXR1cm4gZi5nZXRMZXZlbCgpfSxlLmdldD1mdW5jdGlvbihpKXtyZXR1cm4gcltpXXx8KHJbaV09bmV3IGwoYSh7bmFtZTppfSxmLmNvbnRleHQpKSl9LGUuY3JlYXRlRGVmYXVsdEhhbmRsZXI9ZnVuY3Rpb24oaSl7aT1pfHx7fSxpLmZvcm1hdHRlcj1pLmZvcm1hdHRlcnx8ZnVuY3Rpb24ocCxfKXtfLm5hbWUmJnAudW5zaGlmdCgiWyIrXy5uYW1lKyJdIil9O3ZhciB1PXt9LGg9ZnVuY3Rpb24oYyxwKXtGdW5jdGlvbi5wcm90b3R5cGUuYXBwbHkuY2FsbChjLGNvbnNvbGUscCl9O3JldHVybiB0eXBlb2YgY29uc29sZT4idSI/ZnVuY3Rpb24oKXt9OmZ1bmN0aW9uKGMscCl7Yz1BcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChjKTt2YXIgXz1jb25zb2xlLmxvZyxnO3AubGV2ZWw9PT1lLlRJTUU/KGc9KHAubmFtZT8iWyIrcC5uYW1lKyJdICI6IiIpK2NbMF0sY1sxXT09PSJzdGFydCI/Y29uc29sZS50aW1lP2NvbnNvbGUudGltZShnKTp1W2ddPW5ldyBEYXRlKCkuZ2V0VGltZSgpOmNvbnNvbGUudGltZUVuZD9jb25zb2xlLnRpbWVFbmQoZyk6aChfLFtnKyI6ICIrKG5ldyBEYXRlKCkuZ2V0VGltZSgpLXVbZ10pKyJtcyJdKSk6KHAubGV2ZWw9PT1lLldBUk4mJmNvbnNvbGUud2Fybj9fPWNvbnNvbGUud2FybjpwLmxldmVsPT09ZS5FUlJPUiYmY29uc29sZS5lcnJvcj9fPWNvbnNvbGUuZXJyb3I6cC5sZXZlbD09PWUuSU5GTyYmY29uc29sZS5pbmZvP189Y29uc29sZS5pbmZvOnAubGV2ZWw9PT1lLkRFQlVHJiZjb25zb2xlLmRlYnVnP189Y29uc29sZS5kZWJ1ZzpwLmxldmVsPT09ZS5UUkFDRSYmY29uc29sZS50cmFjZSYmKF89Y29uc29sZS50cmFjZSksaS5mb3JtYXR0ZXIoYyxwKSxoKF8sYykpfX0sZS51c2VEZWZhdWx0cz1mdW5jdGlvbihpKXtlLnNldExldmVsKGkmJmkuZGVmYXVsdExldmVsfHxlLkRFQlVHKSxlLnNldEhhbmRsZXIoZS5jcmVhdGVEZWZhdWx0SGFuZGxlcihpKSl9LGUuc2V0RGVmYXVsdHM9ZS51c2VEZWZhdWx0cyxuLmV4cG9ydHM/bi5leHBvcnRzPWU6KGUuX3ByZXZMb2dnZXI9dC5Mb2dnZXIsZS5ub0NvbmZsaWN0PWZ1bmN0aW9uKCl7cmV0dXJuIHQuTG9nZ2VyPWUuX3ByZXZMb2dnZXIsZX0sdC5Mb2dnZXI9ZSl9KShGKX0pKEIpO3ZhciB6PUIuZXhwb3J0cyxEPVcoeik7Y2xhc3Mgd3tjb25zdHJ1Y3Rvcih0KXt0aGlzLmRhdGE9dCx0aGlzLmJpdE9mZnNldD0wfXJlYWRCaXRzKHQpe2lmKHRoaXMuYml0T2Zmc2V0K3Q+dGhpcy5kYXRhLmxlbmd0aCo4KXRocm93IG5ldyBFcnJvcigiQXR0ZW1wdGVkIHRvIHJlYWQgcGFzdCB0aGUgZW5kIG9mIHRoZSBiaXRzdHJlYW0iKTtsZXQgZT0wO2ZvcihsZXQgcz0wO3M8dDtzKyspe2NvbnN0IHI9TWF0aC5mbG9vcih0aGlzLmJpdE9mZnNldC84KSxvPTctdGhpcy5iaXRPZmZzZXQlOCxhPXRoaXMuZGF0YVtyXT4+byYxO2V8PWE8PHQtMS1zLHRoaXMuYml0T2Zmc2V0Kyt9cmV0dXJuIGV9c2tpcCh0KXt0aGlzLmJpdE9mZnNldCs9dH1yZWFkRXhwR29sb21iVW5zaWduZWQoKXtsZXQgdD0tMTtmb3IobGV0IGU9MDtlPT09MDt0KyspZT10aGlzLnJlYWRCaXRzKDEpO3JldHVybigxPDx0KS0xK3RoaXMucmVhZEJpdHModCl9cmVhZEV4cEdvbG9tYlNpZ25lZCgpe2NvbnN0IHQ9dGhpcy5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtyZXR1cm4gdCUyPT09MD8tKHQvMik6KHQrMSkvMn19Y29uc3QgbT17U0xJQ0VfTk9OX0lEUjoxLFNMSUNFX1BBUlRJVElPTl9BOjIsU0xJQ0VfSURSOjUsU0VJX0gyNjQ6NixTRUlfSDI2NV9QUkVGSVg6MzksU0VJX0gyNjVfU1VGRklYOjQwLFNQU19IMjY0OjcsU1BTX0gyNjU6MzMsUFBTX0gyNjQ6OCxQUFNfSDI2NTozNH0sUj17UElDX1RJTUlORzoxLFVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6NX0sRT17TEVHQUNZOjEsTkVXOjIsVElNRUNPREU6MyxPVEhFUjo0fSxqPSI2ZTljZmQyYS01OTA3LTQ5ZmYtYjM2My04OTc4YTZlODM0MGUiLHE9IjlhMjFmM2JlLTMxZjAtNGI3OC1iMGJlLWM3ZjdkYmI5NzI1MCIsTD0iZDQwZTM4ZWEtZDQxOS00YzYyLTk0ZWQtMjBhYzM3YjRlNGZhIjtjbGFzcyBWe2NvbnN0cnVjdG9yKHQ9IkgyNjQiKXt0aGlzLnNwcz1uZXcgTWFwLHRoaXMucHBzPW5ldyBNYXAsdGhpcy5hY3RpdmVTUFM9bnVsbCx0aGlzLmNvZGVjPXR9Y29sbGVjdFBQUyh0KXt0aGlzLmNvZGVjPT09IkgyNjQiP3RoaXMuY29sbGVjdEgyNjRQUFModCk6dGhpcy5jb2xsZWN0SDI2NVBQUyh0KX1jb2xsZWN0U1BTKHQpe3RoaXMuY29kZWM9PT0iSDI2NCI/dGhpcy5jb2xsZWN0SDI2NFNQUyh0KTp0aGlzLmNvbGxlY3RIMjY1U1BTKHQpfWNvbGxlY3RIMjY0U1BTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRCaXRzKDgpLHI9WzEwMCwxMTAsMTIyLDI0NCw0NCw4Myw4NiwxMTgsMTI4LDEzOCwxMzksMTM0LDEzNV07ZS5za2lwKDgpLGUuc2tpcCg4KTtjb25zdCBvPWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7aWYobz4zMXx8bzwwKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBzZXFfcGFyYW1ldGVyX3NldF9pZCIpO2lmKHIuaW5jbHVkZXMocykpe2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtpZihsPT09MyYmZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnNraXAoMSksZS5yZWFkQml0cygxKSl7Y29uc3QgaT1sIT09Mz84OjEyO2ZvcihsZXQgdT0wO3U8aTt1KyspaWYoZS5yZWFkQml0cygxKSl7Y29uc3QgaD11PDY/MTY6NjQ7bGV0IGM9OCxwPTg7Zm9yKGxldCBfPTA7XzxoO18rKyl7aWYocCE9PTApe2NvbnN0IGc9ZS5yZWFkRXhwR29sb21iU2lnbmVkKCk7cD0oYytnKzI1NiklMjU2fWM9cD09PTA/YzpwfX19fWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3QgYT1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKGE9PT0wKWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7ZWxzZSBpZihhPT09MSl7ZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpO2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtmb3IobGV0IGY9MDtmPGw7ZisrKWUucmVhZEV4cEdvbG9tYlNpZ25lZCgpfWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRCaXRzKDEpPT09MCYmZS5za2lwKDEpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSk7bGV0IGQ7aWYoZS5yZWFkQml0cygxKSl7bGV0IGY9ZnVuY3Rpb24oYyl7Y29uc3QgcD1jLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2Muc2tpcCg0KSxjLnNraXAoNCk7Zm9yKGxldCB4PTA7eDw9cDt4KyspYy5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxjLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGMuc2tpcCgxKTtjLnNraXAoNSk7Y29uc3QgXz1jLnJlYWRCaXRzKDUpLGc9Yy5yZWFkQml0cyg1KSxBPWMucmVhZEJpdHMoNSk7cmV0dXJue2NwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6XyxkcGJfb3V0cHV0X2RlbGF5X2xlbmd0aF9taW51czE6Zyx0aW1lX29mZnNldF9sZW5ndGg6QX19O2UucmVhZEJpdHMoMSkmJmUucmVhZEJpdHMoOCk9PT0yNTUmJihlLnNraXAoMTYpLGUuc2tpcCgxNikpLGUucmVhZEJpdHMoMSkmJmUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5za2lwKDMpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiZlLnNraXAoMjQpKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpKTtjb25zdCBsPWUucmVhZEJpdHMoMSk/e251bV91bml0c19pbl90aWNrOmUucmVhZEJpdHMoMzIpLHRpbWVfc2NhbGU6ZS5yZWFkQml0cygzMiksZml4ZWRfZnJhbWVfcmF0ZV9mbGFnOmUucmVhZEJpdHMoMSl9OnZvaWQgMCxpPWUucmVhZEJpdHMoMSk/ZihlKTp2b2lkIDAsdT1lLnJlYWRCaXRzKDEpP2YoZSk6dm9pZCAwOyhpfHx1KSYmZS5za2lwKDEpO2NvbnN0IGg9ZS5yZWFkQml0cygxKTtkPXt0aW1pbmdfaW5mbzpsLG5hbF9ocmRfcGFyYW1ldGVyczppLHZjbF9ocmRfcGFyYW1ldGVyczp1LHBpY19zdHJ1Y3RfcHJlc2VudF9mbGFnOmh9fXRoaXMuc3BzLnNldChvLHt2dWlfcGFyYW1ldGVyczpkfSl9Y29sbGVjdEgyNjVTUFModCl7fWNvbGxlY3RIMjY0UFBTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKHM+MjU1fHxzPDApdGhyb3cgbmV3IEVycm9yKCJJbnZhbGlkIHBpY19wYXJhbWV0ZXJfc2V0X2lkIik7Y29uc3Qgcj1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO3RoaXMucHBzLnNldChzLHtzZXFfcGFyYW1ldGVyX3NldF9pZDpyfSl9Y29sbGVjdEgyNjVQUFModCl7fWZpbmRBY3RpdmVTUFModCl7Y29uc3QgZT1uZXcgdyh0KTtlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3Qgcz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLHI9dGhpcy5wcHMuZ2V0KHMpO2lmKHIpe2NvbnN0IG89dGhpcy5zcHMuZ2V0KHIuc2VxX3BhcmFtZXRlcl9zZXRfaWQpO2lmKG8pe3RoaXMuYWN0aXZlU1BTPW87cmV0dXJufX10aHJvdyBuZXcgRXJyb3IoIkNhbm5vdCBmaW5kIHRoZSBhY3RpdmUgU1BTIil9fWNvbnN0IFM9bmV3IFY7ZnVuY3Rpb24gRyhuLHQpe2Zvcig7dDxuLmJ5dGVMZW5ndGgtNDspe2lmKG5bdF09PT0wJiZuW3QrMV09PT0wJiYoblt0KzJdPT09MXx8blt0KzJdPT09MCYmblt0KzNdPT09MSkpcmV0dXJuIHQ7dCs9MX1yZXR1cm4tMX1mdW5jdGlvbiBVKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkobi5ieXRlTGVuZ3RoKTtsZXQgZT0wLHM9MDtmb3IobGV0IHI9MjtyPG4uYnl0ZUxlbmd0aDtyKyspbltyXT09PTMmJm5bci0xXT09PTAmJm5bci0yXT09PTAmJih0LnNldChuLnN1YmFycmF5KHMsciksZSksZSs9ci1zLHM9cisxKTtyZXR1cm4gczxuLmJ5dGVMZW5ndGgmJnQuc2V0KG4uc3ViYXJyYXkocyksZSksdH1mdW5jdGlvbiBZKG4sdCl7bGV0IGU9MDtjb25zdCBzPXQ9PT0iSDI2NCI/MToyLHI9W107Zm9yKDtlPG4uYnl0ZUxlbmd0aC00Oyl7Y29uc3Qgbz1HKG4sZSk7aWYobz49ZSl7Y29uc3QgYT1uW28rMl09PT0xPzM6NCxkPUcobixvK2Ercyk7aWYoZD5vKXIucHVzaChuLnN1YmFycmF5KG8sZCkpLGU9ZDtlbHNle3IucHVzaChuLnN1YmFycmF5KG8pKTticmVha319ZWxzZSBicmVha31yZXR1cm4gcn1mdW5jdGlvbiBYKG4sdCl7bGV0IGU9ITA7cmV0dXJuIFkobix0KS5maWx0ZXIocz0+e2NvbnN0IHI9c1syXT09PTE/Mzo0LG89dD09PSJIMjY0Ij8xOjIsYT1zW3JdLGQ9dD09PSJIMjY0Ij9hJjMxOmE+PjEmNjM7aWYoZSlzd2l0Y2goZCl7Y2FzZSBtLlBQU19IMjY0OmNhc2UgbS5QUFNfSDI2NTpTLmNvbGxlY3RQUFMoVShzLnN1YmFycmF5KHIrbykpKTticmVhaztjYXNlIG0uU1BTX0gyNjQ6Y2FzZSBtLlNQU19IMjY1OlMuY29sbGVjdFNQUyhVKHMuc3ViYXJyYXkocitvKSkpO2JyZWFrO2Nhc2UgbS5TTElDRV9JRFI6Y2FzZSBtLlNMSUNFX05PTl9JRFI6Y2FzZSBtLlNMSUNFX1BBUlRJVElPTl9BOnRyeXtTLmZpbmRBY3RpdmVTUFMoVShzLnN1YmFycmF5KHIrbykpKSxlPSExfWNhdGNoKGwpe2NvbnNvbGUuaW5mbygiRmFpbGVkIHRvIGZpbmQgYWN0aXZlIFNQUy4gV2lsbCBub3QgYmUgYWJsZSB0byBleHRyYWN0IFBJQyB0aW1pbmcgbWV0YWRhdGEiKX1icmVha31yZXR1cm5bbS5TRUlfSDI2NCxtLlNFSV9IMjY1X1BSRUZJWCxtLlNFSV9IMjY1X1NVRkZJWF0uaW5jbHVkZXMoZCl9KX1mdW5jdGlvbiAkKG4pe2xldCB0PTAsZT0wO2Zvcig7bltlXT09PTI1NTspdCs9MjU1LGUrKzt0Kz1uW2VdLGUrKztsZXQgcz0wO2Zvcig7bltlXT09PTI1NTspcys9MjU1LGUrKztyZXR1cm4gcys9bltlXSxlKysse3R5cGU6dCxjb250ZW50Om4uc3ViYXJyYXkoZSxlK3MpfX1mdW5jdGlvbiBKKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkoVChxKSksZT1uZXcgVWludDhBcnJheShUKGopKSxzPW5ldyBVaW50OEFycmF5KFQoTCkpO3JldHVybiB0LmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5USU1FQ09ERTplLmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5MRUdBQ1k6cy5ldmVyeSgocixvKT0+cj09PW5bb10pP0UuTkVXOkUuT1RIRVJ9ZnVuY3Rpb24gSyhuLHQpe2xldCBlPTA7bi51dWlkPXQuc3ViYXJyYXkoZSxlKzE2KSxlKz0xNjtjb25zdCBzPUoobi51dWlkKSxyPXQuc3ViYXJyYXkoZSk7c3dpdGNoKHMpe2Nhc2UgRS5MRUdBQ1k6Y2FzZSBFLk9USEVSOm4udW5yZWdpc3RlcmVkPXI7YnJlYWs7Y2FzZSBFLlRJTUVDT0RFOm4udGltZWNvZGU9TyhyKTticmVhaztjYXNlIEUuTkVXOntsZXQgbz0wO2NvbnN0IGE9QyhEYXRlLm5vdygpKS5sZW5ndGgsZD1yLnN1YmFycmF5KG8sYSk7bys9YTtjb25zdCBsPXIuc3ViYXJyYXkobyk7bi50aW1lY29kZT1PKGQpLG4udW5yZWdpc3RlcmVkPWw7YnJlYWt9fX1mdW5jdGlvbiBPKG4pe2NvbnN0IHQ9bi5yZWR1Y2UoKG8sYSk9PihvPDxCaWdJbnQoOCkpK0JpZ0ludChhKSxCaWdJbnQoMCkpLGU9TnVtYmVyKHQpLHM9bmV3IERhdGUoZSk7cmV0dXJuIG5ldyBUZXh0RW5jb2RlcigpLmVuY29kZShzLnRvSVNPU3RyaW5nKCkpfWZ1bmN0aW9uIFoobix0KXt2YXIgZixpLHUsaCxjO2lmKCFTLmFjdGl2ZVNQUyl7Y29uc29sZS53YXJuKCJDYW5ub3QgZmluZCB0aGUgYWN0aXZlIFNQUyIpO3JldHVybn1jb25zdCBlPShmPVMuYWN0aXZlU1BTLnZ1aV9wYXJhbWV0ZXJzLm5hbF9ocmRfcGFyYW1ldGVycykhPW51bGw/ZjpTLmFjdGl2ZVNQUy52dWlfcGFyYW1ldGVycy52Y2xfaHJkX3BhcmFtZXRlcnMscz17Y3BiX2RwYl9kZWxheXNfcHJlc2VudF9mbGFnOmU/MTowLGNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6KGk9ZT09bnVsbD92b2lkIDA6ZS5jcGJfcmVtb3ZhbF9kZWxheV9sZW5ndGhfbWludXMxKSE9bnVsbD9pOjIzLGRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMToodT1lPT1udWxsP3ZvaWQgMDplLmRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMSkhPW51bGw/dToyMyx0aW1lX29mZnNldF9sZW5ndGg6ZT8oaD1lLnRpbWVfb2Zmc2V0X2xlbmd0aCkhPW51bGw/aDoyNDp2b2lkIDAscGljX3N0cnVjdF9wcmVzZW50X2ZsYWc6KGM9Uy5hY3RpdmVTUFMudnVpX3BhcmFtZXRlcnMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpIT1udWxsP2M6MH07aWYoIXMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpe2NvbnNvbGUud2FybigicGljX3N0cnVjdF9wcmVzZW50X2ZsYWcgaXMgbm90IHByZXNlbnQiKTtyZXR1cm59Y29uc3Qgcj1uZXcgdyh0KTtzLmNwYl9kcGJfZGVsYXlzX3ByZXNlbnRfZmxhZyYmKHIuc2tpcChzLmNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czErMSksci5za2lwKHMuZHBiX291dHB1dF9kZWxheV9sZW5ndGhfbWludXMxKzEpKTtjb25zdCBvPVsxLDEsMSwyLDIsMywzLDIsM10sYT1yLnJlYWRCaXRzKDQpO2lmKGE+PW8ubGVuZ3RoKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBwaWNfc3RydWN0Iik7Y29uc3QgZD1vW2FdLGw9W107Zm9yKGxldCBwPTA7cDxkO3ArKylpZihyLnJlYWRCaXRzKDEpKXtjb25zdCBnPXt9O3Iuc2tpcCgyKSxyLnNraXAoMSksci5za2lwKDUpO2NvbnN0IEE9ci5yZWFkQml0cygxKTtpZihyLnNraXAoMiksZy5uX2ZyYW1lcz1yLnJlYWRCaXRzKDgpLEE/KGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcubWludXRlc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcuaG91cnNfdmFsdWU9ci5yZWFkQml0cyg1KSk6ci5yZWFkQml0cygxKSYmKGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLHIucmVhZEJpdHMoMSkmJihnLm1pbnV0ZXNfdmFsdWU9ci5yZWFkQml0cyg2KSxyLnJlYWRCaXRzKDEpJiYoZy5ob3Vyc192YWx1ZT1yLnJlYWRCaXRzKDUpKSkpLHMudGltZV9vZmZzZXRfbGVuZ3RoKXRyeXtnLnRpbWVfb2Zmc2V0PXIucmVhZEJpdHMocy50aW1lX29mZnNldF9sZW5ndGgpfWNhdGNoKHgpe2NvbnNvbGUuZXJyb3IoIkZhaWxlZCB0byByZWFkIHRpbWVfb2Zmc2V0Iix4KSxnLnRpbWVfb2Zmc2V0PTB9ZWxzZSBnLnRpbWVfb2Zmc2V0PTA7bC5wdXNoKGcpfW4uc2VpUGljVGltaW5nVGltZUNvZGVBcnJheT1sfWZ1bmN0aW9uIFEobix0KXtpZih0IT09IkgyNjQiJiZ0IT09IkgyNjUiKXRocm93IG5ldyBFcnJvcigiVW5zdXBwb3J0ZWQgY29kZWMgIi5jb25jYXQodCkpO2NvbnN0IGU9e307cmV0dXJuIFMuY29kZWM9dCxYKG5ldyBVaW50OEFycmF5KG4uZGF0YSksdCkuZm9yRWFjaChzPT57Y29uc3Qgcj1zWzJdPT09MT8zOjQsbz10PT09IkgyNjQiPzE6MixhPVUocy5zdWJhcnJheShyK28pKSxkPSQoYSk7c3dpdGNoKGQudHlwZSl7Y2FzZSBSLlBJQ19USU1JTkc6WihlLGQuY29udGVudCk7YnJlYWs7Y2FzZSBSLlVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6SyhlLGQuY29udGVudCk7YnJlYWt9fSksZX1mdW5jdGlvbiBlZShuKXtyZXR1cm4vXlswLTlhLWZBLUZdezh9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezEyfSQvLnRlc3Qobil9ZnVuY3Rpb24gVChuKXtyZXR1cm4gbi5yZXBsYWNlKC8tL2csIiIpLm1hdGNoKC8uezEsMn0vZykubWFwKHQ9PnBhcnNlSW50KHQsMTYpKX1mdW5jdGlvbiB0ZShuLHQsZSl7Y29uc3Qgcz1uZXcgVWludDhBcnJheShUKG4pKSxyPUMoZSksbz1uZXcgVGV4dEVuY29kZXIoKS5lbmNvZGUoSlNPTi5zdHJpbmdpZnkodCkpLGE9bmV3IFVpbnQ4QXJyYXkocy5sZW5ndGgrci5sZW5ndGgrby5sZW5ndGgpO3JldHVybiBhLnNldChzKSxhLnNldChyLHMubGVuZ3RoKSxhLnNldChvLHIubGVuZ3RoK3MubGVuZ3RoKSxhfWZ1bmN0aW9uIG5lKG4pe2NvbnN0IHQ9W10sZT1NYXRoLmZsb29yKG4uYnl0ZUxlbmd0aC8yNTUpLHM9bi5ieXRlTGVuZ3RoJTI1NTtmb3IobGV0IHI9MDtyPGU7cisrKXQucHVzaCgyNTUpO3JldHVybiB0LnB1c2gocyksbmV3IFVpbnQ4QXJyYXkoWzUsLi4udF0pfWZ1bmN0aW9uIHJlKG4pe2NvbnN0IHQ9W107Zm9yKGxldCBlPTA7ZTxuLmJ5dGVMZW5ndGg7ZSsrKWUrMjxuLmJ5dGVMZW5ndGgmJlswLDEsMiwzXS5pbmNsdWRlcyhuW2UrMl0pJiZuW2VdPT09MCYmbltlKzFdPT09MD8odC5wdXNoKG5bZV0pLHQucHVzaChuW2UrMV0pLGUrPTIsdC5wdXNoKDMpKTp0LnB1c2gobltlXSk7cmV0dXJuIHQucHVzaCgxMjgpLG5ldyBVaW50OEFycmF5KHQpfWZ1bmN0aW9uIEMobil7Y29uc3QgdD1bXTtpZighaXNOYU4obikpe2NvbnN0IGU9QmlnSW50KG4pO2ZvcihsZXQgcz0wO3M8TWF0aC5jZWlsKE1hdGguZmxvb3IoTWF0aC5sb2cyKG5ldyBOdW1iZXIobikpKzEpLzgpO3MrKyl0LnVuc2hpZnQobmV3IE51bWJlcihlPj5CaWdJbnQoOCpzKSZCaWdJbnQoMjU1KSkpfXJldHVybiBuZXcgVWludDhBcnJheSh0KX1mdW5jdGlvbiBzZSh7dXVpZDpuLHBheWxvYWQ6dCx0aW1lY29kZTplfSl7Y29uc3Qgcz1bMCwwLDAsMV0scj1bMTAyXSxvPXRlKG4sdCxlKSxhPW5lKG8pLGQ9cmUobyksbD1uZXcgVWludDhBcnJheShzLmxlbmd0aCtyLmxlbmd0aCthLmxlbmd0aCtkLmxlbmd0aCk7cmV0dXJuIGwuc2V0KHMpLGwuc2V0KHIscy5sZW5ndGgpLGwuc2V0KGEscy5sZW5ndGgrci5sZW5ndGgpLGwuc2V0KGQscy5sZW5ndGgrci5sZW5ndGgrYS5sZW5ndGgpLGx9ZnVuY3Rpb24gaWUoe3V1aWQ6bixwYXlsb2FkOnQsdGltZWNvZGU6ZX0scyl7aWYobj09PSIifHx0PT09IiIpdGhyb3cgbmV3IEVycm9yKCJ1dWlkIGFuZCBwYXlsb2FkIGNhbm5vdCBiZSBlbXB0eSIpO2VlKG4pfHwoY29uc29sZS53YXJuKCJJbnZhbGlkIFVVSUQuIFVzaW5nIGRlZmF1bHQgVVVJRC4iKSxuPUwsZT1EYXRlLm5vdygpKTtjb25zdCByPXNlKHt1dWlkOm4scGF5bG9hZDp0LHRpbWVjb2RlOmV9KSxvPW5ldyBEYXRhVmlldyhzLmRhdGEpLGE9bmV3IEFycmF5QnVmZmVyKHMuZGF0YS5ieXRlTGVuZ3RoK3IuYnl0ZUxlbmd0aCksZD1uZXcgRGF0YVZpZXcoYSk7Zm9yKGxldCBsPTA7bDxzLmRhdGEuYnl0ZUxlbmd0aDtsKyspZC5zZXRVaW50OChsLG8uZ2V0VWludDgobCkpO2ZvcihsZXQgbD0wO2w8ci5ieXRlTGVuZ3RoO2wrKylkLnNldFVpbnQ4KHMuZGF0YS5ieXRlTGVuZ3RoK2wscltsXSk7cy5kYXRhPWF9RC5nZXQoIlRyYW5zZm9ybVdvcmtlciIpLnNldExldmVsKEQuREVCVUcpO2NvbnN0IG9lPTJlMyxiPVtdO2xldCB5PSIiLFA9e307Y29uc3Qgdj17fTtsZXQgST1bXTtmdW5jdGlvbiBIKG4pe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybSh0LGUpe3ZhciBzLHI7aWYodCBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCBvPSgocz1QW3QuZ2V0TWV0YWRhdGEoKS5wYXlsb2FkVHlwZV0pPT1udWxsP3ZvaWQgMDpzLnRvVXBwZXJDYXNlKCkpfHwoeT09bnVsbD92b2lkIDA6eS50b1VwcGVyQ2FzZSgpKTtpZihvPT09IkgyNjQiKXtjb25zdCBhPVEodCxvKTsoYS50aW1lY29kZXx8YS51bnJlZ2lzdGVyZWR8fCgocj1hLnNlaVBpY1RpbWluZ1RpbWVDb2RlQXJyYXkpPT1udWxsP3ZvaWQgMDpyLmxlbmd0aCk+MCkmJnNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJtZXRhZGF0YSIsbWlkOm4sbWV0YWRhdGE6YX0pfXNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJjb21wbGV0ZSIsZnJhbWU6e3R5cGU6dC50eXBlLHRpbWVzdGFtcDp0LnRpbWVzdGFtcCxkYXRhOnQuZGF0YX19KX1lLmVucXVldWUodCl9fSl9ZnVuY3Rpb24gTSgpe09iamVjdC5rZXlzKHYpLnNvcnQoKS5qb2luKCk9PT1JLnNvcnQoKS5qb2luKCkmJihiLnNoaWZ0KCksST1bXSl9ZnVuY3Rpb24gYWUobil7Y29uc3QgdD1uZXcgRGF0ZSgpLmdldFRpbWUoKTt2W25dPXQsT2JqZWN0LmtleXModikuZmlsdGVyKHM9PnQtdltzXT5vZSkuZm9yRWFjaChzPT57ZGVsZXRlIHZbc10sZGVsZXRlIElbc119KSxNKCl9ZnVuY3Rpb24gTigpe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybShuLHQpe2lmKG4gaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3Qgcz1uLmdldE1ldGFkYXRhKCkuc3luY2hyb25pemF0aW9uU291cmNlO2lmKGFlKHMpLCFJLmluY2x1ZGVzKHMpJiZiLmxlbmd0aCl0cnl7aWYoIS8oaDI2WzRdKS8udGVzdCh5KSl0aHJvdyBuZXcgRXJyb3IoIlNlbmRpbmcgbWV0YWRhdGEgaXMgbm90IHN1cHBvcnRlZCB3aXRoIGFueSBvdGhlciBjb2RlYyBvdGhlciB0aGFuIEguMjY0Iik7YlswXS51dWlkPT09TCYmKGJbMF0udGltZWNvZGU9RGF0ZS5ub3coKSksaWUoYlswXSxuKSxJLnB1c2gocyl9Y2F0Y2gocil7Y29uc29sZS5lcnJvcihyKX1maW5hbGx5e00oKX19dC5lbnF1ZXVlKG4pfX0pfWZ1bmN0aW9uIGsoe3JlYWRhYmxlOm4sd3JpdGFibGU6dH0sZSl7bi5waXBlVGhyb3VnaChlKS5waXBlVG8odCl9YWRkRXZlbnRMaXN0ZW5lcigicnRjdHJhbnNmb3JtIixuPT57bGV0IHQ7aWYobi50cmFuc2Zvcm1lci5vcHRpb25zLm5hbWU9PT0ic2VuZGVyVHJhbnNmb3JtIil5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlYyx0PU4oKTtlbHNlIGlmKG4udHJhbnNmb3JtZXIub3B0aW9ucy5uYW1lPT09InJlY2VpdmVyVHJhbnNmb3JtIilQPW4udHJhbnNmb3JtZXIub3B0aW9ucy5wYXlsb2FkVHlwZUNvZGVjfHx7fSx5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlY3x8IiIsdD1IKG4udHJhbnNmb3JtZXIub3B0aW9ucy5taWQpO2Vsc2UgcmV0dXJuO2sobi50cmFuc2Zvcm1lcix0KX0pLGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLG49Pntjb25zdHthY3Rpb246dH09bi5kYXRhO3N3aXRjaCh0KXtjYXNlImluc2VydGFibGUtc3RyZWFtcy1zZW5kZXIiOnk9bi5kYXRhLmNvZGVjLGsobi5kYXRhLE4oKSk7YnJlYWs7Y2FzZSJpbnNlcnRhYmxlLXN0cmVhbXMtcmVjZWl2ZXIiOlA9bi5kYXRhLnBheWxvYWRUeXBlQ29kZWN8fHt9LHk9bi5kYXRhLmNvZGVjfHwiIixrKG4uZGF0YSxIKG4uZGF0YS5taWQpKTticmVhaztjYXNlIm1ldGFkYXRhLXNlaS11c2VyLWRhdGEtdW5yZWdpc3RlcmVkIjpiLnB1c2goe3V1aWQ6bi5kYXRhLnV1aWQscGF5bG9hZDpuLmRhdGEucGF5bG9hZH0pO2JyZWFrfX0pfSkoKTsK",Ei=typeof self<"u"&&self.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(Ri)],{type:"text/javascript;charset=utf-8"});function ki(e){let t;try{if(t=Ei&&(self.URL||self.webkitURL).createObjectURL(Ei),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker("data:text/javascript;base64,"+Ri,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}function Ii(e){if(!e)return new Uint8Array;const t=e.length,n=new Uint8Array(t/2);for(let r=0;r<t;r+=2)n[r/2]=parseInt(e.substr(r,2),16);return n}function Ci(e,t,n){if(Object.prototype.hasOwnProperty.call(e,n)&&Object.prototype.hasOwnProperty.call(t,n)){const r=e[n];e[n]=t[n],t[n]=r}else console.error('One or both objects do not have the property "'.concat(n,'"'))}function xi(e,t,n,r){return new(n||(n=Promise))(function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((r=r.apply(e,t||[])).next())})}St.get("Publish");const Ti=Ai;function Ai(e,t){const n=Vi();return(Ai=function(e,t){return n[e-=257]})(e,t)}var Li;!function(){const e=Ai,t=Vi();for(;;)try{if(parseInt(e(266))/1*(-parseInt(e(261))/2)+parseInt(e(258))/3*(-parseInt(e(264))/4)+-parseInt(e(267))/5*(parseInt(e(274))/6)+parseInt(e(260))/7*(parseInt(e(268))/8)+parseInt(e(270))/9+-parseInt(e(277))/10+parseInt(e(263))/11==303379)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Pi=navigator&&navigator[Ti(276)]||"",Oi=navigator&&navigator.vendor||"",Ni=!(null==window||!window[Ti(273)]),Mi=Pi[Ti(278)](Ti(257)),Di=!Mi&&Oi[Ti(278)](Ti(259)),Fi=!Mi&&!Di&&Pi.includes(Ti(272)),Ui=!Mi&&!Di&&!Fi&&Pi[Ti(278)](Ti(275)),ji=(null===(Li=null==navigator?void 0:navigator[Ti(262)])||void 0===Li?void 0:Li[Ti(271)])||(null==navigator?void 0:navigator[Ti(271)])||"";function Vi(){const e=["2403660vsbxKa","includes","Firefox","653511krAkNS","Apple","63eEorAu","2iQvmqu","userAgentData","13393182jRLBxS","4fTXBZP","Win32","74923SyWRbn","1345hVdNEb","21688LwGppn","Windows","132498ZoOcLo","platform","Edg","RTCRtpScriptTransform","9372dNMWWf","Chrome","userAgent"];return(Vi=function(){return e})()}const Wi={supportsRtpScriptTransform:Ni,isFirefox:Mi,isSafari:Di,isEdge:Fi,isChrome:Ui,platform:ji,isWindows:ji===Ti(269)||ji===Ti(265)},Zi=Gi;function Gi(e,t){const n=zi();return(Gi=function(e,t){return n[e-=185]})(e,t)}!function(){const e=Gi,t=zi();for(;;)try{if(-parseInt(e(380))/1+-parseInt(e(354))/2+-parseInt(e(464))/3*(parseInt(e(486))/4)+-parseInt(e(253))/5+parseInt(e(377))/6+parseInt(e(321))/7*(-parseInt(e(285))/8)+-parseInt(e(444))/9*(-parseInt(e(279))/10)==657542)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Bi=Wi[Zi(496)];function Yi(e,t){const n=Zi;let r=new Uint8Array((0|e.byteLength)+(0|t[n(442)]));return r[n(311)](e,0),r[n(311)](t,0|e.byteLength),r}function zi(){const e=["[MSE] source buffer error","ManagedMediaSource","BYTES_PER_ELEMENT","types","ready","valid","Num frames in chunk: ","readBits","getTrackID","mvhd","parsePPS","encrypted","dependsOn","payload","len","moov","VMHD","mse","volume","h264","setUint16","tfdt","nextDts","avc1.","audioSampleAuxInfo","message","endMSE","width","hdlr","warn","traf","readBoolean","shift","mseReady","revokeObjectURL","smhd","dts","indexOf","<PROTECTINFO>","webkitsourceclose","onMSEClose","[H264Parser] IDR without SPS/PPS, not suitable for recovery",'VALUE="',"createObjectURL","</KID>","mdhd","SMHD","getFramePayload","tkhd","flush","clRtcDrmDebugLog","getBits","2598770DahMdb","dbgQueue","dispatch","DINF","http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader","isReady","sps","nalus","endOfStream","toString","UNKNOWN","Opus","minf","onError","stco","STSC","buffered","</KIDS>","initSegment","dinf","org.w3.clearkey","mp4track","keyFrame","units","mseEnded","videoSampleAuxInfo","41695210Plpuuo","splice","ended","bitLength","seq","url","8YyaFaO","com.apple.fps","[MSE] error: ","bitsAvailable","</WRMHEADER>","trex","setData","buffer error","slice","length","readUByte","mp4a","Unsupported DRM type ","mdia","fromCharCode",'<WRMHEADER xmlns="',"index","string","both","NDR","dOps","cenc","getPayload","bind","PPS","sourceBuffer","set","Checking codec","releaseBuffer","tenc","trak","flags",'/mp4; codecs="',"[H264Parser] Both IDR and non-IDR VCL NALUs found in the same frame","clRtcDrmCreateMediaDump","STSD","6352549TgZLxu","initBrowser","IDR","trun"," - ","start","mediaSource","startsWith","stype","readSPS","addEventListener","schi","encv","createElement","getVideoFrames","onReady","href","sourceopen","setUint32","vmhd","FTYP","schm","getData","toISOString","remuxer","track","skipScalingList","STSZ","getSize","addSourceBuffer","[MSE] buffer error:","appendBufferError","off","2392886zJoPkf","destroy","sdtp","audiosamplerate",": NRI: ","reportDiscontinuity","extractNALUs","No A/V data","pps","senc","saio","concat","config","ftyp","parseNAL","esds","error","feed","Browser does not support codec","4.3.0.0","skipUEG","mp4","end","2232924PKvVOf","updating","options","227868XbMqAn","prototype","createBuffer","info","MediaSource","timestamp","mvex","isfmb","opus","max","stsz","POSITIVE_INFINITY","saiz","timescale","call","encryption","height","jmuxer","bufferControllers","open","patchSampleAuxinfo","queue","stsd","onBufferError","frameCounter","ntype","remux","getPayloadSize","isSupported","</LA_URL>","waitingForIdr","box","idr"," samples - expected 1","tracks","stbl","getNri",'<KID ALGID="AESCTR" ',"download","readUInt","join","com.microsoft.playready.recommendation",'" version="',"remuxController","Received ","frma","resetTrack","disableRemotePlayback","</DATA>","mfhd","pssh","charCodeAt","drm","mediaDuration","video","readyToDecode","from","SPS","skipLZ","data","keySystem","[MSE] sourceclose","byteLength","STTS","9mESMVl","Buffered range ","samples","byteOffset","parseHeader","codec","node","audio","Failure: Browser doesn't support MSE/MMS","subarray","replaceAll","downloadToFile","onBuffer","skipBits","mdat","isKeyframe","moof","mode","push","STCO","9ffcUcC","listener","isReset","map","enca","type","<LA_URL>","parseSPS","getElementById","no video element were found to render, provide a valid video element","sinf","doAppend","HDLR_TYPES","videoElement","stts","keyId","trackTypes","TYPES","remove","size","AUD","src","1376748eVkTXq","min","tfhd","initialized","offAll","appendBuffer","buffer","nri","skipEG","isvcl","isSafari","isTypeSupported","readyState","abort","apply","reduce","assign","calculateExpectedSizeFromSai","duration","generatePlayReadyHeader","readUEG","onMSEOpen","sampleAuxInfo","SEI","irrecoverableError","channelCount","saiIvSize","stsc"];return(zi=function(){return e})()}function Xi(e,t=0,n=1/0){return((e,t,n,r)=>{const s=Zi,i=r[s(203)]||1;t*=i,n*=i;const o=(l=e)instanceof ArrayBuffer?l:l[Zi(492)],a=(e[s(447)]||0)+e[s(442)],c=(e[s(447)]||0)+t;var l;let u=Math[s(389)](0,Math[s(487)](c,a)),d=Math[s(487)](u+Math[s(389)](n,0),a);return u/=i,d/=i,new r(o,u,d-u)})(e,t,n,Uint8Array)}function Ki(e){const t=Zi,n=Array[t(436)](e)[t(467)](e=>e[t(431)](0));return new Uint8Array(n)}window[Zi(455)]=(e,t,n="application/octet-stream")=>{const r=Zi,s=document[r(334)]("a"),i=new Blob([e],{type:n});s[r(337)]=URL[r(244)](i),s[r(418)]=t,s.click(),URL[r(235)](s[r(337)])};class ce{static get[Zi(304)](){return 1}static get[Zi(323)](){return 5}static get[Zi(196)](){return 6}static get SPS(){return 7}static get PPS(){return 8}static get[Zi(484)](){return 9}static get[Zi(481)](){const e=Zi;return{[ce[e(323)]]:e(323),[ce.SEI]:e(196),[ce.SPS]:e(437),[ce[e(309)]]:e(309),[ce[e(304)]]:e(304),[ce[e(484)]]:e(484)}}static type(e){const t=Zi;return e[t(405)]in ce[t(481)]?ce[t(481)][e[t(405)]]:t(263)}constructor(e){const t=Zi;this.payload=e,this[t(493)]=(96&this.payload[0])>>5,this[t(405)]=31&this[t(214)][0],this[t(495)]=1==this.ntype||5==this[t(405)],this[t(329)]="",this[t(387)]=!1}toString(){const e=Zi;return ce[e(469)](this)+e(358)+this[e(416)]()}getNri(){return this[Zi(493)]}[Zi(469)](){return this[Zi(405)]}[Zi(459)](){const e=Zi;return this[e(405)]===ce[e(323)]}[Zi(307)](){return this[Zi(214)]}[Zi(407)](){const e=Zi;return this[e(214)][e(442)]}getSize(){return 4+this[Zi(407)]()}[Zi(343)](){const e=Zi,t=new Uint8Array(this.getSize());return new DataView(t.buffer)[e(339)](0,this.getSize()-4),t[e(311)](this[e(307)](),4),t}}class ps{constructor(e){const t=Zi;this[t(439)]=e,this[t(301)]=0,this.bitLength=8*e[t(442)]}[Zi(291)](e){const t=Zi;this.data=e,this[t(301)]=0,this[t(282)]=8*e[t(442)]}get[Zi(288)](){const e=Zi;return this[e(282)]-this[e(301)]}skipBits(e){if(this[Zi(288)]<e)return!1;this.index+=e}[Zi(208)](e,t=!0){return this.getBits(e,this.index,t)}[Zi(252)](e,t,n=!0){const r=Zi;if(this.bitsAvailable<e)return 0;const s=t%8,i=this[r(439)][t/8|0]&255>>>s,o=8-s;if(o>=e)return n&&(this.index+=e),i>>o-e;{n&&(this.index+=o);const s=e-o;return i<<s|this[r(252)](s,t+o,n)}}[Zi(438)](){const e=Zi;let t;for(t=0;t<this.bitLength-this[e(301)];++t)if(0!==this.getBits(1,this[e(301)]+t,!1))return this.index+=t,t;return t}[Zi(374)](){const e=Zi;this[e(457)](1+this[e(438)]())}[Zi(494)](){const e=Zi;this[e(457)](1+this[e(438)]())}readUEG(){const e=Zi,t=this[e(438)]();return this[e(208)](t+1)-1}readEG(){const e=this[Zi(193)]();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this[Zi(208)](1)}[Zi(295)](e=1){return this[Zi(208)](8*e)}readUShort(){return this[Zi(208)](16)}[Zi(419)](){return this[Zi(208)](32)}}class rt{static[Zi(360)](e,t){const n=Zi;let r=[],s=!1,i=!1,o=!1,a=!1,c=0,l=0,u=0,d=[];for(;c<=e.byteLength;){if(c<e.byteLength){const t=e[c++];0!==t?(1===t&&l>1&&(u=l>2?4:3,d.push(c)),l=0):++l}else u=0,d.push(c++);if(d.length>1){const n=d.shift(),p=d[0]-u;if(n<p){let u=!1;const d=31&e[n];if(d===ce.NDR?i=!0:d===ce.IDR?s=!0:d===ce.SPS?(u=o,o=!0):d===ce.PPS&&(u=a,a=!0),!u)if(!t||d!==ce.NDR&&d!==ce.IDR)r.push(e.subarray(n,p));else{const t=new Uint8Array(p-n);let s=0;for(c=n,l=0;c<p;){let n=e[c++];l>1&&3===n&&(l=0,n=e[c++]),0!==n?l=0:++l,t[s++]=n}r.push(t.subarray(0,s))}}}}let p=!0,f=!1;return i||s?i&&s&&(console[n(230)](n(318)),p=!1):(console[n(230)]("[H264Parser] No VCL NALUs found"),p=!1),s&&(o&&a?f=!0:console[n(230)](n(242))),{valid:p,idr:f,nalus:r}}static skipScalingList(e,t){let n,r=8,s=8;for(let i=0;i<t;i++)0!==s&&(n=e.readEG(),s=(r+n+256)%256),r=0===s?r:s}static[Zi(330)](e){const t=Zi;let n,r,s,i,o,a,c=new ps(e),l=0,u=0,d=0,p=0,f=1;if(c[t(295)](),n=c.readUByte(),c[t(208)](5),c[t(457)](3),c.readUByte(),c[t(374)](),100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n){var h=c[t(193)]();if(3===h&&c[t(457)](1),c.skipUEG(),c[t(374)](),c[t(457)](1),c[t(232)]()){a=3!==h?8:12;for(let e=0;e<a;++e)c[t(232)]()&&(e<6?rt[t(347)](c,16):rt[t(347)](c,64))}}c[t(374)]();var m=c.readUEG();if(0===m)c[t(193)]();else if(1===m){c.skipBits(1),c[t(494)](),c[t(494)](),r=c[t(193)]();for(let e=0;e<r;++e)c.skipEG()}if(c.skipUEG(),c[t(457)](1),s=c[t(193)](),i=c.readUEG(),o=c[t(208)](1),0===o&&c[t(457)](1),c[t(457)](1),c[t(232)]()&&(l=c[t(193)](),u=c[t(193)](),d=c[t(193)](),p=c.readUEG()),c.readBoolean()){if(c[t(232)]()){let e;switch(c[t(295)]()){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[c[t(295)]()<<8|c.readUByte(),c[t(295)]()<<8|c[t(295)]()]}e&&e[0]>0&&e[1]>0&&(f=e[0]/e[1])}c.readBoolean()&&c[t(457)](1),c[t(232)]()&&(c.skipBits(4),c[t(232)]()&&c[t(457)](24)),c.readBoolean()&&(c.skipUEG(),c[t(374)]()),c.readBoolean()&&(c[t(419)](),c[t(419)](),c.readBoolean())}return{width:Math.ceil((16*(s+1)-2*l-2*u)*f),height:(2-o)*(i+1)*16-(o?2:4)*(d+p)}}static[Zi(448)](e){const t=Zi;let n=new ps(e[t(307)]());n.readUByte(),e.isfmb=0===n[t(193)](),e.stype=n[t(193)]()}constructor(e){const t=Zi;this.remuxer=e,this[t(346)]=e[t(274)]}[Zi(471)](e){const t=Zi;var n=rt[t(330)](new Uint8Array(e));this[t(346)][t(228)]=n[t(228)],this[t(346)][t(396)]=n[t(396)],this[t(346)].sps=[new Uint8Array(e)],this[t(346)][t(449)]=t(224);let r=new DataView(e.buffer,e[t(447)]+1,4);for(let e=0;e<3;++e){var s=r.getUint8(e)[t(262)](16);s.length<2&&(s="0"+s),this.track[t(449)]+=s}}[Zi(211)](e){this[Zi(346)].pps=[new Uint8Array(e)]}[Zi(368)](e){const t=Zi;if(!e)return!1;let n=!1;switch(e.type()){case ce[t(323)]:case ce[t(304)]:n=!0;break;case ce[t(309)]:!this[t(346)][t(362)]&&(this.parsePPS(e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this[t(346)][t(259)]&&(this[t(345)][t(435)]=!0)),n=!0;break;case ce[t(437)]:!this[t(346)][t(259)]&&(this[t(471)](e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this.track.sps&&(this[t(345)][t(435)]=!0)),n=!0;break;case ce[t(484)]:break;case ce[t(196)]:n=!0}return n}}class _n{constructor(e){const t=Zi;this[t(465)]={},this[t(469)]=""|e}on(e,t){const n=Zi;return!this[n(465)][e]&&(this[n(465)][e]=[]),this[n(465)][e][n(462)](t),!0}[Zi(353)](e,t){const n=Zi;if(this[n(465)][e]){var r=this.listener[e][n(238)](t);return r>-1&&this[n(465)][e][n(280)](r,1),!0}return!1}[Zi(490)](){this[Zi(465)]={}}[Zi(255)](e,t){const n=Zi;return!!this.listener[e]&&(this[n(465)][e][n(467)](e=>{e[n(187)](null,[t])}),!0)}}class F{constructor(e){var t,n;const r=Zi;this[r(432)]=e,this[r(199)]={video:(null==(t=e[r(366)][r(434)])?void 0:t.encryption)===r(306)?16:0,audio:(null==(n=e[r(366)][r(451)])?void 0:n.encryption)===r(306)?16:0},F.types={avc1:[],encv:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],Opus:[],dOps:[],enca:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pssh:[],sinf:[],frma:[],schm:[],schi:[],tenc:[],saiz:[],saio:[],senc:[]};for(let e in F[r(204)])F[r(204)][e]=[e[r(431)](0),e[r(431)](1),e.charCodeAt(2),e[r(431)](3)];const s=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F[r(476)]={video:s,audio:i};const o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);F[r(443)]=F[r(268)]=F[r(463)]=a,F[r(348)]=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F[r(217)]=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F[r(320)]=new Uint8Array([0,0,0,0,0,0,0,1]);const c=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);F[r(341)]=F[r(411)](F[r(204)][r(367)],c,u,c,l),F.DINF=F[r(411)](F[r(204)][r(272)],F[r(411)](F[r(204)].dref,o))}static[Zi(411)](e,...t){const n=Zi;let r,s=8,i=t.length,o=i;for(;i--;)t[i]&&(s+=t[i].byteLength);for(r=new Uint8Array(s),r[0]=s>>>24,r[1]=s>>>16&255,r[2]=s>>>8&255,r[3]=255&s,r[n(311)](e,4),i=0,s=8;i<o;++i)t[i]&&(r[n(311)](t[i],s),s+=t[i][n(442)]);return r}hdlr(e){const t=Zi;return F[t(411)](F[t(204)][t(229)],F[t(476)][e])}mdat(e){const t=Zi;return F.box(F.types[t(458)],e)}[Zi(246)](e,t){const n=Zi;return F.box(F[n(204)][n(246)],new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,0,0,0,0,85,196,0,0]))}[Zi(298)](e){const t=Zi;return F[t(411)](F[t(204)][t(298)],this[t(246)](e[t(393)],e.duration),this[t(229)](e[t(469)]),this[t(265)](e))}[Zi(429)](e){const t=Zi;return F[t(411)](F.types[t(429)],new Uint8Array([0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[Zi(265)](e){const t=Zi;return e[t(469)]===t(451)?F[t(411)](F[t(204)][t(265)],F.box(F[t(204)][t(236)],F[t(247)]),F.DINF,this[t(415)](e)):F[t(411)](F[t(204)][t(265)],F[t(256)],this[t(415)](e),F[t(411)](F[t(204)][t(340)],F[t(217)]))}[Zi(460)](e,t,n){const r=Zi;return F[r(411)](F[r(204)][r(460)],this[r(429)](e),this.traf(n,t))}moov(e,t,n){const r=Zi;let s=e[r(294)],i=[];for(;s--;)i[s]=this[r(315)](e[s]);return F[r(411)][r(187)](null,[F[r(204)].moov,this[r(210)](n,t),this[r(430)](e)].concat(i)[r(365)](this[r(386)](e)))}mvex(e){const t=Zi;let n=e[t(294)],r=[];for(;n--;)r[n]=this[t(290)](e[n]);return F.box[t(187)](null,[F[t(204)].mvex].concat(r))}[Zi(210)](e,t){const n=Zi;let r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,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,255,255,255,255]);return F[n(411)](F[n(204)].mvhd,r)}[Zi(356)](e){const t=Zi;let n=e[t(446)]||[],r=new Uint8Array(4+n.length);for(let e=0;e<n.length;e++){const s=n[e][t(316)];r[e+4]=s[t(213)]<<4|s.isDependedOn<<2|s.hasRedundancy}return F.box(F.types.sdtp,r)}[Zi(415)](e){const t=Zi;return F[t(411)](F.types[t(415)],this[t(402)](e),F.box(F.types[t(478)],F[t(443)]),F.box(F.types[t(200)],F[t(268)]),F[t(411)](F[t(204)][t(390)],F[t(348)]),F[t(411)](F[t(204)][t(267)],F[t(463)]))}[Zi(333)](e){const t=Zi;let n,r,s,i=[],o=[];for(n=0;n<e[t(259)][t(294)];n++)r=e[t(259)][n],s=r[t(442)],i.push(s>>>8&255),i[t(462)](255&s),i=i[t(365)](Array[t(381)].slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],s=r[t(442)],o.push(s>>>8&255),o[t(462)](255&s),o=o[t(365)](Array[t(381)][t(293)][t(394)](r));const a=F[t(411)](F[t(204)].avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e[t(259)][t(294)]][t(365)](i)[t(365)]([e[t(362)].length]).concat(o))),c=e[t(228)],l=e[t(396)],u=F[t(411)](F[t(204)][t(474)],F[t(411)](F.types[t(425)],new Uint8Array([97,118,99,49])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...Ki(this[t(432)][t(366)].video[t(395)]),0,1,0,0])),F[t(411)](F[t(204)].schi,this[t(314)]("video")));return F[t(411)](F[t(204)][t(333)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>>8&255,255&c,l>>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,65,86,67,32,67,111,100,105,110,103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]),a,u)}[Zi(369)](e){const t=Zi;let n=e.config[t(442)],r=new Uint8Array(26+n+3);return r[t(311)]([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5,n]),r[t(311)](e[t(366)],26),r[t(311)]([6,1,2],26+n),r}[Zi(296)](e){const t=Zi,n=e.audiosamplerate;return F[t(411)](F[t(204)][t(296)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,n>>>8&255,255&n,0,0]),F[t(411)](F[t(204)][t(369)],this.esds(e)))}dOps(e){const t=Zi,n=e[t(357)];return new Uint8Array([0,e[t(198)],1,56,0,0,n>>>8&255,255&n,0,0,0])}[Zi(264)](e){const t=Zi,n=e[t(357)];return F[t(411)](F[t(204)].Opus,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,n>>>8&255,255&n,0,0]),F[t(411)](F.types[t(305)],this[t(305)](e)))}[Zi(468)](e){const t=Zi,n=F[t(411)](F[t(204)].dOps,this[t(305)](e)),r=F[t(411)](F[t(204)].sinf,F[t(411)](F[t(204)].frma,new Uint8Array([79,112,117,115])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...Ki(this.drm[t(366)].audio[t(395)]),0,1,0,0])),F[t(411)](F[t(204)][t(332)],this[t(314)](t(451)))),s=e[t(357)];return F[t(411)](F[t(204)][t(468)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,s>>>8&255,255&s,0,0]),n,r)}[Zi(402)](e){const t=Zi;return e[t(469)]===t(451)?F.box(F[t(204)][t(402)],F[t(320)],e[t(212)]?this[t(468)](e):this[t(264)](e)):F.box(F[t(204)][t(402)],F[t(320)],this.encv(e))}[Zi(249)](e){const t=Zi,n=e.id,r=e[t(191)],s=e.width,i=e[t(396)],o=e[t(219)];return F[t(411)](F[t(204)][t(249)],new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,0,r>>>24,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,255&o,o%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,i>>>8&255,255&i,0,0]))}[Zi(231)](e,t){var n;const r=Zi,s=e.id,i=e[r(446)][0][r(483)],o=e[r(446)][0][r(191)],a=e[r(446)][0].flags,c=F[r(411)](F[r(204)][r(488)],new Uint8Array([0,2,0,58,s>>>24,s>>>16&255,s>>>8&255,255&s,0,0,0,1,o>>>24,s>>>16&255,o>>>8&255,255&o,i>>>24,i>>>16&255,i>>>8&255,255&i,0,a.isNonSync,0,0])),l=F[r(411)](F[r(204)][r(222)],new Uint8Array([0,0,0,0,t>>>24,t>>>16&255,t>>>8&255,255&t]));if(e[r(212)]){let t,s;if(e[r(469)]===r(434)?(t=!0,s=this[r(199)][r(434)]+(null==(n=e[r(446)][0].sampleAuxInfo)?void 0:n.byteLength)):(t=!1,s=this[r(199)][r(451)]),s>0){const n=this[r(392)](s),i=this[r(363)](e[r(446)],t),o=n.length+20+i.length+c[r(294)]+l[r(294)]+8+16+8+8,a=this[r(324)](e,o);return F[r(411)](F[r(204)][r(231)],c,l,a,n,this[r(364)](o-i[r(294)]+a[r(294)]+8),i)}{const t=this[r(363)](null,!1),n=t[r(294)]+c[r(294)]+l.length+8+16+8+8,s=this[r(324)](e,n);return F[r(411)](F[r(204)][r(231)],c,l,s,t)}}return F.box(F.types.traf,c,l,this[r(324)](e,c[r(294)]+l[r(294)]+8+16+8+8))}[Zi(315)](e){const t=Zi;return e[t(191)]=e[t(191)]||4294967295,F.box(F[t(204)][t(315)],this[t(249)](e),this[t(298)](e))}trex(e){const t=Zi,n=e.id;return F[t(411)](F[t(204)][t(290)],new Uint8Array([0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,16,0,0,0,0,0,0,0,0]))}trun(e,t){const n=Zi;let r=(e.samples||[]).length,s=new Uint8Array(12);return t+=20,s[n(311)]([0,0,0,1,r>>>24,r>>>16&255,r>>>8&255,255&r,t>>>24,t>>>16&255,t>>>8&255,255&t],0),F.box(F.types[n(324)],s)}[Zi(192)](e,t){const n=Zi,r=n(373),s=n(257),i=function(e){const t=function(e){const t=Zi;let n="";for(let r=0;r<e.length;r+=16e3){const s=e[t(453)](r,r+16e3);n+=String[t(299)][t(187)](null,s)}return n}(Xi(e));return btoa(t)}(function(e){const t=Zi,n=[];return n[t(462)](e[3]),n[t(462)](e[2]),n[t(462)](e[1]),n[t(462)](e[0]),n.push(e[5]),n.push(e[4]),n.push(e[7]),n.push(e[6]),(e=Xi(e))[t(311)](n,0),e}(e));return Xi(function(e){const t=Zi,n=new Uint8Array(2*e.length),r=new DataView(n[t(492)]);for(let n=0;n<e[t(294)];++n){const s=e[t(431)](n);r[t(221)](2*n,s,true)}return n[t(492)]}([n(300)+s+n(422)+r+'">',"<DATA>",n(239),"<KIDS>",n(417),n(243)+i+'"',">",n(245),n(270),"</PROTECTINFO>",t?n(470)+t+n(409):"",n(428),n(289)][n(420)]("")))}[Zi(430)](e){const t=Zi;if(this[t(432)][t(440)][t(328)]("com.widevine"))return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237,0,0,0,18,18,16,...this[t(432)][t(366)][e[0][t(469)]][t(479)]]));if(this[t(432)].keySystem===t(421)){const n=this[t(192)](this[t(432)][t(366)][e[0].type][t(479)],this.drm.licenseUrl),r=n[t(442)];return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149,r>>>24,r>>>16&255,r>>>8&255,255&r,...n]))}return this[t(432)][t(440)]===t(273)?F[t(411)](F[t(204)][t(430)],new Uint8Array([1,0,0,0,16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75,0,0,0,1,...this.drm.config[e[0][t(469)]][t(479)],0,0,0,0])):this[t(432)][t(440)]===t(286)?null:void console[t(370)](t(297)+this[t(432)].keySystem)}[Zi(314)](e){const t=Zi;let n,r,s=this[t(432)][t(366)][e];return"cbcs"===s.encryption?(n=new Uint8Array([16,...s.iv]),r=25):(n=new Uint8Array([]),r=0),F[t(411)](F[t(204)].tenc,new Uint8Array([1,0,0,0,0,r,1,this[t(199)][e],...s[t(479)],...n]))}[Zi(392)](e){return F[Zi(411)](F.types.saiz,new Uint8Array([0,0,0,0,e,0,0,0,1]))}[Zi(364)](e){const t=Zi;return F[t(411)](F[t(204)][t(364)],new Uint8Array([0,0,0,0,0,0,0,1,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[Zi(363)](e,t){const n=Zi;let r=null;return e&&(1!==e[n(294)]&&console[n(370)](n(424)+e[n(294)]+n(413)),r=e[0][n(195)]),r&&r[n(442)]?F[n(411)](F[n(204)][n(363)],new Uint8Array([0,0,0,t?2:0,0,0,0,1,...r])):F[n(411)](F[n(204)][n(363)],new Uint8Array([0,0,0,0,0,0,0,1]))}[Zi(271)](e,t,n){const r=Zi,s=this[r(216)](e,t,n);let i=new Uint8Array(F[r(341)][r(442)]+s.byteLength);return i.set(F[r(341)]),i[r(311)](s,F[r(341)].byteLength),i}}let $i=1;class yr{constructor(){this[Zi(283)]=1}static[Zi(209)](){return $i++}[Zi(250)](){const e=Zi;this[e(274)][e(215)]=0,this.mp4track[e(446)]=[]}[Zi(258)](){const e=Zi;return!(!this.readyToDecode||!this[e(446)][e(294)])}}class Ea extends yr{constructor(e){const t=Zi;super(),this[t(435)]=!0,this[t(223)]=0,this[t(237)]=0,this[t(274)]={id:yr[t(209)](),type:"audio",channelCount:2,audiosamplerate:48e3,len:0,fragmented:!0,timescale:e,duration:e,samples:[],codec:t(388),encrypted:!0},this[t(446)]=[]}resetTrack(){const e=Zi;this[e(283)]=1,this[e(223)]=0,this[e(237)]=0}[Zi(406)](e,t,n){const r=Zi;if(e.length>0)for(let s=0;s<e[r(294)];s++){let i=e[s],o=i[r(276)],a=o[r(442)];this.samples.push({units:o,size:a,duration:i.duration,sampleAuxInfo:t,timestamp:n}),this[r(274)][r(215)]+=a}}[Zi(248)](){const e=Zi;if(!this[e(446)])return null;let t,n=this[e(274)][e(446)];for(;this.samples[e(294)];){let r=this[e(446)][e(233)](),s=(1e3*r[e(385)]|0)-this.nextDts|0;s<5&&(s=5),this.dts=this.nextDts,this[e(223)]+=s,t={size:r.size,duration:s,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1},sampleAuxInfo:r[e(195)]};let i=new Uint8Array(r.size);return i[e(311)](r.units,0),n.push(t),new Uint8Array(i.buffer,0,r[e(483)])}return null}}class _a extends yr{constructor(e,t){const n=Zi;super(),this[n(435)]=!1,this.nextDts=0,this[n(237)]=0,this[n(477)]=t,this.mp4track={id:yr[n(209)](),type:n(434),len:0,fragmented:!0,sps:"",pps:"",width:0,height:0,timescale:e,duration:e,samples:[],encrypted:!0},this[n(446)]=[],this[n(220)]=new rt(this)}[Zi(426)](){const e=Zi;this[e(283)]=1,this.readyToDecode=!1,this[e(274)].sps="",this[e(274)][e(362)]="",this[e(223)]=0,this[e(237)]=0}[Zi(406)](e,t,n){const r=Zi;for(let s of e){let e=[],i=0;for(let t of s[r(276)])this.h264[r(368)](t)&&(e[r(462)](t),i+=t.getSize());e[r(294)]>0&&this[r(435)]&&(this[r(274)][r(215)]+=i,this[r(446)][r(462)]({units:e,size:i,keyFrame:s.keyFrame,duration:s[r(191)],sampleAuxInfo:t,timestamp:n}))}}[Zi(248)](){const e=Zi;if(!this[e(258)]()||!this.samples)return null;let t,n=this[e(274)][e(446)],r=this.samples[e(233)](),s=r[e(276)],i=(1e3*r.timestamp|0)-this[e(223)]|0;i<5&&(i=5),window[e(251)]&&i>5e3&&console[e(383)]("timestamp gap: "+(i/1e3|0)+" s"),this[e(237)]=this[e(223)],this.nextDts+=i,t={size:r[e(483)],duration:i,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:r[e(275)]?0:1,dependsOn:r.keyFrame?2:1},sampleAuxInfo:r[e(195)]};let o=0;for(const t of s)o+=t[e(349)]();let a=0,c=new Uint8Array(o);for(const t of s)c[e(311)](t[e(343)](),a),a+=t[e(349)]();return n[e(462)](t),new Uint8Array(c[e(492)],0,o)}}class Ta extends _n{constructor(e,t){const n=Zi;super(n(345)),this.initialized=!1,this.trackTypes=[],this[n(414)]={},this[n(393)]=1e3,this.mediaDuration=0,this[n(477)]=e,this[n(375)]=t}addTrack(e){const t=Zi;(e===t(434)||"both"===e)&&(this[t(414)][t(434)]=new _a(this[t(393)],this.videoElement),this[t(480)][t(462)](t(434))),(e===t(451)||e===t(303))&&(this[t(414)][t(451)]=new Ea(this.timescale),this[t(480)][t(462)](t(451)))}reset(){const e=Zi;for(let t of this[e(480)])this[e(414)][t][e(426)]();this[e(489)]=!1}[Zi(355)](){const e=Zi;this[e(414)]={},this[e(490)]()}[Zi(250)](){const e=Zi;if(this[e(489)])for(let t of this[e(480)]){let n=this[e(414)][t];for(;;){let r=n.getFramePayload();if(!r||!r[e(442)])break;let s={type:t,payload:Yi(this[e(375)][e(460)](n[e(283)]++,n[e(237)],n[e(274)]),this[e(375)][e(458)](r)),dts:n[e(237)]};this[e(255)](e(492),s),n[e(250)]()}}else this[e(258)]()&&(this[e(255)](e(205)),this[e(271)](),this[e(489)]=!0,this[e(250)]())}initSegment(){const e=Zi;for(let t of this[e(480)]){let n=this[e(414)][t],r={type:t,payload:this[e(375)][e(271)]([n[e(274)]],this[e(433)],this[e(393)])};this.dispatch(e(492),r)}}isReady(){const e=Zi;for(let t of this.trackTypes)if(!this[e(414)][t][e(435)]||!this[e(414)][t].samples[e(294)])return!1;return!0}[Zi(406)](e){const t=Zi;for(let n of this[t(480)]){let r=e[n];r.length>0&&this[t(414)][n][t(406)](r,n===t(451)?e[t(225)]:e.videoSampleAuxInfo,e[t(385)])}this.flush()}}class Aa extends _n{constructor(e,t,n){const r=Zi;super(r(492)),this[r(469)]=t,this.queue=new Uint8Array,window[r(319)]&&(this[r(254)]=new Uint8Array,this[r(404)]=0),this.sourceBuffer=e,this[r(218)]=n,this[r(197)]=!1,this[r(310)].addEventListener(r(370),e=>{const t=r;console.warn(t(201),e,this.type),this[t(197)]=!0,this[t(255)](t(370),{type:this[t(469)],name:"buffer",error:t(292)})})}[Zi(355)](){const e=Zi;this[e(401)]=null,this[e(254)]=null;try{this.sourceBuffer&&(this[e(310)][e(186)](),this[e(218)].removeSourceBuffer(this[e(310)]),this[e(310)]=null)}catch(e){}this.offAll()}[Zi(475)](){const e=Zi;if(this.queue[e(294)]&&this[e(310)]&&!this[e(310)].updating){if(this[e(310)].buffered[e(294)]>1){for(let t=0;t<this[e(310)].buffered[e(294)];++t){const n=t<this[e(310)].buffered[e(294)]-1;window[e(251)]&&console[e(383)](e(445)+t+(n?" (remove)":"")+": "+this[e(310)][e(269)][e(326)](t)+e(325)+this[e(310)][e(269)][e(376)](t)),n&&this.sourceBuffer[e(482)](this[e(310)][e(269)].start(t),this[e(310)].buffered[e(376)](t))}if(this.sourceBuffer[e(378)])return}try{this[e(310)][e(491)](this[e(401)]),this.queue=new Uint8Array}catch(t){this[e(255)](e(370),{type:this[e(469)],name:e(352),error:t})}}}[Zi(371)](e){const t=Zi;if(this[t(254)]&&(this.dbgQueue=Yi(this[t(254)],e),100==++this[t(404)])){const e=(new Date)[t(344)]().substring(0,19)[t(454)](":","-"),n=this.type+"-"+e+".mp4";window.downloadToFile(this[t(254)],n),this[t(254)]=null}this[t(197)]||(this[t(401)]=Yi(this[t(401)],e)),this.doAppend()}}class Tn extends _n{static isSupported(e){const t=Zi;return window[t(202)]?window.ManagedMediaSource[t(497)](e):!!window[t(384)]&&window.MediaSource[t(497)](e)}constructor(e){const t=Zi;super(t(397)),this[t(197)]=!1,this[t(410)]=!0,this[t(466)]=!1,this[t(234)]=!1,this.mseEnded=!1,this[t(379)]=Object[t(189)]({},{node:"",mode:"video",debug:!1,onReady:function(){},onError:function(e){}},e),this[t(450)]=typeof this.options[t(450)]===t(302)?document[t(472)](this.options.node):this[t(379)].node,this[t(432)]=e.drm,this.mp4=new F(this.drm),this[t(423)]=new Ta(this.node,this[t(375)]),this[t(423)].addTrack(this[t(379)][t(461)]),this[t(423)].on(t(492),this[t(456)].bind(this)),this[t(423)].on(t(205),this[t(382)][t(308)](this)),this.initBrowser()}[Zi(322)](){const e=Zi;typeof this.options.node===e(302)&&""==this.options[e(450)]&&console[e(370)](e(473)),this[e(234)]=!1,this.setupMSE()}setupMSE(){const e=Zi;if(!window[e(202)]&&!window[e(384)])throw e(452);window.ManagedMediaSource?(this.node[e(427)]=!0,this[e(327)]=new ManagedMediaSource):this[e(327)]=new MediaSource,this[e(284)]=URL[e(244)](this[e(327)]),this.node[e(485)]=this[e(284)],this[e(277)]=!1,this[e(327)][e(331)](e(338),this.onMSEOpen[e(308)](this)),this.mediaSource.addEventListener("sourceclose",this[e(241)][e(308)](this)),this[e(327)][e(331)]("webkitsourceopen",this[e(194)][e(308)](this)),this.mediaSource[e(331)](e(240),this[e(241)].bind(this)),this[e(327)][e(331)]("error",function(t){const n=e;console[n(370)](n(287),t[n(226)])})}[Zi(227)](){const e=Zi;if(!this[e(277)])try{this.mseEnded=!0,this[e(327)][e(185)]===e(399)&&this[e(327)][e(261)]()}catch(t){console[e(370)]("mediasource is not available to end: ",t)}}[Zi(359)](){this[Zi(410)]=!0}[Zi(371)](e){const t=Zi;let n={video:[],audio:[]};if(this[t(197)]||this[t(277)]||!e||!this[t(423)])return-1;if(e[t(434)]){n.timestamp=e.timestamp;const r=this[t(190)](e.videoSampleAuxInfo,this.mp4[t(199)][t(434)]),s=r!=e[t(434)][t(442)];let i=rt[t(360)](e[t(434)],s);if(!i[t(206)]||i[t(260)].length<1)return 0;if(this.waitingForIdr){if(!i[t(412)])return 0;this[t(410)]=!1}if(!Bi&&e[t(278)]){const n=i[t(260)][t(188)]((e,n)=>e+4+n[t(442)],0);n!==r&&this[t(400)](e[t(278)],this.mp4[t(199)][t(434)],n-r)}n[t(434)]=this[t(335)](i[t(260)]),n[t(278)]=e[t(278)]}return e[t(451)]&&(n[t(385)]=e[t(385)],n[t(451)]=[{units:e.audio}],n.audioSampleAuxInfo=e[t(225)]),e[t(434)]||e[t(451)]?(this[t(423)][t(406)](n),0):(console.error(t(361)),0)}[Zi(335)](e){const t=Zi;let n=[],r=[],s=!1,i=!1;for(let o of e){let e=new ce(o);e.type()!==ce.IDR&&e[t(469)]()!==ce.NDR||rt[t(448)](e),n[t(294)]&&i&&(e[t(387)]||!e[t(495)])&&(r[t(462)]({units:n,keyFrame:s}),n=[],s=!1,i=!1),n[t(462)](e),s=s||e[t(459)](),i=i||e[t(495)]}if(n[t(294)])if(i)r[t(462)]({units:n,keyFrame:s});else{let e=r[t(294)]-1;e>=0&&(r[e].units=r[e][t(276)].concat(n))}return 1!==r[t(294)]&&console[t(230)](t(207)+r[t(294)]),r}[Zi(190)](e,t){const n=Zi;if(!e)return 0;const r=(e[0]<<8)+e[1],s=t+2+4;let i=0,o=2;for(;0<r&&o+s<=e[n(442)];){o+=t;const n=(e[o]<<8)+e[o+1],r=(e[o+2]<<24)+(e[o+3]<<16)+(e[o+4]<<8)+e[o+5];o+=6,i+=n+r}return i}patchSampleAuxinfo(e,t,n){const r=Zi;let s=2;if(0<(e[0]<<8)+e[1]&&s+(t+2+4)<=e[r(442)]){s+=t;let r=(e[s]<<8)+e[s+1];r+=n,r>=0&&(e[s]=r>>>8&255,e[s+1]=255&r)}return 0}[Zi(382)](){const e=Zi;if(this[e(234)]&&this[e(423)]&&this[e(423)].isReady()&&!this.bufferControllers){this.bufferControllers={};for(let t in this[e(423)][e(414)]){let n=this[e(423)][e(414)][t];const r="".concat(t,e(317))[e(365)](n[e(274)][e(449)],'"');if(window.clRtcDrmDebugLog&&console[e(383)](e(312),r),!Tn[e(408)](r))return console[e(370)](e(372)),!1;let s=this[e(327)][e(350)](r);this[e(398)][t]=new Aa(s,t,this[e(327)]),this.bufferControllers[t].on(e(370),this[e(403)][e(308)](this))}}}[Zi(313)](){const e=Zi;for(let t in this[e(398)])this[e(398)][t].doAppend()}onBuffer(e){const t=Zi;this[t(234)]&&this[t(398)]&&this[t(398)][e.type]&&this[t(398)][e[t(469)]][t(371)](e[t(214)])}[Zi(194)](){const e=Zi;window[e(251)]&&console.info("[MSE] sourceopen"),this[e(327)][e(185)]!==e(281)&&(this.mediaSource.duration=Number[e(391)],this[e(234)]=!0,"function"==typeof this[e(379)][e(336)]&&this[e(379)].onReady[e(394)](null,this[e(466)]),URL[e(235)](this.url),this[e(382)]())}[Zi(241)](){const e=Zi;window.clRtcDrmDebugLog&&console[e(383)](e(441)),this.mseReady=!1,this[e(227)]()}[Zi(403)](e){const t=Zi;console.warn(t(351),e),this.irrecoverableError=!0,this[t(227)](),"function"==typeof this[t(379)][t(266)]&&this[t(379)][t(266)][t(394)](null,e)}}function Hi(e,t){const n=Qi();return(Hi=function(e,t){return n[e-=222]})(e,t)}function Qi(){const e=["__dev_time__","1634635aeNfVS","4rWkceo","1051qHPzyB","314juHkBI","7752096GfpyFE","1023208nKrJjX","2137269uUqtNM","303058KNxeBb","1097196nHglzA"];return(Qi=function(){return e})()}!function(){const e=Hi,t=Qi();for(;;)try{if(parseInt(e(228))/1*(-parseInt(e(229))/2)+-parseInt(e(222))/3*(parseInt(e(227))/4)+parseInt(e(226))/5+parseInt(e(224))/6+parseInt(e(223))/7+-parseInt(e(231))/8+parseInt(e(230))/9==409100)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const qi=eo;function eo(e,t){const n=ro();return(eo=function(e,t){return n[e-=460]})(e,t)}!function(){const e=eo,t=ro();for(;;)try{if(-parseInt(e(471))/1*(-parseInt(e(474))/2)+parseInt(e(479))/3+parseInt(e(473))/4*(parseInt(e(461))/5)+parseInt(e(487))/6+-parseInt(e(467))/7+-parseInt(e(482))/8+-parseInt(e(464))/9==139726)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const to="CrsCCAMSEKDc0WAwLAQT1SB2ogyBJEwYv4Tx7gUijgIwggEKAoIBAQC8Xc/GTRwZDtlnBThq8"+qi(462)+"wyoYOE+M/t1oIbccwlTQ7o+BpV1X6TB7fxFyx1jsBtRsBWphU65w121zqmSiwzZzJ4xsXVQCJ"+qi(460)+qi(476)+qi(480)+qi(484)+qi(485)+"7hyskG5ZLAyJMzTvgnV3D8/I5Y6mCFBPb/+/Ri+9bEvquPF3Ff9ip3yEHu9mcQeEYCeGe9zR/27eI5MATX39gYtCnn7dDXVxo4/rCYK0A4VemC3HRai2X3pSGcsKY7+6we7h4IycjqtuGtYg8A"+qi(475)+"RL9KsD0v7ysBQVdUXEbJotcFz71tI5qc3jwr6GjYIPA3VzusD17PN6AGQniMwxJV12z/EgnUo"+qi(477),no=Uint8Array[qi(478)](window[qi(470)](to),e=>e.charCodeAt(0));class De{constructor(e){this[qi(488)]=e}[qi(469)](){return this[qi(488)]}[qi(483)](){const e=qi;switch(this[e(488)]){case e(489):return"https://lic.staging.drmtoday.com";case e(465):return e(481);default:return e(466)}}certificate(){return no}}function ro(){const e=["development","https://lic.drmtoday.com","462553oMrSQp","Staging","toString","atob","20047HjYCpd","Development","52chMPdC","6mbMcSk","baigovcoURAZcr1d/G0rpREjLdVLG0Gjqk63Gx688W5gh3TKemsK3R1jV0dOfj3e6uV/kTpsN","+vwmV2/NJWxKqHBKdL9JqvOnNiQUF0hDI7Wf8Wb63RYSXKE27Ky31hKgx1wuq7TTWkA+kHnJT","pcFB13osydpD2AaDsgWo5RWJcNf+fzCgtUQx/0Au9+xVm5LQBdv8Ja4f2oiHN3dw","from","146355HhTpSB","UrTEfQxfPR4dJTquE+IDLAi5yeVVxzbAgMBAAE6DGNhc3RsYWJzLmNvbUABEoADMmGXpXg/0q","https://lic.test.drmtoday.com","501688OkVRMl","baseUrl","xUuwokpsqVIHZrJfu62ar+BF8UVUKdK5oYQoiTZd9OzK3kr29kqGGk3lSgM0/p499p/FUL8oH","HzgsJ7Hajdsyzn0Vs3+VysAgaJAkXZ+k+N6Ka0WBiZlCtcunVJDiHQbz1sF9GvcePUUi2fM/h","Production","1063410zFUyaf","name","staging","pQnNI61gzHO42XZOMuxytMm0F6puNHTTqhyY3Z290YqvSDdOB+UY5QJuXJgjhvOUD9+oaLlvT","93365ZJpndd","V382D1oJAM0F/YgCQtNDLz7vTWJ+QskNGi5Dd2qzO4s48Cnx5BLvL4H0xCRSw2Ed6ekHSdrRU","production","2343546YgIYCY"];return(ro=function(){return e})()}function so(e,t){const n=io();return(so=function(e,t){return n[e-=325]})(e,t)}function io(){const e=["1052499bnJBHn","cenc","4222tSxFth","Unsupported SampleAuxInfo version","12980Tusgux","3160ZwXFcU","40030ewyARR","16lkTHRT","1199124lbwxEr","data","105TSrukA","getUint8","12bBEpge","SampleAuxInfo corrupted (postfix not found)","getUint16","error","85265ZYYyUv","buffer","3616548TKdsLX","subarray","byteLength","SampleAuxInfo corrupted"];return(io=function(){return e})()}function oo(e,t){const n=uo();return(oo=function(e,t){return n[e-=295]})(e,t)}De[qi(468)]=new De(qi(489)),De[qi(486)]=new De(qi(463)),De[qi(472)]=new De(qi(465)),function(){const e=so,t=io();for(;;)try{if(parseInt(e(328))/1+-parseInt(e(332))/2*(-parseInt(e(336))/3)+-parseInt(e(338))/4*(-parseInt(e(342))/5)+-parseInt(e(344))/6+-parseInt(e(326))/7*(parseInt(e(333))/8)+parseInt(e(334))/9+parseInt(e(331))/10*(parseInt(e(330))/11)==358550)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),function(){const e=oo,t=uo();for(;;)try{if(parseInt(e(305))/1*(-parseInt(e(297))/2)+-parseInt(e(295))/3+parseInt(e(310))/4*(parseInt(e(309))/5)+-parseInt(e(304))/6*(parseInt(e(296))/7)+parseInt(e(307))/8*(-parseInt(e(298))/9)+-parseInt(e(301))/10*(parseInt(e(302))/11)+-parseInt(e(300))/12*(-parseInt(e(308))/13)==178039)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const ao=[];let co=null,lo=0;function uo(){const e=["31476hbBsvr","850RxzAPl","4180KczaCN","push","156MUFuvQ","96571jvhWaB","buffer","26232BkewNd","4303YGAqiP","5yhGpFn","1137036pzCnTd","1035942NcoZLh","94073eTaQjy","2bXtEms","414snfiTE","slice"];return(uo=function(){return e})()}const po=yo;function fo(){const e=["Data does not seem to be UTF-16 encoded!","No init data available!","getElementsByTagName","min","14BFNrBA","keystatuseschange","catch","childNodes","internal-error","Failed to reuse previous EME session: ","output-downscaled","expired","bind","5576688EKOFOG","has","length","License acquisition failed with error ","arrayBuffer","apply","CDM error generating license request: ","<Challenge","No PR challenge data!","then","license","createSession","warn","[PR] License fetched:","text/xml","clRtcDrmDebugLog","push","encode","max","json"," is not ","replace","target","rtcdrmerror","update","fromCharCode","subarray","2993694njpqat","4002692oINhTV","Content-Type","1347492MkzfDC","Data has an incorrect length, must be even.","addEventListener","buffer","onFetch","generateRequest","initData","dispatchEvent","atob","No clear key test key provided!","Challenge","New lic will be requested","oct","BYTES_PER_ELEMENT","sessionId","usable for decryption (status: ","[WV] License fetched:","Key ","5MtuOVr","byteLength","744563CKOUzg","load","floor","error","decode","indexOf","info","isSafari","edef8ba979d64acea3c827dcd51d21ed","mediaKeys","Previous lic will be reused","charCodeAt","licenseUrl","status","Failed to update the session: ","log","keyStatuses","temporary","9a04f07998404286ab92e65be0885f95","output-restricted","nodeValue","btoa","message","EME createSession() failed - no DRM available","5977680uUTwUr","getUint16","[PR] Challenge node not found","A128KW","3974463jrELhf","Failed to update the session","stringify","[EME]","delete","No media keys for media element!","set","2nMQfRz"];return(fo=function(){return e})()}!function(){const e=yo,t=fo();for(;;)try{if(-parseInt(e(419))/1*(parseInt(e(454))/2)+parseInt(e(495))/3+parseInt(e(496))/4*(-parseInt(e(417))/5)+-parseInt(e(498))/6*(-parseInt(e(459))/7)+parseInt(e(468))/8+-parseInt(e(447))/9+parseInt(e(443))/10==555073)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();let ho={licenseUrl:"",onFetch:void 0};const mo={},go=(e,t=0,n=1/0)=>((e,t,n)=>{const r=yo,s=Uint8Array[r(511)];t*=s,n*=s;const i=(c=e)instanceof ArrayBuffer?c:c[yo(501)],o=e[r(418)],a=t;var c;let l=Math[r(486)](0,Math[r(458)](a,o)),u=Math[r(458)](l+Math[r(486)](n,0),o);return l/=s,u/=s,new Uint8Array(i,l,u-l)})(e,t,n);function yo(e,t){const n=fo();return(yo=function(e,t){return n[e-=417]})(e,t)}const vo=e=>{const t=yo;let n="";for(const r of e){let e=r.toString(16);1==e[t(470)]&&(e="0"+e),n+=e}return n};let bo=null;const wo=e=>{const t=yo;return window[t(440)](String[t(493)][t(473)](null,e))[t(489)](/\+/g,"-")[t(489)](/\//g,"_")[t(489)](/=*$/,"")},So=(e,t)=>{const n=yo,r=(e=>{const t=yo,n=JSON.parse((new TextDecoder)[t(423)](e));if(console[t(434)]("CK license request:",n),null===bo)throw new Error(t(507));const r=[];for(const e of n.kids){const n={kty:t(510),alg:t(446),kid:e,k:wo(bo)};r[t(484)](n)}return(new TextEncoder)[t(485)](JSON[t(449)]({keys:r}))})(t.message);t[n(490)][n(492)](r)[n(461)](function(e){const t=n;console[t(422)](t(448),e)})},_o=e=>{const t=yo,n=window[t(506)](e[t(489)](/-/g,"+")[t(489)](/_/g,"/")),r=new Uint8Array(n[t(470)]);for(let e=0;e<n.length;++e)r[e]=n[t(430)](e);return r},Ro=(e,t,...n)=>xi(void 0,[e,t,...n],void 0,function*(e,t,n=!1){const r=yo,s=new Headers(mo);n&&s.append(r(497),r(482));const i={method:"POST",headers:s,body:t},o=yield ho[r(502)]?ho[r(502)](e,i):fetch(e,i);if(!o.ok)throw new Error(r(471)+o[r(432)]);return o}),Eo=(e,t)=>{const n=yo;Ro(ho[n(431)],t[n(441)])[n(477)](e=>e[n(487)]())[n(477)](e=>{const r=n;window[r(483)]&&console.info(r(514),e.license);const s=_o(e[r(478)])[r(501)];t[r(490)][r(492)](s)[r(461)](e=>{console[r(422)]("Failed to update the session",e)})})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console[r(422)](t)})},ko=(e,t)=>{const n=yo,r=((e,t)=>{const n=yo,r=new DOMParser;try{const e=function(e,t,n=!1){const r=yo;if(!e)return"";let s=e;if(!n&&s.byteLength%2!=0)throw console[r(422)](r(499)),new Error(r(455));const i=go(s);let o;if((255===i[0]&&254===i[1]||254===i[0]&&255===i[1])&&(s=i[r(494)](2)),s instanceof ArrayBuffer)o=s;else{const e=new Uint8Array(s[r(418)]);e[r(453)](go(s)),o=e[r(501)]}const a=Math[r(421)](s.byteLength/2),c=new Uint16Array(a),l=new DataView(o);for(let e=0;e<a;e++)c[e]=l[r(444)](2*e,t);return function(e){const t=yo;let n="";for(let r=0;r<e[t(470)];r+=16e3){const s=e[t(494)](r,r+16e3);n+=String[t(493)].apply(null,s)}return n}(c)}(t,!0);if(e[n(424)](n(475))>-1){const t=r.parseFromString(e,n(482))[n(457)](n(508))[0][n(462)][0][n(439)];if(null===t)throw new Error("No PR challenge data!");return _o(t)}console[n(480)](n(445))}catch(t){e.dispatchEvent(new CustomEvent(n(491),{detail:{message:""+t}})),console.error(t)}return null})(e,t.message);if(null===r)return e[n(505)](new CustomEvent("rtcdrmerror",{detail:{message:"No PR challenge data!"}})),void console.error(n(476));Ro(ho[n(431)],r[n(501)],!0)[n(477)](e=>e[n(472)]())[n(477)](r=>{const s=n;window[s(483)]&&console[s(425)](s(481),r),t[s(490)].update(r)[s(461)](function(t){const n=s;e[n(505)](new CustomEvent(n(491),{detail:{message:n(433)+t}})),console[n(422)](n(448),t)})})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent("rtcdrmerror",{detail:{message:""+t}})),console[r(422)](t)})},Io=(e,t)=>{const n=yo;Ro(ho[n(431)],t[n(441)])[n(477)](e=>{const t=n,r=e.text();return window[t(483)]&&console.info("[FPS] License fetched:",e,r),r})[n(477)](e=>{const r=n;t[r(490)][r(492)](_o(e))})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console[r(422)](t)})},Co=(e,t)=>{mo[e]=t},xo=Wi[po(426)];let To=!xo;const Ao=new Map;function Lo(e){return xi(this,void 0,void 0,function*(){const t=yo;if(null===e[t(504)])throw new Error(t(456));const n=e[t(490)];if(null===n)throw new Error("No media element available!");const r=n[t(428)];if(null===r)throw new Error(t(452));const s=vo(new Uint8Array(e[t(504)])),i=s+n.id;let o=null;Ao[t(469)](i)&&(o=Ao.get(i),null!=o&&o.close(),Ao[t(451)](i)),window[t(483)]&&console[t(425)](t(450),t(o?429:509));let a=null;try{a=r[t(479)](To?"persistent-license":"temporary")}catch(e){console[t(434)]("EME createSession(persistent) failed:",e)}if(!a&&To){To=!1;try{a=r[t(479)](t(436))}catch(e){console[t(422)]("EME createSession(temporary) failed:",e)}}if(a)if(a[t(500)](t(460),e=>{const r=t;e[r(490)][r(435)].forEach((e,t)=>{const s=r;(e===s(466)||e===s(438)||e===s(465)||e===s(463))&&n[s(505)](new CustomEvent(s(491),{detail:{message:s(515)+vo(new Uint8Array(t))+s(488)+(s(513)+e+")"),keyId:t}}))})}),xo?a.addEventListener(t(441),Io[t(467)](null,n),!1):-1!==s[t(424)](t(427))?a.addEventListener(t(441),Eo[t(467)](null,n),!1):-1!==s[t(424)](t(437))?a[t(500)](t(441),ko[t(467)](null,n),!1):a.addEventListener("message",So[t(467)](null,n),!1),o)try{(yield a[t(420)](o[t(512)]))?Ao[t(453)](i,a):n.dispatchEvent(new CustomEvent(t(491),{detail:{message:"Failed to load previous EME session"}}))}catch(e){n[t(505)](new CustomEvent(t(491),{detail:{message:t(464)+e}}))}else a[t(503)](e.initDataType,e[t(504)]).then(()=>{To&&Ao[t(453)](i,a)})[t(461)](e=>{const r=t;n[r(505)](new CustomEvent(r(491),{detail:{message:r(474)+e}}))});else n[t(505)](new CustomEvent(t(491),{detail:{message:t(442)}}))})}const Po=qo;function Oo(){const e=[" too close to seek, ","fpsCertificateUrl","9880640TWxZrg","H264","ignoreAudio","Unable to create Worker!","createMediaKeys(",", restart required: ","/license-proxy-headerauth/drmtoday/RightsManager.asmx","6236Nwzlef","worker","serverCertificateUrl","serverCertificate","seq",",255]).buffer,idrFrames.push(new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,","ClearKey","No valid DRM config found, call rtcDrmConfigure first.","sessionId","toISOString","indexOf","robustness","isInteger","info","includes","Development","slice","16niaptx"," frame","video/mp4","isArray","Android","end","PlayReady","streamType","1772WtcYWF","]: ","Frame gap: ","nextKeyFrameAllowedTime","use rtcDrmFeedFrame to push frames manually","Error recovery attempted","merchant","FairPlay","requestMediaKeySystemAccess(","pipeThrough","/license-server-fairplay/","isChrome","type","MSE (re)init","const DUMMY_IDR_FRAME_SLICE_HDR0=new Uint8Array([32,0,203]),DUMMY_IDR_FRAME_SLICE_HDR1=new Uint8Array([16,0,50]);","DRM config env value must be one of: ","length","GOP is getting too long, requesting a new key frame","Worker","let brokenFrame=null,idrFrames=[];function initializeDummyFrames(){brokenFrame=new Uint8Array([0,0,0,1,65,154,255","srcObject","RTCRtpScriptTransform","),idrFrames.push(idrFrames[0].slice());let $=new Uint8Array(idrFrames[1]);$.set([16,0,50],27)}let idrPicIdToggle=","now"," to ","join","setServerCertificate","audioCapabilities","lastKeyFrameTime","prevSeqNum"," seeking from ",".experiment","clRtcDrmDebugLog","Server certificate fetch failed with error ","isFirefox","org.w3.clearkey","x-dt-custom-data","jitterBufferTarget","playbackRate","enabled","keyFrameNeeded","createEncodedStreams","wvCertificateUrl","key","sai","Discarding corrupted video frame (too small)",'gle^=1]}function audioTransformFunction($,e){postMessage({streamType:"audio",frame:{timestamp:$.timestamp,data:$.',"H264 is the only supported video codec.","com.microsoft.playready.recommendation"," will be used","DRM config iv must be an instance of 16-byte long Uint8Array.","encryption","0;function generateDummyFrame($){return(brokenFrame||initializeDummyFrames(),$)?brokenFrame:idrFrames[idrPicIdTog","toString","message","status","bytesSinceKey","currentTime","supportsRtpScriptTransform","1585647fRskxG","audioElement","track","sinf","createObjectURL","enqueue","Invalid videoElement, it must be an instance of HTMLVideoElement.","7302558TqFWae","pipeTo","SampleAuxInfo extraction failed (video)","isEdge","keys","not-allowed","rtcdrmerror","btoa","?audioTransformFunction:videoTransformFunction});e.pipeThrough(a).pipeTo(x)}self.RTCTransformEvent&&(self.onrtctr",", a1d1f1 is recommended).","reportDiscontinuity","onFetch","keyId","sessionTypes","). Edge only supports PlayReady, Widevine and ClearKey.","audioEncrypted","audioStartTimestamp","frame","videoStartTimestamp","184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32]).buffer","Duplicate/reordered frame, prev seq: ","ClearKey is not supported by Safari.","bind",") not found in [","DRM config robustness can only be one of: ","persistent-license","postMessage","receiver","get","both","jmuxer","Production","Blob","timestamp","cenc","emeConfig","clear","cbcs-1-9","5iKPdqC","isWindows","PlayReady license acquisition might fail without output protection enabled (sessionId is ","). Chrome only supports Widevine and ClearKey.","mediaBufferMs should be an integer.","size","certificate","prLicenseUrl","fpsLicenseUrl","/license-proxy-widevine/cenc/","4572770OAoUlm","BYTES_PER_ELEMENT","then","SW_SECURE_CRYPTO","ansform=$=>{let e=$.transformer;handleTransform(e.options.operation,e.readable,e.writable)}),onmessage=$=>{keyFra","splice","Safari doesn't support 'cenc'/AES-CTR, use 'cbcs' instead if possible.","videoElement","rtcDrmConfigure did not specify audioElement, audio will be dropped",'audio/mp4; codecs="opus"',"object","Invalid audioElement, it must be an instance of HTMLMediaElement.","keyFrameNeededPosted","debugCreateMediaDump","next","play","6591266VeIbXo","userId","jitterBufferDelayHint",'ame(keyFrameNeeded),e.enqueue($)}function handleTransform($,e,x){let a=new TransformStream({transform:"audio"===$',"dispatchEvent","reduce"," bytes, playback at ","offset","arrayBuffer","waitingForIdr","Widevine","DRM config mediaBufferMs should be an integer.","hwSecurity","authToken","audio"," bytes)","push","licenseUrl","Default transform mode enabled, ","RTCRtpScriptTransform/TransformStream will not be created, ","GET","baseUrl","video","trim","7377TdQrIK","3000","playoutDelayHint","catch","fpsCertificate","POSITIVE_INFINITY","/license-server-fairplay/cert/","DRM config:","streams","mediaBufferMs","log","codec","onmessage","Target video element (","Applying pre-configured certificate (","webkitURL","Discarding corrupted video frame (no Annex B startcode)"," requesting a new key frame (latency ","PlayReady might not support '","No target media element!","URL","set","warn","data","config","isSafari","forEach","setMediaKeys","buffered"," - ","keySystem",'data}}),e.enqueue($)}let keyFrameNeeded=!1;function videoTransformFunction($,e){postMessage({streamType:"video",f',"paused","wvCertificate","a1d1f1","2000","keyFrameRequestInterval","Several DRM configs detected, rtcDrmOnTrack have to be called with target DRM config.","error","238HZxcdH","HW_SECURE_ALL","Invalid DRM type (","buffer","x-dt-auth-token","clRtcDrmCreateMediaDump",'rame:{type:$.type,timestamp:$.timestamp,data:$.data}}),"key"===$.type&&(keyFrameNeeded=!1),$.data=generateDummyFr',"addEventListener",") failed","keyFrameLogCntr","feed","byteLength","kind","purchase","environment","videoCapabilities","requestMediaKeySystemAccess","temporary","). It has to be a string containing a JWT.","value",".. ","string"];return(Oo=function(){return e})()}!function(){const e=qo,t=Oo();for(;;)try{if(parseInt(e(543))/1*(parseInt(e(512))/2)+parseInt(e(473))/3*(parseInt(e(568))/4)+-parseInt(e(672))/5*(-parseInt(e(634))/6)+-parseInt(e(536))/7+parseInt(e(560))/8*(parseInt(e(627))/9)+-parseInt(e(682))/10+-parseInt(e(449))/11==932877)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const No=Wi[Po(626)],Mo=Wi[Po(602)],Do=Wi[Po(498)],Fo=Wi[Po(637)],Uo=Wi[Po(579)],jo=Wi.platform,Vo=Wi[Po(673)],Wo=Fo||Uo&&jo===Po(564),Zo=1e6*(Mo?82:Do?220:120),Go=Mo?5e3:2e3,Bo=Mo?1.5:.5;function Yo(e){const t=Po;return typeof e!==t(692)||null===e||e instanceof Element||e instanceof De?e:function(e){const t=Po;return!!((null==e?void 0:e[t(515)])instanceof ArrayBuffer&&null!=e&&e[t(683)])}(e)?e[t(559)]():Array[t(563)](e)?e[t(454)]((e,t,n)=>(e[n]=Yo(t),e),[]):e instanceof Object?Object[t(638)](e)[t(454)]((t,n)=>(t[n]=Yo(e[n]),t),{}):e}class Ya{constructor(e){const t=Po;this[t(545)]="",this.licenseUrl="",this[t(503)]="",this[t(669)]=[],this[t(497)]=Yo(e),this[t(664)]=null,this[t(521)]=0,this[t(571)]=Date.now(),this.videoStartTimestamp=0,this.audioStartTimestamp=0,this.prevSeqNum=-1,this[t(596)]=0,this[t(624)]=0,this.keyFrameNeeded=!0,this.keyFrameNeededPosted=!1,this.keyFrameRequestInterval=Go,this.worker=null}}const zo=new Map,Xo=new Uint8Array([60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60]),Ko=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]),$o=new Uint8Array([213,251,214,184,46,217,62,78,249,138,228,9,49,238,51,183]);function Ho(e){const t=Po;let n=!1;if((e[t(497)].video&&"clear"!==e[t(497)].video[t(619)]&&"HW"===e.config[t(471)][t(554)]||e[t(497)][t(463)]&&e[t(497)][t(463)].encryption!==t(670)&&"HW"===e[t(497)][t(463)][t(554)])&&(n=!0),e.hwSecurity=n,function(e,t){const n=Po;void 0!==t&&(e[n(497)][n(482)]=t),(void 0===e[n(497)][n(482)]||e[n(497)].mediaBufferMs<0)&&(e.config[n(482)]=100,Mo?e[n(497)][n(482)]=350:!Do&&Vo&&(e[n(497)][n(580)]===n(566)||e[n(461)])&&(e[n(497)][n(482)]=1400))}(e,e[t(497)][t(482)]),void 0===e.config.authToken){void 0===e.config[t(450)]&&(e[t(497)][t(450)]=t(525)),void 0===e[t(497)][t(551)]&&(e.config[t(551)]=t(507));const n=window[t(641)](JSON.stringify({userId:e.config[t(450)],sessionId:e[t(497)][t(551)],merchant:e.config[t(574)]}));Co(t(604),n)}else Co(t(516),e.config[t(462)]);for(const n of[e[t(497)].audio,e[t(497)][t(471)]])n&&n[t(619)]!==t(670)&&(n[t(646)]||(n[t(646)]=Ko),n.iv||(n.iv=$o));e[t(546)]=void 0,e[t(545)]="",e[t(466)]="";const r=e.config[t(526)][t(470)]();var s;if(e[t(497)][t(580)]===t(549)?(e.keySystem=t(603),bo=Xo):e.config.type===t(459)?(e[t(503)]="com.widevine.alpha",Vo&&n&&(e[t(503)]+=t(599)),e.config.wvCertificate?e[t(546)]=e[t(497)][t(506)]:e[t(497)][t(610)]?e[t(545)]=e[t(497)][t(610)]:e[t(546)]=e.config[t(526)][t(678)](),e.config.wvLicenseUrl?e[t(466)]=e[t(497)].wvLicenseUrl:e[t(466)]=r+t(681)):e[t(497)][t(580)]===t(566)?(e[t(503)]=t(616),e[t(497)][t(679)]?e.licenseUrl=e[t(497)][t(679)]:e[t(466)]=r+t(542)):e[t(497)].type===t(575)&&(e.keySystem="com.apple.fps",e.config[t(477)]?e[t(546)]=e[t(497)][t(477)]:e[t(497)][t(535)]?e.serverCertificateUrl=e.config[t(535)]:e[t(545)]=r+t(479)+e[t(497)].merchant,e[t(497)][t(680)]?e[t(466)]=e.config.fpsLicenseUrl:e.licenseUrl=r+t(578)),s={licenseUrl:e[t(466)],onFetch:e.config[t(645)]},ho=s,e[t(669)]=[],e.config[t(580)]!==t(575)){e[t(669)][t(465)]({initDataTypes:[t(668)],sessionTypes:["persistent-license",t(529)]});for(const n of[e[t(497)][t(471)],e[t(497)][t(463)]])if(n&&n.encryption!==t(670)){const r=n==e[t(497)][t(471)]?t(471):t(463);let s;e[t(497)][t(580)]===t(459)?s="HW"===n[t(554)]?t(513):t(685):"PlayReady"===e[t(497)][t(580)]&&(s="HW"===n.robustness?t(474):t(508)),r===t(471)?e[t(669)][0][t(527)]=[{contentType:'video/mp4; codecs="avc1.640032"',encryptionScheme:"cenc"===n[t(619)]?t(668):"cbcs-1-9",robustness:s||void 0}]:e[t(669)][0][t(595)]=[{contentType:t(691),encryptionScheme:n[t(619)]===t(668)?"cenc":t(671),robustness:s||void 0}]}}else e[t(669)]=[{initDataTypes:[t(630)],videoCapabilities:[{contentType:t(562),robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:t(639),sessionTypes:["temporary"]}];window[t(600)]&&console.info(t(480),e)}function Jo(e){const t=Po;window[t(600)]&&console[t(556)](t(581));let n=e[t(497)].videoElement;(!e[t(497)][t(471)]||e.config[t(471)][t(619)]===t(670))&&(n=e.config.audioElement),e[t(664)]=null;const r=!e.ignoreAudio&&e[t(497)][t(463)]&&"clear"!==e[t(497)].audio[t(619)],s=e[t(497)][t(471)]&&e.config.video[t(619)]!==t(670);e[t(624)]=0,e[t(608)]=!0,e.keyFrameNeededPosted=!1,e[t(509)]=Go,e[t(652)]=0,e[t(650)]=0,e[t(597)]=-1,e[t(596)]=0,e.jmuxer=new Tn({node:n,mode:r?t(s?663:463):"video",fps:60,drm:e}),Do&&e[t(497)].videoElement&&e[t(497)][t(689)][t(448)]()[t(684)](()=>{})[t(476)](()=>{})}function Qo(e,t,n){const r=Po;if(e[r(497)][r(471)]&&"clear"===e.config[r(471)][r(619)])return null==n||n[r(632)](t),!1;const s=Date[r(591)]();if(t.type===r(611)){const n=window[r(600)];++e[r(521)]<(n?Number[r(478)]:5)&&(console[r(556)]((new Date)[r(552)]().slice(11,-1)+" "+t[r(580)]+", "+(t[r(496)].byteLength+r(455)+e[r(497)][r(689)][r(625)])),n&&1===e[r(521)]&&function(e,t=64,n=64){const r=Po,s=new Uint8Array(e[r(496)]);let i="",o=0;for(let e=0;e<t&&e<s[r(584)];++e)i+=(s[e]<16?"0":"")+s[e].toString(16)+" ";if(o<s[r(584)])for(o<s[r(584)]-n&&(i+=r(532),o=s[r(584)]-n);o<s[r(584)];o++)i+=(s[o]<16?"0":"")+s[o][r(621)](16)+" ";console.info("["+((e[r(580)]||r(463))+r(561))+r(569)+i[r(472)]())}(t,128,8)),e[r(608)]=!1,e[r(624)]=0,e[r(571)]=s+e[r(509)]}return e[r(624)]+=t.data[r(523)],!e[r(608)]&&e[r(624)]>Zo&&(console[r(556)](r(585)),e[r(608)]=!0),e.jmuxer&&(function(e,t){const n=Po;0===e[n(652)]&&(e[n(652)]=t[n(667)],e[n(509)]=Go,e[n(571)]=Date[n(591)]()+2e3);let r=null,s=!1;if(t.data[n(523)]<=4)console[n(495)](n(613)),s=!0;else{const i=new Uint8Array(t[n(496)],0,4);0!=i[0]||0!=i[1]||0!=i[2]||1!=i[3]?(console[n(495)](n(489)),s=!0):(r=function(e,t){const n=so,r=new DataView(e[n(335)]),s=e.data[n(346)]-2,i=r[n(340)](s);if(i<s){let e=s-i;if(69!==r[n(337)](s-1))return console[n(341)](n(339)),null;if(r.getUint8(e++)>>>4!=1)return console[n(341)](n(329)),null;const o=new Uint8Array(i-2);let a=0,c=0;for(;e<s-1;){let t=r.getUint8(e++);c>1&&3===t&&(c=0,t=r.getUint8(e++)),0!==t?c=0:++c,o[a++]=t}const l=new DataView(o[n(343)]),u=t===n(327)?16:0,d=u+2+6*l.getUint16(u);return d+2>a?(console.error(n(325)),null):{sai:o[n(345)](0,d),offset:s-i,seq:l.getUint16(d)}}return null}(t,e[n(497)][n(471)][n(619)]),!r&&(console.warn(n(636)),s=!0))}if(r)if(-1===e[n(597)]){if(t[n(580)]!==n(611))return 0;e[n(597)]=r[n(547)]}else{let i=r.seq-e[n(597)];if(i<-32767&&(i+=65536),i<=0)return window[n(600)]&&console[n(495)](n(654)+e[n(597)]+", curr: "+r[n(547)]),0;i>1&&(s=t[n(580)]!==n(611),console[n(495)](n(570)+e[n(597)]+n(502)+r[n(547)]+n(541)+s)),e.prevSeqNum=r[n(547)]}let i=0;s&&!e[n(664)][n(458)]&&(i=-1,e[n(664)][n(644)]());const o=(t[n(667)]-e[n(652)])/9e4;return r&&e[n(664)][n(522)]({video:new Uint8Array(t.data,0,r[n(456)]),videoSampleAuxInfo:r[n(612)],timestamp:o})<0&&(i=-1,console[n(495)](n(573)),Jo(e)),i>=0&&"key"===t[n(580)]&&(e[n(596)]=o,console[n(483)]((new Date)[n(552)]()[n(559)](11,-1)+" kf at "+o+", playback at "+e[n(497)].videoElement[n(625)])),i}(e,t)<0?e[r(608)]=!0:function(e){const t=Po,n=e.config[t(689)];if(!n||n[t(501)][t(584)]<1||n[t(505)]||n[t(625)]<Bo)return;const r=e[t(497)].mediaBufferMs;if(void 0===r||r<0)throw new Error("targetLatency not set!");const s=n[t(501)][t(565)](n[t(501)][t(584)]-1),i=1e3*(s-n[t(625)])|0;if(!e[t(649)]&&function(e,t,n){const r=Po;let s;s=t<3*n>>>2?.875:t<=n?1:t<7*n>>>2?1.125:t<9*n>>>2?1.25:t<11*n>>>2?1.375:1.5,s!==e.playbackRate&&(e[r(606)]=s)}(n,i,r),!(i<r+50||i<5*r>>>2))if(e.lastKeyFrameTime>n[t(625)]+.1){const i=1e3*(s-e[t(596)])|0;i>40&&i>r-100?(window[t(600)]&&console.info((new Date).toISOString().slice(11,-1)+t(598)+(n[t(625)]+t(592)+e[t(596)]+" (")+(e.lastKeyFrameTime-n[t(625)])+")"),n[t(625)]=e[t(596)]):console[t(483)]((new Date)[t(552)]().slice(11,-1)+t(534)+i)}else!e[t(608)]&&Date[t(591)]()>e[t(571)]&&i>r+100&&i>3*r>>>1&&(window[t(600)]&&console[t(556)]((new Date).toISOString()[t(559)](11,-1)+t(490)+i+" ms)"),e[t(608)]=!0,e[t(509)]<16e3&&(e[t(509)]<<=1))}(e)),n?(!e[r(608)]||!Wo)&&(t[r(496)]=function(e){return!co&&function(){const e=oo;co=new Uint8Array([0,0,0,1,65,154,255,255]).buffer,ao[e(303)](new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32])[e(306)]),ao[e(303)](ao[0][e(299)](0)),new Uint8Array(ao[1]).set([16,0,50],27)}(),e?co:(lo^=1,ao[lo])}(e[r(608)]),n[r(632)](t)):e[r(608)]!=e[r(445)]&&(e.worker&&e[r(544)][r(660)](e[r(608)]),e[r(445)]=e[r(608)]),e[r(608)]}function qo(e,t){const n=Oo();return(qo=function(e,t){return n[e-=445]})(e,t)}function ea(e,t,n){const r=Po;return e[r(497)][r(463)]&&e[r(497)].audio[r(619)]!==r(670)?t[r(496)][r(523)]>0&&function(e,t){const n=Po;var r;if(!e.jmuxer||e[n(538)])return 0;0===e[n(650)]&&(e[n(650)]=t[n(667)]);const s=(t[n(667)]-e.audioStartTimestamp)/48e3;if("cbcs"===(null===(r=e.config[n(463)])||void 0===r?void 0:r[n(619)]))return e[n(664)][n(522)]({audio:new Uint8Array(t[n(496)]),timestamp:s});const i=function(e){const t=so,n=new DataView(e.data),r=e.data[t(346)]-2,s=n.getUint16(r);if(s<r){let e=r-s;if(69!==n[t(337)](r-1))return console[t(341)](t(339)),null;if(n[t(337)](e++)>>>4!=1)return console[t(341)](t(329)),null;const i=new Uint8Array(s-2);let o=0;for(;e<r-1;){const r=n[t(337)](e++);if(i[o++]=r,o>=16)break}return{sai:i,offset:r-s}}return null}(t);i?e[n(664)][n(522)]({audio:new Uint8Array(t[n(496)],0,i[n(456)]),audioSampleAuxInfo:i[n(612)],timestamp:s}):console[n(511)]("SampleAuxInfo extraction failed (audio)")}(e,t):n&&n[r(632)](t),!1}function ta(e){const t=Po;if(!e||typeof e!==t(692))throw new TypeError("Invalid config argument type, DRM config must be an object.");if(!(e[t(689)]instanceof HTMLVideoElement))throw new TypeError(t(633));if(e[t(628)]&&!(e.audioElement instanceof HTMLMediaElement))throw new TypeError(t(693));if(void 0!==e[t(482)]&&!Number[t(555)](e[t(482)]))throw new TypeError(t(460));let n=!1,r=!1,s=!1;const i=["cbcs",t(668),t(670)],o=["SW","HW"];for(const a of[e[t(471)],e[t(463)]])if(a){if(!i[t(557)](a[t(619)]))throw new RangeError("DRM config encryption value must be one of: "+i[t(593)](", "));if(Do&&"cenc"===a.encryption)throw new RangeError(t(688));if(a[t(619)]!==t(670)){if(r=!0,a.keyId){if(!(a[t(646)]instanceof Uint8Array)||16!==a.keyId[t(584)])throw new TypeError("DRM config keyId must be an instance of 16-byte long Uint8Array.");s=!0}else if(Do)throw new ReferenceError(t(655));if(a.iv&&(!(a.iv instanceof Uint8Array)||16!==a.iv.length))throw new TypeError(t(618));if(a[t(554)]&&!o[t(557)](a.robustness))throw new RangeError(t(658)+o[t(593)](", "));if(a===e[t(471)]&&a[t(484)]!==t(537))throw new RangeError(t(615));Do&&a===e.audio&&"opus"===a.codec&&(n=!0,console.warn("Safari does not support Opus, audio will not be rendered.")),"PlayReady"===e[t(580)]&&(a[t(619)]!==t(668)&&console[t(495)](t(491)+a[t(619)]+"', it's safer to use 'cbcs' instead."),void 0===e.sessionId||e.sessionId[t(557)]("f1")||console.warn(t(674)+e.sessionId+t(643)))}}if(r){const n=[De[t(558)],De.Staging,De[t(665)]];if(!n.includes(e[t(526)]))throw new RangeError(t(583)+n.join(", "));if(e[t(462)]&&typeof e[t(462)]!==t(533))throw new TypeError("Invalid authToken type ("+typeof e[t(462)]+t(530));if(e.type)if(Do){if(e[t(580)]!==t(575))throw new RangeError(t(514)+e[t(580)]+"). Safari only supports FairPlay.")}else if(Uo){if(e.type!==t(459)&&"ClearKey"!==e[t(580)])throw new RangeError("Invalid DRM type ("+e.type+t(675))}else if(Fo&&e[t(580)]!==t(566)&&"Widevine"!==e[t(580)]&&"ClearKey"!==e[t(580)])throw new RangeError(t(514)+e.type+t(648))}void 0!==e.debugLog&&(window[t(600)]=e.debugLog),void 0!==e[t(446)]&&(window[t(517)]=e[t(446)]);let a=zo.get(e[t(689)]);!a&&(a=new Ya(e),zo[t(494)](e[t(689)],a)),a.enabled=r,a[t(538)]=n,a[t(649)]=!n&&a[t(497)][t(463)]&&a[t(497)].audio.encryption!==t(670),r&&(a[t(497)].type||(a[t(497)][t(580)]=t(Do?575:459)),s||a[t(497)][t(580)]===t(549)||(a[t(497)][t(580)]=t(549)),Ho(a),function(e){xi(this,void 0,void 0,function*(){const t=qo;var n,r;let s=e[t(497)][t(689)];if((!e[t(497)][t(471)]||e[t(497)][t(471)].encryption===t(670))&&(s=e[t(497)][t(628)]),!s)throw new Error(t(492));s.src="",s[t(588)]=null,yield s.setMediaKeys(null);let i=null;try{i=yield navigator[t(528)](e[t(503)],e.emeConfig)}catch(e){}if(!i&&e[t(669)][0]){const s=null===(n=e[t(669)][0][t(647)])||void 0===n?void 0:n[t(553)](t(659));if(void 0!==s&&s>=0){null===(r=e.emeConfig[0].sessionTypes)||void 0===r||r[t(687)](s,1);try{i=yield navigator[t(528)](e[t(503)],e[t(669)])}catch(e){}}}if(!i){const n=t(576)+e[t(503)]+t(520);return s.dispatchEvent(new CustomEvent(t(640),{detail:{message:n}})),void console[t(511)](n)}let o=null;try{o=yield i.createMediaKeys()}catch(e){}if(!o){const n=t(540)+e[t(503)]+t(520);return s[t(453)](new CustomEvent("rtcdrmerror",{detail:{message:n}})),void console[t(511)](n)}if(e.serverCertificate)window.clRtcDrmDebugLog&&console[t(556)](t(487)+e[t(546)][t(523)]+t(464)),yield o[t(594)](e[t(546)]);else if(e.serverCertificateUrl){const n={method:t(469)},r=e.serverCertificateUrl;try{const i=yield e[t(497)].onFetch?e.config[t(645)](r,n):fetch(r,n);if(!i.ok){const e=t(601)+i[t(623)];return void s[t(453)](new CustomEvent(t(640),{detail:{message:e}}))}const a=yield i[t(457)]();window.clRtcDrmDebugLog&&console[t(556)]("Fetched certificate from "+r+", "+a[t(523)]+" bytes"),yield o[t(594)](a)}catch(e){const n=e.name+": "+e[t(622)];return console.error(n),void s[t(453)](new CustomEvent(t(640),{detail:{message:n}}))}}yield s[t(500)](o),s[t(519)]("encrypted",Lo),Jo(e)})}(a)),a[t(497)][t(689)][t(519)](t(448),function(){const e=t;a[e(497)][e(689)][e(625)]>.5&&(a[e(571)]=Date.now())})}const na=Po(582)+Po(587)+Po(548)+Po(653)+Po(590)+Po(620)+Po(614)+Po(504)+Po(518)+Po(452)+Po(642)+Po(686)+"meNeeded=$.data};";function ra(e){const t=Po;if(0===zo[t(677)])throw new TypeError(t(550));let n;if(e&&e[t(689)])n=e[t(689)];else{if(1!==zo.size)throw new TypeError(t(510));n=zo[t(638)]()[t(447)]()[t(531)]}const r=zo[t(662)](n);if(!r){let e="";throw zo[t(499)]((t,n)=>{e+=n.id+", "}),e=e.slice(0,-2),new TypeError(t(486)+n.id+t(657)+e+"]")}return r}function sa(e,t){const n=Po;if(e&&e[n(497)][n(689)]){const r=e[n(497)][n(689)];if(r[n(501)].length>0){const e=r.buffered[n(565)](r[n(501)][n(584)]-1)-r[n(625)];t.playoutDelayHint=t.jitterBufferDelayHint=t.jitterBufferTarget=e}setTimeout(sa,1e3,e,t)}}const aa=St.get("View");aa.setLevel(St.DEBUG);const ca={metadata:!1,enableDRM:!1,disableVideo:!1,disableAudio:!1,peerConfig:{autoInitStats:!0,statsIntervalMs:1e3}};class cc extends bi{constructor(e,t,n=null,r=!0){e&&aa.warn("The streamName property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, set via token generator"),super(null,t,aa,r),this.payloadTypeCodec={},this.tracksMidValues={},this.drmOptionsMap=null,this.eventQueue=[],this.isMainStreamActive=!1,n&&(this.on(Ss.track,e=>{n.srcObject=e.streams[0]}),aa.warn("The mediaElement property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, do this in either the `track` or the `active` broadcast event."))}async connect(e=ca){this.options=Me(Ne(Ne({},ca),e),{peerConfig:Ne(Ne({},ca.peerConfig),e.peerConfig),setSDPToPeer:!1}),this.eventQueue.length=0,await this.initConnection({migrate:!1})}async select(e={}){aa.debug("Viewer select layer values: ",e),await this.signaling.cmd("select",{layer:e}),aa.info("Connected to streamName: ",this.streamName)}async addRemoteTrack(e,t){aa.info("Viewer adding remote track",e);const n=await this.webRTCPeer.addRemoteTrack(e,t);for(const e of t)e.addTrack(n.receiver.track);return n}async project(e,t){for(const e of t){if(!e.trackId&&!e.media)throw aa.error("Error in projection mapping, trackId or mediaId must be set"),new Error("Error in projection mapping, trackId or mediaId must be set");const t=this.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw aa.error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers")),new Error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers"))}aa.debug("Viewer project source: layer mappings: ",e,t),await this.signaling.cmd("project",{sourceId:e,mapping:t}),aa.info("Projection done")}async unproject(e){aa.debug("Viewer unproject mediaIds: ",e),await this.signaling.cmd("unproject",{mediaIds:e}),aa.info("Unprojection done")}async replaceConnection(){aa.info("Migrating current connection"),await this.initConnection({migrate:!0})}stop(){var e,t;super.stop(),null==(e=this.drmOptionsMap)||e.clear(),this.DRMProfile=null,null==(t=this.worker)||t.terminate(),this.worker=null,this.payloadTypeCodec={},this.tracksMidValues={},this.eventQueue.length=0}async initConnection(e){var t;let n,r;if(aa.debug("Viewer connect options values: ",this.options),this.stopReconnection=!1,!e.migrate&&this.isActive())throw aa.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{r=await this.tokenGenerator(),this.options.peerConfig.iceServers=null==r?void 0:r.iceServers,this.options.peerConfig.encodedInsertableStreams=Si&&(this.options.enableDRM||this.options.metadata)}catch(e){throw aa.error("Error generating token."),e instanceof mr&&(401!==e.status&&this.autoReconnect?this.reconnect():this.stopReconnection=!0),e}if(!r)throw aa.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const s=hi(r.jwt);this.streamName=s.millicast.streamName;const i=new mi({streamName:this.streamName,url:"".concat(r.urls[0],"?token=").concat(r.jwt)});r.subscriberToken&&(this.subscriberToken=r.subscriberToken);const o=e.migrate?new tt:this.webRTCPeer;await o.createRTCPeer(this.options.peerConfig),null==(t=this.stopReemitingWebRTCPeerInstanceEvents)||t.call(this),this.stopReemitingWebRTCPeerInstanceEvents=Gt(o,this,Object.values(Ss).filter(e=>e!==Ss.track)),this.options.metadata&&(this.worker||(this.worker=new ki),this.worker.onmessage=e=>{if("metadata"===e.data.event){const t=new TextDecoder,n=e.data.metadata;if(n.mid=e.data.mid,n.track=this.tracksMidValues[e.data.mid],n.uuid){const e=n.uuid;n.uuid=e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),n.uuid=n.uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5")}if(n.timecode&&(n.timecode=new Date(t.decode(n.timecode))),n.unregistered){const e=t.decode(n.unregistered);try{const t=JSON.parse(e);n.unregistered=t}catch(e){aa.info("The content could not be converted to JSON, returning raw bytes instead")}}this.emit("metadata",n),this.emit("onMetadata",n)}}),o.on(Ss.track,e=>{this.isMainStreamActive?this.onTrackEvent(e):this.eventQueue.push(e)}),i.on(Vs,async e=>{if(this.isMainStreamActive||"active"!==e.name)"inactive"===e.name&&this.isMainStreamActive&&this.mainSourceId===e.data.sourceId&&(this.isMainStreamActive=!1),this.emit(Vs,e);else{if(this.mainSourceId=e.data.sourceId,!this.DRMProfile&&e.data.encryption){const e=await this.tokenGenerator();e.drmObject&&(this.DRMProfile=e.drmObject)}for(this.emit(Vs,e),this.isMainStreamActive=!0;this.eventQueue.length>0;)this.onTrackEvent(this.eventQueue.shift())}});const a=o.getRTCLocalSDP(Me(Ne({},this.options),{stereo:!0})),c=i.connect();n=await Promise.all([a,c]);const l=n[0];let u=this.signaling;this.signaling=i;const d=this.signaling.subscribe(l,Me(Ne({},this.options),{vad:this.options.multiplexedAudioTracks>0})),p=o.peer.setLocalDescription(o.sessionDescription);n=await Promise.all([d,p]);const f=n[0];this.payloadTypeCodec=ms.getCodecPayloadType(f),await o.setRTCRemoteSDP(f),aa.info("Connected to streamName: ",this.streamName);let h=this.webRTCPeer;this.webRTCPeer=o,this.setReconnect(),e.migrate&&this.webRTCPeer.on(Ss.connectionStateChange,e=>{var t,n;"connected"===e?setTimeout(()=>{var e,t;null==(e=null==u?void 0:u.close)||e.call(u),null==(t=null==h?void 0:h.closeRTCPeer)||t.call(h),u=h=null,aa.info("Current connection migrated")},1e3):["disconnected","failed","closed"].includes(e)&&(null==(t=null==u?void 0:u.close)||t.call(u),null==(n=null==h?void 0:h.closeRTCPeer)||n.call(h),u=h=null)})}onTrackEvent(e){var t,n,r;if(this.tracksMidValues[null==(t=e.transceiver)?void 0:t.mid]=e.track,this.isDRMOn){const t=e.transceiver.mid,n=this.getDRMConfiguration(t);try{!function(e,t){const n=Po;var r,s;const i=e[n(629)][n(524)];"video"===i&&(e[n(661)][n(475)]=e[n(661)][n(451)]=e[n(661)][n(605)]=0);const o=ra(t),a=o[n(497)].videoElement,c=o[n(497)][n(628)];if(o[n(607)]){if(o[n(497)].customTransform)window.clRtcDrmDebugLog&&console[n(556)](n(468)+n(572));else if(window[n(600)]&&console[n(556)](n(467)+(n(No?589:609)+n(617))),No){if(o[n(544)]=function(e){const t=Po,n=window[t(493)]||window[t(488)],r=window[t(666)],s=window[t(586)];if(!(n&&r&&s&&e))return null;const i=new r([e]);return new s(n[t(631)](i))}(na),null==o[n(544)])throw new Error(n(539));o[n(544)][n(485)]=e=>{const t=n;e[t(496)][t(567)]===t(471)?Qo(o,e[t(496)].frame,null):ea(o,e[t(496)][t(651)],null)},e[n(661)].transform=new RTCRtpScriptTransform(o.worker,{operation:i})}else{const t=i===n(471)?Qo:ea,r={drm:o,transform:(e,n)=>{t(o,e,n)}},s=e.receiver.createEncodedStreams(),a=new TransformStream({transform:r.transform[n(656)](r)}),{readable:c,writable:l}=s;c[n(577)](a)[n(635)](l)}if("audio"===i&&(null===(r=o[n(497)][n(463)])||void 0===r?void 0:r.encryption)===n(670)){if(!c)return void console.warn(n(690));c[n(588)]!==e[n(481)][0]&&(c[n(588)]=e[n(481)][0]),o[n(497)].videoElement&&(e[n(661)][n(475)]=e[n(661)].jitterBufferDelayHint=e[n(661)][n(605)]=o[n(497)][n(482)],sa(o,e[n(661)]))}else"video"===i&&"clear"===(null===(s=o.config[n(471)])||void 0===s?void 0:s[n(619)])&&a[n(588)]!==e[n(481)][0]&&(a.srcObject=e.streams[0])}else a[n(588)]!==e[n(481)][0]&&(a.srcObject=e[n(481)][0])}(e,n)}catch(e){aa.error("Failed to apply DRM on media Id:",t,"error is: ",e),this.emit("error",new Error("Failed to apply DRM on media Id: "+t+" error is: "+e))}this.worker||(this.worker=new ki),this.worker.addEventListener("message",e=>{"complete"===e.data.event&&function(e,t,n){const r=Po,s=ra(n);e[r(580)]?Qo(s,e,t):ea(s,e,t)}(e.data.frame,null,n)})}if(this.options.metadata)if(_i)e.receiver.transform=new RTCRtpScriptTransform(this.worker,{name:"receiverTransform",payloadTypeCodec:Ne({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(n=e.transceiver)?void 0:n.mid});else if(Si){const{readable:t,writable:n}=e.receiver.createEncodedStreams();this.worker.postMessage({action:"insertable-streams-receiver",payloadTypeCodec:Ne({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(r=e.transceiver)?void 0:r.mid,readable:t,writable:n},[t,n])}this.emit(Ss.track,e)}getDRMConfiguration(e){return this.drmOptionsMap?this.drmOptionsMap.get(e):null}async onRtcDrmFetch(e,t){return t.headers||(t.headers=new Headers),t.headers.get("x-dt-custom-data")&&t.headers.delete("x-dt-custom-data"),this.subscriberToken?t.headers.append("Authorization","Bearer ".concat(this.subscriberToken)):aa.warn("onRtcDrmFetch: no subscriberToken"),fetch(e,t)}configureDRM(e){if(!e)throw new Error("Required DRM options is not provided");this.drmOptionsMap||(this.drmOptionsMap=new Map);const t={merchant:"dolby",environment:De.Production,customTransform:this.options.metadata,videoElement:e.videoElement,audioElement:e.audioElement,video:{codec:"H264",encryption:"cbcs",keyId:Ii(e.videoEncryptionParams.keyId),iv:Ii(e.videoEncryptionParams.iv)},audio:{codec:"opus",encryption:"clear"},onFetch:this.onRtcDrmFetch.bind(this)};e.mediaBufferMs&&(t.mediaBufferMs=e.mediaBufferMs),this.DRMProfile&&(this.DRMProfile.playReadyUrl&&(t.prLicenseUrl=this.DRMProfile.playReadyUrl),this.DRMProfile.widevineUrl&&(t.wvLicenseUrl=this.DRMProfile.widevineUrl),this.DRMProfile.fairPlayUrl&&(t.fpsLicenseUrl=this.DRMProfile.fairPlayUrl),this.DRMProfile.fairPlayCertUrl&&(t.fpsCertificateUrl=this.DRMProfile.fairPlayCertUrl));try{ta(t),this.drmOptionsMap.set(e.videoMid,t),e.audioMid&&this.drmOptionsMap.set(e.audioMid,t),t.videoElement.addEventListener("rtcdrmerror",e=>{aa.error("DRM error: ",e.detail.message,"in video element:",t.videoElement.id),this.emit("error",new Error(e.detail.message))})}catch(t){aa.error("Failed to configure DRM with options:",e,"error is:",t)}}removeDRMConfiguration(e){var t;null==(t=this.drmOptionsMap)||t.delete(e)}get isDRMOn(){return!!this.drmOptionsMap&&this.drmOptionsMap.size>0}exchangeDRMConfiguration(e,t){const n=this.getDRMConfiguration(e),r=this.getDRMConfiguration(t);if(null===n)throw new Error("No DRM configuration found for "+e);if(null===r)throw new Error("No DRM configuration found for "+t);Ci(n.video,r.video,"keyId"),Ci(n.video,r.video,"iv");try{ta(n)}catch(e){aa.error("Failed to configure DRM with options:",n,"error is:",e)}try{ta(r)}catch(e){aa.error("Failed to configure DRM with options:",r,"error is:",e)}}}const la="rts/status",ua="rts/viewer-count",da="stats/stats-frequent";var pa,fa=Object.freeze({__proto__:null,STATUS:la,VIEWER_COUNT:ua,STATS:"rts/stats",STATS_FREQUENT:da});!function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(pa||(pa={}));const ha="is-playing",ma="is-paused",ga="is-loaded",ya="is-loading",va="is-starting",ba="is-seeking",wa="is-disabled",Sa="is-small",Ra="is-tiny",ka="is-rtl",Ia="is-ended",Ca="is-live",xa="is-error",La="is-waiting",Pa="is-autoplay",Oa="is-toggling",Na="is-live-seeked",Ma="no-timeline",Da="has-poster",Fa="will-play",Ua="will-pause",ja="will-seek",Va="is-seekable",Wa="is-in-viewport",Za="no-controls",Ga="is-destroyed";var Ba=Object.freeze({__proto__:null,PLAYING:ha,FULLSCREEN:"is-fullscreen",PAUSED:ma,MUTED:"is-muted",LOADED:ga,LOADING:ya,STARTING:va,SEEKING:ba,GRABBING:"is-grabbing",DISABLED:wa,SMALL:Sa,TINY:Ra,RTL:ka,TV:"is-tv",ENDED:Ia,LIVE:Ca,ERRORED:xa,WAITING:La,AUTOPLAY:Pa,SEAMLESS:"is-seamless",TOGGLING:Oa,LIVE_SEEKED:Na,NO_DVR:Ma,HAS_POSTER:Da,WILL_PLAY:Fa,WILL_PAUSE:Ua,MENU_OPENED:"has-menu-opened",TOUCHED:"is-touched",HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:ja,SEEKABLE:Va,IN_VIEWPORT:Wa,NO_CONTROLS:Za,DESTROYED:Ga,IS_SOURCE_PROCESSING:"is-source-processing"});const za={Unknown:"00-00",MediaUnknown:"01-00",MediaUnavailable:"01-01",MediaUnsupportedVideoFormat:"01-02",MediaUnsupportedAudioFormat:"01-03",MediaBitrateExceeded:"01-04",MediaBufferOverread:"01-05",MediaIntegerOverflow:"01-06",MediaQuotaExceeded:"01-07",MediaInvalidCompositionDuration:"01-08",MediaInvalidCompositionSourceDuration:"01-09",MediaInvalidCompositionSourceStartTime:"01-10",MediaMalformedDepth:"01-11",PlaybackUnknown:"02-00",PlaybackVideoBufferUnderRun:"02-01",PlaybackAudioBufferUnderRun:"02-02",PlaybackVideoBufferingTimeout:"02-03",PlaybackAudioBufferingTimeout:"02-04",PlaybackManifestParseError:"02-05",PlaybackVideoDecodeError:"02-06",PlaybackAudioDecodeError:"02-07",PlaybackDroppedFramesExceeded:"02-08",PlaybackPlayheadExceedsDuration:"02-09",PlaybackUnsupportedDevice:"02-10",PlaybackManifestLoadError:"02-11",PlaybackManifestLoadTimeout:"02-12",PlaybackManifestParsingError:"02-13",PlaybackManifestIncompatibleCodecs:"02-14",PlaybackLevelEmptyError:"02-15",PlaybackLevelLoadError:"02-16",PlaybackLevelLoadTimeout:"02-17",PlaybackLevelSwitchError:"02-18",PlaybackAudioTrackLoadError:"02-19",PlaybackAudioTrackLoadTimeout:"02-20",PlaybackFragLoadError:"02-21",PlaybackFragLoadTimeout:"02-22",PlaybackFragDecryptError:"02-23",PlaybackFragParsingError:"02-24",PlaybackFragGap:"02-25",PlaybackRemuxAllocError:"02-26",PlaybackBufferAddCodecError:"02-27",PlaybackBufferIncompatibleCodecs:"02-28",PlaybackBufferAppendError:"02-29",PlaybackBufferStalledError:"02-30",PlaybackBufferFullError:"02-31",PlaybackBufferSeekOverHole:"02-32",PlaybackBufferNudgeOnStall:"02-33",PlaybackInternalException:"02-34",PlaybackInternalAborted:"02-35",PlaybackManifestLoaderFailure:"02-36",PlaybackSegmentBaseLoaderError:"02-37",PlaybackTimeSyncFailed:"02-38",PlaybackFragmentLoaderFailure:"02-39",PlaybackAppendError:"02-40",PlaybackRemoveError:"02-41",PlaybackDataUpdateFailed:"02-42",PlaybackManifestNoStreams:"02-43",PlaybackUnknownManifestType:"02-44",PlaybackDashInsufficientSegmentInfo:"02-45",PlaybackDashNoRepresentations:"02-46",PlaybackDashNoAdaptationSets:"02-47",PlaybackDashNoInitSegment:"02-48",PlaybackDashUnsupportedContainerFormat:"02-49",PlaybackDashKeySystemMismatch:"02-50",PlaybackMultipleKeyIDs:"02-51",PlaybackDashConflictingKeyIDs:"02-52",PlaybackRestrictedStreams:"02-53",PlaybackHlsMasterAndMediaTags:"02-54",PlaybackRepresentationIdConflict:"02-55",PlaybackHlsUnsupportedKeyFormats:"02-56",PlaybackManifestNoVariants:"02-57",PlaybackHlsUndeclaredVariables:"02-58",PlaybackAes128InvalidKeyLength:"02-59",PlaybackDashConflictingAes128Keys:"02-60",PlaybackDashUnsupportedAes128Encryption:"02-61",PlaybackManifestPatchMismatch:"02-62",PlaybackEmptyMediaPlaylist:"02-63",PlaybackNonContiguousCompositionTrack:"02-64",PlaybackDecoderNotFound:"02-65",PlaybackDecoderTemporarilyUnavailable:"02-66",PlaybackIncompatibleAsset:"02-67",PlaybackNoCompatibleExternalDisplay:"02-69",PlaybackOutOfMemory:"02-70",PlaybackToneMappingFailed:"02-71",PlaybackVideoCompositorFailed:"02-72",NetworkUnknown:"03-00",NetworkNoInternet:"03-01",NetworkRequestTimeout:"03-02",NetworkUnableToResolveHost:"03-03",NetworkResourceNotFound:"03-04",NetworkExpiredUrl:"03-05",NetworkUrlResolutionFailed:"03-06",NetworkDownloadErrorIdManifest:"03-07",NetworkDownloadErrorIdSidx:"03-08",NetworkDownloadErrorIdContent:"03-09",NetworkDownloadErrorIdInitialization:"03-10",NetworkDownloadErrorIdXlink:"03-11",NetworkHttpRequestFailed:"03-12",NetworkMaxRetriesExceeded:"03-13",NetworkSegmentMissing:"03-14",NetworkHttp400BadRequest:"03-400",NetworkHttp401Unauthorized:"03-401",NetworkHttp402PaymentRequired:"03-402",NetworkHttp403Forbidden:"03-403",NetworkHttp404NotFound:"03-404",NetworkHttp405MethodNotAllowed:"03-405",NetworkHttp406NotAcceptable:"03-406",NetworkHttp407ProxyAuthenticationRequired:"03-407",NetworkHttp408RequestTimeout:"03-408",NetworkHttp409Conflict:"03-409",NetworkHttp410Gone:"03-410",NetworkHttp411LengthRequired:"03-411",NetworkHttp412PreconditionFailed:"03-412",NetworkHttp413PayloadTooLarge:"03-413",NetworkHttp414URITooLong:"03-414",NetworkHttp415UnsupportedMediaType:"03-415",NetworkHttp416RangeNotSatisfiable:"03-416",NetworkHttp417ExpectationFailed:"03-417",NetworkHttp418ImATeapot:"03-418",NetworkHttp421MisdirectedRequest:"03-421",NetworkHttp422UnprocessableEntity:"03-422",NetworkHttp423Locked:"03-423",NetworkHttp424FailedDependency:"03-424",NetworkHttp425TooEarly:"03-425",NetworkHttp426UpgradeRequired:"03-426",NetworkHttp428PreconditionRequired:"03-428",NetworkHttp429TooManyRequests:"03-429",NetworkHttp431RequestHeaderFieldsTooLarge:"03-431",NetworkHttp451UnavailableForLegalReasons:"03-451",NetworkHttp500InternalServerError:"03-500",NetworkHttp501NotImplemented:"03-501",NetworkHttp502BadGateway:"03-502",NetworkHttp503ServiceUnavailable:"03-503",NetworkHttp504GatewayTimeout:"03-504",NetworkHttp505HTTPVersionNotSupported:"03-505",NetworkHttp506VariantAlsoNegotiates:"03-506",NetworkHttp507InsufficientStorage:"03-507",NetworkHttp508LoopDetected:"03-508",NetworkHttp510NotExtended:"03-510",NetworkHttp511NetworkAuthenticationRequired:"03-511",ContentProtectionUnknown:"04-00",ContentProtectionConcurrentStreamLimitExceeded:"04-01",ContentProtectionEntitlementRefused:"04-02",ContentProtectionLicenseExpired:"04-03",ContentProtectionBadLicenseRequest:"04-04",ContentProtectionLicenseServerTimeout:"04-05",ContentProtectionInsufficientHDCPSupport:"04-06",ContentProtectionGeoRestricted:"04-07",ContentProtectionParentalControlRestricted:"04-08",ContentProtectionCDNUnauthorized:"04-09",ContentProtectionInvalidAccessToken:"04-10",ContentProtectionKeySystemNoKeys:"04-11",ContentProtectionKeySystemNoAccess:"04-12",ContentProtectionKeySystemNoSession:"04-13",ContentProtectionKeySystemNoConfiguredLicense:"04-14",ContentProtectionKeySystemCertificateRequestFailed:"04-15",ContentProtectionKeySystemCertificateUpdateFailed:"04-16",ContentProtectionKeySystemSessionUpdateFailed:"04-17",ContentProtectionKeySystemStatusOutputRestricted:"04-18",ContentProtectionKeySystemStatusInternalError:"04-19",ContentProtectionKeyLoadError:"04-20",ContentProtectionKeyLoadTimeout:"04-21",ContentProtectionCapabilityMediaKeysError:"04-22",ContentProtectionManifestKeySystemUnknown:"04-23",ContentProtectionKeySystemUnavailable:"04-24",ContentProtectionCDMCreationFailed:"04-25",ContentProtectionCDMAttachFailed:"04-26",ContentProtectionCDMServerCertificateRejected:"04-27",ContentProtectionCDMSessionCreationFailed:"04-28",ContentProtectionCDMLicenseRequestFailed:"04-29",ContentProtectionCDMLicenseResponseRejected:"04-30",ContentProtectionManifestMissingDRMInfo:"04-31",ContentProtectionLicenseServerMissing:"04-32",ContentProtectionOfflineSessionRemoved:"04-33",ContentProtectionInitDataTransformationError:"04-34",ContentProtectionServerCertificateRequestFailed:"04-35",ContentProtectionInsufficientHDCPVersion:"04-36",ContentProtectionHDCPVersionCheckFailed:"04-37",AdsUnknown:"08-00",AdsVastParseError:"08-100",AdsInvalidVastSchema:"08-101",AdsVastVersionNotSupported:"08-102",AdsUnexpectedAdType:"08-200",AdsCreativeLinearityMismatch:"08-201",AdsCreativeDurationMismatch:"08-202",AdsCreativeSizeMismatch:"08-203",AdsWrapperVastError:"08-300",AdsVastResponseRedirectTimeout:"08-301",AdsWrapperLimitReached:"08-302",AdsVastResponseEmpty:"08-303",AdsLinearAdDisplayError:"08-400",AdsMediaFileNotFound:"08-401",AdsMediaFileUnavailable:"08-402",AdsUnsupportedMimeType:"08-403",AdsUnableToDisplayMediaFile:"08-405",AdsMezzanineFileMissing:"08-406",AdsMezzanineFileDownloaded:"08-407",AdsRejectedAd:"08-408",AdsInteractiveCreativeError:"08-409",AdsVerificationNodeExecutionError:"08-410",AdsNonLinearAdDisplayError:"08-500",AdsNonLinearAdSizeMismatch:"08-501",AdsNonLinearAdFetchError:"08-502",AdsNonLinearUnsupportedType:"08-503",AdsCompanionAdDisplayError:"08-600",AdsCompanionAdSizeMismatch:"08-601",AdsRequiredCompanionAdError:"08-602",AdsCompanionAdFetchError:"08-603",AdsUndefinedVastError:"08-900",AdsUnknownVpaidError:"08-901",AdsVastDocumentEmpty:"08-999"},Xa=Object.fromEntries(Object.entries(za).map(([e,t])=>[t,e])),Ka=[1e7]+""+-1e3+-4e3+-8e3+-1e11,$a=()=>"undefined"==typeof crypto?"":Ka.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),Ha="without_recovery",Ja="off";class FlowplayerError extends Error{static getErrorKey(e){return e in Xa?Xa[e]:Xa["00-00"]}constructor(e,t,n={}){super(e),this.message=e,this.flowplayerErrorCode=t,this.config=n,this.id=$a(),this.isFatal=!!n.isFatal,this.errorKey=FlowplayerError.getErrorKey(this.flowplayerErrorCode)||"unknown"}toJSON(){return{message:this.message,flowplayer_error_code:this.flowplayerErrorCode,id:this.id,root_error_id:this.config.rootErrorId,resource:this.config.resource,is_fatal:this.isFatal,is_retry:!!this.config.isRetry}}}const Qa=[],qa=[];function ec(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),i=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),o=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),l=/SamsungBrowser/.test(t),u=l&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:i,firefox:o,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:l,samsung_tv:l&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}var tc=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",VIDEO_MENU:"flowplayer-video-menu",UI:"flowplayer-ui",LOGO:"flowplayer-logo",CONTROL:"flowplayer-control",CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:"flowplayer-live-status",ELAPSED:"flowplayer-elapsed-time",TIMELINE:"flowplayer-timeline-bar",CHAPTERS_TIMELINE:"flowplayer-chapters-timeline-bar",CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:"flowplayer-header",HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:"flowplayer-header-right-zone",HEADER_DURATION:"flowplayer-header-duration",MIDDLE:"flowplayer-middle",MIDDLE_ZONE:"flowplayer-middle-zone",WAIT:"flowplayer-wait",MIDDLE_BUTTONS:"flowplayer-middle-buttons",MIDDLE_LEFT_ZONE:"flowplayer-middle-left-zone",MIDDLE_RIGHT_ZONE:"flowplayer-middle-right-zone",ENDSCREEN_INTERSTITIAL:"flowplayer-endscreen-interstitial",ENDSCREEN_UP_NEXT:"flowplayer-endscreen-up-next",ENDSCREEN_GRID:"flowplayer-endscreen-grid",PLAYLIST_INTERSTITIAL:"flowplayer-playlist-interstitial",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:"flowplayer-small-play-icon",SMALL_PAUSE_ICON:"flowplayer-small-pause-icon",PLAY_ICON:"flowplayer-play-icon",PAUSE_ICON:"flowplayer-pause-icon",FULLSCREEN_ENTER_ICON:"flowplayer-fullscreen-enter-icon",FULLSCREEN_EXIT_ICON:"flowplayer-fullscreen-exit-icon",SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:"flowplayer-fast-forward-icon",REWIND_ICON:"flowplayer-rewind-icon",SHARE_ICON:"flowplayer-share-icon",SUBTITLES_MENU_ICON:"flowplayer-subs-menu-icon",MENU_BACK_ICON:"flowplayer-menu-back",VOLUME_ICON:"flowplayer-volume-icon",MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:"flowplayer-live-countdown",PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:"flowplayer-error",TV_MENU:"flowplayer-tv-menu",CUE_COMPONENT:"flowplayer-cue",SSAI_UI:"flowplayer-ssai-ui",SSAI_CONTROLS:"flowplayer-ssai-controls",SSAI_TIMELINE:"flowplayer-ssai-timeline",SSAI_INDICATOR:"flowplayer-ssai-indicator"});function nc(e){this.message=e}nc.prototype=new Error,nc.prototype.name="InvalidCharacterError";var rc="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new nc("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,i=0,o="";r=t.charAt(i++);~r&&(n=s%4?64*n+r:r,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};var sc=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 function(e){return decodeURIComponent(rc(e).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return rc(t)}};function ic(e){this.message=e}ic.prototype=new Error,ic.prototype.name="InvalidTokenError";var oc=function(e,t){if("string"!=typeof e)throw new ic("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(sc(e.split(".")[n]))}catch(e){throw new ic("Invalid token specified: "+e.message)}};oc.InvalidTokenError=ic;const ac=new Map,lc=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const s=window.customElements.get(n);return"function"!=typeof s?r:s})(e._customElements,t))(e);var uc,dc;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(uc||(uc={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(dc||(dc={}));const pc=e=>{return e.autoplay&&dc.AUDIO_REQUIRED&(!0===(t=e.autoplay)?dc.ON:!1===t?dc.OFF:t);var t};function fc(e,t,n){const r="boolean"==typeof n;if("boolean"!=typeof n&&(n=!!e.hasState(Ua)||e.paused),function(e,t,n){const r=e.poll(t?J:Q,{forced:n});return r&&r.defaultPrevented}(e,n,r))return Promise.resolve();if(!n)return e.hasState(Fa)?(e.setState(Ua,!0),e.setState(Fa,!1),Promise.resolve()):Promise.resolve(e.pause());if(0==e.reaper)return Promise.resolve();const s=e.reaper.get("__pending_play");return e.paused||s?s?(s.src!==mc(e.original_src)&&hc(e),s):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==mc(e.original_src)}(e)&&hc(e),function(e){const t=e.hasState(Pa),n=t&&pc(e.opts);n&&(e.muted&&e.toggleMute(!1),0==e.volume&&(e.volume=1));t&&e.setState(Pa,!1);return e.play().then(()=>{e.hasState(Ua)&&e.togglePlay(!1)}).catch(r=>{if(console.warn(t?n?"[flowplayer/play] autoplay audio required\n%s":"[flowplayer/play] attempting muted autoplay\n%s":"",r.message,"\ninstance:",e),t&&!n)return e.muted=!0,e.play()})}(e)):(e.setState(Ua,!1),!e.hasState(ha)&&e.setState(Fa,!0),Promise.resolve())}function hc(e){e.opts.is_native&&(e.hasState(ga)||(e.hasState(ya)||e.emit(q),e.setState(ya,!0),e.load()))}function mc(e){const t=document.createElement("a");return t.href=e,t.href}function gc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[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])&&(n[r[s]]=e[r[s]])}return n}function yc(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function vc(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const bc=e=>{var{src:t}=e,n=gc(e,["src"]);return[Object.assign({src:t,type:t?vc("video/"+yc(t)):""},n)]};function wc(e){return bc({src:e})}function Sc(e){var{src:t,type:n}=e,r=gc(e,["src","type"]);return t&&n?[Object.assign({src:t,type:n},r)]:n&&!t?[Object.assign({type:n},r)]:bc(Object.assign({src:t},r))}const _c="health:record",Rc="rebuffer",Ec="rebuffer:ended",kc="display",Ic="insights:ttff",Cc="insights:time_to_first_frag_loaded",xc="insights:watched_interval",Tc="flowplayer:feature",Ac="health:ready";var Lc=Object.freeze({__proto__:null,RECORD:_c,REBUFFER:Rc,REBUFFER_ENDED:Ec,DISPLAY:kc,TIME_TO_FIRST_FRAME:Ic,TIME_TO_FIRST_FRAGMENT_LOADED:Cc,WATCHED_INTERVAL:xc,FEATURE_USAGE:Tc,HEALTH_SERVICE_READY:Ac});const Pc={All:1,High:.1,Medium:.01,Low:.001,None:0};function Oc(e,{feature_name:t,behavior:n,sample_rate:r}){t&&(r||(r=Pc.All),e.emit(Tc,{feature_name:t,behavior:n,sample_rate:r}))}var Nc;function Mc(e,t,n,r={safari:!1}){const s=function(e){return"string"==typeof e?wc(e):Array.isArray(e)||"object"!=typeof e?e.reduce(function(e,t){return"string"==typeof t&&(t=wc(t)),"object"!=typeof t||Array.isArray(t)||(t=Sc(t)),e.concat(t)},[]):Sc(e)}(n);return function(e){[ba,Ua,Fa,ha,ma,ya,ga,Na].forEach(t=>e.setState(t,!1)),e.setState(va,!0)}(e),Array(...Array(s.length)).map((e,t)=>t).some(n=>{const i=s[n];if(Nc.Ok==function(e,t,n){e.emit(A,n),t.playback_token&&"string"==typeof n.src&&n.src.startsWith("https://")&&(n.src=function(e,t){const n=new URL(e);return n.pathname=`/pt:${t}${n.pathname}`,n.toString()}(n.src,t.playback_token),Oc(e,{feature_name:"signed-urls",behavior:"used",sample_rate:.1}));"string"==typeof n.src&&(e.original_src=n.src);const r=function(e,t,n){return e.plugins.filter(e=>function(e){return e&&"wants"in e}(e)).find(e=>e.wants(n.src||"",n,t))}(e,t,n);return e.setOpts({is_native:!r}),r?(r.onload(t,e.root,e,n),Nc.Ok):Nc.Err}(e,t,i)||Nc.Ok==function(e,t,n,r={safari:!1}){var s;/^audio\//.test(n.type||"")&&e.emit(Y);t.start_time&&(n.src=n.src+"#t="+t.start_time);if(""==e.canPlayType(n.type||""))return Nc.Err;if(n.drm&&(!n.drm["com.apple.fps.1_0"]||!r.safari))return Nc.Err;"string"==typeof n.src&&(e.preload=null!==(s=t.preload)&&void 0!==s?s:"auto",e.src=n.src);return Nc.Ok}(e,t,i,r))return!0;n==s.length-1&&"string"==typeof i.src&&(e.src=i.src)}),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(Nc||(Nc={}));const Dc=[L,k,A,W];var Fc;function Uc(e,t,n){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=n,0==t.offset?jc(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout(function(){0!=e.reaper&&(e.currentTime=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.currentTime+t.offset,e.duration),t.timer=0,jc(e,t))},1e3),function(e,t){e.setState(ja,!0),e.setState(Fc.BACKWARD,t.offset<0),e.setState(Fc.FORWARD,t.offset>0)}(e,t),e.emit(V,t),t))}function jc(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(Fc.FORWARD,!1),e.setState(Fc.BACKWARD,!1),e.setState(ja,!1)}(e)}function Vc(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function Wc(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(Fc||(Fc={}));function Zc(e,t,n,r){if((r=r||0)>=e.length)return n;return Wc(e[r],t,Zc(e,t,n,r+1))}const Gc="flowplayer/uuid";let Bc="";!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const Yc=["touchstart","touchmove"];function zc(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}function Xc(e,t,n){const r=zc(t,n);return e.dispatchEvent(r),e}function Kc(e,t,n){const r=zc(t,n);return e.dispatchEvent(r),r}function $c(e,t,n,r){Array.isArray(t)?t.forEach(t=>Hc(e,t,n,r)):Hc(e,t,n,r)}function Hc(e,t,n,r){if(s=t,!~Yc.indexOf(s))return e.addEventListener(t,n,r),e;var s;const i=Object.assign(r||{},{passive:!0});return e.addEventListener(t,n,i),e}function Jc(e,t,n,r){return $c(e,t,n,Object.assign(r||{},{once:!0}))}class PlayerStorage{constructor(e,t){this.implementation=e,t&&t.keys().forEach(e=>{"string"==typeof t.implementation[e]&&this.implementation.setItem(e,t.implementation[e])})}keys(){var e;const t=[];for(var n=0;n<this.implementation.length;n++)(null===(e=this.implementation.key(n))||void 0===e?void 0:e.startsWith("flowplayer/"))&&t.push(this.implementation.key(n));return t}removeItem(e){try{this.implementation.removeItem(`flowplayer/${e}`)}catch(e){}}getItem(e){try{return this.implementation.getItem(`flowplayer/${e}`)}catch(e){return null}}setItem(e,t){try{this.implementation.setItem(`flowplayer/${e}`,t)}catch(e){}}clear(){try{this.keys().forEach(e=>this.implementation.removeItem(e))}catch(e){}}get length(){try{return this.keys().length}catch(e){return 0}}key(e){try{return this.implementation.key(e)}catch(e){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(e){var t;return(null===(t=this.pairs.find(t=>t[0]===e))||void 0===t?void 0:t[1])||null}key(e){return this.pairs[e][0]||null}removeItem(e){this.pairs=this.pairs.filter(t=>t[0]!==e)}setItem(e,t){this.removeItem(e),this.pairs.push([e,t])}}const Qc={preload:"auto",rtl:!1,controls:!0},qc=["muted","preload"];function el(e,t,n){let r;n.live_state={dvr_window:void 0,get dvr(){return r},set dvr(t){r=t;const s=!(!e.live||t);n.hasState(Ma)!=s&&n.setState(Ma,s)}},n._storage=new PlayerStorage(function(){const e=["localStorage","sessionStorage"].map(e=>{try{const t=window[e];return t.getItem(""),t}catch(t){return console.debug(`Access to window.${e} denied, trying next option`),null}}).find(e=>!!e)||new InMemoryStorage;return e}()),n.toJSON=function(){return{duration:n.duration,volume:n.volume,currentTime:n.currentTime,states:n.root.className}},n.setSrc=function(t){return Mc(n,e,t,ec())},n.playerState=n.playerState||{},n.setState=function(e,t){if(n.playerState[e]===!!t)return n;const r=Object.assign({},n.playerState,{[e]:t});return n.playerState=r,Xc(n,H,n.playerState),n},n.createComponents=function(...e){return Array.from({length:e.length}).map((t,n)=>lc(this,e[n]))},n.hasState=function(e){return!!n.playerState[e]},n.transitionState=function(e,t,r){!n.hasState(e)&&n.hasState(t)||(r=0),r&&n.setState(Oa,!0),n.setState(t,!1),n.setState(e,!0),r&&setTimeout(function(){n.setState(Oa,!1)},r)},n.emit=(e,t)=>(Xc(n,e,t),n),n.on=(e,t)=>($c(n,e,t),n),n.once=(e,t)=>(Jc(n,e,t),n),n.off=(e,t)=>(function(e,t,n){e.removeEventListener(t,n)}(n,e,t),n),n.poll=(e,t)=>Kc(n,e,t),n.togglePlay=function(e){return n.hasState(xa)?Promise.reject():fc(n,0,e)},n.toggleMute=function(e){e=null==e?!n.muted:!!e,n.muted=e,n.muted||n.volume||(n.volume=1),Xc(n,m)},n.toggleDisable=function(e){e=null==e?!n.disabled:!!e,n.setState(wa,e),n.disabled=e},n.destroy=function(){n.pause();const e=qa.indexOf(n);~e&&qa.splice(e,1),setTimeout(function(){n.setSrc([]),n.reaper&&n.reaper.clear(),Xc(n,L),n.setState(Ga,!0)},0)},n.setAttrs=function(e){return qc.forEach(t=>{if(!(t in e))return;const r=e[t];r?n.setAttribute(t,r.toString()):n.removeAttribute(t)}),n},n.opt=function(t,n){return n=void 0===n?Wc(Qc,t):n,Wc(e,t,n)},n.i18n=function(e,t){if(!n.reaper)return"";const r=n.reaper.get("translations");return r?Zc(r,e,t||""):t||""},n.setOpts=function(r){Object.assign(e,r),e.live&&!n.hasState(Ca)&&(n.setState(Ma,!0),Xc(n,U)),"disabled"in r&&void 0!==r.disabled&&n.toggleDisable(r.disabled),"muted"in r&&void 0!==r.muted&&n.toggleMute(r.muted),"dvr"in e&&(n.live_state.dvr=n.opt("dvr")),n.setState(ka,n.opt("rtl",function(e){if(!e)return Vc();const t=e.getAttribute("dir");return t?"rtl"==t:Vc()}(t))),n.setState(Ca,!!e.live),n.setState(Da,"string"==typeof e.poster&&e.poster.length>0),n.setState(Va,!!e.seekable),n.setState(Za,0==e.controls),t.style.backgroundImage=n.hasState(Da)?"url('"+e.poster+"')":"",Xc(n,K,e)},n.renderPlugin=function(e){Kc(n,B,e).defaultPrevented||n.root.appendChild(e)};const s={offset:0,timer:0};var i,o;o=s,(i=n).on(Dc,function(){jc(i,o)}),n.enqueueSeek=function(e){if(0!=n.opts.seekable&&!(1==n.opts.disabled&&e>0))return Uc(n,s,e)},n.deviceId=function(){return function(e){if(Bc)return Bc;try{const t=e.getItem(Gc);if(t)return t;const n=$a();return e.setItem(Gc,n),n}catch(e){return Bc=$a()}}(n._storage)}}const tl=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function nl(e,t){return!!~tl.indexOf(e)||e.indexOf(t)===e.length-t.length}nl.check_whitelist=function(e){return!!~tl.indexOf(e)};const rl="production";function sl(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=oc(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&sl.validate(n),n}var il;function ol(e){return{grant:e,is_granted:t=>(e&t)===t}}function al({root:e,video:t,data:n}){t&&t.destroy(),console.error(new Error(n.details||n.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const r=document.createElement("h2");r.textContent="Playback Error";const s=document.createElement("p");s.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const o=document.createElement("img");o.src="https://flowplayer.com/user/pages/images/logo-white.png",o.alt="Flowplayer Logo",e.append(r,s,i,o)}function cl(e){return t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return e(t)},0)}}sl.validate=function(e){if("string"==typeof e&&(e=sl(e)),!e||!e.raw){if(nl.check_whitelist(window.location.hostname)||"dev"===rl.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=nl.bind(null,t);if("dev"!==rl.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==rl.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},sl.id=function(e){if(e)return"string"==typeof e&&(e=sl(e)),e.data.id},function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(il||(il={})),ol.of=ol,ol.from_token=function(e){const t=sl(e,{require_valid_token:!0});return ol.of(t.data.acl)},ol.permissions=il;const ll="is-casting",ul="has-casted";function dl(e){return function(e,t){const n=e.seekable;if("object"!=typeof e.opts||0==n.length)return{head:0,tail:0};const r=pl(e),s=t||e.live_state.dvr_window;return{head:r,tail:"number"!=typeof s||r-s<0?n.start(0):r-s}}(e).tail}function pl(e){var t;const n=e.seekable;return n.length?e.hasState("is-chromecast-playing")||!(null===(t=e.hls)||void 0===t?void 0:t.liveSyncPosition)?n.end(n.length-1):e.hls.liveSyncPosition:0}function fl(e){try{e.dvr_offset=0,e.currentTime=pl(e)}catch(e){console.warn("failed to seek to now: %j",e)}}function hl(e,t){const n=t.clientWidth;t.classList.toggle(Sa,n<600),t.classList.toggle(Ra,n<400)}function ml(e,t,n){let r=!0;t.classList.add("flowplayer"),hl(0,t),Jc(n,h,()=>{void 0!==e.start_quality&&Oc(n,{feature_name:"start-quality",behavior:String(e.start_quality),sample_rate:Pc.High})}),$c(n,h,()=>{if(!n.hasState(ya)&&!n.hasState(ga)&&e.is_native&&"none"!==e.preload)return"metadata"===e.preload?(n.setState(ya,!0),n.emit(q)):void hc(n)}),$c(n,u,()=>{e.is_native&&"metadata"===e.preload&&n.paused&&n.emit(_)}),$c(n,[h,a],function(){hl(0,t)}),$c(n,H,function(){Object.entries(n.playerState).forEach(function([e,n]){t.classList.toggle(e,n)})}),$c(n,f,function(){n.setState(La,!n.hasState(ll)&&!n.hasState(va)&&n.readyState<3)}),$c(n,R,function(t){const r=n.original_src;cl(()=>{if(r===n.original_src){if(n.setState(Ia,!0),Jc(n,f,function(){n.setState(Ia,!1),r===n.original_src&&n.setState(va,!e.loop&&!!e.rewind&&n.paused)}),e.loop)return n.togglePlay(!0);e.rewind&&(n.currentTime=0)}})(t)}),$c(n,[k,E],function(e){n.setState(ba,e.type==k)}),$c(n,Z,function(e){setTimeout(()=>{e.defaultPrevented||(n.currentTime=e.detail.currentTime)},0)}),$c(n,R,function(){n.setState(ha,!1),r=!0}),$c(n,p,()=>{if(!n.opts.live||!n.opts.is_native)return;const e=n.seekable;0!=e.length&&n.emit("dvr/window",e.end(e.length-1)-e.start(0))}),$c(n,d,function(){n.setState(ga,!0),n.setState(ya,!1)}),$c(n,v,()=>{n.setState(Fa,!0)}),$c(n,[w,_,h],function(t){if(!n.hasState(ba)&&(t.type!=_||e.autoplay||n.setState(La,!1),t.type!=h||"none"!=n.opt("preload")||e.autoplay)){if(t.type==h&&e.autoplay)return Jc(n,y,function(){n.setState(La,!1)});t.type!=w||n.hasState(ga)||n.setState(ya,!0),n.setState(Ia,!1),n.setState(La,t.type==w)}}),$c(n,[y,g],function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const s=t.type==y,i=n.currentTime==n.duration,o=s&&r&&e.autoplay||n.hasState(La);if(s&&(n.started=!0,r=!1),n.setState(La,!1).setState(Fa,!1),!s&&n.setState(Ua,!1),i)return;const a=s?ha:ma,c=s?ma:ha;n.transitionState(a,c,o?0:300),!n.hasState(va)||n.root.classList.contains("ad-hide-first-frame")||n.root.classList.contains("preroll-ios")||function(e,t){if(!e.hasState(Ca)||![void 0,0,-1].includes(t)||!e.seekable.length||e.hasState(ul))return e.setState(va,!1);e.once(E,()=>e.setState(va,!1)),0===t?function(e){e.currentTime=dl(e)}(e):fl(e)}(n,e.start_time)})}const gl=[0].concat(Array.from({length:100}).map((e,t)=>(t+1)/100));function yl(){return qa.find(e=>e.hasState(ll))}const vl=.5625;function bl(e){if("number"==typeof e&&!isNaN(e))return Number(e);if("string"==typeof e){const t=e.split(":");return Number(t[1])/Number(t[0])}return e}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(e,t,n){this.root=t,this.player=n,this.wireUp()}wireUp(){var e,t;this.cleanUp(),null===(e=this.player)||void 0===e||e.once(y,this.render),null===(t=this.player)||void 0===t||t.once(R,this.wireUp)}cleanUp(){var e,t,n,r;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo),null===(n=this.player)||void 0===n||n.off(y,this.render),null===(r=this.player)||void 0===r||r.off(R,this.wireUp)}render(){var e,t,n;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo);const r=(null===(n=this.root)||void 0===n?void 0:n.querySelector(".fp-ui"))||this.root;if(!r)return;const s=this._logo=document.createElement("a");s.href="https://explorer.flowplayer.com",s.target="_blank",Object.entries(wl).forEach(([e,t])=>{s.style.setProperty(e,t,"important")}),r.appendChild(s)}}ExplorerPlan.pluginName="explorer-plan";const wl={display:"block",opacity:"1",visibility:"visible",width:"33%","padding-top":"9%",position:"absolute","z-index":"9999",bottom:"25%",left:"10%","background-size":"cover","background-image":"url(https://static.flowplayer.com/explorer/explorer.svg)"},Sl="flowplayer/"+y;function _l(e,t){const n=[];e.addEventListener("contextmenu",r=>{const s=r.timeStamp;for(n.push(s);n.length>3;)n.shift();n.length>=3&&n.every(e=>e-s<3e3)&&(console.debug("flowplayer/debug rendering info"),function(e,t){var n;!function(e){const t=e.querySelector(".debug-info");null==t||t.remove()}(e);const r=document.createElement("div");r.classList.add("debug-info");const s=Rl("flowplayer.version","3.34.1");r.append(s);const i=null===(n=null==t?void 0:t.hls)||void 0===n?void 0:n.constructor;if(i&&i.version){const e=Rl("hls.version",i.version);r.append(e)}e.appendChild(r)}(e,t))})}const Rl=(e,t)=>{const n=document.createElement("div");n.classList.add("row",e);const r=document.createElement("span");r.classList.add("attr"),r.textContent=e;const s=document.createElement("span");return s.textContent=t,s.classList.add("value"),n.append(r,s),n};const El=t("core/retry");function kl(e,t){const n={pending:void 0,count:0};e.on(ee,s=>{var i,o,a,c,l;const u=null===(i=s.detail)||void 0===i?void 0:i.error;u.config.isRetry=!!n.count,void 0===n.pending&&(null===(a=null===(o=u.config)||void 0===o?void 0:o.retryOpts)||void 0===a?void 0:a.retry)!==Ja&&(t.retry||(null===(l=null===(c=u.config)||void 0===c?void 0:c.retryOpts)||void 0===l?void 0:l.retry))&&(++n.count,n.pending=function(e,t,n){var s,i;return setTimeout(()=>{var s;e.hasState(Ga)||(t.pending=void 0,(null===(s=n.config.retryOpts)||void 0===s?void 0:s.retry)!==Ha&&e.emit(j),e.emit(r,{error:n}),El("%s try",t.count))},null!==(i=null===(s=n.config.retryOpts)||void 0===s?void 0:s.retryTimeout)&&void 0!==i?i:3e3*t.count)}(e,n,u))}),e.on(y,()=>{n.count=0}),e.on([A,j],e=>{e.type===A&&(n.count=0),clearTimeout(n.pending),n.pending=void 0}),e.on(r,cl(()=>{e.load()}))}const Il=[q,s,A];function Cl(e){try{return!!new URL(e)}catch(e){return!1}}const xl=navigator;function Tl(e){var t,n;const r=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return r?1e-6*r:(null===(n=xl.connection)||void 0===n?void 0:n.downlink)||-1}function Al(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const Ll=e=>{switch(e){case!0:return dc.ON;case!1:return dc.OFF;default:return e}};function Pl(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const Ol=[],Nl="https://ihi.flowplayer.com/v1/health/events";function Ml(e){if(e.suspended)return;const t=Ol.slice(0);Ol.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),Al(function(){try{return"undefined"==typeof window?Nl:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:Nl}catch(e){return Nl}}(),t))}async function Dl(e,t,n){const r=await Ul();Ol.push(Object.assign(t,r)),e.logger.log(":enqueue",t.event,t),Ol.length<10&&!n||Ml(e)}const Fl=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},Ul=async()=>({client_time:Date.now()}),jl=(e,t)=>Object.assign(e,{detail:t}),Vl=(e,{event:t,media_session_id:n,session_id:r,play_range_id:s})=>({event:t,media_session_id:n,session_id:r,play_range_id:s,device_id:e.deviceId(),version:"3.34.1",commit:"b6818796fc39e12da65fa0ebd29704a4b383c122",ima_sdk_version:Fl(),preload:e.opt("preload"),autoplay:Ll(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:Tl(e),page_url:Pl(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id")||e.opt("metadata.stream_target_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),Wl=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});const Zl=(e,t)=>{let n=null;return(...r)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...r),e)}};var Gl;!function(e){e[e.Starting=0]="Starting",e[e.ConfigFinalized=1]="ConfigFinalized",e[e.TimerStartedWithAutoplay=2]="TimerStartedWithAutoplay",e[e.TimerStartedWithUserGesture=3]="TimerStartedWithUserGesture",e[e.MetricReported=4]="MetricReported"}(Gl||(Gl={}));const Bl=[i,o];class TimeToFirstFrame{constructor(e=Gl.Starting,t=!1){this.state=e,this.loadedAd=t}reset(){this.state=Gl.Starting,this.loadedAd=!1,this.start=void 0,this.end=void 0,this.adDetails=void 0}adInfo(){const{ad_tag_id:e,vast_ad_id:t}=this.adDetails||{};return{ad_tag_id:e,vast_ad_id:t}}toJSON(){return Object.assign({ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round(this.end&&this.start?this.end-this.start:-1)},this.adInfo())}startTimer(e){this.state==Gl.ConfigFinalized&&(this.state=e,this.start=performance.now())}hasStarted(){return[Gl.TimerStartedWithAutoplay,Gl.TimerStartedWithUserGesture].includes(this.state)}stopTimer(e){this.hasStarted()&&(this.end||(this.end=performance.now()),this.state=Gl.MetricReported,e())}}function Yl(e){return Math.round(1e3*e)/1e3}class EWMA{constructor(e){this.tickInterval=e,this.ewma=0,this.startTime=Date.now()}decay(){const e=Date.now()-this.startTime;return Math.pow(2,-e/(4*this.tickInterval))}update(e){const t=this.decay();return this.ewma=t*this.ewma+(1-t)*e,this.ewma}toJSON(){return this.ewma}}const zl={skipUnreliableSegments:!0};class WatchedState{constructor(e){this.player=e,this.marchingInterval=void 0,this.lastWatchedPoint=void 0,this.watchedSum=0,this.lastReportedSum=0,this.ewmaTickWatched=new EWMA(WatchedState.AccuracyMilliseconds)}reset(){this.onNotWatching(),this.watchedSum=0,this.lastReportedSum=0,this.lastWatchedPoint=void 0}onNotWatching(){this.marchingInterval&&(this.updateWatched(),this.marchingInterval=clearInterval(this.marchingInterval))}onWatching(){this.marchingInterval||(this.lastWatchedPoint=this.createWatchedPoint(),this.marchingInterval=setInterval(()=>{this.updateWatched()},WatchedState.AccuracyMilliseconds))}createWatchedPoint(){return{currentTime:this.player.currentTime,paused:this.player.paused}}updateWatched(){const e=this.createWatchedPoint();this.lastWatchedPoint&&this.calculateTimeWatched(this.lastWatchedPoint,e),this.lastWatchedPoint=e}calculateTimeWatched(e,t){var n,r;const s=t.currentTime-e.currentTime,i=this.ewmaTickWatched.update(s);if(!(s<0)&&!(!1!==(null===(r=null===(n=this.player.opts)||void 0===n?void 0:n.health)||void 0===r?void 0:r.skipUnreliableSegments)&&1e3*s>1.3*WatchedState.AccuracyMilliseconds)&&(this.watchedSum+=s,this.watchedSum!=this.lastReportedSum&&(this.watchedSum>this.lastReportedSum+WatchedState.ReportingIntervalSeconds||this.player.ended))){const e=Yl(i),t={total_watched_seconds:Yl(this.watchedSum),tick_watched_seconds:e,batch_watched_seconds:Yl(this.watchedSum-this.lastReportedSum)};this.lastReportedSum=this.watchedSum,this.player.emit(xc,t)}}}WatchedState.ReportingIntervalSeconds=5,WatchedState.AccuracyMilliseconds=160;const Xl=$a();class Health{constructor(e,n){let r;this.session_id=Xl,this.suspended=!1,this.logger=t("health",n.opts),this.media_session_id=$a(),this.play_range_id=$a(),this.analyticsLoop=setInterval(()=>Ml(this),2e3),n.on(L,()=>clearInterval(this.analyticsLoop)),n.on(y,()=>{r!==this.media_session_id&&(r=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=$a()});let s=Date.now()-1e3;n.on(f,e=>{if(r!==this.media_session_id)return;const t=Date.now();if(t<s)return;s=Date.now()+5e3;const i=Vl(n,this.eventInfo(e.type)),o=jl(i,{duration:(a=n.duration,Number.isFinite(a)?a:a===1/0?-1:void 0)});var a;this.first_playing_event_timestamp&&(Object.assign(o,{ms_since_first_playing:t-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),Dl(this,o)});const i=this;if(n.health={get media_session_id(){return i.media_session_id},set media_session_id(e){i.media_session_id=e},get session_id(){return i.session_id},set session_id(e){i.session_id=e},toggle(e){e?i.resume():i.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>Ml(this),2e3)}init(e,t,n){if(Pl().toString().startsWith("data:"))return this.suspend();!function(e){let t=null;const n=()=>{t=null};e.on(w,function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e.emit(Rc))}),e.on(Rc,e=>{t=e}),e.on(_,r=>{if(t){const s=r.timeStamp-t.timeStamp;if(n(),s<31)return;if(s>3e5)return;e.emit(Ec,{rebuffer_duration:s/1e3})}}),Il.forEach(t=>e.on(t,n))}(n),function(e){let t;[_,q].forEach(n=>{e.on(n,n=>{const r=Date.now();switch(n.type){case q:return t=r;case _:if(t)return e.emit(Cc,{ms_since_loading_started:r-t}),t=null}})})}(n),function(e){if(void 0===window.performance)return;const t=new TimeToFirstFrame;e.on(A,()=>{if(!e.opt("metadata.media_id"))return t.reset();t.reset(),t.state=Gl.ConfigFinalized}),e.on(q,()=>{(e.root.classList.contains("ad-hide-first-frame")||e.opt("autoplay"))&&t.startTimer(Gl.TimerStartedWithAutoplay)}),Bl.forEach(n=>{e.on(n,()=>{e.opt("autoplay")||t.startTimer(Gl.TimerStartedWithUserGesture)})}),e.on("ad-requested",()=>{t.loadedAd=!0}),e.on(f,()=>{if(!(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA)){if(e.root.classList.contains("ad-hide-first-frame"))return!t.end&&(t.end=performance.now());switch(t.state){case Gl.TimerStartedWithAutoplay:case Gl.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(Ic,t.toJSON()))}}}),e.on("ad-started",n=>{switch(t.end=void 0,t.adDetails=n.detail,t.state){case Gl.TimerStartedWithAutoplay:case Gl.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(Ic,t.toJSON()))}})}(n),function(e){const t=new WatchedState(e);e.on(q,()=>t.reset()),e.on(y,()=>t.onWatching()),e.on(Ec,()=>!e.paused&&t.onWatching()),e.on(Rc,()=>t.onNotWatching()),e.on(g,()=>t.onNotWatching()),e.on(k,()=>{e.currentTime>1&&t.updateWatched(),t.onNotWatching()}),e.on(E,()=>{e.paused||t.onWatching()}),e.on(R,()=>t.updateWatched()),e.on("visibilitychange",()=>t.updateWatched())}(n),n.on(kc,e=>{Dl(this,Vl(n,this.eventInfo(e.type)),!0)}),n.on(_c,({detail:e})=>{const t=Vl(n,this.eventInfo(e.event));Object.assign(t,e.detail||{}),Dl(this,t)}),n.on(Tc,e=>{if(t=e.detail.sample_rate,!Object.values(Pc).includes(t))return console.debug(`sample_rate=${e.detail.sample_rate} is invalid`);var t,r;if(!(0!==(r=e.detail).sample_rate&&Math.random()<=r.sample_rate))return;const s=Vl(n,this.eventInfo(e.type));Dl(this,jl(s,e.detail))}),n.on(A,()=>{n.opt("metadata.media_id")&&n.emit(Ac)}),[h,u,d,p,w,Rc].forEach(e=>{n.on(e,e=>{Dl(this,Vl(n,this.eventInfo(e.type)))})}),[Ec,Ic,Cc,xc].forEach(e=>{n.on(e,e=>{const t=Vl(n,this.eventInfo(e.type));Dl(this,Object.assign(t,e.detail))})}),[y,g,k,E,R,c,l,_,q].forEach(e=>{n.on(e,e=>{Dl(this,Vl(n,this.eventInfo(e.type)))})}),n.on(m,Zl(800,e=>{const t=Vl(n,this.eventInfo(e.type));Dl(this,jl(t,{volume:parseFloat(n.volume.toFixed(2)),muted:n.muted}))})),n.on(a,Zl(800,e=>{const r=Vl(n,this.eventInfo(e.type));Dl(this,jl(r,{height:t.clientHeight,width:t.clientWidth}))})),n.on("hls/failover",e=>{const t=Vl(n,this.eventInfo(e.type)),r=e.detail,{reason:s,from:i}=r;Dl(this,jl(t,{reason:s,from:i}))}),n.on(N,({type:e,detail:t})=>{if("hls"===t.plugin)return function(e,t,n,r){const s=Vl(t,e.eventInfo(n)),i=Object.assign({before:Wl(r.before),after:Wl(r.after),automatic:r.automatic,downscale:r.downscale},r.before?{}:{start_quality:t.opts.start_quality});Dl(e,Object.assign(Object.assign({},s),{state:i}))}(this,n,e,t)}),n.on(ee,e=>{const t=Vl(n,this.eventInfo(e.type)),r=e.detail.error;if(!r)return Dl(this,t,!0);return Dl(this,jl(t,r.toJSON()),!0)}),n.on(A,e=>{var t;const r=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof r)return;if(!Cl(n.original_src))return;if(!Cl(r))return;if(r==n.original_src)return;this.media_session_id=$a();Dl(this,Vl(n,this.eventInfo(e.type))),Ml(this),n.setOpts({health:Object.assign(Object.assign({},n.opts.health),zl)})}),n.on("visibilitychange",e=>{Dl(this,Vl(n,this.eventInfo(e.type))),Ml(this)})}}function Kl(e,t){return function(e){return e.extensions.reduce((e,t)=>e.find(e=>e.pluginName===t.pluginName)?(console.warn("flowplayer: duplicate plugin %s detected, plugin names should be unique",t.name),e):(e.push(t),e),[])}(e).map(n=>new n(e,t))}function $l(e,t={}){var n,r,s,i,o,a;switch(e.code){case MediaError.MEDIA_ERR_ABORTED:return new FlowplayerError(null!==(n=e.message)&&void 0!==n?n:"The playback was aborted, typically by the user.",za.PlaybackInternalAborted,Object.assign({isFatal:!1,retryOpts:{retry:Ja}},t));case MediaError.MEDIA_ERR_NETWORK:return new FlowplayerError(null!==(r=e.message)&&void 0!==r?r:"A network error prevented media from being downloaded.",za.NetworkHttpRequestFailed,Object.assign({isFatal:!0},t));case MediaError.MEDIA_ERR_DECODE:return new FlowplayerError(null!==(s=e.message)&&void 0!==s?s:"An error occurred while decoding the media.",za.PlaybackVideoDecodeError,Object.assign({isFatal:!0},t));case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:return new FlowplayerError(null!==(i=e.message)&&void 0!==i?i:"The media could not be loaded because the format is not supported.",za.MediaUnsupportedVideoFormat,Object.assign({isFatal:!0},t));case 5:return new FlowplayerError(null!==(o=e.message)&&void 0!==o?o:"Encrypted content could not be played due to missing keys or unsupported protection scheme.",za.ContentProtectionKeySystemNoKeys,Object.assign({isFatal:!0},t));default:return new FlowplayerError(null!==(a=e.message)&&void 0!==a?a:"An unknown playback error occurred.",za.PlaybackUnknown,Object.assign({isFatal:!0},t))}}Health.pluginName="health",Health.events=Lc,Health._UNLOAD_SUBSCRIBED=!1;const Hl=function(){const t="undefined"!=typeof window?window:void 0!==e?e:{},n=t.flowplayer?t.flowplayer:{extensions:[]};return Array.isArray(n.extensions)||(n.extensions=[]),n}();function Jl(e,t){if("function"==typeof e)return Qa.push(...[...arguments].filter(e=>"function"==typeof e)),Jl;"string"==typeof t&&(t={src:t}),t||(t={}),t.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(t.token=window.__FLOWPLAYER_TOKEN);const r="string"==typeof e?document.querySelector(e):e;if(!r)return console.error(new Error("Flowplayer: '"+e.toString()+"' not found"));const i=r.querySelector("video.fp-engine");if(i)return i;const o=function(e){try{return sl.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}(t.token);if(!o.success)return al({root:r,data:{reason:"token",details:o.message}});const c=new Map,l=function(e,t){const n=t.querySelector("video"),r=n||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return r.classList.add("fp-engine"),r.playsInline=!0,n||t.append(r),r}(t,r);var p;l.reaper=c,l._customElements=ac,Object.defineProperty(l,"token",{value:"string"==typeof t.token?sl.id(t.token):"",writable:!1}),l.addEventListener(L,()=>{c.clear(),l.reaper=0,delete l.root}),l.root=r,t.token&&ol.from_token(t.token).is_granted(ol.permissions.DEVELOPER_PLAN)&&Qa.push(ExplorerPlan),!~qa.indexOf(l)&&qa.push(l),el(t,r,l),l.setAttrs(t),l.plugins=Kl(Jl,l),ml(t,r,l),function(e,t,n){if(!window.IntersectionObserver)return;const r={should_resume:!!e.autoplay,locked:!1};$c(n,v,function(){r.locked||(r.should_resume=!0)});const s=()=>{if(!e.autoplay)return;if(n.hasState(Wa)&&r.should_resume)return n.togglePlay(!0);const t=n.currentSrc;e.autopause||n.hasState(Wa)||!r.should_resume||Jc(n,I,()=>{e.autoplay&&r.should_resume&&t===n.currentSrc&&n.togglePlay(!0)})},i=()=>{if(!e.autoplay)return;if(!e.is_native)return;if("auto"===e.preload)return;if(n.hasState(Wa))return hc(n);const t=n.currentSrc;Jc(n,I,()=>{t!==n.currentSrc||n.readyState>1||!n.paused||hc(n)})};$c(n,A,function(){r.should_resume=!!e.autoplay,n.off(h,i),n.once(h,i),n.off(_,s),n.once(_,s)}),$c(n,g,function(){r.locked||(r.should_resume=!1)});const o=new IntersectionObserver(e=>{e.forEach(e=>{setTimeout(()=>{const t=e.intersectionRatio,r=n.hasState(Wa);if(n.setState(Wa,t>=.2),n.emit(G,{ratio:t}),r===n.hasState(Wa))return;const s=n.hasState(Wa)?I:T;n.emit(s)},0)})},{threshold:gl});o.observe(t),n.on(L,()=>o.disconnect()),$c(n,I,function(){!r.should_resume||!e.autopause||yl()||n.opts.autoplay&&!n.readyState||n.togglePlay(!0)}),$c(n,T,function(){if(!e.autopause||yl())return;const t=!n.paused;r.locked=!0,n.pause(),setTimeout(function(){r.should_resume=t,r.locked=!1},0)})}(t,r,l),function(e,t){if(!window.ResizeObserver)return;const n=new ResizeObserver(e=>{const n=e[e.length-1];t.emit(a,n)});n.observe(e),t.on(L,()=>n.disconnect())}(r,l),function(e,t,n){const r=!!e.ratio,s=document.createElement("div");s.classList.add("fp-ratio"),t.append(s);let i=bl(e.ratio||vl);s.style.paddingTop=100*i+"%";const o=[d,u];n.on(o,function(){if(r)return;const e=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth;e&&n.setOpts({ratio:e})}),n.on(K,function(){const t=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth,r=bl((null==e?void 0:e.ratio)||t||vl);i!==r&&(i=r,s.style.paddingTop=100*r+"%")})}(t,r,l),function(e){const t=t=>{t.detail!==e&&!1===e.opt("multiplay")&&e.togglePlay(!1)};e.on(L,()=>document.removeEventListener(Sl,t)),document.addEventListener(Sl,t)}(l),_l(r,l),kl(l,t),(p=l).on(s,cl(e=>{const t=e instanceof MediaError?e:p.error;t&&p.emit(ee,{error:$l(t,{resource:p.original_src})})})),l.plugins.forEach(e=>{try{e.init(t,r,l)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),l.setOpts(t),l.opts=t,t.src&&l.setSrc(t.src);const f=l.readyState;return f>0&&l.currentSrc&&l.emit(u),f>2&&l.currentSrc&&l.emit(_),l.emit(n),l.on(z,function(e){al({root:r,video:l,data:e.data||{}})}),setTimeout(Xc,0,document,"flowplayer:player:created",l),l}Object.assign(Jl,Hl),function(e){Array.isArray(e.extensions)&&e.extensions.forEach(e=>Qa.push(e)),e.customElements=ac,e.defaultElements=tc,e.version="3.34.1",e.commit="b6818796fc39e12da65fa0ebd29704a4b383c122",e.instances=qa,e.extensions=Qa,e.support=ec,e.events=te,e.states=Ba,e.errors=za,e.jwt=oc,e.autoplay=dc,e.quality=uc}(Jl),"object"==typeof document&&setTimeout(Xc,0,document,"flowplayer:umd",Jl),Jl.extensions.unshift.apply(Jl.extensions,[Health]);class MillicastAdapter{static wants(e){return e.type==MillicastAdapter.Type}constructor(e,n,r=t("rts/millicast"),s=pa.Starting){this.player=e,this.src=n,this.log=r,this.status=s,Qs.setEndpoint(MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT),this.player.on(M,e=>{var t;if(!this.engine||!this.engine.isActive())return;const n=e.detail;null===(t=this.engine)||void 0===t||t.select(n)}),this.player.on(D,e=>{var t;if(!this.engine||!this.engine.isActive())return;const n=e.detail.track,r=null===(t=this.player.tracks)||void 0===t?void 0:t.find(e=>e.selected&&e!==n);r&&(r.selected=!1),this.engine.project("Main"===n.label?"":n.label,n.data.tracks)})}isStreamActive(){return this.status===pa.Receiving&&this.player.hasState(Jl.states.PLAYING)}async load(){this.log("loading",this.src.streamName);this.engine=new cc(this.src.streamName,()=>this.src.__TEST_STREAM_ACCOUNT_ID__?Qs.getSubscriber(this.src):Qs.getSubscriber(Object.assign(Object.assign({},this.src),{streamAccountId:"dev"in this.src?"3caeCP":"bUEzT6"})),this.player,!1),this.player.original_src=MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT+`/${this.src.streamName}`,this._observe(),await this.connect()}retry(){this.connect()}async connect(){try{await this._connect(),this.player.emit(j)}catch(e){this.log("Connection failed",e);const t=new FlowplayerError(e.message,za.NetworkUnknown,{resource:this.src.streamName,isFatal:!0,retryOpts:{retry:Ha,retryTimeout:3e3}});this.player.emit(ee,{error:t})}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop(),this.engine=void 0}_handleViewerCount(e){"number"==typeof e&&this.player.emit(ua,{viewerCount:e})}_handleActive(e){this.player.hasState(xa)&&this.player.emit(j),this.player.setState(La,!1),this.status=pa.Receiving,this.player.emit(la,{status:pa.Receiving,data:e})}_handleInactive(){var e,t;this.status=pa.Idle;const n={status:pa.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit(la,n);const r=new FlowplayerError(n.message,za.MediaUnavailable,{resource:this.src.streamName,isFatal:!0,retryOpts:{retry:Ja}});this.player.emit(ee,{error:r}),null===(t=null===(e=this.engine)||void 0===e?void 0:e.webRTCPeer)||void 0===t||t.stopStats()}_handleQualityLayers(e){var t,n;const r=null===(t=e[0])||void 0===t?void 0:t.layers;if(r&&Array.isArray(r)&&r.every(e=>void 0!==e.encodingId)){if(r[0].encodingId===(null===(n=this.layers)||void 0===n?void 0:n[0].encodingId))return;return this.layers=r,this.player.emit(O,function(e){const t=e.map((e,t)=>Object.assign(Object.assign({},e),{name:e.height||"Level "+t})).sort((e,t)=>t.width-e.width);t.length>1&&t.push({name:"AUTO",width:0,height:0});return t}
|
|
18
|
+
function(e,t){var n=xn,r=n.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=i),i.prototype=Object.create(r.prototype),s(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var s=r(e);return void 0!==t?"string"==typeof n?s.fill(t,n):s.fill(t):s.fill(0),s},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Cn,Cn.exports);var Vn=65536;var Wn=Cn.exports.Buffer,Zn=Ue.crypto||Ue.msCrypto;Zn&&Zn.getRandomValues?In.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=Wn.allocUnsafe(e);if(e>0)if(e>Vn)for(var r=0;r<e;r+=Vn)Zn.getRandomValues(n.slice(r,r+Vn));else Zn.getRandomValues(n);return"function"==typeof t?Ie.nextTick(function(){t(null,n)}):n}:In.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};const Gn=In.exports;let Bn=class Js{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Js(this.ufrag,this.pwd);return e.setLite(this.lite),e.setEndOfCandidates(this.endOfCandidates),e}plain(){const e={ufrag:this.ufrag,pwd:this.pwd};return this.lite&&(e.lite=this.lite),this.endOfCandidates&&(e.endOfCandidates=this.endOfCandidates),e}getUfrag(){return this.ufrag}getPwd(){return this.pwd}isLite(){return this.lite}setLite(e){this.lite=e}isEndOfCandidates(){return this.endOfCandidates}setEndOfCandidates(e){this.endOfCandidates=e}};Bn.generate=function(e){const t=new Bn,n=Gn(8),r=Gn(24);return t.ufrag=n.toString("hex"),t.pwd=r.toString("hex"),t.lite=e,t},Bn.expand=function(e){if("ICEInfo"===e.constructor.name)return e;const t=new Bn(e.ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t},Bn.clone=function(e){return"ICEInfo"===e.constructor.name?e.clone():Bn.expand(e)};var Yn=Bn;const zn=yn("SEND","RECV");zn.byValue=function(e){return zn[e.toUpperCase()]},zn.toString=function(e){switch(e){case zn.SEND:return"send";case zn.RECV:return"recv"}},zn.reverse=function(e){switch(e){case zn.SEND:return zn.RECV;case zn.RECV:return zn.SEND}};var Xn=zn;const Kn=Xn;let $n=class ei{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ei(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:Kn.toString(this.direction)};for(var[t,n]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=n;return e}getId(){return this.id}getDirection(){return this.direction}setDirection(e){this.direction=e}getFormats(){return this.formats}setFormats(e){this.formats=[];for(let t=0;t<e.length;++t)this.formats.push(parseInt(e[t]))}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}};$n.expand=function(e){if("RIDInfo"===e.constructor.name)return e;const t=new $n(e.id,Kn.byValue(e.direction));for(const[n,r]of Object.entries(e.params||{}))t.addParam(n,r);return e.formats&&t.setFormats(e.formats),t},$n.clone=function(e){return"RIDInfo"===e.constructor.name?e.clone():$n.expand(e)};var Hn=$n;let Jn=class ti{constructor(e,t){this.paused=t,this.id=e}clone(){return new ti(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}};Jn.expand=function(e){return"SimulcastStreamInfo"===e.constructor.name?e:new Jn(e.id,e.paused)},Jn.clone=function(e){return"SimulcastStreamInfo"===e.constructor.name?e.clone():Jn.expand(e)};var Qn=Jn;const qn=Qn,er=Xn;let tr=class ri{constructor(){this.send=[],this.recv=[]}clone(){const e=new ri;for(const t of this.send)e.addSimulcastAlternativeStreams(er.SEND,t.map(e=>e.clone()));for(const t of this.recv)e.addSimulcastAlternativeStreams(er.RECV,t.map(e=>e.clone()));return e}plain(){const e={send:[],recv:[]};for(const t of this.send)e.send.push(t.map(e=>e.plain()));for(const t of this.recv)e.recv.push(t.map(e=>e.plain()));return e}addSimulcastAlternativeStreams(e,t){return e===er.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===er.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===er.SEND?this.send:this.recv}};tr.expand=function(e){if("SimulcastInfo"===e.constructor.name)return e;const t=new tr;for(const n of e.send||[])t.addSimulcastAlternativeStreams(er.SEND,n.map(qn.expand));for(const n of e.recv||[])t.addSimulcastAlternativeStreams(er.RECV,n.map(qn.expand));return t},tr.clone=function(e){return"SimulcastInfo"===e.constructor.name?e.clone():tr.expand(e)};var nr=tr;const rr=yn("SENDRECV","SENDONLY","RECVONLY","INACTIVE");rr.byValue=function(e){return rr[e.toUpperCase()]},rr.toString=function(e){switch(e){case rr.SENDRECV:return"sendrecv";case rr.SENDONLY:return"sendonly";case rr.RECVONLY:return"recvonly";case rr.INACTIVE:return"inactive"}},rr.reverse=function(e){switch(e){case rr.SENDRECV:return rr.SENDRECV;case rr.SENDONLY:return rr.RECVONLY;case rr.RECVONLY:return rr.SENDONLY;case rr.INACTIVE:return rr.INACTIVE}};var sr=rr;let ir=class ni{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new ni(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}};ir.expand=function(e){return"DataChannelInfo"===e.constructor.name?e:new ir(e.port,e.maxMessageSize)},ir.clone=function(e){return"DataChannelInfo"===e.constructor.name?e.clone():ir.expand(e)};var or=ir;const ar=gn,cr=Hn,ur=nr,dr=sr,pr=Xn,fr=or;let hr=class Wr{constructor(e,t){this.id=e,this.type=t,this.direction=dr.SENDRECV,this.extensions=new Map,this.codecs=new Map,this.rids=new Map,this.simulcast=null,this.bitrate=0,this.control=null,this.dataChannel=null}clone(){const e=new Wr(this.id,this.type);e.setDirection(this.direction),e.setBitrate(this.bitrate);for(const t of this.codecs.values())e.addCodec(t.clone());for(const[t,n]of this.extensions.entries())e.addExtension(t,n);for(const t of this.rids.values())e.addRID(t.clone());return this.simulcast&&e.setSimulcast(this.simulcast.clone()),this.control&&e.setControl(this.control),this.dataChannel&&e.setDataChannel(this.dataChannel.clone()),e}plain(){const e={id:this.id,type:this.type,direction:dr.toString(this.direction),codecs:[]};this.dataChannel&&(e.dataChannel=this.dataChannel.plain()),this.bitrate&&(e.bitrate=this.bitrate);for(const t of this.codecs.values())e.codecs.push(t.plain());for(const[t,n]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=n;for(const t of this.rids.values())e.rids||(e.rids=[]),e.rids.push(t.plain());return this.simulcast&&(e.simulcast=this.simulcast.plain()),this.control&&(e.control=this.control),e}getType(){return this.type}getId(){return this.id}setId(e){this.id=e}addExtension(e,t){this.extensions.set(e,t)}addRID(e){this.rids.set(e.getId(),e)}addCodec(e){this.codecs.set(e.getType(),e)}setCodecs(e){this.codecs=e}getCodecForType(e){return this.codecs.get(e)}getCodec(e){for(const t of this.codecs.values())if(t.getCodec().toLowerCase()===e.toLowerCase())return t;return null}hasCodec(e){return null!==this.getCodec(e)}getCodecs(){return this.codecs}hasRTX(){for(const e of this.codecs.values())if(e.hasRTX())return!0;return!1}getExtensions(){return this.extensions}getRIDs(){return this.rids}getRID(e){return this.rids.get(e)}getBitrate(){return this.bitrate}setBitrate(e){this.bitrate=e}getDirection(){return this.direction}setDirection(e){this.direction=e}hasControl(){return!!this.control}getControl(){return this.control}setControl(e){this.control=e}hasDataChannel(){return!!this.dataChannel}getDataChannel(){return this.dataChannel}setDataChannel(e){this.dataChannel=e}answer(e){const t=new Wr(this.id,this.type);if(e){t.setDirection(dr.reverse(this.direction));const{codecs:n,dataChannel:r}=e;if(n){let r;r=Array.isArray(n)?ar.MapFromNames(n,e.rtx,e.rtcpfbs):n;for(let e of this.codecs.values())for(let n of r.values()){if(n.getCodec().toLowerCase()!==e.getCodec().toLowerCase()||"h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0")||"h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id")||"multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const r=n.clone();r.setType(e.getType()),r.hasRTX()&&r.setRTX(e.getRTX()),e.hasChannels()&&r.setChannels(e.getChannels()),r.addParams(e.getParams()),t.addCodec(r);break}}const s=new Set(e.extensions);for(let[e,n]of this.extensions)s.has(n)&&t.addExtension(e,n);if(e.simulcast&&this.simulcast){const e=new ur,n=this.simulcast.getSimulcastStreams(pr.SEND);if(n)for(const t of n){const n=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(pr.RECV,n)}const r=this.simulcast.getSimulcastStreams(pr.RECV);if(r)for(const t of r){const n=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(pr.SEND,n)}for(const e of this.rids.values()){const n=e.clone();n.setDirection(pr.reverse(e.getDirection())),t.addRID(n)}t.setSimulcast(e)}if(r&&this.dataChannel){const e=new fr(this.dataChannel.getPort(),r.maxMessageSize?r.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(e)}}else t.setDirection(dr.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}};function gr(e){const t=e.toString();if(!/^\d+$/.test(t))throw new Error("invalid integer ".concat(t));return parseInt(t)}hr.create=function(e,t,n){!n&&"string"!=typeof t&&(n=t,t=e);const r=new hr(e,t);if(n){const{codecs:e}=n;e&&(Array.isArray(e)?r.setCodecs(ar.MapFromNames(e,n.rtx,n.rtcpfbs)):r.setCodecs(e))}else r.setDirection(dr.INACTIVE);return r},hr.expand=function(e){if("MediaInfo"===e.constructor.name)return e;const t=new hr(e.id,e.type);if(e.direction&&t.setDirection(dr.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const n=fr.expand(e.dataChannel);n&&t.setDataChannel(n)}for(const[n,r]of Object.entries(e.extensions))t.addExtension(gr(n),r);for(const n of e.codecs){const e=ar.expand(n);e&&t.addCodec(e)}for(const n of e.rids||[]){const e=cr.expand(n);t.addRID(e)}return e.simulcast&&t.setSimulcast(ur.expand(e.simulcast)),e.control&&t.setControl(e.control),t},hr.clone=function(e){return"MediaInfo"===e.constructor.name?e.clone():hr.expand(e)};var vr=hr;let br=class ai{constructor(e,t){this.semantics=e,this.ssrcs=[];for(let e=0;e<t.length;++e)this.ssrcs.push(parseInt(t[e]))}clone(){return new ai(this.semantics,this.ssrcs)}plain(){const e={semantics:this.semantics,ssrcs:[]};for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);return e}getSemantics(){return this.semantics}getSSRCs(){return this.ssrcs}};br.expand=function(e){return"SourceGroupInfo"===e.constructor.name?e:new br(e.semantics,e.ssrcs)},br.clone=function(e){return"SourceGroupInfo"===e.constructor.name?e.clone():br.expand(e)};var wr=br;let Sr=class ci{constructor(e){this.ssrc=e}clone(){const e=new ci(this.ssrc);return e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId),e}plain(){const e={ssrc:this.ssrc};return this.cname&&(e.cname=this.cname),this.streamId&&(e.streamId=this.streamId),this.trackId&&(e.trackId=this.trackId),e}getCName(){return this.cname}setCName(e){this.cname=e}getStreamId(){return this.streamId}setStreamId(e){this.streamId=e}getTrackId(){return this.trackId}setTrackId(e){this.trackId=e}getSSRC(){return this.ssrc}};Sr.expand=function(e){if("SourceInfo"===e.constructor.name)return e;const t=new Sr(e.ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t},Sr.clone=function(e){return"SourceInfo"===e.constructor.name?e.clone():Sr.expand(e)};var _r=Sr;const Rr=gn;let Er=class ui{constructor(e,t=!1){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ui(this.id,this.paused);for(let t of this.codecs.values())e.addCodec(t.clone());return e.setParams(this.params),e}plain(){var e={id:this.id,paused:this.paused,codecs:{},params:{}};for(var[t,n]of this.codecs.entries())e.codecs[t]=n.plain();for(var[t,r]of this.params.entries())e.params[t]=r;return e}getId(){return this.id}getCodecs(){return this.codecs}addCodec(e){this.codecs.set(e.getType(),e)}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}isPaused(){return this.paused}};Er.expand=function(e){if("TrackEncodingInfo"===e.constructor.name)return e;const t=new Er(e.id,e.paused);for(const n of Object.values(e.codecs||{}))t.addCodec(Rr.expand(n));for(const[n,r]of Object.entries(e.params||{}))t.addParam(n,r);return t},Er.clone=function(e){return"TrackEncodingInfo"===e.constructor.name?e.clone():Er.expand(e)};var kr=Er;const Ir=wr,Cr=kr;let xr=class di{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new di(this.media,this.id);this.mediaId&&e.setMediaId(this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.addSSRC(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.addSourceGroup(this.groups[t].clone());for(let t=0;t<this.encodings.length;++t){const n=[];for(let e=0;e<this.encodings[t].length;++e)n.push(this.encodings[t][e].clone());e.addAlternativeEncodings(n)}return e}plain(){const e={media:this.media,id:this.id,ssrcs:[]};this.mediaId&&(e.mediaId=this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.groups||(e.groups=[]),e.groups.push(this.groups[t].plain());for(let t=0;t<this.encodings.length;++t){const n=[];for(let e=0;e<this.encodings[t].length;++e)n.push(this.encodings[t][e].plain());n.length&&(e.encodings||(e.encodings=[]),e.encodings.push(n))}return e}getMedia(){return this.media}setMediaId(e){this.mediaId=e}getMediaId(){return this.mediaId}getId(){return this.id}addSSRC(e){this.ssrcs.push(e)}getSSRCs(){return this.ssrcs}addSourceGroup(e){this.groups.push(e)}getSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return t;return null}getSourceGroups(){return this.groups}getSourceGroupsForMediaSSRC(e){return this.groups.filter(t=>t.getSSRCs()[0]===e)}hasSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return!0;return!1}getEncodings(){return this.encodings}addEncoding(e){this.encodings.push([e])}addAlternativeEncodings(e){this.encodings.push(e)}setEncodings(e){this.encodings=e}getEncodingSources(){const e=[];if(this.encodings.length)for(const t of this.encodings)for(const n of t){const t={id:n.getId(),rid:n.getId()},r=n.getParams(),s=null==r?void 0:r.get("ssrc");if(void 0!==s){t.media=parseInt(s);for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}else if(this.hasSourceGroup("SIM")){const t=this.getSourceGroup("SIM").getSSRCs();this.getSourceGroups();for(const n of t){const t={id:String(n),media:n};for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}e.push(t)}}else{const t={id:""};if(this.ssrcs.length){t.media=this.ssrcs[0];for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}return e}};xr.expand=function(e){var t,n;if("TrackInfo"===e.constructor.name)return e;const r=new xr(e.media,e.id);if(e.mediaId&&r.setMediaId(e.mediaId),Array.isArray(e.ssrcs))for(const t of e.ssrcs)r.addSSRC(t);else if(void 0!==(null===(t=e.ssrcs)||void 0===t?void 0:t.media)){const t=e.ssrcs.media;if(r.addSSRC(t),void 0!==e.ssrcs.rtx){const n=e.ssrcs.rtx;r.addSSRC(n),r.addSourceGroup(new Ir("FID",[t,n]))}if(void 0!==e.ssrcs.fec){const n=e.ssrcs.fec;r.addSSRC(n),r.addSourceGroup(new Ir("FEC-FR",[t,n]))}}if(e.rid){const t=new Cr(e.rid);void 0!==(null===(n=e.ssrcs)||void 0===n?void 0:n.media)&&t.addParam("ssrc",e.ssrcs.media),r.addAlternativeEncodings([t])}for(const t of e.groups||[])r.addSourceGroup(Ir.expand(t));for(const t of e.encodings||[]){const e=[];for(const n of t)e.push(Cr.expand(n));r.addAlternativeEncodings(e)}return r},xr.clone=function(e){return"TrackInfo"===e.constructor.name?e.clone():xr.expand(e)};var Tr=xr;const Ar=Tr;let Lr=class fi{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new fi(this.id);for(const t of this.tracks.values())e.addTrack(t.clone());return e}plain(){const e={id:this.id,tracks:[]};for(const t of this.tracks.values())e.tracks.push(t.plain());return e}getId(){return this.id}addTrack(e){this.tracks.set(e.getId(),e)}removeTrack(e){return this.tracks.delete(e.getId())}removeTrackById(e){return this.tracks.delete(e)}getFirstTrack(e){for(let t of this.tracks.values())if(t.getMedia().toLowerCase()===e.toLowerCase())return t;return null}getTracks(){return this.tracks}removeAllTracks(){this.tracks.clear()}getTrack(e){return this.tracks.get(e)}};Lr.expand=function(e){if("StreamInfo"===e.constructor.name)return e;const t=new Lr(e.id);for(const n of e.tracks||[]){const e=Ar.expand(n);e&&t.addTrack(e)}return t},Lr.clone=function(e){return"StreamInfo"===e.constructor.name?e.clone():Lr.expand(e)};var Pr=Lr;const Or=Ht,Nr=function(e){const t=new Intl.Collator(e,{sensitivity:"base"});return(e,n)=>0==t.compare(e,n)}("en-US"),Mr=dn,Dr=gn,Fr=fn,Ur=Rn,jr=kn,Vr=Yn,Zr=vr,Gr=bn,Br=sr,Yr=Xn,zr=wr,Xr=_r,Kr=Pr,$r=Tr,Hr=kr,Jr=nr,Qr=Qn,qr=Hn,es=or;let ts=class lr{constructor(e){this.version=e||1,this.streams=new Map,this.medias=new Array,this.candidates=new Array,this.ice=null,this.dtls=null,this.crypto=null,this.extmapAllowMixed=!0}clone(){const e=new lr(this.version);for(const t of this.medias)e.addMedia(t.clone());for(const t of this.streams.values())e.addStream(t.clone());for(const t of this.candidates)e.addCandidate(t.clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExtmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(const t of this.medias)e.medias.push(t.plain());for(const t of this.streams.values())e.streams.push(t.plain());for(const t of this.candidates)e.candidates.push(t.plain());return this.ice&&(e.ice=this.ice.plain()),this.dtls&&(e.dtls=this.dtls.plain()),this.crypto&&(e.crypto=this.crypto.plain()),this.extmapAllowMixed||(e.extmapAllowMixedNotSupported=!this.extmapAllowMixed),e}unify(){const e=new lr(this.version);for(const t of this.medias)e.addMedia(t.clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const n of this.streams.values()){const r=n.clone();for(const n of r.getTracks().values()){let r=t[n.getMedia()].pop();r||(r=this.getMedia(n.getMedia()).clone(),r.setId(n.getId()),e.addMedia(r)),n.setMediaId(r.getId())}e.addStream(r)}for(const t of this.candidates)e.addCandidate(t.clone());return this.ice&&e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e}setVersion(e){this.version=e}addMedia(e){this.medias.push(e)}getMedia(e){for(let t in this.medias){let n=this.medias[t];if(Nr(n.getType(),e))return n}return null}getMediasByType(e){let t=[];for(let n in this.medias){let r=this.medias[n];Nr(r.getType(),e)&&t.push(r)}return t}getMediaById(e){for(const t of this.medias)if(Nr(t.getId(),e))return t;return null}replaceMedia(e){for(let t in this.medias)if(this.medias[t].getId()==e.getId())return this.medias[t]=e,!0;return!1}getMedias(){return this.medias}getVersion(){return this.version}getDTLS(){return this.dtls}setDTLS(e){this.dtls=e}hasCrypto(){return!!this.crypto}getCrypto(){return this.crypto}setCrypto(e){this.crypto=e}hasICE(){return!!this.ice}getICE(){return this.ice}setICE(e){this.ice=e}addCandidate(e){for(const t of this.candidates)if(t.equals(e))return;this.candidates.push(e)}addCandidates(e){for(const t of e)this.addCandidate(t)}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(const e of this.streams.values())return e;return null}addStream(e){this.streams.set(e.getId(),e)}removeStream(e){return this.streams.delete(e.getId())}removeAllStreams(){this.streams.clear()}getTracksByMediaType(e){let t=[];for(const n of this.streams.values())for(const[r,s]of n.getTracks())Nr(s.getMedia(),e)&&t.push(s);return t}getTrackByMediaId(e){for(const t of this.streams.values())for(const[n,r]of t.getTracks())if(r.getMediaId()==e)return r;return null}getStreamByMediaId(e){for(const t of this.streams.values())for(const[n,r]of t.getTracks())if(r.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new lr;e.ice&&(e.ice instanceof Vr?t.setICE(e.ice.clone()):t.setICE(Vr.expand(e.ice))),e.dtls&&(e.dtls instanceof Ur?t.setDTLS(e.dtls):t.setDTLS(Ur.expand(e.dtls))),e.crypto&&(e.crypto instanceof jr?t.setCrypto(e.crypto):t.setCrypto(jr.expand(e.crypto)));for(let n=0;e.candidates&&n<e.candidates.length;++n)e.candidates[n]instanceof Mr?t.addCandidate(e.candidates[n].clone()):t.addCandidate(Mr.expand(e.candidates[n]));for(const n of this.medias){const r=e&&e.capabilities&&e.capabilities[n.getType()];t.addMedia(n.answer(r))}return t.setExtmapAllowMixed(this.extmapAllowMixed),t}toString(){let e={version:0,media:[]};e.version=0,e.origin={username:"-",sessionId:(new Date).getTime(),sessionVersion:this.version,netType:"IN",ipVer:4,address:"127.0.0.1"},e.name="semantic-sdp",e.connection={version:4,ip:"0.0.0.0"},e.timing={start:0,stop:0},this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),e.msidSemantic={semantic:"WMS",token:"*"},e.groups=[],this.extmapAllowMixed&&(e.extmapAllowMixed="extmap-allow-mixed");const t=[];for(const n of this.medias){let r={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};r.direction=Br.toString(n.getDirection()),this.extmapAllowMixed&&(r.extmapAllowMixed="extmap-allow-mixed"),r.mid=n.getId(),t.push(n.getId()),n.hasControl()&&(r.control=n.getControl()),n.getBitrate()>0&&(r.bandwidth.push({type:"AS",limit:n.getBitrate()}),r.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let s=this.getCandidates();for(const e of s)r.candidates.push({foundation:e.getFoundation(),component:e.getComponentId(),transport:e.getTransport(),priority:e.getPriority(),ip:e.getAddress(),port:e.getPort(),type:e.getType(),raddr:e.getRelAddr(),rport:e.getRelPort()});if(this.getICE()&&(r.iceUfrag=this.getICE().getUfrag(),r.icePwd=this.getICE().getPwd()),Nr("audio",n.getType())||Nr("video",n.getType())){r.rtcpMux="rtcp-mux",r.rtcpRsize="rtcp-rsize",this.getDTLS()?(r.protocol="UDP/TLS/RTP/SAVPF",r.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},r.setup=Gr.toString(this.getDTLS().getSetup())):this.getCrypto()?(r.protocol="RTP/SAVPF",r.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):r.protocol="RTP/AVP";for(const e of n.getCodecs().values()){Nr("video",n.getType())?r.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):Nr("opus",e.getCodec())||Nr("multiopus",e.getCodec())?r.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):r.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())r.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(r.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),r.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const n={payload:e.getType(),config:""};for(const e in t)n.config.length&&(n.config+=";"),Object.hasOwnProperty.call(t,e)?n.config+=e+"="+t[e]:n.config+=e;r.fmtp.push(n)}}const e=[];for(const t of r.rtp)e.push(t.payload);r.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())r.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:Yr.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[n,r]of e.getParams().entries())t.params+=(t.params.length?";":"")+n+"="+r;r.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;r.simulcast={};const n=t.getSimulcastStreams(Yr.SEND),s=t.getSimulcastStreams(Yr.RECV);if(n&&n.length){let t="";for(const e of n){let n="";for(const t of e)n+=(n.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+n}r.simulcast["dir"+e]="send",r.simulcast["list"+e]=t,e++}if(s&&s.length){let t="";for(const e of s){let n="";for(const t of e)n+=(n.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+n}r.simulcast["dir"+e]="recv",r.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){r.protocol="UDP/DTLS/SCTP",r.payloads="webrtc-datachannel";const e=n.getDataChannel();r.sctpPort=e.getPort(),r.maxMessageSize=e.getMaxMessageSize()}e.media.push(r)}for(let t of this.streams.values())for(let n of t.getTracks().values())for(let r in e.media){let s=e.media[r];if(n.getMediaId()){if(n.getMediaId()==s.mid){let e=n.getSourceGroups();for(let t in e){let n=e[t];s.ssrcGroups.push({semantics:n.getSemantics(),ssrcs:n.getSSRCs().join(" ")})}let r=n.getSSRCs();for(let e in r)s.ssrcs.push({id:r[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:r[e],attribute:"msid",value:t.getId()+" "+n.getId()});s.msid=t.getId()+" "+n.getId();break}}else if(Nr(s.type,n.getMedia())){let e=n.getSourceGroups();for(let t in e){let n=e[t];s.ssrcGroups.push({semantics:n.getSemantics(),ssrcs:n.getSSRCs().join(" ")})}let r=n.getSSRCs();for(let e in r)s.ssrcs.push({id:r[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:r[e],attribute:"msid",value:t.getId()+" "+n.getId()});break}}const n={type:"BUNDLE",mids:t.join(" ")};return e.groups.push(n),Or.write(e)}toIceFragmentString(){let e={version:0,media:[],candidates:[]};this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),this.getICE()&&(e.iceUfrag=this.getICE().getUfrag(),e.icePwd=this.getICE().getPwd());for(const t of this.getCandidates())e.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()});return Or.write(e).slice(10)}};ts.create=function(e){var t;const n=new ts;if(e.streams)for(const t of e.streams)n.addStream(Kr.expand(t));e.ice&&(e.ice instanceof Vr?n.setICE(e.ice.clone()):n.setICE(Vr.expand(e.ice))),e.dtls&&(e.dtls instanceof Ur?n.setDTLS(e.dtls):n.setDTLS(Ur.expand(e.dtls))),e.crypto&&(e.crypto instanceof jr?n.setCrypto(e.crypto):n.setCrypto(jr.expand(e.crypto)));for(const t of e.candidates||[])t instanceof Mr?n.addCandidate(t.clone()):n.addCandidate(Mr.expand(t));let r=96,s=1,i=0;for(const[o,a]of Object.entries(e.capabilities||{}))if(e.unified&&null!==(t=e.streams)&&void 0!==t&&t.length)for(const e of n.getTracksByMediaType(o)){const t=Zr.create(e.getMediaId(),o,a);for(const[e,n]of t.getCodecs())n.getType()>=96&&n.setType(r++),n.getRTX()&&n.setRTX(r++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);n.addMedia(t)}else{const t=Zr.create(e.unified?String(i++):o,o,a);for(const[e,n]of t.getCodecs())n.getType()>=96&&n.setType(r++),n.getRTX()&&n.setRTX(r++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);n.addMedia(t)}return n},ts.expand=function(e){if("SDPInfo"===e.constructor.name)return e;const t=new ts(e.version);for(const n of e.medias||[]){const e=Zr.expand(n);e&&t.addMedia(e)}for(const n of e.streams||[]){const e=Kr.expand(n);e&&t.addStream(e)}for(const n of e.candidates||[]){const e=Mr.expand(n);e&&t.addCandidate(e)}return e.ice&&t.setICE(Vr.expand(e.ice)),e.dtls&&t.setDTLS(Ur.expand(e.dtls)),e.crypto&&t.setCrypto(jr.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},ts.clone=function(e){return"SDPInfo"===e.constructor.name?e.clone():ts.expand(e)},ts.process=function(e){return ts.parse(e)},ts.parse=function(e){const t=Or.parse(e),n=new ts;if(n.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),r=String(t.icePwd),s=new Vr(e,r);s.setLite("ice-lite"==t.icelite),s.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),n.setICE(s)}for(let e in t.media){const r=t.media[e],s=r.type,i=r.mid?r.mid.toString():e,o=new Zr(i,s);if(r.iceUfrag&&r.icePwd){const e=String(r.iceUfrag),s=String(r.icePwd),i=new Vr(e,s);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==r.endOfCandidates),n.setICE(i)}for(let e=0;r.candidates&&e<r.candidates.length;++e){const t=r.candidates[e],s=new Mr(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);n.addCandidate(s)}const a=r.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let s=Gr.ACTPASS;r.setup&&(s=Gr.byValue(r.setup)),n.setDTLS(new Ur(s,e,t))}if(r.crypto){const e=r.crypto[0];n.setCrypto(new jr(e.id,e.suite,e.config,e.sessionConfig))}let c=Br.SENDRECV;r.direction&&(c=Br.byValue(r.direction),o.setDirection(c)),r.control&&o.setControl(r.control),n.setExtmapAllowMixed("extmap-allow-mixed"==r.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const l=new Map;for(let e in r.rtp){const t=r.rtp[e],n=t.payload,s=t.codec;if("RED"===s.toUpperCase()||"ULPFEC"===s.toUpperCase())continue;let i={};for(let e in r.fmtp){const t=r.fmtp[e];if(t.payload===n){const e=t.config.split(";");for(let t in e){const n=e[t].split("="),r=n[0].trim(),s=n.splice(1).join("=").trim();i[r]=s}}}if("RTX"===s.toUpperCase())l.set(parseInt(i.apt),n);else{const e=new Dr(s,n,i);t.encoding>1&&e.setChannels(t.encoding),o.addCodec(e)}}for(let e of l.entries()){const t=o.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;r.rtcpFb&&e<r.rtcpFb.length;++e){const t=o.getCodecForType(r.rtcpFb[e].payload);if(t){const n=r.rtcpFb[e].type,s=r.rtcpFb[e].subtype?r.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new Fr(n,s))}}const u=r.ext;for(let e in u){const t=u[e];o.addExtension(t.value,t.uri)}const d=r.rids;for(let e in d){const t=d[e],n=new qr(t.id,Yr.byValue(t.direction));let r=[];const s=new Map;if(t.params){const e=Or.parseParams(t.params);for(let t in e)"pt"===t?r=e[t].split(","):s.set(t,e[t]);n.setFormats(r),n.setParams(s)}o.addRID(n)}const p=[];if(r.simulcast){const e=new Jr;if(r.simulcast.dir1){const t=Yr.byValue(r.simulcast.dir1),n=Or.parseSimulcastStreamList(r.simulcast.list1);for(let r=0;r<n.length;++r){const s=[];for(let e=0;e<n[r].length;++e)s.push(new Qr(n[r][e].scid,n[r][e].paused));e.addSimulcastAlternativeStreams(t,s)}}if(r.simulcast.dir2){const t=Yr.byValue(r.simulcast.dir2),n=Or.parseSimulcastStreamList(r.simulcast.list2);for(let r=0;r<n.length;++r){const s=[];for(let e=0;e<n[r].length;++e)s.push(new Qr(n[r][e].scid,n[r][e].paused));e.addSimulcastAlternativeStreams(t,s)}}for(let t of e.getSimulcastStreams(Yr.SEND)){const e=[];for(let n=0;n<t.length;n++){const r=new Hr(t[n].getId(),t[n].isPaused()),s=o.getRID(r.getId());if(s){const t=s.getFormats();for(let e=0;t&&e<t.length;++e){const n=o.getCodecForType(t[e]);n&&r.addCodec(n)}r.setParams(s.getParams()),e.push(r)}}e.length&&p.push(e)}o.setSimulcast(e)}const f=new Map;if(r.ssrcs)for(let e in r.ssrcs){let t=r.ssrcs[e],o=t.id,a=t.attribute,c=t.value,l=f.get(o);if(l||(l=new Xr(o),f.set(l.getSSRC(),l)),Nr("cname",a))l.setCName(c);else if(Nr("msid",a)){let e=c.split(" "),t=e[0],r=e[1];l.setStreamId(t),l.setTrackId(r);let a=n.getStream(t);a||(a=new Kr(t),n.addStream(a));let u=a.getTrack(r);u||(u=new $r(s,r),u.setMediaId(i),u.setEncodings(p),a.addTrack(u)),u.addSSRC(o)}}if(r.msid){let e=r.msid.split(" "),t=e[0],o=e[1],a=n.getStream(t);a||(a=new Kr(t),n.addStream(a));let c=a.getTrack(o);c||(c=new $r(s,o),c.setMediaId(i),c.setEncodings(p),a.addTrack(c));for(let[e,n]of f.entries())n.getStreamId()||(n.setStreamId(t),n.setTrackId(o),c.addSSRC(e))}for(let[e,t]of f.entries())if(!t.getStreamId()){let r=t.getCName(),o=i;t.setStreamId(r),t.setTrackId(o);let a=n.getStream(r);a||(a=new Kr(r),n.addStream(a));let c=a.getTrack(o);c||(c=new $r(s,o),c.setMediaId(i),c.setEncodings(p),a.addTrack(c)),c.addSSRC(e)}if(r.ssrcGroups)for(let e in r.ssrcGroups){let t=r.ssrcGroups[e],s=t.ssrcs.split(" "),i=new zr(t.semantics,s),o=f.get(parseInt(s[0]));o&&n.getStream(o.getStreamId()).getTrack(o.getTrackId()).addSourceGroup(i)}if("application"==r.type&&"webrtc-datachannel"==r.payloads){const e=new es(r.sctpPort,r.maxMessageSize);o.setDataChannel(e)}n.addMedia(o)}return n};var ns=ts;Object.defineProperty($t,"__esModule",{value:!0});var rs=$t.SDPInfo=ns;$t.CandidateInfo=dn,$t.CodecInfo=gn,$t.DTLSInfo=Rn,$t.CryptoInfo=kn,$t.ICEInfo=Yn;var ss=$t.MediaInfo=vr;$t.Setup=bn,$t.SourceGroupInfo=wr,$t.SourceInfo=_r,$t.StreamInfo=Pr,$t.TrackInfo=Tr,$t.RTCPFeedbackInfo=fn,$t.TrackEncodingInfo=kr,$t.RIDInfo=Hn,$t.SimulcastInfo=nr,$t.SimulcastStreamInfo=Qn,$t.DataChannelInfo=or;var is=$t.Direction=sr,os={exports:{}};!function(e,t){!function(n,r){var s="function",i="undefined",o="object",a="string",c="major",l="model",u="name",d="type",p="vendor",f="version",h="architecture",m="console",g="mobile",y="tablet",v="smarttv",w="wearable",_="embedded",R="Amazon",E="Apple",k="ASUS",I="BlackBerry",T="Browser",A="Chrome",L="Firefox",O="Google",N="Huawei",M="LG",D="Microsoft",U="Motorola",j="Opera",V="Samsung",W="Sharp",Z="Sony",G="Xiaomi",B="Zebra",Y="Facebook",z="Chromium OS",K="Mac OS",$=" Browser",H=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},J=function(e,t){return typeof e===a&&-1!==Q(t).indexOf(Q(e))},Q=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,500)},ee=function(e,t){for(var n,i,a,c,l,u,d=0;d<t.length&&!l;){var p=t[d],f=t[d+1];for(n=i=0;n<p.length&&!l&&p[n];)if(l=p[n++].exec(e))for(a=0;a<f.length;a++)u=l[++i],typeof(c=f[a])===o&&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}},te=function(e,t){for(var n in t)if(typeof t[n]===o&&t[n].length>0){for(var s=0;s<t[n].length;s++)if(J(t[n][s],e))return"?"===n?r:n}else if(J(t[n],e))return"?"===n?r:n;return t.hasOwnProperty("*")?t["*"]:e},ne={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"},re={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,j+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[u,j+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[u,j]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/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)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[u,"Smart Lenovo "+T]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+T],f],[/\bfocus\/([\w\.]+)/i],[f,[u,L+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[f,[u,L]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360"+$]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+$],f],[/samsungbrowser\/([\w\.]+)/i],[f,[u,V+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,Y],f],[/(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,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,A+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,A+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,te,{"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,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/(wolvic)\/([\w\.]+)/i],[u,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,L+" 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,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,Q]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",Q]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,Q]]],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,V],[d,y]],[/\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,V],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[p,E],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[p,E],[d,y]],[/(macintosh);/i],[l,[p,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[p,W],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[p,N],[d,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[p,N],[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,G],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[p,G],[d,y]],[/; (\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,y]],[/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,U],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[p,U],[d,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[p,M],[d,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[p,M],[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,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[p,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[p,O],[d,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[p,O],[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,Z],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[p,Z],[d,y]],[/ (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,R],[d,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[p,R],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,p,[d,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[p,I],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[p,k],[d,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[p,k],[d,g]],[/(nexus 9)/i],[l,[p,"HTC"],[d,y]],[/(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,y]],[/(itel) ((\w+))/i],[[p,Q],l,[d,te,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[p,"Acer"],[d,y]],[/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]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[p,"Nothing"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/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]],[/(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,y]],[/(surface duo)/i],[l,[p,D],[d,y]],[/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,y]],[/\b(venue[\d ]{2,7}) b/i],[l,[p,"Dell"],[d,y]],[/\b(q(?:mv|ta)\w+) b/i],[l,[p,"Verizon"],[d,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[p,"Barnes & Noble"],[d,y]],[/\b(tm\d{3}\w+) b/i],[l,[p,"NuVision"],[d,y]],[/\b(k88) b/i],[l,[p,"ZTE"],[d,y]],[/\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,y]],[/\b((zeki)?tb.*\b) b/i],[l,[p,"Zeki"],[d,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],l,[d,y]],[/\b(ns-?\w{0,9}) b/i],[l,[p,"Insignia"],[d,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[p,"NextBook"],[d,y]],[/\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,y]],[/\b(trio[-\w\. ]+) b/i],[l,[p,"MachSpeed"],[d,y]],[/\btu_(1491) b/i],[l,[p,"Rotor"],[d,y]],[/(shield[\w ]+) b/i],[l,[p,"Nvidia"],[d,y]],[/(sprint) (\w+)/i],[p,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[p,D],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[p,B],[d,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[p,B],[d,g]],[/smart-tv.+(samsung)/i],[p,[d,v]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[p,V],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,M],[d,v]],[/(apple) ?tv/i],[p,[l,E+" TV"],[d,v]],[/crkey/i],[[l,A+"cast"],[p,O],[d,v]],[/droid.+aft(\w+)( bui|\))/i],[l,[p,R],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[p,W],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[l,[p,Z],[d,v]],[/(mitv-\w{5}) bui/i],[l,[p,G],[d,v]],[/Hbbtv.*(technisat) (.*);/i],[p,l,[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,q],[l,q],[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,l,[d,m]],[/droid.+; (shield) bui/i],[l,[p,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[l,[p,Z],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[p,D],[d,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[l,[p,V],[d,w]],[/((pebble))app/i],[p,l,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[p,E],[d,w]],[/droid.+; (glass) \d/i],[l,[p,O],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[p,B],[d,w]],[/(quest( \d| pro)?)/i],[l,[p,Y],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,_]],[/(aeobc)\b/i],[l,[p,R],[d,_]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[f,te,ne]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,te,ne],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,K],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,I]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,L+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[u,A+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,z],f],[/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,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,f]]},se=function(e,t){if(typeof e===o&&(t=e,e=r),!(this instanceof se))return new se(e,t).getResult();var m=typeof n!==i&&n.navigator?n.navigator:r,v=e||(m&&m.userAgent?m.userAgent:""),w=m&&m.userAgentData?m.userAgentData:r,_=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(re,t):re,R=m&&m.userAgent==v;return this.getBrowser=function(){var e={};return e[u]=r,e[f]=r,ee.call(e,v,_.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:r}(e[f]),R&&m&&m.brave&&typeof m.brave.isBrave==s&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[h]=r,ee.call(e,v,_.cpu),e},this.getDevice=function(){var e={};return e[p]=r,e[l]=r,e[d]=r,ee.call(e,v,_.device),R&&!e[d]&&w&&w.mobile&&(e[d]=g),R&&"Macintosh"==e[l]&&m&&typeof m.standalone!==i&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[l]="iPad",e[d]=y),e},this.getEngine=function(){var e={};return e[u]=r,e[f]=r,ee.call(e,v,_.engine),e},this.getOS=function(){var e={};return e[u]=r,e[f]=r,ee.call(e,v,_.os),R&&!e[u]&&w&&w.platform&&"Unknown"!=w.platform&&(e[u]=w.platform.replace(/chrome os/i,z).replace(/macos/i,K)),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 v},this.setUA=function(e){return v=typeof e===a&&e.length>500?q(e,500):e,this},this.setUA(v),this};se.VERSION="0.7.39",se.BROWSER=H([u,f,c]),se.CPU=H([h]),se.DEVICE=H([l,p,d,m,g,v,y,w,_]),se.ENGINE=se.OS=H([u,f]),e.exports&&(t=e.exports=se),t.UAParser=se;var ie=typeof n!==i&&(n.jQuery||n.Zepto);if(ie&&!ie.ua){var oe=new se;ie.ua=oe.getResult(),ie.ua.get=function(){return oe.getUA()},ie.ua.set=function(e){oe.setUA(e);var t=oe.getResult();for(var n in t)ie.ua[n]=t[n]}}}("object"==typeof window?window:Ue)}(os,os.exports);const as=je(os.exports),cs=["iOS"];class Yt extends as{constructor(){super(window.navigator.userAgent)}isChromium(){return this.getUA().match(/Chrome/i)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let n=!0;return n=!new RegExp(cs.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&n}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const ls=St.get("SdpParser"),us=Array.from({length:31},(e,t)=>t+35),ds=Array.from({length:32},(e,t)=>t+96),fs=Array.from({length:14},(e,t)=>t+1),hs=Array.from({length:240},(e,t)=>t+16),ms={setSimulcast(e,t){if(ls.info("Setting simulcast. Codec: ",t),!(new Yt).isChromium())return ls.warn("Your browser does not appear to support Simulcast. For a better experience, use a Chromium based browser."),e;if("h264"!==t&&"vp8"!==t)return ls.warn("Your selected codec ".concat(t," does not appear to support Simulcast. To broadcast using simulcast, please use H.264 or VP8.")),e;if(!/m=video/.test(e))return ls.warn("There is no available video for simulcast to be enabled."),e;try{const t=new RegExp("m=video.*?a=ssrc:(\\d*) cname:(.+?)\\r\\n","s"),n=new RegExp("m=video.*?a=ssrc:(\\d*) msid:(.+?)\\r\\n","s"),r=t.exec(e),s=r[1],i=r[2],o=n.exec(e)[2],a=2,c=[s];for(let t=0;t<a;++t){const n=100+2*t,r=n+1;c.push(n),e+="a=ssrc-group:FID "+n+" "+r+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+c.join(" ")+"\r\n",ls.info("Simulcast setted"),ls.debug("Simulcast SDP: ",e),e}catch(e){throw ls.error("Error setting SDP for simulcast: ",e),e}},setStereo:e=>(ls.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),ls.info("Replaced SDP response for support stereo"),ls.debug("New SDP value: ",e),e),setDTX:e=>(ls.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),ls.info("Replaced SDP response for support dtx"),ls.debug("New SDP value: ",e),e),setAbsoluteCaptureTime(e){const t="a=extmap:"+ms.getAvailableHeaderExtensionIdRange(e)[0]+" http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,n,r)=>n+t+r),ls.info("Replaced SDP response for setting absolute capture time"),ls.debug("New SDP value: ",e),e},setDependencyDescriptor(e){const t="a=extmap:"+ms.getAvailableHeaderExtensionIdRange(e)[0]+" https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,n,r)=>n+t+r),ls.info("Replaced SDP response for setting depency descriptor"),ls.debug("New SDP value: ",e),e},setVideoBitrate(e,t){if(t<1)ls.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const n=rs.parse(e),r=n.getMedia("video");ls.info("Setting video bitrate"),r.setBitrate(t),e=n.toString()}return e},removeSdpLine:(e,t)=>(ls.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),ls.debug("SDP trimmed result: ",e),e),adaptCodecName(e,t,n){if(!e)return e;const r=new RegExp("".concat(t),"i");return e.replace(r,n)},setMultiopus(e,t){if(!(new Yt).isFirefox()&&(!t||gs(t)))if(e.includes("multiopus/48000/6"))ls.info("Multiopus already setted");else{ls.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],n=ms.getAvailablePayloadTypeRange(e)[0],r=t.replace("\r\n"," ")+n+"\r\na=rtpmap:"+n+" multiopus/48000/6\r\na=fmtp:"+n+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,r),ls.info("Multiopus offer created"),ls.debug("SDP parsed for multioups: ",e)}return e},getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let n=ds.concat(us);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));n=n.filter(e=>!t.includes(e))}return n},getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let n=fs.concat(hs);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));n=n.filter(e=>!t.includes(e))}return n},renegotiate(e,t){const n=rs.parse(e),r=rs.parse(t);for(const e of n.getMedias()){let t=r.getMediaById(e.getId());if(!t){t=new ss(e.getId(),e.getType()),t.setDirection(is.reverse(e.getDirection()));const n=r.getMedia(e.getType());if(n){t.setCodecs(n.getCodecs());for(const[e,r]of n.getExtensions())t.addExtension(e,r)}r.addMedia(t)}}return r.toString()},updateMissingVideoExtensions(e,t){var n;const r=rs.parse(e),s=null==(n=rs.parse(t).getMediasByType("video")[0])?void 0:n.getExtensions();if(s||s.length){for(const t of r.getMediasByType("video")){const n=t.getExtensions();s.forEach((r,s)=>{if(!n.get(s)){const n=t.getId(),i="a=extmap:"+s+" "+r+"\r\n",o=new RegExp("(a=mid:"+n+"\r\n(?:.*\r\n)*?)","g");e=e.replace(o,(e,t,n)=>t+i)}})}return e}},getCodecPayloadType(e){const t=e.matchAll(/a=rtpmap:(\d+) (\w+)\/\d+/g),n={};for(const e of t)n[e[1]]=e[2];return n}},gs=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2),ys={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1",H265:"h265"},vs={OPUS:"opus",MULTIOPUS:"multiopus"},bs=St.get("PeerConnection"),ws="Viewer",Ss={track:"track",connectionStateChange:"connectionStateChange"},_s={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class tt extends jt{constructor(){super(),this.mode=null,this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null,this.transceiverMap=new Map}async createRTCPeer(e={autoInitStats:!0,statsIntervalMs:1e3},t=ws){bs.info("Creating new RTCPeerConnection"),bs.debug("RTC configuration provided by user: ",e),this.peer=ks(this,e),this.mode=t,e.autoInitStats&&this.initStats(e)}getRTCPeer(){return bs.info("Getting RTC Peer"),this.peer}async closeRTCPeer(){var e;bs.info("Closing RTCPeerConnection"),null==(e=this.peer)||e.close(),this.peer=null,this.stopStats(),this.emit(Ss.connectionStateChange,"closed")}async setRTCRemoteSDP(e){bs.info("Setting RTC Remote SDP");const t={type:"answer",sdp:e};try{await this.peer.setRemoteDescription(t),bs.info("RTC Remote SDP was set successfully."),bs.debug("RTC Remote SDP new value: ",e)}catch(e){throw bs.error("Error while setting RTC Remote SDP: ",e),e}}async getRTCLocalSDP(e=_s){bs.info("Getting RTC Local SDP"),e=Ne(Ne({},_s),e),bs.debug("Options: ",e);const t=Es(e.mediaStream);t?xs(this.peer,t,e):Ts(this.peer,e),bs.info("Creating peer offer");const n=await this.peer.createOffer();return bs.info("Peer offer created"),bs.debug("Peer offer response: ",n.sdp),this.sessionDescription=n,e.disableAudio||(e.stereo&&(this.sessionDescription.sdp=ms.setStereo(this.sessionDescription.sdp)),e.dtx&&(this.sessionDescription.sdp=ms.setDTX(this.sessionDescription.sdp)),this.sessionDescription.sdp=ms.setMultiopus(this.sessionDescription.sdp,t)),!e.disableVideo&&e.simulcast&&(this.sessionDescription.sdp=ms.setSimulcast(this.sessionDescription.sdp,e.codec)),e.absCaptureTime&&(this.sessionDescription.sdp=ms.setAbsoluteCaptureTime(this.sessionDescription.sdp)),e.dependencyDescriptor&&(this.sessionDescription.sdp=ms.setDependencyDescriptor(this.sessionDescription.sdp)),e.setSDPToPeer&&(await this.peer.setLocalDescription(this.sessionDescription),bs.info("Peer local description set")),this.sessionDescription.sdp}async addRemoteTrack(e,t){return new Promise((n,r)=>{try{const r=this.peer.addTransceiver(e,{direction:"recvonly",streams:t});this.transceiverMap.set(r,n)}catch(e){r(e)}})}updateBandwidthRestriction(e,t){if(this.mode===ws)throw bs.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");return bs.info("Updating bandwidth restriction, bitrate value: ",t),bs.debug("SDP value: ",e),ms.setVideoBitrate(e,t)}async updateBitrate(e=0){if(this.mode===ws)throw bs.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");if(!this.peer)throw bs.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");bs.info("Updating bitrate to value: ",e),this.sessionDescription=await this.peer.createOffer(),await this.peer.setLocalDescription(this.sessionDescription);const t=this.updateBandwidthRestriction(this.peer.remoteDescription.sdp,e);await this.setRTCRemoteSDP(t),bs.info("Bitrate restrictions updated: ","".concat(e>0?e:"unlimited"," kbps"))}getRTCPeerStatus(){if(bs.info("Getting RTC peer status"),!this.peer)return null;const e=As(this.peer);return bs.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void bs.error("Could not change track if there is not an active connection.");const t=this.peer.getSenders().find(t=>t.track.kind===e.kind);t?t.replaceTrack(e):bs.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Yt,n=RTCRtpSender.getCapabilities(e);if(n){const r={};let s=new RegExp("^video/(".concat(Object.values(ys).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(vs).join("|"),")$"),"i"),t.isChrome()&&(r.multiopus={mimeType:"audio/multiopus",channels:6}));for(const e of n.codecs){const t=e.mimeType.match(s);if(t){const n=t[1].toLowerCase();if(r[n]=Me(Ne({},r[n]),{mimeType:e.mimeType}),e.scalabilityModes){let t=r[n].scalabilityModes||[];t=[...t,...e.scalabilityModes],r[n].scalabilityModes=[...new Set(t)]}e.channels&&(r[n].channels=e.channels)}}n.codecs=Object.keys(r).map(e=>Ne({codec:e},r[e]))}return n}getTracks(){var e,t;return null==(t=null==(e=this.peer)?void 0:e.getSenders())?void 0:t.map(e=>e.track)}initStats(e){this.peerConnectionStats?bs.warn("PeerConnection.initStats() has already been called. Automatic initialization occurs via View.connect(), Publish.connect() or this.createRTCPeer(). See options"):this.peer?(this.peerConnectionStats=new Ji(this.peer,e),Gt(this.peerConnectionStats,this,[Kt])):bs.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null==(e=this.peerConnectionStats)||e.stop(),this.peerConnectionStats=null}}const Rs=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,Es=e=>{if(!e)return null;if(e instanceof MediaStream&&Rs(e))return e;if(!(e instanceof MediaStream)){bs.info("Creating MediaStream to add received tracks.");const t=new MediaStream;for(const n of e)t.addTrack(n);if(Rs(t))return t}throw bs.error("MediaStream must have 1 audio track and 1 video track, or at least one of them."),new Error("MediaStream must have 1 audio track and 1 video track, or at least one of them.")},ks=(e,t)=>{const n=new RTCPeerConnection(t);return Cs(e,n),n};async function Is(e){return new Promise(t=>setTimeout(t,e))}const Cs=(e,t)=>{t.ontrack=async t=>{bs.info("New track from peer."),bs.debug("Track event value: ",t);const n=e.transceiverMap.get(t.transceiver);if(n){for(;!t.transceiver.mid;)await Is(100);n(t.transceiver),e.transceiverMap.delete(t.transceiver)}setTimeout(()=>{e.emit(Ss.track,t)},0)},t.connectionState?t.onconnectionstatechange=n=>{bs.info("Peer connection state change: ",t.connectionState),e.emit(Ss.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=n=>{bs.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(Ss.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=async e=>{if(!t.remoteDescription)return;bs.info("Peer onnegotiationneeded, updating local description");const n=await t.createOffer();bs.info("Peer onnegotiationneeded, got local offer",n.sdp),n.sdp=ms.updateMissingVideoExtensions(n.sdp,t.remoteDescription.sdp),await t.setLocalDescription(n);const r=ms.renegotiate(n.sdp,t.remoteDescription.sdp);bs.info("Peer onnegotiationneeded, updating remote description",r),await t.setRemoteDescription({type:"answer",sdp:r}),bs.info("Peer onnegotiationneeded, renegotiation done")}},xs=(e,t,n)=>{bs.info("Adding mediaStream tracks to RTCPeerConnection");for(const r of t.getTracks()){const s={streams:[t]};"audio"===r.kind&&(s.direction=n.disableAudio?"inactive":"sendonly"),"video"===r.kind&&(s.direction=n.disableVideo?"inactive":"sendonly",n.scalabilityMode&&(new Yt).isChrome()?(bs.debug("Video track with scalability mode: ".concat(n.scalabilityMode,".")),s.sendEncodings=[{scalabilityMode:n.scalabilityMode}]):n.scalabilityMode&&bs.warn("SVC is only supported in Google Chrome")),e.addTransceiver(r,s),bs.info("Track '".concat(r.label,"' added: "),"id: ".concat(r.id),"kind: ".concat(r.kind))}},Ts=(e,t)=>{const n=new Yt;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});n.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let n=0;n<t.multiplexedAudioTracks;n++)e.addTransceiver("audio",{direction:"recvonly"})},As=e=>{var t;const n=null!=(t=e.connectionState)?t:e.iceConnectionState;switch(n){case"checking":return"connecting";case"completed":return"connected";default:return n}};var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.TypedEmitter=Ut.EventEmitter;const{TypedEmitter:Ps}=Ls;class ia extends Ps{constructor(e,t){super(),this.namespace=e,this.tm=t}cmd(e,t){return this.tm.cmd(e,t,this.namespace)}event(e,t){return this.tm.event(e,t,this.namespace)}close(){return this.tm.namespaces.delete(this.namespace)}}var Os=class oa extends Ps{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=e=>{let t;try{t=JSON.parse(e.utf8Data||e.data||e)}catch(e){return}switch(t.type){case"cmd":const{transId:e}=t,r={name:t.name,data:t.data,namespace:t.namespace,accept:t=>{this._send({type:"response",transId:e,data:t})},reject:t=>{this._send({type:"error",transId:e,data:t})}};if(r.namespace){const e=this.namespaces.get(r.namespace);e?e.emit("cmd",r):this.emit("cmd",r)}else this.emit("cmd",r);break;case"response":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.resolve(t.data);break}case"error":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.reject(t.data);break}case"event":const s={name:t.name,data:t.data,namespace:t.namespace};if(s.namespace){var n=this.namespaces.get(s.namespace);n?n.emit("event",s):this.emit("event",s)}else this.emit("event",s)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}_send(e){this.transport.send(JSON.stringify(e))}cmd(e,t,n=void 0){return new Promise((r,s)=>{if(!e||0===e.length)throw new Error("Bad command name");const i={type:"cmd",transId:this.maxId++,name:e,data:t};n&&(i.namespace=n),this.transactions.set(i.transId,Me(Ne({},i),{resolve:r,reject:s}));try{this._send(i)}catch(e){throw this.transactions.delete(i.transId),e}})}event(e,t,n=void 0){if(!e||0===e.length)throw new Error("Bad event name");const r={type:"event",name:e,data:t};n&&(r.namespace=n),this._send(r)}namespace(e){let t=this.namespaces.get(e);return t||(t=new ia(e,this),this.namespaces.set(e,t),t)}close(){for(const e of this.namespaces.values())e.close();this.transport.removeListener?this.transport.removeListener("message",this.listener):this.transport.removeEventListener("message",this.listener)}};const Ns=je(Os),Ms=St.get("Signaling"),Ds="wsConnectionSuccess",Fs="wsConnectionError",js="wsConnectionClose",Vs="broadcastEvent";class mi extends jt{constructor(e={streamName:null,url:"ws://localhost:8080/"}){super(),this.streamName=e.streamName,this.wsUrl=e.url,this.webSocket=null,this.transactionManager=null,this.serverId=null,this.clusterId=null,this.streamViewId=null}async connect(){var e;return Ms.info("Connecting to Signaling Server"),this.transactionManager&&(null==(e=this.webSocket)?void 0:e.readyState)===WebSocket.OPEN?(Ms.info("Connected to server: ",this.webSocket.url),Ms.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(Ds,{ws:this.webSocket,tm:this.transactionManager}),this.webSocket):new Promise((e,t)=>{this.webSocket=new WebSocket(this.wsUrl),this.transactionManager=new Ns(this.webSocket),this.webSocket.onopen=()=>{Ms.info("WebSocket opened"),this.transactionManager.on("event",e=>{this.emit(Vs,e)}),Ms.info("Connected to server: ",this.webSocket.url),Ms.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(Ds,{ws:this.webSocket,tm:this.transactionManager}),e(this.webSocket)},this.webSocket.onerror=()=>{Ms.error("WebSocket not connected: ",this.webSocket.url),this.emit(Fs,this.webSocket.url),t(this.webSocket.url)},this.webSocket.onclose=()=>{this.webSocket=null,this.transactionManager=null,Ms.info("Connection closed with Signaling Server."),this.emit(js)}})}close(){var e;Ms.info("Closing connection with Signaling Server."),null==(e=this.webSocket)||e.close()}async subscribe(e,t,n=null,r=null){var s,i,o,a;Ms.info("Starting subscription to streamName: ",this.streamName),Ms.debug("Subcription local description: ",e);const c=Ws(t,n,r),l={sdp:e=ms.adaptCodecName(e,"AV1X",ys.AV1),streamId:this.streamName,pinnedSourceId:c.pinnedSourceId,excludedSourceIds:c.excludedSourceIds,events:["active","inactive","layers","viewercount","vad","updated","migrate","stopped"]};c.vad&&(l.vad=!0),Array.isArray(c.events)&&(l.events=c.events),c.forcePlayoutDelay&&(l.forcePlayoutDelay=c.forcePlayoutDelay),c.layer&&(l.layer=c.layer);try{if(c.disableVideo&&c.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),Ms.info("Sending view command");const e=await this.transactionManager.cmd("view",l),t=null==(a=null==(o=null==(i=null==(s=RTCRtpReceiver.getCapabilities)?void 0:s.call(RTCRtpReceiver,"video"))?void 0:i.codecs)?void 0:o.find)?void 0:a.call(o,e=>"video/AV1X"===e.mimeType);return e.sdp=t?ms.adaptCodecName(e.sdp,ys.AV1,"AV1X"):e.sdp,Ms.info("Command sent, subscriberId: ",e.subscriberId),Ms.debug("Command result: ",e),this.serverId=e.subscriberId,this.clusterId=e.clusterId,this.streamViewId=e.streamViewId,nt(this.streamName),st(this.serverId),it(e.streamViewId),lt(this.clusterId),e.sdp}catch(e){throw Ms.error("Error sending view command, error: ",e),e}}async publish(e,t,n=null,r=null){var s,i,o,a,c,l,u,d;const p=Zs(t,n,r);Ms.info("Starting publishing to streamName: ".concat(this.streamName,", codec: ").concat(p.codec)),Ms.debug("Publishing local description: ",e);const f=null!=(a=null==(o=null==(i=null==(s=tt.getCapabilities)?void 0:s.call(tt,"video"))?void 0:i.codecs)?void 0:o.map(e=>e.codec))?a:[],h=Object.values(ys);if(-1===h.indexOf(p.codec))throw Ms.error("Invalid codec ".concat(p.codec,". Possible values are: "),h),new Error("Invalid codec ".concat(p.codec,". Possible values are: ").concat(h));if(f.length>0&&-1===f.indexOf(p.codec))throw Ms.error("Unsupported codec ".concat(p.codec,". Possible values are: "),f),new Error("Unsupported codec ".concat(p.codec,". Possible values are: ").concat(f));p.codec===ys.AV1&&(e=ms.adaptCodecName(e,"AV1X",ys.AV1));const m={name:this.streamName,sdp:e,codec:p.codec,sourceId:p.sourceId};if(p.priority){if(!(Number.isInteger(p.priority)&&p.priority>=-2147483648&&p.priority<=2147483647))throw new Error("Invalid value for priority option. It should be a decimal integer between the range [-2^31, +2^31 - 1]");m.priority=p.priority}null!==p.record&&(m.record=p.record),Array.isArray(p.events)&&(m.events=p.events);try{if(p.disableVideo&&p.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),Ms.info("Sending publish command");const e=await this.transactionManager.cmd("publish",m);if(p.codec===ys.AV1){const t=null==(d=null==(u=null==(l=null==(c=RTCRtpSender.getCapabilities)?void 0:c.call(RTCRtpSender,"video"))?void 0:l.codecs)?void 0:u.find)?void 0:d.call(u,e=>"video/AV1X"===e.mimeType);e.sdp=t?ms.adaptCodecName(e.sdp,ys.AV1,"AV1X"):e.sdp}return Ms.info("Command sent, publisherId: ",e.publisherId),Ms.debug("Command result: ",e),this.serverId=e.publisherId,this.clusterId=e.clusterId,nt(this.streamName),st(this.serverId),ot(e.feedId),lt(this.clusterId),e.sdp}catch(e){throw Ms.error("Error sending publish command, error: ",e),e}}async cmd(e,t){return Ms.info("Sending cmd: ".concat(e)),this.transactionManager.cmd(e,t)}}const Ws=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={vad:e,pinnedSourceId:t,excludedSourceIds:n}),r},Zs=(e,t,n)=>{let r="object"==typeof e?e:{};if(0===Object.keys(r).length){r={codec:null!=e?e:ys.H264,record:t,sourceId:n}}return r};class mr extends Error{constructor(e,t){super(e),this.name="FetchError",this.status=t}}const zs=St.get("Director"),Xs="WebRtc";let Ks="";let Hs="https://director.millicast.com";const Qs={setEndpoint:e=>{Hs=e.replace(/\/$/,"")},getEndpoint:()=>Hs,setLiveDomain:e=>{Ks=e.replace(/\/$/,"")},getLiveDomain:()=>Ks,getPublisher:async(e,t=null,n=Xs)=>{const r=qs(e,t,n);zs.info("Getting publisher connection path for stream name: ",r.streamName);const s={streamName:r.streamName,streamType:r.streamType},i={"Content-Type":"application/json",Authorization:"Bearer ".concat(r.token)},o="".concat(Qs.getEndpoint(),"/api/director/publish");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=ii(t),zs.debug("Getting publisher response: ",t),et(t.data.streamAccountId),t.data}catch(e){throw zs.error("Error while getting publisher connection path. ",e),e}},getSubscriber:async(e,t=null,n=null)=>{const r=si(e,t,n);et(r.streamAccountId),zs.info("Getting subscriber connection data for stream name: ".concat(r.streamName," and account id: ").concat(r.streamAccountId));const s={streamAccountId:r.streamAccountId,streamName:r.streamName};let i={"Content-Type":"application/json"};r.subscriberToken&&(i=Me(Ne({},i),{Authorization:"Bearer ".concat(r.subscriberToken)}));const o="".concat(Qs.getEndpoint(),"/api/director/subscribe");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=ii(t),zs.debug("Getting subscriber response: ",t),r.subscriberToken&&(t.data.subscriberToken=r.subscriberToken),t.data}catch(e){throw zs.error("Error while getting subscriber connection path. ",e),e}}},qs=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={token:e,streamName:t,streamType:n}),r},si=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={streamName:e,streamAccountId:t,subscriberToken:n}),r},ii=e=>{if(Qs.getLiveDomain()){const t=/\/\/(.*?)\//,n=e.data.urls.map(e=>{const n=t.exec(e);return e.replace(n[1],Qs.getLiveDomain())});e.data.urls=n}if(e.data.drmObject){const t=e.data.drmObject.playReadyUrl;t&&(e.data.drmObject.playReadyUrl="".concat(Qs.getEndpoint()).concat(t));const n=e.data.drmObject.widevineUrl;n&&(e.data.drmObject.widevineUrl="".concat(Qs.getEndpoint()).concat(n));const r=e.data.drmObject.fairPlayUrl;r&&(e.data.drmObject.fairPlayUrl="".concat(Qs.getEndpoint()).concat(r));const s=e.data.drmObject.fairPlayCertUrl;s&&(e.data.drmObject.fairPlayCertUrl="".concat(Qs.getEndpoint()).concat(s))}return e};function oi(e){this.message=e}oi.prototype=new Error,oi.prototype.name="InvalidCharacterError";var li=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new oi("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,i=0,o="";r=t.charAt(i++);~r&&(n=s%4?64*n+r:r,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};function pi(e){this.message=e}function hi(e,t){if("string"!=typeof e)throw new pi("Invalid token specified");var n=!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 function(e){return decodeURIComponent(li(e).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return li(t)}}(e.split(".")[n]))}catch(e){throw new pi("Invalid token specified: "+e.message)}}pi.prototype=new Error,pi.prototype.name="InvalidTokenError";var gi={exports:{}};!function(e,t){!function(n){if(null!=t&&"number"!=typeof t.nodeType)e.exports=n();else{var r=n(),s=typeof self<"u"?self:$.global;"function"!=typeof s.btoa&&(s.btoa=r.btoa),"function"!=typeof s.atob&&(s.atob=r.atob)}}(function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(n){for(var r,s,i,o,a=String(n),c=0,l="";c<a.length;){if(r=a.charCodeAt(c++),s=a.charCodeAt(c++),i=a.charCodeAt(c++),r>255||s>255||i>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");l+=e.charAt((o=r<<16|s<<8|i)>>18&63)+e.charAt(o>>12&63)+e.charAt(o>>6&63)+e.charAt(63&o)}switch(a.length%3){case 0:return l;case 1:return l.slice(0,-2)+"==";case 2:return l.slice(0,-1)+"="}},atob:function(n){var r=String(n).replace(/[=]+$/,"");if(r.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,i,o=0,a=0,c="";i=r.charAt(a++);~i&&(s=o%4?64*s+i:i,o++%4)?c+=String.fromCharCode(255&s>>(-2*o&6)):0)i=e.indexOf(i);return c}}})}(gi,gi.exports);var yi={exports:{}};let vi;!function(e){!function(t,n){e.exports=n()}(self,()=>{return e={7629:(e,t,n)=>{const r=n(375),s=n(8571),i=n(9474),o=n(1687),a=n(8652),c=n(8160),l=n(3292),u=n(6354),d=n(8901),p=n(9708),f=n(6914),h=n(2294),m=n(6133),g=n(1152),y=n(8863),v=n(2036),w={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return r("function"==typeof p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return c.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){r(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),r(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const n in e){const s=e[n];r("function"==typeof s,"Alteration adjuster for",n,"must be a function"),t.$_terms.alterations.push({target:n,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return r(void 0!==e,"Artifact cannot be undefined"),r(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return r(!1===e||"string"==typeof e,"Invalid to value"),r(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return r(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return r(e,"Missing error"),r(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return r(void 0!==e,"Missing example"),c.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(r(!t,"Cannot combine options with description"),t=e.description,e=e.method),r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(r("string"==typeof e,"id must be a non-empty string"),r(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return r(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return r(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){r(e.length,"Missing notes");for(const t of e)r(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return r("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){r(e,"Missing preferences"),r(void 0===e.context,"Cannot override context"),r(void 0===e.externals,"Cannot override externals"),r(void 0===e.warnings,"Cannot override warnings"),r(void 0===e.debug,"Cannot override debug"),c.checkPreferences(e);const t=this.clone();return t._preferences=c.preferences(t._preferences,e),t}presence(e){return r(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return r(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),n=void 0!==e&&!e;return t._preferences=c.preferences(t._preferences,{convert:n}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){r(e.length,"Missing tags");for(const t of e)r(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return r(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){c.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const n=this.clone();n.$_terms.whens||(n.$_terms.whens=[]);const s=l.when(n,e,t);if(!["any","link"].includes(n.type)){const e=s.is?[s]:s.switch;for(const t of e)r(!t.then||"any"===t.then.type||t.then.type===n.type,"Cannot combine",n.type,"with",t.then&&t.then.type),r(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===n.type,"Cannot combine",n.type,"with",t.otherwise&&t.otherwise.type)}return n.$_terms.whens.push(s),n.$_mutateRebuild()}cache(e){r(!this._inRuleset(),"Cannot set caching inside a ruleset"),r(!this._cache,"Cannot override schema cache"),r(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||a.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){r(c.isSchema(e),"Invalid schema object"),r("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),r(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),r(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const n=e.clone();for(const e of Object.keys(t))"type"!==e&&(n[e]=t[e]);t=n}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?c.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const n of e._singleRules.keys())t._singleRules.has(n)&&(t._rules=t._rules.filter(e=>e.keep||e.name!==n),t._singleRules.delete(n));for(const n of e._rules)e._definition.rules[n.method].multi||t._singleRules.set(n.name,n),t._rules.push(n);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else o(t._flags,e._flags);for(const n in e.$_terms){const r=e.$_terms[n];r?t.$_terms[n]?t.$_terms[n]=t.$_terms[n].concat(r):t.$_terms[n]=r.slice():t.$_terms[n]||(t.$_terms[n]=r)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return r(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){r(!this._inRuleset(),"Cannot fork inside a ruleset");let n=this;for(let r of[].concat(e))r=Array.isArray(r)?r:r.split("."),n=n._ids.fork(r,t,n);return n.$_temp.ruleset=!1,n}rule(e){const t=this._definition;c.assertOptions(e,Object.keys(t.modifiers)),r(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const n=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;r(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const i=this.clone();for(let o=n;o<i._rules.length;++o){const n=i._rules[o],a=s(n);for(const s in e)t.modifiers[s](a,e[s]),r(a.name===n.name,"Cannot change rule name");i._rules[o]=a,i._singleRules.get(a.name)===n&&i._singleRules.set(a.name,a)}return i.$_temp.ruleset=!1,i.$_mutateRebuild()}get ruleset(){r(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),r(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:n,adjuster:s}of this.$_terms.alterations)e.includes(n)&&(t=s(t),r(c.isSchema(t),"Alteration adjuster for",n,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),r(e&&"object"==typeof e,"Invalid options"),r(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)r("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const n=this._definition.rules[t.method],s=t.args;r(n,"Unknown rule",t.method);const i=this.clone();if(s){r(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let o=s[e];if(n.argsByName){const a=n.argsByName.get(e);if(a.ref&&c.isResolvable(o))t._resolve.push(e),i.$_mutateRegister(o);else if(a.normalize&&(o=a.normalize(o),s[e]=o),a.assert){const t=c.validateArg(o,e,a);r(!t,t,"or reference")}}void 0!==o?s[e]=o:delete s[e]}}return n.multi||(i._ruleRemove(t.name,{clone:!1}),i._singleRules.set(t.name,t)),!1===i.$_temp.ruleset&&(i.$_temp.ruleset=null),n.priority?i._rules.unshift(t):i._rules.push(t),i}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,n,r,s,i={}){const o=!1!==i.flags?this._flags:{},a=i.messages?f.merge(this._definition.messages,i.messages):this._definition.messages;return new u.Report(e,t,n,o,a,r,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,n,r){(n=Object.assign({},n)).abortEarly=!0,n._externals=!1,t.snapshot();const s=!y.validate(e,this,t,n,r).errors;return t.restore(),s}$_modify(e){return c.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){return r(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:n,path:r,key:s})=>{const i=this._definition[t][n]&&this._definition[t][n].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:n}={}){this._refs.register(e,t),this._ids.register(e,{key:n})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,n={}){r("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(i(t,s.default)&&(t=void 0),i(t,this._flags[e]))return this;const o=!1!==n.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][c.symbols.parent].call(this,...t)}$_validate(e,t,n){return y.validate(e,this,t,n)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const n in t){const r=t[n];e.$_terms[n]=r.init}return e.$_mutateRebuild()}_default(e,t,n={}){return c.assertOptions(n,"literal"),r(void 0!==t,"Missing",e,"value"),r("function"==typeof t||!n.literal,"Only function value supports literal option"),"function"==typeof t&&n.literal&&(t={[c.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,n){if(!this.$_terms.whens)return{schema:this};const r=[],s=[];for(let i=0;i<this.$_terms.whens.length;++i){const o=this.$_terms.whens[i];if(o.concat){r.push(o.concat),s.push("".concat(i,".concat"));continue}const a=o.ref?o.ref.resolve(e,t,n):e,c=o.is?[o]:o.switch,l=s.length;for(let l=0;l<c.length;++l){const{is:u,then:d,otherwise:p}=c[l],f="".concat(i).concat(o.switch?"."+l:"");if(u.$_match(a,t.nest(u,"".concat(f,".is")),n)){if(d){const i=t.localize([...t.path,"".concat(f,".then")],t.ancestors,t.schemas),{schema:o,id:a}=d._generate(e,i,n);r.push(o),s.push("".concat(f,".then").concat(a?"(".concat(a,")"):""));break}}else if(p){const i=t.localize([...t.path,"".concat(f,".otherwise")],t.ancestors,t.schemas),{schema:o,id:a}=p._generate(e,i,n);r.push(o),s.push("".concat(f,".otherwise").concat(a?"(".concat(a,")"):""));break}}if(o.break&&s.length>l)break}const i=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",i),!i)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,n));for(const e of r)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...r]),this.$_temp.whens[i]=o,{schema:o,id:i}}_inner(e,t,n={}){r(!this._inRuleset(),"Cannot set ".concat(e," inside a ruleset"));const s=this.clone();return s.$_terms[e]&&!n.override||(s.$_terms[e]=[]),n.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const n=!1!==t.clone?this.clone():this;n._singleRules.delete(e);const r=[];for(let t=0;t<n._rules.length;++t){const s=n._rules[t];s.name!==e||s.keep?r.push(s):n._inRuleset()&&t<n.$_temp.ruleset&&--n.$_temp.ruleset}return n._rules=r,n}_values(e,t){c.verifyFlat(e,t.slice(1,-1));const n=this.clone(),s=e[0]===c.symbols.override;if(s&&(e=e.slice(1)),!n[t]&&e.length?n[t]=new v:s&&(n[t]=e.length?new v:null,n.$_mutateRebuild()),!n[t])return n;s&&n[t].override();for(const s of e){r(void 0!==s,"Cannot call allow/valid/invalid with undefined"),r(s!==c.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";n[e]&&(n[e].remove(s),n[e].length||(r("_valids"===t||!n._flags.only,"Setting invalid value",s,"leaves schema rejecting all values due to previous valid rule"),n[e]=null)),n[t].add(s,n._refs)}return n}}};w.Base.prototype[c.symbols.any]={version:c.version,compile:l.compile,root:"$_root"},w.Base.prototype.isImmutable=!0,w.Base.prototype.deny=w.Base.prototype.invalid,w.Base.prototype.disallow=w.Base.prototype.invalid,w.Base.prototype.equal=w.Base.prototype.valid,w.Base.prototype.exist=w.Base.prototype.required,w.Base.prototype.not=w.Base.prototype.invalid,w.Base.prototype.options=w.Base.prototype.prefs,w.Base.prototype.preferences=w.Base.prototype.prefs,e.exports=new w.Base},8652:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){i.assertOptions(e,["max"]),r(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let n=this._map.get(e);if(n)return n.value=t,void this._list.first(n);n=this._list.unshift({key:e,value:t}),this._map.set(e,n),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:n}=e;return t.prev=n,n&&(n.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,n)=>{const r=n(375),s=n(7916),i=n(5934);let o,a;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=i.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,n="Options"){r(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter(e=>!t.includes(e));r(0===s.length,"".concat(n," contain unknown keys: ").concat(s))},t.checkPreferences=function(e){a=a||n(3378);const t=a.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,n){switch(n){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,n={}){const s=e&&e[t.symbols.any];return!!s&&(r(n.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,r){o=o||n(6914),e=e||{},r=r||{};const s=Object.assign({},e,r);return r.errors&&e.errors&&(s.errors=Object.assign({},e.errors,r.errors),s.errors.wrap=Object.assign({},e.errors.wrap,r.errors.wrap)),r.messages&&(s.messages=o.compile(r.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,n={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,n.append&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},t.validateArg=function(e,n,{assert:r,message:s}){if(t.isSchema(r)){const t=r.validate(e);return t.error?t.error.message:void 0}if(!r(e))return n?"".concat(n," ").concat(s):s},t.verifyFlat=function(e,t){for(const n of e)r(!Array.isArray(n),"Method no longer accepts array arguments:",t)}},3292:(e,t,n)=>{const r=n(375),s=n(8160),i=n(6133),o={};t.schema=function(e,t,n={}){s.assertOptions(n,["appendPath","override"]);try{return o.schema(e,t,n)}catch(e){throw n.appendPath&&void 0!==e.path&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},o.schema=function(e,t,n){r(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(r(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const i=(t,...r)=>!1!==n.override?t.valid(e.override,...r):t.valid(...r);if(o.simple(t))return i(e,t);if("function"==typeof t)return e.custom(t);if(r("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return i(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const n of t)if(!o.simple(n))return e.alternatives().try(...t);return i(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?i(e.date(),t):(r(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return i.isRef(e)?e:i.create(e,t)},t.compile=function(e,n,i={}){s.assertOptions(i,["legacy"]);const a=n&&n[s.symbols.any];if(a)return r(i.legacy||a.version===s.version,"Cannot mix different versions of joi schemas:",a.version,s.version),n;if("object"!=typeof n||!i.legacy)return t.schema(e,n,{appendPath:!0});const c=o.walk(n);return c?c.compile(c.root,n):t.schema(e,n,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};r(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const n=o.walk(e[t]);if(n)return n}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,n,a){if(void 0===a&&(r(n&&"object"==typeof n,"Missing options"),a=n,n=i.create(".")),Array.isArray(a)&&(a={switch:a}),s.assertOptions(a,["is","not","then","otherwise","switch","break"]),s.isSchema(n))return r(void 0===a.is,'"is" can not be used with a schema condition'),r(void 0===a.not,'"not" can not be used with a schema condition'),r(void 0===a.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:n,then:a.then,otherwise:a.otherwise,break:a.break});if(r(i.isRef(n)||"string"==typeof n,"Invalid condition:",n),r(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let c=a;void 0!==a.not&&(c={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return r(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),r(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||i.isRef(a.is)||s.isSchema(a.is)||(l=l.required()),o.condition(e,{ref:t.ref(n),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}r(Array.isArray(a.switch),'"switch" must be an array'),r(void 0===a.is,'Cannot combine "switch" with "is"'),r(void 0===a.not,'Cannot combine "switch" with "not"'),r(void 0===a.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(n),switch:[],break:a.break};for(let t=0;t<a.switch.length;++t){const n=a.switch[t],o=t===a.switch.length-1;s.assertOptions(n,o?["is","then","otherwise"]:["is","then"]),r(void 0!==n.is,'Switch statement missing "is"'),r(void 0!==n.then,'Switch statement missing "then"');const l={is:e.$_compile(n.is),then:e.$_compile(n.then)};if(i.isRef(n.is)||s.isSchema(n.is)||(l.is=l.is.required()),o){r(void 0===a.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==a.otherwise?a.otherwise:n.otherwise;void 0!==t&&(r(void 0===c.break,"Cannot specify both otherwise and break"),l.otherwise=e.$_compile(t))}c.switch.push(l)}return c},o.condition=function(e,t){for(const n of["then","otherwise"])void 0===t[n]?delete t[n]:t[n]=e.$_compile(t[n]);return t}},6354:(e,t,n)=>{const r=n(5688),s=n(8160),i=n(3328);t.Report=class{constructor(e,n,r,s,i,o,a){if(this.code=e,this.flags=s,this.messages=i,this.path=o.path,this.prefs=a,this.state=o,this.value=n,this.message=null,this.template=null,this.local=r||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?'Error code "'.concat(e,'" is not defined, your custom type is missing the correct messages definition'):(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,n){return t.template(this.value,e,n||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const n of e)"object"!=typeof n&&("string"==typeof n?(t&&(t+="."),t+=n):t+="[".concat(n,"]"));return t},t.template=function(e,t,n,r,o){if(!t)return;if(i.isTemplate(t))return"root"!==n?t:null;let a=o.errors.language;if(s.isResolvable(a)&&(a=a.resolve(e,r,o)),a&&t[a]){if(void 0!==t[a][n])return t[a][n];if(void 0!==t[a]["*"])return t[a]["*"]}return t[n]?t[n]:t["*"]},t.label=function(e,n,r,s){if(!r.errors.label)return"";if(e.label)return e.label;let i=n.path;return"key"===r.errors.label&&n.path.length>1&&(i=n.path.slice(-1)),t.path(i)||t.template(null,r.messages,"root",n,r)||s&&t.template(null,s,"root",n,r)||"value"},t.process=function(e,n,r){if(!e)return null;const{override:s,message:i,details:o}=t.details(e);if(s)return s;if(r.errors.stack)return new t.ValidationError(i,o,n);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(i,o,n);return Error.stackTraceLimit=a,c},t.details=function(e,t={}){let n=[];const r=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();n.push(e),r.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();n.push(e),r.push({message:e,path:s.path.filter(e=>"object"!=typeof e),type:s.code,context:s.local})}return n.length>1&&(n=[...new Set(n)]),{message:n.join(". "),details:r}},t.ValidationError=class extends Error{constructor(e,t,n){super(e),this._original=n,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=r.error},8901:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8160),o=n(6914),a={};t.type=function(e,t){const n=Object.getPrototypeOf(e),c=s(n),l=e._assign(Object.create(c)),u=Object.assign({},t);delete u.base,c._definition=u;const d=n._definition||{};u.messages=o.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const p=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];r(void 0===l.$_terms[e],"Invalid term override for",u.type,e),l.$_terms[e]=t.init,p[e]=t}u.terms=p,u.args||(u.args=d.args),u.prepare=a.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=a.coerce(u.coerce,d.coerce),u.validate=a.validate(u.validate,d.validate);const f=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];r("object"==typeof t,"Invalid rule definition for",u.type,e);let n=t.method;if(void 0===n&&(n=function(){return this.$_addRule(e)}),n&&(r(!c[e],"Rule conflict in",u.type,e),c[e]=n),r(!f[e],"Rule conflict in",u.type,e),f[e]=t,t.alias){const e=[].concat(t.alias);for(const n of e)c[n]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map(e=>("string"==typeof e&&(e={name:e}),r(!t.argsByName.has(e.name),"Duplicated argument name",e.name),i.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e)))}u.rules=f;const h=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){r(!c[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];r("function"==typeof t,"Invalid modifier definition for",u.type,e);const n=function(t){return this.rule({[e]:t})};c[e]=n,h[e]=t}if(u.modifiers=h,u.overrides){c._super=n,l.$_super={};for(const e in u.overrides)r(n[e],"Cannot override missing",e),u.overrides[e][i.symbols.parent]=n[e],l.$_super[e]=n[e].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=a.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=a.rebuild(u.rebuild,d.rebuild),l},a.build=function(e,t){return e&&t?function(n,r){return t(e(n,r),r)}:e||t},a.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(n,r){let s;if((!t.from||t.from.includes(typeof n))&&(s=t.method(n,r),s)){if(s.errors||void 0===s.value)return s;n=s.value}if(!e.from||e.from.includes(typeof n)){const t=e.method(n,r);if(t)return t}return s}}:e||t},a.prepare=function(e,t){return e&&t?function(n,r){const s=e(n,r);if(s){if(s.errors||void 0===s.value)return s;n=s.value}return t(n,r)||s}:e||t},a.rebuild=function(e,t){return e&&t?function(n){t(n),e(n)}:e||t},a.validate=function(e,t){return e&&t?function(n,r){const s=t(n,r);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;n=s.value}return e(n,r)||s}:e||t}},5107:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8652),o=n(8160),a=n(3292),c=n(6354),l=n(8901),u=n(9708),d=n(6133),p=n(3328),f=n(1152);let h;const m={types:{alternatives:n(4946),any:n(8068),array:n(546),boolean:n(4937),date:n(7500),function:n(390),link:n(8785),number:n(3832),object:n(8966),string:n(7417),symbol:n(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(m.types))};for(const t of e._types)e[t]=function(...e){return r(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const n=m.aliases[t];e[t]=e[n]}return e.x=e.expression,f.setup&&f.setup(e),e}};m.methods={ValidationError:c.ValidationError,version:o.version,cache:i.provider,assert(e,t,...n){m.assert(e,t,!0,n)},attempt:(e,t,...n)=>m.assert(e,t,!1,n),build(e){return r("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return a.compile(this,e,t)},defaults(e){r("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const n of t._types){const s=e(t[n]());r(o.isSchema(s),"modifier must return a valid schema object"),t[n]=function(...e){return m.generate(this,s,e)}}return t},expression:(...e)=>new p(...e),extend(...e){o.verifyFlat(e,"extend"),h=h||n(3378),r(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let n of e){"function"==typeof n&&(n=n(t)),this.assert(n,h.extension);const e=m.expandExtension(n,t);for(const n of e){r(void 0===t[n.type]||t._types.has(n.type),"Cannot override name",n.type);const e=n.base||this.any(),s=l.type(e,n);t._types.add(n.type),t[n.type]=function(...e){return m.generate(this,s,e)}}}return t},isError:c.ValidationError.isError,isExpression:p.isTemplate,isRef:d.isRef,isSchema:o.isSchema,in:(...e)=>d.in(...e),override:o.symbols.override,ref:(...e)=>d.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,n,r){const i=r[0]instanceof Error||"string"==typeof r[0]?r[0]:null,a=null!==i?r[1]:r[0],l=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let u=l.error;if(!u)return l.value;if(i instanceof Error)throw i;const d=n&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==0&&(u=s(u)),u.message=i?"".concat(i," ").concat(d):d,u},m.generate=function(e,t,n){return r(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&n.length?t._definition.args(t,...n):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const n=[];for(const r of t._types)if(e.type.test(r)){const s=Object.assign({},e);s.type=r,s.base=t[r](),n.push(s)}return n},e.exports=m.root()},6914:(e,t,n)=>{const r=n(375),s=n(8571),i=n(3328);t.compile=function(e,t){if("string"==typeof e)return r(!t,"Cannot set single message string"),new i(e);if(i.isTemplate(e))return r(!t,"Cannot set single message template"),e;r("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let n in e){const s=e[n];if("root"===n||i.isTemplate(s)){t[n]=s;continue}if("string"==typeof s){t[n]=new i(s);continue}r("object"==typeof s&&!Array.isArray(s),"Invalid message for",n);const o=n;for(n in t[o]=t[o]||{},s){const e=s[n];"root"===n||i.isTemplate(e)?t[o][n]=e:(r("string"==typeof e,"Invalid message for",n,"in",o),t[o][n]=new i(e))}}return t},t.decompile=function(e){const t={};for(let n in e){const r=e[n];if("root"===n){t.root=r;continue}if(i.isTemplate(r)){t[n]=r.describe({compact:!0});continue}const s=n;for(n in t[s]={},r){const e=r[n];"root"!==n?t[s][n]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,n){if(!e)return t.compile(n);if(!n)return e;if("string"==typeof n)return new i(n);if(i.isTemplate(n))return n;const o=s(e);for(let e in n){const t=n[e];if("root"===e||i.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new i(t);continue}r("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in o[s]=o[s]||{},t){const n=t[e];"root"===e||i.isTemplate(n)?o[s][e]=n:(r("string"==typeof n,"Invalid message for",e,"in",s),o[s][e]=new i(n))}}return o}},2294:(e,t,n)=>{const r=n(375),s=n(8160),i=n(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,n]of e._byId.entries())r(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,n);for(const[t,n]of e._byKey.entries())r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,n)}fork(e,t,n){const i=this._collect(e);i.push({schema:n});const a=i.shift();let c={id:a.id,schema:t(a.schema)};r(s.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of i)c={id:e.id,schema:o.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const n=e[0],r=this._get(n);if(!r)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,r.schema._flags.label||n],s.length?r.schema._ids.labels(s,t):t.join(".")}reach(e,t=[]){const n=e[0],s=this._get(n);r(s,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?s.schema._ids.reach(i,[...t,n]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const t=this._byId.get(n);r(!t||t.schema===e,"Cannot add different schemas with the same id:",n),r(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}t&&(r(!this._byKey.has(t),"Schema already contains key:",t),r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],n=[]){const s=e[0],i=this._get(s);r(i,"Schema does not contain path",[...t,...e].join(".")),n=[i,...n];const o=e.slice(1);return o.length?i.schema._ids._collect(o,[...t,s],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.fork=function(e,n,r){const s=t.schema(e,{each:(e,{key:t})=>{if(n===(e._flags.id||t))return r},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let n;for(const r in e._flags){if("_"===r[0])continue;const s=o.scan(e._flags[r],{source:"flags",name:r},t);void 0!==s&&(n=n||e.clone(),n._flags[r]=s)}for(let r=0;r<e._rules.length;++r){const s=e._rules[r],i=o.scan(s.args,{source:"rules",name:s.name},t);if(void 0!==i){n=n||e.clone();const t=Object.assign({},s);t.args=i,n._rules[r]=t,n._singleRules.get(s.name)===s&&n._singleRules.set(s.name,t)}}for(const r in e.$_terms){if("_"===r[0])continue;const s=o.scan(e.$_terms[r],{source:"terms",name:r},t);void 0!==s&&(n=n||e.clone(),n.$_terms[r]=s)}return n},o.scan=function(e,t,n,r,a){const c=r||[];if(null===e||"object"!=typeof e)return;let l;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const s="terms"===t.source&&"keys"===t.name&&e[r].key,i=o.scan(e[r],t,n,[r,...c],s);void 0!==i&&(l=l||e.slice(),l[r]=i)}return l}if(!1!==n.schema&&s.isSchema(e)||!1!==n.ref&&i.isRef(e)){const r=n.each(e,Me(Ne({},t),{path:c,key:a}));return r===e?void 0:r}for(const r in e){if("_"===r[0])continue;const s=o.scan(e[r],t,n,[r,...c],a);void 0!==s&&(l=l||Object.assign({},e),l[r]=s)}return l}},6133:(e,t,n)=>{const r=n(375),s=n(8571),i=n(9621),o=n(8160);let a;const c={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){r("string"==typeof e,"Invalid reference key:",e),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),r(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const n=Object.assign({},c.defaults,t);delete n.prefix;const s=n.separator,i=c.context(e,s,t.prefix);if(n.type=i.type,e=i.key,"value"===n.type)if(i.root&&(r(!s||e[0]!==s,"Cannot specify relative path with root prefix"),n.ancestor="root",e||(e=null)),s&&s===e)e=null,n.ancestor=0;else if(void 0!==n.ancestor)r(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,r]=c.ancestor(e,s);r&&""===(e=e.slice(r))&&(e=null),n.ancestor=t}return n.path=s?null===e?[]:e.split(s):[e],new c.Ref(n)},t.in=function(e,n={}){return t.create(e,Me(Ne({},n),{in:!0}))},t.isRef=function(e){return!!e&&!!e[o.symbols.ref]},c.Ref=class{constructor(e){r("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),r([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),r(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),r(!e.map||Array.isArray(e.map),"options.map must be an array"),r(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,c.defaults,e),r("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,n,s,i={}){return r(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(n.context,t,i):"local"===this.type?this._resolve(s,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(r(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,n){let r;if("value"===this.type&&t.mainstay.shadow&&!1!==n.shadow&&(r=t.mainstay.shadow.get(this.absolute(t))),void 0===r&&(r=i(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(r=this.adjust(r)),this.map){const e=this.map.get(r);void 0!==e&&(r=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,r),r}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new c.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display="ref:".concat(this.type,":").concat(e));if(!this.separator)return void(this.display="ref:".concat(e));if(!this.ancestor)return void(this.display="ref:".concat(this.separator).concat(e));if("root"===this.ancestor)return void(this.display="ref:root:".concat(e));if(1===this.ancestor)return void(this.display="ref:".concat(e||".."));const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display="ref:".concat(t).concat(e||"")}},c.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},c.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new c.Ref(e)},c.context=function(e,t,n={}){if(e=e.trim(),n){const r=void 0===n.global?"$":n.global;if(r!==t&&e.startsWith(r))return{key:e.slice(r.length),type:"global"};const s=void 0===n.local?"#":n.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const i=void 0===n.root?"/":n.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},c.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let n=2;for(;e[n]===t;)++n;return[n-1,n]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root}),a=a||n(3328),a.isTemplate(e)&&this.register(e.refs(),r)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter(e=>!e.ancestor).map(e=>e.root)}}},3378:(e,t,n)=>{const r=n(5107),s={};s.wrap=r.string().min(1).max(2).allow(!1),t.preferences=r.object({allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),context:r.object(),convert:r.boolean(),dateFormat:r.valid("date","iso","string","time","utc"),debug:r.boolean(),errors:{escapeHtml:r.boolean(),label:r.valid("path","key",!1),language:[r.string(),r.object().ref()],render:r.boolean(),stack:r.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:r.boolean(),messages:r.object(),noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:r.valid("required","optional","forbidden"),skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=r.object({alias:r.array().items(r.string().pattern(s.nameRx)).single(),args:r.array().items(r.string(),r.object({name:r.string().pattern(s.nameRx).required(),ref:r.boolean(),assert:r.alternatives([r.function(),r.object().schema()]).conditional("ref",{is:!0,then:r.required()}),normalize:r.function(),message:r.string().when("assert",{is:r.function(),then:r.required()})})),convert:r.boolean(),manifest:r.boolean(),method:r.function().allow(!1),multi:r.boolean(),validate:r.function()}),t.extension=r.object({type:r.alternatives([r.string(),r.object().regex()]).required(),args:r.function(),cast:r.object().pattern(s.nameRx,r.object({from:r.function().maxArity(1).required(),to:r.function().minArity(1).maxArity(2).required()})),base:r.object().schema().when("type",{is:r.object().regex(),then:r.forbidden()}),coerce:[r.function().maxArity(3),r.object({method:r.function().maxArity(3).required(),from:r.array().items(r.string()).single()})],flags:r.object().pattern(s.nameRx,r.object({setter:r.string(),default:r.any()})),manifest:{build:r.function().arity(2)},messages:[r.object(),r.string()],modifiers:r.object().pattern(s.nameRx,r.function().minArity(1).maxArity(2)),overrides:r.object().pattern(s.nameRx,r.function()),prepare:r.function().maxArity(3),rebuild:r.function().arity(1),rules:r.object().pattern(s.nameRx,s.rule),terms:r.object().pattern(s.nameRx,r.object({init:r.array().allow(null).required(),manifest:r.object().pattern(/.+/,[r.valid("schema","single"),r.object({mapped:r.object({from:r.string().required(),to:r.string().required()}).required()})])})),validate:r.function().maxArity(3)}).strict(),t.extensions=r.array().items(r.object(),r.function().arity(1)).strict(),s.desc={buffer:r.object({buffer:r.string()}),func:r.object({function:r.function().required(),options:{literal:!0}}),override:r.object({override:!0}),ref:r.object({ref:r.object({type:r.valid("value","global","local"),path:r.array().required(),separator:r.string().length(1).allow(!1),ancestor:r.number().min(0).integer().allow("root"),map:r.array().items(r.array().length(2)).min(1),adjust:r.function(),iterables:r.boolean(),in:r.boolean(),render:r.boolean()}).required()}),regex:r.object({regex:r.string().min(3)}),special:r.object({special:r.valid("deep").required()}),template:r.object({template:r.string().required(),options:r.object()}),value:r.object({value:r.alternatives([r.object(),r.array()]).required()})},s.desc.entity=r.alternatives([r.array().items(r.link("...")),r.boolean(),r.function(),r.number(),r.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,r.link("/")]),s.desc.values=r.array().items(null,r.boolean(),r.function(),r.number().allow(1/0,-1/0),r.string().allow(""),r.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=r.object().pattern(/.+/,[r.string(),s.desc.template,r.object().pattern(/.+/,[r.string(),s.desc.template])]),t.description=r.object({type:r.string().required(),flags:r.object({cast:r.string(),default:r.any(),description:r.string(),empty:r.link("/"),failover:s.desc.entity,id:r.string(),label:r.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:r.boolean(),unit:r.string()}).unknown(),preferences:{allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),convert:r.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:r.boolean(),label:["path","key"],language:[r.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:r.boolean(),messages:s.desc.messages,noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:["required","optional","forbidden"],skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:r.array().min(1).items({name:r.string().required(),args:r.object().min(1),keep:r.boolean(),message:[r.string(),s.desc.messages],warn:r.boolean()}),keys:r.object().pattern(/.*/,r.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,r.any())},493:(e,t,n)=>{const r=n(8571),s=n(9621),i=n(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,n){this.path=e,this.ancestors=t,this.mainstay=n.mainstay,this.schemas=n.schemas,this.debug=null}localize(e,t=null,n=null){const r=new o.State(e,t,this);return n&&r.schemas&&(r.schemas=[o.schemas(n),...r.schemas]),r}nest(e,t){const n=new o.State(this.path,this.ancestors,this);return n.schemas=n.schemas&&[o.schemas(e),...n.schemas],n.debug=t,n}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=r(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return i.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,n){if(!e.length||"strip"===n&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let r=this._values;for(let t=0;t<e.length;++t){const n=e[t];let s=r.get(n);s||(s=new Map,r.set(n,s)),r=s}r[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.value]}node(e){if(this._values)return s(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const n=e.slice(0,-1),r=e[e.length-1],i=s(this._values,n,{iterables:!0});t?i.set(r,t):i&&i.delete(r)}}},3328:(e,t,n)=>{const r=n(375),s=n(8571),i=n(5277),o=n(1447),a=n(8160),c=n(6354),l=n(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(r("string"==typeof e,"Template source must be a string"),r(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const e=t,{functions:n}=e,i=Fe(e,["functions"]);this._settings=Object.keys(i).length?s(i):void 0,this._functions=n,this._functions&&(r(Object.keys(this._functions).every(e=>"string"==typeof e),"Functions keys must be strings"),r(Object.values(this._functions).every(e=>"function"==typeof e),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let n=!1;const r=[],s=t.shift();s&&r.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",i=e.indexOf(s);if(-1===i||"{"===e[1]){r.push("{".concat(u.decode(e)));continue}let o=e.slice(t?0:1,i);const a=":"===o[0];a&&(o=o.slice(1));const c=this._ref(u.decode(o),{raw:t,wrapped:a});r.push(c),"string"!=typeof c&&(n=!0);const l=e.slice(i+s.length);l&&r.push(u.decode(l))}n?this._template=r:this.rendered=r.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?Me(Ne({},e.options),{functions:e.functions}):void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[a.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,n,r){return this._template&&1===this._template.length?this._part(this._template[0],e,t,n,r,{}):this.render(e,t,n,r)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,n,r,s={}){if(!this.isDynamic())return this.rendered;const o=[];for(const a of this._template)if("string"==typeof a)o.push(a);else{const c=this._part(a,e,t,n,r,s),l=u.stringify(c,e,t,n,r,s);if(void 0!==l){const e=a.raw||!1===(s.errors&&s.errors.escapeHtml)?l:i(l);o.push(u.wrap(e,a.wrapped&&n.errors.wrap.label))}}return o.join("")}_ref(e,{raw:t,wrapped:n}){const r=[],s=e=>{const t=l.create(e,this._settings);return r.push(t),e=>{const n=t.resolve(...e);return void 0!==n?n:null}};try{const t=this._functions?Ne(Ne({},u.functions),this._functions):u.functions;var i=new o.Parser(e,{reference:s,functions:t,constants:u.constants})}catch(t){throw t.message='Invalid template variable "'.concat(e,'" fails due to: ').concat(t.message),t}if(i.single){if("reference"===i.single.type){const e=r[0];return{ref:e,raw:t,refs:r,wrapped:n||"local"===e.type&&"label"===e.key}}return u.stringify(i.single.value)}return{formula:i,raw:t,refs:r}}toString(){return this.source}},u.Template.prototype[a.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,(e,t)=>u.opens.slice(0,t.length)).replace(/\\(\}+)/g,(e,t)=>u.closes.slice(0,t.length))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let n="";for(let r=0;r<e.length;++r){const s=e[r];if("{"===s){let s="";for(;r+1<e.length&&"{"===e[r+1];)s+="{",++r;t.push(n),n=s}else n+=s}return t.push(n),t},u.wrap=function(e,t){return t?1===t.length?"".concat(t).concat(e).concat(t):"".concat(t[0]).concat(e).concat(t[1]):e},u.stringify=function(e,t,n,r,s,i={}){const o=typeof e,a=r&&r.errors&&r.errors.wrap||{};let c=!1;if(l.isRef(e)&&e.render&&(c=e.in,e=e.resolve(t,n,r,s,Ne({in:e.in},i))),null===e)return"null";if("string"===o)return u.wrap(e,i.arrayItems&&a.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,r);if(e instanceof Map){const t=[];for(const[n,r]of e.entries())t.push("".concat(n.toString()," -> ").concat(r.toString()));e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const o of e)d.push(u.stringify(o,t,n,r,s,Ne({arrayItems:!0},i)));return u.wrap(d.join(", "),!c&&a.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,n)=>e?t:n,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,n,r,s,i]=this,o=i.messages;if(!o)return"";const a=c.template(t,o[0],e,n,r)||c.template(t,o[1],e,n,r);return a?a.render(t,n,r,s,i):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,n)=>{const r=n(375),s=n(1687),i=n(8068),o=n(8160),a=n(3292),c=n(6354),l=n(6133),u={};e.exports=i.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:n,error:r,state:i,prefs:o}=t;if(n._flags.match){const t=[],a=[];for(let r=0;r<n.$_terms.matches.length;++r){const s=n.$_terms.matches[r],c=i.nest(s.schema,"match.".concat(r));c.snapshot();const l=s.schema.$_validate(e,c,o);l.errors?(a.push(l.errors),c.restore()):(t.push(l.value),c.commit())}if(0===t.length)return{errors:r("alternatives.any",{details:a.map(e=>c.details(e,{override:!1}))})};if("one"===n._flags.match)return 1===t.length?{value:t[0]}:{errors:r("alternatives.one")};if(t.length!==n.$_terms.matches.length)return{errors:r("alternatives.all",{details:a.map(e=>c.details(e,{override:!1}))})};const l=e=>e.$_terms.matches.some(e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema));return l(n)?{value:t.reduce((e,t)=>s(e,t,{mergeArrays:!1}))}:{value:t[t.length-1]}}const a=[];for(let t=0;t<n.$_terms.matches.length;++t){const r=n.$_terms.matches[t];if(r.schema){const n=i.nest(r.schema,"match.".concat(t));n.snapshot();const s=r.schema.$_validate(e,n,o);if(!s.errors)return n.commit(),s;n.restore(),a.push({schema:r.schema,reports:s.errors});continue}const s=r.ref?r.ref.resolve(e,i,o):e,c=r.is?[r]:r.switch;for(let n=0;n<c.length;++n){const a=c[n],{is:l,then:u,otherwise:d}=a,p="match.".concat(t).concat(r.switch?"."+n:"");if(l.$_match(s,i.nest(l,"".concat(p,".is")),o)){if(u)return u.$_validate(e,i.nest(u,"".concat(p,".then")),o)}else if(d)return d.$_validate(e,i.nest(d,"".concat(p,".otherwise")),o)}}return u.errors(a,t)},rules:{conditional:{method(e,t){r(!this._flags._endedSwitch,"Unreachable condition"),r(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),r(void 0===t.break,"Cannot use break option with alternatives conditional");const n=this.clone(),s=a.when(n,e,t),i=s.is?[s]:s.switch;for(const e of i)if(e.then&&e.otherwise){n.$_setFlag("_endedSwitch",!0,{clone:!1});break}return n.$_terms.matches.push(s),n.$_mutateRebuild()}},match:{method(e){if(r(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)r(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(...e){r(e.length,"Missing alternative schemas"),o.verifyFlat(e,"try"),r(!this._flags._endedSwitch,"Unreachable condition");const t=this.clone();for(const n of e)t.$_terms.matches.push({schema:t.$_compile(n)});return t.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,n)=>"is"!==n.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const n of t.matches){const{schema:t,ref:r,is:s,not:i,then:o,otherwise:a}=n;e=t?e.try(t):r?e.conditional(r,{is:s,then:o,not:i,otherwise:a,switch:n.switch}):e.conditional(s,{then:o,otherwise:a})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:n}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const r=new Set,s=[];for(const{reports:i,schema:o}of e){if(i.length>1)return u.unmatched(e,t);const a=i[0];if(a instanceof c.Report==0)return u.unmatched(e,t);if(a.state.path.length!==n.path.length){s.push({type:o.type,report:a});continue}if("any.only"===a.code){for(const e of a.local.valids)r.add(e);continue}const[l,d]=a.code.split(".");"base"!==d?s.push({type:o.type,report:a}):"object.base"===a.code?r.add(a.local.type):r.add(l)}return s.length?1===s.length?{errors:s[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...r]})}},u.unmatched=function(e,t){const n=[];for(const t of e)n.push(...t.reports);return{errors:t("alternatives.match",c.details(n,{override:!1}))}}},8068:(e,t,n)=>{const r=n(375),s=n(7629),i=n(8160),o=n(6914);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:n}){try{return n(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){r(i.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return r(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:n,local:r})=>t.error(n,r),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=o.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const n in t){const r=t[n];if(["examples","externals","metas","notes","tags"].includes(n))for(const t of r)e=e[n.slice(0,-1)](t);else if("alterations"!==n)if("whens"!==n){if("shared"===n)for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:n,is:r,not:s,then:i,otherwise:o,concat:a}=t;e=a?e.concat(a):n?e.when(n,{is:r,not:s,then:i,otherwise:o,switch:t.switch,break:t.break}):e.when(r,{then:i,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:n}of r)t[e]=n;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,n)=>{const r=n(375),s=n(9474),i=n(9621),o=n(8068),a=n(8160),c=n(3292),l={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:n,prefs:r}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,n,r):void 0}},validate(e,{schema:t,error:n}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[a.symbols.arraySingle]=!0,{value:t}}return{errors:n("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:n,error:r},{schema:s}){const i=[e,...t.ancestors];for(let r=0;r<e.length;++r){const o=t.localize([...t.path,r],i,s);if(s.$_match(e[r],o,n))return e}const o=s._flags.label;return o?r("array.hasKnown",{patternLabel:o}):r("array.hasUnknown",null)},multi:!0},items:{method(...e){a.verifyFlat(e,"items");const t=this.$_addRule("items");for(let n=0;n<e.length;++n){const r=a.tryWithPath(()=>this.$_compile(e[n]),n,{append:!0});t.$_terms.items.push(r)}return t.$_mutateRebuild()},validate(e,{schema:t,error:n,state:r,prefs:s,errorsArray:i}){const o=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...o],d=!e[a.symbols.arraySingle];delete e[a.symbols.arraySingle];const p=i();let f=e.length;for(let i=0;i<f;++i){const a=e[i];let h=!1,m=!1;const g=d?i:new Number(i),y=[...r.path,g];if(!t._flags.sparse&&void 0===a){if(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly)return p;c.shift();continue}const v=[e,...r.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(a,r.localize(y,v,e),s,{presence:"ignore"})){if(p.push(n("array.excludes",{pos:i,value:a},r.localize(y))),s.abortEarly)return p;h=!0,c.shift();break}if(h)continue;if(t.$_terms.ordered.length){if(c.length){const o=c.shift(),u=o.$_validate(a,r.localize(y,v,o),s);if(u.errors){if(p.push(...u.errors),s.abortEarly)return p}else if("strip"===o._flags.result)l.fastSplice(e,i),--i,--f;else{if(!t._flags.sparse&&void 0===u.value){if(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly)return p;continue}e[i]=u.value}continue}if(!t.$_terms.items.length){if(p.push(n("array.orderedLength",{pos:i,limit:t.$_terms.ordered.length})),s.abortEarly)return p;break}}const w=[];let _=o.length;for(let c=0;c<_;++c){const u=r.localize(y,v,o[c]);u.snapshot();const d=o[c].$_validate(a,u,s);if(w[c]=d,!d.errors){if(u.commit(),e[i]=d.value,m=!0,l.fastSplice(o,c),--c,--_,!t._flags.sparse&&void 0===d.value&&(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly))return p;break}u.restore()}if(m)continue;const R=s.stripUnknown&&!!s.stripUnknown.arrays||!1;_=u.length;for(const c of u){let u;const d=o.indexOf(c);if(-1!==d)u=w[d];else{const o=r.localize(y,v,c);if(o.snapshot(),u=c.$_validate(a,o,s),!u.errors){o.commit(),"strip"===c._flags.result?(l.fastSplice(e,i),--i,--f):t._flags.sparse||void 0!==u.value?e[i]=u.value:(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),h=!0),m=!0;break}o.restore()}if(1===_){if(R){l.fastSplice(e,i),--i,--f,m=!0;break}if(p.push(...u.errors),s.abortEarly)return p;h=!0;break}}if(!h&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m){if(R){l.fastSplice(e,i),--i,--f;continue}if(p.push(n("array.includes",{pos:i,value:a},r.localize(y))),s.abortEarly)return p}}return o.length&&l.fillMissedErrors(t,p,o,e,r,s),c.length&&(l.fillOrderedErrors(t,p,c,e,r,s),p.length||l.fillDefault(c,e,r,s)),p.length?p:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:r,operator:s,args:i})=>a.compare(e.length,n,s)?e:t.error("array."+r,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){a.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let n=0;n<e.length;++n){const r=a.tryWithPath(()=>this.$_compile(e[n]),n,{append:!0});l.validateSingle(r,t),t.$_mutateRegister(r),t.$_terms.ordered.push(r)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return r(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){a.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),r(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:n,prefs:r,schema:s},{options:i}){const{value:o,errors:a}=l.sort(s,e,i,n,r);if(a)return a;for(let n=0;n<e.length;++n)if(e[n]!==o[n])return t("array.sort",{order:i.order,by:i.by?i.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e,t={}){r(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),a.assertOptions(t,["ignoreUndefined","separator"]);const n={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const r=a.default(t.separator,".");n.path=r?e.split(r):[e]}else n.comparator=e;return this.$_addRule(n)},validate(e,{state:t,error:n,schema:o},{comparator:a,options:c},{comparator:l,path:u}){const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},p=l||s,f=c.ignoreUndefined;for(let s=0;s<e.length;++s){const o=u?i(e[s],u):e[s],c=l?d.custom:d[typeof o];if(r(c,"Failed to find unique map container for type",typeof o),c instanceof Map){const r=c.entries();let i;for(;!(i=r.next()).done;)if(p(i.value[0],o)){const r=t.localize([...t.path,s],[e,...t.ancestors]),o={pos:s,value:e[s],dupePos:i.value[1],dupeValue:e[i.value[1]]};return u&&(o.path=a),n("array.unique",o,r)}c.set(o,s)}else{if((!f||void 0!==o)&&void 0!==c[o]){const r={pos:s,value:e[s],dupePos:c[o],dupeValue:e[c[o]]};return u&&(r.path=a),n("array.unique",r,t.localize([...t.path,s],[e,...t.ancestors]))}c[o]=s}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,n,r,s,i){const o=[];let a=0;for(const e of n){const t=e._flags.label;t?o.push(t):++a}o.length?a?t.push(e.$_createError("array.includesRequiredBoth",r,{knownMisses:o,unknownMisses:a},s,i)):t.push(e.$_createError("array.includesRequiredKnowns",r,{knownMisses:o},s,i)):t.push(e.$_createError("array.includesRequiredUnknowns",r,{unknownMisses:a},s,i))},l.fillOrderedErrors=function(e,t,n,r,s,i){const o=[];for(const e of n)"required"===e._flags.presence&&o.push(e);o.length&&l.fillMissedErrors(e,t,o,r,s,i)},l.fillDefault=function(e,t,n,r){const s=[];let i=!0;for(let o=e.length-1;o>=0;--o){const a=e[o],c=[t,...n.ancestors],l=a.$_validate(void 0,n.localize(n.path,c,a),r).value;if(i){if(void 0===l)continue;i=!1}s.unshift(l)}s.length&&t.push(...s)},l.fastSplice=function(e,t){let n=t;for(;n<e.length;)e[n++]=e[n];--e.length},l.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(r(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},l.sort=function(e,t,n,r,s){const i="ascending"===n.order?1:-1,o=-1*i,a=i,c=(c,u)=>{let d=l.compare(c,u,o,a);if(null!==d||(n.by&&(c=n.by.resolve(c,r,s),u=n.by.resolve(u,r,s)),d=l.compare(c,u,o,a),null!==d))return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,r,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},r,s);return"number"===p?(c-u)*i:c<u?o:a};try{return{value:t.slice().sort(c)}}catch(e){return{errors:e}}},l.compare=function(e,t,n,r){return e===t?0:void 0===e?1:void 0===t?-1:null===e?r:null===t?n:null}},4937:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(2036),a={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const n=t._flags.sensitive?e:e.toLowerCase();e="true"===n||"false"!==n&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){i.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new o;for(let n=0;n<e.length;++n){const s=e[n];r(void 0!==s,"Cannot call truthy with undefined"),t.$_terms.truthy.add(s)}return t}},falsy:{method(...e){i.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new o;for(let n=0;n<e.length;++n){const s=e[n];r(void 0!==s,"Cannot call falsy with undefined"),t.$_terms.falsy.add(s)}return t}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:a.isBool,to:(e,t)=>e?1:0},string:{from:a.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(3328),a={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:a.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:n,prefs:r}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return r.convert&&s&&"string"==typeof e?{value:e,errors:n("date.format",{format:s})}:{value:e,errors:n("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:n},{name:r,operator:s,args:o}){const a="now"===n?Date.now():n.getTime();return i.compare(e.getTime(),a,s)?e:t.error("date."+r,{limit:o.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:a.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return r(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return r(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:a.isDate,to:(e,t)=>e.getTime()},string:{from:a.isDate,to:(e,{prefs:t})=>o.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),a.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e))||/^\s*$/.test(e))return null;if("iso"===t)return i.isIsoDate(e)?a.date(e.toString()):null;const n=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return a.date(1*e);if("unix"===t)return a.date(1e3*e);if("string"==typeof n)return null}return a.date(e)},a.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,n)=>{const r=n(375),s=n(7824);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return r(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:n})=>e.length===n?e:t.error("function.arity",{n:n})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return r(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:n})=>e.length>=n?e:t.error("function.minArity",{n:n})},maxArity:{method(e){return r(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:n})=>e.length<=n?e:t.error("function.maxArity",{n:n})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,n)=>{const r=n(978),s=n(375),i=n(8571),o=n(3652),a=n(8068),c=n(8160),l=n(3292),u=n(6354),d=n(6133),p=n(3328),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=a.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:n,state:r,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:n("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,s);const i=[];if(t.$_terms.renames&&!f.rename(t,e,r,s,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const o=new Set(Object.keys(e));if(t.$_terms.keys){const n=[e,...r.ancestors];for(const a of t.$_terms.keys){const t=a.key,c=e[t];o.delete(t);const l=r.localize([...r.path,t],n,a),u=a.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),i.push(...u.errors)}else"strip"===a.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(o.size||t._flags._hasPatternMatch){const n=f.unknown(t,e,o,i,r,s);if(n)return n}if(t.$_terms.dependencies)for(const n of t.$_terms.dependencies){if(null!==n.key&&!1===f.isPresent(n.options)(n.key.resolve(e,r,s,null,{shadow:!1})))continue;const o=f.dependencies[n.rel](t,n,e,r,s);if(o){const n=t.$_createError(o.code,e,o.context,r,s);if(s.abortEarly)return{value:e,errors:n};i.push(n)}}return{value:e,errors:i}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,n){p.isTemplate(e)||(e=l.ref(e)),s(void 0===n||"string"==typeof n,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const r=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:n}});return r.$_mutateRegister(e),r.$_mutateRegister(t),r},validate(e,{error:t,prefs:n,state:r},{subject:s,schema:i,message:o}){const a=s.resolve(e,r,n),c=d.isRef(s)?s.absolute(r):[];return i.$_match(a,r.localize(c,[e,...r.ancestors],i),n)?e:t("object.assert",{subject:s,message:o})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:n,name:r})=>e instanceof n?e:t.error("object.instance",{type:r,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter(t=>!e.hasOwnProperty(t.key)):new f.Keys;for(const n in e)c.tryWithPath(()=>t.$_terms.keys.push({key:n,schema:this.$_compile(e[n])}),n)}else t.$_terms.keys=new f.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:r,operator:s,args:i})=>c.compare(Object.keys(e).length,n,s)?e:t.error("object."+r,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,t,n={}){const r=e instanceof RegExp;r||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(n,["fallthrough","matches"]),r&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const o={[r?"regex":"schema"]:e,rule:t};return n.matches&&(o.matches=this.$_compile(n.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),i.$_mutateRegister(o.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),n.fallthrough&&(o.fallthrough=!0),i.$_terms.patterns.push(o),i.$_mutateRegister(t),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,n={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof p,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(n,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const t of i.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&i.$_mutateRegister(t),i.$_terms.renames.push({from:e,to:t,options:r(f.renameDefaults,n)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:n})=>!c.isSchema(e)||"any"!==n&&e.type!==n?t.error("object.schema",{type:n}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,n={}){return f.dependency(this,"with",e,t,n)}},without:{method(e,t,n={}){return f.dependency(this,"without",e,t,n)}},xor:{method(...e){return c.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new o.Sorter;for(const n of e.$_terms.keys)c.tryWithPath(()=>t.add(n,{after:n.schema.$_rootReferences(),group:n.key}),n.key);e.$_terms.keys=new f.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:n,key:r=null,peers:s,options:i}of t.dependencies)e=f.dependency(e,n,r,s,i);if(t.patterns)for(const{regex:n,schema:r,rule:s,fallthrough:i,matches:o}of t.patterns)e=e.pattern(n||r,s,{fallthrough:i,matches:o});if(t.renames)for(const{from:n,to:r,options:s}of t.renames)e=e.rename(n,r,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return i(e,{shallow:!0});const n=Object.create(Object.getPrototypeOf(e));return Object.assign(n,e),n}const n=function(...t){return e.apply(this,t)};return n.prototype=i(e.prototype),Object.defineProperty(n,"name",{value:e.name,writable:!1}),Object.defineProperty(n,"length",{value:e.length,writable:!1}),Object.assign(n,e),n},f.dependency=function(e,t,n,r,i){s(null===n||"string"==typeof n,t,"key must be a strings"),i||(i=r.length>1&&"object"==typeof r[r.length-1]?r.pop():{}),c.assertOptions(i,["separator","isPresent"]),r=[].concat(r);const o=c.default(i.separator,"."),a=[];for(const e of r)s("string"==typeof e,t,"peers must be strings"),a.push(l.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==n&&(n=l.ref(n,{separator:o,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new f.Dependency(t,n,a,r,i)),u},f.dependencies={and(e,t,n,r,s){const i=[],o=[],a=t.peers.length,c=f.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(n,r,s,null,{shadow:!1}))?i.push(e.key):o.push(e.key);if(i.length!==a&&o.length!==a)return{code:"object.and",context:{present:o,presentWithLabels:f.keysToLabels(e,o),missing:i,missingWithLabels:f.keysToLabels(e,i)}}},nand(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(i.length!==t.peers.length)return;const a=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:a,mainWithLabel:f.keysToLabels(e,a),peers:c,peersWithLabels:f.keysToLabels(e,c)}}},or(e,t,n,r,s){const i=f.isPresent(t.options);for(const e of t.peers)if(i(e.resolve(n,r,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(!i.length||1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.oxor",context:a}},with(e,t,n,r,s){const i=f.isPresent(t.options);for(const o of t.peers)if(!1===i(o.resolve(n,r,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},without(e,t,n,r,s){const i=f.isPresent(t.options);for(const o of t.peers)if(i(o.resolve(n,r,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},xor(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===i.length?{code:"object.missing",context:a}:(a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.xor",context:a})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map(t=>e.$_mapLabels(t)):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,n,r,s){const i={};for(const o of e.$_terms.renames){const a=[],c="string"!=typeof o.from;if(c)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined||e===o.to)continue;const n=o.from.exec(e);n&&a.push({from:e,to:o.to,match:n})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||a.push(o);for(const l of a){const a=l.from;let u=l.to;if(u instanceof p&&(u=u.render(t,n,r,l.match)),a!==u){if(!o.options.multiple&&i[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:a,to:u,pattern:c},n,r)),r.abortEarly)||Object.prototype.hasOwnProperty.call(t,u)&&!o.options.override&&!i[u]&&(s.push(e.$_createError("object.rename.override",t,{from:a,to:u,pattern:c},n,r)),r.abortEarly))return!1;void 0===t[a]?delete t[u]:t[u]=t[a],i[u]=!0,o.options.alias||delete t[a]}}}return!0},f.unknown=function(e,t,n,r,s,i){if(e.$_terms.patterns){let o=!1;const a=e.$_terms.patterns.map(e=>{if(e.matches)return o=!0,[]}),c=[t,...s.ancestors];for(const o of n){const l=t[o],u=[...s.path,o];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(o);if(s.mainstay.tracer.debug(s,"rule","pattern.".concat(d),e?"pass":"error"),!e)continue}else if(!p.schema.$_match(o,s.nest(p.schema,"pattern.".concat(d)),i))continue;n.delete(o);const f=s.localize(u,c,{schema:p.rule,key:o}),h=p.rule.$_validate(l,f,i);if(h.errors){if(i.abortEarly)return{value:t,errors:h.errors};r.push(...h.errors)}if(p.matches&&a[d].push(o),t[o]=h.value,!p.fallthrough)break}}if(o)for(let n=0;n<a.length;++n){const o=a[n];if(!o)continue;const l=e.$_terms.patterns[n].matches,d=s.localize(s.path,c,l),p=l.$_validate(o,d,i);if(p.errors){const n=u.details(p.errors,{override:!1});n.matches=o;const a=e.$_createError("object.pattern.match",t,n,s,i);if(i.abortEarly)return{value:t,errors:a};r.push(a)}}}if(n.size&&(e.$_terms.keys||e.$_terms.patterns)){if(i.stripUnknown&&void 0===e._flags.unknown||i.skipFunctions){const e=!(!i.stripUnknown||!0!==i.stripUnknown&&!i.stripUnknown.objects);for(const r of n)e?(delete t[r],n.delete(r)):"function"==typeof t[r]&&n.delete(r)}if(!c.default(e._flags.unknown,i.allowUnknown))for(const o of n){const n=s.localize([...s.path,o],[]),a=e.$_createError("object.unknown",t[o],{child:o},n,i,{flags:!1});if(i.abortEarly)return{value:t,errors:a};r.push(a)}}},f.Dependency=class{constructor(e,t,n,r,s){this.rel=e,this.key=t,this.peers=n,this.paths=r,this.options=s}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options=Me(Ne({},e.options),{separator:this.peers[0].separator})),this.options.isPresent&&(e.options=Me(Ne({},e.options),{isPresent:this.options.isPresent})),e}},f.Keys=class extends Array{concat(e){const t=this.slice(),n=new Map;for(let e=0;e<t.length;++e)n.set(t[e].key,e);for(const r of e){const e=r.key,s=n.get(e);void 0!==s?t[s]={key:e,schema:t[s].schema.concat(r.schema)}:t.push(r)}return t}}},8785:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(3292),a=n(6354),c={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:n,prefs:s}){r(t.$_terms.link,"Uninitialized link schema");const i=c.generate(t,e,n,s),o=t.$_terms.link[0].ref;return i.$_validate(e,n.nest(i,"link:".concat(o.display,":").concat(i.type)),s)},generate:(e,t,n,r)=>c.generate(e,t,n,r),rules:{ref:{method(e){r(!this.$_terms.link,"Cannot reinitialize schema"),e=o.ref(e),r("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),r("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){r(this.$_terms.link,"Uninitialized link schema"),r(i.isSchema(e),"Invalid schema object"),r("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(r(t.link,"Invalid link description missing link"),e.ref(t.link))}}),c.generate=function(e,t,n,r){let s=n.mainstay.links.get(e);if(s)return s._generate(t,n,r).schema;const i=e.$_terms.link[0].ref,{perspective:o,path:a}=c.perspective(i,n);c.assert(o,"which is outside of schema boundaries",i,e,n,r);try{s=a.length?o.$_reach(a):o}catch(t){c.assert(!1,"to non-existing schema",i,e,n,r)}return c.assert("link"!==s.type,"which is another link",i,e,n,r),e._flags.relative||n.mainstay.links.set(e,s),s._generate(t,n,r).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:n,key:r}of t.schemas){if((n._flags.id||r)===e.path[0])return{perspective:n,path:e.path.slice(1)};if(n.$_terms.shared)for(const t of n.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,n,s,i,o){e||r(!1,'"'.concat(a.label(s._flags,i,o),'" contains link reference "').concat(n.display,'" ').concat(t))}},3832:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),n=t.indexOf("."),r=t.indexOf("e");return(n<0?0:(r<0?t.length:r)-n-1)+(r<0?0:Math.max(0,-parseInt(t.slice(r+1))))}};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:n}){if(!e.match(o.numberRx))return;e=e.trim();const r={value:parseFloat(e)};if(0===r.value&&(r.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(o.extractSignificantDigits(e)!==o.extractSignificantDigits(String(r.value)))return r.errors=n("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==o.normalizeDecimal(e))return r.errors=n("number.unsafe"),r}return r}},validate(e,{schema:t,error:n,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:n("number.infinity")};if(!i.isNumber(e))return{value:e,errors:n("number.base")};const s={value:e};if(r.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(s.errors=n("number.unsafe")),s},rules:{compare:{method:!1,validate:(e,t,{limit:n},{name:r,operator:s,args:o})=>i.compare(e,n,s)?e:t.error("number."+r,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?o.decimalPlaces(e):null,n=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:n}})},validate:(e,t,{base:n,baseDecimalPlace:r,pfactor:s},i)=>o.decimalPlaces(e)>r?t.error("number.multiple",{multiple:i.args.base,value:e}):Math.round(s*e)%Math.round(s*n)==0?e:t.error("number.multiple",{multiple:i.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return r(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:n}){const r=e.toString().match(o.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=n?e:t.error("number.precision",{limit:n,value:e})},convert:!0},sign:{method(e){return r(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:n})=>"negative"===n&&e<0||"positive"===n&&e>0?e:t.error("number.".concat(n))},unsafe:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,n)=>{const r=n(7824);e.exports=r.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,n)=>{const r=n(375),s=n(5380),i=n(1745),o=n(9959),a=n(6064),c=n(9926),l=n(5752),u=n(8068),d=n(8160),p={tlds:c instanceof Set&&{tlds:{allow:c,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:n,prefs:r}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const n of t.$_terms.replacements)e=e.replace(n.pattern,n.replacement);const a=t.$_getRule("hex");if(a&&a.args.options.byteAligned&&e.length%2!=0&&(e="0".concat(e)),t.$_getRule("isoDate")){const t=p.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let i=s.args.limit;if(d.isResolvable(i)&&(i=i.resolve(e,n,r),!d.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},n,r)};e=e.slice(0,i)}}return{value:e}}},validate(e,{schema:t,error:n}){if("string"!=typeof e)return{value:e,errors:n("string.base")};if(""===e){const r=t.$_getRule("min");return r&&0===r.args.limit?void 0:{value:e,errors:n("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return d.assertOptions(e,["paddingRequired","urlSafe"]),e=Ne({urlSafe:!1,paddingRequired:!0},e),r("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),r("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:n})=>p.base64Regex[n.paddingRequired][n.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return r(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:n})=>"lower"===n&&e===e.toLocaleLowerCase()||"upper"===n&&e===e.toLocaleUpperCase()?e:t.error("string.".concat(n,"case")),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let n=e.length,r=0,s=1;for(;n--;){const t=e.charAt(n)*s;r+=t-9*(t>9),s^=3}return r>0&&r%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return d.assertOptions(e,["paddingRequired"]),e=Ne({paddingRequired:!0},e),r("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:n}){const r=e.match(p.dataUriRegex);return!r||r[2]&&"base64"===r[2]&&!p.base64Regex[n.paddingRequired].false.test(r[3])?t.error("string.dataUri"):e}},domain:{method(e){e&&d.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=p.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,n,{address:r})=>s.isValid(e,r)?e:t.error("string.domain")},email:{method(e={}){d.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),r(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=p.addressOptions(e),n=new RegExp("\\s*[".concat(e.separator?a(e.separator):",","]\\s*"));return this.$_addRule({name:"email",args:{options:e},regex:n,address:t})},validate(e,t,{options:n},{regex:r,address:s}){const o=n.multiple?e.split(r):[e],a=[];for(const e of o)i.isValid(e,s)||a.push(e);return a.length?t.error("string.email",{value:e,invalids:a}):e}},guid:{alias:"uuid",method(e={}){d.assertOptions(e,["version","separator"]);let t="";if(e.version){const n=[].concat(e.version);r(n.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;e<n.length;++e){const i=n[e];r("string"==typeof i,"version at position "+e+" must be a string");const o=p.guidVersions[i.toLowerCase()];r(o,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),r(!s.has(o),"version at position "+e+" must not be a duplicate"),t+=o,s.add(o)}}r(p.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const n=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":"\\".concat(e.separator),s=new RegExp("^([\\[{\\(]?)[0-9A-F]{8}(".concat(n,")[0-9A-F]{4}\\2?[").concat(t||"0-9A-F","][0-9A-F]{3}\\2?[").concat(t?"89AB":"0-9A-F","][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$"),"i");return this.$_addRule({name:"guid",args:{options:e},regex:s})},validate(e,t,n,{regex:r}){const s=r.exec(e);return s?p.guidBrackets[s[1]]!==s[s.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(e={}){return d.assertOptions(e,["byteAligned","prefix"]),e=Ne({byteAligned:!1,prefix:!1},e),r("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),r("boolean"==typeof e.prefix||"optional"===e.prefix,'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:e}})},validate:(e,t,{options:n})=>("optional"===n.prefix?p.hexRegex.withOptionalPrefix:!0===n.prefix?p.hexRegex.withPrefix:p.hexRegex.withoutPrefix).test(e)?n.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>s.isValid(e,{minDomainSegments:1})||p.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){d.assertOptions(e,["cidr","version"]);const{cidr:t,versions:n,regex:r}=o.regex(e),s=e.version?n:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:r})},validate:(e,t,{options:n},{regex:r})=>r.test(e)?e:n.version?t.error("string.ipVersion",{value:e,cidr:n.cidr,version:n.version}):t.error("string.ip",{value:e,cidr:n.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>p.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>p.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return p.length(this,"length",e,"=",t)},validate(e,t,{limit:n,encoding:r},{name:s,operator:i,args:o}){const a=!r&&e.length;return d.compare(a,n,i)?e:t.error("string."+s,{limit:o.limit,value:e,encoding:r})},args:[{name:"limit",ref:!0,assert:d.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return p.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return p.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return r(p.normalizationForms.includes(e),"normalization form must be one of "+p.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:n})=>e===e.normalize(n)?e:t("string.normalize",{value:e,form:n}),convert:!0},pattern:{alias:"regex",method(e,t={}){r(e instanceof RegExp,"regex must be a RegExp"),r(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),d.assertOptions(t,["invert","name"]);const n=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:n})},validate:(e,t,{regex:n,options:r},{errorCode:s})=>n.test(e)^r.invert?e:t.error(s,{name:r.name,regex:n,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(a(e),"g")),r(e instanceof RegExp,"pattern must be a RegExp"),r("string"==typeof t,"replacement must be a String");const n=this.clone();return n.$_terms.replacements||(n.$_terms.replacements=[]),n.$_terms.replacements.push({pattern:e,replacement:t}),n}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:n})=>n&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){d.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),e.domain&&d.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:n}=l.regex(e),r=e.domain?p.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:r,scheme:n})},validate(e,t,{options:n},{regex:r,domain:i,scheme:o}){if(["http:/","https:/"].includes(e))return t.error("string.uri");let a=r.exec(e);if(!a&&t.prefs.convert&&n.encodeUri){const t=encodeURI(e);a=r.exec(t),a&&(e=t)}if(a){const r=a[1]||a[2];return!i||n.allowRelative&&!r||s.isValid(r,i)?e:t.error("string.domain",{value:r})}return n.relativeOnly?t.error("string.uriRelativeOnly"):n.scheme?t.error("string.uriCustomScheme",{scheme:o,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:n,replacement:r}of t.replacements)e=e.replace(n,r);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),p.addressOptions=function(e){if(!e)return p.tlds||e;if(r(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),r(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return r(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.tlds);r("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),r(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),r(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),p.validateTlds(e.tlds.deny,"tlds.deny"),e;const n=e.tlds.allow;return n?!0===n?(r(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.tlds)):(Array.isArray(n)&&(e=Object.assign({},e,{tlds:{allow:new Set(n)}})),r(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),p.validateTlds(e.tlds.allow,"tlds.allow"),e):e},p.validateTlds=function(e,t){for(const n of e)r(s.isValid(n,{minDomainSegments:1,maxDomainSegments:1}),"".concat(t," must contain valid top level domain names"))},p.isoDate=function(e){if(!d.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},p.length=function(e,t,n,s,i){return r(!i||!1,"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:n,encoding:i},operator:s})}},8826:(e,t,n)=>{const r=n(375),s=n(8068),i={};i.Map=class extends Map{slice(){return new i.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new i.Map}},coerce:{method(e,{schema:t,error:n}){const r=t.$_terms.map.get(e);return r&&(e=r),t._flags.only&&"symbol"!=typeof e?{value:e,errors:n("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),r(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),n=[];for(const s of e){r(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,i]=s;r("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),r("symbol"==typeof i,"Value must be a Symbol"),t.$_terms.map.set(e,i),n.push(i)}return t.valid(...n)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,n)=>{const r=n(375),s=n(8571),i=n(738),o=n(9621),a=n(8160),c=n(6354),l=n(493),u={result:Symbol("result")};t.entry=function(e,t,n){let s=a.defaults;n&&(r(void 0===n.warnings,"Cannot override warnings preference in synchronous validation"),r(void 0===n.artifacts,"Cannot override artifacts preference in synchronous validation"),s=a.preferences(a.defaults,n));const i=u.entry(e,t,s);r(!i.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:i.value};return i.error&&(o.error=i.error),i.mainstay.warnings.length&&(o.warning=c.details(i.mainstay.warnings)),i.mainstay.debug&&(o.debug=i.mainstay.debug),i.mainstay.artifacts&&(o.artifacts=i.mainstay.artifacts),o},t.entryAsync=async function(e,t,n){let r=a.defaults;n&&(r=a.preferences(a.defaults,n));const s=u.entry(e,t,r),i=s.mainstay;if(s.error)throw i.debug&&(s.error.debug=i.debug),s.error;if(i.externals.length){let t=s.value;const l=[];for(const s of i.externals){const d=s.state.path,p="link"===s.schema.type?i.links.get(s.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?o(e,d):e;if(d.length){f=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);h=g[0],m=h[f]}try{const e=(e,t)=>(p||s.schema).$_createError(e,m,t,s.state,r),o=await s.method(m,{schema:s.schema,linked:p,state:s.state,prefs:n,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>i.warnings.push((p||s.schema).$_createError(e,m,t,s.state,r)),message:(e,t)=>(p||s.schema).$_createError("external",m,t,s.state,r,{messages:e})});if(void 0===o||o===m)continue;if(o instanceof c.Report){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(o),r.abortEarly)break;continue}if(Array.isArray(o)&&o[a.symbols.errors]){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(...o),r.abortEarly)break;continue}h?(i.tracer.value(s.state,"rule",m,o,"external"),h[f]=o):(i.tracer.value(s.state,"rule",t,o,"external"),t=o)}catch(e){throw r.errors.label&&(e.message+=" (".concat(s.label,")")),e}}if(s.value=t,l.length)throw s.error=c.process(l,e,r),i.debug&&(s.error.debug=i.debug),s.error}if(!r.warnings&&!r.debug&&!r.artifacts)return s.value;const l={value:s.value};return i.warnings.length&&(l.warning=c.details(i.warnings)),i.debug&&(l.debug=i.debug),i.artifacts&&(l.artifacts=i.artifacts),l},u.Mainstay=class{constructor(e,t,n){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=n,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,n,r){const{tracer:s,cleanup:i}=u.tracer(n,r),o=r.debug?[]:null,a=n._ids._schemaChain?new Map:null,d=new u.Mainstay(s,o,a),p=n._ids._schemaChain?[{schema:n}]:null,f=new l([],[],{mainstay:d,schemas:p}),h=t.validate(e,n,f,r);i&&n.$_root.untrace();const m=c.process(h.errors,e,r);return{value:h.value,error:m,mainstay:d}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(r(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,n,r,s={}){if(t.$_terms.whens&&(t=t._generate(e,n,r).schema),t._preferences&&(r=u.prefs(t,r)),t._cache&&r.cache){const r=t._cache.get(e);if(n.mainstay.tracer.debug(n,"validate","cached",!!r),r)return r}const i=(s,i,o)=>t.$_createError(s,e,i,o||n,r),o={original:e,prefs:r,schema:t,state:n,error:i,errorsArray:u.errorsArray,warn:(e,t,r)=>n.mainstay.warnings.push(i(e,t,r)),message:(s,i)=>t.$_createError("custom",e,i,n,r,{messages:s})};n.mainstay.tracer.entry(t,n);const c=t._definition;if(c.prepare&&void 0!==e&&r.convert){const t=c.prepare(e,o);if(t){if(n.mainstay.tracer.value(n,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(c.coerce&&void 0!==e&&r.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,o);if(t){if(n.mainstay.tracer.value(n,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}const l=t._flags.empty;l&&l.$_match(u.trim(e,t),n.nest(l),a.defaults)&&(n.mainstay.tracer.value(n,"empty",e,void 0),e=void 0);const d=s.presence||t._flags.presence||(t._flags._endedSwitch?null:r.presence);if(void 0===e){if("forbidden"===d)return u.finalize(e,null,o);if("required"===d)return u.finalize(e,[t.$_createError("any.required",e,null,n,r)],o);if("optional"===d){if(t._flags.default!==a.symbols.deepDefault)return u.finalize(e,null,o);n.mainstay.tracer.value(n,"default",e,{}),e={}}}else if("forbidden"===d)return u.finalize(e,[t.$_createError("any.unknown",e,null,n,r)],o);const p=[];if(t._valids){const s=t._valids.get(e,n,r,t._flags.insensitive);if(s)return r.convert&&(n.mainstay.tracer.value(n,"valids",e,s.value),e=s.value),n.mainstay.tracer.filter(t,n,"valid",s),u.finalize(e,null,o);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},n,r);if(r.abortEarly)return u.finalize(e,[s],o);p.push(s)}}if(t._invalids){const s=t._invalids.get(e,n,r,t._flags.insensitive);if(s){n.mainstay.tracer.filter(t,n,"invalid",s);const i=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},n,r);if(r.abortEarly)return u.finalize(e,[i],o);p.push(i)}}if(c.validate){const t=c.validate(e,o);if(t&&(n.mainstay.tracer.value(n,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),u.finalize(e,p,o);if(t.errors.length)return p.push(...t.errors),u.finalize(e,p,o)}}return t._rules.length?u.rules(e,p,o):u.finalize(e,p,o)},u.rules=function(e,t,n){const{schema:r,state:s,prefs:i}=n;for(const o of r._rules){const c=r._definition.rules[o.method];if(c.convert&&i.convert){s.mainstay.tracer.log(r,s,"rule",o.name,"full");continue}let l,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const n=c.argsByName.get(t),o=d[t].resolve(e,s,i),u=n.normalize?n.normalize(o):o,p=a.validateArg(u,null,n);if(p){l=r.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},s,i);break}d[t]=u}}l=l||c.validate(e,n,d,o);const p=u.rule(l,o);if(p.errors){if(s.mainstay.tracer.log(r,s,"rule",o.name,"error"),o.warn){s.mainstay.warnings.push(...p.errors);continue}if(i.abortEarly)return u.finalize(e,p.errors,n);t.push(...p.errors)}else s.mainstay.tracer.log(r,s,"rule",o.name,"pass"),s.mainstay.tracer.value(s,"rule",e,p.value,o.name),e=p.value}return u.finalize(e,t,n)},u.rule=function(e,t){return e instanceof c.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[a.symbols.errors]?(e.forEach(e=>u.error(e,t)),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,n){t=t||[];const{schema:s,state:i,prefs:o}=n;if(t.length){const r=u.default("failover",void 0,t,n);void 0!==r&&(i.mainstay.tracer.value(i,"failover",e,r),e=r,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)r(e instanceof Error||e instanceof c.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const r=u.default("default",e,t,n);i.mainstay.tracer.value(i,"default",e,r),e=r}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const r=t.to(e,n);i.mainstay.tracer.value(i,"cast",e,r,s._flags.cast),e=r}}if(s.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of s.$_terms.externals)i.mainstay.externals.push({method:e,schema:s,state:i,label:c.label(s._flags,i,o)});const a={value:e,errors:t.length?t:null};return s._flags.result&&(a.value="strip"===s._flags.result?void 0:n.original,i.mainstay.tracer.value(i,s._flags.result,e,a.value),i.shadow(e,s._flags.result)),s._cache&&!1!==o.cache&&!s._refs.length&&s._cache.set(n.original,a),void 0===e||a.errors||void 0===s._flags.artifact||(i.mainstay.artifacts=i.mainstay.artifacts||new Map,i.mainstay.artifacts.has(s._flags.artifact)||i.mainstay.artifacts.set(s._flags.artifact,[]),i.mainstay.artifacts.get(s._flags.artifact).push(i.path)),a},u.prefs=function(e,t){const n=t===a.defaults;return n&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),n&&(e._preferences[a.symbols.prefs]=t),t)},u.default=function(e,t,n,r){const{schema:i,state:o,prefs:c}=r,l=i._flags[e];if(c.noDefaults||void 0===l)return t;if(o.mainstay.tracer.log(i,o,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[s(o.ancestors[0]),r]:[];try{return l(...t)}catch(t){return void n.push(i.$_createError("any.".concat(e),null,{error:t},o,c))}}return"object"!=typeof l?l:l[a.symbols.literal]?l.literal:a.isResolvable(l)?l.resolve(t,o,c):s(l)},u.trim=function(e,t){if("string"!=typeof e)return e;const n=t.$_getRule("trim");return n&&n.args.enabled?e.trim():e},u.ignore={active:!1,debug:i,entry:i,filter:i,log:i,resolve:i,value:i},u.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}},2036:(e,t,n)=>{const r=n(375),s=n(9474),i=n(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){i.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,n){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const n of[...t._values,...t._refs])e.add(n)}if(n)for(const t of[...n._values,...n._refs])e.remove(t);return e.length?e:null}remove(e){i.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,n,r){return!!this.get(e,t,n,r)}get(e,t,n,r){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&r){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const i of this._refs){const o=i.resolve(e,t,n,null,{in:!0});if(void 0===o)continue;const a=i.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];for(const t of a)if(typeof t==typeof e)if(r&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:i}}else if(s(t,e))return{value:t,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){r(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[i.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const n of e)"string"==typeof n&&t.set(n.toLowerCase(),n);return t}},978:(e,t,n)=>{const r=n(375),s=n(8571),i=n(1687),o=n(9621),a={};e.exports=function(e,t,n={}){if(r(e&&"object"==typeof e,"Invalid defaults value: must be an object"),r(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),r("object"==typeof n,"Invalid options: must be an object"),!t)return null;if(n.shallow)return a.applyToDefaultsWithShallow(e,t,n);const o=s(e);if(!0===t)return o;const c=void 0!==n.nullOverride&&n.nullOverride;return i(o,t,{nullOverride:c,mergeArrays:!1})},a.applyToDefaultsWithShallow=function(e,t,n){const c=n.shallow;r(Array.isArray(c),"Invalid keys");const l=new Map,u=!0===t?null:new Set;for(let n of c){n=Array.isArray(n)?n:n.split(".");const r=o(e,n);r&&"object"==typeof r?l.set(r,u&&o(t,n)||r):u&&u.add(n)}const d=s(e,{},l);if(!u)return d;for(const e of u)a.reachCopy(d,t,e);const p=void 0!==n.nullOverride&&n.nullOverride;return i(d,t,{nullOverride:p,mergeArrays:!1})},a.reachCopy=function(e,t,n){for(const e of n){if(!(e in t))return;const n=t[e];if("object"!=typeof n||null===n)return;t=n}const r=t;let s=e;for(let e=0;e<n.length-1;++e){const t=n[e];"object"!=typeof s[t]&&(s[t]={}),s=s[t]}s[n[n.length-1]]=r}},375:(e,t,n)=>{const r=n(7916);e.exports=function(e,...t){if(!e)throw 1===t.length&&t[0]instanceof Error?t[0]:new r(t)}},8571:(e,t,n)=>{const r=n(9621),s=n(4277),i=n(7043),o={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=o.clone=function(e,t={},n=null){if("object"!=typeof e||null===e)return e;let r=o.clone,a=n;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);r=e=>e}else if(a){const t=a.get(e);if(t)return t}else a=new Map;const c=s.getInternalProto(e);if(c===s.buffer)return!1;if(c===s.date)return new Date(e.getTime());if(c===s.regex)return new RegExp(e);const l=o.base(e,c,t);if(l===e)return e;if(a&&a.set(e,l),c===s.set)for(const n of e)l.add(r(n,t,a));else if(c===s.map)for(const[n,s]of e)l.set(n,r(s,t,a));const u=i.keys(e,t);for(const n of u){if("__proto__"===n)continue;if(c===s.array&&"length"===n){l.length=e.length;continue}const i=Object.getOwnPropertyDescriptor(e,n);i?i.get||i.set?Object.defineProperty(l,n,i):i.enumerable?l[n]=r(e[n],t,a):Object.defineProperty(l,n,{enumerable:!1,writable:!0,configurable:!0,value:r(e[n],t,a)}):Object.defineProperty(l,n,{enumerable:!0,writable:!0,configurable:!0,value:r(e[n],t,a)})}return l},o.cloneWithShallow=function(e,t){const n=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of n){const n=r(e,t);"object"!=typeof n&&"function"!=typeof n||s.set(n,n)}return o.clone(e,t,s)},o.base=function(e,t,n){if(!1===n.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===s.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(t===s.array){const e=[];return r!==t&&Object.setPrototypeOf(e,r),e}if(o.needsProtoHack.has(t)){const e=new r.constructor;return r!==t&&Object.setPrototypeOf(e,r),e}return Object.create(r)}},9474:(e,t,n)=>{const r=n(4277),s={mismatched:null};e.exports=function(e,t,n){return n=Object.assign({prototype:!0},n),!!s.isDeepEqual(e,t,n,[])},s.isDeepEqual=function(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t||null===e||null===t)return!1;if("function"===o){if(!n.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const a=s.getSharedType(e,t,!!n.prototype);switch(a){case r.buffer:return!1;case r.promise:return e===t;case r.regex:return e.toString()===t.toString();case s.mismatched:return!1}for(let n=i.length-1;n>=0;--n)if(i[n].isSame(e,t))return!0;i.push(new s.SeenEntry(e,t));try{return!!s.isDeepEqualObj(a,e,t,n,i)}finally{i.pop()}},s.getSharedType=function(e,t,n){if(n)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?s.mismatched:r.getInternalProto(e);const i=r.getInternalProto(e);return i!==r.getInternalProto(t)?s.mismatched:i},s.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},s.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},s.isSetSimpleEqual=function(e,t){for(const n of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,n))return!1;return!0},s.isDeepEqualObj=function(e,t,n,i,o){const{isDeepEqual:a,valueOf:c,hasOwnEnumerableProperty:l}=s,{keys:u,getOwnPropertySymbols:d}=Object;if(e===r.array){if(!i.part){if(t.length!==n.length)return!1;for(let e=0;e<t.length;++e)if(!a(t[e],n[e],i,o))return!1;return!0}for(const e of t)for(const t of n)if(a(e,t,i,o))return!0}else if(e===r.set){if(t.size!==n.size)return!1;if(!s.isSetSimpleEqual(t,n)){const e=new Set(Set.prototype.values.call(n));for(const n of Set.prototype.values.call(t)){if(e.delete(n))continue;let t=!1;for(const r of e)if(a(n,r,i,o)){e.delete(r),t=!0;break}if(!t)return!1}}}else if(e===r.map){if(t.size!==n.size)return!1;for(const[e,r]of Map.prototype.entries.call(t))if(void 0===r&&!Map.prototype.has.call(n,e)||!a(r,Map.prototype.get.call(n,e),i,o))return!1}else if(e===r.error&&(t.name!==n.name||t.message!==n.message))return!1;const p=c(t),f=c(n);if((t!==p||n!==f)&&!a(p,f,i,o))return!1;const h=u(t);if(!i.part&&h.length!==u(n).length&&!i.skip)return!1;let m=0;for(const e of h)if(i.skip&&i.skip.includes(e))void 0===n[e]&&++m;else if(!l(n,e)||!a(t[e],n[e],i,o))return!1;if(!i.part&&h.length-m!==u(n).length)return!1;if(!1!==i.symbols){const e=d(t),r=new Set(d(n));for(const s of e){if(!i.skip||!i.skip.includes(s))if(l(t,s)){if(!l(n,s)||!a(t[s],n[s],i,o))return!1}else if(l(n,s))return!1;r.delete(s)}for(const e of r)if(l(n,e))return!1}return!0},s.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,n)=>{const r=n(8761);e.exports=class extends Error{constructor(e){super(e.filter(e=>""!==e).map(e=>"string"==typeof e?e:e instanceof Error?e.message:r(e)).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{const t={};e.exports=function(e){if(!e)return"";let n="";for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);t.isSafe(s)?n+=e[r]:n+=t.escapeHtmlChar(s)}return n},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":"&#x".concat(e.toString(16).padStart(2,"0"),";"))},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{e.exports=function(){}},1687:(e,t,n)=>{const r=n(375),s=n(8571),i=n(7043),o={};e.exports=o.merge=function(e,t,n){if(r(e&&"object"==typeof e,"Invalid target value: must be an object"),r(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(n=Object.assign({nullOverride:!0,mergeArrays:!0},n),Array.isArray(t)){r(Array.isArray(e),"Cannot merge array onto an object"),n.mergeArrays||(e.length=0);for(let r=0;r<t.length;++r)e.push(s(t[r],{symbols:n.symbols}));return e}const a=i.keys(t,n);for(let r=0;r<a.length;++r){const i=a[r];if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(t,i))continue;const c=t[i];if(c&&"object"==typeof c){if(e[i]===c)continue;!e[i]||"object"!=typeof e[i]||Array.isArray(e[i])!==Array.isArray(c)||c instanceof Date||c instanceof RegExp?e[i]=s(c,{symbols:n.symbols}):o.merge(e[i],c,n)}else(null!=c||n.nullOverride)&&(e[i]=c)}return e}},9621:(e,t,n)=>{const r=n(375),s={};e.exports=function(e,t,n){if(!1===t||null==t)return e;"string"==typeof(n=n||{})&&(n={separator:n});const i=Array.isArray(t);r(!i||!n.separator,"Separator option is not valid for array-based chain");const o=i?t:t.split(n.separator||".");let a=e;for(let e=0;e<o.length;++e){let i=o[e];const c=n.iterables&&s.iterables(a);if(Array.isArray(a)||"set"===c){const e=Number(i);Number.isInteger(e)&&(i=e<0?a.length+e:e)}if(!a||"function"==typeof a&&!1===n.functions||!c&&void 0===a[i]){r(!n.strict||e+1===o.length,"Missing segment",i,"in reach path ",t),r("object"==typeof a||!0===n.functions||"function"!=typeof a,"Invalid segment",i,"in reach path ",t),a=n.default;break}a=c?"set"===c?[...a][i]:a.get(i):a[i]}return a},s.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{const n={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},n.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const r=Object.prototype.toString.call(e);return n.typeMap.get(r)||t.generic}},7043:(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,n)=>{const r=n(375),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const n=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),i=t.group||"?",o=t.sort||0;r(!n.includes(i),"Item cannot come before itself: ".concat(i)),r(!n.includes("?"),"Item cannot come before unassociated items"),r(!s.includes(i),"Item cannot come after itself: ".concat(i)),r(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:o,before:n,after:s,group:i,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();r(e,"item","?"!==i?"added into group ".concat(i):"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return r(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return r(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),n=Object.create(null);for(const r of this._items){const s=r.seq,i=r.group;n[i]=n[i]||[],n[i].push(s),e[s]=r.before;for(const e of r.after)t[e]=t[e]||[],t[e].push(s)}for(const t in e){const r=[];for(const s in e[t]){const i=e[t][s];n[i]=n[i]||[],r.push(...n[i])}e[t]=r}for(const r in t)if(n[r])for(const s of n[r])e[s].push(...t[r]);const r={};for(const t in e){const n=e[t];for(const e of n)r[e]=r[e]||[],r[e].push(t)}const s={},i=[];for(let e=0;e<this._items.length;++e){let t=e;if(r[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===s[e])continue;r[e]||(r[e]=[]);const n=r[e].length;let i=0;for(let t=0;t<n;++t)s[r[e][t]]&&++i;if(i===n){t=e;break}}}null!==t&&(s[t]=!0,i.push(t))}if(i.length!==this._items.length)return!1;const o={};for(const e of this._items)o[e.seq]=e;this._items=[],this.nodes=[];for(const e of i){const t=o[e];this.nodes.push(t.node),this._items.push(t)}return!0}},s.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,n)=>{const r=n(443),s=n(2178),i={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:r.URL||URL};t.analyze=function(e,t={}){if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(i.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(i.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=i.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const n=t.minDomainSegments||i.minDomainSegments,r=e.split(".");if(r.length<n)return s.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&r.length>t.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=r[r.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<r.length;++e){const t=r[e];if(!t.length)return s.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return s.code("DOMAIN_LONG_SEGMENT");if(e<r.length-1){if(!i.domainSegmentRx.test(t))return s.code("DOMAIN_INVALID_CHARS")}else if(!i.tldSegmentRx.test(t))return s.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,n){return!t.analyze(e,n)},i.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new i.URL("http://".concat(e)).host}catch(t){return e}}},1745:(e,t,n)=>{const r=n(9848),s=n(5380),i=n(2178),o={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(r.TextEncoder||TextEncoder)};t.analyze=function(e,t){return o.email(e,t)},t.isValid=function(e,t){return!o.email(e,t)},o.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return i.code("EMPTY_STRING");const n=!o.nonAsciiRx.test(e);if(!n){if(!1===t.allowUnicode)return i.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(2!==r.length)return r.length>2?i.code("MULTIPLE_AT_CHAR"):i.code("MISSING_AT_CHAR");const[a,c]=r;if(!a)return i.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return i.code("ADDRESS_TOO_LONG");if(o.encoder.encode(a).length>64)return i.code("LOCAL_TOO_LONG")}return o.local(a,n)||s.analyze(c,t)},o.local=function(e,t){const n=e.split(".");for(const e of n){if(!e.length)return i.code("EMPTY_LOCAL_SEGMENT");if(t){if(!o.atextRx.test(e))return i.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(o.atextRx.test(t))continue;const e=o.binary(t);if(!o.atomRx.test(e))return i.code("INVALID_LOCAL_CHARS")}}},o.binary=function(e){return Array.from(o.encoder.encode(e)).map(e=>String.fromCharCode(e)).join("")},o.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,o.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,n)=>{const r=n(375),s=n(5752);t.regex=function(e={}){r(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";r(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),r(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let n=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(n)||(n=[n]),r(n.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<n.length;++e)r("string"==typeof n[e],"options.version must only contain strings"),n[e]=n[e].toLowerCase(),r(["ipv4","ipv6","ipvfuture"].includes(n[e]),"options.version contains unknown version "+n[e]+" - must be one of ipv4, ipv6, ipvfuture");n=Array.from(new Set(n));const i="(?:".concat(n.map(e=>{if("forbidden"===t)return s.ip[e];const n="\\/".concat("ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr);return"required"===t?"".concat(s.ip[e]).concat(n):"".concat(s.ip[e],"(?:").concat(n,")?")}).join("|"),")"),o=new RegExp("^".concat(i,"$"));return{cidr:t,versions:n,regex:o,raw:i}}},5752:(e,t,n)=>{const r=n(375),s=n(6064),i={generate:function(){const e={},t="\\dA-Fa-f",n="["+t+"]",r="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",i="%"+t,o=r+i+s+":@",a="["+o+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=n+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,p="::(?:"+l+":){5}"+u,f="(?:"+l+")?::(?:"+l+":){4}"+u,h="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,g="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,y="(?:(?:"+l+":){0,4}"+l+")?::"+u,v="(?:(?:"+l+":){0,5}"+l+")?::"+l,w="(?:(?:"+l+":){0,6}"+l+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+p+"|"+f+"|"+h+"|"+m+"|"+g+"|"+y+"|"+v+"|"+w+")",e.ipvFuture="v"+n+"+\\.["+r+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+r+i+s+":]*",R="["+r+i+s+"]{1,255}",E="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|"+R+")",k="(?:"+_+"@)?"+E+"(?::\\d*)?",I="(?:"+_+"@)?("+E+")(?::\\d*)?",T=a+"*",A=a+"+",L="(?:\\/"+T+")*",O="\\/(?:"+A+L+")?",N=A+L,M="["+r+i+s+"@]+"+L,D="(?:\\/\\/\\/"+T+L+")";return e.hierPart="(?:(?:\\/\\/"+k+L+")|"+O+"|"+N+"|"+D+")",e.hierPartCapture="(?:(?:\\/\\/"+I+L+")|"+O+"|"+N+")",e.relativeRef="(?:(?:\\/\\/"+k+L+")|"+O+"|"+M+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+I+L+")|"+O+"|"+M+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",e}};i.rfc3986=i.generate(),t.ip={v4Cidr:i.rfc3986.ipv4Cidr,v6Cidr:i.rfc3986.ipv6Cidr,ipv4:i.rfc3986.ipv4address,ipv6:i.rfc3986.ipv6address,ipvfuture:i.rfc3986.ipvFuture},i.createRegex=function(e){const t=i.rfc3986,n="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",o=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return i.wrap(o+n);let a="";if(e.scheme){r(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const n=[].concat(e.scheme);r(n.length>=1,"scheme must have at least 1 scheme specified");const i=[];for(let e=0;e<n.length;++e){const o=n[e];r(o instanceof RegExp||"string"==typeof o,"scheme at position "+e+" must be a RegExp or String"),o instanceof RegExp?i.push(o.source.toString()):(r(t.schemeRegex.test(o),"scheme at position "+e+" must be a valid scheme"),i.push(s(o)))}a=i.join("|")}const c="(?:"+(a?"(?:"+a+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",l=e.allowRelative?"(?:"+c+"|"+o+")":c;return i.wrap(l+n,a)},i.wrap=function(e,t){return{raw:e="(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])".concat(e),regex:new RegExp("^".concat(e,"$")),scheme:t}},i.uriRegex=i.createRegex({}),t.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?i.createRegex(e):i.uriRegex}},1447:(e,t)=>{const n={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[n.settings]&&t.constants)for(const e in t.constants){const n=t.constants[e];if(null!==n&&!["boolean","number","string"].includes(typeof n))throw new Error("Formula constant ".concat(e," contains invalid ").concat(typeof n," value type"))}this.settings=t[n.settings]?t:Object.assign({[n.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let r=[],s="",i=0,o=!1;const a=e=>{if(i)throw new Error("Formula missing closing parenthesis");const a=r.length?r[r.length-1]:null;if(o||s||e){if(a&&"reference"===a.type&&")"===e)return a.type="function",a.value=this._subFormula(s,a.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);r.push({type:"segment",value:e})}else if(o){if("]"===o)return r.push({type:"reference",value:s}),void(s="");r.push({type:"literal",value:s})}else if(n.operatorCharacters.includes(s))a&&"operator"===a.type&&n.operators.includes(a.value+s)?a.value+=s:r.push({type:"operator",value:s});else if(s.match(n.numberRx))r.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])r.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(n.tokenRx))throw new Error("Formula contains invalid token: ".concat(s));r.push({type:"reference",value:s})}s=""}};for(const t of e)o?t===o?(a(),o=!1):s+=t:i?"("===t?(s+=t,++i):")"===t?(--i,i?s+=t:a(t)):s+=t:t in n.literals?o=n.literals[t]:"("===t?(a(),++i):n.operatorCharacters.includes(t)?(a(),s=t,a()):" "!==t?s+=t:a();a(),r=r.map((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==r[t-1].type?e:{type:"operator",value:"n"});let c=!1;for(const e of r){if("operator"===e.type){if(n.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!n.operators.includes(e.value))throw new Error("Formula contains an unknown operator ".concat(e.value))}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===r.length&&["reference","literal","constant"].includes(r[0].type)&&(this.single={type:"reference"===r[0].type?"reference":"value",value:r[0].value}),this._parts=r.map(e=>{if("operator"===e.type)return n.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error("Formula contains invalid reference ".concat(e.value));return this.settings.reference?this.settings.reference(e.value):n.reference(e.value)})}_subFormula(e,r){const s=this.settings.functions[r];if("function"!=typeof s)throw new Error("Formula contains unknown function ".concat(r));let i=[];if(e){let t="",s=0,o=!1;const a=()=>{if(!t)throw new Error("Formula contains function ".concat(r," with invalid arguments ").concat(e));i.push(t),t=""};for(let r=0;r<e.length;++r){const i=e[r];o?(t+=i,i===o&&(o=!1)):i in n.literals&&!s?(t+=i,o=n.literals[i]):","!==i||s?(t+=i,"("===i?++s:")"===i&&--s):a()}a()}return i=i.map(e=>new t.Parser(e,this.settings)),function(e){const t=[];for(const n of i)t.push(n.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let r=t.length-2;r>=0;--r){const s=t[r];if(s&&"operator"===s.type){const i=t[r+1];t.splice(r+1,1);const o=n.evaluate(i,e);t[r]=n.single(s.value,o)}}return n.operatorsOrder.forEach(r=>{for(let s=1;s<t.length-1;)if(r.includes(t[s])){const r=t[s],i=n.evaluate(t[s-1],e),o=n.evaluate(t[s+1],e);t.splice(s,2);const a=n.calculate(r,i,o);t[s-1]=0===a?0:a}else s+=2}),n.evaluate(t[0],e)}},t.Parser.prototype[n.symbol]=!0,n.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},n.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[n.symbol]?e.evaluate(t):e},n.single=function(e,t){if("!"===e)return!t;const n=-t;return 0===n?0:n},n.calculate=function(e,t,r){if("??"===e)return n.exists(t)?t:r;if("string"==typeof t||"string"==typeof r){if("+"===e)return(t=n.exists(t)?t:"")+(n.exists(r)?r:"")}else switch(e){case"^":return Math.pow(t,r);case"*":return t*r;case"/":return t/r;case"%":return t%r;case"+":return t+r;case"-":return t-r}switch(e){case"<":return t<r;case"<=":return t<=r;case">":return t>r;case">=":return t>=r;case"==":return t===r;case"!=":return t!==r;case"&&":return t&&r;case"||":return t||r}return null},n.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{e.exports=JSON.parse('{"version":"17.13.3"}')}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}(5107);var e,t})}(yi);class bi extends jt{constructor(e,t,n,r){if(super(),vi=n,!t)throw vi.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new tt,this.signaling=null,this.autoReconnect=r,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.isReconnecting=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;vi.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null==(e=this.signaling)||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new tt}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return vi.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Fs,()=>{(this.firstReconnection||!this.alreadyDisconnected)&&(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(Ss.connectionStateChange,e=>{ct(e),"connected"===e&&at(new Date),("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}async reconnect(e){try{vi.info("Attempting to reconnect..."),!this.isActive()&&!this.stopReconnection&&!this.isReconnecting&&(this.stop(),this.emit("reconnect",{timeout:wi(this.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),this.isReconnecting=!0,await this.connect(this.options),this.alreadyDisconnected=!1,this.reconnectionInterval=1e3,this.firstReconnection=!0,this.isReconnecting=!1)}catch(e){this.isReconnecting=!1,this.reconnectionInterval=wi(this.reconnectionInterval),vi.error("Reconnection failed, retrying in ".concat(this.reconnectionInterval,"ms. "),e),setTimeout(()=>this.reconnect({error:e}),this.reconnectionInterval)}}}const wi=e=>e<32e3?2*e:e,Si=window.RTCRtpSender&&!!RTCRtpSender.prototype.createEncodedStreams&&window.RTCRtpReceiver&&!!RTCRtpReceiver.prototype.createEncodedStreams,_i="RTCRtpScriptTransform"in window,Ri="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBGPXR5cGVvZiBnbG9iYWxUaGlzPCJ1Ij9nbG9iYWxUaGlzOnR5cGVvZiB3aW5kb3c8InUiP3dpbmRvdzp0eXBlb2YgZ2xvYmFsPCJ1Ij9nbG9iYWw6dHlwZW9mIHNlbGY8InUiP3NlbGY6e307ZnVuY3Rpb24gVyhuKXtyZXR1cm4gbiYmbi5fX2VzTW9kdWxlJiZPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwiZGVmYXVsdCIpP24uZGVmYXVsdDpufXZhciBCPXtleHBvcnRzOnt9fTsvKiEKICoganMtbG9nZ2VyIC0gaHR0cDovL2dpdGh1Yi5jb20vam9ubnlyZWV2ZXMvanMtbG9nZ2VyCiAqIEpvbm55IFJlZXZlcywgaHR0cDovL2pvbm55cmVldmVzLmNvLnVrLwogKiBqcy1sb2dnZXIgbWF5IGJlIGZyZWVseSBkaXN0cmlidXRlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UuCiAqLyhmdW5jdGlvbihuKXsoZnVuY3Rpb24odCl7dmFyIGU9e307ZS5WRVJTSU9OPSIxLjYuMSI7dmFyIHMscj17fSxvPWZ1bmN0aW9uKGksdSl7cmV0dXJuIGZ1bmN0aW9uKCl7cmV0dXJuIHUuYXBwbHkoaSxhcmd1bWVudHMpfX0sYT1mdW5jdGlvbigpe3ZhciBpPWFyZ3VtZW50cyx1PWlbMF0saCxjO2ZvcihjPTE7YzxpLmxlbmd0aDtjKyspZm9yKGggaW4gaVtjXSkhKGggaW4gdSkmJmlbY10uaGFzT3duUHJvcGVydHkoaCkmJih1W2hdPWlbY11baF0pO3JldHVybiB1fSxkPWZ1bmN0aW9uKGksdSl7cmV0dXJue3ZhbHVlOmksbmFtZTp1fX07ZS5UUkFDRT1kKDEsIlRSQUNFIiksZS5ERUJVRz1kKDIsIkRFQlVHIiksZS5JTkZPPWQoMywiSU5GTyIpLGUuVElNRT1kKDQsIlRJTUUiKSxlLldBUk49ZCg1LCJXQVJOIiksZS5FUlJPUj1kKDgsIkVSUk9SIiksZS5PRkY9ZCg5OSwiT0ZGIik7dmFyIGw9ZnVuY3Rpb24oaSl7dGhpcy5jb250ZXh0PWksdGhpcy5zZXRMZXZlbChpLmZpbHRlckxldmVsKSx0aGlzLmxvZz10aGlzLmluZm99O2wucHJvdG90eXBlPXtzZXRMZXZlbDpmdW5jdGlvbihpKXtpJiYidmFsdWUiaW4gaSYmKHRoaXMuY29udGV4dC5maWx0ZXJMZXZlbD1pKX0sZ2V0TGV2ZWw6ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5jb250ZXh0LmZpbHRlckxldmVsfSxlbmFibGVkRm9yOmZ1bmN0aW9uKGkpe3ZhciB1PXRoaXMuY29udGV4dC5maWx0ZXJMZXZlbDtyZXR1cm4gaS52YWx1ZT49dS52YWx1ZX0sdHJhY2U6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLlRSQUNFLGFyZ3VtZW50cyl9LGRlYnVnOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5ERUJVRyxhcmd1bWVudHMpfSxpbmZvOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5JTkZPLGFyZ3VtZW50cyl9LHdhcm46ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLldBUk4sYXJndW1lbnRzKX0sZXJyb3I6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLkVSUk9SLGFyZ3VtZW50cyl9LHRpbWU6ZnVuY3Rpb24oaSl7dHlwZW9mIGk9PSJzdHJpbmciJiZpLmxlbmd0aD4wJiZ0aGlzLmludm9rZShlLlRJTUUsW2ksInN0YXJ0Il0pfSx0aW1lRW5kOmZ1bmN0aW9uKGkpe3R5cGVvZiBpPT0ic3RyaW5nIiYmaS5sZW5ndGg+MCYmdGhpcy5pbnZva2UoZS5USU1FLFtpLCJlbmQiXSl9LGludm9rZTpmdW5jdGlvbihpLHUpe3MmJnRoaXMuZW5hYmxlZEZvcihpKSYmcyh1LGEoe2xldmVsOml9LHRoaXMuY29udGV4dCkpfX07dmFyIGY9bmV3IGwoe2ZpbHRlckxldmVsOmUuT0ZGfSk7KGZ1bmN0aW9uKCl7dmFyIGk9ZTtpLmVuYWJsZWRGb3I9byhmLGYuZW5hYmxlZEZvciksaS50cmFjZT1vKGYsZi50cmFjZSksaS5kZWJ1Zz1vKGYsZi5kZWJ1ZyksaS50aW1lPW8oZixmLnRpbWUpLGkudGltZUVuZD1vKGYsZi50aW1lRW5kKSxpLmluZm89byhmLGYuaW5mbyksaS53YXJuPW8oZixmLndhcm4pLGkuZXJyb3I9byhmLGYuZXJyb3IpLGkubG9nPWkuaW5mb30pKCksZS5zZXRIYW5kbGVyPWZ1bmN0aW9uKGkpe3M9aX0sZS5zZXRMZXZlbD1mdW5jdGlvbihpKXtmLnNldExldmVsKGkpO2Zvcih2YXIgdSBpbiByKXIuaGFzT3duUHJvcGVydHkodSkmJnJbdV0uc2V0TGV2ZWwoaSl9LGUuZ2V0TGV2ZWw9ZnVuY3Rpb24oKXtyZXR1cm4gZi5nZXRMZXZlbCgpfSxlLmdldD1mdW5jdGlvbihpKXtyZXR1cm4gcltpXXx8KHJbaV09bmV3IGwoYSh7bmFtZTppfSxmLmNvbnRleHQpKSl9LGUuY3JlYXRlRGVmYXVsdEhhbmRsZXI9ZnVuY3Rpb24oaSl7aT1pfHx7fSxpLmZvcm1hdHRlcj1pLmZvcm1hdHRlcnx8ZnVuY3Rpb24ocCxfKXtfLm5hbWUmJnAudW5zaGlmdCgiWyIrXy5uYW1lKyJdIil9O3ZhciB1PXt9LGg9ZnVuY3Rpb24oYyxwKXtGdW5jdGlvbi5wcm90b3R5cGUuYXBwbHkuY2FsbChjLGNvbnNvbGUscCl9O3JldHVybiB0eXBlb2YgY29uc29sZT4idSI/ZnVuY3Rpb24oKXt9OmZ1bmN0aW9uKGMscCl7Yz1BcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChjKTt2YXIgXz1jb25zb2xlLmxvZyxnO3AubGV2ZWw9PT1lLlRJTUU/KGc9KHAubmFtZT8iWyIrcC5uYW1lKyJdICI6IiIpK2NbMF0sY1sxXT09PSJzdGFydCI/Y29uc29sZS50aW1lP2NvbnNvbGUudGltZShnKTp1W2ddPW5ldyBEYXRlKCkuZ2V0VGltZSgpOmNvbnNvbGUudGltZUVuZD9jb25zb2xlLnRpbWVFbmQoZyk6aChfLFtnKyI6ICIrKG5ldyBEYXRlKCkuZ2V0VGltZSgpLXVbZ10pKyJtcyJdKSk6KHAubGV2ZWw9PT1lLldBUk4mJmNvbnNvbGUud2Fybj9fPWNvbnNvbGUud2FybjpwLmxldmVsPT09ZS5FUlJPUiYmY29uc29sZS5lcnJvcj9fPWNvbnNvbGUuZXJyb3I6cC5sZXZlbD09PWUuSU5GTyYmY29uc29sZS5pbmZvP189Y29uc29sZS5pbmZvOnAubGV2ZWw9PT1lLkRFQlVHJiZjb25zb2xlLmRlYnVnP189Y29uc29sZS5kZWJ1ZzpwLmxldmVsPT09ZS5UUkFDRSYmY29uc29sZS50cmFjZSYmKF89Y29uc29sZS50cmFjZSksaS5mb3JtYXR0ZXIoYyxwKSxoKF8sYykpfX0sZS51c2VEZWZhdWx0cz1mdW5jdGlvbihpKXtlLnNldExldmVsKGkmJmkuZGVmYXVsdExldmVsfHxlLkRFQlVHKSxlLnNldEhhbmRsZXIoZS5jcmVhdGVEZWZhdWx0SGFuZGxlcihpKSl9LGUuc2V0RGVmYXVsdHM9ZS51c2VEZWZhdWx0cyxuLmV4cG9ydHM/bi5leHBvcnRzPWU6KGUuX3ByZXZMb2dnZXI9dC5Mb2dnZXIsZS5ub0NvbmZsaWN0PWZ1bmN0aW9uKCl7cmV0dXJuIHQuTG9nZ2VyPWUuX3ByZXZMb2dnZXIsZX0sdC5Mb2dnZXI9ZSl9KShGKX0pKEIpO3ZhciB6PUIuZXhwb3J0cyxEPVcoeik7Y2xhc3Mgd3tjb25zdHJ1Y3Rvcih0KXt0aGlzLmRhdGE9dCx0aGlzLmJpdE9mZnNldD0wfXJlYWRCaXRzKHQpe2lmKHRoaXMuYml0T2Zmc2V0K3Q+dGhpcy5kYXRhLmxlbmd0aCo4KXRocm93IG5ldyBFcnJvcigiQXR0ZW1wdGVkIHRvIHJlYWQgcGFzdCB0aGUgZW5kIG9mIHRoZSBiaXRzdHJlYW0iKTtsZXQgZT0wO2ZvcihsZXQgcz0wO3M8dDtzKyspe2NvbnN0IHI9TWF0aC5mbG9vcih0aGlzLmJpdE9mZnNldC84KSxvPTctdGhpcy5iaXRPZmZzZXQlOCxhPXRoaXMuZGF0YVtyXT4+byYxO2V8PWE8PHQtMS1zLHRoaXMuYml0T2Zmc2V0Kyt9cmV0dXJuIGV9c2tpcCh0KXt0aGlzLmJpdE9mZnNldCs9dH1yZWFkRXhwR29sb21iVW5zaWduZWQoKXtsZXQgdD0tMTtmb3IobGV0IGU9MDtlPT09MDt0KyspZT10aGlzLnJlYWRCaXRzKDEpO3JldHVybigxPDx0KS0xK3RoaXMucmVhZEJpdHModCl9cmVhZEV4cEdvbG9tYlNpZ25lZCgpe2NvbnN0IHQ9dGhpcy5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtyZXR1cm4gdCUyPT09MD8tKHQvMik6KHQrMSkvMn19Y29uc3QgbT17U0xJQ0VfTk9OX0lEUjoxLFNMSUNFX1BBUlRJVElPTl9BOjIsU0xJQ0VfSURSOjUsU0VJX0gyNjQ6NixTRUlfSDI2NV9QUkVGSVg6MzksU0VJX0gyNjVfU1VGRklYOjQwLFNQU19IMjY0OjcsU1BTX0gyNjU6MzMsUFBTX0gyNjQ6OCxQUFNfSDI2NTozNH0sUj17UElDX1RJTUlORzoxLFVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6NX0sRT17TEVHQUNZOjEsTkVXOjIsVElNRUNPREU6MyxPVEhFUjo0fSxqPSI2ZTljZmQyYS01OTA3LTQ5ZmYtYjM2My04OTc4YTZlODM0MGUiLHE9IjlhMjFmM2JlLTMxZjAtNGI3OC1iMGJlLWM3ZjdkYmI5NzI1MCIsTD0iZDQwZTM4ZWEtZDQxOS00YzYyLTk0ZWQtMjBhYzM3YjRlNGZhIjtjbGFzcyBWe2NvbnN0cnVjdG9yKHQ9IkgyNjQiKXt0aGlzLnNwcz1uZXcgTWFwLHRoaXMucHBzPW5ldyBNYXAsdGhpcy5hY3RpdmVTUFM9bnVsbCx0aGlzLmNvZGVjPXR9Y29sbGVjdFBQUyh0KXt0aGlzLmNvZGVjPT09IkgyNjQiP3RoaXMuY29sbGVjdEgyNjRQUFModCk6dGhpcy5jb2xsZWN0SDI2NVBQUyh0KX1jb2xsZWN0U1BTKHQpe3RoaXMuY29kZWM9PT0iSDI2NCI/dGhpcy5jb2xsZWN0SDI2NFNQUyh0KTp0aGlzLmNvbGxlY3RIMjY1U1BTKHQpfWNvbGxlY3RIMjY0U1BTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRCaXRzKDgpLHI9WzEwMCwxMTAsMTIyLDI0NCw0NCw4Myw4NiwxMTgsMTI4LDEzOCwxMzksMTM0LDEzNV07ZS5za2lwKDgpLGUuc2tpcCg4KTtjb25zdCBvPWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7aWYobz4zMXx8bzwwKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBzZXFfcGFyYW1ldGVyX3NldF9pZCIpO2lmKHIuaW5jbHVkZXMocykpe2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtpZihsPT09MyYmZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnNraXAoMSksZS5yZWFkQml0cygxKSl7Y29uc3QgaT1sIT09Mz84OjEyO2ZvcihsZXQgdT0wO3U8aTt1KyspaWYoZS5yZWFkQml0cygxKSl7Y29uc3QgaD11PDY/MTY6NjQ7bGV0IGM9OCxwPTg7Zm9yKGxldCBfPTA7XzxoO18rKyl7aWYocCE9PTApe2NvbnN0IGc9ZS5yZWFkRXhwR29sb21iU2lnbmVkKCk7cD0oYytnKzI1NiklMjU2fWM9cD09PTA/YzpwfX19fWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3QgYT1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKGE9PT0wKWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7ZWxzZSBpZihhPT09MSl7ZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpO2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtmb3IobGV0IGY9MDtmPGw7ZisrKWUucmVhZEV4cEdvbG9tYlNpZ25lZCgpfWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRCaXRzKDEpPT09MCYmZS5za2lwKDEpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSk7bGV0IGQ7aWYoZS5yZWFkQml0cygxKSl7bGV0IGY9ZnVuY3Rpb24oYyl7Y29uc3QgcD1jLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2Muc2tpcCg0KSxjLnNraXAoNCk7Zm9yKGxldCB4PTA7eDw9cDt4KyspYy5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxjLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGMuc2tpcCgxKTtjLnNraXAoNSk7Y29uc3QgXz1jLnJlYWRCaXRzKDUpLGc9Yy5yZWFkQml0cyg1KSxBPWMucmVhZEJpdHMoNSk7cmV0dXJue2NwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6XyxkcGJfb3V0cHV0X2RlbGF5X2xlbmd0aF9taW51czE6Zyx0aW1lX29mZnNldF9sZW5ndGg6QX19O2UucmVhZEJpdHMoMSkmJmUucmVhZEJpdHMoOCk9PT0yNTUmJihlLnNraXAoMTYpLGUuc2tpcCgxNikpLGUucmVhZEJpdHMoMSkmJmUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5za2lwKDMpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiZlLnNraXAoMjQpKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpKTtjb25zdCBsPWUucmVhZEJpdHMoMSk/e251bV91bml0c19pbl90aWNrOmUucmVhZEJpdHMoMzIpLHRpbWVfc2NhbGU6ZS5yZWFkQml0cygzMiksZml4ZWRfZnJhbWVfcmF0ZV9mbGFnOmUucmVhZEJpdHMoMSl9OnZvaWQgMCxpPWUucmVhZEJpdHMoMSk/ZihlKTp2b2lkIDAsdT1lLnJlYWRCaXRzKDEpP2YoZSk6dm9pZCAwOyhpfHx1KSYmZS5za2lwKDEpO2NvbnN0IGg9ZS5yZWFkQml0cygxKTtkPXt0aW1pbmdfaW5mbzpsLG5hbF9ocmRfcGFyYW1ldGVyczppLHZjbF9ocmRfcGFyYW1ldGVyczp1LHBpY19zdHJ1Y3RfcHJlc2VudF9mbGFnOmh9fXRoaXMuc3BzLnNldChvLHt2dWlfcGFyYW1ldGVyczpkfSl9Y29sbGVjdEgyNjVTUFModCl7fWNvbGxlY3RIMjY0UFBTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKHM+MjU1fHxzPDApdGhyb3cgbmV3IEVycm9yKCJJbnZhbGlkIHBpY19wYXJhbWV0ZXJfc2V0X2lkIik7Y29uc3Qgcj1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO3RoaXMucHBzLnNldChzLHtzZXFfcGFyYW1ldGVyX3NldF9pZDpyfSl9Y29sbGVjdEgyNjVQUFModCl7fWZpbmRBY3RpdmVTUFModCl7Y29uc3QgZT1uZXcgdyh0KTtlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3Qgcz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLHI9dGhpcy5wcHMuZ2V0KHMpO2lmKHIpe2NvbnN0IG89dGhpcy5zcHMuZ2V0KHIuc2VxX3BhcmFtZXRlcl9zZXRfaWQpO2lmKG8pe3RoaXMuYWN0aXZlU1BTPW87cmV0dXJufX10aHJvdyBuZXcgRXJyb3IoIkNhbm5vdCBmaW5kIHRoZSBhY3RpdmUgU1BTIil9fWNvbnN0IFM9bmV3IFY7ZnVuY3Rpb24gRyhuLHQpe2Zvcig7dDxuLmJ5dGVMZW5ndGgtNDspe2lmKG5bdF09PT0wJiZuW3QrMV09PT0wJiYoblt0KzJdPT09MXx8blt0KzJdPT09MCYmblt0KzNdPT09MSkpcmV0dXJuIHQ7dCs9MX1yZXR1cm4tMX1mdW5jdGlvbiBVKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkobi5ieXRlTGVuZ3RoKTtsZXQgZT0wLHM9MDtmb3IobGV0IHI9MjtyPG4uYnl0ZUxlbmd0aDtyKyspbltyXT09PTMmJm5bci0xXT09PTAmJm5bci0yXT09PTAmJih0LnNldChuLnN1YmFycmF5KHMsciksZSksZSs9ci1zLHM9cisxKTtyZXR1cm4gczxuLmJ5dGVMZW5ndGgmJnQuc2V0KG4uc3ViYXJyYXkocyksZSksdH1mdW5jdGlvbiBZKG4sdCl7bGV0IGU9MDtjb25zdCBzPXQ9PT0iSDI2NCI/MToyLHI9W107Zm9yKDtlPG4uYnl0ZUxlbmd0aC00Oyl7Y29uc3Qgbz1HKG4sZSk7aWYobz49ZSl7Y29uc3QgYT1uW28rMl09PT0xPzM6NCxkPUcobixvK2Ercyk7aWYoZD5vKXIucHVzaChuLnN1YmFycmF5KG8sZCkpLGU9ZDtlbHNle3IucHVzaChuLnN1YmFycmF5KG8pKTticmVha319ZWxzZSBicmVha31yZXR1cm4gcn1mdW5jdGlvbiBYKG4sdCl7bGV0IGU9ITA7cmV0dXJuIFkobix0KS5maWx0ZXIocz0+e2NvbnN0IHI9c1syXT09PTE/Mzo0LG89dD09PSJIMjY0Ij8xOjIsYT1zW3JdLGQ9dD09PSJIMjY0Ij9hJjMxOmE+PjEmNjM7aWYoZSlzd2l0Y2goZCl7Y2FzZSBtLlBQU19IMjY0OmNhc2UgbS5QUFNfSDI2NTpTLmNvbGxlY3RQUFMoVShzLnN1YmFycmF5KHIrbykpKTticmVhaztjYXNlIG0uU1BTX0gyNjQ6Y2FzZSBtLlNQU19IMjY1OlMuY29sbGVjdFNQUyhVKHMuc3ViYXJyYXkocitvKSkpO2JyZWFrO2Nhc2UgbS5TTElDRV9JRFI6Y2FzZSBtLlNMSUNFX05PTl9JRFI6Y2FzZSBtLlNMSUNFX1BBUlRJVElPTl9BOnRyeXtTLmZpbmRBY3RpdmVTUFMoVShzLnN1YmFycmF5KHIrbykpKSxlPSExfWNhdGNoKGwpe2NvbnNvbGUuaW5mbygiRmFpbGVkIHRvIGZpbmQgYWN0aXZlIFNQUy4gV2lsbCBub3QgYmUgYWJsZSB0byBleHRyYWN0IFBJQyB0aW1pbmcgbWV0YWRhdGEiKX1icmVha31yZXR1cm5bbS5TRUlfSDI2NCxtLlNFSV9IMjY1X1BSRUZJWCxtLlNFSV9IMjY1X1NVRkZJWF0uaW5jbHVkZXMoZCl9KX1mdW5jdGlvbiAkKG4pe2xldCB0PTAsZT0wO2Zvcig7bltlXT09PTI1NTspdCs9MjU1LGUrKzt0Kz1uW2VdLGUrKztsZXQgcz0wO2Zvcig7bltlXT09PTI1NTspcys9MjU1LGUrKztyZXR1cm4gcys9bltlXSxlKysse3R5cGU6dCxjb250ZW50Om4uc3ViYXJyYXkoZSxlK3MpfX1mdW5jdGlvbiBKKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkoVChxKSksZT1uZXcgVWludDhBcnJheShUKGopKSxzPW5ldyBVaW50OEFycmF5KFQoTCkpO3JldHVybiB0LmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5USU1FQ09ERTplLmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5MRUdBQ1k6cy5ldmVyeSgocixvKT0+cj09PW5bb10pP0UuTkVXOkUuT1RIRVJ9ZnVuY3Rpb24gSyhuLHQpe2xldCBlPTA7bi51dWlkPXQuc3ViYXJyYXkoZSxlKzE2KSxlKz0xNjtjb25zdCBzPUoobi51dWlkKSxyPXQuc3ViYXJyYXkoZSk7c3dpdGNoKHMpe2Nhc2UgRS5MRUdBQ1k6Y2FzZSBFLk9USEVSOm4udW5yZWdpc3RlcmVkPXI7YnJlYWs7Y2FzZSBFLlRJTUVDT0RFOm4udGltZWNvZGU9TyhyKTticmVhaztjYXNlIEUuTkVXOntsZXQgbz0wO2NvbnN0IGE9QyhEYXRlLm5vdygpKS5sZW5ndGgsZD1yLnN1YmFycmF5KG8sYSk7bys9YTtjb25zdCBsPXIuc3ViYXJyYXkobyk7bi50aW1lY29kZT1PKGQpLG4udW5yZWdpc3RlcmVkPWw7YnJlYWt9fX1mdW5jdGlvbiBPKG4pe2NvbnN0IHQ9bi5yZWR1Y2UoKG8sYSk9PihvPDxCaWdJbnQoOCkpK0JpZ0ludChhKSxCaWdJbnQoMCkpLGU9TnVtYmVyKHQpLHM9bmV3IERhdGUoZSk7cmV0dXJuIG5ldyBUZXh0RW5jb2RlcigpLmVuY29kZShzLnRvSVNPU3RyaW5nKCkpfWZ1bmN0aW9uIFoobix0KXt2YXIgZixpLHUsaCxjO2lmKCFTLmFjdGl2ZVNQUyl7Y29uc29sZS53YXJuKCJDYW5ub3QgZmluZCB0aGUgYWN0aXZlIFNQUyIpO3JldHVybn1jb25zdCBlPShmPVMuYWN0aXZlU1BTLnZ1aV9wYXJhbWV0ZXJzLm5hbF9ocmRfcGFyYW1ldGVycykhPW51bGw/ZjpTLmFjdGl2ZVNQUy52dWlfcGFyYW1ldGVycy52Y2xfaHJkX3BhcmFtZXRlcnMscz17Y3BiX2RwYl9kZWxheXNfcHJlc2VudF9mbGFnOmU/MTowLGNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6KGk9ZT09bnVsbD92b2lkIDA6ZS5jcGJfcmVtb3ZhbF9kZWxheV9sZW5ndGhfbWludXMxKSE9bnVsbD9pOjIzLGRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMToodT1lPT1udWxsP3ZvaWQgMDplLmRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMSkhPW51bGw/dToyMyx0aW1lX29mZnNldF9sZW5ndGg6ZT8oaD1lLnRpbWVfb2Zmc2V0X2xlbmd0aCkhPW51bGw/aDoyNDp2b2lkIDAscGljX3N0cnVjdF9wcmVzZW50X2ZsYWc6KGM9Uy5hY3RpdmVTUFMudnVpX3BhcmFtZXRlcnMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpIT1udWxsP2M6MH07aWYoIXMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpe2NvbnNvbGUud2FybigicGljX3N0cnVjdF9wcmVzZW50X2ZsYWcgaXMgbm90IHByZXNlbnQiKTtyZXR1cm59Y29uc3Qgcj1uZXcgdyh0KTtzLmNwYl9kcGJfZGVsYXlzX3ByZXNlbnRfZmxhZyYmKHIuc2tpcChzLmNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czErMSksci5za2lwKHMuZHBiX291dHB1dF9kZWxheV9sZW5ndGhfbWludXMxKzEpKTtjb25zdCBvPVsxLDEsMSwyLDIsMywzLDIsM10sYT1yLnJlYWRCaXRzKDQpO2lmKGE+PW8ubGVuZ3RoKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBwaWNfc3RydWN0Iik7Y29uc3QgZD1vW2FdLGw9W107Zm9yKGxldCBwPTA7cDxkO3ArKylpZihyLnJlYWRCaXRzKDEpKXtjb25zdCBnPXt9O3Iuc2tpcCgyKSxyLnNraXAoMSksci5za2lwKDUpO2NvbnN0IEE9ci5yZWFkQml0cygxKTtpZihyLnNraXAoMiksZy5uX2ZyYW1lcz1yLnJlYWRCaXRzKDgpLEE/KGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcubWludXRlc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcuaG91cnNfdmFsdWU9ci5yZWFkQml0cyg1KSk6ci5yZWFkQml0cygxKSYmKGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLHIucmVhZEJpdHMoMSkmJihnLm1pbnV0ZXNfdmFsdWU9ci5yZWFkQml0cyg2KSxyLnJlYWRCaXRzKDEpJiYoZy5ob3Vyc192YWx1ZT1yLnJlYWRCaXRzKDUpKSkpLHMudGltZV9vZmZzZXRfbGVuZ3RoKXRyeXtnLnRpbWVfb2Zmc2V0PXIucmVhZEJpdHMocy50aW1lX29mZnNldF9sZW5ndGgpfWNhdGNoKHgpe2NvbnNvbGUuZXJyb3IoIkZhaWxlZCB0byByZWFkIHRpbWVfb2Zmc2V0Iix4KSxnLnRpbWVfb2Zmc2V0PTB9ZWxzZSBnLnRpbWVfb2Zmc2V0PTA7bC5wdXNoKGcpfW4uc2VpUGljVGltaW5nVGltZUNvZGVBcnJheT1sfWZ1bmN0aW9uIFEobix0KXtpZih0IT09IkgyNjQiJiZ0IT09IkgyNjUiKXRocm93IG5ldyBFcnJvcigiVW5zdXBwb3J0ZWQgY29kZWMgIi5jb25jYXQodCkpO2NvbnN0IGU9e307cmV0dXJuIFMuY29kZWM9dCxYKG5ldyBVaW50OEFycmF5KG4uZGF0YSksdCkuZm9yRWFjaChzPT57Y29uc3Qgcj1zWzJdPT09MT8zOjQsbz10PT09IkgyNjQiPzE6MixhPVUocy5zdWJhcnJheShyK28pKSxkPSQoYSk7c3dpdGNoKGQudHlwZSl7Y2FzZSBSLlBJQ19USU1JTkc6WihlLGQuY29udGVudCk7YnJlYWs7Y2FzZSBSLlVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6SyhlLGQuY29udGVudCk7YnJlYWt9fSksZX1mdW5jdGlvbiBlZShuKXtyZXR1cm4vXlswLTlhLWZBLUZdezh9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezEyfSQvLnRlc3Qobil9ZnVuY3Rpb24gVChuKXtyZXR1cm4gbi5yZXBsYWNlKC8tL2csIiIpLm1hdGNoKC8uezEsMn0vZykubWFwKHQ9PnBhcnNlSW50KHQsMTYpKX1mdW5jdGlvbiB0ZShuLHQsZSl7Y29uc3Qgcz1uZXcgVWludDhBcnJheShUKG4pKSxyPUMoZSksbz1uZXcgVGV4dEVuY29kZXIoKS5lbmNvZGUoSlNPTi5zdHJpbmdpZnkodCkpLGE9bmV3IFVpbnQ4QXJyYXkocy5sZW5ndGgrci5sZW5ndGgrby5sZW5ndGgpO3JldHVybiBhLnNldChzKSxhLnNldChyLHMubGVuZ3RoKSxhLnNldChvLHIubGVuZ3RoK3MubGVuZ3RoKSxhfWZ1bmN0aW9uIG5lKG4pe2NvbnN0IHQ9W10sZT1NYXRoLmZsb29yKG4uYnl0ZUxlbmd0aC8yNTUpLHM9bi5ieXRlTGVuZ3RoJTI1NTtmb3IobGV0IHI9MDtyPGU7cisrKXQucHVzaCgyNTUpO3JldHVybiB0LnB1c2gocyksbmV3IFVpbnQ4QXJyYXkoWzUsLi4udF0pfWZ1bmN0aW9uIHJlKG4pe2NvbnN0IHQ9W107Zm9yKGxldCBlPTA7ZTxuLmJ5dGVMZW5ndGg7ZSsrKWUrMjxuLmJ5dGVMZW5ndGgmJlswLDEsMiwzXS5pbmNsdWRlcyhuW2UrMl0pJiZuW2VdPT09MCYmbltlKzFdPT09MD8odC5wdXNoKG5bZV0pLHQucHVzaChuW2UrMV0pLGUrPTIsdC5wdXNoKDMpKTp0LnB1c2gobltlXSk7cmV0dXJuIHQucHVzaCgxMjgpLG5ldyBVaW50OEFycmF5KHQpfWZ1bmN0aW9uIEMobil7Y29uc3QgdD1bXTtpZighaXNOYU4obikpe2NvbnN0IGU9QmlnSW50KG4pO2ZvcihsZXQgcz0wO3M8TWF0aC5jZWlsKE1hdGguZmxvb3IoTWF0aC5sb2cyKG5ldyBOdW1iZXIobikpKzEpLzgpO3MrKyl0LnVuc2hpZnQobmV3IE51bWJlcihlPj5CaWdJbnQoOCpzKSZCaWdJbnQoMjU1KSkpfXJldHVybiBuZXcgVWludDhBcnJheSh0KX1mdW5jdGlvbiBzZSh7dXVpZDpuLHBheWxvYWQ6dCx0aW1lY29kZTplfSl7Y29uc3Qgcz1bMCwwLDAsMV0scj1bMTAyXSxvPXRlKG4sdCxlKSxhPW5lKG8pLGQ9cmUobyksbD1uZXcgVWludDhBcnJheShzLmxlbmd0aCtyLmxlbmd0aCthLmxlbmd0aCtkLmxlbmd0aCk7cmV0dXJuIGwuc2V0KHMpLGwuc2V0KHIscy5sZW5ndGgpLGwuc2V0KGEscy5sZW5ndGgrci5sZW5ndGgpLGwuc2V0KGQscy5sZW5ndGgrci5sZW5ndGgrYS5sZW5ndGgpLGx9ZnVuY3Rpb24gaWUoe3V1aWQ6bixwYXlsb2FkOnQsdGltZWNvZGU6ZX0scyl7aWYobj09PSIifHx0PT09IiIpdGhyb3cgbmV3IEVycm9yKCJ1dWlkIGFuZCBwYXlsb2FkIGNhbm5vdCBiZSBlbXB0eSIpO2VlKG4pfHwoY29uc29sZS53YXJuKCJJbnZhbGlkIFVVSUQuIFVzaW5nIGRlZmF1bHQgVVVJRC4iKSxuPUwsZT1EYXRlLm5vdygpKTtjb25zdCByPXNlKHt1dWlkOm4scGF5bG9hZDp0LHRpbWVjb2RlOmV9KSxvPW5ldyBEYXRhVmlldyhzLmRhdGEpLGE9bmV3IEFycmF5QnVmZmVyKHMuZGF0YS5ieXRlTGVuZ3RoK3IuYnl0ZUxlbmd0aCksZD1uZXcgRGF0YVZpZXcoYSk7Zm9yKGxldCBsPTA7bDxzLmRhdGEuYnl0ZUxlbmd0aDtsKyspZC5zZXRVaW50OChsLG8uZ2V0VWludDgobCkpO2ZvcihsZXQgbD0wO2w8ci5ieXRlTGVuZ3RoO2wrKylkLnNldFVpbnQ4KHMuZGF0YS5ieXRlTGVuZ3RoK2wscltsXSk7cy5kYXRhPWF9RC5nZXQoIlRyYW5zZm9ybVdvcmtlciIpLnNldExldmVsKEQuREVCVUcpO2NvbnN0IG9lPTJlMyxiPVtdO2xldCB5PSIiLFA9e307Y29uc3Qgdj17fTtsZXQgST1bXTtmdW5jdGlvbiBIKG4pe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybSh0LGUpe3ZhciBzLHI7aWYodCBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCBvPSgocz1QW3QuZ2V0TWV0YWRhdGEoKS5wYXlsb2FkVHlwZV0pPT1udWxsP3ZvaWQgMDpzLnRvVXBwZXJDYXNlKCkpfHwoeT09bnVsbD92b2lkIDA6eS50b1VwcGVyQ2FzZSgpKTtpZihvPT09IkgyNjQiKXtjb25zdCBhPVEodCxvKTsoYS50aW1lY29kZXx8YS51bnJlZ2lzdGVyZWR8fCgocj1hLnNlaVBpY1RpbWluZ1RpbWVDb2RlQXJyYXkpPT1udWxsP3ZvaWQgMDpyLmxlbmd0aCk+MCkmJnNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJtZXRhZGF0YSIsbWlkOm4sbWV0YWRhdGE6YX0pfXNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJjb21wbGV0ZSIsZnJhbWU6e3R5cGU6dC50eXBlLHRpbWVzdGFtcDp0LnRpbWVzdGFtcCxkYXRhOnQuZGF0YX19KX1lLmVucXVldWUodCl9fSl9ZnVuY3Rpb24gTSgpe09iamVjdC5rZXlzKHYpLnNvcnQoKS5qb2luKCk9PT1JLnNvcnQoKS5qb2luKCkmJihiLnNoaWZ0KCksST1bXSl9ZnVuY3Rpb24gYWUobil7Y29uc3QgdD1uZXcgRGF0ZSgpLmdldFRpbWUoKTt2W25dPXQsT2JqZWN0LmtleXModikuZmlsdGVyKHM9PnQtdltzXT5vZSkuZm9yRWFjaChzPT57ZGVsZXRlIHZbc10sZGVsZXRlIElbc119KSxNKCl9ZnVuY3Rpb24gTigpe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybShuLHQpe2lmKG4gaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3Qgcz1uLmdldE1ldGFkYXRhKCkuc3luY2hyb25pemF0aW9uU291cmNlO2lmKGFlKHMpLCFJLmluY2x1ZGVzKHMpJiZiLmxlbmd0aCl0cnl7aWYoIS8oaDI2WzRdKS8udGVzdCh5KSl0aHJvdyBuZXcgRXJyb3IoIlNlbmRpbmcgbWV0YWRhdGEgaXMgbm90IHN1cHBvcnRlZCB3aXRoIGFueSBvdGhlciBjb2RlYyBvdGhlciB0aGFuIEguMjY0Iik7YlswXS51dWlkPT09TCYmKGJbMF0udGltZWNvZGU9RGF0ZS5ub3coKSksaWUoYlswXSxuKSxJLnB1c2gocyl9Y2F0Y2gocil7Y29uc29sZS5lcnJvcihyKX1maW5hbGx5e00oKX19dC5lbnF1ZXVlKG4pfX0pfWZ1bmN0aW9uIGsoe3JlYWRhYmxlOm4sd3JpdGFibGU6dH0sZSl7bi5waXBlVGhyb3VnaChlKS5waXBlVG8odCl9YWRkRXZlbnRMaXN0ZW5lcigicnRjdHJhbnNmb3JtIixuPT57bGV0IHQ7aWYobi50cmFuc2Zvcm1lci5vcHRpb25zLm5hbWU9PT0ic2VuZGVyVHJhbnNmb3JtIil5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlYyx0PU4oKTtlbHNlIGlmKG4udHJhbnNmb3JtZXIub3B0aW9ucy5uYW1lPT09InJlY2VpdmVyVHJhbnNmb3JtIilQPW4udHJhbnNmb3JtZXIub3B0aW9ucy5wYXlsb2FkVHlwZUNvZGVjfHx7fSx5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlY3x8IiIsdD1IKG4udHJhbnNmb3JtZXIub3B0aW9ucy5taWQpO2Vsc2UgcmV0dXJuO2sobi50cmFuc2Zvcm1lcix0KX0pLGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLG49Pntjb25zdHthY3Rpb246dH09bi5kYXRhO3N3aXRjaCh0KXtjYXNlImluc2VydGFibGUtc3RyZWFtcy1zZW5kZXIiOnk9bi5kYXRhLmNvZGVjLGsobi5kYXRhLE4oKSk7YnJlYWs7Y2FzZSJpbnNlcnRhYmxlLXN0cmVhbXMtcmVjZWl2ZXIiOlA9bi5kYXRhLnBheWxvYWRUeXBlQ29kZWN8fHt9LHk9bi5kYXRhLmNvZGVjfHwiIixrKG4uZGF0YSxIKG4uZGF0YS5taWQpKTticmVhaztjYXNlIm1ldGFkYXRhLXNlaS11c2VyLWRhdGEtdW5yZWdpc3RlcmVkIjpiLnB1c2goe3V1aWQ6bi5kYXRhLnV1aWQscGF5bG9hZDpuLmRhdGEucGF5bG9hZH0pO2JyZWFrfX0pfSkoKTsK",Ei=typeof self<"u"&&self.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(Ri)],{type:"text/javascript;charset=utf-8"});function ki(e){let t;try{if(t=Ei&&(self.URL||self.webkitURL).createObjectURL(Ei),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker("data:text/javascript;base64,"+Ri,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}function Ii(e){if(!e)return new Uint8Array;const t=e.length,n=new Uint8Array(t/2);for(let r=0;r<t;r+=2)n[r/2]=parseInt(e.substr(r,2),16);return n}function Ci(e,t,n){if(Object.prototype.hasOwnProperty.call(e,n)&&Object.prototype.hasOwnProperty.call(t,n)){const r=e[n];e[n]=t[n],t[n]=r}else console.error('One or both objects do not have the property "'.concat(n,'"'))}function xi(e,t,n,r){return new(n||(n=Promise))(function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((r=r.apply(e,t||[])).next())})}St.get("Publish");const Ti=Ai;function Ai(e,t){const n=Vi();return(Ai=function(e,t){return n[e-=257]})(e,t)}var Li;!function(){const e=Ai,t=Vi();for(;;)try{if(parseInt(e(266))/1*(-parseInt(e(261))/2)+parseInt(e(258))/3*(-parseInt(e(264))/4)+-parseInt(e(267))/5*(parseInt(e(274))/6)+parseInt(e(260))/7*(parseInt(e(268))/8)+parseInt(e(270))/9+-parseInt(e(277))/10+parseInt(e(263))/11==303379)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Pi=navigator&&navigator[Ti(276)]||"",Oi=navigator&&navigator.vendor||"",Ni=!(null==window||!window[Ti(273)]),Mi=Pi[Ti(278)](Ti(257)),Di=!Mi&&Oi[Ti(278)](Ti(259)),Fi=!Mi&&!Di&&Pi.includes(Ti(272)),Ui=!Mi&&!Di&&!Fi&&Pi[Ti(278)](Ti(275)),ji=(null===(Li=null==navigator?void 0:navigator[Ti(262)])||void 0===Li?void 0:Li[Ti(271)])||(null==navigator?void 0:navigator[Ti(271)])||"";function Vi(){const e=["2403660vsbxKa","includes","Firefox","653511krAkNS","Apple","63eEorAu","2iQvmqu","userAgentData","13393182jRLBxS","4fTXBZP","Win32","74923SyWRbn","1345hVdNEb","21688LwGppn","Windows","132498ZoOcLo","platform","Edg","RTCRtpScriptTransform","9372dNMWWf","Chrome","userAgent"];return(Vi=function(){return e})()}const Wi={supportsRtpScriptTransform:Ni,isFirefox:Mi,isSafari:Di,isEdge:Fi,isChrome:Ui,platform:ji,isWindows:ji===Ti(269)||ji===Ti(265)},Zi=Gi;function Gi(e,t){const n=zi();return(Gi=function(e,t){return n[e-=185]})(e,t)}!function(){const e=Gi,t=zi();for(;;)try{if(-parseInt(e(380))/1+-parseInt(e(354))/2+-parseInt(e(464))/3*(parseInt(e(486))/4)+-parseInt(e(253))/5+parseInt(e(377))/6+parseInt(e(321))/7*(-parseInt(e(285))/8)+-parseInt(e(444))/9*(-parseInt(e(279))/10)==657542)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Bi=Wi[Zi(496)];function Yi(e,t){const n=Zi;let r=new Uint8Array((0|e.byteLength)+(0|t[n(442)]));return r[n(311)](e,0),r[n(311)](t,0|e.byteLength),r}function zi(){const e=["[MSE] source buffer error","ManagedMediaSource","BYTES_PER_ELEMENT","types","ready","valid","Num frames in chunk: ","readBits","getTrackID","mvhd","parsePPS","encrypted","dependsOn","payload","len","moov","VMHD","mse","volume","h264","setUint16","tfdt","nextDts","avc1.","audioSampleAuxInfo","message","endMSE","width","hdlr","warn","traf","readBoolean","shift","mseReady","revokeObjectURL","smhd","dts","indexOf","<PROTECTINFO>","webkitsourceclose","onMSEClose","[H264Parser] IDR without SPS/PPS, not suitable for recovery",'VALUE="',"createObjectURL","</KID>","mdhd","SMHD","getFramePayload","tkhd","flush","clRtcDrmDebugLog","getBits","2598770DahMdb","dbgQueue","dispatch","DINF","http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader","isReady","sps","nalus","endOfStream","toString","UNKNOWN","Opus","minf","onError","stco","STSC","buffered","</KIDS>","initSegment","dinf","org.w3.clearkey","mp4track","keyFrame","units","mseEnded","videoSampleAuxInfo","41695210Plpuuo","splice","ended","bitLength","seq","url","8YyaFaO","com.apple.fps","[MSE] error: ","bitsAvailable","</WRMHEADER>","trex","setData","buffer error","slice","length","readUByte","mp4a","Unsupported DRM type ","mdia","fromCharCode",'<WRMHEADER xmlns="',"index","string","both","NDR","dOps","cenc","getPayload","bind","PPS","sourceBuffer","set","Checking codec","releaseBuffer","tenc","trak","flags",'/mp4; codecs="',"[H264Parser] Both IDR and non-IDR VCL NALUs found in the same frame","clRtcDrmCreateMediaDump","STSD","6352549TgZLxu","initBrowser","IDR","trun"," - ","start","mediaSource","startsWith","stype","readSPS","addEventListener","schi","encv","createElement","getVideoFrames","onReady","href","sourceopen","setUint32","vmhd","FTYP","schm","getData","toISOString","remuxer","track","skipScalingList","STSZ","getSize","addSourceBuffer","[MSE] buffer error:","appendBufferError","off","2392886zJoPkf","destroy","sdtp","audiosamplerate",": NRI: ","reportDiscontinuity","extractNALUs","No A/V data","pps","senc","saio","concat","config","ftyp","parseNAL","esds","error","feed","Browser does not support codec","4.3.0.0","skipUEG","mp4","end","2232924PKvVOf","updating","options","227868XbMqAn","prototype","createBuffer","info","MediaSource","timestamp","mvex","isfmb","opus","max","stsz","POSITIVE_INFINITY","saiz","timescale","call","encryption","height","jmuxer","bufferControllers","open","patchSampleAuxinfo","queue","stsd","onBufferError","frameCounter","ntype","remux","getPayloadSize","isSupported","</LA_URL>","waitingForIdr","box","idr"," samples - expected 1","tracks","stbl","getNri",'<KID ALGID="AESCTR" ',"download","readUInt","join","com.microsoft.playready.recommendation",'" version="',"remuxController","Received ","frma","resetTrack","disableRemotePlayback","</DATA>","mfhd","pssh","charCodeAt","drm","mediaDuration","video","readyToDecode","from","SPS","skipLZ","data","keySystem","[MSE] sourceclose","byteLength","STTS","9mESMVl","Buffered range ","samples","byteOffset","parseHeader","codec","node","audio","Failure: Browser doesn't support MSE/MMS","subarray","replaceAll","downloadToFile","onBuffer","skipBits","mdat","isKeyframe","moof","mode","push","STCO","9ffcUcC","listener","isReset","map","enca","type","<LA_URL>","parseSPS","getElementById","no video element were found to render, provide a valid video element","sinf","doAppend","HDLR_TYPES","videoElement","stts","keyId","trackTypes","TYPES","remove","size","AUD","src","1376748eVkTXq","min","tfhd","initialized","offAll","appendBuffer","buffer","nri","skipEG","isvcl","isSafari","isTypeSupported","readyState","abort","apply","reduce","assign","calculateExpectedSizeFromSai","duration","generatePlayReadyHeader","readUEG","onMSEOpen","sampleAuxInfo","SEI","irrecoverableError","channelCount","saiIvSize","stsc"];return(zi=function(){return e})()}function Xi(e,t=0,n=1/0){return((e,t,n,r)=>{const s=Zi,i=r[s(203)]||1;t*=i,n*=i;const o=(l=e)instanceof ArrayBuffer?l:l[Zi(492)],a=(e[s(447)]||0)+e[s(442)],c=(e[s(447)]||0)+t;var l;let u=Math[s(389)](0,Math[s(487)](c,a)),d=Math[s(487)](u+Math[s(389)](n,0),a);return u/=i,d/=i,new r(o,u,d-u)})(e,t,n,Uint8Array)}function Ki(e){const t=Zi,n=Array[t(436)](e)[t(467)](e=>e[t(431)](0));return new Uint8Array(n)}window[Zi(455)]=(e,t,n="application/octet-stream")=>{const r=Zi,s=document[r(334)]("a"),i=new Blob([e],{type:n});s[r(337)]=URL[r(244)](i),s[r(418)]=t,s.click(),URL[r(235)](s[r(337)])};class ce{static get[Zi(304)](){return 1}static get[Zi(323)](){return 5}static get[Zi(196)](){return 6}static get SPS(){return 7}static get PPS(){return 8}static get[Zi(484)](){return 9}static get[Zi(481)](){const e=Zi;return{[ce[e(323)]]:e(323),[ce.SEI]:e(196),[ce.SPS]:e(437),[ce[e(309)]]:e(309),[ce[e(304)]]:e(304),[ce[e(484)]]:e(484)}}static type(e){const t=Zi;return e[t(405)]in ce[t(481)]?ce[t(481)][e[t(405)]]:t(263)}constructor(e){const t=Zi;this.payload=e,this[t(493)]=(96&this.payload[0])>>5,this[t(405)]=31&this[t(214)][0],this[t(495)]=1==this.ntype||5==this[t(405)],this[t(329)]="",this[t(387)]=!1}toString(){const e=Zi;return ce[e(469)](this)+e(358)+this[e(416)]()}getNri(){return this[Zi(493)]}[Zi(469)](){return this[Zi(405)]}[Zi(459)](){const e=Zi;return this[e(405)]===ce[e(323)]}[Zi(307)](){return this[Zi(214)]}[Zi(407)](){const e=Zi;return this[e(214)][e(442)]}getSize(){return 4+this[Zi(407)]()}[Zi(343)](){const e=Zi,t=new Uint8Array(this.getSize());return new DataView(t.buffer)[e(339)](0,this.getSize()-4),t[e(311)](this[e(307)](),4),t}}class ps{constructor(e){const t=Zi;this[t(439)]=e,this[t(301)]=0,this.bitLength=8*e[t(442)]}[Zi(291)](e){const t=Zi;this.data=e,this[t(301)]=0,this[t(282)]=8*e[t(442)]}get[Zi(288)](){const e=Zi;return this[e(282)]-this[e(301)]}skipBits(e){if(this[Zi(288)]<e)return!1;this.index+=e}[Zi(208)](e,t=!0){return this.getBits(e,this.index,t)}[Zi(252)](e,t,n=!0){const r=Zi;if(this.bitsAvailable<e)return 0;const s=t%8,i=this[r(439)][t/8|0]&255>>>s,o=8-s;if(o>=e)return n&&(this.index+=e),i>>o-e;{n&&(this.index+=o);const s=e-o;return i<<s|this[r(252)](s,t+o,n)}}[Zi(438)](){const e=Zi;let t;for(t=0;t<this.bitLength-this[e(301)];++t)if(0!==this.getBits(1,this[e(301)]+t,!1))return this.index+=t,t;return t}[Zi(374)](){const e=Zi;this[e(457)](1+this[e(438)]())}[Zi(494)](){const e=Zi;this[e(457)](1+this[e(438)]())}readUEG(){const e=Zi,t=this[e(438)]();return this[e(208)](t+1)-1}readEG(){const e=this[Zi(193)]();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this[Zi(208)](1)}[Zi(295)](e=1){return this[Zi(208)](8*e)}readUShort(){return this[Zi(208)](16)}[Zi(419)](){return this[Zi(208)](32)}}class rt{static[Zi(360)](e,t){const n=Zi;let r=[],s=!1,i=!1,o=!1,a=!1,c=0,l=0,u=0,d=[];for(;c<=e.byteLength;){if(c<e.byteLength){const t=e[c++];0!==t?(1===t&&l>1&&(u=l>2?4:3,d.push(c)),l=0):++l}else u=0,d.push(c++);if(d.length>1){const n=d.shift(),p=d[0]-u;if(n<p){let u=!1;const d=31&e[n];if(d===ce.NDR?i=!0:d===ce.IDR?s=!0:d===ce.SPS?(u=o,o=!0):d===ce.PPS&&(u=a,a=!0),!u)if(!t||d!==ce.NDR&&d!==ce.IDR)r.push(e.subarray(n,p));else{const t=new Uint8Array(p-n);let s=0;for(c=n,l=0;c<p;){let n=e[c++];l>1&&3===n&&(l=0,n=e[c++]),0!==n?l=0:++l,t[s++]=n}r.push(t.subarray(0,s))}}}}let p=!0,f=!1;return i||s?i&&s&&(console[n(230)](n(318)),p=!1):(console[n(230)]("[H264Parser] No VCL NALUs found"),p=!1),s&&(o&&a?f=!0:console[n(230)](n(242))),{valid:p,idr:f,nalus:r}}static skipScalingList(e,t){let n,r=8,s=8;for(let i=0;i<t;i++)0!==s&&(n=e.readEG(),s=(r+n+256)%256),r=0===s?r:s}static[Zi(330)](e){const t=Zi;let n,r,s,i,o,a,c=new ps(e),l=0,u=0,d=0,p=0,f=1;if(c[t(295)](),n=c.readUByte(),c[t(208)](5),c[t(457)](3),c.readUByte(),c[t(374)](),100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n){var h=c[t(193)]();if(3===h&&c[t(457)](1),c.skipUEG(),c[t(374)](),c[t(457)](1),c[t(232)]()){a=3!==h?8:12;for(let e=0;e<a;++e)c[t(232)]()&&(e<6?rt[t(347)](c,16):rt[t(347)](c,64))}}c[t(374)]();var m=c.readUEG();if(0===m)c[t(193)]();else if(1===m){c.skipBits(1),c[t(494)](),c[t(494)](),r=c[t(193)]();for(let e=0;e<r;++e)c.skipEG()}if(c.skipUEG(),c[t(457)](1),s=c[t(193)](),i=c.readUEG(),o=c[t(208)](1),0===o&&c[t(457)](1),c[t(457)](1),c[t(232)]()&&(l=c[t(193)](),u=c[t(193)](),d=c[t(193)](),p=c.readUEG()),c.readBoolean()){if(c[t(232)]()){let e;switch(c[t(295)]()){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[c[t(295)]()<<8|c.readUByte(),c[t(295)]()<<8|c[t(295)]()]}e&&e[0]>0&&e[1]>0&&(f=e[0]/e[1])}c.readBoolean()&&c[t(457)](1),c[t(232)]()&&(c.skipBits(4),c[t(232)]()&&c[t(457)](24)),c.readBoolean()&&(c.skipUEG(),c[t(374)]()),c.readBoolean()&&(c[t(419)](),c[t(419)](),c.readBoolean())}return{width:Math.ceil((16*(s+1)-2*l-2*u)*f),height:(2-o)*(i+1)*16-(o?2:4)*(d+p)}}static[Zi(448)](e){const t=Zi;let n=new ps(e[t(307)]());n.readUByte(),e.isfmb=0===n[t(193)](),e.stype=n[t(193)]()}constructor(e){const t=Zi;this.remuxer=e,this[t(346)]=e[t(274)]}[Zi(471)](e){const t=Zi;var n=rt[t(330)](new Uint8Array(e));this[t(346)][t(228)]=n[t(228)],this[t(346)][t(396)]=n[t(396)],this[t(346)].sps=[new Uint8Array(e)],this[t(346)][t(449)]=t(224);let r=new DataView(e.buffer,e[t(447)]+1,4);for(let e=0;e<3;++e){var s=r.getUint8(e)[t(262)](16);s.length<2&&(s="0"+s),this.track[t(449)]+=s}}[Zi(211)](e){this[Zi(346)].pps=[new Uint8Array(e)]}[Zi(368)](e){const t=Zi;if(!e)return!1;let n=!1;switch(e.type()){case ce[t(323)]:case ce[t(304)]:n=!0;break;case ce[t(309)]:!this[t(346)][t(362)]&&(this.parsePPS(e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this[t(346)][t(259)]&&(this[t(345)][t(435)]=!0)),n=!0;break;case ce[t(437)]:!this[t(346)][t(259)]&&(this[t(471)](e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this.track.sps&&(this[t(345)][t(435)]=!0)),n=!0;break;case ce[t(484)]:break;case ce[t(196)]:n=!0}return n}}class _n{constructor(e){const t=Zi;this[t(465)]={},this[t(469)]=""|e}on(e,t){const n=Zi;return!this[n(465)][e]&&(this[n(465)][e]=[]),this[n(465)][e][n(462)](t),!0}[Zi(353)](e,t){const n=Zi;if(this[n(465)][e]){var r=this.listener[e][n(238)](t);return r>-1&&this[n(465)][e][n(280)](r,1),!0}return!1}[Zi(490)](){this[Zi(465)]={}}[Zi(255)](e,t){const n=Zi;return!!this.listener[e]&&(this[n(465)][e][n(467)](e=>{e[n(187)](null,[t])}),!0)}}class F{constructor(e){var t,n;const r=Zi;this[r(432)]=e,this[r(199)]={video:(null==(t=e[r(366)][r(434)])?void 0:t.encryption)===r(306)?16:0,audio:(null==(n=e[r(366)][r(451)])?void 0:n.encryption)===r(306)?16:0},F.types={avc1:[],encv:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],Opus:[],dOps:[],enca:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pssh:[],sinf:[],frma:[],schm:[],schi:[],tenc:[],saiz:[],saio:[],senc:[]};for(let e in F[r(204)])F[r(204)][e]=[e[r(431)](0),e[r(431)](1),e.charCodeAt(2),e[r(431)](3)];const s=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F[r(476)]={video:s,audio:i};const o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);F[r(443)]=F[r(268)]=F[r(463)]=a,F[r(348)]=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F[r(217)]=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F[r(320)]=new Uint8Array([0,0,0,0,0,0,0,1]);const c=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);F[r(341)]=F[r(411)](F[r(204)][r(367)],c,u,c,l),F.DINF=F[r(411)](F[r(204)][r(272)],F[r(411)](F[r(204)].dref,o))}static[Zi(411)](e,...t){const n=Zi;let r,s=8,i=t.length,o=i;for(;i--;)t[i]&&(s+=t[i].byteLength);for(r=new Uint8Array(s),r[0]=s>>>24,r[1]=s>>>16&255,r[2]=s>>>8&255,r[3]=255&s,r[n(311)](e,4),i=0,s=8;i<o;++i)t[i]&&(r[n(311)](t[i],s),s+=t[i][n(442)]);return r}hdlr(e){const t=Zi;return F[t(411)](F[t(204)][t(229)],F[t(476)][e])}mdat(e){const t=Zi;return F.box(F.types[t(458)],e)}[Zi(246)](e,t){const n=Zi;return F.box(F[n(204)][n(246)],new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,0,0,0,0,85,196,0,0]))}[Zi(298)](e){const t=Zi;return F[t(411)](F[t(204)][t(298)],this[t(246)](e[t(393)],e.duration),this[t(229)](e[t(469)]),this[t(265)](e))}[Zi(429)](e){const t=Zi;return F[t(411)](F.types[t(429)],new Uint8Array([0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[Zi(265)](e){const t=Zi;return e[t(469)]===t(451)?F[t(411)](F[t(204)][t(265)],F.box(F[t(204)][t(236)],F[t(247)]),F.DINF,this[t(415)](e)):F[t(411)](F[t(204)][t(265)],F[t(256)],this[t(415)](e),F[t(411)](F[t(204)][t(340)],F[t(217)]))}[Zi(460)](e,t,n){const r=Zi;return F[r(411)](F[r(204)][r(460)],this[r(429)](e),this.traf(n,t))}moov(e,t,n){const r=Zi;let s=e[r(294)],i=[];for(;s--;)i[s]=this[r(315)](e[s]);return F[r(411)][r(187)](null,[F[r(204)].moov,this[r(210)](n,t),this[r(430)](e)].concat(i)[r(365)](this[r(386)](e)))}mvex(e){const t=Zi;let n=e[t(294)],r=[];for(;n--;)r[n]=this[t(290)](e[n]);return F.box[t(187)](null,[F[t(204)].mvex].concat(r))}[Zi(210)](e,t){const n=Zi;let r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,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,255,255,255,255]);return F[n(411)](F[n(204)].mvhd,r)}[Zi(356)](e){const t=Zi;let n=e[t(446)]||[],r=new Uint8Array(4+n.length);for(let e=0;e<n.length;e++){const s=n[e][t(316)];r[e+4]=s[t(213)]<<4|s.isDependedOn<<2|s.hasRedundancy}return F.box(F.types.sdtp,r)}[Zi(415)](e){const t=Zi;return F[t(411)](F.types[t(415)],this[t(402)](e),F.box(F.types[t(478)],F[t(443)]),F.box(F.types[t(200)],F[t(268)]),F[t(411)](F[t(204)][t(390)],F[t(348)]),F[t(411)](F[t(204)][t(267)],F[t(463)]))}[Zi(333)](e){const t=Zi;let n,r,s,i=[],o=[];for(n=0;n<e[t(259)][t(294)];n++)r=e[t(259)][n],s=r[t(442)],i.push(s>>>8&255),i[t(462)](255&s),i=i[t(365)](Array[t(381)].slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],s=r[t(442)],o.push(s>>>8&255),o[t(462)](255&s),o=o[t(365)](Array[t(381)][t(293)][t(394)](r));const a=F[t(411)](F[t(204)].avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e[t(259)][t(294)]][t(365)](i)[t(365)]([e[t(362)].length]).concat(o))),c=e[t(228)],l=e[t(396)],u=F[t(411)](F[t(204)][t(474)],F[t(411)](F.types[t(425)],new Uint8Array([97,118,99,49])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...Ki(this[t(432)][t(366)].video[t(395)]),0,1,0,0])),F[t(411)](F[t(204)].schi,this[t(314)]("video")));return F[t(411)](F[t(204)][t(333)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>>8&255,255&c,l>>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,65,86,67,32,67,111,100,105,110,103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]),a,u)}[Zi(369)](e){const t=Zi;let n=e.config[t(442)],r=new Uint8Array(26+n+3);return r[t(311)]([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5,n]),r[t(311)](e[t(366)],26),r[t(311)]([6,1,2],26+n),r}[Zi(296)](e){const t=Zi,n=e.audiosamplerate;return F[t(411)](F[t(204)][t(296)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,n>>>8&255,255&n,0,0]),F[t(411)](F[t(204)][t(369)],this.esds(e)))}dOps(e){const t=Zi,n=e[t(357)];return new Uint8Array([0,e[t(198)],1,56,0,0,n>>>8&255,255&n,0,0,0])}[Zi(264)](e){const t=Zi,n=e[t(357)];return F[t(411)](F[t(204)].Opus,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,n>>>8&255,255&n,0,0]),F[t(411)](F.types[t(305)],this[t(305)](e)))}[Zi(468)](e){const t=Zi,n=F[t(411)](F[t(204)].dOps,this[t(305)](e)),r=F[t(411)](F[t(204)].sinf,F[t(411)](F[t(204)].frma,new Uint8Array([79,112,117,115])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...Ki(this.drm[t(366)].audio[t(395)]),0,1,0,0])),F[t(411)](F[t(204)][t(332)],this[t(314)](t(451)))),s=e[t(357)];return F[t(411)](F[t(204)][t(468)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,s>>>8&255,255&s,0,0]),n,r)}[Zi(402)](e){const t=Zi;return e[t(469)]===t(451)?F.box(F[t(204)][t(402)],F[t(320)],e[t(212)]?this[t(468)](e):this[t(264)](e)):F.box(F[t(204)][t(402)],F[t(320)],this.encv(e))}[Zi(249)](e){const t=Zi,n=e.id,r=e[t(191)],s=e.width,i=e[t(396)],o=e[t(219)];return F[t(411)](F[t(204)][t(249)],new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,0,r>>>24,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,255&o,o%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,i>>>8&255,255&i,0,0]))}[Zi(231)](e,t){var n;const r=Zi,s=e.id,i=e[r(446)][0][r(483)],o=e[r(446)][0][r(191)],a=e[r(446)][0].flags,c=F[r(411)](F[r(204)][r(488)],new Uint8Array([0,2,0,58,s>>>24,s>>>16&255,s>>>8&255,255&s,0,0,0,1,o>>>24,s>>>16&255,o>>>8&255,255&o,i>>>24,i>>>16&255,i>>>8&255,255&i,0,a.isNonSync,0,0])),l=F[r(411)](F[r(204)][r(222)],new Uint8Array([0,0,0,0,t>>>24,t>>>16&255,t>>>8&255,255&t]));if(e[r(212)]){let t,s;if(e[r(469)]===r(434)?(t=!0,s=this[r(199)][r(434)]+(null==(n=e[r(446)][0].sampleAuxInfo)?void 0:n.byteLength)):(t=!1,s=this[r(199)][r(451)]),s>0){const n=this[r(392)](s),i=this[r(363)](e[r(446)],t),o=n.length+20+i.length+c[r(294)]+l[r(294)]+8+16+8+8,a=this[r(324)](e,o);return F[r(411)](F[r(204)][r(231)],c,l,a,n,this[r(364)](o-i[r(294)]+a[r(294)]+8),i)}{const t=this[r(363)](null,!1),n=t[r(294)]+c[r(294)]+l.length+8+16+8+8,s=this[r(324)](e,n);return F[r(411)](F[r(204)][r(231)],c,l,s,t)}}return F.box(F.types.traf,c,l,this[r(324)](e,c[r(294)]+l[r(294)]+8+16+8+8))}[Zi(315)](e){const t=Zi;return e[t(191)]=e[t(191)]||4294967295,F.box(F[t(204)][t(315)],this[t(249)](e),this[t(298)](e))}trex(e){const t=Zi,n=e.id;return F[t(411)](F[t(204)][t(290)],new Uint8Array([0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,16,0,0,0,0,0,0,0,0]))}trun(e,t){const n=Zi;let r=(e.samples||[]).length,s=new Uint8Array(12);return t+=20,s[n(311)]([0,0,0,1,r>>>24,r>>>16&255,r>>>8&255,255&r,t>>>24,t>>>16&255,t>>>8&255,255&t],0),F.box(F.types[n(324)],s)}[Zi(192)](e,t){const n=Zi,r=n(373),s=n(257),i=function(e){const t=function(e){const t=Zi;let n="";for(let r=0;r<e.length;r+=16e3){const s=e[t(453)](r,r+16e3);n+=String[t(299)][t(187)](null,s)}return n}(Xi(e));return btoa(t)}(function(e){const t=Zi,n=[];return n[t(462)](e[3]),n[t(462)](e[2]),n[t(462)](e[1]),n[t(462)](e[0]),n.push(e[5]),n.push(e[4]),n.push(e[7]),n.push(e[6]),(e=Xi(e))[t(311)](n,0),e}(e));return Xi(function(e){const t=Zi,n=new Uint8Array(2*e.length),r=new DataView(n[t(492)]);for(let n=0;n<e[t(294)];++n){const s=e[t(431)](n);r[t(221)](2*n,s,true)}return n[t(492)]}([n(300)+s+n(422)+r+'">',"<DATA>",n(239),"<KIDS>",n(417),n(243)+i+'"',">",n(245),n(270),"</PROTECTINFO>",t?n(470)+t+n(409):"",n(428),n(289)][n(420)]("")))}[Zi(430)](e){const t=Zi;if(this[t(432)][t(440)][t(328)]("com.widevine"))return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237,0,0,0,18,18,16,...this[t(432)][t(366)][e[0][t(469)]][t(479)]]));if(this[t(432)].keySystem===t(421)){const n=this[t(192)](this[t(432)][t(366)][e[0].type][t(479)],this.drm.licenseUrl),r=n[t(442)];return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149,r>>>24,r>>>16&255,r>>>8&255,255&r,...n]))}return this[t(432)][t(440)]===t(273)?F[t(411)](F[t(204)][t(430)],new Uint8Array([1,0,0,0,16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75,0,0,0,1,...this.drm.config[e[0][t(469)]][t(479)],0,0,0,0])):this[t(432)][t(440)]===t(286)?null:void console[t(370)](t(297)+this[t(432)].keySystem)}[Zi(314)](e){const t=Zi;let n,r,s=this[t(432)][t(366)][e];return"cbcs"===s.encryption?(n=new Uint8Array([16,...s.iv]),r=25):(n=new Uint8Array([]),r=0),F[t(411)](F[t(204)].tenc,new Uint8Array([1,0,0,0,0,r,1,this[t(199)][e],...s[t(479)],...n]))}[Zi(392)](e){return F[Zi(411)](F.types.saiz,new Uint8Array([0,0,0,0,e,0,0,0,1]))}[Zi(364)](e){const t=Zi;return F[t(411)](F[t(204)][t(364)],new Uint8Array([0,0,0,0,0,0,0,1,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[Zi(363)](e,t){const n=Zi;let r=null;return e&&(1!==e[n(294)]&&console[n(370)](n(424)+e[n(294)]+n(413)),r=e[0][n(195)]),r&&r[n(442)]?F[n(411)](F[n(204)][n(363)],new Uint8Array([0,0,0,t?2:0,0,0,0,1,...r])):F[n(411)](F[n(204)][n(363)],new Uint8Array([0,0,0,0,0,0,0,1]))}[Zi(271)](e,t,n){const r=Zi,s=this[r(216)](e,t,n);let i=new Uint8Array(F[r(341)][r(442)]+s.byteLength);return i.set(F[r(341)]),i[r(311)](s,F[r(341)].byteLength),i}}let $i=1;class yr{constructor(){this[Zi(283)]=1}static[Zi(209)](){return $i++}[Zi(250)](){const e=Zi;this[e(274)][e(215)]=0,this.mp4track[e(446)]=[]}[Zi(258)](){const e=Zi;return!(!this.readyToDecode||!this[e(446)][e(294)])}}class Ea extends yr{constructor(e){const t=Zi;super(),this[t(435)]=!0,this[t(223)]=0,this[t(237)]=0,this[t(274)]={id:yr[t(209)](),type:"audio",channelCount:2,audiosamplerate:48e3,len:0,fragmented:!0,timescale:e,duration:e,samples:[],codec:t(388),encrypted:!0},this[t(446)]=[]}resetTrack(){const e=Zi;this[e(283)]=1,this[e(223)]=0,this[e(237)]=0}[Zi(406)](e,t,n){const r=Zi;if(e.length>0)for(let s=0;s<e[r(294)];s++){let i=e[s],o=i[r(276)],a=o[r(442)];this.samples.push({units:o,size:a,duration:i.duration,sampleAuxInfo:t,timestamp:n}),this[r(274)][r(215)]+=a}}[Zi(248)](){const e=Zi;if(!this[e(446)])return null;let t,n=this[e(274)][e(446)];for(;this.samples[e(294)];){let r=this[e(446)][e(233)](),s=(1e3*r[e(385)]|0)-this.nextDts|0;s<5&&(s=5),this.dts=this.nextDts,this[e(223)]+=s,t={size:r.size,duration:s,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1},sampleAuxInfo:r[e(195)]};let i=new Uint8Array(r.size);return i[e(311)](r.units,0),n.push(t),new Uint8Array(i.buffer,0,r[e(483)])}return null}}class _a extends yr{constructor(e,t){const n=Zi;super(),this[n(435)]=!1,this.nextDts=0,this[n(237)]=0,this[n(477)]=t,this.mp4track={id:yr[n(209)](),type:n(434),len:0,fragmented:!0,sps:"",pps:"",width:0,height:0,timescale:e,duration:e,samples:[],encrypted:!0},this[n(446)]=[],this[n(220)]=new rt(this)}[Zi(426)](){const e=Zi;this[e(283)]=1,this.readyToDecode=!1,this[e(274)].sps="",this[e(274)][e(362)]="",this[e(223)]=0,this[e(237)]=0}[Zi(406)](e,t,n){const r=Zi;for(let s of e){let e=[],i=0;for(let t of s[r(276)])this.h264[r(368)](t)&&(e[r(462)](t),i+=t.getSize());e[r(294)]>0&&this[r(435)]&&(this[r(274)][r(215)]+=i,this[r(446)][r(462)]({units:e,size:i,keyFrame:s.keyFrame,duration:s[r(191)],sampleAuxInfo:t,timestamp:n}))}}[Zi(248)](){const e=Zi;if(!this[e(258)]()||!this.samples)return null;let t,n=this[e(274)][e(446)],r=this.samples[e(233)](),s=r[e(276)],i=(1e3*r.timestamp|0)-this[e(223)]|0;i<5&&(i=5),window[e(251)]&&i>5e3&&console[e(383)]("timestamp gap: "+(i/1e3|0)+" s"),this[e(237)]=this[e(223)],this.nextDts+=i,t={size:r[e(483)],duration:i,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:r[e(275)]?0:1,dependsOn:r.keyFrame?2:1},sampleAuxInfo:r[e(195)]};let o=0;for(const t of s)o+=t[e(349)]();let a=0,c=new Uint8Array(o);for(const t of s)c[e(311)](t[e(343)](),a),a+=t[e(349)]();return n[e(462)](t),new Uint8Array(c[e(492)],0,o)}}class Ta extends _n{constructor(e,t){const n=Zi;super(n(345)),this.initialized=!1,this.trackTypes=[],this[n(414)]={},this[n(393)]=1e3,this.mediaDuration=0,this[n(477)]=e,this[n(375)]=t}addTrack(e){const t=Zi;(e===t(434)||"both"===e)&&(this[t(414)][t(434)]=new _a(this[t(393)],this.videoElement),this[t(480)][t(462)](t(434))),(e===t(451)||e===t(303))&&(this[t(414)][t(451)]=new Ea(this.timescale),this[t(480)][t(462)](t(451)))}reset(){const e=Zi;for(let t of this[e(480)])this[e(414)][t][e(426)]();this[e(489)]=!1}[Zi(355)](){const e=Zi;this[e(414)]={},this[e(490)]()}[Zi(250)](){const e=Zi;if(this[e(489)])for(let t of this[e(480)]){let n=this[e(414)][t];for(;;){let r=n.getFramePayload();if(!r||!r[e(442)])break;let s={type:t,payload:Yi(this[e(375)][e(460)](n[e(283)]++,n[e(237)],n[e(274)]),this[e(375)][e(458)](r)),dts:n[e(237)]};this[e(255)](e(492),s),n[e(250)]()}}else this[e(258)]()&&(this[e(255)](e(205)),this[e(271)](),this[e(489)]=!0,this[e(250)]())}initSegment(){const e=Zi;for(let t of this[e(480)]){let n=this[e(414)][t],r={type:t,payload:this[e(375)][e(271)]([n[e(274)]],this[e(433)],this[e(393)])};this.dispatch(e(492),r)}}isReady(){const e=Zi;for(let t of this.trackTypes)if(!this[e(414)][t][e(435)]||!this[e(414)][t].samples[e(294)])return!1;return!0}[Zi(406)](e){const t=Zi;for(let n of this[t(480)]){let r=e[n];r.length>0&&this[t(414)][n][t(406)](r,n===t(451)?e[t(225)]:e.videoSampleAuxInfo,e[t(385)])}this.flush()}}class Aa extends _n{constructor(e,t,n){const r=Zi;super(r(492)),this[r(469)]=t,this.queue=new Uint8Array,window[r(319)]&&(this[r(254)]=new Uint8Array,this[r(404)]=0),this.sourceBuffer=e,this[r(218)]=n,this[r(197)]=!1,this[r(310)].addEventListener(r(370),e=>{const t=r;console.warn(t(201),e,this.type),this[t(197)]=!0,this[t(255)](t(370),{type:this[t(469)],name:"buffer",error:t(292)})})}[Zi(355)](){const e=Zi;this[e(401)]=null,this[e(254)]=null;try{this.sourceBuffer&&(this[e(310)][e(186)](),this[e(218)].removeSourceBuffer(this[e(310)]),this[e(310)]=null)}catch(e){}this.offAll()}[Zi(475)](){const e=Zi;if(this.queue[e(294)]&&this[e(310)]&&!this[e(310)].updating){if(this[e(310)].buffered[e(294)]>1){for(let t=0;t<this[e(310)].buffered[e(294)];++t){const n=t<this[e(310)].buffered[e(294)]-1;window[e(251)]&&console[e(383)](e(445)+t+(n?" (remove)":"")+": "+this[e(310)][e(269)][e(326)](t)+e(325)+this[e(310)][e(269)][e(376)](t)),n&&this.sourceBuffer[e(482)](this[e(310)][e(269)].start(t),this[e(310)].buffered[e(376)](t))}if(this.sourceBuffer[e(378)])return}try{this[e(310)][e(491)](this[e(401)]),this.queue=new Uint8Array}catch(t){this[e(255)](e(370),{type:this[e(469)],name:e(352),error:t})}}}[Zi(371)](e){const t=Zi;if(this[t(254)]&&(this.dbgQueue=Yi(this[t(254)],e),100==++this[t(404)])){const e=(new Date)[t(344)]().substring(0,19)[t(454)](":","-"),n=this.type+"-"+e+".mp4";window.downloadToFile(this[t(254)],n),this[t(254)]=null}this[t(197)]||(this[t(401)]=Yi(this[t(401)],e)),this.doAppend()}}class Tn extends _n{static isSupported(e){const t=Zi;return window[t(202)]?window.ManagedMediaSource[t(497)](e):!!window[t(384)]&&window.MediaSource[t(497)](e)}constructor(e){const t=Zi;super(t(397)),this[t(197)]=!1,this[t(410)]=!0,this[t(466)]=!1,this[t(234)]=!1,this.mseEnded=!1,this[t(379)]=Object[t(189)]({},{node:"",mode:"video",debug:!1,onReady:function(){},onError:function(e){}},e),this[t(450)]=typeof this.options[t(450)]===t(302)?document[t(472)](this.options.node):this[t(379)].node,this[t(432)]=e.drm,this.mp4=new F(this.drm),this[t(423)]=new Ta(this.node,this[t(375)]),this[t(423)].addTrack(this[t(379)][t(461)]),this[t(423)].on(t(492),this[t(456)].bind(this)),this[t(423)].on(t(205),this[t(382)][t(308)](this)),this.initBrowser()}[Zi(322)](){const e=Zi;typeof this.options.node===e(302)&&""==this.options[e(450)]&&console[e(370)](e(473)),this[e(234)]=!1,this.setupMSE()}setupMSE(){const e=Zi;if(!window[e(202)]&&!window[e(384)])throw e(452);window.ManagedMediaSource?(this.node[e(427)]=!0,this[e(327)]=new ManagedMediaSource):this[e(327)]=new MediaSource,this[e(284)]=URL[e(244)](this[e(327)]),this.node[e(485)]=this[e(284)],this[e(277)]=!1,this[e(327)][e(331)](e(338),this.onMSEOpen[e(308)](this)),this.mediaSource.addEventListener("sourceclose",this[e(241)][e(308)](this)),this[e(327)][e(331)]("webkitsourceopen",this[e(194)][e(308)](this)),this.mediaSource[e(331)](e(240),this[e(241)].bind(this)),this[e(327)][e(331)]("error",function(t){const n=e;console[n(370)](n(287),t[n(226)])})}[Zi(227)](){const e=Zi;if(!this[e(277)])try{this.mseEnded=!0,this[e(327)][e(185)]===e(399)&&this[e(327)][e(261)]()}catch(t){console[e(370)]("mediasource is not available to end: ",t)}}[Zi(359)](){this[Zi(410)]=!0}[Zi(371)](e){const t=Zi;let n={video:[],audio:[]};if(this[t(197)]||this[t(277)]||!e||!this[t(423)])return-1;if(e[t(434)]){n.timestamp=e.timestamp;const r=this[t(190)](e.videoSampleAuxInfo,this.mp4[t(199)][t(434)]),s=r!=e[t(434)][t(442)];let i=rt[t(360)](e[t(434)],s);if(!i[t(206)]||i[t(260)].length<1)return 0;if(this.waitingForIdr){if(!i[t(412)])return 0;this[t(410)]=!1}if(!Bi&&e[t(278)]){const n=i[t(260)][t(188)]((e,n)=>e+4+n[t(442)],0);n!==r&&this[t(400)](e[t(278)],this.mp4[t(199)][t(434)],n-r)}n[t(434)]=this[t(335)](i[t(260)]),n[t(278)]=e[t(278)]}return e[t(451)]&&(n[t(385)]=e[t(385)],n[t(451)]=[{units:e.audio}],n.audioSampleAuxInfo=e[t(225)]),e[t(434)]||e[t(451)]?(this[t(423)][t(406)](n),0):(console.error(t(361)),0)}[Zi(335)](e){const t=Zi;let n=[],r=[],s=!1,i=!1;for(let o of e){let e=new ce(o);e.type()!==ce.IDR&&e[t(469)]()!==ce.NDR||rt[t(448)](e),n[t(294)]&&i&&(e[t(387)]||!e[t(495)])&&(r[t(462)]({units:n,keyFrame:s}),n=[],s=!1,i=!1),n[t(462)](e),s=s||e[t(459)](),i=i||e[t(495)]}if(n[t(294)])if(i)r[t(462)]({units:n,keyFrame:s});else{let e=r[t(294)]-1;e>=0&&(r[e].units=r[e][t(276)].concat(n))}return 1!==r[t(294)]&&console[t(230)](t(207)+r[t(294)]),r}[Zi(190)](e,t){const n=Zi;if(!e)return 0;const r=(e[0]<<8)+e[1],s=t+2+4;let i=0,o=2;for(;0<r&&o+s<=e[n(442)];){o+=t;const n=(e[o]<<8)+e[o+1],r=(e[o+2]<<24)+(e[o+3]<<16)+(e[o+4]<<8)+e[o+5];o+=6,i+=n+r}return i}patchSampleAuxinfo(e,t,n){const r=Zi;let s=2;if(0<(e[0]<<8)+e[1]&&s+(t+2+4)<=e[r(442)]){s+=t;let r=(e[s]<<8)+e[s+1];r+=n,r>=0&&(e[s]=r>>>8&255,e[s+1]=255&r)}return 0}[Zi(382)](){const e=Zi;if(this[e(234)]&&this[e(423)]&&this[e(423)].isReady()&&!this.bufferControllers){this.bufferControllers={};for(let t in this[e(423)][e(414)]){let n=this[e(423)][e(414)][t];const r="".concat(t,e(317))[e(365)](n[e(274)][e(449)],'"');if(window.clRtcDrmDebugLog&&console[e(383)](e(312),r),!Tn[e(408)](r))return console[e(370)](e(372)),!1;let s=this[e(327)][e(350)](r);this[e(398)][t]=new Aa(s,t,this[e(327)]),this.bufferControllers[t].on(e(370),this[e(403)][e(308)](this))}}}[Zi(313)](){const e=Zi;for(let t in this[e(398)])this[e(398)][t].doAppend()}onBuffer(e){const t=Zi;this[t(234)]&&this[t(398)]&&this[t(398)][e.type]&&this[t(398)][e[t(469)]][t(371)](e[t(214)])}[Zi(194)](){const e=Zi;window[e(251)]&&console.info("[MSE] sourceopen"),this[e(327)][e(185)]!==e(281)&&(this.mediaSource.duration=Number[e(391)],this[e(234)]=!0,"function"==typeof this[e(379)][e(336)]&&this[e(379)].onReady[e(394)](null,this[e(466)]),URL[e(235)](this.url),this[e(382)]())}[Zi(241)](){const e=Zi;window.clRtcDrmDebugLog&&console[e(383)](e(441)),this.mseReady=!1,this[e(227)]()}[Zi(403)](e){const t=Zi;console.warn(t(351),e),this.irrecoverableError=!0,this[t(227)](),"function"==typeof this[t(379)][t(266)]&&this[t(379)][t(266)][t(394)](null,e)}}function Hi(e,t){const n=Qi();return(Hi=function(e,t){return n[e-=222]})(e,t)}function Qi(){const e=["__dev_time__","1634635aeNfVS","4rWkceo","1051qHPzyB","314juHkBI","7752096GfpyFE","1023208nKrJjX","2137269uUqtNM","303058KNxeBb","1097196nHglzA"];return(Qi=function(){return e})()}!function(){const e=Hi,t=Qi();for(;;)try{if(parseInt(e(228))/1*(-parseInt(e(229))/2)+-parseInt(e(222))/3*(parseInt(e(227))/4)+parseInt(e(226))/5+parseInt(e(224))/6+parseInt(e(223))/7+-parseInt(e(231))/8+parseInt(e(230))/9==409100)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const qi=eo;function eo(e,t){const n=ro();return(eo=function(e,t){return n[e-=460]})(e,t)}!function(){const e=eo,t=ro();for(;;)try{if(-parseInt(e(471))/1*(-parseInt(e(474))/2)+parseInt(e(479))/3+parseInt(e(473))/4*(parseInt(e(461))/5)+parseInt(e(487))/6+-parseInt(e(467))/7+-parseInt(e(482))/8+-parseInt(e(464))/9==139726)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const to="CrsCCAMSEKDc0WAwLAQT1SB2ogyBJEwYv4Tx7gUijgIwggEKAoIBAQC8Xc/GTRwZDtlnBThq8"+qi(462)+"wyoYOE+M/t1oIbccwlTQ7o+BpV1X6TB7fxFyx1jsBtRsBWphU65w121zqmSiwzZzJ4xsXVQCJ"+qi(460)+qi(476)+qi(480)+qi(484)+qi(485)+"7hyskG5ZLAyJMzTvgnV3D8/I5Y6mCFBPb/+/Ri+9bEvquPF3Ff9ip3yEHu9mcQeEYCeGe9zR/27eI5MATX39gYtCnn7dDXVxo4/rCYK0A4VemC3HRai2X3pSGcsKY7+6we7h4IycjqtuGtYg8A"+qi(475)+"RL9KsD0v7ysBQVdUXEbJotcFz71tI5qc3jwr6GjYIPA3VzusD17PN6AGQniMwxJV12z/EgnUo"+qi(477),no=Uint8Array[qi(478)](window[qi(470)](to),e=>e.charCodeAt(0));class De{constructor(e){this[qi(488)]=e}[qi(469)](){return this[qi(488)]}[qi(483)](){const e=qi;switch(this[e(488)]){case e(489):return"https://lic.staging.drmtoday.com";case e(465):return e(481);default:return e(466)}}certificate(){return no}}function ro(){const e=["development","https://lic.drmtoday.com","462553oMrSQp","Staging","toString","atob","20047HjYCpd","Development","52chMPdC","6mbMcSk","baigovcoURAZcr1d/G0rpREjLdVLG0Gjqk63Gx688W5gh3TKemsK3R1jV0dOfj3e6uV/kTpsN","+vwmV2/NJWxKqHBKdL9JqvOnNiQUF0hDI7Wf8Wb63RYSXKE27Ky31hKgx1wuq7TTWkA+kHnJT","pcFB13osydpD2AaDsgWo5RWJcNf+fzCgtUQx/0Au9+xVm5LQBdv8Ja4f2oiHN3dw","from","146355HhTpSB","UrTEfQxfPR4dJTquE+IDLAi5yeVVxzbAgMBAAE6DGNhc3RsYWJzLmNvbUABEoADMmGXpXg/0q","https://lic.test.drmtoday.com","501688OkVRMl","baseUrl","xUuwokpsqVIHZrJfu62ar+BF8UVUKdK5oYQoiTZd9OzK3kr29kqGGk3lSgM0/p499p/FUL8oH","HzgsJ7Hajdsyzn0Vs3+VysAgaJAkXZ+k+N6Ka0WBiZlCtcunVJDiHQbz1sF9GvcePUUi2fM/h","Production","1063410zFUyaf","name","staging","pQnNI61gzHO42XZOMuxytMm0F6puNHTTqhyY3Z290YqvSDdOB+UY5QJuXJgjhvOUD9+oaLlvT","93365ZJpndd","V382D1oJAM0F/YgCQtNDLz7vTWJ+QskNGi5Dd2qzO4s48Cnx5BLvL4H0xCRSw2Ed6ekHSdrRU","production","2343546YgIYCY"];return(ro=function(){return e})()}function so(e,t){const n=io();return(so=function(e,t){return n[e-=325]})(e,t)}function io(){const e=["1052499bnJBHn","cenc","4222tSxFth","Unsupported SampleAuxInfo version","12980Tusgux","3160ZwXFcU","40030ewyARR","16lkTHRT","1199124lbwxEr","data","105TSrukA","getUint8","12bBEpge","SampleAuxInfo corrupted (postfix not found)","getUint16","error","85265ZYYyUv","buffer","3616548TKdsLX","subarray","byteLength","SampleAuxInfo corrupted"];return(io=function(){return e})()}function oo(e,t){const n=uo();return(oo=function(e,t){return n[e-=295]})(e,t)}De[qi(468)]=new De(qi(489)),De[qi(486)]=new De(qi(463)),De[qi(472)]=new De(qi(465)),function(){const e=so,t=io();for(;;)try{if(parseInt(e(328))/1+-parseInt(e(332))/2*(-parseInt(e(336))/3)+-parseInt(e(338))/4*(-parseInt(e(342))/5)+-parseInt(e(344))/6+-parseInt(e(326))/7*(parseInt(e(333))/8)+parseInt(e(334))/9+parseInt(e(331))/10*(parseInt(e(330))/11)==358550)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),function(){const e=oo,t=uo();for(;;)try{if(parseInt(e(305))/1*(-parseInt(e(297))/2)+-parseInt(e(295))/3+parseInt(e(310))/4*(parseInt(e(309))/5)+-parseInt(e(304))/6*(parseInt(e(296))/7)+parseInt(e(307))/8*(-parseInt(e(298))/9)+-parseInt(e(301))/10*(parseInt(e(302))/11)+-parseInt(e(300))/12*(-parseInt(e(308))/13)==178039)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const ao=[];let co=null,lo=0;function uo(){const e=["31476hbBsvr","850RxzAPl","4180KczaCN","push","156MUFuvQ","96571jvhWaB","buffer","26232BkewNd","4303YGAqiP","5yhGpFn","1137036pzCnTd","1035942NcoZLh","94073eTaQjy","2bXtEms","414snfiTE","slice"];return(uo=function(){return e})()}const po=yo;function fo(){const e=["Data does not seem to be UTF-16 encoded!","No init data available!","getElementsByTagName","min","14BFNrBA","keystatuseschange","catch","childNodes","internal-error","Failed to reuse previous EME session: ","output-downscaled","expired","bind","5576688EKOFOG","has","length","License acquisition failed with error ","arrayBuffer","apply","CDM error generating license request: ","<Challenge","No PR challenge data!","then","license","createSession","warn","[PR] License fetched:","text/xml","clRtcDrmDebugLog","push","encode","max","json"," is not ","replace","target","rtcdrmerror","update","fromCharCode","subarray","2993694njpqat","4002692oINhTV","Content-Type","1347492MkzfDC","Data has an incorrect length, must be even.","addEventListener","buffer","onFetch","generateRequest","initData","dispatchEvent","atob","No clear key test key provided!","Challenge","New lic will be requested","oct","BYTES_PER_ELEMENT","sessionId","usable for decryption (status: ","[WV] License fetched:","Key ","5MtuOVr","byteLength","744563CKOUzg","load","floor","error","decode","indexOf","info","isSafari","edef8ba979d64acea3c827dcd51d21ed","mediaKeys","Previous lic will be reused","charCodeAt","licenseUrl","status","Failed to update the session: ","log","keyStatuses","temporary","9a04f07998404286ab92e65be0885f95","output-restricted","nodeValue","btoa","message","EME createSession() failed - no DRM available","5977680uUTwUr","getUint16","[PR] Challenge node not found","A128KW","3974463jrELhf","Failed to update the session","stringify","[EME]","delete","No media keys for media element!","set","2nMQfRz"];return(fo=function(){return e})()}!function(){const e=yo,t=fo();for(;;)try{if(-parseInt(e(419))/1*(parseInt(e(454))/2)+parseInt(e(495))/3+parseInt(e(496))/4*(-parseInt(e(417))/5)+-parseInt(e(498))/6*(-parseInt(e(459))/7)+parseInt(e(468))/8+-parseInt(e(447))/9+parseInt(e(443))/10==555073)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();let ho={licenseUrl:"",onFetch:void 0};const mo={},go=(e,t=0,n=1/0)=>((e,t,n)=>{const r=yo,s=Uint8Array[r(511)];t*=s,n*=s;const i=(c=e)instanceof ArrayBuffer?c:c[yo(501)],o=e[r(418)],a=t;var c;let l=Math[r(486)](0,Math[r(458)](a,o)),u=Math[r(458)](l+Math[r(486)](n,0),o);return l/=s,u/=s,new Uint8Array(i,l,u-l)})(e,t,n);function yo(e,t){const n=fo();return(yo=function(e,t){return n[e-=417]})(e,t)}const vo=e=>{const t=yo;let n="";for(const r of e){let e=r.toString(16);1==e[t(470)]&&(e="0"+e),n+=e}return n};let bo=null;const wo=e=>{const t=yo;return window[t(440)](String[t(493)][t(473)](null,e))[t(489)](/\+/g,"-")[t(489)](/\//g,"_")[t(489)](/=*$/,"")},So=(e,t)=>{const n=yo,r=(e=>{const t=yo,n=JSON.parse((new TextDecoder)[t(423)](e));if(console[t(434)]("CK license request:",n),null===bo)throw new Error(t(507));const r=[];for(const e of n.kids){const n={kty:t(510),alg:t(446),kid:e,k:wo(bo)};r[t(484)](n)}return(new TextEncoder)[t(485)](JSON[t(449)]({keys:r}))})(t.message);t[n(490)][n(492)](r)[n(461)](function(e){const t=n;console[t(422)](t(448),e)})},_o=e=>{const t=yo,n=window[t(506)](e[t(489)](/-/g,"+")[t(489)](/_/g,"/")),r=new Uint8Array(n[t(470)]);for(let e=0;e<n.length;++e)r[e]=n[t(430)](e);return r},Ro=(e,t,...n)=>xi(void 0,[e,t,...n],void 0,function*(e,t,n=!1){const r=yo,s=new Headers(mo);n&&s.append(r(497),r(482));const i={method:"POST",headers:s,body:t},o=yield ho[r(502)]?ho[r(502)](e,i):fetch(e,i);if(!o.ok)throw new Error(r(471)+o[r(432)]);return o}),Eo=(e,t)=>{const n=yo;Ro(ho[n(431)],t[n(441)])[n(477)](e=>e[n(487)]())[n(477)](e=>{const r=n;window[r(483)]&&console.info(r(514),e.license);const s=_o(e[r(478)])[r(501)];t[r(490)][r(492)](s)[r(461)](e=>{console[r(422)]("Failed to update the session",e)})})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console[r(422)](t)})},ko=(e,t)=>{const n=yo,r=((e,t)=>{const n=yo,r=new DOMParser;try{const e=function(e,t,n=!1){const r=yo;if(!e)return"";let s=e;if(!n&&s.byteLength%2!=0)throw console[r(422)](r(499)),new Error(r(455));const i=go(s);let o;if((255===i[0]&&254===i[1]||254===i[0]&&255===i[1])&&(s=i[r(494)](2)),s instanceof ArrayBuffer)o=s;else{const e=new Uint8Array(s[r(418)]);e[r(453)](go(s)),o=e[r(501)]}const a=Math[r(421)](s.byteLength/2),c=new Uint16Array(a),l=new DataView(o);for(let e=0;e<a;e++)c[e]=l[r(444)](2*e,t);return function(e){const t=yo;let n="";for(let r=0;r<e[t(470)];r+=16e3){const s=e[t(494)](r,r+16e3);n+=String[t(493)].apply(null,s)}return n}(c)}(t,!0);if(e[n(424)](n(475))>-1){const t=r.parseFromString(e,n(482))[n(457)](n(508))[0][n(462)][0][n(439)];if(null===t)throw new Error("No PR challenge data!");return _o(t)}console[n(480)](n(445))}catch(t){e.dispatchEvent(new CustomEvent(n(491),{detail:{message:""+t}})),console.error(t)}return null})(e,t.message);if(null===r)return e[n(505)](new CustomEvent("rtcdrmerror",{detail:{message:"No PR challenge data!"}})),void console.error(n(476));Ro(ho[n(431)],r[n(501)],!0)[n(477)](e=>e[n(472)]())[n(477)](r=>{const s=n;window[s(483)]&&console[s(425)](s(481),r),t[s(490)].update(r)[s(461)](function(t){const n=s;e[n(505)](new CustomEvent(n(491),{detail:{message:n(433)+t}})),console[n(422)](n(448),t)})})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent("rtcdrmerror",{detail:{message:""+t}})),console[r(422)](t)})},Io=(e,t)=>{const n=yo;Ro(ho[n(431)],t[n(441)])[n(477)](e=>{const t=n,r=e.text();return window[t(483)]&&console.info("[FPS] License fetched:",e,r),r})[n(477)](e=>{const r=n;t[r(490)][r(492)](_o(e))})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console[r(422)](t)})},Co=(e,t)=>{mo[e]=t},xo=Wi[po(426)];let To=!xo;const Ao=new Map;function Lo(e){return xi(this,void 0,void 0,function*(){const t=yo;if(null===e[t(504)])throw new Error(t(456));const n=e[t(490)];if(null===n)throw new Error("No media element available!");const r=n[t(428)];if(null===r)throw new Error(t(452));const s=vo(new Uint8Array(e[t(504)])),i=s+n.id;let o=null;Ao[t(469)](i)&&(o=Ao.get(i),null!=o&&o.close(),Ao[t(451)](i)),window[t(483)]&&console[t(425)](t(450),t(o?429:509));let a=null;try{a=r[t(479)](To?"persistent-license":"temporary")}catch(e){console[t(434)]("EME createSession(persistent) failed:",e)}if(!a&&To){To=!1;try{a=r[t(479)](t(436))}catch(e){console[t(422)]("EME createSession(temporary) failed:",e)}}if(a)if(a[t(500)](t(460),e=>{const r=t;e[r(490)][r(435)].forEach((e,t)=>{const s=r;(e===s(466)||e===s(438)||e===s(465)||e===s(463))&&n[s(505)](new CustomEvent(s(491),{detail:{message:s(515)+vo(new Uint8Array(t))+s(488)+(s(513)+e+")"),keyId:t}}))})}),xo?a.addEventListener(t(441),Io[t(467)](null,n),!1):-1!==s[t(424)](t(427))?a.addEventListener(t(441),Eo[t(467)](null,n),!1):-1!==s[t(424)](t(437))?a[t(500)](t(441),ko[t(467)](null,n),!1):a.addEventListener("message",So[t(467)](null,n),!1),o)try{(yield a[t(420)](o[t(512)]))?Ao[t(453)](i,a):n.dispatchEvent(new CustomEvent(t(491),{detail:{message:"Failed to load previous EME session"}}))}catch(e){n[t(505)](new CustomEvent(t(491),{detail:{message:t(464)+e}}))}else a[t(503)](e.initDataType,e[t(504)]).then(()=>{To&&Ao[t(453)](i,a)})[t(461)](e=>{const r=t;n[r(505)](new CustomEvent(r(491),{detail:{message:r(474)+e}}))});else n[t(505)](new CustomEvent(t(491),{detail:{message:t(442)}}))})}const Po=qo;function Oo(){const e=[" too close to seek, ","fpsCertificateUrl","9880640TWxZrg","H264","ignoreAudio","Unable to create Worker!","createMediaKeys(",", restart required: ","/license-proxy-headerauth/drmtoday/RightsManager.asmx","6236Nwzlef","worker","serverCertificateUrl","serverCertificate","seq",",255]).buffer,idrFrames.push(new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,","ClearKey","No valid DRM config found, call rtcDrmConfigure first.","sessionId","toISOString","indexOf","robustness","isInteger","info","includes","Development","slice","16niaptx"," frame","video/mp4","isArray","Android","end","PlayReady","streamType","1772WtcYWF","]: ","Frame gap: ","nextKeyFrameAllowedTime","use rtcDrmFeedFrame to push frames manually","Error recovery attempted","merchant","FairPlay","requestMediaKeySystemAccess(","pipeThrough","/license-server-fairplay/","isChrome","type","MSE (re)init","const DUMMY_IDR_FRAME_SLICE_HDR0=new Uint8Array([32,0,203]),DUMMY_IDR_FRAME_SLICE_HDR1=new Uint8Array([16,0,50]);","DRM config env value must be one of: ","length","GOP is getting too long, requesting a new key frame","Worker","let brokenFrame=null,idrFrames=[];function initializeDummyFrames(){brokenFrame=new Uint8Array([0,0,0,1,65,154,255","srcObject","RTCRtpScriptTransform","),idrFrames.push(idrFrames[0].slice());let $=new Uint8Array(idrFrames[1]);$.set([16,0,50],27)}let idrPicIdToggle=","now"," to ","join","setServerCertificate","audioCapabilities","lastKeyFrameTime","prevSeqNum"," seeking from ",".experiment","clRtcDrmDebugLog","Server certificate fetch failed with error ","isFirefox","org.w3.clearkey","x-dt-custom-data","jitterBufferTarget","playbackRate","enabled","keyFrameNeeded","createEncodedStreams","wvCertificateUrl","key","sai","Discarding corrupted video frame (too small)",'gle^=1]}function audioTransformFunction($,e){postMessage({streamType:"audio",frame:{timestamp:$.timestamp,data:$.',"H264 is the only supported video codec.","com.microsoft.playready.recommendation"," will be used","DRM config iv must be an instance of 16-byte long Uint8Array.","encryption","0;function generateDummyFrame($){return(brokenFrame||initializeDummyFrames(),$)?brokenFrame:idrFrames[idrPicIdTog","toString","message","status","bytesSinceKey","currentTime","supportsRtpScriptTransform","1585647fRskxG","audioElement","track","sinf","createObjectURL","enqueue","Invalid videoElement, it must be an instance of HTMLVideoElement.","7302558TqFWae","pipeTo","SampleAuxInfo extraction failed (video)","isEdge","keys","not-allowed","rtcdrmerror","btoa","?audioTransformFunction:videoTransformFunction});e.pipeThrough(a).pipeTo(x)}self.RTCTransformEvent&&(self.onrtctr",", a1d1f1 is recommended).","reportDiscontinuity","onFetch","keyId","sessionTypes","). Edge only supports PlayReady, Widevine and ClearKey.","audioEncrypted","audioStartTimestamp","frame","videoStartTimestamp","184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32]).buffer","Duplicate/reordered frame, prev seq: ","ClearKey is not supported by Safari.","bind",") not found in [","DRM config robustness can only be one of: ","persistent-license","postMessage","receiver","get","both","jmuxer","Production","Blob","timestamp","cenc","emeConfig","clear","cbcs-1-9","5iKPdqC","isWindows","PlayReady license acquisition might fail without output protection enabled (sessionId is ","). Chrome only supports Widevine and ClearKey.","mediaBufferMs should be an integer.","size","certificate","prLicenseUrl","fpsLicenseUrl","/license-proxy-widevine/cenc/","4572770OAoUlm","BYTES_PER_ELEMENT","then","SW_SECURE_CRYPTO","ansform=$=>{let e=$.transformer;handleTransform(e.options.operation,e.readable,e.writable)}),onmessage=$=>{keyFra","splice","Safari doesn't support 'cenc'/AES-CTR, use 'cbcs' instead if possible.","videoElement","rtcDrmConfigure did not specify audioElement, audio will be dropped",'audio/mp4; codecs="opus"',"object","Invalid audioElement, it must be an instance of HTMLMediaElement.","keyFrameNeededPosted","debugCreateMediaDump","next","play","6591266VeIbXo","userId","jitterBufferDelayHint",'ame(keyFrameNeeded),e.enqueue($)}function handleTransform($,e,x){let a=new TransformStream({transform:"audio"===$',"dispatchEvent","reduce"," bytes, playback at ","offset","arrayBuffer","waitingForIdr","Widevine","DRM config mediaBufferMs should be an integer.","hwSecurity","authToken","audio"," bytes)","push","licenseUrl","Default transform mode enabled, ","RTCRtpScriptTransform/TransformStream will not be created, ","GET","baseUrl","video","trim","7377TdQrIK","3000","playoutDelayHint","catch","fpsCertificate","POSITIVE_INFINITY","/license-server-fairplay/cert/","DRM config:","streams","mediaBufferMs","log","codec","onmessage","Target video element (","Applying pre-configured certificate (","webkitURL","Discarding corrupted video frame (no Annex B startcode)"," requesting a new key frame (latency ","PlayReady might not support '","No target media element!","URL","set","warn","data","config","isSafari","forEach","setMediaKeys","buffered"," - ","keySystem",'data}}),e.enqueue($)}let keyFrameNeeded=!1;function videoTransformFunction($,e){postMessage({streamType:"video",f',"paused","wvCertificate","a1d1f1","2000","keyFrameRequestInterval","Several DRM configs detected, rtcDrmOnTrack have to be called with target DRM config.","error","238HZxcdH","HW_SECURE_ALL","Invalid DRM type (","buffer","x-dt-auth-token","clRtcDrmCreateMediaDump",'rame:{type:$.type,timestamp:$.timestamp,data:$.data}}),"key"===$.type&&(keyFrameNeeded=!1),$.data=generateDummyFr',"addEventListener",") failed","keyFrameLogCntr","feed","byteLength","kind","purchase","environment","videoCapabilities","requestMediaKeySystemAccess","temporary","). It has to be a string containing a JWT.","value",".. ","string"];return(Oo=function(){return e})()}!function(){const e=qo,t=Oo();for(;;)try{if(parseInt(e(543))/1*(parseInt(e(512))/2)+parseInt(e(473))/3*(parseInt(e(568))/4)+-parseInt(e(672))/5*(-parseInt(e(634))/6)+-parseInt(e(536))/7+parseInt(e(560))/8*(parseInt(e(627))/9)+-parseInt(e(682))/10+-parseInt(e(449))/11==932877)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const No=Wi[Po(626)],Mo=Wi[Po(602)],Do=Wi[Po(498)],Fo=Wi[Po(637)],Uo=Wi[Po(579)],jo=Wi.platform,Vo=Wi[Po(673)],Wo=Fo||Uo&&jo===Po(564),Zo=1e6*(Mo?82:Do?220:120),Go=Mo?5e3:2e3,Bo=Mo?1.5:.5;function Yo(e){const t=Po;return typeof e!==t(692)||null===e||e instanceof Element||e instanceof De?e:function(e){const t=Po;return!!((null==e?void 0:e[t(515)])instanceof ArrayBuffer&&null!=e&&e[t(683)])}(e)?e[t(559)]():Array[t(563)](e)?e[t(454)]((e,t,n)=>(e[n]=Yo(t),e),[]):e instanceof Object?Object[t(638)](e)[t(454)]((t,n)=>(t[n]=Yo(e[n]),t),{}):e}class Ya{constructor(e){const t=Po;this[t(545)]="",this.licenseUrl="",this[t(503)]="",this[t(669)]=[],this[t(497)]=Yo(e),this[t(664)]=null,this[t(521)]=0,this[t(571)]=Date.now(),this.videoStartTimestamp=0,this.audioStartTimestamp=0,this.prevSeqNum=-1,this[t(596)]=0,this[t(624)]=0,this.keyFrameNeeded=!0,this.keyFrameNeededPosted=!1,this.keyFrameRequestInterval=Go,this.worker=null}}const zo=new Map,Xo=new Uint8Array([60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60]),Ko=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]),$o=new Uint8Array([213,251,214,184,46,217,62,78,249,138,228,9,49,238,51,183]);function Ho(e){const t=Po;let n=!1;if((e[t(497)].video&&"clear"!==e[t(497)].video[t(619)]&&"HW"===e.config[t(471)][t(554)]||e[t(497)][t(463)]&&e[t(497)][t(463)].encryption!==t(670)&&"HW"===e[t(497)][t(463)][t(554)])&&(n=!0),e.hwSecurity=n,function(e,t){const n=Po;void 0!==t&&(e[n(497)][n(482)]=t),(void 0===e[n(497)][n(482)]||e[n(497)].mediaBufferMs<0)&&(e.config[n(482)]=100,Mo?e[n(497)][n(482)]=350:!Do&&Vo&&(e[n(497)][n(580)]===n(566)||e[n(461)])&&(e[n(497)][n(482)]=1400))}(e,e[t(497)][t(482)]),void 0===e.config.authToken){void 0===e.config[t(450)]&&(e[t(497)][t(450)]=t(525)),void 0===e[t(497)][t(551)]&&(e.config[t(551)]=t(507));const n=window[t(641)](JSON.stringify({userId:e.config[t(450)],sessionId:e[t(497)][t(551)],merchant:e.config[t(574)]}));Co(t(604),n)}else Co(t(516),e.config[t(462)]);for(const n of[e[t(497)].audio,e[t(497)][t(471)]])n&&n[t(619)]!==t(670)&&(n[t(646)]||(n[t(646)]=Ko),n.iv||(n.iv=$o));e[t(546)]=void 0,e[t(545)]="",e[t(466)]="";const r=e.config[t(526)][t(470)]();var s;if(e[t(497)][t(580)]===t(549)?(e.keySystem=t(603),bo=Xo):e.config.type===t(459)?(e[t(503)]="com.widevine.alpha",Vo&&n&&(e[t(503)]+=t(599)),e.config.wvCertificate?e[t(546)]=e[t(497)][t(506)]:e[t(497)][t(610)]?e[t(545)]=e[t(497)][t(610)]:e[t(546)]=e.config[t(526)][t(678)](),e.config.wvLicenseUrl?e[t(466)]=e[t(497)].wvLicenseUrl:e[t(466)]=r+t(681)):e[t(497)][t(580)]===t(566)?(e[t(503)]=t(616),e[t(497)][t(679)]?e.licenseUrl=e[t(497)][t(679)]:e[t(466)]=r+t(542)):e[t(497)].type===t(575)&&(e.keySystem="com.apple.fps",e.config[t(477)]?e[t(546)]=e[t(497)][t(477)]:e[t(497)][t(535)]?e.serverCertificateUrl=e.config[t(535)]:e[t(545)]=r+t(479)+e[t(497)].merchant,e[t(497)][t(680)]?e[t(466)]=e.config.fpsLicenseUrl:e.licenseUrl=r+t(578)),s={licenseUrl:e[t(466)],onFetch:e.config[t(645)]},ho=s,e[t(669)]=[],e.config[t(580)]!==t(575)){e[t(669)][t(465)]({initDataTypes:[t(668)],sessionTypes:["persistent-license",t(529)]});for(const n of[e[t(497)][t(471)],e[t(497)][t(463)]])if(n&&n.encryption!==t(670)){const r=n==e[t(497)][t(471)]?t(471):t(463);let s;e[t(497)][t(580)]===t(459)?s="HW"===n[t(554)]?t(513):t(685):"PlayReady"===e[t(497)][t(580)]&&(s="HW"===n.robustness?t(474):t(508)),r===t(471)?e[t(669)][0][t(527)]=[{contentType:'video/mp4; codecs="avc1.640032"',encryptionScheme:"cenc"===n[t(619)]?t(668):"cbcs-1-9",robustness:s||void 0}]:e[t(669)][0][t(595)]=[{contentType:t(691),encryptionScheme:n[t(619)]===t(668)?"cenc":t(671),robustness:s||void 0}]}}else e[t(669)]=[{initDataTypes:[t(630)],videoCapabilities:[{contentType:t(562),robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:t(639),sessionTypes:["temporary"]}];window[t(600)]&&console.info(t(480),e)}function Jo(e){const t=Po;window[t(600)]&&console[t(556)](t(581));let n=e[t(497)].videoElement;(!e[t(497)][t(471)]||e.config[t(471)][t(619)]===t(670))&&(n=e.config.audioElement),e[t(664)]=null;const r=!e.ignoreAudio&&e[t(497)][t(463)]&&"clear"!==e[t(497)].audio[t(619)],s=e[t(497)][t(471)]&&e.config.video[t(619)]!==t(670);e[t(624)]=0,e[t(608)]=!0,e.keyFrameNeededPosted=!1,e[t(509)]=Go,e[t(652)]=0,e[t(650)]=0,e[t(597)]=-1,e[t(596)]=0,e.jmuxer=new Tn({node:n,mode:r?t(s?663:463):"video",fps:60,drm:e}),Do&&e[t(497)].videoElement&&e[t(497)][t(689)][t(448)]()[t(684)](()=>{})[t(476)](()=>{})}function Qo(e,t,n){const r=Po;if(e[r(497)][r(471)]&&"clear"===e.config[r(471)][r(619)])return null==n||n[r(632)](t),!1;const s=Date[r(591)]();if(t.type===r(611)){const n=window[r(600)];++e[r(521)]<(n?Number[r(478)]:5)&&(console[r(556)]((new Date)[r(552)]().slice(11,-1)+" "+t[r(580)]+", "+(t[r(496)].byteLength+r(455)+e[r(497)][r(689)][r(625)])),n&&1===e[r(521)]&&function(e,t=64,n=64){const r=Po,s=new Uint8Array(e[r(496)]);let i="",o=0;for(let e=0;e<t&&e<s[r(584)];++e)i+=(s[e]<16?"0":"")+s[e].toString(16)+" ";if(o<s[r(584)])for(o<s[r(584)]-n&&(i+=r(532),o=s[r(584)]-n);o<s[r(584)];o++)i+=(s[o]<16?"0":"")+s[o][r(621)](16)+" ";console.info("["+((e[r(580)]||r(463))+r(561))+r(569)+i[r(472)]())}(t,128,8)),e[r(608)]=!1,e[r(624)]=0,e[r(571)]=s+e[r(509)]}return e[r(624)]+=t.data[r(523)],!e[r(608)]&&e[r(624)]>Zo&&(console[r(556)](r(585)),e[r(608)]=!0),e.jmuxer&&(function(e,t){const n=Po;0===e[n(652)]&&(e[n(652)]=t[n(667)],e[n(509)]=Go,e[n(571)]=Date[n(591)]()+2e3);let r=null,s=!1;if(t.data[n(523)]<=4)console[n(495)](n(613)),s=!0;else{const i=new Uint8Array(t[n(496)],0,4);0!=i[0]||0!=i[1]||0!=i[2]||1!=i[3]?(console[n(495)](n(489)),s=!0):(r=function(e,t){const n=so,r=new DataView(e[n(335)]),s=e.data[n(346)]-2,i=r[n(340)](s);if(i<s){let e=s-i;if(69!==r[n(337)](s-1))return console[n(341)](n(339)),null;if(r.getUint8(e++)>>>4!=1)return console[n(341)](n(329)),null;const o=new Uint8Array(i-2);let a=0,c=0;for(;e<s-1;){let t=r.getUint8(e++);c>1&&3===t&&(c=0,t=r.getUint8(e++)),0!==t?c=0:++c,o[a++]=t}const l=new DataView(o[n(343)]),u=t===n(327)?16:0,d=u+2+6*l.getUint16(u);return d+2>a?(console.error(n(325)),null):{sai:o[n(345)](0,d),offset:s-i,seq:l.getUint16(d)}}return null}(t,e[n(497)][n(471)][n(619)]),!r&&(console.warn(n(636)),s=!0))}if(r)if(-1===e[n(597)]){if(t[n(580)]!==n(611))return 0;e[n(597)]=r[n(547)]}else{let i=r.seq-e[n(597)];if(i<-32767&&(i+=65536),i<=0)return window[n(600)]&&console[n(495)](n(654)+e[n(597)]+", curr: "+r[n(547)]),0;i>1&&(s=t[n(580)]!==n(611),console[n(495)](n(570)+e[n(597)]+n(502)+r[n(547)]+n(541)+s)),e.prevSeqNum=r[n(547)]}let i=0;s&&!e[n(664)][n(458)]&&(i=-1,e[n(664)][n(644)]());const o=(t[n(667)]-e[n(652)])/9e4;return r&&e[n(664)][n(522)]({video:new Uint8Array(t.data,0,r[n(456)]),videoSampleAuxInfo:r[n(612)],timestamp:o})<0&&(i=-1,console[n(495)](n(573)),Jo(e)),i>=0&&"key"===t[n(580)]&&(e[n(596)]=o,console[n(483)]((new Date)[n(552)]()[n(559)](11,-1)+" kf at "+o+", playback at "+e[n(497)].videoElement[n(625)])),i}(e,t)<0?e[r(608)]=!0:function(e){const t=Po,n=e.config[t(689)];if(!n||n[t(501)][t(584)]<1||n[t(505)]||n[t(625)]<Bo)return;const r=e[t(497)].mediaBufferMs;if(void 0===r||r<0)throw new Error("targetLatency not set!");const s=n[t(501)][t(565)](n[t(501)][t(584)]-1),i=1e3*(s-n[t(625)])|0;if(!e[t(649)]&&function(e,t,n){const r=Po;let s;s=t<3*n>>>2?.875:t<=n?1:t<7*n>>>2?1.125:t<9*n>>>2?1.25:t<11*n>>>2?1.375:1.5,s!==e.playbackRate&&(e[r(606)]=s)}(n,i,r),!(i<r+50||i<5*r>>>2))if(e.lastKeyFrameTime>n[t(625)]+.1){const i=1e3*(s-e[t(596)])|0;i>40&&i>r-100?(window[t(600)]&&console.info((new Date).toISOString().slice(11,-1)+t(598)+(n[t(625)]+t(592)+e[t(596)]+" (")+(e.lastKeyFrameTime-n[t(625)])+")"),n[t(625)]=e[t(596)]):console[t(483)]((new Date)[t(552)]().slice(11,-1)+t(534)+i)}else!e[t(608)]&&Date[t(591)]()>e[t(571)]&&i>r+100&&i>3*r>>>1&&(window[t(600)]&&console[t(556)]((new Date).toISOString()[t(559)](11,-1)+t(490)+i+" ms)"),e[t(608)]=!0,e[t(509)]<16e3&&(e[t(509)]<<=1))}(e)),n?(!e[r(608)]||!Wo)&&(t[r(496)]=function(e){return!co&&function(){const e=oo;co=new Uint8Array([0,0,0,1,65,154,255,255]).buffer,ao[e(303)](new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32])[e(306)]),ao[e(303)](ao[0][e(299)](0)),new Uint8Array(ao[1]).set([16,0,50],27)}(),e?co:(lo^=1,ao[lo])}(e[r(608)]),n[r(632)](t)):e[r(608)]!=e[r(445)]&&(e.worker&&e[r(544)][r(660)](e[r(608)]),e[r(445)]=e[r(608)]),e[r(608)]}function qo(e,t){const n=Oo();return(qo=function(e,t){return n[e-=445]})(e,t)}function ea(e,t,n){const r=Po;return e[r(497)][r(463)]&&e[r(497)].audio[r(619)]!==r(670)?t[r(496)][r(523)]>0&&function(e,t){const n=Po;var r;if(!e.jmuxer||e[n(538)])return 0;0===e[n(650)]&&(e[n(650)]=t[n(667)]);const s=(t[n(667)]-e.audioStartTimestamp)/48e3;if("cbcs"===(null===(r=e.config[n(463)])||void 0===r?void 0:r[n(619)]))return e[n(664)][n(522)]({audio:new Uint8Array(t[n(496)]),timestamp:s});const i=function(e){const t=so,n=new DataView(e.data),r=e.data[t(346)]-2,s=n.getUint16(r);if(s<r){let e=r-s;if(69!==n[t(337)](r-1))return console[t(341)](t(339)),null;if(n[t(337)](e++)>>>4!=1)return console[t(341)](t(329)),null;const i=new Uint8Array(s-2);let o=0;for(;e<r-1;){const r=n[t(337)](e++);if(i[o++]=r,o>=16)break}return{sai:i,offset:r-s}}return null}(t);i?e[n(664)][n(522)]({audio:new Uint8Array(t[n(496)],0,i[n(456)]),audioSampleAuxInfo:i[n(612)],timestamp:s}):console[n(511)]("SampleAuxInfo extraction failed (audio)")}(e,t):n&&n[r(632)](t),!1}function ta(e){const t=Po;if(!e||typeof e!==t(692))throw new TypeError("Invalid config argument type, DRM config must be an object.");if(!(e[t(689)]instanceof HTMLVideoElement))throw new TypeError(t(633));if(e[t(628)]&&!(e.audioElement instanceof HTMLMediaElement))throw new TypeError(t(693));if(void 0!==e[t(482)]&&!Number[t(555)](e[t(482)]))throw new TypeError(t(460));let n=!1,r=!1,s=!1;const i=["cbcs",t(668),t(670)],o=["SW","HW"];for(const a of[e[t(471)],e[t(463)]])if(a){if(!i[t(557)](a[t(619)]))throw new RangeError("DRM config encryption value must be one of: "+i[t(593)](", "));if(Do&&"cenc"===a.encryption)throw new RangeError(t(688));if(a[t(619)]!==t(670)){if(r=!0,a.keyId){if(!(a[t(646)]instanceof Uint8Array)||16!==a.keyId[t(584)])throw new TypeError("DRM config keyId must be an instance of 16-byte long Uint8Array.");s=!0}else if(Do)throw new ReferenceError(t(655));if(a.iv&&(!(a.iv instanceof Uint8Array)||16!==a.iv.length))throw new TypeError(t(618));if(a[t(554)]&&!o[t(557)](a.robustness))throw new RangeError(t(658)+o[t(593)](", "));if(a===e[t(471)]&&a[t(484)]!==t(537))throw new RangeError(t(615));Do&&a===e.audio&&"opus"===a.codec&&(n=!0,console.warn("Safari does not support Opus, audio will not be rendered.")),"PlayReady"===e[t(580)]&&(a[t(619)]!==t(668)&&console[t(495)](t(491)+a[t(619)]+"', it's safer to use 'cbcs' instead."),void 0===e.sessionId||e.sessionId[t(557)]("f1")||console.warn(t(674)+e.sessionId+t(643)))}}if(r){const n=[De[t(558)],De.Staging,De[t(665)]];if(!n.includes(e[t(526)]))throw new RangeError(t(583)+n.join(", "));if(e[t(462)]&&typeof e[t(462)]!==t(533))throw new TypeError("Invalid authToken type ("+typeof e[t(462)]+t(530));if(e.type)if(Do){if(e[t(580)]!==t(575))throw new RangeError(t(514)+e[t(580)]+"). Safari only supports FairPlay.")}else if(Uo){if(e.type!==t(459)&&"ClearKey"!==e[t(580)])throw new RangeError("Invalid DRM type ("+e.type+t(675))}else if(Fo&&e[t(580)]!==t(566)&&"Widevine"!==e[t(580)]&&"ClearKey"!==e[t(580)])throw new RangeError(t(514)+e.type+t(648))}void 0!==e.debugLog&&(window[t(600)]=e.debugLog),void 0!==e[t(446)]&&(window[t(517)]=e[t(446)]);let a=zo.get(e[t(689)]);!a&&(a=new Ya(e),zo[t(494)](e[t(689)],a)),a.enabled=r,a[t(538)]=n,a[t(649)]=!n&&a[t(497)][t(463)]&&a[t(497)].audio.encryption!==t(670),r&&(a[t(497)].type||(a[t(497)][t(580)]=t(Do?575:459)),s||a[t(497)][t(580)]===t(549)||(a[t(497)][t(580)]=t(549)),Ho(a),function(e){xi(this,void 0,void 0,function*(){const t=qo;var n,r;let s=e[t(497)][t(689)];if((!e[t(497)][t(471)]||e[t(497)][t(471)].encryption===t(670))&&(s=e[t(497)][t(628)]),!s)throw new Error(t(492));s.src="",s[t(588)]=null,yield s.setMediaKeys(null);let i=null;try{i=yield navigator[t(528)](e[t(503)],e.emeConfig)}catch(e){}if(!i&&e[t(669)][0]){const s=null===(n=e[t(669)][0][t(647)])||void 0===n?void 0:n[t(553)](t(659));if(void 0!==s&&s>=0){null===(r=e.emeConfig[0].sessionTypes)||void 0===r||r[t(687)](s,1);try{i=yield navigator[t(528)](e[t(503)],e[t(669)])}catch(e){}}}if(!i){const n=t(576)+e[t(503)]+t(520);return s.dispatchEvent(new CustomEvent(t(640),{detail:{message:n}})),void console[t(511)](n)}let o=null;try{o=yield i.createMediaKeys()}catch(e){}if(!o){const n=t(540)+e[t(503)]+t(520);return s[t(453)](new CustomEvent("rtcdrmerror",{detail:{message:n}})),void console[t(511)](n)}if(e.serverCertificate)window.clRtcDrmDebugLog&&console[t(556)](t(487)+e[t(546)][t(523)]+t(464)),yield o[t(594)](e[t(546)]);else if(e.serverCertificateUrl){const n={method:t(469)},r=e.serverCertificateUrl;try{const i=yield e[t(497)].onFetch?e.config[t(645)](r,n):fetch(r,n);if(!i.ok){const e=t(601)+i[t(623)];return void s[t(453)](new CustomEvent(t(640),{detail:{message:e}}))}const a=yield i[t(457)]();window.clRtcDrmDebugLog&&console[t(556)]("Fetched certificate from "+r+", "+a[t(523)]+" bytes"),yield o[t(594)](a)}catch(e){const n=e.name+": "+e[t(622)];return console.error(n),void s[t(453)](new CustomEvent(t(640),{detail:{message:n}}))}}yield s[t(500)](o),s[t(519)]("encrypted",Lo),Jo(e)})}(a)),a[t(497)][t(689)][t(519)](t(448),function(){const e=t;a[e(497)][e(689)][e(625)]>.5&&(a[e(571)]=Date.now())})}const na=Po(582)+Po(587)+Po(548)+Po(653)+Po(590)+Po(620)+Po(614)+Po(504)+Po(518)+Po(452)+Po(642)+Po(686)+"meNeeded=$.data};";function ra(e){const t=Po;if(0===zo[t(677)])throw new TypeError(t(550));let n;if(e&&e[t(689)])n=e[t(689)];else{if(1!==zo.size)throw new TypeError(t(510));n=zo[t(638)]()[t(447)]()[t(531)]}const r=zo[t(662)](n);if(!r){let e="";throw zo[t(499)]((t,n)=>{e+=n.id+", "}),e=e.slice(0,-2),new TypeError(t(486)+n.id+t(657)+e+"]")}return r}function sa(e,t){const n=Po;if(e&&e[n(497)][n(689)]){const r=e[n(497)][n(689)];if(r[n(501)].length>0){const e=r.buffered[n(565)](r[n(501)][n(584)]-1)-r[n(625)];t.playoutDelayHint=t.jitterBufferDelayHint=t.jitterBufferTarget=e}setTimeout(sa,1e3,e,t)}}const aa=St.get("View");aa.setLevel(St.DEBUG);const ca={metadata:!1,enableDRM:!1,disableVideo:!1,disableAudio:!1,peerConfig:{autoInitStats:!0,statsIntervalMs:1e3}};class cc extends bi{constructor(e,t,n=null,r=!0){e&&aa.warn("The streamName property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, set via token generator"),super(null,t,aa,r),this.payloadTypeCodec={},this.tracksMidValues={},this.drmOptionsMap=null,this.eventQueue=[],this.isMainStreamActive=!1,n&&(this.on(Ss.track,e=>{n.srcObject=e.streams[0]}),aa.warn("The mediaElement property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, do this in either the `track` or the `active` broadcast event."))}async connect(e=ca){this.options=Me(Ne(Ne({},ca),e),{peerConfig:Ne(Ne({},ca.peerConfig),e.peerConfig),setSDPToPeer:!1}),this.eventQueue.length=0,await this.initConnection({migrate:!1})}async select(e={}){aa.debug("Viewer select layer values: ",e),await this.signaling.cmd("select",{layer:e}),aa.info("Connected to streamName: ",this.streamName)}async addRemoteTrack(e,t){aa.info("Viewer adding remote track",e);const n=await this.webRTCPeer.addRemoteTrack(e,t);for(const e of t)e.addTrack(n.receiver.track);return n}async project(e,t){for(const e of t){if(!e.trackId&&!e.media)throw aa.error("Error in projection mapping, trackId or mediaId must be set"),new Error("Error in projection mapping, trackId or mediaId must be set");const t=this.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw aa.error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers")),new Error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers"))}aa.debug("Viewer project source: layer mappings: ",e,t),await this.signaling.cmd("project",{sourceId:e,mapping:t}),aa.info("Projection done")}async unproject(e){aa.debug("Viewer unproject mediaIds: ",e),await this.signaling.cmd("unproject",{mediaIds:e}),aa.info("Unprojection done")}async replaceConnection(){aa.info("Migrating current connection"),await this.initConnection({migrate:!0})}stop(){var e,t;super.stop(),null==(e=this.drmOptionsMap)||e.clear(),this.DRMProfile=null,null==(t=this.worker)||t.terminate(),this.worker=null,this.payloadTypeCodec={},this.tracksMidValues={},this.eventQueue.length=0}async initConnection(e){var t;let n,r;if(aa.debug("Viewer connect options values: ",this.options),this.stopReconnection=!1,!e.migrate&&this.isActive())throw aa.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{r=await this.tokenGenerator(),this.options.peerConfig.iceServers=null==r?void 0:r.iceServers,this.options.peerConfig.encodedInsertableStreams=Si&&(this.options.enableDRM||this.options.metadata)}catch(e){throw aa.error("Error generating token."),e instanceof mr&&(401!==e.status&&this.autoReconnect?this.reconnect():this.stopReconnection=!0),e}if(!r)throw aa.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const s=hi(r.jwt);this.streamName=s.millicast.streamName;const i=new mi({streamName:this.streamName,url:"".concat(r.urls[0],"?token=").concat(r.jwt)});r.subscriberToken&&(this.subscriberToken=r.subscriberToken);const o=e.migrate?new tt:this.webRTCPeer;await o.createRTCPeer(this.options.peerConfig),null==(t=this.stopReemitingWebRTCPeerInstanceEvents)||t.call(this),this.stopReemitingWebRTCPeerInstanceEvents=Gt(o,this,Object.values(Ss).filter(e=>e!==Ss.track)),this.options.metadata&&(this.worker||(this.worker=new ki),this.worker.onmessage=e=>{if("metadata"===e.data.event){const t=new TextDecoder,n=e.data.metadata;if(n.mid=e.data.mid,n.track=this.tracksMidValues[e.data.mid],n.uuid){const e=n.uuid;n.uuid=e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),n.uuid=n.uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5")}if(n.timecode&&(n.timecode=new Date(t.decode(n.timecode))),n.unregistered){const e=t.decode(n.unregistered);try{const t=JSON.parse(e);n.unregistered=t}catch(e){aa.info("The content could not be converted to JSON, returning raw bytes instead")}}this.emit("metadata",n),this.emit("onMetadata",n)}}),o.on(Ss.track,e=>{this.isMainStreamActive?this.onTrackEvent(e):this.eventQueue.push(e)}),i.on(Vs,async e=>{if(this.isMainStreamActive||"active"!==e.name)"inactive"===e.name&&this.isMainStreamActive&&this.mainSourceId===e.data.sourceId&&(this.isMainStreamActive=!1),this.emit(Vs,e);else{if(this.mainSourceId=e.data.sourceId,!this.DRMProfile&&e.data.encryption){const e=await this.tokenGenerator();e.drmObject&&(this.DRMProfile=e.drmObject)}for(this.emit(Vs,e),this.isMainStreamActive=!0;this.eventQueue.length>0;)this.onTrackEvent(this.eventQueue.shift())}});const a=o.getRTCLocalSDP(Me(Ne({},this.options),{stereo:!0})),c=i.connect();n=await Promise.all([a,c]);const l=n[0];let u=this.signaling;this.signaling=i;const d=this.signaling.subscribe(l,Me(Ne({},this.options),{vad:this.options.multiplexedAudioTracks>0})),p=o.peer.setLocalDescription(o.sessionDescription);n=await Promise.all([d,p]);const f=n[0];this.payloadTypeCodec=ms.getCodecPayloadType(f),await o.setRTCRemoteSDP(f),aa.info("Connected to streamName: ",this.streamName);let h=this.webRTCPeer;this.webRTCPeer=o,this.setReconnect(),e.migrate&&this.webRTCPeer.on(Ss.connectionStateChange,e=>{var t,n;"connected"===e?setTimeout(()=>{var e,t;null==(e=null==u?void 0:u.close)||e.call(u),null==(t=null==h?void 0:h.closeRTCPeer)||t.call(h),u=h=null,aa.info("Current connection migrated")},1e3):["disconnected","failed","closed"].includes(e)&&(null==(t=null==u?void 0:u.close)||t.call(u),null==(n=null==h?void 0:h.closeRTCPeer)||n.call(h),u=h=null)})}onTrackEvent(e){var t,n,r;if(this.tracksMidValues[null==(t=e.transceiver)?void 0:t.mid]=e.track,this.isDRMOn){const t=e.transceiver.mid,n=this.getDRMConfiguration(t);try{!function(e,t){const n=Po;var r,s;const i=e[n(629)][n(524)];"video"===i&&(e[n(661)][n(475)]=e[n(661)][n(451)]=e[n(661)][n(605)]=0);const o=ra(t),a=o[n(497)].videoElement,c=o[n(497)][n(628)];if(o[n(607)]){if(o[n(497)].customTransform)window.clRtcDrmDebugLog&&console[n(556)](n(468)+n(572));else if(window[n(600)]&&console[n(556)](n(467)+(n(No?589:609)+n(617))),No){if(o[n(544)]=function(e){const t=Po,n=window[t(493)]||window[t(488)],r=window[t(666)],s=window[t(586)];if(!(n&&r&&s&&e))return null;const i=new r([e]);return new s(n[t(631)](i))}(na),null==o[n(544)])throw new Error(n(539));o[n(544)][n(485)]=e=>{const t=n;e[t(496)][t(567)]===t(471)?Qo(o,e[t(496)].frame,null):ea(o,e[t(496)][t(651)],null)},e[n(661)].transform=new RTCRtpScriptTransform(o.worker,{operation:i})}else{const t=i===n(471)?Qo:ea,r={drm:o,transform:(e,n)=>{t(o,e,n)}},s=e.receiver.createEncodedStreams(),a=new TransformStream({transform:r.transform[n(656)](r)}),{readable:c,writable:l}=s;c[n(577)](a)[n(635)](l)}if("audio"===i&&(null===(r=o[n(497)][n(463)])||void 0===r?void 0:r.encryption)===n(670)){if(!c)return void console.warn(n(690));c[n(588)]!==e[n(481)][0]&&(c[n(588)]=e[n(481)][0]),o[n(497)].videoElement&&(e[n(661)][n(475)]=e[n(661)].jitterBufferDelayHint=e[n(661)][n(605)]=o[n(497)][n(482)],sa(o,e[n(661)]))}else"video"===i&&"clear"===(null===(s=o.config[n(471)])||void 0===s?void 0:s[n(619)])&&a[n(588)]!==e[n(481)][0]&&(a.srcObject=e.streams[0])}else a[n(588)]!==e[n(481)][0]&&(a.srcObject=e[n(481)][0])}(e,n)}catch(e){aa.error("Failed to apply DRM on media Id:",t,"error is: ",e),this.emit("error",new Error("Failed to apply DRM on media Id: "+t+" error is: "+e))}this.worker||(this.worker=new ki),this.worker.addEventListener("message",e=>{"complete"===e.data.event&&function(e,t,n){const r=Po,s=ra(n);e[r(580)]?Qo(s,e,t):ea(s,e,t)}(e.data.frame,null,n)})}if(this.options.metadata)if(_i)e.receiver.transform=new RTCRtpScriptTransform(this.worker,{name:"receiverTransform",payloadTypeCodec:Ne({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(n=e.transceiver)?void 0:n.mid});else if(Si){const{readable:t,writable:n}=e.receiver.createEncodedStreams();this.worker.postMessage({action:"insertable-streams-receiver",payloadTypeCodec:Ne({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(r=e.transceiver)?void 0:r.mid,readable:t,writable:n},[t,n])}this.emit(Ss.track,e)}getDRMConfiguration(e){return this.drmOptionsMap?this.drmOptionsMap.get(e):null}async onRtcDrmFetch(e,t){return t.headers||(t.headers=new Headers),t.headers.get("x-dt-custom-data")&&t.headers.delete("x-dt-custom-data"),this.subscriberToken?t.headers.append("Authorization","Bearer ".concat(this.subscriberToken)):aa.warn("onRtcDrmFetch: no subscriberToken"),fetch(e,t)}configureDRM(e){if(!e)throw new Error("Required DRM options is not provided");this.drmOptionsMap||(this.drmOptionsMap=new Map);const t={merchant:"dolby",environment:De.Production,customTransform:this.options.metadata,videoElement:e.videoElement,audioElement:e.audioElement,video:{codec:"H264",encryption:"cbcs",keyId:Ii(e.videoEncryptionParams.keyId),iv:Ii(e.videoEncryptionParams.iv)},audio:{codec:"opus",encryption:"clear"},onFetch:this.onRtcDrmFetch.bind(this)};e.mediaBufferMs&&(t.mediaBufferMs=e.mediaBufferMs),this.DRMProfile&&(this.DRMProfile.playReadyUrl&&(t.prLicenseUrl=this.DRMProfile.playReadyUrl),this.DRMProfile.widevineUrl&&(t.wvLicenseUrl=this.DRMProfile.widevineUrl),this.DRMProfile.fairPlayUrl&&(t.fpsLicenseUrl=this.DRMProfile.fairPlayUrl),this.DRMProfile.fairPlayCertUrl&&(t.fpsCertificateUrl=this.DRMProfile.fairPlayCertUrl));try{ta(t),this.drmOptionsMap.set(e.videoMid,t),e.audioMid&&this.drmOptionsMap.set(e.audioMid,t),t.videoElement.addEventListener("rtcdrmerror",e=>{aa.error("DRM error: ",e.detail.message,"in video element:",t.videoElement.id),this.emit("error",new Error(e.detail.message))})}catch(t){aa.error("Failed to configure DRM with options:",e,"error is:",t)}}removeDRMConfiguration(e){var t;null==(t=this.drmOptionsMap)||t.delete(e)}get isDRMOn(){return!!this.drmOptionsMap&&this.drmOptionsMap.size>0}exchangeDRMConfiguration(e,t){const n=this.getDRMConfiguration(e),r=this.getDRMConfiguration(t);if(null===n)throw new Error("No DRM configuration found for "+e);if(null===r)throw new Error("No DRM configuration found for "+t);Ci(n.video,r.video,"keyId"),Ci(n.video,r.video,"iv");try{ta(n)}catch(e){aa.error("Failed to configure DRM with options:",n,"error is:",e)}try{ta(r)}catch(e){aa.error("Failed to configure DRM with options:",r,"error is:",e)}}}const la="rts/status",ua="rts/viewer-count",da="stats/stats-frequent";var pa,fa=Object.freeze({__proto__:null,STATUS:la,VIEWER_COUNT:ua,STATS:"rts/stats",STATS_FREQUENT:da});!function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(pa||(pa={}));const ha="is-playing",ma="is-paused",ga="is-loaded",ya="is-loading",va="is-starting",ba="is-seeking",wa="is-disabled",Sa="is-small",Ra="is-tiny",ka="is-rtl",Ia="is-ended",Ca="is-live",xa="is-error",La="is-waiting",Pa="is-autoplay",Oa="is-toggling",Na="is-live-seeked",Ma="no-timeline",Da="has-poster",Fa="will-play",Ua="will-pause",ja="will-seek",Va="is-seekable",Wa="is-in-viewport",Za="no-controls",Ga="is-destroyed";var Ba=Object.freeze({__proto__:null,PLAYING:ha,FULLSCREEN:"is-fullscreen",PAUSED:ma,MUTED:"is-muted",LOADED:ga,LOADING:ya,STARTING:va,SEEKING:ba,GRABBING:"is-grabbing",DISABLED:wa,SMALL:Sa,TINY:Ra,RTL:ka,TV:"is-tv",ENDED:Ia,LIVE:Ca,ERRORED:xa,WAITING:La,AUTOPLAY:Pa,SEAMLESS:"is-seamless",TOGGLING:Oa,LIVE_SEEKED:Na,NO_DVR:Ma,HAS_POSTER:Da,WILL_PLAY:Fa,WILL_PAUSE:Ua,MENU_OPENED:"has-menu-opened",TOUCHED:"is-touched",HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:ja,SEEKABLE:Va,IN_VIEWPORT:Wa,NO_CONTROLS:Za,DESTROYED:Ga,IS_SOURCE_PROCESSING:"is-source-processing"});const za={Unknown:"00-00",MediaUnknown:"01-00",MediaUnavailable:"01-01",MediaUnsupportedVideoFormat:"01-02",MediaUnsupportedAudioFormat:"01-03",MediaBitrateExceeded:"01-04",MediaBufferOverread:"01-05",MediaIntegerOverflow:"01-06",MediaQuotaExceeded:"01-07",MediaInvalidCompositionDuration:"01-08",MediaInvalidCompositionSourceDuration:"01-09",MediaInvalidCompositionSourceStartTime:"01-10",MediaMalformedDepth:"01-11",PlaybackUnknown:"02-00",PlaybackVideoBufferUnderRun:"02-01",PlaybackAudioBufferUnderRun:"02-02",PlaybackVideoBufferingTimeout:"02-03",PlaybackAudioBufferingTimeout:"02-04",PlaybackManifestParseError:"02-05",PlaybackVideoDecodeError:"02-06",PlaybackAudioDecodeError:"02-07",PlaybackDroppedFramesExceeded:"02-08",PlaybackPlayheadExceedsDuration:"02-09",PlaybackUnsupportedDevice:"02-10",PlaybackManifestLoadError:"02-11",PlaybackManifestLoadTimeout:"02-12",PlaybackManifestParsingError:"02-13",PlaybackManifestIncompatibleCodecs:"02-14",PlaybackLevelEmptyError:"02-15",PlaybackLevelLoadError:"02-16",PlaybackLevelLoadTimeout:"02-17",PlaybackLevelSwitchError:"02-18",PlaybackAudioTrackLoadError:"02-19",PlaybackAudioTrackLoadTimeout:"02-20",PlaybackFragLoadError:"02-21",PlaybackFragLoadTimeout:"02-22",PlaybackFragDecryptError:"02-23",PlaybackFragParsingError:"02-24",PlaybackFragGap:"02-25",PlaybackRemuxAllocError:"02-26",PlaybackBufferAddCodecError:"02-27",PlaybackBufferIncompatibleCodecs:"02-28",PlaybackBufferAppendError:"02-29",PlaybackBufferStalledError:"02-30",PlaybackBufferFullError:"02-31",PlaybackBufferSeekOverHole:"02-32",PlaybackBufferNudgeOnStall:"02-33",PlaybackInternalException:"02-34",PlaybackInternalAborted:"02-35",PlaybackManifestLoaderFailure:"02-36",PlaybackSegmentBaseLoaderError:"02-37",PlaybackTimeSyncFailed:"02-38",PlaybackFragmentLoaderFailure:"02-39",PlaybackAppendError:"02-40",PlaybackRemoveError:"02-41",PlaybackDataUpdateFailed:"02-42",PlaybackManifestNoStreams:"02-43",PlaybackUnknownManifestType:"02-44",PlaybackDashInsufficientSegmentInfo:"02-45",PlaybackDashNoRepresentations:"02-46",PlaybackDashNoAdaptationSets:"02-47",PlaybackDashNoInitSegment:"02-48",PlaybackDashUnsupportedContainerFormat:"02-49",PlaybackDashKeySystemMismatch:"02-50",PlaybackMultipleKeyIDs:"02-51",PlaybackDashConflictingKeyIDs:"02-52",PlaybackRestrictedStreams:"02-53",PlaybackHlsMasterAndMediaTags:"02-54",PlaybackRepresentationIdConflict:"02-55",PlaybackHlsUnsupportedKeyFormats:"02-56",PlaybackManifestNoVariants:"02-57",PlaybackHlsUndeclaredVariables:"02-58",PlaybackAes128InvalidKeyLength:"02-59",PlaybackDashConflictingAes128Keys:"02-60",PlaybackDashUnsupportedAes128Encryption:"02-61",PlaybackManifestPatchMismatch:"02-62",PlaybackEmptyMediaPlaylist:"02-63",PlaybackNonContiguousCompositionTrack:"02-64",PlaybackDecoderNotFound:"02-65",PlaybackDecoderTemporarilyUnavailable:"02-66",PlaybackIncompatibleAsset:"02-67",PlaybackNoCompatibleExternalDisplay:"02-69",PlaybackOutOfMemory:"02-70",PlaybackToneMappingFailed:"02-71",PlaybackVideoCompositorFailed:"02-72",NetworkUnknown:"03-00",NetworkNoInternet:"03-01",NetworkRequestTimeout:"03-02",NetworkUnableToResolveHost:"03-03",NetworkResourceNotFound:"03-04",NetworkExpiredUrl:"03-05",NetworkUrlResolutionFailed:"03-06",NetworkDownloadErrorIdManifest:"03-07",NetworkDownloadErrorIdSidx:"03-08",NetworkDownloadErrorIdContent:"03-09",NetworkDownloadErrorIdInitialization:"03-10",NetworkDownloadErrorIdXlink:"03-11",NetworkHttpRequestFailed:"03-12",NetworkMaxRetriesExceeded:"03-13",NetworkSegmentMissing:"03-14",NetworkHttp400BadRequest:"03-400",NetworkHttp401Unauthorized:"03-401",NetworkHttp402PaymentRequired:"03-402",NetworkHttp403Forbidden:"03-403",NetworkHttp404NotFound:"03-404",NetworkHttp405MethodNotAllowed:"03-405",NetworkHttp406NotAcceptable:"03-406",NetworkHttp407ProxyAuthenticationRequired:"03-407",NetworkHttp408RequestTimeout:"03-408",NetworkHttp409Conflict:"03-409",NetworkHttp410Gone:"03-410",NetworkHttp411LengthRequired:"03-411",NetworkHttp412PreconditionFailed:"03-412",NetworkHttp413PayloadTooLarge:"03-413",NetworkHttp414URITooLong:"03-414",NetworkHttp415UnsupportedMediaType:"03-415",NetworkHttp416RangeNotSatisfiable:"03-416",NetworkHttp417ExpectationFailed:"03-417",NetworkHttp418ImATeapot:"03-418",NetworkHttp421MisdirectedRequest:"03-421",NetworkHttp422UnprocessableEntity:"03-422",NetworkHttp423Locked:"03-423",NetworkHttp424FailedDependency:"03-424",NetworkHttp425TooEarly:"03-425",NetworkHttp426UpgradeRequired:"03-426",NetworkHttp428PreconditionRequired:"03-428",NetworkHttp429TooManyRequests:"03-429",NetworkHttp431RequestHeaderFieldsTooLarge:"03-431",NetworkHttp451UnavailableForLegalReasons:"03-451",NetworkHttp500InternalServerError:"03-500",NetworkHttp501NotImplemented:"03-501",NetworkHttp502BadGateway:"03-502",NetworkHttp503ServiceUnavailable:"03-503",NetworkHttp504GatewayTimeout:"03-504",NetworkHttp505HTTPVersionNotSupported:"03-505",NetworkHttp506VariantAlsoNegotiates:"03-506",NetworkHttp507InsufficientStorage:"03-507",NetworkHttp508LoopDetected:"03-508",NetworkHttp510NotExtended:"03-510",NetworkHttp511NetworkAuthenticationRequired:"03-511",ContentProtectionUnknown:"04-00",ContentProtectionConcurrentStreamLimitExceeded:"04-01",ContentProtectionEntitlementRefused:"04-02",ContentProtectionLicenseExpired:"04-03",ContentProtectionBadLicenseRequest:"04-04",ContentProtectionLicenseServerTimeout:"04-05",ContentProtectionInsufficientHDCPSupport:"04-06",ContentProtectionGeoRestricted:"04-07",ContentProtectionParentalControlRestricted:"04-08",ContentProtectionCDNUnauthorized:"04-09",ContentProtectionInvalidAccessToken:"04-10",ContentProtectionKeySystemNoKeys:"04-11",ContentProtectionKeySystemNoAccess:"04-12",ContentProtectionKeySystemNoSession:"04-13",ContentProtectionKeySystemNoConfiguredLicense:"04-14",ContentProtectionKeySystemCertificateRequestFailed:"04-15",ContentProtectionKeySystemCertificateUpdateFailed:"04-16",ContentProtectionKeySystemSessionUpdateFailed:"04-17",ContentProtectionKeySystemStatusOutputRestricted:"04-18",ContentProtectionKeySystemStatusInternalError:"04-19",ContentProtectionKeyLoadError:"04-20",ContentProtectionKeyLoadTimeout:"04-21",ContentProtectionCapabilityMediaKeysError:"04-22",ContentProtectionManifestKeySystemUnknown:"04-23",ContentProtectionKeySystemUnavailable:"04-24",ContentProtectionCDMCreationFailed:"04-25",ContentProtectionCDMAttachFailed:"04-26",ContentProtectionCDMServerCertificateRejected:"04-27",ContentProtectionCDMSessionCreationFailed:"04-28",ContentProtectionCDMLicenseRequestFailed:"04-29",ContentProtectionCDMLicenseResponseRejected:"04-30",ContentProtectionManifestMissingDRMInfo:"04-31",ContentProtectionLicenseServerMissing:"04-32",ContentProtectionOfflineSessionRemoved:"04-33",ContentProtectionInitDataTransformationError:"04-34",ContentProtectionServerCertificateRequestFailed:"04-35",ContentProtectionInsufficientHDCPVersion:"04-36",ContentProtectionHDCPVersionCheckFailed:"04-37",AdsUnknown:"08-00",AdsVastParseError:"08-100",AdsInvalidVastSchema:"08-101",AdsVastVersionNotSupported:"08-102",AdsUnexpectedAdType:"08-200",AdsCreativeLinearityMismatch:"08-201",AdsCreativeDurationMismatch:"08-202",AdsCreativeSizeMismatch:"08-203",AdsWrapperVastError:"08-300",AdsVastResponseRedirectTimeout:"08-301",AdsWrapperLimitReached:"08-302",AdsVastResponseEmpty:"08-303",AdsLinearAdDisplayError:"08-400",AdsMediaFileNotFound:"08-401",AdsMediaFileUnavailable:"08-402",AdsUnsupportedMimeType:"08-403",AdsUnableToDisplayMediaFile:"08-405",AdsMezzanineFileMissing:"08-406",AdsMezzanineFileDownloaded:"08-407",AdsRejectedAd:"08-408",AdsInteractiveCreativeError:"08-409",AdsVerificationNodeExecutionError:"08-410",AdsNonLinearAdDisplayError:"08-500",AdsNonLinearAdSizeMismatch:"08-501",AdsNonLinearAdFetchError:"08-502",AdsNonLinearUnsupportedType:"08-503",AdsCompanionAdDisplayError:"08-600",AdsCompanionAdSizeMismatch:"08-601",AdsRequiredCompanionAdError:"08-602",AdsCompanionAdFetchError:"08-603",AdsUndefinedVastError:"08-900",AdsUnknownVpaidError:"08-901",AdsVastDocumentEmpty:"08-999"},Xa=Object.fromEntries(Object.entries(za).map(([e,t])=>[t,e])),Ka=[1e7]+""+-1e3+-4e3+-8e3+-1e11,$a=()=>"undefined"==typeof crypto?"":Ka.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),Ha="without_recovery",Ja="off";class FlowplayerError extends Error{static getErrorKey(e){return e in Xa?Xa[e]:Xa["00-00"]}constructor(e,t,n={}){super(e),this.message=e,this.flowplayerErrorCode=t,this.config=n,this.id=$a(),this.isFatal=!!n.isFatal,this.errorKey=FlowplayerError.getErrorKey(this.flowplayerErrorCode)||"unknown"}toJSON(){return{message:this.message,flowplayer_error_code:this.flowplayerErrorCode,id:this.id,root_error_id:this.config.rootErrorId,resource:this.config.resource,is_fatal:this.isFatal,is_retry:!!this.config.isRetry}}}const Qa=[],qa=[];function ec(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),i=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),o=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),l=/SamsungBrowser/.test(t),u=l&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:i,firefox:o,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:l,samsung_tv:l&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}var tc=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",VIDEO_MENU:"flowplayer-video-menu",UI:"flowplayer-ui",LOGO:"flowplayer-logo",CONTROL:"flowplayer-control",CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:"flowplayer-live-status",ELAPSED:"flowplayer-elapsed-time",TIMELINE:"flowplayer-timeline-bar",CHAPTERS_TIMELINE:"flowplayer-chapters-timeline-bar",CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:"flowplayer-header",HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:"flowplayer-header-right-zone",HEADER_DURATION:"flowplayer-header-duration",MIDDLE:"flowplayer-middle",MIDDLE_ZONE:"flowplayer-middle-zone",WAIT:"flowplayer-wait",MIDDLE_BUTTONS:"flowplayer-middle-buttons",MIDDLE_LEFT_ZONE:"flowplayer-middle-left-zone",MIDDLE_RIGHT_ZONE:"flowplayer-middle-right-zone",ENDSCREEN_INTERSTITIAL:"flowplayer-endscreen-interstitial",ENDSCREEN_UP_NEXT:"flowplayer-endscreen-up-next",ENDSCREEN_GRID:"flowplayer-endscreen-grid",PLAYLIST_INTERSTITIAL:"flowplayer-playlist-interstitial",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:"flowplayer-small-play-icon",SMALL_PAUSE_ICON:"flowplayer-small-pause-icon",PLAY_ICON:"flowplayer-play-icon",PAUSE_ICON:"flowplayer-pause-icon",FULLSCREEN_ENTER_ICON:"flowplayer-fullscreen-enter-icon",FULLSCREEN_EXIT_ICON:"flowplayer-fullscreen-exit-icon",SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:"flowplayer-fast-forward-icon",REWIND_ICON:"flowplayer-rewind-icon",SHARE_ICON:"flowplayer-share-icon",SUBTITLES_MENU_ICON:"flowplayer-subs-menu-icon",MENU_BACK_ICON:"flowplayer-menu-back",VOLUME_ICON:"flowplayer-volume-icon",MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:"flowplayer-live-countdown",PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:"flowplayer-error",TV_MENU:"flowplayer-tv-menu",CUE_COMPONENT:"flowplayer-cue",SSAI_UI:"flowplayer-ssai-ui",SSAI_CONTROLS:"flowplayer-ssai-controls",SSAI_TIMELINE:"flowplayer-ssai-timeline",SSAI_INDICATOR:"flowplayer-ssai-indicator"});function nc(e){this.message=e}nc.prototype=new Error,nc.prototype.name="InvalidCharacterError";var rc="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new nc("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,i=0,o="";r=t.charAt(i++);~r&&(n=s%4?64*n+r:r,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};var sc=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 function(e){return decodeURIComponent(rc(e).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return rc(t)}};function ic(e){this.message=e}ic.prototype=new Error,ic.prototype.name="InvalidTokenError";var oc=function(e,t){if("string"!=typeof e)throw new ic("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(sc(e.split(".")[n]))}catch(e){throw new ic("Invalid token specified: "+e.message)}};oc.InvalidTokenError=ic;const ac=new Map,lc=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const s=window.customElements.get(n);return"function"!=typeof s?r:s})(e._customElements,t))(e);var uc,dc;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(uc||(uc={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(dc||(dc={}));const pc=e=>{return e.autoplay&&dc.AUDIO_REQUIRED&(!0===(t=e.autoplay)?dc.ON:!1===t?dc.OFF:t);var t};function fc(e,t,n){const r="boolean"==typeof n;if("boolean"!=typeof n&&(n=!!e.hasState(Ua)||e.paused),function(e,t,n){const r=e.poll(t?J:Q,{forced:n});return r&&r.defaultPrevented}(e,n,r))return Promise.resolve();if(!n)return e.hasState(Fa)?(e.setState(Ua,!0),e.setState(Fa,!1),Promise.resolve()):Promise.resolve(e.pause());if(0==e.reaper)return Promise.resolve();const s=e.reaper.get("__pending_play");return e.paused||s?s?(s.src!==mc(e.original_src)&&hc(e),s):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==mc(e.original_src)}(e)&&hc(e),function(e){const t=e.hasState(Pa),n=t&&pc(e.opts);n&&(e.muted&&e.toggleMute(!1),0==e.volume&&(e.volume=1));t&&e.setState(Pa,!1);return e.play().then(()=>{e.hasState(Ua)&&e.togglePlay(!1)}).catch(r=>{if(console.warn(t?n?"[flowplayer/play] autoplay audio required\n%s":"[flowplayer/play] attempting muted autoplay\n%s":"",r.message,"\ninstance:",e),t&&!n)return e.muted=!0,e.play()})}(e)):(e.setState(Ua,!1),!e.hasState(ha)&&e.setState(Fa,!0),Promise.resolve())}function hc(e){e.opts.is_native&&(e.hasState(ga)||(e.hasState(ya)||e.emit(q),e.setState(ya,!0),e.load()))}function mc(e){const t=document.createElement("a");return t.href=e,t.href}function gc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[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])&&(n[r[s]]=e[r[s]])}return n}function yc(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function vc(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const bc=e=>{var{src:t}=e,n=gc(e,["src"]);return[Object.assign({src:t,type:t?vc("video/"+yc(t)):""},n)]};function wc(e){return bc({src:e})}function Sc(e){var{src:t,type:n}=e,r=gc(e,["src","type"]);return t&&n?[Object.assign({src:t,type:n},r)]:n&&!t?[Object.assign({type:n},r)]:bc(Object.assign({src:t},r))}const _c="health:record",Rc="rebuffer",Ec="rebuffer:ended",kc="display",Ic="insights:ttff",Cc="insights:time_to_first_frag_loaded",xc="insights:watched_interval",Tc="flowplayer:feature",Ac="health:ready";var Lc=Object.freeze({__proto__:null,RECORD:_c,REBUFFER:Rc,REBUFFER_ENDED:Ec,DISPLAY:kc,TIME_TO_FIRST_FRAME:Ic,TIME_TO_FIRST_FRAGMENT_LOADED:Cc,WATCHED_INTERVAL:xc,FEATURE_USAGE:Tc,HEALTH_SERVICE_READY:Ac});const Pc={All:1,High:.1,Medium:.01,Low:.001,None:0};function Oc(e,{feature_name:t,behavior:n,sample_rate:r}){t&&(r||(r=Pc.All),e.emit(Tc,{feature_name:t,behavior:n,sample_rate:r}))}var Nc;function Mc(e,t,n,r={safari:!1}){const s=function(e){return"string"==typeof e?wc(e):Array.isArray(e)||"object"!=typeof e?e.reduce(function(e,t){return"string"==typeof t&&(t=wc(t)),"object"!=typeof t||Array.isArray(t)||(t=Sc(t)),e.concat(t)},[]):Sc(e)}(n);return function(e){[ba,Ua,Fa,ha,ma,ya,ga,Na].forEach(t=>e.setState(t,!1)),e.setState(va,!0)}(e),Array(...Array(s.length)).map((e,t)=>t).some(n=>{const i=s[n];if(Nc.Ok==function(e,t,n){e.emit(A,n),t.playback_token&&"string"==typeof n.src&&n.src.startsWith("https://")&&(n.src=function(e,t){const n=new URL(e);return n.pathname=`/pt:${t}${n.pathname}`,n.toString()}(n.src,t.playback_token),Oc(e,{feature_name:"signed-urls",behavior:"used",sample_rate:.1}));"string"==typeof n.src&&(e.original_src=n.src);const r=function(e,t,n){return e.plugins.filter(e=>function(e){return e&&"wants"in e}(e)).find(e=>e.wants(n.src||"",n,t))}(e,t,n);return e.setOpts({is_native:!r}),r?(r.onload(t,e.root,e,n),Nc.Ok):Nc.Err}(e,t,i)||Nc.Ok==function(e,t,n,r={safari:!1}){var s;/^audio\//.test(n.type||"")&&e.emit(Y);t.start_time&&(n.src=n.src+"#t="+t.start_time);if(""==e.canPlayType(n.type||""))return Nc.Err;if(n.drm&&(!n.drm["com.apple.fps.1_0"]||!r.safari))return Nc.Err;"string"==typeof n.src&&(e.preload=null!==(s=t.preload)&&void 0!==s?s:"auto",e.src=n.src);return Nc.Ok}(e,t,i,r))return!0;n==s.length-1&&"string"==typeof i.src&&(e.src=i.src)}),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(Nc||(Nc={}));const Dc=[L,k,A,W];var Fc;function Uc(e,t,n){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=n,0==t.offset?jc(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout(function(){0!=e.reaper&&(e.currentTime=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.currentTime+t.offset,e.duration),t.timer=0,jc(e,t))},1e3),function(e,t){e.setState(ja,!0),e.setState(Fc.BACKWARD,t.offset<0),e.setState(Fc.FORWARD,t.offset>0)}(e,t),e.emit(V,t),t))}function jc(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(Fc.FORWARD,!1),e.setState(Fc.BACKWARD,!1),e.setState(ja,!1)}(e)}function Vc(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function Wc(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(Fc||(Fc={}));function Zc(e,t,n,r){if((r=r||0)>=e.length)return n;return Wc(e[r],t,Zc(e,t,n,r+1))}const Gc="flowplayer/uuid";let Bc="";!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const Yc=["touchstart","touchmove"];function zc(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}function Xc(e,t,n){const r=zc(t,n);return e.dispatchEvent(r),e}function Kc(e,t,n){const r=zc(t,n);return e.dispatchEvent(r),r}function $c(e,t,n,r){Array.isArray(t)?t.forEach(t=>Hc(e,t,n,r)):Hc(e,t,n,r)}function Hc(e,t,n,r){if(s=t,!~Yc.indexOf(s))return e.addEventListener(t,n,r),e;var s;const i=Object.assign(r||{},{passive:!0});return e.addEventListener(t,n,i),e}function Jc(e,t,n,r){return $c(e,t,n,Object.assign(r||{},{once:!0}))}class PlayerStorage{constructor(e,t){this.implementation=e,t&&t.keys().forEach(e=>{"string"==typeof t.implementation[e]&&this.implementation.setItem(e,t.implementation[e])})}keys(){var e;const t=[];for(var n=0;n<this.implementation.length;n++)(null===(e=this.implementation.key(n))||void 0===e?void 0:e.startsWith("flowplayer/"))&&t.push(this.implementation.key(n));return t}removeItem(e){try{this.implementation.removeItem(`flowplayer/${e}`)}catch(e){}}getItem(e){try{return this.implementation.getItem(`flowplayer/${e}`)}catch(e){return null}}setItem(e,t){try{this.implementation.setItem(`flowplayer/${e}`,t)}catch(e){}}clear(){try{this.keys().forEach(e=>this.implementation.removeItem(e))}catch(e){}}get length(){try{return this.keys().length}catch(e){return 0}}key(e){try{return this.implementation.key(e)}catch(e){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(e){var t;return(null===(t=this.pairs.find(t=>t[0]===e))||void 0===t?void 0:t[1])||null}key(e){return this.pairs[e][0]||null}removeItem(e){this.pairs=this.pairs.filter(t=>t[0]!==e)}setItem(e,t){this.removeItem(e),this.pairs.push([e,t])}}const Qc={preload:"auto",rtl:!1,controls:!0},qc=["muted","preload"];function el(e,t,n){let r;n.live_state={dvr_window:void 0,get dvr(){return r},set dvr(t){r=t;const s=!(!e.live||t);n.hasState(Ma)!=s&&n.setState(Ma,s)}},n._storage=new PlayerStorage(function(){const e=["localStorage","sessionStorage"].map(e=>{try{const t=window[e];return t.getItem(""),t}catch(t){return console.debug(`Access to window.${e} denied, trying next option`),null}}).find(e=>!!e)||new InMemoryStorage;return e}()),n.toJSON=function(){return{duration:n.duration,volume:n.volume,currentTime:n.currentTime,states:n.root.className}},n.setSrc=function(t){return Mc(n,e,t,ec())},n.playerState=n.playerState||{},n.setState=function(e,t){if(n.playerState[e]===!!t)return n;const r=Object.assign({},n.playerState,{[e]:t});return n.playerState=r,Xc(n,H,n.playerState),n},n.createComponents=function(...e){return Array.from({length:e.length}).map((t,n)=>lc(this,e[n]))},n.hasState=function(e){return!!n.playerState[e]},n.transitionState=function(e,t,r){!n.hasState(e)&&n.hasState(t)||(r=0),r&&n.setState(Oa,!0),n.setState(t,!1),n.setState(e,!0),r&&setTimeout(function(){n.setState(Oa,!1)},r)},n.emit=(e,t)=>(Xc(n,e,t),n),n.on=(e,t)=>($c(n,e,t),n),n.once=(e,t)=>(Jc(n,e,t),n),n.off=(e,t)=>(function(e,t,n){e.removeEventListener(t,n)}(n,e,t),n),n.poll=(e,t)=>Kc(n,e,t),n.togglePlay=function(e){return n.hasState(xa)?Promise.reject():fc(n,0,e)},n.toggleMute=function(e){e=null==e?!n.muted:!!e,n.muted=e,n.muted||n.volume||(n.volume=1),Xc(n,m)},n.toggleDisable=function(e){e=null==e?!n.disabled:!!e,n.setState(wa,e),n.disabled=e},n.destroy=function(){n.pause();const e=qa.indexOf(n);~e&&qa.splice(e,1),setTimeout(function(){n.setSrc([]),n.reaper&&n.reaper.clear(),Xc(n,L),n.setState(Ga,!0)},0)},n.setAttrs=function(e){return qc.forEach(t=>{if(!(t in e))return;const r=e[t];r?n.setAttribute(t,r.toString()):n.removeAttribute(t)}),n},n.opt=function(t,n){return n=void 0===n?Wc(Qc,t):n,Wc(e,t,n)},n.i18n=function(e,t){if(!n.reaper)return"";const r=n.reaper.get("translations");return r?Zc(r,e,t||""):t||""},n.setOpts=function(r){Object.assign(e,r),e.live&&!n.hasState(Ca)&&(n.setState(Ma,!0),Xc(n,U)),"disabled"in r&&void 0!==r.disabled&&n.toggleDisable(r.disabled),"muted"in r&&void 0!==r.muted&&n.toggleMute(r.muted),"dvr"in e&&(n.live_state.dvr=n.opt("dvr")),n.setState(ka,n.opt("rtl",function(e){if(!e)return Vc();const t=e.getAttribute("dir");return t?"rtl"==t:Vc()}(t))),n.setState(Ca,!!e.live),n.setState(Da,"string"==typeof e.poster&&e.poster.length>0),n.setState(Va,!!e.seekable),n.setState(Za,0==e.controls),t.style.backgroundImage=n.hasState(Da)?"url('"+e.poster+"')":"",Xc(n,K,e)},n.renderPlugin=function(e){Kc(n,B,e).defaultPrevented||n.root.appendChild(e)};const s={offset:0,timer:0};var i,o;o=s,(i=n).on(Dc,function(){jc(i,o)}),n.enqueueSeek=function(e){if(0!=n.opts.seekable&&!(1==n.opts.disabled&&e>0))return Uc(n,s,e)},n.deviceId=function(){return function(e){if(Bc)return Bc;try{const t=e.getItem(Gc);if(t)return t;const n=$a();return e.setItem(Gc,n),n}catch(e){return Bc=$a()}}(n._storage)}}const tl=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function nl(e,t){return!!~tl.indexOf(e)||e.indexOf(t)===e.length-t.length}nl.check_whitelist=function(e){return!!~tl.indexOf(e)};const rl="production";function sl(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=oc(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&sl.validate(n),n}var il;function ol(e){return{grant:e,is_granted:t=>(e&t)===t}}function al({root:e,video:t,data:n}){t&&t.destroy(),console.error(new Error(n.details||n.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const r=document.createElement("h2");r.textContent="Playback Error";const s=document.createElement("p");s.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const o=document.createElement("img");o.src="https://flowplayer.com/user/pages/images/logo-white.png",o.alt="Flowplayer Logo",e.append(r,s,i,o)}function cl(e){return t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return e(t)},0)}}sl.validate=function(e){if("string"==typeof e&&(e=sl(e)),!e||!e.raw){if(nl.check_whitelist(window.location.hostname)||"dev"===rl.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=nl.bind(null,t);if("dev"!==rl.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==rl.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},sl.id=function(e){if(e)return"string"==typeof e&&(e=sl(e)),e.data.id},function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(il||(il={})),ol.of=ol,ol.from_token=function(e){const t=sl(e,{require_valid_token:!0});return ol.of(t.data.acl)},ol.permissions=il;const ll="is-casting",ul="has-casted";function dl(e){return function(e,t){const n=e.seekable;if("object"!=typeof e.opts||0==n.length)return{head:0,tail:0};const r=pl(e),s=t||e.live_state.dvr_window;return{head:r,tail:"number"!=typeof s||r-s<0?n.start(0):r-s}}(e).tail}function pl(e){var t;const n=e.seekable;return n.length?e.hasState("is-chromecast-playing")||!(null===(t=e.hls)||void 0===t?void 0:t.liveSyncPosition)?n.end(n.length-1):e.hls.liveSyncPosition:0}function fl(e){try{e.dvr_offset=0,e.currentTime=pl(e)}catch(e){console.warn("failed to seek to now: %j",e)}}function hl(e,t){const n=t.clientWidth;t.classList.toggle(Sa,n<600),t.classList.toggle(Ra,n<400)}function ml(e,t,n){let r=!0;t.classList.add("flowplayer"),hl(0,t),Jc(n,h,()=>{void 0!==e.start_quality&&Oc(n,{feature_name:"start-quality",behavior:String(e.start_quality),sample_rate:Pc.High})}),$c(n,h,()=>{if(!n.hasState(ya)&&!n.hasState(ga)&&e.is_native&&"none"!==e.preload)return"metadata"===e.preload?(n.setState(ya,!0),n.emit(q)):void hc(n)}),$c(n,u,()=>{e.is_native&&"metadata"===e.preload&&n.paused&&n.emit(_)}),$c(n,[h,a],function(){hl(0,t)}),$c(n,H,function(){Object.entries(n.playerState).forEach(function([e,n]){t.classList.toggle(e,n)})}),$c(n,f,function(){n.setState(La,!n.hasState(ll)&&!n.hasState(va)&&n.readyState<3)}),$c(n,R,function(t){const r=n.original_src;cl(()=>{if(r===n.original_src){if(n.setState(Ia,!0),Jc(n,f,function(){n.setState(Ia,!1),r===n.original_src&&n.setState(va,!e.loop&&!!e.rewind&&n.paused)}),e.loop)return n.togglePlay(!0);e.rewind&&(n.currentTime=0)}})(t)}),$c(n,[k,E],function(e){n.setState(ba,e.type==k)}),$c(n,Z,function(e){setTimeout(()=>{e.defaultPrevented||(n.currentTime=e.detail.currentTime)},0)}),$c(n,R,function(){n.setState(ha,!1),r=!0}),$c(n,p,()=>{if(!n.opts.live||!n.opts.is_native)return;const e=n.seekable;0!=e.length&&n.emit("dvr/window",e.end(e.length-1)-e.start(0))}),$c(n,d,function(){n.setState(ga,!0),n.setState(ya,!1)}),$c(n,v,()=>{n.setState(Fa,!0)}),$c(n,[w,_,h],function(t){if(!n.hasState(ba)&&(t.type!=_||e.autoplay||n.setState(La,!1),t.type!=h||"none"!=n.opt("preload")||e.autoplay)){if(t.type==h&&e.autoplay)return Jc(n,y,function(){n.setState(La,!1)});t.type!=w||n.hasState(ga)||n.setState(ya,!0),n.setState(Ia,!1),n.setState(La,t.type==w)}}),$c(n,[y,g],function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const s=t.type==y,i=n.currentTime==n.duration,o=s&&r&&e.autoplay||n.hasState(La);if(s&&(n.started=!0,r=!1),n.setState(La,!1).setState(Fa,!1),!s&&n.setState(Ua,!1),i)return;const a=s?ha:ma,c=s?ma:ha;n.transitionState(a,c,o?0:300),!n.hasState(va)||n.root.classList.contains("ad-hide-first-frame")||n.root.classList.contains("preroll-ios")||function(e,t){if(!e.hasState(Ca)||![void 0,0,-1].includes(t)||!e.seekable.length||e.hasState(ul))return e.setState(va,!1);e.once(E,()=>e.setState(va,!1)),0===t?function(e){e.currentTime=dl(e)}(e):fl(e)}(n,e.start_time)})}const gl=[0].concat(Array.from({length:100}).map((e,t)=>(t+1)/100));function yl(){return qa.find(e=>e.hasState(ll))}const vl=.5625;function bl(e){if("number"==typeof e&&!isNaN(e))return Number(e);if("string"==typeof e){const t=e.split(":");return Number(t[1])/Number(t[0])}return e}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(e,t,n){this.root=t,this.player=n,this.wireUp()}wireUp(){var e,t;this.cleanUp(),null===(e=this.player)||void 0===e||e.once(y,this.render),null===(t=this.player)||void 0===t||t.once(R,this.wireUp)}cleanUp(){var e,t,n,r;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo),null===(n=this.player)||void 0===n||n.off(y,this.render),null===(r=this.player)||void 0===r||r.off(R,this.wireUp)}render(){var e,t,n;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo);const r=(null===(n=this.root)||void 0===n?void 0:n.querySelector(".fp-ui"))||this.root;if(!r)return;const s=this._logo=document.createElement("a");s.href="https://explorer.flowplayer.com",s.target="_blank",Object.entries(wl).forEach(([e,t])=>{s.style.setProperty(e,t,"important")}),r.appendChild(s)}}ExplorerPlan.pluginName="explorer-plan";const wl={display:"block",opacity:"1",visibility:"visible",width:"33%","padding-top":"9%",position:"absolute","z-index":"9999",bottom:"25%",left:"10%","background-size":"cover","background-image":"url(https://static.flowplayer.com/explorer/explorer.svg)"},Sl="flowplayer/"+y;function _l(e,t){const n=[];e.addEventListener("contextmenu",r=>{const s=r.timeStamp;for(n.push(s);n.length>3;)n.shift();n.length>=3&&n.every(e=>e-s<3e3)&&(console.debug("flowplayer/debug rendering info"),function(e,t){var n;!function(e){const t=e.querySelector(".debug-info");null==t||t.remove()}(e);const r=document.createElement("div");r.classList.add("debug-info");const s=Rl("flowplayer.version","3.34.2");r.append(s);const i=null===(n=null==t?void 0:t.hls)||void 0===n?void 0:n.constructor;if(i&&i.version){const e=Rl("hls.version",i.version);r.append(e)}e.appendChild(r)}(e,t))})}const Rl=(e,t)=>{const n=document.createElement("div");n.classList.add("row",e);const r=document.createElement("span");r.classList.add("attr"),r.textContent=e;const s=document.createElement("span");return s.textContent=t,s.classList.add("value"),n.append(r,s),n};const El=t("core/retry");function kl(e,t){const n={pending:void 0,count:0};e.on(ee,s=>{var i,o,a,c,l;const u=null===(i=s.detail)||void 0===i?void 0:i.error;u.config.isRetry=!!n.count,void 0===n.pending&&(null===(a=null===(o=u.config)||void 0===o?void 0:o.retryOpts)||void 0===a?void 0:a.retry)!==Ja&&(t.retry||(null===(l=null===(c=u.config)||void 0===c?void 0:c.retryOpts)||void 0===l?void 0:l.retry))&&(++n.count,n.pending=function(e,t,n){var s,i;return setTimeout(()=>{var s;e.hasState(Ga)||(t.pending=void 0,(null===(s=n.config.retryOpts)||void 0===s?void 0:s.retry)!==Ha&&e.emit(j),e.emit(r,{error:n}),El("%s try",t.count))},null!==(i=null===(s=n.config.retryOpts)||void 0===s?void 0:s.retryTimeout)&&void 0!==i?i:3e3*t.count)}(e,n,u))}),e.on(y,()=>{n.count=0}),e.on([A,j],e=>{e.type===A&&(n.count=0),clearTimeout(n.pending),n.pending=void 0}),e.on(r,cl(()=>{e.load()}))}const Il=[q,s,A];function Cl(e){try{return!!new URL(e)}catch(e){return!1}}const xl=navigator;function Tl(e){var t,n;const r=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return r?1e-6*r:(null===(n=xl.connection)||void 0===n?void 0:n.downlink)||-1}function Al(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const Ll=e=>{switch(e){case!0:return dc.ON;case!1:return dc.OFF;default:return e}};function Pl(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const Ol=[],Nl="https://ihi.flowplayer.com/v1/health/events";function Ml(e){if(e.suspended)return;const t=Ol.slice(0);Ol.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),Al(function(){try{return"undefined"==typeof window?Nl:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:Nl}catch(e){return Nl}}(),t))}async function Dl(e,t,n){const r=await Ul();Ol.push(Object.assign(t,r)),e.logger.log(":enqueue",t.event,t),Ol.length<10&&!n||Ml(e)}const Fl=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},Ul=async()=>({client_time:Date.now()}),jl=(e,t)=>Object.assign(e,{detail:t}),Vl=(e,{event:t,media_session_id:n,session_id:r,play_range_id:s})=>({event:t,media_session_id:n,session_id:r,play_range_id:s,device_id:e.deviceId(),version:"3.34.2",commit:"0fb3bf5690263ef02228e4ccbc86b57faf2b4f65",ima_sdk_version:Fl(),preload:e.opt("preload"),autoplay:Ll(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:Tl(e),page_url:Pl(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id")||e.opt("metadata.stream_target_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),Wl=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});const Zl=(e,t)=>{let n=null;return(...r)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...r),e)}};var Gl;!function(e){e[e.Starting=0]="Starting",e[e.ConfigFinalized=1]="ConfigFinalized",e[e.TimerStartedWithAutoplay=2]="TimerStartedWithAutoplay",e[e.TimerStartedWithUserGesture=3]="TimerStartedWithUserGesture",e[e.MetricReported=4]="MetricReported"}(Gl||(Gl={}));const Bl=[i,o];class TimeToFirstFrame{constructor(e=Gl.Starting,t=!1){this.state=e,this.loadedAd=t}reset(){this.state=Gl.Starting,this.loadedAd=!1,this.start=void 0,this.end=void 0,this.adDetails=void 0}adInfo(){const{ad_tag_id:e,vast_ad_id:t}=this.adDetails||{};return{ad_tag_id:e,vast_ad_id:t}}toJSON(){return Object.assign({ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round(this.end&&this.start?this.end-this.start:-1)},this.adInfo())}startTimer(e){this.state==Gl.ConfigFinalized&&(this.state=e,this.start=performance.now())}hasStarted(){return[Gl.TimerStartedWithAutoplay,Gl.TimerStartedWithUserGesture].includes(this.state)}stopTimer(e){this.hasStarted()&&(this.end||(this.end=performance.now()),this.state=Gl.MetricReported,e())}}function Yl(e){return Math.round(1e3*e)/1e3}class EWMA{constructor(e){this.tickInterval=e,this.ewma=0,this.startTime=Date.now()}decay(){const e=Date.now()-this.startTime;return Math.pow(2,-e/(4*this.tickInterval))}update(e){const t=this.decay();return this.ewma=t*this.ewma+(1-t)*e,this.ewma}toJSON(){return this.ewma}}const zl={skipUnreliableSegments:!0};class WatchedState{constructor(e){this.player=e,this.marchingInterval=void 0,this.lastWatchedPoint=void 0,this.watchedSum=0,this.lastReportedSum=0,this.ewmaTickWatched=new EWMA(WatchedState.AccuracyMilliseconds)}reset(){this.onNotWatching(),this.watchedSum=0,this.lastReportedSum=0,this.lastWatchedPoint=void 0}onNotWatching(){this.marchingInterval&&(this.updateWatched(),this.marchingInterval=clearInterval(this.marchingInterval))}onWatching(){this.marchingInterval||(this.lastWatchedPoint=this.createWatchedPoint(),this.marchingInterval=setInterval(()=>{this.updateWatched()},WatchedState.AccuracyMilliseconds))}createWatchedPoint(){return{currentTime:this.player.currentTime,paused:this.player.paused}}updateWatched(){const e=this.createWatchedPoint();this.lastWatchedPoint&&this.calculateTimeWatched(this.lastWatchedPoint,e),this.lastWatchedPoint=e}calculateTimeWatched(e,t){var n,r;const s=t.currentTime-e.currentTime,i=this.ewmaTickWatched.update(s);if(!(s<0)&&!(!1!==(null===(r=null===(n=this.player.opts)||void 0===n?void 0:n.health)||void 0===r?void 0:r.skipUnreliableSegments)&&1e3*s>1.3*WatchedState.AccuracyMilliseconds)&&(this.watchedSum+=s,this.watchedSum!=this.lastReportedSum&&(this.watchedSum>this.lastReportedSum+WatchedState.ReportingIntervalSeconds||this.player.ended))){const e=Yl(i),t={total_watched_seconds:Yl(this.watchedSum),tick_watched_seconds:e,batch_watched_seconds:Yl(this.watchedSum-this.lastReportedSum)};this.lastReportedSum=this.watchedSum,this.player.emit(xc,t)}}}WatchedState.ReportingIntervalSeconds=5,WatchedState.AccuracyMilliseconds=160;const Xl=$a();class Health{constructor(e,n){let r;this.session_id=Xl,this.suspended=!1,this.logger=t("health",n.opts),this.media_session_id=$a(),this.play_range_id=$a(),this.analyticsLoop=setInterval(()=>Ml(this),2e3),n.on(L,()=>clearInterval(this.analyticsLoop)),n.on(y,()=>{r!==this.media_session_id&&(r=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=$a()});let s=Date.now()-1e3;n.on(f,e=>{if(r!==this.media_session_id)return;const t=Date.now();if(t<s)return;s=Date.now()+5e3;const i=Vl(n,this.eventInfo(e.type)),o=jl(i,{duration:(a=n.duration,Number.isFinite(a)?a:a===1/0?-1:void 0)});var a;this.first_playing_event_timestamp&&(Object.assign(o,{ms_since_first_playing:t-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),Dl(this,o)});const i=this;if(n.health={get media_session_id(){return i.media_session_id},set media_session_id(e){i.media_session_id=e},get session_id(){return i.session_id},set session_id(e){i.session_id=e},toggle(e){e?i.resume():i.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>Ml(this),2e3)}init(e,t,n){if(Pl().toString().startsWith("data:"))return this.suspend();!function(e){let t=null;const n=()=>{t=null};e.on(w,function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e.emit(Rc))}),e.on(Rc,e=>{t=e}),e.on(_,r=>{if(t){const s=r.timeStamp-t.timeStamp;if(n(),s<31)return;if(s>3e5)return;e.emit(Ec,{rebuffer_duration:s/1e3})}}),Il.forEach(t=>e.on(t,n))}(n),function(e){let t;[_,q].forEach(n=>{e.on(n,n=>{const r=Date.now();switch(n.type){case q:return t=r;case _:if(t)return e.emit(Cc,{ms_since_loading_started:r-t}),t=null}})})}(n),function(e){if(void 0===window.performance)return;const t=new TimeToFirstFrame;e.on(A,()=>{if(!e.opt("metadata.media_id"))return t.reset();t.reset(),t.state=Gl.ConfigFinalized}),e.on(q,()=>{(e.root.classList.contains("ad-hide-first-frame")||e.opt("autoplay"))&&t.startTimer(Gl.TimerStartedWithAutoplay)}),Bl.forEach(n=>{e.on(n,()=>{e.opt("autoplay")||t.startTimer(Gl.TimerStartedWithUserGesture)})}),e.on("ad-requested",()=>{t.loadedAd=!0}),e.on(f,()=>{if(!(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA)){if(e.root.classList.contains("ad-hide-first-frame"))return!t.end&&(t.end=performance.now());switch(t.state){case Gl.TimerStartedWithAutoplay:case Gl.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(Ic,t.toJSON()))}}}),e.on("ad-started",n=>{switch(t.end=void 0,t.adDetails=n.detail,t.state){case Gl.TimerStartedWithAutoplay:case Gl.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(Ic,t.toJSON()))}})}(n),function(e){const t=new WatchedState(e);e.on(q,()=>t.reset()),e.on(y,()=>t.onWatching()),e.on(Ec,()=>!e.paused&&t.onWatching()),e.on(Rc,()=>t.onNotWatching()),e.on(g,()=>t.onNotWatching()),e.on(k,()=>{e.currentTime>1&&t.updateWatched(),t.onNotWatching()}),e.on(E,()=>{e.paused||t.onWatching()}),e.on(R,()=>t.updateWatched()),e.on("visibilitychange",()=>t.updateWatched())}(n),n.on(kc,e=>{Dl(this,Vl(n,this.eventInfo(e.type)),!0)}),n.on(_c,({detail:e})=>{const t=Vl(n,this.eventInfo(e.event));Object.assign(t,e.detail||{}),Dl(this,t)}),n.on(Tc,e=>{if(t=e.detail.sample_rate,!Object.values(Pc).includes(t))return console.debug(`sample_rate=${e.detail.sample_rate} is invalid`);var t,r;if(!(0!==(r=e.detail).sample_rate&&Math.random()<=r.sample_rate))return;const s=Vl(n,this.eventInfo(e.type));Dl(this,jl(s,e.detail))}),n.on(A,()=>{n.opt("metadata.media_id")&&n.emit(Ac)}),[h,u,d,p,w,Rc].forEach(e=>{n.on(e,e=>{Dl(this,Vl(n,this.eventInfo(e.type)))})}),[Ec,Ic,Cc,xc].forEach(e=>{n.on(e,e=>{const t=Vl(n,this.eventInfo(e.type));Dl(this,Object.assign(t,e.detail))})}),[y,g,k,E,R,c,l,_,q].forEach(e=>{n.on(e,e=>{Dl(this,Vl(n,this.eventInfo(e.type)))})}),n.on(m,Zl(800,e=>{const t=Vl(n,this.eventInfo(e.type));Dl(this,jl(t,{volume:parseFloat(n.volume.toFixed(2)),muted:n.muted}))})),n.on(a,Zl(800,e=>{const r=Vl(n,this.eventInfo(e.type));Dl(this,jl(r,{height:t.clientHeight,width:t.clientWidth}))})),n.on("hls/failover",e=>{const t=Vl(n,this.eventInfo(e.type)),r=e.detail,{reason:s,from:i}=r;Dl(this,jl(t,{reason:s,from:i}))}),n.on(N,({type:e,detail:t})=>{if("hls"===t.plugin)return function(e,t,n,r){const s=Vl(t,e.eventInfo(n)),i=Object.assign({before:Wl(r.before),after:Wl(r.after),automatic:r.automatic,downscale:r.downscale},r.before?{}:{start_quality:t.opts.start_quality});Dl(e,Object.assign(Object.assign({},s),{state:i}))}(this,n,e,t)}),n.on(ee,e=>{const t=Vl(n,this.eventInfo(e.type)),r=e.detail.error;if(!r)return Dl(this,t,!0);return Dl(this,jl(t,r.toJSON()),!0)}),n.on(A,e=>{var t;const r=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof r)return;if(!Cl(n.original_src))return;if(!Cl(r))return;if(r==n.original_src)return;this.media_session_id=$a();Dl(this,Vl(n,this.eventInfo(e.type))),Ml(this),n.setOpts({health:Object.assign(Object.assign({},n.opts.health),zl)})}),n.on("visibilitychange",e=>{Dl(this,Vl(n,this.eventInfo(e.type))),Ml(this)})}}function Kl(e,t){return function(e){return e.extensions.reduce((e,t)=>e.find(e=>e.pluginName===t.pluginName)?(console.warn("flowplayer: duplicate plugin %s detected, plugin names should be unique",t.name),e):(e.push(t),e),[])}(e).map(n=>new n(e,t))}function $l(e,t={}){var n,r,s,i,o,a;switch(e.code){case MediaError.MEDIA_ERR_ABORTED:return new FlowplayerError(null!==(n=e.message)&&void 0!==n?n:"The playback was aborted, typically by the user.",za.PlaybackInternalAborted,Object.assign({isFatal:!1,retryOpts:{retry:Ja}},t));case MediaError.MEDIA_ERR_NETWORK:return new FlowplayerError(null!==(r=e.message)&&void 0!==r?r:"A network error prevented media from being downloaded.",za.NetworkHttpRequestFailed,Object.assign({isFatal:!0},t));case MediaError.MEDIA_ERR_DECODE:return new FlowplayerError(null!==(s=e.message)&&void 0!==s?s:"An error occurred while decoding the media.",za.PlaybackVideoDecodeError,Object.assign({isFatal:!0},t));case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:return new FlowplayerError(null!==(i=e.message)&&void 0!==i?i:"The media could not be loaded because the format is not supported.",za.MediaUnsupportedVideoFormat,Object.assign({isFatal:!0},t));case 5:return new FlowplayerError(null!==(o=e.message)&&void 0!==o?o:"Encrypted content could not be played due to missing keys or unsupported protection scheme.",za.ContentProtectionKeySystemNoKeys,Object.assign({isFatal:!0},t));default:return new FlowplayerError(null!==(a=e.message)&&void 0!==a?a:"An unknown playback error occurred.",za.PlaybackUnknown,Object.assign({isFatal:!0},t))}}Health.pluginName="health",Health.events=Lc,Health._UNLOAD_SUBSCRIBED=!1;const Hl=function(){const t="undefined"!=typeof window?window:void 0!==e?e:{},n=t.flowplayer?t.flowplayer:{extensions:[]};return Array.isArray(n.extensions)||(n.extensions=[]),n}();function Jl(e,t){if("function"==typeof e)return Qa.push(...[...arguments].filter(e=>"function"==typeof e)),Jl;"string"==typeof t&&(t={src:t}),t||(t={}),t.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(t.token=window.__FLOWPLAYER_TOKEN);const r="string"==typeof e?document.querySelector(e):e;if(!r)return console.error(new Error("Flowplayer: '"+e.toString()+"' not found"));const i=r.querySelector("video.fp-engine");if(i)return i;const o=function(e){try{return sl.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}(t.token);if(!o.success)return al({root:r,data:{reason:"token",details:o.message}});const c=new Map,l=function(e,t){const n=t.querySelector("video"),r=n||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return r.classList.add("fp-engine"),r.playsInline=!0,n||t.append(r),r}(t,r);var p;l.reaper=c,l._customElements=ac,Object.defineProperty(l,"token",{value:"string"==typeof t.token?sl.id(t.token):"",writable:!1}),l.addEventListener(L,()=>{c.clear(),l.reaper=0,delete l.root}),l.root=r,t.token&&ol.from_token(t.token).is_granted(ol.permissions.DEVELOPER_PLAN)&&Qa.push(ExplorerPlan),!~qa.indexOf(l)&&qa.push(l),el(t,r,l),l.setAttrs(t),l.plugins=Kl(Jl,l),ml(t,r,l),function(e,t,n){if(!window.IntersectionObserver)return;const r={should_resume:!!e.autoplay,locked:!1};$c(n,v,function(){r.locked||(r.should_resume=!0)});const s=()=>{if(!e.autoplay)return;if(n.hasState(Wa)&&r.should_resume)return n.togglePlay(!0);const t=n.currentSrc;e.autopause||n.hasState(Wa)||!r.should_resume||Jc(n,I,()=>{e.autoplay&&r.should_resume&&t===n.currentSrc&&n.togglePlay(!0)})},i=()=>{if(!e.autoplay)return;if(!e.is_native)return;if("auto"===e.preload)return;if(n.hasState(Wa))return hc(n);const t=n.currentSrc;Jc(n,I,()=>{t!==n.currentSrc||n.readyState>1||!n.paused||hc(n)})};$c(n,A,function(){r.should_resume=!!e.autoplay,n.off(h,i),n.once(h,i),n.off(_,s),n.once(_,s)}),$c(n,g,function(){r.locked||(r.should_resume=!1)});const o=new IntersectionObserver(e=>{e.forEach(e=>{setTimeout(()=>{const t=e.intersectionRatio,r=n.hasState(Wa);if(n.setState(Wa,t>=.2),n.emit(G,{ratio:t}),r===n.hasState(Wa))return;const s=n.hasState(Wa)?I:T;n.emit(s)},0)})},{threshold:gl});o.observe(t),n.on(L,()=>o.disconnect()),$c(n,I,function(){!r.should_resume||!e.autopause||yl()||n.opts.autoplay&&!n.readyState||n.togglePlay(!0)}),$c(n,T,function(){if(!e.autopause||yl())return;const t=!n.paused;r.locked=!0,n.pause(),setTimeout(function(){r.should_resume=t,r.locked=!1},0)})}(t,r,l),function(e,t){if(!window.ResizeObserver)return;const n=new ResizeObserver(e=>{const n=e[e.length-1];t.emit(a,n)});n.observe(e),t.on(L,()=>n.disconnect())}(r,l),function(e,t,n){const r=!!e.ratio,s=document.createElement("div");s.classList.add("fp-ratio"),t.append(s);let i=bl(e.ratio||vl);s.style.paddingTop=100*i+"%";const o=[d,u];n.on(o,function(){if(r)return;const e=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth;e&&n.setOpts({ratio:e})}),n.on(K,function(){const t=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth,r=bl((null==e?void 0:e.ratio)||t||vl);i!==r&&(i=r,s.style.paddingTop=100*r+"%")})}(t,r,l),function(e){const t=t=>{t.detail!==e&&!1===e.opt("multiplay")&&e.togglePlay(!1)};e.on(L,()=>document.removeEventListener(Sl,t)),document.addEventListener(Sl,t)}(l),_l(r,l),kl(l,t),(p=l).on(s,cl(e=>{const t=e instanceof MediaError?e:p.error;t&&p.emit(ee,{error:$l(t,{resource:p.original_src})})})),l.plugins.forEach(e=>{try{e.init(t,r,l)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),l.setOpts(t),l.opts=t,t.src&&l.setSrc(t.src);const f=l.readyState;return f>0&&l.currentSrc&&l.emit(u),f>2&&l.currentSrc&&l.emit(_),l.emit(n),l.on(z,function(e){al({root:r,video:l,data:e.data||{}})}),setTimeout(Xc,0,document,"flowplayer:player:created",l),l}Object.assign(Jl,Hl),function(e){Array.isArray(e.extensions)&&e.extensions.forEach(e=>Qa.push(e)),e.customElements=ac,e.defaultElements=tc,e.version="3.34.2",e.commit="0fb3bf5690263ef02228e4ccbc86b57faf2b4f65",e.instances=qa,e.extensions=Qa,e.support=ec,e.events=te,e.states=Ba,e.errors=za,e.jwt=oc,e.autoplay=dc,e.quality=uc}(Jl),"object"==typeof document&&setTimeout(Xc,0,document,"flowplayer:umd",Jl),Jl.extensions.unshift.apply(Jl.extensions,[Health]);class MillicastAdapter{static wants(e){return e.type==MillicastAdapter.Type}constructor(e,n,r=t("rts/millicast"),s=pa.Starting){this.player=e,this.src=n,this.log=r,this.status=s,Qs.setEndpoint(MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT),this.player.on(M,e=>{var t;if(!this.engine||!this.engine.isActive())return;const n=e.detail;null===(t=this.engine)||void 0===t||t.select(n)}),this.player.on(D,e=>{var t;if(!this.engine||!this.engine.isActive())return;const n=e.detail.track,r=null===(t=this.player.tracks)||void 0===t?void 0:t.find(e=>e.selected&&e!==n);r&&(r.selected=!1),this.engine.project("Main"===n.label?"":n.label,n.data.tracks)})}isStreamActive(){return this.status===pa.Receiving&&this.player.hasState(Jl.states.PLAYING)}async load(){this.log("loading",this.src.streamName);this.engine=new cc(this.src.streamName,()=>this.src.__TEST_STREAM_ACCOUNT_ID__?Qs.getSubscriber(this.src):Qs.getSubscriber(Object.assign(Object.assign({},this.src),{streamAccountId:"dev"in this.src?"3caeCP":"bUEzT6"})),this.player,!1),this.player.original_src=MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT+`/${this.src.streamName}`,this._observe(),await this.connect()}retry(){this.connect()}async connect(){try{await this._connect(),this.player.emit(j)}catch(e){this.log("Connection failed",e);const t=new FlowplayerError(e.message,za.NetworkUnknown,{resource:this.src.streamName,isFatal:!0,retryOpts:{retry:Ha,retryTimeout:3e3}});this.player.emit(ee,{error:t})}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop(),this.engine=void 0}_handleViewerCount(e){"number"==typeof e&&this.player.emit(ua,{viewerCount:e})}_handleActive(e){this.player.hasState(xa)&&this.player.emit(j),this.player.setState(La,!1),this.status=pa.Receiving,this.player.emit(la,{status:pa.Receiving,data:e})}_handleInactive(){var e,t;this.status=pa.Idle;const n={status:pa.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit(la,n);const r=new FlowplayerError(n.message,za.MediaUnavailable,{resource:this.src.streamName,isFatal:!0,retryOpts:{retry:Ja}});this.player.emit(ee,{error:r}),null===(t=null===(e=this.engine)||void 0===e?void 0:e.webRTCPeer)||void 0===t||t.stopStats()}_handleQualityLayers(e){var t,n;const r=null===(t=e[0])||void 0===t?void 0:t.layers;if(r&&Array.isArray(r)&&r.every(e=>void 0!==e.encodingId)){if(r[0].encodingId===(null===(n=this.layers)||void 0===n?void 0:n[0].encodingId))return;return this.layers=r,this.player.emit(O,function(e){const t=e.map((e,t)=>Object.assign(Object.assign({},e),{name:e.height||"Level "+t})).sort((e,t)=>t.width-e.width);t.length>1&&t.push({name:"AUTO",width:0,height:0});return t}
|
|
19
19
|
/**
|
|
20
20
|
* @license wowza-webrtc-player 1.0.5
|
|
21
21
|
* Copyright (c) 2018-2022 Koala Interactive, Inc.
|