@100mslive/react-sdk 0.0.1-alpha → 0.0.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +1 -0
- package/dist/_virtual/eventemitter2.js_commonjs-module.js +1 -0
- package/dist/_virtual/grammar.js_commonjs-module.js +1 -0
- package/dist/_virtual/parser.js_commonjs-exports.js +1 -0
- package/dist/_virtual/sdp.js_commonjs-module.js +1 -0
- package/dist/_virtual/ua-parser.js_commonjs-module.js +1 -0
- package/dist/index.cjs.js +8 -1
- package/dist/node_modules/eventemitter2/lib/eventemitter2.js +8 -0
- package/dist/node_modules/sdp/sdp.js +1 -0
- package/dist/node_modules/sdp-transform/lib/grammar.js +1 -0
- package/dist/node_modules/sdp-transform/lib/parser.js +1 -0
- package/dist/node_modules/ua-parser-js/src/ua-parser.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/adapter_core.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/adapter_factory.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/chrome/chrome_shim.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/chrome/getdisplaymedia.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/chrome/getusermedia.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/common_shim.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/firefox/getusermedia.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/safari/safari_shim.js +1 -0
- package/dist/node_modules/webrtc-adapter/src/js/utils.js +1 -0
- package/dist/packages/hms-video-web/dist/hms-video.esm.js +1 -0
- package/dist/{node_modules → packages/react-sdk/node_modules}/zustand/esm/shallow.js +0 -0
- package/dist/packages/react-sdk/src/hooks/HmsRoomProvider.js +1 -0
- package/dist/{src → packages/react-sdk/src}/hooks/store.js +1 -1
- package/dist/{src → packages/react-sdk/src}/hooks/useAVToggle.js +0 -0
- package/dist/packages/react-sdk/src/hooks/useAudioLevel.js +1 -0
- package/dist/{src → packages/react-sdk/src}/hooks/useDevices.js +0 -0
- package/dist/packages/react-sdk/src/hooks/usePreview.js +1 -0
- package/dist/packages/react-sdk/src/hooks/useVideo.js +1 -0
- package/dist/packages/react-sdk/src/hooks/useVideoList.js +1 -0
- package/dist/{src → packages/react-sdk/src}/hooks/useVideoTile.js +0 -0
- package/dist/packages/react-sdk/src/index.js +1 -0
- package/dist/{src → packages/react-sdk/src}/utils/isBrowser.js +0 -0
- package/dist/{src → packages/react-sdk/src}/utils/layout.js +0 -0
- package/dist/{src → packages/react-sdk/src}/utils/logger.js +0 -0
- package/dist/{hooks → src/hooks}/HmsRoomProvider.d.ts +6 -4
- package/dist/{hooks → src/hooks}/store.d.ts +4 -2
- package/dist/src/hooks/types.d.ts +5 -0
- package/dist/{hooks → src/hooks}/useAVToggle.d.ts +0 -0
- package/dist/src/hooks/useAudioLevel.d.ts +6 -0
- package/dist/{hooks → src/hooks}/useDevices.d.ts +0 -0
- package/dist/{hooks → src/hooks}/usePreview.d.ts +2 -1
- package/dist/src/hooks/useVideo.d.ts +2 -0
- package/dist/{hooks/useVideoListLayout.d.ts → src/hooks/useVideoList.d.ts} +4 -4
- package/dist/{hooks → src/hooks}/useVideoTile.d.ts +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +4 -2
- package/dist/{utils → src/utils}/groupBy.d.ts +0 -0
- package/dist/{utils → src/utils}/isBrowser.d.ts +0 -0
- package/dist/{utils → src/utils}/layout.d.ts +0 -0
- package/dist/{utils → src/utils}/logger.d.ts +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +36 -33
- package/CHANGELOG.md +0 -5
- package/dist/hooks/types.d.ts +0 -5
- package/dist/src/hooks/HmsRoomProvider.js +0 -1
- package/dist/src/hooks/usePreview.js +0 -1
- package/dist/src/hooks/useVideoListLayout.js +0 -1
- package/dist/src/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};export{e as commonjsGlobal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={exports:{}};export{e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={exports:{}};export{r as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={exports:{}};export{r as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={exports:{}};export{r as u};
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
"use strict";function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},e.apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),i=require("@100mslive/hms-video-store"),o=require("zustand"),a=require("@100mslive/hms-video");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,n=s(t),l=s(o);function c(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const i=Object.keys(e);if(i.length!==Object.keys(t).length)return!1;for(let o=0;o<i.length;o++)if(!Object.prototype.hasOwnProperty.call(t,i[o])||!Object.is(e[i[o]],t[i[o]]))return!1;return!0}!function(e){e[e.VERBOSE=0]="VERBOSE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.NONE=5]="NONE"}(r||(r={}));class u{static v(e,...t){this.log(r.VERBOSE,e,...t)}static d(e,...t){this.log(r.DEBUG,e,...t)}static i(e,...t){this.log(r.INFO,e,...t)}static w(e,...t){this.log(r.WARN,e,...t)}static e(e,...t){this.log(r.ERROR,e,...t)}static log(e,t,...i){if(!(this.level.valueOf()>e.valueOf()))switch(e){case r.VERBOSE:console.log("HMSui-components: ",t,...i);break;case r.DEBUG:console.debug("HMSui-components: ",t,...i);break;case r.INFO:console.info("HMSui-components: ",t,...i);break;case r.WARN:console.warn("HMSui-components: ",t,...i);break;case r.ERROR:console.error("HMSui-components: ",t,...i)}}}u.level=r.VERBOSE;const h="It seems like you forgot to add your component within a top level HMSRoomProvider, please refer to 100ms react docs(https://docs.100ms.live/javascript/v2/features/integration#react-hooks) to check on the required steps for using this hook.";const d="undefined"!=typeof window,g=t.createContext(null);let f;const p=(m=g,(e,i=c)=>{e||u.w("fetching full store without passing any selector may have a heavy performance impact on your website.");const o=t.useContext(m);if(!o)throw new Error(h);return(0,o.store)(e,i)});var m;const P=()=>{const e=t.useContext(g);if(!e)throw new Error(h);return e.store},w=()=>{const e=t.useContext(g);if(!e)throw new Error(h);return e.actions},v=({elements:t,tilesInFirstPage:i,onlyOnePage:o,isLastPageDifferentFromFirstPage:a,defaultWidth:s,defaultHeight:r,lastPageWidth:n,lastPageHeight:l})=>{const c=((e,t,i)=>e.reduce(((e,o,a)=>{const s=Math.floor(a/t);return s>0&&i||(e[s]||(e[s]=[]),e[s].push(o)),e}),[]))(t,i,o);return c.map(((t,i)=>t.map((t=>{const o=i===c.length-1;return e({},t,{height:a&&o?l:r,width:a&&o?n:s})}))))};const b=e=>function(e){if(0===e.length)return null;const t={};let i=e[0],o=1;for(let a=0;a<e.length;a++){const s=e[a];null===t[s]?t[s]=1:t[s]++,t[s]>o&&(i=s,o=t[s])}return i}(e.filter((e=>{var t,i;return(null==(t=e.track)?void 0:t.width)&&(null==(i=e.track)?void 0:i.height)})).map((e=>{var t,i;return((null==(t=e.track)?void 0:t.width)||1)/((null==(i=e.track)?void 0:i.height)||1)}))),E=(e,t,i,o,a)=>{if(e<0||t<0)throw new Error("Container must have a non-negative area");if(i<1||!Number.isInteger(i))throw new Error("Number of shapes to place must be a positive integer");const s=o&&a&&o/a;if(void 0!==s&&isNaN(s))throw new Error("Aspect ratio must be a number");let r={area:0,cols:0,rows:0,width:0,height:0};if(void 0!==s)for(let o=i;o>0;o+=-1){const a=Math.ceil(i/o);let n,l;e/(o*s)<=t/a?(n=e/o,l=n/s):(l=t/a,n=l*s);const c=n*l;c>r.area&&(r={area:c,width:n,height:l,rows:a,cols:o})}return r};function H({count:e,parentWidth:t,parentHeight:i,maxTileCount:o,maxRowCount:a,maxColCount:s,aspectRatio:r}){let n=0,l=0,c=0,u=0,h=!1,d=0;if(0===e)return{tilesInFirstPage:d,defaultWidth:n,defaultHeight:l,lastPageWidth:c,lastPageHeight:u,isLastPageDifferentFromFirstPage:h};if(o)({tilesInFirstPage:d,defaultWidth:n,defaultHeight:l,lastPageWidth:c,lastPageHeight:u,isLastPageDifferentFromFirstPage:h}=(({parentWidth:e,parentHeight:t,count:i,maxCount:o,aspectRatio:a})=>{let s=0,r=0,n=0,l=0,c=!1,u=0,h=0;const{width:d,height:g}=E(e,t,Math.min(i,o),a.width,a.height);if(s=d,r=g,u=Math.min(i,o),h=i%o,c=h>0&&i>o,c){const{width:i,height:o}=E(e,t,h,a.width,a.height);n=i,l=o}return{tilesInFirstPage:u,defaultWidth:s,defaultHeight:r,lastPageWidth:n,lastPageHeight:l,isLastPageDifferentFromFirstPage:c}})({parentWidth:t,parentHeight:i,count:e,maxCount:o,aspectRatio:r}));else if(a)({tilesInFirstPage:d,defaultWidth:n,defaultHeight:l,lastPageWidth:c,lastPageHeight:u,isLastPageDifferentFromFirstPage:h}=(({parentWidth:e,parentHeight:t,count:i,maxCount:o,aspectRatio:a})=>{let s=0,r=0,n=0,l=0,c=!1,u=0,h=0;const d=Math.min(Math.ceil(Math.sqrt(i*(a.width/a.height)/(e/t))),o),g=t/d,f=g*(a.width/a.height),p=Math.floor(e/f);if(s=f,r=g,u=Math.min(i,d*p),h=i%(d*p),c=h>0&&i>d*p,c){const i=t/Math.min(Math.ceil(Math.sqrt(h*(a.width/a.height)/(e/t))),o);l=i,n=i*(a.width/a.height)}return{tilesInFirstPage:u,defaultWidth:s,defaultHeight:r,lastPageWidth:n,lastPageHeight:l,isLastPageDifferentFromFirstPage:c}})({parentWidth:t,parentHeight:i,count:e,maxCount:a,aspectRatio:r}));else if(s)({tilesInFirstPage:d,defaultWidth:n,defaultHeight:l,lastPageWidth:c,lastPageHeight:u,isLastPageDifferentFromFirstPage:h}=(({parentWidth:e,parentHeight:t,count:i,maxCount:o,aspectRatio:a})=>{let s=0,r=0,n=0,l=0,c=!1,u=0,h=0;const d=Math.min(Math.ceil(Math.sqrt(i*(e/t)/(a.width/a.height))),o),g=e/d,f=g/(a.width/a.height),p=Math.floor(t/f);if(r=f,s=g,u=Math.min(i,p*d),h=i%(p*d),c=h>0&&i>p*d,c){const i=e/Math.min(Math.ceil(Math.sqrt(h*(e/t)/(a.width/a.height))),o);l=i/(a.width/a.height),n=i}return{tilesInFirstPage:u,defaultWidth:s,defaultHeight:r,lastPageWidth:n,lastPageHeight:l,isLastPageDifferentFromFirstPage:c}})({parentWidth:t,parentHeight:i,count:e,maxCount:s,aspectRatio:r}));else{const{width:o,height:a}=E(t,i,e,r.width,r.height);n=o,l=a,d=e}return{tilesInFirstPage:d,defaultWidth:n,defaultHeight:l,lastPageWidth:c,lastPageHeight:u,isLastPageDifferentFromFirstPage:h}}exports.HMSRoomProvider=({children:o,actions:a,store:s,notifications:r})=>{if(!f)if(a&&s)f={actions:a,store:s},r&&(f.notifications=r);else{const t=new i.HMSReactiveStore,o=()=>{throw new Error("modifying store is not allowed")};f={actions:t.getHMSActions(),store:l.default(e({},t.getStore(),{setState:o,destroy:o})),notifications:t.getNotifications()}}return t.useEffect((()=>{d&&(window.onunload=()=>{f.actions.leave()})}),[]),n.default.createElement(g.Provider,{value:f},o)},exports.calculateLayoutSizes=H,exports.chunkElements=v,exports.getModeAspectRatio=b,exports.useAVToggle=()=>{const e=p(i.selectIsLocalAudioEnabled),o=p(i.selectIsLocalVideoEnabled),a=p(i.selectIsAllowedToPublish),s=w(),r=t.useCallback((async()=>{try{await s.setLocalAudioEnabled(!e)}catch(e){console.error("Cannot toggle audio",e)}}),[e]),n=t.useCallback((async()=>{try{await s.setLocalVideoEnabled(!o)}catch(e){console.error("Cannot toggle video",e)}}),[o]);return{isLocalAudioEnabled:e,isLocalVideoEnabled:o,toggleAudio:r,toggleVideo:n,isAllowedToPublish:a}},exports.useDevices=()=>{const e=w(),t=p(i.selectDevices),o=p(i.selectLocalMediaSettings),{video:a,audio:s}=p(i.selectIsAllowedToPublish),r=p(i.selectIsAllowedToSubscribe),n=t.videoInput||[],l=t.audioInput||[],c=t.audioOutput||[];return[a,s,r].some((e=>!!e))?{showVideo:a,videoInput:n,showAudio:s,audioInput:l,audioOutput:c,isSubscribing:r,selectedDevices:o,handleInputChange:t=>{const i=t.currentTarget.value,{name:a}=t.currentTarget;if(i!==o[a])switch(a){case"audioInputDeviceId":e.setAudioSettings({deviceId:i});break;case"videoInputDeviceId":e.setVideoSettings({deviceId:i});break;case"audioOutputDeviceId":e.setAudioOutputDevice(i)}}}:null},exports.useHMSActions=w,exports.useHMSNotifications=()=>{const e=t.useContext(g),[i,o]=t.useState(null);if(!e)throw new Error(h);return t.useEffect((()=>{if(!e.notifications)return;const t=e.notifications.onNotification((e=>o(e)));return t}),[e.notifications]),i},exports.useHMSStore=p,exports.useHMSVanillaStore=P,exports.usePreview=(e,o)=>{const[s,r]=t.useState(!1),n=w(),l=p(i.selectLocalPeer),c=p(i.selectRoomState),u=p(i.selectIsLocalAudioEnabled),h=p(i.selectIsLocalVideoDisplayEnabled),d=p(i.selectIsAllowedToPublish),g=s||c!==i.HMSRoomState.Preview;return t.useEffect((()=>{c===i.HMSRoomState.Disconnected&&n.preview({userName:o,authToken:e}),a.isBrowser&&(window.onunload=()=>n.leave())}),[c,n,e]),{localPeer:l,roomState:c,audioEnabled:u,videoEnabled:h,isAllowedToPublish:d,disableJoin:g,actions:n,setInProgress:r}},exports.useVideoList=({maxTileCount:e,maxColCount:o,maxRowCount:a,width:s,height:r,showScreenFn:n,peers:l,overflow:c,aspectRatio:u})=>{const h=((e,t,i)=>{if(!e||!t||!i)return[];const o=[];for(const a of e)if(void 0===a.videoTrack&&a.audioTrack&&t[a.audioTrack]?o.push({peer:a}):a.videoTrack&&t[a.videoTrack]&&o.push({track:t[a.videoTrack],peer:a}),i(a)&&a.auxiliaryTracks.length>0){const e=a.auxiliaryTracks.find((e=>{const i=t[e];return"video"===(null==i?void 0:i.type)&&"screen"===(null==i?void 0:i.source)}));e&&o.push({track:t[e],peer:a})}return o})(l,P().getState(i.selectTracksMap),n),d=t.useMemo((()=>{if(u)return u;return{width:b(h)||1,height:1}}),[u,h]),g=h.length,{tilesInFirstPage:f,defaultWidth:p,defaultHeight:m,lastPageWidth:w,lastPageHeight:E,isLastPageDifferentFromFirstPage:M}=t.useMemo((()=>H({count:g,parentWidth:Math.floor(s),parentHeight:Math.floor(r),maxTileCount:e,maxRowCount:a,maxColCount:o,aspectRatio:d})),[g,s,r,e,a,o,d]);return{chunkedTracksWithPeer:t.useMemo((()=>v({elements:h,tilesInFirstPage:f,onlyOnePage:"hidden"===c,isLastPageDifferentFromFirstPage:M,defaultWidth:p,defaultHeight:m,lastPageWidth:w,lastPageHeight:E})),[h,f,c,M,p,m,w,E])}},exports.useVideoTile=e=>{const o=w(),a=t.useRef(null),s=p(i.selectVideoTrackByPeerID(e.id)),r=p(i.selectIsPeerAudioEnabled(e.id)),n=p(i.selectIsPeerVideoEnabled(e.id)),{isLocal:l,name:c}=e,u=p(i.selectPeerAudioByID(e.id))>0;return t.useEffect((()=>{a.current&&s&&(s.enabled?o.attachVideo(s.id,a.current):o.detachVideo(s.id,a.current))}),[s,o]),{videoRef:a,isAudioOn:r,isVideoOn:n,actions:o,isLocal:l,name:c,audioLevel:u}};
|
|
1
|
+
"use strict";function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=require("@100mslive/hms-video-store"),n=require("zustand"),i=require("react-intersection-observer");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}var a,c=o(t),p=o(n);function l(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}!function(e){e[e.VERBOSE=0]="VERBOSE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.NONE=5]="NONE"}(a||(a={}));class d{static v(e,...t){this.log(a.VERBOSE,e,...t)}static d(e,...t){this.log(a.DEBUG,e,...t)}static i(e,...t){this.log(a.INFO,e,...t)}static w(e,...t){this.log(a.WARN,e,...t)}static e(e,...t){this.log(a.ERROR,e,...t)}static log(e,t,...r){if(!(this.level.valueOf()>e.valueOf()))switch(e){case a.VERBOSE:console.log("HMSui-components: ",t,...r);break;case a.DEBUG:console.debug("HMSui-components: ",t,...r);break;case a.INFO:console.info("HMSui-components: ",t,...r);break;case a.WARN:console.warn("HMSui-components: ",t,...r);break;case a.ERROR:console.error("HMSui-components: ",t,...r)}}}d.level=a.VERBOSE;const u="It seems like you forgot to add your component within a top level HMSRoomProvider, please refer to 100ms react docs(https://docs.100ms.live/javascript/v2/features/integration#react-hooks) to check on the required steps for using this hook.";const f="undefined"!=typeof window,h=t.createContext(null);let m;const g=(v=h,(e,r=l)=>{e||d.w("fetching full store without passing any selector may have a heavy performance impact on your website.");const n=t.useContext(v);if(!n)throw new Error(u);return(0,n.store)(e,r)});var v;const y=function(e){return(r,n=l)=>{r||d.w("fetching full store without passing any selector may have a heavy performance impact on your website.");const i=t.useContext(e);if(!i)throw new Error(u);const o=i.statsStore;return null==o?void 0:o(r,n)}}(h),b=()=>{const e=t.useContext(h);if(!e)throw new Error(u);return e.store},w=()=>{const e=t.useContext(h);if(!e)throw new Error(u);return e.actions},T=({elements:t,tilesInFirstPage:r,onlyOnePage:n,isLastPageDifferentFromFirstPage:i,defaultWidth:o,defaultHeight:s,lastPageWidth:a,lastPageHeight:c})=>{const p=((e,t,r)=>e.reduce(((e,n,i)=>{const o=Math.floor(i/t);return o>0&&r||(e[o]||(e[o]=[]),e[o].push(n)),e}),[]))(t,r,n);return p.map(((t,r)=>t.map((t=>{const n=r===p.length-1;return e({},t,{height:i&&n?c:s,width:i&&n?a:o})}))))};const C=e=>function(e){if(0===e.length)return null;const t={};let r=e[0],n=1;for(let i=0;i<e.length;i++){const o=e[i];null===t[o]?t[o]=1:t[o]++,t[o]>n&&(r=o,n=t[o])}return r}(e.filter((e=>{var t,r;return(null==(t=e.track)?void 0:t.width)&&(null==(r=e.track)?void 0:r.height)})).map((e=>{var t,r;return((null==(t=e.track)?void 0:t.width)||1)/((null==(r=e.track)?void 0:r.height)||1)}))),E=(e,t,r,n,i)=>{if(e<0||t<0)throw new Error("Container must have a non-negative area");if(r<1||!Number.isInteger(r))throw new Error("Number of shapes to place must be a positive integer");const o=n&&i&&n/i;if(void 0!==o&&isNaN(o))throw new Error("Aspect ratio must be a number");let s={area:0,cols:0,rows:0,width:0,height:0};if(void 0!==o)for(let n=r;n>0;n+=-1){const i=Math.ceil(r/n);let a,c;e/(n*o)<=t/i?(a=e/n,c=a/o):(c=t/i,a=c*o);const p=a*c;p>s.area&&(s={area:p,width:a,height:c,rows:i,cols:n})}return s};function _({count:e,parentWidth:t,parentHeight:r,maxTileCount:n,maxRowCount:i,maxColCount:o,aspectRatio:s}){let a=0,c=0,p=0,l=0,d=!1,u=0;if(0===e)return{tilesInFirstPage:u,defaultWidth:a,defaultHeight:c,lastPageWidth:p,lastPageHeight:l,isLastPageDifferentFromFirstPage:d};if(n)({tilesInFirstPage:u,defaultWidth:a,defaultHeight:c,lastPageWidth:p,lastPageHeight:l,isLastPageDifferentFromFirstPage:d}=(({parentWidth:e,parentHeight:t,count:r,maxCount:n,aspectRatio:i})=>{let o=0,s=0,a=0,c=0,p=!1,l=0,d=0;const{width:u,height:f}=E(e,t,Math.min(r,n),i.width,i.height);if(o=u,s=f,l=Math.min(r,n),d=r%n,p=d>0&&r>n,p){const{width:r,height:n}=E(e,t,d,i.width,i.height);a=r,c=n}return{tilesInFirstPage:l,defaultWidth:o,defaultHeight:s,lastPageWidth:a,lastPageHeight:c,isLastPageDifferentFromFirstPage:p}})({parentWidth:t,parentHeight:r,count:e,maxCount:n,aspectRatio:s}));else if(i)({tilesInFirstPage:u,defaultWidth:a,defaultHeight:c,lastPageWidth:p,lastPageHeight:l,isLastPageDifferentFromFirstPage:d}=(({parentWidth:e,parentHeight:t,count:r,maxCount:n,aspectRatio:i})=>{let o=0,s=0,a=0,c=0,p=!1,l=0,d=0;const u=Math.min(Math.ceil(Math.sqrt(r*(i.width/i.height)/(e/t))),n),f=t/u,h=f*(i.width/i.height),m=Math.floor(e/h);if(o=h,s=f,l=Math.min(r,u*m),d=r%(u*m),p=d>0&&r>u*m,p){const r=t/Math.min(Math.ceil(Math.sqrt(d*(i.width/i.height)/(e/t))),n);c=r,a=r*(i.width/i.height)}return{tilesInFirstPage:l,defaultWidth:o,defaultHeight:s,lastPageWidth:a,lastPageHeight:c,isLastPageDifferentFromFirstPage:p}})({parentWidth:t,parentHeight:r,count:e,maxCount:i,aspectRatio:s}));else if(o)({tilesInFirstPage:u,defaultWidth:a,defaultHeight:c,lastPageWidth:p,lastPageHeight:l,isLastPageDifferentFromFirstPage:d}=(({parentWidth:e,parentHeight:t,count:r,maxCount:n,aspectRatio:i})=>{let o=0,s=0,a=0,c=0,p=!1,l=0,d=0;const u=Math.min(Math.ceil(Math.sqrt(r*(e/t)/(i.width/i.height))),n),f=e/u,h=f/(i.width/i.height),m=Math.floor(t/h);if(s=h,o=f,l=Math.min(r,m*u),d=r%(m*u),p=d>0&&r>m*u,p){const r=e/Math.min(Math.ceil(Math.sqrt(d*(e/t)/(i.width/i.height))),n);c=r/(i.width/i.height),a=r}return{tilesInFirstPage:l,defaultWidth:o,defaultHeight:s,lastPageWidth:a,lastPageHeight:c,isLastPageDifferentFromFirstPage:p}})({parentWidth:t,parentHeight:r,count:e,maxCount:o,aspectRatio:s}));else{const{width:n,height:i}=E(t,r,e,s.width,s.height);a=n,c=i,u=e}return{tilesInFirstPage:u,defaultWidth:a,defaultHeight:c,lastPageWidth:p,lastPageHeight:l,isLastPageDifferentFromFirstPage:d}}let R=!0,S=!0;function P(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function k(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function A(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(R=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function x(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(S=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function D(){if("object"==typeof window){if(R)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function O(e,t){S&&console.warn(e+" is deprecated, please use "+t+" instead.")}function I(e){return"[object Object]"===Object.prototype.toString.call(e)}function L(e){return I(e)?Object.keys(e).reduce((function(t,r){const n=I(e[r]),i=n?L(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function M(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?M(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{M(e,e.get(t),r)}))})))}function N(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&M(e,r,i)}))})),i}const j=D;function U(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=n(e.video),j("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return j("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function F(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function G(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else k(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function H(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function V(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function z(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>N(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),k(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>N(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function W(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function B(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return W(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function s(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find((e=>e.track===t));if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[r.id];if(o)o.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function K(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function q(e,t){k(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var J=Object.freeze({__proto__:null,shimMediaStream:F,shimOnTrack:G,shimGetSendersWithDtmf:H,shimGetStats:V,shimSenderReceiverGetStats:z,shimAddTrackRemoveTrackWithNative:W,shimAddTrackRemoveTrack:B,shimPeerConnection:K,fixNegotiationNeeded:q,shimGetUserMedia:U,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});function $(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){O("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function Y(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Z(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}function Q(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function X(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),k(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ee(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){O("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function re(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function ne(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function ie(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function oe(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var se=Object.freeze({__proto__:null,shimOnTrack:Y,shimPeerConnection:Z,shimSenderGetStats:Q,shimReceiverGetStats:X,shimRemoveStream:ee,shimRTCDataChannel:te,shimAddTransceiver:re,shimGetParameters:ne,shimCreateOffer:ie,shimCreateAnswer:oe,shimGetUserMedia:$,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function ae(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function ce(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function pe(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=a,a=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=a,a=function(e,t,r){const n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=a}function le(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(de(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function de(e){return e&&void 0!==e.video?Object.assign({},e,{video:L(e.video)}):e}function ue(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(O("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function fe(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function he(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function me(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var ge=Object.freeze({__proto__:null,shimLocalStreamsAPI:ae,shimRemoteStreamsAPI:ce,shimCallbacksAPI:pe,shimGetUserMedia:le,shimConstraints:de,shimRTCIceServerUrls:ue,shimTrackEventTransceiver:fe,shimCreateOfferLegacy:he,shimAudioContext:me}),ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ye={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){let t=e.substr(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){const t={};let r;const n=e.substr(e.indexOf(" ")+1).split(";");for(let e=0;e<n.length;e++)r=n[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){const t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){const t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" ");for(let i=3;i<n.length;i++){const o=n[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const n=t.parseRtpMap(s),i=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(n.parameters=i.length?t.parseFmtp(i[0]):{},n.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(n.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){let n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));let i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){const r=[],n=t.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const p=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substr(17).split(" ").map((e=>parseInt(e,10)))));p.length>0&&p[0].length>1&&p[0][0]===a&&(c=p[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),r.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&a&&r.push({ssrc:a});let l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=l}))),r},t.parseRtcpParameters=function(e){const r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const n=t.matchPrefix(e,"a=msid:");if(1===n.length)return r=n[0].substr(7).split(" "),{stream:r[0],track:r[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(r=i[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substr(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){let i;const o=void 0!==r?r:2;i=e||t.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const n=t.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(ye);var be=ye.exports,we=Object.freeze(s({__proto__:null,default:be},[ye.exports]));function Te(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=be.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,k(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function Ce(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=be.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=be.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=be.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=n(arguments[0]),t=i(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function Ee(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},k(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function _e(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function Re(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Pe(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return r.apply(this,[e]);const t="offer"===e.type?this.createOffer:this.createAnswer;return t.apply(this).then((e=>r.apply(this,[e])))})}var ke=Object.freeze({__proto__:null,shimRTCIceCandidate:Te,shimMaxMessageSize:Ce,shimSendThrowTypeError:Ee,shimConnectionState:_e,removeExtmapAllowMixed:Re,shimAddIceCandidateNullOrEmpty:Se,shimParameterlessSetLocalDescription:Pe});const Ae=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=D,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=P(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=P(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=P(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:ke,extractVersion:P,disableLog:A,disableWarnings:x,sdp:we};switch(n.browser){case"chrome":if(!J||!K||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=J,Se(e,n),Pe(e),U(e,n),F(e),K(e,n),G(e),B(e,n),H(e),V(e),z(e),q(e,n),Te(e),_e(e),Ce(e,n),Ee(e),Re(e,n);break;case"firefox":if(!se||!Z||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=se,Se(e,n),Pe(e),$(e,n),Z(e,n),Y(e),ee(e),Q(e),X(e),te(e),re(e),ne(e),ie(e),oe(e),Te(e),_e(e),Ce(e,n),Ee(e);break;case"safari":if(!ge||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=ge,Se(e,n),Pe(e),ue(e),he(e),pe(e),ae(e),ce(e),fe(e),le(e),me(e),Te(e),Ce(e,n),Ee(e),Re(e,n);break;default:r("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var xe={exports:{}},De=xe.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(De).forEach((function(e){De[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=xe.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],s=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),s=o[o.length-1]);for(var a=0;a<(n[t]||[]).length;a+=1){var c=n[t][a];if(c.reg.test(i))return r(c,s,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}({});var Oe={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="model",p="name",l="type",d="vendor",u="version",f="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",b="embedded",w="Amazon",T="Apple",C="ASUS",E="BlackBerry",_="Firefox",R="Google",S="Huawei",P="LG",k="Microsoft",A="Motorola",x="Opera",D="Samsung",O="Sony",I="Xiaomi",L="Zebra",M="Facebook",N=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},j=function(e,t){return typeof e===a&&-1!==U(t).indexOf(U(e))},U=function(e){return e.toLowerCase()},F=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,255)},G=function(e,t){for(var r,o,a,c,p,l,d=0;d<t.length&&!p;){var u=t[d],f=t[d+1];for(r=o=0;r<u.length&&!p;)if(p=u[r++].exec(e))for(a=0;a<f.length;a++)l=p[++o],typeof(c=f[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):n:this[c[0]]=l?c[1].call(this,l,c[2]):n:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):n):this[c]=l||n;d+=2}},H=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(j(t[r][i],e))return"?"===r?n:r}else if(j(t[r],e))return"?"===r?n:r;return e},V={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[u,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[u,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,u],[/opios[\/ ]+([\w\.]+)/i],[u,[p,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[u,[p,x]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[p,u],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[u,[p,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[u,[p,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[u,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[u,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[u,[p,"IE"]],[/yabrowser\/([\w\.]+)/i],[u,[p,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure Browser"],u],[/\bfocus\/([\w\.]+)/i],[u,[p,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[u,[p,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[u,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[u,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[u,[p,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[u,[p,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[u,[p,_]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 Browser"],u],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],u],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,u],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,M],u],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,u],[/\bgsa\/([\w\.]+) .*safari\//i],[u,[p,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[u,[p,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,"Chrome WebView"],u],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[u,[p,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,u],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[u,[p,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[u,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[u,H,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,u],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],u],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[u,[p,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[p,u]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,U]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",U]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,U]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[d,D],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,D],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[d,T],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,T],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,S],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[c,[d,S],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,I],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,I],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[d,A],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,A],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,P],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,P],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[l,m]],[/(pixel c)\b/i],[c,[d,R],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,R],[l,m]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[d,O],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,O],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,w],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,w],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,E],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,C],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,C],[l,m]],[/(nexus 9)/i],[c,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[l,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,"Sharp"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[l,m]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,c,[l,g]],[/(surface duo)/i],[c,[d,k],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[l,m]],[/(u304aa)/i],[c,[d,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[l,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[l,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,c,[l,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,k],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,L],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,L],[l,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[l,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[c,[d,O],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,k],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,D],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,P],[l,v]],[/(apple) ?tv/i],[d,[c,"Apple TV"],[l,v]],[/crkey/i],[[c,"Chromecast"],[d,R],[l,v]],[/droid.+aft(\w)( bui|\))/i],[c,[d,w],[l,v]],[/\(dtv[\);].+(aquos)/i],[c,[d,"Sharp"],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,F],[c,F],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[d,c,[l,y]],[/droid.+; (glass) \d/i],[c,[d,R],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,L],[l,y]],[/(quest( 2)?)/i],[c,[d,M],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[u,[p,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[u,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[p,u],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[u,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,u],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[u,H,V]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,"Windows"],[u,H,V]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[u,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,"Mac OS"],[u,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[u,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,u],[/\(bb(10);/i],[u,[p,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[u,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[u,[p,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[u,[p,"webOS"]],[/crkey\/([\d\.]+)/i],[u,[p,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[p,"Chromium OS"],u],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,u],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],u],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[p,u]]},W=function e(t,i){if(typeof t===s&&(i=t,t=n),!(this instanceof e))return new e(t,i).getResult();var c=t||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),p=i?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(z,i):z;return this.getBrowser=function(){var e,t={};return t.name=n,t.version=n,G.call(t,c,p.browser),t.major=typeof(e=t.version)===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n,t},this.getCPU=function(){var e={};return e.architecture=n,G.call(e,c,p.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,G.call(e,c,p.device),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,G.call(e,c,p.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,G.call(e,c,p.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return c},this.setUA=function(e){return c=typeof e===a&&e.length>255?F(e,255):e,this},this.setUA(c),this};W.VERSION="1.0.2",W.BROWSER=N([p,u,"major"]),W.CPU=N([f]),W.DEVICE=N([c,d,l,h,m,v,g,y,b]),W.ENGINE=W.OS=N([p,u]),e.exports&&(t=e.exports=W),t.UAParser=W;var B=typeof r!==o&&(r.jQuery||r.Zepto);if(B&&!B.ua){var K=new W;B.ua=K.getResult(),B.ua.get=function(){return K.getUA()},B.ua.set=function(e){K.setUA(e);var t=K.getResult();for(var r in t)B.ua[r]=t[r]}}}("object"==typeof window?window:ve)}(Oe,Oe.exports);var Ie,Le,Me;
|
|
2
|
+
/*!
|
|
3
|
+
* EventEmitter2
|
|
4
|
+
* https://github.com/hij1nx/EventEmitter2
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2013 hij1nx
|
|
7
|
+
* Licensed under the MIT license.
|
|
8
|
+
*/Ie={exports:{}},function(e){var t=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n="object"==typeof process&&"function"==typeof process.nextTick,i="function"==typeof Symbol,o="object"==typeof Reflect,s="function"==typeof setImmediate?setImmediate:setTimeout,a=i?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function c(){this._events={},this._conf&&p.call(this,this._conf)}function p(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function l(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var d=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function u(t,r){for(var n={},i=t.length,o=r?value.length:0,s=0;s<i;s++)n[t[s]]=s<o?r[s]:e;return n}function f(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function h(r,n,i,o){var s=Object.assign({},n);if(!r)return s;if("object"!=typeof r)throw TypeError("options must be an object");var a,c,p,l=Object.keys(r),d=l.length;function u(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<d;f++){if(a=l[f],!o&&!t.call(n,a))throw Error('Unknown "'+a+'" option');(c=r[a])!==e&&(p=i[a],s[a]=p?p(c,u):c)}return s}function m(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function g(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var o=typeof e;if(o===n||o===i)return e;r(t)}:function(n,i){for(var o=typeof n,s=r;s-- >0;)if(o===e[s])return n;i(t)}}Object.assign(f.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var n=d.apply(null,arguments),s={data:n,name:t,original:e};if(r){var a=r.call(i,s);!1!==a&&o.emit.apply(o,[s.name].concat(n))}else o.emit.apply(o,[t].concat(n))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===s[e]&&(s[e]=a,n._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!o.hasListeners(r)&&s[e]&&(s[e]=null,n._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,n._on.call(i,e,a))},unsubscribe:function(e){var t,r,n,i=this,o=this._listeners,s=this._emitter,c=this._off,p=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function l(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=w.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;c.call(p,e,t),delete o[e],--this._listenersCount||l()}else{for(n=(r=a(o)).length;n-- >0;)e=r[n],c.call(p,e,o[e]);this._listeners={},this._listenersCount=0,l()}}});var v=g(["function"]),y=g(["object","function"]);function b(e,t,r){var n,i,o,s=0,a=new e((function(c,p,l){function d(){i&&(i=null),s&&(clearTimeout(s),s=0)}r=h(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof l;var u=function(e){d(),c(e)},f=function(e){d(),p(e)};n?t(u,f,l):(i=[function(e){f(e||Error("canceled"))}],t(u,f,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),r.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),p(e)}),r.timeout))}));return n||(a.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),a}function w(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function T(e,t,r,n,i){if(!r)return null;if(0===n){var o=typeof t;if("string"===o){var s,c,p=0,l=0,d=this.delimiter,u=d.length;if(-1!==(c=t.indexOf(d))){s=new Array(5);do{s[p++]=t.slice(l,c),l=c+u}while(-1!==(c=t.indexOf(d,l)));s[p++]=t.slice(l),t=s,i=p}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var f,h,m,g,v,y,b,w=null,C=t[n],E=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),w=[r]):(e&&e.push.apply(e,r._listeners),w=[r]));else{if("*"===C){for(c=(y=a(r)).length;c-- >0;)"_listeners"!==(f=y[c])&&(b=T(e,t,r[f],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===C){for((v=n+1===i||n+2===i&&"*"===E)&&r._listeners&&(w=T(e,t,r,i,i)),c=(y=a(r)).length;c-- >0;)"_listeners"!==(f=y[c])&&("*"===f||"**"===f?(r[f]._listeners&&!v&&(b=T(e,t,r[f],i,i))&&(w?w.push.apply(w,b):w=b),b=T(e,t,r[f],n,i)):b=T(e,t,r[f],f===E?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[C]&&(w=T(e,t,r[C],n+1,i))}if((h=r["*"])&&T(e,t,h,n+1,i),m=r["**"])if(n<i)for(m._listeners&&T(e,t,m,i,i),c=(y=a(m)).length;c-- >0;)"_listeners"!==(f=y[c])&&(f===E?T(e,t,m[f],n+2,i):f===C?T(e,t,m[f],n+1,i):((g={})[f]=m[f],T(e,t,{"**":g},n+1,i)));else m._listeners?T(e,t,m,i,i):m["*"]&&m["*"]._listeners&&T(e,t,m["*"],i,i);return w}function C(e,t,r){var n,i,o=0,s=0,a=this.delimiter,c=a.length;if("string"==typeof e)if(-1!==(n=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,n),s=n+c}while(-1!==(n=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(n=0;n+1<o;n++)if("**"===i[n]&&"**"===i[n+1])return;var p,d=this.listenerTree;for(n=0;n<o;n++)if(d=d[p=i[n]]||(d[p]={}),n===o-1)return d._listeners?("function"==typeof d._listeners&&(d._listeners=[d._listeners]),r?d._listeners.unshift(t):d._listeners.push(t),!d._listeners.warned&&this._maxListeners>0&&d._listeners.length>this._maxListeners&&(d._listeners.warned=!0,l.call(this,d._listeners.length,p))):d._listeners=t,!0;return!0}function E(e,t,r,n){for(var i,o,s,c,p=a(e),l=p.length,d=e._listeners;l-- >0;)i=e[o=p[l]],s="_listeners"===o?r:r?r.concat(o):[o],c=n||"symbol"==typeof o,d&&t.push(c?s:s.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,s,c);return t}function _(e){for(var t,r,n,i=a(e),o=i.length;o-- >0;)(t=e[r=i[o]])&&(n=!0,"_listeners"===r||_(t)||delete e[r]);return n}function R(e,t,r){this.emitter=e,this.event=t,this.listener=r}function S(t,r,i){if(!0===i)a=!0;else if(!1===i)o=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var o=i.async,a=i.promisify,c=i.nextTick,p=i.objectify}if(o||c||a){var l=r,d=r._origin||r;if(c&&!n)throw Error("process.nextTick is not supported");a===e&&(a="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return a?c?Promise.resolve():new Promise((function(e){s(e)})).then((function(){return t.event=r,l.apply(t,e)})):(c?process.nextTick:s)((function(){t.event=r,l.apply(t,e)}))},r._async=!0,r._origin=d}return[r,p?new R(this,t,r):this]}function P(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,e)}R.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},P.EventEmitter2=P,P.prototype.listenTo=function(t,n,i){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;function s(e){if("object"!=typeof e)throw TypeError("events must be an object");var r,n=i.reducers,s=w.call(o,t);r=-1===s?new f(o,t,i):o._observers[s];for(var c,p=a(e),l=p.length,d="function"==typeof n,u=0;u<l;u++)c=p[u],r.subscribe(c,e[c]||c,d?n:n&&n[c])}return i=h(i,{on:e,off:e,reducers:e},{on:v,off:v,reducers:y}),r(n)?s(u(n)):s("string"==typeof n?u(n.split(/\s+/)):n),this},P.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),o=!0);return o},P.prototype.delimiter=".",P.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},P.prototype.getMaxListeners=function(){return this._maxListeners},P.prototype.event="",P.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},P.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},P.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},P.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},P.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},P.prototype._many=function(e,t,r,n,i){var o=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),r.apply(this,arguments)}return s._origin=r,this._on(e,s,n,i)},P.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,r,n,o,s,a=arguments[0],p=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(p&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(r=a.length,i)for(n=0;n<r;n++)if("symbol"==typeof a[n]){s=!0;break}s||(a=a.join(this.delimiter))}var l,d=arguments.length;if(this._all&&this._all.length)for(n=0,r=(l=this._all.slice()).length;n<r;n++)switch(this.event=a,d){case 1:l[n].call(this,a);break;case 2:l[n].call(this,a,arguments[1]);break;case 3:l[n].call(this,a,arguments[1],arguments[2]);break;default:l[n].apply(this,arguments)}if(p)l=[],T.call(this,l,e,this.listenerTree,0,r);else{if("function"==typeof(l=this._events[a])){switch(this.event=a,d){case 1:l.call(this);break;case 2:l.call(this,arguments[1]);break;case 3:l.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),o=1;o<d;o++)t[o-1]=arguments[o];l.apply(this,t)}return!0}l&&(l=l.slice())}if(l&&l.length){if(d>3)for(t=new Array(d-1),o=1;o<d;o++)t[o-1]=arguments[o];for(n=0,r=l.length;n<r;n++)switch(this.event=a,d){case 1:l[n].call(this);break;case 2:l[n].call(this,arguments[1]);break;case 3:l[n].call(this,arguments[1],arguments[2]);break;default:l[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===a)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},P.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,r,n,o,s,a=arguments[0],p=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(p&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,i)for(o=0;o<n;o++)if("symbol"==typeof a[o]){t=!0;break}t||(a=a.join(this.delimiter))}var l,d=[],u=arguments.length;if(this._all)for(o=0,n=this._all.length;o<n;o++)switch(this.event=a,u){case 1:d.push(this._all[o].call(this,a));break;case 2:d.push(this._all[o].call(this,a,arguments[1]));break;case 3:d.push(this._all[o].call(this,a,arguments[1],arguments[2]));break;default:d.push(this._all[o].apply(this,arguments))}if(p?(l=[],T.call(this,l,e,this.listenerTree,0)):l=this._events[a],"function"==typeof l)switch(this.event=a,u){case 1:d.push(l.call(this));break;case 2:d.push(l.call(this,arguments[1]));break;case 3:d.push(l.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(u-1),s=1;s<u;s++)r[s-1]=arguments[s];d.push(l.apply(this,r))}else if(l&&l.length){if(l=l.slice(),u>3)for(r=new Array(u-1),s=1;s<u;s++)r[s-1]=arguments[s];for(o=0,n=l.length;o<n;o++)switch(this.event=a,u){case 1:d.push(l[o].call(this));break;case 2:d.push(l[o].call(this,arguments[1]));break;case 3:d.push(l[o].call(this,arguments[1],arguments[2]));break;default:d.push(l[o].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===a)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},P.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},P.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},P.prototype.onAny=function(e){return this._onAny(e,!1)},P.prototype.prependAny=function(e){return this._onAny(e,!0)},P.prototype.addListener=P.prototype.on,P.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},P.prototype._on=function(t,r,n,i){if("function"==typeof t)return this._onAny(t,r),this;if("function"!=typeof r)throw new Error("on only accepts instances of Function");this._events||c.call(this);var o,s=this;return i!==e&&(r=(o=S.call(this,t,r,i))[0],s=o[1]),this._newListener&&this.emit("newListener",t,r),this.wildcard?(C.call(this,t,r,n),s):(this._events[t]?("function"==typeof this._events[t]&&(this._events[t]=[this._events[t]]),n?this._events[t].unshift(r):this._events[t].push(r),!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,l.call(this,this._events[t].length,t))):this._events[t]=r,s)},P.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=T.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];if(n=a._listeners,r(n)){for(var c=-1,p=0,l=n.length;p<l;p++)if(n[p]===t||n[p].listener&&n[p].listener===t||n[p]._origin&&n[p]._origin===t){c=p;break}if(c<0)continue;return this.wildcard?a._listeners.splice(c,1):this._events[e].splice(c,1),0===n.length&&(this.wildcard?delete a._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&_(this.listenerTree),this},P.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},P.prototype.removeListener=P.prototype.off,P.prototype.removeAllListeners=function(t){if(t===e)return!this._events||c.call(this),this;if(this.wildcard){var r,n=T.call(this,null,t,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&_(this.listenerTree)}else this._events&&(this._events[t]=null);return this},P.prototype.listeners=function(t){var r,n,i,o,s,c=this._events;if(t===e){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!c)return[];for(o=(r=a(c)).length,i=[];o-- >0;)"function"==typeof(n=c[r[o]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var p=[],l="string"==typeof t?t.split(this.delimiter):t.slice();return T.call(this,p,l,s,0),p}return c&&(n=c[t])?"function"==typeof n?[n]:n:[]},P.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?a(t):[]},P.prototype.listenerCount=function(e){return this.listeners(e).length},P.prototype.hasListeners=function(t){if(this.wildcard){var r=[],n="string"==typeof t?t.split(this.delimiter):t.slice();return T.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(t===e?a(i).length:i[t]))},P.prototype.listenersAny=function(){return this._all?this._all:[]},P.prototype.waitFor=function(t,r){var n=this,i=typeof r;return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),b((r=h(r,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:v,Promise:m})).Promise,(function(e,i,o){function s(){var o=r.filter;if(!o||o.apply(n,arguments))if(n.off(t,s),r.handleError){var a=arguments[0];a?i(a):e(d.apply(null,arguments).slice(1))}else e(d.apply(null,arguments))}o((function(){n.off(t,s)})),n._on(t,s,!1)}),{timeout:r.timeout,overload:r.overload})};var k=P.prototype;Object.defineProperties(P,{defaultMaxListeners:{get:function(){return k._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");k._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return b((r=h(r,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(r,n,i){var o;if("function"==typeof e.addEventListener)return o=function(){r(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),r(d.apply(null,arguments))};"error"!==t&&(s=function(r){e.removeListener(t,a),n(r)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(k,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),Ie.exports=P}(),(Me=Le||(Le={}))[Me.VERBOSE=0]="VERBOSE",Me[Me.DEBUG=1]="DEBUG",Me[Me.INFO=2]="INFO",Me[Me.WARN=3]="WARN",Me[Me.TIME=4]="TIME",Me[Me.TIMEEND=5]="TIMEEND",Me[Me.ERROR=6]="ERROR",Me[Me.NONE=7]="NONE";var Ne,je,Ue,Fe,Ge,He,Ve,ze,We,Be,Ke,qe,Je,$e,Ye,Ze,Qe,Xe,et,tt,rt=class{static v(e,...t){this.log(0,e,...t)}static d(e,...t){this.log(1,e,...t)}static i(e,...t){this.log(2,e,...t)}static w(e,...t){this.log(3,e,...t)}static e(e,...t){this.log(6,e,...t)}static time(e){this.log(4,"[HMSPerformanceTiming]",e)}static timeEnd(e){this.log(5,"[HMSPerformanceTiming]",e,e)}static cleanUp(){performance.clearMarks(),performance.clearMeasures()}static log(e,t,...r){if(!(this.level.valueOf()>e.valueOf()))switch(e){case 0:console.log(t,...r);break;case 1:console.debug(t,...r);break;case 2:console.info(t,...r);break;case 3:console.warn(t,...r);break;case 6:console.error(t,...r);break;case 4:performance.mark(r[0]);break;case 5:{let e=r[0];try{let r=performance.measure(e,e);this.log(1,t,e,null==r?void 0:r.duration),performance.clearMarks(e),performance.clearMeasures(e)}catch(r){this.log(1,t,e,r)}break}}}};rt.level="test"===(null==(Ne=null==process?void 0:process.env)?void 0:Ne.NODE_ENV)?7:0,(Ue=je||(je={}))[Ue.Publish=0]="Publish",Ue[Ue.Subscribe=1]="Subscribe",(Ge=Fe||(Fe={})).NONE="NONE",Ge.TRACK="TRACK",Ge.INIT="INIT",Ge.PUBLISH="PUBLISH",Ge.UNPUBLISH="UNPUBLISH",Ge.JOIN="JOIN",Ge.SUBSCRIBE="SUBSCRIBE",Ge.DATA_CHANNEL_SEND="DATA_CHANNEL_SEND",Ge.RESTART_ICE="RESTART_ICE",Ge.VIDEO_PLUGINS="VIDEO_PLUGINS",Ge.AUDIO_PLUGINS="AUDIO_PLUGINS",Ge.AUTOPLAY="AUTOPLAY",Ge.RECONNECT_SIGNAL="RECONNECT_SIGNAL",Ge.VALIDATION="VALIDATION",Ge.PLAYLIST="PLAYLIST",Ge.PREVIEW="PREVIEW",(Ve=He||(He={}))[Ve.PEER_ADDED=0]="PEER_ADDED",Ve[Ve.PEER_REMOVED=1]="PEER_REMOVED",Ve[Ve.PEER_KNOCKED=2]="PEER_KNOCKED",Ve[Ve.ROOM_TYPE_CHANGED=3]="ROOM_TYPE_CHANGED",Ve[Ve.METADATA_UPDATED=4]="METADATA_UPDATED",Ve[Ve.SCREENSHARE_STARTED=5]="SCREENSHARE_STARTED",Ve[Ve.SCREENSHARE_STOPPED=6]="SCREENSHARE_STOPPED",Ve[Ve.DEFAULT_UPDATE=7]="DEFAULT_UPDATE",Ve[Ve.RECORDING_STATE_UPDATED=8]="RECORDING_STATE_UPDATED",Ve[Ve.BROWSER_RECORDING_STATE_UPDATED=9]="BROWSER_RECORDING_STATE_UPDATED",Ve[Ve.SERVER_RECORDING_STATE_UPDATED=10]="SERVER_RECORDING_STATE_UPDATED",Ve[Ve.RTMP_STREAMING_STATE_UPDATED=11]="RTMP_STREAMING_STATE_UPDATED",Ve[Ve.HLS_STREAMING_STATE_UPDATED=12]="HLS_STREAMING_STATE_UPDATED",(We=ze||(ze={}))[We.PEER_JOINED=0]="PEER_JOINED",We[We.PEER_LEFT=1]="PEER_LEFT",We[We.AUDIO_TOGGLED=2]="AUDIO_TOGGLED",We[We.VIDEO_TOGGLED=3]="VIDEO_TOGGLED",We[We.BECAME_DOMINANT_SPEAKER=4]="BECAME_DOMINANT_SPEAKER",We[We.RESIGNED_DOMINANT_SPEAKER=5]="RESIGNED_DOMINANT_SPEAKER",We[We.STARTED_SPEAKING=6]="STARTED_SPEAKING",We[We.STOPPED_SPEAKING=7]="STOPPED_SPEAKING",We[We.ROLE_UPDATED=8]="ROLE_UPDATED",We[We.PEER_LIST=9]="PEER_LIST",We[We.NAME_UPDATED=10]="NAME_UPDATED",We[We.METADATA_UPDATED=11]="METADATA_UPDATED",(Ke=Be||(Be={}))[Ke.TRACK_ADDED=0]="TRACK_ADDED",Ke[Ke.TRACK_REMOVED=1]="TRACK_REMOVED",Ke[Ke.TRACK_MUTED=2]="TRACK_MUTED",Ke[Ke.TRACK_UNMUTED=3]="TRACK_UNMUTED",Ke[Ke.TRACK_DESCRIPTION_CHANGED=4]="TRACK_DESCRIPTION_CHANGED",Ke[Ke.TRACK_DEGRADED=5]="TRACK_DEGRADED",Ke[Ke.TRACK_RESTORED=6]="TRACK_RESTORED",(Je=qe||(qe={}))[Je.DEFAULT=0]="DEFAULT",(Ye=$e||($e={})).NONE="none",Ye.LOW="low",Ye.MEDIUM="medium",Ye.HIGH="high",$e.HIGH,$e.MEDIUM,$e.LOW,(Qe=Ze||(Ze={})).VP8="vp8",Qe.VP9="vp9",Qe.H264="h264",(Xe||(Xe={})).OPUS="opus",function(e){e.audio="audio",e.video="video"}(et||(et={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(tt||(tt={}));var nt,it,ot,st,at,ct,pt,lt,dt,ut,ft,ht,mt,gt,vt="0.1.40-alpha.4",yt=new Oe.exports.UAParser,bt="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node&&!(null==(nt=yt.getBrowser().name)?void 0:nt.toLowerCase().includes("electron")),wt="undefined"!=typeof window;!function(){if(bt)return`hmsclient/${vt}`;let e=yt.getDevice(),t=yt.getBrowser(),r=yt.getOS();e.type?(r.name,r.version,e.vendor,e.type,t.name,t.version):(r.name,r.version,t.name,t.version)}(),(ot=it||(it={})).JOIN="join",ot.OFFER="offer",ot.ANSWER="answer",ot.TRICKLE="trickle",ot.TRACK_UPDATE="track-update",ot.BROADCAST="broadcast",ot.ANALYTICS="analytics",ot.SERVER_ERROR="on-error",ot.SERVER_WARNING="on-warning",ot.SDK_NOTIFICATION="sdk-notification",ot.LEAVE="leave",ot.END_ROOM="end-room",ot.PING="ping",ot.ROLE_CHANGE_REQUEST="role-change-request",ot.ROLE_CHANGE="role-change",ot.TRACK_UPDATE_REQUEST="track-update-request",ot.PEER_LEAVE_REQUEST="peer-leave-request",ot.CHANGE_TRACK_MUTE_STATE_REQUEST="change-track-mute-state-request",ot.START_RTMP_OR_RECORDING_REQUEST="rtmp-start",ot.STOP_RTMP_AND_RECORDING_REQUEST="rtmp-stop",ot.UPDATE_PEER_METADATA="peer-update",ot.START_HLS_STREAMING="hls-start",ot.STOP_HLS_STREAMING="hls-stop",(at=st||(st={})).PEER_JOIN="on-peer-join",at.PEER_LEAVE="on-peer-leave",at.PEER_LIST="peer-list",at.TRACK_METADATA_ADD="on-track-add",at.TRACK_UPDATE="on-track-update",at.CHANGE_TRACK_MUTE_STATE_UPDATE="on-change-track-mute-state-request",at.ACTIVE_SPEAKERS="active-speakers",at.BROADCAST="on-broadcast",at.ROLE_CHANGE="on-role-change",at.POLICY_CHANGE="on-policy-change",at.ROLE_CHANGE_REQUEST="on-role-change-request",at.TRACK_UPDATE_REQUEST="on-track-update-request",at.PEER_UPDATE="on-peer-update",at.PEER_LEAVE_REQUEST="on-peer-leave-request",at.UNSUPPORTED="unsupported",at.RTMP_START="on-rtmp-start",at.RTMP_STOP="on-rtmp-stop",at.RECORDING_START="on-record-start",at.RECORDING_STOP="on-record-stop",at.HLS_START="on-hls-start",at.HLS_STOP="on-hls-stop",function(e){e.AUDIO="audio",e.VIDEO="video",e.AV="audio, video",e.SCREEN="screen"}(ct||(ct={})),function(e){e.TRANSFORM="TRANSFORM",e.ANALYZE="ANALYZE"}(pt||(pt={})),function(e){e.CUSTOM="CUSTOM",e.LOCAL="LOCAL",e.HMS="HMS"}(lt||(lt={})),function(){if(wt&&window){let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e?lt.LOCAL:e.includes("app.100ms.live")?lt.HMS:lt.CUSTOM}lt.CUSTOM}(),function(e){e[e.VERBOSE=0]="VERBOSE",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.OFF=3]="OFF"}(dt||(dt={})),function(e){e[e.VERBOSE=0]="VERBOSE",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.OFF=3]="OFF"}(ut||(ut={})),function(e){e.TRANSFORM="TRANSFORM",e.ANALYZE="ANALYZE"}(ft||(ft={})),(mt=ht||(ht={}))[mt.Disconnected=0]="Disconnected",mt[mt.Connecting=1]="Connecting",mt[mt.Joined=2]="Joined",mt[mt.Failed=3]="Failed",mt[mt.Reconnecting=4]="Reconnecting",mt[mt.Leaving=5]="Leaving",function(e){e[e.ConnectFailed=0]="ConnectFailed",e[e.SignalDisconnect=1]="SignalDisconnect",e[e.PublishIceConnectionFailed=2]="PublishIceConnectionFailed",e[e.SubscribeIceConnectionFailed=3]="SubscribeIceConnectionFailed"}(gt||(gt={})),rt.i("adapter",`${Ae.browserDetails.browser} v${Ae.browserDetails.version}`);exports.HMSRoomProvider=({children:n,actions:i,store:o,notifications:s,webrtcInternals:a,isHMSStatsOn:l=!1})=>{if(!m){const t=()=>{throw new Error("modifying store is not allowed")};if(i&&o){if(m={actions:i,store:p.default(e({},o,{setState:t,destroy:t}))},s&&(m.notifications=s),a){const e=a;m.statsStore=p.default({getState:e.getState,subscribe:e.subscribe,setState:t,destroy:t})}}else{const n=new r.HMSReactiveStore;if(m={actions:n.getHMSActions(),store:p.default(e({},n.getStore(),{setState:t,destroy:t})),notifications:n.getNotifications()},l){const e=n.getStats();m.statsStore=p.default({getState:e.getState,subscribe:e.subscribe,setState:t,destroy:t})}}}return t.useEffect((()=>{f&&(window.onunload=()=>{m.actions.leave()})}),[]),c.default.createElement(h.Provider,{value:m},n)},exports.calculateLayoutSizes=_,exports.chunkElements=T,exports.getModeAspectRatio=C,exports.useAVToggle=()=>{const e=g(r.selectIsLocalAudioEnabled),n=g(r.selectIsLocalVideoEnabled),i=g(r.selectIsAllowedToPublish),o=w(),s=t.useCallback((async()=>{try{await o.setLocalAudioEnabled(!e)}catch(e){console.error("Cannot toggle audio",e)}}),[e]),a=t.useCallback((async()=>{try{await o.setLocalVideoEnabled(!n)}catch(e){console.error("Cannot toggle video",e)}}),[n]);return{isLocalAudioEnabled:e,isLocalVideoEnabled:n,toggleAudio:s,toggleVideo:a,isAllowedToPublish:i}},exports.useAudioLevel=function({trackId:e,getStyle:n,ref:i}){const o=b();t.useEffect((()=>o.subscribe((e=>{if(!i.current)return;const t=n(e);console.log(t,e);for(const e in t)i.current.style[e]=t[e]}),r.selectTrackAudioByID(e))),[e])},exports.useDevices=()=>{const e=w(),t=g(r.selectDevices),n=g(r.selectLocalMediaSettings),{video:i,audio:o}=g(r.selectIsAllowedToPublish),s=g(r.selectIsAllowedToSubscribe),a=t.videoInput||[],c=t.audioInput||[],p=t.audioOutput||[];return[i,o,s].some((e=>!!e))?{showVideo:i,videoInput:a,showAudio:o,audioInput:c,audioOutput:p,isSubscribing:s,selectedDevices:n,handleInputChange:t=>{const r=t.currentTarget.value,{name:i}=t.currentTarget;if(r!==n[i])switch(i){case"audioInputDeviceId":e.setAudioSettings({deviceId:r});break;case"videoInputDeviceId":e.setVideoSettings({deviceId:r});break;case"audioOutputDeviceId":e.setAudioOutputDevice(r)}}}:null},exports.useHMSActions=w,exports.useHMSNotifications=()=>{const e=t.useContext(h),[r,n]=t.useState(null);if(!e)throw new Error(u);return t.useEffect((()=>{if(!e.notifications)return;const t=e.notifications.onNotification((e=>n(e)));return t}),[e.notifications]),r},exports.useHMSStatsStore=y,exports.useHMSStore=g,exports.useHMSVanillaStore=b,exports.usePreview=(e,n="preview")=>{const[i,o]=t.useState(!1),s=w(),a=g(r.selectLocalPeer),c=g(r.selectRoomState),p=g(r.selectIsLocalAudioEnabled),l=g(r.selectIsLocalVideoDisplayEnabled),d=g(r.selectIsAllowedToPublish),u=i||c!==r.HMSRoomState.Preview;return t.useEffect((()=>{c===r.HMSRoomState.Disconnected&&s.preview({userName:n,authToken:e}),wt&&(window.onunload=()=>s.leave())}),[c,s,e]),{localPeer:a,roomState:c,audioEnabled:p,videoEnabled:l,isAllowedToPublish:d,disableJoin:u,actions:s,setInProgress:o}},exports.useVideo=e=>{const n=w(),o=t.useRef(null),{ref:s,inView:a}=i.useInView({threshold:.5}),c=t.useCallback((e=>{o.current=e,s(e)}),[s]),p=g(r.selectTrackByID(e));return t.useEffect((()=>{(async()=>{o.current&&p&&(a&&p.enabled?(console.log("****** ENABLE VIDEO *******"),await n.attachVideo(p.id,o.current)):(console.log("****** DETACH VIDEO *******"),await n.detachVideo(p.id,o.current)))})()}),[a,o,null==p?void 0:p.id,null==p?void 0:p.enabled,null==p?void 0:p.deviceID,null==p?void 0:p.plugins]),c},exports.useVideoList=({maxTileCount:e,maxColCount:n,maxRowCount:i,width:o,height:s,showScreenFn:a=(()=>!1),peers:c,overflow:p="scroll-x",aspectRatio:l})=>{const d=((e,t,r)=>{if(!e||!t||!r)return[];const n=[];for(const i of e)if(void 0===i.videoTrack&&i.audioTrack&&t[i.audioTrack]?n.push({peer:i}):i.videoTrack&&t[i.videoTrack]&&n.push({track:t[i.videoTrack],peer:i}),r(i)&&i.auxiliaryTracks.length>0){const e=i.auxiliaryTracks.find((e=>{const r=t[e];return"video"===(null==r?void 0:r.type)&&"screen"===(null==r?void 0:r.source)}));e&&n.push({track:t[e],peer:i})}return n})(c,b().getState(r.selectTracksMap),a),u=t.useMemo((()=>{if(l)return l;return{width:C(d)||1,height:1}}),[l,d]),f=d.length,{tilesInFirstPage:h,defaultWidth:m,defaultHeight:g,lastPageWidth:v,lastPageHeight:y,isLastPageDifferentFromFirstPage:w}=t.useMemo((()=>_({count:f,parentWidth:Math.floor(o),parentHeight:Math.floor(s),maxTileCount:e,maxRowCount:i,maxColCount:n,aspectRatio:u})),[f,o,s,e,i,n,u]);return{chunkedTracksWithPeer:t.useMemo((()=>T({elements:d,tilesInFirstPage:h,onlyOnePage:"hidden"===p,isLastPageDifferentFromFirstPage:w,defaultWidth:m,defaultHeight:g,lastPageWidth:v,lastPageHeight:y})),[d,h,p,w,m,g,v,y])}},exports.useVideoTile=e=>{const n=w(),i=t.useRef(null),o=g(r.selectVideoTrackByPeerID(e.id)),s=g(r.selectIsPeerAudioEnabled(e.id)),a=g(r.selectIsPeerVideoEnabled(e.id)),{isLocal:c,name:p}=e,l=g(r.selectPeerAudioByID(e.id))>0;return t.useEffect((()=>{i.current&&o&&(o.enabled?n.attachVideo(o.id,i.current):n.detachVideo(o.id,i.current))}),[o,n]),{videoRef:i,isAudioOn:s,isVideoOn:a,actions:n,isLocal:c,name:p,audioLevel:l}};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{e}from"../../../_virtual/eventemitter2.js_commonjs-module.js";
|
|
2
|
+
/*!
|
|
3
|
+
* EventEmitter2
|
|
4
|
+
* https://github.com/hij1nx/EventEmitter2
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2013 hij1nx
|
|
7
|
+
* Licensed under the MIT license.
|
|
8
|
+
*/var t;t=e,function(e){var r=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof process&&"function"==typeof process.nextTick,s="function"==typeof Symbol,o="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,a=s?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function f(){this._events={},this._conf&&h.call(this,this._conf)}function h(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function c(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var u=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function p(t,r){for(var n={},i=t.length,s=r?value.length:0,o=0;o<i;o++)n[t[o]]=o<s?r[o]:e;return n}function v(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function y(t,n,i,s){var o=Object.assign({},n);if(!t)return o;if("object"!=typeof t)throw TypeError("options must be an object");var l,a,f,h=Object.keys(t),c=h.length;function u(e){throw Error('Invalid "'+l+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<c;p++){if(l=h[p],!s&&!r.call(n,l))throw Error('Unknown "'+l+'" option');(a=t[l])!==e&&(f=i[l],o[l]=f?f(a,u):a)}return o}function _(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function m(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,o=r;o-- >0;)if(s===e[o])return n;i(t)}}Object.assign(v.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,o=this._listeners,l=function(){var n=u.apply(null,arguments),o={data:n,name:t,original:e};if(r){var l=r.call(i,o);!1!==l&&s.emit.apply(s,[o.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(o[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===o[e]&&(o[e]=l,n._on.call(i,e,l))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&o[e]&&(o[e]=null,n._off.call(i,e,l))},o[e]=null,s.on("removeListener",this._onRemoveListener)):(o[e]=l,n._on.call(i,e,l))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,o=this._emitter,l=this._off,f=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function h(){i._onNewListener&&(o.off("newListener",i._onNewListener),o.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=g.call(o,i);o._observers.splice(e,1)}if(e){if(!(t=s[e]))return;l.call(f,e,t),delete s[e],--this._listenersCount||h()}else{for(n=(r=a(s)).length;n-- >0;)e=r[n],l.call(f,e,s[e]);this._listeners={},this._listenersCount=0,h()}}});var d=m(["function"]),b=m(["object","function"]);function w(e,t,r){var n,i,s,o=0,l=new e((function(a,f,h){function c(){i&&(i=null),o&&(clearTimeout(o),o=0)}r=y(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof h;var u=function(e){c(),a(e)},p=function(e){c(),f(e)};n?t(u,p,h):(i=[function(e){p(e||Error("canceled"))}],t(u,p,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(o=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",o=0,l.cancel(e),f(e)}),r.timeout))}));return n||(l.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),l}function g(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function L(e,t,r,n,i){if(!r)return null;if(0===n){var s=typeof t;if("string"===s){var o,l,f=0,h=0,c=this.delimiter,u=c.length;if(-1!==(l=t.indexOf(c))){o=new Array(5);do{o[f++]=t.slice(h,l),h=l+u}while(-1!==(l=t.indexOf(c,h)));o[f++]=t.slice(h),t=o,i=f}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var p,v,y,_,m,d,b,w=null,g=t[n],E=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),w=[r]):(e&&e.push.apply(e,r._listeners),w=[r]));else{if("*"===g){for(l=(d=a(r)).length;l-- >0;)"_listeners"!==(p=d[l])&&(b=L(e,t,r[p],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===g){for((m=n+1===i||n+2===i&&"*"===E)&&r._listeners&&(w=L(e,t,r,i,i)),l=(d=a(r)).length;l-- >0;)"_listeners"!==(p=d[l])&&("*"===p||"**"===p?(r[p]._listeners&&!m&&(b=L(e,t,r[p],i,i))&&(w?w.push.apply(w,b):w=b),b=L(e,t,r[p],n,i)):b=L(e,t,r[p],p===E?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[g]&&(w=L(e,t,r[g],n+1,i))}if((v=r["*"])&&L(e,t,v,n+1,i),y=r["**"])if(n<i)for(y._listeners&&L(e,t,y,i,i),l=(d=a(y)).length;l-- >0;)"_listeners"!==(p=d[l])&&(p===E?L(e,t,y[p],n+2,i):p===g?L(e,t,y[p],n+1,i):((_={})[p]=y[p],L(e,t,{"**":_},n+1,i)));else y._listeners?L(e,t,y,i,i):y["*"]&&y["*"]._listeners&&L(e,t,y["*"],i,i);return w}function E(e,t,r){var n,i,s=0,o=0,l=this.delimiter,a=l.length;if("string"==typeof e)if(-1!==(n=e.indexOf(l))){i=new Array(5);do{i[s++]=e.slice(o,n),o=n+a}while(-1!==(n=e.indexOf(l,o)));i[s++]=e.slice(o)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var f,h=this.listenerTree;for(n=0;n<s;n++)if(h=h[f=i[n]]||(h[f]={}),n===s-1)return h._listeners?("function"==typeof h._listeners&&(h._listeners=[h._listeners]),r?h._listeners.unshift(t):h._listeners.push(t),!h._listeners.warned&&this._maxListeners>0&&h._listeners.length>this._maxListeners&&(h._listeners.warned=!0,c.call(this,h._listeners.length,f))):h._listeners=t,!0;return!0}function j(e,t,r,n){for(var i,s,o,l,f=a(e),h=f.length,c=e._listeners;h-- >0;)i=e[s=f[h]],o="_listeners"===s?r:r?r.concat(s):[s],l=n||"symbol"==typeof s,c&&t.push(l?o:o.join(this.delimiter)),"object"==typeof i&&j.call(this,i,t,o,l);return t}function k(e){for(var t,r,n,i=a(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||k(t)||delete e[r]);return n}function T(e,t,r){this.emitter=e,this.event=t,this.listener=r}function x(t,r,n){if(!0===n)o=!0;else if(!1===n)s=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var s=n.async,o=n.promisify,a=n.nextTick,f=n.objectify}if(s||a||o){var h=r,c=r._origin||r;if(a&&!i)throw Error("process.nextTick is not supported");o===e&&(o="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return o?a?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=r,h.apply(t,e)})):(a?process.nextTick:l)((function(){t.event=r,h.apply(t,e)}))},r._async=!0,r._origin=c}return[r,f?new T(this,t,r):this]}function A(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,h.call(this,e)}T.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},A.EventEmitter2=A,A.prototype.listenTo=function(t,r,i){if("object"!=typeof t)throw TypeError("target musts be an object");var s=this;function o(e){if("object"!=typeof e)throw TypeError("events must be an object");var r,n=i.reducers,o=g.call(s,t);r=-1===o?new v(s,t,i):s._observers[o];for(var l,f=a(e),h=f.length,c="function"==typeof n,u=0;u<h;u++)l=f[u],r.subscribe(l,e[l]||l,c?n:n&&n[l])}return i=y(i,{on:e,off:e,reducers:e},{on:d,off:d,reducers:b}),n(r)?o(p(r)):o("string"==typeof r?p(r.split(/\s+/)):r),this},A.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},A.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},A.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},A.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},A.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},A.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function o(){return 0==--t&&s.off(e,o),r.apply(this,arguments)}return o._origin=r,this._on(e,o,n,i)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||f.call(this);var e,t,r,n,i,o,l=arguments[0],a=this.wildcard;if("newListener"===l&&!this._newListener&&!this._events.newListener)return!1;if(a&&(e=l,"newListener"!==l&&"removeListener"!==l&&"object"==typeof l)){if(r=l.length,s)for(n=0;n<r;n++)if("symbol"==typeof l[n]){o=!0;break}o||(l=l.join(this.delimiter))}var h,c=arguments.length;if(this._all&&this._all.length)for(n=0,r=(h=this._all.slice()).length;n<r;n++)switch(this.event=l,c){case 1:h[n].call(this,l);break;case 2:h[n].call(this,l,arguments[1]);break;case 3:h[n].call(this,l,arguments[1],arguments[2]);break;default:h[n].apply(this,arguments)}if(a)h=[],L.call(this,h,e,this.listenerTree,0,r);else{if("function"==typeof(h=this._events[l])){switch(this.event=l,c){case 1:h.call(this);break;case 2:h.call(this,arguments[1]);break;case 3:h.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(c-1),i=1;i<c;i++)t[i-1]=arguments[i];h.apply(this,t)}return!0}h&&(h=h.slice())}if(h&&h.length){if(c>3)for(t=new Array(c-1),i=1;i<c;i++)t[i-1]=arguments[i];for(n=0,r=h.length;n<r;n++)switch(this.event=l,c){case 1:h[n].call(this);break;case 2:h[n].call(this,arguments[1]);break;case 3:h[n].call(this,arguments[1],arguments[2]);break;default:h[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===l)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},A.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||f.call(this);var e,t,r,n,i,o,l=arguments[0],a=this.wildcard;if("newListener"===l&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(a&&(e=l,"newListener"!==l&&"removeListener"!==l&&"object"==typeof l)){if(n=l.length,s)for(i=0;i<n;i++)if("symbol"==typeof l[i]){t=!0;break}t||(l=l.join(this.delimiter))}var h,c=[],u=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=l,u){case 1:c.push(this._all[i].call(this,l));break;case 2:c.push(this._all[i].call(this,l,arguments[1]));break;case 3:c.push(this._all[i].call(this,l,arguments[1],arguments[2]));break;default:c.push(this._all[i].apply(this,arguments))}if(a?(h=[],L.call(this,h,e,this.listenerTree,0)):h=this._events[l],"function"==typeof h)switch(this.event=l,u){case 1:c.push(h.call(this));break;case 2:c.push(h.call(this,arguments[1]));break;case 3:c.push(h.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(u-1),o=1;o<u;o++)r[o-1]=arguments[o];c.push(h.apply(this,r))}else if(h&&h.length){if(h=h.slice(),u>3)for(r=new Array(u-1),o=1;o<u;o++)r[o-1]=arguments[o];for(i=0,n=h.length;i<n;i++)switch(this.event=l,u){case 1:c.push(h[i].call(this));break;case 2:c.push(h[i].call(this,arguments[1]));break;case 3:c.push(h[i].call(this,arguments[1],arguments[2]));break;default:c.push(h[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===l)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(c)},A.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},A.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},A.prototype.onAny=function(e){return this._onAny(e,!1)},A.prototype.prependAny=function(e){return this._onAny(e,!0)},A.prototype.addListener=A.prototype.on,A.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},A.prototype._on=function(t,r,n,i){if("function"==typeof t)return this._onAny(t,r),this;if("function"!=typeof r)throw new Error("on only accepts instances of Function");this._events||f.call(this);var s,o=this;return i!==e&&(r=(s=x.call(this,t,r,i))[0],o=s[1]),this._newListener&&this.emit("newListener",t,r),this.wildcard?(E.call(this,t,r,n),o):(this._events[t]?("function"==typeof this._events[t]&&(this._events[t]=[this._events[t]]),n?this._events[t].unshift(r):this._events[t].push(r),!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,c.call(this,this._events[t].length,t))):this._events[t]=r,o)},A.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=L.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var o=0;o<i.length;o++){var l=i[o];if(r=l._listeners,n(r)){for(var a=-1,f=0,h=r.length;f<h;f++)if(r[f]===t||r[f].listener&&r[f].listener===t||r[f]._origin&&r[f]._origin===t){a=f;break}if(a<0)continue;return this.wildcard?l._listeners.splice(a,1):this._events[e].splice(a,1),0===r.length&&(this.wildcard?delete l._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete l._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&k(this.listenerTree),this},A.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},A.prototype.removeListener=A.prototype.off,A.prototype.removeAllListeners=function(t){if(t===e)return!this._events||f.call(this),this;if(this.wildcard){var r,n=L.call(this,null,t,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&k(this.listenerTree)}else this._events&&(this._events[t]=null);return this},A.prototype.listeners=function(t){var r,n,i,s,o,l=this._events;if(t===e){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!l)return[];for(s=(r=a(l)).length,i=[];s-- >0;)"function"==typeof(n=l[r[s]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(o=this.listenerTree))return[];var f=[],h="string"==typeof t?t.split(this.delimiter):t.slice();return L.call(this,f,h,o,0),f}return l&&(n=l[t])?"function"==typeof n?[n]:n:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?j.call(this,this.listenerTree,[],null,e):t?a(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.prototype.hasListeners=function(t){if(this.wildcard){var r=[],n="string"==typeof t?t.split(this.delimiter):t.slice();return L.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,s=this._all;return!!(s&&s.length||i&&(t===e?a(i).length:i[t]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(t,r){var n=this,i=typeof r;return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),w((r=y(r,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:d,Promise:_})).Promise,(function(e,i,s){function o(){var s=r.filter;if(!s||s.apply(n,arguments))if(n.off(t,o),r.handleError){var l=arguments[0];l?i(l):e(u.apply(null,arguments).slice(1))}else e(u.apply(null,arguments))}s((function(){n.off(t,o)})),n._on(t,o,!1)}),{timeout:r.timeout,overload:r.overload})};var P=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");P._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return w((r=y(r,{Promise:Promise,timeout:0,overload:!1},{Promise:_})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(u.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var o,l=function(){o&&e.removeListener("error",o),r(u.apply(null,arguments))};"error"!==t&&(o=function(r){e.removeListener(t,l),n(r)},e.once("error",o)),i((function(){o&&e.removeListener("error",o),e.removeListener(t,l)})),e.once(t,l)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(P,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=A}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"../../_virtual/sdp.js_commonjs-module.js";!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const s=e.type;return t.push("typ"),t.push(s),"host"!==s&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){let t=e.substr(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){const t={};let r;const s=e.substr(e.indexOf(" ")+1).split(";");for(let e=0;e<s.length;e++)r=s[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const s=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?s.push(t+"="+e.parameters[t]):s.push(t)})),t+="a=fmtp:"+r+" "+s.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},s=e.indexOf(":",t);return s>-1?(r.attribute=e.substr(t+1,s-t-1),r.value=e.substr(s+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){const t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){const t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const s=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return s&&n?{usernameFragment:s.substr(12),password:n.substr(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},s=t.splitLines(e)[0].split(" ");for(let n=3;n<s.length;n++){const a=s[n],i=t.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(i){const s=t.parseRtpMap(i),n=t.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=n.length?t.parseFmtp(n[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){let s="";s+="m="+e+" ",s+=r.codecs.length>0?"9":"0",s+=" UDP/TLS/RTP/SAVPF ",s+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",s+="c=IN IP4 0.0.0.0\r\n",s+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{s+=t.writeRtpMap(e),s+=t.writeFmtp(e),s+=t.writeRtcpFb(e)}));let n=0;return r.codecs.forEach((e=>{e.maxptime>n&&(n=e.maxptime)})),n>0&&(s+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{s+=t.writeExtmap(e)})),s},t.parseRtpEncodingParameters=function(e){const r=[],s=t.parseRtpParameters(e),n=-1!==s.fecMechanisms.indexOf("RED"),a=-1!==s.fecMechanisms.indexOf("ULPFEC"),i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),p=i.length>0&&i[0].ssrc;let c;const o=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substr(17).split(" ").map((e=>parseInt(e,10)))));o.length>0&&o[0].length>1&&o[0][0]===p&&(c=o[0][1]),s.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:p,codecPayloadType:parseInt(e.parameters.apt,10)};p&&c&&(t.rtx={ssrc:c}),r.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:p,mechanism:a?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&p&&r.push({ssrc:p});let u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),r},t.parseRtcpParameters=function(e){const r={},s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];s&&(r.cname=s.value,r.ssrc=s.ssrc);const n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;const a=t.matchPrefix(e,"a=rtcp-mux");return r.mux=a.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const s=t.matchPrefix(e,"a=msid:");if(1===s.length)return r=s[0].substr(7).split(" "),{stream:r[0],track:r[1]};const n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return n.length>0?(r=n[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),s=t.matchPrefix(e,"a=max-message-size:");let n;s.length>0&&(n=parseInt(s[0].substr(19),10)),isNaN(n)&&(n=65536);const a=t.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};const i=t.matchPrefix(e,"a=sctpmap:");if(i.length>0){const e=i[0].substr(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,s){let n;const a=void 0!==r?r:2;n=e||t.generateSessionId();return"v=0\r\no="+(s||"thisisadapterortc")+" "+n+" "+a+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const s=t.splitLines(e);for(let e=0;e<s.length;e++)switch(s[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return s[e].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(e);var t=e.exports;export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e}from"../../../_virtual/grammar.js_commonjs-module.js";var r=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var r="candidate:%s %d %s %d %s %d typ %s";return r+=null!=e.raddr?" raddr %s rport %d":"%v%v",r+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(r+=" generation %d"),r+=null!=e["network-id"]?" network-id %d":"%v",r+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var r="ssrc:%d";return null!=e.attribute&&(r+=" %s",null!=e.value&&(r+=":%s")),r}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var r="mediaclk:";return r+=null!=e.id?"id=%s %s":"%v%s",r+=null!=e.mediaClockValue?"=%s":"",r+=null!=e.rateNumerator?" rate=%s":"",r+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(r).forEach((function(e){r[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__exports as r}from"../../../_virtual/parser.js_commonjs-exports.js";export{__exports as default}from"../../../_virtual/parser.js_commonjs-exports.js";import"./grammar.js";import{g as t}from"../../../_virtual/grammar.js_commonjs-module.js";!function(r){var n=function(r){return String(Number(r))===r?Number(r):r},e=function(r,t,e){var s=r.name&&r.names;r.push&&!t[r.push]?t[r.push]=[]:s&&!t[r.name]&&(t[r.name]={});var a=r.push?{}:s?t[r.name]:t;!function(r,t,e,s){if(s&&!e)t[s]=n(r[1]);else for(var a=0;a<e.length;a+=1)null!=r[a+1]&&(t[e[a]]=n(r[a+1]))}(e.match(r.reg),a,r.names,r.name),r.push&&t[r.push].push(a)},s=t.exports,a=RegExp.prototype.test.bind(/^([a-z])=(.*)/);r.parse=function(r){var t={},n=[],p=t;return r.split(/(\r\n|\r|\n)/).filter(a).forEach((function(r){var t=r[0],a=r.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),p=n[n.length-1]);for(var u=0;u<(s[t]||[]).length;u+=1){var i=s[t][u];if(i.reg.test(a))return e(i,p,a)}})),t.media=n,t};var p=function(r,t){var e=t.split(/=(.+)/,2);return 2===e.length?r[e[0]]=n(e[1]):1===e.length&&t.length>1&&(r[e[0]]=void 0),r};r.parseParams=function(r){return r.split(/;\s?/).reduce(p,{})},r.parseFmtpConfig=r.parseParams,r.parsePayloads=function(r){return r.toString().split(" ").map(Number)},r.parseRemoteCandidates=function(r){for(var t=[],e=r.split(" ").map(n),s=0;s<e.length;s+=3)t.push({component:e[s],ip:e[s+1],port:e[s+2]});return t},r.parseImageAttributes=function(r){return r.split(" ").map((function(r){return r.substring(1,r.length-1).split(",").reduce(p,{})}))},r.parseSimulcastStreamList=function(r){return r.split(";").map((function(r){return r.split(",").map((function(r){var t,e=!1;return"~"!==r[0]?t=n(r):(t=n(r.substring(1,r.length)),e=!0),{scid:t,paused:e}}))}))}}(r);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{commonjsGlobal as i}from"../../../_virtual/_commonjsHelpers.js";import{u as e}from"../../../_virtual/ua-parser.js_commonjs-module.js";var o,r;o=e,r=e.exports,function(i,e){var a="function",n="undefined",s="object",t="string",b="model",w="name",l="type",d="vendor",u="version",c="architecture",m="console",p="mobile",f="tablet",h="smarttv",v="wearable",g="embedded",x="Amazon",k="Apple",y="ASUS",_="BlackBerry",S="Firefox",T="Google",q="Huawei",z="LG",N="Microsoft",C="Motorola",j="Opera",A="Samsung",O="Sony",E="Xiaomi",B="Zebra",U="Facebook",R=function(i){for(var e={},o=0;o<i.length;o++)e[i[o].toUpperCase()]=i[o];return e},M=function(i,e){return typeof i===t&&-1!==V(e).indexOf(V(i))},V=function(i){return i.toLowerCase()},P=function(i,e){if(typeof i===t)return i=i.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof e===n?i:i.substring(0,255)},F=function(i,o){for(var r,n,t,b,w,l,d=0;d<o.length&&!w;){var u=o[d],c=o[d+1];for(r=n=0;r<u.length&&!w;)if(w=u[r++].exec(i))for(t=0;t<c.length;t++)l=w[++n],typeof(b=c[t])===s&&b.length>0?2===b.length?typeof b[1]==a?this[b[0]]=b[1].call(this,l):this[b[0]]=b[1]:3===b.length?typeof b[1]!==a||b[1].exec&&b[1].test?this[b[0]]=l?l.replace(b[1],b[2]):e:this[b[0]]=l?b[1].call(this,l,b[2]):e:4===b.length&&(this[b[0]]=l?b[3].call(this,l.replace(b[1],b[2])):e):this[b]=l||e;d+=2}},D=function(i,o){for(var r in o)if(typeof o[r]===s&&o[r].length>0){for(var a=0;a<o[r].length;a++)if(M(o[r][a],i))return"?"===r?e:r}else if(M(o[r],i))return"?"===r?e:r;return i},I={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[u,[w,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[u,[w,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[w,u],[/opios[\/ ]+([\w\.]+)/i],[u,[w,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[u,[w,j]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[w,u],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[u,[w,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[u,[w,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[u,[w,"WeChat"]],[/konqueror\/([\w\.]+)/i],[u,[w,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[u,[w,"IE"]],[/yabrowser\/([\w\.]+)/i],[u,[w,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[w,/(.+)/,"$1 Secure Browser"],u],[/\bfocus\/([\w\.]+)/i],[u,[w,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[u,[w,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[u,[w,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[u,[w,"Dolphin"]],[/coast\/([\w\.]+)/i],[u,[w,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[u,[w,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[u,[w,S]],[/\bqihu|(qi?ho?o?|360)browser/i],[[w,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[w,/(.+)/,"$1 Browser"],u],[/(comodo_dragon)\/([\w\.]+)/i],[[w,/_/g," "],u],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[w,u],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[w],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[w,U],u],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[w,u],[/\bgsa\/([\w\.]+) .*safari\//i],[u,[w,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[u,[w,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[w,"Chrome WebView"],u],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[u,[w,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[w,u],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[u,[w,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[u,w],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[w,[u,D,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[w,u],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[w,"Netscape"],u],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[u,[w,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[w,u]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[c,"amd64"]],[/(ia32(?=;))/i],[[c,V]],[/((?:i[346]|x)86)[;\)]/i],[[c,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[c,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[c,"armhf"]],[/windows (ce|mobile); ppc;/i],[[c,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[c,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[c,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[c,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[b,[d,A],[l,f]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[b,[d,A],[l,p]],[/\((ip(?:hone|od)[\w ]*);/i],[b,[d,k],[l,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[b,[d,k],[l,f]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[b,[d,q],[l,f]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[b,[d,q],[l,p]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[b,/_/g," "],[d,E],[l,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[b,/_/g," "],[d,E],[l,f]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[b,[d,"OPPO"],[l,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[b,[d,"Vivo"],[l,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[b,[d,"Realme"],[l,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[b,[d,C],[l,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[b,[d,C],[l,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[b,[d,z],[l,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[b,[d,z],[l,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[b,[d,"Lenovo"],[l,f]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[b,/_/g," "],[d,"Nokia"],[l,p]],[/(pixel c)\b/i],[b,[d,T],[l,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[b,[d,T],[l,p]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[b,[d,O],[l,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[b,"Xperia Tablet"],[d,O],[l,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[b,[d,"OnePlus"],[l,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[b,[d,x],[l,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[b,/(.+)/g,"Fire Phone $1"],[d,x],[l,p]],[/(playbook);[-\w\),; ]+(rim)/i],[b,d,[l,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[b,[d,_],[l,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[b,[d,y],[l,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[b,[d,y],[l,p]],[/(nexus 9)/i],[b,[d,"HTC"],[l,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[d,[b,/_/g," "],[l,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[b,[d,"Acer"],[l,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[b,[d,"Meizu"],[l,p]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[b,[d,"Sharp"],[l,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,b,[l,p]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,b,[l,f]],[/(surface duo)/i],[b,[d,N],[l,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[b,[d,"Fairphone"],[l,p]],[/(u304aa)/i],[b,[d,"AT&T"],[l,p]],[/\bsie-(\w*)/i],[b,[d,"Siemens"],[l,p]],[/\b(rct\w+) b/i],[b,[d,"RCA"],[l,f]],[/\b(venue[\d ]{2,7}) b/i],[b,[d,"Dell"],[l,f]],[/\b(q(?:mv|ta)\w+) b/i],[b,[d,"Verizon"],[l,f]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[b,[d,"Barnes & Noble"],[l,f]],[/\b(tm\d{3}\w+) b/i],[b,[d,"NuVision"],[l,f]],[/\b(k88) b/i],[b,[d,"ZTE"],[l,f]],[/\b(nx\d{3}j) b/i],[b,[d,"ZTE"],[l,p]],[/\b(gen\d{3}) b.+49h/i],[b,[d,"Swiss"],[l,p]],[/\b(zur\d{3}) b/i],[b,[d,"Swiss"],[l,f]],[/\b((zeki)?tb.*\b) b/i],[b,[d,"Zeki"],[l,f]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],b,[l,f]],[/\b(ns-?\w{0,9}) b/i],[b,[d,"Insignia"],[l,f]],[/\b((nxa|next)-?\w{0,9}) b/i],[b,[d,"NextBook"],[l,f]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],b,[l,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],b,[l,p]],[/\b(ph-1) /i],[b,[d,"Essential"],[l,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[b,[d,"Envizen"],[l,f]],[/\b(trio[-\w\. ]+) b/i],[b,[d,"MachSpeed"],[l,f]],[/\btu_(1491) b/i],[b,[d,"Rotor"],[l,f]],[/(shield[\w ]+) b/i],[b,[d,"Nvidia"],[l,f]],[/(sprint) (\w+)/i],[d,b,[l,p]],[/(kin\.[onetw]{3})/i],[[b,/\./g," "],[d,N],[l,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[b,[d,B],[l,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[b,[d,B],[l,p]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,b,[l,m]],[/droid.+; (shield) bui/i],[b,[d,"Nvidia"],[l,m]],[/(playstation [345portablevi]+)/i],[b,[d,O],[l,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[b,[d,N],[l,m]],[/smart-tv.+(samsung)/i],[d,[l,h]],[/hbbtv.+maple;(\d+)/i],[[b,/^/,"SmartTV"],[d,A],[l,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,z],[l,h]],[/(apple) ?tv/i],[d,[b,"Apple TV"],[l,h]],[/crkey/i],[[b,"Chromecast"],[d,T],[l,h]],[/droid.+aft(\w)( bui|\))/i],[b,[d,x],[l,h]],[/\(dtv[\);].+(aquos)/i],[b,[d,"Sharp"],[l,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,P],[b,P],[l,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,h]],[/((pebble))app/i],[d,b,[l,v]],[/droid.+; (glass) \d/i],[b,[d,T],[l,v]],[/droid.+; (wt63?0{2,3})\)/i],[b,[d,B],[l,v]],[/(quest( 2)?)/i],[b,[d,U],[l,v]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[b,[l,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[b,[l,f]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,f]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,p]],[/(android[-\w\. ]{0,9});.+buil/i],[b,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[u,[w,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[u,[w,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[w,u],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[u,w]],os:[[/microsoft (windows) (vista|xp)/i],[w,u],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[w,[u,D,I]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[w,"Windows"],[u,D,I]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[u,/_/g,"."],[w,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[w,"Mac OS"],[u,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[u,w],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[w,u],[/\(bb(10);/i],[u,[w,_]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[u,[w,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[u,[w,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[u,[w,"webOS"]],[/crkey\/([\d\.]+)/i],[u,[w,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[w,"Chromium OS"],u],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[w,u],[/(sunos) ?([\w\.\d]*)/i],[[w,"Solaris"],u],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[w,u]]},G=function o(r,a){if(typeof r===s&&(a=r,r=e),!(this instanceof o))return new o(r,a).getResult();var b=r||(typeof i!==n&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),w=a?function(i,e){var o={};for(var r in i)e[r]&&e[r].length%2==0?o[r]=e[r].concat(i[r]):o[r]=i[r];return o}(W,a):W;return this.getBrowser=function(){var i,o={};return o.name=e,o.version=e,F.call(o,b,w.browser),o.major=typeof(i=o.version)===t?i.replace(/[^\d\.]/g,"").split(".")[0]:e,o},this.getCPU=function(){var i={};return i.architecture=e,F.call(i,b,w.cpu),i},this.getDevice=function(){var i={};return i.vendor=e,i.model=e,i.type=e,F.call(i,b,w.device),i},this.getEngine=function(){var i={};return i.name=e,i.version=e,F.call(i,b,w.engine),i},this.getOS=function(){var i={};return i.name=e,i.version=e,F.call(i,b,w.os),i},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(i){return b=typeof i===t&&i.length>255?P(i,255):i,this},this.setUA(b),this};G.VERSION="1.0.2",G.BROWSER=R([w,u,"major"]),G.CPU=R([c]),G.DEVICE=R([b,d,l,m,p,h,f,v,g]),G.ENGINE=G.OS=R([w,u]),o.exports&&(r=o.exports=G),r.UAParser=G;var H=typeof i!==n&&(i.jQuery||i.Zepto);if(H&&!H.ua){var L=new G;H.ua=L.getResult(),H.ua.get=function(){return L.getUA()},H.ua.set=function(i){L.setUA(i);var e=L.getResult();for(var o in e)H.ua[o]=e[o]}}}("object"==typeof window?window:i);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{adapterFactory as o}from"./adapter_factory.js";const d=o({window:"undefined"==typeof window?void 0:window});export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{detectBrowser as r,extractVersion as i,disableLog as s,disableWarnings as e,log as m}from"./utils.js";import*as o from"./chrome/chrome_shim.js";import{shimPeerConnection as a,shimMediaStream as t,shimOnTrack as h,shimAddTrackRemoveTrack as f,shimGetSendersWithDtmf as n,shimGetStats as d,shimSenderReceiverGetStats as p,fixNegotiationNeeded as c}from"./chrome/chrome_shim.js";import*as j from"./firefox/firefox_shim.js";import{shimPeerConnection as u,shimOnTrack as l,shimRemoveStream as x,shimSenderGetStats as b,shimReceiverGetStats as w,shimRTCDataChannel as g,shimAddTransceiver as _,shimGetParameters as S,shimCreateOffer as C,shimCreateAnswer as k}from"./firefox/firefox_shim.js";import*as F from"./safari/safari_shim.js";import{shimRTCIceServerUrls as U,shimCreateOfferLegacy as v,shimCallbacksAPI as G,shimLocalStreamsAPI as M,shimRemoteStreamsAPI as D,shimTrackEventTransceiver as L,shimGetUserMedia as O,shimAudioContext as P}from"./safari/safari_shim.js";import*as T from"./common_shim.js";import{shimAddIceCandidateNullOrEmpty as V,shimParameterlessSetLocalDescription as W,shimRTCIceCandidate as q,shimMaxMessageSize as y,shimSendThrowTypeError as z,removeExtmapAllowMixed as A,shimConnectionState as B}from"./common_shim.js";import*as E from"../../../sdp/sdp.js";import{shimGetUserMedia as H}from"./firefox/getusermedia.js";import{shimGetUserMedia as I}from"./chrome/getusermedia.js";function J({window:J}={},K={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const N=m,Q=r(J),R={browserDetails:Q,commonShim:T,extractVersion:i,disableLog:s,disableWarnings:e,sdp:E};switch(Q.browser){case"chrome":if(!o||!a||!K.shimChrome)return N("Chrome shim is not included in this adapter release."),R;if(null===Q.version)return N("Chrome shim can not determine version, not shimming."),R;N("adapter.js shimming chrome."),R.browserShim=o,V(J,Q),W(J),I(J,Q),t(J),a(J,Q),h(J),f(J,Q),n(J),d(J),p(J),c(J,Q),q(J),B(J),y(J,Q),z(J),A(J,Q);break;case"firefox":if(!j||!u||!K.shimFirefox)return N("Firefox shim is not included in this adapter release."),R;N("adapter.js shimming firefox."),R.browserShim=j,V(J,Q),W(J),H(J,Q),u(J,Q),l(J),x(J),b(J),w(J),g(J),_(J),S(J),C(J),k(J),q(J),B(J),y(J,Q),z(J);break;case"safari":if(!F||!K.shimSafari)return N("Safari shim is not included in this adapter release."),R;N("adapter.js shimming safari."),R.browserShim=F,V(J,Q),W(J),U(J),v(J),G(J),M(J),D(J),L(J),O(J),P(J),q(J),y(J,Q),z(J),A(J,Q);break;default:N("Unsupported browser!")}return R}export{J as adapterFactory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{wrapPeerConnectionEvent as e,filterStats as t}from"../utils.js";export{shimGetUserMedia}from"./getusermedia.js";export{shimGetDisplayMedia}from"./getdisplaymedia.js";function r(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function n(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",(r=>{let n;n=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[e.stream],this.dispatchEvent(o)})),e.stream.getTracks().forEach((r=>{let n;n=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[e.stream],this.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else e(t,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function o(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let o=r.apply(this,arguments);return o||(o=t(this,e),this._senders.push(o)),o};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function s(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const o=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(s(o(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(s(o(t)))},r])})).then(r,n)}}function i(r){if(!("object"==typeof r&&r.RTCPeerConnection&&r.RTCRtpSender&&r.RTCRtpReceiver))return;if(!("getStats"in r.RTCRtpSender.prototype)){const e=r.RTCPeerConnection.prototype.getSenders;e&&(r.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((e=>e._pc=this)),t});const n=r.RTCPeerConnection.prototype.addTrack;n&&(r.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),r.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((r=>t(r,e.track,!0)))}}if(!("getStats"in r.RTCRtpReceiver.prototype)){const n=r.RTCPeerConnection.prototype.getReceivers;n&&(r.RTCPeerConnection.prototype.getReceivers=function(){const e=n.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),e(r,"track",(e=>(e.receiver._pc=e.srcElement,e))),r.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((r=>t(r,e.track,!1)))}}if(!("getStats"in r.RTCRtpSender.prototype)||!("getStats"in r.RTCRtpReceiver.prototype))return;const n=r.RTCPeerConnection.prototype.getStats;r.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof r.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}function c(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),o.apply(this,arguments)}}function a(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return c(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const o=e.RTCPeerConnection.prototype.removeStream;function s(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],o=e._streams[n.id];r=r.replace(new RegExp(o.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function i(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],o=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),o.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const o=this.getSenders().find((e=>e.track===t));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const s=this._streams[r.id];if(s)s.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=s(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>s(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=i(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const p=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=p.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function p(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function d(t,r){e(t,"negotiationneeded",(e=>{const t=e.target;if(!(r.version<72||t.getConfiguration&&"plan-b"===t.getConfiguration().sdpSemantics)||"stable"===t.signalingState)return e}))}export{d as fixNegotiationNeeded,a as shimAddTrackRemoveTrack,c as shimAddTrackRemoveTrackWithNative,o as shimGetSendersWithDtmf,s as shimGetStats,r as shimMediaStream,n as shimOnTrack,p as shimPeerConnection,i as shimSenderReceiverGetStats};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,i){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof i?e.navigator.mediaDevices.getDisplayMedia=function(a){return i(a).then((i=>{const o=a.video&&a.video.width,t=a.video&&a.video.height,d=a.video&&a.video.frameRate;return a.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:d||3}},o&&(a.video.mandatory.maxWidth=o),t&&(a.video.mandatory.maxHeight=t),e.navigator.mediaDevices.getUserMedia(a)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}export{e as shimGetDisplayMedia};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{log as e}from"../utils.js";const o=e;function r(e,r){const t=e&&e.navigator;if(!t.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const o={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const t="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==t.exact&&"number"==typeof t.exact&&(t.min=t.max=t.exact);const i=function(e,o){return e?e+o.charAt(0).toUpperCase()+o.slice(1):"deviceId"===o?"sourceId":o};if(void 0!==t.ideal){o.optional=o.optional||[];let e={};"number"==typeof t.ideal?(e[i("min",r)]=t.ideal,o.optional.push(e),e={},e[i("max",r)]=t.ideal,o.optional.push(e)):(e[i("",r)]=t.ideal,o.optional.push(e))}void 0!==t.exact&&"number"!=typeof t.exact?(o.mandatory=o.mandatory||{},o.mandatory[i("",r)]=t.exact):["min","max"].forEach((e=>{void 0!==t[e]&&(o.mandatory=o.mandatory||{},o.mandatory[i(e,r)]=t[e])}))})),e.advanced&&(o.optional=(o.optional||[]).concat(e.advanced)),o},n=function(e,n){if(r.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const o=function(e,o,r){o in e&&!(r in e)&&(e[r]=e[o],delete e[o])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const d=r.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||d)){let r;if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?r=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(r=["front"]),r)return t.mediaDevices.enumerateDevices().then((t=>{let d=(t=t.filter((e=>"videoinput"===e.kind))).find((e=>r.some((o=>e.label.toLowerCase().includes(o)))));return!d&&t.length&&r.includes("back")&&(d=t[t.length-1]),d&&(e.video.deviceId=a.exact?{exact:d.deviceId}:{ideal:d.deviceId}),e.video=i(e.video),o("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return o("chrome: "+JSON.stringify(e)),n(e)},a=function(e){return r.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(t.getUserMedia=function(e,o,r){n(e,(e=>{t.webkitGetUserMedia(e,o,(e=>{r&&r(a(e))}))}))}.bind(t),t.mediaDevices.getUserMedia){const e=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(o){return n(o,(o=>e(o).then((e=>{if(o.audio&&!e.getAudioTracks().length||o.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(a(e))))))}}}export{r as shimGetUserMedia};
|