@needle-tools/engine 4.4.5 → 4.4.6-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/{assets/generateMeshBVH.worker-b7788939.js → generateMeshBVH.worker-2bb9524d.js} +1 -1
- package/dist/{gltf-progressive.light.umd.cjs → gltf-progressive-10ca5f84.umd.cjs} +1 -1
- package/dist/{gltf-progressive.light.js → gltf-progressive-13de1400.light.js} +2 -2
- package/dist/{gltf-progressive.js → gltf-progressive-1e91190e.js} +2 -2
- package/dist/{gltf-progressive.umd.cjs → gltf-progressive-9f7cc7b2.light.umd.cjs} +1 -1
- package/dist/{gltf-progressive.light.min.js → gltf-progressive-b5ae121f.light.min.js} +1 -1
- package/dist/{gltf-progressive.min.js → gltf-progressive-c7497194.min.js} +1 -1
- package/dist/{needle-engine.bundle.js → needle-engine.bundle-07e0eaf0.js} +751 -750
- package/dist/{needle-engine.bundle.min.js → needle-engine.bundle-71861947.min.js} +73 -73
- package/dist/{needle-engine.bundle.umd.cjs → needle-engine.bundle-73459623.umd.cjs} +87 -87
- package/dist/{needle-engine.bundle.light.min.js → needle-engine.bundle-9def7e8b.light.min.js} +73 -73
- package/dist/{needle-engine.bundle.light.js → needle-engine.bundle-ad489836.light.js} +751 -750
- package/dist/{needle-engine.bundle.light.umd.cjs → needle-engine.bundle-cb5d2462.light.umd.cjs} +82 -82
- package/dist/needle-engine.js +7 -7
- package/dist/needle-engine.light.js +7 -7
- package/dist/needle-engine.light.min.js +1 -1
- package/dist/needle-engine.light.umd.cjs +1 -1
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing.js → postprocessing-1f7b0484.light.js} +2 -2
- package/dist/{postprocessing.light.min.js → postprocessing-3a475b1f.light.min.js} +1 -1
- package/dist/{postprocessing.light.umd.cjs → postprocessing-3a5c88ab.light.umd.cjs} +1 -1
- package/dist/{postprocessing.light.js → postprocessing-7f24854b.js} +2 -2
- package/dist/{postprocessing.min.js → postprocessing-992c1d00.min.js} +1 -1
- package/dist/{postprocessing.umd.cjs → postprocessing-a77d707a.umd.cjs} +1 -1
- package/dist/{three.light.umd.cjs → three-67c59991.umd.cjs} +1 -1
- package/dist/{three.umd.cjs → three-ed3e16aa.light.umd.cjs} +1 -1
- package/dist/{three-examples.light.umd.cjs → three-examples-609de8cf.light.umd.cjs} +1 -1
- package/dist/{three-examples.min.js → three-examples-84a86d3a.min.js} +1 -1
- package/dist/{three-examples.js → three-examples-9070776e.js} +1 -1
- package/dist/{three-examples.umd.cjs → three-examples-a36ec195.umd.cjs} +1 -1
- package/dist/{three-examples.light.js → three-examples-ae5d9997.light.js} +1 -1
- package/dist/{three-examples.light.min.js → three-examples-e915b453.light.min.js} +1 -1
- package/dist/{three-mesh-ui.light.umd.cjs → three-mesh-ui-0f43a7e0.umd.cjs} +1 -1
- package/dist/{three-mesh-ui.min.js → three-mesh-ui-34f3b06e.min.js} +1 -1
- package/dist/{three-mesh-ui.js → three-mesh-ui-3dd2ba28.js} +1 -1
- package/dist/{three-mesh-ui.light.min.js → three-mesh-ui-6c3bb6f5.light.min.js} +1 -1
- package/dist/{three-mesh-ui.light.js → three-mesh-ui-a93a09fb.light.js} +1 -1
- package/dist/{three-mesh-ui.umd.cjs → three-mesh-ui-c6a7f37c.light.umd.cjs} +1 -1
- package/dist/{vendor.umd.cjs → vendor-017686ea.light.umd.cjs} +1 -1
- package/dist/{vendor.light.umd.cjs → vendor-2a57f283.umd.cjs} +1 -1
- package/dist/{vendor.light.js → vendor-3f0ec7ec.light.js} +1 -1
- package/dist/{vendor.js → vendor-804f80f4.js} +1 -1
- package/dist/{vendor.min.js → vendor-e7e3da93.min.js} +1 -1
- package/dist/{vendor.light.min.js → vendor-ec47e3c4.light.min.js} +1 -1
- package/lib/engine/engine_networking.d.ts +1 -1
- package/lib/engine/engine_networking.js +13 -2
- package/lib/engine/engine_networking.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_networking.ts +13 -2
- /package/dist/{rapier.light.umd.cjs → rapier-32f37222.light.umd.cjs} +0 -0
- /package/dist/{rapier.umd.cjs → rapier-32f37222.umd.cjs} +0 -0
- /package/dist/{rapier.light.min.js → rapier-461dfeff.light.min.js} +0 -0
- /package/dist/{rapier.min.js → rapier-461dfeff.min.js} +0 -0
- /package/dist/{rapier.js → rapier-ef0b93e2.js} +0 -0
- /package/dist/{rapier.light.js → rapier-ef0b93e2.light.js} +0 -0
- /package/dist/{three.js → three-3fd45ef1.js} +0 -0
- /package/dist/{three.light.js → three-3fd45ef1.light.js} +0 -0
- /package/dist/{three.light.min.js → three-41cc41b9.light.min.js} +0 -0
- /package/dist/{three.min.js → three-41cc41b9.min.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PlaneGeometry as Ds,ShaderChunk as bc,Triangle as je,Vector3 as R,Layers as wn,MeshBasicMaterial as wr,DoubleSide as Mr,AdditiveBlending as Fs,Object3D as Tr,InstancedBufferAttribute as It,DynamicDrawUsage as xe,InstancedBufferGeometry as xc,Uniform$1 as Je,ShaderMaterial as Cr,BufferGeometry as Xt,BufferAttribute as me,Mesh as Mn,MeshStandardMaterial as _c,MeshPhysicalMaterial as Sc,Vector2 as Ye,Plane as Ls,Line3 as at,Sphere as Vs,Matrix4 as Be,Box3 as Te,REVISION as js,BackSide as wc,FrontSide as Js,Group as Mc,LineBasicMaterial as Tc,BatchedMesh as Cc,Ray as Pc,DataTexture as Pr,NearestFilter as Yt,UnsignedIntType as yi,IntType as Tn,FloatType as gi,UnsignedByteType as Gs,UnsignedShortType as Ec,ByteType as qs,ShortType as Ac,RGBAFormat as Cn,RGBAIntegerFormat as Er,RGFormat as kc,RedFormat as Rc,RGIntegerFormat as Hs,RedIntegerFormat as Oc,Matrix3 as Bc,Vector4 as Ar}from"./three.min.js";const re={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Ws(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function Ic(n){if(!n)throw new Error("No basePath supplied");return await Ws(`${n}/profilesList.json`)}async function zc(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await Ic(e);let s;if(n.profiles.some(a=>{const c=r[a];return c&&(s={profileId:a,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const a=r[t];if(!a)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${a.path}`,deprecated:!!a.deprecated}}const o=await Ws(s.profilePath);let l;if(i){let a;if(n.handedness==="any"?a=o.layouts[Object.keys(o.layouts)[0]]:a=o.layouts[n.handedness],!a)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);a.assetPath&&(l=s.profilePath.replace("profile.json",a.assetPath))}return{profile:o,assetPath:l}}const Nc={xAxis:0,yAxis:0,button:0,state:re.ComponentState.DEFAULT};function Uc(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const r=Math.atan2(e,n);t=Math.cos(r),i=Math.sin(r)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Dc{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===re.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Nc)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=Uc(e,t);switch(this.componentProperty){case re.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case re.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case re.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case re.ComponentProperty.STATE:this.valueNodeProperty===re.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Fc{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const r=new Dc(t.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:re.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=re.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=re.ComponentState.PRESSED:(t.touched||this.values.button>re.ButtonTouchThreshold)&&(this.values.state=re.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class Lc{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new Fc(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const kr=2,Ze=4,ct=4,Xs=4,mt=new Int32Array(2),Ys=new Float32Array(mt.buffer),Zs=new Float64Array(mt.buffer),Pn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Rr;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Rr||(Rr={}));class qi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new qi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return mt[0]=this.readInt32(e),Ys[0]}readFloat64(e){return mt[Pn?0:1]=this.readInt32(e),mt[Pn?1:0]=this.readInt32(e+4),Zs[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){Ys[0]=t,this.writeInt32(e,mt[0])}writeFloat64(e,t){Zs[0]=t,this.writeInt32(e,mt[Pn?0:1]),this.writeInt32(e+4,mt[Pn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Ze+ct)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<ct;t++)e+=String.fromCharCode(this.readInt8(this.position_+Ze+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let r="",s=0;if(e+=Ze,t===Rr.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;s<i;){let o;const l=this.readUint8(e+s++);if(l<192)o=l;else{const a=this.readUint8(e+s++);if(l<224)o=(l&31)<<6|a&63;else{const c=this.readUint8(e+s++);if(l<240)o=(l&15)<<12|(a&63)<<6|c&63;else{const h=this.readUint8(e+s++);o=(l&7)<<18|(a&63)<<12|(c&63)<<6|h&63}}}o<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode((o>>10)+55296,(o&1024-1)+56320))}return r}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Ze}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let t=0;t<ct;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+Ze+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let r=0;r<t;++r)e(r)!==null&&i.push(e(r));return i}createObjList(e,t){const i=[];for(let r=0;r<t;++r){const s=e(r);s!==null&&i.push(s.unpack())}return i}}class zs{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=qi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const r=this.bb.capacity();this.bb=zs.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,r=qi.allocate(i);return r.setPosition(i-t),r.bytes().set(e.bytes(),i-t),r}addOffset(e){this.prep(Ze,0),this.writeInt32(this.offset()-e+Ze)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const r=2;this.addInt16(e-this.object_start);const s=(i+r)*kr;this.addInt16(s);let o=0;const l=this.space;e:for(t=0;t<this.vtables.length;t++){const a=this.bb.capacity()-this.vtables[t];if(s==this.bb.readInt16(a)){for(let c=kr;c<s;c+=kr)if(this.bb.readInt16(l+c)!=this.bb.readInt16(a+c))continue e;o=this.vtables[t];break}}return o?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,o-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const r=i?Xs:0;if(t){const s=t;if(this.prep(this.minalign,Ze+ct+r),s.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let o=ct-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Ze+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,r=i-this.bb.readInt32(i);if(this.bb.readInt16(r+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(Ze,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let r;const s=e.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const o=e.charCodeAt(i++);r=(s<<10)+o+(65536-56623104-56320)}r<128?t.push(r):(r<2048?t.push(r>>6&31|192):(r<65536?t.push(r>>12&15|224):t.push(r>>18&7|240,r>>12&63|128),t.push(r>>6&63|128)),t.push(r&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,r=this.space,s=this.bb.bytes();i<t.length;i++)s[r++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const r=e[i];if(r!==null)t.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function En(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Qs={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(r){typeof r=="number"?this._pieces.push(r):(this.flush(),this._parts.push(r))},i.prototype.flush=function(){if(this._pieces.length>0){var r=new Uint8Array(this._pieces);e.useArrayBufferView||(r=r.buffer),this._parts.push(r),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var r=new t,s=0,o=this._parts.length;s<o;s++)r.append(this._parts[s]);return r.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(Qs);var Ks=Qs.exports,Vc=Ks.BufferBuilder,$s=Ks.binaryFeatures,jc={unpack:function(n){var e=new ae(n);return e.unpack()},pack:function(n){var e=new ce;e.pack(n);var t=e.getBuffer();return t}},Jc=jc;function ae(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}ae.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},ae.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},ae.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},ae.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},ae.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},ae.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},ae.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},ae.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},ae.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},ae.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},ae.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",r,s;t<n;)r=e[t],r<128?(i+=String.fromCharCode(r),t++):(r^192)<32?(s=(r^192)<<6|e[t+1]&63,i+=String.fromCharCode(s),t+=2):(s=(r&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(s),t+=3);return this.index+=n,i},ae.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},ae.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),r=this.unpack();e[i]=r}return e},ae.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},ae.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,r=n&1048575|1048576,s=r*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*s},ae.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function ce(){this.bufferBuilder=new Vc}ce.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},ce.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},ce.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_string=function(n){var e=qc(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},ce.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},ce.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,r=Math.floor(i*Math.pow(2,52)),s=Math.pow(2,32),o=e<<31|t+1023<<20|r/s&1048575,l=r%s;this.bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(l)},ce.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},ce.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},ce.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},ce.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},ce.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},ce.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function Gc(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function qc(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,Gc).length}const eo=En(Jc);let to=!0,io=!0;function vi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function Zt(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(o,l){if(o!==e)return r.apply(this,arguments);const a=c=>{const h=t(c);h&&(l.handleEvent?l.handleEvent(h):l(h))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(l,a),r.apply(this,[o,a])};const s=i.removeEventListener;i.removeEventListener=function(o,l){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(l))return s.apply(this,arguments);const a=this._eventMap[e].get(l);return this._eventMap[e].delete(l),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,a])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Hc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(to=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Wc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(io=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Or(){if(typeof window=="object"){if(to)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function An(n,e){io&&console.warn(n+" is deprecated, please use "+e+" instead.")}function Xc(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=vi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=vi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=vi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=vi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function no(n){return Object.prototype.toString.call(n)==="[object Object]"}function ro(n){return no(n)?Object.keys(n).reduce(function(e,t){const i=no(n[t]),r=i?ro(n[t]):n[t],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[t]:r})},{}):n}function Br(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Br(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(r=>{Br(n,n.get(r),t)})}))}function so(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",r=new Map;if(e===null)return r;const s=[];return n.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{n.forEach(l=>{l.type===i&&l.trackId===o.id&&Br(n,l,r)})}),r}const oo=Or;function ao(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(l){if(typeof l!="object"||l.mandatory||l.optional)return l;const a={};return Object.keys(l).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const h=typeof l[c]=="object"?l[c]:{ideal:l[c]};h.exact!==void 0&&typeof h.exact=="number"&&(h.min=h.max=h.exact);const u=function(d,p){return d?d+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(h.ideal!==void 0){a.optional=a.optional||[];let d={};typeof h.ideal=="number"?(d[u("min",c)]=h.ideal,a.optional.push(d),d={},d[u("max",c)]=h.ideal,a.optional.push(d)):(d[u("",c)]=h.ideal,a.optional.push(d))}h.exact!==void 0&&typeof h.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[u("",c)]=h.exact):["min","max"].forEach(d=>{h[d]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[u(d,c)]=h[d])})}),l.advanced&&(a.optional=(a.optional||[]).concat(l.advanced)),a},r=function(l,a){if(e.version>=61)return a(l);if(l=JSON.parse(JSON.stringify(l)),l&&typeof l.audio=="object"){const c=function(h,u,d){u in h&&!(d in h)&&(h[d]=h[u],delete h[u])};l=JSON.parse(JSON.stringify(l)),c(l.audio,"autoGainControl","googAutoGainControl"),c(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=i(l.audio)}if(l&&typeof l.video=="object"){let c=l.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const h=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!h)){delete l.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return t.mediaDevices.enumerateDevices().then(d=>{d=d.filter(f=>f.kind==="videoinput");let p=d.find(f=>u.some(m=>f.label.toLowerCase().includes(m)));return!p&&d.length&&u.includes("back")&&(p=d[d.length-1]),p&&(l.video.deviceId=c.exact?{exact:p.deviceId}:{ideal:p.deviceId}),l.video=i(l.video),oo("chrome: "+JSON.stringify(l)),a(l)})}l.video=i(l.video)}return oo("chrome: "+JSON.stringify(l)),a(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(l,a,c){r(l,h=>{t.webkitGetUserMedia(h,a,u=>{c&&c(s(u))})})};if(t.getUserMedia=o.bind(t),t.mediaDevices.getUserMedia){const l=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(a){return r(a,c=>l(c).then(h=>{if(c.audio&&!h.getAudioTracks().length||c.video&&!h.getVideoTracks().length)throw h.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return h},h=>Promise.reject(s(h))))}}}function Yc(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const r=t.video&&t.video.width,s=t.video&&t.video.height,o=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:o||3}},r&&(t.video.mandatory.maxWidth=r),s&&(t.video.mandatory.maxHeight=s),n.navigator.mediaDevices.getUserMedia(t)})}}}function co(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function lo(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)}),t.stream.getTracks().forEach(i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Zt(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ho(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,l){let a=r.apply(this,arguments);return a||(a=e(this,o),this._senders.push(a)),a};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const l=this._senders.indexOf(o);l!==-1&&this._senders.splice(l,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],t.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],i.apply(this,[r]),r.getTracks().forEach(s=>{const o=this._senders.find(l=>l.track===s);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function uo(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,r]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const s=function(l){const a={};return l.result().forEach(c=>{const h={id:c.id,timestamp:c.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[c.type]||c.type};c.names().forEach(u=>{h[u]=c.stat(u)}),a[h.id]=h}),a},o=function(l){return new Map(Object.keys(l).map(a=>[a,l[a]]))};if(arguments.length>=2){const l=function(a){i(o(s(a)))};return e.apply(this,[l,t])}return new Promise((l,a)=>{e.apply(this,[function(c){l(o(s(c)))},a])}).then(i,r)}}function po(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=i.apply(this,arguments);return r._pc=this,r}),n.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>so(s,r.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),Zt(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>so(r,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,r,s;return this.getSenders().forEach(o=>{o.track===t&&(i?s=!0:i=o)}),this.getReceivers().forEach(o=>(o.track===t&&(r?s=!0:r=o),o.track===t)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function fo(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const l=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(l)===-1&&this._shimmedLocalStreams[o.id].push(l):this._shimmedLocalStreams[o.id]=[o,l],l};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(a=>{if(this.getSenders().find(c=>c.track===a))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();t.apply(this,arguments);const l=this.getSenders().filter(a=>o.indexOf(a)===-1);this._shimmedLocalStreams[s.id]=[s].concat(l)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],i.apply(this,arguments)};const r=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const l=this._shimmedLocalStreams[o].indexOf(s);l!==-1&&this._shimmedLocalStreams[o].splice(l,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),r.apply(this,arguments)}}function mo(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return fo(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const c=t.apply(this);return this._reverseStreams=this._reverseStreams||{},c.map(h=>this._reverseStreams[h.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(c){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},c.getTracks().forEach(h=>{if(this.getSenders().find(u=>u.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[c.id]){const h=new n.MediaStream(c.getTracks());this._streams[c.id]=h,this._reverseStreams[h.id]=c,c=h}i.apply(this,[c])};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(c){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[c.id]||c]),delete this._reverseStreams[this._streams[c.id]?this._streams[c.id].id:c.id],delete this._streams[c.id]},n.RTCPeerConnection.prototype.addTrack=function(c,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const u=[].slice.call(arguments,1);if(u.length!==1||!u[0].getTracks().find(p=>p===c))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===c))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const d=this._streams[h.id];if(d)d.addTrack(c),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([c]);this._streams[h.id]=p,this._reverseStreams[p.id]=h,this.addStream(p)}return this.getSenders().find(p=>p.track===c)};function s(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(f.id,"g"),p.id)}),new RTCSessionDescription({type:h.type,sdp:u})}function o(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(p.id,"g"),f.id)}),new RTCSessionDescription({type:h.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const h=n.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=s(this,p);d[0].apply(null,[f])},p=>{d[1]&&d[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>s(this,p))}};n.RTCPeerConnection.prototype[c]=u[c]});const l=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?l.apply(this,arguments):(arguments[0]=o(this,arguments[0]),l.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const c=a.get.apply(this);return c.type===""?c:s(this,c)}}),n.RTCPeerConnection.prototype.removeTrack=function(c){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!c._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(c._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let h;Object.keys(this._streams).forEach(u=>{this._streams[u].getTracks().find(d=>c.track===d)&&(h=this._streams[u])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(c.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ir(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=r[t]})}function yo(n,e){Zt(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const go=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:yo,shimAddTrackRemoveTrack:mo,shimAddTrackRemoveTrackWithNative:fo,shimGetDisplayMedia:Yc,shimGetSendersWithDtmf:ho,shimGetStats:uo,shimGetUserMedia:ao,shimMediaStream:co,shimOnTrack:lo,shimPeerConnection:Ir,shimSenderReceiverGetStats:po},Symbol.toStringTag,{value:"Module"}));function Zc(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let r=i.urls||i.url;i.url&&!i.urls&&An("RTCIceServer.url","RTCIceServer.urls");const s=typeof r=="string";return s&&(r=[r]),r=r.filter(o=>{if(o.indexOf("stun:")===0)return!1;const l=o.startsWith("turn")&&!o.startsWith("turn:[")&&o.includes("transport=udp");return l&&!t?(t=!0,!0):l&&!t}),delete i.url,i.urls=s?r[0]:r,!!r.length}})}var vo={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
|
|
1
|
+
import{PlaneGeometry as Ds,ShaderChunk as bc,Triangle as je,Vector3 as R,Layers as wn,MeshBasicMaterial as wr,DoubleSide as Mr,AdditiveBlending as Fs,Object3D as Tr,InstancedBufferAttribute as It,DynamicDrawUsage as xe,InstancedBufferGeometry as xc,Uniform$1 as Je,ShaderMaterial as Cr,BufferGeometry as Xt,BufferAttribute as me,Mesh as Mn,MeshStandardMaterial as _c,MeshPhysicalMaterial as Sc,Vector2 as Ye,Plane as Ls,Line3 as at,Sphere as Vs,Matrix4 as Be,Box3 as Te,REVISION as js,BackSide as wc,FrontSide as Js,Group as Mc,LineBasicMaterial as Tc,BatchedMesh as Cc,Ray as Pc,DataTexture as Pr,NearestFilter as Yt,UnsignedIntType as yi,IntType as Tn,FloatType as gi,UnsignedByteType as Gs,UnsignedShortType as Ec,ByteType as qs,ShortType as Ac,RGBAFormat as Cn,RGBAIntegerFormat as Er,RGFormat as kc,RedFormat as Rc,RGIntegerFormat as Hs,RedIntegerFormat as Oc,Matrix3 as Bc,Vector4 as Ar}from"./three-41cc41b9.min.js";const re={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Ws(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function Ic(n){if(!n)throw new Error("No basePath supplied");return await Ws(`${n}/profilesList.json`)}async function zc(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await Ic(e);let s;if(n.profiles.some(a=>{const c=r[a];return c&&(s={profileId:a,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const a=r[t];if(!a)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${a.path}`,deprecated:!!a.deprecated}}const o=await Ws(s.profilePath);let l;if(i){let a;if(n.handedness==="any"?a=o.layouts[Object.keys(o.layouts)[0]]:a=o.layouts[n.handedness],!a)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);a.assetPath&&(l=s.profilePath.replace("profile.json",a.assetPath))}return{profile:o,assetPath:l}}const Nc={xAxis:0,yAxis:0,button:0,state:re.ComponentState.DEFAULT};function Uc(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const r=Math.atan2(e,n);t=Math.cos(r),i=Math.sin(r)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Dc{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===re.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Nc)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=Uc(e,t);switch(this.componentProperty){case re.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case re.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case re.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case re.ComponentProperty.STATE:this.valueNodeProperty===re.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Fc{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const r=new Dc(t.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:re.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=re.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=re.ComponentState.PRESSED:(t.touched||this.values.button>re.ButtonTouchThreshold)&&(this.values.state=re.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class Lc{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new Fc(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const kr=2,Ze=4,ct=4,Xs=4,mt=new Int32Array(2),Ys=new Float32Array(mt.buffer),Zs=new Float64Array(mt.buffer),Pn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Rr;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Rr||(Rr={}));class qi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new qi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return mt[0]=this.readInt32(e),Ys[0]}readFloat64(e){return mt[Pn?0:1]=this.readInt32(e),mt[Pn?1:0]=this.readInt32(e+4),Zs[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){Ys[0]=t,this.writeInt32(e,mt[0])}writeFloat64(e,t){Zs[0]=t,this.writeInt32(e,mt[Pn?0:1]),this.writeInt32(e+4,mt[Pn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Ze+ct)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<ct;t++)e+=String.fromCharCode(this.readInt8(this.position_+Ze+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let r="",s=0;if(e+=Ze,t===Rr.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;s<i;){let o;const l=this.readUint8(e+s++);if(l<192)o=l;else{const a=this.readUint8(e+s++);if(l<224)o=(l&31)<<6|a&63;else{const c=this.readUint8(e+s++);if(l<240)o=(l&15)<<12|(a&63)<<6|c&63;else{const h=this.readUint8(e+s++);o=(l&7)<<18|(a&63)<<12|(c&63)<<6|h&63}}}o<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode((o>>10)+55296,(o&1024-1)+56320))}return r}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Ze}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let t=0;t<ct;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+Ze+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let r=0;r<t;++r)e(r)!==null&&i.push(e(r));return i}createObjList(e,t){const i=[];for(let r=0;r<t;++r){const s=e(r);s!==null&&i.push(s.unpack())}return i}}class zs{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=qi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const r=this.bb.capacity();this.bb=zs.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,r=qi.allocate(i);return r.setPosition(i-t),r.bytes().set(e.bytes(),i-t),r}addOffset(e){this.prep(Ze,0),this.writeInt32(this.offset()-e+Ze)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const r=2;this.addInt16(e-this.object_start);const s=(i+r)*kr;this.addInt16(s);let o=0;const l=this.space;e:for(t=0;t<this.vtables.length;t++){const a=this.bb.capacity()-this.vtables[t];if(s==this.bb.readInt16(a)){for(let c=kr;c<s;c+=kr)if(this.bb.readInt16(l+c)!=this.bb.readInt16(a+c))continue e;o=this.vtables[t];break}}return o?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,o-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const r=i?Xs:0;if(t){const s=t;if(this.prep(this.minalign,Ze+ct+r),s.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let o=ct-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Ze+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,r=i-this.bb.readInt32(i);if(this.bb.readInt16(r+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(Ze,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let r;const s=e.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const o=e.charCodeAt(i++);r=(s<<10)+o+(65536-56623104-56320)}r<128?t.push(r):(r<2048?t.push(r>>6&31|192):(r<65536?t.push(r>>12&15|224):t.push(r>>18&7|240,r>>12&63|128),t.push(r>>6&63|128)),t.push(r&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,r=this.space,s=this.bb.bytes();i<t.length;i++)s[r++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const r=e[i];if(r!==null)t.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function En(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Qs={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(r){typeof r=="number"?this._pieces.push(r):(this.flush(),this._parts.push(r))},i.prototype.flush=function(){if(this._pieces.length>0){var r=new Uint8Array(this._pieces);e.useArrayBufferView||(r=r.buffer),this._parts.push(r),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var r=new t,s=0,o=this._parts.length;s<o;s++)r.append(this._parts[s]);return r.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(Qs);var Ks=Qs.exports,Vc=Ks.BufferBuilder,$s=Ks.binaryFeatures,jc={unpack:function(n){var e=new ae(n);return e.unpack()},pack:function(n){var e=new ce;e.pack(n);var t=e.getBuffer();return t}},Jc=jc;function ae(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}ae.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},ae.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},ae.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},ae.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},ae.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},ae.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},ae.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},ae.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},ae.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},ae.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},ae.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",r,s;t<n;)r=e[t],r<128?(i+=String.fromCharCode(r),t++):(r^192)<32?(s=(r^192)<<6|e[t+1]&63,i+=String.fromCharCode(s),t+=2):(s=(r&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(s),t+=3);return this.index+=n,i},ae.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},ae.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),r=this.unpack();e[i]=r}return e},ae.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},ae.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,r=n&1048575|1048576,s=r*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*s},ae.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function ce(){this.bufferBuilder=new Vc}ce.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},ce.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},ce.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_string=function(n){var e=qc(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},ce.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},ce.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,r=Math.floor(i*Math.pow(2,52)),s=Math.pow(2,32),o=e<<31|t+1023<<20|r/s&1048575,l=r%s;this.bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(l)},ce.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},ce.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},ce.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},ce.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},ce.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},ce.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function Gc(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function qc(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,Gc).length}const eo=En(Jc);let to=!0,io=!0;function vi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function Zt(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(o,l){if(o!==e)return r.apply(this,arguments);const a=c=>{const h=t(c);h&&(l.handleEvent?l.handleEvent(h):l(h))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(l,a),r.apply(this,[o,a])};const s=i.removeEventListener;i.removeEventListener=function(o,l){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(l))return s.apply(this,arguments);const a=this._eventMap[e].get(l);return this._eventMap[e].delete(l),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,a])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Hc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(to=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Wc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(io=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Or(){if(typeof window=="object"){if(to)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function An(n,e){io&&console.warn(n+" is deprecated, please use "+e+" instead.")}function Xc(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=vi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=vi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=vi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=vi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function no(n){return Object.prototype.toString.call(n)==="[object Object]"}function ro(n){return no(n)?Object.keys(n).reduce(function(e,t){const i=no(n[t]),r=i?ro(n[t]):n[t],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[t]:r})},{}):n}function Br(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Br(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(r=>{Br(n,n.get(r),t)})}))}function so(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",r=new Map;if(e===null)return r;const s=[];return n.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{n.forEach(l=>{l.type===i&&l.trackId===o.id&&Br(n,l,r)})}),r}const oo=Or;function ao(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(l){if(typeof l!="object"||l.mandatory||l.optional)return l;const a={};return Object.keys(l).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const h=typeof l[c]=="object"?l[c]:{ideal:l[c]};h.exact!==void 0&&typeof h.exact=="number"&&(h.min=h.max=h.exact);const u=function(d,p){return d?d+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(h.ideal!==void 0){a.optional=a.optional||[];let d={};typeof h.ideal=="number"?(d[u("min",c)]=h.ideal,a.optional.push(d),d={},d[u("max",c)]=h.ideal,a.optional.push(d)):(d[u("",c)]=h.ideal,a.optional.push(d))}h.exact!==void 0&&typeof h.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[u("",c)]=h.exact):["min","max"].forEach(d=>{h[d]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[u(d,c)]=h[d])})}),l.advanced&&(a.optional=(a.optional||[]).concat(l.advanced)),a},r=function(l,a){if(e.version>=61)return a(l);if(l=JSON.parse(JSON.stringify(l)),l&&typeof l.audio=="object"){const c=function(h,u,d){u in h&&!(d in h)&&(h[d]=h[u],delete h[u])};l=JSON.parse(JSON.stringify(l)),c(l.audio,"autoGainControl","googAutoGainControl"),c(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=i(l.audio)}if(l&&typeof l.video=="object"){let c=l.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const h=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!h)){delete l.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return t.mediaDevices.enumerateDevices().then(d=>{d=d.filter(f=>f.kind==="videoinput");let p=d.find(f=>u.some(m=>f.label.toLowerCase().includes(m)));return!p&&d.length&&u.includes("back")&&(p=d[d.length-1]),p&&(l.video.deviceId=c.exact?{exact:p.deviceId}:{ideal:p.deviceId}),l.video=i(l.video),oo("chrome: "+JSON.stringify(l)),a(l)})}l.video=i(l.video)}return oo("chrome: "+JSON.stringify(l)),a(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(l,a,c){r(l,h=>{t.webkitGetUserMedia(h,a,u=>{c&&c(s(u))})})};if(t.getUserMedia=o.bind(t),t.mediaDevices.getUserMedia){const l=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(a){return r(a,c=>l(c).then(h=>{if(c.audio&&!h.getAudioTracks().length||c.video&&!h.getVideoTracks().length)throw h.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return h},h=>Promise.reject(s(h))))}}}function Yc(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const r=t.video&&t.video.width,s=t.video&&t.video.height,o=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:o||3}},r&&(t.video.mandatory.maxWidth=r),s&&(t.video.mandatory.maxHeight=s),n.navigator.mediaDevices.getUserMedia(t)})}}}function co(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function lo(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)}),t.stream.getTracks().forEach(i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Zt(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ho(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,l){let a=r.apply(this,arguments);return a||(a=e(this,o),this._senders.push(a)),a};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const l=this._senders.indexOf(o);l!==-1&&this._senders.splice(l,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],t.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],i.apply(this,[r]),r.getTracks().forEach(s=>{const o=this._senders.find(l=>l.track===s);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function uo(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,r]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const s=function(l){const a={};return l.result().forEach(c=>{const h={id:c.id,timestamp:c.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[c.type]||c.type};c.names().forEach(u=>{h[u]=c.stat(u)}),a[h.id]=h}),a},o=function(l){return new Map(Object.keys(l).map(a=>[a,l[a]]))};if(arguments.length>=2){const l=function(a){i(o(s(a)))};return e.apply(this,[l,t])}return new Promise((l,a)=>{e.apply(this,[function(c){l(o(s(c)))},a])}).then(i,r)}}function po(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=i.apply(this,arguments);return r._pc=this,r}),n.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>so(s,r.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),Zt(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>so(r,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,r,s;return this.getSenders().forEach(o=>{o.track===t&&(i?s=!0:i=o)}),this.getReceivers().forEach(o=>(o.track===t&&(r?s=!0:r=o),o.track===t)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function fo(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const l=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(l)===-1&&this._shimmedLocalStreams[o.id].push(l):this._shimmedLocalStreams[o.id]=[o,l],l};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(a=>{if(this.getSenders().find(c=>c.track===a))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();t.apply(this,arguments);const l=this.getSenders().filter(a=>o.indexOf(a)===-1);this._shimmedLocalStreams[s.id]=[s].concat(l)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],i.apply(this,arguments)};const r=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const l=this._shimmedLocalStreams[o].indexOf(s);l!==-1&&this._shimmedLocalStreams[o].splice(l,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),r.apply(this,arguments)}}function mo(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return fo(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const c=t.apply(this);return this._reverseStreams=this._reverseStreams||{},c.map(h=>this._reverseStreams[h.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(c){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},c.getTracks().forEach(h=>{if(this.getSenders().find(u=>u.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[c.id]){const h=new n.MediaStream(c.getTracks());this._streams[c.id]=h,this._reverseStreams[h.id]=c,c=h}i.apply(this,[c])};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(c){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[c.id]||c]),delete this._reverseStreams[this._streams[c.id]?this._streams[c.id].id:c.id],delete this._streams[c.id]},n.RTCPeerConnection.prototype.addTrack=function(c,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const u=[].slice.call(arguments,1);if(u.length!==1||!u[0].getTracks().find(p=>p===c))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===c))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const d=this._streams[h.id];if(d)d.addTrack(c),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([c]);this._streams[h.id]=p,this._reverseStreams[p.id]=h,this.addStream(p)}return this.getSenders().find(p=>p.track===c)};function s(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(f.id,"g"),p.id)}),new RTCSessionDescription({type:h.type,sdp:u})}function o(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(p.id,"g"),f.id)}),new RTCSessionDescription({type:h.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const h=n.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=s(this,p);d[0].apply(null,[f])},p=>{d[1]&&d[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>s(this,p))}};n.RTCPeerConnection.prototype[c]=u[c]});const l=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?l.apply(this,arguments):(arguments[0]=o(this,arguments[0]),l.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const c=a.get.apply(this);return c.type===""?c:s(this,c)}}),n.RTCPeerConnection.prototype.removeTrack=function(c){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!c._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(c._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let h;Object.keys(this._streams).forEach(u=>{this._streams[u].getTracks().find(d=>c.track===d)&&(h=this._streams[u])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(c.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ir(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=r[t]})}function yo(n,e){Zt(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const go=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:yo,shimAddTrackRemoveTrack:mo,shimAddTrackRemoveTrackWithNative:fo,shimGetDisplayMedia:Yc,shimGetSendersWithDtmf:ho,shimGetStats:uo,shimGetUserMedia:ao,shimMediaStream:co,shimOnTrack:lo,shimPeerConnection:Ir,shimSenderReceiverGetStats:po},Symbol.toStringTag,{value:"Module"}));function Zc(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let r=i.urls||i.url;i.url&&!i.urls&&An("RTCIceServer.url","RTCIceServer.urls");const s=typeof r=="string";return s&&(r=[r]),r=r.filter(o=>{if(o.indexOf("stun:")===0)return!1;const l=o.startsWith("turn")&&!o.startsWith("turn:[")&&o.includes("transport=udp");return l&&!t?(t=!0,!0):l&&!t}),delete i.url,i.urls=s?r[0]:r,!!r.length}})}var vo={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
|
|
2
2
|
`).map(function(i){return i.trim()})},e.splitSections=function(t){var i=t.split(`
|
|
3
3
|
m=`);return i.map(function(r,s){return(s>0?"m="+r:r).trim()+`\r
|
|
4
4
|
`})},e.getDescription=function(t){var i=e.splitSections(t);return i&&i[0]},e.getMediaSections=function(t){var i=e.splitSections(t);return i.shift(),i},e.matchPrefix=function(t,i){return e.splitLines(t).filter(function(r){return r.indexOf(i)===0})},e.parseCandidate=function(t){var i;t.indexOf("a=candidate:")===0?i=t.substring(12).split(" "):i=t.substring(10).split(" ");for(var r={foundation:i[0],component:parseInt(i[1],10),protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]},s=8;s<i.length;s+=2)switch(i[s]){case"raddr":r.relatedAddress=i[s+1];break;case"rport":r.relatedPort=parseInt(i[s+1],10);break;case"tcptype":r.tcpType=i[s+1];break;case"ufrag":r.ufrag=i[s+1],r.usernameFragment=i[s+1];break;default:r[i[s]]=i[s+1];break}return r},e.writeCandidate=function(t){var i=[];i.push(t.foundation),i.push(t.component),i.push(t.protocol.toUpperCase()),i.push(t.priority),i.push(t.address||t.ip),i.push(t.port);var r=t.type;return i.push("typ"),i.push(r),r!=="host"&&t.relatedAddress&&t.relatedPort&&(i.push("raddr"),i.push(t.relatedAddress),i.push("rport"),i.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(i.push("ufrag"),i.push(t.usernameFragment||t.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){var i=t.substr(9).split(" "),r={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),r.name=i[0],r.clockRate=parseInt(i[1],10),r.channels=i.length===3?parseInt(i[2],10):1,r.numChannels=r.channels,r},e.writeRtpMap=function(t){var i=t.payloadType;t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType);var r=t.channels||t.numChannels||1;return"a=rtpmap:"+i+" "+t.name+"/"+t.clockRate+(r!==1?"/"+r:"")+`\r
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PlaneGeometry as Ds,ShaderChunk as bc,Triangle as je,Vector3 as R,Layers as wn,MeshBasicMaterial as wr,DoubleSide as Mr,AdditiveBlending as Fs,Object3D as Tr,InstancedBufferAttribute as It,DynamicDrawUsage as xe,InstancedBufferGeometry as xc,Uniform$1 as Je,ShaderMaterial as Cr,BufferGeometry as Xt,BufferAttribute as me,Mesh as Mn,MeshStandardMaterial as _c,MeshPhysicalMaterial as Sc,Vector2 as Ye,Plane as Ls,Line3 as at,Sphere as Vs,Matrix4 as Be,Box3 as Te,REVISION as js,BackSide as wc,FrontSide as Js,Group as Mc,LineBasicMaterial as Tc,BatchedMesh as Cc,Ray as Pc,DataTexture as Pr,NearestFilter as Yt,UnsignedIntType as yi,IntType as Tn,FloatType as gi,UnsignedByteType as Gs,UnsignedShortType as Ec,ByteType as qs,ShortType as Ac,RGBAFormat as Cn,RGBAIntegerFormat as Er,RGFormat as kc,RedFormat as Rc,RGIntegerFormat as Hs,RedIntegerFormat as Oc,Matrix3 as Bc,Vector4 as Ar}from"./three.light.min.js";const re={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Ws(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function Ic(n){if(!n)throw new Error("No basePath supplied");return await Ws(`${n}/profilesList.json`)}async function zc(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await Ic(e);let s;if(n.profiles.some(a=>{const c=r[a];return c&&(s={profileId:a,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const a=r[t];if(!a)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${a.path}`,deprecated:!!a.deprecated}}const o=await Ws(s.profilePath);let l;if(i){let a;if(n.handedness==="any"?a=o.layouts[Object.keys(o.layouts)[0]]:a=o.layouts[n.handedness],!a)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);a.assetPath&&(l=s.profilePath.replace("profile.json",a.assetPath))}return{profile:o,assetPath:l}}const Nc={xAxis:0,yAxis:0,button:0,state:re.ComponentState.DEFAULT};function Uc(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const r=Math.atan2(e,n);t=Math.cos(r),i=Math.sin(r)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Dc{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===re.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Nc)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=Uc(e,t);switch(this.componentProperty){case re.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case re.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case re.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case re.ComponentProperty.STATE:this.valueNodeProperty===re.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Fc{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const r=new Dc(t.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:re.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=re.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=re.ComponentState.PRESSED:(t.touched||this.values.button>re.ButtonTouchThreshold)&&(this.values.state=re.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class Lc{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new Fc(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const kr=2,Ze=4,ct=4,Xs=4,mt=new Int32Array(2),Ys=new Float32Array(mt.buffer),Zs=new Float64Array(mt.buffer),Pn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Rr;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Rr||(Rr={}));class qi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new qi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return mt[0]=this.readInt32(e),Ys[0]}readFloat64(e){return mt[Pn?0:1]=this.readInt32(e),mt[Pn?1:0]=this.readInt32(e+4),Zs[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){Ys[0]=t,this.writeInt32(e,mt[0])}writeFloat64(e,t){Zs[0]=t,this.writeInt32(e,mt[Pn?0:1]),this.writeInt32(e+4,mt[Pn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Ze+ct)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<ct;t++)e+=String.fromCharCode(this.readInt8(this.position_+Ze+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let r="",s=0;if(e+=Ze,t===Rr.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;s<i;){let o;const l=this.readUint8(e+s++);if(l<192)o=l;else{const a=this.readUint8(e+s++);if(l<224)o=(l&31)<<6|a&63;else{const c=this.readUint8(e+s++);if(l<240)o=(l&15)<<12|(a&63)<<6|c&63;else{const h=this.readUint8(e+s++);o=(l&7)<<18|(a&63)<<12|(c&63)<<6|h&63}}}o<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode((o>>10)+55296,(o&1024-1)+56320))}return r}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Ze}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let t=0;t<ct;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+Ze+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let r=0;r<t;++r)e(r)!==null&&i.push(e(r));return i}createObjList(e,t){const i=[];for(let r=0;r<t;++r){const s=e(r);s!==null&&i.push(s.unpack())}return i}}class zs{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=qi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const r=this.bb.capacity();this.bb=zs.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,r=qi.allocate(i);return r.setPosition(i-t),r.bytes().set(e.bytes(),i-t),r}addOffset(e){this.prep(Ze,0),this.writeInt32(this.offset()-e+Ze)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const r=2;this.addInt16(e-this.object_start);const s=(i+r)*kr;this.addInt16(s);let o=0;const l=this.space;e:for(t=0;t<this.vtables.length;t++){const a=this.bb.capacity()-this.vtables[t];if(s==this.bb.readInt16(a)){for(let c=kr;c<s;c+=kr)if(this.bb.readInt16(l+c)!=this.bb.readInt16(a+c))continue e;o=this.vtables[t];break}}return o?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,o-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const r=i?Xs:0;if(t){const s=t;if(this.prep(this.minalign,Ze+ct+r),s.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let o=ct-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Ze+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,r=i-this.bb.readInt32(i);if(this.bb.readInt16(r+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(Ze,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let r;const s=e.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const o=e.charCodeAt(i++);r=(s<<10)+o+(65536-56623104-56320)}r<128?t.push(r):(r<2048?t.push(r>>6&31|192):(r<65536?t.push(r>>12&15|224):t.push(r>>18&7|240,r>>12&63|128),t.push(r>>6&63|128)),t.push(r&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,r=this.space,s=this.bb.bytes();i<t.length;i++)s[r++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const r=e[i];if(r!==null)t.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function En(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Qs={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(r){typeof r=="number"?this._pieces.push(r):(this.flush(),this._parts.push(r))},i.prototype.flush=function(){if(this._pieces.length>0){var r=new Uint8Array(this._pieces);e.useArrayBufferView||(r=r.buffer),this._parts.push(r),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var r=new t,s=0,o=this._parts.length;s<o;s++)r.append(this._parts[s]);return r.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(Qs);var Ks=Qs.exports,Vc=Ks.BufferBuilder,$s=Ks.binaryFeatures,jc={unpack:function(n){var e=new ae(n);return e.unpack()},pack:function(n){var e=new ce;e.pack(n);var t=e.getBuffer();return t}},Jc=jc;function ae(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}ae.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},ae.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},ae.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},ae.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},ae.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},ae.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},ae.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},ae.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},ae.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},ae.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},ae.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",r,s;t<n;)r=e[t],r<128?(i+=String.fromCharCode(r),t++):(r^192)<32?(s=(r^192)<<6|e[t+1]&63,i+=String.fromCharCode(s),t+=2):(s=(r&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(s),t+=3);return this.index+=n,i},ae.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},ae.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),r=this.unpack();e[i]=r}return e},ae.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},ae.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,r=n&1048575|1048576,s=r*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*s},ae.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function ce(){this.bufferBuilder=new Vc}ce.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},ce.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},ce.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_string=function(n){var e=qc(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},ce.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},ce.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,r=Math.floor(i*Math.pow(2,52)),s=Math.pow(2,32),o=e<<31|t+1023<<20|r/s&1048575,l=r%s;this.bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(l)},ce.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},ce.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},ce.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},ce.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},ce.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},ce.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function Gc(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function qc(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,Gc).length}const eo=En(Jc);let to=!0,io=!0;function vi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function Zt(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(o,l){if(o!==e)return r.apply(this,arguments);const a=c=>{const h=t(c);h&&(l.handleEvent?l.handleEvent(h):l(h))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(l,a),r.apply(this,[o,a])};const s=i.removeEventListener;i.removeEventListener=function(o,l){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(l))return s.apply(this,arguments);const a=this._eventMap[e].get(l);return this._eventMap[e].delete(l),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,a])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Hc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(to=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Wc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(io=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Or(){if(typeof window=="object"){if(to)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function An(n,e){io&&console.warn(n+" is deprecated, please use "+e+" instead.")}function Xc(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=vi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=vi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=vi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=vi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function no(n){return Object.prototype.toString.call(n)==="[object Object]"}function ro(n){return no(n)?Object.keys(n).reduce(function(e,t){const i=no(n[t]),r=i?ro(n[t]):n[t],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[t]:r})},{}):n}function Br(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Br(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(r=>{Br(n,n.get(r),t)})}))}function so(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",r=new Map;if(e===null)return r;const s=[];return n.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{n.forEach(l=>{l.type===i&&l.trackId===o.id&&Br(n,l,r)})}),r}const oo=Or;function ao(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(l){if(typeof l!="object"||l.mandatory||l.optional)return l;const a={};return Object.keys(l).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const h=typeof l[c]=="object"?l[c]:{ideal:l[c]};h.exact!==void 0&&typeof h.exact=="number"&&(h.min=h.max=h.exact);const u=function(d,p){return d?d+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(h.ideal!==void 0){a.optional=a.optional||[];let d={};typeof h.ideal=="number"?(d[u("min",c)]=h.ideal,a.optional.push(d),d={},d[u("max",c)]=h.ideal,a.optional.push(d)):(d[u("",c)]=h.ideal,a.optional.push(d))}h.exact!==void 0&&typeof h.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[u("",c)]=h.exact):["min","max"].forEach(d=>{h[d]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[u(d,c)]=h[d])})}),l.advanced&&(a.optional=(a.optional||[]).concat(l.advanced)),a},r=function(l,a){if(e.version>=61)return a(l);if(l=JSON.parse(JSON.stringify(l)),l&&typeof l.audio=="object"){const c=function(h,u,d){u in h&&!(d in h)&&(h[d]=h[u],delete h[u])};l=JSON.parse(JSON.stringify(l)),c(l.audio,"autoGainControl","googAutoGainControl"),c(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=i(l.audio)}if(l&&typeof l.video=="object"){let c=l.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const h=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!h)){delete l.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return t.mediaDevices.enumerateDevices().then(d=>{d=d.filter(f=>f.kind==="videoinput");let p=d.find(f=>u.some(m=>f.label.toLowerCase().includes(m)));return!p&&d.length&&u.includes("back")&&(p=d[d.length-1]),p&&(l.video.deviceId=c.exact?{exact:p.deviceId}:{ideal:p.deviceId}),l.video=i(l.video),oo("chrome: "+JSON.stringify(l)),a(l)})}l.video=i(l.video)}return oo("chrome: "+JSON.stringify(l)),a(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(l,a,c){r(l,h=>{t.webkitGetUserMedia(h,a,u=>{c&&c(s(u))})})};if(t.getUserMedia=o.bind(t),t.mediaDevices.getUserMedia){const l=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(a){return r(a,c=>l(c).then(h=>{if(c.audio&&!h.getAudioTracks().length||c.video&&!h.getVideoTracks().length)throw h.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return h},h=>Promise.reject(s(h))))}}}function Yc(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const r=t.video&&t.video.width,s=t.video&&t.video.height,o=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:o||3}},r&&(t.video.mandatory.maxWidth=r),s&&(t.video.mandatory.maxHeight=s),n.navigator.mediaDevices.getUserMedia(t)})}}}function co(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function lo(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)}),t.stream.getTracks().forEach(i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Zt(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ho(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,l){let a=r.apply(this,arguments);return a||(a=e(this,o),this._senders.push(a)),a};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const l=this._senders.indexOf(o);l!==-1&&this._senders.splice(l,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],t.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],i.apply(this,[r]),r.getTracks().forEach(s=>{const o=this._senders.find(l=>l.track===s);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function uo(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,r]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const s=function(l){const a={};return l.result().forEach(c=>{const h={id:c.id,timestamp:c.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[c.type]||c.type};c.names().forEach(u=>{h[u]=c.stat(u)}),a[h.id]=h}),a},o=function(l){return new Map(Object.keys(l).map(a=>[a,l[a]]))};if(arguments.length>=2){const l=function(a){i(o(s(a)))};return e.apply(this,[l,t])}return new Promise((l,a)=>{e.apply(this,[function(c){l(o(s(c)))},a])}).then(i,r)}}function po(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=i.apply(this,arguments);return r._pc=this,r}),n.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>so(s,r.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),Zt(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>so(r,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,r,s;return this.getSenders().forEach(o=>{o.track===t&&(i?s=!0:i=o)}),this.getReceivers().forEach(o=>(o.track===t&&(r?s=!0:r=o),o.track===t)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function fo(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const l=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(l)===-1&&this._shimmedLocalStreams[o.id].push(l):this._shimmedLocalStreams[o.id]=[o,l],l};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(a=>{if(this.getSenders().find(c=>c.track===a))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();t.apply(this,arguments);const l=this.getSenders().filter(a=>o.indexOf(a)===-1);this._shimmedLocalStreams[s.id]=[s].concat(l)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],i.apply(this,arguments)};const r=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const l=this._shimmedLocalStreams[o].indexOf(s);l!==-1&&this._shimmedLocalStreams[o].splice(l,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),r.apply(this,arguments)}}function mo(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return fo(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const c=t.apply(this);return this._reverseStreams=this._reverseStreams||{},c.map(h=>this._reverseStreams[h.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(c){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},c.getTracks().forEach(h=>{if(this.getSenders().find(u=>u.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[c.id]){const h=new n.MediaStream(c.getTracks());this._streams[c.id]=h,this._reverseStreams[h.id]=c,c=h}i.apply(this,[c])};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(c){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[c.id]||c]),delete this._reverseStreams[this._streams[c.id]?this._streams[c.id].id:c.id],delete this._streams[c.id]},n.RTCPeerConnection.prototype.addTrack=function(c,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const u=[].slice.call(arguments,1);if(u.length!==1||!u[0].getTracks().find(p=>p===c))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===c))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const d=this._streams[h.id];if(d)d.addTrack(c),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([c]);this._streams[h.id]=p,this._reverseStreams[p.id]=h,this.addStream(p)}return this.getSenders().find(p=>p.track===c)};function s(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(f.id,"g"),p.id)}),new RTCSessionDescription({type:h.type,sdp:u})}function o(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(p.id,"g"),f.id)}),new RTCSessionDescription({type:h.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const h=n.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=s(this,p);d[0].apply(null,[f])},p=>{d[1]&&d[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>s(this,p))}};n.RTCPeerConnection.prototype[c]=u[c]});const l=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?l.apply(this,arguments):(arguments[0]=o(this,arguments[0]),l.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const c=a.get.apply(this);return c.type===""?c:s(this,c)}}),n.RTCPeerConnection.prototype.removeTrack=function(c){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!c._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(c._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let h;Object.keys(this._streams).forEach(u=>{this._streams[u].getTracks().find(d=>c.track===d)&&(h=this._streams[u])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(c.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ir(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=r[t]})}function yo(n,e){Zt(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const go=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:yo,shimAddTrackRemoveTrack:mo,shimAddTrackRemoveTrackWithNative:fo,shimGetDisplayMedia:Yc,shimGetSendersWithDtmf:ho,shimGetStats:uo,shimGetUserMedia:ao,shimMediaStream:co,shimOnTrack:lo,shimPeerConnection:Ir,shimSenderReceiverGetStats:po},Symbol.toStringTag,{value:"Module"}));function Zc(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let r=i.urls||i.url;i.url&&!i.urls&&An("RTCIceServer.url","RTCIceServer.urls");const s=typeof r=="string";return s&&(r=[r]),r=r.filter(o=>{if(o.indexOf("stun:")===0)return!1;const l=o.startsWith("turn")&&!o.startsWith("turn:[")&&o.includes("transport=udp");return l&&!t?(t=!0,!0):l&&!t}),delete i.url,i.urls=s?r[0]:r,!!r.length}})}var vo={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
|
|
1
|
+
import{PlaneGeometry as Ds,ShaderChunk as bc,Triangle as je,Vector3 as R,Layers as wn,MeshBasicMaterial as wr,DoubleSide as Mr,AdditiveBlending as Fs,Object3D as Tr,InstancedBufferAttribute as It,DynamicDrawUsage as xe,InstancedBufferGeometry as xc,Uniform$1 as Je,ShaderMaterial as Cr,BufferGeometry as Xt,BufferAttribute as me,Mesh as Mn,MeshStandardMaterial as _c,MeshPhysicalMaterial as Sc,Vector2 as Ye,Plane as Ls,Line3 as at,Sphere as Vs,Matrix4 as Be,Box3 as Te,REVISION as js,BackSide as wc,FrontSide as Js,Group as Mc,LineBasicMaterial as Tc,BatchedMesh as Cc,Ray as Pc,DataTexture as Pr,NearestFilter as Yt,UnsignedIntType as yi,IntType as Tn,FloatType as gi,UnsignedByteType as Gs,UnsignedShortType as Ec,ByteType as qs,ShortType as Ac,RGBAFormat as Cn,RGBAIntegerFormat as Er,RGFormat as kc,RedFormat as Rc,RGIntegerFormat as Hs,RedIntegerFormat as Oc,Matrix3 as Bc,Vector4 as Ar}from"./three-41cc41b9.light.min.js";const re={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Ws(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function Ic(n){if(!n)throw new Error("No basePath supplied");return await Ws(`${n}/profilesList.json`)}async function zc(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await Ic(e);let s;if(n.profiles.some(a=>{const c=r[a];return c&&(s={profileId:a,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const a=r[t];if(!a)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${a.path}`,deprecated:!!a.deprecated}}const o=await Ws(s.profilePath);let l;if(i){let a;if(n.handedness==="any"?a=o.layouts[Object.keys(o.layouts)[0]]:a=o.layouts[n.handedness],!a)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);a.assetPath&&(l=s.profilePath.replace("profile.json",a.assetPath))}return{profile:o,assetPath:l}}const Nc={xAxis:0,yAxis:0,button:0,state:re.ComponentState.DEFAULT};function Uc(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const r=Math.atan2(e,n);t=Math.cos(r),i=Math.sin(r)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Dc{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===re.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Nc)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=Uc(e,t);switch(this.componentProperty){case re.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case re.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case re.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case re.ComponentProperty.STATE:this.valueNodeProperty===re.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Fc{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const r=new Dc(t.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:re.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=re.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=re.ComponentState.PRESSED:(t.touched||this.values.button>re.ButtonTouchThreshold)&&(this.values.state=re.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===re.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>re.AxisTouchThreshold&&(this.values.state=re.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class Lc{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new Fc(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const kr=2,Ze=4,ct=4,Xs=4,mt=new Int32Array(2),Ys=new Float32Array(mt.buffer),Zs=new Float64Array(mt.buffer),Pn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Rr;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Rr||(Rr={}));class qi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new qi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return mt[0]=this.readInt32(e),Ys[0]}readFloat64(e){return mt[Pn?0:1]=this.readInt32(e),mt[Pn?1:0]=this.readInt32(e+4),Zs[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){Ys[0]=t,this.writeInt32(e,mt[0])}writeFloat64(e,t){Zs[0]=t,this.writeInt32(e,mt[Pn?0:1]),this.writeInt32(e+4,mt[Pn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Ze+ct)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<ct;t++)e+=String.fromCharCode(this.readInt8(this.position_+Ze+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let r="",s=0;if(e+=Ze,t===Rr.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;s<i;){let o;const l=this.readUint8(e+s++);if(l<192)o=l;else{const a=this.readUint8(e+s++);if(l<224)o=(l&31)<<6|a&63;else{const c=this.readUint8(e+s++);if(l<240)o=(l&15)<<12|(a&63)<<6|c&63;else{const h=this.readUint8(e+s++);o=(l&7)<<18|(a&63)<<12|(c&63)<<6|h&63}}}o<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode((o>>10)+55296,(o&1024-1)+56320))}return r}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Ze}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let t=0;t<ct;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+Ze+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let r=0;r<t;++r)e(r)!==null&&i.push(e(r));return i}createObjList(e,t){const i=[];for(let r=0;r<t;++r){const s=e(r);s!==null&&i.push(s.unpack())}return i}}class zs{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=qi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const r=this.bb.capacity();this.bb=zs.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,r=qi.allocate(i);return r.setPosition(i-t),r.bytes().set(e.bytes(),i-t),r}addOffset(e){this.prep(Ze,0),this.writeInt32(this.offset()-e+Ze)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const r=2;this.addInt16(e-this.object_start);const s=(i+r)*kr;this.addInt16(s);let o=0;const l=this.space;e:for(t=0;t<this.vtables.length;t++){const a=this.bb.capacity()-this.vtables[t];if(s==this.bb.readInt16(a)){for(let c=kr;c<s;c+=kr)if(this.bb.readInt16(l+c)!=this.bb.readInt16(a+c))continue e;o=this.vtables[t];break}}return o?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,o-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const r=i?Xs:0;if(t){const s=t;if(this.prep(this.minalign,Ze+ct+r),s.length!=ct)throw new Error("FlatBuffers: file identifier must be length "+ct);for(let o=ct-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Ze+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,r=i-this.bb.readInt32(i);if(this.bb.readInt16(r+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(Ze,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let r;const s=e.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const o=e.charCodeAt(i++);r=(s<<10)+o+(65536-56623104-56320)}r<128?t.push(r):(r<2048?t.push(r>>6&31|192):(r<65536?t.push(r>>12&15|224):t.push(r>>18&7|240,r>>12&63|128),t.push(r>>6&63|128)),t.push(r&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,r=this.space,s=this.bb.bytes();i<t.length;i++)s[r++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const r=e[i];if(r!==null)t.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function En(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Qs={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(r){typeof r=="number"?this._pieces.push(r):(this.flush(),this._parts.push(r))},i.prototype.flush=function(){if(this._pieces.length>0){var r=new Uint8Array(this._pieces);e.useArrayBufferView||(r=r.buffer),this._parts.push(r),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var r=new t,s=0,o=this._parts.length;s<o;s++)r.append(this._parts[s]);return r.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(Qs);var Ks=Qs.exports,Vc=Ks.BufferBuilder,$s=Ks.binaryFeatures,jc={unpack:function(n){var e=new ae(n);return e.unpack()},pack:function(n){var e=new ce;e.pack(n);var t=e.getBuffer();return t}},Jc=jc;function ae(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}ae.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},ae.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},ae.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},ae.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},ae.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},ae.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},ae.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},ae.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},ae.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},ae.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},ae.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",r,s;t<n;)r=e[t],r<128?(i+=String.fromCharCode(r),t++):(r^192)<32?(s=(r^192)<<6|e[t+1]&63,i+=String.fromCharCode(s),t+=2):(s=(r&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(s),t+=3);return this.index+=n,i},ae.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},ae.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),r=this.unpack();e[i]=r}return e},ae.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},ae.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,r=n&1048575|1048576,s=r*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*s},ae.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function ce(){this.bufferBuilder=new Vc}ce.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},ce.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)$s.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},ce.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_string=function(n){var e=qc(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},ce.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},ce.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},ce.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,r=Math.floor(i*Math.pow(2,52)),s=Math.pow(2,32),o=e<<31|t+1023<<20|r/s&1048575,l=r%s;this.bufferBuilder.append(203),this.pack_int32(o),this.pack_int32(l)},ce.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},ce.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},ce.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},ce.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},ce.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},ce.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},ce.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function Gc(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function qc(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,Gc).length}const eo=En(Jc);let to=!0,io=!0;function vi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function Zt(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(o,l){if(o!==e)return r.apply(this,arguments);const a=c=>{const h=t(c);h&&(l.handleEvent?l.handleEvent(h):l(h))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(l,a),r.apply(this,[o,a])};const s=i.removeEventListener;i.removeEventListener=function(o,l){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(l))return s.apply(this,arguments);const a=this._eventMap[e].get(l);return this._eventMap[e].delete(l),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,a])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Hc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(to=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Wc(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(io=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Or(){if(typeof window=="object"){if(to)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function An(n,e){io&&console.warn(n+" is deprecated, please use "+e+" instead.")}function Xc(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=vi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=vi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=vi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=vi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function no(n){return Object.prototype.toString.call(n)==="[object Object]"}function ro(n){return no(n)?Object.keys(n).reduce(function(e,t){const i=no(n[t]),r=i?ro(n[t]):n[t],s=i&&!Object.keys(r).length;return r===void 0||s?e:Object.assign(e,{[t]:r})},{}):n}function Br(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Br(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(r=>{Br(n,n.get(r),t)})}))}function so(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",r=new Map;if(e===null)return r;const s=[];return n.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{n.forEach(l=>{l.type===i&&l.trackId===o.id&&Br(n,l,r)})}),r}const oo=Or;function ao(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(l){if(typeof l!="object"||l.mandatory||l.optional)return l;const a={};return Object.keys(l).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const h=typeof l[c]=="object"?l[c]:{ideal:l[c]};h.exact!==void 0&&typeof h.exact=="number"&&(h.min=h.max=h.exact);const u=function(d,p){return d?d+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(h.ideal!==void 0){a.optional=a.optional||[];let d={};typeof h.ideal=="number"?(d[u("min",c)]=h.ideal,a.optional.push(d),d={},d[u("max",c)]=h.ideal,a.optional.push(d)):(d[u("",c)]=h.ideal,a.optional.push(d))}h.exact!==void 0&&typeof h.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[u("",c)]=h.exact):["min","max"].forEach(d=>{h[d]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[u(d,c)]=h[d])})}),l.advanced&&(a.optional=(a.optional||[]).concat(l.advanced)),a},r=function(l,a){if(e.version>=61)return a(l);if(l=JSON.parse(JSON.stringify(l)),l&&typeof l.audio=="object"){const c=function(h,u,d){u in h&&!(d in h)&&(h[d]=h[u],delete h[u])};l=JSON.parse(JSON.stringify(l)),c(l.audio,"autoGainControl","googAutoGainControl"),c(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=i(l.audio)}if(l&&typeof l.video=="object"){let c=l.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const h=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!h)){delete l.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return t.mediaDevices.enumerateDevices().then(d=>{d=d.filter(f=>f.kind==="videoinput");let p=d.find(f=>u.some(m=>f.label.toLowerCase().includes(m)));return!p&&d.length&&u.includes("back")&&(p=d[d.length-1]),p&&(l.video.deviceId=c.exact?{exact:p.deviceId}:{ideal:p.deviceId}),l.video=i(l.video),oo("chrome: "+JSON.stringify(l)),a(l)})}l.video=i(l.video)}return oo("chrome: "+JSON.stringify(l)),a(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(l,a,c){r(l,h=>{t.webkitGetUserMedia(h,a,u=>{c&&c(s(u))})})};if(t.getUserMedia=o.bind(t),t.mediaDevices.getUserMedia){const l=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(a){return r(a,c=>l(c).then(h=>{if(c.audio&&!h.getAudioTracks().length||c.video&&!h.getVideoTracks().length)throw h.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return h},h=>Promise.reject(s(h))))}}}function Yc(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const r=t.video&&t.video.width,s=t.video&&t.video.height,o=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:o||3}},r&&(t.video.mandatory.maxWidth=r),s&&(t.video.mandatory.maxHeight=s),n.navigator.mediaDevices.getUserMedia(t)})}}}function co(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function lo(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)}),t.stream.getTracks().forEach(i=>{let r;n.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[t.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Zt(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ho(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,l){let a=r.apply(this,arguments);return a||(a=e(this,o),this._senders.push(a)),a};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const l=this._senders.indexOf(o);l!==-1&&this._senders.splice(l,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],t.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],i.apply(this,[r]),r.getTracks().forEach(s=>{const o=this._senders.find(l=>l.track===s);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function uo(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,r]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const s=function(l){const a={};return l.result().forEach(c=>{const h={id:c.id,timestamp:c.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[c.type]||c.type};c.names().forEach(u=>{h[u]=c.stat(u)}),a[h.id]=h}),a},o=function(l){return new Map(Object.keys(l).map(a=>[a,l[a]]))};if(arguments.length>=2){const l=function(a){i(o(s(a)))};return e.apply(this,[l,t])}return new Promise((l,a)=>{e.apply(this,[function(c){l(o(s(c)))},a])}).then(i,r)}}function po(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=i.apply(this,arguments);return r._pc=this,r}),n.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>so(s,r.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),Zt(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>so(r,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,r,s;return this.getSenders().forEach(o=>{o.track===t&&(i?s=!0:i=o)}),this.getReceivers().forEach(o=>(o.track===t&&(r?s=!0:r=o),o.track===t)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function fo(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const l=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(l)===-1&&this._shimmedLocalStreams[o.id].push(l):this._shimmedLocalStreams[o.id]=[o,l],l};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(a=>{if(this.getSenders().find(c=>c.track===a))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();t.apply(this,arguments);const l=this.getSenders().filter(a=>o.indexOf(a)===-1);this._shimmedLocalStreams[s.id]=[s].concat(l)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],i.apply(this,arguments)};const r=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const l=this._shimmedLocalStreams[o].indexOf(s);l!==-1&&this._shimmedLocalStreams[o].splice(l,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),r.apply(this,arguments)}}function mo(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return fo(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const c=t.apply(this);return this._reverseStreams=this._reverseStreams||{},c.map(h=>this._reverseStreams[h.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(c){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},c.getTracks().forEach(h=>{if(this.getSenders().find(u=>u.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[c.id]){const h=new n.MediaStream(c.getTracks());this._streams[c.id]=h,this._reverseStreams[h.id]=c,c=h}i.apply(this,[c])};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(c){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[c.id]||c]),delete this._reverseStreams[this._streams[c.id]?this._streams[c.id].id:c.id],delete this._streams[c.id]},n.RTCPeerConnection.prototype.addTrack=function(c,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const u=[].slice.call(arguments,1);if(u.length!==1||!u[0].getTracks().find(p=>p===c))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===c))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const d=this._streams[h.id];if(d)d.addTrack(c),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([c]);this._streams[h.id]=p,this._reverseStreams[p.id]=h,this.addStream(p)}return this.getSenders().find(p=>p.track===c)};function s(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(f.id,"g"),p.id)}),new RTCSessionDescription({type:h.type,sdp:u})}function o(c,h){let u=h.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const p=c._reverseStreams[d],f=c._streams[p.id];u=u.replace(new RegExp(p.id,"g"),f.id)}),new RTCSessionDescription({type:h.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const h=n.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=s(this,p);d[0].apply(null,[f])},p=>{d[1]&&d[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>s(this,p))}};n.RTCPeerConnection.prototype[c]=u[c]});const l=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?l.apply(this,arguments):(arguments[0]=o(this,arguments[0]),l.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const c=a.get.apply(this);return c.type===""?c:s(this,c)}}),n.RTCPeerConnection.prototype.removeTrack=function(c){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!c._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(c._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let h;Object.keys(this._streams).forEach(u=>{this._streams[u].getTracks().find(d=>c.track===d)&&(h=this._streams[u])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(c.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ir(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=r[t]})}function yo(n,e){Zt(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const go=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:yo,shimAddTrackRemoveTrack:mo,shimAddTrackRemoveTrackWithNative:fo,shimGetDisplayMedia:Yc,shimGetSendersWithDtmf:ho,shimGetStats:uo,shimGetUserMedia:ao,shimMediaStream:co,shimOnTrack:lo,shimPeerConnection:Ir,shimSenderReceiverGetStats:po},Symbol.toStringTag,{value:"Module"}));function Zc(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let r=i.urls||i.url;i.url&&!i.urls&&An("RTCIceServer.url","RTCIceServer.urls");const s=typeof r=="string";return s&&(r=[r]),r=r.filter(o=>{if(o.indexOf("stun:")===0)return!1;const l=o.startsWith("turn")&&!o.startsWith("turn:[")&&o.includes("transport=udp");return l&&!t?(t=!0,!0):l&&!t}),delete i.url,i.urls=s?r[0]:r,!!r.length}})}var vo={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
|
|
2
2
|
`).map(function(i){return i.trim()})},e.splitSections=function(t){var i=t.split(`
|
|
3
3
|
m=`);return i.map(function(r,s){return(s>0?"m="+r:r).trim()+`\r
|
|
4
4
|
`})},e.getDescription=function(t){var i=e.splitSections(t);return i&&i[0]},e.getMediaSections=function(t){var i=e.splitSections(t);return i.shift(),i},e.matchPrefix=function(t,i){return e.splitLines(t).filter(function(r){return r.indexOf(i)===0})},e.parseCandidate=function(t){var i;t.indexOf("a=candidate:")===0?i=t.substring(12).split(" "):i=t.substring(10).split(" ");for(var r={foundation:i[0],component:parseInt(i[1],10),protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]},s=8;s<i.length;s+=2)switch(i[s]){case"raddr":r.relatedAddress=i[s+1];break;case"rport":r.relatedPort=parseInt(i[s+1],10);break;case"tcptype":r.tcpType=i[s+1];break;case"ufrag":r.ufrag=i[s+1],r.usernameFragment=i[s+1];break;default:r[i[s]]=i[s+1];break}return r},e.writeCandidate=function(t){var i=[];i.push(t.foundation),i.push(t.component),i.push(t.protocol.toUpperCase()),i.push(t.priority),i.push(t.address||t.ip),i.push(t.port);var r=t.type;return i.push("typ"),i.push(r),r!=="host"&&t.relatedAddress&&t.relatedPort&&(i.push("raddr"),i.push(t.relatedAddress),i.push("rport"),i.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(i.push("ufrag"),i.push(t.usernameFragment||t.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){var i=t.substr(9).split(" "),r={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),r.name=i[0],r.clockRate=parseInt(i[1],10),r.channels=i.length===3?parseInt(i[2],10):1,r.numChannels=r.channels,r},e.writeRtpMap=function(t){var i=t.payloadType;t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType);var r=t.channels||t.numChannels||1;return"a=rtpmap:"+i+" "+t.name+"/"+t.clockRate+(r!==1?"/"+r:"")+`\r
|
|
@@ -232,7 +232,7 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
232
232
|
registerProvider(prov: INetworkingWebsocketUrlProvider): void;
|
|
233
233
|
/** Used to connect to the networking server */
|
|
234
234
|
connect(url?: string): Promise<boolean>;
|
|
235
|
-
/**
|
|
235
|
+
/** Disconnect from the networking backend + reset internal state */
|
|
236
236
|
disconnect(): void;
|
|
237
237
|
private _listeners;
|
|
238
238
|
private _listenersBinary;
|
|
@@ -481,11 +481,19 @@ export class NetworkConnection {
|
|
|
481
481
|
return this.connectWebsocket();
|
|
482
482
|
}
|
|
483
483
|
;
|
|
484
|
-
/**
|
|
484
|
+
/** Disconnect from the networking backend + reset internal state */
|
|
485
485
|
disconnect() {
|
|
486
486
|
this._ws?.close();
|
|
487
487
|
this._ws = undefined;
|
|
488
488
|
networkingServerUrl = undefined;
|
|
489
|
+
// Reset all state
|
|
490
|
+
this._currentRoomAllowEditing = true;
|
|
491
|
+
this._currentRoomName = null;
|
|
492
|
+
this._currentRoomViewId = null;
|
|
493
|
+
this._isInRoom = false;
|
|
494
|
+
this._currentInRoom.length = 0;
|
|
495
|
+
this._state = {};
|
|
496
|
+
this._currentDelay = -1;
|
|
489
497
|
}
|
|
490
498
|
_listeners = {};
|
|
491
499
|
_listenersBinary = {};
|
|
@@ -660,7 +668,10 @@ export class NetworkConnection {
|
|
|
660
668
|
if (model.room === this.currentRoomName) {
|
|
661
669
|
this._isInRoom = false;
|
|
662
670
|
this._currentRoomName = null;
|
|
671
|
+
this._currentRoomAllowEditing = true;
|
|
663
672
|
this._currentInRoom.length = 0;
|
|
673
|
+
if (debugnetBin || isDevEnvironment())
|
|
674
|
+
console.debug("Left Needle Engine Room: " + model.room);
|
|
664
675
|
}
|
|
665
676
|
break;
|
|
666
677
|
case RoomEvents.UserJoinedRoom:
|
|
@@ -698,7 +709,7 @@ export class NetworkConnection {
|
|
|
698
709
|
this._currentDelay = this.context.time.time - time;
|
|
699
710
|
}
|
|
700
711
|
if (debugNet)
|
|
701
|
-
console.log(
|
|
712
|
+
console.log(`Current latency: ${(this._currentDelay * 1000).toFixed()} ms`, "Clients in room: " + this._currentInRoom?.length);
|
|
702
713
|
break;
|
|
703
714
|
}
|
|
704
715
|
}
|