@arcware-cloud/pixelstreaming-websdk 1.3.41 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE.md +0 -2
  2. package/README.md +0 -2
  3. package/core.cjs +19343 -0
  4. package/core.mjs +1 -0
  5. package/core.umd.cjs +19352 -0
  6. package/index.cjs +3710 -7812
  7. package/index.mjs +1 -32858
  8. package/index.umd.cjs +3710 -7812
  9. package/package.json +13 -5
  10. package/report.html +39 -0
  11. package/stats.json +118354 -0
  12. package/types/{lib → core}/ArcwareConfig.d.ts +10 -4
  13. package/types/core/ArcwarePixelStreaming.d.ts +268 -0
  14. package/types/core/CoreSetup.d.ts +10 -0
  15. package/types/core/Messages/ErrorMessage.d.ts +11 -0
  16. package/types/core/Messages/LoveLetter.d.ts +11 -0
  17. package/types/core/Messages/Ping.d.ts +10 -0
  18. package/types/core/Messages/Queue.d.ts +23 -0
  19. package/types/core/Messages/Render.d.ts +8 -0
  20. package/types/core/Messages/SessionId.d.ts +9 -0
  21. package/types/core/Messages/Stats.d.ts +34 -0
  22. package/types/core/Messages/StreamInfo.d.ts +30 -0
  23. package/types/core/Messages/Version.d.ts +9 -0
  24. package/types/core/Messages/WebSdkSettings.d.ts +31 -0
  25. package/types/core/Messages/index.d.ts +17 -0
  26. package/types/core/domain/ArcwareSettingsSchema.d.ts +61 -0
  27. package/types/core/domain/CustomizationSchema.d.ts +15 -0
  28. package/types/core/domain/Session.d.ts +31 -0
  29. package/types/core/domain/Stats.d.ts +7 -0
  30. package/types/core/features/ArcwareFileTransferUtil.d.ts +8 -0
  31. package/types/{lib → core}/features/DiagnosticsCollector.d.ts +1 -1
  32. package/types/core/features/IWhiteLabel.d.ts +16 -0
  33. package/types/{lib → core}/features/whiteLabelling.d.ts +2 -3
  34. package/types/core.d.ts +5 -0
  35. package/types/index.d.ts +7 -3
  36. package/types/{lib → ui}/ArcwareApplication.d.ts +41 -8
  37. package/types/{lib → ui}/ArcwareInit.d.ts +3 -3
  38. package/types/{lib/ui → ui/components}/AudioButton/index.d.ts +1 -1
  39. package/types/{lib/ui → ui/components}/MicButton/index.d.ts +1 -1
  40. package/types/{lib/ui → ui/components}/MicrophoneOverlay/index.d.ts +1 -1
  41. package/types/{lib/ui → ui/components}/StopButton/index.d.ts +1 -1
  42. package/types/{lib → ui}/styles/ArcwarePixelStreamingApplicationStyles.d.ts +45 -46
  43. package/types/lib/ArcwarePixelStreaming.d.ts +0 -140
  44. package/types/lib/MessageTypes.d.ts +0 -4
  45. package/types/lib/domain/ArcwareSettingsSchema.d.ts +0 -273
  46. package/types/lib/domain/Session.d.ts +0 -29
  47. package/types/lib/domain/Stats.d.ts +0 -36
  48. package/types/lib/features/ArcwareFileTransferUtil.d.ts +0 -13
  49. package/types/lib/features/ZWhiteLabel.d.ts +0 -31
  50. package/types/lib/index.d.ts +0 -6
  51. package/types/shared/index.d.ts +0 -1
  52. package/types/shared/lib/Messages/ErrorMessage.d.ts +0 -18
  53. package/types/shared/lib/Messages/LoveLetter.d.ts +0 -18
  54. package/types/shared/lib/Messages/Ping.d.ts +0 -15
  55. package/types/shared/lib/Messages/Queue.d.ts +0 -58
  56. package/types/shared/lib/Messages/Render.d.ts +0 -9
  57. package/types/shared/lib/Messages/SessionId.d.ts +0 -12
  58. package/types/shared/lib/Messages/Stats.d.ts +0 -174
  59. package/types/shared/lib/Messages/StreamInfo.d.ts +0 -338
  60. package/types/shared/lib/Messages/Version.d.ts +0 -12
  61. package/types/shared/lib/Messages/WebSdkSettings.d.ts +0 -96
  62. package/types/shared/lib/Messages/index.d.ts +0 -185
  63. package/types/shared/lib/index.d.ts +0 -1
  64. /package/types/{lib → core}/ApplyUrlHack.d.ts +0 -0
  65. /package/types/{lib → core}/domain/EventHandler.d.ts +0 -0
  66. /package/types/{lib → core}/domain/debounce.d.ts +0 -0
  67. /package/types/{lib → core}/features/ArcwareEventUtil.d.ts +0 -0
  68. /package/types/{lib → core}/features/common.d.ts +0 -0
  69. /package/types/{lib/ui → ui/components}/ArcwareLogoLoader/index.d.ts +0 -0
  70. /package/types/{lib/ui → ui/components}/AudioButton/AudioIcon.d.ts +0 -0
  71. /package/types/{lib/ui → ui/components}/LoveLetters/index.d.ts +0 -0
  72. /package/types/{lib/ui → ui/components}/MicIcon/index.d.ts +0 -0
  73. /package/types/{lib/ui → ui/components}/PlayIcon/index.d.ts +0 -0
  74. /package/types/{lib/ui → ui/components}/StopIcon/index.d.ts +0 -0
package/core.mjs ADDED
@@ -0,0 +1 @@
1
+ var e={6758(e,t,n){n.d(t,{b:()=>r});class s{constructor(e){this._args=[],this._callback=e}handleEvent(e){this._callback(...this._args),this._args=[]}setArgs(...e){this._args=e}}class r extends EventTarget{constructor(){super(),this._eventListeners=new Map}removeListenerInternal(e,t){if(this._eventListeners.has(e)){const n=this._eventListeners.get(e);if(void 0===n)return this;for(let s=0;s<n.length;++s){const r=n[s];if(r.callback===t){super.removeEventListener(e,r.eventListenerWrapper),n.splice(s,1);break}}}return this}addListener(e,t){return this.on(e,t)}on(e,t){var n;const r=new s(t);return super.addEventListener(e,r),this._eventListeners.has(e)||this._eventListeners.set(e,new Array),null===(n=this._eventListeners.get(e))||void 0===n||n.push({callback:t,eventListenerWrapper:r}),this}once(e,t){var n;const r=new s((...n)=>{t(n),this.removeListenerInternal(e,t)});return super.addEventListener(e,r,{once:!0}),this._eventListeners.has(e)||this._eventListeners.set(e,new Array),null===(n=this._eventListeners.get(e))||void 0===n||n.push({callback:t,eventListenerWrapper:r}),this}removeListener(e,t){return this.removeListenerInternal(e,t),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){if(this._eventListeners.has(e)){const t=this._eventListeners.get(e);if(void 0===t)return this;for(const n of t)this.removeEventListener(e,n.eventListenerWrapper);this._eventListeners.delete(e)}return this}emit(e,...t){if(this._eventListeners.has(e)){const n=this._eventListeners.get(e);if(void 0===n)return!1;for(const e of n)e.eventListenerWrapper.setArgs(...t);return super.dispatchEvent(new Event(e)),!0}return!1}}},948(e,t,n){var s;n.d(t,{Vy:()=>i}),function(e){e[e.Disabled=0]="Disabled",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info",e[e.Debug=4]="Debug"}(s||(s={}));class r{constructor(){this.logLevel=s.Debug,this.includeStack=!0}}let i=new class{InitLogging(e,t){this.ValidateContext(),this.context.logLevel=e,this.context.includeStack=t}Debug(e){this.ValidateContext(),this.context.logLevel>=s.Debug&&this.CommonLog("Debug",e)}Info(e){this.ValidateContext(),this.context.logLevel>=s.Info&&this.CommonLog("Info",e)}Warning(e){this.ValidateContext(),this.context.logLevel>=s.Warning&&this.CommonLog("Warning",e)}Error(e){this.ValidateContext(),this.context.logLevel>=s.Error&&this.CommonLog("Error",e)}CommonLog(e,t){let n=`[${e}] - ${t}`;this.context.includeStack&&(n+=`\nStack: ${this.GetStackTrace()}`),"Error"===e?console.error(n):"Warning"===e?console.warn(n):console.log(n)}GetStackTrace(){const e=new Error;let t="No Stack Available for this browser";return e.stack&&(t=e.stack.toString().replace(/Error/g,"")),t}ValidateContext(){this.context||("undefined"!=typeof window&&window?window.loggerContext?this.context=window.loggerContext:(this.context=new r,window.loggerContext=this.context):this.context=new r)}}},9899(e,t,n){function s(e,t){const n=e.create();return n.type=e.typeName,t&&e.mergePartial(n,t),n}n.d(t,{o:()=>s})},9027(e,t,n){n.d(t,{$W:()=>c,B1:()=>S,BI:()=>V,C_:()=>Q,H2:()=>B,Rd:()=>Z,Rq:()=>K,ZF:()=>P,hU:()=>A,l8:()=>p,q5:()=>b,tg:()=>j,vq:()=>$,x:()=>R,yB:()=>E,zW:()=>y});var s=n(8899),r=n(3923),i=n(2285);class o extends i.G{constructor(){super("base_message",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new o;class a extends i.G{constructor(){super("peerConnectionOptions",[])}create(e){const t=globalThis.Object.create(this.messagePrototype);return void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const l=new a;class d extends i.G{constructor(){super("config",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"peerConnectionOptions",kind:"message",T:()=>l},{no:3,name:"protocolVersion",kind:"scalar",opt:!0,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.peerConnectionOptions=l.internalBinaryRead(e,e.uint32(),n,i.peerConnectionOptions);break;case 3:i.protocolVersion=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),e.peerConnectionOptions&&l.internalBinaryWrite(e.peerConnectionOptions,t.tag(2,s.O0.LengthDelimited).fork(),n).join(),void 0!==e.protocolVersion&&t.tag(3,s.O0.LengthDelimited).string(e.protocolVersion);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const c=new d;class h extends i.G{constructor(){super("identify",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new h;class u extends i.G{constructor(){super("endpointId",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"protocolVersion",kind:"scalar",opt:!0,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.id="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.id=e.string();break;case 3:i.protocolVersion=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.id&&t.tag(2,s.O0.LengthDelimited).string(e.id),void 0!==e.protocolVersion&&t.tag(3,s.O0.LengthDelimited).string(e.protocolVersion);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new u;class m extends i.G{constructor(){super("endpointIdConfirm",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"committedId",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.committedId="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.committedId=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.committedId&&t.tag(2,s.O0.LengthDelimited).string(e.committedId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new m;class g extends i.G{constructor(){super("streamerIdChanged",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"newID",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.newID="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.newID=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.newID&&t.tag(2,s.O0.LengthDelimited).string(e.newID);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const p=new g;class f extends i.G{constructor(){super("listStreamers",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const y=new f;class v extends i.G{constructor(){super("streamerList",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"ids",kind:"scalar",repeat:2,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.ids=[],void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.ids.push(e.string());break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);for(let n=0;n<e.ids.length;n++)t.tag(2,s.O0.LengthDelimited).string(e.ids[n]);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const b=new v;class w extends i.G{constructor(){super("subscribe",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"streamerId",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.streamerId="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.streamerId=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.streamerId&&t.tag(2,s.O0.LengthDelimited).string(e.streamerId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const S=new w;class C extends i.G{constructor(){super("unsubscribe",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new C;class T extends i.G{constructor(){super("subscribeFailed",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"message",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.message="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.message=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.message&&t.tag(2,s.O0.LengthDelimited).string(e.message);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const E=new T;class M extends i.G{constructor(){super("playerConnected",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"dataChannel",kind:"scalar",T:8},{no:3,name:"sfu",kind:"scalar",T:8},{no:5,name:"playerId",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.dataChannel=!1,t.sfu=!1,t.playerId="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.dataChannel=e.bool();break;case 3:i.sfu=e.bool();break;case 5:i.playerId=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),!1!==e.dataChannel&&t.tag(2,s.O0.Varint).bool(e.dataChannel),!1!==e.sfu&&t.tag(3,s.O0.Varint).bool(e.sfu),""!==e.playerId&&t.tag(5,s.O0.LengthDelimited).string(e.playerId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new M;class I extends i.G{constructor(){super("playerDisconnected",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"playerId",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.playerId="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.playerId=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.playerId&&t.tag(2,s.O0.LengthDelimited).string(e.playerId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new I;class k extends i.G{constructor(){super("offer",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"playerId",kind:"scalar",opt:!0,T:9},{no:4,name:"sfu",kind:"scalar",opt:!0,T:8},{no:5,name:"multiplex",kind:"scalar",opt:!0,T:8},{no:6,name:"scalabilityMode",kind:"scalar",opt:!0,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.sdp="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.sdp=e.string();break;case 3:i.playerId=e.string();break;case 4:i.sfu=e.bool();break;case 5:i.multiplex=e.bool();break;case 6:i.scalabilityMode=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.sdp&&t.tag(2,s.O0.LengthDelimited).string(e.sdp),void 0!==e.playerId&&t.tag(3,s.O0.LengthDelimited).string(e.playerId),void 0!==e.sfu&&t.tag(4,s.O0.Varint).bool(e.sfu),void 0!==e.multiplex&&t.tag(5,s.O0.Varint).bool(e.multiplex),void 0!==e.scalabilityMode&&t.tag(6,s.O0.LengthDelimited).string(e.scalabilityMode);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const R=new k;class L extends i.G{constructor(){super("answer",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"playerId",kind:"scalar",opt:!0,T:9},{no:4,name:"minBitrateBps",kind:"scalar",opt:!0,T:5},{no:5,name:"maxBitrateBps",kind:"scalar",opt:!0,T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.sdp="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.sdp=e.string();break;case 3:i.playerId=e.string();break;case 4:i.minBitrateBps=e.int32();break;case 5:i.maxBitrateBps=e.int32();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.sdp&&t.tag(2,s.O0.LengthDelimited).string(e.sdp),void 0!==e.playerId&&t.tag(3,s.O0.LengthDelimited).string(e.playerId),void 0!==e.minBitrateBps&&t.tag(4,s.O0.Varint).int32(e.minBitrateBps),void 0!==e.maxBitrateBps&&t.tag(5,s.O0.Varint).int32(e.maxBitrateBps);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const P=new L;class x extends i.G{constructor(){super("iceCandidateData",[{no:1,name:"candidate",kind:"scalar",T:9},{no:2,name:"sdpMid",kind:"scalar",T:9},{no:3,name:"sdpMLineIndex",kind:"scalar",T:5},{no:4,name:"usernameFragment",kind:"scalar",opt:!0,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.candidate="",t.sdpMid="",t.sdpMLineIndex=0,void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.candidate=e.string();break;case 2:i.sdpMid=e.string();break;case 3:i.sdpMLineIndex=e.int32();break;case 4:i.usernameFragment=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.candidate&&t.tag(1,s.O0.LengthDelimited).string(e.candidate),""!==e.sdpMid&&t.tag(2,s.O0.LengthDelimited).string(e.sdpMid),0!==e.sdpMLineIndex&&t.tag(3,s.O0.Varint).int32(e.sdpMLineIndex),void 0!==e.usernameFragment&&t.tag(4,s.O0.LengthDelimited).string(e.usernameFragment);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const O=new x;class F extends i.G{constructor(){super("iceCandidate",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"candidate",kind:"message",T:()=>O},{no:3,name:"playerId",kind:"scalar",opt:!0,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.candidate=O.internalBinaryRead(e,e.uint32(),n,i.candidate);break;case 3:i.playerId=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),e.candidate&&O.internalBinaryWrite(e.candidate,t.tag(2,s.O0.LengthDelimited).fork(),n).join(),void 0!==e.playerId&&t.tag(3,s.O0.LengthDelimited).string(e.playerId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const V=new F;class N extends i.G{constructor(){super("disconnectPlayer",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"playerId",kind:"scalar",T:9},{no:3,name:"reason",kind:"scalar",opt:!0,T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.playerId="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.playerId=e.string();break;case 3:i.reason=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.playerId&&t.tag(2,s.O0.LengthDelimited).string(e.playerId),void 0!==e.reason&&t.tag(3,s.O0.LengthDelimited).string(e.reason);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new N;class D extends i.G{constructor(){super("ping",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"time",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.time=0,void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.time=e.int32();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),0!==e.time&&t.tag(2,s.O0.Varint).int32(e.time);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const A=new D;class U extends i.G{constructor(){super("pong",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"time",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.time=0,void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.time=e.int32();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),0!==e.time&&t.tag(2,s.O0.Varint).int32(e.time);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const B=new U;class W extends i.G{constructor(){super("streamerDisconnected",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new W;class _ extends i.G{constructor(){super("layerPreference",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"spatialLayer",kind:"scalar",T:5},{no:3,name:"temporalLayer",kind:"scalar",T:5},{no:4,name:"playerId",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.spatialLayer=0,t.temporalLayer=0,t.playerId="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.spatialLayer=e.int32();break;case 3:i.temporalLayer=e.int32();break;case 4:i.playerId=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),0!==e.spatialLayer&&t.tag(2,s.O0.Varint).int32(e.spatialLayer),0!==e.temporalLayer&&t.tag(3,s.O0.Varint).int32(e.temporalLayer),""!==e.playerId&&t.tag(4,s.O0.LengthDelimited).string(e.playerId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const $=new _;class H extends i.G{constructor(){super("dataChannelRequest",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const j=new H;class z extends i.G{constructor(){super("peerDataChannels",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"playerId",kind:"scalar",T:9},{no:3,name:"sendStreamId",kind:"scalar",T:5},{no:4,name:"recvStreamId",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.playerId="",t.sendStreamId=0,t.recvStreamId=0,void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.playerId=e.string();break;case 3:i.sendStreamId=e.int32();break;case 4:i.recvStreamId=e.int32();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.playerId&&t.tag(2,s.O0.LengthDelimited).string(e.playerId),0!==e.sendStreamId&&t.tag(3,s.O0.Varint).int32(e.sendStreamId),0!==e.recvStreamId&&t.tag(4,s.O0.Varint).int32(e.recvStreamId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const K=new z;class G extends i.G{constructor(){super("peerDataChannelsReady",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const Q=new G;class q extends i.G{constructor(){super("streamerDataChannels",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sfuId",kind:"scalar",T:9},{no:3,name:"sendStreamId",kind:"scalar",T:5},{no:4,name:"recvStreamId",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.sfuId="",t.sendStreamId=0,t.recvStreamId=0,void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.sfuId=e.string();break;case 3:i.sendStreamId=e.int32();break;case 4:i.recvStreamId=e.int32();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.sfuId&&t.tag(2,s.O0.LengthDelimited).string(e.sfuId),0!==e.sendStreamId&&t.tag(3,s.O0.Varint).int32(e.sendStreamId),0!==e.recvStreamId&&t.tag(4,s.O0.Varint).int32(e.recvStreamId);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new q;class J extends i.G{constructor(){super("startStreaming",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new J;class X extends i.G{constructor(){super("stopStreaming",[{no:1,name:"type",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();if(1===t)i.type=e.string();else{let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new X;class Y extends i.G{constructor(){super("playerCount",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"count",kind:"scalar",T:5}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.count=0,void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.count=e.int32();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),0!==e.count&&t.tag(2,s.O0.Varint).int32(e.count);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}const Z=new Y;class ee extends i.G{constructor(){super("stats",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"data",kind:"scalar",T:9}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type="",t.data="",void 0!==e&&(0,r.x)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=null!=r?r:this.create(),o=e.pos+t;for(;e.pos<o;){let[t,r]=e.tag();switch(t){case 1:i.type=e.string();break;case 2:i.data=e.string();break;default:let o=n.readUnknownField;if("throw"===o)throw new globalThis.Error(`Unknown field ${t} (wire type ${r}) for ${this.typeName}`);let a=e.skip(r);!1!==o&&(!0===o?s.f$.onRead:o)(this.typeName,i,t,r,a)}}return i}internalBinaryWrite(e,t,n){""!==e.type&&t.tag(1,s.O0.LengthDelimited).string(e.type),""!==e.data&&t.tag(2,s.O0.LengthDelimited).string(e.data);let r=n.writeUnknownFields;return!1!==r&&(1==r?s.f$.onWrite:r)(this.typeName,e,t),t}}new ee},8496(e,t,n){n.d(t,{P:()=>i});var s=n(9027),r=n(9899);class i{get RTT(){return this.rtt}constructor(e,t){this.alive=!1,this.rtt=0,this.protocol=e,this.timeout=t,this.onResponse=this.onHeartbeatResponse.bind(this),this.protocol.transport.on("close",this.stop.bind(this)),this.start()}start(){this.alive=!0,this.protocol.on("pong",this.onResponse),this.keepalive=setInterval(this.sendHeartbeat.bind(this),this.timeout)}stop(){clearInterval(this.keepalive),this.protocol.off("pong",this.onResponse)}sendHeartbeat(){var e;!1!==this.alive?(this.alive=!1,this.protocol.sendMessage(r.o(s.hU,{time:(new Date).getTime()}))):null===(e=this.onTimeout)||void 0===e||e.call(this)}onHeartbeatResponse(e){this.rtt=(new Date).getTime()-e.time,this.alive=!0}}},3532(e,t,n){n.d(t,{t:()=>i});var s=n(6758),r=n(948);class i extends s.b{static get SIGNALLING_VERSION(){return"1.3.0"}constructor(e){super(),this.transport=e,e.onMessage=t=>{let n;try{const e=JSON.parse(t);r.Vy.Debug("Protocol received => \n"+JSON.stringify(e,void 0,4)),n=e}catch(e){return void(e instanceof Error?r.Vy.Error(`Error parsing message string ${t}.\n${e.message}`):r.Vy.Error("Unknown error while parsing message data in handleOnMessage"))}e.emit("message",n),this.emit(n.type,n)||this.emit("unhandled",n)}}connect(e){return this.transport.connect(e)}disconnect(e,t){this.transport.disconnect(e,t)}isConnected(){return this.transport.isConnected()}sendMessage(e){this.transport.sendMessage(JSON.stringify(e)),this.transport.emit("out",e),r.Vy.Debug("Protocol sent => \n"+JSON.stringify(e,void 0,4))}}},7447(e,t,n){n.d(t,{T:()=>i});var s=n(948),r=n(6758);class i extends r.b{constructor(e){super(),this.WS_OPEN_STATE=1,this.protocols=e}sendMessage(e){this.webSocket&&this.webSocket.send(e)}connect(e){s.Vy.Info(e);try{return this.webSocket=new WebSocket(e,this.protocols),this.webSocket.onopen=e=>this.handleOnOpen(),this.webSocket.onerror=e=>this.handleOnError(),this.webSocket.onclose=e=>this.handleOnClose(e),this.webSocket.onmessage=e=>this.handleOnMessage(e),this.webSocket.onmessagebinary=e=>this.handleOnMessageBinary(e),!0}catch(e){return s.Vy.Error(e),!1}}disconnect(e,t){this.webSocket&&this.webSocket.close(e,t)}isConnected(){return!!this.webSocket&&this.webSocket.readyState!=WebSocket.CLOSED}handleOnMessageBinary(e){e&&e.data&&e.data.text().then(e=>{const t=new MessageEvent("messageFromBinary",{data:e});this.handleOnMessage(t)}).catch(e=>{s.Vy.Error(`Failed to parse binary blob from websocket, reason: ${e.message}`)})}handleOnMessage(e){e.data&&e.data instanceof Blob?this.handleOnMessageBinary(e):this.onMessage&&this.onMessage(e.data)}handleOnOpen(){s.Vy.Info("Connected to the signalling server via WebSocket"),this.emit("open")}handleOnError(){this.emit("error")}handleOnClose(e){s.Vy.Info("Disconnected to the signalling server via WebSocket: "+JSON.stringify(e.code)+" - "+e.reason),this.emit("close",e)}}},9046(e,t,n){n.d(t,{p:()=>s});class s{static addVideoHeaderExtensionToSdp(e,t){const n=e.split("\n").filter(e=>e.startsWith("a=extmap:")).map(e=>parseInt(e.split(" ")[0].substring(9),10)).sort((e,t)=>e-t).filter((e,t,n)=>n.indexOf(e)===t),s="a=extmap:"+(n[n.length-1]+1)+" "+t+"\r\n",r=e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n");return r.shift()+r.map(e=>e.startsWith("m=video")?e+s:e).join("")}}},5785(e,t,n){n.d(t,{R:()=>o});var s=n(223),r=n(948),i=n(6077);class o{constructor(e,t,n){this.active=!1,this.countdownActive=!1,this.warnTimer=void 0,this.countDown=0,this.countDownTimer=void 0,this.config=e,this.pixelStreaming=t,this.onDismissAfk=n,this.onAFKTimedOutCallback=()=>{console.log("AFK timed out, did you want to override this callback?")}}onAfkClick(){clearInterval(this.countDownTimer),(this.active||this.countdownActive)&&(this.startAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new i.jr))}startAfkWarningTimer(){this.config.getNumericSettingValue(s.k$.AFKTimeoutSecs)>0&&this.config.isFlagEnabled(s.iI.AFKDetection)?this.active=!0:this.active=!1,this.resetAfkWarningTimer()}stopAfkWarningTimer(){this.active=!1,this.countdownActive=!1,clearTimeout(this.warnTimer),clearInterval(this.countDownTimer)}pauseAfkWarningTimer(){this.active=!1}resetAfkWarningTimer(){this.active&&this.config.isFlagEnabled(s.iI.AFKDetection)&&(clearTimeout(this.warnTimer),this.warnTimer=setTimeout(()=>this.activateAfkEvent(),1e3*this.config.getNumericSettingValue(s.k$.AFKTimeoutSecs)))}activateAfkEvent(){this.pauseAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new i.mC({countDown:this.countDown,dismissAfk:this.onDismissAfk})),this.countDown=this.config.getNumericSettingValue(s.k$.AFKCountdownSecs),this.countdownActive=!0,this.pixelStreaming.dispatchEvent(new i.S_({countDown:this.countDown})),this.config.isFlagEnabled(s.iI.HoveringMouseMode)||document.exitPointerLock&&document.exitPointerLock(),this.countDownTimer=setInterval(()=>{this.countDown--,0==this.countDown?(this.pixelStreaming.dispatchEvent(new i.Kr),this.onAFKTimedOutCallback(),r.Vy.Info("You have been disconnected due to inactivity"),this.stopAfkWarningTimer()):this.pixelStreaming.dispatchEvent(new i.S_({countDown:this.countDown}))},1e3)}}},223(e,t,n){n.d(t,{Bs:()=>b,TS:()=>v,gw:()=>g,iI:()=>c,k$:()=>u,mY:()=>f});var s=n(948),r=n(5131),i=n(9468),o=n(4746),a=n(5828),l=n(6077),d=n(114);class c{}c.AutoConnect="AutoConnect",c.AutoPlayVideo="AutoPlayVideo",c.AFKDetection="TimeoutIfIdle",c.HoveringMouseMode="HoveringMouse",c.ForceMonoAudio="ForceMonoAudio",c.ForceTURN="ForceTURN",c.FakeMouseWithTouches="FakeMouseWithTouches",c.IsQualityController="ControlsQuality",c.MatchViewportResolution="MatchViewportRes",c.StartVideoMuted="StartVideoMuted",c.SuppressBrowserKeys="SuppressBrowserKeys",c.UseMic="UseMic",c.UseModalForTextInput="UseModalForTextInput",c.UseCamera="UseCamera",c.KeyboardInput="KeyboardInput",c.MouseInput="MouseInput",c.TouchInput="TouchInput",c.GamepadInput="GamepadInput",c.XRControllerInput="XRControllerInput",c.WaitForStreamer="WaitForStreamer",c.HideUI="HideUI",c.EnableCaptureTimeExt="EnableCaptureTimeExt";const h=e=>Object.getOwnPropertyNames(c).some(t=>c[t]===e);class u{}u.AFKTimeoutSecs="AFKTimeout",u.AFKCountdownSecs="AFKCountdown",u.MinQP="MinQP",u.MaxQP="MaxQP",u.MinQuality="MinQuality",u.MaxQuality="MaxQuality",u.CompatQualityMin="CompatQualityMin",u.CompatQualityMax="CompatQualityMax",u.WebRTCFPS="WebRTCFPS",u.WebRTCMinBitrate="WebRTCMinBitrate",u.WebRTCMaxBitrate="WebRTCMaxBitrate",u.MaxReconnectAttempts="MaxReconnectAttempts",u.StreamerAutoJoinInterval="StreamerAutoJoinInterval",u.KeepaliveDelay="KeepaliveDelay";const m=e=>Object.getOwnPropertyNames(u).some(t=>u[t]===e);class g{}g.SignallingServerUrl="ss";const p=e=>Object.getOwnPropertyNames(g).some(t=>g[t]===e);class f{}f.PreferredCodec="PreferredCodec",f.StreamerId="StreamerId",f.PreferredQuality="PreferredQuality";const y=e=>Object.getOwnPropertyNames(f).some(t=>f[t]===e);class v{constructor(e={}){this.flags=new Map,this.numericParameters=new Map,this.textParameters=new Map,this.optionParameters=new Map;const{initialSettings:t,useUrlParams:n,webSocketProtocols:s}=e;this._useUrlParams=!!n,this._webSocketProtocols=s,this.populateDefaultSettings(this._useUrlParams,t)}get useUrlParams(){return this._useUrlParams}get webSocketProtocols(){return this._webSocketProtocols}populateDefaultSettings(e,t){this.textParameters.set(g.SignallingServerUrl,new o.c(g.SignallingServerUrl,"Signalling url","Url of the signalling server",t&&Object.prototype.hasOwnProperty.call(t,g.SignallingServerUrl)?t[g.SignallingServerUrl]:("https:"===location.protocol?"wss://":"ws://")+window.location.hostname+("80"===window.location.port||""===window.location.port?"":`:${window.location.port}`),e)),this.optionParameters.set(f.StreamerId,new a.G(f.StreamerId,"Streamer ID","The ID of the streamer to stream.",t&&Object.prototype.hasOwnProperty.call(t,f.StreamerId)?t[f.StreamerId]:"",t&&Object.prototype.hasOwnProperty.call(t,f.StreamerId)?[t[f.StreamerId]]:void 0,e));const n=function(e){const t=d.C.getSupportedVideoCodecs();if(t.includes(e))return e;for(const n of t)if(n.startsWith(e))return n;return e};this.optionParameters.set(f.PreferredCodec,new a.G(f.PreferredCodec,"Preferred Codec","The preferred codec to be used during codec negotiation",t&&Object.prototype.hasOwnProperty.call(t,f.PreferredCodec)?n(t[f.PreferredCodec]):function(){const e=d.C.getSupportedVideoCodecs();if(1==e.length)return e[0];if(e.length>0){const t=e[0];for(const t of e)if(t.startsWith("H264"))return t;return t}return s.Vy.Error("Could not find any reasonable video codec to assign as a default."),""}(),d.C.getSupportedVideoCodecs(),e,n)),this.optionParameters.set(f.PreferredQuality,new a.G(f.PreferredQuality,"Preferred Quality","The preferred quality of the stream (only applicable when using the SFU)",t&&Object.prototype.hasOwnProperty.call(t,f.PreferredQuality)?t[f.PreferredQuality]:"Default",["Default"],e)),this.flags.set(c.AutoConnect,new r.T(c.AutoConnect,"Auto connect to stream","Whether we should attempt to auto connect to the signalling server or show a click to start prompt.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.AutoConnect))&&t[c.AutoConnect],e)),this.flags.set(c.AutoPlayVideo,new r.T(c.AutoPlayVideo,"Auto play video","When video is ready automatically start playing it as opposed to showing a play button.",!t||!Object.prototype.hasOwnProperty.call(t,c.AutoPlayVideo)||t[c.AutoPlayVideo],e)),this.flags.set(c.UseMic,new r.T(c.UseMic,"Use microphone","Make browser request microphone access and open an input audio track.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.UseMic))&&t[c.UseMic],e)),this.flags.set(c.UseModalForTextInput,new r.T(c.UseModalForTextInput,"Use modal for text input","When entering input into a streamed UE text widget, use an input modal.",!t||!Object.prototype.hasOwnProperty.call(t,c.UseModalForTextInput)||t[c.UseModalForTextInput],e)),this.flags.set(c.UseCamera,new r.T(c.UseCamera,"Use webcam","Make browser request webcam access and open a input video track.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.UseCamera))&&t[c.UseCamera],e)),this.flags.set(c.StartVideoMuted,new r.T(c.StartVideoMuted,"Start video muted","Video will start muted if true.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.StartVideoMuted))&&t[c.StartVideoMuted],e)),this.flags.set(c.SuppressBrowserKeys,new r.T(c.SuppressBrowserKeys,"Suppress browser keys","Suppress certain browser keys that we use in UE, for example F5 to show shader complexity instead of refresh the page.",!t||!Object.prototype.hasOwnProperty.call(t,c.SuppressBrowserKeys)||t[c.SuppressBrowserKeys],e)),this.flags.set(c.IsQualityController,new r.T(c.IsQualityController,"Is quality controller?","True if this peer controls stream quality",!t||!Object.prototype.hasOwnProperty.call(t,c.IsQualityController)||t[c.IsQualityController],e)),this.flags.set(c.ForceMonoAudio,new r.T(c.ForceMonoAudio,"Force mono audio","Force browser to request mono audio in the SDP",!(!t||!Object.prototype.hasOwnProperty.call(t,c.ForceMonoAudio))&&t[c.ForceMonoAudio],e)),this.flags.set(c.ForceTURN,new r.T(c.ForceTURN,"Force TURN","Only generate TURN/Relayed ICE candidates.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.ForceTURN))&&t[c.ForceTURN],e)),this.flags.set(c.AFKDetection,new r.T(c.AFKDetection,"AFK if idle","Timeout the experience if user is AFK for a period.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.AFKDetection))&&t[c.AFKDetection],e)),this.flags.set(c.MatchViewportResolution,new r.T(c.MatchViewportResolution,"Match viewport resolution","Pixel Streaming will be instructed to dynamically resize the video stream to match the size of the video element.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.MatchViewportResolution))&&t[c.MatchViewportResolution],e)),this.flags.set(c.HoveringMouseMode,new r.T(c.HoveringMouseMode,"Control Scheme: Locked Mouse","Either locked mouse, where the pointer is consumed by the video and locked to it, or hovering mouse, where the mouse is not consumed.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.HoveringMouseMode))&&t[c.HoveringMouseMode],e,(e,t)=>{t.label=`Control Scheme: ${e?"Hovering":"Locked"} Mouse`})),this.flags.set(c.FakeMouseWithTouches,new r.T(c.FakeMouseWithTouches,"Fake mouse with touches","A single finger touch is converted into a mouse event. This allows a non-touch application to be controlled partially via a touch device.",!(!t||!Object.prototype.hasOwnProperty.call(t,c.FakeMouseWithTouches))&&t[c.FakeMouseWithTouches],e)),this.flags.set(c.KeyboardInput,new r.T(c.KeyboardInput,"Keyboard input","If enabled, send keyboard events to streamer",!t||!Object.prototype.hasOwnProperty.call(t,c.KeyboardInput)||t[c.KeyboardInput],e)),this.flags.set(c.MouseInput,new r.T(c.MouseInput,"Mouse input","If enabled, send mouse events to streamer",!t||!Object.prototype.hasOwnProperty.call(t,c.MouseInput)||t[c.MouseInput],e)),this.flags.set(c.TouchInput,new r.T(c.TouchInput,"Touch input","If enabled, send touch events to streamer",!t||!Object.prototype.hasOwnProperty.call(t,c.TouchInput)||t[c.TouchInput],e)),this.flags.set(c.GamepadInput,new r.T(c.GamepadInput,"Gamepad input","If enabled, send gamepad events to streamer",!t||!Object.prototype.hasOwnProperty.call(t,c.GamepadInput)||t[c.GamepadInput],e)),this.flags.set(c.XRControllerInput,new r.T(c.XRControllerInput,"XR controller input","If enabled, send XR controller events to streamer",!t||!Object.prototype.hasOwnProperty.call(t,c.XRControllerInput)||t[c.XRControllerInput],e)),this.flags.set(c.WaitForStreamer,new r.T(c.WaitForStreamer,"Wait for streamer","Will continue trying to connect to the first streamer available.",!t||!Object.prototype.hasOwnProperty.call(t,c.WaitForStreamer)||t[c.WaitForStreamer],e)),this.flags.set(c.HideUI,new r.T(c.HideUI,"Hide the UI overlay","Will hide all UI overlay details",!(!t||!Object.prototype.hasOwnProperty.call(t,c.HideUI))&&t[c.HideUI],e)),this.flags.set(c.EnableCaptureTimeExt,new r.T(c.EnableCaptureTimeExt,"Enable abs-capture-time","Enables the abs-capture-time RTP header extension",!(!t||!Object.prototype.hasOwnProperty.call(t,c.EnableCaptureTimeExt))&&t[c.EnableCaptureTimeExt],e)),this.numericParameters.set(u.AFKTimeoutSecs,new i.U(u.AFKTimeoutSecs,"AFK timeout","The time (in seconds) it takes for the application to time out if AFK timeout is enabled.",0,null,t&&Object.prototype.hasOwnProperty.call(t,u.AFKTimeoutSecs)?t[u.AFKTimeoutSecs]:120,e)),this.numericParameters.set(u.AFKCountdownSecs,new i.U(u.AFKCountdownSecs,"AFK countdown","The time (in seconds) for a user to respond before the stream is ended after an AFK timeout.",10,null,10,e)),this.numericParameters.set(u.MaxReconnectAttempts,new i.U(u.MaxReconnectAttempts,"Max Reconnects","Maximum number of reconnects the application will attempt when a streamer disconnects.",0,999,t&&Object.prototype.hasOwnProperty.call(t,u.MaxReconnectAttempts)?t[u.MaxReconnectAttempts]:3,e)),this.numericParameters.set(u.MinQP,new i.U(u.MinQP,"Min QP","The lower bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,t&&Object.prototype.hasOwnProperty.call(t,u.MinQP)?t[u.MinQP]:0,e)),this.numericParameters.set(u.MaxQP,new i.U(u.MaxQP,"Max QP","The upper bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,t&&Object.prototype.hasOwnProperty.call(t,u.MaxQP)?t[u.MaxQP]:51,e)),this.numericParameters.set(u.MinQuality,new i.U(u.MinQuality,"Min Quality","The lower bound for the quality factor of the encoder. 0 = Worst quality, 100 = Best quality.",0,100,t&&Object.prototype.hasOwnProperty.call(t,u.MinQuality)?t[u.MinQuality]:0,e)),this.numericParameters.set(u.MaxQuality,new i.U(u.MaxQuality,"Max Quality","The upper bound for the quality factor of the encoder. 0 = Worst quality, 100 = Best quality.",0,100,t&&Object.prototype.hasOwnProperty.call(t,u.MaxQuality)?t[u.MaxQuality]:100,e)),this.numericParameters.set(u.CompatQualityMin,new i.U(u.CompatQualityMin,"Min Quality","The lower bound for encoding quality. 0 = Worst, 100 = Best.",0,100,t&&Object.prototype.hasOwnProperty.call(t,u.CompatQualityMin)?t[u.CompatQualityMin]:0,e)),this.numericParameters.set(u.CompatQualityMax,new i.U(u.CompatQualityMax,"Max Quality","The upper bound for encoding quality. 0 = Worst, 100 = Best.",0,100,t&&Object.prototype.hasOwnProperty.call(t,u.CompatQualityMax)?t[u.CompatQualityMax]:100,e)),this.numericParameters.set(u.WebRTCFPS,new i.U(u.WebRTCFPS,"Max FPS","The maximum FPS that WebRTC will try to transmit frames at.",1,999,t&&Object.prototype.hasOwnProperty.call(t,u.WebRTCFPS)?t[u.WebRTCFPS]:60,e)),this.numericParameters.set(u.WebRTCMinBitrate,new i.U(u.WebRTCMinBitrate,"Min Bitrate (kbps)","The minimum bitrate that WebRTC should use.",0,5e5,t&&Object.prototype.hasOwnProperty.call(t,u.WebRTCMinBitrate)?t[u.WebRTCMinBitrate]:0,e)),this.numericParameters.set(u.WebRTCMaxBitrate,new i.U(u.WebRTCMaxBitrate,"Max Bitrate (kbps)","The maximum bitrate that WebRTC should use.",0,5e5,t&&Object.prototype.hasOwnProperty.call(t,u.WebRTCMaxBitrate)?t[u.WebRTCMaxBitrate]:0,e)),this.numericParameters.set(u.StreamerAutoJoinInterval,new i.U(u.StreamerAutoJoinInterval,"Streamer Auto Join Interval (ms)","Delay between retries when waiting for an available streamer.",500,9e5,t&&Object.prototype.hasOwnProperty.call(t,u.StreamerAutoJoinInterval)?t[u.StreamerAutoJoinInterval]:3e3,e)),this.numericParameters.set(u.KeepaliveDelay,new i.U(u.KeepaliveDelay,"Connection Keepalive delay","Delay between keepalive pings to the signalling server.",0,9e5,t&&Object.prototype.hasOwnProperty.call(t,u.KeepaliveDelay)?t[u.KeepaliveDelay]:3e4,e))}_addOnNumericSettingChangedListener(e,t){this.numericParameters.has(e)&&this.numericParameters.get(e).addOnChangedListener(t)}_addOnOptionSettingChangedListener(e,t){this.optionParameters.has(e)&&this.optionParameters.get(e).addOnChangedListener(t)}getNumericSettingValue(e){if(this.numericParameters.has(e))return this.numericParameters.get(e).number;throw new Error(`There is no numeric setting with the id of ${e}`)}getTextSettingValue(e){if(this.textParameters.has(e))return this.textParameters.get(e).value;throw new Error(`There is no numeric setting with the id of ${e}`)}setNumericSetting(e,t){if(!this.numericParameters.has(e))throw new Error(`There is no numeric setting with the id of ${e}`);this.numericParameters.get(e).number=t}_addOnSettingChangedListener(e,t){this.flags.has(e)&&(this.flags.get(e).onChange=t)}_addOnTextSettingChangedListener(e,t){this.textParameters.has(e)&&(this.textParameters.get(e).onChange=t)}getSettingOption(e){return this.optionParameters.get(e)}isFlagEnabled(e){return this.flags.get(e).flag}setFlagEnabled(e,t){this.flags.has(e)?this.flags.get(e).flag=t:s.Vy.Warning(`Cannot toggle flag called ${e} - it does not exist in the Config.flags map.`)}setTextSetting(e,t){this.textParameters.has(e)?this.textParameters.get(e).text=t:s.Vy.Warning(`Cannot set text setting called ${e} - it does not exist in the Config.textParameters map.`)}setOptionSettingOptions(e,t){this.optionParameters.has(e)?this.optionParameters.get(e).options=t:s.Vy.Warning(`Cannot set text setting called ${e} - it does not exist in the Config.optionParameters map.`)}setOptionSettingValue(e,t){if(this.optionParameters.has(e)){const n=this.optionParameters.get(e),s=n.options;s.includes(t)||(s.push(t),n.options=s),n.selected=t}else s.Vy.Warning(`Cannot set text setting called ${e} - it does not exist in the Config.enumParameters map.`)}setFlagLabel(e,t){this.flags.has(e)?this.flags.get(e).label=t:s.Vy.Warning(`Cannot set label for flag called ${e} - it does not exist in the Config.flags map.`)}setSettings(e){for(const t of Object.keys(e))h(t)?this.setFlagEnabled(t,e[t]):m(t)?this.setNumericSetting(t,e[t]):p(t)?this.setTextSetting(t,e[t]):y(t)&&this.setOptionSettingValue(t,e[t])}getSettings(){const e={};for(const[t,n]of this.flags.entries())e[t]=n.flag;for(const[t,n]of this.numericParameters.entries())e[t]=n.number;for(const[t,n]of this.textParameters.entries())e[t]=n.text;for(const[t,n]of this.optionParameters.entries())e[t]=n.selected;return e}getFlags(){return Array.from(this.flags.values())}getTextSettings(){return Array.from(this.textParameters.values())}getNumericSettings(){return Array.from(this.numericParameters.values())}getOptionSettings(){return Array.from(this.optionParameters.values())}_registerOnChangeEvents(e){for(const t of this.flags.keys()){const n=this.flags.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new l.Si({id:n.id,type:"flag",value:t,target:n})))}for(const t of this.numericParameters.keys()){const n=this.numericParameters.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new l.Si({id:n.id,type:"number",value:t,target:n})))}for(const t of this.textParameters.keys()){const n=this.textParameters.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new l.Si({id:n.id,type:"text",value:t,target:n})))}for(const t of this.optionParameters.keys()){const n=this.optionParameters.get(t);n&&(n.onChangeEmit=t=>e.dispatchEvent(new l.Si({id:n.id,type:"option",value:t,target:n})))}}}var b;!function(e){e[e.LockedMouse=0]="LockedMouse",e[e.HoveringMouse=1]="HoveringMouse"}(b||(b={}))},8532(e,t,n){n.d(t,{E:()=>s});class s{constructor(e,t,n,s,r=()=>{}){this.parseURLParams(),this.onChange=r,this.onChangeEmit=()=>{},this.id=e,this.description=n,this.label=t,this.value=s}set label(e){this._label=e,this.onChangeEmit(this._value)}get label(){return this._label}get value(){return this._value}set value(e){this._value=e,this.onChange(this._value,this),this.onChangeEmit(this._value)}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search),t=this.getValueAsString();let n=!1;for(const[s,r]of e)if(s.toLowerCase()==this.id.toLowerCase()){e.set(s,t),n=!0;break}n||e.set(this.id,t),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}getValueAsString(){return""}parseURLParams(){this._urlParams={};const e=new URLSearchParams(window.location.search);for(const[t,n]of e)this._urlParams[t.toLowerCase()]=n}hasURLParam(e){return e.toLowerCase()in this._urlParams}getURLParam(e){return this.hasURLParam(e)?this._urlParams[e.toLowerCase()]:""}}},5131(e,t,n){n.d(t,{T:()=>r});var s=n(8532);class r extends s.E{constructor(e,t,n,s,r,i=()=>{}){if(super(e,t,n,s,i),r&&this.hasURLParam(this.id)){const e=this.getURLParam(this.id);this.flag="false"!=e.toLowerCase()}else this.flag=s;this.useUrlParams=r}getValueAsString(){return this.flag?"true":"false"}enable(){this.flag=!0}get flag(){return!!this.value}set flag(e){this.value=e}}},9468(e,t,n){n.d(t,{U:()=>r});var s=n(8532);class r extends s.E{constructor(e,t,n,s,r,i,o,a=()=>{}){if(super(e,t,n,i,a),this._min=s,this._max=r,o&&this.hasURLParam(this.id)){const e=Number.parseFloat(this.getURLParam(this.id));this.number=Number.isNaN(e)?i:e}else this.number=i;this.useUrlParams=o}getValueAsString(){return this.number.toString()}set number(e){this.value=this.clamp(e)}get number(){return this.value}clamp(e){return null==this._min&&null==this._max?e:null==this._min?Math.min(this._max,e):null==this._max?Math.max(this._min,e):Math.max(Math.min(this._max,e),this._min)}get min(){return this._min}get max(){return this._max}addOnChangedListener(e){this.onChange=e}}},5828(e,t,n){n.d(t,{G:()=>i});var s=n(948),r=n(8532);class i extends r.E{constructor(e,t,n,s,r,i,o=function(e){return e},a=()=>{}){super(e,t,n,s,a),this._urlParamResolver=o;const l=this.hasURLParam(this.id)?this._urlParamResolver(this.getURLParam(this.id)):s;this.options=null!=r?r:[l],this.selected=l,this.useUrlParams=i}getValueAsString(){return this.selected}addOnChangedListener(e){this.onChange=e}get options(){return this._options}set options(e){this._options=e,this.onChangeEmit(this.selected)}get selected(){return this.value}set selected(e){void 0!==e&&(this.options.includes(e)?this.value=e:s.Vy.Error(`Could not set "${e}" as the selected option for ${this.id} because it wasn't one of the options.`))}set urlParamResolver(e){this._urlParamResolver=e}}},4746(e,t,n){n.d(t,{c:()=>r});var s=n(8532);class r extends s.E{constructor(e,t,n,s,r,i=()=>{}){super(e,t,n,s,i),r&&this.hasURLParam(this.id)?this.text=this.getURLParam(this.id):this.text=s,this.useUrlParams=r}getValueAsString(){return this.text}get text(){return this.value}set text(e){this.value=e}}},4045(e,t,n){n.d(t,{a:()=>r});var s=n(948);class r{constructor(){this.isReceivingFreezeFrame=!1}getDataChannelInstance(){return this}createDataChannel(e,t,n){this.peerConnection=e,this.label=t,this.datachannelOptions=n,null==n&&(this.datachannelOptions={},this.datachannelOptions.ordered=!0),this.dataChannel=this.peerConnection.createDataChannel(this.label,this.datachannelOptions),this.setupDataChannel()}setupDataChannel(){this.dataChannel.binaryType="arraybuffer",this.dataChannel.onopen=e=>this.handleOnOpen(e),this.dataChannel.onclose=e=>this.handleOnClose(e),this.dataChannel.onmessage=e=>this.handleOnMessage(e),this.dataChannel.onerror=e=>this.handleOnError(e)}handleOnOpen(e){var t;s.Vy.Info(`Data Channel (${this.label}) opened.`),this.onOpen(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}handleOnClose(e){var t;s.Vy.Info(`Data Channel (${this.label}) closed.`),this.onClose(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}handleOnMessage(e){s.Vy.Info(`Data Channel (${this.label}) message: ${e}`)}handleOnError(e){var t;s.Vy.Info(`Data Channel (${this.label}) error: ${e}`),this.onError(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}onOpen(e,t){}onClose(e,t){}onError(e,t){}}},9355(e,t,n){n.d(t,{I:()=>i});var s=n(948),r=n(8733);class i{constructor(e,t){this.intervalHandle=void 0,this.sink=e,this.callback=t,this.records=new Map,this.seq=0}start(e){return!this.isRunning()&&(this.startTime=Date.now(),this.records.clear(),this.intervalHandle=window.setInterval((()=>{Date.now()-this.startTime>=e.duration?this.stop():this.sendRequest(e.requestSize,e.responseSize)}).bind(this),Math.floor(1e3/e.rps)),!0)}stop(){this.intervalHandle&&(window.clearInterval(this.intervalHandle),this.intervalHandle=void 0,this.callback(this.produceResult()))}produceResult(){const e=new Map(this.records);return{records:e,dataChannelRtt:Math.ceil(Array.from(this.records.values()).reduce((e,t)=>e+(t.playerReceivedTimestamp-t.playerSentTimestamp),0)/this.records.size),playerToStreamerTime:Math.ceil(Array.from(this.records.values()).reduce((e,t)=>e+(t.streamerReceivedTimestamp-t.playerSentTimestamp),0)/this.records.size),streamerToPlayerTime:Math.ceil(Array.from(this.records.values()).reduce((e,t)=>e+(t.playerReceivedTimestamp-t.streamerSentTimestamp),0)/this.records.size),exportLatencyAsCSV:()=>{let t="Timestamp;RTT;PlayerToStreamer;StreamerToPlayer;\n";return e.forEach(e=>{t+=e.playerSentTimestamp+";",t+=e.playerReceivedTimestamp-e.playerSentTimestamp+";",t+=e.streamerReceivedTimestamp-e.playerSentTimestamp+";",t+=e.playerReceivedTimestamp-e.streamerSentTimestamp+";",t+="\n"}),t}}}isRunning(){return!!this.intervalHandle}receive(e){if(!this.isRunning())return;if(!e)return void s.Vy.Error("Undefined response from server");const t=this.records.get(e.Seq);t&&t.update(e)}sendRequest(e,t){const n=this.createRequest(e,t),s=new r.T(n);this.records.set(s.seq,s),this.sink(n)}createRequest(e,t){return{Seq:this.seq++,FillResponseSize:t,Filler:e?"A".repeat(e):""}}}},8733(e,t,n){n.d(t,{T:()=>s});class s{constructor(e){this.seq=e.Seq,this.playerSentTimestamp=Date.now(),this.requestFillerSize=e.Filler?e.Filler.length:0}update(e){this.playerReceivedTimestamp=Date.now(),this.streamerReceivedTimestamp=e.ReceivedTimestamp,this.streamerSentTimestamp=e.SentTimestamp,this.responseFillerSize=e.Filler?e.Filler.length:0}}},8236(e,t,n){n.d(t,{p:()=>r});var s=n(948);class r{constructor(e){this.dataChannelProvider=e}canSend(){return void 0!==this.dataChannelProvider.getDataChannelInstance().dataChannel&&"open"==this.dataChannelProvider.getDataChannelInstance().dataChannel.readyState}sendData(e){const t=this.dataChannelProvider.getDataChannelInstance();"open"==t.dataChannel.readyState?(t.dataChannel.send(e),s.Vy.Info(`Message Sent: ${new Uint8Array(e)}`),this.resetAfkWarningTimerOnDataSend()):s.Vy.Error(`Message Failed: ${new Uint8Array(e)}`)}resetAfkWarningTimerOnDataSend(){}}},235(e,t,n){n.d(t,{C9:()=>s});class s{constructor(){this.PixelStreamingSettings=new r,this.EncoderSettings=new i,this.WebRTCSettings=new o}ueCompatible(){null!=this.WebRTCSettings.MaxFPS&&(this.WebRTCSettings.FPS=this.WebRTCSettings.MaxFPS)}}class r{}class i{}class o{}},724(e,t,n){n.d(t,{Z:()=>r});var s=n(948);class r{constructor(){this.ReceiptTimeMs=null,this.TransmissionTimeMs=null,this.PreCaptureTimeMs=null,this.PostCaptureTimeMs=null,this.PreEncodeTimeMs=null,this.PostEncodeTimeMs=null,this.EncodeMs=null,this.CaptureToSendMs=null,this.testStartTimeMs=0,this.browserReceiptTimeMs=0,this.latencyExcludingDecode=0,this.testDuration=0,this.networkLatency=0,this.browserSendLatency=0,this.frameDisplayDeltaTimeMs=0,this.endToEndLatency=0,this.encodeLatency=0}setFrameDisplayDeltaTime(e){0==this.frameDisplayDeltaTimeMs&&(this.frameDisplayDeltaTimeMs=Math.round(e))}processFields(){null!=this.EncodeMs||null==this.PreEncodeTimeMs&&null==this.PostEncodeTimeMs||(s.Vy.Info(`Setting Encode Ms \n ${this.PostEncodeTimeMs} \n ${this.PreEncodeTimeMs}`),this.EncodeMs=this.PostEncodeTimeMs-this.PreEncodeTimeMs),null!=this.CaptureToSendMs||null==this.PreCaptureTimeMs&&null==this.PostCaptureTimeMs||(s.Vy.Info(`Setting CaptureToSendMs Ms \n ${this.PostCaptureTimeMs} \n ${this.PreCaptureTimeMs}`),this.CaptureToSendMs=this.PostCaptureTimeMs-this.PreCaptureTimeMs)}}},1065(e,t,n){n.d(t,{f:()=>s});class s{constructor(e){this.freezeFrameHeight=0,this.freezeFrameWidth=0,this.rootDiv=e,this.rootElement=document.createElement("div"),this.rootElement.id="freezeFrame",this.rootElement.style.display="none",this.rootElement.style.pointerEvents="none",this.rootElement.style.position="absolute",this.rootElement.style.zIndex="20",this.imageElement=document.createElement("img"),this.imageElement.style.position="absolute",this.rootElement.appendChild(this.imageElement),this.rootDiv.appendChild(this.rootElement)}setElementForShow(){this.rootElement.style.display="block"}setElementForHide(){this.rootElement.style.display="none"}updateImageElementSource(e){const t=btoa(e.reduce((e,t)=>e+String.fromCharCode(t),""));this.imageElement.src="data:image/jpeg;base64,"+t}setDimensionsFromElementAndResize(){this.freezeFrameHeight=this.imageElement.naturalHeight,this.freezeFrameWidth=this.imageElement.naturalWidth,this.resize()}resize(){if(0!==this.freezeFrameWidth&&0!==this.freezeFrameHeight){let e=0,t=0,n=0,s=0;const r=this.rootDiv.clientWidth/this.rootDiv.clientHeight,i=this.freezeFrameWidth/this.freezeFrameHeight;r<i?(e=this.rootDiv.clientWidth,t=Math.floor(this.rootDiv.clientWidth/i),n=Math.floor(.5*(this.rootDiv.clientHeight-t)),s=0):(e=Math.floor(this.rootDiv.clientHeight*i),t=this.rootDiv.clientHeight,n=0,s=Math.floor(.5*(this.rootDiv.clientWidth-e))),this.rootElement.style.width=this.rootDiv.offsetWidth+"px",this.rootElement.style.height=this.rootDiv.offsetHeight+"px",this.rootElement.style.left="0px",this.rootElement.style.top="0px",this.imageElement.style.width=e+"px",this.imageElement.style.height=t+"px",this.imageElement.style.left=s+"px",this.imageElement.style.top=n+"px"}}}},2865(e,t,n){n.d(t,{f:()=>i});var s=n(948),r=n(1065);class i{constructor(e){this.receiving=!1,this.size=0,this.jpeg=void 0,this.valid=!1,this.freezeFrameDelay=50,this.freezeFrame=new r.f(e)}showFreezeFrame(){this.valid&&this.freezeFrame.setElementForShow()}hideFreezeFrame(){this.valid=!1,this.freezeFrame.setElementForHide()}updateFreezeFrameAndShow(e,t){this.freezeFrame.updateImageElementSource(e),this.freezeFrame.imageElement.onload=()=>{this.freezeFrame.setDimensionsFromElementAndResize(),t()}}processFreezeFrameMessage(e,t){this.receiving||(this.receiving=!0,this.valid=!1,this.size=0,this.jpeg=void 0),this.size=new DataView(e.slice(1,5).buffer).getInt32(0,!0);const n=e.slice(5);if(this.jpeg){const e=new Uint8Array(this.jpeg.length+n.length);e.set(this.jpeg,0),e.set(n,this.jpeg.length),this.jpeg=e}else this.jpeg=n,this.receiving=!0,s.Vy.Info(`received first chunk of freeze frame: ${this.jpeg.length}/${this.size}`);this.jpeg.length===this.size?(this.receiving=!1,this.valid=!0,s.Vy.Info(`received complete freeze frame ${this.size}`),this.updateFreezeFrameAndShow(this.jpeg,t)):this.jpeg.length>this.size&&(s.Vy.Error(`received bigger freeze frame than advertised: ${this.jpeg.length}/${this.size}`),this.jpeg=void 0,this.receiving=!1)}}},3501(e,t,n){n.d(t,{g:()=>i});var s,r=n(4568);!function(e){e[e.RightClusterBottomButton=0]="RightClusterBottomButton",e[e.RightClusterRightButton=1]="RightClusterRightButton",e[e.RightClusterLeftButton=2]="RightClusterLeftButton",e[e.RightClusterTopButton=3]="RightClusterTopButton",e[e.LeftShoulder=4]="LeftShoulder",e[e.RightShoulder=5]="RightShoulder",e[e.LeftTrigger=6]="LeftTrigger",e[e.RightTrigger=7]="RightTrigger",e[e.SelectOrBack=8]="SelectOrBack",e[e.StartOrForward=9]="StartOrForward",e[e.LeftAnalogPress=10]="LeftAnalogPress",e[e.RightAnalogPress=11]="RightAnalogPress",e[e.LeftClusterTopButton=12]="LeftClusterTopButton",e[e.LeftClusterBottomButton=13]="LeftClusterBottomButton",e[e.LeftClusterLeftButton=14]="LeftClusterLeftButton",e[e.LeftClusterRightButton=15]="LeftClusterRightButton",e[e.CentreButton=16]="CentreButton",e[e.LeftStickHorizontal=0]="LeftStickHorizontal",e[e.LeftStickVertical=1]="LeftStickVertical",e[e.RightStickHorizontal=2]="RightStickHorizontal",e[e.RightStickVertical=3]="RightStickVertical"}(s||(s={}));class i{constructor(e){this.streamMessageController=e,this.onGamepadConnectedListener=this.onGamepadConnected.bind(this),this.onGamepadDisconnectedListener=this.onGamepadDisconnected.bind(this),this.beforeUnloadListener=this.onBeforeUnload.bind(this),this.requestAnimationFrame=(window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame).bind(window)}register(){window.addEventListener("beforeunload",this.beforeUnloadListener);const e=window;if("GamepadEvent"in e?(window.addEventListener("gamepadconnected",this.onGamepadConnectedListener),window.addEventListener("gamepaddisconnected",this.onGamepadDisconnectedListener)):"WebKitGamepadEvent"in e&&(window.addEventListener("webkitgamepadconnected",this.onGamepadConnectedListener),window.addEventListener("webkitgamepaddisconnected",this.onGamepadDisconnectedListener)),this.controllers=[],navigator.getGamepads)for(const e of navigator.getGamepads())e&&this.onGamepadConnected(new GamepadEvent("gamepadconnected",{gamepad:e}))}unregister(){window.removeEventListener("gamepadconnected",this.onGamepadConnectedListener),window.removeEventListener("gamepaddisconnected",this.onGamepadDisconnectedListener),window.removeEventListener("webkitgamepadconnected",this.onGamepadConnectedListener),window.removeEventListener("webkitgamepaddisconnected",this.onGamepadDisconnectedListener);for(const e of this.controllers)e&&void 0!==e.id&&this.streamMessageController.toStreamerHandlers.get("GamepadDisconnected")([e.id]);this.controllers=[]}onGamepadResponseReceived(e){for(const t of this.controllers)if(t&&void 0===t.id){t.id=e;break}}onGamepadConnected(e){const t=e.gamepad,n={currentState:(0,r.L)(t),prevState:(0,r.L)(t),id:void 0};this.controllers[t.index]=n,window.requestAnimationFrame(()=>this.updateStatus()),this.streamMessageController.toStreamerHandlers.get("GamepadConnected")()}onGamepadDisconnected(e){const t=e.gamepad,n=this.controllers[t.index];delete this.controllers[t.index],this.controllers=this.controllers.filter(e=>void 0!==e),void 0!==n.id&&this.streamMessageController.toStreamerHandlers.get("GamepadDisconnected")([n.id])}scanGamepads(){const e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let t=0;t<e.length;t++)e[t]&&void 0!==this.controllers[e[t].index]&&(this.controllers[e[t].index].currentState=e[t])}updateStatus(){this.scanGamepads();const e=this.streamMessageController.toStreamerHandlers;for(const t of this.controllers){if(!t)continue;const n=void 0===t.id?this.controllers.indexOf(t):t.id,i=t.currentState;for(let r=0;r<t.currentState.buttons.length;r++){const i=t.currentState.buttons[r],o=t.prevState.buttons[r];i.pressed?r==s.LeftTrigger?e.get("GamepadAnalog")([n,5,i.value]):r==s.RightTrigger?e.get("GamepadAnalog")([n,6,i.value]):e.get("GamepadButtonPressed")([n,r,o.pressed?1:0]):!i.pressed&&o.pressed&&(r==s.LeftTrigger?e.get("GamepadAnalog")([n,5,0]):r==s.RightTrigger?e.get("GamepadAnalog")([n,6,0]):e.get("GamepadButtonReleased")([n,r,0]))}for(let t=0;t<i.axes.length;t+=2){const s=parseFloat(i.axes[t].toFixed(4)),r=-parseFloat(i.axes[t+1].toFixed(4));e.get("GamepadAnalog")([n,t+1,s]),e.get("GamepadAnalog")([n,t+2,r])}const o=this.controllers.indexOf(t);this.controllers[o].prevState=(0,r.L)(i)}this.controllers.length>0&&this.requestAnimationFrame(()=>this.updateStatus())}onBeforeUnload(e){for(const e of this.controllers)e&&void 0!==e.id&&this.streamMessageController.toStreamerHandlers.get("GamepadDisconnected")([e.id])}}},4568(e,t,n){function s(e){return JSON.parse(JSON.stringify({buttons:e.buttons.map(e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched,value:e.value}))),axes:e.axes}))}n.d(t,{L:()=>s})},1104(e,t,n){n.d(t,{a:()=>h});var s=n(7281),r=n(6003),i=n(7883),o=n(7633),a=n(7764),l=n(3501),d=n(223),c=n(948);class h{constructor(e,t,n){this.activeKeys=new u,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=n}registerKeyBoard(e){c.Vy.Info("Register Keyboard Events");const t=new s.Y(this.toStreamerMessagesProvider,e,this.activeKeys);return t.register(),t}registerMouse(e){let t;return c.Vy.Info("Register Mouse Events"),t=e==d.Bs.HoveringMouse?new i.g(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter,this.activeKeys):new r.u(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter,this.activeKeys),t.register(),t}registerTouch(e){let t;return c.Vy.Info("Registering Touch"),t=e?new a.P(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter):new o.s(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter),t.register(),t}registerGamePad(){c.Vy.Info("Register Game Pad");const e=new l.g(this.toStreamerMessagesProvider);return e.register(),e}}class u{constructor(){this.activeKeys=[],this.activeKeys=[]}getActiveKeys(){return this.activeKeys}}},3199(e,t,n){n.d(t,{v:()=>s});const s=Object.freeze({Escape:27,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,Minus:173,Equal:187,Backspace:8,Tab:9,KeyQ:81,KeyW:87,KeyE:69,KeyR:82,KeyT:84,KeyY:89,KeyU:85,KeyI:73,KeyO:79,KeyP:80,BracketLeft:219,BracketRight:221,Enter:13,ControlLeft:17,KeyA:65,KeyS:83,KeyD:68,KeyF:70,KeyG:71,KeyH:72,KeyJ:74,KeyK:75,KeyL:76,Semicolon:186,Quote:222,Backquote:192,ShiftLeft:16,Backslash:220,KeyZ:90,KeyX:88,KeyC:67,KeyV:86,KeyB:66,KeyN:78,KeyM:77,Comma:188,Period:190,Slash:191,ShiftRight:253,AltLeft:18,Space:32,CapsLock:20,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,Pause:19,ScrollLock:145,NumpadDivide:111,NumpadMultiply:106,NumpadSubtract:109,NumpadAdd:107,NumpadDecimal:110,Numpad9:105,Numpad8:104,Numpad7:103,Numpad6:102,Numpad5:101,Numpad4:100,Numpad3:99,Numpad2:98,Numpad1:97,Numpad0:96,NumLock:144,ControlRight:254,AltRight:255,Home:36,End:35,ArrowUp:38,ArrowLeft:37,ArrowRight:39,ArrowDown:40,PageUp:33,PageDown:34,Insert:45,Delete:46,ContextMenu:93})},7281(e,t,n){n.d(t,{Y:()=>a});var s=n(4438),r=n(948),i=n(223),o=n(3199);class a{constructor(e,t,n){this.streamMessageController=e,this.config=t,this.activeKeys=n,this.onKeyDownListener=this.handleOnKeyDown.bind(this),this.onKeyUpListener=this.handleOnKeyUp.bind(this),this.onKeyPressListener=this.handleOnKeyPress.bind(this)}register(){document.addEventListener("keydown",this.onKeyDownListener),document.addEventListener("keyup",this.onKeyUpListener),document.addEventListener("keypress",this.onKeyPressListener)}unregister(){document.removeEventListener("keydown",this.onKeyDownListener),document.removeEventListener("keyup",this.onKeyUpListener),document.removeEventListener("keypress",this.onKeyPressListener)}handleOnKeyDown(e){var t;const n=this.getKeycode(e);n&&229!==n&&(null===(t=this.streamMessageController.toStreamerHandlers.get("KeyDown"))||void 0===t||t([this.getKeycode(e),e.repeat?1:0]),this.activeKeys.getActiveKeys().push(n),n===s.h.backSpace&&this.handleOnKeyPress(new KeyboardEvent("keypress",{charCode:s.h.backSpace,keyCode:s.h.backSpace})),this.config.isFlagEnabled(i.iI.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(n)&&e.preventDefault())}handleOnKeyUp(e){var t;const n=this.getKeycode(e);n&&(null===(t=this.streamMessageController.toStreamerHandlers.get("KeyUp"))||void 0===t||t([n]),this.config.isFlagEnabled(i.iI.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(n)&&e.preventDefault())}handleOnKeyPress(e){var t;const n=this.getKeycode(e);n&&(null===(t=this.streamMessageController.toStreamerHandlers.get("KeyPress"))||void 0===t||t([n]))}getKeycode(e){if(!("keyCode"in e)){const t=e;return t.code in o.v?o.v[t.code]:(r.Vy.Warning(`Keyboard code of ${t.code} is not supported in our mapping, ignoring this key.`),null)}return e.keyCode===s.h.shift&&"ShiftRight"===e.code?s.h.rightShift:e.keyCode===s.h.control&&"ControlRight"===e.code?s.h.rightControl:e.keyCode===s.h.alt&&"AltRight"===e.code?s.h.rightAlt:e.keyCode}isKeyCodeBrowserKey(e){return e>=112&&e<=123||9===e}}},8888(e,t,n){n.d(t,{J:()=>r,w:()=>s});class s{}s.mainButton=0,s.auxiliaryButton=1,s.secondaryButton=2,s.fourthButton=3,s.fifthButton=4;class r{}r.primaryButton=1,r.secondaryButton=2,r.auxiliaryButton=4,r.fourthButton=8,r.fifthButton=16},6141(e,t,n){n.d(t,{M:()=>r});var s=n(8888);class r{constructor(e,t,n,s){this.streamMessageController=e,this.coordinateConverter=n,this.videoPlayer=t,this.activeKeys=s,this.onEnterListener=this.onMouseEnter.bind(this),this.onLeaveListener=this.onMouseLeave.bind(this)}register(){this.registerMouseEnterAndLeaveEvents()}unregister(){this.unregisterMouseEnterAndLeaveEvents()}registerMouseEnterAndLeaveEvents(){const e=this.videoPlayer.getVideoParentElement();null==e||e.addEventListener("mouseenter",this.onEnterListener),null==e||e.addEventListener("mouseleave",this.onLeaveListener)}unregisterMouseEnterAndLeaveEvents(){const e=this.videoPlayer.getVideoParentElement();null==e||e.removeEventListener("mouseenter",this.onEnterListener),null==e||e.removeEventListener("mouseleave",this.onLeaveListener)}onMouseEnter(e){var t;this.videoPlayer.isVideoReady()&&(null===(t=this.streamMessageController.toStreamerHandlers.get("MouseEnter"))||void 0===t||t(),this.pressMouseButtons(e.buttons,e.x,e.y))}onMouseLeave(e){var t;this.videoPlayer.isVideoReady()&&(null===(t=this.streamMessageController.toStreamerHandlers.get("MouseLeave"))||void 0===t||t(),this.releaseMouseButtons(e.buttons,e.x,e.y))}releaseMouseButtons(e,t,n){const r=this.coordinateConverter.translateUnsigned(t,n);e&s.J.primaryButton&&this.sendMouseUp(s.w.mainButton,r.x,r.y),e&s.J.secondaryButton&&this.sendMouseUp(s.w.secondaryButton,r.x,r.y),e&s.J.auxiliaryButton&&this.sendMouseUp(s.w.auxiliaryButton,r.x,r.y),e&s.J.fourthButton&&this.sendMouseUp(s.w.fourthButton,r.x,r.y),e&s.J.fifthButton&&this.sendMouseUp(s.w.fifthButton,r.x,r.y)}pressMouseButtons(e,t,n){if(!this.videoPlayer.isVideoReady())return;const r=this.coordinateConverter.translateUnsigned(t,n);e&s.J.primaryButton&&this.sendMouseDown(s.w.mainButton,r.x,r.y),e&s.J.secondaryButton&&this.sendMouseDown(s.w.secondaryButton,r.x,r.y),e&s.J.auxiliaryButton&&this.sendMouseDown(s.w.auxiliaryButton,r.x,r.y),e&s.J.fourthButton&&this.sendMouseDown(s.w.fourthButton,r.x,r.y),e&s.J.fifthButton&&this.sendMouseDown(s.w.fifthButton,r.x,r.y)}sendMouseDown(e,t,n){var s;null===(s=this.streamMessageController.toStreamerHandlers.get("MouseDown"))||void 0===s||s([e,t,n])}sendMouseUp(e,t,n){var s;const r=this.coordinateConverter.translateUnsigned(t,n);null===(s=this.streamMessageController.toStreamerHandlers.get("MouseUp"))||void 0===s||s([e,r.x,r.y])}}},7883(e,t,n){n.d(t,{g:()=>r});var s=n(6141);class r extends s.M{constructor(e,t,n,s){super(e,t,n,s),this.videoElementParent=t.getVideoParentElement(),this.onMouseUpListener=this.onMouseUp.bind(this),this.onMouseDownListener=this.onMouseDown.bind(this),this.onMouseDblClickListener=this.onMouseDblClick.bind(this),this.onMouseWheelListener=this.onMouseWheel.bind(this),this.onMouseMoveListener=this.onMouseMove.bind(this),this.onContextMenuListener=this.onContextMenu.bind(this)}register(){super.register(),this.videoElementParent.addEventListener("mousemove",this.onMouseMoveListener),this.videoElementParent.addEventListener("mousedown",this.onMouseDownListener),this.videoElementParent.addEventListener("mouseup",this.onMouseUpListener),this.videoElementParent.addEventListener("contextmenu",this.onContextMenuListener),this.videoElementParent.addEventListener("wheel",this.onMouseWheelListener),this.videoElementParent.addEventListener("dblclick",this.onMouseDblClickListener)}unregister(){this.videoElementParent.removeEventListener("mousemove",this.onMouseMoveListener),this.videoElementParent.removeEventListener("mousedown",this.onMouseDownListener),this.videoElementParent.removeEventListener("mouseup",this.onMouseUpListener),this.videoElementParent.removeEventListener("contextmenu",this.onContextMenuListener),this.videoElementParent.removeEventListener("wheel",this.onMouseWheelListener),this.videoElementParent.removeEventListener("dblclick",this.onMouseDblClickListener),super.unregister()}onMouseDown(e){if(!this.videoPlayer.isVideoReady())return;const t=this.coordinateConverter.translateUnsigned(e.offsetX,e.offsetY);this.streamMessageController.toStreamerHandlers.get("MouseDown")([e.button,t.x,t.y]),e.preventDefault()}onMouseUp(e){if(!this.videoPlayer.isVideoReady())return;const t=this.coordinateConverter.translateUnsigned(e.offsetX,e.offsetY);this.streamMessageController.toStreamerHandlers.get("MouseUp")([e.button,t.x,t.y]),e.preventDefault()}onContextMenu(e){this.videoPlayer.isVideoReady()&&e.preventDefault()}onMouseMove(e){if(!this.videoPlayer.isVideoReady())return;const t=this.coordinateConverter.translateUnsigned(e.offsetX,e.offsetY),n=this.coordinateConverter.translateSigned(e.movementX,e.movementY);this.streamMessageController.toStreamerHandlers.get("MouseMove")([t.x,t.y,n.x,n.y]),e.preventDefault()}onMouseWheel(e){if(!this.videoPlayer.isVideoReady())return;const t=this.coordinateConverter.translateUnsigned(e.offsetX,e.offsetY);this.streamMessageController.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,t.x,t.y]),e.preventDefault()}onMouseDblClick(e){if(!this.videoPlayer.isVideoReady())return;const t=this.coordinateConverter.translateUnsigned(e.offsetX,e.offsetY);this.streamMessageController.toStreamerHandlers.get("MouseDouble")([e.button,t.x,t.y])}}},6003(e,t,n){n.d(t,{u:()=>i});var s=n(948),r=n(6141);class i extends r.M{constructor(e,t,n,s){super(e,t,n,s),this.videoElementParent=t.getVideoParentElement(),this.x=this.videoElementParent.getBoundingClientRect().width/2,this.y=this.videoElementParent.getBoundingClientRect().height/2,this.normalizedCoord=this.coordinateConverter.translateUnsigned(this.x,this.y),this.onRequestLockListener=this.onRequestLock.bind(this),this.onLockStateChangeListener=this.onLockStateChange.bind(this),this.onMouseUpListener=this.onMouseUp.bind(this),this.onMouseDownListener=this.onMouseDown.bind(this),this.onMouseDblClickListener=this.onMouseDblClick.bind(this),this.onMouseWheelListener=this.onMouseWheel.bind(this),this.onMouseMoveListener=this.onMouseMove.bind(this)}register(){super.register(),this.videoElementParent.requestPointerLock=this.videoElementParent.requestPointerLock||this.videoElementParent.mozRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,this.videoElementParent.requestPointerLock&&this.videoElementParent.addEventListener("click",this.onRequestLockListener),document.addEventListener("pointerlockchange",this.onLockStateChangeListener),document.addEventListener("mozpointerlockchange",this.onLockStateChangeListener),this.videoElementParent.addEventListener("mousedown",this.onMouseDownListener),this.videoElementParent.addEventListener("mouseup",this.onMouseUpListener),this.videoElementParent.addEventListener("wheel",this.onMouseWheelListener),this.videoElementParent.addEventListener("dblclick",this.onMouseDblClickListener)}unregister(){const e=document.pointerLockElement||document.mozPointerLockElement;document.exitPointerLock&&e===this.videoElementParent&&document.exitPointerLock(),this.videoElementParent.removeEventListener("click",this.onRequestLockListener),document.removeEventListener("pointerlockchange",this.onLockStateChangeListener),document.removeEventListener("mozpointerlockchange",this.onLockStateChangeListener),document.removeEventListener("mousemove",this.onMouseMoveListener),this.videoElementParent.removeEventListener("mousedown",this.onMouseDownListener),this.videoElementParent.removeEventListener("mouseup",this.onMouseUpListener),this.videoElementParent.removeEventListener("wheel",this.onMouseWheelListener),this.videoElementParent.removeEventListener("dblclick",this.onMouseDblClickListener),super.unregister()}onRequestLock(){this.videoElementParent.requestPointerLock()}onLockStateChange(){(document.pointerLockElement||document.mozPointerLockElement)===this.videoElementParent?(s.Vy.Info("Pointer locked"),document.addEventListener("mousemove",this.onMouseMoveListener)):(s.Vy.Info("The pointer lock status is now unlocked"),document.removeEventListener("mousemove",this.onMouseMoveListener),this.activeKeys.getActiveKeys().forEach(e=>{this.streamMessageController.toStreamerHandlers.get("KeyUp")([e])}))}onMouseDown(e){this.videoPlayer.isVideoReady()&&this.streamMessageController.toStreamerHandlers.get("MouseDown")([e.button,this.normalizedCoord.x,this.normalizedCoord.y])}onMouseUp(e){this.videoPlayer.isVideoReady()&&this.streamMessageController.toStreamerHandlers.get("MouseUp")([e.button,this.normalizedCoord.x,this.normalizedCoord.y])}onMouseMove(e){if(!this.videoPlayer.isVideoReady())return;const t=this.videoPlayer.getVideoParentElement().clientWidth,n=this.videoPlayer.getVideoParentElement().clientHeight;for(this.x+=e.movementX,this.y+=e.movementY;this.x>t;)this.x-=t;for(;this.y>n;)this.y-=n;for(;this.x<0;)this.x+=t;for(;this.y<0;)this.y+=n;this.normalizedCoord=this.coordinateConverter.translateUnsigned(this.x,this.y);const s=this.coordinateConverter.translateSigned(e.movementX,e.movementY);this.streamMessageController.toStreamerHandlers.get("MouseMove")([this.normalizedCoord.x,this.normalizedCoord.y,s.x,s.y])}onMouseWheel(e){this.videoPlayer.isVideoReady()&&this.streamMessageController.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,this.normalizedCoord.x,this.normalizedCoord.y])}onMouseDblClick(e){this.videoPlayer.isVideoReady()&&this.streamMessageController.toStreamerHandlers.get("MouseDouble")([e.button,this.normalizedCoord.x,this.normalizedCoord.y])}}},4438(e,t,n){n.d(t,{h:()=>s});class s{}s.backSpace=8,s.shift=16,s.control=17,s.alt=18,s.rightShift=253,s.rightControl=254,s.rightAlt=255},7633(e,t,n){n.d(t,{s:()=>r});var s=n(948);class r{constructor(e,t,n){this.fingers=[9,8,7,6,5,4,3,2,1,0],this.fingerIds=new Map,this.maxByteValue=255,this.streamMessageController=e,this.videoPlayer=t,this.coordinateConverter=n,this.videoElementParent=t.getVideoElement(),this.onTouchStartListener=this.onTouchStart.bind(this),this.onTouchEndListener=this.onTouchEnd.bind(this),this.onTouchMoveListener=this.onTouchMove.bind(this)}register(){this.videoElementParent.addEventListener("touchstart",this.onTouchStartListener),this.videoElementParent.addEventListener("touchend",this.onTouchEndListener),this.videoElementParent.addEventListener("touchmove",this.onTouchMoveListener)}unregister(){this.videoElementParent.removeEventListener("touchstart",this.onTouchStartListener),this.videoElementParent.removeEventListener("touchend",this.onTouchEndListener),this.videoElementParent.removeEventListener("touchmove",this.onTouchMoveListener)}rememberTouch(e){const t=this.fingers.pop();void 0===t&&s.Vy.Info("exhausted touch identifiers"),this.fingerIds.set(e.identifier,t)}forgetTouch(e){this.fingers.push(this.fingerIds.get(e.identifier)),this.fingers.sort(function(e,t){return t-e}),this.fingerIds.delete(e.identifier)}onTouchStart(e){if(this.videoPlayer.isVideoReady()){for(let t=0;t<e.changedTouches.length;t++)this.rememberTouch(e.changedTouches[t]);this.emitTouchData("TouchStart",e.changedTouches),e.preventDefault()}}onTouchEnd(e){if(this.videoPlayer.isVideoReady()){this.emitTouchData("TouchEnd",e.changedTouches);for(let t=0;t<e.changedTouches.length;t++)this.forgetTouch(e.changedTouches[t]);e.preventDefault()}}onTouchMove(e){this.videoPlayer.isVideoReady()&&(this.emitTouchData("TouchMove",e.touches),e.preventDefault())}emitTouchData(e,t){if(!this.videoPlayer.isVideoReady())return;const n=this.videoPlayer.getVideoParentElement().getBoundingClientRect(),r=this.streamMessageController.toStreamerHandlers;for(let i=0;i<t.length;i++){const o=1,a=t[i],l=a.clientX-n.left,d=a.clientY-n.top;s.Vy.Info(`F${this.fingerIds.get(a.identifier)}=(${l}, ${d})`);const c=this.coordinateConverter.translateUnsigned(l,d);switch(e){case"TouchStart":r.get("TouchStart")([o,c.x,c.y,this.fingerIds.get(a.identifier),this.maxByteValue*(a.force>0?a.force:1),c.inRange?1:0]);break;case"TouchEnd":r.get("TouchEnd")([o,c.x,c.y,this.fingerIds.get(a.identifier),this.maxByteValue*a.force,c.inRange?1:0]);break;case"TouchMove":r.get("TouchMove")([o,c.x,c.y,this.fingerIds.get(a.identifier),this.maxByteValue*(a.force>0?a.force:1),c.inRange?1:0])}}}}},7764(e,t,n){n.d(t,{P:()=>r});var s=n(8888);class r{constructor(e,t,n){this.streamMessageController=e,this.videoPlayer=t,this.coordinateConverter=n,this.onTouchStartListener=this.onTouchStart.bind(this),this.onTouchEndListener=this.onTouchEnd.bind(this),this.onTouchMoveListener=this.onTouchMove.bind(this),this.videoElementParentClientRect=this.videoPlayer.getVideoParentElement().getBoundingClientRect()}register(){document.addEventListener("touchstart",this.onTouchStartListener),document.addEventListener("touchend",this.onTouchEndListener),document.addEventListener("touchmove",this.onTouchMoveListener)}unregister(){document.removeEventListener("touchstart",this.onTouchStartListener),document.removeEventListener("touchend",this.onTouchEndListener),document.removeEventListener("touchmove",this.onTouchMoveListener)}onTouchStart(e){if(this.videoPlayer.isVideoReady()&&e.target===this.videoPlayer.getVideoElement()){if(null==this.fakeTouchFinger){const t=e.changedTouches[0];this.fakeTouchFinger={id:t.identifier,x:t.clientX-this.videoElementParentClientRect.left,y:t.clientY-this.videoElementParentClientRect.top};const n=this.videoPlayer.getVideoParentElement(),r=new MouseEvent("mouseenter",t);n.dispatchEvent(r);const i=this.coordinateConverter.translateUnsigned(this.fakeTouchFinger.x,this.fakeTouchFinger.y);this.streamMessageController.toStreamerHandlers.get("MouseDown")([s.w.mainButton,i.x,i.y])}e.preventDefault()}}onTouchEnd(e){if(!this.videoPlayer.isVideoReady()||null==this.fakeTouchFinger)return;const t=this.videoPlayer.getVideoParentElement(),n=this.streamMessageController.toStreamerHandlers;for(let r=0;r<e.changedTouches.length;r++){const i=e.changedTouches[r];if(i.identifier===this.fakeTouchFinger.id){const e=i.clientX-this.videoElementParentClientRect.left,r=i.clientY-this.videoElementParentClientRect.top,o=this.coordinateConverter.translateUnsigned(e,r);n.get("MouseUp")([s.w.mainButton,o.x,o.y]);const a=new MouseEvent("mouseleave",i);t.dispatchEvent(a),this.fakeTouchFinger=null;break}}e.preventDefault()}onTouchMove(e){if(!this.videoPlayer.isVideoReady()||null==this.fakeTouchFinger)return;const t=this.streamMessageController.toStreamerHandlers;for(let n=0;n<e.touches.length;n++){const s=e.touches[n];if(s.identifier===this.fakeTouchFinger.id){const e=s.clientX-this.videoElementParentClientRect.left,n=s.clientY-this.videoElementParentClientRect.top,r=this.coordinateConverter.translateUnsigned(e,n),i=this.coordinateConverter.translateSigned(e-this.fakeTouchFinger.x,n-this.fakeTouchFinger.y);t.get("MouseMove")([r.x,r.y,i.x,i.y]),this.fakeTouchFinger.x=e,this.fakeTouchFinger.y=n;break}}e.preventDefault()}}},2807(e,t,n){n.d(t,{E:()=>r});var s=n(4568);class r{constructor(e){this.toStreamerMessagesProvider=e,this.controllers=[]}updateStatus(e,t,n){if(e.gamepad){const r=t.getPose(e.gripSpace,n);if(!r)return;let i=0;e.profiles.includes("htc-vive")?i=1:e.profiles.includes("oculus-touch")&&(i=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([i]);let o=2;switch(e.handedness){case"left":o=0;break;case"right":o=1}const a=r.transform.matrix,l=[];for(let e=0;e<16;e++)l[e]=new Float32Array([a[e]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([l[0],l[4],l[8],l[12],l[1],l[5],l[9],l[13],l[2],l[6],l[10],l[14],l[3],l[7],l[11],l[15],o]),void 0===this.controllers[o]&&(this.controllers[o]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[o].prevState=(0,s.L)(e.gamepad)),this.controllers[o].currentState=(0,s.L)(e.gamepad);const d=this.controllers[o],c=d.currentState,h=d.prevState;for(let e=0;e<c.buttons.length;e++){const t=c.buttons[e],n=h.buttons[e];if(t.pressed){const s=n.pressed?1:0;this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([o,e,s,t.value])}else n.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([o,e,0]);if(t.touched){const t=n.touched?1:0;this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonTouched")([o,e,t])}else n.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonTouchReleased")([o,e,0])}for(let e=0;e<c.axes.length;e++){const t=c.axes[e];t!=h.axes[e]&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([o,e,t])}this.controllers[o].prevState=c}}}},6679(e,t,n){n.d(t,{F:()=>c});var s=n(5683),r=n(8749),i=n(9904),o=n(434),a=n(5016),l=n(156),d=n(948);class c{constructor(){this.inboundVideoStats=new s.IR,this.inboundAudioStats=new s.$o,this.datachannelStats=new r.L,this.outboundVideoStats=new o.k,this.outboundAudioStats=new o.k,this.remoteOutboundAudioStats=new o.G,this.remoteOutboundVideoStats=new o.G,this.sessionStats=new a.Y,this.streamStats=new l.I,this.codecs=new Map}processStats(e){this.localCandidates=new Array,this.remoteCandidates=new Array,this.candidatePairs=new Array,e.forEach(e=>{switch(e.type){case"candidate-pair":this.handleCandidatePair(e);break;case"certificate":case"media-source":case"media-playout":case"peer-connection":case"remote-inbound-rtp":break;case"codec":this.handleCodec(e);break;case"data-channel":this.handleDataChannel(e);break;case"inbound-rtp":this.handleInboundRTP(e);break;case"local-candidate":this.handleLocalCandidate(e);break;case"outbound-rtp":this.handleLocalOutbound(e);break;case"remote-candidate":this.handleRemoteCandidate(e);break;case"remote-outbound-rtp":this.handleRemoteOutbound(e);break;case"track":this.handleTrack(e);break;case"transport":this.handleTransport(e);break;case"stream":this.handleStream(e);break;default:d.Vy.Error("unhandled Stat Type"),d.Vy.Info(e)}})}handleStream(e){this.streamStats=e}handleCandidatePair(e){this.candidatePairs.push(e)}handleDataChannel(e){this.datachannelStats.bytesReceived=e.bytesReceived,this.datachannelStats.bytesSent=e.bytesSent,this.datachannelStats.dataChannelIdentifier=e.dataChannelIdentifier,this.datachannelStats.id=e.id,this.datachannelStats.label=e.label,this.datachannelStats.messagesReceived=e.messagesReceived,this.datachannelStats.messagesSent=e.messagesSent,this.datachannelStats.protocol=e.protocol,this.datachannelStats.state=e.state,this.datachannelStats.timestamp=e.timestamp}handleLocalCandidate(e){const t=new i.y;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.candidateType=e.candidateType,t.id=e.id,t.relayProtocol=e.relayProtocol,t.transportId=e.transportId,this.localCandidates.push(t)}handleRemoteCandidate(e){const t=new i.y;t.label="remote-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.id=e.id,t.candidateType=e.candidateType,t.relayProtocol=e.relayProtocol,t.transportId=e.transportId,this.remoteCandidates.push(t)}handleInboundRTP(e){switch(e.kind){case"video":e.bytesReceived>this.inboundVideoStats.bytesReceived&&e.timestamp>this.inboundVideoStats.timestamp&&(this.inboundVideoStats.bitrate=8*(e.bytesReceived-this.inboundVideoStats.bytesReceived)/(e.timestamp-this.inboundVideoStats.timestamp),this.inboundVideoStats.bitrate=Math.floor(this.inboundVideoStats.bitrate));for(const t in e)this.inboundVideoStats[t]=e[t];break;case"audio":e.bytesReceived>this.inboundAudioStats.bytesReceived&&e.timestamp>this.inboundAudioStats.timestamp&&(this.inboundAudioStats.bitrate=8*(e.bytesReceived-this.inboundAudioStats.bytesReceived)/(e.timestamp-this.inboundAudioStats.timestamp),this.inboundAudioStats.bitrate=Math.floor(this.inboundAudioStats.bitrate));for(const t in e)this.inboundAudioStats[t]=e[t];break;default:d.Vy.Error(`Kind should be audio or video, we got ${e.kind} - that's unsupported.`)}}handleLocalOutbound(e){const t="audio"===e.kind?this.outboundAudioStats:this.outboundVideoStats;t.active=e.active,t.codecId=e.codecId,t.bytesSent=e.bytesSent,t.frameHeight=e.frameHeight,t.frameWidth=e.frameWidth,t.framesEncoded=e.framesEncoded,t.framesPerSecond=e.framesPerSecond,t.headerBytesSent=e.headerBytesSent,t.id=e.id,t.keyFramesEncoded=e.keyFramesEncoded,t.kind=e.kind,t.mediaSourceId=e.mediaSourceId,t.mid=e.mid,t.nackCount=e.nackCount,t.packetsSent=e.packetsSent,t.qpSum=e.qpSum,t.qualityLimitationDurations=e.qualityLimitationDurations,t.qualityLimitationReason=e.qualityLimitationReason,t.remoteId=e.remoteId,t.retransmittedBytesSent=e.retransmittedBytesSent,t.rid=e.rid,t.scalabilityMode=e.scalabilityMode,t.ssrc=e.ssrc,t.targetBitrate=e.targetBitrate,t.timestamp=e.timestamp,t.totalEncodeTime=e.totalEncodeTime,t.totalEncodeBytesTarget=e.totalEncodeBytesTarget,t.totalPacketSendDelay=e.totalPacketSendDelay,t.transportId=e.transportId}handleRemoteOutbound(e){const t="audio"===e.kind?this.remoteOutboundAudioStats:this.remoteOutboundVideoStats;t.bytesSent=e.bytesSent,t.codecId=e.codecId,t.id=e.id,t.kind=e.kind,t.localId=e.localId,t.packetsSent=e.packetsSent,t.remoteTimestamp=e.remoteTimestamp,t.reportsSent=e.reportsSent,t.roundTripTimeMeasurements=e.roundTripTimeMeasurements,t.ssrc=e.ssrc,t.timestamp=e.timestamp,t.totalRoundTripTime=e.totalRoundTripTime,t.transportId=e.transportId}handleTrack(e){"track"!==e.type||"video_label"!==e.trackIdentifier&&"video"!==e.kind||(this.inboundVideoStats.framesDropped=e.framesDropped,this.inboundVideoStats.framesReceived=e.framesReceived,this.inboundVideoStats.frameHeight=e.frameHeight,this.inboundVideoStats.frameWidth=e.frameWidth)}handleTransport(e){this.transportStats=e}handleCodec(e){const t=e.id;this.codecs.set(t,e)}handleSessionStatistics(e,t,n){const s=Date.now()-e;this.sessionStats.runTime=new Date(s).toISOString().substr(11,8).toString();const r=null===t?"Not sent yet":t?"true":"false";this.sessionStats.controlsStreamInput=r,this.sessionStats.videoEncoderAvgQP=n}isNumber(e){return"number"==typeof e&&isFinite(e)}getActiveCandidatePair(){if(void 0===this.candidatePairs)return null;if(this.transportStats){const e=this.candidatePairs.find(e=>e.id===this.transportStats.selectedCandidatePairId);return void 0===e?null:e}const e=this.candidatePairs.find(e=>e.selected);return void 0===e?null:e}}},9904(e,t,n){n.d(t,{y:()=>s});class s{}},8749(e,t,n){n.d(t,{L:()=>s});class s{}},5683(e,t,n){n.d(t,{$o:()=>s,IR:()=>r});class s{}class r{}},7937(e,t,n){n.d(t,{b3:()=>i});class s{}class r{}class i{constructor(){this.latestSenderRecvClockOffset=null}calculate(e,t){const n=new o,s=this.getRTTMs(e);if(null!=s){n.rttMs=s;const r=this.getCaptureSource(t);if(null!=r){const t=this.calculateSenderLatency(e,r);null!==t&&(n.senderLatencyMs=t)}}return void 0!==e.inboundVideoStats.totalProcessingDelay&&void 0!==e.inboundVideoStats.framesDecoded&&(n.averageProcessingDelayMs=e.inboundVideoStats.totalProcessingDelay/e.inboundVideoStats.framesDecoded*1e3),void 0!==e.inboundVideoStats.jitterBufferDelay&&void 0!==e.inboundVideoStats.jitterBufferEmittedCount&&(n.averageJitterBufferDelayMs=e.inboundVideoStats.jitterBufferDelay/e.inboundVideoStats.jitterBufferEmittedCount*1e3),void 0!==e.inboundVideoStats.framesDecoded&&void 0!==e.inboundVideoStats.totalDecodeTime&&(n.averageDecodeLatencyMs=e.inboundVideoStats.totalDecodeTime/e.inboundVideoStats.framesDecoded*1e3),void 0!==e.inboundVideoStats.totalAssemblyTime&&void 0!==e.inboundVideoStats.framesAssembledFromMultiplePackets&&(n.averageAssemblyDelayMs=e.inboundVideoStats.totalAssemblyTime/e.inboundVideoStats.framesAssembledFromMultiplePackets*1e3),void 0!==e.inboundVideoStats.googTimingFrameInfo&&e.inboundVideoStats.googTimingFrameInfo.length>0&&(n.frameTiming=this.extractFrameTimingInfo(e.inboundVideoStats.googTimingFrameInfo)),void 0!==n.frameTiming&&void 0!==n.frameTiming.captureToSendLatencyMs&&void 0!==n.averageProcessingDelayMs&&void 0!==n.rttMs&&(n.averageE2ELatency=n.frameTiming.captureToSendLatencyMs+.5*n.rttMs+n.averageProcessingDelayMs),null!=n.senderLatencyMs&&void 0!==n.averageProcessingDelayMs&&void 0!==n.rttMs&&(n.averageE2ELatency=n.senderLatencyMs+.5*n.rttMs+n.averageProcessingDelayMs),n}extractFrameTimingInfo(e){const t=new r,n=e.split(",");return 15===n.length&&(t.rtpTimestamp=Number.parseInt(n[0]),t.captureTimestamp=Number.parseInt(n[1]),t.encodeStartTimestamp=Number.parseInt(n[2]),t.encodeFinishTimestamp=Number.parseInt(n[3]),t.packetizerFinishTimestamp=Number.parseInt(n[4]),t.pacerExitTimestamp=Number.parseInt(n[5]),t.networkTimestamp1=Number.parseInt(n[6]),t.networkTimestamp2=Number.parseInt(n[7]),t.receiveStart=Number.parseInt(n[8]),t.receiveFinish=Number.parseInt(n[9]),t.decodeStart=Number.parseInt(n[10]),t.decodeFinish=Number.parseInt(n[11]),t.renderTime=Number.parseInt(n[12]),t.isOutlier=Number.parseInt(n[13])>0,t.isTriggeredByTimer=Number.parseInt(n[14])>0,t.encoderLatencyMs=t.encodeFinishTimestamp-t.encodeStartTimestamp,t.packetizeLatencyMs=t.packetizerFinishTimestamp-t.encodeFinishTimestamp,t.pacerLatencyMs=t.pacerExitTimestamp-t.packetizerFinishTimestamp,t.captureToSendLatencyMs=t.pacerExitTimestamp-t.captureTimestamp),t}calculateSenderLatency(e,t){const n=t.captureTimestamp+t.senderCaptureTimeOffset;let s=this.calculateSenderReceiverClockOffset(e);if(null==s){if(null==this.latestSenderRecvClockOffset)return null;s=this.latestSenderRecvClockOffset}else this.latestSenderRecvClockOffset=s;const r=n+s-22089888e5;return t.timestamp-r}getCaptureSource(e){e=e.filter(e=>"video"===e.track.kind);for(const t of e){const e=t.getSynchronizationSources().concat(t.getContributingSources());for(const t of e)if(void 0!==t.captureTimestamp&&void 0!==t.senderCaptureTimeOffset&&void 0!==t.timestamp){const e=new s;return e.timestamp=t.timestamp,e.captureTimestamp=t.captureTimestamp,e.senderCaptureTimeOffset=t.senderCaptureTimeOffset,e}}return null}calculateSenderReceiverClockOffset(e){if(void 0===e.remoteOutboundVideoStats||void 0===e.remoteOutboundVideoStats.timestamp||void 0===e.remoteOutboundVideoStats.remoteTimestamp)return null;const t=e.remoteOutboundVideoStats.timestamp,n=e.remoteOutboundVideoStats.remoteTimestamp,s=this.getRTTMs(e);return void 0!==t&&void 0!==n&&null!==s?t-(n+.5*s):null}getRTTMs(e){const t=e.getActiveCandidatePair();return t&&void 0!==t.currentRoundTripTime?1e3*t.currentRoundTripTime:e.remoteOutboundVideoStats&&void 0!==e.remoteOutboundVideoStats.totalRoundTripTime&&void 0!==e.remoteOutboundVideoStats.roundTripTimeMeasurements&&e.remoteOutboundVideoStats.roundTripTimeMeasurements>0?e.remoteOutboundVideoStats.totalRoundTripTime/e.remoteOutboundVideoStats.roundTripTimeMeasurements*1e3:e.remoteOutboundAudioStats&&void 0!==e.remoteOutboundAudioStats.totalRoundTripTime&&void 0!==e.remoteOutboundAudioStats.roundTripTimeMeasurements&&e.remoteOutboundAudioStats.roundTripTimeMeasurements>0?e.remoteOutboundAudioStats.totalRoundTripTime/e.remoteOutboundAudioStats.roundTripTimeMeasurements*1e3:null}}class o{constructor(){this.senderLatencyMs=void 0,this.senderLatencyAbsCaptureTimeMs=void 0,this.rttMs=void 0,this.averageProcessingDelayMs=void 0,this.averageJitterBufferDelayMs=void 0,this.averageDecodeLatencyMs=void 0,this.averageAssemblyDelayMs=void 0,this.averageE2ELatency=void 0,this.frameTiming=void 0}}},434(e,t,n){n.d(t,{G:()=>r,k:()=>s});class s{}class r{}},1615(e,t,n){n.d(t,{J:()=>h});var s=n(948),r=n(223),i=n(6679),o=n(7963),a=n(3507),l=n(9046),d=n(7937),c=function(e,t,n,s){return new(n||(n=Promise))(function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};class h{constructor(e,t,n){this.config=t,this.createPeerConnection(e,n),this.latencyCalculator=new d.b3}createPeerConnection(e,t){this.config.isFlagEnabled(r.iI.ForceTURN)&&(e.iceTransportPolicy="relay",s.Vy.Info("Forcing TURN usage by setting ICE Transport Policy in peer connection config.")),this.peerConnection=new RTCPeerConnection(e),this.peerConnection.onsignalingstatechange=e=>this.handleSignalStateChange(e),this.peerConnection.oniceconnectionstatechange=e=>this.handleIceConnectionStateChange(e),this.peerConnection.onicegatheringstatechange=e=>this.handleIceGatheringStateChange(e),this.peerConnection.ontrack=e=>this.handleOnTrack(e),this.peerConnection.onicecandidate=e=>this.handleIceCandidate(e),this.peerConnection.ondatachannel=e=>this.handleDataChannel(e),this.aggregatedStats=new i.F,this.preferredCodec=t,this.updateCodecSelection=!0}createOffer(e,t){return c(this,void 0,void 0,function*(){s.Vy.Info("Create Offer");const n="localhost"===location.hostname||"127.0.0.1"===location.hostname,i="https:"===location.protocol;let o=t.isFlagEnabled(r.iI.UseMic),a=t.isFlagEnabled(r.iI.UseCamera);!o&&!a||n||i||(o=!1,a=!1,s.Vy.Error("Microphone and Webcam access in the browser will not work if you are not on HTTPS or localhost. Disabling mic and webcam access."),s.Vy.Error("For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(o,a).finally(()=>{var t;null===(t=this.peerConnection)||void 0===t||t.createOffer(e).then(e=>{var t;this.showTextOverlayConnecting(),e.sdp=this.mungeSDP(e.sdp,o),null===(t=this.peerConnection)||void 0===t||t.setLocalDescription(e),this.onSendWebRTCOffer(e)}).catch(()=>{this.showTextOverlaySetupFailure()})})})}receiveOffer(e,t){return c(this,void 0,void 0,function*(){var n;s.Vy.Info("Receive Offer"),this.isFirefox()&&(e.sdp=e.sdp.replace(/^a=extmap:\d+ http:\/\/www\.webrtc\.org\/experiments\/rtp-hdrext\/abs-capture-time\r\n/gm,"")),null===(n=this.peerConnection)||void 0===n||n.setRemoteDescription(e).then(()=>{this.onSetRemoteDescription(e);const n="localhost"===location.hostname||"127.0.0.1"===location.hostname,i="https:"===location.protocol;let o=t.isFlagEnabled(r.iI.UseMic),a=t.isFlagEnabled(r.iI.UseCamera);!o&&!a||n||i||(o=!1,a=!1,s.Vy.Error("Microphone and Webcam access in the browser will not work if you are not on HTTPS or localhost. Disabling mic and webcam access."),s.Vy.Error("For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.config.setOptionSettingOptions(r.mY.PreferredCodec,this.fuzzyIntersectUEAndBrowserCodecs(e)),this.setupTransceiversAsync(o,a).finally(()=>{var e;null===(e=this.peerConnection)||void 0===e||e.createAnswer().then(e=>{var t;return e.sdp=this.mungeSDP(e.sdp,o),null===(t=this.peerConnection)||void 0===t?void 0:t.setLocalDescription(e)}).then(()=>{var e;this.onSetLocalDescription(null===(e=this.peerConnection)||void 0===e?void 0:e.currentLocalDescription)}).catch(e=>{s.Vy.Error(`createAnswer() failed - ${e}`)})})})})}receiveAnswer(e){var t;null===(t=this.peerConnection)||void 0===t||t.setRemoteDescription(e),this.config.setOptionSettingOptions(r.mY.PreferredCodec,this.fuzzyIntersectUEAndBrowserCodecs(e))}generateStats(){this.peerConnection.getStats().then(e=>{this.aggregatedStats.processStats(e),this.onVideoStats(this.aggregatedStats);const t=this.latencyCalculator.calculate(this.aggregatedStats,this.peerConnection.getReceivers());if(this.onLatencyCalculated(t),this.updateCodecSelection&&this.aggregatedStats.inboundVideoStats.codecId){const e=this.aggregatedStats.codecs.get(this.aggregatedStats.inboundVideoStats.codecId);if(void 0===e)return;const t=e.mimeType.replace("video/","");let n=t;e.sdpFmtpLine&&""!==e.sdpFmtpLine.trim()&&(n=`${t} ${e.sdpFmtpLine.trim()}`);const s=this.config.getSettingOption(r.mY.PreferredCodec).options;if(s.includes(n))return void this.config.setOptionSettingValue(r.mY.PreferredCodec,n);const i=s.filter(e=>-1!==e.indexOf(t));if(i.length>0)return void this.config.setOptionSettingValue(r.mY.PreferredCodec,i[0])}})}close(){this.peerConnection&&(this.peerConnection.close(),this.peerConnection=null)}mungeSDP(e,t){let n=e.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=10000;x-google-max-bitrate=100000\r\n"),s="maxaveragebitrate=510000;";return t&&(s+="sprop-maxcapturerate=48000;"),s+=this.config.isFlagEnabled(r.iI.ForceMonoAudio)?"stereo=0;":"stereo=1;",s+="useinbandfec=1",n=n.replace("useinbandfec=1",s),this.config.isFlagEnabled(r.iI.EnableCaptureTimeExt)&&!this.isFirefox()&&(n=l.p.addVideoHeaderExtensionToSdp(n,"http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time")),n}isFirefox(){return navigator.userAgent.indexOf("Firefox")>0}handleOnIce(e){var t;s.Vy.Info("peerconnection handleOnIce"),this.config.isFlagEnabled(r.iI.ForceTURN)&&e.candidate.indexOf("relay")<0?s.Vy.Info(`Dropping candidate because it was not TURN relay. | Type= ${e.type} | Protocol= ${e.protocol} | Address=${e.address} | Port=${e.port} |`):null===(t=this.peerConnection)||void 0===t||t.addIceCandidate(e)}handleSignalStateChange(e){s.Vy.Info("signaling state change: "+e)}handleIceConnectionStateChange(e){s.Vy.Info("ice connection state change: "+e),this.onIceConnectionStateChange(e)}handleIceGatheringStateChange(e){s.Vy.Info("ice gathering state change: "+JSON.stringify(e))}handleOnTrack(e){e.streams.length<1||"probator"==e.streams[0].id||("video"==e.track.kind&&(this.videoTrack=e.track),"audio"==e.track.kind&&(this.audioTrack=e.track),this.onTrack(e))}handleIceCandidate(e){this.onPeerIceCandidate(e)}handleDataChannel(e){this.onDataChannel(e)}onTrack(e){}onIceConnectionStateChange(e){}onPeerIceCandidate(e){}onDataChannel(e){}fuzzyIntersectUEAndBrowserCodecs(e){const t=new Array,n=this.parseAvailableCodecs(e),s=this.config.getSettingOption(r.mY.PreferredCodec).options;for(const e of n)if(s.includes(e))t.push(e);else{const n=e.split(" ")[0];for(const e of s)if(e.includes(n)){t.push(e);break}}return t}setupTransceiversAsync(e,t){return c(this,void 0,void 0,function*(){var n,s,r,i,o,a,l,d;let c=!1;for(const e of null!==(s=null===(n=this.peerConnection)||void 0===n?void 0:n.getTransceivers())&&void 0!==s?s:[])if(e&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind){c=!0;break}if(t?yield this.setupVideoSender(c):c||null===(r=this.peerConnection)||void 0===r||r.addTransceiver("video",{direction:"recvonly"}),RTCRtpReceiver.getCapabilities&&""!=this.preferredCodec)for(const e of null!==(o=null===(i=this.peerConnection)||void 0===i?void 0:i.getTransceivers())&&void 0!==o?o:[])if(e&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind&&e.setCodecPreferences){const t=this.preferredCodec.split(" "),n={mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""},s=[n];RTCRtpReceiver.getCapabilities("video").codecs.forEach(e=>{(e.mimeType!=n.mimeType||(null==e?void 0:e.sdpFmtpLine)!=(null==n?void 0:n.sdpFmtpLine))&&s.push(e)});for(const e of s)void 0!==(null==e?void 0:e.sdpFmtpLine)&&""!==e.sdpFmtpLine||delete e.sdpFmtpLine;e.setCodecPreferences(s)}let h=!1;for(const e of null!==(l=null===(a=this.peerConnection)||void 0===a?void 0:a.getTransceivers())&&void 0!==l?l:[])if(e&&e.receiver&&e.receiver.track&&"audio"===e.receiver.track.kind){h=!0;break}e?yield this.setupAudioSender(h):h||null===(d=this.peerConnection)||void 0===d||d.addTransceiver("audio",{direction:"recvonly"})})}setupVideoSender(e){return c(this,void 0,void 0,function*(){var t,n,s,r;const i=yield navigator.mediaDevices.getUserMedia({video:!0});if(i)if(e){for(const e of null!==(n=null===(t=this.peerConnection)||void 0===t?void 0:t.getTransceivers())&&void 0!==n?n:[])if(a.V.canTransceiverReceiveVideo(e))for(const t of i.getTracks())t.kind&&"video"==t.kind&&(e.sender.replaceTrack(t),e.direction="sendrecv")}else for(const e of i.getTracks())e.kind&&"video"==e.kind&&(null===(s=this.peerConnection)||void 0===s||s.addTransceiver(e,{direction:"sendrecv"}));else e||null===(r=this.peerConnection)||void 0===r||r.addTransceiver("video",{direction:"recvonly"})})}setupAudioSender(e){return c(this,void 0,void 0,function*(){var t,n,s,r;const i=yield navigator.mediaDevices.getUserMedia({video:!1,audio:{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,sampleSize:16,volume:1}});if(i)if(e){for(const e of null!==(n=null===(t=this.peerConnection)||void 0===t?void 0:t.getTransceivers())&&void 0!==n?n:[])if(a.V.canTransceiverReceiveAudio(e))for(const t of i.getTracks())t.kind&&"audio"==t.kind&&(e.sender.replaceTrack(t),e.direction="sendrecv")}else for(const e of i.getTracks())e.kind&&"audio"==e.kind&&(null===(s=this.peerConnection)||void 0===s||s.addTransceiver(e,{direction:"sendrecv"}));else e||null===(r=this.peerConnection)||void 0===r||r.addTransceiver("audio",{direction:"recvonly"})})}onVideoStats(e){}onLatencyCalculated(e){}onSendWebRTCOffer(e){}onSetRemoteDescription(e){}onSetLocalDescription(e){}showTextOverlayConnecting(){}showTextOverlaySetupFailure(){}parseAvailableCodecs(e){if(!RTCRtpReceiver.getCapabilities)return["Only available on Chrome"];const t=[],n=(0,o.splitSections)(e.sdp);return n.shift(),n.forEach(e=>{const{codecs:n}=(0,o.parseRtpParameters)(e),s=/(VP\d|H26\d|AV1).*/;n.forEach(e=>{const n=e.name+" "+Object.keys(e.parameters||{}).map(t=>t+"="+e.parameters[t]).join(";");if(null!==s.exec(n)){"VP9"==e.name&&(e.parameters={"profile-id":"0"});const n=e.name+" "+Object.keys(e.parameters||{}).map(t=>t+"="+e.parameters[t]).join(";");t.push(n)}})}),t}}},5016(e,t,n){n.d(t,{Y:()=>s});class s{}},156(e,t,n){n.d(t,{I:()=>s});class s{}},9307(e,t,n){n.d(t,{z:()=>u});var s=n(223),r=n(9139),i=n(948),o=n(6077),a=n(9689),l=n(474),d=n(9355),c=n(3507),h=n(9629);class u{constructor(e,t){this.allowConsoleCommands=!1,this.config=e,(null==t?void 0:t.videoElementParent)&&(this._videoElementParent=t.videoElementParent),this._eventEmitter=new o.R5,this.configureSettings(),this.setWebRtcPlayerController(new r.n(this.config,this)),this._webXrController=new a.R(this._webRtcController),this._setupWebRtcTCPRelayDetection=this._setupWebRtcTCPRelayDetection.bind(this),this._eventEmitter.addEventListener("webRtcConnected",e=>{this._eventEmitter.addEventListener("statsReceived",this._setupWebRtcTCPRelayDetection)})}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(s.iI.IsQualityController,e=>{!0!==e||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()}),this.config._addOnSettingChangedListener(s.iI.AFKDetection,e=>{this._webRtcController.setAfkEnabled(e)}),this.config._addOnSettingChangedListener(s.iI.MatchViewportResolution,()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()}),this.config._addOnSettingChangedListener(s.iI.HoveringMouseMode,e=>{this.config.setFlagLabel(s.iI.HoveringMouseMode,`Control Scheme: ${e?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(s.iI.MouseInput))}),this.config._addOnSettingChangedListener(s.iI.KeyboardInput,e=>{this._webRtcController.setKeyboardInputEnabled(e)}),this.config._addOnSettingChangedListener(s.iI.MouseInput,e=>{this._webRtcController.setMouseInputEnabled(e)}),this.config._addOnSettingChangedListener(s.iI.FakeMouseWithTouches,e=>{this._webRtcController.setTouchInputEnabled(this.config.isFlagEnabled(s.iI.TouchInput))}),this.config._addOnSettingChangedListener(s.iI.TouchInput,e=>{this._webRtcController.setTouchInputEnabled(e)}),this.config._addOnSettingChangedListener(s.iI.GamepadInput,e=>{this._webRtcController.setGamePadInputEnabled(e)}),this.config._addOnNumericSettingChangedListener(s.k$.MinQP,e=>{i.Vy.Info("-------- Sending MinQP --------"),this._webRtcController.sendEncoderMinQP(e),i.Vy.Info("-------------------------------------------");const t=Math.trunc(100*(1-e/51));this.config.setNumericSetting(s.k$.CompatQualityMax,t)}),this.config._addOnNumericSettingChangedListener(s.k$.MaxQP,e=>{i.Vy.Info("-------- Sending MaxQP --------"),this._webRtcController.sendEncoderMaxQP(e),i.Vy.Info("-------------------------------------------");const t=Math.trunc(100*(1-e/51));this.config.setNumericSetting(s.k$.CompatQualityMin,t)}),this.config._addOnNumericSettingChangedListener(s.k$.MinQuality,e=>{i.Vy.Info("-------- Sending MinQuality --------"),this._webRtcController.sendEncoderMinQuality(e),i.Vy.Info("-------------------------------------------"),this.config.setNumericSetting(s.k$.CompatQualityMin,e)}),this.config._addOnNumericSettingChangedListener(s.k$.MaxQuality,e=>{i.Vy.Info("-------- Sending MaxQuality --------"),this._webRtcController.sendEncoderMaxQuality(e),i.Vy.Info("-------------------------------------------"),this.config.setNumericSetting(s.k$.CompatQualityMax,e)}),this.config._addOnNumericSettingChangedListener(s.k$.CompatQualityMin,e=>{e=51-e/100*51,i.Vy.Info("-------- Sending MinQP from quality value --------"),this._webRtcController.sendEncoderMaxQP(e),i.Vy.Info("-------------------------------------------")}),this.config._addOnNumericSettingChangedListener(s.k$.CompatQualityMax,e=>{e=51-e/100*51,i.Vy.Info("-------- Sending MaxQP from quality value --------"),this._webRtcController.sendEncoderMinQP(e),i.Vy.Info("-------------------------------------------")}),this.config._addOnNumericSettingChangedListener(s.k$.WebRTCMinBitrate,e=>{i.Vy.Info("-------- Sending web rtc settings --------"),this._webRtcController.sendWebRTCMinBitrate(1e3*e),i.Vy.Info("-------------------------------------------")}),this.config._addOnNumericSettingChangedListener(s.k$.WebRTCMaxBitrate,e=>{i.Vy.Info("-------- Sending web rtc settings --------"),this._webRtcController.sendWebRTCMaxBitrate(1e3*e),i.Vy.Info("-------------------------------------------")}),this.config._addOnNumericSettingChangedListener(s.k$.WebRTCFPS,e=>{i.Vy.Info("-------- Sending web rtc settings --------"),this._webRtcController.sendWebRTCFps(e),i.Vy.Info("-------------------------------------------")}),this.config._addOnOptionSettingChangedListener(s.mY.PreferredCodec,e=>{this._webRtcController&&this._webRtcController.setPreferredCodec(e)}),this.config._registerOnChangeEvents(this._eventEmitter)}_onInputControlOwnership(e){this._inputController=e}setWebRtcPlayerController(e){this._webRtcController=e,this._webRtcController.setPreferredCodec(this.config.getSettingOption(s.mY.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new o.y6),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new o.oK),this._webRtcController.tryReconnect("Reconnecting...")}disconnect(){this._eventEmitter.dispatchEvent(new o.iu),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){this.config.isFlagEnabled(s.iI.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}unmuteMicrophone(e=!1){if(!this.config.isFlagEnabled("UseMic"))return e?(this.config.setFlagEnabled("UseMic",!0),void this.reconnect()):void i.Vy.Warning("Trying to unmute mic, but PixelStreaming was initialized with no microphone track. Call with forceEnable == true to re-connect with a mic track.");this.setMicrophoneMuted(!1)}muteMicrophone(){this.config.isFlagEnabled("UseMic")?this.setMicrophoneMuted(!0):i.Vy.Info("Trying to mute mic, but PixelStreaming has no microphone track, so sending sound is already disabled.")}setMicrophoneMuted(e){var t,n,s,r;for(const i of null!==(r=null===(s=null===(n=null===(t=this._webRtcController)||void 0===t?void 0:t.peerConnectionController)||void 0===n?void 0:n.peerConnection)||void 0===s?void 0:s.getTransceivers())&&void 0!==r?r:[])c.V.canTransceiverSendAudio(i)&&(i.sender.track.enabled=!e)}unmuteCamera(e=!1){if(!this.config.isFlagEnabled("UseCamera"))return e?(this.config.setFlagEnabled("UseCamera",!0),void this.reconnect()):void i.Vy.Warning("Trying to unmute video, but PixelStreaming was initialized with no video track. Call with forceEnable == true to re-connect with a video track.");this.setCameraMuted(!1)}muteCamera(){this.config.isFlagEnabled("UseCamera")?this.setCameraMuted(!0):i.Vy.Info("Trying to mute camera, but PixelStreaming has no video track, so sending video is already disabled.")}setCameraMuted(e){var t,n,s,r;for(const i of null!==(r=null===(s=null===(n=null===(t=this._webRtcController)||void 0===t?void 0:t.peerConnectionController)||void 0===n?void 0:n.peerConnection)||void 0===s?void 0:s.getTransceivers())&&void 0!==r?r:[])c.V.canTransceiverSendVideo(i)&&(i.sender.track.enabled=!e)}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new o.nV)}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new o.xV)}_onWebRtcSdpOffer(e){this._eventEmitter.dispatchEvent(new o.PC({sdp:e}))}_onWebRtcSdpAnswer(e){this._eventEmitter.dispatchEvent(new o.zx({sdp:e}))}_onLatencyCalculated(e){this._eventEmitter.dispatchEvent(new o.L0({latencyInfo:e}))}_onStreamLoading(){this._eventEmitter.dispatchEvent(new o.Bg)}_onDisconnect(e,t){this._eventEmitter.dispatchEvent(new o.Nu({eventString:e,allowClickToReconnect:t}))}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new o.Ys)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new o.d4)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new o.tv)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new o.Qy),this._videoStartTime=Date.now()}_onLatencyTestResult(e){this._eventEmitter.dispatchEvent(new o.Cc({latencyTimings:e}))}_onDataChannelLatencyTestResponse(e){this._eventEmitter.dispatchEvent(new o.Fh({response:e}))}_onVideoStats(e){this._videoStartTime&&void 0!==this._videoStartTime||(this._videoStartTime=Date.now()),e.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new o.d_({aggregatedStats:e}))}_onVideoEncoderAvgQP(e){this._eventEmitter.dispatchEvent(new o.x1({avgQP:e}))}_onInitialSettings(e){var t;this._eventEmitter.dispatchEvent(new o.EG({settings:e})),e.PixelStreamingSettings&&(this.allowConsoleCommands=null!==(t=e.PixelStreamingSettings.AllowPixelStreamingCommands)&&void 0!==t&&t,!1===this.allowConsoleCommands&&i.Vy.Info("-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const n=this.config.useUrlParams,r=new h.Z(window.location.search);i.Vy.Info(`using URL parameters ${n}`),e.EncoderSettings&&(e.EncoderSettings.MinQP&&(this.config.setNumericSetting(s.k$.MinQP,n&&r.has(s.k$.MinQP)?Number.parseFloat(r.get(s.k$.MinQP)):e.EncoderSettings.MinQP||0),this.config.setNumericSetting(s.k$.MaxQP,n&&r.has(s.k$.MaxQP)?Number.parseFloat(r.get(s.k$.MaxQP)):e.EncoderSettings.MaxQP||51)),e.EncoderSettings.MinQuality&&(this.config.setNumericSetting(s.k$.MinQuality,n&&r.has(s.k$.MinQuality)?Number.parseFloat(r.get(s.k$.MinQuality)):e.EncoderSettings.MinQuality||0),this.config.setNumericSetting(s.k$.MaxQuality,n&&r.has(s.k$.MaxQuality)?Number.parseFloat(r.get(s.k$.MaxQuality)):e.EncoderSettings.MaxQuality||100)),n&&(r.has(s.k$.CompatQualityMin)&&this.config.setNumericSetting(s.k$.CompatQualityMin,Number.parseFloat(r.get(s.k$.CompatQualityMin))),r.has(s.k$.CompatQualityMax)&&this.config.setNumericSetting(s.k$.CompatQualityMax,Number.parseFloat(r.get(s.k$.CompatQualityMax))))),e.WebRTCSettings&&(this.config.setNumericSetting(s.k$.WebRTCMinBitrate,n&&r.has(s.k$.WebRTCMinBitrate)?Number.parseFloat(r.get(s.k$.WebRTCMinBitrate)):e.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(s.k$.WebRTCMaxBitrate,n&&r.has(s.k$.WebRTCMaxBitrate)?Number.parseFloat(r.get(s.k$.WebRTCMaxBitrate)):e.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(s.k$.WebRTCFPS,n&&r.has(s.k$.WebRTCFPS)?Number.parseFloat(r.get(s.k$.WebRTCFPS)):e.WebRTCSettings.FPS))}_onQualityControlOwnership(e){this.config.setFlagEnabled(s.iI.IsQualityController,e)}_onPlayerCount(e){this._eventEmitter.dispatchEvent(new o.d2({count:e}))}_onSubscribeFailed(e){this._eventEmitter.dispatchEvent(new o._h({message:e}))}_setupWebRtcTCPRelayDetection(e){const t=e.data.aggregatedStats.getActiveCandidatePair();if(null!=t){const n=e.data.aggregatedStats.localCandidates.find(e=>e.id==t.localCandidateId,null);null!=n&&"relay"==n.candidateType&&"tcp"==n.relayProtocol&&this._eventEmitter.dispatchEvent(new o.KB),this._eventEmitter.removeEventListener("statsReceived",this._setupWebRtcTCPRelayDetection)}}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestDataChannelLatencyTest(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._dataChannelLatencyTestController||(this._dataChannelLatencyTestController=new d.I(this._webRtcController.sendDataChannelLatencyTest.bind(this._webRtcController),e=>{this._eventEmitter.dispatchEvent(new o.L7({result:e}))}),this.addEventListener("dataChannelLatencyTestResponse",({data:{response:e}})=>{this._dataChannelLatencyTestController.receive(e)})),this._dataChannelLatencyTestController.start(e))}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(e),!0)}emitCommand(e){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in e||(this._webRtcController.emitCommand(e),0))}emitConsoleCommand(e){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(e),0))}sendTextboxEntry(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendTextboxEntry(e),!0)}addResponseEventListener(e,t){this._webRtcController.responseController.addResponseEventListener(e,t)}removeResponseEventListener(e){this._webRtcController.responseController.removeResponseEventListener(e)}dispatchEvent(e){return this._eventEmitter.dispatchEvent(e)}addEventListener(e,t){this._eventEmitter.addEventListener(e,t)}removeEventListener(e,t){this._eventEmitter.removeEventListener(e,t)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(e){this._webRtcController.signallingUrlBuilder=e}get webRtcController(){return this._webRtcController}get signallingProtocol(){return this._webRtcController.protocol}get webXrController(){return this._webXrController}registerMessageHandler(e,t,n){t!==l.Tt.FromStreamer||void 0!==n?t===l.Tt.ToStreamer&&void 0===n?this._webRtcController.streamMessageController.registerMessageHandler(t,e,t=>this._webRtcController.sendMessageController.sendMessageToStreamer(e,t)):this._webRtcController.streamMessageController.registerMessageHandler(t,e,e=>n(e)):i.Vy.Warning(`Unable to register an undefined handler for ${e}`)}get toStreamerHandlers(){return this._webRtcController.streamMessageController.toStreamerHandlers}isReconnecting(){return this._webRtcController.isReconnecting}}},1054(e,t,n){n.d(t,{G:()=>r});var s=n(948);class r{constructor(){this.responseEventListeners=new Map}addResponseEventListener(e,t){this.responseEventListeners.set(e,t)}removeResponseEventListener(e){this.responseEventListeners.delete(e)}onResponse(e){s.Vy.Info("DataChannelReceiveMessageType.Response");const t=new TextDecoder("utf-16").decode(e.slice(1));s.Vy.Info(t),this.responseEventListeners.forEach(e=>{e(t)})}}},3447(e,t,n){n.d(t,{g:()=>r});var s=n(948);class r{constructor(e,t){this.dataChannelSender=e,this.toStreamerMessagesMapProvider=t}sendMessageToStreamer(e,t){void 0===t&&(t=[]);const n=this.toStreamerMessagesMapProvider.toStreamerMessages.get(e);if(void 0===n)return void s.Vy.Error(`Attempted to send a message to the streamer with message type: ${e}, but the frontend hasn't been configured to send such a message. Check you've added the message type in your cpp`);if(n.structure&&t&&n.structure.length!==t.length)return void s.Vy.Error(`Provided message data doesn't match expected layout. Expected [ ${n.structure.map(e=>{switch(e){case"uint8":case"uint16":case"int16":case"float":case"double":default:return"number";case"string":return"string"}}).toString()} ] but received [ ${t.map(e=>typeof e).toString()} ]`);let r=0;const i=new TextEncoder;t.forEach((e,t)=>{switch(n.structure[t]){case"uint8":r+=1;break;case"uint16":case"int16":r+=2;break;case"float":r+=4;break;case"double":r+=8;break;case"string":r+=2,r+=2*i.encode(e).length}});const o=new DataView(new ArrayBuffer(r+1));o.setUint8(0,n.id);let a=1;t.forEach((e,t)=>{switch(n.structure[t]){case"uint8":o.setUint8(a,e),a+=1;break;case"uint16":o.setUint16(a,e,!0),a+=2;break;case"int16":o.setInt16(a,e,!0),a+=2;break;case"float":o.setFloat32(a,e,!0),a+=4;break;case"double":o.setFloat64(a,e,!0),a+=8;break;case"string":o.setUint16(a,e.length,!0),a+=2;for(let t=0;t<e.length;t++)o.setUint16(a,e.charCodeAt(t),!0),a+=2}}),this.dataChannelSender.canSend()?this.dataChannelSender.sendData(o.buffer):s.Vy.Info(`Data channel cannot send yet, skipping sending message: ${e} - ${new Uint8Array(o.buffer)}`)}}},474(e,t,n){n.d(t,{QR:()=>i,Tt:()=>s});var s,r=n(948);class i{constructor(){this.toStreamerHandlers=new Map,this.fromStreamerHandlers=new Map,this.toStreamerMessages=new Map,this.fromStreamerMessages=new Map}populateDefaultProtocol(){this.toStreamerMessages.set("IFrameRequest",{id:0,structure:[]}),this.toStreamerMessages.set("RequestQualityControl",{id:1,structure:[]}),this.toStreamerMessages.set("FpsRequest",{id:2,structure:[]}),this.toStreamerMessages.set("AverageBitrateRequest",{id:3,structure:[]}),this.toStreamerMessages.set("StartStreaming",{id:4,structure:[]}),this.toStreamerMessages.set("StopStreaming",{id:5,structure:[]}),this.toStreamerMessages.set("LatencyTest",{id:6,structure:["string"]}),this.toStreamerMessages.set("RequestInitialSettings",{id:7,structure:[]}),this.toStreamerMessages.set("TestEcho",{id:8,structure:[]}),this.toStreamerMessages.set("DataChannelLatencyTest",{id:9,structure:[]}),this.toStreamerMessages.set("UIInteraction",{id:50,structure:["string"]}),this.toStreamerMessages.set("Command",{id:51,structure:["string"]}),this.toStreamerMessages.set("TextboxEntry",{id:52,structure:["string"]}),this.toStreamerMessages.set("KeyDown",{id:60,structure:["uint8","uint8"]}),this.toStreamerMessages.set("KeyUp",{id:61,structure:["uint8"]}),this.toStreamerMessages.set("KeyPress",{id:62,structure:["uint16"]}),this.toStreamerMessages.set("MouseEnter",{id:70,structure:[]}),this.toStreamerMessages.set("MouseLeave",{id:71,structure:[]}),this.toStreamerMessages.set("MouseDown",{id:72,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("MouseUp",{id:73,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("MouseMove",{id:74,structure:["uint16","uint16","int16","int16"]}),this.toStreamerMessages.set("MouseWheel",{id:75,structure:["int16","uint16","uint16"]}),this.toStreamerMessages.set("MouseDouble",{id:76,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.set("TouchStart",{id:80,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("TouchEnd",{id:81,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("TouchMove",{id:82,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadConnected",{id:93,structure:[]}),this.toStreamerMessages.set("GamepadButtonPressed",{id:90,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadButtonReleased",{id:91,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.set("GamepadAnalog",{id:92,structure:["uint8","uint8","double"]}),this.toStreamerMessages.set("GamepadDisconnected",{id:94,structure:["uint8"]}),this.fromStreamerMessages.set(0,"QualityControlOwnership"),this.fromStreamerMessages.set(1,"Response"),this.fromStreamerMessages.set(2,"Command"),this.fromStreamerMessages.set(3,"FreezeFrame"),this.fromStreamerMessages.set(4,"UnfreezeFrame"),this.fromStreamerMessages.set(5,"VideoEncoderAvgQP"),this.fromStreamerMessages.set(6,"LatencyTest"),this.fromStreamerMessages.set(7,"InitialSettings"),this.fromStreamerMessages.set(8,"FileExtension"),this.fromStreamerMessages.set(9,"FileMimeType"),this.fromStreamerMessages.set(10,"FileContents"),this.fromStreamerMessages.set(11,"TestEcho"),this.fromStreamerMessages.set(12,"InputControlOwnership"),this.fromStreamerMessages.set(13,"GamepadResponse"),this.fromStreamerMessages.set(14,"DataChannelLatencyTest"),this.fromStreamerMessages.set(255,"Protocol")}registerMessageHandler(e,t,n){switch(e){case s.ToStreamer:this.toStreamerHandlers.set(t,n);break;case s.FromStreamer:this.fromStreamerHandlers.set(t,n);break;default:r.Vy.Info(`Unknown message direction ${e}`)}}}!function(e){e[e.ToStreamer=0]="ToStreamer",e[e.FromStreamer=1]="FromStreamer"}(s||(s={}))},6403(e,t,n){n.d(t,{v:()=>s});class s{constructor(e){this.sendMessageController=e}SendRequestQualityControl(){this.sendMessageController.sendMessageToStreamer("RequestQualityControl")}SendMaxFpsRequest(){this.sendMessageController.sendMessageToStreamer("FpsRequest")}SendAverageBitrateRequest(){this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest")}SendStartStreaming(){this.sendMessageController.sendMessageToStreamer("StartStreaming")}SendStopStreaming(){this.sendMessageController.sendMessageToStreamer("StopStreaming")}SendRequestInitialSettings(){this.sendMessageController.sendMessageToStreamer("RequestInitialSettings")}}},114(e,t,n){n.d(t,{C:()=>r});var s=n(948);class r{static getSupportedVideoCodecs(){const e=[];if(!RTCRtpReceiver.getCapabilities)return s.Vy.Warning("RTCRtpReceiver.getCapabilities API is not available in your browser, defaulting to guess that we support H.264."),e.push("H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"),e;const t=/(VP\d|H26\d|AV1).*/,n=RTCRtpReceiver.getCapabilities("video");return n?(n.codecs.forEach(n=>{const s=n.mimeType.split("/")[1]+" "+(n.sdpFmtpLine||"");null!==t.exec(s)&&e.push(s)}),e):(e.push("H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"),e)}}},6077(e,t,n){n.d(t,{Bg:()=>w,CE:()=>y,Cc:()=>O,EG:()=>U,EQ:()=>v,FJ:()=>I,Fh:()=>N,Gi:()=>V,KB:()=>$,Kr:()=>o,L0:()=>F,L7:()=>D,Lz:()=>M,Nu:()=>p,PC:()=>c,Qy:()=>b,R5:()=>H,RW:()=>R,S_:()=>r,Si:()=>B,Ys:()=>u,_h:()=>A,d2:()=>_,d4:()=>m,d_:()=>L,ie:()=>x,iu:()=>C,jG:()=>P,jr:()=>i,mC:()=>s,nV:()=>h,oK:()=>T,qM:()=>W,tv:()=>g,vL:()=>E,vx:()=>k,x1:()=>a,xV:()=>l,y6:()=>S,ys:()=>f,zx:()=>d});class s extends Event{constructor(e){super("afkWarningActivate"),this.data=e}}class r extends Event{constructor(e){super("afkWarningUpdate"),this.data=e}}class i extends Event{constructor(){super("afkWarningDeactivate")}}class o extends Event{constructor(){super("afkTimedOut")}}class a extends Event{constructor(e){super("videoEncoderAvgQP"),this.data=e}}class l extends Event{constructor(){super("webRtcSdp")}}class d extends Event{constructor(e){super("webRtcSdpAnswer"),this.data=e}}class c extends Event{constructor(e){super("webRtcSdpOffer"),this.data=e}}class h extends Event{constructor(){super("webRtcAutoConnect")}}class u extends Event{constructor(){super("webRtcConnecting")}}class m extends Event{constructor(){super("webRtcConnected")}}class g extends Event{constructor(){super("webRtcFailed")}}class p extends Event{constructor(e){super("webRtcDisconnected"),this.data=e}}class f extends Event{constructor(e){super("dataChannelOpen"),this.data=e}}class y extends Event{constructor(e){super("dataChannelClose"),this.data=e}}class v extends Event{constructor(e){super("dataChannelError"),this.data=e}}class b extends Event{constructor(){super("videoInitialized")}}class w extends Event{constructor(){super("streamLoading")}}class S extends Event{constructor(){super("streamConnect")}}class C extends Event{constructor(){super("streamDisconnect")}}class T extends Event{constructor(){super("streamReconnect")}}class E extends Event{constructor(e){super("playStreamError"),this.data=e}}class M extends Event{constructor(){super("playStream")}}class I extends Event{constructor(e){super("playStreamRejected"),this.data=e}}class k extends Event{constructor(e){super("loadFreezeFrame"),this.data=e}}class R extends Event{constructor(){super("hideFreezeFrame")}}class L extends Event{constructor(e){super("statsReceived"),this.data=e}}class P extends Event{constructor(e){super("streamerListMessage"),this.data=e}}class x extends Event{constructor(e){super("StreamerIDChangedMessage"),this.data=e}}class O extends Event{constructor(e){super("latencyTestResult"),this.data=e}}class F extends Event{constructor(e){super("latencyCalculated"),this.data=e}}class V extends Event{constructor(e){super("showOnScreenKeyboard"),this.data=e}}class N extends Event{constructor(e){super("dataChannelLatencyTestResponse"),this.data=e}}class D extends Event{constructor(e){super("dataChannelLatencyTestResult"),this.data=e}}class A extends Event{constructor(e){super("subscribeFailed"),this.data=e}}class U extends Event{constructor(e){super("initialSettings"),this.data=e}}class B extends Event{constructor(e){super("settingsChanged"),this.data=e}}Event,Event;class W extends Event{constructor(e){super("xrFrame"),this.data=e}}class _ extends Event{constructor(e){super("playerCount"),this.data=e}}class $ extends Event{constructor(){super("webRtcTCPRelayDetected")}}class H extends EventTarget{dispatchEvent(e){return super.dispatchEvent(e)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}}},3281(e,t,n){n.d(t,{X:()=>i,f:()=>r});var s=n(948);class r{static setExtensionFromBytes(e,t){t.receiving||(t.mimetype="",t.extension="",t.receiving=!0,t.valid=!1,t.chunks=0,t.data=[],t.timestampStart=(new Date).getTime(),s.Vy.Info("Received first chunk of file"));const n=new TextDecoder("utf-16").decode(e.slice(1));s.Vy.Info(n),t.extension=n}static setMimeTypeFromBytes(e,t){t.receiving||(t.mimetype="",t.extension="",t.receiving=!0,t.valid=!1,t.chunks=0,t.data=[],t.timestampStart=(new Date).getTime(),s.Vy.Info("Received first chunk of file"));const n=new TextDecoder("utf-16").decode(e.slice(1));s.Vy.Info(n),t.mimetype=n}static setContentsFromBytes(e,t){if(!t.receiving)return;t.chunks=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379);const n=e.slice(5);if(t.data.push(n),s.Vy.Info(`Received file chunk: ${t.data.length}/${t.chunks}`),t.data.length===t.chunks){t.receiving=!1,t.valid=!0,s.Vy.Info("Received complete file");const e=(new Date).getTime()-t.timestampStart,n=Math.round(16384*t.chunks/e);s.Vy.Info(`Average transfer bitrate: ${n}kb/s over ${e/1e3} seconds`)}else t.data.length>t.chunks&&(t.receiving=!1,s.Vy.Error(`Received bigger file than advertised: ${t.data.length}/${t.chunks}`))}}class i{constructor(){this.mimetype="",this.extension="",this.receiving=!1,this.chunks=0,this.data=[],this.valid=!1}}},9629(e,t,n){n.d(t,{Z:()=>s});class s{constructor(e){this._urlParams={};const t=new URLSearchParams(e);for(const[e,n]of t)this._urlParams[e.toLowerCase()]=n}has(e){return e.toLowerCase()in this._urlParams}get(e){return this.has(e)?this._urlParams[e.toLowerCase()]:null}}},2139(e,t,n){n.d(t,{g:()=>s});class s{reconfigure(e,t){const n=e.height/e.width,s=t.height/t.width;this.playerIsLarger=n>s,this.playerSize=e,this.ratio=this.playerIsLarger?n/s:s/n}translateUnsigned(e,t){const n=this.playerIsLarger?e/this.playerSize.width:this.ratio*(e/this.playerSize.width-.5)+.5,s=this.playerIsLarger?this.ratio*(t/this.playerSize.height-.5)+.5:t/this.playerSize.height;return n<0||n>1||s<0||s>1?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*n,y:65536*s}}translateSigned(e,t){return{x:32767*(this.playerIsLarger?e/(.5*this.playerSize.width):this.ratio*e/(.5*this.playerSize.width)),y:32767*(this.playerIsLarger?this.ratio*t/(.5*this.playerSize.height):t/(.5*this.playerSize.height))}}untranslateUnsigned(e,t){const n=this.playerIsLarger?e/65536:(e/65536-.5)/this.ratio+.5,s=this.playerIsLarger?(t/65536-.5)/this.ratio+.5:t/65536;return{x:n*this.playerSize.width,y:s*this.playerSize.height}}}},3507(e,t,n){n.d(t,{V:()=>s});class s{static isVideoTransceiver(e){return this.canTransceiverReceiveVideo(e)||this.canTransceiverSendVideo(e)}static canTransceiverReceiveVideo(e){return!!e&&("sendrecv"===e.direction||"recvonly"===e.direction)&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind}static canTransceiverSendVideo(e){return!!e&&("sendrecv"===e.direction||"sendonly"===e.direction)&&e.sender&&e.sender.track&&"video"===e.sender.track.kind}static isAudioTransceiver(e){return this.canTransceiverReceiveAudio(e)||this.canTransceiverSendAudio(e)}static canTransceiverReceiveAudio(e){return!!e&&("sendrecv"===e.direction||"recvonly"===e.direction)&&e.receiver&&e.receiver.track&&"audio"===e.receiver.track.kind}static canTransceiverSendAudio(e){return!!e&&("sendrecv"===e.direction||"sendonly"===e.direction)&&e.sender&&e.sender.track&&"audio"===e.sender.track.kind}}},9059(e,t,n){n.d(t,{l:()=>r});var s=n(948);class r{constructor(e){this.videoElementProvider=e,this.audioElement=document.createElement("Audio"),this.videoElementProvider.setAudioElement(this.audioElement)}handleOnTrack(e){if(s.Vy.Info("handleOnTrack "+JSON.stringify(e.streams)),e.streams.length<1||"probator"==e.streams[0].id)return;const t=this.videoElementProvider.getVideoElement();if(e.track&&s.Vy.Info("Got track - "+e.track.kind+" id="+e.track.id+" readyState="+e.track.readyState),"audio"!=e.track.kind)return"video"==e.track.kind&&t.srcObject!==e.streams[0]?(t.srcObject=e.streams[0],void s.Vy.Info("Set video source from video track ontrack.")):void 0;this.CreateAudioTrack(e.streams[0])}CreateAudioTrack(e){const t=this.videoElementProvider.getVideoElement();t.srcObject!=e&&t.srcObject&&t.srcObject!==e&&(this.audioElement.srcObject=e,s.Vy.Info("Created new audio element to play separate audio stream."))}}},6865(e,t,n){n.d(t,{L:()=>i});var s=n(223),r=n(948);class i{constructor(e,t){this.lastTimeResized=(new Date).getTime(),this.videoElement=document.createElement("video"),this.config=t,this.videoElement.id="streamingVideo",this.videoElement.disablePictureInPicture=!0,this.videoElement.playsInline=!0,this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.pointerEvents="all",e.appendChild(this.videoElement),this.onResizePlayerCallback=()=>{console.log("Resolution changed, restyling player, did you forget to override this function?")},this.onMatchViewportResolutionCallback=()=>{console.log("Resolution changed and match viewport resolution is turned on, did you forget to override this function?")},this.videoElement.onclick=()=>{null!=this.audioElement&&this.audioElement.paused&&this.audioElement.play(),this.videoElement.paused&&this.videoElement.play()},this.videoElement.onloadedmetadata=()=>{this.onVideoInitialized()},window.addEventListener("resize",()=>this.resizePlayerStyle(),!0),window.addEventListener("orientationchange",()=>this.onOrientationChange())}destroy(){this.videoElement.src="",this.videoElement.srcObject=null,this.videoElement.remove(),this.audioElement&&(this.audioElement.src="",this.audioElement.srcObject=null,this.audioElement.remove())}setAudioElement(e){this.audioElement=e}play(){return this.videoElement.muted=this.config.isFlagEnabled(s.iI.StartVideoMuted),this.videoElement.autoplay=this.config.isFlagEnabled(s.iI.AutoPlayVideo),this.videoElement.play()}isPaused(){return this.videoElement.paused}isVideoReady(){return void 0!==this.videoElement.readyState&&this.videoElement.readyState>0}hasVideoSource(){return void 0!==this.videoElement.srcObject&&null!==this.videoElement.srcObject}getVideoElement(){return this.videoElement}getVideoParentElement(){var e;return null!==(e=this.videoElement.parentElement)&&void 0!==e?e:void 0}setVideoEnabled(e){this.videoElement.srcObject.getTracks().forEach(t=>t.enabled=e)}onVideoInitialized(){}onOrientationChange(){clearTimeout(this.orientationChangeTimeout),this.orientationChangeTimeout=window.setTimeout(()=>{this.resizePlayerStyle()},500)}resizePlayerStyle(){const e=this.getVideoParentElement();e&&(this.updateVideoStreamSize(),e.classList.contains("fixed-size")||this.resizePlayerStyleToFillParentElement(),this.onResizePlayerCallback())}resizePlayerStyleToFillParentElement(){this.getVideoParentElement().setAttribute("style","top: 0px; left: 0px; width: 100%; height: 100%; cursor: default;")}updateVideoStreamSize(){if(this.config.isFlagEnabled(s.iI.MatchViewportResolution))if((new Date).getTime()-this.lastTimeResized>300){const e=this.getVideoParentElement();if(!e)return;this.onMatchViewportResolutionCallback(e.clientWidth,e.clientHeight),this.lastTimeResized=(new Date).getTime()}else r.Vy.Info("Resizing too often - skipping"),clearTimeout(this.resizeTimeoutHandle),this.resizeTimeoutHandle=window.setTimeout(()=>this.updateVideoStreamSize(),100)}}},9139(e,t,n){n.d(t,{n:()=>L});var s=n(948),r=n(7447),i=n(3532),o=n(9027),a=n(9899),l=n(8496),d=n(9059),c=n(2865),h=n(5785),u=n(4045),m=n(1615),g=n(223),p=n(235),f=n(724),y=n(3281),v=n(1104),b=n(6865),w=n(474),S=n(1054),C=n(3447),T=n(6403),E=n(8236),M=n(2139),I=n(6077),k=n(9629),R=n(114);class L{constructor(e,t){this.shouldShowPlayOverlay=!0,this.autoJoinTimer=void 0,this.config=e,this.pixelStreaming=t,this.responseController=new S.G,this.file=new y.X,this.sdpConstraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this.afkController=new h.R(this.config,this.pixelStreaming,this.onAfkTriggered.bind(this)),this.afkController.onAFKTimedOutCallback=()=>{this.closeSignalingServer("You have been disconnected due to inactivity.",!1)},this.freezeFrameController=new c.f(this.pixelStreaming.videoElementParent),this.videoPlayer=new b.L(this.pixelStreaming.videoElementParent,this.config),this.videoPlayer.onVideoInitialized=()=>this.handleVideoInitialized(),this.videoPlayer.onMatchViewportResolutionCallback=(e,t)=>{const n={"Resolution.Width":e,"Resolution.Height":t};this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(n)])},this.videoPlayer.onResizePlayerCallback=()=>{this.setUpMouseAndFreezeFrame()},this.streamController=new d.l(this.videoPlayer),this.coordinateConverter=new M.g,this.sendrecvDataChannelController=new u.a,this.recvDataChannelController=new u.a,this.registerDataChannelEventEmitters(this.sendrecvDataChannelController),this.registerDataChannelEventEmitters(this.recvDataChannelController),this.dataChannelSender=new E.p(this.sendrecvDataChannelController),this.dataChannelSender.resetAfkWarningTimerOnDataSend=()=>this.afkController.resetAfkWarningTimer(),this.streamMessageController=new w.QR,this.transport=new r.T(e.webSocketProtocols),this.protocol=new i.t(this.transport),this.protocol.addListener(o.$W.typeName,e=>this.handleOnConfigMessage(e)),this.protocol.addListener(o.hU.typeName,e=>this.handlePingMessage(e)),this.protocol.addListener(o.q5.typeName,e=>this.handleStreamerListMessage(e)),this.protocol.addListener(o.yB.typeName,e=>this.handleSubscribeFailedMessage(e)),this.protocol.addListener(o.l8.typeName,e=>this.handleStreamerIDChangedMessage(e)),this.protocol.addListener(o.Rd.typeName,e=>{const t=e;this.pixelStreaming._onPlayerCount(t.count)}),this.protocol.addListener(o.ZF.typeName,e=>this.handleWebRtcAnswer(e)),this.protocol.addListener(o.x.typeName,e=>this.handleWebRtcOffer(e)),this.protocol.addListener(o.Rq.typeName,e=>this.handleWebRtcSFUPeerDatachannels(e)),this.protocol.addListener(o.BI.typeName,e=>{const t=e;this.handleIceCandidate(t.candidate)}),this.protocol.transport.addListener("open",()=>{const e=a.o(o.zW);this.protocol.sendMessage(e),this.reconnectAttempt=0,this.isReconnecting=!1}),this.protocol.transport.addListener("error",()=>{s.Vy.Error("Got a transport error.")}),this.protocol.transport.addListener("close",e=>{const t=this.config.getNumericSettingValue(g.k$.MaxReconnectAttempts),n=this.reconnectAttempt<t,s=(this.forceReconnect||this.enableAutoReconnect&&t>0&&n)&&1001!=e.code,r=!s,i=this.disconnectMessage?this.disconnectMessage:e.reason;this.forceReconnect=!1,this.config.getSettingOption(g.mY.PreferredCodec).options=R.C.getSupportedVideoCodecs(),this.pixelStreaming._onDisconnect(i,r),this.afkController.stopAfkWarningTimer(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.setVideoEncoderAvgQP(0),this.setTouchInputEnabled(!1),this.setMouseInputEnabled(!1),this.setKeyboardInputEnabled(!1),this.setGamePadInputEnabled(!1),s&&setTimeout(()=>{this.reconnectAttempt++,this.doReconnect(e.reason)},2e3)}),this.sendMessageController=new C.g(this.dataChannelSender,this.streamMessageController),this.toStreamerMessagesController=new T.v(this.sendMessageController),this.registerMessageHandlers(),this.streamMessageController.populateDefaultProtocol(),this.inputClassesFactory=new v.a(this.streamMessageController,this.videoPlayer,this.coordinateConverter),this.isUsingSFU=!1,this.isUsingSVC=!1,this.isQualityController=!1,this.preferredCodec="",this.enableAutoReconnect=!0,this.forceReconnect=!1,this.reconnectAttempt=0,this.isReconnecting=!1,this.config._addOnOptionSettingChangedListener(g.mY.StreamerId,e=>{if(void 0===e||""===e)return;this.peerConnectionController.peerConnection.close(),this.peerConnectionController.createPeerConnection(this.peerConfig,this.preferredCodec),this.subscribedStream=e;const t=a.o(o.B1,{streamerId:e});this.protocol.sendMessage(t)}),this.config._addOnOptionSettingChangedListener(g.mY.PreferredQuality,e=>{if(void 0===e||""===e)return;let t;if(this.isUsingSVC)t=a.o(o.vq,{spatialLayer:+e[1]-1,temporalLayer:+e[3]-1});else{const n=this.config.getSettingOption(g.mY.PreferredQuality).options.indexOf(e);t=a.o(o.vq,{spatialLayer:n,temporalLayer:0})}this.protocol.sendMessage(t)}),this.setVideoEncoderAvgQP(-1),this.signallingUrlBuilder=()=>this.config.getTextSettingValue(g.gw.SignallingServerUrl)}destroyVideoPlayer(){this.videoPlayer.destroy()}handleOnMessage(e){const t=new Uint8Array(e.data);s.Vy.Info("Message incoming:"+t);const n=this.streamMessageController.fromStreamerMessages.get(t[0]);this.streamMessageController.fromStreamerHandlers.get(n)(e.data)}registerMessageHandlers(){this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"QualityControlOwnership",e=>this.onQualityControlOwnership(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"Response",e=>this.responseController.onResponse(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"Command",e=>{this.onCommand(e)}),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"FreezeFrame",e=>this.onFreezeFrameMessage(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"UnfreezeFrame",()=>this.invalidateFreezeFrameAndEnableVideo()),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"VideoEncoderAvgQP",e=>this.handleVideoEncoderAvgQP(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"LatencyTest",e=>this.handleLatencyTestResult(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"DataChannelLatencyTest",e=>this.handleDataChannelLatencyTestResponse(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"InitialSettings",e=>this.handleInitialSettings(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"FileExtension",e=>this.onFileExtension(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"FileMimeType",e=>this.onFileMimeType(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"FileContents",e=>this.onFileContents(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"TestEcho",()=>{}),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"InputControlOwnership",e=>this.onInputControlOwnership(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"GamepadResponse",e=>this.onGamepadResponse(e)),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"Multiplexed",()=>{}),this.streamMessageController.registerMessageHandler(w.Tt.FromStreamer,"Protocol",e=>this.onProtocolMessage(e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"IFrameRequest",()=>this.sendMessageController.sendMessageToStreamer("IFrameRequest")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"RequestQualityControl",()=>this.sendMessageController.sendMessageToStreamer("RequestQualityControl")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"FpsRequest",()=>this.sendMessageController.sendMessageToStreamer("FpsRequest")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"AverageBitrateRequest",()=>this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"StartStreaming",()=>this.sendMessageController.sendMessageToStreamer("StartStreaming")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"StopStreaming",()=>this.sendMessageController.sendMessageToStreamer("StopStreaming")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"LatencyTest",e=>this.sendMessageController.sendMessageToStreamer("LatencyTest",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"RequestInitialSettings",()=>this.sendMessageController.sendMessageToStreamer("RequestInitialSettings")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"TestEcho",()=>{}),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"UIInteraction",e=>this.sendMessageController.sendMessageToStreamer("UIInteraction",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"Command",e=>this.sendMessageController.sendMessageToStreamer("Command",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"TextboxEntry",e=>this.sendMessageController.sendMessageToStreamer("TextboxEntry",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"KeyDown",e=>this.sendMessageController.sendMessageToStreamer("KeyDown",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"KeyUp",e=>this.sendMessageController.sendMessageToStreamer("KeyUp",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"KeyPress",e=>this.sendMessageController.sendMessageToStreamer("KeyPress",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseEnter",e=>this.sendMessageController.sendMessageToStreamer("MouseEnter",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseLeave",e=>this.sendMessageController.sendMessageToStreamer("MouseLeave",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseDown",e=>this.sendMessageController.sendMessageToStreamer("MouseDown",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseUp",e=>this.sendMessageController.sendMessageToStreamer("MouseUp",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseMove",e=>this.sendMessageController.sendMessageToStreamer("MouseMove",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseWheel",e=>this.sendMessageController.sendMessageToStreamer("MouseWheel",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"MouseDouble",e=>this.sendMessageController.sendMessageToStreamer("MouseDouble",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"TouchStart",e=>this.sendMessageController.sendMessageToStreamer("TouchStart",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"TouchEnd",e=>this.sendMessageController.sendMessageToStreamer("TouchEnd",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"TouchMove",e=>this.sendMessageController.sendMessageToStreamer("TouchMove",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"GamepadConnected",()=>this.sendMessageController.sendMessageToStreamer("GamepadConnected")),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"GamepadButtonPressed",e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonPressed",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"GamepadButtonReleased",e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonReleased",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"GamepadAnalog",e=>this.sendMessageController.sendMessageToStreamer("GamepadAnalog",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"GamepadDisconnected",e=>this.sendMessageController.sendMessageToStreamer("GamepadDisconnected",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XREyeViews",e=>this.sendMessageController.sendMessageToStreamer("XREyeViews",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRHMDTransform",e=>this.sendMessageController.sendMessageToStreamer("XRHMDTransform",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRControllerTransform",e=>this.sendMessageController.sendMessageToStreamer("XRControllerTransform",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRSystem",e=>this.sendMessageController.sendMessageToStreamer("XRSystem",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRButtonTouched",e=>this.sendMessageController.sendMessageToStreamer("XRButtonTouched",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRButtonTouchReleased",e=>this.sendMessageController.sendMessageToStreamer("XRButtonTouchReleased",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRButtonPressed",e=>this.sendMessageController.sendMessageToStreamer("XRButtonPressed",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRButtonReleased",e=>this.sendMessageController.sendMessageToStreamer("XRButtonReleased",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"XRAnalog",e=>this.sendMessageController.sendMessageToStreamer("XRAnalog",e)),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"ChannelRelayStatus",()=>{}),this.streamMessageController.registerMessageHandler(w.Tt.ToStreamer,"Multiplexed",()=>{})}onCommand(e){s.Vy.Info("DataChannelReceiveMessageType.Command");const t=new TextDecoder("utf-16").decode(e.slice(1));s.Vy.Info("Data Channel Command: "+t);const n=JSON.parse(t);"onScreenKeyboard"===n.command&&this.handleOnScreenKeyboardCommand(n)}handleOnScreenKeyboardCommand(e){var t,n,s,r;const i={showOnScreenKeyboard:null===(t=e.showOnScreenKeyboard)||void 0===t||t,x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(s=e.y)&&void 0!==s?s:0,contents:null!==(r=e.contents)&&void 0!==r?r:""};this.pixelStreaming.dispatchEvent(new I.Gi(i))}onProtocolMessage(e){try{const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t);Object.prototype.hasOwnProperty.call(n,"Direction")||s.Vy.Error("Malformed protocol received. Ensure the protocol message contains a direction");const r=n.Direction;delete n.Direction,s.Vy.Info(`Received new ${r==w.Tt.FromStreamer?"FromStreamer":"ToStreamer"} protocol. Updating existing protocol...`),Object.keys(n).forEach(e=>{const t=n[e];switch(r){case w.Tt.ToStreamer:if(!Object.prototype.hasOwnProperty.call(t,"id"))return void s.Vy.Error(`ToStreamer->${e} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(t,null,2)}`);if("UIInteraction"===e||"Command"===e||"LatencyTest"===e)return;this.streamMessageController.toStreamerHandlers.get(e)?this.streamMessageController.toStreamerMessages.set(e,t):s.Vy.Error(`There was no registered handler for "${e}" - try adding one using registerMessageHandler(MessageDirection.ToStreamer, "${e}", myHandler)`);break;case w.Tt.FromStreamer:if(!Object.prototype.hasOwnProperty.call(t,"id"))return void s.Vy.Error(`FromStreamer->${e} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(t,null,2)}`);this.streamMessageController.fromStreamerHandlers.get(e)?this.streamMessageController.fromStreamerMessages.set(t.id,e):s.Vy.Error(`There was no registered handler for "${t}" - try adding one using registerMessageHandler(MessageDirection.FromStreamer, "${e}", myHandler)`);break;default:s.Vy.Error(`Unknown direction: ${r}`)}}),this.toStreamerMessagesController.SendRequestInitialSettings(),this.toStreamerMessagesController.SendRequestQualityControl()}catch(e){s.Vy.Info(e)}}onInputControlOwnership(e){const t=new Uint8Array(e);s.Vy.Info("DataChannelReceiveMessageType.InputControlOwnership");const n=new Boolean(t[1]).valueOf();s.Vy.Info(`Received input controller message - will your input control the stream: ${n}`),this.pixelStreaming._onInputControlOwnership(n)}onGamepadResponse(e){const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t);this.gamePadController.onGamepadResponseReceived(n.controllerId)}onAfkTriggered(){this.afkController.onAfkClick(),this.videoPlayer.isPaused()&&this.videoPlayer.hasVideoSource()&&this.playStream()}setAfkEnabled(e){e?this.onAfkTriggered():this.afkController.stopAfkWarningTimer()}tryReconnect(e){this.forceReconnect=!0,this.doReconnect(e)}doReconnect(e){this.protocol?(this.isReconnecting=!0,this.protocol.isConnected()?(this.forceReconnect||(this.disconnectMessage=`${e} Reconnecting.`),this.closeSignalingServer(e,!0)):(this.pixelStreaming._onWebRtcAutoConnect(),this.connectToSignallingServer())):s.Vy.Info("This player has no protocol connection.")}loadFreezeFrameOrShowPlayOverlay(){this.pixelStreaming.dispatchEvent(new I.vx({shouldShowPlayOverlay:this.shouldShowPlayOverlay,isValid:this.freezeFrameController.valid,jpegData:this.freezeFrameController.jpeg})),!0===this.shouldShowPlayOverlay?(s.Vy.Info("showing play overlay"),this.resizePlayerStyle()):(s.Vy.Info("showing freeze frame"),this.freezeFrameController.showFreezeFrame()),setTimeout(()=>{this.videoPlayer.setVideoEnabled(!1)},this.freezeFrameController.freezeFrameDelay)}onFreezeFrameMessage(e){s.Vy.Info("DataChannelReceiveMessageType.FreezeFrame");const t=new Uint8Array(e);this.freezeFrameController.processFreezeFrameMessage(t,()=>this.loadFreezeFrameOrShowPlayOverlay())}invalidateFreezeFrameAndEnableVideo(){s.Vy.Info("DataChannelReceiveMessageType.FreezeFrame"),setTimeout(()=>{this.pixelStreaming.dispatchEvent(new I.RW),this.freezeFrameController.hideFreezeFrame()},this.freezeFrameController.freezeFrameDelay),this.videoPlayer.getVideoElement()&&this.videoPlayer.setVideoEnabled(!0)}onFileExtension(e){const t=new Uint8Array(e);y.f.setExtensionFromBytes(t,this.file)}onFileMimeType(e){const t=new Uint8Array(e);y.f.setMimeTypeFromBytes(t,this.file)}onFileContents(e){const t=new Uint8Array(e);y.f.setContentsFromBytes(t,this.file)}playStream(){if(!this.videoPlayer.getVideoElement()){const e="Could not play video stream because the video player was not initialized correctly.";return this.pixelStreaming.dispatchEvent(new I.vL({message:e})),s.Vy.Error(e),void this.closeSignalingServer("Stream not initialized correctly",!1)}if(this.videoPlayer.hasVideoSource()){if(this.setTouchInputEnabled(this.config.isFlagEnabled(g.iI.TouchInput)),this.pixelStreaming.dispatchEvent(new I.Lz),this.streamController.audioElement.srcObject){const e=this.config.isFlagEnabled(g.iI.StartVideoMuted);this.streamController.audioElement.muted=e,e?this.playVideo():this.streamController.audioElement.play().then(()=>{this.playVideo()}).catch(e=>{s.Vy.Info(e),s.Vy.Info("Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new I.FJ({reason:e}))})}else this.playVideo();this.shouldShowPlayOverlay=!1,this.freezeFrameController.showFreezeFrame()}else s.Vy.Warning("Cannot play stream, the video element has no srcObject to play.")}playVideo(){this.videoPlayer.play().catch(e=>{this.streamController.audioElement.srcObject&&this.streamController.audioElement.pause(),s.Vy.Info(e),s.Vy.Info("Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new I.FJ({reason:e}))})}autoPlayVideoOrSetUpPlayOverlay(){this.config.isFlagEnabled(g.iI.AutoPlayVideo)&&this.playStream(),this.resizePlayerStyle()}connectToSignallingServer(){this.locallyClosed=!1,this.enableAutoReconnect=!0,this.disconnectMessage=null;const e=this.signallingUrlBuilder();this.protocol.connect(e);const t=this.config.getNumericSettingValue(g.k$.KeepaliveDelay);t>0&&(this.keepalive=new l.P(this.protocol,t),this.keepalive.onTimeout=()=>{s.Vy.Error("Protocol timeout"),this.protocol.disconnect()})}startSession(e){if(this.peerConfig=e,this.config.isFlagEnabled(g.iI.ForceTURN)&&!this.checkTurnServerAvailability(e))return s.Vy.Info("No turn server was found in the Peer Connection Options. TURN cannot be forced, closing connection. Please use STUN instead"),void this.closeSignalingServer("TURN cannot be forced, closing connection. Please use STUN instead.",!1);this.peerConnectionController=new m.J(this.peerConfig,this.config,this.preferredCodec),this.peerConnectionController.onVideoStats=e=>{this.handleVideoStats(e)},this.peerConnectionController.onLatencyCalculated=e=>{this.pixelStreaming._onLatencyCalculated(e)},this.peerConnectionController.onSendWebRTCOffer=e=>{this.handleSendWebRTCOffer(e)},this.peerConnectionController.onSetLocalDescription=e=>{this.handleSendWebRTCAnswer(e)},this.peerConnectionController.onSetRemoteDescription=e=>{this.pixelStreaming._onWebRtcSdpOffer(e)},this.peerConnectionController.onPeerIceCandidate=e=>this.handleSendIceCandidate(e),this.peerConnectionController.onDataChannel=e=>this.handleDataChannel(e),this.peerConnectionController.showTextOverlayConnecting=()=>this.pixelStreaming._onWebRtcConnecting(),this.peerConnectionController.showTextOverlaySetupFailure=()=>this.pixelStreaming._onWebRtcFailed();let t=!1;this.peerConnectionController.onIceConnectionStateChange=()=>{!t&&["connected","completed"].includes(this.peerConnectionController.peerConnection.iceConnectionState)&&(this.pixelStreaming._onWebRtcConnected(),t=!0)},this.peerConnectionController.onTrack=e=>this.streamController.handleOnTrack(e)}checkTurnServerAvailability(e){if(!e.iceServers)return s.Vy.Info("A turn sever was not found"),!1;for(const t of e.iceServers)for(const e of t.urls)if(e.includes("turn"))return s.Vy.Info(`A turn sever was found at ${e}`),!0;return s.Vy.Info("A turn sever was not found"),!1}handleOnConfigMessage(e){this.resizePlayerStyle(),this.startSession(e.peerConnectionOptions)}handlePingMessage(e){this.protocol.sendMessage(a.o(o.H2,{time:e.time}))}handleStreamerListMessage(e){s.Vy.Info(`Got streamer list ${e.ids}`);let t="";const n=this.config.getSettingOption(g.mY.StreamerId);n.selected.toString().trim()&&(t=n.selected);const r=[...e.ids];r.unshift(""),this.config.setOptionSettingOptions(g.mY.StreamerId,r);let i="";const l=this.config.isFlagEnabled(g.iI.WaitForStreamer),d=this.config.getNumericSettingValue(g.k$.MaxReconnectAttempts),c=this.config.getNumericSettingValue(g.k$.StreamerAutoJoinInterval),h=this.config.useUrlParams,u=new k.Z(window.location.search);h&&u.has(g.mY.StreamerId)?t=u.get(g.mY.StreamerId):this.subscribedStream&&(t=this.subscribedStream),t&&e.ids.includes(t)?i=t:t&&l||1!=e.ids.length||(i=e.ids[0]),i?(this.reconnectAttempt=0,this.isReconnecting=!1,this.config.setOptionSettingValue(g.mY.StreamerId,i)):l&&(this.reconnectAttempt<d?(this.reconnectAttempt++,this.isReconnecting=!0,setTimeout(()=>{this.protocol.sendMessage(a.o(o.zW))},c)):(this.reconnectAttempt=0,this.isReconnecting=!1,this.enableAutoReconnect=!1)),this.pixelStreaming.dispatchEvent(new I.jG({messageStreamerList:e,autoSelectedStreamerId:i,wantedStreamerId:t}))}handleSubscribeFailedMessage(e){this.reconnectAttempt=0,this.isReconnecting=!1,this.enableAutoReconnect=!1,this.pixelStreaming._onSubscribeFailed(e.message)}handleStreamerIDChangedMessage(e){const t=e.newID,n=this.config.getSettingOption(g.mY.StreamerId),s=n.onChange;n.onChange=()=>{};const r=n.options;for(let e=0;e<r.length;++e)if(r[e]==this.subscribedStream){r[e]=t;break}n.options=r,n.selected=t,n.onChange=s,this.subscribedStream=e.newID,this.pixelStreaming.dispatchEvent(new I.ie({newID:t}))}handleWebRtcAnswer(e){s.Vy.Info(`Got answer sdp ${e.sdp}`);const t={sdp:e.sdp,type:"answer"};this.peerConnectionController.receiveAnswer(t),this.handlePostWebrtcNegotiation()}handleWebRtcOffer(e){s.Vy.Info(`Got offer sdp ${e.sdp}`),this.isUsingSFU=!!e.sfu&&e.sfu,this.isUsingSVC=!!e.scalabilityMode&&"L1T1"!=e.scalabilityMode,(this.isUsingSFU||this.isUsingSVC)&&(this.peerConnectionController.preferredCodec="");const t=e.scalabilityMode?e.scalabilityMode:"L1T1";let n=["Default"];if(this.isUsingSFU)if(this.isUsingSVC){n=[];const e=+t[1],s=+t[3];for(let t=1;t<=e;t++)for(let e=1;e<=s;e++)n.push(`S${t}T${e}`)}else n=["Low","Medium","High"];this.config.setOptionSettingOptions(g.mY.PreferredQuality,n),this.config.setOptionSettingValue(g.mY.PreferredQuality,n.slice(-1)[0]);const r={sdp:e.sdp,type:"offer"};this.peerConnectionController.receiveOffer(r,this.config),this.handlePostWebrtcNegotiation()}handleWebRtcSFUPeerDatachannels(e){const t={ordered:!0,negotiated:!0,id:e.sendStreamId},n=e.sendStreamId!=e.recvStreamId;if(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,n?"send-datachannel":"datachannel",t),n){const t={ordered:!0,negotiated:!0,id:e.recvStreamId};this.recvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"recv-datachannel",t),this.recvDataChannelController.handleOnOpen=()=>this.protocol.sendMessage(a.o(o.C_)),this.recvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}else this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handlePostWebrtcNegotiation(){this.afkController.startAfkWarningTimer(),this.pixelStreaming._onWebRtcSdp(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.statsTimerHandle=window.setInterval(()=>this.getStats(),1e3),this.setMouseInputEnabled(this.config.isFlagEnabled(g.iI.MouseInput)),this.setKeyboardInputEnabled(this.config.isFlagEnabled(g.iI.KeyboardInput)),this.setGamePadInputEnabled(this.config.isFlagEnabled(g.iI.GamepadInput))}handleIceCandidate(e){s.Vy.Info("Web RTC Controller: onWebRtcIce");const t=new RTCIceCandidate(e);this.peerConnectionController.handleOnIce(t)}handleSendIceCandidate(e){s.Vy.Info("OnIceCandidate"),e.candidate&&e.candidate.candidate&&this.protocol.sendMessage(a.o(o.BI,{candidate:e.candidate}))}handleDataChannel(e){s.Vy.Info("Data channel created for us by browser as we are a receiving peer."),this.sendrecvDataChannelController.dataChannel=e.channel,this.sendrecvDataChannelController.setupDataChannel(),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handleSendWebRTCOffer(e){s.Vy.Info("Sending the offer to the Server");const t={sdp:e.sdp,minBitrateBps:1e3*this.config.getNumericSettingValue(g.k$.WebRTCMinBitrate),maxBitrateBps:1e3*this.config.getNumericSettingValue(g.k$.WebRTCMaxBitrate)};this.protocol.sendMessage(a.o(o.x,t))}handleSendWebRTCAnswer(e){s.Vy.Info("Sending the answer to the Server");const t={sdp:e.sdp,minBitrateBps:1e3*this.config.getNumericSettingValue(g.k$.WebRTCMinBitrate),maxBitrateBps:1e3*this.config.getNumericSettingValue(g.k$.WebRTCMaxBitrate)};this.protocol.sendMessage(a.o(o.ZF,t)),this.isUsingSFU&&this.protocol.sendMessage(a.o(o.tg)),this.pixelStreaming._onWebRtcSdpAnswer(e)}setUpMouseAndFreezeFrame(){const e=this.videoPlayer.getVideoParentElement(),t=this.videoPlayer.getVideoElement();this.coordinateConverter.reconfigure({width:e.clientWidth,height:e.clientHeight},{width:t.videoWidth,height:t.videoHeight}),this.freezeFrameController.freezeFrame.resize()}closeSignalingServer(e,t){var n;this.locallyClosed=!0,this.enableAutoReconnect=t,this.disconnectMessage=e,null===(n=this.protocol)||void 0===n||n.disconnect(1e3,e)}closePeerConnection(){var e;null===(e=this.peerConnectionController)||void 0===e||e.close()}close(){this.closeSignalingServer("",!1),this.closePeerConnection()}getStats(){this.peerConnectionController.generateStats()}sendLatencyTest(){this.latencyStartTime=Date.now(),this.streamMessageController.toStreamerHandlers.get("LatencyTest")([JSON.stringify({StartTime:this.latencyStartTime})])}sendDataChannelLatencyTest(e){this.streamMessageController.toStreamerHandlers.get("DataChannelLatencyTest")([JSON.stringify(e)])}sendEncoderMinQP(e){s.Vy.Info(`MinQP=${e}\n`),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MinQP":e})])}sendEncoderMaxQP(e){s.Vy.Info(`MaxQP=${e}\n`),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MaxQP":e})])}sendEncoderMinQuality(e){s.Vy.Info(`MinQuality=${e}\n`),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MinQuality":e})])}sendEncoderMaxQuality(e){s.Vy.Info(`MaxQuality=${e}\n`),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"Encoder.MaxQuality":e})])}sendWebRTCMinBitrate(e){s.Vy.Info(`WebRTC Min Bitrate=${e}`),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MinBitrate":e})])}sendWebRTCMaxBitrate(e){s.Vy.Info(`WebRTC Max Bitrate=${e}`),null!=e&&this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MaxBitrate":e})])}sendWebRTCFps(e){s.Vy.Info(`WebRTC FPS=${e}`),null!=e&&(this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.Fps":e})]),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"WebRTC.MaxFps":e})]))}sendShowFps(){s.Vy.Info("---- Sending show stat to UE ----"),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({"stat.fps":""})])}sendIframeRequest(){s.Vy.Info("---- Sending Request for an IFrame ----"),this.streamMessageController.toStreamerHandlers.get("IFrameRequest")()}emitUIInteraction(e){s.Vy.Info("---- Sending custom UIInteraction message ----"),this.streamMessageController.toStreamerHandlers.get("UIInteraction")([JSON.stringify(e)])}emitCommand(e){s.Vy.Info("---- Sending custom Command message ----"),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(e)])}emitConsoleCommand(e){s.Vy.Info("---- Sending custom Command:ConsoleCommand message ----"),this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify({ConsoleCommand:e})])}sendRequestQualityControlOwnership(){s.Vy.Info("---- Sending Request to Control Quality ----"),this.toStreamerMessagesController.SendRequestQualityControl()}sendTextboxEntry(e){var t;s.Vy.Info("---- Sending TextboxEntry message ----"),null===(t=this.streamMessageController.toStreamerHandlers.get("TextboxEntry"))||void 0===t||t([e])}handleLatencyTestResult(e){s.Vy.Info("DataChannelReceiveMessageType.latencyTest");const t=new TextDecoder("utf-16").decode(e.slice(1)),n=new f.Z;Object.assign(n,JSON.parse(t)),n.processFields(),n.testStartTimeMs=this.latencyStartTime,n.browserReceiptTimeMs=Date.now(),n.latencyExcludingDecode=~~(n.browserReceiptTimeMs-n.testStartTimeMs),n.testDuration=~~(n.TransmissionTimeMs-n.ReceiptTimeMs),n.networkLatency=~~(n.latencyExcludingDecode-n.testDuration),n.frameDisplayDeltaTimeMs&&n.browserReceiptTimeMs&&(n.endToEndLatency=(n.frameDisplayDeltaTimeMs,n.networkLatency,~~+n.CaptureToSendMs)),this.pixelStreaming._onLatencyTestResult(n)}handleDataChannelLatencyTestResponse(e){s.Vy.Info("DataChannelReceiveMessageType.dataChannelLatencyResponse");const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t);this.pixelStreaming._onDataChannelLatencyTestResponse(n)}handleInitialSettings(e){s.Vy.Info("DataChannelReceiveMessageType.InitialSettings");const t=new TextDecoder("utf-16").decode(e.slice(1)),n=JSON.parse(t),r=new p.C9;n.Encoder&&(r.EncoderSettings=n.Encoder),n.WebRTC&&(r.WebRTCSettings=n.WebRTC),n.PixelStreaming&&(r.PixelStreamingSettings=n.PixelStreaming),n.ConfigOptions&&void 0!==n.ConfigOptions.DefaultToHover&&this.config.setFlagEnabled(g.iI.HoveringMouseMode,!!n.ConfigOptions.DefaultToHover),r.ueCompatible(),s.Vy.Info(t),this.pixelStreaming._onInitialSettings(r)}handleVideoEncoderAvgQP(e){s.Vy.Info("DataChannelReceiveMessageType.VideoEncoderAvgQP");const t=Number(new TextDecoder("utf-16").decode(e.slice(1)));this.setVideoEncoderAvgQP(t)}handleVideoInitialized(){this.pixelStreaming._onVideoInitialized(),this.autoPlayVideoOrSetUpPlayOverlay(),this.resizePlayerStyle(),this.videoPlayer.updateVideoStreamSize()}onQualityControlOwnership(e){const t=new Uint8Array(e);s.Vy.Info("DataChannelReceiveMessageType.QualityControlOwnership"),this.isQualityController=new Boolean(t[1]).valueOf(),s.Vy.Info(`Received quality controller message, will control quality: ${this.isQualityController}`),this.pixelStreaming._onQualityControlOwnership(this.isQualityController)}handleVideoStats(e){this.pixelStreaming._onVideoStats(e)}resizePlayerStyle(){this.videoPlayer.resizePlayerStyle()}setPreferredCodec(e){this.preferredCodec=e,this.peerConnectionController&&(this.peerConnectionController.preferredCodec=e,this.peerConnectionController.updateCodecSelection=!1)}setVideoEncoderAvgQP(e){this.videoAvgQp=e,this.pixelStreaming._onVideoEncoderAvgQP(this.videoAvgQp)}setKeyboardInputEnabled(e){var t;null===(t=this.keyboardController)||void 0===t||t.unregister(),e&&(this.keyboardController=this.inputClassesFactory.registerKeyBoard(this.config))}setMouseInputEnabled(e){var t;if(null===(t=this.mouseController)||void 0===t||t.unregister(),e){const e=this.config.isFlagEnabled(g.iI.HoveringMouseMode)?g.Bs.HoveringMouse:g.Bs.LockedMouse;this.mouseController=this.inputClassesFactory.registerMouse(e)}}setTouchInputEnabled(e){var t;null===(t=this.touchController)||void 0===t||t.unregister(),e&&(this.touchController=this.inputClassesFactory.registerTouch(this.config.isFlagEnabled(g.iI.FakeMouseWithTouches)))}setGamePadInputEnabled(e){var t;null===(t=this.gamePadController)||void 0===t||t.unregister(),e&&(this.gamePadController=this.inputClassesFactory.registerGamePad())}registerDataChannelEventEmitters(e){e.onOpen=(e,t)=>this.pixelStreaming.dispatchEvent(new I.ys({label:e,event:t})),e.onClose=(e,t)=>this.pixelStreaming.dispatchEvent(new I.CE({label:e,event:t})),e.onError=(e,t)=>this.pixelStreaming.dispatchEvent(new I.EQ({label:e,event:t}))}registerMessageHandler(e,t,n){t===w.Tt.FromStreamer&&void 0===n&&s.Vy.Warning(`Unable to register handler for ${e} as no handler was passed`),this.streamMessageController.registerMessageHandler(t,e,s=>void 0===n&&t===w.Tt.ToStreamer?this.sendMessageController.sendMessageToStreamer(e,s):n(s))}}},9689(e,t,n){n.d(t,{R:()=>a});var s=n(948),r=n(2807),i=n(6077),o=n(223);class a{constructor(e){this.xrViewerPose=null,this.EPSILON=1e-7,this.videoTexture=null,this.prevVideoWidth=0,this.prevVideoHeight=0,this.leftView=null,this.rightView=null,this.lastSentLeftEyeProj=null,this.lastSentRightEyeProj=null,this.lastSentRelativeLeftEyePos=null,this.lastSentRelativeRightEyePos=null,this.xrSession=null,this.webRtcController=e,this.xrGamepadController=new r.E(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){if(this.xrSession)this.xrSession.end();else{if(!navigator.xr)return void s.Vy.Error("This browser does not support XR.");navigator.xr.requestSession("immersive-vr",{optionalFeatures:[]}).then(e=>{this.onXrSessionStarted(e)})}}onXrSessionEnded(){s.Vy.Info("XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}initGL(){if(this.gl)return;const e=document.createElement("canvas");this.gl=e.getContext("webgl2",{xrCompatible:!0}),this.gl.clearColor(0,0,0,1)}initShaders(){const e=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(e,"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n\n // varyings\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position.x, a_position.y, 0, 1);\n // pass the texCoord to the fragment shader\n // The GPU will interpolate this value between points.\n v_texCoord = a_texCoord;\n }\n "),this.gl.compileShader(e);const t=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(t,"\n precision mediump float;\n\n // our texture\n uniform sampler2D u_image;\n\n // the texCoords passed in from the vertex shader.\n varying vec2 v_texCoord;\n\n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord);\n }\n "),this.gl.compileShader(t);const n=this.gl.createProgram();this.gl.attachShader(n,e),this.gl.attachShader(n,t),this.gl.linkProgram(n),this.gl.useProgram(n),this.positionLocation=this.gl.getAttribLocation(n,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(n,"a_texCoord")}updateVideoTexture(){this.videoTexture||(this.videoTexture=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this.videoTexture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR));const e=this.webRtcController.videoPlayer.getVideoElement().videoHeight,t=this.webRtcController.videoPlayer.getVideoElement().videoWidth;this.prevVideoHeight!=e||this.prevVideoWidth!=t?this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()):this.gl.texSubImage2D(this.gl.TEXTURE_2D,0,0,0,t,e,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.prevVideoHeight=e,this.prevVideoWidth=t}initBuffers(){this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([-1,1,1,1,-1,-1,-1,-1,1,1,1,-1]),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.texcoordBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.texcoordLocation,2,this.gl.FLOAT,!1,0,0)}onXrSessionStarted(e){s.Vy.Info("XR Session started"),this.xrSession=e,this.xrSession.addEventListener("end",()=>{this.onXrSessionEnded()}),this.initGL(),this.initShaders(),this.initBuffers(),e.requestReferenceSpace("local").then(t=>{if(this.xrRefSpace=t,this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)}),this.xrSession.supportedFrameRates)for(const t of this.xrSession.supportedFrameRates)90==t&&e.updateTargetFrameRate(90);this.xrSession.requestAnimationFrame(this.onXrFrame.bind(this))}),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}areArraysEqual(e,t){return e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<=this.EPSILON)}arePointsEqual(e,t){return Math.abs(e.x-t.x)>=this.EPSILON&&Math.abs(e.y-t.y)>=this.EPSILON&&Math.abs(e.z-t.z)>=this.EPSILON}sendXRDataToUE(){if(null==this.leftView||null==this.rightView)return;let e=null==this.lastSentLeftEyeProj||null==this.lastSentRightEyeProj||null==this.lastSentRelativeLeftEyePos||null==this.lastSentRelativeRightEyePos;const t=this.leftView.transform.matrix,n=this.leftView.projectionMatrix,s=this.rightView.transform.matrix,r=this.rightView.projectionMatrix,i=this.xrViewerPose.transform.matrix;if(!e&&null!=this.lastSentLeftEyeProj&&null!=this.lastSentRightEyeProj){const t=this.areArraysEqual(n,this.lastSentLeftEyeProj),s=this.areArraysEqual(r,this.lastSentRightEyeProj);e=0==t||0==s}const o=new DOMPointReadOnly(this.leftView.transform.position.x-this.xrViewerPose.transform.position.x,this.leftView.transform.position.y-this.xrViewerPose.transform.position.y,this.leftView.transform.position.z-this.xrViewerPose.transform.position.z,1),a=new DOMPointReadOnly(this.leftView.transform.position.x-this.xrViewerPose.transform.position.x,this.leftView.transform.position.y-this.xrViewerPose.transform.position.y,this.leftView.transform.position.z-this.xrViewerPose.transform.position.z,1);if(!e&&null!=this.lastSentRelativeLeftEyePos&&null!=this.lastSentRelativeRightEyePos){const t=this.arePointsEqual(o,this.lastSentRelativeLeftEyePos),n=this.arePointsEqual(a,this.lastSentRelativeRightEyePos);e=0==t||0==n}e?(this.webRtcController.streamMessageController.toStreamerHandlers.get("XREyeViews")([t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15],n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15],s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14],s[3],s[7],s[11],s[15],r[0],r[4],r[8],r[12],r[1],r[5],r[9],r[13],r[2],r[6],r[10],r[14],r[3],r[7],r[11],r[15],i[0],i[4],i[8],i[12],i[1],i[5],i[9],i[13],i[2],i[6],i[10],i[14],i[3],i[7],i[11],i[15]]),this.lastSentLeftEyeProj=n,this.lastSentRightEyeProj=r,this.lastSentRelativeLeftEyePos=o,this.lastSentRelativeRightEyePos=a):this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([i[0],i[4],i[8],i[12],i[1],i[5],i[9],i[13],i[2],i[6],i[10],i[14],i[3],i[7],i[11],i[15]])}onXrFrame(e,t){if(this.xrViewerPose=t.getViewerPose(this.xrRefSpace),this.xrViewerPose){if(this.updateViews(),null==this.leftView||null==this.rightView)return;this.sendXRDataToUE(),this.updateVideoTexture(),this.render()}this.webRtcController.config.isFlagEnabled(o.iI.XRControllerInput)&&this.xrSession.inputSources.forEach((e,n,s)=>{this.xrGamepadController.updateStatus(e,t,this.xrRefSpace)},this),this.xrSession.requestAnimationFrame((e,t)=>this.onXrFrame(e,t)),this.onFrame.dispatchEvent(new i.qM({time:e,frame:t}))}updateViews(){if(this.xrViewerPose)for(const e of this.xrViewerPose.views)"left"===e.eye?this.leftView=e:"right"===e.eye&&(this.rightView=e)}render(){if(!this.gl)return;const e=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,e.framebuffer),this.gl.viewport(0,0,e.framebufferWidth,e.framebufferHeight),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}static isSessionSupported(e){"https:"!==location.protocol&&s.Vy.Info("WebXR requires https, if you want WebXR use https.");try{if(navigator.xr)return navigator.xr.isSessionSupported(e)}catch(e){return Promise.resolve(!1)}return Promise.resolve(!1)}}},4441(e,t,n){function s(e,t){if(!e)throw new Error(t)}function r(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function i(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function o(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}n.d(t,{bn:()=>r,e1:()=>i,vA:()=>s,wO:()=>o})},2616(e,t,n){n.d(t,{A:()=>i,C:()=>o});let s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),r=[];for(let e=0;e<s.length;e++)r[s[e].charCodeAt(0)]=e;function i(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,s=new Uint8Array(t),i=0,o=0,a=0;for(let t=0;t<e.length;t++){if(n=r[e.charCodeAt(t)],void 0===n)switch(e[t]){case"=":o=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(o){case 0:a=n,o=1;break;case 1:s[i++]=a<<2|(48&n)>>4,a=n,o=2;break;case 2:s[i++]=(15&a)<<4|(60&n)>>2,a=n,o=3;break;case 3:s[i++]=(3&a)<<6|n,o=0}}if(1==o)throw Error("invalid base64 string.");return s.subarray(0,i)}function o(e){let t,n="",r=0,i=0;for(let o=0;o<e.length;o++)switch(t=e[o],r){case 0:n+=s[t>>2],i=(3&t)<<4,r=1;break;case 1:n+=s[i|t>>4],i=(15&t)<<2,r=2;break;case 2:n+=s[i|t>>6],n+=s[63&t],r=0}return r&&(n+=s[i],n+="=",1==r&&(n+="=")),n}r["-".charCodeAt(0)]=s.indexOf("+"),r["_".charCodeAt(0)]=s.indexOf("/")},8899(e,t,n){var s,r;n.d(t,{O0:()=>r,f$:()=>s}),function(e){e.symbol=Symbol.for("protobuf-ts/unknown"),e.onRead=(n,s,r,i,o)=>{(t(s)?s[e.symbol]:s[e.symbol]=[]).push({no:r,wireType:i,data:o})},e.onWrite=(t,n,s)=>{for(let{no:t,wireType:r,data:i}of e.list(n))s.tag(t,r).raw(i)},e.list=(n,s)=>{if(t(n)){let t=n[e.symbol];return s?t.filter(e=>e.no==s):t}return[]},e.last=(t,n)=>e.list(t,n).slice(-1)[0];const t=t=>t&&Array.isArray(t[e.symbol])}(s||(s={})),function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(r||(r={}))},7844(e,t,n){n.d(t,{e:()=>a});var s=n(8899),r=n(6544),i=n(7718);const o={readUnknownField:!0,readerFactory:e=>new l(e)};function a(e){return e?Object.assign(Object.assign({},o),e):o}class l{constructor(e,t){this.varint64=i.ls,this.uint32=i.Gn,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case s.O0.Varint:for(;128&this.buf[this.pos++];);break;case s.O0.Bit64:this.pos+=4;case s.O0.Bit32:this.pos+=4;break;case s.O0.LengthDelimited:let t=this.uint32();this.pos+=t;break;case s.O0.StartGroup:let n;for(;(n=this.tag()[1])!==s.O0.EndGroup;)this.skip(n);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return new r.hY(...this.varint64())}uint64(){return new r.eA(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,new r.hY(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new r.eA(this.sfixed32(),this.sfixed32())}sfixed64(){return new r.hY(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}},8592(e,t,n){n.d(t,{d:()=>a});var s=n(6544),r=n(7718),i=n(4441);const o={writeUnknownFields:!0,writerFactory:()=>new l};function a(e){return e?Object.assign(Object.assign({},o),e):o}class l{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for((0,i.e1)(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return(0,i.bn)(e),(0,r.f7)(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){(0,i.wO)(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){(0,i.e1)(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){(0,i.bn)(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return(0,i.bn)(e),e=(e<<1^e>>31)>>>0,(0,r.f7)(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=s.hY.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=s.eA.from(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=s.hY.from(e);return(0,r.cV)(t.lo,t.hi,this.buf),this}sint64(e){let t=s.hY.from(e),n=t.hi>>31,i=t.lo<<1^n,o=(t.hi<<1|t.lo>>>31)^n;return(0,r.cV)(i,o,this.buf),this}uint64(e){let t=s.eA.from(e);return(0,r.cV)(t.lo,t.hi,this.buf),this}}},7718(e,t,n){function s(){let e=0,t=0;for(let n=0;n<28;n+=7){let s=this.buf[this.pos++];if(e|=(127&s)<<n,!(128&s))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let s=this.buf[this.pos++];if(t|=(127&s)<<n,!(128&s))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function r(e,t,n){for(let s=0;s<28;s+=7){const r=e>>>s,i=!(r>>>7==0&&0==t),o=255&(i?128|r:r);if(n.push(o),!i)return}const s=e>>>28&15|(7&t)<<4,r=!!(t>>3);if(n.push(255&(r?128|s:s)),r){for(let e=3;e<31;e+=7){const s=t>>>e,r=!(s>>>7==0),i=255&(r?128|s:s);if(n.push(i),!r)return}n.push(t>>>31&1)}}n.d(t,{Gn:()=>d,Jg:()=>o,cV:()=>r,f7:()=>l,ls:()=>s,oJ:()=>a});const i=4294967296;function o(e){let t="-"==e[0];t&&(e=e.slice(1));const n=1e6;let s=0,r=0;function o(t,o){const a=Number(e.slice(t,o));r*=n,s=s*n+a,s>=i&&(r+=s/i|0,s%=i)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),[t,s,r]}function a(e,t){if(t>>>0<=2097151)return""+(i*t+(e>>>0));let n=(e>>>24|t<<8)>>>0&16777215,s=t>>16&65535,r=(16777215&e)+6777216*n+6710656*s,o=n+8147497*s,a=2*s,l=1e7;function d(e,t){let n=e?String(e):"";return t?"0000000".slice(n.length)+n:n}return r>=l&&(o+=Math.floor(r/l),r%=l),o>=l&&(a+=Math.floor(o/l),o%=l),d(a,0)+d(o,a)+d(r,1)}function l(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function d(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;128&e&&t<10;t++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}},9196(e,t,n){n.d(t,{bm:()=>i,yG:()=>o});const s={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},r={ignoreUnknownFields:!1};function i(e){return e?Object.assign(Object.assign({},r),e):r}function o(e){return e?Object.assign(Object.assign({},s),e):s}},2280(e,t,n){function s(e){let t=typeof e;if("object"==t){if(Array.isArray(e))return"array";if(null===e)return"null"}return t}function r(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}n.d(t,{O:()=>r,V:()=>s})},9378(e,t,n){function s(e){let t=!1;const n=[];for(let s=0;s<e.length;s++){let r=e.charAt(s);"_"==r?t=!0:/\d/.test(r)?(n.push(r),t=!0):t?(n.push(r.toUpperCase()),t=!1):0==s?n.push(r.toLowerCase()):n.push(r)}return n.join("")}n.d(t,{W:()=>s})},5336(e,t,n){n.d(t,{$:()=>s});const s=Symbol.for("protobuf-ts/message-type")},2285(e,t,n){n.d(t,{G:()=>b});var s=n(5336),r=n(743),i=n(350),o=n(9581),a=n(2985),l=n(8228),d=n(1312),c=n(6895),h=n(3923),u=n(2280),m=n(9196),g=n(9230),p=n(8592),f=n(7844);const y=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),v=y[s.$]={};class b{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(r.mS),this.options=null!=n?n:{},v.value=this,this.messagePrototype=Object.create(null,y),this.refTypeCheck=new i.u(this),this.refJsonReader=new o.L(this),this.refJsonWriter=new a.X(this),this.refBinReader=new l.W(this),this.refBinWriter=new d.c(this)}create(e){let t=(0,c.C)(this);return void 0!==e&&(0,h.x)(this,t,e),t}clone(e){let t=this.create();return(0,h.x)(this,t,e),t}equals(e,t){return(0,g.F)(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){(0,h.x)(this,e,t)}fromBinary(e,t){let n=(0,f.e)(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,(0,m.bm)(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,(0,m.yG)(t))}toJsonString(e,t){var n;let s=this.toJson(e,t);return JSON.stringify(s,null,null!==(n=null==t?void 0:t.prettySpaces)&&void 0!==n?n:0)}toBinary(e,t){let n=(0,p.d)(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(null!==e&&"object"==typeof e&&!Array.isArray(e)){let s=null!=n?n:this.create();return this.refJsonReader.read(e,s,t),s}throw new Error(`Unable to parse message ${this.typeName} from JSON ${(0,u.V)(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,s){let r=null!=s?s:this.create();return this.refBinReader.read(e,r,n,t),r}}},314(e,t,n){function s(e){if("object"!=typeof e||null===e||!e.hasOwnProperty("oneofKind"))return!1;switch(typeof e.oneofKind){case"string":return void 0!==e[e.oneofKind]&&2==Object.keys(e).length;case"undefined":return 1==Object.keys(e).length;default:return!1}}n.d(t,{Zs:()=>s})},6544(e,t,n){n.d(t,{eA:()=>c,hY:()=>h});var s=n(7718);let r;function i(e){if(!e)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}!function(){const e=new DataView(new ArrayBuffer(8)),t=void 0!==globalThis.BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64;r=t?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:e}:void 0}();const o=/^-?[0-9]+$/,a=4294967296,l=2147483648;class d{constructor(e,t){this.lo=0|e,this.hi=0|t}isZero(){return 0==this.lo&&0==this.hi}toNumber(){let e=this.hi*a+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class c extends d{static from(e){if(r)switch(typeof e){case"string":if("0"==e)return this.ZERO;if(""==e)throw new Error("string is no integer");e=r.C(e);case"number":if(0===e)return this.ZERO;e=r.C(e);case"bigint":if(!e)return this.ZERO;if(e<r.UMIN)throw new Error("signed value for ulong");if(e>r.UMAX)throw new Error("ulong too large");return r.V.setBigUint64(0,e,!0),new c(r.V.getInt32(0,!0),r.V.getInt32(4,!0))}else switch(typeof e){case"string":if("0"==e)return this.ZERO;if(e=e.trim(),!o.test(e))throw new Error("string is no integer");let[t,n,r]=(0,s.Jg)(e);if(t)throw new Error("signed value for ulong");return new c(n,r);case"number":if(0==e)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new c(e,e/a)}throw new Error("unknown value "+typeof e)}toString(){return r?this.toBigInt().toString():(0,s.oJ)(this.lo,this.hi)}toBigInt(){return i(r),r.V.setInt32(0,this.lo,!0),r.V.setInt32(4,this.hi,!0),r.V.getBigUint64(0,!0)}}c.ZERO=new c(0,0);class h extends d{static from(e){if(r)switch(typeof e){case"string":if("0"==e)return this.ZERO;if(""==e)throw new Error("string is no integer");e=r.C(e);case"number":if(0===e)return this.ZERO;e=r.C(e);case"bigint":if(!e)return this.ZERO;if(e<r.MIN)throw new Error("signed long too small");if(e>r.MAX)throw new Error("signed long too large");return r.V.setBigInt64(0,e,!0),new h(r.V.getInt32(0,!0),r.V.getInt32(4,!0))}else switch(typeof e){case"string":if("0"==e)return this.ZERO;if(e=e.trim(),!o.test(e))throw new Error("string is no integer");let[t,n,r]=(0,s.Jg)(e);if(t){if(r>l||r==l&&0!=n)throw new Error("signed long too small")}else if(r>=l)throw new Error("signed long too large");let i=new h(n,r);return t?i.negate():i;case"number":if(0==e)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new h(e,e/a):new h(-e,-e/a).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return 0!==(this.hi&l)}negate(){let e=~this.hi,t=this.lo;return t?t=1+~t:e+=1,new h(t,e)}toString(){if(r)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+(0,s.oJ)(e.lo,e.hi)}return(0,s.oJ)(this.lo,this.hi)}toBigInt(){return i(r),r.V.setInt32(0,this.lo,!0),r.V.setInt32(4,this.hi,!0),r.V.getBigInt64(0,!0)}}h.ZERO=new h(0,0)},8228(e,t,n){n.d(t,{W:()=>a});var s=n(8899),r=n(743),i=n(9511),o=n(2799);class a{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const t=null!==(e=this.info.fields)&&void 0!==e?e:[];this.fieldNoToField=new Map(t.map(e=>[e.no,e]))}}read(e,t,n,i){this.prepare();const o=void 0===i?e.len:e.pos+i;for(;e.pos<o;){const[i,o]=e.tag(),a=this.fieldNoToField.get(i);if(!a){let r=n.readUnknownField;if("throw"==r)throw new Error(`Unknown field ${i} (wire type ${o}) for ${this.info.typeName}`);let a=e.skip(o);!1!==r&&(!0===r?s.f$.onRead:r)(this.info.typeName,t,i,o,a);continue}let l=t,d=a.repeat,c=a.localName;switch(a.oneof&&(l=l[a.oneof],l.oneofKind!==c&&(l=t[a.oneof]={oneofKind:c})),a.kind){case"scalar":case"enum":let t="enum"==a.kind?r.LN.INT32:a.T,i="scalar"==a.kind?a.L:void 0;if(d){let n=l[c];if(o==s.O0.LengthDelimited&&t!=r.LN.STRING&&t!=r.LN.BYTES){let s=e.uint32()+e.pos;for(;e.pos<s;)n.push(this.scalar(e,t,i))}else n.push(this.scalar(e,t,i))}else l[c]=this.scalar(e,t,i);break;case"message":if(d){let t=l[c],s=a.T().internalBinaryRead(e,e.uint32(),n);t.push(s)}else l[c]=a.T().internalBinaryRead(e,e.uint32(),n,l[c]);break;case"map":let[h,u]=this.mapEntry(a,e,n);l[c][h]=u}}}mapEntry(e,t,n){let s,i,a=t.uint32(),l=t.pos+a;for(;t.pos<l;){let[o,a]=t.tag();switch(o){case 1:s=e.K==r.LN.BOOL?t.bool().toString():this.scalar(t,e.K,r.rO.STRING);break;case 2:switch(e.V.kind){case"scalar":i=this.scalar(t,e.V.T,e.V.L);break;case"enum":i=t.int32();break;case"message":i=e.V.T().internalBinaryRead(t,t.uint32(),n)}break;default:throw new Error(`Unknown field ${o} (wire type ${a}) in map entry for ${this.info.typeName}#${e.name}`)}}if(void 0===s){let t=(0,o.V)(e.K);s=e.K==r.LN.BOOL?t.toString():t}if(void 0===i)switch(e.V.kind){case"scalar":i=(0,o.V)(e.V.T,e.V.L);break;case"enum":i=0;break;case"message":i=e.V.T().create()}return[s,i]}scalar(e,t,n){switch(t){case r.LN.INT32:return e.int32();case r.LN.STRING:return e.string();case r.LN.BOOL:return e.bool();case r.LN.DOUBLE:return e.double();case r.LN.FLOAT:return e.float();case r.LN.INT64:return(0,i.l)(e.int64(),n);case r.LN.UINT64:return(0,i.l)(e.uint64(),n);case r.LN.FIXED64:return(0,i.l)(e.fixed64(),n);case r.LN.FIXED32:return e.fixed32();case r.LN.BYTES:return e.bytes();case r.LN.UINT32:return e.uint32();case r.LN.SFIXED32:return e.sfixed32();case r.LN.SFIXED64:return(0,i.l)(e.sfixed64(),n);case r.LN.SINT32:return e.sint32();case r.LN.SINT64:return(0,i.l)(e.sint64(),n)}}}},1312(e,t,n){n.d(t,{c:()=>a});var s=n(8899),r=n(743),i=n(4441),o=n(6544);class a{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((e,t)=>e.no-t.no)}}write(e,t,n){this.prepare();for(const s of this.fields){let o,a,l=s.repeat,d=s.localName;if(s.oneof){const t=e[s.oneof];if(t.oneofKind!==d)continue;o=t[d],a=!0}else o=e[d],a=!1;switch(s.kind){case"scalar":case"enum":let e="enum"==s.kind?r.LN.INT32:s.T;if(l)if((0,i.vA)(Array.isArray(o)),l==r.sA.PACKED)this.packed(t,e,s.no,o);else for(const n of o)this.scalar(t,e,s.no,n,!0);else void 0===o?(0,i.vA)(s.opt):this.scalar(t,e,s.no,o,a||s.opt);break;case"message":if(l){(0,i.vA)(Array.isArray(o));for(const e of o)this.message(t,n,s.T(),s.no,e)}else this.message(t,n,s.T(),s.no,o);break;case"map":(0,i.vA)("object"==typeof o&&null!==o);for(const[e,r]of Object.entries(o))this.mapEntry(t,n,s,e,r)}}let o=n.writeUnknownFields;!1!==o&&(!0===o?s.f$.onWrite:o)(this.info.typeName,e,t)}mapEntry(e,t,n,o,a){e.tag(n.no,s.O0.LengthDelimited),e.fork();let l=o;switch(n.K){case r.LN.INT32:case r.LN.FIXED32:case r.LN.UINT32:case r.LN.SFIXED32:case r.LN.SINT32:l=Number.parseInt(o);break;case r.LN.BOOL:(0,i.vA)("true"==o||"false"==o),l="true"==o}switch(this.scalar(e,n.K,1,l,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,a,!0);break;case"enum":this.scalar(e,r.LN.INT32,2,a,!0);break;case"message":this.message(e,t,n.V.T(),2,a)}e.join()}message(e,t,n,r,i){void 0!==i&&(n.internalBinaryWrite(i,e.tag(r,s.O0.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,s,r){let[i,o,a]=this.scalarInfo(t,s);a&&!r||(e.tag(n,i),e[o](s))}packed(e,t,n,o){if(!o.length)return;(0,i.vA)(t!==r.LN.BYTES&&t!==r.LN.STRING),e.tag(n,s.O0.LengthDelimited),e.fork();let[,a]=this.scalarInfo(t);for(let t=0;t<o.length;t++)e[a](o[t]);e.join()}scalarInfo(e,t){let n,i=s.O0.Varint,a=void 0===t,l=0===t;switch(e){case r.LN.INT32:n="int32";break;case r.LN.STRING:l=a||!t.length,i=s.O0.LengthDelimited,n="string";break;case r.LN.BOOL:l=!1===t,n="bool";break;case r.LN.UINT32:n="uint32";break;case r.LN.DOUBLE:i=s.O0.Bit64,n="double";break;case r.LN.FLOAT:i=s.O0.Bit32,n="float";break;case r.LN.INT64:l=a||o.hY.from(t).isZero(),n="int64";break;case r.LN.UINT64:l=a||o.eA.from(t).isZero(),n="uint64";break;case r.LN.FIXED64:l=a||o.eA.from(t).isZero(),i=s.O0.Bit64,n="fixed64";break;case r.LN.BYTES:l=a||!t.byteLength,i=s.O0.LengthDelimited,n="bytes";break;case r.LN.FIXED32:i=s.O0.Bit32,n="fixed32";break;case r.LN.SFIXED32:i=s.O0.Bit32,n="sfixed32";break;case r.LN.SFIXED64:l=a||o.hY.from(t).isZero(),i=s.O0.Bit64,n="sfixed64";break;case r.LN.SINT32:n="sint32";break;case r.LN.SINT64:l=a||o.hY.from(t).isZero(),n="sint64"}return[i,n,a||l]}}},6895(e,t,n){n.d(t,{C:()=>i});var s=n(2799),r=n(5336);function i(e){const t=e.messagePrototype?Object.create(e.messagePrototype):Object.defineProperty({},r.$,{value:e});for(let n of e.fields){let e=n.localName;if(!n.opt)if(n.oneof)t[n.oneof]={oneofKind:void 0};else if(n.repeat)t[e]=[];else switch(n.kind){case"scalar":t[e]=(0,s.V)(n.T,n.L);break;case"enum":t[e]=0;break;case"map":t[e]={}}}return t}},9230(e,t,n){n.d(t,{F:()=>r});var s=n(743);function r(e,t,n){if(t===n)return!0;if(!t||!n)return!1;for(let r of e.fields){let e=r.localName,d=r.oneof?t[r.oneof][e]:t[e],c=r.oneof?n[r.oneof][e]:n[e];switch(r.kind){case"enum":case"scalar":let e="enum"==r.kind?s.LN.INT32:r.T;if(!(r.repeat?a(e,d,c):o(e,d,c)))return!1;break;case"map":if(!("message"==r.V.kind?l(r.V.T(),i(d),i(c)):a("enum"==r.V.kind?s.LN.INT32:r.V.T,i(d),i(c))))return!1;break;case"message":let t=r.T();if(!(r.repeat?l(t,d,c):t.equals(d,c)))return!1}}return!0}const i=Object.values;function o(e,t,n){if(t===n)return!0;if(e!==s.LN.BYTES)return!1;let r=t,i=n;if(r.length!==i.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!=i[e])return!1;return!0}function a(e,t,n){if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(!o(e,t[s],n[s]))return!1;return!0}function l(e,t,n){if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(!e.equals(t[s],n[s]))return!1;return!0}},743(e,t,n){n.d(t,{LN:()=>s,mS:()=>a,rO:()=>r,sA:()=>i});var s,r,i,o=n(9378);function a(e){var t,n,s,r;return e.localName=null!==(t=e.localName)&&void 0!==t?t:(0,o.W)(e.name),e.jsonName=null!==(n=e.jsonName)&&void 0!==n?n:(0,o.W)(e.name),e.repeat=null!==(s=e.repeat)&&void 0!==s?s:i.NO,e.opt=null!==(r=e.opt)&&void 0!==r?r:!e.repeat&&!e.oneof&&"message"==e.kind,e}!function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"}(s||(s={})),function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER"}(r||(r={})),function(e){e[e.NO=0]="NO",e[e.PACKED=1]="PACKED",e[e.UNPACKED=2]="UNPACKED"}(i||(i={}))},9581(e,t,n){n.d(t,{L:()=>d});var s=n(2280),r=n(2616),i=n(743),o=n(6544),a=n(4441),l=n(9511);class d{constructor(e){this.info=e}prepare(){var e;if(void 0===this.fMap){this.fMap={};const t=null!==(e=this.info.fields)&&void 0!==e?e:[];for(const e of t)this.fMap[e.name]=e,this.fMap[e.jsonName]=e,this.fMap[e.localName]=e}}assert(e,t,n){if(!e){let e=(0,s.V)(n);throw"number"!=e&&"boolean"!=e||(e=n.toString()),new Error(`Cannot parse JSON ${e} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();const r=[];for(const[o,a]of Object.entries(e)){const e=this.fMap[o];if(!e){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}const l=e.localName;let d;if(e.oneof){if(null===a&&("enum"!==e.kind||"google.protobuf.NullValue"!==e.T()[0]))continue;if(r.includes(e.oneof))throw new Error(`Multiple members of the oneof group "${e.oneof}" of ${this.info.typeName} are present in JSON.`);r.push(e.oneof),d=t[e.oneof]={oneofKind:l}}else d=t;if("map"==e.kind){if(null===a)continue;this.assert((0,s.O)(a),e.name,a);const t=d[l];for(const[s,r]of Object.entries(a)){let o;switch(this.assert(null!==r,e.name+" map value",null),e.V.kind){case"message":o=e.V.T().internalJsonRead(r,n);break;case"enum":if(o=this.enum(e.V.T(),r,e.name,n.ignoreUnknownFields),!1===o)continue;break;case"scalar":o=this.scalar(r,e.V.T,e.V.L,e.name)}this.assert(void 0!==o,e.name+" map value",r);let a=s;e.K==i.LN.BOOL&&(a="true"==a||"false"!=a&&a),a=this.scalar(a,e.K,i.rO.STRING,e.name).toString(),t[a]=o}}else if(e.repeat){if(null===a)continue;this.assert(Array.isArray(a),e.name,a);const t=d[l];for(const s of a){let r;switch(this.assert(null!==s,e.name,null),e.kind){case"message":r=e.T().internalJsonRead(s,n);break;case"enum":if(r=this.enum(e.T(),s,e.name,n.ignoreUnknownFields),!1===r)continue;break;case"scalar":r=this.scalar(s,e.T,e.L,e.name)}this.assert(void 0!==r,e.name,a),t.push(r)}}else switch(e.kind){case"message":if(null===a&&"google.protobuf.Value"!=e.T().typeName){this.assert(void 0===e.oneof,e.name+" (oneof member)",null);continue}d[l]=e.T().internalJsonRead(a,n,d[l]);break;case"enum":if(null===a)continue;let t=this.enum(e.T(),a,e.name,n.ignoreUnknownFields);if(!1===t)continue;d[l]=t;break;case"scalar":if(null===a)continue;d[l]=this.scalar(a,e.T,e.L,e.name)}}}enum(e,t,n,s){if("google.protobuf.NullValue"==e[0]&&(0,a.vA)(null===t||"NULL_VALUE"===t,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),null===t)return 0;switch(typeof t){case"number":return(0,a.vA)(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let r=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(r=t.substring(e[2].length));let i=e[1][r];return(void 0!==i||!s)&&((0,a.vA)("number"==typeof i,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),i)}(0,a.vA)(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,s){let d;try{switch(t){case i.LN.DOUBLE:case i.LN.FLOAT:if(null===e)return 0;if("NaN"===e)return Number.NaN;if("Infinity"===e)return Number.POSITIVE_INFINITY;if("-Infinity"===e)return Number.NEGATIVE_INFINITY;if(""===e){d="empty string";break}if("string"==typeof e&&e.trim().length!==e.length){d="extra whitespace";break}if("string"!=typeof e&&"number"!=typeof e)break;let s=Number(e);if(Number.isNaN(s)){d="not a number";break}if(!Number.isFinite(s)){d="too large or small";break}return t==i.LN.FLOAT&&(0,a.wO)(s),s;case i.LN.INT32:case i.LN.FIXED32:case i.LN.SFIXED32:case i.LN.SINT32:case i.LN.UINT32:if(null===e)return 0;let c;if("number"==typeof e?c=e:""===e?d="empty string":"string"==typeof e&&(e.trim().length!==e.length?d="extra whitespace":c=Number(e)),void 0===c)break;return t==i.LN.UINT32?(0,a.e1)(c):(0,a.bn)(c),c;case i.LN.INT64:case i.LN.SFIXED64:case i.LN.SINT64:if(null===e)return(0,l.l)(o.hY.ZERO,n);if("number"!=typeof e&&"string"!=typeof e)break;return(0,l.l)(o.hY.from(e),n);case i.LN.FIXED64:case i.LN.UINT64:if(null===e)return(0,l.l)(o.eA.ZERO,n);if("number"!=typeof e&&"string"!=typeof e)break;return(0,l.l)(o.eA.from(e),n);case i.LN.BOOL:if(null===e)return!1;if("boolean"!=typeof e)break;return e;case i.LN.STRING:if(null===e)return"";if("string"!=typeof e){d="extra whitespace";break}try{encodeURIComponent(e)}catch(d){d="invalid UTF8";break}return e;case i.LN.BYTES:if(null===e||""===e)return new Uint8Array(0);if("string"!=typeof e)break;return(0,r.A)(e)}}catch(e){d=e.message}this.assert(!1,s+(d?" - "+d:""),e)}}},2985(e,t,n){n.d(t,{X:()=>a});var s=n(2616),r=n(6544),i=n(743),o=n(4441);class a{constructor(e){var t;this.fields=null!==(t=e.fields)&&void 0!==t?t:[]}write(e,t){const n={},s=e;for(const e of this.fields){if(!e.oneof){let r=this.field(e,s[e.localName],t);void 0!==r&&(n[t.useProtoFieldName?e.name:e.jsonName]=r);continue}const r=s[e.oneof];if(r.oneofKind!==e.localName)continue;const i="scalar"==e.kind||"enum"==e.kind?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let a=this.field(e,r[e.localName],i);(0,o.vA)(void 0!==a),n[t.useProtoFieldName?e.name:e.jsonName]=a}return n}field(e,t,n){let s;if("map"==e.kind){(0,o.vA)("object"==typeof t&&null!==t);const r={};switch(e.V.kind){case"scalar":for(const[n,s]of Object.entries(t)){const t=this.scalar(e.V.T,s,e.name,!1,!0);(0,o.vA)(void 0!==t),r[n.toString()]=t}break;case"message":const s=e.V.T();for(const[i,a]of Object.entries(t)){const t=this.message(s,a,e.name,n);(0,o.vA)(void 0!==t),r[i.toString()]=t}break;case"enum":const i=e.V.T();for(const[s,a]of Object.entries(t)){(0,o.vA)(void 0===a||"number"==typeof a);const t=this.enum(i,a,e.name,!1,!0,n.enumAsInteger);(0,o.vA)(void 0!==t),r[s.toString()]=t}}(n.emitDefaultValues||Object.keys(r).length>0)&&(s=r)}else if(e.repeat){(0,o.vA)(Array.isArray(t));const r=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++){const s=this.scalar(e.T,t[n],e.name,e.opt,!0);(0,o.vA)(void 0!==s),r.push(s)}break;case"enum":const s=e.T();for(let i=0;i<t.length;i++){(0,o.vA)(void 0===t[i]||"number"==typeof t[i]);const a=this.enum(s,t[i],e.name,e.opt,!0,n.enumAsInteger);(0,o.vA)(void 0!==a),r.push(a)}break;case"message":const i=e.T();for(let s=0;s<t.length;s++){const a=this.message(i,t[s],e.name,n);(0,o.vA)(void 0!==a),r.push(a)}}(n.emitDefaultValues||r.length>0||n.emitDefaultValues)&&(s=r)}else switch(e.kind){case"scalar":s=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":s=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":s=this.message(e.T(),t,e.name,n)}return s}enum(e,t,n,s,r,i){if("google.protobuf.NullValue"==e[0])return r||s?null:void 0;if(void 0!==t){if(0!==t||r||s)return(0,o.vA)("number"==typeof t),(0,o.vA)(Number.isInteger(t)),i||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}else(0,o.vA)(s)}message(e,t,n,s){return void 0===t?s.emitDefaultValues?null:void 0:e.internalJsonWrite(t,s)}scalar(e,t,n,a,l){if(void 0===t)return void(0,o.vA)(a);const d=l||a;switch(e){case i.LN.INT32:case i.LN.SFIXED32:case i.LN.SINT32:return 0===t?d?0:void 0:((0,o.bn)(t),t);case i.LN.FIXED32:case i.LN.UINT32:return 0===t?d?0:void 0:((0,o.e1)(t),t);case i.LN.FLOAT:(0,o.wO)(t);case i.LN.DOUBLE:return 0===t?d?0:void 0:((0,o.vA)("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case i.LN.STRING:return""===t?d?"":void 0:((0,o.vA)("string"==typeof t),t);case i.LN.BOOL:return!1===t?!d&&void 0:((0,o.vA)("boolean"==typeof t),t);case i.LN.UINT64:case i.LN.FIXED64:(0,o.vA)("number"==typeof t||"string"==typeof t||"bigint"==typeof t);let e=r.eA.from(t);if(e.isZero()&&!d)return;return e.toString();case i.LN.INT64:case i.LN.SFIXED64:case i.LN.SINT64:(0,o.vA)("number"==typeof t||"string"==typeof t||"bigint"==typeof t);let n=r.hY.from(t);if(n.isZero()&&!d)return;return n.toString();case i.LN.BYTES:return(0,o.vA)(t instanceof Uint8Array),t.byteLength?(0,s.C)(t):d?"":void 0}}}},9511(e,t,n){n.d(t,{l:()=>r});var s=n(743);function r(e,t){switch(t){case s.rO.BIGINT:return e.toBigInt();case s.rO.NUMBER:return e.toNumber();default:return e.toString()}}},3923(e,t,n){function s(e,t,n){let s,r,i=n;for(let n of e.fields){let e=n.localName;if(n.oneof){const o=i[n.oneof];if(null==(null==o?void 0:o.oneofKind))continue;if(s=o[e],r=t[n.oneof],r.oneofKind=o.oneofKind,null==s){delete r[e];continue}}else if(s=i[e],r=t,null==s)continue;switch(n.repeat&&(r[e].length=s.length),n.kind){case"scalar":case"enum":if(n.repeat)for(let t=0;t<s.length;t++)r[e][t]=s[t];else r[e]=s;break;case"message":let t=n.T();if(n.repeat)for(let n=0;n<s.length;n++)r[e][n]=t.create(s[n]);else void 0===r[e]?r[e]=t.create(s):t.mergePartial(r[e],s);break;case"map":switch(n.V.kind){case"scalar":case"enum":Object.assign(r[e],s);break;case"message":let t=n.V.T();for(let n of Object.keys(s))r[e][n]=t.create(s[n])}}}}n.d(t,{x:()=>s})},2799(e,t,n){n.d(t,{V:()=>o});var s=n(743),r=n(9511),i=n(6544);function o(e,t=s.rO.STRING){switch(e){case s.LN.BOOL:return!1;case s.LN.UINT64:case s.LN.FIXED64:return(0,r.l)(i.eA.ZERO,t);case s.LN.INT64:case s.LN.SFIXED64:case s.LN.SINT64:return(0,r.l)(i.hY.ZERO,t);case s.LN.DOUBLE:case s.LN.FLOAT:return 0;case s.LN.BYTES:return new Uint8Array(0);case s.LN.STRING:return"";default:return 0}}},350(e,t,n){n.d(t,{u:()=>i});var s=n(743),r=n(314);class i{constructor(e){var t;this.fields=null!==(t=e.fields)&&void 0!==t?t:[]}prepare(){if(this.data)return;const e=[],t=[],n=[];for(let s of this.fields)if(s.oneof)n.includes(s.oneof)||(n.push(s.oneof),e.push(s.oneof),t.push(s.oneof));else switch(t.push(s.localName),s.kind){case"scalar":case"enum":s.opt&&!s.repeat||e.push(s.localName);break;case"message":s.repeat&&e.push(s.localName);break;case"map":e.push(s.localName)}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(null==e||"object"!=typeof e)return!1;this.prepare();let s=Object.keys(e),i=this.data;if(s.length<i.req.length||i.req.some(e=>!s.includes(e)))return!1;if(!n&&s.some(e=>!i.known.includes(e)))return!1;if(t<1)return!0;for(const s of i.oneofs){const i=e[s];if(!(0,r.Zs)(i))return!1;if(void 0===i.oneofKind)continue;const o=this.fields.find(e=>e.localName===i.oneofKind);if(!o)return!1;if(!this.field(i[i.oneofKind],o,n,t))return!1}for(const s of this.fields)if(void 0===s.oneof&&!this.field(e[s.localName],s,n,t))return!1;return!0}field(e,t,n,r){let i=t.repeat;switch(t.kind){case"scalar":return void 0===e?t.opt:i?this.scalars(e,t.T,r,t.L):this.scalar(e,t.T,t.L);case"enum":return void 0===e?t.opt:i?this.scalars(e,s.LN.INT32,r):this.scalar(e,s.LN.INT32);case"message":return void 0===e||(i?this.messages(e,t.T(),n,r):this.message(e,t.T(),n,r));case"map":if("object"!=typeof e||null===e)return!1;if(r<2)return!0;if(!this.mapKeys(e,t.K,r))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,r,t.V.L);case"enum":return this.scalars(Object.values(e),s.LN.INT32,r);case"message":return this.messages(Object.values(e),t.V.T(),n,r)}}return!0}message(e,t,n,s){return n?t.isAssignable(e,s):t.is(e,s)}messages(e,t,n,s){if(!Array.isArray(e))return!1;if(s<2)return!0;if(n){for(let n=0;n<e.length&&n<s;n++)if(!t.isAssignable(e[n],s-1))return!1}else for(let n=0;n<e.length&&n<s;n++)if(!t.is(e[n],s-1))return!1;return!0}scalar(e,t,n){let r=typeof e;switch(t){case s.LN.UINT64:case s.LN.FIXED64:case s.LN.INT64:case s.LN.SFIXED64:case s.LN.SINT64:switch(n){case s.rO.BIGINT:return"bigint"==r;case s.rO.NUMBER:return"number"==r&&!isNaN(e);default:return"string"==r}case s.LN.BOOL:return"boolean"==r;case s.LN.STRING:return"string"==r;case s.LN.BYTES:return e instanceof Uint8Array;case s.LN.DOUBLE:case s.LN.FLOAT:return"number"==r&&!isNaN(e);default:return"number"==r&&Number.isInteger(e)}}scalars(e,t,n,s){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e))for(let r=0;r<e.length&&r<n;r++)if(!this.scalar(e[r],t,s))return!1;return!0}mapKeys(e,t,n){let r=Object.keys(e);switch(t){case s.LN.INT32:case s.LN.FIXED32:case s.LN.SFIXED32:case s.LN.SINT32:case s.LN.UINT32:return this.scalars(r.slice(0,n).map(e=>parseInt(e)),t,n);case s.LN.BOOL:return this.scalars(r.slice(0,n).map(e=>"true"==e||"false"!=e&&e),t,n);default:return this.scalars(r,t,n,s.rO.STRING)}}}},551(e,t,n){function s(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,{A:()=>s})},4188(e,t,n){function s(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,{A:()=>s})},7767(e,t,n){n.d(t,{A:()=>o});var s=n(4188),r=n(123),i=n(551);function o(e,t){(0,i.A)(2,arguments);var n=(0,r.A)(e).getTime(),o=(0,s.A)(t);return new Date(n+o)}},7894(e,t,n){n.d(t,{A:()=>o});var s=n(4188),r=n(7767),i=n(551);function o(e,t){(0,i.A)(2,arguments);var n=(0,s.A)(t);return(0,r.A)(e,1e3*n)}},7813(e,t,n){n.d(t,{A:()=>i});var s=n(123),r=n(551);function i(e,t){(0,r.A)(2,arguments);var n=(0,s.A)(e),i=(0,s.A)(t);return n.getTime()<i.getTime()}},123(e,t,n){n.d(t,{A:()=>i});var s=n(2284),r=n(551);function i(e){(0,r.A)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===(0,s.A)(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}},7963(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},t.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(e=>0===e.indexOf(n))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const s=e.type;return t.push("typ"),t.push(s),"host"!==s&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const s=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<s.length;e++)n=s[e].trim().split("="),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const s=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?s.push(t+"="+e.parameters[t]):s.push(t)}),t+="a=fmtp:"+n+" "+s.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},s=e.indexOf(":",t);return s>-1?(n.attribute=e.substring(t+1,s),n.value=e.substring(s+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const s=t.matchPrefix(e+n,"a=ice-ufrag:")[0],r=t.matchPrefix(e+n,"a=ice-pwd:")[0];return s&&r?{usernameFragment:s.substring(12),password:r.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},s=t.splitLines(e)[0].split(" ");n.profile=s[2];for(let r=3;r<s.length;r++){const i=s[r],o=t.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){const s=t.parseRtpMap(o),r=t.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=r.length?t.parseFmtp(r[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach(e=>{n.headerExtensions.push(t.parseExtmap(e))});const r=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach(e=>{r.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),n},t.writeRtpDescription=function(e,n){let s="";s+="m="+e+" ",s+=n.codecs.length>0?"9":"0",s+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",s+=n.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",s+="c=IN IP4 0.0.0.0\r\n",s+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach(e=>{s+=t.writeRtpMap(e),s+=t.writeFmtp(e),s+=t.writeRtcpFb(e)});let r=0;return n.codecs.forEach(e=>{e.maxptime>r&&(r=e.maxptime)}),r>0&&(s+="a=maxptime:"+r+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach(e=>{s+=t.writeExtmap(e)}),s},t.parseRtpEncodingParameters=function(e){const n=[],s=t.parseRtpParameters(e),r=-1!==s.fecMechanisms.indexOf("RED"),i=-1!==s.fecMechanisms.indexOf("ULPFEC"),o=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=o.length>0&&o[0].ssrc;let l;const d=t.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));d.length>0&&d[0].length>1&&d[0][0]===a&&(l=d[0][1]),s.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&l&&(t.rtx={ssrc:l}),n.push(t),r&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:i?"red+ulpfec":"red"},n.push(t))}}),0===n.length&&a&&n.push({ssrc:a});let c=t.matchPrefix(e,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substring(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substring(5),10)*.95-16e3:void 0,n.forEach(e=>{e.maxBitrate=c})),n},t.parseRtcpParameters=function(e){const n={},s=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];s&&(n.cname=s.value,n.ssrc=s.ssrc);const r=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=r.length>0,n.compound=0===r.length;const i=t.matchPrefix(e,"a=rtcp-mux");return n.mux=i.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const s=t.matchPrefix(e,"a=msid:");if(1===s.length)return n=s[0].substring(7).split(" "),{stream:n[0],track:n[1]};const r=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return r.length>0?(n=r[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),s=t.matchPrefix(e,"a=max-message-size:");let r;s.length>0&&(r=parseInt(s[0].substring(19),10)),isNaN(r)&&(r=65536);const i=t.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substring(12),10),protocol:n.fmt,maxMessageSize:r};const o=t.matchPrefix(e,"a=sctpmap:");if(o.length>0){const e=o[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,s){let r;const i=void 0!==n?n:2;return r=e||t.generateSessionId(),"v=0\r\no="+(s||"thisisadapterortc")+" "+r+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const s=t.splitLines(e);for(let e=0;e<s.length;e++)switch(s[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return s[e].substring(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const n=t.splitLines(e)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){const n=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const n=t.splitLines(e);for(let e=0;e<n.length;e++)if(n[e].length<2||"="!==n[e].charAt(1))return!1;return!0},e.exports=t},8097(e,t,n){n.d(t,{H:()=>r});var s=n(9307);function r(){const e=s.z.prototype.setWebRtcPlayerController;s.z.prototype.setWebRtcPlayerController=function(t){const n=t.signallingUrlBuilder;t.signallingUrlBuilder=()=>function(e,t){const n=new URL(decodeURIComponent(e())),s=n.searchParams;let r=t;return r&&(r.startsWith("?")&&(r=r.substring(1)),r.split("&").forEach(e=>{const[t,n]=e.split("=");s.set(t,n)})),n.toString()}(n,this.config.urlFlags),e.call(this,t)}}},2886(e,t,n){n.d(t,{g:()=>h});var s=n(1635),r=n(948),i=n(223),o=n(946),a=n(9644),l=n(419),d=n(6460);function c(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch(e){return!1}}r.Vy.InitLogging(2,!1);class h extends i.TS{static PickIdsOfUrl(){const{pathname:e}=new URL(window.location.href),t=e.split("/");return{projectId:t.find(e=>{return"string"==typeof(t=e)&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t);var t}),shareId:t.find(e=>{return"string"==typeof(t=e)&&t.startsWith("share-");var t})}}constructor(e){var t,n,s,r,l,c;if(!new URL(window.location.href).search.slice(1).split("&").find(e=>e.startsWith("df-"))&&!(null===(t=e.settings)||void 0===t?void 0:t.shareId)&&!(null===(n=e.settings)||void 0===n?void 0:n.projectId))throw new Error("ShareId or ProjectId must be specified.");const u=Object.assign(Object.assign({},h.DEFAULT_INITIAL_SETTINGS),null!==(s=e.initialSettings)&&void 0!==s?s:{}),m=Object.assign(Object.assign({},h.DEFAULT_SETTINGS),null!==(r=e.settings)&&void 0!==r?r:{}),g=Object.assign(Object.assign({},h.DEFAULT_CUSTOMIZATION),null!==(l=e.customization)&&void 0!==l?l:{});if(super(Object.assign(Object.assign({},e),{initialSettings:u,settings:m,customization:g})),this.VERSION="1.4.4",this.whiteLabellingChanged=new d.J,this.signallingWlURL="https://signalling-client.arcware.cloud/whiteLabel/",e.envName&&(this.signallingWlURL=`https://signalling-client.${e.envName}.arcware.cloud/whiteLabel/`),this.settings=m,this.customization=g,this.session=new o.N,this._initialSettings=u,this.setFlagEnabled(i.iI.AFKDetection,!0),this.useUrlParams){const e=new URLSearchParams(window.location.search);if(e.has("wl"))if(""!==e.get("wl")){const t=this.useUrlParams?(0,a.a)(e):void 0;t&&(this.settings.whiteLabelling=Object.assign(Object.assign({},null!==(c=this.settings.whiteLabelling)&&void 0!==c?c:{}),t))}else this.settings.fetchRemoteWhiteLabelling=!0;this.settings.infoButton=e.has("i")||e.has("info")}}getWhiteLabelling(e){return(0,s.sH)(this,void 0,void 0,function*(){var t;if(""!==new URLSearchParams(window.location.search).get("wl"))return void d.J.Emit(this.whiteLabellingChanged,{next:null!==(t=this.settings.whiteLabelling)&&void 0!==t?t:{},changed:!1});const n=`${this.signallingWlURL.replace(/\/+$/,"")}/${encodeURIComponent(e)}`,s=new AbortController,r=setTimeout(()=>s.abort(),1e3);try{const e=yield fetch(n,{method:"GET",signal:s.signal,headers:{Accept:"application/json, text/plain"},credentials:"omit"});if(!e.ok)return;const t=yield e.text();if(!t||""===t.trim())return;let r;try{r=JSON.parse(t)}catch(e){return}const i=(0,l.d)(r);if(!i)return;const o=this.settings.whiteLabelling;return this.settings.whiteLabelling=i,d.J.Emit(this.whiteLabellingChanged,{next:i,changed:!c(o,i)}),i}catch(e){return}finally{clearTimeout(r)}})}get urlFlags(){var e;let t="";if(this.settings.shareId&&(t+=`&sh=${this.settings.shareId}`),this.settings.projectId&&(t+=`&p=${this.settings.projectId}`),"string"==typeof this.settings.session)t+=`&s=${this.settings.session}`;else{const e=this.session.id;e&&(t+=`&s=${e}`,t+="&r=true")}this.settings.bypass&&(t+="&b=true"),this.settings.token&&(t+=`&t=${this.settings.token}`);const n=null!==(e=new URLSearchParams(window.location.search).get("rId"))&&void 0!==e?e:void 0;n&&(t+=`&rId=${n}`);const s=new URL(window.location.href).search.slice(1).split("&").find(e=>e.startsWith("df-"));return s&&(t+=`&${s}`),this.settings.startHeight&&this.settings.startHeight>200&&(t+=`&h=${this.settings.startHeight}`),this.settings.startWidth&&this.settings.startWidth>200&&(t+=`&w=${this.settings.startWidth}`),t}get initialSettings(){return this._initialSettings}modifyInitialSettings(e){this.setFlagEnabled(i.iI.HoveringMouseMode,e)}}h.DEFAULT_INITIAL_SETTINGS={ss:"wss://signalling-client.ragnarok.arcware.cloud",AutoConnect:!1,AutoPlayVideo:!0,HoveringMouse:!0,ForceMonoAudio:!1,FakeMouseWithTouches:!1,StartVideoMuted:!0,SuppressBrowserKeys:!0,UseMic:!0,KeyboardInput:!0,MouseInput:!0,TouchInput:!0,GamepadInput:!0,XRControllerInput:!0,AFKTimeout:600},h.DEFAULT_SETTINGS={fullscreenButton:!0,audioButton:!0,stopButton:!1,infoButton:!1,micButton:!1,settingsButton:!1,connectionStrengthIcon:!1,orientationZoom:{landscape:0,portrait:0},whiteLabelling:{},fetchRemoteWhiteLabelling:void 0},h.DEFAULT_CUSTOMIZATION={buttons_position:"Bottom-Right",buttons_orientation:"Vertical",buttons_reverse:!1}},272(e,t,n){n.d(t,{j:()=>s,o:()=>T});var s,r=n(1635),i=n(948),o=n(223),a=n(9307),l=n(8097),d=n(5149),c=n(5428),h=n(6319),u=n(9568),m=n(6151),g=n(2309),p=n(9866),f=n(8536),y=n(6460),v=n(633),b=n(3263),w=n(7506),S=n(7050),C=n(6155);!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(s||(s={}));class T extends a.z{get session(){return this.config.session}get isWsOpen(){var e,t;const n=null===(t=null===(e=this.webRtcController)||void 0===e?void 0:e.transport)||void 0===t?void 0:t.webSocket;return!!n&&n.readyState===WebSocket.OPEN}get websocketState(){var e,t,n;let s=null===(n=null===(t=null===(e=this.webRtcController)||void 0===e?void 0:e.transport)||void 0===t?void 0:t.webSocket)||void 0===n?void 0:n.readyState;return void 0!==s?s:WebSocket.CLOSED}constructor(e,t){var n,s;(0,l.H)(),super(e,t),this.outbox=[],this.videoInitializedSent=!1,this._postInitSideEffectsDone=!1,this.queueHandler=new y.J,this.errorHandler=new y.J,this.loveLetterHandler=new y.J,this.sessionIdHandler=new y.J,this.videoInitializedHandler=new y.J,this.websocketOnCloseHandler=new y.J,this.whiteLabellingChangedHandler=new y.J,this.postInitSideEffectsHandler=new y.J,this.micToggleHandler=new y.J,this.analyticsEventHandler=new y.J,this.fileTransferHandler=new y.J,this.applicationResponseHandler=new y.J,this._rVFCsupported="requestVideoFrameCallback"in HTMLVideoElement.prototype;const i=null===(n=this.webRtcController)||void 0===n?void 0:n.transport;null===(s=null==i?void 0:i.addEventListener)||void 0===s||s.call(i,"open",()=>{this.flushOutbox()}),this.config=e,this.config.whiteLabellingChanged.add(e=>{try{y.J.Emit(this.whiteLabellingChangedHandler,e),this.config.settings.fetchRemoteWhiteLabelling=!1}catch(e){}}),this.config.settings.fetchRemoteWhiteLabelling&&(()=>{(0,r.sH)(this,void 0,void 0,function*(){var e;try{const e=this.config.settings.shareId;e&&(yield this.config.getWhiteLabelling(e))}catch(e){}finally{y.J.Emit(this.whiteLabellingChangedHandler,{next:null!==(e=this.config.settings.whiteLabelling)&&void 0!==e?e:{},changed:!0})}})})(),this.diagnosticsCollector=new S._Z({enableBandwidthProbe:!1}),this.bindTransportEvents(),this.startTransportWatcher(),this.attachFirstRenderedFrameOnce(),this.watchVideoElementReplacement(),this.handleResolutionChange=this.handleResolutionChange.bind(this),this.addMessageHandler("letter",c.Q,this.onLoveLetter),this.addMessageHandler("streamInfo",u.U,this.onStreamInfo),this.addMessageHandler("sessionId",h.B,this.onSessionId),this.addMessageHandler("error",d.x,this.onError),this.addMessageHandler("ping",m.M,this.onPing),this.addMessageHandler("queue",g.D,this.onQueue),this.addMessageHandler("version",p.o,this.onVersion),this.addMessageHandler("render",f.w,this.onRender),this.addResponseEventListener("ue-response",e=>this.handleUEResponse(e));const o=(0,b.A)(()=>{this.handleResolutionChange()},0);this.addEventListener("videoInitialized",this.onVideoInitialized.bind(this)),this.addEventListener("statsReceived",e=>{this.sendStats(e.data.aggregatedStats)}),window.addEventListener("resize",o),this.webRtcController.streamMessageController.registerMessageHandler(0,"TextboxEntry",e=>{try{this.webRtcController.sendMessageController.sendMessageToStreamer("TextboxEntry",e)}catch(e){console.error("Error: ToStreamer.TextboxEntry",e)}}),this.config.settings.errorHandler&&this.errorHandler.add(this.config.settings.errorHandler),this.config.settings.queueHandler&&this.queueHandler.add(this.config.settings.queueHandler),this.config.settings.sessionIdHandler&&this.sessionIdHandler.add(this.config.settings.sessionIdHandler),this.config.settings.loveLetterHandler&&this.loveLetterHandler.add(this.config.settings.loveLetterHandler),this.handleMouseLock()}bindTransportEvents(){var e,t,n,s;const r=null===(e=this.webRtcController)||void 0===e?void 0:e.transport;if(!r||r===this._boundTransport)return;this._boundTransport&&this._onWsOpen&&(null===(n=(t=this._boundTransport).removeEventListener)||void 0===n||n.call(t,"open",this._onWsOpen)),this._onWsOpen||(this._onWsOpen=()=>{this.flushOutbox(),this.attachFirstRenderedFrameOnce(),setTimeout(()=>{var e,t,n;if(!this.videoInitializedSent){const s=null===(n=null===(t=null===(e=this.webRtcController)||void 0===e?void 0:e.videoPlayer)||void 0===t?void 0:t.getVideoElement)||void 0===n?void 0:n.call(t);s&&s.videoWidth>0&&s.videoHeight>0&&s.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(this.sendVideoInitializedOnce(),this.runPostInitSideEffectsOnce())}},1200)}),null===(s=r.addEventListener)||void 0===s||s.call(r,"open",this._onWsOpen);const i=r.webSocket;i&&!this._onWsClose&&(this._onWsClose=e=>{y.J.Emit(this.websocketOnCloseHandler,e)},i.addEventListener("close",this._onWsClose)),this._boundTransport=r}startTransportWatcher(){this._transportWatchTimer||(this._transportWatchTimer=setInterval(()=>{var e;const t=null===(e=this.webRtcController)||void 0===e?void 0:e.transport;t&&t!==this._boundTransport&&this.bindTransportEvents()},3e3))}stopTransportWatcher(){this._transportWatchTimer&&(clearInterval(this._transportWatchTimer),this._transportWatchTimer=void 0)}isRetryableClose(e){var t,n;return!((null!==(n=null!==(t=e.code)&&void 0!==t?t:e.status)&&void 0!==n?n:e.errorCode)>=4e3)}reconnect(){super.reconnect(),this.resetInitGuardsAndHooks()}removePlayer(){var e,t,n,s,r;this.stopTransportWatcher(),this._boundTransport&&(this._onWsOpen&&(null===(t=(e=this._boundTransport).removeEventListener)||void 0===t||t.call(e,"open",this._onWsOpen)),this._onWsClose&&(null===(s=(n=this._boundTransport).removeEventListener)||void 0===s||s.call(n,"close",this._onWsClose))),this.cancelFirstRenderedFrameHook();try{null===(r=this._mo)||void 0===r||r.disconnect()}catch(e){}this.disconnect()}onVersion(e){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;let n;try{n=yield this.diagnosticsCollector.collect()}catch(n){null===(e=i.Vy.Warning)||void 0===e||e.call(i.Vy,`Diagnostics collection failed: ${null!==(t=null==n?void 0:n.message)&&void 0!==t?t:n}`)}finally{const e={type:"version",version:this.config.VERSION};void 0!==n&&(e.diagnostics=n),this.send(e)}})}addMessageHandler(e,t,n){this.signallingProtocol.addListener(e,s=>{var r,o;let a;try{a=t(s)}catch(t){return void(null===(r=i.Vy.Error)||void 0===r||r.call(i.Vy,`Unexpected message content. Event:'${e}', Error: ${null!==(o=null==t?void 0:t.message)&&void 0!==o?o:t}`))}n.call(this,a)})}_dispatchOrBuffer(e){if(this.isWsOpen)try{return void this.signallingProtocol.sendMessage(e)}catch(e){}this.outbox.push(e)}flushOutbox(){if(!this.isWsOpen||0===this.outbox.length)return;const e=this.outbox.splice(0,this.outbox.length);for(const t of e)try{this.signallingProtocol.sendMessage(t)}catch(n){this.outbox.unshift(t,...e.slice(e.indexOf(t)+1));break}}sendStats(e){const t={type:"stats",stats:(0,v.U)(e)};this.send(t)}onPing(e){var t,n;this.config.isFlagEnabled("HoveringMouse")!==!(null===(n=null===(t=null==this?void 0:this.streamInfo)||void 0===t?void 0:t.streamInfo.meta)||void 0===n?void 0:n.mouseLock)&&this.handleMouseLock(),this.session.current&&this.session.set(this.session.current)}onStreamInfo(e){var t,n,s,r;if(i.Vy.Info("StreamInfo received."),this.streamInfo=e,!(null===(n=null===(t=this.config)||void 0===t?void 0:t.settings)||void 0===n?void 0:n["do-not-eval-streamInfo"])){const{afk:t}=e.streamInfo;t&&(this.config.setFlagEnabled(o.iI.AFKDetection,t.enabled),this.config.setNumericSetting(o.k$.AFKTimeoutSecs,t.warn),this.config.setNumericSetting(o.k$.AFKCountdownSecs,t.action)),(null===(s=e.streamInfo.webSdkSettings)||void 0===s?void 0:s.init)&&this.config.setSettings(e.streamInfo.webSdkSettings.init),(null===(r=e.streamInfo.webSdkSettings)||void 0===r?void 0:r.conf)&&Object.entries(e.streamInfo.webSdkSettings.conf).forEach(([e,t])=>{const n=e;this.config.settings[n]=t})}this.handleMouseLock()}onRender(e){return(0,r.sH)(this,void 0,void 0,function*(){const e={type:"render",isRendering:yield this.waitForFirstFrameWithTimeout()};this.send(e)})}onQueue(e){i.Vy.Info("QueueInfo received."),y.J.Emit(this.queueHandler,e)}onError(e){var t,n;if(i.Vy.Error(e.type),console.log(e),this.isRetryableClose(e))this.startTransportWatcher();else{try{null===(n=null===(t=this.webRtcController)||void 0===t?void 0:t.closeSignalingServer)||void 0===n||n.call(t,e.reason,!1)}catch(e){}this.stopTransportWatcher()}y.J.Emit(this.errorHandler,e)}onSessionId(e){i.Vy.Info(e.sessionId),this.session.set(e.sessionId),y.J.Emit(this.sessionIdHandler,e.sessionId)}onLoveLetter(e){this.config.settings.loveLetterLogging&&console.info(e.reason),y.J.Emit(this.loveLetterHandler,e)}send(e,t){const n="string"==typeof e?Object.assign({type:e},null!=t?t:{}):e;this._dispatchOrBuffer(n)}handleUEResponse(e){let t;try{t=(0,C.Yr)(e,{allowJsonish:!0})}catch(t){return void y.J.Emit(this.applicationResponseHandler,e)}const n=(0,C.AZ)(t.type);"event"!==n?"filetransfer"!==n&&"createscreenshot"!==n?y.J.Emit(this.applicationResponseHandler,e):y.J.Emit(this.fileTransferHandler,{filename:t.filename}):this.handleAnalyticsFromUnreal(t)}sendAnalyticsEvent(e){const t=(0,w.Q)(e,{maxPayloadBytes:512,allowJsonish:!0});t.ok?this._dispatchAnalytics(t.value):console.warn("Invalid AnalyticsEvent:",e)}handleAnalyticsFromUnreal(e){const t=(0,w.Q)(e,{maxPayloadBytes:512,allowJsonish:!0});t.ok?this._dispatchAnalytics(t.value):console.warn("Invalid AnalyticsEvent from Unreal:",e)}_dispatchAnalytics(e){this.send(e),y.J.Emit(this.analyticsEventHandler,e)}getIncomingFile(){const e=this.webRtcController;return null==e?void 0:e.file}fileDownload(e){if("undefined"==typeof window||"undefined"==typeof document)return;const t=this.getIncomingFile();if(t&&t.data&&t.mimetype)try{const n=(0,C.gX)(t.mimetype),s=(e&&e.trim()?(0,C.Nz)(e):(0,C.i$)())+n,r=t.data.map(e=>e.slice()),i=new Blob(r,{type:t.mimetype});if("undefined"==typeof URL||!URL.createObjectURL)return;const o=URL.createObjectURL(i),a=document.createElement("a");a.href=o,a.download=s,a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>{try{URL.revokeObjectURL(o)}catch(e){}},0)}catch(e){console.error("Download failed:",e)}}attachFirstRenderedFrameOnce(){var e,t,n,s;const r=null===(n=null===(t=null===(e=this.webRtcController)||void 0===e?void 0:e.videoPlayer)||void 0===t?void 0:t.getVideoElement)||void 0===n?void 0:n.call(t);if(!r)return;if(this._rVFCArmedForElement===r)return;if(this.cancelFirstRenderedFrameHook(),this._rVFCArmedForElement=r,this._rVFCsupported){const e=r;this._rvfcHandle=null===(s=e.requestVideoFrameCallback)||void 0===s?void 0:s.call(e,(e,t)=>{this.sendVideoInitializedOnce(),this.runPostInitSideEffectsOnce(),this._rvfcHandle=void 0})}const i=()=>{r.removeEventListener("resize",i),this.sendVideoInitializedOnce(),this.runPostInitSideEffectsOnce()};r.addEventListener("resize",i,{once:!0})}cancelFirstRenderedFrameHook(){var e;const t=this._rVFCArmedForElement;if(t){if(this._rvfcHandle&&"cancelVideoFrameCallback"in HTMLVideoElement.prototype){const n=t;try{null===(e=n.cancelVideoFrameCallback)||void 0===e||e.call(n,this._rvfcHandle)}catch(e){}}this._rvfcHandle=void 0,this._rVFCArmedForElement=void 0}}watchVideoElementReplacement(){var e,t,n,s;try{const r=null===(n=null===(t=null===(e=null==this?void 0:this.webRtcController)||void 0===e?void 0:e.videoPlayer)||void 0===t?void 0:t.getVideoParentElement)||void 0===n?void 0:n.call(t);if(!r)return;null===(s=this._mo)||void 0===s||s.disconnect(),this._mo=new MutationObserver(()=>{this.attachFirstRenderedFrameOnce()}),this._mo.observe(r,{childList:!0,subtree:!0})}catch(e){}}waitForFirstFrameWithTimeout(){return(0,r.sH)(this,arguments,void 0,function*(e=2e3){var t,n,s;const r=null===(s=null===(n=null===(t=this.webRtcController)||void 0===t?void 0:t.videoPlayer)||void 0===n?void 0:n.getVideoElement)||void 0===s?void 0:s.call(n);if(this.isVideoRenderingNow(r))return!0;let i;const o=yield Promise.race([new Promise(e=>{var t,n;const s=()=>{i(),e(!0)},i=()=>{var e,t;r.removeEventListener("playing",o),r.removeEventListener("resize",a),"cancelVideoFrameCallback"in HTMLVideoElement.prototype&&null!=l&&(null===(t=(e=r).cancelVideoFrameCallback)||void 0===t||t.call(e,l))},o=()=>this.isVideoRenderingNow(r)&&s(),a=()=>this.isVideoRenderingNow(r)&&s();r.addEventListener("playing",o,{once:!0}),r.addEventListener("resize",a,{once:!0});const l="requestVideoFrameCallback"in HTMLVideoElement.prototype?null===(n=(t=r).requestVideoFrameCallback)||void 0===n?void 0:n.call(t,()=>s()):null}),new Promise(t=>{i=setTimeout(()=>t(!1),e)})]);return i&&clearTimeout(i),o})}isVideoRenderingNow(e){if(!e)return!1;const t=e.videoWidth>0&&e.videoHeight>0,n=e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA,s=!e.paused&&!e.ended;return t&&n||t&&s||n&&s}sendVideoInitializedOnce(){this.videoInitializedSent||(this.videoInitializedSent=!0,this.cancelFirstRenderedFrameHook(),this.send({type:"onVideoInitialized"}),this.videoInitializedHandler&&y.J.Emit(this.videoInitializedHandler,void 0))}onVideoInitialized(){this.videoInitializedSent||this.sendVideoInitializedOnce(),this.runPostInitSideEffectsOnce()}handleResolutionChange(){var e,t,n,s,r,i,o,a;if(!(null==this?void 0:this.streamInfo)||!(null==this?void 0:this.webRtcController)||!(null===(t=null===(e=null==this?void 0:this.webRtcController)||void 0===e?void 0:e.videoPlayer)||void 0===t?void 0:t.getVideoElement()))return;const l=null===(s=null===(n=null==this?void 0:this.streamInfo)||void 0===n?void 0:n.streamInfo)||void 0===s?void 0:s.resolution,d=null===(o=null===(i=null===(r=null==this?void 0:this.streamInfo)||void 0===r?void 0:r.streamInfo)||void 0===i?void 0:i.meta)||void 0===o?void 0:o.version,c=null===(a=this.config.settings)||void 0===a?void 0:a.orientationZoom;l&&(null==l?void 0:l.dynamic)&&setTimeout(()=>{const{videoPlayer:e}=null==this?void 0:this.webRtcController,t=null==e?void 0:e.getVideoParentElement();if(!t)return;const n=t.getBoundingClientRect(),s=n.width,r=n.height,i=null==l?void 0:l.width,o=null==l?void 0:l.height;if(!s||!r)return;const a=s/r;let h,u;if(a>i/o?(h=i,u=i/a):(u=o,h=o*a),c&&(s<r?c.hasOwnProperty("portrait")&&(null==this||this.emitUIInteraction({zoom:c.portrait})):c.hasOwnProperty("landscape")&&(null==this||this.emitUIInteraction({zoom:c.landscape}))),e)if(!d||(null==d?void 0:d.startsWith("4.27"))){const e={Console:`r.setres ${Math.round(h)}x${Math.round(u)}w`};null==this||this.emitUIInteraction(e)}else e.onMatchViewportResolutionCallback(Math.round(h),Math.round(u))},0)}handleMouseLock(){var e,t,n;null===(e=null==this?void 0:this.config)||void 0===e||e.modifyInitialSettings(!(null===(n=null===(t=null==this?void 0:this.streamInfo)||void 0===t?void 0:t.streamInfo.meta)||void 0===n?void 0:n.mouseLock))}setAudioEnabled(e){var t,n,s,r;const i=null===(s=null===(n=null===(t=this.webRtcController)||void 0===t?void 0:t.videoPlayer)||void 0===n?void 0:n.getVideoElement)||void 0===s?void 0:s.call(n),o=null===(r=this.webRtcController)||void 0===r?void 0:r.streamController;if(!i)return;const a=!e;i.muted=a,(null==o?void 0:o.audioElement)&&(o.audioElement.muted=a,e&&i.currentTime>0&&!i.paused&&o.audioElement.paused&&o.audioElement.play().catch(()=>{}))}resetInitGuardsAndHooks(){this.videoInitializedSent=!1,this._postInitSideEffectsDone=!1,this.cancelFirstRenderedFrameHook(),this.attachFirstRenderedFrameOnce(),this.bindTransportEvents()}static clearSessionId(){"undefined"!=typeof localStorage&&localStorage.removeItem("pxss")}runPostInitSideEffectsOnce(){var e,t;if(!this._postInitSideEffectsDone){this._postInitSideEffectsDone=!0;try{null===(e=this.handleMouseLock)||void 0===e||e.call(this)}catch(e){}try{null===(t=this.handleResolutionChange)||void 0===t||t.call(this)}catch(e){}y.J.Emit(this.postInitSideEffectsHandler,void 0)}}toggleAudio(e,t){var n,s;const{streamController:r}=this.webRtcController;e&&(e.muted=t,r&&(r.audioElement.muted=t,(null==e?void 0:e.currentTime)>0&&!(null==e?void 0:e.paused)&&(null===(n=null==r?void 0:r.audioElement)||void 0===n?void 0:n.paused)&&(null===(s=null==r?void 0:r.audioElement)||void 0===s||s.play())))}toggleMic(e,t){var n;null===(n=null==this?void 0:this.config)||void 0===n||n.setFlagEnabled(o.iI.UseMic,e),t||(y.J.Emit(this.micToggleHandler,{enabled:e}),setTimeout(()=>{this.videoInitializedSent=!1,this.attachFirstRenderedFrameOnce(),this.bindTransportEvents(),this.reconnect()},1e3))}onStreamingStateChange(e){var t,n,s,r;const i=null===(n=null===(t=null==this?void 0:this.webRtcController)||void 0===t?void 0:t.videoPlayer)||void 0===n?void 0:n.getVideoElement();null==i||i.addEventListener("play",()=>e(!0)),null==i||i.addEventListener("pause",()=>e(!1)),null==i||i.addEventListener("ended",()=>e(!1)),null===(s=this.webRtcController)||void 0===s||s.transport.addEventListener("open",()=>{e(!0)}),null===(r=this.webRtcController)||void 0===r||r.transport.addEventListener("close",()=>{e(!1)})}}},6689(e,t,n){n.d(t,{J:()=>a});var s=n(272);let r=null,i=null,o=null;function a(e,t,n){var a,l,d,c;const h=!0===(null==n?void 0:n.forceRefresh),u=!0===(null==n?void 0:n.allowMultipleInstances),m=`${null!==(l=null===(a=e.settings)||void 0===a?void 0:a.shareId)&&void 0!==l?l:""}|${null!==(c=null===(d=e.settings)||void 0===d?void 0:d.projectId)&&void 0!==c?c:""}`;if(u)return{PixelStreaming:new s.o(e,t),Config:e};if(o&&o!==m&&r&&(r.disconnect(),r=null,i=null),r&&!h)return console.warn("CoreSetup: Reusing existing stream instance."),{PixelStreaming:r,Config:i};h&&r&&(r.disconnect(),r=null,i=null);const g=new s.o(e,t);return r=g,i=e,o=m,{PixelStreaming:g,Config:e}}},5149(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("ErrorMessage must be an object");const t=e;if("error"!==t.type)throw new Error(`Invalid ErrorMessage type: ${t.type}`);const n=t.code;if("number"!=typeof n||!Number.isInteger(n))throw new Error("ErrorMessage.code must be an integer");const s=t.reason;if("string"!=typeof s)throw new Error("ErrorMessage.reason must be a string");const r=t.verbosity;if("number"!=typeof r)throw new Error("ErrorMessage.verbosity must be a number");return{type:"error",code:n,reason:s,verbosity:r}}n.d(t,{x:()=>s})},5428(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("LoveLetter must be an object");const t=e;if("letter"!==t.type)throw new Error(`Invalid LoveLetter type: ${t.type}`);const n=t.reason;if("string"!=typeof n||!n.startsWith("LL: "))throw new Error("LoveLetter.reason must be a string starting with 'LL: '");const s=t.code;if("number"!=typeof s)throw new Error("LoveLetter.code must be a number");const r=t.verbosity;if("number"!=typeof r)throw new Error("LoveLetter.verbosity must be a number");return{type:"letter",reason:n,code:s,verbosity:r}}n.d(t,{Q:()=>s})},6151(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("Ping message must be an object");const t=e;if("ping"!==t.type)throw new Error(`Invalid Ping.type: ${t.type}`);const n=t.time;if("number"!=typeof n)throw new Error("Ping.time must be a number");const s=t.message;if(void 0!==s&&"string"!=typeof s)throw new Error("Ping.message must be a string if present");return Object.assign({type:"ping",time:n},"string"==typeof s?{message:s}:{})}n.d(t,{M:()=>s})},2309(e,t,n){function s(e){return"object"==typeof e&&null!==e}function r(e){return"number"==typeof e&&Number.isInteger(e)}function i(e){return"number"==typeof e}function o(e){if(!s(e))throw new Error("Queue message must be an object");if("queue"!==e.type)throw new Error(`Invalid Queue.type: ${e.type}`);const t=e.queue;if(!s(t))throw new Error("Queue.queue must be an object");const n=t.valueType;if("milliseconds"!==(o=n)&&"seconds"!==o&&"minutes"!==o&&"hours"!==o&&"days"!==o)throw new Error("Queue.queue.valueType must be one of milliseconds|seconds|minutes|hours|days");var o;const a={valueType:n},l=t.index;if(void 0!==l){if(!r(l))throw new Error("Queue.queue.index must be an integer if present");a.index=l}const d=t.queueLength;if(void 0!==d){if(!r(d))throw new Error("Queue.queue.queueLength must be an integer if present");a.queueLength=d}const c=t.waited;if(void 0!==c){if(!i(c))throw new Error("Queue.queue.waited must be a number if present");a.waited=c}const h=t.estimatedWaitTime;if(void 0!==h){if(null!==h&&!i(h))throw new Error("Queue.queue.estimatedWaitTime must be a number or null if present");a.estimatedWaitTime=h}const u=t.averageWaitTime;if(void 0!==u){if(null!==u&&!i(u))throw new Error("Queue.queue.averageWaitTime must be a number or null if present");a.averageWaitTime=u}return{type:"queue",queue:a}}n.d(t,{D:()=>o})},8536(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("Render message must be an object");const t=e;if("render"!==t.type)throw new Error(`Invalid Render.type: ${t.type}`);return{type:"render"}}n.d(t,{w:()=>s})},6319(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("SessionId message must be an object");const t=e;if("sessionId"!==t.type)throw new Error(`Invalid SessionId.type: ${t.type}`);const n=t.sessionId;if("string"!=typeof n)throw new Error("SessionId.sessionId must be a string");return{type:"sessionId",sessionId:n}}n.d(t,{B:()=>s})},393(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("Stats message must be an object");const t=e;if("stats"!==t.type)throw new Error(`Invalid Stats.type: ${t.type}`);const n=t.stats;if(void 0!==n&&("object"!=typeof n||null===n))throw new Error("Stats.stats must be an object if present");const s=null==n?void 0:n.controlsStreamInput;if(void 0!==s&&"true"!==s&&"false"!==s)throw new Error("Stats.stats.controlsStreamInput must be 'true' or 'false'");return{type:"stats",stats:n}}n.d(t,{B:()=>s})},9568(e,t,n){n.d(t,{U:()=>l});var s=n(7335);function r(e){return"object"==typeof e&&null!==e}function i(e){return"boolean"==typeof e}function o(e){return"string"==typeof e}function a(e){return"number"==typeof e&&Number.isInteger(e)&&e>=0}function l(e){const t="string"==typeof e?(()=>{try{return JSON.parse(e)}catch(e){throw new Error("StreamInfo payload is not valid JSON")}})():e;if(!r(t))throw new Error("StreamInfo must be an object");if("streamInfo"!==t.type)throw new Error(`Invalid StreamInfo.type: ${t.type}`);const n=t.streamInfo;if(!r(n))throw new Error("StreamInfo.streamInfo must be an object");const l=n.guid;if(!o(l)||0===l.length)throw new Error("StreamInfo.streamInfo.guid must be a non-empty string");const d={type:"streamInfo",streamInfo:{guid:l}};i(n.autoPlay)&&(d.streamInfo.autoPlay=n.autoPlay),i(n.touchCapable)&&(d.streamInfo.touchCapable=n.touchCapable);const c=n.resolution;if(void 0!==c){if(!r(c))throw new Error("StreamInfo.streamInfo.resolution must be an object if present");if(!a(c.width))throw new Error("StreamInfo.streamInfo.resolution.width must be a non-negative int");if(!a(c.height))throw new Error("StreamInfo.streamInfo.resolution.height must be a non-negative int");d.streamInfo.resolution={width:c.width,height:c.height},i(c.dynamic)&&(d.streamInfo.resolution.dynamic=c.dynamic),i(c.fixed)&&(d.streamInfo.resolution.fixed=c.fixed)}const h=n.meta;if(void 0!==h){if(!r(h))throw new Error("StreamInfo.streamInfo.meta must be an object if present");const e={};o(h.friendlyName)&&(e.friendlyName=h.friendlyName),i(h.isTrial)&&(e.isTrial=h.isTrial),i(h.mouseLock)&&(e.mouseLock=h.mouseLock),i(h.poweredBy)&&(e.poweredBy=h.poweredBy),o(h.version)&&(e.version=h.version),d.streamInfo.meta=e}const u=n.webSdkSettings;void 0!==u&&(d.streamInfo.webSdkSettings=(0,s.Z)(u));const m=n.afk;if(void 0!==m){if(!r(m))throw new Error("StreamInfo.streamInfo.afk must be an object if present");if(!i(m.enabled))throw new Error("StreamInfo.streamInfo.afk.enabled must be boolean");if(!a(m.warn))throw new Error("StreamInfo.streamInfo.afk.warn must be a non-negative int");if(!a(m.error))throw new Error("StreamInfo.streamInfo.afk.error must be a non-negative int");if(!a(m.action))throw new Error("StreamInfo.streamInfo.afk.action must be a non-negative int");d.streamInfo.afk={enabled:m.enabled,warn:m.warn,error:m.error,action:m.action}}return d}},9866(e,t,n){function s(e){if("object"!=typeof e||null===e)throw new Error("Version message must be an object");const t=e;if("version"!==t.type)throw new Error(`Invalid Version.type: ${t.type}`);const n=t.version;if(void 0!==n&&"string"!=typeof n)throw new Error("Version.version must be a string if present");return Object.assign({type:"version"},"string"==typeof n?{version:n}:{})}n.d(t,{o:()=>s})},7335(e,t,n){function s(e){return"object"==typeof e&&null!==e}function r(e){return"boolean"==typeof e}function i(e){return"string"==typeof e}function o(e){if(!s(e))throw new Error("WebSdkSettings must be an object");const t={},n=e.conf;if(void 0!==n){if(!s(n))throw new Error("WebSdkSettings.conf must be an object if present");const e={};r(n.fullscreenButton)&&(e.fullscreenButton=n.fullscreenButton),r(n.stopButton)&&(e.stopButton=n.stopButton),r(n.audioButton)&&(e.audioButton=n.audioButton),r(n.infoButton)&&(e.infoButton=n.infoButton),r(n.micButton)&&(e.micButton=n.micButton),r(n.settingsButton)&&(e.settingsButton=n.settingsButton),r(n.connectionStrengthIcon)&&(e.connectionStrengthIcon=n.connectionStrengthIcon),t.conf=e}const o=e.init;if(void 0!==o){if(!s(o))throw new Error("WebSdkSettings.init must be an object if present");const e={};r(o.KeyboardInput)&&(e.KeyboardInput=o.KeyboardInput),r(o.MouseInput)&&(e.MouseInput=o.MouseInput),r(o.GamepadInput)&&(e.GamepadInput=o.GamepadInput),r(o.TouchInput)&&(e.TouchInput=o.TouchInput),r(o.XRControllerInput)&&(e.XRControllerInput=o.XRControllerInput),r(o.FakeMouseWithTouches)&&(e.FakeMouseWithTouches=o.FakeMouseWithTouches),r(o.ForceMonoAudio)&&(e.ForceMonoAudio=o.ForceMonoAudio),r(o.HoveringMouse)&&(e.HoveringMouse=o.HoveringMouse),t.init=e}const a=e.customization;if(void 0!==a){if(!s(a))throw new Error("WebSdkSettings.customization must be an object if present");const e={},n=a.buttons_position;if(void 0!==n){if(!i(n)||!["Top-Left","Top-Right","Bottom-Left","Bottom-Right"].includes(n))throw new Error("customization.buttons_position must be one of: Top-Left, Top-Right, Bottom-Left, Bottom-Right");e.buttons_position=n}const o=a.buttons_orientation;if(void 0!==o){if(!i(o)||!["Horizontal","Vertical"].includes(o))throw new Error("customization.buttons_orientation must be one of: Horizontal, Vertical");e.buttons_orientation=o}const l=a.buttons_reverse;if(void 0!==l){if(!r(l))throw new Error("customization.buttons_reverse must be a boolean");e.buttons_reverse=l}t.customization=e}return t}n.d(t,{Z:()=>o})},6246(e,t,n){n.d(t,{B2:()=>i.B,BN:()=>a.B,DY:()=>d.D,Mr:()=>l.M,Ql:()=>r.Q,U3:()=>o.U,Vn:()=>m,ZB:()=>h.Z,ot:()=>c.o,wL:()=>u.w,xI:()=>s.x});var s=n(5149),r=n(5428),i=n(6319),o=n(9568),a=n(393),l=n(6151),d=n(2309),c=n(9866),h=n(7335),u=n(8536);const m={stats:{parse:a.B}}},6460(e,t,n){n.d(t,{J:()=>s});class s{add(e){return this.callbacks.find(t=>t===e)?null:(this.callbacks.push(e),e)}remove(e){const t=this.callbacks.find(t=>t===e);return t&&this.callbacks.splice(this.callbacks.indexOf(t),1),!!t}constructor(){this.callbacks=new Array}static Emit(e,t){e.callbacks.forEach(e=>e(t))}}},946(e,t,n){n.d(t,{N:()=>o});var s=n(7894),r=n(7813);function i(e){return"string"==typeof e&&e.length>0}class o{get current(){return this._current}get noSession(){return new URLSearchParams(window.location.search).has("noSession")}get id(){if(this.noSession)return null;const e=this.readSessionString();if(null===e)return null;let t;try{t=JSON.parse(e)}catch(e){return this.unset(),null}const n=function(e){if("object"!=typeof e||null===e)return;const t=e;for(const e of Object.keys(t))if("id"!==e&&"created"!==e&&"expire"!==e)return;if(!i(t.id))return;const n=function(e){if(e instanceof Date&&!isNaN(e.getTime()))return e;if("string"==typeof e){const t=new Date(e);if(!isNaN(t.getTime()))return t}}(t.created);if(!n)return;const s=void 0===t.expire?void 0:"boolean"==typeof t.expire?t.expire:void 0;return{id:t.id,created:n,expire:s}}(t);if(!n)return this.unset(),null;const o=(0,s.A)(new Date(n.created),this.options.keepSession);return(0,r.A)(o,new Date)?(this.unset(),null):n.id}get localStorageKey(){return this.options.localStorageKey}constructor(e){this.options=function(e){return{localStorageKey:"string"==typeof(null==e?void 0:e.localStorageKey)&&e.localStorageKey.length>=3?e.localStorageKey:"pxss",keepSession:"number"==typeof(null==e?void 0:e.keepSession)&&Number.isInteger(e.keepSession)&&e.keepSession>=3?e.keepSession:10}}(e)}set(e){if(!i(e))throw new Error("Session id must be a non-empty string");this._current=e;const t={id:e,created:new Date,expire:!1};this.writeSessionString(JSON.stringify(t))}unset(){try{window.localStorage.removeItem(this.localStorageKey)}catch(e){}try{window.sessionStorage.removeItem(this.localStorageKey)}catch(e){}}readSessionString(){try{const e=window.localStorage.getItem(this.localStorageKey);if(null!==e)return e}catch(e){}try{return window.sessionStorage.getItem(this.localStorageKey)}catch(e){}return null}writeSessionString(e){let t=!1;try{window.localStorage.setItem(this.localStorageKey,e),t=!0}catch(e){}if(!t)try{window.sessionStorage.setItem(this.localStorageKey,e),t=!0}catch(e){}}}},633(e,t,n){function s(e){return{codecs:e.codecs,candidatePair:e.candidatePairs,localCandidates:e.localCandidates,remoteCandidates:e.remoteCandidates,DataChannelStats:e.datachannelStats,bytesReceived:i(e.inboundVideoStats.bytesReceived),packetsLost:i(e.inboundVideoStats.packetsLost),frameWidth:i(e.inboundVideoStats.frameWidth),frameHeight:i(e.inboundVideoStats.frameHeight),framesDecoded:i(e.inboundVideoStats.framesDecoded),framesPerSecond:i(e.inboundVideoStats.framesPerSecond),framesDropped:i(e.inboundVideoStats.framesDropped),videoCodec:e.inboundVideoStats.codecId,audioCodec:e.inboundAudioStats.codecId,browserInfo:{userAgent:navigator.userAgent,platform:navigator.oscpu||navigator.platform||null,language:navigator.language},currentRTT:r(e.candidatePairs),sessionRunTime:e.sessionStats.runTime,controlsStreamInput:"true"===e.sessionStats.controlsStreamInput||"false"===e.sessionStats.controlsStreamInput?e.sessionStats.controlsStreamInput:void 0,videoEncoderAvgQP:i(e.sessionStats.videoEncoderAvgQP),videoBitrate:i(e.inboundVideoStats.bitrate),audioBitrate:i(e.inboundAudioStats.bitrate)}}function r(e){let t=0;for(const n of e)n.selected&&n.currentRoundTripTime>t&&(t=n.currentRoundTripTime);return t}function i(e){return"number"==typeof e&&Number.isFinite(e)?e:0}n.d(t,{U:()=>s})},3263(e,t,n){function s(e,t){let n;return function(...s){clearTimeout(n),n=window.setTimeout(()=>e(...s),t)}}n.d(t,{A:()=>s})},7506(e,t,n){n.d(t,{Q:()=>r});var s=n(6155);function r(e,t={}){var n,r,o;const a=null!==(n=t.maxPayloadBytes)&&void 0!==n?n:512;let l;try{l=(0,s.Yr)(e,{allowJsonish:null===(r=t.allowJsonish)||void 0===r||r})}catch(e){return{ok:!1,error:null!==(o=null==e?void 0:e.message)&&void 0!==o?o:"Invalid input"}}const d=i(l.type),c=i(l.customName);if(!d)return{ok:!1,error:"`type` must be a non-empty string."};if(!c)return{ok:!1,error:"`customName` must be a non-empty string."};let h;return"payload"in l&&"string"==typeof l.payload&&(h=(0,s.HJ)(l.payload,a)),{ok:!0,value:void 0!==h?{type:d,customName:c,payload:h}:{type:d,customName:c}}}function i(e){if("string"!=typeof e)return;const t=e.trim();return t.length?t:void 0}},7050(e,t,n){n.d(t,{_Z:()=>o});var s,r,i=n(1635);!function(e){e.Landscape="landscape",e.Portrait="portrait"}(s||(s={})),function(e){e.Desktop="desktop",e.Mobile="mobile",e.Tablet="tablet"}(r||(r={}));class o{constructor(e={}){var t,n,s,r;this.uaInfoCache=null,this.opts={enableBandwidthProbe:null===(t=e.enableBandwidthProbe)||void 0===t||t,probeUrl:null!==(n=e.probeUrl)&&void 0!==n?n:"/diag/probe.bin",respectSaveData:null===(s=e.respectSaveData)||void 0===s||s,sampleRate:Math.max(0,Math.min(1,null!==(r=e.sampleRate)&&void 0!==r?r:1))}}collect(){return(0,i.sH)(this,void 0,void 0,function*(){var e,t;if(!this.shouldSample())return{device:{type:r.Desktop,touchSupport:!1},runtime:{browser:{family:"Unknown",version:null},os:{family:"Unknown",version:null}},powerHints:{saveData:null,prefersReducedData:null,prefersReducedMotion:null},network:{type:null,effectiveType:null,downlinkMbps:null,rttMs:null,measuredDownlinkMbps:null},timestamps:{collectedAt:Date.now()}};const n=Date.now(),[s,i,o]=yield Promise.all([this.getUAInfo(),this.getCodecSupport(),this.maybeMeasureBandwidth()]);return{device:{type:this.inferDeviceType(),vendor:null,model:s.model,architecture:s.architecture,bitness:s.bitness,touchSupport:this.hasTouch(),hardwareConcurrency:null!==(e=navigator.hardwareConcurrency)&&void 0!==e?e:null,deviceMemory:null!==(t=navigator.deviceMemory)&&void 0!==t?t:null,orientation:this.getOrientation(),webgl:this.hasWebGL(),codecs:i},runtime:{browser:{family:s.browserFamily,version:s.browserVersion},os:{family:s.osFamily,version:s.osVersion}},powerHints:this.getPowerHints(),network:this.getNetworkInfo(o),timestamps:{collectedAt:n}}})}collectWebRTC(e){return(0,i.sH)(this,void 0,void 0,function*(){var t,n,s,r,i,o;try{const a=yield e.getStats();let l,d,c,h;return a.forEach(e=>{"transport"===e.type&&e.selectedCandidatePairId&&(d=e),"candidate-pair"===e.type&&(e.selected||e.nominated)&&(l=e)}),l&&(c=a.get(l.localCandidateId),h=a.get(l.remoteCandidateId)),{candidatePairId:null!==(t=null==l?void 0:l.id)&&void 0!==t?t:null,localCandidateType:null!==(n=null==c?void 0:c.candidateType)&&void 0!==n?n:null,remoteCandidateType:null!==(s=null==h?void 0:h.candidateType)&&void 0!==s?s:null,protocol:null!==(r=null==c?void 0:c.protocol)&&void 0!==r?r:null,networkType:null!==(i=null==c?void 0:c.networkType)&&void 0!==i?i:null,dtlsCipher:null!==(o=null==d?void 0:d.dtlsCipher)&&void 0!==o?o:null}}catch(e){return{}}})}buildHelloEnvelope(e,t){return(0,i.sH)(this,void 0,void 0,function*(){const n=yield this.collect(),s=t?yield this.collectWebRTC(t):void 0,r=s?{diag:Object.assign(Object.assign({},n),{webrtc:s})}:{diag:n};return Object.assign(Object.assign({},e),{ext:r})})}shouldSample(){return this.opts.sampleRate>=1||Math.random()<this.opts.sampleRate}hasTouch(){var e;const t=navigator;return"ontouchstart"in window||(null!==(e=t.maxTouchPoints)&&void 0!==e?e:0)>0}getOrientation(){var e;try{if(null===(e=screen.orientation)||void 0===e?void 0:e.type)return screen.orientation.type.startsWith("portrait")?s.Portrait:s.Landscape;if(window.matchMedia)return window.matchMedia("(orientation: portrait)").matches?s.Portrait:s.Landscape}catch(e){}return null}hasWebGL(){try{const e=document.createElement("canvas");return!(!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}}inferDeviceType(){const e=navigator.userAgentData,t=navigator.userAgent||"",n=!0===(null==e?void 0:e.mobile),s=Math.min(screen.width,screen.height);return/\b(iPad|Tablet)\b/i.test(t)?r.Tablet:n?s>=600?r.Tablet:r.Mobile:/\b(iPhone|Android.*Mobile|Windows Phone)\b/i.test(t)?r.Mobile:("ontouchstart"in window||navigator.maxTouchPoints>0)&&s>=600&&s<=1100?r.Tablet:r.Desktop}getPowerHints(){const e=navigator.connection,t="boolean"==typeof(null==e?void 0:e.saveData)?e.saveData:null;let n=null,s=null;if("function"==typeof window.matchMedia){try{const e=window.matchMedia("(prefers-reduced-data: reduce)");"boolean"==typeof e.matches&&(n=e.matches)}catch(e){}try{const e=window.matchMedia("(prefers-reduced-motion: reduce)");"boolean"==typeof e.matches&&(s=e.matches)}catch(e){}}return{saveData:t,prefersReducedData:n,prefersReducedMotion:s}}getNetworkInfo(e){const t=navigator.connection;return{type:"string"==typeof(null==t?void 0:t.type)?t.type:null,effectiveType:"string"==typeof(null==t?void 0:t.effectiveType)?t.effectiveType:null,downlinkMbps:"number"==typeof(null==t?void 0:t.downlink)?t.downlink:null,rttMs:"number"==typeof(null==t?void 0:t.rtt)?t.rtt:null,measuredDownlinkMbps:e}}maybeMeasureBandwidth(){return(0,i.sH)(this,void 0,void 0,function*(){const e=navigator.connection,t=!0===(null==e?void 0:e.saveData);if(!this.opts.enableBandwidthProbe)return null;if(this.opts.respectSaveData&&t)return null;try{const e=performance.now(),t=yield fetch(this.withCacheBuster(this.opts.probeUrl),{cache:"no-store",credentials:"omit"}),n=yield t.arrayBuffer(),s=performance.now(),r=8*n.byteLength,i=(s-e)/1e3;return i<=.05?null:+(r/i/1e6).toFixed(2)}catch(e){return null}})}withCacheBuster(e){var t,n;const s=new URL(e,location.origin),r=null!==(n=null===(t=null===crypto||void 0===crypto?void 0:crypto.randomUUID)||void 0===t?void 0:t.call(crypto))&&void 0!==n?n:String(Date.now());return s.searchParams.set("cb",r),s.toString()}getCodecSupport(){return(0,i.sH)(this,void 0,void 0,function*(){const[e,t]=yield Promise.all([this.supportsCodec('video/mp4; codecs="avc1.42E01E"'),this.supportsCodec('video/mp4; codecs="hvc1.1.6.L93.B0"')]);return{h264:e,hevc:t}})}supportsCodec(e){return(0,i.sH)(this,void 0,void 0,function*(){try{if("mediaCapabilities"in navigator){const t=yield navigator.mediaCapabilities.decodingInfo({type:"file",video:{contentType:e,width:1920,height:1080,bitrate:5e6,framerate:30}});return!!(null==t?void 0:t.supported)}}catch(e){}try{return""!==document.createElement("video").canPlayType(e)}catch(e){return!1}})}getUAInfo(){return(0,i.sH)(this,void 0,void 0,function*(){if(this.uaInfoCache)return this.uaInfoCache;const e=navigator.userAgentData,t=navigator.userAgent;let n="Unknown",s=null,r="Unknown",i=null,o=null,a=null,l=null;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["platform","platformVersion","model","architecture","bitness","fullVersionList"]);r=t.platform||"Unknown",i=t.platformVersion||null,o=t.model||null,a=t.architecture||null,l=t.bitness||null;const d=(t.fullVersionList||e.brands||[]).find(e=>{if(!e.brand)return!1;const t=e.brand.replace(/[^a-zA-Z]/g,"").toLowerCase();return!t.includes("chromium")&&!t.includes("notabrand")});d&&(n=d.brand,s=d.version)}catch(e){}if(!n||"Unknown"===n){const e=[[/Edg\/(\S+)/,"Edge"],[/OPR\/(\S+)/,"Opera"],[/SamsungBrowser\/(\S+)/,"Samsung Internet"],[/Firefox\/(\S+)/,"Firefox"],[/Chrome\/(\S+)/,"Chrome"],[/Version\/(\S+).*Safari/,"Safari"]];for(const[r,i]of e){const e=t.match(r);if(e){n=i,s=e[1];break}}}if(/iPhone|iPad|iPod/.test(t)){r="iOS";const e=t.match(/OS (\d+[_\d]*)/);e&&(i=e[1].replace(/_/g,"."))}else if(null==e?void 0:e.platform)r=e.platform;else if(/Windows/.test(t)){r="Windows";const e=t.match(/Windows NT (\d+\.\d+)/);e&&(i=e[1])}else if(/Mac OS X/.test(t)){r="macOS";const e=t.match(/Mac OS X (\d+[_\d]*)/);e&&(i=e[1].replace(/_/g,"."))}else if(/Android/.test(t)){r="Android";const e=t.match(/Android (\d+(\.\d+)?)/);e&&(i=e[1])}else/Linux/.test(t)&&(r="Linux");const d={browserFamily:n,browserVersion:s,osFamily:r,osVersion:i,model:o,architecture:a,bitness:l};return this.uaInfoCache=d,d})}}},419(e,t,n){function s(e){return function(e){return"string"==typeof e&&e.startsWith("https://")&&(()=>{try{return new URL(e),!0}catch(e){return!1}})()}(e)||function(e){return"string"==typeof e&&e.length>0&&!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)}(e)}function r(e){if("object"!=typeof e||null===e)return;const t=e,n={},r=["loadingIconUrl","loadingIconFadeMs","splashScreenUrl","splashScreenMode","splashScreenPosition","splashScreenBgColor","hideLoveLetters","hideAfkOverlay"];for(const e of Object.keys(t))if(!r.includes(e))return;const i=t.loadingIconUrl;s(i)&&(n.loadingIconUrl=i);const o=t.loadingIconFadeMs;"number"==typeof o&&Number.isInteger(o)&&o>0&&(n.loadingIconFadeMs=o);const a=t.splashScreenUrl;s(a)&&(n.splashScreenUrl=a);const l=t.splashScreenMode;"contain"!==l&&"cover"!==l&&"stretch"!==l&&"repeat"!==l||(n.splashScreenMode=l);const d=t.splashScreenPosition;"string"==typeof d&&(n.splashScreenPosition=d);const c=t.splashScreenBgColor;"string"==typeof c&&(n.splashScreenBgColor=c);const h=t.hideLoveLetters;"boolean"==typeof h&&(n.hideLoveLetters=h);const u=t.hideAfkOverlay;return"boolean"==typeof u&&(n.hideAfkOverlay=u),Object.keys(n).length>0?n:void 0}n.d(t,{d:()=>r})},6155(e,t,n){function s(e,t={allowJsonish:!0}){if(e&&"object"==typeof e)return e;if("string"==typeof e){try{const t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch(e){}if(t.allowJsonish){const t=e.trim().replace(/'/g,'"').replace(/([{,]\s*)([A-Za-z_][$\w-]*)(\s*:)/g,'$1"$2"$3');try{const e=JSON.parse(t);if(e&&"object"==typeof e)return e}catch(e){}}}throw new Error("Input must be an object or a JSON string of an object.")}function r(e,t){const n=new TextEncoder,s=new TextDecoder,r=n.encode(e);if(r.byteLength<=t)return e;for(let e=t;e>0;e--)try{return s.decode(r.subarray(0,e),{stream:!1})}catch(e){}return""}function i(e){let t=e.replace(/\s+/g," ").trim();return t=t.replace(/[\\\/:\*\?"<>\|\u0000-\u001F]+/g,""),t=t.replace(/^\.+/,""),!/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i.test(t)&&t||(t=a()),t.length>100&&(t=t.slice(0,100)),t}function o(e){const t={"image/png":".png","image/jpeg":".jpg","image/jpg":".jpg","image/webp":".webp","image/gif":".gif","image/bmp":".bmp","image/tiff":".tiff","video/mp4":".mp4","video/webm":".webm","video/ogg":".ogv","audio/mpeg":".mp3","audio/ogg":".ogg","audio/wav":".wav","audio/webm":".weba","application/pdf":".pdf","application/zip":".zip","application/x-zip-compressed":".zip","application/json":".json","text/plain":".txt","text/csv":".csv"};return t[e]?t[e]:e.startsWith("image/")||e.startsWith("video/")||e.startsWith("audio/")?"."+e.split("/")[1]:""}function a(){return Math.random().toString(36).slice(2,8)}function l(e){return"string"==typeof e?e.trim().toLowerCase():""}n.d(t,{AZ:()=>l,HJ:()=>r,Nz:()=>i,Yr:()=>s,gX:()=>o,i$:()=>a})},9644(e,t,n){n.d(t,{a:()=>r});var s=n(419);function r(e){var t;try{const n=null!==(t=e.get("wl"))&&void 0!==t?t:e.get("whitelabel");if(!n)return;const r=function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"===".slice((t.length+3)%4);return"function"==typeof atob?atob(n):Buffer.from(n,"base64").toString("utf-8")}(n),i=JSON.parse(r);return(0,s.d)(i)}catch(e){return}}},2284(e,t,n){function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}n.d(t,{A:()=>s})},1635(e,t,n){function s(e,t,n,s){return new(n||(n=Promise))(function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})}n.d(t,{sH:()=>s}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError}},t={};function n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s={};n.d(s,{B2:()=>a.B2,BN:()=>a.BN,DY:()=>a.DY,J1:()=>o.J,Mr:()=>a.Mr,Ql:()=>a.Ql,U3:()=>a.U3,Vn:()=>a.Vn,ZB:()=>a.ZB,gh:()=>i.g,jj:()=>r.j,oU:()=>r.o,ot:()=>a.ot,wL:()=>a.wL,xI:()=>a.xI});var r=n(272),i=n(2886),o=n(6689),a=n(6246);const l=s.gh,d=s.oU,c=s.J1,h=s.Vn,u=s.jj,m=s.xI,g=s.Ql,p=s.Mr,f=s.DY,y=s.wL,v=s.B2,b=s.BN,w=s.U3,S=s.ot,C=s.ZB;export{l as ArcwareConfig,d as ArcwarePixelStreaming,c as CoreSetup,h as Send,u as WebsocketState,m as parseErrorMessage,g as parseLoveLetter,p as parsePing,f as parseQueue,y as parseRender,v as parseSessionId,b as parseStats,w as parseStreamInfo,S as parseVersion,C as parseWebSdkSettings};