this._cellMetadata[f]=p,this.getSections(p).forEach(function(o){return o.addCellIndex({index:f})})}}]),SectionManager}();function calculateSizeAndPositionData_calculateSizeAndPositionData(o){for(var p=o.cellCount,f=o.cellSizeAndPositionGetter,m=o.sectionSize,_=[],w=new eM(m),I=0,k=0,M=0;M<p;M++){var x=f({index:M});if(null==x.height||isNaN(x.height)||null==x.width||isNaN(x.width)||null==x.x||isNaN(x.x)||null==x.y||isNaN(x.y))throw Error("Invalid metadata returned for cell ".concat(M,`:
        x:`).concat(x.x,", y:").concat(x.y,", width:").concat(x.width,", height:").concat(x.height));I=Math.max(I,x.y+x.height),k=Math.max(k,x.x+x.width),_[M]=x,w.registerCell({cellMetadatum:x,index:M})}return{cellMetadata:_,height:I,sectionManager:w,width:k}}function getUpdatedOffsetForIndex(o){var p=o.align,f=o.cellOffset,m=o.cellSize,_=o.containerSize,w=o.currentOffset,I=f-_+m;switch(void 0===p?"auto":p){case"start":return f;case"end":return I;case"center":return f-(_-m)/2;default:return Math.max(I,Math.min(f,w))}}var ex=function(o){function Collection(o,p){var f;return(0,ei.A)(this,Collection),(f=(0,en.A)(this,(0,eo.A)(Collection).call(this,o,p)))._cellMetadata=[],f._lastRenderedCellIndices=[],f._cellCache=[],f._isScrollingChange=f._isScrollingChange.bind((0,es.A)(f)),f._setCollectionViewRef=f._setCollectionViewRef.bind((0,es.A)(f)),f}return(0,ea.A)(Collection,o),(0,er.A)(Collection,[{key:"forceUpdate",value:function(){void 0!==this._collectionView&&this._collectionView.forceUpdate()}},{key:"recomputeCellSizesAndPositions",value:function(){this._cellCache=[],this._collectionView.recomputeCellSizesAndPositions()}},{key:"render",value:function(){var o=(0,eu.A)({},this.props);return ed.createElement(eA,(0,eu.A)({cellLayoutManager:this,isScrollingChange:this._isScrollingChange,ref:this._setCollectionViewRef},o))}},{key:"calculateSizeAndPositionData",value:function(){var o=this.props,p=calculateSizeAndPositionData_calculateSizeAndPositionData({cellCount:o.cellCount,cellSizeAndPositionGetter:o.cellSizeAndPositionGetter,sectionSize:o.sectionSize});this._cellMetadata=p.cellMetadata,this._sectionManager=p.sectionManager,this._height=p.height,this._width=p.width}},{key:"getLastRenderedIndices",value:function(){return this._lastRenderedCellIndices}},{key:"getScrollPositionForCell",value:function(o){var p=o.align,f=o.cellIndex,m=o.height,_=o.scrollLeft,w=o.scrollTop,I=o.width,k=this.props.cellCount;if(f>=0&&f<k){var M=this._cellMetadata[f];_=getUpdatedOffsetForIndex({align:p,cellOffset:M.x,cellSize:M.width,containerSize:I,currentOffset:_,targetIndex:f}),w=getUpdatedOffsetForIndex({align:p,cellOffset:M.y,cellSize:M.height,containerSize:m,currentOffset:w,targetIndex:f})}return{scrollLeft:_,scrollTop:w}}},{key:"getTotalSize",value:function(){return{height:this._height,width:this._width}}},{key:"cellRenderers",value:function(o){var p=this,f=o.height,m=o.isScrolling,_=o.width,w=o.x,I=o.y,k=this.props,M=k.cellGroupRenderer,x=k.cellRenderer;return this._lastRenderedCellIndices=this._sectionManager.getCellIndices({height:f,width:_,x:w,y:I}),M({cellCache:this._cellCache,cellRenderer:x,cellSizeAndPositionGetter:function(o){var f=o.index;return p._sectionManager.getCellMetadata({index:f})},indices:this._lastRenderedCellIndices,isScrolling:m})}},{key:"_isScrollingChange",value:function(o){o||(this._cellCache=[])}},{key:"_setCollectionViewRef",value:function(o){this._collectionView=o}}]),Collection}(ed.PureComponent);function defaultCellGroupRenderer(o){var p=o.cellCache,f=o.cellRenderer,m=o.cellSizeAndPositionGetter,_=o.indices,w=o.isScrolling;return _.map(function(o){var _=m({index:o}),I={index:o,isScrolling:w,key:o,style:{height:_.height,left:_.x,position:"absolute",top:_.y,width:_.width}};return w?(o in p||(p[o]=f(I)),p[o]):f(I)}).filter(function(o){return!!o})}(0,el.A)(ex,"defaultProps",{"aria-label":"grid",cellGroupRenderer:defaultCellGroupRenderer}),ex.propTypes={},function(o){function ColumnSizer(o,p){var f;return(0,ei.A)(this,ColumnSizer),(f=(0,en.A)(this,(0,eo.A)(ColumnSizer).call(this,o,p)))._registerChild=f._registerChild.bind((0,es.A)(f)),f}return(0,ea.A)(ColumnSizer,o),(0,er.A)(ColumnSizer,[{key:"componentDidUpdate",value:function(o){var p=this.props,f=p.columnMaxWidth,m=p.columnMinWidth,_=p.columnCount,w=p.width;(f!==o.columnMaxWidth||m!==o.columnMinWidth||_!==o.columnCount||w!==o.width)&&this._registeredChild&&this._registeredChild.recomputeGridSize()}},{key:"render",value:function(){var o=this.props,p=o.children,f=o.columnMaxWidth,m=o.columnMinWidth,_=o.columnCount,w=o.width,I=f?Math.min(f,w):w,k=w/_;return p({adjustedWidth:Math.min(w,(k=Math.floor(k=Math.min(I,k=Math.max(m||1,k))))*_),columnWidth:k,getColumnWidth:function(){return k},registerChild:this._registerChild})}},{key:"_registerChild",value:function(o){if(o&&"function"!=typeof o.recomputeGridSize)throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");this._registeredChild=o,this._registeredChild&&this._registeredChild.recomputeGridSize()}}]),ColumnSizer}(ed.PureComponent).propTypes={};var eP=f(0x250cdd33f),eR=function(o){function InfiniteLoader(o,p){var f;return(0,ei.A)(this,InfiniteLoader),(f=(0,en.A)(this,(0,eo.A)(InfiniteLoader).call(this,o,p)))._loadMoreRowsMemoizer=createCallbackMemoizer(),f._onRowsRendered=f._onRowsRendered.bind((0,es.A)(f)),f._registerChild=f._registerChild.bind((0,es.A)(f)),f}return(0,ea.A)(InfiniteLoader,o),(0,er.A)(InfiniteLoader,[{key:"resetLoadMoreRowsCache",value:function(o){this._loadMoreRowsMemoizer=createCallbackMemoizer(),o&&this._doStuff(this._lastRenderedStartIndex,this._lastRenderedStopIndex)}},{key:"render",value:function(){return(0,this.props.children)({onRowsRendered:this._onRowsRendered,registerChild:this._registerChild})}},{key:"_loadUnloadedRanges",value:function(o){var p=this,f=this.props.loadMoreRows;o.forEach(function(o){var m=f(o);m&&m.then(function(){isRangeVisible({lastRenderedStartIndex:p._lastRenderedStartIndex,lastRenderedStopIndex:p._lastRenderedStopIndex,startIndex:o.startIndex,stopIndex:o.stopIndex})&&p._registeredChild&&forceUpdateReactVirtualizedComponent(p._registeredChild,p._lastRenderedStartIndex)})})}},{key:"_onRowsRendered",value:function(o){var p=o.startIndex,f=o.stopIndex;this._lastRenderedStartIndex=p,this._lastRenderedStopIndex=f,this._doStuff(p,f)}},{key:"_doStuff",value:function(o,p){var f,m=this,_=this.props,w=_.isRowLoaded,I=_.minimumBatchSize,k=_.rowCount,M=_.threshold,x=scanForUnloadedRanges({isRowLoaded:w,minimumBatchSize:I,rowCount:k,startIndex:Math.max(0,o-M),stopIndex:Math.min(k-1,p+M)}),O=(f=[]).concat.apply(f,(0,eP.A)(x.map(function(o){return[o.startIndex,o.stopIndex]})));this._loadMoreRowsMemoizer({callback:function(){m._loadUnloadedRanges(x)},indices:{squashedUnloadedRanges:O}})}},{key:"_registerChild",value:function(o){this._registeredChild=o}}]),InfiniteLoader}(ed.PureComponent);function isRangeVisible(o){var p=o.lastRenderedStartIndex,f=o.lastRenderedStopIndex,m=o.startIndex,_=o.stopIndex;return!(m>f||_<p)}function scanForUnloadedRanges(o){for(var p=o.isRowLoaded,f=o.minimumBatchSize,m=o.rowCount,_=o.startIndex,w=o.stopIndex,I=[],k=null,M=null,x=_;x<=w;x++)p({index:x})?null!==M&&(I.push({startIndex:k,stopIndex:M}),k=M=null):(M=x,null===k&&(k=x));if(null!==M){for(var O=Math.min(Math.max(M,k+f-1),m-1),L=M+1;L<=O;L++)if(p({index:L}))break;else M=L;I.push({startIndex:k,stopIndex:M})}if(I.length)for(var B=I[0];B.stopIndex-B.startIndex+1<f&&B.startIndex>0;){var U=B.startIndex-1;if(p({index:U}))break;B.startIndex=U}return I}function forceUpdateReactVirtualizedComponent(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f="function"==typeof o.recomputeGridSize?o.recomputeGridSize:o.recomputeRowHeights;f?f.call(o,p):o.forceUpdate()}(0,el.A)(eR,"defaultProps",{minimumBatchSize:10,rowCount:0,threshold:15}),eR.propTypes={};var eO=($=U=function(o){function List(){(0,ei.A)(this,List);for(var o,p,f=arguments.length,m=Array(f),_=0;_<f;_++)m[_]=arguments[_];return p=(0,en.A)(this,(o=(0,eo.A)(List)).call.apply(o,[this].concat(m))),(0,el.A)((0,es.A)(p),"Grid",void 0),(0,el.A)((0,es.A)(p),"_cellRenderer",function(o){var f=o.parent,m=o.rowIndex,_=o.style,w=o.isScrolling,I=o.isVisible,k=o.key,M=p.props.rowRenderer,x=Object.getOwnPropertyDescriptor(_,"width");return x&&x.writable&&(_.width="100%"),M({index:m,style:_,isScrolling:w,isVisible:I,key:k,parent:f})}),(0,el.A)((0,es.A)(p),"_setRef",function(o){p.Grid=o}),(0,el.A)((0,es.A)(p),"_onScroll",function(o){var f=o.clientHeight,m=o.scrollHeight,_=o.scrollTop;(0,p.props.onScroll)({clientHeight:f,scrollHeight:m,scrollTop:_})}),(0,el.A)((0,es.A)(p),"_onSectionRendered",function(o){var f=o.rowOverscanStartIndex,m=o.rowOverscanStopIndex,_=o.rowStartIndex,w=o.rowStopIndex;(0,p.props.onRowsRendered)({overscanStartIndex:f,overscanStopIndex:m,startIndex:_,stopIndex:w})}),p}return(0,ea.A)(List,o),(0,er.A)(List,[{key:"forceUpdateGrid",value:function(){this.Grid&&this.Grid.forceUpdate()}},{key:"getOffsetForRow",value:function(o){var p=o.alignment,f=o.index;return this.Grid?this.Grid.getOffsetForCell({alignment:p,rowIndex:f,columnIndex:0}).scrollTop:0}},{key:"invalidateCellSizeAfterRender",value:function(o){var p=o.columnIndex,f=o.rowIndex;this.Grid&&this.Grid.invalidateCellSizeAfterRender({rowIndex:f,columnIndex:p})}},{key:"measureAllRows",value:function(){this.Grid&&this.Grid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=o.rowIndex;this.Grid&&this.Grid.recomputeGridSize({rowIndex:void 0===f?0:f,columnIndex:void 0===p?0:p})}},{key:"recomputeRowHeights",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:o,columnIndex:0})}},{key:"scrollToPosition",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:o})}},{key:"scrollToRow",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:o})}},{key:"render",value:function(){var o=this.props,p=o.className,f=o.noRowsRenderer,m=o.scrollToIndex,_=o.width,w=clsx_m("ReactVirtualized__List",p);return ed.createElement(eb,(0,eu.A)({},this.props,{autoContainerWidth:!0,cellRenderer:this._cellRenderer,className:w,columnWidth:_,columnCount:1,noContentRenderer:f,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,scrollToRow:m}))}}]),List}(ed.PureComponent),(0,el.A)(U,"propTypes",null),$);(0,el.A)(eO,"defaultProps",{autoHeight:!1,estimatedRowSize:30,onScroll:function(){},noRowsRenderer:function(){return null},onRowsRendered:function(){},overscanIndicesGetter:accessibilityOverscanIndicesGetter_defaultOverscanIndicesGetter,overscanRowCount:10,scrollToAlignment:"auto",scrollToIndex:-1,style:{}});var eD=f(0x20d9752e1);function _GEA(o,p,f,m){for(var _=f+1;p<=f;){var w=p+f>>>1;o[w]>=m?(_=w,f=w-1):p=w+1}return _}function _GEP(o,p,f,m,_){for(var w=f+1;p<=f;){var I=p+f>>>1;_(o[I],m)>=0?(w=I,f=I-1):p=I+1}return w}let eL=function(o,p,f,m,_){return"function"==typeof f?_GEP(o,void 0===m?0:0|m,void 0===_?o.length-1:0|_,p,f):_GEA(o,void 0===f?0:0|f,void 0===m?o.length-1:0|m,p)};function IntervalTreeNode(o,p,f,m,_){this.mid=o,this.left=p,this.right=f,this.leftPoints=m,this.rightPoints=_,this.count=(p?p.count:0)+(f?f.count:0)+m.length}var eN=IntervalTreeNode.prototype;function copy(o,p){o.mid=p.mid,o.left=p.left,o.right=p.right,o.leftPoints=p.leftPoints,o.rightPoints=p.rightPoints,o.count=p.count}function rebuild(o,p){var f=createIntervalTree(p);o.mid=f.mid,o.left=f.left,o.right=f.right,o.leftPoints=f.leftPoints,o.rightPoints=f.rightPoints,o.count=f.count}function rebuildWithInterval(o,p){var f=o.intervals([]);f.push(p),rebuild(o,f)}function rebuildWithoutInterval(o,p){var f=o.intervals([]),m=f.indexOf(p);return m<0?0:(f.splice(m,1),rebuild(o,f),1)}function reportLeftRange(o,p,f){for(var m=0;m<o.length&&o[m][0]<=p;++m){var _=f(o[m]);if(_)return _}}function reportRightRange(o,p,f){for(var m=o.length-1;m>=0&&o[m][1]>=p;--m){var _=f(o[m]);if(_)return _}}function reportRange(o,p){for(var f=0;f<o.length;++f){var m=p(o[f]);if(m)return m}}function compareNumbers(o,p){return o-p}function compareBegin(o,p){var f=o[0]-p[0];return f||o[1]-p[1]}function compareEnd(o,p){var f=o[1]-p[1];return f||o[0]-p[0]}function createIntervalTree(o){if(0===o.length)return null;for(var p=[],f=0;f<o.length;++f)p.push(o[f][0],o[f][1]);p.sort(compareNumbers);for(var m=p[p.length>>1],_=[],w=[],I=[],f=0;f<o.length;++f){var k=o[f];k[1]<m?_.push(k):m<k[0]?w.push(k):I.push(k)}var M=I.slice();return I.sort(compareBegin),M.sort(compareEnd),new IntervalTreeNode(m,createIntervalTree(_),createIntervalTree(w),I,M)}function IntervalTree(o){this.root=o}eN.intervals=function(o){return o.push.apply(o,this.leftPoints),this.left&&this.left.intervals(o),this.right&&this.right.intervals(o),o},eN.insert=function(o){var p=this.count-this.leftPoints.length;if(this.count+=1,o[1]<this.mid)this.left?4*(this.left.count+1)>3*(p+1)?rebuildWithInterval(this,o):this.left.insert(o):this.left=createIntervalTree([o]);else if(o[0]>this.mid)this.right?4*(this.right.count+1)>3*(p+1)?rebuildWithInterval(this,o):this.right.insert(o):this.right=createIntervalTree([o]);else{var f=eL(this.leftPoints,o,compareBegin),m=eL(this.rightPoints,o,compareEnd);this.leftPoints.splice(f,0,o),this.rightPoints.splice(m,0,o)}},eN.remove=function(o){var p=this.count-this.leftPoints;if(o[1]<this.mid){if(!this.left)return 0;if(4*(this.right?this.right.count:0)>3*(p-1))return rebuildWithoutInterval(this,o);var f=this.left.remove(o);return 2===f?(this.left=null,this.count-=1,1):(1===f&&(this.count-=1),f)}if(o[0]>this.mid){if(!this.right)return 0;if(4*(this.left?this.left.count:0)>3*(p-1))return rebuildWithoutInterval(this,o);var f=this.right.remove(o);return 2===f?(this.right=null,this.count-=1,1):(1===f&&(this.count-=1),f)}if(1===this.count)if(this.leftPoints[0]===o)return 2;else return 0;if(1===this.leftPoints.length&&this.leftPoints[0]===o){if(this.left&&this.right){for(var m=this,_=this.left;_.right;)m=_,_=_.right;if(m===this)_.right=this.right;else{var w=this.left,f=this.right;m.count-=_.count,m.right=_.left,_.left=w,_.right=f}copy(this,_),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?copy(this,this.left):copy(this,this.right);return 1}for(var w=eL(this.leftPoints,o,compareBegin);w<this.leftPoints.length&&this.leftPoints[w][0]===o[0];++w)if(this.leftPoints[w]===o){this.count-=1,this.leftPoints.splice(w,1);for(var f=eL(this.rightPoints,o,compareEnd);f<this.rightPoints.length;++f)if(this.rightPoints[f][1]!==o[1])break;else if(this.rightPoints[f]===o)return this.rightPoints.splice(f,1),1}return 0},eN.queryPoint=function(o,p){if(o<this.mid){if(this.left){var f=this.left.queryPoint(o,p);if(f)return f}return reportLeftRange(this.leftPoints,o,p)}if(!(o>this.mid))return reportRange(this.leftPoints,p);if(this.right){var f=this.right.queryPoint(o,p);if(f)return f}return reportRightRange(this.rightPoints,o,p)},eN.queryInterval=function(o,p,f){if(o<this.mid&&this.left){var m=this.left.queryInterval(o,p,f);if(m)return m}if(p>this.mid&&this.right){var m=this.right.queryInterval(o,p,f);if(m)return m}return p<this.mid?reportLeftRange(this.leftPoints,p,f):o>this.mid?reportRightRange(this.rightPoints,o,f):reportRange(this.leftPoints,f)};var eF=IntervalTree.prototype;function createWrapper(o){return new IntervalTree(o&&0!==o.length?createIntervalTree(o):null)}eF.insert=function(o){this.root?this.root.insert(o):this.root=new IntervalTreeNode(o[0],null,null,[o],[o])},eF.remove=function(o){if(this.root){var p=this.root.remove(o);return 2===p&&(this.root=null),0!==p}return!1},eF.queryPoint=function(o,p){if(this.root)return this.root.queryPoint(o,p)},eF.queryInterval=function(o,p,f){if(o<=p&&this.root)return this.root.queryInterval(o,p,f)},Object.defineProperty(eF,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(eF,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});var eV=function(){function PositionCache(){(0,ei.A)(this,PositionCache),(0,el.A)(this,"_columnSizeMap",{}),(0,el.A)(this,"_intervalTree",createWrapper()),(0,el.A)(this,"_leftMap",{})}return(0,er.A)(PositionCache,[{key:"estimateTotalHeight",value:function(o,p,f){var m=o-this.count;return this.tallestColumnSize+Math.ceil(m/p)*f}},{key:"range",value:function(o,p,f){var m=this;this._intervalTree.queryInterval(o,o+p,function(o){var p=(0,eD.A)(o,3),_=p[0],w=(p[1],p[2]);return f(w,m._leftMap[w],_)})}},{key:"setPosition",value:function(o,p,f,m){this._intervalTree.insert([f,f+m,o]),this._leftMap[o]=p;var _=this._columnSizeMap,w=_[p];void 0===w?_[p]=f+m:_[p]=Math.max(w,f+m)}},{key:"count",get:function(){return this._intervalTree.count}},{key:"shortestColumnSize",get:function(){var o=this._columnSizeMap,p=0;for(var f in o){var m=o[f];p=0===p?m:Math.min(p,m)}return p}},{key:"tallestColumnSize",get:function(){var o=this._columnSizeMap,p=0;for(var f in o)p=Math.max(p,o[f]);return p}}]),PositionCache}();function Masonry_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function Masonry_objectSpread(o){for(var p=1;p<arguments.length;p++){var f=null!=arguments[p]?arguments[p]:{};p%2?Masonry_ownKeys(f,!0).forEach(function(p){(0,el.A)(o,p,f[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(f)):Masonry_ownKeys(f).forEach(function(p){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(f,p))})}return o}var eB=(Z=q=function(o){function Masonry(){(0,ei.A)(this,Masonry);for(var o,p,f=arguments.length,m=Array(f),_=0;_<f;_++)m[_]=arguments[_];return p=(0,en.A)(this,(o=(0,eo.A)(Masonry)).call.apply(o,[this].concat(m))),(0,el.A)((0,es.A)(p),"state",{isScrolling:!1,scrollTop:0}),(0,el.A)((0,es.A)(p),"_debounceResetIsScrollingId",void 0),(0,el.A)((0,es.A)(p),"_invalidateOnUpdateStartIndex",null),(0,el.A)((0,es.A)(p),"_invalidateOnUpdateStopIndex",null),(0,el.A)((0,es.A)(p),"_positionCache",new eV),(0,el.A)((0,es.A)(p),"_startIndex",null),(0,el.A)((0,es.A)(p),"_startIndexMemoized",null),(0,el.A)((0,es.A)(p),"_stopIndex",null),(0,el.A)((0,es.A)(p),"_stopIndexMemoized",null),(0,el.A)((0,es.A)(p),"_debounceResetIsScrollingCallback",function(){p.setState({isScrolling:!1})}),(0,el.A)((0,es.A)(p),"_setScrollingContainerRef",function(o){p._scrollingContainer=o}),(0,el.A)((0,es.A)(p),"_onScroll",function(o){var f=p.props.height,m=o.currentTarget.scrollTop,_=Math.min(Math.max(0,p._getEstimatedTotalHeight()-f),m);m===_&&(p._debounceResetIsScrolling(),p.state.scrollTop!==_&&p.setState({isScrolling:!0,scrollTop:_}))}),p}return(0,ea.A)(Masonry,o),(0,er.A)(Masonry,[{key:"clearCellPositions",value:function(){this._positionCache=new eV,this.forceUpdate()}},{key:"invalidateCellSizeAfterRender",value:function(o){var p=o.rowIndex;null===this._invalidateOnUpdateStartIndex?(this._invalidateOnUpdateStartIndex=p,this._invalidateOnUpdateStopIndex=p):(this._invalidateOnUpdateStartIndex=Math.min(this._invalidateOnUpdateStartIndex,p),this._invalidateOnUpdateStopIndex=Math.max(this._invalidateOnUpdateStopIndex,p))}},{key:"recomputeCellPositions",value:function(){var o=this._positionCache.count-1;this._positionCache=new eV,this._populatePositionCache(0,o),this.forceUpdate()}},{key:"componentDidMount",value:function(){this._checkInvalidateOnUpdate(),this._invokeOnScrollCallback(),this._invokeOnCellsRenderedCallback()}},{key:"componentDidUpdate",value:function(o,p){this._checkInvalidateOnUpdate(),this._invokeOnScrollCallback(),this._invokeOnCellsRenderedCallback(),this.props.scrollTop!==o.scrollTop&&this._debounceResetIsScrolling()}},{key:"componentWillUnmount",value:function(){this._debounceResetIsScrollingId&&cancelAnimationTimeout(this._debounceResetIsScrollingId)}},{key:"render",value:function(){var o,p=this,f=this.props,m=f.autoHeight,_=f.cellCount,w=f.cellMeasurerCache,I=f.cellRenderer,k=f.className,M=f.height,x=f.id,O=f.keyMapper,L=f.overscanByPixels,B=f.role,U=f.style,$=f.tabIndex,q=f.width,Z=f.rowDirection,ee=this.state,et=ee.isScrolling,ei=ee.scrollTop,er=[],en=this._getEstimatedTotalHeight(),eo=this._positionCache.shortestColumnSize,es=this._positionCache.count,ea=0;if(this._positionCache.range(Math.max(0,ei-L),M+2*L,function(f,m,_){var k;void 0===o?(ea=f,o=f):(ea=Math.min(ea,f),o=Math.max(o,f)),er.push(I({index:f,isScrolling:et,key:O(f),parent:p,style:(k={height:w.getHeight(f)},(0,el.A)(k,"ltr"===Z?"left":"right",m),(0,el.A)(k,"position","absolute"),(0,el.A)(k,"top",_),(0,el.A)(k,"width",w.getWidth(f)),k)}))}),eo<ei+M+L&&es<_)for(var ec=Math.min(_-es,Math.ceil((ei+M+L-eo)/w.defaultHeight*q/w.defaultWidth)),eu=es;eu<es+ec;eu++)o=eu,er.push(I({index:eu,isScrolling:et,key:O(eu),parent:this,style:{width:w.getWidth(eu)}}));return this._startIndex=ea,this._stopIndex=o,ed.createElement("div",{ref:this._setScrollingContainerRef,"aria-label":this.props["aria-label"],className:clsx_m("ReactVirtualized__Masonry",k),id:x,onScroll:this._onScroll,role:B,style:Masonry_objectSpread({boxSizing:"border-box",direction:"ltr",height:m?"auto":M,overflowX:"hidden",overflowY:en<M?"hidden":"auto",position:"relative",width:q,WebkitOverflowScrolling:"touch",willChange:"transform"},U),tabIndex:$},ed.createElement("div",{className:"ReactVirtualized__Masonry__innerScrollContainer",style:{width:"100%",height:en,maxWidth:"100%",maxHeight:en,overflow:"hidden",pointerEvents:et?"none":"",position:"relative"}},er))}},{key:"_checkInvalidateOnUpdate",value:function(){if("number"==typeof this._invalidateOnUpdateStartIndex){var o=this._invalidateOnUpdateStartIndex,p=this._invalidateOnUpdateStopIndex;this._invalidateOnUpdateStartIndex=null,this._invalidateOnUpdateStopIndex=null,this._populatePositionCache(o,p),this.forceUpdate()}}},{key:"_debounceResetIsScrolling",value:function(){var o=this.props.scrollingResetTimeInterval;this._debounceResetIsScrollingId&&cancelAnimationTimeout(this._debounceResetIsScrollingId),this._debounceResetIsScrollingId=requestAnimationTimeout(this._debounceResetIsScrollingCallback,o)}},{key:"_getEstimatedTotalHeight",value:function(){var o=this.props,p=o.cellCount,f=o.cellMeasurerCache,m=Math.max(1,Math.floor(o.width/f.defaultWidth));return this._positionCache.estimateTotalHeight(p,m,f.defaultHeight)}},{key:"_invokeOnScrollCallback",value:function(){var o=this.props,p=o.height,f=o.onScroll,m=this.state.scrollTop;this._onScrollMemoized!==m&&(f({clientHeight:p,scrollHeight:this._getEstimatedTotalHeight(),scrollTop:m}),this._onScrollMemoized=m)}},{key:"_invokeOnCellsRenderedCallback",value:function(){(this._startIndexMemoized!==this._startIndex||this._stopIndexMemoized!==this._stopIndex)&&((0,this.props.onCellsRendered)({startIndex:this._startIndex,stopIndex:this._stopIndex}),this._startIndexMemoized=this._startIndex,this._stopIndexMemoized=this._stopIndex)}},{key:"_populatePositionCache",value:function(o,p){for(var f=this.props,m=f.cellMeasurerCache,_=f.cellPositioner,w=o;w<=p;w++){var I=_(w),k=I.left,M=I.top;this._positionCache.setPosition(w,k,M,m.getHeight(w))}}}],[{key:"getDerivedStateFromProps",value:function(o,p){return void 0!==o.scrollTop&&p.scrollTop!==o.scrollTop?{isScrolling:!0,scrollTop:o.scrollTop}:null}}]),Masonry}(ed.PureComponent),(0,el.A)(q,"propTypes",null),Z);function identity(o){return o}function noop(){}(0,el.A)(eB,"defaultProps",{autoHeight:!1,keyMapper:identity,onCellsRendered:noop,onScroll:noop,overscanByPixels:20,role:"grid",scrollingResetTimeInterval:150,style:{},tabIndex:0,rowDirection:"ltr"}),(0,ec.polyfill)(eB);var eU=function(){function CellMeasurerCacheDecorator(){var o=this,p=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,ei.A)(this,CellMeasurerCacheDecorator),(0,el.A)(this,"_cellMeasurerCache",void 0),(0,el.A)(this,"_columnIndexOffset",void 0),(0,el.A)(this,"_rowIndexOffset",void 0),(0,el.A)(this,"columnWidth",function(p){var f=p.index;o._cellMeasurerCache.columnWidth({index:f+o._columnIndexOffset})}),(0,el.A)(this,"rowHeight",function(p){var f=p.index;o._cellMeasurerCache.rowHeight({index:f+o._rowIndexOffset})});var f=p.cellMeasurerCache,m=p.columnIndexOffset,_=p.rowIndexOffset;this._cellMeasurerCache=f,this._columnIndexOffset=void 0===m?0:m,this._rowIndexOffset=void 0===_?0:_}return(0,er.A)(CellMeasurerCacheDecorator,[{key:"clear",value:function(o,p){this._cellMeasurerCache.clear(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"clearAll",value:function(){this._cellMeasurerCache.clearAll()}},{key:"hasFixedHeight",value:function(){return this._cellMeasurerCache.hasFixedHeight()}},{key:"hasFixedWidth",value:function(){return this._cellMeasurerCache.hasFixedWidth()}},{key:"getHeight",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.getHeight(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"getWidth",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.getWidth(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"has",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.has(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"set",value:function(o,p,f,m){this._cellMeasurerCache.set(o+this._rowIndexOffset,p+this._columnIndexOffset,f,m)}},{key:"defaultHeight",get:function(){return this._cellMeasurerCache.defaultHeight}},{key:"defaultWidth",get:function(){return this._cellMeasurerCache.defaultWidth}}]),CellMeasurerCacheDecorator}();function MultiGrid_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function MultiGrid_objectSpread(o){for(var p=1;p<arguments.length;p++){var f=null!=arguments[p]?arguments[p]:{};p%2?MultiGrid_ownKeys(f,!0).forEach(function(p){(0,el.A)(o,p,f[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(f)):MultiGrid_ownKeys(f).forEach(function(p){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(f,p))})}return o}var ej=function(o){function MultiGrid(o,p){(0,ei.A)(this,MultiGrid),f=(0,en.A)(this,(0,eo.A)(MultiGrid).call(this,o,p)),(0,el.A)((0,es.A)(f),"state",{scrollLeft:0,scrollTop:0,scrollbarSize:0,showHorizontalScrollbar:!1,showVerticalScrollbar:!1}),(0,el.A)((0,es.A)(f),"_deferredInvalidateColumnIndex",null),(0,el.A)((0,es.A)(f),"_deferredInvalidateRowIndex",null),(0,el.A)((0,es.A)(f),"_bottomLeftGridRef",function(o){f._bottomLeftGrid=o}),(0,el.A)((0,es.A)(f),"_bottomRightGridRef",function(o){f._bottomRightGrid=o}),(0,el.A)((0,es.A)(f),"_cellRendererBottomLeftGrid",function(o){var p=o.rowIndex,m=_objectWithoutProperties(o,["rowIndex"]),_=f.props,w=_.cellRenderer,I=_.fixedRowCount;return p===_.rowCount-I?ed.createElement("div",{key:m.key,style:MultiGrid_objectSpread({},m.style,{height:20})}):w(MultiGrid_objectSpread({},m,{parent:(0,es.A)(f),rowIndex:p+I}))}),(0,el.A)((0,es.A)(f),"_cellRendererBottomRightGrid",function(o){var p=o.columnIndex,m=o.rowIndex,_=_objectWithoutProperties(o,["columnIndex","rowIndex"]),w=f.props,I=w.cellRenderer,k=w.fixedColumnCount,M=w.fixedRowCount;return I(MultiGrid_objectSpread({},_,{columnIndex:p+k,parent:(0,es.A)(f),rowIndex:m+M}))}),(0,el.A)((0,es.A)(f),"_cellRendererTopRightGrid",function(o){var p=o.columnIndex,m=_objectWithoutProperties(o,["columnIndex"]),_=f.props,w=_.cellRenderer,I=_.columnCount,k=_.fixedColumnCount;return p===I-k?ed.createElement("div",{key:m.key,style:MultiGrid_objectSpread({},m.style,{width:20})}):w(MultiGrid_objectSpread({},m,{columnIndex:p+k,parent:(0,es.A)(f)}))}),(0,el.A)((0,es.A)(f),"_columnWidthRightGrid",function(o){var p=o.index,m=f.props,_=m.columnCount,w=m.fixedColumnCount,I=m.columnWidth,k=f.state,M=k.scrollbarSize;return k.showHorizontalScrollbar&&p===_-w?M:"function"==typeof I?I({index:p+w}):I}),(0,el.A)((0,es.A)(f),"_onScroll",function(o){var p=o.scrollLeft,m=o.scrollTop;f.setState({scrollLeft:p,scrollTop:m});var _=f.props.onScroll;_&&_(o)}),(0,el.A)((0,es.A)(f),"_onScrollbarPresenceChange",function(o){var p=o.horizontal,m=o.size,_=o.vertical,w=f.state,I=w.showHorizontalScrollbar,k=w.showVerticalScrollbar;if(p!==I||_!==k){f.setState({scrollbarSize:m,showHorizontalScrollbar:p,showVerticalScrollbar:_});var M=f.props.onScrollbarPresenceChange;"function"==typeof M&&M({horizontal:p,size:m,vertical:_})}}),(0,el.A)((0,es.A)(f),"_onScrollLeft",function(o){var p=o.scrollLeft;f._onScroll({scrollLeft:p,scrollTop:f.state.scrollTop})}),(0,el.A)((0,es.A)(f),"_onScrollTop",function(o){var p=o.scrollTop;f._onScroll({scrollTop:p,scrollLeft:f.state.scrollLeft})}),(0,el.A)((0,es.A)(f),"_rowHeightBottomGrid",function(o){var p=o.index,m=f.props,_=m.fixedRowCount,w=m.rowCount,I=m.rowHeight,k=f.state,M=k.scrollbarSize;return k.showVerticalScrollbar&&p===w-_?M:"function"==typeof I?I({index:p+_}):I}),(0,el.A)((0,es.A)(f),"_topLeftGridRef",function(o){f._topLeftGrid=o}),(0,el.A)((0,es.A)(f),"_topRightGridRef",function(o){f._topRightGrid=o});var f,m=o.deferredMeasurementCache,_=o.fixedColumnCount,w=o.fixedRowCount;return f._maybeCalculateCachedStyles(!0),m&&(f._deferredMeasurementCacheBottomLeftGrid=w>0?new eU({cellMeasurerCache:m,columnIndexOffset:0,rowIndexOffset:w}):m,f._deferredMeasurementCacheBottomRightGrid=_>0||w>0?new eU({cellMeasurerCache:m,columnIndexOffset:_,rowIndexOffset:w}):m,f._deferredMeasurementCacheTopRightGrid=_>0?new eU({cellMeasurerCache:m,columnIndexOffset:_,rowIndexOffset:0}):m),f}return(0,ea.A)(MultiGrid,o),(0,er.A)(MultiGrid,[{key:"forceUpdateGrids",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.forceUpdate(),this._bottomRightGrid&&this._bottomRightGrid.forceUpdate(),this._topLeftGrid&&this._topLeftGrid.forceUpdate(),this._topRightGrid&&this._topRightGrid.forceUpdate()}},{key:"invalidateCellSizeAfterRender",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=void 0===p?0:p,m=o.rowIndex,_=void 0===m?0:m;this._deferredInvalidateColumnIndex="number"==typeof this._deferredInvalidateColumnIndex?Math.min(this._deferredInvalidateColumnIndex,f):f,this._deferredInvalidateRowIndex="number"==typeof this._deferredInvalidateRowIndex?Math.min(this._deferredInvalidateRowIndex,_):_}},{key:"measureAllCells",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.measureAllCells(),this._bottomRightGrid&&this._bottomRightGrid.measureAllCells(),this._topLeftGrid&&this._topLeftGrid.measureAllCells(),this._topRightGrid&&this._topRightGrid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=void 0===p?0:p,m=o.rowIndex,_=void 0===m?0:m,w=this.props,I=w.fixedColumnCount,k=w.fixedRowCount,M=Math.max(0,f-I),x=Math.max(0,_-k);this._bottomLeftGrid&&this._bottomLeftGrid.recomputeGridSize({columnIndex:f,rowIndex:x}),this._bottomRightGrid&&this._bottomRightGrid.recomputeGridSize({columnIndex:M,rowIndex:x}),this._topLeftGrid&&this._topLeftGrid.recomputeGridSize({columnIndex:f,rowIndex:_}),this._topRightGrid&&this._topRightGrid.recomputeGridSize({columnIndex:M,rowIndex:_}),this._leftGridWidth=null,this._topGridHeight=null,this._maybeCalculateCachedStyles(!0)}},{key:"componentDidMount",value:function(){var o=this.props,p=o.scrollLeft,f=o.scrollTop;if(p>0||f>0){var m={};p>0&&(m.scrollLeft=p),f>0&&(m.scrollTop=f),this.setState(m)}this._handleInvalidatedGridSize()}},{key:"componentDidUpdate",value:function(){this._handleInvalidatedGridSize()}},{key:"render",value:function(){var o=this.props,p=o.onScroll,f=o.onSectionRendered,m=(o.onScrollbarPresenceChange,o.scrollLeft,o.scrollToColumn),_=(o.scrollTop,o.scrollToRow),w=_objectWithoutProperties(o,["onScroll","onSectionRendered","onScrollbarPresenceChange","scrollLeft","scrollToColumn","scrollTop","scrollToRow"]);if(this._prepareForRender(),0===this.props.width||0===this.props.height)return null;var I=this.state,k=I.scrollLeft,M=I.scrollTop;return ed.createElement("div",{style:this._containerOuterStyle},ed.createElement("div",{style:this._containerTopStyle},this._renderTopLeftGrid(w),this._renderTopRightGrid(MultiGrid_objectSpread({},w,{onScroll:p,scrollLeft:k}))),ed.createElement("div",{style:this._containerBottomStyle},this._renderBottomLeftGrid(MultiGrid_objectSpread({},w,{onScroll:p,scrollTop:M})),this._renderBottomRightGrid(MultiGrid_objectSpread({},w,{onScroll:p,onSectionRendered:f,scrollLeft:k,scrollToColumn:m,scrollToRow:_,scrollTop:M}))))}},{key:"_getBottomGridHeight",value:function(o){return o.height-this._getTopGridHeight(o)}},{key:"_getLeftGridWidth",value:function(o){var p=o.fixedColumnCount,f=o.columnWidth;if(null==this._leftGridWidth)if("function"==typeof f){for(var m=0,_=0;_<p;_++)m+=f({index:_});this._leftGridWidth=m}else this._leftGridWidth=f*p;return this._leftGridWidth}},{key:"_getRightGridWidth",value:function(o){return o.width-this._getLeftGridWidth(o)}},{key:"_getTopGridHeight",value:function(o){var p=o.fixedRowCount,f=o.rowHeight;if(null==this._topGridHeight)if("function"==typeof f){for(var m=0,_=0;_<p;_++)m+=f({index:_});this._topGridHeight=m}else this._topGridHeight=f*p;return this._topGridHeight}},{key:"_handleInvalidatedGridSize",value:function(){if("number"==typeof this._deferredInvalidateColumnIndex){var o=this._deferredInvalidateColumnIndex,p=this._deferredInvalidateRowIndex;this._deferredInvalidateColumnIndex=null,this._deferredInvalidateRowIndex=null,this.recomputeGridSize({columnIndex:o,rowIndex:p}),this.forceUpdate()}}},{key:"_maybeCalculateCachedStyles",value:function(o){var p=this.props,f=p.columnWidth,m=p.enableFixedColumnScroll,_=p.enableFixedRowScroll,w=p.height,I=p.fixedColumnCount,k=p.fixedRowCount,M=p.rowHeight,x=p.style,O=p.styleBottomLeftGrid,L=p.styleBottomRightGrid,B=p.styleTopLeftGrid,U=p.styleTopRightGrid,$=p.width,q=o||w!==this._lastRenderedHeight||$!==this._lastRenderedWidth,Z=o||f!==this._lastRenderedColumnWidth||I!==this._lastRenderedFixedColumnCount,ee=o||k!==this._lastRenderedFixedRowCount||M!==this._lastRenderedRowHeight;(o||q||x!==this._lastRenderedStyle)&&(this._containerOuterStyle=MultiGrid_objectSpread({height:w,overflow:"visible",width:$},x)),(o||q||ee)&&(this._containerTopStyle={height:this._getTopGridHeight(this.props),position:"relative",width:$},this._containerBottomStyle={height:w-this._getTopGridHeight(this.props),overflow:"visible",position:"relative",width:$}),(o||O!==this._lastRenderedStyleBottomLeftGrid)&&(this._bottomLeftGridStyle=MultiGrid_objectSpread({left:0,overflowX:"hidden",overflowY:m?"auto":"hidden",position:"absolute"},O)),(o||Z||L!==this._lastRenderedStyleBottomRightGrid)&&(this._bottomRightGridStyle=MultiGrid_objectSpread({left:this._getLeftGridWidth(this.props),position:"absolute"},L)),(o||B!==this._lastRenderedStyleTopLeftGrid)&&(this._topLeftGridStyle=MultiGrid_objectSpread({left:0,overflowX:"hidden",overflowY:"hidden",position:"absolute",top:0},B)),(o||Z||U!==this._lastRenderedStyleTopRightGrid)&&(this._topRightGridStyle=MultiGrid_objectSpread({left:this._getLeftGridWidth(this.props),overflowX:_?"auto":"hidden",overflowY:"hidden",position:"absolute",top:0},U)),this._lastRenderedColumnWidth=f,this._lastRenderedFixedColumnCount=I,this._lastRenderedFixedRowCount=k,this._lastRenderedHeight=w,this._lastRenderedRowHeight=M,this._lastRenderedStyle=x,this._lastRenderedStyleBottomLeftGrid=O,this._lastRenderedStyleBottomRightGrid=L,this._lastRenderedStyleTopLeftGrid=B,this._lastRenderedStyleTopRightGrid=U,this._lastRenderedWidth=$}},{key:"_prepareForRender",value:function(){(this._lastRenderedColumnWidth!==this.props.columnWidth||this._lastRenderedFixedColumnCount!==this.props.fixedColumnCount)&&(this._leftGridWidth=null),(this._lastRenderedFixedRowCount!==this.props.fixedRowCount||this._lastRenderedRowHeight!==this.props.rowHeight)&&(this._topGridHeight=null),this._maybeCalculateCachedStyles(),this._lastRenderedColumnWidth=this.props.columnWidth,this._lastRenderedFixedColumnCount=this.props.fixedColumnCount,this._lastRenderedFixedRowCount=this.props.fixedRowCount,this._lastRenderedRowHeight=this.props.rowHeight}},{key:"_renderBottomLeftGrid",value:function(o){var p=o.enableFixedColumnScroll,f=o.fixedColumnCount,m=o.fixedRowCount,_=o.rowCount,w=o.hideBottomLeftGridScrollbar,I=this.state.showVerticalScrollbar;if(!f)return null;var k=this._getBottomGridHeight(o),M=this._getLeftGridWidth(o),x=this.state.showVerticalScrollbar?this.state.scrollbarSize:0,O=ed.createElement(eb,(0,eu.A)({},o,{cellRenderer:this._cellRendererBottomLeftGrid,className:this.props.classNameBottomLeftGrid,columnCount:f,deferredMeasurementCache:this._deferredMeasurementCacheBottomLeftGrid,height:k,onScroll:p?this._onScrollTop:void 0,ref:this._bottomLeftGridRef,rowCount:Math.max(0,_-m)+ +!!I,rowHeight:this._rowHeightBottomGrid,style:this._bottomLeftGridStyle,tabIndex:null,width:w?M+x:M}));return w?ed.createElement("div",{className:"BottomLeftGrid_ScrollWrapper",style:MultiGrid_objectSpread({},this._bottomLeftGridStyle,{height:k,width:M,overflowY:"hidden"})},O):O}},{key:"_renderBottomRightGrid",value:function(o){var p=o.columnCount,f=o.fixedColumnCount,m=o.fixedRowCount,_=o.rowCount,w=o.scrollToColumn,I=o.scrollToRow;return ed.createElement(eb,(0,eu.A)({},o,{cellRenderer:this._cellRendererBottomRightGrid,className:this.props.classNameBottomRightGrid,columnCount:Math.max(0,p-f),columnWidth:this._columnWidthRightGrid,deferredMeasurementCache:this._deferredMeasurementCacheBottomRightGrid,height:this._getBottomGridHeight(o),onScroll:this._onScroll,onScrollbarPresenceChange:this._onScrollbarPresenceChange,ref:this._bottomRightGridRef,rowCount:Math.max(0,_-m),rowHeight:this._rowHeightBottomGrid,scrollToColumn:w-f,scrollToRow:I-m,style:this._bottomRightGridStyle,width:this._getRightGridWidth(o)}))}},{key:"_renderTopLeftGrid",value:function(o){var p=o.fixedColumnCount,f=o.fixedRowCount;return p&&f?ed.createElement(eb,(0,eu.A)({},o,{className:this.props.classNameTopLeftGrid,columnCount:p,height:this._getTopGridHeight(o),ref:this._topLeftGridRef,rowCount:f,style:this._topLeftGridStyle,tabIndex:null,width:this._getLeftGridWidth(o)})):null}},{key:"_renderTopRightGrid",value:function(o){var p=o.columnCount,f=o.enableFixedRowScroll,m=o.fixedColumnCount,_=o.fixedRowCount,w=o.scrollLeft,I=o.hideTopRightGridScrollbar,k=this.state,M=k.showHorizontalScrollbar,x=k.scrollbarSize;if(!_)return null;var O=this._getTopGridHeight(o),L=this._getRightGridWidth(o),B=O,U=this._topRightGridStyle;I&&(B=O+(M?x:0),U=MultiGrid_objectSpread({},this._topRightGridStyle,{left:0}));var $=ed.createElement(eb,(0,eu.A)({},o,{cellRenderer:this._cellRendererTopRightGrid,className:this.props.classNameTopRightGrid,columnCount:Math.max(0,p-m)+ +!!M,columnWidth:this._columnWidthRightGrid,deferredMeasurementCache:this._deferredMeasurementCacheTopRightGrid,height:B,onScroll:f?this._onScrollLeft:void 0,ref:this._topRightGridRef,rowCount:_,scrollLeft:w,style:U,tabIndex:null,width:L}));return I?ed.createElement("div",{className:"TopRightGrid_ScrollWrapper",style:MultiGrid_objectSpread({},this._topRightGridStyle,{height:O,width:L,overflowX:"hidden"})},$):$}}],[{key:"getDerivedStateFromProps",value:function(o,p){return o.scrollLeft!==p.scrollLeft||o.scrollTop!==p.scrollTop?{scrollLeft:null!=o.scrollLeft&&o.scrollLeft>=0?o.scrollLeft:p.scrollLeft,scrollTop:null!=o.scrollTop&&o.scrollTop>=0?o.scrollTop:p.scrollTop}:null}}]),MultiGrid}(ed.PureComponent);(0,el.A)(ej,"defaultProps",{classNameBottomLeftGrid:"",classNameBottomRightGrid:"",classNameTopLeftGrid:"",classNameTopRightGrid:"",enableFixedColumnScroll:!1,enableFixedRowScroll:!1,fixedColumnCount:0,fixedRowCount:0,scrollToColumn:-1,scrollToRow:-1,style:{},styleBottomLeftGrid:{},styleBottomRightGrid:{},styleTopLeftGrid:{},styleTopRightGrid:{},hideTopRightGridScrollbar:!1,hideBottomLeftGridScrollbar:!1}),ej.propTypes={},(0,ec.polyfill)(ej);let eH=ej;function defaultCellDataGetter(o){var p=o.dataKey,f=o.rowData;return"function"==typeof f.get?f.get(p):f[p]}function defaultCellRenderer(o){var p=o.cellData;return null==p?"":String(p)}function defaultHeaderRowRenderer(o){var p=o.className,f=o.columns,m=o.style;return ed.createElement("div",{className:p,role:"row",style:m},f)}(function(o){function ScrollSync(o,p){var f;return(0,ei.A)(this,ScrollSync),(f=(0,en.A)(this,(0,eo.A)(ScrollSync).call(this,o,p))).state={clientHeight:0,clientWidth:0,scrollHeight:0,scrollLeft:0,scrollTop:0,scrollWidth:0},f._onScroll=f._onScroll.bind((0,es.A)(f)),f}return(0,ea.A)(ScrollSync,o),(0,er.A)(ScrollSync,[{key:"render",value:function(){var o=this.props.children,p=this.state,f=p.clientHeight,m=p.clientWidth,_=p.scrollHeight,w=p.scrollLeft,I=p.scrollTop,k=p.scrollWidth;return o({clientHeight:f,clientWidth:m,onScroll:this._onScroll,scrollHeight:_,scrollLeft:w,scrollTop:I,scrollWidth:k})}},{key:"_onScroll",value:function(o){var p=o.clientHeight,f=o.clientWidth,m=o.scrollHeight,_=o.scrollLeft,w=o.scrollTop,I=o.scrollWidth;this.setState({clientHeight:p,clientWidth:f,scrollHeight:m,scrollLeft:_,scrollTop:w,scrollWidth:I})}}]),ScrollSync})(ed.PureComponent).propTypes={},defaultHeaderRowRenderer.propTypes=null;let ez="DESC";function SortIndicator(o){var p=o.sortDirection,f=clsx_m("ReactVirtualized__Table__sortableHeaderIcon",{"ReactVirtualized__Table__sortableHeaderIcon--ASC":"ASC"===p,"ReactVirtualized__Table__sortableHeaderIcon--DESC":p===ez});return ed.createElement("svg",{className:f,width:18,height:18,viewBox:"0 0 24 24"},"ASC"===p?ed.createElement("path",{d:"M7 14l5-5 5 5z"}):ed.createElement("path",{d:"M7 10l5 5 5-5z"}),ed.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}function defaultHeaderRenderer(o){var p=o.dataKey,f=o.label,m=o.sortBy,_=o.sortDirection,w=[ed.createElement("span",{className:"ReactVirtualized__Table__headerTruncatedText",key:"label",title:"string"==typeof f?f:null},f)];return m===p&&w.push(ed.createElement(SortIndicator,{key:"SortIndicator",sortDirection:_})),w}function defaultRowRenderer(o){var p=o.className,f=o.columns,m=o.index,_=o.key,w=o.onRowClick,I=o.onRowDoubleClick,k=o.onRowMouseOut,M=o.onRowMouseOver,x=o.onRowRightClick,O=o.rowData,L=o.style,B={"aria-rowindex":m+1};return(w||I||k||M||x)&&(B["aria-label"]="row",B.tabIndex=0,w&&(B.onClick=function(o){return w({event:o,index:m,rowData:O})}),I&&(B.onDoubleClick=function(o){return I({event:o,index:m,rowData:O})}),k&&(B.onMouseOut=function(o){return k({event:o,index:m,rowData:O})}),M&&(B.onMouseOver=function(o){return M({event:o,index:m,rowData:O})}),x&&(B.onContextMenu=function(o){return x({event:o,index:m,rowData:O})})),ed.createElement("div",(0,eu.A)({},B,{className:p,key:_,role:"row",style:L}),f)}SortIndicator.propTypes={},defaultHeaderRenderer.propTypes=null,defaultRowRenderer.propTypes=null;var eG=function(o){function Column(){return(0,ei.A)(this,Column),(0,en.A)(this,(0,eo.A)(Column).apply(this,arguments))}return(0,ea.A)(Column,o),Column}(ed.Component);function Table_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function Table_objectSpread(o){for(var p=1;p<arguments.length;p++){var f=null!=arguments[p]?arguments[p]:{};p%2?Table_ownKeys(f,!0).forEach(function(p){(0,el.A)(o,p,f[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(f)):Table_ownKeys(f).forEach(function(p){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(f,p))})}return o}(0,el.A)(eG,"defaultProps",{cellDataGetter:defaultCellDataGetter,cellRenderer:defaultCellRenderer,defaultSortDirection:"ASC",flexGrow:0,flexShrink:1,headerRenderer:defaultHeaderRenderer,style:{}}),eG.propTypes={};var eW=function(o){function Table(o){var p;return(0,ei.A)(this,Table),(p=(0,en.A)(this,(0,eo.A)(Table).call(this,o))).state={scrollbarWidth:0},p._createColumn=p._createColumn.bind((0,es.A)(p)),p._createRow=p._createRow.bind((0,es.A)(p)),p._onScroll=p._onScroll.bind((0,es.A)(p)),p._onSectionRendered=p._onSectionRendered.bind((0,es.A)(p)),p._setRef=p._setRef.bind((0,es.A)(p)),p}return(0,ea.A)(Table,o),(0,er.A)(Table,[{key:"forceUpdateGrid",value:function(){this.Grid&&this.Grid.forceUpdate()}},{key:"getOffsetForRow",value:function(o){var p=o.alignment,f=o.index;return this.Grid?this.Grid.getOffsetForCell({alignment:p,rowIndex:f}).scrollTop:0}},{key:"invalidateCellSizeAfterRender",value:function(o){var p=o.columnIndex,f=o.rowIndex;this.Grid&&this.Grid.invalidateCellSizeAfterRender({rowIndex:f,columnIndex:p})}},{key:"measureAllRows",value:function(){this.Grid&&this.Grid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=o.rowIndex;this.Grid&&this.Grid.recomputeGridSize({rowIndex:void 0===f?0:f,columnIndex:void 0===p?0:p})}},{key:"recomputeRowHeights",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:o})}},{key:"scrollToPosition",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:o})}},{key:"scrollToRow",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:o})}},{key:"getScrollbarWidth",value:function(){if(this.Grid){var o=(0,eT.findDOMNode)(this.Grid),p=o.clientWidth||0;return(o.offsetWidth||0)-p}return 0}},{key:"componentDidMount",value:function(){this._setScrollbarWidth()}},{key:"componentDidUpdate",value:function(){this._setScrollbarWidth()}},{key:"render",value:function(){var o=this,p=this.props,f=p.children,m=p.className,_=p.disableHeader,w=p.gridClassName,I=p.gridStyle,k=p.headerHeight,M=p.headerRowRenderer,x=p.height,O=p.id,L=p.noRowsRenderer,B=p.rowClassName,U=p.rowStyle,$=p.scrollToIndex,q=p.style,Z=p.width,ee=this.state.scrollbarWidth,et="function"==typeof B?B({index:-1}):B,ei="function"==typeof U?U({index:-1}):U;return this._cachedColumnStyles=[],ed.Children.toArray(f).forEach(function(p,f){var m=o._getFlexStyleForColumn(p,p.props.style);o._cachedColumnStyles[f]=Table_objectSpread({overflow:"hidden"},m)}),ed.createElement("div",{"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-colcount":ed.Children.toArray(f).length,"aria-rowcount":this.props.rowCount,className:clsx_m("ReactVirtualized__Table",m),id:O,role:"grid",style:q},!_&&M({className:clsx_m("ReactVirtualized__Table__headerRow",et),columns:this._getHeaderColumns(),style:Table_objectSpread({height:k,overflow:"hidden",paddingRight:ee,width:Z},ei)}),ed.createElement(eb,(0,eu.A)({},this.props,{"aria-readonly":null,autoContainerWidth:!0,className:clsx_m("ReactVirtualized__Table__Grid",w),cellRenderer:this._createRow,columnWidth:Z,columnCount:1,height:_?x:x-k,id:void 0,noContentRenderer:L,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,role:"rowgroup",scrollbarWidth:ee,scrollToRow:$,style:Table_objectSpread({},I,{overflowX:"hidden"})})))}},{key:"_createColumn",value:function(o){var p=o.column,f=o.columnIndex,m=o.isScrolling,_=o.parent,w=o.rowData,I=o.rowIndex,k=this.props.onColumnClick,M=p.props,x=M.cellDataGetter,O=M.cellRenderer,L=M.className,B=M.columnData,U=M.dataKey,$=M.id,q=O({cellData:x({columnData:B,dataKey:U,rowData:w}),columnData:B,columnIndex:f,dataKey:U,isScrolling:m,parent:_,rowData:w,rowIndex:I}),Z=this._cachedColumnStyles[f],ee="string"==typeof q?q:null;return ed.createElement("div",{"aria-colindex":f+1,"aria-describedby":$,className:clsx_m("ReactVirtualized__Table__rowColumn",L),key:"Row"+I+"-Col"+f,onClick:function(o){k&&k({columnData:B,dataKey:U,event:o})},role:"gridcell",style:Z,title:ee},q)}},{key:"_createHeader",value:function(o){var p,f,m,_,w,I=o.column,k=o.index,M=this.props,x=M.headerClassName,O=M.headerStyle,L=M.onHeaderClick,B=M.sort,U=M.sortBy,$=M.sortDirection,q=I.props,Z=q.columnData,ee=q.dataKey,et=q.defaultSortDirection,ei=q.disableSort,er=q.headerRenderer,en=q.id,eo=q.label,es=!ei&&B,ea=clsx_m("ReactVirtualized__Table__headerColumn",x,I.props.headerClassName,{ReactVirtualized__Table__sortableHeaderColumn:es}),el=this._getFlexStyleForColumn(I,Table_objectSpread({},O,{},I.props.headerStyle)),ec=er({columnData:Z,dataKey:ee,disableSort:ei,label:eo,sortBy:U,sortDirection:$});if(es||L){var eu=U!==ee?et:$===ez?"ASC":ez,onClick=function(o){es&&B({defaultSortDirection:et,event:o,sortBy:ee,sortDirection:eu}),L&&L({columnData:Z,dataKey:ee,event:o})};w=I.props["aria-label"]||eo||ee,_="none",m=0,p=onClick,f=function(o){("Enter"===o.key||" "===o.key)&&onClick(o)}}return U===ee&&(_="ASC"===$?"ascending":"descending"),ed.createElement("div",{"aria-label":w,"aria-sort":_,className:ea,id:en,key:"Header-Col"+k,onClick:p,onKeyDown:f,role:"columnheader",style:el,tabIndex:m},ec)}},{key:"_createRow",value:function(o){var p=this,f=o.rowIndex,m=o.isScrolling,_=o.key,w=o.parent,I=o.style,k=this.props,M=k.children,x=k.onRowClick,O=k.onRowDoubleClick,L=k.onRowRightClick,B=k.onRowMouseOver,U=k.onRowMouseOut,$=k.rowClassName,q=k.rowGetter,Z=k.rowRenderer,ee=k.rowStyle,et=this.state.scrollbarWidth,ei="function"==typeof $?$({index:f}):$,er="function"==typeof ee?ee({index:f}):ee,en=q({index:f}),eo=ed.Children.toArray(M).map(function(o,_){return p._createColumn({column:o,columnIndex:_,isScrolling:m,parent:w,rowData:en,rowIndex:f,scrollbarWidth:et})}),es=clsx_m("ReactVirtualized__Table__row",ei),ea=Table_objectSpread({},I,{height:this._getRowHeight(f),overflow:"hidden",paddingRight:et},er);return Z({className:es,columns:eo,index:f,isScrolling:m,key:_,onRowClick:x,onRowDoubleClick:O,onRowRightClick:L,onRowMouseOver:B,onRowMouseOut:U,rowData:en,style:ea})}},{key:"_getFlexStyleForColumn",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f="".concat(o.props.flexGrow," ").concat(o.props.flexShrink," ").concat(o.props.width,"px"),m=Table_objectSpread({},p,{flex:f,msFlex:f,WebkitFlex:f});return o.props.maxWidth&&(m.maxWidth=o.props.maxWidth),o.props.minWidth&&(m.minWidth=o.props.minWidth),m}},{key:"_getHeaderColumns",value:function(){var o=this,p=this.props,f=p.children;return(p.disableHeader?[]:ed.Children.toArray(f)).map(function(p,f){return o._createHeader({column:p,index:f})})}},{key:"_getRowHeight",value:function(o){var p=this.props.rowHeight;return"function"==typeof p?p({index:o}):p}},{key:"_onScroll",value:function(o){var p=o.clientHeight,f=o.scrollHeight,m=o.scrollTop;(0,this.props.onScroll)({clientHeight:p,scrollHeight:f,scrollTop:m})}},{key:"_onSectionRendered",value:function(o){var p=o.rowOverscanStartIndex,f=o.rowOverscanStopIndex,m=o.rowStartIndex,_=o.rowStopIndex;(0,this.props.onRowsRendered)({overscanStartIndex:p,overscanStopIndex:f,startIndex:m,stopIndex:_})}},{key:"_setRef",value:function(o){this.Grid=o}},{key:"_setScrollbarWidth",value:function(){var o=this.getScrollbarWidth();this.setState({scrollbarWidth:o})}}]),Table}(ed.PureComponent);(0,el.A)(eW,"defaultProps",{disableHeader:!1,estimatedRowSize:30,headerHeight:0,headerStyle:{},noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanIndicesGetter:accessibilityOverscanIndicesGetter_defaultOverscanIndicesGetter,overscanRowCount:10,rowRenderer:defaultRowRenderer,headerRowRenderer:defaultHeaderRowRenderer,rowStyle:{},scrollToAlignment:"auto",scrollToIndex:-1,style:{}}),eW.propTypes={};var e$=[],eK=null,eq=null;function enablePointerEventsIfDisabled(){eq&&(eq=null,document.body&&null!=eK&&(document.body.style.pointerEvents=eK),eK=null)}function enablePointerEventsAfterDelayCallback(){enablePointerEventsIfDisabled(),e$.forEach(function(o){return o.__resetIsScrolling()})}function enablePointerEventsAfterDelay(){eq&&cancelAnimationTimeout(eq);var o=0;e$.forEach(function(p){o=Math.max(o,p.props.scrollingResetTimeInterval)}),eq=requestAnimationTimeout(enablePointerEventsAfterDelayCallback,o)}function onScrollWindow(o){o.currentTarget===window&&null==eK&&document.body&&(eK=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),enablePointerEventsAfterDelay(),e$.forEach(function(p){p.props.scrollElement===o.currentTarget&&p.__handleWindowScrollEvent()})}function registerScrollListener(o,p){e$.some(function(o){return o.props.scrollElement===p})||p.addEventListener("scroll",onScrollWindow),e$.push(o)}function unregisterScrollListener(o,p){!(e$=e$.filter(function(p){return p!==o})).length&&(p.removeEventListener("scroll",onScrollWindow),eq&&(cancelAnimationTimeout(eq),enablePointerEventsIfDisabled()))}var isWindow=function(o){return o===window},getBoundingBox=function(o){return o.getBoundingClientRect()};function getDimensions(o,p){if(!o)return{height:p.serverHeight,width:p.serverWidth};if(!isWindow(o))return getBoundingBox(o);var f=window,m=f.innerHeight,_=f.innerWidth;return{height:"number"==typeof m?m:0,width:"number"==typeof _?_:0}}function getPositionOffset(o,p){if(isWindow(p)&&document.documentElement){var f=document.documentElement,m=getBoundingBox(o),_=getBoundingBox(f);return{top:m.top-_.top,left:m.left-_.left}}var w=getScrollOffset(p),I=getBoundingBox(o),k=getBoundingBox(p);return{top:I.top+w.top-k.top,left:I.left+w.left-k.left}}function getScrollOffset(o){return isWindow(o)&&document.documentElement?{top:"scrollY"in window?window.scrollY:document.documentElement.scrollTop,left:"scrollX"in window?window.scrollX:document.documentElement.scrollLeft}:{top:o.scrollTop,left:o.scrollLeft}}function WindowScroller_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function WindowScroller_objectSpread(o){for(var p=1;p<arguments.length;p++){var f=null!=arguments[p]?arguments[p]:{};p%2?WindowScroller_ownKeys(f,!0).forEach(function(p){(0,el.A)(o,p,f[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(f)):WindowScroller_ownKeys(f).forEach(function(p){Object.defineProperty(o,p,Object.getOwnPropertyDescriptor(f,p))})}return o}var getWindow=function(){return"u">typeof window?window:void 0},eJ=(et=ee=function(o){function WindowScroller(){(0,ei.A)(this,WindowScroller);for(var o,p,f=arguments.length,m=Array(f),_=0;_<f;_++)m[_]=arguments[_];return p=(0,en.A)(this,(o=(0,eo.A)(WindowScroller)).call.apply(o,[this].concat(m))),(0,el.A)((0,es.A)(p),"_window",getWindow()),(0,el.A)((0,es.A)(p),"_isMounted",!1),(0,el.A)((0,es.A)(p),"_positionFromTop",0),(0,el.A)((0,es.A)(p),"_positionFromLeft",0),(0,el.A)((0,es.A)(p),"_detectElementResize",void 0),(0,el.A)((0,es.A)(p),"_child",void 0),(0,el.A)((0,es.A)(p),"state",WindowScroller_objectSpread({},getDimensions(p.props.scrollElement,p.props),{isScrolling:!1,scrollLeft:0,scrollTop:0})),(0,el.A)((0,es.A)(p),"_registerChild",function(o){!o||o instanceof Element||console.warn("WindowScroller registerChild expects to be passed Element or null"),p._child=o,p.updatePosition()}),(0,el.A)((0,es.A)(p),"_onChildScroll",function(o){var f=o.scrollTop;if(p.state.scrollTop!==f){var m=p.props.scrollElement;m&&("function"==typeof m.scrollTo?m.scrollTo(0,f+p._positionFromTop):m.scrollTop=f+p._positionFromTop)}}),(0,el.A)((0,es.A)(p),"_registerResizeListener",function(o){o===window?window.addEventListener("resize",p._onResize,!1):p._detectElementResize.addResizeListener(o,p._onResize)}),(0,el.A)((0,es.A)(p),"_unregisterResizeListener",function(o){o===window?window.removeEventListener("resize",p._onResize,!1):o&&p._detectElementResize.removeResizeListener(o,p._onResize)}),(0,el.A)((0,es.A)(p),"_onResize",function(){p.updatePosition()}),(0,el.A)((0,es.A)(p),"__handleWindowScrollEvent",function(){if(p._isMounted){var o=p.props.onScroll,f=p.props.scrollElement;if(f){var m=getScrollOffset(f),_=Math.max(0,m.left-p._positionFromLeft),w=Math.max(0,m.top-p._positionFromTop);p.setState({isScrolling:!0,scrollLeft:_,scrollTop:w}),o({scrollLeft:_,scrollTop:w})}}}),(0,el.A)((0,es.A)(p),"__resetIsScrolling",function(){p.setState({isScrolling:!1})}),p}return(0,ea.A)(WindowScroller,o),(0,er.A)(WindowScroller,[{key:"updatePosition",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.scrollElement,p=this.props.onResize,f=this.state,m=f.height,_=f.width,w=this._child||eT.findDOMNode(this);if(w instanceof Element&&o){var I=getPositionOffset(w,o);this._positionFromTop=I.top,this._positionFromLeft=I.left}var k=getDimensions(o,this.props);(m!==k.height||_!==k.width)&&(this.setState({height:k.height,width:k.width}),p({height:k.height,width:k.width}))}},{key:"componentDidMount",value:function(){var o=this.props.scrollElement;this._detectElementResize=createDetectElementResize(),this.updatePosition(o),o&&(registerScrollListener(this,o),this._registerResizeListener(o)),this._isMounted=!0}},{key:"componentDidUpdate",value:function(o,p){var f=this.props.scrollElement,m=o.scrollElement;m!==f&&null!=m&&null!=f&&(this.updatePosition(f),unregisterScrollListener(this,m),registerScrollListener(this,f),this._unregisterResizeListener(m),this._registerResizeListener(f))}},{key:"componentWillUnmount",value:function(){var o=this.props.scrollElement;o&&(unregisterScrollListener(this,o),this._unregisterResizeListener(o)),this._isMounted=!1}},{key:"render",value:function(){var o=this.props.children,p=this.state,f=p.isScrolling,m=p.scrollTop,_=p.scrollLeft,w=p.height,I=p.width;return o({onChildScroll:this._onChildScroll,registerChild:this._registerChild,height:w,isScrolling:f,scrollLeft:_,scrollTop:m,width:I})}}]),WindowScroller}(ed.PureComponent),(0,el.A)(ee,"propTypes",null),et);(0,el.A)(eJ,"defaultProps",{onResize:function(){},onScroll:function(){},scrollingResetTimeInterval:150,scrollElement:getWindow(),serverHeight:0,serverWidth:0})},0x1cebff0c0:(o,p,f)=>{"use strict";f.d(p,{P:()=>thunk});var thunk=({dispatch:o,getState:p})=>f=>m=>"function"==typeof m?m(o,p,void 0):f(m)},0x182690375:(o,p,f)=>{"use strict";f.d(p,{Q:()=>w,c:()=>I});var m,_,w=((m={})[m.ID=25]="ID",m[m.FRECENCY=0]="FRECENCY",m[m.RAW_FRECENCY=65]="RAW_FRECENCY",m[m.FRECENCY_BONUS=76]="FRECENCY_BONUS",m[m.FRECENCY_WEIGHT_HIT_VISITS=91]="FRECENCY_WEIGHT_HIT_VISITS",m[m.FRECENCY_HIT_COUNT=92]="FRECENCY_HIT_COUNT",m[m.FRECENCY_WEIGHT_ITEM_VISITS=93]="FRECENCY_WEIGHT_ITEM_VISITS",m[m.FRECENCY_ITEM_COUNT=94]="FRECENCY_ITEM_COUNT",m[m.FRECENCY_LOG_HIT_COUNT=105]="FRECENCY_LOG_HIT_COUNT",m[m.FRECENCY_LOG_HIT_COUNT_SCALED=106]="FRECENCY_LOG_HIT_COUNT_SCALED",m[m.FRECENCY_LOG_ITEM_COUNT=159]="FRECENCY_LOG_ITEM_COUNT",m[m.FRECENCY_LOG_ITEM_COUNT_SCALED=160]="FRECENCY_LOG_ITEM_COUNT_SCALED",m[m.FRECENCY_HIT_VISIT_DECAY_2H=162]="FRECENCY_HIT_VISIT_DECAY_2H",m[m.FRECENCY_HIT_VISIT_DECAY_7D=163]="FRECENCY_HIT_VISIT_DECAY_7D",m[m.FRECENCY_ITEM_VISIT_DECAY_2H=164]="FRECENCY_ITEM_VISIT_DECAY_2H",m[m.FRECENCY_ITEM_VISIT_DECAY_7D=165]="FRECENCY_ITEM_VISIT_DECAY_7D",m[m.FRECENCY_HIT_VISITS_4H=242]="FRECENCY_HIT_VISITS_4H",m[m.FRECENCY_HIT_VISITS_1D=243]="FRECENCY_HIT_VISITS_1D",m[m.FRECENCY_HIT_VISITS_3D=244]="FRECENCY_HIT_VISITS_3D",m[m.FRECENCY_HIT_VISITS_1W=245]="FRECENCY_HIT_VISITS_1W",m[m.FRECENCY_HIT_VISITS_1M=246]="FRECENCY_HIT_VISITS_1M",m[m.FRECENCY_HIT_VISITS_90D=247]="FRECENCY_HIT_VISITS_90D",m[m.FRECENCY_ITEM_VISITS_4H=248]="FRECENCY_ITEM_VISITS_4H",m[m.FRECENCY_ITEM_VISITS_1D=249]="FRECENCY_ITEM_VISITS_1D",m[m.FRECENCY_ITEM_VISITS_3D=250]="FRECENCY_ITEM_VISITS_3D",m[m.FRECENCY_ITEM_VISITS_1W=251]="FRECENCY_ITEM_VISITS_1W",m[m.FRECENCY_ITEM_VISITS_1M=252]="FRECENCY_ITEM_VISITS_1M",m[m.FRECENCY_ITEM_VISITS_90D=253]="FRECENCY_ITEM_VISITS_90D",m[m.TYPE_NAVIGATION_CHANNEL=2]="TYPE_NAVIGATION_CHANNEL",m[m.TYPE_NAVIGATION_LINK=172]="TYPE_NAVIGATION_LINK",m[m.TYPE_NAVIGATION_MPIM=4]="TYPE_NAVIGATION_MPIM",m[m.TYPE_NAVIGATION_MODAL=177]="TYPE_NAVIGATION_MODAL",m[m.TYPE_NAVIGATION_USER=5]="TYPE_NAVIGATION_USER",m[m.TYPE_QUERY=6]="TYPE_QUERY",m[m.TYPE_QUERY_HISTORY=7]="TYPE_QUERY_HISTORY",m[m.TYPE_EMOJI=178]="TYPE_EMOJI",m[m.ACTIVE_TOKEN_FILTER_IN=8]="ACTIVE_TOKEN_FILTER_IN",m[m.ACTIVE_TOKEN_FILTER_FROM=9]="ACTIVE_TOKEN_FILTER_FROM",m[m.ACTIVE_TOKEN_FILTER_TO=10]="ACTIVE_TOKEN_FILTER_TO",m[m.ACTIVE_TOKEN_FILTER_BEFORE=11]="ACTIVE_TOKEN_FILTER_BEFORE",m[m.ACTIVE_TOKEN_FILTER_DURING=12]="ACTIVE_TOKEN_FILTER_DURING",m[m.ACTIVE_TOKEN_FILTER_ON=13]="ACTIVE_TOKEN_FILTER_ON",m[m.ACTIVE_TOKEN_FILTER_AFTER=14]="ACTIVE_TOKEN_FILTER_AFTER",m[m.ACTIVE_TOKEN_FILTER_HAS=15]="ACTIVE_TOKEN_FILTER_HAS",m[m.ACTIVE_TOKEN_FILTER_IS=155]="ACTIVE_TOKEN_FILTER_IS",m[m.ACTIVE_TOKEN_FILTER_WITH=233]="ACTIVE_TOKEN_FILTER_WITH",m[m.ACTIVE_TOKEN_MEMBER=16]="ACTIVE_TOKEN_MEMBER",m[m.ACTIVE_TOKEN_STRING=17]="ACTIVE_TOKEN_STRING",m[m.ACTIVE_TOKEN_PHRASE=18]="ACTIVE_TOKEN_PHRASE",m[m.STRING_EXACT_MATCH=19]="STRING_EXACT_MATCH",m[m.STRING_EXACT_PREFIX_MATCH=20]="STRING_EXACT_PREFIX_MATCH",m[m.STRING_NORMAL_MATCH=21]="STRING_NORMAL_MATCH",m[m.STRING_NORMAL_PREFIX_MATCH=22]="STRING_NORMAL_PREFIX_MATCH",m[m.STRING_SAME_NUMBER_WORDS=23]="STRING_SAME_NUMBER_WORDS",m[m.EXCESS_STRING_LENGTH=24]="EXCESS_STRING_LENGTH",m[m.EXACT_MATCH_LOG_RESULTS=229]="EXACT_MATCH_LOG_RESULTS",m[m.FILE_SUGGESTION_SCORE=26]="FILE_SUGGESTION_SCORE",m[m.ACTIVE_TOKEN_QUERY_SUGGESTION=27]="ACTIVE_TOKEN_QUERY_SUGGESTION",m[m.QUERY_SUGGESTION_SCORE_V2=28]="QUERY_SUGGESTION_SCORE_V2",m[m.TYPE_NAVIGATION_TEAM=31]="TYPE_NAVIGATION_TEAM",m[m.TYPE_NAVIGATION_VIEW=32]="TYPE_NAVIGATION_VIEW",m[m.TYPE_USER_QUERY=33]="TYPE_USER_QUERY",m[m.NAV_EXACT_MATCH=35]="NAV_EXACT_MATCH",m[m.NAV_EXACT_PREFIX_MATCH=36]="NAV_EXACT_PREFIX_MATCH",m[m.NAV_NORMAL_MATCH=37]="NAV_NORMAL_MATCH",m[m.NAV_NORMAL_PREFIX_MATCH=75]="NAV_NORMAL_PREFIX_MATCH",m[m.CHANNEL_IS_PREVIOUS_NAME_EXACT_MATCH=38]="CHANNEL_IS_PREVIOUS_NAME_EXACT_MATCH",m[m.CHANNEL_IS_PREVIOUS_NAME_PREFIX_MATCH=39]="CHANNEL_IS_PREVIOUS_NAME_PREFIX_MATCH",m[m.CHANNEL_IS_ARCHIVED=40]="CHANNEL_IS_ARCHIVED",m[m.CHANNEL_IS_MEMBER=41]="CHANNEL_IS_MEMBER",m[m.CHANNEL_IS_STARRED=42]="CHANNEL_IS_STARRED",m[m.MPIM_IS_STARRED=43]="MPIM_IS_STARRED",m[m.CHANNEL_IS_UNREAD=44]="CHANNEL_IS_UNREAD",m[m.MPIM_IS_UNREAD=45]="MPIM_IS_UNREAD",m[m.CHANNEL_IS_OTHER_TEAM=46]="CHANNEL_IS_OTHER_TEAM",m[m.USER_IS_ACTIVE=47]="USER_IS_ACTIVE",m[m.USER_IS_CURRENT_USER=48]="USER_IS_CURRENT_USER",m[m.USER_DM_IS_STARRED=49]="USER_DM_IS_STARRED",m[m.USER_DM_IS_UNREAD=50]="USER_DM_IS_UNREAD",m[m.CHANNEL_PRIORITY=51]="CHANNEL_PRIORITY",m[m.CHANNEL_READ_AGE_DECAY_7D=52]="CHANNEL_READ_AGE_DECAY_7D",m[m.CHANNEL_READ_AGE_DECAY_2H=53]="CHANNEL_READ_AGE_DECAY_2H",m[m.MPIM_READ_AGE_DECAY_2H=54]="MPIM_READ_AGE_DECAY_2H",m[m.MPIM_READ_AGE_DECAY_7D=55]="MPIM_READ_AGE_DECAY_7D",m[m.USER_DM_READ_AGE_DECAY_7D=56]="USER_DM_READ_AGE_DECAY_7D",m[m.USER_DM_READ_AGE_DECAY_2H=57]="USER_DM_READ_AGE_DECAY_2H",m[m.USER_DM_READ_AGE_DECAY_7D_V2=274]="USER_DM_READ_AGE_DECAY_7D_V2",m[m.USER_DM_READ_AGE_DECAY_2H_V2=275]="USER_DM_READ_AGE_DECAY_2H_V2",m[m.QUERY_LENGTH=61]="QUERY_LENGTH",m[m.NAV_QUERY_LENGTH=62]="NAV_QUERY_LENGTH",m[m.SUGGESTION_TEXT_LENGTH=63]="SUGGESTION_TEXT_LENGTH",m[m.NAV_TEXT_LENGTH=64]="NAV_TEXT_LENGTH",m[m.MPIM_PRIORITY=66]="MPIM_PRIORITY",m[m.QUERY_RATIO_LENGTH_STRING=68]="QUERY_RATIO_LENGTH_STRING",m[m.NAV_QUERY_RATIO_LENGTH_STRING=69]="NAV_QUERY_RATIO_LENGTH_STRING",m[m.USER_QUERY_RATIO_LENGTH_STRING=70]="USER_QUERY_RATIO_LENGTH_STRING",m[m.CHANNEL_QUERY_RATIO_LENGTH_STRING=71]="CHANNEL_QUERY_RATIO_LENGTH_STRING",m[m.MPIM_QUERY_RATIO_LENGTH_STRING=72]="MPIM_QUERY_RATIO_LENGTH_STRING",m[m.FUZZY_SCORE=73]="FUZZY_SCORE",m[m.MPIM_WITH_DEACTIVATED_USER=74]="MPIM_WITH_DEACTIVATED_USER",m[m.USER_FIRST_NAME_EXACT_MATCH=81]="USER_FIRST_NAME_EXACT_MATCH",m[m.USER_FIRST_NAME_EXACT_PREFIX_MATCH=82]="USER_FIRST_NAME_EXACT_PREFIX_MATCH",m[m.USER_FIRST_NAME_NORMAL_MATCH=83]="USER_FIRST_NAME_NORMAL_MATCH",m[m.USER_FIRST_NAME_NORMAL_PREFIX_MATCH=84]="USER_FIRST_NAME_NORMAL_PREFIX_MATCH",m[m.USER_LAST_NAME_EXACT_MATCH=85]="USER_LAST_NAME_EXACT_MATCH",m[m.USER_LAST_NAME_EXACT_PREFIX_MATCH=86]="USER_LAST_NAME_EXACT_PREFIX_MATCH",m[m.USER_LAST_NAME_NORMAL_MATCH=87]="USER_LAST_NAME_NORMAL_MATCH",m[m.USER_LAST_NAME_NORMAL_PREFIX_MATCH=88]="USER_LAST_NAME_NORMAL_PREFIX_MATCH",m[m.USER_PRIORITY=89]="USER_PRIORITY",m[m.ONLY_MATCHES_PREVIOUS_NAME=90]="ONLY_MATCHES_PREVIOUS_NAME",m[m.NAV_NORMAL_MATCH_USER=95]="NAV_NORMAL_MATCH_USER",m[m.NAV_NORMAL_PREFIX_MATCH_USER=96]="NAV_NORMAL_PREFIX_MATCH_USER",m[m.NAV_NORMAL_MATCH_NO_USER=97]="NAV_NORMAL_MATCH_NO_USER",m[m.NAV_NORMAL_PREFIX_MATCH_NO_USER=98]="NAV_NORMAL_PREFIX_MATCH_NO_USER",m[m.CHANNEL_LATEST_MSG_AGE_DECAY_7D=99]="CHANNEL_LATEST_MSG_AGE_DECAY_7D",m[m.CHANNEL_LATEST_MSG_AGE_DECAY_2H=100]="CHANNEL_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_LATEST_MSG_AGE_DECAY_2H=101]="MPIM_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_LATEST_MSG_AGE_DECAY_7D=102]="MPIM_LATEST_MSG_AGE_DECAY_7D",m[m.USER_DM_LATEST_MSG_AGE_DECAY_7D=103]="USER_DM_LATEST_MSG_AGE_DECAY_7D",m[m.USER_DM_LATEST_MSG_AGE_DECAY_2H=104]="USER_DM_LATEST_MSG_AGE_DECAY_2H",m[m.USER_DM_LATEST_MSG_AGE_DECAY_7D_V2=260]="USER_DM_LATEST_MSG_AGE_DECAY_7D_V2",m[m.USER_DM_LATEST_MSG_AGE_DECAY_2H_V2=261]="USER_DM_LATEST_MSG_AGE_DECAY_2H_V2",m[m.FUZZY_SCORE_50=127]="FUZZY_SCORE_50",m[m.FUZZY_SCORE_25=128]="FUZZY_SCORE_25",m[m.FUZZY_SCORE_ALL=129]="FUZZY_SCORE_ALL",m[m.FUZZY_SCORE_SCALED_EXP=291]="FUZZY_SCORE_SCALED_EXP",m[m.FUZZY_SCORE_SCALED_FLIPPED=292]="FUZZY_SCORE_SCALED_FLIPPED",m[m.FUZZY_SCORE_SCALED_SUBTRACT=293]="FUZZY_SCORE_SCALED_SUBTRACT",m[m.HERE_KEYWORD=131]="HERE_KEYWORD",m[m.HERE_KEYWORD_EXACT_MATCH=132]="HERE_KEYWORD_EXACT_MATCH",m[m.IS_BROADCAST_KEYWORD=133]="IS_BROADCAST_KEYWORD",m[m.BROADCAST_KEYWORD_NORMAL_MATCH=134]="BROADCAST_KEYWORD_NORMAL_MATCH",m[m.MEMBER_OF_CURRENT_CHANNEL=153]="MEMBER_OF_CURRENT_CHANNEL",m[m.QUERY_LENGTH_DECAY_NORMAL_MATCH_CHANNEL=154]="QUERY_LENGTH_DECAY_NORMAL_MATCH_CHANNEL",m[m.USER_EMAIL_MATCH=170]="USER_EMAIL_MATCH",m[m.USER_EMAIL_ONLY_MATCH=171]="USER_EMAIL_ONLY_MATCH",m[m.QUERY_IS_SELF=193]="QUERY_IS_SELF",m[m.CURRENT_USER_TEXTY=194]="CURRENT_USER_TEXTY",m[m.USER_IS_EXTERNAL=234]="USER_IS_EXTERNAL",m[m.USER_SAME_TEAM=235]="USER_SAME_TEAM",m[m.USER_IS_BOT=254]="USER_IS_BOT",m[m.MEMBER_OF_SEARCHER_DEFAULT_TEAM=294]="MEMBER_OF_SEARCHER_DEFAULT_TEAM",m[m.HAS_WORKSPACE_INTERSECTION_WITH_SEARCHER=295]="HAS_WORKSPACE_INTERSECTION_WITH_SEARCHER",m[m.NUM_WORKSPACES_INTERSECTING_WITH_SEARCHER=296]="NUM_WORKSPACES_INTERSECTING_WITH_SEARCHER",m[m.USER_IS_DEACTIVATED=297]="USER_IS_DEACTIVATED",m[m.USER_IS_IN_CURRENT_THREAD=298]="USER_IS_IN_CURRENT_THREAD",m[m.MEMBER_FILTER_USER_IN_CHANNEL=299]="MEMBER_FILTER_USER_IN_CHANNEL",m[m.FROM_AND_CHANNEL_FILTERS_USER_IN_CHANNEL=300]="FROM_AND_CHANNEL_FILTERS_USER_IN_CHANNEL",m[m.CHANNEL_TEAM_CTR_90DD=189]="CHANNEL_TEAM_CTR_90DD",m[m.CHANNEL_USER_CTR_30DD=190]="CHANNEL_USER_CTR_30DD",m[m.NAV_NORMAL_MATCH_CHANNEL_LOG_RESULTS=199]="NAV_NORMAL_MATCH_CHANNEL_LOG_RESULTS",m[m.HISTORY_AGE_DECAY_2H=230]="HISTORY_AGE_DECAY_2H",m[m.HISTORY_AGE_DECAY_7D=231]="HISTORY_AGE_DECAY_7D",m[m.HISTORY_POSITION=232]="HISTORY_POSITION",m[m.CHANNEL_IS_NOT_MEMBER=310]="CHANNEL_IS_NOT_MEMBER",m[m.USER_DM_NULL=179]="USER_DM_NULL",m[m.USER_DM_EMPTY=180]="USER_DM_EMPTY",m[m.USER_DM_NOT_OPEN=181]="USER_DM_NOT_OPEN",m[m.USER_DM_OPEN=182]="USER_DM_OPEN",m[m.USER_DM_LATEST_OLDER_30D=183]="USER_DM_LATEST_OLDER_30D",m[m.USER_DM_LATEST_OLDER_90D=184]="USER_DM_LATEST_OLDER_90D",m[m.USER_DM_EMPTY_V2=257]="USER_DM_EMPTY_V2",m[m.USER_DM_LATEST_OLDER_30D_V2=258]="USER_DM_LATEST_OLDER_30D_V2",m[m.USER_DM_LATEST_OLDER_90D_V2=259]="USER_DM_LATEST_OLDER_90D_V2",m[m.USER_HAS_DMED=284]="USER_HAS_DMED",m[m.USER_DM_READ_AGE_DECAY_2H_V3=285]="USER_DM_READ_AGE_DECAY_2H_V3",m[m.USER_DM_READ_AGE_DECAY_7D_V3=286]="USER_DM_READ_AGE_DECAY_7D_V3",m[m.USER_DM_READ_OLDER_7D=287]="USER_DM_READ_OLDER_7D",m[m.USER_DM_READ_OLDER_30D=288]="USER_DM_READ_OLDER_30D",m[m.USER_DM_READ_OLDER_90D=289]="USER_DM_READ_OLDER_90D",m[m.USER_MPIM_READ_AGE_DECAY_7D=236]="USER_MPIM_READ_AGE_DECAY_7D",m[m.USER_MPIM_READ_AGE_DECAY_2H=237]="USER_MPIM_READ_AGE_DECAY_2H",m[m.USER_MPIM_LATEST_MSG_AGE_DECAY_7D=238]="USER_MPIM_LATEST_MSG_AGE_DECAY_7D",m[m.USER_MPIM_LATEST_MSG_AGE_DECAY_2H=239]="USER_MPIM_LATEST_MSG_AGE_DECAY_2H",m[m.USER_MPIM_FRECENCY_LOG_HIT_COUNT=240]="USER_MPIM_FRECENCY_LOG_HIT_COUNT",m[m.USER_MPIM_FRECENCY_LOG_ITEM_COUNT=241]="USER_MPIM_FRECENCY_LOG_ITEM_COUNT",m[m.USER_HAS_MPDMED=303]="USER_HAS_MPDMED",m[m.USER_MPIM_LOG1P_MEMBERSHIP_COUNT=304]="USER_MPIM_LOG1P_MEMBERSHIP_COUNT",m[m.USER_MPIM_GTE5_MEMBERSHIP_COUNT=305]="USER_MPIM_GTE5_MEMBERSHIP_COUNT",m[m.USER_MPIM_GTE25_MEMBERSHIP_COUNT=306]="USER_MPIM_GTE25_MEMBERSHIP_COUNT",m[m.USER_MPIM_READ_AGE_DECAY_7D_V2=307]="USER_MPIM_READ_AGE_DECAY_7D_V2",m[m.USER_MPIM_READ_AGE_DECAY_2H_V2=308]="USER_MPIM_READ_AGE_DECAY_2H_V2",m[m.MPIM_MEMBERS=166]="MPIM_MEMBERS",m[m.MPIM_MEMBER_NAME_MATCHES=167]="MPIM_MEMBER_NAME_MATCHES",m[m.MPIM_MEMBER_ALL_MATCHES=168]="MPIM_MEMBER_ALL_MATCHES",m[m.MPIM_MATCHER_SCORE=169]="MPIM_MATCHER_SCORE",m[m.MPIM_MATCHER_SCORE_0=173]="MPIM_MATCHER_SCORE_0",m[m.MPIM_MATCHER_SCORE_1=174]="MPIM_MATCHER_SCORE_1",m[m.MPIM_MATCHER_SCORE_2=175]="MPIM_MATCHER_SCORE_2",m[m.MPIM_MATCHER_SCORE_3=176]="MPIM_MATCHER_SCORE_3",m[m.MPIM_TEAM_CTR_90DD=187]="MPIM_TEAM_CTR_90DD",m[m.MPIM_USER_CTR_30DD=188]="MPIM_USER_CTR_30DD",m[m.MPIM_NUM_OTHER_MEMBERS_EQUALS_NUM_QUERY_WORDS=301]="MPIM_NUM_OTHER_MEMBERS_EQUALS_NUM_QUERY_WORDS",m[m.MPIM_ALL_OTHER_MEMBERS_NAMES_HAVE_PREFIX_MATCH=302]="MPIM_ALL_OTHER_MEMBERS_NAMES_HAVE_PREFIX_MATCH",m[m.MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_2H=262]="MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_7D=263]="MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_7D",m[m.MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_2H=264]="MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_7D=265]="MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_7D",m[m.MPIM_USERS_MAX_MSG_READ_AGE_DECAY_2H=266]="MPIM_USERS_MAX_MSG_READ_AGE_DECAY_2H",m[m.MPIM_USERS_MAX_MSG_READ_AGE_DECAY_7D=267]="MPIM_USERS_MAX_MSG_READ_AGE_DECAY_7D",m[m.MPIM_USERS_AVG_MSG_READ_AGE_DECAY_2H=268]="MPIM_USERS_AVG_MSG_READ_AGE_DECAY_2H",m[m.MPIM_USERS_AVG_MSG_READ_AGE_DECAY_7D=269]="MPIM_USERS_AVG_MSG_READ_AGE_DECAY_7D",m[m.MPIM_USERS_PCT_NON_EMPTY_DMS=270]="MPIM_USERS_PCT_NON_EMPTY_DMS",m[m.MPIM_USERS_PCT_NON_NULL_DMS=271]="MPIM_USERS_PCT_NON_NULL_DMS",m[m.MPIM_USERS_ALL_INTERNAL=272]="MPIM_USERS_ALL_INTERNAL",m[m.EMOJI_EXACT_MATCH=136]="EMOJI_EXACT_MATCH",m[m.EMOJI_QUERY_LENGTH_RATIO=150]="EMOJI_QUERY_LENGTH_RATIO",m[m.EMOJI_TOTAL_COMBO_BREAKS=151]="EMOJI_TOTAL_COMBO_BREAKS",m[m.EMOJI_COMBO_BREAK_0=161]="EMOJI_COMBO_BREAK_0",m[m.EMOJI_COMBO_BREAK_1=156]="EMOJI_COMBO_BREAK_1",m[m.EMOJI_COMBO_BREAK_2=157]="EMOJI_COMBO_BREAK_2",m[m.EMOJI_COMBO_BREAK_3=158]="EMOJI_COMBO_BREAK_3",m[m.EMOJI_TEAM_CTR_90DD=185]="EMOJI_TEAM_CTR_90DD",m[m.EMOJI_USER_CTR_30DD=186]="EMOJI_USER_CTR_30DD",m[m.CHANNEL_IS_FROZEN=146]="CHANNEL_IS_FROZEN",m[m.USER_DM_IS_FROZEN=147]="USER_DM_IS_FROZEN",m[m.CHANNEL_HAS_DRAFT=148]="CHANNEL_HAS_DRAFT",m[m.USER_DM_HAS_DRAFT=149]="USER_DM_HAS_DRAFT",m[m.QUERY_FRECENCY_RAW=107]="QUERY_FRECENCY_RAW",m[m.QUERY_FRECENCY_WEIGHT_HIT_VISITS=108]="QUERY_FRECENCY_WEIGHT_HIT_VISITS",m[m.QUERY_FRECENCY_HIT_COUNT=109]="QUERY_FRECENCY_HIT_COUNT",m[m.QUERY_FRECENCY_WEIGHT_ITEM_VISITS=110]="QUERY_FRECENCY_WEIGHT_ITEM_VISITS",m[m.QUERY_FRECENCY_ITEM_COUNT=111]="QUERY_FRECENCY_ITEM_COUNT",m[m.QUERY_FUZZY_SCORE=112]="QUERY_FUZZY_SCORE",m[m.QUERY_FRECENCY_BONUS=113]="QUERY_FRECENCY_BONUS",m[m.QUERY_LOG_HIT_COUNT=130]="QUERY_LOG_HIT_COUNT",m[m.QUERY_TOKEN_NORMAL_MATCH=137]="QUERY_TOKEN_NORMAL_MATCH",m[m.QUERY_TOKEN_NORMAL_PREFIX_MATCH=138]="QUERY_TOKEN_NORMAL_PREFIX_MATCH",m[m.QUERY_HISTORY_AGE_DECAY_30D=282]="QUERY_HISTORY_AGE_DECAY_30D",m[m.QUERY_HISTORY_LOG_INDEX=283]="QUERY_HISTORY_LOG_INDEX",m[m.FILTER_USER_IS_ACTIVE=114]="FILTER_USER_IS_ACTIVE",m[m.FILTER_USER_IS_CURRENT_USER=115]="FILTER_USER_IS_CURRENT_USER",m[m.FILTER_USER_DM_IS_STARRED=116]="FILTER_USER_DM_IS_STARRED",m[m.FILTER_USER_DM_IS_UNREAD=117]="FILTER_USER_DM_IS_UNREAD",m[m.FILTER_USER_DM_READ_AGE_DECAY_7D=118]="FILTER_USER_DM_READ_AGE_DECAY_7D",m[m.FILTER_USER_DM_READ_AGE_DECAY_2H=119]="FILTER_USER_DM_READ_AGE_DECAY_2H",m[m.FILTER_USER_DM_LATEST_MSG_AGE_DECAY_7D=120]="FILTER_USER_DM_LATEST_MSG_AGE_DECAY_7D",m[m.FILTER_USER_DM_LATEST_MSG_AGE_DECAY_2H=121]="FILTER_USER_DM_LATEST_MSG_AGE_DECAY_2H",m[m.FILTER_USER_FIRST_NAME_NORMAL_MATCH=122]="FILTER_USER_FIRST_NAME_NORMAL_MATCH",m[m.FILTER_USER_FIRST_NAME_NORMAL_PREFIX_MATCH=123]="FILTER_USER_FIRST_NAME_NORMAL_PREFIX_MATCH",m[m.FILTER_USER_LAST_NAME_NORMAL_MATCH=124]="FILTER_USER_LAST_NAME_NORMAL_MATCH",m[m.FILTER_USER_LAST_NAME_NORMAL_PREFIX_MATCH=125]="FILTER_USER_LAST_NAME_NORMAL_PREFIX_MATCH",m[m.FILTER_USER_PRIORITY=126]="FILTER_USER_PRIORITY",m[m.FILTER_CHANNEL_IS_ARCHIVED=139]="FILTER_CHANNEL_IS_ARCHIVED",m[m.FILTER_CHANNEL_IS_MEMBER=140]="FILTER_CHANNEL_IS_MEMBER",m[m.FILTER_CHANNEL_IS_STARRED=141]="FILTER_CHANNEL_IS_STARRED",m[m.FILTER_CHANNEL_IS_UNREAD=142]="FILTER_CHANNEL_IS_UNREAD",m[m.FILTER_CHANNEL_READ_AGE_DECAY_7D=143]="FILTER_CHANNEL_READ_AGE_DECAY_7D",m[m.FILTER_CHANNEL_READ_AGE_DECAY_2H=144]="FILTER_CHANNEL_READ_AGE_DECAY_2H",m[m.FILTER_CHANNEL_PRIORITY=145]="FILTER_CHANNEL_PRIORITY",m[m.USER_ENTITY_TYPE_CTR_30DD=191]="USER_ENTITY_TYPE_CTR_30DD",m[m.NUM_RESULTS=192]="NUM_RESULTS",m[m.TYPE_NAVIGATION_FILE=3]="TYPE_NAVIGATION_FILE",m[m.FILE_AGE_DECAY_7D=195]="FILE_AGE_DECAY_7D",m[m.FILE_AGE_DECAY_28D=196]="FILE_AGE_DECAY_28D",m[m.FILE_AGE_DECAY_90D=197]="FILE_AGE_DECAY_90D",m[m.FILE_FROM_CURRENT_USER=198]="FILE_FROM_CURRENT_USER",m[m.FILE_LOG_PRIVATE_SHARES=200]="FILE_LOG_PRIVATE_SHARES",m[m.FILE_LOG_PUBLIC_SHARES=201]="FILE_LOG_PUBLIC_SHARES",m[m.FILE_LOG_ACTIONS=202]="FILE_LOG_ACTIONS",m[m.FILE_LATEST_ACTION_AGE_DECAY_2H=203]="FILE_LATEST_ACTION_AGE_DECAY_2H",m[m.FILE_LATEST_ACTION_AGE_DECAY_7D=204]="FILE_LATEST_ACTION_AGE_DECAY_7D",m[m.FILE_LATEST_ACTION_AGE_DECAY_90D=205]="FILE_LATEST_ACTION_AGE_DECAY_90D",m[m.FILE_LATEST_SHARE_AGE_DECAY_2H=206]="FILE_LATEST_SHARE_AGE_DECAY_2H",m[m.FILE_LATEST_SHARE_AGE_DECAY_7D=207]="FILE_LATEST_SHARE_AGE_DECAY_7D",m[m.FILE_LATEST_SHARE_AGE_DECAY_90D=208]="FILE_LATEST_SHARE_AGE_DECAY_90D",m[m.FILE_CHANNEL_CTR=209]="FILE_CHANNEL_CTR",m[m.FILE_SUGGESTIONS_SEARCHER=210]="FILE_SUGGESTIONS_SEARCHER",m[m.FILE_USER_CTR=211]="FILE_USER_CTR",m[m.FILE_NAME_CONTAINS_QUERY_NORMALIZED=273]="FILE_NAME_CONTAINS_QUERY_NORMALIZED",m[m.FILE_IS_CANVAS=276]="FILE_IS_CANVAS",m[m.FILE_HAS_DMS_WITH_CREATOR=277]="FILE_HAS_DMS_WITH_CREATOR",m[m.FILE_LATEST_VIEW_BY_USER_OLDER_90D=278]="FILE_LATEST_VIEW_BY_USER_OLDER_90D",m[m.FILE_HAS_DMS_WITH_CREATOR_V2=290]="FILE_HAS_DMS_WITH_CREATOR_V2",m[m.FILE_IS_SFDC_LIST=309]="FILE_IS_SFDC_LIST",m[m.APP_NAME_PREFIX_MATCH=215]="APP_NAME_PREFIX_MATCH",m[m.BEST_NAME_MATCH_LOG_RESULTS=218]="BEST_NAME_MATCH_LOG_RESULTS",m[m.SHORTCUT_ENTITY_TYPE_CTR=226]="SHORTCUT_ENTITY_TYPE_CTR",m[m.TYPE_SLASH_COMMAND=212]="TYPE_SLASH_COMMAND",m[m.SLASH_COMMAND_TEAM_CTR=227]="SLASH_COMMAND_TEAM_CTR",m[m.SLASH_COMMAND_USER_CTR=219]="SLASH_COMMAND_USER_CTR",m[m.TYPE_GLOBAL_ACTION=213]="TYPE_GLOBAL_ACTION",m[m.IS_INVITE_WORKSPACE=217]="IS_INVITE_WORKSPACE",m[m.GLOBAL_ACTION_TEAM_CTR=220]="GLOBAL_ACTION_TEAM_CTR",m[m.GLOBAL_ACTION_USER_CTR=221]="GLOBAL_ACTION_USER_CTR",m[m.TYPE_CHANNEL_ACTION=214]="TYPE_CHANNEL_ACTION",m[m.CHANNEL_ACTION_TEAM_CTR=222]="CHANNEL_ACTION_TEAM_CTR",m[m.CHANNEL_ACTION_USER_CTR=223]="CHANNEL_ACTION_USER_CTR",m[m.TYPE_APP_ACTION=152]="TYPE_APP_ACTION",m[m.APP_ACTION_TEAM_CTR=224]="APP_ACTION_TEAM_CTR",m[m.APP_ACTION_USER_CTR=225]="APP_ACTION_USER_CTR",m[m.OS_APP_ACTION=228]="OS_APP_ACTION",m[m.TYPE_APP=216]="TYPE_APP",m[m.TYPE_NAVIGATION_MESSAGE=255]="TYPE_NAVIGATION_MESSAGE",m[m.TYPE_WORKFLOW_TRIGGER=256]="TYPE_WORKFLOW_TRIGGER",m[m.WORKFLOW_TRIGGER_TEAM_CTR=279]="WORKFLOW_TRIGGER_TEAM_CTR",m[m.WORKFLOW_TRIGGER_USER_CTR=280]="WORKFLOW_TRIGGER_USER_CTR",m[m.HAS_CHANNEL_ASSOCIATION=281]="HAS_CHANNEL_ASSOCIATION",m[m.DEPRECATED_QUERY_SUGGESTION_SCORE=1]="DEPRECATED_QUERY_SUGGESTION_SCORE",m[m.DEPRECATED_TYPE_NAVIGATION_EXPERT_CHANNEL=29]="DEPRECATED_TYPE_NAVIGATION_EXPERT_CHANNEL",m[m.DEPRECATED_BM25_SCORE=30]="DEPRECATED_BM25_SCORE",m[m.DEPRECATED_NAV_EXCESS_STRING_LENGTH=34]="DEPRECATED_NAV_EXCESS_STRING_LENGTH",m[m.DEPRECATED_CHANNEL_EXCESS_STRING_LENGTH=58]="DEPRECATED_CHANNEL_EXCESS_STRING_LENGTH",m[m.DEPRECATED_USER_EXCESS_STRING_LENGTH=59]="DEPRECATED_USER_EXCESS_STRING_LENGTH",m[m.DEPRECATED_MPIM_EXCESS_STRING_LENGTH=60]="DEPRECATED_MPIM_EXCESS_STRING_LENGTH",m[m.DEPRECATED_LOG_FRECENCY=67]="DEPRECATED_LOG_FRECENCY",m[m.DEPRECATED_LOG_FRECENCY_BONUS=77]="DEPRECATED_LOG_FRECENCY_BONUS",m[m.DEPRECATED_LOG_FRECENCY_CHANNEL=78]="DEPRECATED_LOG_FRECENCY_CHANNEL",m[m.DEPRECATED_LOG_FRECENCY_USER=79]="DEPRECATED_LOG_FRECENCY_USER",m[m.DEPRECATED_LOG_FRECENCY_MPIM=80]="DEPRECATED_LOG_FRECENCY_MPIM",m[m.DEPRECATED_EMOJI_SCORE_BONUS=135]="DEPRECATED_EMOJI_SCORE_BONUS",m[m.TEST_FEATURE_1=1e3]="TEST_FEATURE_1",m[m.TEST_FEATURE_2=1001]="TEST_FEATURE_2",m[m.TEST_FEATURE_3=1002]="TEST_FEATURE_3",m[m.TEST_FEATURE_4=1003]="TEST_FEATURE_4",m[m.TEST_FEATURE_5=1004]="TEST_FEATURE_5",m[m.TEST_FEATURE_6=1005]="TEST_FEATURE_6",m[m.TEST_FEATURE_7=1006]="TEST_FEATURE_7",m[m.TEST_FEATURE_8=1007]="TEST_FEATURE_8",m[m.TEST_FEATURE_9=1008]="TEST_FEATURE_9",m[m.TEST_FEATURE_10=1009]="TEST_FEATURE_10",m),I=((_={})[_.NUMERICAL=1]="NUMERICAL",_[_.BINARY=2]="BINARY",_[_.TEXT=3]="TEXT",_)},0x21fa18925:(o,p,f)=>{"use strict";f.d(p,{i1:()=>I});var m=f(0x15ee65f83),_=f(0x13ffa45d4);let w=(0,m.w)(" "),I=(0,_.Z)(w,3)},0x4a33e69:(o,p,f)=>{"use strict";f.d(p,{Ae:()=>O,Om:()=>U,Q7:()=>B,VG:()=>Z,br:()=>ee,e$:()=>q,e4:()=>L,lP:()=>x,xD:()=>$});var m,_,w,I=f(0x15ee65f83),k=f(0x13ffa45d4);let M=(0,I.w)(" "),x=(0,k.Z)(M,0);var O=((m={})[m.Unknown_reaction_type=0]="Unknown_reaction_type",m[m.Effect=1]="Effect",m[m.Standard=2]="Standard",m[m.Gif=3]="Gif",m);let L=(0,k.Z)(M,0,3);var B=((_={})[_.UNKNOWN_DRAW_TYPE=0]="UNKNOWN_DRAW_TYPE",_[_.NEW=1]="NEW",_[_.EDIT=2]="EDIT",_[_.END=3]="END",_[_.CHANGE_HUE=4]="CHANGE_HUE",_[_.POSITION=5]="POSITION",_),U=((w={})[w.UNKNOWN_TYPE=0]="UNKNOWN_TYPE",w[w.SUMMARY=1]="SUMMARY",w);let $=(0,k.Z)(M,0,10),q=(0,k.Z)(M,0,11),Z=(0,k.Z)(M,0,12),ee=(0,k.Z)(M,0,13)},0x11d924e73:(o,p,f)=>{"use strict";f.d(p,{j:()=>m});let m={Active:"active",Eligible:"eligible"}},0xff3799b7:(o,p,f)=>{"use strict";f.d(p,{X:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("activity.feed generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"activity.feed",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to activity.feed
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"activityFeedFetcher",key:"createFetcherActivityFeedFetcher",description:"activity.feed generated fetcher"}},0x20dc45706:(o,p,f)=>{"use strict";f.d(p,{h:()=>x,u:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={QueryFailed:"query_failed",InvalidInput:"invalid_input",QueryIncomplete:"query_incomplete",UnauthorizedEnv:"unauthorized_env"},x=(0,w.A)("analytics.clogData generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"analytics.clogData",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to analytics.clogData
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"analyticsClogDataFetcher",key:"createFetcherAnalyticsClogDataFetcher",description:"analytics.clogData generated fetcher"}},0x14444f66c:(o,p,f)=>{"use strict";f.d(p,{O:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("connectInvites.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"connectInvites.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to connectInvites.list
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"connectInvitesListFetcher",key:"createFetcherConnectInvitesListFetcher",description:"connectInvites.list generated fetcher"}},0xadf93c56:(o,p,f)=>{"use strict";f.d(p,{T:()=>M,W:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={ChannelConversionInProgress:"channel_conversion_in_progress",ConnectionLimitExceeded:"connection_limit_exceeded",EmailDoesNotMatch:"email_does_not_match",FailedToStartTrial:"failed_to_start_trial",HasAlreadyConnectedToOrg:"has_already_connected_to_org",InvalidArguments:"invalid_arguments",InvalidEmojiNotAllowed:"invalid_emoji_not_allowed",InvalidHostTeam:"invalid_host_team",InvalidLink:"invalid_link",InvalidName:"invalid_name",InvalidNameMaxlength:"invalid_name_maxlength",InvalidNamePunctuation:"invalid_name_punctuation",InvalidNameRequired:"invalid_name_required",InvalidNameSpecials:"invalid_name_specials",InviteFromSameOrg:"invite_from_same_org",InviteNotFound:"invite_not_found",InvalidPrivacy:"invalid_privacy",InvalidRecipientTeam:"invalid_recipient_team",InvalidTargetTeam:"invalid_target_team",InviteUsed:"invite_used",IsPendingConnectedToOrg:"is_pending_connected_to_org",LegacyConnectionInvalidOrg:"legacy_connection_invalid_org",LegacyConnectionLimitExceeded:"legacy_connection_limit_exceeded",NameTaken:"name_taken",NotAllowedForGridWorkspace:"not_allowed_for_grid_workspace",NotPaid:"not_paid",RestrictedAction:"restricted_action",TeamNotFound:"team_not_found",UserCannotCreateChannel:"user_cannot_create_channel",UserIsRestricted:"user_is_restricted",UserNotFound:"user_not_found",UserRequiredToAcceptAsPrivateButCannot:"user_required_to_accept_as_private_but_cannot"},x=(0,w.A)("conversations.acceptSharedInvite generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.acceptSharedInvite",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.acceptSharedInvite
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"conversationsAcceptSharedInviteFetcher",key:"createFetcherConversationsAcceptSharedInviteFetcher",description:"conversations.acceptSharedInvite generated fetcher"}},0x164b95e6a:(o,p,f)=>{"use strict";f.d(p,{_:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("conversations.info generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.info",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.info
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"conversationsInfoFetcher",key:"createFetcherConversationsInfoFetcher",description:"conversations.info generated fetcher"}},0x8c156709:(o,p,f)=>{"use strict";f.d(p,{U:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("conversations.listPrefs generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.listPrefs",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.listPrefs
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"conversationsListPrefsFetcher",key:"createFetcherConversationsListPrefsFetcher",description:"conversations.listPrefs generated fetcher"}},0x1dc28e3a1:(o,p,f)=>{"use strict";f.d(p,{Sv:()=>M,a0:()=>O,jB:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={Unknown:"unknown",UserCannotCreateChannel:"user_cannot_create_channel",IsPendingConnectedToOrg:"is_pending_connected_to_org",HasAlreadyConnectedToOrg:"has_already_connected_to_org",EmailDoesNotMatch:"email_does_not_match",InviteFromSameOrg:"invite_from_same_org",UserIsRestricted:"user_is_restricted",NotAllowedForGridWorkspace:"not_allowed_for_grid_workspace",GridWorkspaceRequired:"grid_workspace_required",RestrictedAction:"restricted_action",ConnectionLimitExceeded:"connection_limit_exceeded",LegacyConnectionLimitExceeded:"legacy_connection_limit_exceeded",LegacyConnectionInvalidOrg:"legacy_connection_invalid_org",UserRequiredToAcceptAsPrivateButCannot:"user_required_to_accept_as_private_but_cannot",NotPaid:"not_paid",UpgradeRequiredButUserCannot:"upgrade_required_but_user_cannot",InvalidRecipientTeam:"invalid_recipient_team"},x={InvalidArguments:"invalid_arguments",InviteNotFound:"invite_not_found",TeamNotFound:"team_not_found",UserNotFound:"user_not_found",DomainClaimed:"domain_claimed"},O=(0,w.A)("conversations.sharedInviteAcceptanceEligibility generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.sharedInviteAcceptanceEligibility",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.sharedInviteAcceptanceEligibility
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));O.meta={name:"conversationsSharedInviteAcceptanceEligibilityFetcher",key:"createFetcherConversationsSharedInviteAcceptanceEligibilityFetcher",description:"conversations.sharedInviteAcceptanceEligibility generated fetcher"}},0x1c429b447:(o,p,f)=>{"use strict";f.d(p,{D:()=>x,G:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={FeatureNotEnabled:"feature_not_enabled",InviteNotFound:"invite_not_found",WorkspaceNotFound:"workspace_not_found",OperationNotAllowed:"operation_not_allowed",ExternalWorkspaceLimitReached:"external_workspace_limit_reached",FailedToFetchTermsOfService:"failed_to_fetch_terms_of_service",TermsOfServiceNotAccepted:"terms_of_service_not_accepted",GuestUserNotAllowed:"guest_user_not_allowed",EmailDoesNotMatch:"email_does_not_match",InvalidRecipientTeam:"invalid_recipient_team",DomainClaimed:"domain_claimed",NotPaid:"not_paid"},x=(0,w.A)("externalWorkspaces.invites.accept generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"externalWorkspaces.invites.accept",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to externalWorkspaces.invites.accept
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"externalWorkspacesInvitesAcceptFetcher",key:"createFetcherExternalWorkspacesInvitesAcceptFetcher",description:"externalWorkspaces.invites.accept generated fetcher"}},0xa676c83f:(o,p,f)=>{"use strict";f.d(p,{I:()=>M,l:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={InviteNotFound:"invite_not_found",InviteInvalid:"invite_invalid",RateLimited:"rate_limited",InviteUsed:"invite_used",FailedGeneratingInviteOutput:"failed_generating_invite_output"},x=(0,w.A)("externalWorkspaces.invites.info generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"externalWorkspaces.invites.info",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to externalWorkspaces.invites.info
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"externalWorkspacesInvitesInfoFetcher",key:"createFetcherExternalWorkspacesInvitesInfoFetcher",description:"externalWorkspaces.invites.info generated fetcher"}},0x87ff5a19:(o,p,f)=>{"use strict";f.d(p,{I:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("help.issues.ticketStats generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"help.issues.ticketStats",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to help.issues.ticketStats
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpIssuesTicketStatsFetcher",key:"createFetcherHelpIssuesTicketStatsFetcher",description:"help.issues.ticketStats generated fetcher"}},0xc20486ad:(o,p,f)=>{"use strict";f.d(p,{l:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("help.productHelpCard.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"help.productHelpCard.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to help.productHelpCard.list
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpProductHelpCardListFetcher",key:"createFetcherHelpProductHelpCardListFetcher",description:"help.productHelpCard.list generated fetcher"}},0x1f1fa752e:(o,p,f)=>{"use strict";f.d(p,{G:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("helpdesk.categories generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"helpdesk.categories",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to helpdesk.categories
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpdeskCategoriesFetcher",key:"createFetcherHelpdeskCategoriesFetcher",description:"helpdesk.categories generated fetcher"}},0x1200f8ad6:(o,p,f)=>{"use strict";f.d(p,{h:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("helpdesk.getSectionsAndArticlesByCategory generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"helpdesk.getSectionsAndArticlesByCategory",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to helpdesk.getSectionsAndArticlesByCategory
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpdeskGetSectionsAndArticlesByCategoryFetcher",key:"createFetcherHelpdeskGetSectionsAndArticlesByCategoryFetcher",description:"helpdesk.getSectionsAndArticlesByCategory generated fetcher"}},0x1257faab2:(o,p,f)=>{"use strict";f.d(p,{a:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("helpdesk.get generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"helpdesk.get",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to helpdesk.get
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpdeskGetFetcher",key:"createFetcherHelpdeskGetFetcher",description:"helpdesk.get generated fetcher"}},0x14691160d:(o,p,f)=>{"use strict";f.d(p,{z:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("lists.records.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"lists.records.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to lists.records.list
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"listsRecordsListFetcher",key:"createFetcherListsRecordsListFetcher",description:"lists.records.list generated fetcher"}},0x1e1870ede:(o,p,f)=>{"use strict";f.d(p,{u:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("megaphone.visualizer.notifications.get generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"megaphone.visualizer.notifications.get",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to megaphone.visualizer.notifications.get
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"megaphoneVisualizerNotificationsGetFetcher",key:"createFetcherMegaphoneVisualizerNotificationsGetFetcher",description:"megaphone.visualizer.notifications.get generated fetcher"}},0x160dba631:(o,p,f)=>{"use strict";f.d(p,{l:()=>k});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3);let k=(0,w.A)("onboarding.fetch generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:k,reason:M,...x}=f;o((0,_.apiCall)({method:"onboarding.fetch",args:x,abortSignal:k,reason:M})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to onboarding.fetch
						with reason ${M} failed, initiated by generated fetcher`),w(o)})}));k.meta={name:"onboardingFetchFetcher",key:"createFetcherOnboardingFetchFetcher",description:"onboarding.fetch generated fetcher"}},0x171e9fa85:(o,p,f)=>{"use strict";f.d(p,{n:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("payments.checkout.config generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"payments.checkout.config",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to payments.checkout.config
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"paymentsCheckoutConfigFetcher",key:"createFetcherPaymentsCheckoutConfigFetcher",description:"payments.checkout.config generated fetcher"}},0x1f0b97483:(o,p,f)=>{"use strict";f.d(p,{b:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("payments.status.get generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"payments.status.get",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to payments.status.get
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"paymentsStatusGetFetcher",key:"createFetcherPaymentsStatusGetFetcher",description:"payments.status.get generated fetcher"}},0x161b73cc3:(o,p,f)=>{"use strict";f.d(p,{T:()=>x,W:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={AlreadyPinned:"already_pinned",BadTimestamp:"bad_timestamp",ChannelNotFound:"channel_not_found",ExternalChannelMigrating:"external_channel_migrating",FileNotFound:"file_not_found",FileNotShared:"file_not_shared",MessageNotFound:"message_not_found",NoItemSpecified:"no_item_specified",NotInChannel:"not_in_channel",NotPinnable:"not_pinnable",RestrictedAction:"restricted_action",TooManyPins:"too_many_pins"},x=(0,w.A)("pins.add generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"pins.add",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to pins.add
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"pinsAddFetcher",key:"createFetcherPinsAddFetcher",description:"pins.add generated fetcher"}},0x1adb11c14:(o,p,f)=>{"use strict";f.d(p,{u:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("pins.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"pins.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to pins.list
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"pinsListFetcher",key:"createFetcherPinsListFetcher",description:"pins.list generated fetcher"}},0x1bb57acec:(o,p,f)=>{"use strict";f.d(p,{w:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("pins.remove generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"pins.remove",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to pins.remove
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"pinsRemoveFetcher",key:"createFetcherPinsRemoveFetcher",description:"pins.remove generated fetcher"}},0x1930533e1:(o,p,f)=>{"use strict";f.d(p,{Q:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("rooms.inviteResponse generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.inviteResponse",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.inviteResponse
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"roomsInviteResponseFetcher",key:"createFetcherRoomsInviteResponseFetcher",description:"rooms.inviteResponse generated fetcher"}},0x22dfce16c:(o,p,f)=>{"use strict";f.d(p,{g:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={InvalidUser:"invalid_user",ChannelNotFound:"channel_not_found",InvalidChannelId:"invalid_channel_id",PermissionDenied:"permission_denied",CannotInviteExternal:"cannot_invite_external",InviteFailed:"invite_failed",HuddleNotFound:"huddle_not_found",TeamNotFound:"team_not_found",MaxPotentialParticipants:"max_potential_participants",RecipientHuddlesDisabled:"recipient_huddles_disabled",FreemiumMaxParticipants:"freemium_max_participants"};(0,w.A)("rooms.notifyMember generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.notifyMember",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.notifyMember
						with reason ${x} failed, initiated by generated fetcher`),w(o)})})).meta={name:"roomsNotifyMemberFetcher",key:"createFetcherRoomsNotifyMemberFetcher",description:"rooms.notifyMember generated fetcher"}},0x11becc36f:(o,p,f)=>{"use strict";f.d(p,{i:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("rooms.startTranscription generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.startTranscription",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.startTranscription
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"roomsStartTranscriptionFetcher",key:"createFetcherRoomsStartTranscriptionFetcher",description:"rooms.startTranscription generated fetcher"}},0x2317cea27:(o,p,f)=>{"use strict";f.d(p,{W:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("rooms.stopTranscription generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.stopTranscription",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.stopTranscription
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"roomsStopTranscriptionFetcher",key:"createFetcherRoomsStopTranscriptionFetcher",description:"rooms.stopTranscription generated fetcher"}},0x173d2b811:(o,p,f)=>{"use strict";f.d(p,{z:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("search.autocomplete.topEngagedFiles generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"search.autocomplete.topEngagedFiles",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to search.autocomplete.topEngagedFiles
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"searchAutocompleteTopEngagedFilesFetcher",key:"createFetcherSearchAutocompleteTopEngagedFilesFetcher",description:"search.autocomplete.topEngagedFiles generated fetcher"}},0x98b79679:(o,p,f)=>{"use strict";f.d(p,{v:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("search.autocomplete.triggers generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"search.autocomplete.triggers",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to search.autocomplete.triggers
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"searchAutocompleteTriggersFetcher",key:"createFetcherSearchAutocompleteTriggersFetcher",description:"search.autocomplete.triggers generated fetcher"}},0xe55c52c1:(o,p,f)=>{"use strict";f.d(p,{Z:()=>x,q:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={MissingArgument:"missing_argument",NotPaid:"not_paid",InvalidLink:"invalid_link",InviteInactive:"invite_inactive",InviteAlreadyUsed:"invite_already_used",InviteNotAllowed:"invite_not_allowed",AcceptNotAllowed:"accept_not_allowed",FeatureDisabled:"feature_disabled",OrgsSevered:"orgs_severed",InternalError:"internal_error",CustomInvitesNotSupported:"custom_invites_not_supported",InvalidRecipientTeam:"invalid_recipient_team",EmailDoesNotMatch:"email_does_not_match",SlackConnectDmNotAllowedOnTeam:"slack_connect_dm_not_allowed_on_team",InviteNotFound:"invite_not_found"},x=(0,w.A)("sharedInvites.accept generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"sharedInvites.accept",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to sharedInvites.accept
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"sharedInvitesAcceptFetcher",key:"createFetcherSharedInvitesAcceptFetcher",description:"sharedInvites.accept generated fetcher"}},0x104b72550:(o,p,f)=>{"use strict";f.d(p,{K:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("team.feature.request generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"team.feature.request",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to team.feature.request
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"teamFeatureRequestFetcher",key:"createFetcherTeamFeatureRequestFetcher",description:"team.feature.request generated fetcher"}},0x23561f5d7:(o,p,f)=>{"use strict";f.d(p,{p:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("teams.trials.info generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"teams.trials.info",args:L,abortSignal:M,reason:x})).then(o=>{m((0,k.XK)(o))}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to teams.trials.info
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"teamsTrialsInfoFetcher",key:"createFetcherTeamsTrialsInfoFetcher",description:"teams.trials.info generated fetcher"}},0x1d2c85d59:(o,p,f)=>{"use strict";f.d(p,{k:()=>M,n:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={BadUsername:"bad_username",CannotUpdateAdminUser:"cannot_update_admin_user",EmailBad:"email_bad",EmailTaken:"email_taken",DisplayNameNotAllowed:"display_name_not_allowed",InvalidNamePunctuation:"invalid_name_punctuation",InvalidNameRequired:"invalid_name_required",InvalidNameSpecials:"invalid_name_specials",InvalidProfile:"invalid_profile",InvalidReservedWord:"invalid_reserved_word",InvalidUser:"invalid_user",LongUsername:"long_username",MustClearBothStatusTextAndStatusEmoji:"must_clear_both_status_text_and_status_emoji",NameNotAllowed:"name_not_allowed",NotAdmin:"not_admin",NotAppAdmin:"not_app_admin",PartialProfileSetFailed:"partial_profile_set_failed",ProfileSetFailed:"profile_set_failed",ProfileStatusSetFailedNotEmojiSyntax:"profile_status_set_failed_not_emoji_syntax",ProfileStatusSetFailedNotValidEmoji:"profile_status_set_failed_not_valid_emoji",ProfileStatusSetFailedWritingExpiration:"profile_status_set_failed_writing_expiration",ReadOnlyProfileField:"read_only_profile_field",ReservedName:"reserved_name",SudoRequired:"sudo_required",TooLong:"too_long",UserNotFound:"user_not_found",UserNotSpecified:"user_not_specified",UserRemovedFromTeam:"user_removed_from_team",UsernameEmpty:"username_empty",UsernameTaken:"username_taken",CannotUpdateStatus:"cannot_update_status",PermissionDenied:"permission_denied",UsernameSame:"username_same",InvalidEmojiNotAllowed:"invalid_emoji_not_allowed",InvalidOooMessage:"invalid_ooo_message",InvalidStartsWithAt:"invalid_starts_with_at"},x=(0,w.A)("users.profile.set generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"users.profile.set",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to users.profile.set
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"usersProfileSetFetcher",key:"createFetcherUsersProfileSetFetcher",description:"users.profile.set generated fetcher"}},0x238e7f805:(o,p,f)=>{"use strict";f.d(p,{B:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("workflows.triggers.tripPreCheck generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"workflows.triggers.tripPreCheck",args:L,abortSignal:M,reason:x})).then(o=>{m((0,k.XK)(o))}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to workflows.triggers.tripPreCheck
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"workflowsTriggersTripPreCheckFetcher",key:"createFetcherWorkflowsTriggersTripPreCheckFetcher",description:"workflows.triggers.tripPreCheck generated fetcher"}},0x1da389b54:(o,p,f)=>{"use strict";f.d(p,{d:()=>M,e:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={UnknownMethod:"unknown_method",AccessDenied:"access_denied",CannotTripNonWorkflowFunction:"cannot_trip_non_workflow_function",InvalidUrl:"invalid_url",InvalidContext:"invalid_context",TriggerNotFound:"trigger_not_found",FunctionNotFound:"function_not_found",ParameterValidationFailed:"parameter_validation_failed",InvalidInteractiveTriggerInputs:"invalid_interactive_trigger_inputs",InvalidTriggerInput:"invalid_trigger_input",WorkflowNotPublished:"workflow_not_published",UnableToFindUserInChannelForTrigger:"unable_to_find_user_in_channel_for_trigger",ProviderNotFound:"provider_not_found",MissingOauthToken:"missing_oauth_token",InvalidChannel:"invalid_channel",InvalidMessage:"invalid_message",InvalidBlockId:"invalid_block_id",InvalidActionId:"invalid_action_id",InputTriggerUrlDoesntMatchButtonTriggerUrl:"input_trigger_url_doesnt_match_button_trigger_url",InvalidSpeedbumpCustomizableInputParameters:"invalid_speedbump_customizable_input_parameters",CommunicationDisabled:"communication_disabled",InvalidTriggerType:"invalid_trigger_type",NotOptedIntoOverages:"not_opted_into_overages",ReachedUpperSpendLimit:"reached_upper_spend_limit",FreeTeamNotAllowed:"free_team_not_allowed",PretripAckRequired:"pretrip_ack_required"},x=(0,w.A)("workflows.triggers.trip generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"workflows.triggers.trip",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to workflows.triggers.trip
						with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"workflowsTriggersTripFetcher",key:"createFetcherWorkflowsTriggersTripFetcher",description:"workflows.triggers.trip generated fetcher"}},0xce04fe24:(o,p,f)=>{"use strict";f.d(p,{U:()=>m});let m={AllContent:"all_content",SelectedSources:"selected_sources"}},0x15e7d1996:(o,p,f)=>{"use strict";f.d(p,{k:()=>m});let m={NotPaid:"not_paid",InvalidLink:"invalid_link",InviteInactive:"invite_inactive",InviteAlreadyUsed:"invite_already_used",InviteNotAllowed:"invite_not_allowed",AcceptNotAllowed:"accept_not_allowed",OrgsSevered:"orgs_severed",OrgNotVerified:"org_not_verified",UserIsRestricted:"user_is_restricted",InvalidRecipientTeam:"invalid_recipient_team",EmailDoesNotMatch:"email_does_not_match",Generic:"generic",SlackConnectDmNotAllowedOnTeam:"slack_connect_dm_not_allowed_on_team"}},0x1d9cb8d92:(o,p,f)=>{"use strict";f.d(p,{t:()=>m});let m={PendingApproval:"pending_approval",Approved:"approved",Rejected:"rejected",Expired:"expired"}},0x11bfbac9:(o,p,f)=>{"use strict";f.d(p,{c:()=>m});let m={Sent:"sent",Expired:"expired",Revoked:"revoked",Requested:"requested"}},0xfaf2a52c:(o,p,f)=>{"use strict";f.d(p,{D:()=>m,z:()=>_});let m={Incoming:"incoming",Outgoing:"outgoing"},_={Incoming:"incoming",Outgoing:"outgoing"}},0x23ebbcda7:(o,p,f)=>{"use strict";f.d(p,{k:()=>m});let m={Channel:"channel",Im:"im",Workspace:"workspace"}},0x93c830b7:(o,p,f)=>{"use strict";f.d(p,{S:()=>m});let m={ActionItem:"action_item",LatestUnreadAndActivity:"latest_unread_and_activity",Topic:"topic",SuggestedTopic:"suggested_topic",StalledConversations:"stalled_conversations",FocusTopic:"focus_topic"}},0x510b1d7f:(o,p,f)=>{"use strict";let m;f.r(p),f.d(p,{$Command:()=>Command,AllowNotifications:()=>tq,AssociateChannelFlowCommand:()=>AssociateChannelFlowCommand,BadRequestException:()=>BadRequestException,BatchChannelMembershipsFilterSensitiveLog:()=>BatchChannelMembershipsFilterSensitiveLog,BatchCreateChannelMembershipCommand:()=>BatchCreateChannelMembershipCommand,BatchCreateChannelMembershipResponseFilterSensitiveLog:()=>BatchCreateChannelMembershipResponseFilterSensitiveLog,ChannelAssociatedWithFlowSummaryFilterSensitiveLog:()=>ChannelAssociatedWithFlowSummaryFilterSensitiveLog,ChannelBanFilterSensitiveLog:()=>ChannelBanFilterSensitiveLog,ChannelBanSummaryFilterSensitiveLog:()=>ChannelBanSummaryFilterSensitiveLog,ChannelFilterSensitiveLog:()=>ChannelFilterSensitiveLog,ChannelFlowCallbackCommand:()=>ChannelFlowCallbackCommand,ChannelFlowCallbackRequestFilterSensitiveLog:()=>ChannelFlowCallbackRequestFilterSensitiveLog,ChannelFlowFilterSensitiveLog:()=>ChannelFlowFilterSensitiveLog,ChannelFlowSummaryFilterSensitiveLog:()=>ChannelFlowSummaryFilterSensitiveLog,ChannelMembershipFilterSensitiveLog:()=>ChannelMembershipFilterSensitiveLog,ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog:()=>ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog,ChannelMembershipPreferencesFilterSensitiveLog:()=>ChannelMembershipPreferencesFilterSensitiveLog,ChannelMembershipSummaryFilterSensitiveLog:()=>ChannelMembershipSummaryFilterSensitiveLog,ChannelMembershipType:()=>tJ,ChannelMessageCallbackFilterSensitiveLog:()=>ChannelMessageCallbackFilterSensitiveLog,ChannelMessageFilterSensitiveLog:()=>ChannelMessageFilterSensitiveLog,ChannelMessagePersistenceType:()=>t3,ChannelMessageStatus:()=>t4,ChannelMessageSummaryFilterSensitiveLog:()=>ChannelMessageSummaryFilterSensitiveLog,ChannelMessageType:()=>t5,ChannelMode:()=>tQ,ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog:()=>ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog,ChannelModeratorFilterSensitiveLog:()=>ChannelModeratorFilterSensitiveLog,ChannelModeratorSummaryFilterSensitiveLog:()=>ChannelModeratorSummaryFilterSensitiveLog,ChannelPrivacy:()=>tZ,ChannelSummaryFilterSensitiveLog:()=>ChannelSummaryFilterSensitiveLog,ChimeSDKMessaging:()=>ChimeSDKMessaging,ChimeSDKMessagingClient:()=>ChimeSDKMessagingClient,ChimeSDKMessagingServiceException:()=>ChimeSDKMessagingServiceException,ConflictException:()=>ConflictException,CreateChannelBanCommand:()=>CreateChannelBanCommand,CreateChannelBanResponseFilterSensitiveLog:()=>CreateChannelBanResponseFilterSensitiveLog,CreateChannelCommand:()=>CreateChannelCommand,CreateChannelFlowCommand:()=>CreateChannelFlowCommand,CreateChannelFlowRequestFilterSensitiveLog:()=>CreateChannelFlowRequestFilterSensitiveLog,CreateChannelMembershipCommand:()=>CreateChannelMembershipCommand,CreateChannelMembershipResponseFilterSensitiveLog:()=>CreateChannelMembershipResponseFilterSensitiveLog,CreateChannelModeratorCommand:()=>CreateChannelModeratorCommand,CreateChannelModeratorResponseFilterSensitiveLog:()=>CreateChannelModeratorResponseFilterSensitiveLog,CreateChannelRequestFilterSensitiveLog:()=>CreateChannelRequestFilterSensitiveLog,DeleteChannelBanCommand:()=>DeleteChannelBanCommand,DeleteChannelCommand:()=>DeleteChannelCommand,DeleteChannelFlowCommand:()=>DeleteChannelFlowCommand,DeleteChannelMembershipCommand:()=>DeleteChannelMembershipCommand,DeleteChannelMessageCommand:()=>DeleteChannelMessageCommand,DeleteChannelModeratorCommand:()=>DeleteChannelModeratorCommand,DeleteMessagingStreamingConfigurationsCommand:()=>DeleteMessagingStreamingConfigurationsCommand,DescribeChannelBanCommand:()=>DescribeChannelBanCommand,DescribeChannelBanResponseFilterSensitiveLog:()=>DescribeChannelBanResponseFilterSensitiveLog,DescribeChannelCommand:()=>DescribeChannelCommand,DescribeChannelFlowCommand:()=>DescribeChannelFlowCommand,DescribeChannelFlowResponseFilterSensitiveLog:()=>DescribeChannelFlowResponseFilterSensitiveLog,DescribeChannelMembershipCommand:()=>DescribeChannelMembershipCommand,DescribeChannelMembershipForAppInstanceUserCommand:()=>DescribeChannelMembershipForAppInstanceUserCommand,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog:()=>DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog,DescribeChannelMembershipResponseFilterSensitiveLog:()=>DescribeChannelMembershipResponseFilterSensitiveLog,DescribeChannelModeratedByAppInstanceUserCommand:()=>DescribeChannelModeratedByAppInstanceUserCommand,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog,DescribeChannelModeratorCommand:()=>DescribeChannelModeratorCommand,DescribeChannelModeratorResponseFilterSensitiveLog:()=>DescribeChannelModeratorResponseFilterSensitiveLog,DescribeChannelResponseFilterSensitiveLog:()=>DescribeChannelResponseFilterSensitiveLog,DisassociateChannelFlowCommand:()=>DisassociateChannelFlowCommand,ErrorCode:()=>tY,ExpirationCriterion:()=>tX,FallbackAction:()=>t1,ForbiddenException:()=>ForbiddenException,GetChannelMembershipPreferencesCommand:()=>GetChannelMembershipPreferencesCommand,GetChannelMembershipPreferencesResponseFilterSensitiveLog:()=>GetChannelMembershipPreferencesResponseFilterSensitiveLog,GetChannelMessageCommand:()=>GetChannelMessageCommand,GetChannelMessageResponseFilterSensitiveLog:()=>GetChannelMessageResponseFilterSensitiveLog,GetChannelMessageStatusCommand:()=>GetChannelMessageStatusCommand,GetMessagingSessionEndpointCommand:()=>GetMessagingSessionEndpointCommand,GetMessagingStreamingConfigurationsCommand:()=>GetMessagingStreamingConfigurationsCommand,IdentityFilterSensitiveLog:()=>IdentityFilterSensitiveLog,InvocationType:()=>t0,ListChannelBansCommand:()=>ListChannelBansCommand,ListChannelBansRequestFilterSensitiveLog:()=>ListChannelBansRequestFilterSensitiveLog,ListChannelBansResponseFilterSensitiveLog:()=>ListChannelBansResponseFilterSensitiveLog,ListChannelFlowsCommand:()=>ListChannelFlowsCommand,ListChannelFlowsRequestFilterSensitiveLog:()=>ListChannelFlowsRequestFilterSensitiveLog,ListChannelFlowsResponseFilterSensitiveLog:()=>ListChannelFlowsResponseFilterSensitiveLog,ListChannelMembershipsCommand:()=>ListChannelMembershipsCommand,ListChannelMembershipsForAppInstanceUserCommand:()=>ListChannelMembershipsForAppInstanceUserCommand,ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog:()=>ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog:()=>ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog,ListChannelMembershipsRequestFilterSensitiveLog:()=>ListChannelMembershipsRequestFilterSensitiveLog,ListChannelMembershipsResponseFilterSensitiveLog:()=>ListChannelMembershipsResponseFilterSensitiveLog,ListChannelMessagesCommand:()=>ListChannelMessagesCommand,ListChannelMessagesRequestFilterSensitiveLog:()=>ListChannelMessagesRequestFilterSensitiveLog,ListChannelMessagesResponseFilterSensitiveLog:()=>ListChannelMessagesResponseFilterSensitiveLog,ListChannelModeratorsCommand:()=>ListChannelModeratorsCommand,ListChannelModeratorsRequestFilterSensitiveLog:()=>ListChannelModeratorsRequestFilterSensitiveLog,ListChannelModeratorsResponseFilterSensitiveLog:()=>ListChannelModeratorsResponseFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowCommand:()=>ListChannelsAssociatedWithChannelFlowCommand,ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog:()=>ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog:()=>ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog,ListChannelsCommand:()=>ListChannelsCommand,ListChannelsModeratedByAppInstanceUserCommand:()=>ListChannelsModeratedByAppInstanceUserCommand,ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog:()=>ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog,ListChannelsRequestFilterSensitiveLog:()=>ListChannelsRequestFilterSensitiveLog,ListChannelsResponseFilterSensitiveLog:()=>ListChannelsResponseFilterSensitiveLog,ListSubChannelsCommand:()=>ListSubChannelsCommand,ListSubChannelsRequestFilterSensitiveLog:()=>ListSubChannelsRequestFilterSensitiveLog,ListSubChannelsResponseFilterSensitiveLog:()=>ListSubChannelsResponseFilterSensitiveLog,ListTagsForResourceCommand:()=>ListTagsForResourceCommand,ListTagsForResourceResponseFilterSensitiveLog:()=>ListTagsForResourceResponseFilterSensitiveLog,MessageAttributeValueFilterSensitiveLog:()=>MessageAttributeValueFilterSensitiveLog,MessagingDataType:()=>t6,NotFoundException:()=>NotFoundException,ProcessorFilterSensitiveLog:()=>ProcessorFilterSensitiveLog,PushNotificationConfigurationFilterSensitiveLog:()=>PushNotificationConfigurationFilterSensitiveLog,PushNotificationPreferencesFilterSensitiveLog:()=>PushNotificationPreferencesFilterSensitiveLog,PushNotificationType:()=>t2,PutChannelExpirationSettingsCommand:()=>PutChannelExpirationSettingsCommand,PutChannelMembershipPreferencesCommand:()=>PutChannelMembershipPreferencesCommand,PutChannelMembershipPreferencesRequestFilterSensitiveLog:()=>PutChannelMembershipPreferencesRequestFilterSensitiveLog,PutChannelMembershipPreferencesResponseFilterSensitiveLog:()=>PutChannelMembershipPreferencesResponseFilterSensitiveLog,PutMessagingStreamingConfigurationsCommand:()=>PutMessagingStreamingConfigurationsCommand,RedactChannelMessageCommand:()=>RedactChannelMessageCommand,ResourceLimitExceededException:()=>ResourceLimitExceededException,SearchChannelsCommand:()=>SearchChannelsCommand,SearchChannelsRequestFilterSensitiveLog:()=>SearchChannelsRequestFilterSensitiveLog,SearchChannelsResponseFilterSensitiveLog:()=>SearchChannelsResponseFilterSensitiveLog,SearchFieldKey:()=>t9,SearchFieldOperator:()=>t7,SendChannelMessageCommand:()=>SendChannelMessageCommand,SendChannelMessageRequestFilterSensitiveLog:()=>SendChannelMessageRequestFilterSensitiveLog,ServiceFailureException:()=>ServiceFailureException,ServiceUnavailableException:()=>ServiceUnavailableException,SortOrder:()=>t8,TagFilterSensitiveLog:()=>TagFilterSensitiveLog,TagResourceCommand:()=>TagResourceCommand,TagResourceRequestFilterSensitiveLog:()=>TagResourceRequestFilterSensitiveLog,ThrottledClientException:()=>ThrottledClientException,UnauthorizedClientException:()=>UnauthorizedClientException,UntagResourceCommand:()=>UntagResourceCommand,UntagResourceRequestFilterSensitiveLog:()=>UntagResourceRequestFilterSensitiveLog,UpdateChannelCommand:()=>UpdateChannelCommand,UpdateChannelFlowCommand:()=>UpdateChannelFlowCommand,UpdateChannelFlowRequestFilterSensitiveLog:()=>UpdateChannelFlowRequestFilterSensitiveLog,UpdateChannelMessageCommand:()=>UpdateChannelMessageCommand,UpdateChannelMessageRequestFilterSensitiveLog:()=>UpdateChannelMessageRequestFilterSensitiveLog,UpdateChannelReadMarkerCommand:()=>UpdateChannelReadMarkerCommand,UpdateChannelRequestFilterSensitiveLog:()=>UpdateChannelRequestFilterSensitiveLog,__Client:()=>Client,paginateListChannelBans:()=>iR,paginateListChannelFlows:()=>iO,paginateListChannelMemberships:()=>iL,paginateListChannelMembershipsForAppInstanceUser:()=>iD,paginateListChannelMessages:()=>iN,paginateListChannelModerators:()=>iF,paginateListChannels:()=>iU,paginateListChannelsAssociatedWithChannelFlow:()=>iV,paginateListChannelsModeratedByAppInstanceUser:()=>iB,paginateListSubChannels:()=>ij,paginateSearchChannels:()=>iH}),(et=el||(el={})).HEADER="header",et.QUERY="query",(ei=ed||(ed={})).HEADER="header",ei.QUERY="query",(er=ec||(ec={})).HTTP="http",er.HTTPS="https",(en=eu||(eu={})).MD5="md5",en.CRC32="crc32",en.CRC32C="crc32c",en.SHA1="sha1",en.SHA256="sha256",(eo=eh||(eh={}))[eo.HEADER=0]="HEADER",eo[eo.TRAILER=1]="TRAILER";let _="__smithy_context";(es=ep||(ep={})).PROFILE="profile",es.SSO_SESSION="sso-session",es.SERVICES="services",(ea=ef||(ef={})).HTTP_0_9="http/0.9",ea.HTTP_1_0="http/1.0",ea.TDS_8_0="tds/8.0";let httpRequest_HttpRequest=class httpRequest_HttpRequest{constructor(o){this.method=o.method||"GET",this.hostname=o.hostname||"localhost",this.port=o.port,this.query=o.query||{},this.headers=o.headers||{},this.body=o.body,this.protocol=o.protocol?":"!==o.protocol.slice(-1)?`${o.protocol}:`:o.protocol:"https:",this.path=o.path?"/"!==o.path.charAt(0)?`/${o.path}`:o.path:"/",this.username=o.username,this.password=o.password,this.fragment=o.fragment}static clone(o){let p=new httpRequest_HttpRequest({...o,headers:{...o.headers}});return p.query&&(p.query=cloneQuery(p.query)),p}static isInstance(o){return!!o&&"method"in o&&"protocol"in o&&"hostname"in o&&"path"in o&&"object"==typeof o.query&&"object"==typeof o.headers}clone(){return httpRequest_HttpRequest.clone(this)}};function cloneQuery(o){return Object.keys(o).reduce((p,f)=>{let m=o[f];return{...p,[f]:Array.isArray(m)?[...m]:m}},{})}let HttpResponse=class HttpResponse{constructor(o){this.statusCode=o.statusCode,this.reason=o.reason,this.headers=o.headers||{},this.body=o.body}static isInstance(o){return!!o&&"number"==typeof o.statusCode&&"object"==typeof o.headers}};function resolveHostHeaderConfig(o){return o}let w={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},I={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},k="X-Amzn-Trace-Id",M={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};function resolveUserAgentConfig(o){return{...o,customUserAgent:"string"==typeof o.customUserAgent?[[o.customUserAgent]]:o.customUserAgent}}let EndpointCache=class EndpointCache{constructor({size:o,params:p}){this.data=new Map,this.parameters=[],this.capacity=o??50,p&&(this.parameters=p)}get(o,p){let f=this.hash(o);if(!1===f)return p();if(!this.data.has(f)){if(this.data.size>this.capacity+10){let o=this.data.keys(),p=0;for(;;){let{value:f,done:m}=o.next();if(this.data.delete(f),m||++p>10)break}}this.data.set(f,p())}return this.data.get(f)}size(){return this.data.size}hash(o){let p="",{parameters:f}=this;if(0===f.length)return!1;for(let m of f){let f=String(o[m]??"");if(f.includes("|;"))return!1;p+=f+"|;"}return p}};let x=RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),isIpAddress=o=>x.test(o)||o.startsWith("[")&&o.endsWith("]"),O=RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel=(o,p=!1)=>{if(!p)return O.test(o);for(let p of o.split("."))if(!isValidHostLabel(p))return!1;return!0},L={},B="endpoints";function toDebugString(o){return"object"!=typeof o||null==o?o:"ref"in o?`$${toDebugString(o.ref)}`:"fn"in o?`${o.fn}(${(o.argv||[]).map(toDebugString).join(", ")})`:JSON.stringify(o,null,2)}let EndpointError=class EndpointError extends Error{constructor(o){super(o),this.name="EndpointError"}};let getAttr=(o,p)=>(o=>{let p=o.split("."),f=[];for(let m of p){let p=m.indexOf("[");if(-1!==p){if(m.indexOf("]")!==m.length-1)throw new EndpointError(`Path: '${o}' does not end with ']'`);let _=m.slice(p+1,-1);if(Number.isNaN(parseInt(_)))throw new EndpointError(`Invalid array index: '${_}' in path: '${o}'`);0!==p&&f.push(m.slice(0,p)),f.push(_)}else f.push(m)}return f})(p).reduce((f,m)=>{if("object"!=typeof f)throw new EndpointError(`Index '${m}' in '${p}' not found in '${JSON.stringify(o)}'`);return Array.isArray(f)?f[parseInt(m)]:f[m]},o),U={[ec.HTTP]:80,[ec.HTTPS]:443},$={booleanEquals:(o,p)=>o===p,getAttr:getAttr,isSet:o=>null!=o,isValidHostLabel:isValidHostLabel,not:o=>!o,parseURL:o=>{let p=(()=>{try{if(o instanceof URL)return o;if("object"==typeof o&&"hostname"in o){let{hostname:p,port:f,protocol:m="",path:_="",query:w={}}=o,I=new URL(`${m}//${p}${f?`:${f}`:""}${_}`);return I.search=Object.entries(w).map(([o,p])=>`${o}=${p}`).join("&"),I}return new URL(o)}catch{return null}})();if(!p)return console.error(`Unable to parse ${JSON.stringify(o)} as a whatwg URL.`),null;let f=p.href,{host:m,hostname:_,pathname:w,protocol:I,search:k}=p;if(k)return null;let M=I.slice(0,-1);if(!Object.values(ec).includes(M))return null;let x=isIpAddress(_),O=f.includes(`${m}:${U[M]}`)||"string"==typeof o&&o.includes(`${m}:${U[M]}`),L=`${m}${O?`:${U[M]}`:""}`;return{scheme:M,authority:L,path:w,normalizedPath:w.endsWith("/")?w:`${w}/`,isIp:x}},stringEquals:(o,p)=>o===p,substring:(o,p,f,m)=>p>=f||o.length<f?null:m?o.substring(o.length-f,o.length-p):o.substring(p,f),uriEncode:o=>encodeURIComponent(o).replace(/[!*'()]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`)},evaluateTemplate=(o,p)=>{let f=[],m={...p.endpointParams,...p.referenceRecord},_=0;for(;_<o.length;){let p=o.indexOf("{",_);if(-1===p){f.push(o.slice(_));break}f.push(o.slice(_,p));let w=o.indexOf("}",p);if(-1===w){f.push(o.slice(p));break}"{"===o[p+1]&&"}"===o[w+1]&&(f.push(o.slice(p+1,w)),_=w+2);let I=o.substring(p+1,w);if(I.includes("#")){let[o,p]=I.split("#");f.push(getAttr(m[o],p))}else f.push(m[I]);_=w+1}return f.join("")},evaluateExpression=(o,p,f)=>{if("string"==typeof o)return evaluateTemplate(o,f);if(o.fn)return callFunction(o,f);if(o.ref)return(({ref:o},p)=>({...p.endpointParams,...p.referenceRecord})[o])(o,f);throw new EndpointError(`'${p}': ${String(o)} is not a string, function or reference.`)},callFunction=({fn:o,argv:p},f)=>{let m=p.map(o=>["boolean","number"].includes(typeof o)?o:evaluateExpression(o,"arg",f)),_=o.split(".");return _[0]in L&&null!=_[1]?L[_[0]][_[1]](...m):$[o](...m)},evaluateCondition=({assign:o,...p},f)=>{if(o&&o in f.referenceRecord)throw new EndpointError(`'${o}' is already defined in Reference Record.`);let m=callFunction(p,f);return f.logger?.debug?.(`${B} evaluateCondition: ${toDebugString(p)} = ${toDebugString(m)}`),{result:""===m||!!m,...null!=o&&{toAssign:{name:o,value:m}}}},evaluateConditions=(o=[],p)=>{let f={};for(let m of o){let{result:o,toAssign:_}=evaluateCondition(m,{...p,referenceRecord:{...p.referenceRecord,...f}});if(!o)return{result:o};_&&(f[_.name]=_.value,p.logger?.debug?.(`${B} assign: ${_.name} := ${toDebugString(_.value)}`))}return{result:!0,referenceRecord:f}},getEndpointProperty=(o,p)=>{if(Array.isArray(o))return o.map(o=>getEndpointProperty(o,p));switch(typeof o){case"string":return evaluateTemplate(o,p);case"object":if(null===o)throw new EndpointError(`Unexpected endpoint property: ${o}`);return getEndpointProperties(o,p);case"boolean":return o;default:throw new EndpointError(`Unexpected endpoint property type: ${typeof o}`)}},getEndpointProperties=(o,p)=>Object.entries(o).reduce((o,[f,m])=>({...o,[f]:getEndpointProperty(m,p)}),{}),evaluateEndpointRule=(o,p)=>{let{conditions:f,endpoint:m}=o,{result:_,referenceRecord:w}=evaluateConditions(f,p);if(!_)return;let I={...p,referenceRecord:{...p.referenceRecord,...w}},{url:k,properties:M,headers:x}=m;return p.logger?.debug?.(`${B} Resolving endpoint from template: ${toDebugString(m)}`),{...void 0!=x&&{headers:Object.entries(x).reduce((o,[p,f])=>({...o,[p]:f.map(o=>{let f=evaluateExpression(o,"Header value entry",I);if("string"!=typeof f)throw new EndpointError(`Header '${p}' value '${f}' is not a string`);return f})}),{})},...void 0!=M&&{properties:getEndpointProperties(M,I)},url:((o,p)=>{let f=evaluateExpression(o,"Endpoint URL",p);if("string"==typeof f)try{return new URL(f)}catch(o){throw console.error(`Failed to construct URL with ${f}`,o),o}throw new EndpointError(`Endpoint URL must be a string, got ${typeof f}`)})(k,I)}},evaluateErrorRule=(o,p)=>{let{conditions:f,error:m}=o,{result:_,referenceRecord:w}=evaluateConditions(f,p);if(_)throw new EndpointError(evaluateExpression(m,"Error",{...p,referenceRecord:{...p.referenceRecord,...w}}))},evaluateTreeRule=(o,p)=>{let{conditions:f,rules:m}=o,{result:_,referenceRecord:w}=evaluateConditions(f,p);if(_)return evaluateRules(m,{...p,referenceRecord:{...p.referenceRecord,...w}})},evaluateRules=(o,p)=>{for(let f of o)if("endpoint"===f.type){let o=evaluateEndpointRule(f,p);if(o)return o}else if("error"===f.type)evaluateErrorRule(f,p);else if("tree"===f.type){let o=evaluateTreeRule(f,p);if(o)return o}else throw new EndpointError(`Unknown endpoint rule: ${f}`);throw new EndpointError("Rules evaluation failed")},isVirtualHostableS3Bucket=(o,p=!1)=>{if(p){for(let p of o.split("."))if(!isVirtualHostableS3Bucket(p))return!1;return!0}return!(!isValidHostLabel(o)||o.length<3||o.length>63||o!==o.toLowerCase()||isIpAddress(o))};var q,Z,ee,et,ei,er,en,eo,es,ea,el,ed,ec,eu,eh,ep,ef,em,eg,eS,ev=f(0x48128888);let eb=f.n(ev)(),ey={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:o=>{let p=o.split(":");if(p.length<6)return null;let[f,m,_,w,I,...k]=p;return"arn"!==f||""===m||""===_||""===k.join(":")?null:{partition:m,service:_,region:w,accountId:I,resourceId:k.map(o=>o.split("/")).flat()}},partition:o=>{let{partitions:p}=eb;for(let f of p){let{regions:p,outputs:m}=f;for(let[f,_]of Object.entries(p))if(f===o)return{...m,..._}}for(let f of p){let{regionRegex:p,outputs:m}=f;if(new RegExp(p).test(o))return{...m}}let f=p.find(o=>"aws"===o.id);if(!f)throw Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...f.outputs}}};L.aws=ey;let e_="user-agent",eC="x-amz-user-agent",eT=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,eE=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,escapeUserAgent=o=>{let p=o[0].split("/").map(o=>o.replace(eT,"-")).join("/"),f=o[1]?.replace(eE,"-"),m=p.indexOf("/"),_=p.substring(0,m),w=p.substring(m+1);return"api"===_&&(w=w.toLowerCase()),[_,w,f].filter(o=>o&&o.length>0).reduce((o,p,f)=>{switch(f){case 0:return p;case 1:return`${o}/${p}`;default:return`${o}#${p}`}},"")},ew={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0};(q=em||(em={})).ENV="env",q.CONFIG="shared config entry";let getSmithyContext=o=>o[_]||(o[_]={}),normalizeProvider_normalizeProvider=o=>{if("function"==typeof o)return o;let p=Promise.resolve(o);return()=>p},isFipsRegion=o=>"string"==typeof o&&(o.startsWith("fips-")||o.endsWith("-fips")),getRealRegion=o=>isFipsRegion(o)?["fips-aws-global","aws-fips"].includes(o)?"us-east-1":o.replace(/fips-(dkr-|prod-)?|-fips/,""):o;function convertHttpAuthSchemesToMap(o){let p=new Map;for(let f of o)p.set(f.schemeId,f);return p}let resolveParamsForS3=async o=>{let p=o?.Bucket||"";if("string"==typeof o.Bucket&&(o.Bucket=p.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName(p)){if(!0===o.ForcePathStyle)throw Error("Path-style addressing cannot be used with ARN buckets")}else isDnsCompatibleBucketName(p)&&(-1===p.indexOf(".")||String(o.Endpoint).startsWith("http:"))&&p.toLowerCase()===p&&!(p.length<3)||(o.ForcePathStyle=!0);return o.DisableMultiRegionAccessPoints&&(o.disableMultiRegionAccessPoints=!0,o.DisableMRAP=!0),o},eI=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,eA=/(\d+\.){3}\d+/,ek=/\.\./,isDnsCompatibleBucketName=o=>eI.test(o)&&!eA.test(o)&&!ek.test(o),isArnBucketName=o=>{let[p,f,m,,,_]=o.split(":"),w="arn"===p&&o.split(":").length>=6,I=!!(w&&f&&m&&_);if(w&&!I)throw Error(`Invalid ARN: ${o} was an invalid ARN.`);return I},createConfigValueProvider=(o,p,f)=>{let configProvider=async()=>{let m=f[o]??f[p];return"function"==typeof m?m():m};return"credentialScope"===o||"CredentialScope"===p?async()=>{let o="function"==typeof f.credentials?await f.credentials():f.credentials;return o?.credentialScope??o?.CredentialScope}:"accountId"===o||"AccountId"===p?async()=>{let o="function"==typeof f.credentials?await f.credentials():f.credentials;return o?.accountId??o?.AccountId}:"endpoint"===o||"endpoint"===p?async()=>{let o=await configProvider();if(o&&"object"==typeof o){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:p,hostname:f,port:m,path:_}=o;return`${p}//${f}${m?":"+m:""}${_}`}}return o}:configProvider},getEndpointFromConfig=async o=>void 0;function parseQueryString(o){let p={};if(o=o.replace(/^\?/,""))for(let f of o.split("&")){let[o,m=null]=f.split("=");o=decodeURIComponent(o),m&&(m=decodeURIComponent(m)),o in p?Array.isArray(p[o])?p[o].push(m):p[o]=[p[o],m]:p[o]=m}return p}let parseUrl=o=>{let p;if("string"==typeof o)return parseUrl(new URL(o));let{hostname:f,pathname:m,port:_,protocol:w,search:I}=o;return I&&(p=parseQueryString(I)),{hostname:f,port:_?parseInt(_):void 0,protocol:w,path:m,query:p}},toEndpointV1=o=>"object"==typeof o?"url"in o?parseUrl(o.url):o:parseUrl(o),getEndpointFromInstructions=async(o,p,f,m)=>{if(!f.endpoint){let o;(o=f.serviceConfiguredEndpoint?await f.serviceConfiguredEndpoint():await getEndpointFromConfig(f.serviceId))&&(f.endpoint=()=>Promise.resolve(toEndpointV1(o)))}let _=await resolveParams(o,p,f);if("function"!=typeof f.endpointProvider)throw Error("config.endpointProvider is not set.");return f.endpointProvider(_,m)},resolveParams=async(o,p,f)=>{let m={},_=p?.getEndpointParameterInstructions?.()||{};for(let[p,w]of Object.entries(_))switch(w.type){case"staticContextParams":m[p]=w.value;break;case"contextParams":m[p]=o[w.name];break;case"clientContextParams":case"builtInParams":m[p]=await createConfigValueProvider(w.name,p,f)();break;default:throw Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(w))}return 0===Object.keys(_).length&&Object.assign(m,f),"s3"===String(f.serviceId).toLowerCase()&&await resolveParamsForS3(m),m},eM={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ex={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSerdePlugin(o,p,f){return{applyToStack:m=>{m.add(p=>async m=>{let{response:_}=await p(m);try{let p=await f(_,o);return{response:_,output:p}}catch(o){throw Object.defineProperty(o,"$response",{value:_}),"$metadata"in o||(o.message+=`
  Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`,void 0!==o.$responseBodyText&&o.$response&&(o.$response.body=o.$responseBodyText)),o}},eM),m.add((f,m)=>async _=>{let w=m.endpointV2?.url&&o.urlParser?async()=>o.urlParser(m.endpointV2.url):o.endpoint;if(!w)throw Error("No valid endpoint provider available.");let I=await p(_.input,{...o,endpoint:w});return f({..._,request:I})},ex)}}}let eP={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:ex.name},getEndpointPlugin=(o,p)=>({applyToStack:f=>{f.addRelativeTo((({config:o,instructions:p})=>(f,m)=>async _=>{let w=await getEndpointFromInstructions(_.input,{getEndpointParameterInstructions:()=>p},{...o},m);m.endpointV2=w,m.authSchemes=w.properties?.authSchemes;let I=m.authSchemes?.[0];if(I){m.signing_region=I.signingRegion,m.signing_service=I.signingName;let o=getSmithyContext(m),p=o?.selectedHttpAuthScheme?.httpAuthOption;p&&(p.signingProperties=Object.assign(p.signingProperties||{},{signing_region:I.signingRegion,signingRegion:I.signingRegion,signing_service:I.signingName,signingName:I.signingName,signingRegionSet:I.signingRegionSet},I.properties))}return f({..._})})({config:o,instructions:p}),eP)}}),eR={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:eP.name};ex.name,(Z=eg||(eg={})).STANDARD="standard",Z.ADAPTIVE="adaptive";let eO=eg.STANDARD,eD=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],eL=["TimeoutError","RequestTimeout","RequestTimeoutException"],eN=[500,502,503,504],eF=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],isThrottlingError=o=>o.$metadata?.httpStatusCode===429||eD.includes(o.name)||o.$retryable?.throttling==!0,isTransientError=o=>o.$metadata?.clockSkewCorrected||eL.includes(o.name)||eF.includes(o?.code||"")||eN.includes(o.$metadata?.httpStatusCode||0);let DefaultRateLimiter=class DefaultRateLimiter{constructor(o){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=o?.beta??.7,this.minCapacity=o?.minCapacity??1,this.minFillRate=o?.minFillRate??.5,this.scaleConstant=o?.scaleConstant??.4,this.smooth=o?.smooth??.8;const p=this.getCurrentTimeInSeconds();this.lastThrottleTime=p,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(o){if(this.enabled){if(this.refillTokenBucket(),o>this.currentCapacity){let p=(o-this.currentCapacity)/this.fillRate*1e3;await new Promise(o=>setTimeout(o,p))}this.currentCapacity=this.currentCapacity-o}}refillTokenBucket(){let o=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=o;return}let p=(o-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+p),this.lastTimestamp=o}updateClientSendingRate(o){let p;if(this.updateMeasuredRate(),isThrottlingError(o)){let o=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),p=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),p=this.cubicSuccess(this.getCurrentTimeInSeconds());let f=Math.min(p,2*this.measuredTxRate);this.updateTokenBucketRate(f)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(o){return this.getPrecise(o*this.beta)}cubicSuccess(o){return this.getPrecise(this.scaleConstant*Math.pow(o-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(o){this.refillTokenBucket(),this.fillRate=Math.max(o,this.minFillRate),this.maxCapacity=Math.max(o,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let o=Math.floor(2*this.getCurrentTimeInSeconds())/2;if(this.requestCount++,o>this.lastTxRateBucket){let p=this.requestCount/(o-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(p*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=o}}getPrecise(o){return parseFloat(o.toFixed(8))}};let createDefaultRetryToken=({retryDelay:o,retryCount:p,retryCost:f})=>({getRetryCount:()=>p,getRetryDelay:()=>Math.min(2e4,o),getRetryCost:()=>f});let StandardRetryStrategy=class StandardRetryStrategy{constructor(o){this.maxAttempts=o,this.mode=eg.STANDARD,this.capacity=500,this.retryBackoffStrategy=(()=>{let o=100;return{computeNextBackoffDelay:p=>Math.floor(Math.min(2e4,Math.random()*2**p*o)),setDelayBase:p=>{o=p}}})(),this.maxAttemptsProvider="function"==typeof o?o:async()=>o}async acquireInitialRetryToken(o){return createDefaultRetryToken({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(o,p){let f=await this.getMaxAttempts();if(this.shouldRetry(o,p,f)){let f=p.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===f?500:100);let m=this.retryBackoffStrategy.computeNextBackoffDelay(o.getRetryCount()),_=p.retryAfterHint?Math.max(p.retryAfterHint.getTime()-Date.now()||0,m):m,w=this.getCapacityCost(f);return this.capacity-=w,createDefaultRetryToken({retryDelay:_,retryCount:o.getRetryCount()+1,retryCost:w})}throw Error("No retry token available")}recordSuccess(o){this.capacity=Math.max(500,this.capacity+(o.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}shouldRetry(o,p,f){return o.getRetryCount()+1<f&&this.capacity>=this.getCapacityCost(p.errorType)&&this.isRetryableError(p.errorType)}getCapacityCost(o){return"TRANSIENT"===o?10:5}isRetryableError(o){return"THROTTLING"===o||"TRANSIENT"===o}};let AdaptiveRetryStrategy=class AdaptiveRetryStrategy{constructor(o,p){this.maxAttemptsProvider=o,this.mode=eg.ADAPTIVE;const{rateLimiter:f}=p??{};this.rateLimiter=f??new DefaultRateLimiter,this.standardRetryStrategy=new StandardRetryStrategy(o)}async acquireInitialRetryToken(o){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(o)}async refreshRetryTokenForRetry(o,p){return this.rateLimiter.updateClientSendingRate(p),this.standardRetryStrategy.refreshRetryTokenForRetry(o,p)}recordSuccess(o){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(o)}};let eV="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),eB=new Uint8Array(16);function rng(){if(!m&&!(m="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(eB)}let eU=[];for(let o=0;o<256;++o)eU.push((o+256).toString(16).slice(1));function unsafeStringify(o,p=0){return eU[o[p+0]]+eU[o[p+1]]+eU[o[p+2]]+eU[o[p+3]]+"-"+eU[o[p+4]]+eU[o[p+5]]+"-"+eU[o[p+6]]+eU[o[p+7]]+"-"+eU[o[p+8]]+eU[o[p+9]]+"-"+eU[o[p+10]]+eU[o[p+11]]+eU[o[p+12]]+eU[o[p+13]]+eU[o[p+14]]+eU[o[p+15]]}let esm_browser_v4=function(o,p,f){if(eV&&!p&&!o)return eV();let m=(o=o||{}).random||(o.rng||rng)();if(m[6]=15&m[6]|64,m[8]=63&m[8]|128,p){f=f||0;for(let o=0;o<16;++o)p[f+o]=m[o];return p}return unsafeStringify(m)},asSdkError=o=>o instanceof Error?o:o instanceof Object?Object.assign(Error(),o):"string"==typeof o?Error(o):Error(`AWS SDK error wrapper for ${o}`),getAllAliases=(o,p)=>{let f=[];if(o&&f.push(o),p)for(let o of p)f.push(o);return f},getMiddlewareNameWithAliases=(o,p)=>`${o||"anonymous"}${p&&p.length>0?` (a.k.a. ${p.join(",")})`:""}`,constructStack=()=>{let o=[],p=[],f=!1,m=new Set,cloneTo=f=>(o.forEach(o=>{f.add(o.middleware,{...o})}),p.forEach(o=>{f.addRelativeTo(o.middleware,{...o})}),f.identifyOnResolve?.(_.identifyOnResolve()),f),expandRelativeMiddlewareList=o=>{let p=[];return o.before.forEach(o=>{0===o.before.length&&0===o.after.length?p.push(o):p.push(...expandRelativeMiddlewareList(o))}),p.push(o),o.after.reverse().forEach(o=>{0===o.before.length&&0===o.after.length?p.push(o):p.push(...expandRelativeMiddlewareList(o))}),p},getMiddlewareList=(f=!1)=>{let m=[],_=[],w={};return o.forEach(o=>{let p={...o,before:[],after:[]};for(let o of getAllAliases(p.name,p.aliases))w[o]=p;m.push(p)}),p.forEach(o=>{let p={...o,before:[],after:[]};for(let o of getAllAliases(p.name,p.aliases))w[o]=p;_.push(p)}),_.forEach(o=>{if(o.toMiddleware){let p=w[o.toMiddleware];if(void 0===p){if(f)return;throw Error(`${o.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(o.name,o.aliases)} middleware ${o.relation} ${o.toMiddleware}`)}"after"===o.relation&&p.after.push(o),"before"===o.relation&&p.before.push(o)}}),m.sort((o,p)=>ej[p.step]-ej[o.step]||eH[p.priority||"normal"]-eH[o.priority||"normal"]).map(expandRelativeMiddlewareList).reduce((o,p)=>(o.push(...p),o),[])},_={add:(p,f={})=>{let{name:_,override:w,aliases:I}=f,k={step:"initialize",priority:"normal",middleware:p,...f},M=getAllAliases(_,I);if(M.length>0){if(M.some(o=>m.has(o))){if(!w)throw Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(_,I)}'`);for(let p of M){let f=o.findIndex(o=>o.name===p||o.aliases?.some(o=>o===p));if(-1===f)continue;let m=o[f];if(m.step!==k.step||k.priority!==m.priority)throw Error(`"${getMiddlewareNameWithAliases(m.name,m.aliases)}" middleware with ${m.priority} priority in ${m.step} step cannot be overridden by "${getMiddlewareNameWithAliases(_,I)}" middleware with ${k.priority} priority in ${k.step} step.`);o.splice(f,1)}}for(let o of M)m.add(o)}o.push(k)},addRelativeTo:(o,f)=>{let{name:_,override:w,aliases:I}=f,k={middleware:o,...f},M=getAllAliases(_,I);if(M.length>0){if(M.some(o=>m.has(o))){if(!w)throw Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(_,I)}'`);for(let o of M){let f=p.findIndex(p=>p.name===o||p.aliases?.some(p=>p===o));if(-1===f)continue;let m=p[f];if(m.toMiddleware!==k.toMiddleware||m.relation!==k.relation)throw Error(`"${getMiddlewareNameWithAliases(m.name,m.aliases)}" middleware ${m.relation} "${m.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(_,I)}" middleware ${k.relation} "${k.toMiddleware}" middleware.`);p.splice(f,1)}}for(let o of M)m.add(o)}p.push(k)},clone:()=>cloneTo(constructStack()),use:o=>{o.applyToStack(_)},remove:f=>{let _,w;if("string"==typeof f){let _,w;return _=!1,w=o=>{let p=getAllAliases(o.name,o.aliases);if(p.includes(f)){for(let o of(_=!0,p))m.delete(o);return!1}return!0},o=o.filter(w),p=p.filter(w),_}return _=!1,w=o=>{if(o.middleware===f){for(let p of(_=!0,getAllAliases(o.name,o.aliases)))m.delete(p);return!1}return!0},o=o.filter(w),p=p.filter(w),_},removeByTag:f=>{let _=!1,filterCb=o=>{let{tags:p,name:w,aliases:I}=o;if(p&&p.includes(f)){for(let o of getAllAliases(w,I))m.delete(o);return _=!0,!1}return!0};return o=o.filter(filterCb),p=p.filter(filterCb),_},concat:o=>{let p=cloneTo(constructStack());return p.use(o),p.identifyOnResolve(f||p.identifyOnResolve()||(o.identifyOnResolve?.()??!1)),p},applyToStack:cloneTo,identify:()=>getMiddlewareList(!0).map(o=>{let p=o.step??o.relation+" "+o.toMiddleware;return getMiddlewareNameWithAliases(o.name,o.aliases)+" - "+p}),identifyOnResolve:o=>("boolean"==typeof o&&(f=o),f),resolve:(o,p)=>{for(let f of getMiddlewareList().map(o=>o.middleware).reverse())o=f(o,p);return f&&console.log(_.identify()),o}};return _},ej={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},eH={high:3,normal:2,low:1};let Client=class Client{constructor(o){this.config=o,this.middlewareStack=constructStack()}send(o,p,f){let m,_="function"!=typeof p?p:void 0,w="function"==typeof p?p:f;if(void 0===_&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=new WeakMap);let p=this.handlers;p.has(o.constructor)?m=p.get(o.constructor):(m=o.resolveMiddleware(this.middlewareStack,this.config,_),p.set(o.constructor,m))}else delete this.handlers,m=o.resolveMiddleware(this.middlewareStack,this.config,_);if(!w)return m(o).then(o=>o.output);m(o).then(o=>w(null,o.output),o=>w(o)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};let ez={},eG=Array(64);for(let o=0;o+65<=90;o++){let p=String.fromCharCode(o+65);ez[p]=o,eG[o]=p}for(let o=0;o+97<=122;o++){let p=String.fromCharCode(o+97),f=o+26;ez[p]=f,eG[f]=p}for(let o=0;o<10;o++){ez[o.toString(10)]=o+52;let p=o.toString(10),f=o+52;ez[p]=f,eG[f]=p}ez["+"]=62,eG[62]="+",ez["/"]=63,eG[63]="/";let fromBase64=o=>{let p=o.length/4*3;"=="===o.slice(-2)?p-=2:"="===o.slice(-1)&&p--;let f=new ArrayBuffer(p),m=new DataView(f);for(let p=0;p<o.length;p+=4){let f=0,_=0;for(let m=p,w=p+3;m<=w;m++)if("="!==o[m]){if(!(o[m]in ez))throw TypeError(`Invalid character ${o[m]} in base64 string.`);f|=ez[o[m]]<<(w-m)*6,_+=6}else f>>=6;let w=p/4*3;f>>=_%8;let I=Math.floor(_/8);for(let o=0;o<I;o++){let p=(I-o-1)*8;m.setUint8(w+o,(f&255<<p)>>p)}}return new Uint8Array(f)},fromUtf8=o=>new TextEncoder().encode(o);function toBase64_browser_toBase64(o){let p,f="object"==typeof(p="string"==typeof o?fromUtf8(o):o)&&"number"==typeof p.length,m="object"==typeof p&&"number"==typeof p.byteOffset&&"number"==typeof p.byteLength;if(!f&&!m)throw Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let _="";for(let o=0;o<p.length;o+=3){let f=0,m=0;for(let _=o,w=Math.min(o+3,p.length);_<w;_++)f|=p[_]<<(w-_-1)*8,m+=8;let w=Math.ceil(m/6);f<<=6*w-m;for(let o=1;o<=w;o++){let p=(w-o)*6;_+=eG[(f&63<<p)>>p]}_+="==".slice(0,4-w)}return _}let toUtf8_browser_toUtf8=o=>{if("string"==typeof o)return o;if("object"!=typeof o||"number"!=typeof o.byteOffset||"number"!=typeof o.byteLength)throw Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(o)};function transformToString(o,p="utf-8"){return"base64"===p?toBase64_browser_toBase64(o):toUtf8_browser_toUtf8(o)}function transformFromString(o,p){return"base64"===p?Uint8ArrayBlobAdapter.mutate(fromBase64(o)):Uint8ArrayBlobAdapter.mutate(fromUtf8(o))}let Uint8ArrayBlobAdapter=class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(o,p="utf-8"){if("string"==typeof o)return transformFromString(o,p);throw Error(`Unsupported conversion from ${typeof o} to Uint8ArrayBlobAdapter.`)}static mutate(o){return Object.setPrototypeOf(o,Uint8ArrayBlobAdapter.prototype),o}transformToString(o="utf-8"){return transformToString(this,o)}};let escapeUri=o=>encodeURIComponent(o).replace(/[!'()*]/g,hexEncode),hexEncode=o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`;function buildQueryString(o){let p=[];for(let f of Object.keys(o).sort()){let m=o[f];if(f=escapeUri(f),Array.isArray(m))for(let o=0,_=m.length;o<_;o++)p.push(`${f}=${escapeUri(m[o])}`);else{let o=f;(m||"string"==typeof m)&&(o+=`=${escapeUri(m)}`),p.push(o)}}return p.join("&")}function requestTimeout(o=0){return new Promise((p,f)=>{o&&setTimeout(()=>{let p=Error(`Request did not complete within ${o} ms`);p.name="TimeoutError",f(p)},o)})}let eW={supported:void 0};let FetchHttpHandler=class FetchHttpHandler{static create(o){return"function"==typeof o?.handle?o:new FetchHttpHandler(o)}constructor(o){"function"==typeof o?this.configProvider=o().then(o=>o||{}):(this.config=o??{},this.configProvider=Promise.resolve(this.config)),void 0===eW.supported&&(eW.supported=!!("u">typeof Request&&"keepalive"in new Request("https://[::1]")))}destroy(){}async handle(o,{abortSignal:p}={}){this.config||(this.config=await this.configProvider);let f=this.config.requestTimeout,m=!0===this.config.keepAlive,_=this.config.credentials;if(p?.aborted){let o=Error("Request aborted");return o.name="AbortError",Promise.reject(o)}let w=o.path,I=buildQueryString(o.query||{});I&&(w+=`?${I}`),o.fragment&&(w+=`#${o.fragment}`);let k="";if(null!=o.username||null!=o.password){let p=o.username??"",f=o.password??"";k=`${p}:${f}@`}let{port:M,method:x}=o,O=`${o.protocol}//${k}${o.hostname}${M?`:${M}`:""}${w}`,L="GET"===x||"HEAD"===x?void 0:o.body,B={body:L,headers:new Headers(o.headers),method:x,credentials:_};this.config?.cache&&(B.cache=this.config.cache),L&&(B.duplex="half"),"u">typeof AbortController&&(B.signal=p),eW.supported&&(B.keepalive=m),"function"==typeof this.config.requestInit&&Object.assign(B,this.config.requestInit(o));let removeSignalEventListener=()=>{},U=[fetch(new Request(O,B)).then(o=>{let p=o.headers,f={};for(let o of p.entries())f[o[0]]=o[1];return void 0==o.body?o.blob().then(p=>({response:new HttpResponse({headers:f,reason:o.statusText,statusCode:o.status,body:p})})):{response:new HttpResponse({headers:f,reason:o.statusText,statusCode:o.status,body:o.body})}}),requestTimeout(f)];return p&&U.push(new Promise((o,f)=>{let onAbort=()=>{let o=Error("Request aborted");o.name="AbortError",f(o)};"function"==typeof p.addEventListener?(p.addEventListener("abort",onAbort,{once:!0}),removeSignalEventListener=()=>p.removeEventListener("abort",onAbort)):p.onabort=onAbort})),Promise.race(U).finally(removeSignalEventListener)}updateHttpClientConfig(o,p){this.config=void 0,this.configProvider=this.configProvider.then(f=>(f[o]=p,f))}httpHandlerConfigs(){return this.config??{}}};let stream_collector_streamCollector=o=>"function"==typeof Blob&&o instanceof Blob?collectBlob(o):collectStream(o);async function collectBlob(o){return new Uint8Array(fromBase64(await readToBase64(o)))}async function collectStream(o){let p=[],f=o.getReader(),m=!1,_=0;for(;!m;){let{done:o,value:w}=await f.read();w&&(p.push(w),_+=w.length),m=o}let w=new Uint8Array(_),I=0;for(let o of p)w.set(o,I),I+=o.length;return w}function readToBase64(o){return new Promise((p,f)=>{let m=new FileReader;m.onloadend=()=>{if(2!==m.readyState)return f(Error("Reader aborted too early"));let o=m.result??"",_=o.indexOf(","),w=_>-1?_+1:o.length;p(o.substring(w))},m.onabort=()=>f(Error("Read aborted")),m.onerror=()=>f(m.error),m.readAsDataURL(o)})}let e$={},eK={};for(let o=0;o<256;o++){let p=o.toString(16).toLowerCase();1===p.length&&(p=`0${p}`),e$[o]=p,eK[p]=o}function fromHex(o){if(o.length%2!=0)throw Error("Hex encoded strings must have an even number length");let p=new Uint8Array(o.length/2);for(let f=0;f<o.length;f+=2){let m=o.slice(f,f+2).toLowerCase();if(m in eK)p[f/2]=eK[m];else throw Error(`Cannot decode unrecognized sequence ${m} as hexadecimal`)}return p}function dist_es_toHex(o){let p="";for(let f=0;f<o.byteLength;f++)p+=e$[o[f]];return p}let collect_stream_body_collectBody=async(o=new Uint8Array,p)=>{if(o instanceof Uint8Array)return Uint8ArrayBlobAdapter.mutate(o);if(!o)return Uint8ArrayBlobAdapter.mutate(new Uint8Array);let f=p.streamCollector(o);return Uint8ArrayBlobAdapter.mutate(await f)};let Command=class Command{constructor(){this.middlewareStack=constructStack()}static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(o,p,f,{middlewareFn:m,clientName:w,commandName:I,inputFilterSensitiveLog:k,outputFilterSensitiveLog:M,smithyContext:x,additionalContext:O,CommandCtor:L}){for(let _ of m.bind(this)(L,o,p,f))this.middlewareStack.use(_);let B=o.concat(this.middlewareStack),{logger:U}=p,$={logger:U,clientName:w,commandName:I,inputFilterSensitiveLog:k,outputFilterSensitiveLog:M,[_]:{commandInstance:this,...x},...O},{requestHandler:q}=p;return B.resolve(o=>q.handle(o.request,f||{}),$)}};let ClassBuilder=class ClassBuilder{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=o=>o,this._outputFilterSensitiveLog=o=>o,this._serializer=null,this._deserializer=null}init(o){this._init=o}ep(o){return this._ep=o,this}m(o){return this._middlewareFn=o,this}s(o,p,f={}){return this._smithyContext={service:o,operation:p,...f},this}c(o={}){return this._additionalContext=o,this}n(o,p){return this._clientName=o,this._commandName=p,this}f(o=o=>o,p=o=>o){return this._inputFilterSensitiveLog=o,this._outputFilterSensitiveLog=p,this}ser(o){return this._serializer=o,this}de(o){return this._deserializer=o,this}build(){let o,p=this;return o=class extends Command{static getEndpointParameterInstructions(){return p._ep}constructor(...[o]){super(),this.serialize=p._serializer,this.deserialize=p._deserializer,this.input=o??{},p._init(this)}resolveMiddleware(f,m,_){return this.resolveMiddlewareWithContext(f,m,_,{CommandCtor:o,middlewareFn:p._middlewareFn,clientName:p._clientName,commandName:p._commandName,inputFilterSensitiveLog:p._inputFilterSensitiveLog,outputFilterSensitiveLog:p._outputFilterSensitiveLog,smithyContext:p._smithyContext,additionalContext:p._additionalContext})}}}};let eq="***SensitiveInformation***",expectBoolean=o=>{if(null!=o){if("number"==typeof o){if((0===o||1===o)&&eY.warn(stackTraceWarning(`Expected boolean, got ${typeof o}: ${o}`)),0===o)return!1;if(1===o)return!0}if("string"==typeof o){let p=o.toLowerCase();if(("false"===p||"true"===p)&&eY.warn(stackTraceWarning(`Expected boolean, got ${typeof o}: ${o}`)),"false"===p)return!1;if("true"===p)return!0}if("boolean"==typeof o)return o;throw TypeError(`Expected boolean, got ${typeof o}: ${o}`)}},expectNumber=o=>{if(null!=o){if("string"==typeof o){let p=parseFloat(o);if(!Number.isNaN(p))return String(p)!==String(o)&&eY.warn(stackTraceWarning(`Expected number but observed string: ${o}`)),p}if("number"==typeof o)return o;throw TypeError(`Expected number, got ${typeof o}: ${o}`)}},expectNonNull=(o,p)=>{if(null==o){if(p)throw TypeError(`Expected a non-null value for ${p}`);throw TypeError("Expected a non-null value")}return o},expectObject=o=>{if(null==o)return;if("object"==typeof o&&!Array.isArray(o))return o;let p=Array.isArray(o)?"array":typeof o;throw TypeError(`Expected object, got ${p}: ${o}`)},expectString=o=>{if(null!=o){if("string"==typeof o)return o;if(["boolean","number","bigint"].includes(typeof o))return eY.warn(stackTraceWarning(`Expected string, got ${typeof o}: ${o}`)),String(o);throw TypeError(`Expected string, got ${typeof o}: ${o}`)}},eJ=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,stackTraceWarning=o=>String(TypeError(o).stack||o).split(`
`).slice(0,5).filter(o=>!o.includes("stackTraceWarning")).join(`
`),eY={warn:console.warn},parseEpochTimestamp=o=>{let p;if(null!=o){if("number"==typeof o)p=o;else if("string"==typeof o)p="string"==typeof o?expectNumber((o=>{let p=o.match(eJ);if(null===p||p[0].length!==o.length)throw TypeError("Expected real number, got implicit NaN");return parseFloat(o)})(o)):expectNumber(o);else if("object"==typeof o&&1===o.tag)p=o.value;else throw TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(p)||p===1/0||p===-1/0)throw TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*p))}};let ServiceException=class ServiceException extends Error{constructor(o){super(o.message),Object.setPrototypeOf(this,ServiceException.prototype),this.name=o.name,this.$fault=o.$fault,this.$metadata=o.$metadata}};let decorateServiceException=(o,p={})=>{Object.entries(p).filter(([,o])=>void 0!==o).forEach(([p,f])=>{(void 0==o[p]||""===o[p])&&(o[p]=f)});let f=o.message||o.Message||"UnknownError";return o.message=f,delete o.Message,o},loadConfigsForDefaultMode=o=>{switch(o){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},isSerializableHeaderValue=o=>null!=o,StringWrapper=function(){let o=Object.getPrototypeOf(this).constructor,p=Function.bind.apply(String,[null,...arguments]),f=new p;return Object.setPrototypeOf(f,o.prototype),f};StringWrapper.prototype=Object.create(String.prototype,{constructor:{value:StringWrapper,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(StringWrapper,String);let NoOpLogger=class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}};function map(o,p,f){let m,_;if(void 0===p&&void 0===f)m={},_=o;else{if(m=o,"function"==typeof p)return mapWithFilter(m,p,_=f);_=p}for(let o of Object.keys(_)){if(!Array.isArray(_[o])){m[o]=_[o];continue}applyInstruction(m,null,_,o)}return m}let take=(o,p)=>{let f={};for(let m in p)applyInstruction(f,o,p,m);return f},mapWithFilter=(o,p,f)=>map(o,Object.entries(f).reduce((o,[f,m])=>(Array.isArray(m)?o[f]=m:"function"==typeof m?o[f]=[p,m()]:o[f]=[p,m],o),{})),applyInstruction=(o,p,f,m)=>{if(null!==p){let _=f[m];"function"==typeof _&&(_=[,_]);let[w=nonNullish,I=pass,k=m]=_;("function"==typeof w&&w(p[k])||"function"!=typeof w&&w)&&(o[m]=I(p[k]));return}let[_,w]=f[m];if("function"==typeof w){let p,f=void 0===_&&null!=(p=w()),I="function"==typeof _&&!!_(void 0)||"function"!=typeof _&&!!_;f?o[m]=p:I&&(o[m]=w())}else{let p=void 0===_&&null!=w,f="function"==typeof _&&!!_(w)||"function"!=typeof _&&!!_;(p||f)&&(o[m]=w)}},nonNullish=o=>null!=o,pass=o=>o;function extendedEncodeURIComponent(o){return encodeURIComponent(o).replace(/[!'()*]/g,function(o){return"%"+o.charCodeAt(0).toString(16).toUpperCase()})}let serializeDateTime=o=>o.toISOString().replace(".000Z","Z"),_json=o=>{if(null==o)return{};if(Array.isArray(o))return o.filter(o=>null!=o).map(_json);if("object"==typeof o){let p={};for(let f of Object.keys(o))null!=o[f]&&(p[f]=_json(o[f]));return p}return o},isStreamingPayload=o=>o?.body instanceof ReadableStream,getRetryErrorInfo=o=>{let p={error:o,errorType:getRetryErrorType(o)},f=getRetryAfterHint(o.$response);return f&&(p.retryAfterHint=f),p},getRetryErrorType=o=>isThrottlingError(o)?"THROTTLING":isTransientError(o)?"TRANSIENT":(o=>{if(o.$metadata?.httpStatusCode!==void 0){let p=o.$metadata.httpStatusCode;if(500<=p&&p<=599&&!isTransientError(o))return!0}return!1})(o)?"SERVER_ERROR":"CLIENT_ERROR",eX={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryAfterHint=o=>{if(!HttpResponse.isInstance(o))return;let p=Object.keys(o.headers).find(o=>"retry-after"===o.toLowerCase());if(!p)return;let f=o.headers[p],m=Number(f);return new Date(Number.isNaN(m)?f:1e3*m)},eQ={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:eX.name};let DefaultIdentityProviderConfig=class DefaultIdentityProviderConfig{constructor(o){for(const[p,f]of(this.authSchemes=new Map,Object.entries(o)))void 0!==f&&this.authSchemes.set(p,f)}getIdentityProvider(o){return this.authSchemes.get(o)}};let isIdentityExpired=o=>doesIdentityRequireRefresh(o)&&o.expiration.getTime()-Date.now()<3e5,doesIdentityRequireRefresh=o=>void 0!==o.expiration,dist_es_normalizeProvider_normalizeProvider=o=>{if("function"==typeof o)return o;let p=Promise.resolve(o);return()=>p};function requestBuilder(o,p){return new RequestBuilder(o,p)}let RequestBuilder=class RequestBuilder{constructor(o,p){this.input=o,this.context=p,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){let{hostname:o,protocol:p="https",port:f,path:m}=await this.context.endpoint();for(let o of(this.path=m,this.resolvePathStack))o(this.path);return new httpRequest_HttpRequest({protocol:p,hostname:this.hostname||o,port:f,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(o){return this.hostname=o,this}bp(o){return this.resolvePathStack.push(p=>{this.path=`${p?.endsWith("/")?p.slice(0,-1):p||""}`+o}),this}p(o,p,f,m){return this.resolvePathStack.push(_=>{this.path=((o,p,f,m,_,w)=>{if(null!=p&&void 0!==p[f]){let p=m();if(p.length<=0)throw Error("Empty value provided for input HTTP label: "+f+".");o=o.replace(_,w?p.split("/").map(o=>extendedEncodeURIComponent(o)).join("/"):extendedEncodeURIComponent(p))}else throw Error("No value provided for input HTTP label: "+f+".");return o})(_,this.input,o,p,f,m)}),this}h(o){return this.headers=o,this}q(o){return this.query=o,this}b(o){return this.body=o,this}m(o){return this.method=o,this}};let makePagedClientRequest=async(o,p,f,...m)=>await p.send(new o(f),...m);function createPaginator(o,p,f,m,_){return async function*(w,I,...k){let M,x=w.startingToken||void 0,O=!0;for(;O;){if(I[f]=x,_&&(I[_]=I[_]??w.pageSize),w.client instanceof o)M=await makePagedClientRequest(p,w.client,I,...k);else throw Error(`Invalid client, expected instance of ${o.name}`);yield M;let L=x;O=!!((x=get(M,m))&&(!w.stopOnSameToken||x!==L))}}}let get=(o,p)=>{let f=o;for(let o of p.split(".")){if(!f||"object"!=typeof f)return;f=f[o]}return f},eZ="content-length";function contentLengthMiddleware(o){return p=>async f=>{let m=f.request;if(httpRequest_HttpRequest.isInstance(m)){let{body:p,headers:f}=m;if(p&&-1===Object.keys(f).map(o=>o.toLowerCase()).indexOf(eZ))try{let f=o(p);m.headers={...m.headers,[eZ]:String(f)}}catch{}}return p({...f,request:m})}}let e0={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},toUint8Array=o=>"string"==typeof o?fromUtf8(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o),e1="X-Amz-Date",e2="X-Amz-Signature",e3="X-Amz-Security-Token",e4="authorization",e5=e1.toLowerCase(),e6=[e4,e5,"date"],e8=e2.toLowerCase(),e9="x-amz-content-sha256",e7=e3.toLowerCase(),te={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},tt=/^proxy-/,ti=/^sec-/,tr="AWS4-HMAC-SHA256",tn="aws4_request",to={},ts=[],createScope=(o,p,f)=>`${o}/${p}/${f}/${tn}`,getSigningKey=async(o,p,f,m,_)=>{let w=await hmac(o,p.secretAccessKey,p.accessKeyId),I=`${f}:${m}:${_}:${dist_es_toHex(w)}:${p.sessionToken}`;if(I in to)return to[I];for(ts.push(I);ts.length>50;)delete to[ts.shift()];let k=`AWS4${p.secretAccessKey}`;for(let p of[f,m,_,tn])k=await hmac(o,k,p);return to[I]=k},hmac=(o,p,f)=>{let m=new o(p);return m.update(toUint8Array(f)),m.digest()},getCanonicalHeaders=({headers:o},p,f)=>{let m={};for(let _ of Object.keys(o).sort()){if(void 0==o[_])continue;let w=_.toLowerCase();(!(w in te||p?.has(w)||tt.test(w)||ti.test(w))||f&&(!f||f.has(w)))&&(m[w]=o[_].trim().replace(/\s+/g," "))}return m},getPayloadHash=async({headers:o,body:p},f)=>{for(let p of Object.keys(o))if(p.toLowerCase()===e9)return o[p];if(void 0==p)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof p||ArrayBuffer.isView(p)||"function"==typeof ArrayBuffer&&p instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(p)){let o=new f;return o.update(toUint8Array(p)),dist_es_toHex(await o.digest())}return"UNSIGNED-PAYLOAD"};let HeaderFormatter=class HeaderFormatter{format(o){let p=[];for(let f of Object.keys(o)){let m=fromUtf8(f);p.push(Uint8Array.from([m.byteLength]),m,this.formatHeaderValue(o[f]))}let f=new Uint8Array(p.reduce((o,p)=>o+p.byteLength,0)),m=0;for(let o of p)f.set(o,m),m+=o.byteLength;return f}formatHeaderValue(o){switch(o.type){case"boolean":return Uint8Array.from([+!o.value]);case"byte":return Uint8Array.from([2,o.value]);case"short":let p=new DataView(new ArrayBuffer(3));return p.setUint8(0,3),p.setInt16(1,o.value,!1),new Uint8Array(p.buffer);case"integer":let f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,o.value,!1),new Uint8Array(f.buffer);case"long":let m=new Uint8Array(9);return m[0]=5,m.set(o.value.bytes,1),m;case"binary":let _=new DataView(new ArrayBuffer(3+o.value.byteLength));_.setUint8(0,6),_.setUint16(1,o.value.byteLength,!1);let w=new Uint8Array(_.buffer);return w.set(o.value,3),w;case"string":let I=fromUtf8(o.value),k=new DataView(new ArrayBuffer(3+I.byteLength));k.setUint8(0,7),k.setUint16(1,I.byteLength,!1);let M=new Uint8Array(k.buffer);return M.set(I,3),M;case"timestamp":let x=new Uint8Array(9);return x[0]=8,x.set(Int64.fromNumber(o.value.valueOf()).bytes,1),x;case"uuid":if(!ta.test(o.value))throw Error(`Invalid UUID received: ${o.value}`);let O=new Uint8Array(17);return O[0]=9,O.set(fromHex(o.value.replace(/\-/g,"")),1),O}}};(ee=eS||(eS={}))[ee.boolTrue=0]="boolTrue",ee[ee.boolFalse=1]="boolFalse",ee[ee.byte=2]="byte",ee[ee.short=3]="short",ee[ee.integer=4]="integer",ee[ee.long=5]="long",ee[ee.byteArray=6]="byteArray",ee[ee.string=7]="string",ee[ee.timestamp=8]="timestamp",ee[ee.uuid=9]="uuid";let ta=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let Int64=class Int64{constructor(o){if(this.bytes=o,8!==o.byteLength)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(o){if(o>0x8000000000000000||o<-0x8000000000000000)throw Error(`${o} is too large (or, if negative, too small) to represent as an Int64`);let p=new Uint8Array(8);for(let f=7,m=Math.abs(Math.round(o));f>-1&&m>0;f--,m/=256)p[f]=m;return o<0&&negate(p),new Int64(p)}valueOf(){let o=this.bytes.slice(0),p=128&o[0];return p&&negate(o),parseInt(dist_es_toHex(o),16)*(p?-1:1)}toString(){return String(this.valueOf())}};function negate(o){for(let p=0;p<8;p++)o[p]^=255;for(let p=7;p>-1&&(o[p]++,0===o[p]);p--);}let prepareRequest=o=>{for(let p of Object.keys((o=httpRequest_HttpRequest.clone(o)).headers))e6.indexOf(p.toLowerCase())>-1&&delete o.headers[p];return o};let SignatureV4=class SignatureV4{constructor({applyChecksum:o,credentials:p,region:f,service:m,sha256:_,uriEscapePath:w=!0}){this.headerFormatter=new HeaderFormatter,this.service=m,this.sha256=_,this.uriEscapePath=w,this.applyChecksum="boolean"!=typeof o||o,this.regionProvider=normalizeProvider_normalizeProvider(f),this.credentialProvider=normalizeProvider_normalizeProvider(p)}async presign(o,p={}){let{signingDate:f=new Date,expiresIn:m=3600,unsignableHeaders:_,unhoistableHeaders:w,signableHeaders:I,hoistableHeaders:k,signingRegion:M,signingService:x}=p,O=await this.credentialProvider();this.validateResolvedCredentials(O);let L=M??await this.regionProvider(),{longDate:B,shortDate:U}=formatDate(f);if(m>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let $=createScope(U,L,x??this.service),q=((o,p={})=>{let{headers:f,query:m={}}=httpRequest_HttpRequest.clone(o);for(let o of Object.keys(f)){let _=o.toLowerCase();("x-amz-"===_.slice(0,6)&&!p.unhoistableHeaders?.has(_)||p.hoistableHeaders?.has(_))&&(m[o]=f[o],delete f[o])}return{...o,headers:f,query:m}})(prepareRequest(o),{unhoistableHeaders:w,hoistableHeaders:k});O.sessionToken&&(q.query[e3]=O.sessionToken),q.query["X-Amz-Algorithm"]=tr,q.query["X-Amz-Credential"]=`${O.accessKeyId}/${$}`,q.query[e1]=B,q.query["X-Amz-Expires"]=m.toString(10);let Z=getCanonicalHeaders(q,_,I);return q.query["X-Amz-SignedHeaders"]=getCanonicalHeaderList(Z),q.query[e2]=await this.getSignature(B,$,this.getSigningKey(O,L,U,x),this.createCanonicalRequest(q,Z,await getPayloadHash(o,this.sha256))),q}async sign(o,p){return"string"==typeof o?this.signString(o,p):o.headers&&o.payload?this.signEvent(o,p):o.message?this.signMessage(o,p):this.signRequest(o,p)}async signEvent({headers:o,payload:p},{signingDate:f=new Date,priorSignature:m,signingRegion:_,signingService:w}){let I=_??await this.regionProvider(),{shortDate:k,longDate:M}=formatDate(f),x=createScope(k,I,w??this.service),O=await getPayloadHash({headers:{},body:p},this.sha256),L=new this.sha256;L.update(o);let B=["AWS4-HMAC-SHA256-PAYLOAD",M,x,m,dist_es_toHex(await L.digest()),O].join(`
`);return this.signString(B,{signingDate:f,signingRegion:I,signingService:w})}async signMessage(o,{signingDate:p=new Date,signingRegion:f,signingService:m}){return this.signEvent({headers:this.headerFormatter.format(o.message.headers),payload:o.message.body},{signingDate:p,signingRegion:f,signingService:m,priorSignature:o.priorSignature}).then(p=>({message:o.message,signature:p}))}async signString(o,{signingDate:p=new Date,signingRegion:f,signingService:m}={}){let _=await this.credentialProvider();this.validateResolvedCredentials(_);let w=f??await this.regionProvider(),{shortDate:I}=formatDate(p),k=new this.sha256(await this.getSigningKey(_,w,I,m));return k.update(toUint8Array(o)),dist_es_toHex(await k.digest())}async signRequest(o,{signingDate:p=new Date,signableHeaders:f,unsignableHeaders:m,signingRegion:_,signingService:w}={}){let I=await this.credentialProvider();this.validateResolvedCredentials(I);let k=_??await this.regionProvider(),M=prepareRequest(o),{longDate:x,shortDate:O}=formatDate(p),L=createScope(O,k,w??this.service);M.headers[e5]=x,I.sessionToken&&(M.headers[e7]=I.sessionToken);let B=await getPayloadHash(M,this.sha256);!((o,p)=>{for(let f of(o=o.toLowerCase(),Object.keys(p)))if(o===f.toLowerCase())return!0;return!1})(e9,M.headers)&&this.applyChecksum&&(M.headers[e9]=B);let U=getCanonicalHeaders(M,m,f),$=await this.getSignature(x,L,this.getSigningKey(I,k,O,w),this.createCanonicalRequest(M,U,B));return M.headers[e4]=`${tr} Credential=${I.accessKeyId}/${L}, SignedHeaders=${getCanonicalHeaderList(U)}, Signature=${$}`,M}createCanonicalRequest(o,p,f){let m=Object.keys(p).sort();return`${o.method}
${this.getCanonicalPath(o)}
${(({query:o={}})=>{let p=[],f={};for(let m of Object.keys(o)){if(m.toLowerCase()===e8)continue;let _=escapeUri(m);p.push(_);let w=o[m];"string"==typeof w?f[_]=`${_}=${escapeUri(w)}`:Array.isArray(w)&&(f[_]=w.slice(0).reduce((o,p)=>o.concat([`${_}=${escapeUri(p)}`]),[]).sort().join("&"))}return p.sort().map(o=>f[o]).filter(o=>o).join("&")})(o)}
${m.map(o=>`${o}:${p[o]}`).join(`
`)}

${m.join(";")}
${f}`}async createStringToSign(o,p,f){let m=new this.sha256;m.update(toUint8Array(f));let _=await m.digest();return`${tr}
${o}
${p}
${dist_es_toHex(_)}`}getCanonicalPath({path:o}){if(this.uriEscapePath){let p=[];for(let f of o.split("/"))f?.length!==0&&"."!==f&&(".."===f?p.pop():p.push(f));return escapeUri(`${o?.startsWith("/")?"/":""}${p.join("/")}${p.length>0&&o?.endsWith("/")?"/":""}`).replace(/%2F/g,"/")}return o}async getSignature(o,p,f,m){let _=await this.createStringToSign(o,p,m),w=new this.sha256(await f);return w.update(toUint8Array(_)),dist_es_toHex(await w.digest())}getSigningKey(o,p,f,m){return getSigningKey(this.sha256,o,f,p,m||this.service)}validateResolvedCredentials(o){if("object"!=typeof o||"string"!=typeof o.accessKeyId||"string"!=typeof o.secretAccessKey)throw Error("Resolved credential object is not valid")}};let formatDate=o=>{var p;let f=("number"==typeof(p=o)?new Date(1e3*p):"string"==typeof p?new Date(Number(p)?1e3*Number(p):p):p).toISOString().replace(/\.\d{3}Z$/,"Z").replace(/[\-:]/g,"");return{longDate:f,shortDate:f.slice(0,8)}},getCanonicalHeaderList=o=>Object.keys(o).sort().join(";"),defaultChimeSDKMessagingHttpAuthSchemeParametersProvider=async(o,p,f)=>({operation:getSmithyContext(p).operation,region:await normalizeProvider_normalizeProvider(o.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(o){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"chime",region:o.region},propertiesExtractor:(o,p)=>({signingProperties:{config:o,context:p}})}}let defaultChimeSDKMessagingHttpAuthSchemeProvider=o=>{let p=[];return o.operation,p.push(createAwsAuthSigv4HttpAuthOption(o)),p},tl={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var td=f(0x1aee62d78),tc=f.n(td),tu="u">typeof Buffer&&Buffer.from?function(o){return Buffer.from(o,"utf8")}:o=>new TextEncoder().encode(o);function convertToBuffer(o){return o instanceof Uint8Array?o:"string"==typeof o?tu(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o)}function isEmptyData(o){return"string"==typeof o?0===o.length:0===o.byteLength}var th={name:"SHA-256"},tp={name:"HMAC",hash:th},tf=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);let tm={};function locateWindow(){return"u">typeof window?window:"u">typeof self?self:tm}var tg=function(){function Sha256(o){this.toHash=new Uint8Array(0),this.secret=o,this.reset()}return Sha256.prototype.update=function(o){if(!isEmptyData(o)){var p=convertToBuffer(o),f=new Uint8Array(this.toHash.byteLength+p.byteLength);f.set(this.toHash,0),f.set(p,this.toHash.byteLength),this.toHash=f}},Sha256.prototype.digest=function(){var o=this;return this.key?this.key.then(function(p){return locateWindow().crypto.subtle.sign(tp,p,o.toHash).then(function(o){return new Uint8Array(o)})}):isEmptyData(this.toHash)?Promise.resolve(tf):Promise.resolve().then(function(){return locateWindow().crypto.subtle.digest(th,o.toHash)}).then(function(o){return Promise.resolve(new Uint8Array(o))})},Sha256.prototype.reset=function(){var o=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise(function(p,f){locateWindow().crypto.subtle.importKey("raw",convertToBuffer(o.secret),tp,!1,["sign"]).then(p,f)}),this.key.catch(function(){}))},Sha256}();function tslib_es6_awaiter(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})}function tslib_es6_generator(o,p){var f,m,_,w,I={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return w={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(w[Symbol.iterator]=function(){return this}),w;function verb(o){return function(p){return step([o,p])}}function step(k){if(f)throw TypeError("Generator is already executing.");for(;w&&(w=0,k[0]&&(I=0)),I;)try{if(f=1,m&&(_=2&k[0]?m.return:k[0]?m.throw||((_=m.return)&&_.call(m),0):m.next)&&!(_=_.call(m,k[1])).done)return _;switch(m=0,_&&(k=[2&k[0],_.value]),k[0]){case 0:case 1:_=k;break;case 4:return I.label++,{value:k[1],done:!1};case 5:I.label++,m=k[1],k=[0];continue;case 7:k=I.ops.pop(),I.trys.pop();continue;default:if(!(_=(_=I.trys).length>0&&_[_.length-1])&&(6===k[0]||2===k[0])){I=0;continue}if(3===k[0]&&(!_||k[1]>_[0]&&k[1]<_[3])){I.label=k[1];break}if(6===k[0]&&I.label<_[1]){I.label=_[1],_=k;break}if(_&&I.label<_[2]){I.label=_[2],I.ops.push(k);break}_[2]&&I.ops.pop(),I.trys.pop();continue}k=p.call(o,I)}catch(o){k=[6,o],m=0}finally{f=_=0}if(5&k[0])throw k[1];return{value:k[0]?k[1]:void 0,done:!0}}}"function"==typeof SuppressedError&&SuppressedError;var tS=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),tv=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],tb=function(){function RawSha256(){this.state=Int32Array.from(tv),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return RawSha256.prototype.update=function(o){if(this.finished)throw Error("Attempted to update an already finished hash.");var p=0,f=o.byteLength;if(this.bytesHashed+=f,8*this.bytesHashed>0x1fffffffffffff)throw Error("Cannot hash more than 2^53 - 1 bits");for(;f>0;)this.buffer[this.bufferLength++]=o[p++],f--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0)},RawSha256.prototype.digest=function(){if(!this.finished){var o=8*this.bytesHashed,p=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),f=this.bufferLength;if(p.setUint8(this.bufferLength++,128),f%64>=56){for(var m=this.bufferLength;m<64;m++)p.setUint8(m,0);this.hashBuffer(),this.bufferLength=0}for(var m=this.bufferLength;m<56;m++)p.setUint8(m,0);p.setUint32(56,Math.floor(o/0x100000000),!0),p.setUint32(60,o),this.hashBuffer(),this.finished=!0}for(var _=new Uint8Array(32),m=0;m<8;m++)_[4*m]=this.state[m]>>>24&255,_[4*m+1]=this.state[m]>>>16&255,_[4*m+2]=this.state[m]>>>8&255,_[4*m+3]=this.state[m]>>>0&255;return _},RawSha256.prototype.hashBuffer=function(){for(var o=this.buffer,p=this.state,f=p[0],m=p[1],_=p[2],w=p[3],I=p[4],k=p[5],M=p[6],x=p[7],O=0;O<64;O++){if(O<16)this.temp[O]=(255&o[4*O])<<24|(255&o[4*O+1])<<16|(255&o[4*O+2])<<8|255&o[4*O+3];else{var L=this.temp[O-2],B=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,U=((L=this.temp[O-15])>>>7|L<<25)^(L>>>18|L<<14)^L>>>3;this.temp[O]=(B+this.temp[O-7]|0)+(U+this.temp[O-16]|0)}var $=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&k^~I&M)|0)+(x+(tS[O]+this.temp[O]|0)|0)|0,q=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&m^f&_^m&_)|0;x=M,M=k,k=I,I=w+$|0,w=_,_=m,m=f,f=$+q|0}p[0]+=f,p[1]+=m,p[2]+=_,p[3]+=w,p[4]+=I,p[5]+=k,p[6]+=M,p[7]+=x},RawSha256}(),ty=function(){function Sha256(o){this.secret=o,this.hash=new tb,this.reset()}return Sha256.prototype.update=function(o){if(!isEmptyData(o)&&!this.error)try{this.hash.update(convertToBuffer(o))}catch(o){this.error=o}},Sha256.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},Sha256.prototype.digest=function(){return tslib_es6_awaiter(this,void 0,void 0,function(){return tslib_es6_generator(this,function(o){return[2,this.digestSync()]})})},Sha256.prototype.reset=function(){if(this.hash=new tb,this.secret){this.outer=new tb;var o=bufferFromSecret(this.secret),p=new Uint8Array(64);p.set(o);for(var f=0;f<64;f++)o[f]^=54,p[f]^=92;this.hash.update(o),this.outer.update(p);for(var f=0;f<o.byteLength;f++)o[f]=0}},Sha256}();function bufferFromSecret(o){var p=convertToBuffer(o);if(p.byteLength>64){var f=new tb;f.update(p),p=f.digest()}var m=new Uint8Array(64);return m.set(p),m}var t_=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function supportsWebCrypto(o){return!!supportsSecureRandom(o)&&"object"==typeof o.crypto.subtle&&supportsSubtleCrypto(o.crypto.subtle)}function supportsSecureRandom(o){return"object"==typeof o&&"object"==typeof o.crypto&&"function"==typeof o.crypto.getRandomValues}function supportsSubtleCrypto(o){return o&&t_.every(function(p){return"function"==typeof o[p]})}var tC=function(){function Sha256(o){supportsWebCrypto(locateWindow())?this.hash=new tg(o):this.hash=new ty(o)}return Sha256.prototype.update=function(o,p){this.hash.update(convertToBuffer(o))},Sha256.prototype.digest=function(){return this.hash.digest()},Sha256.prototype.reset=function(){this.hash.reset()},Sha256}(),tT=f(0x6fb93939),tE=f.n(tT);let tw="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=o=>{if("string"==typeof o){if(tw)return tw.encode(o).byteLength;let p=o.length;for(let f=p-1;f>=0;f--){let m=o.charCodeAt(f);m>127&&m<=2047?p++:m>2047&&m<=65535&&(p+=2),m>=56320&&m<=57343&&f--}return p}if("number"==typeof o.byteLength)return o.byteLength;if("number"==typeof o.size)return o.size;throw Error(`Body Length computation failed for ${o}`)},getSkewCorrectedDate=o=>new Date(Date.now()+o),getDateHeader=o=>HttpResponse.isInstance(o)?o.headers?.date??o.headers?.Date:void 0,getUpdatedSystemClockOffset=(o,p)=>{let f=Date.parse(o);return Math.abs(getSkewCorrectedDate(p).getTime()-f)>=3e5?f-Date.now():p},throwSigningPropertyError=(o,p)=>{if(!p)throw Error(`Property \`${o}\` is not resolved for AWS SDK SigV4Auth`);return p},validateSigningProperties=async o=>{let p=throwSigningPropertyError("context",o.context),f=throwSigningPropertyError("config",o.config),m=p.endpointV2?.properties?.authSchemes?.[0],_=throwSigningPropertyError("signer",f.signer),w=await _(m),I=o?.signingRegion;return{config:f,signer:w,signingRegion:I,signingRegionSet:o?.signingRegionSet,signingName:o?.signingName}};let AwsSdkSigV4Signer=class AwsSdkSigV4Signer{async sign(o,p,f){if(!httpRequest_HttpRequest.isInstance(o))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let m=await validateSigningProperties(f),{config:_,signer:w}=m,{signingRegion:I,signingName:k}=m,M=f.context;if(M?.authSchemes?.length){let[o,p]=M.authSchemes;o?.name==="sigv4a"&&p?.name==="sigv4"&&(I=p?.signingRegion??I,k=p?.signingName??k)}return await w.sign(o,{signingDate:getSkewCorrectedDate(_.systemClockOffset),signingRegion:I,signingService:k})}errorHandler(o){return p=>{let f=p.ServerTime??getDateHeader(p.$response);if(f){let m=throwSigningPropertyError("config",o.config),_=m.systemClockOffset;m.systemClockOffset=getUpdatedSystemClockOffset(f,m.systemClockOffset),m.systemClockOffset!==_&&p.$metadata&&(p.$metadata.clockSkewCorrected=!0)}throw p}}successHandler(o,p){let f=getDateHeader(o);if(f){let o=throwSigningPropertyError("config",p.config);o.systemClockOffset=getUpdatedSystemClockOffset(f,o.systemClockOffset)}}};let tI="required",tA="argv",tk="isSet",tM="booleanEquals",tx="error",tP="endpoint",tR="tree",tO="PartitionResult",tD={[tI]:!1,type:"String"},tL={[tI]:!0,default:!1,type:"Boolean"},tN={ref:"Endpoint"},tF={fn:tM,[tA]:[{ref:"UseFIPS"},!0]},tV={fn:tM,[tA]:[{ref:"UseDualStack"},!0]},tB={},tU={fn:"getAttr",[tA]:[{ref:tO},"supportsFIPS"]},tj={fn:tM,[tA]:[!0,{fn:"getAttr",[tA]:[{ref:tO},"supportsDualStack"]}]},tH=[tF],tz=[tV],tG=[{ref:"Region"}],tW={version:"1.0",parameters:{Region:tD,UseDualStack:tL,UseFIPS:tL,Endpoint:tD},rules:[{conditions:[{fn:tk,[tA]:[tN]}],rules:[{conditions:tH,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:tx},{conditions:tz,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:tx},{endpoint:{url:tN,properties:tB,headers:tB},type:tP}],type:tR},{conditions:[{fn:tk,[tA]:tG}],rules:[{conditions:[{fn:"aws.partition",[tA]:tG,assign:tO}],rules:[{conditions:[tF,tV],rules:[{conditions:[{fn:tM,[tA]:[!0,tU]},tj],rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:tx}],type:tR},{conditions:tH,rules:[{conditions:[{fn:tM,[tA]:[tU,!0]}],rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR},{error:"FIPS is enabled but this partition does not support FIPS",type:tx}],type:tR},{conditions:tz,rules:[{conditions:[tj],rules:[{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR},{error:"DualStack is enabled but this partition does not support DualStack",type:tx}],type:tR},{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR}],type:tR},{error:"Invalid Configuration: Missing Region",type:tx}]},t$=new EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver=(o,p={})=>t$.get(o,()=>((o,p)=>{let{endpointParams:f,logger:m}=p,{parameters:_,rules:w}=o;p.logger?.debug?.(`${B} Initial EndpointParams: ${toDebugString(f)}`);let I=Object.entries(_).filter(([,o])=>null!=o.default).map(([o,p])=>[o,p.default]);if(I.length>0)for(let[o,p]of I)f[o]=f[o]??p;for(let o of Object.entries(_).filter(([,o])=>o.required).map(([o])=>o))if(null==f[o])throw new EndpointError(`Missing required parameter: '${o}'`);let k=evaluateRules(w,{endpointParams:f,logger:m,referenceRecord:{}});return p.logger?.debug?.(`${B} Resolved endpoint: ${toDebugString(k)}`),k})(tW,{endpointParams:o,logger:p.logger}));L.aws=ey;let tK=["in-region","cross-region","mobile","standard","legacy"];let ChimeSDKMessagingClient=class ChimeSDKMessagingClient extends Client{constructor(...[o]){const p=((o,p)=>{var f;let m,_,w,I,k,M,x,O,L={...(w=async()=>{if(void 0===o.region)throw Error("Region is missing from runtimeConfig");let p=o.region;return"string"==typeof p?p:p()},{setRegion(o){w=o},region:()=>w}),...(o=>{let p=[];for(let f in eu){let m=eu[f];void 0!==o[m]&&p.push({algorithmId:()=>m,checksumConstructor:()=>o[m]})}return{_checksumAlgorithms:p,addChecksumAlgorithm(o){this._checksumAlgorithms.push(o)},checksumAlgorithms(){return this._checksumAlgorithms}}})(o),...(I=o.retryStrategy,{setRetryStrategy(o){I=o},retryStrategy:()=>I}),...(k=o.httpHandler,{setHttpHandler(o){k=o},httpHandler:()=>k,updateHttpClientConfig(o,p){k.updateHttpClientConfig(o,p)},httpHandlerConfigs:()=>k.httpHandlerConfigs()}),...(M=o.httpAuthSchemes,x=o.httpAuthSchemeProvider,O=o.credentials,{setHttpAuthScheme(o){let p=M.findIndex(p=>p.schemeId===o.schemeId);-1===p?M.push(o):M.splice(p,1,o)},httpAuthSchemes:()=>M,setHttpAuthSchemeProvider(o){x=o},httpAuthSchemeProvider:()=>x,setCredentials(o){O=o},credentials:()=>O})};p.forEach(o=>o.configure(L));return{...o,...{region:L.region()},...{...(m={},(f=L).checksumAlgorithms().forEach(o=>{m[o.algorithmId()]=o.checksumConstructor()}),m),...((_={}).retryStrategy=f.retryStrategy(),_)},...{httpHandler:L.httpHandler()},...{httpAuthSchemes:L.httpAuthSchemes(),httpAuthSchemeProvider:L.httpAuthSchemeProvider(),credentials:L.credentials()}}})((o=>({...(o=>{let p,f;o.credentials&&(p=((o,p,f)=>{let m,_,w;if(void 0===o)return;let I="function"!=typeof o?async()=>Promise.resolve(o):o,k=!1,coalesceProvider=async o=>{_||(_=I(o));try{m=await _,w=!0,k=!1}finally{_=void 0}return m};return void 0===p?async o=>((!w||o?.forceRefresh)&&(m=await coalesceProvider(o)),m):async o=>((!w||o?.forceRefresh)&&(m=await coalesceProvider(o)),k||(f(m)?p(m)&&await coalesceProvider(o):k=!0),m)})(o.credentials,isIdentityExpired,doesIdentityRequireRefresh)),p||(p=o.credentialDefaultProvider?dist_es_normalizeProvider_normalizeProvider(o.credentialDefaultProvider(Object.assign({},o,{parentClientConfig:o}))):async()=>{throw Error("`credentials` is missing")});let{signingEscapePath:m=!0,systemClockOffset:_=o.systemClockOffset||0,sha256:w}=o;return f=o.signer?dist_es_normalizeProvider_normalizeProvider(o.signer):o.regionInfoProvider?()=>dist_es_normalizeProvider_normalizeProvider(o.region)().then(async p=>[await o.regionInfoProvider(p,{useFipsEndpoint:await o.useFipsEndpoint(),useDualstackEndpoint:await o.useDualstackEndpoint()})||{},p]).then(([f,_])=>{let{signingRegion:I,signingService:k}=f;o.signingRegion=o.signingRegion||I||_,o.signingName=o.signingName||k||o.serviceId;let M={...o,credentials:p,region:o.signingRegion,service:o.signingName,sha256:w,uriEscapePath:m};return new(o.signerConstructor||SignatureV4)(M)}):async f=>{let _=(f=Object.assign({},{name:"sigv4",signingName:o.signingName||o.defaultSigningName,signingRegion:await dist_es_normalizeProvider_normalizeProvider(o.region)(),properties:{}},f)).signingRegion,I=f.signingName;o.signingRegion=o.signingRegion||_,o.signingName=o.signingName||I||o.serviceId;let k={...o,credentials:p,region:o.signingRegion,service:o.signingName,sha256:w,uriEscapePath:m};return new(o.signerConstructor||SignatureV4)(k)},{...o,systemClockOffset:_,signingEscapePath:m,credentials:p,signer:f}})(o)}))((o=>{let p,f=o.tls??!0,{endpoint:m}=o,_={...o,endpoint:null!=m?async()=>toEndpointV1(await normalizeProvider_normalizeProvider(m)()):void 0,tls:f,isCustomEndpoint:!!m,useDualstackEndpoint:normalizeProvider_normalizeProvider(o.useDualstackEndpoint??!1),useFipsEndpoint:normalizeProvider_normalizeProvider(o.useFipsEndpoint??!1)};return _.serviceConfiguredEndpoint=async()=>(o.serviceId&&!p&&(p=getEndpointFromConfig(o.serviceId)),p),_})(resolveHostHeaderConfig((o=>{let{region:p,useFipsEndpoint:f}=o;if(!p)throw Error("Region is missing");return{...o,region:async()=>"string"==typeof p?getRealRegion(p):getRealRegion(await p()),useFipsEndpoint:async()=>!!isFipsRegion("string"==typeof p?p:await p())||("function"!=typeof f?Promise.resolve(!!f):f())}})((o=>{let{retryStrategy:p}=o,f=normalizeProvider_normalizeProvider(o.maxAttempts??3);return{...o,maxAttempts:f,retryStrategy:async()=>p||(await normalizeProvider_normalizeProvider(o.retryMode)()===eg.ADAPTIVE?new AdaptiveRetryStrategy(f):new StandardRetryStrategy(f))}})(resolveUserAgentConfig((o=>({...o,useDualstackEndpoint:o.useDualstackEndpoint??!1,useFipsEndpoint:o.useFipsEndpoint??!1,defaultSigningName:"chime"}))((o=>{let p=(({defaultsMode:o}={})=>{var p,f,m;let _,w,I,k,M;return p=async()=>{let p="function"==typeof o?await o():o;switch(p?.toLowerCase()){case"auto":let f,m;return Promise.resolve((f="u">typeof window&&window?.navigator?.userAgent?tE().parse(window.navigator.userAgent):void 0,"tablet"===(m=f?.platform?.type)||"mobile"===m)?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(p?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw Error(`Invalid parameter for "defaultsMode", expect ${tK.join(", ")}, got ${p}`)}},k=!1,M=async()=>{w||(w=p());try{_=await w,I=!0,k=!1}finally{w=void 0}return _},void 0===f?async o=>((!I||o?.forceRefresh)&&(_=await M()),_):async o=>((!I||o?.forceRefresh)&&(_=await M()),k||(m&&!m(_)?k=!0:f(_)&&await M()),_)})(o),defaultConfigProvider=()=>p().then(loadConfigsForDefaultMode),f={apiVersion:"2021-05-15",base64Decoder:o?.base64Decoder??fromBase64,base64Encoder:o?.base64Encoder??toBase64_browser_toBase64,disableHostPrefix:o?.disableHostPrefix??!1,endpointProvider:o?.endpointProvider??defaultEndpointResolver,extensions:o?.extensions??[],httpAuthSchemeProvider:o?.httpAuthSchemeProvider??defaultChimeSDKMessagingHttpAuthSchemeProvider,httpAuthSchemes:o?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:o=>o.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:o?.logger??new NoOpLogger,serviceId:o?.serviceId??"Chime SDK Messaging",urlParser:o?.urlParser??parseUrl,utf8Decoder:o?.utf8Decoder??fromUtf8,utf8Encoder:o?.utf8Encoder??toUtf8_browser_toUtf8};return{...f,...o,runtime:"browser",defaultsMode:p,bodyLengthChecker:o?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:o?.credentialDefaultProvider??(o=>()=>Promise.reject(Error("Credential is missing"))),defaultUserAgentProvider:o?.defaultUserAgentProvider??(({serviceId:o,clientVersion:p})=>async()=>{let f="u">typeof window&&window?.navigator?.userAgent?tE().parse(window.navigator.userAgent):void 0,m=[["aws-sdk-js",p],["ua","2.0"],[`os/${f?.os?.name||"other"}`,f?.os?.version],["lang/js"],["md/browser",`${f?.browser?.name??"unknown"}_${f?.browser?.version??"unknown"}`]];return o&&m.push([`api/${o}`,p]),m})({serviceId:f.serviceId,clientVersion:tc().version}),maxAttempts:o?.maxAttempts??3,region:o?.region??(()=>Promise.reject("Region is missing")),requestHandler:FetchHttpHandler.create(o?.requestHandler??defaultConfigProvider),retryMode:o?.retryMode??(async()=>(await defaultConfigProvider()).retryMode||eO),sha256:o?.sha256??tC,streamCollector:o?.streamCollector??stream_collector_streamCollector,useDualstackEndpoint:o?.useDualstackEndpoint??(()=>Promise.resolve(!1)),useFipsEndpoint:o?.useFipsEndpoint??(()=>Promise.resolve(!1))}})(o||{})))))))),o?.extensions||[]);super(p),this.config=p,this.middlewareStack.use((o=>({applyToStack:p=>{p.add((p,f)=>async m=>{let{request:_}=m;if(!httpRequest_HttpRequest.isInstance(_))return p(m);let{headers:w}=_,I=f?.userAgent?.map(escapeUserAgent)||[],k=(await o.defaultUserAgentProvider()).map(escapeUserAgent),M=o?.customUserAgent?.map(escapeUserAgent)||[],x=[].concat([...k,...I,...M]).join(" "),O=[...k.filter(o=>o.startsWith("aws-sdk-")),...M].join(" ");return"browser"!==o.runtime?(O&&(w[eC]=w[eC]?`${w[e_]} ${O}`:O),w[e_]=x):w[eC]=x,p({...m,request:_})},ew)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add((p,f)=>async m=>{let _,w=await o.retryStrategy(),I=await o.maxAttempts();if(void 0===(_=w).acquireInitialRetryToken||void 0===_.refreshRetryTokenForRetry||void 0===_.recordSuccess)return w?.mode&&(f.userAgent=[...f.userAgent||[],["cfg/retry-mode",w.mode]]),w.retry(p,m);{let o=await w.acquireInitialRetryToken(f.partition_id),_=Error(),k=0,M=0,{request:x}=m,O=httpRequest_HttpRequest.isInstance(x);for(O&&(x.headers["amz-sdk-invocation-id"]=esm_browser_v4());;)try{O&&(x.headers["amz-sdk-request"]=`attempt=${k+1}; max=${I}`);let{response:f,output:_}=await p(m);return w.recordSuccess(o),_.$metadata.attempts=k+1,_.$metadata.totalRetryDelay=M,{response:f,output:_}}catch(I){let p=getRetryErrorInfo(I);if(_=asSdkError(I),O&&isStreamingPayload(x))throw(f.logger instanceof NoOpLogger?console:f.logger)?.warn("An error was encountered in a non-retryable streaming request."),_;try{o=await w.refreshRetryTokenForRetry(o,p)}catch{throw _.$metadata||(_.$metadata={}),_.$metadata.attempts=k+1,_.$metadata.totalRetryDelay=M,_}k=o.getRetryCount();let m=o.getRetryDelay();M+=m,await new Promise(o=>setTimeout(o,m))}}},eX)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add(contentLengthMiddleware(o.bodyLengthChecker),e0)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add(p=>async f=>{if(!httpRequest_HttpRequest.isInstance(f.request))return p(f);let{request:m}=f,{handlerProtocol:_=""}=o.requestHandler.metadata||{};if(_.indexOf("h2")>=0&&!m.headers[":authority"])delete m.headers.host,m.headers[":authority"]=m.hostname+(m.port?":"+m.port:"");else if(!m.headers.host){let o=m.hostname;null!=m.port&&(o+=`:${m.port}`),m.headers.host=o}return p(f)},w)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:o=>{o.add((o,p)=>async f=>{try{let m=await o(f),{clientName:_,commandName:w,logger:I,dynamoDbDocumentClientOptions:k={}}=p,{overrideInputFilterSensitiveLog:M,overrideOutputFilterSensitiveLog:x}=k,O=M??p.inputFilterSensitiveLog,L=x??p.outputFilterSensitiveLog,{$metadata:B,...U}=m.output;return I?.info?.({clientName:_,commandName:w,input:O(f.input),output:L(U),metadata:B}),m}catch(M){let{clientName:o,commandName:m,logger:_,dynamoDbDocumentClientOptions:w={}}=p,{overrideInputFilterSensitiveLog:I}=w,k=I??p.inputFilterSensitiveLog;throw _?.error?.({clientName:o,commandName:m,input:k(f.input),error:M,metadata:M.$metadata}),M}},I)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add(p=>async f=>{let{request:m}=f;if(!httpRequest_HttpRequest.isInstance(m)||"node"!==o.runtime||m.headers.hasOwnProperty(k))return p(f);let _,nonEmptyString=o=>"string"==typeof o&&o.length>0;return nonEmptyString(void 0)&&nonEmptyString(_)&&(m.headers[k]=_),p({...f,request:m})},M)}}))(this.config)),this.middlewareStack.use(((o,{httpAuthSchemeParametersProvider:p,identityProviderConfigProvider:f})=>({applyToStack:m=>{let _;m.addRelativeTo((_={httpAuthSchemeParametersProvider:p,identityProviderConfigProvider:f},(p,f)=>async m=>{let w=o.httpAuthSchemeProvider(await _.httpAuthSchemeParametersProvider(o,f,m.input)),I=convertHttpAuthSchemesToMap(o.httpAuthSchemes),k=getSmithyContext(f),M=[];for(let p of w){let m=I.get(p.schemeId);if(!m){M.push(`HttpAuthScheme \`${p.schemeId}\` was not enabled for this service.`);continue}let w=m.identityProvider(await _.identityProviderConfigProvider(o));if(!w){M.push(`HttpAuthScheme \`${p.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:x={},signingProperties:O={}}=p.propertiesExtractor?.(o,f)||{};p.identityProperties=Object.assign(p.identityProperties||{},x),p.signingProperties=Object.assign(p.signingProperties||{},O),k.selectedHttpAuthScheme={httpAuthOption:p,identity:await w(p.identityProperties),signer:m.signer};break}if(!k.selectedHttpAuthScheme)throw Error(M.join(`
`));return p(m)}),eR)}}))(this.config,{httpAuthSchemeParametersProvider:defaultChimeSDKMessagingHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async o=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":o.credentials})})),this.middlewareStack.use((o=>({applyToStack:o=>{o.addRelativeTo((o,p)=>async f=>{if(!httpRequest_HttpRequest.isInstance(f.request))return o(f);let m=getSmithyContext(p).selectedHttpAuthScheme;if(!m)throw Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:_={}},identity:w,signer:I}=m,k=await o({...f,request:await I.sign(f.request,w,_)}).catch((I.errorHandler||(o=>o=>{throw o}))(_));return(I.successHandler||((o,p)=>{}))(k.response,_),k},eQ)}}))(this.config))}destroy(){super.destroy()}};let parseJsonBody=(o,p)=>collect_stream_body_collectBody(o,p).then(o=>p.utf8Encoder(o)).then(o=>{if(o.length)try{return JSON.parse(o)}catch(p){throw p?.name==="SyntaxError"&&Object.defineProperty(p,"$responseBodyText",{value:o}),p}return{}}),parseJsonErrorBody=async(o,p)=>{let f=await parseJsonBody(o,p);return f.message=f.message??f.Message,f};let ChimeSDKMessagingServiceException=class ChimeSDKMessagingServiceException extends ServiceException{constructor(o){super(o),Object.setPrototypeOf(this,ChimeSDKMessagingServiceException.prototype)}};let tq={ALL:"ALL",FILTERED:"FILTERED",NONE:"NONE"},tJ={DEFAULT:"DEFAULT",HIDDEN:"HIDDEN"},tY={AccessDenied:"AccessDenied",BadRequest:"BadRequest",Conflict:"Conflict",Forbidden:"Forbidden",NotFound:"NotFound",PhoneNumberAssociationsExist:"PhoneNumberAssociationsExist",PreconditionFailed:"PreconditionFailed",ResourceLimitExceeded:"ResourceLimitExceeded",ServiceFailure:"ServiceFailure",ServiceUnavailable:"ServiceUnavailable",Throttled:"Throttled",Throttling:"Throttling",Unauthorized:"Unauthorized",Unprocessable:"Unprocessable",VoiceConnectorGroupAssociationsExist:"VoiceConnectorGroupAssociationsExist"};let BadRequestException=class BadRequestException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"BadRequestException",$fault:"client",...o}),this.name="BadRequestException",this.$fault="client",Object.setPrototypeOf(this,BadRequestException.prototype),this.Code=o.Code,this.Message=o.Message}};let ConflictException=class ConflictException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ConflictException",$fault:"client",...o}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,ConflictException.prototype),this.Code=o.Code,this.Message=o.Message}};let ForbiddenException=class ForbiddenException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ForbiddenException",$fault:"client",...o}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,ForbiddenException.prototype),this.Code=o.Code,this.Message=o.Message}};let NotFoundException=class NotFoundException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"NotFoundException",$fault:"client",...o}),this.name="NotFoundException",this.$fault="client",Object.setPrototypeOf(this,NotFoundException.prototype),this.Code=o.Code,this.Message=o.Message}};let ServiceFailureException=class ServiceFailureException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ServiceFailureException",$fault:"server",...o}),this.name="ServiceFailureException",this.$fault="server",Object.setPrototypeOf(this,ServiceFailureException.prototype),this.Code=o.Code,this.Message=o.Message}};let ServiceUnavailableException=class ServiceUnavailableException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ServiceUnavailableException",$fault:"server",...o}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,ServiceUnavailableException.prototype),this.Code=o.Code,this.Message=o.Message}};let ThrottledClientException=class ThrottledClientException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ThrottledClientException",$fault:"client",...o}),this.name="ThrottledClientException",this.$fault="client",Object.setPrototypeOf(this,ThrottledClientException.prototype),this.Code=o.Code,this.Message=o.Message}};let UnauthorizedClientException=class UnauthorizedClientException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"UnauthorizedClientException",$fault:"client",...o}),this.name="UnauthorizedClientException",this.$fault="client",Object.setPrototypeOf(this,UnauthorizedClientException.prototype),this.Code=o.Code,this.Message=o.Message}};let ResourceLimitExceededException=class ResourceLimitExceededException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ResourceLimitExceededException",$fault:"client",...o}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Code=o.Code,this.Message=o.Message}};let tX={CREATED_TIMESTAMP:"CREATED_TIMESTAMP",LAST_MESSAGE_TIMESTAMP:"LAST_MESSAGE_TIMESTAMP"},tQ={RESTRICTED:"RESTRICTED",UNRESTRICTED:"UNRESTRICTED"},tZ={PRIVATE:"PRIVATE",PUBLIC:"PUBLIC"},t0={ASYNC:"ASYNC"},t1={ABORT:"ABORT",CONTINUE:"CONTINUE"},t2={DEFAULT:"DEFAULT",VOIP:"VOIP"},t3={NON_PERSISTENT:"NON_PERSISTENT",PERSISTENT:"PERSISTENT"},t4={DENIED:"DENIED",FAILED:"FAILED",PENDING:"PENDING",SENT:"SENT"},t5={CONTROL:"CONTROL",STANDARD:"STANDARD"},t6={Channel:"Channel",ChannelMessage:"ChannelMessage"},t8={ASCENDING:"ASCENDING",DESCENDING:"DESCENDING"},t9={MEMBERS:"MEMBERS"},t7={EQUALS:"EQUALS",INCLUDES:"INCLUDES"},IdentityFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq}}),BatchChannelMembershipsFilterSensitiveLog=o=>({...o,...o.InvitedBy&&{InvitedBy:IdentityFilterSensitiveLog(o.InvitedBy)},...o.Members&&{Members:o.Members.map(o=>IdentityFilterSensitiveLog(o))}}),BatchCreateChannelMembershipResponseFilterSensitiveLog=o=>({...o,...o.BatchChannelMemberships&&{BatchChannelMemberships:BatchChannelMembershipsFilterSensitiveLog(o.BatchChannelMemberships)}}),ChannelFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq},...o.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(o.CreatedBy)}}),ChannelAssociatedWithFlowSummaryFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq}}),ChannelBanFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)},...o.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(o.CreatedBy)}}),ChannelBanSummaryFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),ProcessorFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq}}),ChannelFlowFilterSensitiveLog=o=>({...o,...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))},...o.Name&&{Name:eq}}),MessageAttributeValueFilterSensitiveLog=o=>({...o,...o.StringValues&&{StringValues:eq}}),PushNotificationConfigurationFilterSensitiveLog=o=>({...o,...o.Title&&{Title:eq},...o.Body&&{Body:eq}}),ChannelMessageCallbackFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.PushNotification&&{PushNotification:PushNotificationConfigurationFilterSensitiveLog(o.PushNotification)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),ChannelFlowCallbackRequestFilterSensitiveLog=o=>({...o,...o.ChannelMessage&&{ChannelMessage:ChannelMessageCallbackFilterSensitiveLog(o.ChannelMessage)}}),ChannelFlowSummaryFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))}}),ChannelMembershipFilterSensitiveLog=o=>({...o,...o.InvitedBy&&{InvitedBy:IdentityFilterSensitiveLog(o.InvitedBy)},...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),ChannelSummaryFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq}}),ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog=o=>({...o,...o.ChannelSummary&&{ChannelSummary:ChannelSummaryFilterSensitiveLog(o.ChannelSummary)}}),PushNotificationPreferencesFilterSensitiveLog=o=>({...o,...o.FilterRule&&{FilterRule:eq}}),ChannelMembershipPreferencesFilterSensitiveLog=o=>({...o,...o.PushNotifications&&{PushNotifications:PushNotificationPreferencesFilterSensitiveLog(o.PushNotifications)}}),ChannelMembershipSummaryFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),ChannelMessageFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.Sender&&{Sender:IdentityFilterSensitiveLog(o.Sender)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),ChannelMessageSummaryFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.Sender&&{Sender:IdentityFilterSensitiveLog(o.Sender)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog=o=>({...o,...o.ChannelSummary&&{ChannelSummary:ChannelSummaryFilterSensitiveLog(o.ChannelSummary)}}),ChannelModeratorFilterSensitiveLog=o=>({...o,...o.Moderator&&{Moderator:IdentityFilterSensitiveLog(o.Moderator)},...o.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(o.CreatedBy)}}),ChannelModeratorSummaryFilterSensitiveLog=o=>({...o,...o.Moderator&&{Moderator:IdentityFilterSensitiveLog(o.Moderator)}}),TagFilterSensitiveLog=o=>({...o,...o.Key&&{Key:eq},...o.Value&&{Value:eq}}),CreateChannelRequestFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq},...o.ClientRequestToken&&{ClientRequestToken:eq},...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))},...o.ChannelId&&{ChannelId:eq}}),CreateChannelBanResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),CreateChannelFlowRequestFilterSensitiveLog=o=>({...o,...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))},...o.Name&&{Name:eq},...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))},...o.ClientRequestToken&&{ClientRequestToken:eq}}),CreateChannelMembershipResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),CreateChannelModeratorResponseFilterSensitiveLog=o=>({...o,...o.ChannelModerator&&{ChannelModerator:IdentityFilterSensitiveLog(o.ChannelModerator)}}),DescribeChannelResponseFilterSensitiveLog=o=>({...o,...o.Channel&&{Channel:ChannelFilterSensitiveLog(o.Channel)}}),DescribeChannelBanResponseFilterSensitiveLog=o=>({...o,...o.ChannelBan&&{ChannelBan:ChannelBanFilterSensitiveLog(o.ChannelBan)}}),DescribeChannelFlowResponseFilterSensitiveLog=o=>({...o,...o.ChannelFlow&&{ChannelFlow:ChannelFlowFilterSensitiveLog(o.ChannelFlow)}}),DescribeChannelMembershipResponseFilterSensitiveLog=o=>({...o,...o.ChannelMembership&&{ChannelMembership:ChannelMembershipFilterSensitiveLog(o.ChannelMembership)}}),DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.ChannelMembership&&{ChannelMembership:ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog(o.ChannelMembership)}}),DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.Channel&&{Channel:ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog(o.Channel)}}),DescribeChannelModeratorResponseFilterSensitiveLog=o=>({...o,...o.ChannelModerator&&{ChannelModerator:ChannelModeratorFilterSensitiveLog(o.ChannelModerator)}}),GetChannelMembershipPreferencesResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)},...o.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(o.Preferences)}}),GetChannelMessageResponseFilterSensitiveLog=o=>({...o,...o.ChannelMessage&&{ChannelMessage:ChannelMessageFilterSensitiveLog(o.ChannelMessage)}}),ListChannelBansRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelBansResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq},...o.ChannelBans&&{ChannelBans:o.ChannelBans.map(o=>ChannelBanSummaryFilterSensitiveLog(o))}}),ListChannelFlowsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelFlowsResponseFilterSensitiveLog=o=>({...o,...o.ChannelFlows&&{ChannelFlows:o.ChannelFlows.map(o=>ChannelFlowSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsResponseFilterSensitiveLog=o=>({...o,...o.ChannelMemberships&&{ChannelMemberships:o.ChannelMemberships.map(o=>ChannelMembershipSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.ChannelMemberships&&{ChannelMemberships:o.ChannelMemberships.map(o=>ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelMessagesRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelMessagesResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq},...o.ChannelMessages&&{ChannelMessages:o.ChannelMessages.map(o=>ChannelMessageSummaryFilterSensitiveLog(o))}}),ListChannelModeratorsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelModeratorsResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq},...o.ChannelModerators&&{ChannelModerators:o.ChannelModerators.map(o=>ChannelModeratorSummaryFilterSensitiveLog(o))}}),ListChannelsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelsResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelAssociatedWithFlowSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListSubChannelsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListSubChannelsResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListTagsForResourceResponseFilterSensitiveLog=o=>({...o,...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))}}),PutChannelMembershipPreferencesRequestFilterSensitiveLog=o=>({...o,...o.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(o.Preferences)}}),PutChannelMembershipPreferencesResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)},...o.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(o.Preferences)}}),SearchChannelsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),SearchChannelsResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),SendChannelMessageRequestFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.ClientRequestToken&&{ClientRequestToken:eq},...o.PushNotification&&{PushNotification:PushNotificationConfigurationFilterSensitiveLog(o.PushNotification)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),TagResourceRequestFilterSensitiveLog=o=>({...o,...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))}}),UntagResourceRequestFilterSensitiveLog=o=>({...o,...o.TagKeys&&{TagKeys:eq}}),UpdateChannelRequestFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq}}),UpdateChannelFlowRequestFilterSensitiveLog=o=>({...o,...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))},...o.Name&&{Name:eq}}),UpdateChannelMessageRequestFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.ContentType&&{ContentType:eq}}),se_AssociateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/channel-flow"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ChannelFlowArn:[]})),m.m("PUT").h(_).b(f),m.build()},se_BatchCreateChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iw]:[,"batch-create"]});return f=JSON.stringify(take(o,{MemberArns:o=>_json(o),SubChannelId:[],Type:[]})),m.m("POST").h(_).q(w).b(f),m.build()},se_ChannelFlowCallbackCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let _=map({[iw]:[,"channel-flow-callback"]});return f=JSON.stringify(take(o,{CallbackId:[!0,o=>o??esm_browser_v4()],ChannelMessage:o=>_json(o),DeleteResource:[]})),m.m("POST").h({"content-type":"application/json"}).q(_).b(f),m.build()},se_CreateChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels"),f=JSON.stringify(take(o,{AppInstanceArn:[],ChannelId:[],ClientRequestToken:[!0,o=>o??esm_browser_v4()],ElasticChannelConfiguration:o=>_json(o),ExpirationSettings:o=>_json(o),MemberArns:o=>_json(o),Metadata:[],Mode:[],ModeratorArns:o=>_json(o),Name:[],Privacy:[],Tags:o=>_json(o)})),m.m("POST").h(_).b(f),m.build()},se_CreateChannelBanCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/bans"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{MemberArn:[]})),m.m("POST").h(_).b(f),m.build()},se_CreateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows"),f=JSON.stringify(take(o,{AppInstanceArn:[],ClientRequestToken:[!0,o=>o??esm_browser_v4()],Name:[],Processors:o=>_json(o),Tags:o=>_json(o)})),m.m("POST").h({"content-type":"application/json"}).b(f),m.build()},se_CreateChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/memberships"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{MemberArn:[],SubChannelId:[],Type:[]})),m.m("POST").h(_).b(f),m.build()},se_CreateChannelModeratorCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/moderators"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ChannelModeratorArn:[]})),m.m("POST").h(_).b(f),m.build()},se_DeleteChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_DeleteChannelBanCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/bans/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_DeleteChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows/{ChannelFlowArn}"),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),m.m("DELETE").h({}).b(f),m.build()},se_DeleteChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1);let w=map({[ik]:[,o[ip]]});return m.m("DELETE").h(_).q(w).b(f),m.build()},se_DeleteChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[ik]:[,o[ip]]});return m.m("DELETE").h(_).q(w).b(f),m.build()},se_DeleteChannelModeratorCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("ChannelModeratorArn",()=>o.ChannelModeratorArn,"{ChannelModeratorArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_DeleteMessagingStreamingConfigurationsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),m.p("AppInstanceArn",()=>o.AppInstanceArn,"{AppInstanceArn}",!1),m.m("DELETE").h({}).b(f),m.build()},se_DescribeChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.m("GET").h(_).b(f),m.build()},se_DescribeChannelBanCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/bans/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),m.m("GET").h(_).b(f),m.build()},se_DescribeChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows/{ChannelFlowArn}"),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),m.m("GET").h({}).b(f),m.build()},se_DescribeChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1);let w=map({[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_DescribeChannelMembershipForAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iA]:[,"app-instance-user-membership"],[ib]:[,expectNonNull(o[ii],"AppInstanceUserArn")]});return m.m("GET").h(_).q(w).b(f),m.build()},se_DescribeChannelModeratedByAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iA]:[,"app-instance-user-moderated-channel"],[ib]:[,expectNonNull(o[ii],"AppInstanceUserArn")]});return m.m("GET").h(_).q(w).b(f),m.build()},se_DescribeChannelModeratorCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("ChannelModeratorArn",()=>o.ChannelModeratorArn,"{ChannelModeratorArn}",!1),m.m("GET").h(_).b(f),m.build()},se_DisassociateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_GetChannelMembershipPreferencesCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/memberships/{MemberArn}/preferences"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),m.m("GET").h(_).b(f),m.build()},se_GetChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_GetChannelMessageStatusCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[iA]:[,"message-status"],[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_GetMessagingSessionEndpointCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/endpoints/messaging-session"),m.m("GET").h({}).b(f),m.build()},se_GetMessagingStreamingConfigurationsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),m.p("AppInstanceArn",()=>o.AppInstanceArn,"{AppInstanceArn}",!1),m.m("GET").h({}).b(f),m.build()},se_ListChannelBansCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/bans"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelFlowsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/channel-flows");let _=map({[iv]:[,expectNonNull(o[ie],"AppInstanceArn")],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h({}).q(_).b(f),m.build()},se_ListChannelMembershipsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[ix]:[,o[ig]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]],[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelMembershipsForAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels");let w=map({[iA]:[,"app-instance-user-memberships"],[ib]:[,o[ii]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelMessagesCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iM]:[,o[im]],[iT]:[()=>void 0!==o.NotBefore,()=>serializeDateTime(o[id]).toString()],[iC]:[()=>void 0!==o.NotAfter,()=>serializeDateTime(o[il]).toString()],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]],[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelModeratorsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/moderators"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels");let w=map({[iv]:[,expectNonNull(o[ie],"AppInstanceArn")],[iI]:[,o[iu]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelsAssociatedWithChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/channels");let _=map({[iA]:[,"channel-flow-associations"],[iy]:[,expectNonNull(o[io],"ChannelFlowArn")],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h({}).q(_).b(f),m.build()},se_ListChannelsModeratedByAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels");let w=map({[iA]:[,"app-instance-user-moderated-channels"],[ib]:[,o[ii]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListSubChannelsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/subchannels"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListTagsForResourceCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/tags");let _=map({[iS]:[,expectNonNull(o[ih],"ResourceARN")]});return m.m("GET").h({}).q(_).b(f),m.build()},se_PutChannelExpirationSettingsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/expiration-settings"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ExpirationSettings:o=>_json(o)})),m.m("PUT").h(_).b(f),m.build()},se_PutChannelMembershipPreferencesCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/memberships/{MemberArn}/preferences"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),f=JSON.stringify(take(o,{Preferences:o=>_json(o)})),m.m("PUT").h(_).b(f),m.build()},se_PutMessagingStreamingConfigurationsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),m.p("AppInstanceArn",()=>o.AppInstanceArn,"{AppInstanceArn}",!1),f=JSON.stringify(take(o,{StreamingConfigurations:o=>_json(o)})),m.m("PUT").h({"content-type":"application/json"}).b(f),m.build()},se_RedactChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[iw]:[,"redact"]});return f=JSON.stringify(take(o,{SubChannelId:[]})),m.m("POST").h(_).q(w).b(f),m.build()},se_SearchChannelsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});m.bp("/channels");let w=map({[iw]:[,"search"],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return f=JSON.stringify(take(o,{Fields:o=>_json(o)})),m.m("POST").h(_).q(w).b(f),m.build()},se_SendChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/messages"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ClientRequestToken:[!0,o=>o??esm_browser_v4()],Content:[],ContentType:[],MessageAttributes:o=>_json(o),Metadata:[],Persistence:[],PushNotification:o=>_json(o),SubChannelId:[],Target:o=>_json(o),Type:[]})),m.m("POST").h(_).b(f),m.build()},se_TagResourceCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/tags");let _=map({[iw]:[,"tag-resource"]});return f=JSON.stringify(take(o,{ResourceARN:[],Tags:o=>_json(o)})),m.m("POST").h({"content-type":"application/json"}).q(_).b(f),m.build()},se_UntagResourceCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/tags");let _=map({[iw]:[,"untag-resource"]});return f=JSON.stringify(take(o,{ResourceARN:[],TagKeys:o=>_json(o)})),m.m("POST").h({"content-type":"application/json"}).q(_).b(f),m.build()},se_UpdateChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{Metadata:[],Mode:[],Name:[]})),m.m("PUT").h(_).b(f),m.build()},se_UpdateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows/{ChannelFlowArn}"),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),f=JSON.stringify(take(o,{Name:[],Processors:o=>_json(o)})),m.m("PUT").h({"content-type":"application/json"}).b(f),m.build()},se_UpdateChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1),f=JSON.stringify(take(o,{Content:[],ContentType:[],Metadata:[],SubChannelId:[]})),m.m("PUT").h(_).b(f),m.build()},se_UpdateChannelReadMarkerCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/readMarker"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.m("PUT").h(_).b(f),m.build()},de_AssociateChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_BatchCreateChannelMembershipCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{BatchChannelMemberships:_json,Errors:_json})),f},de_ChannelFlowCallbackCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{CallbackId:expectString,ChannelArn:expectString})),f},de_CreateChannelCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString})),f},de_CreateChannelBanCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json})),f},de_CreateChannelFlowCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlowArn:expectString})),f},de_CreateChannelMembershipCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json,SubChannelId:expectString})),f},de_CreateChannelModeratorCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelModerator:_json})),f},de_DeleteChannelCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelBanCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelFlowCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelMembershipCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelMessageCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelModeratorCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteMessagingStreamingConfigurationsCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DescribeChannelCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channel:o=>de_Channel(o,p)})),f},de_DescribeChannelBanCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelBan:o=>de_ChannelBan(o,p)})),f},de_DescribeChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlow:o=>de_ChannelFlow(o,p)})),f},de_DescribeChannelMembershipCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMembership:o=>de_ChannelMembership(o,p)})),f},de_DescribeChannelMembershipForAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMembership:o=>de_ChannelMembershipForAppInstanceUserSummary(o,p)})),f},de_DescribeChannelModeratedByAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channel:o=>de_ChannelModeratedByAppInstanceUserSummary(o,p)})),f},de_DescribeChannelModeratorCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelModerator:o=>de_ChannelModerator(o,p)})),f},de_DisassociateChannelFlowCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_GetChannelMembershipPreferencesCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json,Preferences:_json})),f},de_GetChannelMessageCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMessage:o=>de_ChannelMessage(o,p)})),f},de_GetChannelMessageStatusCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Status:_json})),f},de_GetMessagingSessionEndpointCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Endpoint:_json})),f},de_GetMessagingStreamingConfigurationsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{StreamingConfigurations:_json})),f},de_ListChannelBansCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelBans:_json,NextToken:expectString})),f},de_ListChannelFlowsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlows:_json,NextToken:expectString})),f},de_ListChannelMembershipsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelMemberships:_json,NextToken:expectString})),f},de_ListChannelMembershipsForAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMemberships:o=>de_ChannelMembershipForAppInstanceUserSummaryList(o,p),NextToken:expectString})),f},de_ListChannelMessagesCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelMessages:o=>de_ChannelMessageSummaryList(o,p),NextToken:expectString,SubChannelId:expectString})),f},de_ListChannelModeratorsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelModerators:_json,NextToken:expectString})),f},de_ListChannelsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:o=>de_ChannelSummaryList(o,p),NextToken:expectString})),f},de_ListChannelsAssociatedWithChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:_json,NextToken:expectString})),f},de_ListChannelsModeratedByAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:o=>de_ChannelModeratedByAppInstanceUserSummaryList(o,p),NextToken:expectString})),f},de_ListSubChannelsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,NextToken:expectString,SubChannels:_json})),f},de_ListTagsForResourceCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Tags:_json})),f},de_PutChannelExpirationSettingsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ExpirationSettings:_json})),f},de_PutChannelMembershipPreferencesCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json,Preferences:_json})),f},de_PutMessagingStreamingConfigurationsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{StreamingConfigurations:_json})),f},de_RedactChannelMessageCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,MessageId:expectString,SubChannelId:expectString})),f},de_SearchChannelsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:o=>de_ChannelSummaryList(o,p),NextToken:expectString})),f},de_SendChannelMessageCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,MessageId:expectString,Status:_json,SubChannelId:expectString})),f},de_TagResourceCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_UntagResourceCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_UpdateChannelCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString})),f},de_UpdateChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlowArn:expectString})),f},de_UpdateChannelMessageCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,MessageId:expectString,Status:_json,SubChannelId:expectString})),f},de_UpdateChannelReadMarkerCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString})),f},de_CommandError=async(o,p)=>{var f,m;let _,w,I={...o,body:await parseJsonErrorBody(o.body,p)},k=(f=o,m=I.body,_=o=>{let p=o;return"number"==typeof p&&(p=p.toString()),p.indexOf(",")>=0&&(p=p.split(",")[0]),p.indexOf(":")>=0&&(p=p.split(":")[0]),p.indexOf("#")>=0&&(p=p.split("#")[1]),p},void 0!==(w=Object.keys(f.headers).find(o=>"x-amzn-errortype"===o.toLowerCase()))?_(f.headers[w]):void 0!==m.code?_(m.code):void 0!==m.__type?_(m.__type):void 0);switch(k){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await de_BadRequestExceptionRes(I,p);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await de_ConflictExceptionRes(I,p);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await de_ForbiddenExceptionRes(I,p);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await de_NotFoundExceptionRes(I,p);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await de_ServiceFailureExceptionRes(I,p);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await de_ServiceUnavailableExceptionRes(I,p);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await de_ThrottledClientExceptionRes(I,p);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await de_UnauthorizedClientExceptionRes(I,p);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(I,p);default:return Aws_restJson1_throwDefaultError({output:o,parsedBody:I.body,errorCode:k})}},Aws_restJson1_throwDefaultError=({output:o,parsedBody:p,errorCode:f})=>{(({output:o,parsedBody:p,exceptionCtor:f,errorCode:m})=>{let _,w={httpStatusCode:(_=o).statusCode,requestId:_.headers["x-amzn-requestid"]??_.headers["x-amzn-request-id"]??_.headers["x-amz-request-id"],extendedRequestId:_.headers["x-amz-id-2"],cfId:_.headers["x-amz-cf-id"]},I=w.httpStatusCode?w.httpStatusCode+"":void 0;throw decorateServiceException(new f({name:p?.code||p?.Code||m||I||"UnknownError",$fault:"client",$metadata:w}),p)})({output:o,parsedBody:p,exceptionCtor:ChimeSDKMessagingServiceException,errorCode:f})},de_BadRequestExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new BadRequestException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ConflictExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ConflictException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ForbiddenExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ForbiddenException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_NotFoundExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new NotFoundException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ResourceLimitExceededExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ResourceLimitExceededException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ServiceFailureExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ServiceFailureException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ServiceUnavailableExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ServiceUnavailableException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ThrottledClientExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ThrottledClientException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_UnauthorizedClientExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new UnauthorizedClientException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_Channel=(o,p)=>take(o,{ChannelArn:expectString,ChannelFlowArn:expectString,CreatedBy:_json,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),ElasticChannelConfiguration:_json,ExpirationSettings:_json,LastMessageTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Metadata:expectString,Mode:expectString,Name:expectString,Privacy:expectString}),de_ChannelBan=(o,p)=>take(o,{ChannelArn:expectString,CreatedBy:_json,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Member:_json}),de_ChannelFlow=(o,p)=>take(o,{ChannelFlowArn:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Name:expectString,Processors:_json}),de_ChannelMembership=(o,p)=>take(o,{ChannelArn:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),InvitedBy:_json,LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Member:_json,SubChannelId:expectString,Type:expectString}),de_ChannelMembershipForAppInstanceUserSummary=(o,p)=>take(o,{AppInstanceUserMembershipSummary:o=>take(o,{ReadMarkerTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),SubChannelId:expectString,Type:expectString}),ChannelSummary:o=>de_ChannelSummary(o,p)}),de_ChannelMembershipForAppInstanceUserSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>de_ChannelMembershipForAppInstanceUserSummary(o,p)),de_ChannelMessage=(o,p)=>take(o,{ChannelArn:expectString,Content:expectString,ContentType:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastEditedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),MessageAttributes:_json,MessageId:expectString,Metadata:expectString,Persistence:expectString,Redacted:expectBoolean,Sender:_json,Status:_json,SubChannelId:expectString,Target:_json,Type:expectString}),de_ChannelMessageSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>take(o,{Content:expectString,ContentType:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastEditedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),MessageAttributes:_json,MessageId:expectString,Metadata:expectString,Redacted:expectBoolean,Sender:_json,Status:_json,Target:_json,Type:expectString})),de_ChannelModeratedByAppInstanceUserSummary=(o,p)=>take(o,{ChannelSummary:o=>de_ChannelSummary(o,p)}),de_ChannelModeratedByAppInstanceUserSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>de_ChannelModeratedByAppInstanceUserSummary(o,p)),de_ChannelModerator=(o,p)=>take(o,{ChannelArn:expectString,CreatedBy:_json,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Moderator:_json}),de_ChannelSummary=(o,p)=>take(o,{ChannelArn:expectString,LastMessageTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Metadata:expectString,Mode:expectString,Name:expectString,Privacy:expectString}),de_ChannelSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>de_ChannelSummary(o,p)),Aws_restJson1_deserializeMetadata=o=>({httpStatusCode:o.statusCode,requestId:o.headers["x-amzn-requestid"]??o.headers["x-amzn-request-id"]??o.headers["x-amz-request-id"],extendedRequestId:o.headers["x-amz-id-2"],cfId:o.headers["x-amz-cf-id"]}),ie="AppInstanceArn",ii="AppInstanceUserArn",ir="ChimeBearer",io="ChannelFlowArn",ia="MaxResults",il="NotAfter",id="NotBefore",ic="NextToken",iu="Privacy",ih="ResourceARN",ip="SubChannelId",im="SortOrder",ig="Type",iS="arn",iv="app-instance-arn",ib="app-instance-user-arn",iy="channel-flow-arn",i_="max-results",iC="not-after",iT="not-before",iE="next-token",iw="operation",iI="privacy",iA="scope",ik="sub-channel-id",iM="sort-order",ix="type",iP="x-amz-chime-bearer";let AssociateChannelFlowCommand=class AssociateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","AssociateChannelFlow",{}).n("ChimeSDKMessagingClient","AssociateChannelFlowCommand").f(void 0,void 0).ser(se_AssociateChannelFlowCommand).de(de_AssociateChannelFlowCommand).build(){};let BatchCreateChannelMembershipCommand=class BatchCreateChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","BatchCreateChannelMembership",{}).n("ChimeSDKMessagingClient","BatchCreateChannelMembershipCommand").f(void 0,BatchCreateChannelMembershipResponseFilterSensitiveLog).ser(se_BatchCreateChannelMembershipCommand).de(de_BatchCreateChannelMembershipCommand).build(){};let ChannelFlowCallbackCommand=class ChannelFlowCallbackCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ChannelFlowCallback",{}).n("ChimeSDKMessagingClient","ChannelFlowCallbackCommand").f(ChannelFlowCallbackRequestFilterSensitiveLog,void 0).ser(se_ChannelFlowCallbackCommand).de(de_ChannelFlowCallbackCommand).build(){};let CreateChannelBanCommand=class CreateChannelBanCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelBan",{}).n("ChimeSDKMessagingClient","CreateChannelBanCommand").f(void 0,CreateChannelBanResponseFilterSensitiveLog).ser(se_CreateChannelBanCommand).de(de_CreateChannelBanCommand).build(){};let CreateChannelCommand=class CreateChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannel",{}).n("ChimeSDKMessagingClient","CreateChannelCommand").f(CreateChannelRequestFilterSensitiveLog,void 0).ser(se_CreateChannelCommand).de(de_CreateChannelCommand).build(){};let CreateChannelFlowCommand=class CreateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelFlow",{}).n("ChimeSDKMessagingClient","CreateChannelFlowCommand").f(CreateChannelFlowRequestFilterSensitiveLog,void 0).ser(se_CreateChannelFlowCommand).de(de_CreateChannelFlowCommand).build(){};let CreateChannelMembershipCommand=class CreateChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelMembership",{}).n("ChimeSDKMessagingClient","CreateChannelMembershipCommand").f(void 0,CreateChannelMembershipResponseFilterSensitiveLog).ser(se_CreateChannelMembershipCommand).de(de_CreateChannelMembershipCommand).build(){};let CreateChannelModeratorCommand=class CreateChannelModeratorCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelModerator",{}).n("ChimeSDKMessagingClient","CreateChannelModeratorCommand").f(void 0,CreateChannelModeratorResponseFilterSensitiveLog).ser(se_CreateChannelModeratorCommand).de(de_CreateChannelModeratorCommand).build(){};let DeleteChannelBanCommand=class DeleteChannelBanCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelBan",{}).n("ChimeSDKMessagingClient","DeleteChannelBanCommand").f(void 0,void 0).ser(se_DeleteChannelBanCommand).de(de_DeleteChannelBanCommand).build(){};let DeleteChannelCommand=class DeleteChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannel",{}).n("ChimeSDKMessagingClient","DeleteChannelCommand").f(void 0,void 0).ser(se_DeleteChannelCommand).de(de_DeleteChannelCommand).build(){};let DeleteChannelFlowCommand=class DeleteChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelFlow",{}).n("ChimeSDKMessagingClient","DeleteChannelFlowCommand").f(void 0,void 0).ser(se_DeleteChannelFlowCommand).de(de_DeleteChannelFlowCommand).build(){};let DeleteChannelMembershipCommand=class DeleteChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelMembership",{}).n("ChimeSDKMessagingClient","DeleteChannelMembershipCommand").f(void 0,void 0).ser(se_DeleteChannelMembershipCommand).de(de_DeleteChannelMembershipCommand).build(){};let DeleteChannelMessageCommand=class DeleteChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelMessage",{}).n("ChimeSDKMessagingClient","DeleteChannelMessageCommand").f(void 0,void 0).ser(se_DeleteChannelMessageCommand).de(de_DeleteChannelMessageCommand).build(){};let DeleteChannelModeratorCommand=class DeleteChannelModeratorCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelModerator",{}).n("ChimeSDKMessagingClient","DeleteChannelModeratorCommand").f(void 0,void 0).ser(se_DeleteChannelModeratorCommand).de(de_DeleteChannelModeratorCommand).build(){};let DeleteMessagingStreamingConfigurationsCommand=class DeleteMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","DeleteMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_DeleteMessagingStreamingConfigurationsCommand).de(de_DeleteMessagingStreamingConfigurationsCommand).build(){};let DescribeChannelBanCommand=class DescribeChannelBanCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelBan",{}).n("ChimeSDKMessagingClient","DescribeChannelBanCommand").f(void 0,DescribeChannelBanResponseFilterSensitiveLog).ser(se_DescribeChannelBanCommand).de(de_DescribeChannelBanCommand).build(){};let DescribeChannelCommand=class DescribeChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannel",{}).n("ChimeSDKMessagingClient","DescribeChannelCommand").f(void 0,DescribeChannelResponseFilterSensitiveLog).ser(se_DescribeChannelCommand).de(de_DescribeChannelCommand).build(){};let DescribeChannelFlowCommand=class DescribeChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelFlow",{}).n("ChimeSDKMessagingClient","DescribeChannelFlowCommand").f(void 0,DescribeChannelFlowResponseFilterSensitiveLog).ser(se_DescribeChannelFlowCommand).de(de_DescribeChannelFlowCommand).build(){};let DescribeChannelMembershipCommand=class DescribeChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelMembership",{}).n("ChimeSDKMessagingClient","DescribeChannelMembershipCommand").f(void 0,DescribeChannelMembershipResponseFilterSensitiveLog).ser(se_DescribeChannelMembershipCommand).de(de_DescribeChannelMembershipCommand).build(){};let DescribeChannelMembershipForAppInstanceUserCommand=class DescribeChannelMembershipForAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelMembershipForAppInstanceUser",{}).n("ChimeSDKMessagingClient","DescribeChannelMembershipForAppInstanceUserCommand").f(void 0,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog).ser(se_DescribeChannelMembershipForAppInstanceUserCommand).de(de_DescribeChannelMembershipForAppInstanceUserCommand).build(){};let DescribeChannelModeratedByAppInstanceUserCommand=class DescribeChannelModeratedByAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelModeratedByAppInstanceUser",{}).n("ChimeSDKMessagingClient","DescribeChannelModeratedByAppInstanceUserCommand").f(void 0,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog).ser(se_DescribeChannelModeratedByAppInstanceUserCommand).de(de_DescribeChannelModeratedByAppInstanceUserCommand).build(){};let DescribeChannelModeratorCommand=class DescribeChannelModeratorCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelModerator",{}).n("ChimeSDKMessagingClient","DescribeChannelModeratorCommand").f(void 0,DescribeChannelModeratorResponseFilterSensitiveLog).ser(se_DescribeChannelModeratorCommand).de(de_DescribeChannelModeratorCommand).build(){};let DisassociateChannelFlowCommand=class DisassociateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DisassociateChannelFlow",{}).n("ChimeSDKMessagingClient","DisassociateChannelFlowCommand").f(void 0,void 0).ser(se_DisassociateChannelFlowCommand).de(de_DisassociateChannelFlowCommand).build(){};let GetChannelMembershipPreferencesCommand=class GetChannelMembershipPreferencesCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMembershipPreferences",{}).n("ChimeSDKMessagingClient","GetChannelMembershipPreferencesCommand").f(void 0,GetChannelMembershipPreferencesResponseFilterSensitiveLog).ser(se_GetChannelMembershipPreferencesCommand).de(de_GetChannelMembershipPreferencesCommand).build(){};let GetChannelMessageCommand=class GetChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMessage",{}).n("ChimeSDKMessagingClient","GetChannelMessageCommand").f(void 0,GetChannelMessageResponseFilterSensitiveLog).ser(se_GetChannelMessageCommand).de(de_GetChannelMessageCommand).build(){};let GetChannelMessageStatusCommand=class GetChannelMessageStatusCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMessageStatus",{}).n("ChimeSDKMessagingClient","GetChannelMessageStatusCommand").f(void 0,void 0).ser(se_GetChannelMessageStatusCommand).de(de_GetChannelMessageStatusCommand).build(){};let GetMessagingSessionEndpointCommand=class GetMessagingSessionEndpointCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetMessagingSessionEndpoint",{}).n("ChimeSDKMessagingClient","GetMessagingSessionEndpointCommand").f(void 0,void 0).ser(se_GetMessagingSessionEndpointCommand).de(de_GetMessagingSessionEndpointCommand).build(){};let GetMessagingStreamingConfigurationsCommand=class GetMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","GetMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_GetMessagingStreamingConfigurationsCommand).de(de_GetMessagingStreamingConfigurationsCommand).build(){};let ListChannelBansCommand=class ListChannelBansCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelBans",{}).n("ChimeSDKMessagingClient","ListChannelBansCommand").f(ListChannelBansRequestFilterSensitiveLog,ListChannelBansResponseFilterSensitiveLog).ser(se_ListChannelBansCommand).de(de_ListChannelBansCommand).build(){};let ListChannelFlowsCommand=class ListChannelFlowsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelFlows",{}).n("ChimeSDKMessagingClient","ListChannelFlowsCommand").f(ListChannelFlowsRequestFilterSensitiveLog,ListChannelFlowsResponseFilterSensitiveLog).ser(se_ListChannelFlowsCommand).de(de_ListChannelFlowsCommand).build(){};let ListChannelMembershipsCommand=class ListChannelMembershipsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMemberships",{}).n("ChimeSDKMessagingClient","ListChannelMembershipsCommand").f(ListChannelMembershipsRequestFilterSensitiveLog,ListChannelMembershipsResponseFilterSensitiveLog).ser(se_ListChannelMembershipsCommand).de(de_ListChannelMembershipsCommand).build(){};let ListChannelMembershipsForAppInstanceUserCommand=class ListChannelMembershipsForAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMembershipsForAppInstanceUser",{}).n("ChimeSDKMessagingClient","ListChannelMembershipsForAppInstanceUserCommand").f(ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog).ser(se_ListChannelMembershipsForAppInstanceUserCommand).de(de_ListChannelMembershipsForAppInstanceUserCommand).build(){};let ListChannelMessagesCommand=class ListChannelMessagesCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMessages",{}).n("ChimeSDKMessagingClient","ListChannelMessagesCommand").f(ListChannelMessagesRequestFilterSensitiveLog,ListChannelMessagesResponseFilterSensitiveLog).ser(se_ListChannelMessagesCommand).de(de_ListChannelMessagesCommand).build(){};let ListChannelModeratorsCommand=class ListChannelModeratorsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelModerators",{}).n("ChimeSDKMessagingClient","ListChannelModeratorsCommand").f(ListChannelModeratorsRequestFilterSensitiveLog,ListChannelModeratorsResponseFilterSensitiveLog).ser(se_ListChannelModeratorsCommand).de(de_ListChannelModeratorsCommand).build(){};let ListChannelsAssociatedWithChannelFlowCommand=class ListChannelsAssociatedWithChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelsAssociatedWithChannelFlow",{}).n("ChimeSDKMessagingClient","ListChannelsAssociatedWithChannelFlowCommand").f(ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog).ser(se_ListChannelsAssociatedWithChannelFlowCommand).de(de_ListChannelsAssociatedWithChannelFlowCommand).build(){};let ListChannelsCommand=class ListChannelsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannels",{}).n("ChimeSDKMessagingClient","ListChannelsCommand").f(ListChannelsRequestFilterSensitiveLog,ListChannelsResponseFilterSensitiveLog).ser(se_ListChannelsCommand).de(de_ListChannelsCommand).build(){};let ListChannelsModeratedByAppInstanceUserCommand=class ListChannelsModeratedByAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelsModeratedByAppInstanceUser",{}).n("ChimeSDKMessagingClient","ListChannelsModeratedByAppInstanceUserCommand").f(ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog).ser(se_ListChannelsModeratedByAppInstanceUserCommand).de(de_ListChannelsModeratedByAppInstanceUserCommand).build(){};let ListSubChannelsCommand=class ListSubChannelsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListSubChannels",{}).n("ChimeSDKMessagingClient","ListSubChannelsCommand").f(ListSubChannelsRequestFilterSensitiveLog,ListSubChannelsResponseFilterSensitiveLog).ser(se_ListSubChannelsCommand).de(de_ListSubChannelsCommand).build(){};let ListTagsForResourceCommand=class ListTagsForResourceCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListTagsForResource",{}).n("ChimeSDKMessagingClient","ListTagsForResourceCommand").f(void 0,ListTagsForResourceResponseFilterSensitiveLog).ser(se_ListTagsForResourceCommand).de(de_ListTagsForResourceCommand).build(){};let PutChannelExpirationSettingsCommand=class PutChannelExpirationSettingsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutChannelExpirationSettings",{}).n("ChimeSDKMessagingClient","PutChannelExpirationSettingsCommand").f(void 0,void 0).ser(se_PutChannelExpirationSettingsCommand).de(de_PutChannelExpirationSettingsCommand).build(){};let PutChannelMembershipPreferencesCommand=class PutChannelMembershipPreferencesCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutChannelMembershipPreferences",{}).n("ChimeSDKMessagingClient","PutChannelMembershipPreferencesCommand").f(PutChannelMembershipPreferencesRequestFilterSensitiveLog,PutChannelMembershipPreferencesResponseFilterSensitiveLog).ser(se_PutChannelMembershipPreferencesCommand).de(de_PutChannelMembershipPreferencesCommand).build(){};let PutMessagingStreamingConfigurationsCommand=class PutMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","PutMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_PutMessagingStreamingConfigurationsCommand).de(de_PutMessagingStreamingConfigurationsCommand).build(){};let RedactChannelMessageCommand=class RedactChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","RedactChannelMessage",{}).n("ChimeSDKMessagingClient","RedactChannelMessageCommand").f(void 0,void 0).ser(se_RedactChannelMessageCommand).de(de_RedactChannelMessageCommand).build(){};let SearchChannelsCommand=class SearchChannelsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","SearchChannels",{}).n("ChimeSDKMessagingClient","SearchChannelsCommand").f(SearchChannelsRequestFilterSensitiveLog,SearchChannelsResponseFilterSensitiveLog).ser(se_SearchChannelsCommand).de(de_SearchChannelsCommand).build(){};let SendChannelMessageCommand=class SendChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","SendChannelMessage",{}).n("ChimeSDKMessagingClient","SendChannelMessageCommand").f(SendChannelMessageRequestFilterSensitiveLog,void 0).ser(se_SendChannelMessageCommand).de(de_SendChannelMessageCommand).build(){};let TagResourceCommand=class TagResourceCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","TagResource",{}).n("ChimeSDKMessagingClient","TagResourceCommand").f(TagResourceRequestFilterSensitiveLog,void 0).ser(se_TagResourceCommand).de(de_TagResourceCommand).build(){};let UntagResourceCommand=class UntagResourceCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UntagResource",{}).n("ChimeSDKMessagingClient","UntagResourceCommand").f(UntagResourceRequestFilterSensitiveLog,void 0).ser(se_UntagResourceCommand).de(de_UntagResourceCommand).build(){};let UpdateChannelCommand=class UpdateChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannel",{}).n("ChimeSDKMessagingClient","UpdateChannelCommand").f(UpdateChannelRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelCommand).de(de_UpdateChannelCommand).build(){};let UpdateChannelFlowCommand=class UpdateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelFlow",{}).n("ChimeSDKMessagingClient","UpdateChannelFlowCommand").f(UpdateChannelFlowRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelFlowCommand).de(de_UpdateChannelFlowCommand).build(){};let UpdateChannelMessageCommand=class UpdateChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelMessage",{}).n("ChimeSDKMessagingClient","UpdateChannelMessageCommand").f(UpdateChannelMessageRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelMessageCommand).de(de_UpdateChannelMessageCommand).build(){};let UpdateChannelReadMarkerCommand=class UpdateChannelReadMarkerCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelReadMarker",{}).n("ChimeSDKMessagingClient","UpdateChannelReadMarkerCommand").f(void 0,void 0).ser(se_UpdateChannelReadMarkerCommand).de(de_UpdateChannelReadMarkerCommand).build(){};let ChimeSDKMessaging=class ChimeSDKMessaging extends ChimeSDKMessagingClient{};((o,p)=>{for(let f of Object.keys(o)){let m=o[f],methodImpl=async function(o,p,f){let _=new m(o);if("function"==typeof p)this.send(_,p);else{if("function"!=typeof f)return this.send(_,p);if("object"!=typeof p)throw Error(`Expected http options but got ${typeof p}`);this.send(_,p||{},f)}},_=(f[0].toLowerCase()+f.slice(1)).replace(/Command$/,"");p.prototype[_]=methodImpl}})({AssociateChannelFlowCommand:AssociateChannelFlowCommand,BatchCreateChannelMembershipCommand:BatchCreateChannelMembershipCommand,ChannelFlowCallbackCommand:ChannelFlowCallbackCommand,CreateChannelCommand:CreateChannelCommand,CreateChannelBanCommand:CreateChannelBanCommand,CreateChannelFlowCommand:CreateChannelFlowCommand,CreateChannelMembershipCommand:CreateChannelMembershipCommand,CreateChannelModeratorCommand:CreateChannelModeratorCommand,DeleteChannelCommand:DeleteChannelCommand,DeleteChannelBanCommand:DeleteChannelBanCommand,DeleteChannelFlowCommand:DeleteChannelFlowCommand,DeleteChannelMembershipCommand:DeleteChannelMembershipCommand,DeleteChannelMessageCommand:DeleteChannelMessageCommand,DeleteChannelModeratorCommand:DeleteChannelModeratorCommand,DeleteMessagingStreamingConfigurationsCommand:DeleteMessagingStreamingConfigurationsCommand,DescribeChannelCommand:DescribeChannelCommand,DescribeChannelBanCommand:DescribeChannelBanCommand,DescribeChannelFlowCommand:DescribeChannelFlowCommand,DescribeChannelMembershipCommand:DescribeChannelMembershipCommand,DescribeChannelMembershipForAppInstanceUserCommand:DescribeChannelMembershipForAppInstanceUserCommand,DescribeChannelModeratedByAppInstanceUserCommand:DescribeChannelModeratedByAppInstanceUserCommand,DescribeChannelModeratorCommand:DescribeChannelModeratorCommand,DisassociateChannelFlowCommand:DisassociateChannelFlowCommand,GetChannelMembershipPreferencesCommand:GetChannelMembershipPreferencesCommand,GetChannelMessageCommand:GetChannelMessageCommand,GetChannelMessageStatusCommand:GetChannelMessageStatusCommand,GetMessagingSessionEndpointCommand:GetMessagingSessionEndpointCommand,GetMessagingStreamingConfigurationsCommand:GetMessagingStreamingConfigurationsCommand,ListChannelBansCommand:ListChannelBansCommand,ListChannelFlowsCommand:ListChannelFlowsCommand,ListChannelMembershipsCommand:ListChannelMembershipsCommand,ListChannelMembershipsForAppInstanceUserCommand:ListChannelMembershipsForAppInstanceUserCommand,ListChannelMessagesCommand:ListChannelMessagesCommand,ListChannelModeratorsCommand:ListChannelModeratorsCommand,ListChannelsCommand:ListChannelsCommand,ListChannelsAssociatedWithChannelFlowCommand:ListChannelsAssociatedWithChannelFlowCommand,ListChannelsModeratedByAppInstanceUserCommand:ListChannelsModeratedByAppInstanceUserCommand,ListSubChannelsCommand:ListSubChannelsCommand,ListTagsForResourceCommand:ListTagsForResourceCommand,PutChannelExpirationSettingsCommand:PutChannelExpirationSettingsCommand,PutChannelMembershipPreferencesCommand:PutChannelMembershipPreferencesCommand,PutMessagingStreamingConfigurationsCommand:PutMessagingStreamingConfigurationsCommand,RedactChannelMessageCommand:RedactChannelMessageCommand,SearchChannelsCommand:SearchChannelsCommand,SendChannelMessageCommand:SendChannelMessageCommand,TagResourceCommand:TagResourceCommand,UntagResourceCommand:UntagResourceCommand,UpdateChannelCommand:UpdateChannelCommand,UpdateChannelFlowCommand:UpdateChannelFlowCommand,UpdateChannelMessageCommand:UpdateChannelMessageCommand,UpdateChannelReadMarkerCommand:UpdateChannelReadMarkerCommand},ChimeSDKMessaging);let iR=createPaginator(ChimeSDKMessagingClient,ListChannelBansCommand,"NextToken","NextToken","MaxResults"),iO=createPaginator(ChimeSDKMessagingClient,ListChannelFlowsCommand,"NextToken","NextToken","MaxResults"),iD=createPaginator(ChimeSDKMessagingClient,ListChannelMembershipsForAppInstanceUserCommand,"NextToken","NextToken","MaxResults"),iL=createPaginator(ChimeSDKMessagingClient,ListChannelMembershipsCommand,"NextToken","NextToken","MaxResults"),iN=createPaginator(ChimeSDKMessagingClient,ListChannelMessagesCommand,"NextToken","NextToken","MaxResults"),iF=createPaginator(ChimeSDKMessagingClient,ListChannelModeratorsCommand,"NextToken","NextToken","MaxResults"),iV=createPaginator(ChimeSDKMessagingClient,ListChannelsAssociatedWithChannelFlowCommand,"NextToken","NextToken","MaxResults"),iB=createPaginator(ChimeSDKMessagingClient,ListChannelsModeratedByAppInstanceUserCommand,"NextToken","NextToken","MaxResults"),iU=createPaginator(ChimeSDKMessagingClient,ListChannelsCommand,"NextToken","NextToken","MaxResults"),ij=createPaginator(ChimeSDKMessagingClient,ListSubChannelsCommand,"NextToken","NextToken","MaxResults"),iH=createPaginator(ChimeSDKMessagingClient,SearchChannelsCommand,"NextToken","NextToken","MaxResults")},0x249059e84:(o,p,f)=>{"use strict";f.r(p),f.d(p,{fromHex:()=>fromHex,toHex:()=>toHex});let m={},_={};for(let o=0;o<256;o++){let p=o.toString(16).toLowerCase();1===p.length&&(p=`0${p}`),m[o]=p,_[p]=o}function fromHex(o){if(o.length%2!=0)throw Error("Hex encoded strings must have an even number length");let p=new Uint8Array(o.length/2);for(let f=0;f<o.length;f+=2){let m=o.slice(f,f+2).toLowerCase();if(m in _)p[f/2]=_[m];else throw Error(`Cannot decode unrecognized sequence ${m} as hexadecimal`)}return p}function toHex(o){let p="";for(let f=0;f<o.byteLength;f++)p+=m[o[f]];return p}},0x1d34794c1:(o,p,f)=>{"use strict";function whatwgEncodingApi_fromUtf8(o){return new TextEncoder().encode(o)}function whatwgEncodingApi_toUtf8(o){return new TextDecoder("utf-8").decode(o)}f.r(p),f.d(p,{fromUtf8:()=>dist_es_fromUtf8,toUtf8:()=>dist_es_toUtf8});let dist_es_fromUtf8=o=>"function"==typeof TextEncoder?whatwgEncodingApi_fromUtf8(o):(o=>{let p=[];for(let f=0,m=o.length;f<m;f++){let m=o.charCodeAt(f);if(m<128)p.push(m);else if(m<2048)p.push(m>>6|192,63&m|128);else if(f+1<o.length&&(64512&m)==55296&&(64512&o.charCodeAt(f+1))==56320){let _=65536+((1023&m)<<10)+(1023&o.charCodeAt(++f));p.push(_>>18|240,_>>12&63|128,_>>6&63|128,63&_|128)}else p.push(m>>12|224,m>>6&63|128,63&m|128)}return Uint8Array.from(p)})(o),dist_es_toUtf8=o=>"function"==typeof TextDecoder?whatwgEncodingApi_toUtf8(o):(o=>{let p="";for(let f=0,m=o.length;f<m;f++){let m=o[f];m<128?p+=String.fromCharCode(m):192<=m&&m<224?p+=String.fromCharCode((31&m)<<6|63&o[++f]):240<=m&&m<365?p+=decodeURIComponent("%"+[m,o[++f],o[++f],o[++f]].map(o=>o.toString(16)).join("%")):p+=String.fromCharCode((15&m)<<12|(63&o[++f])<<6|63&o[++f])}return p})(o)},0x23b480992:(o,p,f)=>{"use strict";f.d(p,{X:()=>m});let m="en-US"},0xfb32b180:(o,p,f)=>{"use strict";f.d(p,{Xp:()=>_});var m,_=((m={}).DOGFOOD="dogfood",m.BETA="beta",m.PROD="prod",m)},0x1d159ee8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xd475f02c));p.default=class{constructor(o,p,f,m=1e3,_=200){this.realtimeController=o,this.selfAttendeeId=p,this.hasBandwidthPriorityCallback=f,this.waitIntervalMs=m,this.updateIntervalMs=_,this.speakerScores={},this.speakerMuteState={},this.detectorCallbackToHandler=new Map,this.detectorCallbackToScoresTimer=new Map,this.detectorCallbackToActivityTimer=new Map,this.hasBandwidthPriority=!1,this.mostRecentUpdateTimestamp={}}needUpdate(o){return!this.activeSpeakers||0===this.speakerScores[o]&&this.activeSpeakers.includes(o)||this.speakerScores[o]>0&&!this.activeSpeakers.includes(o)}updateActiveSpeakers(o,p,f){if(!this.needUpdate(f))return;let m=[],_=Object.keys(this.speakerScores);for(let o=0;o<_.length;o++){let p=_[o];m.push({attendeeId:p,activeScore:this.speakerScores[p]})}let w=m.sort((o,p)=>p.activeScore-o.activeScore).filter(function(o){return o.activeScore>0}).map(function(o){return o.attendeeId});this.activeSpeakers=w,p(w);let I=w.length>0&&w[0]===this.selfAttendeeId&&o.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==I&&(this.hasBandwidthPriority=I,this.hasBandwidthPriorityCallback(I))}updateScore(o,p,f,m,_){let w=o.calculateScore(f,m,_);this.speakerScores[f]!==w&&(this.speakerScores[f]=w,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f))}subscribe(o,p,f,m){let handler=(f,m)=>{if(!m){this.speakerScores[f]=0,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f);return}this.realtimeController.realtimeSubscribeToVolumeIndicator(f,(f,m,_,w)=>{this.mostRecentUpdateTimestamp[f]=Date.now(),null!==_&&(this.speakerMuteState[f]=_),this.updateScore(o,p,f,m,_)})};this.detectorCallbackToHandler.set(p,handler);let _=new w.default(this.updateIntervalMs);if(_.start(()=>{for(let f in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[f]>this.waitIntervalMs&&this.updateScore(o,p,f,0,this.speakerMuteState[f])}),this.detectorCallbackToActivityTimer.set(p,_),f&&m){let o=new w.default(m);o.start(()=>{f(this.speakerScores)}),this.detectorCallbackToScoresTimer.set(p,o)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)}unsubscribe(o){let p=this.detectorCallbackToHandler.get(o);this.detectorCallbackToHandler.delete(o),p&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(p);let f=this.detectorCallbackToActivityTimer.get(o);f&&(f.stop(),this.detectorCallbackToActivityTimer.delete(o));let m=this.detectorCallbackToScoresTimer.get(o);m&&(m.stop(),this.detectorCallbackToHandler.delete(o))}destroy(){return m(this,void 0,void 0,function*(){for(let o of this.detectorCallbackToHandler.values())this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o);for(let o of this.detectorCallbackToActivityTimer.values())o.stop();for(let o of this.detectorCallbackToScoresTimer.values())o.stop();this.detectorCallbackToHandler.clear(),this.detectorCallbackToActivityTimer.clear(),this.detectorCallbackToScoresTimer.clear()})}}},0x1055669a4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=.9,p=.01,f=.2,m=.2){this.speakerWeight=o,this.cutoffThreshold=p,this.silenceThreshold=f,this.takeoverRate=m,this.volumes={}}calculateScore(o,p,f){(f||null===p)&&(p=0),this.volumes.hasOwnProperty(o)||(this.volumes[o]=0),p=+(p>this.silenceThreshold);let m=this.volumes[o]*this.speakerWeight+p*(1-this.speakerWeight);for(let f in this.volumes[o]=m,this.volumes)f!==o&&(this.volumes[f]=Math.max(this.volumes[f]-this.takeoverRate*p,0));return m<this.cutoffThreshold?0:m}prioritizeVideoSendBandwidthForActiveSpeaker(){return!0}}},0x173a687a3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ApplicationMetadata{constructor(o,p){this.appName=o,this.appVersion=p}static create(o,p){let f=/^[a-zA-Z0-9]+[a-zA-Z0-9_-]*[a-zA-Z0-9]+$/g;if(!o||o.length>32)throw Error("appName should be a valid string and 1 to 32 characters in length");if(!f.test(o))throw Error(`appName must satisfy ${f} regular expression`);if(!p||p.length>32)throw Error("appVersion should be a valid string and 1 to 32 characters in length");if(!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm.test(p))throw Error("appVersion must satisfy Semantic Versioning format");return new ApplicationMetadata(o,p)}}},0x977823e1:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x197b329a2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x1158c4d3));p.default=class{constructor(o){this.logger=o,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new w.default,this.observers=new Set}bindAudioElement(o){return m(this,void 0,void 0,function*(){if(!o)throw Error(`Cannot bind audio element: ${o}`);return this.audioElement=o,this.audioElement.autoplay=!0,this.bindAudioMix()})}unbindAudioElement(){this.audioElement&&(this.audioElement.srcObject=null,this.audioElement=null,this.forEachObserver(o=>{this.audioStream&&o.meetingAudioStreamBecameInactive(this.audioStream)}))}bindAudioStream(o){return m(this,void 0,void 0,function*(){if(o){this.audioStream=o;try{yield this.bindAudioMix()}catch(o){this.logger&&this.logger.warn(`Failed to bind audio stream: ${o}`)}}})}bindAudioDevice(o){return m(this,void 0,void 0,function*(){if(o&&!this.browserBehavior.supportsSetSinkId())throw Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=o,this.bindAudioMix()})}forEachObserver(o){for(let p of this.observers)I.default.nextTick(()=>{o(p)})}bindAudioMix(){var o,p;return m(this,void 0,void 0,function*(){if(!this.audioElement)return;let f=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),f!==this.audioStream&&this.forEachObserver(o=>{f&&o.meetingAudioStreamBecameInactive(f),this.audioStream&&o.meetingAudioStreamBecameActive(this.audioStream)});let m=(null==(o=this.audioDevice)?void 0:o.deviceId)!==this.audioElement.sinkId;if(m&&void 0===this.audioElement.sinkId)throw Error("Cannot select audio output device. This browser does not support setSinkId.");let _=this.audioDevice?this.audioDevice.deviceId:"";if(_===this.audioElement.sinkId)return;let w=this.audioElement,I=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=null),m)try{yield w.setSinkId(_)}catch(o){throw null==(p=this.logger)||p.error(`Failed to set sinkId for audio element: ${o}`),o}this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=I)})}getCurrentMeetingAudioStream(){return m(this,void 0,void 0,function*(){return this.audioStream})}addAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.add(o)})}removeAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.delete(o)})}audioOutputDidChange(o){return m(this,void 0,void 0,function*(){return this.logger.info("Receive an audio output change event"),this.bindAudioDevice(o)})}}},0x1be31fc8b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2));p.default=class AudioProfile{constructor(o=null,p=!0){this.audioBitrateBps=o,this.enableAudioRedundancy=new _.default().supportsAudioRedundancy()&&p}static fullbandSpeechMono(o=!0){return new AudioProfile(4e4,o)}static fullbandMusicMono(o=!0){return new AudioProfile(64e3,o)}static fullbandMusicStereo(o=!0){return new AudioProfile(128e3,o)}isStereo(){return 128e3===this.audioBitrateBps}hasRedundancyEnabled(){return this.enableAudioRedundancy}}},0xb1f38e48:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=void 0;let _=m(f(0x5b4a3d7a));p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=25;let w=class{constructor(){this.logger=null,this.browserBehavior=null,this.meetingSessionConfiguration=null,this.signalingClient=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.activeAudioInput=void 0,this.activeVideoInput=void 0,this.audioMixController=null,this.transceiverController=null,this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.iceGatheringStateEventHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.reconnectController=null,this.removableObservers=[],this.audioProfile=null,this.videoStreamIndex=null,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.lastKnownVideoAvailability=null,this.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.lastVideosToReceive=null,this.videoSubscriptions=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videoSendCodecPreferences=[],this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.prioritizedSendVideoCodecCapabilities=[],this.degradedVideoSendCodecs=[],this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.enableSVC=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null,this.retryCount=0,this.isSessionConnected=!1}resetConnectionSpecificState(){this.peer&&this.peer.close(),this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,void 0!==this.transceiverController&&this.transceiverController.reset(),this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.videoDownlinkBandwidthPolicy.reset(),this.videoUplinkBandwidthPolicy.reset&&this.videoUplinkBandwidthPolicy.reset(),this.lastVideosToReceive=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptions=null,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videosToReceive=new _.default,this.videosPaused=new _.default,this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.videoDuplexMode=null,this.isSessionConnected=!1}};p.default=w},0x11418f4a2:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0x1d159ee8)),x=k(f(0x197b329a2)),O=k(f(0x1be31fc8b)),L=k(f(0x9a4430b2)),B=k(f(0x18c985af)),U=k(f(0x202eb6fd7)),$=k(f(0x170a3ef32)),q=f(0x8fff55e5),Z=k(f(0x194415c85)),ee=k(f(0x11a9e868)),et=k(f(0x1d61c1795)),ei=k(f(0x230534cc6)),er=k(f(0x138580412)),en=k(f(0x24bb989ba)),eo=k(f(0x1158c4d3)),es=k(f(0x178bce6ff)),ea=k(f(0x1f3b38cfe)),el=k(f(0x247795129)),ed=k(f(0x1ac272bbc)),ec=k(f(0x15a2e95ed)),eu=k(f(0x1bd55d3c4)),eh=w(f(0xf8b13aac)),ep=k(f(0x216f98b8d)),ef=k(f(0x1217c7f3f)),em=f(0x252035ee7),eg=k(f(0x69c93909)),eS=k(f(0x1c7d226ae)),ev=k(f(0x435994a8)),eb=k(f(0xbf52f99d)),ey=k(f(0x73c142bf)),e_=k(f(0x44174156)),eC=k(f(0xa567a7ba)),eT=k(f(0x1b7bc4701)),eE=k(f(0x10a1c2ebe)),ew=k(f(0x8c94ea05)),eI=k(f(0x1f9f2eb05)),eA=k(f(0xc8b2a6fb)),ek=k(f(0x1a50cfb5)),eM=k(f(0x8ef9a2fd)),ex=k(f(0x26b16a9c)),eP=k(f(0x141765a48)),eR=k(f(0x117aaca57)),eO=k(f(0x13a00d587)),eD=k(f(0x164fd248f)),eL=k(f(0x11bbef2ec)),eN=k(f(0x23693b9e4)),eF=k(f(0x1c9808277)),eV=k(f(0x22ef5bfc)),eB=k(f(0xe6d64708)),eU=k(f(0x112462f64)),ej=k(f(0x238ca30a)),eH=k(f(0xf1a8ac2)),ez=k(f(0x4287252)),eG=k(f(0x72848aa)),eW=f(0xab1ef933),e$=k(f(0x17f8c39ba)),eK=k(f(0x38bf5f74)),eq=k(f(0x171bbd0a0)),eJ=f(0xb8e111a8),eY=k(f(0x5b4a3d7a)),eX=k(f(0x151b9e5ee)),eQ=k(f(0x25113bad6)),eZ=k(f(0x129e504bc)),e0=k(f(0x86c4609a)),e1=k(f(0x11b1e3853)),e2=k(f(0xf9210d7b)),e3=k(f(0x20da5c30a)),e4=k(f(0xb1f38e48)),e5=class DefaultAudioVideoController{constructor(o,p,f,m,_,w){this._audioProfile=new O.default,this.connectionHealthData=new B.default,this.observerQueue=new Set,this.meetingSessionContext=new e4.default,this.enableSimulcast=!1,this.enableSVC=!1,this.useUpdateTransceiverControllerForUplink=!1,this.startAudioVideoTimestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!1,this.receiveIndexTask=void 0,this.monitorTask=void 0,this.receiveRemotePauseResumeTask=void 0,this.destroyed=!1,this._logger=p,this.sessionStateController=new ea.default(this._logger),this._configuration=o,this._webSocketAdapter=f,this._realtimeController=new en.default(m),this._realtimeController.realtimeSetLocalAttendeeId(o.credentials.attendeeId,o.credentials.externalUserId),this._mediaStreamBroker=m,this._reconnectController=_,this._videoTileController=new eZ.default(new e0.default,this,this._logger),this._audioMixController=new x.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=w,this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers||(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)&&new L.default().hasChromiumWebRTC()?this.videoSendCodecPreferences=[es.default.av1Main(),es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()]:this.videoSendCodecPreferences=[es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()])}destroy(){return I(this,void 0,void 0,function*(){this.observerQueue.clear(),this._mediaStreamBroker.removeMediaStreamBrokerObserver(this._audioMixController),this.destroyed=!0})}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new M.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}get eventController(){return this._eventController}getRTCPeerConnectionStats(o){return(this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent||(this.logger.warn("The `getRTCPeerConnectionStats()` is on its way to be deprecated. It makes an additional call to the `getStats` API and therefore may cause slight performance degradation. Please use the new API `clientMetricReport.getRTCStatsReport()` returned by `metricsDidReceive(clientMetricReport)` callback instead."),this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!0),this.rtcPeerConnection)?this.rtcPeerConnection.getStats(o):null}setAudioProfile(o){this._audioProfile=o}addObserver(o){this.logger.info("adding meeting observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing meeting observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)eo.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}initSignalingClient(){this.connectionHealthData.reset(),this.meetingSessionContext.signalingClient||(this.meetingSessionContext=new e4.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new L.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.audioProfile=this._audioProfile,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new eu.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){this.meetingSessionContext.signalingClient.removeObserver(this.preStartObserver),this.preStartObserver=void 0}prestart(){return this.logger.info("Pre-connecting signaling connection."),this.createOrReuseSignalingTask().run().then(()=>{let handleClosed=()=>I(this,void 0,void 0,function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()});this.preStartObserver={handleSignalingClientEvent(o){o.type===ep.default.WebSocketClosed&&handleClosed()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)}).catch(o=>{this.logger.error(`Signaling task pre-start failed: ${o}`),this.signalingTask=void 0})}start(o){this.startReturningPromise(o).then(()=>{this.logger.info("start completed")}).catch(o=>{this.logger.error(`start failed: ${o}`)})}startReturningPromise(o){return(null==o?void 0:o.signalingOnly)===!0?this.prestart():(this.activeSpeakerDetector,new Promise((o,p)=>{this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!1).then(o).catch(p)})}))}connectWithPromises(o){let p=this.meetingSessionContext,timeout=(o,p)=>new eB.default(this.logger,p,o);this.monitorTask=new eI.default(p,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);let f=this.monitorTask.once(),m=new ex.default(p).once();this.receiveIndexTask=new eO.default(p),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();let _=new eL.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new ew.default(p),new eD.default(p),new eT.default(p),this.receiveIndexTask]).once(),w=new ey.default(p).once(_),I=new eS.default(p).once(w,m),k=new e_.default(p).once(I),M=new eN.default(p).once(k),x=new eC.default(p).once(M),O=new eV.default(p).once(x);return this.receiveRemotePauseResumeTask=new eP.default(p),this.receiveRemotePauseResumeTask.once(O),new eL.default(this.logger,this.wrapTaskName("AudioVideoStart"),[f,timeout(this.configuration.connectionTimeoutMs,new eL.default(this.logger,"Peer",[O,this.receiveRemotePauseResumeTask,o?new eB.default(this.logger,new ek.default(this.logger,"FinalizeConnection",[new eU.default(p),new eF.default(p)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new eF.default(p)]))])}actionConnect(o){var p;return I(this,void 0,void 0,function*(){this.initSignalingClient(),this.uninstallPreStartObserver(),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this,this.enableSimulcast=this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&new L.default().hasChromiumWebRTC(),this.enableSimulcast&&this.configuration.enableSVC&&this.logger.warn("SVC cannot be enabled at the same time as simulcast. Disabling SVC, using simulcast."),this.enableSVC=!this.enableSimulcast&&this.configuration.enableSVC&&new L.default().supportsScalableVideoCoding();let f=!!this.configuration.urls.audioHostURL;if(f?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new eH.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext):this.meetingSessionContext.transceiverController=new ez.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new ej.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new eG.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)),this.meetingSessionContext.volumeIndicatorAdapter=new e3.default(this.logger,this._realtimeController,DefaultAudioVideoController.MIN_VOLUME_DECIBELS,DefaultAudioVideoController.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.meetingSessionContext.enableSVC=this.enableSVC,this.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy;o||(o=new e1.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=o),o.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eq.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new eQ.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new eX.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new e2.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.videoUplinkBandwidthPolicy.setSVCEnabled(this.enableSVC)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eK.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController&&this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController&&(this.useUpdateTransceiverControllerForUplink=!0,this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController(this.meetingSessionContext.transceiverController)),this.meetingSessionContext.audioProfile=this._audioProfile;if(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)){let o=this.configuration.meetingFeatures.contentMaxResolution===$.default.VideoResolutionUHD;o&&this.setVideoMaxBandwidthKbps(2500),this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}else{let o=this.configuration.meetingFeatures.videoMaxResolution===$.default.VideoResolutionFHD;this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}this.meetingSessionContext.videoUplinkBandwidthPolicy&&this.maxUplinkBandwidthKbps&&this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(this.maxUplinkBandwidthKbps),this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController(this._videoTileController),this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver(()=>this.update({needsRenegotiation:!1})),this.meetingSessionContext.lastKnownVideoAvailability=new et.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new e$.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new eY.default,this.meetingSessionContext.videosPaused=new eY.default,this.meetingSessionContext.statsCollector=new eg.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new U.default(this,this._realtimeController,this.connectionHealthData,new er.default(this.meetingSessionContext.signalingClient,DefaultAudioVideoController.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},this._videoTileController.registerVideoTileResolutionObserver(this.meetingSessionContext.statsCollector),o||(this.meetingSessionContext.retryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!1))}),null==(p=this.eventController)||p.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);let m=f&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;this.logger.info("Needs to wait for attendee presence? "+m);let _=this.connectWithPromises(m);try{yield _.run(),this.connectionHealthData.setConnectionStartTime();let o=new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT);this.connectionHealthData.setIsContentShare(o),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var o;this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,null==(o=this.eventController)||o.publishEvent("meetingStartSucceeded",q.audioVideoEventAttributesFromState(this.meetingSessionContext)),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()})}catch(p){this.signalingTask=void 0;let o=new Z.default(this.getMeetingStatusCode(p)||ee.default.TaskFailed);if(this.logger.info(`Start failed: ${o} due to error ${p}.`),this.sessionStateController.state()===ed.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(el.default.Fail,()=>I(this,void 0,void 0,function*(){yield this.actionDisconnect(o,!0,p),this.handleMeetingSessionStatus(o,p)||this.notifyStop(o,p)}))}})}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new eB.default(this.logger,new eA.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=em.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.meetingSessionContext.isSessionConnected=!0,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStart).map(p=>p.bind(o)())}),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var o;return(this._reconnectController.disableReconnect(),this.sessionStateController.state()===ed.default.NotConnected)?(null==(o=this.meetingSessionContext.signalingClient)||o.closeConnection(),this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise((o,p)=>{this.sessionStateController.perform(el.default.Disconnect,()=>{this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new Z.default(ee.default.Left),!1,null).then(o).catch(p)})})}stop(){this.stopReturningPromise()}actionDisconnect(o,p,f){return I(this,void 0,void 0,function*(){try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new eB.default(this.logger,new eE.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(o){this.logger.info("fail to stop")}try{let o=[new eB.default(this.logger,new eb.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new eL.default(this.logger,this.wrapTaskName("AudioVideoClean"),o).run()}catch(o){this.logger.info("fail to clean")}this.sessionStateController.perform(el.default.FinishDisconnecting,()=>{p||this.notifyStop(o,f)}),this._videoTileController.removeVideoTileResolutionObserver(this.meetingSessionContext.statsCollector)})}update(o={needsRenegotiation:!0}){let p=o.needsRenegotiation;if(p||(p=void 0===this.meetingSessionContext.peer),p||(p=!this.updateRemoteVideosFromPolicy()),p||(p=!this.updateLocalVideoFromPolicy()),this.meetingSessionContext.lastVideosToReceive=this.meetingSessionContext.videosToReceive,!p)return this.logger.info("Update request does not require resubscribe"),this.actionFinishUpdating(),!0;this.logger.info("Update request requires resubscribe"),this.updateNumberOfPublishedVideoSources();let f=this.sessionStateController.perform(el.default.Update,()=>{this.actionUpdateWithRenegotiation(!0)});return f===ec.default.Transitioned||f===ec.default.DeferredTransition}updateNumberOfPublishedVideoSources(){let o=this.configuration.credentials.attendeeId,p=this._videoTileController.hasStartedLocalVideoTile();if(null!==this.meetingSessionContext.videoStreamIndex){let f=this.meetingSessionContext.videoStreamIndex.numberOfVideoPublishingParticipantsExcludingSelf(o)+ +!!p;this.connectionHealthData.setNumberOfPublishedVideoSources(f)}}updateRemoteVideosFromPolicy(){if(this.meetingSessionContext.videoDownlinkBandwidthPolicy&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getVideoPreferences&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&!eh.serverSideNetworkAdaptionIsNoneOrDefault(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())){if(!this.sendRemoteVideoUpdate())return!1;if(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()===eh.default.BandwidthProbingAndRemoteVideoQualityAdaption)return this.isNotAddingOrRemovingStreams()}return this.updateRemoteVideosIfNotAddingOrRemovingStreams()}updateRemoteVideosIfNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.simulcastStreamUpdates,m=o.removed,_=this.meetingSessionContext,w=[];for(let[o,p]of f.entries()){let f=new ef.default;if(f.streamId=p,f.attendeeId=_.videoStreamIndex.attendeeIdForStreamId(p),f.mid=_.transceiverController.getMidForStreamId(o),void 0===f.mid)return this.logger.info(`No MID found for stream ID ${o}, cannot update stream without renegotiation`),!1;if(w.push(f),_.transceiverController.setStreamIdForMid(f.mid,p),_.videoStreamIndex.overrideStreamIdMappings(o,p),_.videoTileController.haveVideoTileForAttendeeId(f.attendeeId)){let o=_.videoTileController.getVideoTileForAttendeeId(f.attendeeId);if(!o.setStreamId)return!1;o.setStreamId(p)}}return 0!==w.length&&_.signalingClient.remoteVideoUpdate(w,[]),0===p.length&&0===m.length&&(_.videoStreamIndex.remoteVideoUpdateSent(),!0)}detectChangesInVideosToReceive(){let o=this.meetingSessionContext;if(null===o.videosToReceive||!o.transceiverController||!o.transceiverController.getMidForStreamId||!o.transceiverController.setStreamIdForMid||!o.videosToReceive.forEach||!o.signalingClient.remoteVideoUpdate||!o.videoStreamIndex.overrideStreamIdMappings)return;let p=[],f=new Map,m=[];if(null===o.lastVideosToReceive)p=o.videosToReceive.array();else{let _=o.videoStreamIndex;o.videosToReceive.forEach(m=>{if(o.lastVideosToReceive.contain(m))return;let w=!1;o.lastVideosToReceive.forEach(o=>{!w&&_.StreamIdsInSameGroup(o,m)&&(f.set(o,m),w=!0)}),w||p.push(m)}),m=o.lastVideosToReceive.array().filter(p=>{let m=o.videosToReceive.contain(p),_=f.has(p);return!m&&!_})}return this.logger.info(`Request to update remote videos with added: [${p}], updated: [${Array.from(f.entries()).map(([o,p])=>`${o}->${p}`).join(",")}], removed: [${m}]`),{added:p,removed:m,simulcastStreamUpdates:f}}isNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.removed;return 0===p.length&&0===f.length&&(this.meetingSessionContext.videoStreamIndex.remoteVideoUpdateSent(),!0)}sendRemoteVideoUpdate(){let o=this.meetingSessionContext;if(null===o.videosToReceive)return!1;let p=o.videosToReceive.array().map(p=>o.videoStreamIndex.groupIdForStreamId(p));this.receiveRemotePauseResumeTask.updateSubscribedGroupdIds(new Set(p));let f=eJ.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(o,p,o.videoDownlinkBandwidthPolicy.getVideoPreferences()),m=new Map,_=[];for(let p of f){let f=!1;if(o.lastVideoSubscriptionConfiguration.has(p.groupId)){let m=o.lastVideoSubscriptionConfiguration.get(p.groupId);p.equals(m)||(this.logger.debug(`${JSON.stringify(p)} does not equal ${JSON.stringify(m)}, sending update`),f=!0)}else f=!0;m.set(p.groupId,p),f&&_.push(p)}o.lastVideoSubscriptionConfiguration=m;let w=[];if(null!==o.lastVideosToReceive){let f=new Set(p);for(let p of o.lastVideosToReceive.array()){let m=o.videoStreamIndex.groupIdForStreamId(p);if(!f.has(m)){let p=o.transceiverController.getMidForGroupId(m);if(void 0===p){o.logger.warn(`Could not find MID for group ID to remove: ${m}`);continue}w.push(p)}}}return(0!==_.length||0!==w.length)&&o.signalingClient.remoteVideoUpdate(_,w),!0}updateLocalVideoFromPolicy(){if(this.meetingSessionContext.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseEncodingParameters();if(this.mayNeedRenegotiationForSimulcastLayerChange&&this.meetingSessionContext.transceiverController.hasVideoInput()&&!this.negotiatedBitrateLayersAllocationRtpHeaderExtension())return this.logger.info("Needs regenotiation for local video simulcast layer change"),this.mayNeedRenegotiationForSimulcastLayerChange=!1,!1;this.meetingSessionContext.transceiverController.setEncodingParameters(o)}else this.meetingSessionContext.videoCaptureAndEncodeParameter=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters();return this.logger.info("Updated local video from policy without renegotiation"),!0}negotiatedBitrateLayersAllocationRtpHeaderExtension(){if(!this.meetingSessionContext.transceiverController.localVideoTransceiver())return!1;let o=this.meetingSessionContext.transceiverController.localVideoTransceiver().sender.getParameters();return!!o&&!!o.headerExtensions&&o.headerExtensions.some(o=>"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"===o.uri)}restartLocalVideo(o){let restartVideo=()=>I(this,void 0,void 0,function*(){this._videoTileController.hasStartedLocalVideoTile()&&(this.logger.info("stopping local video tile prior to local video restart"),this._videoTileController.stopLocalVideoTile(),this.logger.info("preparing local video restart update"),yield this.actionUpdateWithRenegotiation(!1),this.logger.info("starting local video tile for local video restart"),this._videoTileController.startLocalVideoTile()),this.logger.info("finalizing local video restart update"),yield this.actionUpdateWithRenegotiation(!0),o()}),p=this.sessionStateController.perform(el.default.Update,()=>{restartVideo()});return p===ec.default.Transitioned||p===ec.default.DeferredTransition}replaceLocalVideo(o){return I(this,void 0,void 0,function*(){if(!o||o.getVideoTracks().length<1)throw Error("could not acquire video track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");let p=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(p){let f=p.state(),m=o.getVideoTracks()[0].getSettings();p.bindVideoStream(f.boundAttendeeId,!0,o,m.width,m.height,f.streamId,f.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(o.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=o,this.logger.info("Local video input is updated")})}replaceLocalAudio(o){return I(this,void 0,void 0,function*(){if(!o||o.getAudioTracks().length<1)throw Error("could not acquire audio track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");if(this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime(),!(yield this.meetingSessionContext.transceiverController.replaceAudioTrack(o.getAudioTracks()[0])))throw Error("Failed to replace audio track");this.meetingSessionContext.activeAudioInput=o,this.logger.info("Local audio input is updated")})}actionUpdateWithRenegotiation(o){return I(this,void 0,void 0,function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),o&&this.sessionStateController.perform(el.default.FinishUpdating,()=>{this.actionFinishUpdating()})}catch(o){this.sessionStateController.perform(el.default.FinishUpdating,()=>{let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);p.statusCode()!==ee.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(p,o)})}})}notifyStop(o,p){var f;if(this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoDidStop).map(f=>f.bind(p)(o))}),this.eventController){let m=Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]}),_=p&&p.message||(null==(f=o.toString)?void 0:f.call(o))||"";null===this.meetingSessionContext.startTimeMs?(m.meetingErrorMessage=_,delete m.meetingDurationMs,delete m.attendeePresenceDurationMs,delete m.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",m)):o.isFailure()||o.isAudioConnectionFailure()?(m.meetingErrorMessage=_,this.eventController.publishEvent("meetingFailed",m)):this.eventController.publishEvent("meetingEnded",m)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{let o=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(o)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(o,p){this.promotedToPrimaryMeeting&&(this.promotedToPrimaryMeeting=!1,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.AudioVideoDisconnectedWhilePromoted)))}));let f=this._reconnectController.retryWithBackoff(()=>I(this,void 0,void 0,function*(){this.sessionStateController.state()===ed.default.NotConnected?this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!0)}):this.sessionStateController.perform(el.default.Reconnect,()=>{this.actionReconnect(o)}),this.meetingSessionContext.retryCount+=1}),()=>{this.logger.info("canceled retry")});return f||this.sessionStateController.perform(el.default.Fail,()=>{this.actionDisconnect(o,!1,p)}),f}actionReconnect(o){return I(this,void 0,void 0,function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!0))})),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset(),this.receiveRemotePauseResumeTask=new eP.default(this.meetingSessionContext);try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new eB.default(this.logger,new eL.default(this.logger,"Media",[new ev.default(this.meetingSessionContext),new eL.default(this.logger,"Signaling",[new eA.default(this.meetingSessionContext),new eT.default(this.meetingSessionContext)]),new ey.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext),this.receiveRemotePauseResumeTask]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var p;null==(p=this.eventController)||p.publishEvent("meetingReconnected",Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]})),this.actionFinishConnecting()})}catch(o){this.sessionStateController.perform(el.default.FinishConnecting,()=>{this.logger.info("failed to reconnect audio-video session");let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);this.handleMeetingSessionStatus(p,o)})}this.connectionHealthData.setConnectionStartTime()})}wrapTaskName(o){return`${o}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}getMeetingStatusCode(o){let p=/the meeting status code: (\d+)/.exec(o&&o.message);return p&&p.length>1?Number.parseInt(p[1],10):null}enforceBandwidthLimitationForSender(o){return I(this,void 0,void 0,function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(o)})}handleMeetingSessionStatus(o,p){if(this.logger.info(`handling status: ${ee.default[o.statusCode()]}`),!o.isTerminal()&&this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(o),o.statusCode()===ee.default.IncompatibleSDP)return this.restartLocalVideo(()=>{this.logger.info("handled incompatible SDP by attempting to restart video")}),!0;if(o.statusCode()===ee.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver(o=>{eW.Maybe.of(o.videoSendDidBecomeUnavailable).map(p=>p.bind(o)())}),!1;if(o.statusCode()===ee.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoWasDemotedFromPrimaryMeeting).map(f=>f.bind(p)(o))}),!1;if(o.isTerminal()&&(this.logger.error("session will not be reconnected"),this.meetingSessionContext.reconnectController&&this.meetingSessionContext.reconnectController.disableReconnect()),(o.isFailure()||o.isTerminal())&&this.meetingSessionContext.reconnectController){let f=this.reconnect(o,p);return f?this.logger.warn(`The audio video controller will reconnect due to status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`):this.logger.error(`The audio video controller failed with status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`),f}return!1}setVideoMaxBandwidthKbps(o){if(o<=0)throw Error("Max bandwidth kbps has to be greater than 0");this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&(this.logger.info(`video send has ideal max bandwidth ${o} kbps`),this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(o)),this.maxUplinkBandwidthKbps=o}handleHasBandwidthPriority(o){return I(this,void 0,void 0,function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){if(this.useUpdateTransceiverControllerForUplink){this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o),yield this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();return}let p=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o);let f=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();p!==f&&(this.logger.info(`video send bandwidth priority ${o} max has changed from ${p} kbps to ${f} kbps`),yield this.enforceBandwidthLimitationForSender(f))}})}pauseReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.pause([o])}resumeReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.resume([o])}setVideoCodecSendPreferences(o){this.videoSendCodecPreferences=o,this.meetingSessionContext.videoSendCodecPreferences=o,this.sessionStateController.state()!==ed.default.NotConnected&&this.update({needsRenegotiation:!0})}getRemoteVideoSources(){let{videoStreamIndex:o}=this.meetingSessionContext;if(!o)return this.logger.info("meeting has not started"),[];let p=this.configuration.credentials.attendeeId;return o.allVideoSendingSourcesExcludingSelf(p)}encodingSimulcastLayersDidChange(o){this.mayNeedRenegotiationForSimulcastLayerChange=!0,this.forEachObserver(p=>{eW.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}promoteToPrimaryMeeting(o){return this.actionPromoteToPrimaryMeeting(o)}actionPromoteToPrimaryMeeting(o){return I(this,void 0,void 0,function*(){let p=new Z.default(ee.default.SignalingRequestFailed);return yield new eL.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new eB.default(this.logger,new eM.default(this.meetingSessionContext,o,o=>{p=o}),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=p.statusCode()===ee.default.OK,p})}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.OK)))})}videoInputDidChange(o){return I(this,void 0,void 0,function*(){(this.logger.info("Receive a video input change event"),this.meetingSessionContext&&this.meetingSessionContext.peer)?this._videoTileController.hasStartedLocalVideoTile()&&(o?yield this.replaceLocalVideo(o):this._videoTileController.stopLocalVideoTile()):this.logger.info("Skip updating video input because there is no active meeting and peer connection")})}audioInputDidChange(o){return I(this,void 0,void 0,function*(){if(this.logger.info("Receive an audio input change event"),!this.meetingSessionContext||!this.meetingSessionContext.peer)return void this.logger.info("Skip updating audio input because there is no active meeting and peer connection");if(!o)try{o=yield this.mediaStreamBroker.acquireAudioInputStream()}catch(o){this.logger.error("Could not acquire audio track from mediaStreamBroker");return}yield this.replaceLocalAudio(o)})}};p.default=e5,e5.MIN_VOLUME_DECIBELS=-42,e5.MAX_VOLUME_DECIBELS=-14,e5.PING_PONG_INTERVAL_MS=1e4},0x191a3194b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14915840a)),w=m(f(0x18e4b58c2)),I=m(f(0x1e9fbf678)),k=m(f(0x203f02bb7)),M=m(f(0x18e1c570f)),x=m(f(0x614ebca7)),O=m(f(0x194415c85)),L=m(f(0x11a9e868)),B=m(f(0xfce8eb05)),U=m(f(0x100e5c30c)),$=m(f(0x947abb4a)),q=m(f(0x11418f4a2));p.default=class extends q.default{constructor(o){const p=new M.default;p.meetingId="",p.externalMeetingId="",p.credentials=new x.default,p.credentials.attendeeId="",p.credentials.joinToken="",p.urls=new B.default,p.urls.turnControlURL="",p.urls.audioHostURL="",p.urls.signalingURL="wss://localhost/";const f=new I.default;super(o||p,f,new $.default(new I.default),new k.default,new U.default(0,new _.default(0,0,0)),new w.default(o||p,f))}setAudioProfile(o){}start(){}stop(){}promoteToPrimaryMeeting(o){return Promise.resolve(new O.default(L.default.OK))}demoteFromPrimaryMeeting(){}}},0xf2ec2ef2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1a86248d4);p.default=class{constructor(o,p,f,m,_,w){this.audioVideoController=o,this.videoTileController=p,this.realtimeController=f,this.audioMixController=m,this.deviceController=_,this.contentShareController=w}addObserver(o){this.audioVideoController.addObserver(o),this.trace("addObserver")}removeObserver(o){this.audioVideoController.removeObserver(o),this.trace("removeObserver")}setAudioProfile(o){this.trace("setAudioProfile",o),this.audioVideoController.setAudioProfile(o)}start(o){this.audioVideoController.start(o),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(o){return this.trace("getRTCPeerConnectionStats",o?o.id:null),this.audioVideoController.getRTCPeerConnectionStats(o)}bindAudioElement(o){let p=this.audioMixController.bindAudioElement(o);return this.trace("bindAudioElement",o.id,p),p}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(o){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(o)}removeAudioMixObserver(o){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(o)}bindVideoElement(o,p){this.videoTileController.bindVideoElement(o,p),this.trace("bindVideoElement",{tileId:o,videoElementId:p.id})}unbindVideoElement(o,p=!0){this.videoTileController.unbindVideoElement(o,p),this.trace("unbindVideoElement",{tileId:o,cleanUpVideoElement:p})}startLocalVideoTile(){let o=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,o),o}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){let o=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,o),o}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){let o=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),o}pauseVideoTile(o){this.videoTileController.pauseVideoTile(o),this.trace("pauseVideoTile",o)}unpauseVideoTile(o){this.videoTileController.unpauseVideoTile(o),this.trace("unpauseVideoTile",o)}getVideoTile(o){let p=this.videoTileController.getVideoTile(o);return this.trace("getVideoTile",o),p}getAllRemoteVideoTiles(){let o=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),o}getAllVideoTiles(){let o=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),o}addVideoTile(){let o=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,o.state()),o}removeVideoTile(o){this.videoTileController.removeVideoTile(o),this.trace("removeVideoTile",o)}removeVideoTilesByAttendeeId(o){let p=this.videoTileController.removeVideoTilesByAttendeeId(o);return this.trace("removeVideoTilesByAttendeeId",o,p),p}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(o){let p=this.videoTileController.captureVideoTile(o);return this.trace("captureVideoTile",o),p}realtimeSubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(o),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSetCanUnmuteLocalAudio(o),this.trace("realtimeSetCanUnmuteLocalAudio",o)}realtimeSubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToSetCanUnmuteLocalAudio")}realtimeCanUnmuteLocalAudio(){let o=this.realtimeController.realtimeCanUnmuteLocalAudio();return this.trace("realtimeCanUnmuteLocalAudio",null,o),o}realtimeMuteLocalAudio(){this.realtimeController.realtimeMuteLocalAudio(),this.trace("realtimeMuteLocalAudio")}realtimeUnmuteLocalAudio(){let o=this.realtimeController.realtimeUnmuteLocalAudio();return this.trace("realtimeUnmuteLocalAudio"),o}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeSubscribeToMuteAndUnmuteLocalAudio")}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToMuteAndUnmuteLocalAudio")}realtimeIsLocalAudioMuted(){let o=this.realtimeController.realtimeIsLocalAudioMuted();return this.trace("realtimeIsLocalAudioMuted"),o}realtimeSubscribeToVolumeIndicator(o,p){this.realtimeController.realtimeSubscribeToVolumeIndicator(o,p),this.trace("realtimeSubscribeToVolumeIndicator",o)}realtimeUnsubscribeFromVolumeIndicator(o,p){this.realtimeController.realtimeUnsubscribeFromVolumeIndicator(o,p),this.trace("realtimeUnsubscribeFromVolumeIndicator",o,p)}realtimeSubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o),this.trace("realtimeSubscribeToLocalSignalStrengthChange")}realtimeUnsubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(o),this.trace("realtimeUnsubscribeToLocalSignalStrengthChange")}realtimeSendDataMessage(o,p,f){this.realtimeController.realtimeSendDataMessage(o,p,f),this.trace("realtimeSendDataMessage")}realtimeSubscribeToReceiveDataMessage(o,p){this.realtimeController.realtimeSubscribeToReceiveDataMessage(o,p),this.trace("realtimeSubscribeToReceiveDataMessage")}realtimeUnsubscribeFromReceiveDataMessage(o){this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(o),this.trace("realtimeUnsubscribeFromReceiveDataMessage")}realtimeSubscribeToFatalError(o){this.realtimeController.realtimeSubscribeToFatalError(o),this.trace("realtimeSubscribeToFatalError")}realtimeUnsubscribeToFatalError(o){this.realtimeController.realtimeUnsubscribeToFatalError(o),this.trace("realtimeUnsubscribeToFatalError")}subscribeToActiveSpeakerDetector(o,p,f,m){this.audioVideoController.activeSpeakerDetector.subscribe(o,p,f,m),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(o){this.audioVideoController.activeSpeakerDetector.unsubscribe(o),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioInputDevices(o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listVideoInputDevices(o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioOutputDevices(o);return this.trace("listAudioOutputDevices",o,p),p})}startAudioInput(o){return m(this,void 0,void 0,function*(){return this.trace("startAudioInput",o),this.deviceController.startAudioInput(o)})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()})}startVideoInput(o){return m(this,void 0,void 0,function*(){return _.isVideoTransformDevice(o)?this.trace("startVideoInput with transform device"):this.trace("startVideoInput",o),this.deviceController.startVideoInput(o)})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.trace("stopVideoInput"),this.deviceController.stopVideoInput()})}chooseAudioOutput(o){let p=this.deviceController.chooseAudioOutput(o);return this.trace("chooseAudioOutput",o),p}addDeviceChangeObserver(o){this.deviceController.addDeviceChangeObserver(o),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.deviceController.removeDeviceChangeObserver(o),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){let o=this.deviceController.createAnalyserNodeForAudioInput();return this.trace("createAnalyserNodeForAudioInput"),o}startVideoPreviewForVideoInput(o){this.deviceController.startVideoPreviewForVideoInput(o),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){this.deviceController.stopVideoPreviewForVideoInput(o),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){this.deviceController.setDeviceLabelTrigger(o),this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=this.deviceController.mixIntoAudioInput(o);return this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){this.deviceController.chooseVideoInputQuality(o,p,f),this.trace("chooseVideoInputQuality",{width:o,height:p,frameRate:f})}setVideoMaxBandwidthKbps(o){this.audioVideoController.setVideoMaxBandwidthKbps(o),this.trace("setVideoMaxBandwidthKbps",o)}setVideoCodecSendPreferences(o){this.audioVideoController.setVideoCodecSendPreferences(o),this.trace("setVideoCodecSendPreferences",o)}getVideoInputQualitySettings(){let o=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),o}setContentAudioProfile(o){this.trace("setContentAudioProfile",o),this.contentShareController.setContentAudioProfile(o)}enableSimulcastForContentShare(o,p){this.trace("enableSimulcastForContentShare"),this.contentShareController.enableSimulcastForContentShare(o,p)}enableSVCForContentShare(o){this.trace("enableSVCForContentShare"),this.contentShareController.enableSVCForContentShare(o)}startContentShare(o){let p=this.contentShareController.startContentShare(o);return this.trace("startContentShare"),p}startContentShareFromScreenCapture(o,p){let f=this.contentShareController.startContentShareFromScreenCapture(o,p);return this.trace("startContentShareFromScreenCapture"),f}pauseContentShare(){this.contentShareController.pauseContentShare(),this.trace("pauseContentShare")}unpauseContentShare(){this.contentShareController.unpauseContentShare(),this.trace("unpauseContentShare")}stopContentShare(){this.contentShareController.stopContentShare(),this.trace("stopContentShare")}addContentShareObserver(o){this.contentShareController.addContentShareObserver(o),this.trace("addContentShareObserver")}removeContentShareObserver(o){this.contentShareController.removeContentShareObserver(o),this.trace("removeContentShareObserver")}setContentShareVideoCodecPreferences(o){this.contentShareController.setContentShareVideoCodecPreferences(o),this.trace("setContentShareVideoCodecPreferences")}trace(o,p,f){let m=this.audioVideoController.configuration.meetingId,_=this.audioVideoController.configuration.credentials.attendeeId,w=`API/DefaultAudioVideoFacade/${m}/${_}/${o}`;void 0!==p&&(w+=` ${JSON.stringify(p)}`),void 0!==f&&(w+=` -> ${JSON.stringify(f)}`),this.audioVideoController.logger.info(w)}getRemoteVideoSources(){let o=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,o),o}get transcriptionController(){return this.realtimeController.transcriptionController}promoteToPrimaryMeeting(o){this.audioVideoController.removeObserver(this),this.audioVideoController.addObserver(this);let p=this.audioVideoController.promoteToPrimaryMeeting(o);return this.trace("promoteToPrimaryMeeting",null,p),p}demoteFromPrimaryMeeting(){this.trace("demoteFromPrimaryMeeting"),this.audioVideoController.demoteFromPrimaryMeeting()}audioVideoWasDemotedFromPrimaryMeeting(o){this.contentShareController.stopContentShare(),this.audioVideoController.removeObserver(this)}}},0x1626f4452:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xbbf88408)),I=f(0x11bb8da88);p.default=class extends w.default{constructor(o,p){super(o,p),this.blurCanvas=document.createElement("canvas"),this.blurCanvasCtx=this.blurCanvas.getContext("2d"),this.blurCanvas.width=this.spec.model.input.width,this.blurCanvas.height=this.spec.model.input.height,this.logger.info("BackgroundBlur processor using builtin blur")}drawImageWithMask(o,p){let f=this.blurredImage,{canvasCtx:m,targetCanvas:_}=this,{width:w,height:I}=_;p&&f?(this.scaledCanvas.getContext("2d").putImageData(p,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),m.save(),m.clearRect(0,0,w,I),m.drawImage(this.scaledCanvas,0,0,w,I),m.globalCompositeOperation="source-in",m.drawImage(o,0,0,w,I),m.globalCompositeOperation="destination-over",m.drawImage(this.blurCanvas,0,0,w,I),m.restore()):m.clearRect(0,0,w,I)}setBlurStrength(o){if(super.setBlurStrength(o),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});let o=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:o.path,inputHeight:o.input.height,inputWidth:o.input.width,inputChannels:4,modelRangeMin:o.input.range[0],modelRangeMax:o.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(o){this.blurredImage=o.payload.blurOutput,super.handlePredict(o)}destroy(){var o;let p=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){p.destroy.call(this),null==(o=this.blurCanvas)||o.remove(),this.blurCanvas=void 0})}}},0xbbf88408:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x190179907)),I=f(0x11bb8da88),k=_(f(0x7295d348));p.default=class extends w.default{constructor(o,p){super("background blur",o,p,new k.default),this.blurAmount=0,this.setBlurStrength(p.blurStrength),this.logger.info("BackgroundBlur processor successfully created"),this.logger.info(`BackgroundBlur spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundBlur options: { blurStrength: ${p.blurStrength}, filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}validateOptions(o){if(super.validateOptions(o),!o.blurStrength)throw Error("processor has null options - blurStrength")}initOnFirstExecution(){this.setBlurPixels()}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.filter=`blur(${this.blurAmount}px)`,f.drawImage(o,0,0,m.width,m.height),f.restore()}setBlurStrength(o){this._blurStrength=o,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}static isSupported(){return m(this,void 0,void 0,function*(){let o=document.createElement("canvas"),p=void 0!==o.getContext("2d").filter;return o.remove(),p})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){let o={backgroundBlurEnabled:"true",backgroundBlurStrength:this._blurStrength,backgroundReplacementEnabled:"false",backgroundFilterVersion:1};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}}},0x11bb8da88:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.BlurStrengthMapper=void 0;let f=class{static getBlurAmount(o,p){if(o<=0)throw Error(`invalid value for blur strength: ${o}`);return Math.round(o*p.height/this.BLUR_STRENGTH_DIVISOR)}};p.BlurStrengthMapper=f,f.BLUR_STRENGTH_DIVISOR=540,p.default={LOW:7,MEDIUM:15,HIGH:30}},0x93cc4db7:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x217eb324b)),I=_(f(0x12346a842)),k=_(f(0x19a5566fd)),M=_(f(0x84671e3f)),x=_(f(0x1626f4452)),O=_(f(0xbbf88408)),L=_(f(0x11bb8da88)),B=class extends M.default{setBlurStrength(){}loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}};p.default=class BackgroundBlurVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){let f;o=BackgroundBlurVideoFrameProcessor.resolveSpec(o);let{logger:m}=p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),_=yield BackgroundBlurVideoFrameProcessor.isSupported(o,p);return(m.info(`processor is ${_?"":"not"} supported`),_)?((yield O.default.isSupported())?(m.info("Using browser-provided background blur"),f=new O.default(o,p)):(m.info("Using built-in background blur"),f=new x.default(o,p)),yield f.loadAssets(),f):(m.warn("Using no-op processor because background blur is not supported"),new B)})}static resolveOptions(o={}){let p=Object.assign({},o);return p.blurStrength||(p.blurStrength=L.default.MEDIUM),p.logger||(p.logger=new I.default("BackgroundBlurProcessor",k.default.INFO)),p=super.resolveOptions(p)}static isSupported(o,p){return o=BackgroundBlurVideoFrameProcessor.resolveSpec(o),p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),super.isSupported(o,p)}}},0x7295d348:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f9d952c4));p.default=class extends _.default{}},0x18769c7b5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ModelSpecBuilder{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new ModelSpecBuilder}withDefaultModel(){return this.withSelfieSegmentationDefaults()}withSelfieSegmentationDefaults(){return this.path="https://static.sdkassets.chime.aws/bgblur/models/selfie_segmentation_landscape.tflite",this.input={height:144,width:256,range:[0,1],channels:3},this.output={height:144,width:256,range:[0,1],channels:1},this}withPath(o){return this.path=o,this}withInput(o){return this.input=o,this}withOutput(o){return this.output=o,this}validate(){if(!this.path)throw Error("model spec path is not set");if(!this.input)throw Error("model spec input is not set");if(!this.output)throw Error("model spec output is not set")}build(){return this.validate(),{path:this.path,input:this.input,output:this.output}}}},0xd154b86a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.delegate=o,this.reportingPeriodMillis=p,this.filterCPUUtilization=f,this.logger=m,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(o){let p=o-this.lastReportedEventTimestamp;if(p>=this.reportingPeriodMillis){let f=this.filterCount,m=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=o,0===this.framerate||0===f)return;let _=Math.round(m/f),w=Math.round(this.framerate*(p/1e3))-f,I=Math.round(100*m/p);_>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:w,avgFilterDurationMillis:_,framerate:this.framerate,periodMillis:p}),I>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:I,filterMillis:m,periodMillis:p})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*.8)}frameReceived(o){o!==this.framerate&&(this.framerate=o,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());let p=Date.now();this.reportEvent(p)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}}},0x190179907:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.BackgroundFilterMonitor=void 0;let w=f(0x1e62759b2),I=_(f(0x8cc00a0b)),k=_(f(0xd154b86a)),M=class{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise(o=>this.resolve=o)),this.promise}next(o){this.value=o,this.resolve(o),delete this.promise}};p.default=class BackgroundFilterProcessor{constructor(o,p,f,m,_){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new I.default(this.targetCanvas),this.mask$=new M,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=BackgroundFilterProcessor.createWorkerPromise(),this.loadModelPromise=BackgroundFilterProcessor.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=o,this.validateSpec(p),this.validateOptions(f),this.spec=p,this.logger=f.logger,this.delegate=m,this.initCPUMonitor(f),this.eventController=_}static createWorkerPromise(){let o={resolve:null,reject:null,promise:null};return o.promise=new Promise((p,f)=>{o.resolve=p,o.reject=f}),o}validateSpec(o){if(!o)throw Error("processor has null spec");if(!o.model)throw Error("processor spec has null model");if(!o.paths)throw Error("processor spec has null paths")}validateOptions(o){if(!o)throw Error("processor has null options");if(!o.logger)throw Error("processor has null options - logger");if(!o.reportingPeriodMillis)throw Error("processor has null options - reportingPeriodMillis");if(!o.filterCPUUtilization)throw Error("processor has null options - filterCPUUtilization")}initCPUMonitor(o){this.videoFramesPerFilterUpdate=1,this.frameCounter=new k.default(this.delegate,o.reportingPeriodMillis,o.filterCPUUtilization,this.logger),this.cpuMonitor=new x(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(o){return JSON.stringify(o,null,2)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(o){if(this.logger.info(`received load model message: ${this.stringify(o)}`),2!==o.payload){this.logger.error("failed to load model! status: "+o.payload),this.loadModelPromise.reject(Error("failed to load model! status: "+o.payload));return}this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(o){this.mask$.next(o.payload.output)}handleWorkerEvent(o){let p=o.data;switch(p.msg){case"initialize":this.handleInitialize(p);break;case"loadModel":this.handleLoadModel(p);break;case"predict":this.handlePredict(p);break;default:this.logger.info(`unexpected event msg: ${this.stringify(p)}`)}}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("start initializing the processor");try{this.worker=yield w.loadWorker(this.spec.paths.worker,"BackgroundFilterWorker",{},null),this.worker.addEventListener("message",o=>this.handleWorkerEvent(o)),this.worker.postMessage({msg:"initialize",payload:{wasmPath:this.spec.paths.wasm,simdPath:this.spec.paths.simd}}),yield this.initWorkerPromise.promise,this.logger.info(`successfully initialized the ${this.filterType} worker`),yield this.loadModelPromise.promise,this.logger.info(`successfully loaded ${this.filterType} worker segmentation model`)}catch(o){throw Error(`could not initialize the ${this.filterType} video frame processor due to '${o.message}'`)}this.logger.info(`successfully initialized the ${this.filterType} processor`)})}process(o){return m(this,void 0,void 0,function*(){if(this.destroyed)return o;this.frameCounter.frameReceived(o[0].framerate),this.cpuMonitor.frameReceived();let p=o[0].asCanvasElement();if(!p)return o;if(!this.modelInitialized)return o[0]=this.canvasVideoFrameBuffer,o;let f=p.width,m=p.height;if(0===f||0===m)return o;0===this.sourceWidth&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight,this.logger.info(`${this.filterType} source width: ${this.sourceWidth}`),this.logger.info(`${this.filterType} source height: ${this.sourceHeight}`),this.initOnFirstExecution()),(this.sourceWidth!==f||this.sourceHeight!==m)&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let o=this.mask$.value,f=this.spec.model.input.width/p.width,m=this.spec.model.input.height/p.height;void 0===this.scaledCanvas&&(this.scaledCanvas=document.createElement("canvas"),this.scaledCanvas.width=this.spec.model.input.width,this.scaledCanvas.height=this.spec.model.input.height);let _=this.scaledCanvas.getContext("2d");_.save(),_.scale(f,m),_.drawImage(p,0,0),_.restore();let w=_.getImageData(0,0,this.scaledCanvas.width,this.scaledCanvas.height);if(this.frameNumber%this.videoFramesPerFilterUpdate==0){let p=this.mask$.whenNext();this.worker.postMessage({msg:"predict",payload:w},[w.data.buffer]),o=yield p}this.destroyed||this.drawImageWithMask(p,o)}catch(p){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${p}`),o}finally{this.frameCounter.filterComplete(),this.frameNumber++}return o[0]=this.canvasVideoFrameBuffer,o})}updateVideoFramesPerFilterUpdate(o){o!==this.videoFramesPerFilterUpdate&&(this.videoFramesPerFilterUpdate=o,this.logger.info(`Adjusting filter rate to compensate for CPU utilization. Filter rate is ${this.videoFramesPerFilterUpdate} video frames per filter.`))}destroy(){var o,p,f,_;return m(this,void 0,void 0,function*(){this.destroyed=!0,this.delegate.removeObserver(this.cpuMonitor),this.canvasVideoFrameBuffer.destroy(),null==(o=this.worker)||o.postMessage({msg:"destroy"}),null==(p=this.worker)||p.postMessage({msg:"stop"}),null==(f=this.targetCanvas)||f.remove(),this.targetCanvas=void 0,null==(_=this.scaledCanvas)||_.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)})}};let x=class{constructor(o,p){this.monitoringPeriodMillis=o,this.observer=p,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){let o=Date.now();o-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.reduceCPUUtilization())}frameReceived(){let o=Date.now();o-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.increaseCPUUtilization())}};p.BackgroundFilterMonitor=x},0x217eb324b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x1e62759b2),I=f(0x1676280b0),k=_(f(0x18769c7b5)),M=_(f(0x9a4430b2)),x=_(f(0x22a0f7c69)),O="https://static.sdkassets.chime.aws",L={worker:`${O}/bgblur/workers/worker.js`,wasm:`${O}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${O}/bgblur/wasm/_cwt-wasm-simd.wasm`};p.default=class{static defaultAssetSpec(){let o=x.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}}static createUrlWithParams(o,p){let f=new URL(o);for(let o of Object.keys(p))void 0!==p[o]&&f.searchParams.set(o,p[o]);return f.toString()}static resolveSpec(o){let{paths:p=L,model:f=k.default.builder().withSelfieSegmentationDefaults().build(),assetGroup:m=this.defaultAssetSpec().assetGroup,revisionID:_=this.defaultAssetSpec().revisionID}=o||{},w={assetGroup:m,revisionID:_,sdk:encodeURIComponent(x.default.sdkVersion),ua:encodeURIComponent(x.default.sdkUserAgentLowResolution)};return p.worker=this.createUrlWithParams(p.worker,w),p.wasm=this.createUrlWithParams(p.wasm,w),p.simd=this.createUrlWithParams(p.simd,w),f.path=this.createUrlWithParams(f.path,w),{paths:p,model:f,assetGroup:m,revisionID:_}}static resolveOptions(o){return o.reportingPeriodMillis||(o.reportingPeriodMillis=1e3),o.filterCPUUtilization?(o.filterCPUUtilization<0||o.filterCPUUtilization>100)&&(o.logger.warn("filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of 30 percent"),o.filterCPUUtilization=30):o.filterCPUUtilization=30,o}static isSupported(o,p){let{logger:f}=p;return"u"<typeof globalThis?(f.info("Browser does not have globalThis."),Promise.resolve(!1)):new M.default().supportsBackgroundFilter()?I.supportsWASM(globalThis,f)?this.supportsBackgroundFilter(globalThis,o,f):(f.info("Browser does not support WASM."),Promise.resolve(!1)):(f.info("Browser is not supported."),Promise.resolve(!1))}static supportsBackgroundFilter(o=globalThis,p,f){return m(this,void 0,void 0,function*(){if(!I.supportsWorker(o,f))return f.info("Browser does not support web workers."),!1;let m=p.paths.worker;try{let o=yield w.loadWorker(m,"BackgroundFilterWorker",{},null);try{o.terminate()}catch(o){f.info(`Failed to terminate worker. ${o.message}`)}return!0}catch(o){return f.info(`Failed to fetch and instantiate test worker ${o.message}`),!1}})}}},0x1f9d952c4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}filterFrameDurationHigh(o){var p;for(let f of this.observers)null==(p=f.filterFrameDurationHigh)||p.call(f,o)}filterCPUUtilizationHigh(o){var p;for(let f of this.observers)null==(p=f.filterCPUUtilizationHigh)||p.call(f,o)}}},0x22c476071:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x190179907)),I=_(f(0xdfc1fc4a));p.default=class BackgroundReplacementFilter extends w.default{constructor(o,p){super("background replacement",o,p,new I.default),this.replacementBlob=p.imageBlob,this.logger.info("BackgroundReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: { filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}setImageBlob(o){return m(this,void 0,void 0,function*(){this.replacementBlob=o,this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl())})}initOnFirstExecution(){}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.drawImage(this.replacementImage,0,0,m.width,m.height),f.restore()}static loadImageExecutor(o,p,f){let m=new Image;m.crossOrigin="Anonymous",m.addEventListener("load",()=>{o(m)},!1),m.addEventListener("error",o=>{p(Error(`Could not load replacement image ${m.src}: ${o.message}`))},!1),m.src=f}static loadImage(o){return m(this,void 0,void 0,function*(){return new Promise((p,f)=>this.loadImageExecutor(p,f,o))})}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){let o=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return m(this,void 0,void 0,function*(){this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl()),o.loadAssets.call(this)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}destroy(){let o=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){o.destroy.call(this),this.revokeReplacementObjectUrl()})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){this.eventController.publishEvent("backgroundFilterConfigSelected",{backgroundBlurEnabled:"false",backgroundBlurStrength:"low",backgroundReplacementEnabled:"true",backgroundFilterVersion:1})}}},0x36f3f7d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x217eb324b)),I=_(f(0x12346a842)),k=_(f(0x19a5566fd)),M=_(f(0x84671e3f)),x=_(f(0x22c476071)),O=class extends M.default{loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}setImageBlob(){return m(this,void 0,void 0,function*(){})}};p.default=class BackgroundReplacementVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let{logger:f}=p;if(!(yield BackgroundReplacementVideoFrameProcessor.isSupported(o,p)))return f.warn("Using no-op processor because background replacement is not supported"),new O;f.info("Using background replacement filter");let m=new x.default(o,p);return yield m.loadAssets(),m})}static resolveOptions(o={}){let p=Object.assign({},o);return p.logger||(p.logger=new I.default("BackgroundReplacementProcessor",k.default.INFO)),super.resolveOptions(p)}static resolveOptionsAsync(o){return m(this,void 0,void 0,function*(){if(!o.imageBlob){let p=document.createElement("canvas");p.width=100,p.height=100;let f=p.getContext("2d");f.fillStyle="blue",f.fillRect(0,0,100,100),o.imageBlob=yield new Promise(o=>{p.toBlob(o)})}})}static isSupported(o,p){let f=Object.create(null,{isSupported:{get:()=>super.isSupported}});return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let m=p.imageBlob,_=URL.createObjectURL(m);try{yield x.default.loadImage(_)}catch(o){return p.logger.info(`Failed to fetch load replacement image ${o.message}`),!1}finally{URL.revokeObjectURL(_)}return f.isSupported.call(this,o,p)})}}},0xdfc1fc4a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f9d952c4));p.default=class extends _.default{}},0x14915840a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f,this.currentRetry=0,this.fixedWaitMs<0&&(this.fixedWaitMs=0),this.shortBackoffMs<0&&(this.shortBackoffMs=0),this.longBackoffMs<0&&(this.longBackoffMs=0),this.reset()}reset(){this.currentRetry=0}nextBackoffAmountMs(){let o=Math.random()*Math.min(this.longBackoffMs,this.shortBackoffMs*Math.pow(2,this.currentRetry))+this.fixedWaitMs;return this.currentRetry+=1,o}}},0x6e5ae8b8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14915840a)),w=m(f(0x1e2c96978));p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f}create(){return new _.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(o){return new w.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,o)}}},0x1e2c96978:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14915840a));p.default=class extends _.default{constructor(o,p,f,m){super(o,p,f),this.limit=m,this.attempts=0}nextBackoffAmountMs(){if(this.attempts++,this.attempts>this.limit)throw Error("retry limit exceeded");return super.nextBackoffAmountMs()}}},0x9a4430b2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x22e89c4d),w=f(0x2056040c6),I=class DefaultBrowserBehavior{constructor(){this.FALLBACK_BROWSER={type:"browser",name:"unknown",version:"unknown",os:"unknown"},this.browser=_.detect()||this.FALLBACK_BROWSER,this.uaParserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null,this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:13,safari:13,opera:66,samsung:12,crios:86,fxios:23,"ios-webview":605,"chromium-webview":92},this.browserName={chrome:"Google Chrome","edge-chromium":"Microsoft Edge",electron:"Electron",firefox:"Mozilla Firefox",ios:"Safari iOS",safari:"Safari",opera:"Opera",samsung:"Samsung Internet",crios:"Chrome iOS",fxios:"Firefox iOS","ios-webview":"WKWebView iOS","chromium-webview":"Chrome WebView"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios","ios-webview","edge-ios"]}version(){return this.browser.version}majorVersion(){return null!==this.version()?parseInt(this.version().split(".")[0]):-1}osMajorVersion(){return parseInt(this.uaParserResult.os.version.split(".")[0])}engine(){return this.uaParserResult.engine.name}engineMajorVersion(){return parseInt(this.uaParserResult.engine.version.split(".")[0])}name(){return this.browser.name}hasChromiumWebRTC(){for(let o of this.chromeLike)if(o===this.browser.name)return!0;return!1}hasWebKitWebRTC(){for(let o of this.webkitBrowsers)if(o===this.browser.name)return!0;return!1}hasFirefoxWebRTC(){return this.isFirefox()}requiresPlaybackLatencyHintForAudioContext(){return -1!==navigator.userAgent.indexOf("Windows")}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()&&!this.isIOSEdge()||this.isIOSSafari()&&this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK||this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK}supportsBackgroundFilter(){return("safari"!==this.name()||15!==this.majorVersion())&&!!this.supportsCanvasCapturedStreamPlayback()}supportsVideoLayersAllocationRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsDependencyDescriptorRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsScalableVideoCoding(){return this.hasChromiumWebRTC()&&"Blink"===this.engine()&&this.engineMajorVersion()>=111}supportsAudioRedundancy(){return this.hasChromiumWebRTC()?this.engineMajorVersion()>=107:!this.hasFirefoxWebRTC()}requiresResolutionAlignment(o,p){return this.isAndroid()&&this.isPixel3()?[64*Math.ceil(o/64),64*Math.ceil(p/64)]:[o,p]}requiresCheckForSdpConnectionAttributes(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresIceCandidateGatheringTimeoutWorkaround(){return this.hasChromiumWebRTC()}requiresBundlePolicy(){return"max-bundle"}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}doesNotSupportMediaDeviceLabels(){return"chromium-webview"===this.browser.name}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()<this.browserSupport[this.browser.name]||"firefox"===this.browser.name&&this.isAndroid())}isSimulcastSupported(){return this.hasChromiumWebRTC()}supportDownlinkBandwidthEstimation(){return!this.isFirefox()}supportString(){if(this.isAndroid())return`${this.browserName.chrome} ${this.browserSupport.chrome}+, ${this.browserName.samsung} ${this.browserSupport.samsung}+`;let o=[];for(let p in this.browserSupport)o.push(`${this.browserName[p]} ${this.browserSupport[p]}+`);return o.join(", ")}supportedVideoCodecs(){return m(this,void 0,void 0,function*(){let o=new RTCPeerConnection;return o.addTransceiver("video",{direction:"inactive",streams:[]}),(yield o.createOffer({offerToReceiveVideo:!0})).sdp.split(`\r
`).filter(o=>o.includes("a=rtpmap:")).map(o=>o.replace(/.* /,"").replace(/\/.*/,"")).filter((o,p,f)=>f.indexOf(o)===p).filter(o=>"rtx"!==o&&"red"!==o&&"ulpfec"!==o)})}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}disableResolutionScaleDown(){return this.isAndroid()}disable480pResolutionScaleDown(){return/( Chrome\/98\.)/i.test(navigator.userAgent)&&this.browser.os.startsWith("Windows")}requiresDisablingH264Encoding(){return this.isIOS()&&("15.1.0"===this.version()||/( OS 15_1)/i.test(navigator.userAgent))}requiresVideoPlayWorkaround(){return this.isSafari()}requiresAudioContextResetOnDeviceFailureForWebAudio(){return this.isIOS()}isVideoFxSupportedBrowser(){return this.supportsBackgroundFilter()}isIOSSafari(){return"ios"===this.browser.name||"ios-webview"===this.browser.name||"safari"===this.browser.name&&/( Mac )/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1}isSafari(){return"safari"===this.browser.name||this.isIOSSafari()}isFirefox(){return"firefox"===this.browser.name}isIOSFirefox(){return"fxios"===this.browser.name}isIOSChrome(){return"crios"===this.browser.name}isChrome(){return"chrome"===this.browser.name}isEdge(){return"edge-chromium"===this.browser.name}isIOSEdge(){return"edge-ios"===this.browser.name}isSamsungInternet(){return"samsung"===this.browser.name}isAndroid(){return/(android)/i.test(navigator.userAgent)}isPixel3(){return/( pixel 3)/i.test(navigator.userAgent)}isIOS(){return this.isIOSSafari()||this.isIOSChrome()||this.isIOSFirefox()}};p.default=I,I.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK=16,I.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK=106},0x176b792fb:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x252035ee7),w=m(f(0x243b8874c)),I=m(f(0xebe235e1)),k=m(f(0x1bb68f383));p.default=class ClientMetricReport{constructor(o,p,f){this.logger=o,this.videoStreamIndex=p,this.selfAttendeeId=f,this.globalMetricReport=new k.default,this.streamMetricReports={},this.rtcStatsReport={},this.customStatsReports=[],this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.overriddenObservableMetrics=new Map,this.identityValue=(o,p)=>Number((p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.decoderLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.concealedSamples-(f.previousMetrics.concealedSamples||0),_=f.currentMetrics.totalSamplesReceived-(f.previousMetrics.totalSamplesReceived||0);return _<=0||_-m<=0?0:m/_*100},this.packetLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics[o]-(f.previousMetrics[o]||0),_=f.currentMetrics.packetsLost-(f.previousMetrics.packetsLost||0),w=m+_;return w<=0||_<=0?0:100*_/w},this.jitterBufferMs=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.jitterBufferDelay-(f.previousMetrics.jitterBufferDelay||0),_=f.currentMetrics.jitterBufferEmittedCount-(f.previousMetrics.jitterBufferEmittedCount||0);return m<=0||_<=0?0:m/_*1e3},this.countPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:Math.trunc(_/m)},this.bitsPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=(f.currentMetrics[o]-(f.previousMetrics[o]||0))*8;return _<=0?0:Math.trunc(_/m)},this.secondsToMilliseconds=(o,p)=>Number(1e3*(p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.averageTimeSpentPerSecondInMilliseconds=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:1e3*_/m},this.averageCpuQualityLimitationDurationPerSecondInMilliseconds=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.previousObjectMetrics[o]||void 0===f.currentObjectMetrics[o])return NaN;let m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=0,w=0;for(let[p,m]of Object.entries(f.previousObjectMetrics[o]))"cpu"===p&&(_=m);for(let[p,m]of Object.entries(f.currentObjectMetrics[o]))"cpu"===p&&(w=m);let I=w-_;return I<=0?0:1e3*I/m},this.isHardwareImplementation=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.currentStringMetrics[o])return NaN;let m=String(f.currentStringMetrics[o]),_=m.includes("ExternalDecoder")||m.includes("ExternalEncoder")||m.includes("EncodeAccelerator")||m.includes("DecodeAccelerator"),w=m.includes("fallback from");return _&&!w?1:0},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:_.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.STUN_RTT_MS},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_MIC_AUDIO_LEVEL,source:"audioLevel"}},this.audioUpstreamMetricMap={jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_MIC_BITRATE},roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_MIC_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"}},this.audioDownstreamMetricMap={concealedSamples:{transform:this.countPerSecond},totalSamplesReceived:{transform:this.countPerSecond},decoderLoss:{transform:this.decoderLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_SPK_BITRATE},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_AUDIO_LEVEL},totalAudioPacketsLost:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_LOST},totalAudioPacketsExpected:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_EXPECTED},totalAudioPacketsRecoveredRed:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_RED},totalAudioPacketsRecoveredFec:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_FEC}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_ENCODE_FPS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_BITRATE},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_JITTER_MS},totalEncodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_ENCODE_MS},encoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE},qualityLimitationDurations:{transform:this.averageCpuQualityLimitationDurationPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_QUALITY_LIMITATION_DURATION_CPU},videoCodecDegradationHighEncodeCpu:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU},videoCodecDegradationEncodeFailure:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE},videoInputWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_WIDTH},videoInputHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_HEIGHT}},this.videoDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},framesReceived:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_WIDTH},totalDecodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_DECODE_MS},decoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE},totalFreezesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_FREEZE_DURATION},freezeCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FREEZE_COUNT},totalPausesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_PAUSE_DURATION},pauseCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PAUSE_COUNT},framesDropped:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DROPPED_FPS},videoRenderWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_WIDTH},videoRenderHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_HEIGHT}},this.streamDimensionMap={encoderImplementation:_.SdkStreamDimension.Type.VIDEO_ENCODER_NAME,decoderImplementation:_.SdkStreamDimension.Type.VIDEO_DECODER_NAME},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesInputPerSecond:{source:"framesPerSecond",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamEncoderImplementation:{source:"encoderImplementation",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamTotalEncodeTimePerSecond:{source:"totalEncodeTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamCpuQualityLimitationDurationPerSecond:{source:"qualityLimitationDurations",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:I.default.VIDEO,dir:w.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.AUDIO,dir:w.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:I.default.VIDEO,dir:w.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"},audioDownstreamLevel:{source:"audioLevel",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamLevel:{source:"audioLevel"}}}getMetricMap(o,p){switch(o){case I.default.AUDIO:switch(p){case w.default.UPSTREAM:return this.audioUpstreamMetricMap;case w.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case I.default.VIDEO:switch(p){case w.default.UPSTREAM:return this.videoUpstreamMetricMap;case w.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getStreamDimensionMap(){return this.streamDimensionMap}getObservableMetricValue(o){if(this.overriddenObservableMetrics.has(o))return this.overriddenObservableMetrics.get(o);let p=this.observableMetricSpec[o],{transform:f,source:m}=this.getMetricMap(p.media,p.dir)[p.source];if(!p.hasOwnProperty("media"))return f(m||p.source);for(let o in this.streamMetricReports){let _=this.streamMetricReports[o];if(_.direction===p.dir&&_.mediaType===p.media)return f(m||p.source,Number(o))}return 0}getObservableVideoMetricValue(o,p){let f=this.observableVideoMetricSpec[o],{transform:m,source:_}=this.getMetricMap(f.media,f.dir)[f.source];return m(_||f.source,p)}getVideoUpstreamSsrcs(){let o=[];for(let p in this.streamMetricReports)this.streamMetricReports[p].mediaType===I.default.VIDEO&&this.streamMetricReports[p].direction===w.default.UPSTREAM&&o.push(Number(p));return o}getObservableMetrics(){let o={};for(let p in this.observableMetricSpec)o[p]=this.getObservableMetricValue(p);return o}getObservableVideoMetrics(){let o={};if(!this.videoStreamIndex||!this.selfAttendeeId)return this.logger.error("Need to define VideoStreamIndex and selfAttendeeId if using getObservableVideoMetrics API"),o;for(let p in this.streamMetricReports)if(this.streamMetricReports[p].mediaType===I.default.VIDEO){let f={};for(let o in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[o].dir===this.streamMetricReports[p].direction){let m=this.getObservableVideoMetricValue(o,Number(p));isNaN(m)||(f[o]=m)}let m=this.streamMetricReports[p].groupId,_=this.streamMetricReports[p].streamId,w="";o[w=void 0!==this.videoStreamIndex.attendeeIdForGroupId?m?this.videoStreamIndex.attendeeIdForGroupId(m):this.selfAttendeeId:_?this.videoStreamIndex.attendeeIdForStreamId(_):this.selfAttendeeId]=o[w]?o[w]:{},o[w][p]=f}return o}getRTCStatsReport(){return this.rtcStatsReport}clone(){let o=new ClientMetricReport(this.logger,this.videoStreamIndex,this.selfAttendeeId);return o.globalMetricReport=this.globalMetricReport,o.streamMetricReports=this.streamMetricReports,o.rtcStatsReport=this.rtcStatsReport,o.customStatsReports=this.customStatsReports,o.currentTimestampMs=this.currentTimestampMs,o.previousTimestampMs=this.previousTimestampMs,o.overriddenObservableMetrics=this.overriddenObservableMetrics,o}print(){let o={globalMetricReport:this.globalMetricReport,streamMetricReports:this.streamMetricReports,currentTimestampMs:this.currentTimestampMs,previousTimestampMs:this.previousTimestampMs};this.logger.debug(()=>`Client Metric Report: ${JSON.stringify(o)}`)}removeDestroyedSsrcs(){for(let o in this.streamMetricReports)this.currentSsrcs[o]||delete this.streamMetricReports[o]}overrideObservableMetric(o,p){this.overriddenObservableMetrics.set(o,p)}}},0x243b8874c:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportDirection=void 0,(m=f=p.ClientMetricReportDirection||(p.ClientMetricReportDirection={}))[m.UPSTREAM=0]="UPSTREAM",m[m.DOWNSTREAM=1]="DOWNSTREAM",p.default=f},0xebe235e1:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportMediaType=void 0,(m=f=p.ClientMetricReportMediaType||(p.ClientMetricReportMediaType={}))[m.AUDIO=0]="AUDIO",m[m.VIDEO=1]="VIDEO",p.default=f},0x1ef8cd3d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x1bb68f383:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0x15a1c7c16:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.currentTimestampMs=0,this.ssrc=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsExpected=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}}},0x49c5e00:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0x21ae4c990:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.minHealth=o.minHealth,this.maxHealth=o.maxHealth,this.currentHealth=o.initialHealth,this.currentData=p.clone(),this.name=f}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(o){this.currentData=o}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){let o=this.health();return o!==this.currentHealth?(this.currentHealth=o,o):null}}},0x18c985af:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ConnectionHealthData{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(o,p){return Date.now()<o+p}setConnectionStartTime(){this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}reset(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now(),this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0}isConnectionStartRecent(o){return ConnectionHealthData.isTimestampRecent(this.connectionStartTimestampMs,o)}isLastPacketLossRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastPacketLossInboundTimestampMs,o)}isGoodSignalRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastGoodSignalTimestampMs,o)}isWeakSignalRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastWeakSignalTimestampMs,o)}isNoSignalRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastNoSignalTimestampMs,o)}clone(){let o=new ConnectionHealthData;return o.connectionStartTimestampMs=this.connectionStartTimestampMs,o.consecutiveStatsWithNoPackets=this.consecutiveStatsWithNoPackets,o.consecutiveStatsWithNoAudioPacketsSent=this.consecutiveStatsWithNoAudioPacketsSent,o.lastPacketLossInboundTimestampMs=this.lastPacketLossInboundTimestampMs,o.lastGoodSignalTimestampMs=this.lastGoodSignalTimestampMs,o.lastWeakSignalTimestampMs=this.lastWeakSignalTimestampMs,o.lastNoSignalTimestampMs=this.lastNoSignalTimestampMs,o.consecutiveMissedPongs=this.consecutiveMissedPongs,o.packetsReceivedInLastMinute=this.packetsReceivedInLastMinute.slice(0),o.fractionPacketsLostInboundInLastMinute=this.fractionPacketsLostInboundInLastMinute.slice(0),o.audioSpeakerDelayMs=this.audioSpeakerDelayMs,o.isVideoEncoderHardware=this.isVideoEncoderHardware,o.videoEncodingTimeInMs=this.videoEncodingTimeInMs,o.videoEncodingTimePerFrameInMs=this.videoEncodingTimePerFrameInMs,o.cpuLimitationDuration=this.cpuLimitationDuration,o.videoInputFps=this.videoInputFps,o.videoEncodeFps=this.videoEncodeFps,o.isContentShare=this.isContentShare,o.numberOfPublishedVideoSources=this.numberOfPublishedVideoSources,o}setConsecutiveMissedPongs(o){this.consecutiveMissedPongs=o}setConsecutiveStatsWithNoPackets(o){this.consecutiveStatsWithNoPackets=o}setConsecutiveStatsWithNoAudioPacketsSent(o){this.consecutiveStatsWithNoAudioPacketsSent=o}setLastPacketLossInboundTimestampMs(o){this.lastPacketLossInboundTimestampMs=o}setLastNoSignalTimestampMs(o){this.lastNoSignalTimestampMs=o}setLastWeakSignalTimestampMs(o){this.lastWeakSignalTimestampMs=o}setLastGoodSignalTimestampMs(o){this.lastGoodSignalTimestampMs=o}setAudioSpeakerDelayMs(o){this.audioSpeakerDelayMs=o}setIsVideoEncoderHardware(o){this.isVideoEncoderHardware=o}setVideoEncodingTimeInMs(o){this.videoEncodingTimeInMs=o}setVideoEncodingTimePerFrameInMs(o){this.videoEncodingTimePerFrameInMs=o}setCpuLimitationDuration(o){this.cpuLimitationDuration=o}setVideoInputFps(o){this.videoInputFps=o}setVideoEncodeFps(o){this.videoEncodeFps=o}setIsContentShare(o){this.isContentShare=o}setNumberOfPublishedVideoSources(o){this.numberOfPublishedVideoSources=o}}},0x1c17b91f1:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x201f8c5d2)),w=m(f(0x1819749c9)),I=m(f(0x2e16c318));p.default=class{constructor(){this.minHealth=0,this.maxHealth=1,this.initialHealth=1,this.connectionUnhealthyThreshold=25,this.noSignalThresholdTimeMs=1e4,this.connectionWaitTimeMs=1e4,this.zeroBarsNoSignalTimeMs=5e3,this.oneBarWeakSignalTimeMs=5e3,this.twoBarsTimeMs=5e3,this.threeBarsTimeMs=1e4,this.fourBarsTimeMs=2e4,this.fiveBarsTimeMs=6e4,this.cooldownTimeMs=6e4,this.pastSamplesToConsider=15,this.goodSignalTimeMs=15e3,this.fractionalLoss=.5,this.packetsExpected=50,this.maximumTimesToWarn=2,this.missedPongsLowerThreshold=1,this.missedPongsUpperThreshold=4,this.maximumAudioDelayMs=6e4,this.maximumAudioDelayDataPoints=10,this.sendingAudioFailureSamplesToConsider=2,this.sendingAudioFailureInitialWaitTimeMs=3e3,this.videoEncodingHealthPolicies=[_.default,w.default,I.default],this.consecutiveHighEncodeCpuThreshold=10,this.highEncodeCpuMsThreshold=500,this.highEncodeCpuMsPerFrameThreshold=15,this.consecutiveVideoEncodingFailureThreshold=5,this.concurrentVideoSendersThreshold=15}}},0x61021f0c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990));p.default=class ReconnectionHealthPolicy extends _.default{constructor(o,p,f){super(p,f,"Reconnection Health"),this.logger=o,this.audioDelayPointsOverMaximum=0,ReconnectionHealthPolicy.CONNECTION_UNHEALTHY_THRESHOLD=p.connectionUnhealthyThreshold,ReconnectionHealthPolicy.CONNECTION_WAIT_TIME_MS=p.connectionWaitTimeMs,ReconnectionHealthPolicy.MISSED_PONGS_THRESHOLD=p.missedPongsUpperThreshold,ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_MS=p.maximumAudioDelayMs,ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_DATA_POINTS=p.maximumAudioDelayDataPoints}health(){if(this.currentData.isConnectionStartRecent(ReconnectionHealthPolicy.CONNECTION_WAIT_TIME_MS))return 1;let o=this.currentData.consecutiveStatsWithNoPackets>=ReconnectionHealthPolicy.CONNECTION_UNHEALTHY_THRESHOLD,p=this.currentData.consecutiveMissedPongs>=ReconnectionHealthPolicy.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;let f=this.audioDelayPointsOverMaximum>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return(f&&(this.audioDelayPointsOverMaximum=0),o||p||f)?(this.logger.warn(`reconnection recommended due to: no packets received: ${o}, missed pongs: ${p}, bad audio delay: ${f}`),0):1}}},0x20ae9efa5:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990));p.default=class extends _.default{constructor(o,p,f){super(p,f,"Sending Audio Health"),this.logger=o,this.sendingAudioFailureSamplesToConsider=p.sendingAudioFailureSamplesToConsider>0?p.sendingAudioFailureSamplesToConsider:1,this.sendingAudioFailureInitialWaitTimeMs=p.sendingAudioFailureInitialWaitTimeMs,this.maximumTimesToWarn=p.maximumTimesToWarn,this.coolDownTimeMs=p.cooldownTimeMs,this.lastWarnTimestampMs=0,this.warnCount=0}isSendingAudioUnhealthy(){let o=!this.currentData.isConnectionStartRecent(this.sendingAudioFailureInitialWaitTimeMs),p=this.currentData.consecutiveStatsWithNoAudioPacketsSent>=this.sendingAudioFailureSamplesToConsider;return o&&p}health(){if(this.isSendingAudioUnhealthy()){let o=Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs;return!(this.currentHealth>this.minimumHealth())||o?this.currentHealth:(this.logger.warn(`Sending Audio is unhealthy for ${this.sendingAudioFailureSamplesToConsider} seconds consecutively.`),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?(this.logger.warn("SendingAudioFailure health policy maximum warnings breached. Falling back to reporting healthy."),this.maximumHealth()):(this.lastWarnTimestampMs=Date.now(),this.minimumHealth())}return this.maximumHealth()}}},0x1c6788b50:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990));p.default=class extends _.default{constructor(o,p){super(o,p,"Unusable Audio Warning"),this.coolDownTimeMs=o.cooldownTimeMs,this.pastSamplesToConsider=o.pastSamplesToConsider,this.fractionalLoss=o.fractionalLoss,this.packetsExpected=o.packetsExpected,this.maximumTimesToWarn=o.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length<this.pastSamplesToConsider)return 0;let o=this.pastSamplesToConsider,p=o*this.packetsExpected,f=0;for(let p=0;p<o;p++)f+=this.currentData.packetsReceivedInLastMinute[p];return Math.min(Math.max(1-f/p,0),1)}health(){if(Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs)return this.currentHealth;if(this.calculateFractionalLoss()>=this.fractionalLoss)return 1*(0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,!!(this.warnCount>this.maximumTimesToWarn)));return 1}}},0x201f8c5d2:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990)),w=m(f(0x17469a88e));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoConcurrentSendersHealth),this.concurrentVideoSendersThreshold=o.concurrentVideoSendersThreshold}health(){return this.currentData.isContentShare?this.maximumHealth():this.currentData.numberOfPublishedVideoSources>this.concurrentVideoSendersThreshold?this.minimumHealth():this.maximumHealth()}}},0x17469a88e:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoEncodingConnectionHealthPolicyName=void 0,(m=f=p.VideoEncodingConnectionHealthPolicyName||(p.VideoEncodingConnectionHealthPolicyName={})).VideoEncodingCpuHealth="Video Encoding CPU Health",m.VideoEncodingFramerateHealth="Video Encoding framerate Health",m.VideoConcurrentSendersHealth="Video Concurrent Senders Health",p.default=f},0x1819749c9:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990)),w=m(f(0x17469a88e));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingCpuHealth),this.consecutiveHighEncodeCpuCnt=0,this.consecutiveHighEncodeCpuThreshold=o.consecutiveHighEncodeCpuThreshold,this.highEncodeCpuMsThreshold=o.highEncodeCpuMsThreshold,this.highEncodeCpuMsPerFrameThreshold=o.highEncodeCpuMsPerFrameThreshold}health(){let o=this.currentData.videoEncodingTimeInMs>=this.highEncodeCpuMsThreshold&&this.currentData.videoEncodingTimePerFrameInMs>=this.highEncodeCpuMsPerFrameThreshold;if(!this.currentData.isVideoEncoderHardware&&(o||this.currentData.cpuLimitationDuration>0)){if(this.consecutiveHighEncodeCpuCnt++,this.consecutiveHighEncodeCpuCnt>this.consecutiveHighEncodeCpuThreshold)return this.consecutiveHighEncodeCpuCnt=0,this.minimumHealth()}else this.consecutiveHighEncodeCpuCnt=0;return this.maximumHealth()}}},0x2e16c318:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990)),w=m(f(0x17469a88e));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingFramerateHealth),this.consecutiveEncodeFailureCnt=0,this.consecutiveVideoEncodingFailureThreshold=o.consecutiveVideoEncodingFailureThreshold}health(){if(0===this.currentData.videoEncodeFps&&this.currentData.videoInputFps>0){if(this.consecutiveEncodeFailureCnt++,this.consecutiveEncodeFailureCnt>this.consecutiveVideoEncodingFailureThreshold)return this.consecutiveEncodeFailureCnt=0,this.minimumHealth()}else this.consecutiveEncodeFailureCnt=0;return this.maximumHealth()}}},0x202eb6fd7:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xab1ef933);p.default=class{constructor(o,p,f,m,_){this.audioVideoController=o,this.realtimeController=p,this.connectionHealthData=f,this.pingPong=m,this.statsCollector=_,this.isActive=!1,this.hasSeenValidCandidatePairMetricsBefore=!1,this.lastTotalBytesReceived=0,this.lastTotalStunMessagesReceived=0,this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o=>{this.isActive&&this.receiveSignalStrengthChange(o)})}start(){this.isActive=!0,this.pingPong.addObserver(this),this.pingPong.start(),this.audioVideoController.addObserver(this)}stop(){this.isActive=!1,this.pingPong.removeObserver(this),this.pingPong.stop(),this.audioVideoController.removeObserver(this)}receiveSignalStrengthChange(o){0===o?this.connectionHealthData.setLastNoSignalTimestampMs(Date.now()):o<=.5?this.connectionHealthData.setLastWeakSignalTimestampMs(Date.now()):this.connectionHealthData.setLastGoodSignalTimestampMs(Date.now()),this.updateConnectionHealth()}didReceivePong(o,p,f){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",p),this.statsCollector.logLatency("ping_pong_clock_skew",f),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(o){let p=0,f=0,m=o.getObservableMetrics(),_=m.audioPacketsReceived,w=m.audioPacketsReceivedFractionLoss,I=m.audioSpeakerDelayMs;"number"!=typeof I||isNaN(I)||this.connectionHealthData.setAudioSpeakerDelayMs(I);let k=o.getRTCStatsReport(),M=0,x=0;k.forEach(o=>{"candidate-pair"===o.type&&(o.bytesReceived&&(M+=o.bytesReceived),o.requestsReceived&&(x+=o.requestsReceived),o.responsesReceived&&(x+=o.responsesReceived))});let O=M-this.lastTotalBytesReceived;this.lastTotalBytesReceived=M;let L=x-this.lastTotalStunMessagesReceived;this.lastTotalStunMessagesReceived=x,"number"!=typeof _||"number"!=typeof w||(p=_,f=w,p<0||f<0||O<0||L<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,p),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,f),O>0||L>0?(this.hasSeenValidCandidatePairMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidCandidatePairMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===p||f>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),"number"==typeof m.audioPacketsSent&&this.updateAudioPacketsSentInConnectionHealth(m.audioPacketsSent),this.updateVideoEncodingHealth(o),this.updateConnectionHealth()))}updateAudioPacketsSentInConnectionHealth(o){o>0?this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(0):this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(this.connectionHealthData.consecutiveStatsWithNoAudioPacketsSent+1)}updateVideoEncodingHealth(o){let p=this.audioVideoController.videoTileController.hasStartedLocalVideoTile(),f=o.getVideoUpstreamSsrcs();if(!p||0===f.length){this.connectionHealthData.setIsVideoEncoderHardware(!1),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(0),this.connectionHealthData.setCpuLimitationDuration(0),this.connectionHealthData.setVideoInputFps(0),this.connectionHealthData.setVideoEncodeFps(0);return}let m=!1,_=0,w=0,I=0,k=0;for(let p of f)m||(m=!!o.getObservableVideoMetricValue("videoUpstreamEncoderImplementation",p)),_+=o.getObservableVideoMetricValue("videoUpstreamTotalEncodeTimePerSecond",p),w+=o.getObservableVideoMetricValue("videoUpstreamCpuQualityLimitationDurationPerSecond",p),I+=o.getObservableVideoMetricValue("videoUpstreamFramesInputPerSecond",p),k+=o.getObservableVideoMetricValue("videoUpstreamFramesEncodedPerSecond",p);let M=k>0?_/k:0;this.connectionHealthData.setIsVideoEncoderHardware(!!m),this.connectionHealthData.setVideoEncodingTimeInMs(_),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(M),this.connectionHealthData.setCpuLimitationDuration(w),this.connectionHealthData.setVideoInputFps(I),this.connectionHealthData.setVideoEncodeFps(k)}addToMinuteWindow(o,p){o.unshift(p),o.length>60&&o.pop()}updateConnectionHealth(){this.audioVideoController.forEachObserver(o=>{m.Maybe.of(o.connectionHealthDidChange).map(p=>p.bind(o)(this.connectionHealthData.clone()))})}}},0x86facdd2:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Modality="#content",p.default=f},0x748652da:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x1db5b830a)),k=class ContentShareMediaStreamBroker{constructor(o){this.logger=o}get mediaStream(){return this._mediaStream}set mediaStream(o){this._mediaStream=o}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return 0===this._mediaStream.getAudioTracks().length?(this.logger.info("No audio stream available. Synthesizing an audio stream."),I.default.synthesizeAudioDevice(0)):this._mediaStream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){return this._mediaStream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){return o&&o.video&&o.video.mandatory&&o.video.mandatory.chromeMediaSource&&o.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(o):navigator.mediaDevices.getDisplayMedia(o)})}acquireScreenCaptureDisplayInputStream(o,p){return m(this,void 0,void 0,function*(){return this.acquireDisplayInputStream(this.screenCaptureDisplayMediaConstraints(o,p))})}screenCaptureDisplayMediaConstraints(o,p){return{audio:!!(!o&&new w.default().getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!o&&{frameRate:{max:p||ContentShareMediaStreamBroker.defaultFrameRate}}),o&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:o,maxFrameRate:p||ContentShareMediaStreamBroker.defaultFrameRate}})}}toggleMediaStream(o){let p=!1;if(this.mediaStream)for(let f=0;f<this.mediaStream.getTracks().length;f++)this.mediaStream.getTracks()[f].enabled!==o&&(this.mediaStream.getTracks()[f].enabled=o,p=!0);return p}cleanup(){if(this.mediaStream)for(let o=0;o<this.mediaStream.getTracks().length;o++)this.mediaStream.getTracks()[o].stop();this.mediaStream=null}muteLocalAudioInputStream(){throw Error("unsupported")}unmuteLocalAudioInputStream(){throw Error("unsupported")}addMediaStreamBrokerObserver(o){}removeMediaStreamBrokerObserver(o){}};p.default=k,k.defaultFrameRate=15},0x1d8dd5b36:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x170a3ef32)),I=_(f(0x18e1c570f)),k=_(f(0x614ebca7)),M=_(f(0x230534cc6)),x=_(f(0x1158c4d3)),O=f(0xab1ef933),L=_(f(0x2c8ecde)),B=_(f(0x13892dc9a)),U=_(f(0x86facdd2));p.default=class{constructor(o,p,f){this.mediaStreamBroker=o,this.contentAudioVideo=p,this.attendeeAudioVideo=f,this.observerQueue=new Set,this.destroyed=!1,this.contentAudioVideo.addObserver(this),this.setupContentShareEvents()}static createContentShareMeetingSessionConfigure(o){let p=new I.default;return p.meetingId=o.meetingId,p.externalMeetingId=o.externalMeetingId,p.urls=o.urls,p.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender,p.credentials=new k.default,p.credentials.attendeeId=o.credentials.attendeeId+U.default.Modality,p.credentials.externalUserId=o.credentials.externalUserId,p.credentials.joinToken=o.credentials.joinToken+U.default.Modality,p.meetingFeatures=o.meetingFeatures.clone(),p.videoDownlinkBandwidthPolicy=new L.default,p}setContentAudioProfile(o){this.contentAudioVideo.setAudioProfile(o)}enableSimulcastForContentShare(o,p){o?(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=new B.default(this.contentAudioVideo.logger,p)):(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=void 0)}enableSVCForContentShare(o){o?this.contentAudioVideo.configuration.enableSVC=!0:this.contentAudioVideo.configuration.enableSVC=!1}startContentShare(o){return m(this,void 0,void 0,function*(){if(o){if(this.contentAudioVideo.configuration.meetingFeatures.contentMaxResolution===w.default.VideoDisabled)return void this.contentAudioVideo.logger.info("Could not start content because max content resolution was set to None");this.mediaStreamBroker.mediaStream=o;for(let o=0;o<this.mediaStreamBroker.mediaStream.getTracks().length;o++)this.mediaStreamBroker.mediaStream.getTracks()[o].addEventListener("ended",()=>{this.stopContentShare()});this.contentAudioVideo.start()}})}startContentShareFromScreenCapture(o,p){return m(this,void 0,void 0,function*(){let f=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(o,p);return yield this.startContentShare(f),f})}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidPause).map(p=>p.call(o))})}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidUnpause).map(p=>p.call(o))})}setContentShareVideoCodecPreferences(o){this.contentAudioVideo.setVideoCodecSendPreferences(o)}destroy(){return m(this,void 0,void 0,function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)})}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(o){this.observerQueue.add(o)}removeContentShareObserver(o){this.observerQueue.delete(o)}forEachContentShareObserver(o){for(let p of this.observerQueue)x.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}audioVideoDidStart(){var o;(null==(o=this.mediaStreamBroker.mediaStream)?void 0:o.getVideoTracks().length)>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(o){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStop).map(p=>p.call(o))})}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence((o,p,f,m)=>{let _=new M.default(o).hasModality(M.default.MODALITY_CONTENT),w=new M.default(o).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!_||!w||!p||this.contentShareTile)return;let I=this.mediaStreamBroker.mediaStream;if(null==I?void 0:I.getVideoTracks().length){let o,p;this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();let f=I.getVideoTracks()[0];if(f.getSettings){let m=f.getSettings();o=m.width,p=m.height}else{let m=f.getCapabilities();o=m.width,p=m.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,I,o,p,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStart).map(p=>p.call(o))})})}}},0x13dedab0d:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=class CSPMonitor{static register(){"document"in f.g&&document.addEventListener&&CSPMonitor.shouldRegisterCSPMonitor&&!CSPMonitor.added&&(document.addEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.added=!0)}static unregister(){"document"in f.g&&document.removeEventListener&&(document.removeEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.loggers=new Set,CSPMonitor.added=!1)}static disable(){CSPMonitor.shouldRegisterCSPMonitor=!1,CSPMonitor.unregister()}static addLogger(o){o&&CSPMonitor.loggers.add(o)}static removeLogger(o){o&&CSPMonitor.loggers.delete(o)}};p.default=m,m.loggers=new Set,m.shouldRegisterCSPMonitor=!0,m.added=!1,m.listener=o=>{let p=`Security Policy Violation
Blocked URI: ${o.blockedURI}
Violated Directive: ${o.violatedDirective}
Original Policy: ${o.originalPolicy}
Document URI: ${o.documentURI}
Source File: ${o.sourceFile}
Line No.: ${o.lineNumber}
`;for(let o of m.loggers)o.error(p);0===m.loggers.size&&console.error(p)}},0x200be574b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w){this.timestampMs=o,this.topic=p,this.data=f,this.senderAttendeeId=m,this.senderExternalUserId=_,this.throttled=!!w}text(){return new TextDecoder().decode(this.data)}json(){return JSON.parse(new TextDecoder().decode(this.data))}}},0x24b1dc2b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isDestroyable=void 0,p.isDestroyable=function(o){return o&&"destroy"in o}},0x25cf5513:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isAudioTransformDevice=void 0,p.isAudioTransformDevice=function(o){return!!o&&"object"==typeof o&&"mute"in o&&"stop"in o&&"intrinsicDevice"in o}},0x1db5b830a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0xe13d341e)),k=_(f(0x1158c4d3)),M=_(f(0x172e1bd2a)),x=f(0xab1ef933),O=_(f(0xd9718ba1)),L=_(f(0xb747ec80)),B=f(0x25cf5513),U=_(f(0x105f3de65)),$=_(f(0x19b2d97e8)),q=_(f(0x4d06f54a)),Z=_(f(0x15ea31aea)),ee=_(f(0x747ce3f3)),et=_(f(0x1d643307b)),ei=_(f(0xdb2548f7)),er=_(f(0x170a3ef32)),en=f(0x1a86248d4),eo=class DefaultDeviceController{constructor(o,p,f=new w.default,m){this.logger=o,this.browserBehavior=f,this.eventController=m,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=void 0,this.deviceChangeObservers=new Set,this.mediaStreamBrokerObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.useMediaConstraintsFallback=!0,this.audioInputTaskQueue=new M.default,this.videoInputTaskQueue=new M.default,this.muted=!1,this.mediaStreamMuteObserver=(o,p)=>{for(let f of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(f)&&f.audioInputMuteStateChanged&&f.audioInputMuteStateChanged(o,p)})},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:_=!1,useMediaConstraintsFallback:x=!0}=p||{};this.useWebAudio=_,this.useMediaConstraintsFallback=x,this.videoInputQualitySettings=new er.default(DefaultDeviceController.defaultVideoWidth,DefaultDeviceController.defaultVideoHeight,DefaultDeviceController.defaultVideoFrameRate);const O=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=O[0],this.videoInputQualitySettings.videoHeight=O[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=new I.default().create();const o=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(o)}`)}catch(p){o.error(p.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>{this.logger.info("Device change event callback is triggered"),this.handleDeviceChange()},null==(o=this.mediaDeviceWrapper)||o.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),null==(o=this.mediaDeviceWrapper)||o.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){return!!this.deviceChangeObservers.size||this.activeDevices.audio&&null!==this.activeDevices.audio.constraints||this.activeDevices.video&&null!==this.activeDevices.video.constraints||!!this.audioOutputDeviceId}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){return m(this,void 0,void 0,function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()})}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audioinput",o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("videoinput",o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audiooutput",o);return this.trace("listAudioOutputDevices",o,p),p})}pushAudioMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"videoInputUnselected":"videoInputSelected")}startAudioInput(o){return m(this,void 0,void 0,function*(){return yield this.audioInputTaskQueue.add(()=>this.startAudioInputTask(o))})}startAudioInputTask(o){var p;return m(this,void 0,void 0,function*(){if(void 0===o)return void this.logger.error("Audio input device cannot be undefined");try{if(B.isAudioTransformDevice(o)?(this.logger.info(`Choosing transform input device ${o}`),yield this.chooseAudioTransformInputDevice(o)):(this.logger.info(`Choosing intrinsic audio input device ${o}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",o)),this.trace("startAudioInputDevice",o,"success"),this.useWebAudio)return this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield null==(p=this.transform)?void 0:p.device.mute(this.muted),this.getMediaStreamDestinationNode().stream;return this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream}catch(o){throw o}})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.audioInputTaskQueue.add(()=>this.stopAudioInputTask())})}stopAudioInputTask(){return m(this,void 0,void 0,function*(){try{if(this.useWebAudio)return void this.releaseAudioTransformStream();this.stopTracksAndRemoveCallbacks("audio")}finally{this.watchForDeviceChangesIfNecessary(),this.publishAudioInputDidChangeEvent(void 0)}})}chooseAudioTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){let f;if((null==(p=this.transform)?void 0:p.device)===o)return;if(!this.useWebAudio)throw Error("Cannot apply transform device without enabling Web Audio.");let m=DefaultDeviceController.getAudioContext();if(m instanceof OfflineAudioContext);else switch(m.state){case"running":break;case"closed":throw Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield m.resume()}try{f=yield o.createAudioNode(m)}catch(o){throw this.logger.error(`Unable to create transform device node: ${o}.`),o}let _=yield o.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",_),this.logger.debug(`Got inner stream: ${_}.`),this.setTransform(o,f)})}chooseVideoTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){if(this.eventController&&o instanceof O.default&&o.passEventControllerToProcessors(this.eventController),o===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");let f=this.chosenVideoTransformDevice;f&&this.logger.info("Switched from previous VideoTransformDevice");let m=!!f,_=yield o.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null==(p=this.activeDevices.video)?void 0:p.stream,_)){this.logger.info("video transform device needs new intrinsic device"),m&&f.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=o,this.activeDevices.video=null,yield this.chooseInputIntrinsicDevice("video",_),this.logger.info("apply processors to transform"),yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream);return}this.chosenVideoTransformDevice=o,this.logger.info("video transform device uses previous stream"),this.logger.info("apply processors to transform"),yield o.transformStream(this.activeDevices.video.stream)})}startVideoInput(o){return m(this,void 0,void 0,function*(){return yield this.videoInputTaskQueue.add(()=>this.startVideoInputTask(o))})}startVideoInputTask(o){return m(this,void 0,void 0,function*(){if(!o)return void this.logger.error("Invalid video input device");try{if(en.isVideoTransformDevice(o))return this.logger.info(`Choosing video transform device ${o}`),yield this.chooseVideoTransformInputDevice(o),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream;return this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",o),this.trace("startVideoInputDevice",o),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream}catch(o){throw o}})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.videoInputTaskQueue.add(()=>this.stopVideoInputTask())})}stopVideoInputTask(){return m(this,void 0,void 0,function*(){try{if(this.chosenVideoInputIsTransformDevice())return void this.releaseVideoTransformStream();this.stopTracksAndRemoveCallbacks("video")}finally{this.watchForDeviceChangesIfNecessary(),this.publishVideoInputDidChangeEvent(void 0)}})}chooseAudioOutput(o){return m(this,void 0,void 0,function*(){this.audioOutputDeviceId=o,this.watchForDeviceChangesIfNecessary();let p=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);this.publishAudioOutputDidChangeEvent(p),this.trace("chooseAudioOutput",o,null)})}addDeviceChangeObserver(o){this.logger.info("adding device change observer"),this.deviceChangeObservers.add(o),this.watchForDeviceChangesIfNecessary(),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.logger.info("removing device change observer"),this.deviceChangeObservers.delete(o),this.watchForDeviceChangesIfNecessary(),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){var o,p;if(!this.activeDevices.audio)return null;let f=null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.end;if(f){let o=f.context.createAnalyser();return o.removeOriginalInputs=()=>{try{f.disconnect(o)}catch(o){}},f.connect(o),o}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(o){let p=DefaultDeviceController.getAudioContext(),f=p.createAnalyser(),m=p.createMediaStreamSource(o);return m.connect(f),this.trace("createAnalyserNodeForAudioInput"),f.removeOriginalInputs=()=>{try{m.disconnect(f)}catch{}},f}startVideoPreviewForVideoInput(o){if(!this.activeDevices.video){this.logger.warn("cannot bind video preview since video input device has not been chosen"),this.trace("startVideoPreviewForVideoInput",o.id);return}L.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,o,!0),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){L.default.disconnectVideoStreamFromVideoElement(o,!1),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){if(this.deviceInfoCache){for(let o of this.deviceInfoCache)if(!o.label){this.deviceInfoCache=null;break}}this.deviceLabelTrigger=o,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=null;return this.useWebAudio?(p=DefaultDeviceController.getAudioContext().createMediaStreamSource(o)).connect(this.getMediaStreamOutputNode()):this.logger.warn("WebAudio is not enabled, mixIntoAudioInput will not work"),this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(o,p);this.videoInputQualitySettings=new er.default(m[0],m[1],f)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return(this.activeDevices.audio||(this.logger.info("No audio device chosen, creating empty audio device"),yield this.startAudioInput(null)),this.useWebAudio)?this.getMediaStreamDestinationNode().stream:this.activeDevices.audio.stream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){if(!this.activeDevices.video)throw Error("No video device chosen");return this.chosenVideoInputIsTransformDevice()?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){throw Error("unsupported")})}releaseAudioTransformStream(){this.logger.info("Stopping audio track for Web Audio graph"),this.stopTracksAndRemoveCallbacks("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0)}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallbacks("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallbacks(o){let p=this.activeDevices[o];if(!p)return;let f=p.endedCallback,m=p.trackMuteCallback,_=p.trackUnmuteCallback;for(let w of p.stream.getTracks())w.stop(),f&&w.removeEventListener("ended",f),m&&w.removeEventListener("mute",m),_&&w.removeEventListener("unmute",_),delete p.endedCallback,delete p.trackMuteCallback,delete p.trackUnmuteCallback,delete this.activeDevices[o]}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}muteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!1)}unmuteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!0)}toggleLocalAudioInputStream(o){var p;let f=this.activeDevices.audio;if(this.useWebAudio&&(f=this.getMediaStreamDestinationNode()),f){for(let p of f.stream.getTracks())p.enabled!==o&&(p.enabled=o);!o!==this.muted&&(this.muted=!o,null==(p=this.transform)||p.device.mute(this.muted))}}static getIntrinsicDeviceId(o){if(!o)return;if("string"==typeof o)return o;if(o.id)return o.id;let p=o.deviceId;return p?"string"==typeof p||Array.isArray(p)?p:"string"==typeof p.exact||Array.isArray(p.exact)?p.exact:void 0:void 0}static createEmptyAudioDevice(){return DefaultDeviceController.synthesizeAudioDevice(0)}static synthesizeAudioDevice(o){let p=DefaultDeviceController.getAudioContext(),f=p.createMediaStreamDestination();if(o){let m=p.createGain();m.gain.value=.1,m.connect(f);let _=p.createOscillator();_.frequency.value=o,_.connect(m),_.start()}else{let o=p.createBufferSource();try{o.buffer=p.createBuffer(1,5*p.sampleRate,p.sampleRate)}catch(f){if(f&&"NotSupportedError"===f.name)o.buffer=p.createBuffer(1,5*DefaultDeviceController.defaultSampleRate,DefaultDeviceController.defaultSampleRate);else throw f}o.buffer.getChannelData(0)[0]=3e-4,o.loop=!0,o.connect(f),o.start()}return f.stream}listDevicesOfKind(o,p){return m(this,void 0,void 0,function*(){return(p||null===this.deviceInfoCache||!this.isWatchingForDeviceChanges())&&(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(o)})}updateDeviceInfoCacheFromBrowser(){var o;return m(this,void 0,void 0,function*(){if("u"<typeof MediaDeviceInfo){this.deviceInfoCache=[];return}let p=yield navigator.mediaDevices.enumerateDevices(),f=!0;for(let o of p)if(!o.label){f=!1;break}if(!f)try{this.logger.info("attempting to trigger media device labels since they are hidden");let o=yield this.deviceLabelTrigger();for(let f of(p=yield navigator.mediaDevices.enumerateDevices(),o.getTracks()))f.stop()}catch(p){this.logger.info("unable to get media device labels"),null==(o=this.eventController)||o.publishEvent("deviceLabelTriggerFailed",{deviceLabelTriggerErrorMessage:this.getErrorMessage(p)})}this.logger.debug(`Update device info cache with devices: ${JSON.stringify(p)}`),this.deviceInfoCache=p})}listCachedDevicesOfKind(o){let p=[];if(this.deviceInfoCache)for(let f of this.deviceInfoCache)f.kind===o&&p.push(f);return p}handleDeviceChange(){return m(this,void 0,void 0,function*(){if(null===this.deviceInfoCache)return;if(this.alreadyHandlingDeviceChange)return void k.default.nextTick(()=>{this.handleDeviceChange()});this.alreadyHandlingDeviceChange=!0;let o=this.listCachedDevicesOfKind("audioinput"),p=this.listCachedDevicesOfKind("videoinput"),f=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();let m=this.listCachedDevicesOfKind("audioinput"),_=this.listCachedDevicesOfKind("videoinput"),w=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver(I=>{this.areDeviceListsEqual(o,m)||x.Maybe.of(I.audioInputsChanged).map(o=>o.bind(I)(m)),this.areDeviceListsEqual(p,_)||x.Maybe.of(I.videoInputsChanged).map(o=>o.bind(I)(_)),this.areDeviceListsEqual(f,w)||x.Maybe.of(I.audioOutputsChanged).map(o=>o.bind(I)(w))}),this.alreadyHandlingDeviceChange=!1})}handleDeviceStreamEnded(o,p){return m(this,void 0,void 0,function*(){try{"audio"===o?(this.useWebAudio&&this.browserBehavior.requiresAudioContextResetOnDeviceFailureForWebAudio()?(this.logger.warn("Audio input device which was active is no longer available, suspending and resuming audio context before resetting to empty device to ensure packets are sent"),yield this.stopAudioInput(),DefaultDeviceController.suspendAudioContext(),DefaultDeviceController.resumeAudioContext()):this.logger.warn("Audio input device which was active is no longer available, resetting to empty device to ensure packets are sent"),yield this.startAudioInput(null)):(this.logger.warn("Video input device which was active is no longer available, stopping video"),yield this.stopVideoInput())}catch(o){this.logger.error("Failed to choose null device after stream ended.")}"audio"===o?this.forEachObserver(o=>{x.Maybe.of(o.audioInputStreamEnded).map(f=>f.bind(o)(p))}):this.forEachObserver(o=>{x.Maybe.of(o.videoInputStreamEnded).map(f=>f.bind(o)(p))})})}forEachObserver(o){for(let p of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(p)&&o(p)})}forEachMediaStreamBrokerObserver(o){for(let p of this.mediaStreamBrokerObservers)k.default.nextTick(()=>{this.mediaStreamBrokerObservers.has(p)&&o(p)})}areDeviceListsEqual(o,p){return JSON.stringify(o.map(o=>JSON.stringify(o)).sort())===JSON.stringify(p.map(o=>JSON.stringify(o)).sort())}intrinsicDeviceAsMediaStream(o){return o&&o.id?o:null}hasSameMediaStreamId(o,p,f){var m,_,w,I;let k;return"audio"===o?!!(k=null==f?void 0:f.audio.streamId)&&k===(null==(_=null==(m=p.constraints)?void 0:m.audio)?void 0:_.streamId):!!(k=null==f?void 0:f.video.streamId)&&k===(null==(I=null==(w=null==p?void 0:p.constraints)?void 0:w.video)?void 0:I.streamId)}hasSameGroupId(o,p,f){if(""===o)return!0;let m=DefaultDeviceController.getIntrinsicDeviceId(f);return this.logger.debug(`Checking deviceIds ${m} of type ${typeof m} with groupId ${o}`),"string"==typeof m&&o===this.getGroupIdFromDeviceId(p,m)}getGroupIdFromDeviceId(o,p){if(null!==this.deviceInfoCache){let f=this.listCachedDevicesOfKind(`${o}input`).find(o=>o.deviceId===p);if(f&&f.groupId)return this.logger.debug(`GroupId of deviceId ${p} found in cache is ${f.groupId}`),f.groupId}return this.logger.debug(`GroupId of deviceId ${p} found in cache is empty`),""}handleGetUserMediaError(o,p){if(!o)throw new $.default(o);switch(o.name){case"NotReadableError":case"TrackStartError":throw new Z.default(o);case"NotFoundError":case"DevicesNotFoundError":throw new q.default(o);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":if(p&&p<DefaultDeviceController.permissionDeniedOriginDetectionThresholdMs)throw new et.default(o,"Permission denied by browser");throw new et.default(o,"Permission denied by user");case"OverconstrainedError":case"ConstraintNotSatisfiedError":throw new ee.default(o);case"TypeError":throw new ei.default(o);default:throw new $.default(o)}}matchesDeviceSelection(o,p,f,m){return!!(f&&f.stream.active&&(this.hasSameMediaStreamId(o,f,m)||null!==f.groupId&&this.hasSameGroupId(f.groupId,o,p)))&&(this.logger.debug(`Compare current device constraint ${JSON.stringify(f.constraints)} to proposed constraints ${JSON.stringify(m)}`),f.matchesConstraints(m))}chooseInputIntrinsicDevice(o,p){var f,_;return m(this,void 0,void 0,function*(){let m=this.getMediaStreamConstraints(o,p);if(this.matchesDeviceSelection(o,p,this.activeDevices[o],m))return void this.logger.info(`reusing existing ${o} input device`);this.activeDevices[o]&&this.activeDevices[o].stream&&this.stopTracksAndRemoveCallbacks(o);let w=Date.now(),I=new U.default;try{this.logger.info(`requesting new ${o} device with constraint ${JSON.stringify(m)}`);let f=this.intrinsicDeviceAsMediaStream(p);"audio"===o&&null===p?(I.stream=DefaultDeviceController.createEmptyAudioDevice(),I.constraints=null):(f?(this.logger.info(`using media stream ${f.id} for ${o} device`),I.stream=f):I.stream=yield navigator.mediaDevices.getUserMedia(m),I.constraints=m),yield this.handleNewInputDevice(o,I)}catch(x){let k=this.getErrorMessage(x);"audio"===o?null==(f=this.eventController)||f.publishEvent("audioInputFailed",{audioInputErrorMessage:k}):null==(_=this.eventController)||_.publishEvent("videoInputFailed",{videoInputErrorMessage:k}),this.logger.error(`failed to get ${o} device for constraints ${JSON.stringify(m)}: ${k}`);let M=!0;if(x&&"constraint"in x&&(this.logger.error(`Over-constrained by constraint: ${x.constraint}`),this.useMediaConstraintsFallback)){let f=this.getMediaStreamConstraints(o,p,!0),_=JSON.stringify(f);if(_!==JSON.stringify(m)){this.logger.info(`retry requesting new ${o} device with minimal constraint ${_}`);try{I.stream=yield navigator.mediaDevices.getUserMedia(f),I.constraints=f,yield this.handleNewInputDevice(o,I),M=!1}catch(p){this.logger.error(`failed to get ${o} device for constraints ${_}: ${this.getErrorMessage(p)}`)}}}if(M){if("audio"===o){this.logger.info(`choosing null ${o} device instead`);try{I.stream=DefaultDeviceController.createEmptyAudioDevice(),I.constraints=null,yield this.handleNewInputDevice(o,I)}catch(p){this.logger.error(`failed to choose null ${o} device. ${p.name}: ${p.message}`)}}this.handleGetUserMediaError(x,Date.now()-w)}}finally{this.watchForDeviceChangesIfNecessary()}})}getErrorMessage(o){return o?o.name&&o.message?`${o.name}: ${o.message}`:o.name?o.name:o.message?o.message:"UnknownError":"UnknownError"}handleNewInputDevice(o,p){var f;return m(this,void 0,void 0,function*(){this.logger.info(`got ${o} device for constraints ${JSON.stringify(p.constraints)}`);let m=null==(f=this.getMediaTrackSettings(p.stream))?void 0:f.deviceId;p.groupId=m?this.getGroupIdFromDeviceId(o,m):"",this.activeDevices[o]=p,this.logger.debug(`Set activeDevice to ${JSON.stringify(p)}`),this.watchForDeviceChangesIfNecessary();let _=p.stream.getTracks()[0];if(_&&(p.endedCallback=()=>{this.activeDevices[o]&&this.activeDevices[o].stream===p.stream&&(this.handleDeviceStreamEnded(o,m),delete p.endedCallback)},_.addEventListener("ended",p.endedCallback,{once:!0})),"audio"===o){let o=p.stream.getAudioTracks()[0];if(o){let f=o.getSettings().deviceId||p.stream;p.trackMuteCallback=()=>{this.mediaStreamMuteObserver(f,!0)},p.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(f,!1)},o.addEventListener("mute",p.trackMuteCallback,{once:!1}),o.addEventListener("unmute",p.trackUnmuteCallback,{once:!1}),this.logger.debug("Notifying mute state after selection"),o.muted?p.trackMuteCallback():p.trackUnmuteCallback()}}})}calculateMediaStreamConstraints(o,p,f,m){if(m&&1===this.listCachedDevicesOfKind(`${o}input`).length)return!0;let _={};return(this.browserBehavior.requiresNoExactMediaStreamConstraints()?_.deviceId=p:_.deviceId={exact:p},f&&(_.groupId=f),m)?_:"video"===o?(_.width={ideal:this.videoInputQualitySettings.videoWidth},_.height={ideal:this.videoInputQualitySettings.videoHeight},_.frameRate={ideal:this.videoInputQualitySettings.videoFrameRate},_):(this.supportSampleRateConstraint()&&(_.sampleRate={ideal:DefaultDeviceController.defaultSampleRate}),this.supportSampleSizeConstraint()&&(_.sampleSize={ideal:DefaultDeviceController.defaultSampleSize}),this.supportChannelCountConstraint()&&(_.channelCount={ideal:DefaultDeviceController.defaultChannelCount}),Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},_))}getMediaStreamConstraintsFromTrackConstraints(o,p){return"audio"===o?{audio:p}:{video:p}}getMediaStreamConstraints(o,p,f=!1){let m={};if(!p)return null;let _=this.intrinsicDeviceAsMediaStream(p);if(_)return m.streamId=_.id,this.getMediaStreamConstraintsFromTrackConstraints(o,m);if("string"==typeof p){let _="";return this.browserBehavior.requiresGroupIdMediaStreamConstraints()&&(null!==this.deviceInfoCache?_=this.getGroupIdFromDeviceId(o,p):this.logger.error("Device cache is not populated. Please make sure to call list devices first")),m=this.calculateMediaStreamConstraints(o,p,_,f),this.getMediaStreamConstraintsFromTrackConstraints(o,m)}return isMediaDeviceInfo(p)?m=this.calculateMediaStreamConstraints(o,p.deviceId,p.groupId,f):m=p,this.getMediaStreamConstraintsFromTrackConstraints(o,m)}deviceInfoFromDeviceId(o,p){if(null===this.deviceInfoCache)return null;for(let f of this.deviceInfoCache)if(f.kind===o&&f.deviceId===p)return f;return null}hasAppliedTransform(){return!!this.transform}isMediaStreamReusableByDeviceId(o,p){if(!o||!o.active||!p)return!1;if(p.id)return o.id===p.id;let f=this.getMediaTrackSettings(o);if(!f.deviceId)return!1;let m=DefaultDeviceController.getIntrinsicDeviceId(p);return"string"==typeof m&&f.deviceId===m}getMediaTrackSettings(o){var p;return null==(p=o.getTracks()[0])?void 0:p.getSettings()}reconnectAudioInputs(){if(!this.audioInputSourceNode)return;this.audioInputSourceNode.disconnect();let o=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(o)}setTransform(o,p){var f,m;null==(m=null==(f=this.transform)?void 0:f.nodes)||m.end.disconnect(),this.transform={nodes:p,device:o};let _=null==p?void 0:p.end,w=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${_} to destination ${w}.`),null==_||_.connect(w),this.reconnectAudioInputs()}removeTransform(){var o;let p=this.transform;if(p)return null==(o=this.transform.nodes)||o.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),p}attachAudioInputStreamToAudioContext(o){var p;null==(p=this.audioInputSourceNode)||p.disconnect(),this.audioInputSourceNode=DefaultDeviceController.getAudioContext().createMediaStreamSource(o);let f=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(f)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=DefaultDeviceController.getAudioContext().createMediaStreamDestination()),this.audioInputDestinationNode}getMediaStreamOutputNode(){var o,p;return(null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.start)||this.getMediaStreamDestinationNode()}static setDefaultLatencyHint(o){DefaultDeviceController.defaultLatencyHint=o}static getAudioContext(){if(!DefaultDeviceController.audioContext){let o={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(o.sampleRate=DefaultDeviceController.defaultSampleRate),new w.default().requiresPlaybackLatencyHintForAudioContext()&&(o.latencyHint="playback"),DefaultDeviceController.defaultLatencyHint&&(o.latencyHint=DefaultDeviceController.defaultLatencyHint),DefaultDeviceController.audioContext=new(window.AudioContext||window.webkitAudioContext)(o)}return DefaultDeviceController.audioContext}static suspendAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.suspend():Promise.resolve()})}static resumeAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.resume():Promise.resolve()})}static closeAudioContext(){if(DefaultDeviceController.audioContext)try{DefaultDeviceController.audioContext.close()}catch(o){}DefaultDeviceController.audioContext=null}addMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.add(o)}removeMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.delete(o)}publishVideoInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.videoInputDidChange&&p.videoInputDidChange(o)}),this.pushVideoMeetingStateForPermissions(o)}publishAudioInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioInputDidChange&&p.audioInputDidChange(o)}),this.pushAudioMeetingStateForPermissions(o)}publishAudioOutputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioOutputDidChange&&p.audioOutputDidChange(o)})}supportSampleRateConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleRate}supportSampleSizeConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleSize}supportChannelCountConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().channelCount}trace(o,p,f){let m=`API/DefaultDeviceController/${o}`;void 0!==p&&(m+=` ${JSON.stringify(p)}`),void 0!==f&&(m+=` -> ${JSON.stringify(f)}`),this.logger.info(m)}};function isMediaDeviceInfo(o){return"object"==typeof o&&"deviceId"in o&&"groupId"in o&&"kind"in o&&"label"in o}p.default=eo,eo.permissionDeniedOriginDetectionThresholdMs=500,eo.defaultVideoWidth=960,eo.defaultVideoHeight=540,eo.defaultVideoFrameRate=15,eo.defaultSampleRate=48e3,eo.defaultSampleSize=16,eo.defaultChannelCount=1,eo.audioContext=null},0x105f3de65:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.groupId=""}matchesConstraints(o){return JSON.stringify(this.constraints)===JSON.stringify(o)}}},0x19b2d97e8:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class extends Error{constructor(o,p){super(p||"Error fetching device."),this.cause=o,this.name="GetUserMediaError"}}},0xf371a16d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.NoOpDeviceControllerWithEventController=void 0;let w=_(f(0x203f02bb7)),I=_(f(0x170a3ef32)),k=class extends w.default{constructor(o){super(),this.destroyed=!1}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0})}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}startAudioInput(o){return Promise.reject()}stopAudioInput(){return Promise.resolve()}startVideoInput(o){return Promise.reject()}stopVideoInput(){return Promise.resolve()}chooseAudioOutput(o){return Promise.reject()}addDeviceChangeObserver(o){}removeDeviceChangeObserver(o){}createAnalyserNodeForAudioInput(){return null}startVideoPreviewForVideoInput(o){}stopVideoPreviewForVideoInput(o){}setDeviceLabelTrigger(o){}mixIntoAudioInput(o){return null}chooseVideoInputQuality(o,p,f){}getVideoInputQualitySettings(){return I.default.VideoDisabled}};p.default=k,p.NoOpDeviceControllerWithEventController=class extends k{constructor(o){super(),this.eventController=o}}},0x4d06f54a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o){super(o),this.name="NotFoundError"}}},0x15ea31aea:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o){super(o),this.name="NotReadableError"}}},0x747ce3f3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o,p){super(o),this.constraint=p,this.name="OverconstrainedError"}}},0x1d643307b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o,p){super(o,p),this.name="PermissionDeniedError"}}},0xdeed8ee7:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.inner=o}mute(o){return f(this,void 0,void 0,function*(){})}stop(){var o;return f(this,void 0,void 0,function*(){null==(o=this.node)||o.disconnect()})}intrinsicDevice(){return f(this,void 0,void 0,function*(){return this.inner})}createAudioNode(o){var p;return f(this,void 0,void 0,function*(){return null==(p=this.node)||p.disconnect(),this.node=yield this.createSingleAudioNode(o),{start:this.node,end:this.node}})}}},0xdb2548f7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o){super(o),this.name="TypeError"}}},0x170a3ef32:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class{constructor(o,p,f){this.videoWidth=o,this.videoHeight=p,this.videoFrameRate=f}equals(o){return this.videoWidth===o.videoWidth&&this.videoHeight===o.videoHeight&&this.videoFrameRate===o.videoFrameRate}};p.default=f,f.VideoDisabled=new f(0,0,0),f.VideoResolutionHD=new f(1280,720,30),f.VideoResolutionFHD=new f(1920,1080,30),f.VideoResolutionUHD=new f(3840,2160,30)},0x1a86248d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isVideoTransformDevice=void 0,p.isVideoTransformDevice=function(o){return!!o&&"object"==typeof o&&"transformStream"in o&&"stop"in o&&"intrinsicDevice"in o}},0x167bde784:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){if(this.devicePixelRatioSource=o,this.observerQueue=new Set,this.mediaQueryListener=()=>{this.observerQueue.forEach(o=>{o.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())})},"u"<typeof window)return;const f=matchMedia(`(resolution: ${this.devicePixelRatioSource.devicePixelRatio()}dppx)`);"function"==typeof f.addEventListener?(f.addEventListener("change",this.mediaQueryListener),this.mediaQueryList=f):"function"==typeof f.addListener?(f.addListener(this.mediaQueryListener),this.mediaQueryList=f):p.warn("ignoring DefaultDevicePixelRatioMonitor")}destroy(){return f(this,void 0,void 0,function*(){this.mediaQueryList&&("function"==typeof this.mediaQueryList.addEventListener?this.mediaQueryList.removeEventListener("change",this.mediaQueryListener):this.mediaQueryList.removeListener(this.mediaQueryListener)),delete this.mediaQueryListener,this.observerQueue.clear()})}registerObserver(o){this.observerQueue.add(o),o.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}removeObserver(o){this.observerQueue.delete(o)}}},0x2074869bd:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{devicePixelRatio(){return!("u"<typeof window)&&window&&window.devicePixelRatio?window.devicePixelRatio:1}}},0xfb871915:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__rest||function(o,p){var f={};for(var m in o)Object.prototype.hasOwnProperty.call(o,m)&&0>p.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_<m.length;_++)0>p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f},w=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let I=w(f(0x14915840a)),k=w(f(0xd475f02c)),M=w(f(0x19f971fd8)),x=f(0xb79a45b7),O=class InMemoryJSONEventBuffer{constructor(o,p,f,w,I){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=o=>({type:o.type,v:o.v,payloads:[...o.payloads]}),this.sendEvents=()=>m(this,void 0,void 0,function*(){if(this.lock)return;let o=this.getItems(this.flushSize);if(0===o.length)return;this.lock=!0;let p=this.makeRequestBody(o),f=!1,m=Date.now();"firefox"===this.metadata.browserName.toLowerCase()&&this.cancellableEvents.set(m,o);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${p}`);let o=yield this.send(p);if(this.cancellableEvents.delete(m),o.ok)try{let f=yield o.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${p} message: ${JSON.stringify(f)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${o} for events ${p}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${p} with response status ${o.status}`),f=!0}catch(o){f=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${p} to the ingestion endpoint ${o}`)}finally{this.lock=!1}f&&(this.cancellableEvents.delete(m),this.failedIngestionEvents.push(...o))});const k=new M.default(I).getParserResult(),{browserMajorVersion:x}=k,O=_(k,["browserMajorVersion"]),L=p.toJSON(),{type:B,v:U}=L,$=_(L,["type","v"]);this.authenticationToken=p.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},O),$),Object.keys(this.metadata).forEach(o=>this.attributesToFilter.push(o)),this.type=B,this.v=U,this.ingestionURL=f,this.logger=I,this.importantEvents=new Set(w);const{maxBufferCapacityKb:q,totalBufferItems:Z,flushSize:ee,flushIntervalMs:et,retryCountLimit:ei}=o;this.maxBufferCapacityBytes=1024*q,this.totalBufferItems=Z,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/Z),this.flushIntervalMs=et,this.flushSize=ee,this.retryCountLimit=ei,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=o=>this.beaconEventHandler(o),this.addEventListeners()}addEventListeners(){this.beaconEventListener&&"window"in f.g&&window.addEventListener&&"document"in f.g&&document.addEventListener&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - addEventListeners - adding pagehide and visibility change event listeners"),window.addEventListener("pagehide",this.beaconEventListener),document.addEventListener("visibilitychange",this.beaconEventListener))}beaconEventHandler(o){("visibilitychange"===o.type&&"hidden"===document.visibilityState||"pagehide"===o.type)&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - beaconEventHandler is triggered calling sendBeacon"),this.sendBeacon())}removeEventListeners(){this.beaconEventListener&&"window"in f.g&&window.removeEventListener&&"document"in f.g&&document.removeEventListener&&(window.removeEventListener("pagehide",this.beaconEventListener),document.removeEventListener("visibilitychange",this.beaconEventListener),this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - removeEventListeners - removing pagehide and visibility change event listeners"))}start(){var o;this.removeEventListeners(),this.addEventListeners(),null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=new k.default(this.flushIntervalMs),this.intervalScheduler.start(()=>this.sendEvents())}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.sendBeacon(),this.removeEventListeners()}addItem(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_=m&&this.filterAttributes(m,this.attributesToFilter),w=Object.assign({name:p,ts:f},_);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(w)}`);let I=this.getSize(w);if(I>InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED)throw Error(`Event Reporting - Item to be added has size ${I} bytes. Item cannot exceed max item size allowed of ${InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(p)){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(w)}`),this.sendEventImmediately({name:p,ts:f,attributes:_});return}if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),Error("Buffer full");if(this.currentIngestionEvent.payloads.push(w),this.ingestionEventSize+=I,this.bufferItemThresholdReached(I)){let o=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);this.buffer.push(o),this.bufferSize+=this.ingestionEventSize,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - buffer item threshold reached updated buffer ${JSON.stringify(this.buffer)}`)}})}filterAttributes(o,p){let f=new Set(p);return Object.keys(o).filter(o=>f.has(o)).forEach(p=>delete o[p]),o}initializeAndGetCurrentIngestionEvent(){let o={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(o),o}bufferItemThresholdReached(o){return o+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===InMemoryJSONEventBuffer.MAX_PAYLOAD_ITEMS}getSize(o){let p=0;if("object"==typeof o)for(let[f,m]of Object.entries(o))p+=this.getPrimitiveSize(f),p+=this.getSize(m);else p+=this.getPrimitiveSize(o);return p}getPrimitiveSize(o){let p=0;return"string"==typeof o?p+=2*o.length:"number"==typeof o&&(p+=8),p}isFull(){return this.bufferSize===this.maxBufferCapacityBytes||this.buffer.length===this.totalBufferItems}isEmpty(){return 0===this.buffer.length||0===this.bufferSize}getItems(o,p=0){return this.isEmpty()?[]:(o=Math.min(this.buffer.length,o+1),this.buffer.splice(p,o))}makeBeaconRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o,authorization:this.authenticationToken})}makeRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o})}sendEventImmediately(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_={type:this.type,v:this.v,payloads:[Object.assign({name:p,ts:f},m)]},w=!1,I=null,k=this.makeRequestBody([_]);try{if((I=yield this.send(k)).ok){try{let o=yield I.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${k}, message: ${JSON.stringify(o)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${o} for event ${k}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${k} with response status ${I.status}`),w=!0}catch(o){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${k} to the ingestion endpoint ${o}.`),w=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){let o=this.makeBeaconRequestBody([_]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${o}`),w=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,o)}}catch(o){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${k}`),w=!0}}w&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${k}`),this.failedIngestionEvents.push(_))})}send(o){return m(this,void 0,void 0,function*(){let p=new I.default(InMemoryJSONEventBuffer.RETRY_FIXED_BACKOFF_WAIT_MS,InMemoryJSONEventBuffer.RETRY_SHORT_BACKOFF_MS,InMemoryJSONEventBuffer.RETRY_LONG_BACKOFF_MS);try{let f=0;for(;f<this.retryCountLimit;){let m=yield fetch(this.ingestionURL,{method:"POST",headers:{Authorization:`Bearer ${this.authenticationToken}`},body:o});if(m.ok||!InMemoryJSONEventBuffer.SENDING_FAILURE_CODES.has(m.status))return m;if(this.logger.warn(`Will retry sending failure for ${o} due to status code ${m.status}.`),++f<this.retryCountLimit){let o=p.nextBackoffAmountMs();yield x.wait(o)}}if(f===this.retryCountLimit)throw Error(`Retry count limit reached for ${o}`)}catch(o){throw o}})}sendBeacon(){return m(this,void 0,void 0,function*(){let o=this.buffer;if(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out buffer events ${JSON.stringify(o)}`),this.buffer=[],this.currentIngestionEvent.payloads.length>0){let p=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);o.push(p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(p)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){let p=this.failedIngestionEvents.map(o=>this.deepCopyCurrentIngestionEvent(o));o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(p)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>0&&(this.cancellableEvents.forEach(p=>{o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out each cancellable event ${JSON.stringify(p)}`)}),this.cancellableEvents.clear()),0===o.length)return;let p=this.makeBeaconRequestBody(o);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - beacon data to send ${p}`);try{navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,p)||this.logger.warn(`Event Reporting - Browser failed to queue beacon data ${p}`)}catch(o){this.logger.warn(`Event Reporting - Sending beacon data ${p} failed with error ${o}`)}})}reset(){this.maxBufferCapacityBytes=0,this.totalBufferItems=0,this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.lock=!1,this.beaconEventListener=void 0,this.cancellableEvents.clear()}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.reset()})}};p.default=O,O.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),O.RETRY_FIXED_BACKOFF_WAIT_MS=0,O.RETRY_SHORT_BACKOFF_MS=1e3,O.RETRY_LONG_BACKOFF_MS=15e3,O.MAX_PAYLOAD_ITEMS=2,O.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},0x159d41205:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=5e3,p=2,f=64,m=100,_=15){this.flushIntervalMs=o,this.flushSize=p,this.maxBufferCapacityKb=f,this.totalBufferItems=m,this.retryCountLimit=_}}},0x8fff55e5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.audioVideoEventAttributesFromState=void 0,p.audioVideoEventAttributesFromState=function(o){let p={};return null!==o.startTimeMs&&(p.meetingDurationMs=Math.round(Date.now()-o.startTimeMs)),null!==o.signalingOpenDurationMs&&(p.signalingOpenDurationMs=o.signalingOpenDurationMs),null!==o.iceGatheringDurationMs&&(p.iceGatheringDurationMs=o.iceGatheringDurationMs),null!==o.attendeePresenceDurationMs&&(p.attendeePresenceDurationMs=o.attendeePresenceDurationMs),null!==o.meetingStartDurationMs&&(p.meetingStartDurationMs=o.meetingStartDurationMs),void 0!==o.maxVideoTileCount&&(p.maxVideoTileCount=o.maxVideoTileCount),void 0!==o.poorConnectionCount&&(p.poorConnectionCount=o.poorConnectionCount),void 0!==o.retryCount&&(p.retryCount=o.retryCount),p}},0x18e4b58c2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x2056040c6),I=f(0x24b1dc2b),k=_(f(0x1077291f7)),M=_(f(0x164a41979)),x=_(f(0x22e52699e)),O=_(f(0x1158c4d3)),L=_(f(0x22a0f7c69)),B=_(f(0x1ad1fbfa6)),U=class DefaultEventController{constructor(o,p,f){var m,_,I,k,M,x,O;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=p,this.configuration=o,this.setupEventReporter(o,p,f);try{this.parserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null}catch(o){this.logger.error(o.message)}this.browserMajorVersion=(null==(I=null==(_=null==(m=this.parserResult)?void 0:m.browser)?void 0:_.version)?void 0:I.split(".")[0])||DefaultEventController.UNAVAILABLE,this.browserName=(null==(k=this.parserResult)?void 0:k.browser.name)||DefaultEventController.UNAVAILABLE,this.browserVersion=(null==(M=this.parserResult)?void 0:M.browser.version)||DefaultEventController.UNAVAILABLE,this.deviceName=[(null==(x=this.parserResult)?void 0:x.device.vendor)||"",(null==(O=this.parserResult)?void 0:O.device.model)||""].join(" ").trim()||DefaultEventController.UNAVAILABLE}addObserver(o){this.observerSet.add(o)}removeObserver(o){this.observerSet.delete(o)}forEachObserver(o){for(let p of this.observerSet)O.default.nextTick(()=>{this.observerSet.has(p)&&o(p)})}publishEvent(o,p){return m(this,void 0,void 0,function*(){let f=Date.now();this.meetingHistoryStates.push({name:o,timestampMs:f});let m=Object.freeze(Object.assign(this.getAttributes(f),p));this.forEachObserver(p=>{p.eventDidReceive(o,m)}),this.reportEvent(o,f,p)})}reportEvent(o,p,f){var _;return m(this,void 0,void 0,function*(){let m;try{f&&(m=B.default(f)),yield null==(_=this.eventReporter)?void 0:_.reportEvent(p,o,m)}catch(o){this.logger.error(`Error reporting event ${o}`)}})}setupEventReporter(o,p,f){if(f)this._eventReporter=f;else if(o.urls){let f=o.urls.eventIngestionURL;if(f){this.logger.info("Event ingestion URL is present in the configuration");let{meetingId:m,credentials:{attendeeId:_,joinToken:w}}=o,I=new x.default(m,_,w),O=new k.default(I,f);this._eventReporter=new M.default(O,p)}}}getAttributes(o){var p,f;return{attendeeId:this.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:"string"==typeof this.configuration.externalMeetingId?this.configuration.externalMeetingId:"",externalUserId:this.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.configuration.meetingId,osName:(null==(p=this.parserResult)?void 0:p.os.name)||DefaultEventController.UNAVAILABLE,osVersion:(null==(f=this.parserResult)?void 0:f.os.version)||DefaultEventController.UNAVAILABLE,sdkVersion:L.default.sdkVersion,sdkName:L.default.sdkName,timestampMs:o}}get eventReporter(){return this._eventReporter}destroy(){return m(this,void 0,void 0,function*(){I.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0})}};p.default=U,U.UNAVAILABLE="Unavailable"},0x1ad1fbfa6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=o=>{let p={};for(let[f,m]of Object.entries(o))if(null==m||""===m)continue;else if("number"==typeof m||"string"==typeof m)p[f]=m;else throw TypeError("Unhandled type received while flattening attributes.");return p}},0x1077291f7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x159d41205));p.default=class{constructor(o,p,f=new _.default){this.eventsClientConfiguration=o,this.ingestionURL=p,this.eventBufferConfiguration=f}}},0x164a41979:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x24b1dc2b),I=_(f(0xfb871915));p.default=class{constructor(o,p){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded","deviceLabelTriggerFailed"],this.destroyed=!1;const{eventsClientConfiguration:f,ingestionURL:m,eventBufferConfiguration:_}=o,{eventsToIgnore:w}=f;this.eventBuffer=new I.default(_,f,m,this.importantEvents,p),this.logger=p,this.eventsToIgnore=w,this.start()}start(){if(!this.reportingEvents)try{this.eventBuffer.start(),this.logger.info("Event reporting started"),this.reportingEvents=!0}catch(o){this.logger.error(`Event Reporting - Error starting the event buffer ${o}`)}}stop(){if(this.reportingEvents)try{this.eventBuffer.stop(),this.logger.info("Event reporting stopped"),this.reportingEvents=!1}catch(o){this.logger.error(`Event Reporting - Error stopping the event buffer ${o}`)}}reportEvent(o,p,f){return m(this,void 0,void 0,function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${o}, ${p}, ${JSON.stringify(f)}`),this.eventsToIgnore.includes(p))return void this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - ${p} event will be ignored as it is in events to ignore`);try{this.logger.debug("Event Reporting - DefaultMeetingEventReporter - adding item to event buffer"),yield this.eventBuffer.addItem({ts:o,name:p,attributes:f})}catch(o){this.logger.error(`Event Reporting - Error adding event to buffer ${o}`)}})}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0,this.stop(),w.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0})}}},0x91d5148b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{reportEvent(o,p,f){}start(){}stop(){}}},0x22e52699e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m=[]){this.type="Meet",this.v=1,this.meetingId=o,this.attendeeId=p,this.eventsToIgnore=m,this.authenticationToken=f}getAuthenticationToken(){return this.authenticationToken}toJSON(){let o={};return o.type=this.type,o.v=this.v,o.meetingId=this.meetingId,o.attendeeId=this.attendeeId,o}}},0x1ec8c7574:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DefaultEventController=p.DefaultDevicePixelRatioMonitor=p.DefaultDeviceController=p.DefaultContentShareController=p.DefaultBrowserBehavior=p.DefaultAudioVideoFacade=p.DefaultAudioVideoController=p.DefaultAudioMixController=p.DefaultActiveSpeakerPolicy=p.DefaultActiveSpeakerDetector=p.DataMessage=p.CreateSDPTask=p.CreatePeerConnectionTask=p.ContentShareMediaStreamBroker=p.ContentShareConstants=p.ConsoleLogger=p.ConnectionHealthPolicyConfiguration=p.ConnectionHealthData=p.ClientVideoStreamReceivingReport=p.ClientMetricReportMediaType=p.ClientMetricReportDirection=p.ClientMetricReport=p.CleanStoppedSessionTask=p.CleanRestartedSessionTask=p.CheckVideoInputFeedback=p.CheckVideoConnectivityFeedback=p.CheckNetworkUDPConnectivityFeedback=p.CheckNetworkTCPConnectivityFeedback=p.CheckContentShareConnectivityFeedback=p.CheckCameraResolutionFeedback=p.CheckAudioOutputFeedback=p.CheckAudioInputFeedback=p.CheckAudioConnectivityFeedback=p.CanvasVideoFrameBuffer=p.CSPMonitor=p.BitrateParameters=p.BaseTask=p.BaseConnectionHealthPolicy=p.BackgroundReplacementVideoFrameProcessor=p.BackgroundFilterVideoFrameProcessor=p.BackgroundBlurVideoFrameProcessor=p.BackgroundBlurStrength=p.AudioVideoControllerState=p.AudioProfile=p.AudioLogEvent=p.Attendee=p.AttachMediaInputTask=p.AsyncScheduler=p.ApplicationMetadata=p.AllHighestVideoBandwidthPolicy=void 0,p.MeetingFeatures=p.MeetingEventsClientConfiguration=p.MediaDeviceProxyHandler=p.Maybe=p.LogLevel=p.Log=p.ListenForVolumeIndicatorsTask=p.LeaveAndReceiveLeaveAckTask=p.JoinAndReceiveIndexTask=p.IntervalScheduler=p.InMemoryJSONEventBuffer=p.GlobalMetricReport=p.GetUserMediaError=p.FullJitterLimitedBackoff=p.FullJitterBackoffFactory=p.FullJitterBackoff=p.FinishGatheringICECandidatesTask=p.EventIngestionConfiguration=p.EventBufferConfiguration=p.DeviceSelection=p.DevicePixelRatioWindowSource=p.DefaultWebSocketAdapter=p.DefaultVolumeIndicatorAdapter=p.DefaultVideoTransformDevice=p.DefaultVideoTileFactory=p.DefaultVideoTileController=p.DefaultVideoTile=p.DefaultVideoStreamIndex=p.DefaultVideoStreamIdSet=p.DefaultVideoFrameProcessorTimer=p.DefaultVideoFrameProcessorPipeline=p.DefaultVideoElementResolutionMonitor=p.DefaultVideoCaptureAndEncodeParameter=p.DefaultUserAgentParser=p.DefaultTranscriptionController=p.DefaultTransceiverController=p.DefaultSimulcastUplinkPolicyForContentShare=p.DefaultSimulcastUplinkPolicy=p.DefaultSignalingClient=p.DefaultSigV4=p.DefaultSessionStateController=p.DefaultReconnectController=p.DefaultRealtimeController=p.DefaultPingPong=p.DefaultModality=p.DefaultMessagingSession=p.DefaultMeetingSession=p.DefaultMeetingReadinessChecker=p.DefaultMeetingEventReporter=p.DefaultMediaDeviceFactory=void 0,p.RedundantAudioEncoder=p.ReconnectionHealthPolicy=p.ReceiveVideoStreamIndexTask=p.ReceiveVideoInputTask=p.ReceiveRemoteVideoPauseResumeTask=p.ReceiveAudioInputTask=p.RealtimeVolumeIndicator=p.RealtimeState=p.RealtimeAttendeePositionInFrame=p.PromoteToPrimaryMeetingTask=p.PromiseQueue=p.PrefetchSortBy=p.PrefetchOn=p.PermissionDeniedError=p.ParallelGroupTask=p.POSTLogger=p.OverconstrainedError=p.OpenSignalingConnectionTask=p.OnceTask=p.NotReadableError=p.NotFoundError=p.None=p.NoVideoUplinkBandwidthPolicy=p.NoVideoDownlinkBandwidthPolicy=p.NoOpVideoFrameProcessor=p.NoOpVideoElementFactory=p.NoOpTask=p.NoOpMediaStreamBroker=p.NoOpLogger=p.NoOpEventReporter=p.NoOpDeviceController=p.NoOpDebugLogger=p.NoOpAudioVideoController=p.NScaleVideoUplinkBandwidthPolicy=p.MutableVideoPreferences=p.MultiLogger=p.MonitorTask=p.ModelSpecBuilder=p.MessagingSessionConfiguration=p.Message=p.MeetingSessionVideoAvailability=p.MeetingSessionURLs=p.MeetingSessionTURNCredentials=p.MeetingSessionStatusCode=p.MeetingSessionStatus=p.MeetingSessionLifecycleEventCondition=p.MeetingSessionLifecycleEvent=p.MeetingSessionCredentials=p.MeetingSessionConfiguration=p.MeetingReadinessCheckerConfiguration=void 0,p.VideoEncodingConcurrentSendersHealthPolicy=p.VideoCodecCapability=p.VideoAdaptiveProbePolicy=p.Versioning=p.UnusableAudioWarningConnectionHealthPolicy=p.TypeError=p.TranscriptionStatusType=p.TranscriptionStatus=p.TranscriptResult=p.TranscriptLanguageWithScore=p.TranscriptItemType=p.TranscriptItem=p.TranscriptEntity=p.TranscriptAlternative=p.Transcript=p.TimeoutTask=p.TimeoutScheduler=p.TaskStatus=p.TargetDisplaySize=p.SubscribeAndReceiveSubscribeAckTask=p.StreamMetricReport=p.Some=p.SingleNodeAudioTransformDevice=p.SimulcastVideoStreamIndex=p.SimulcastTransceiverController=p.SimulcastLayers=p.SimulcastContentShareTransceiverController=p.SignalingClientVideoSubscriptionConfiguration=p.SignalingClientSubscribe=p.SignalingClientJoin=p.SignalingClientEventType=p.SignalingClientEvent=p.SignalingClientConnectionRequest=p.SignalingAndMetricsConnectionMonitor=p.SetRemoteDescriptionTask=p.SetLocalDescriptionTask=p.SessionStateControllerTransitionResult=p.SessionStateControllerState=p.SessionStateControllerDeferPriority=p.SessionStateControllerAction=p.ServerSideNetworkAdaption=p.SerialGroupTask=p.SendingAudioFailureConnectionHealthPolicy=p.SendAndReceiveDataMessagesTask=p.SDPMediaSection=p.SDPCandidateType=p.SDP=p.RunnableTask=p.RedundantAudioRecoveryMetricReport=p.RedundantAudioEncoderWorkerCode=void 0,p.isVideoTransformDevice=p.isDestroyable=p.isAudioTransformDevice=p.ZLIBTextCompressor=p.WebSocketReadyState=p.WaitForAttendeePresenceTask=p.VoiceFocusTransformDevice=p.VoiceFocusDeviceTransformer=p.VideoTileState=p.VideoStreamDescription=p.VideoSource=p.VideoQualitySettings=p.VideoQualityAdaptationPreference=p.VideoPriorityBasedPolicyConfig=p.VideoPriorityBasedPolicy=p.VideoPreferences=p.VideoPreference=p.VideoOnlyTransceiverController=p.VideoLogEvent=p.VideoFxProcessor=p.VideoEncodingFramerateConnectionHealthPolicy=p.VideoEncodingCpuConnectionHealthPolicy=p.VideoEncodingConnectionHealthPolicyName=void 0,p.AllHighestVideoBandwidthPolicy=m(f(0x38bf5f74)).default,p.ApplicationMetadata=m(f(0x173a687a3)).default,p.AsyncScheduler=m(f(0x1158c4d3)).default,p.AttachMediaInputTask=m(f(0x1c7d226ae)).default,p.Attendee=m(f(0x977823e1)).default,p.AudioLogEvent=m(f(0x1e4aafe7d)).default,p.AudioProfile=m(f(0x1be31fc8b)).default,p.AudioVideoControllerState=m(f(0xb1f38e48)).default,p.BackgroundBlurStrength=m(f(0x11bb8da88)).default,p.BackgroundBlurVideoFrameProcessor=m(f(0x93cc4db7)).default,p.BackgroundFilterVideoFrameProcessor=m(f(0x217eb324b)).default,p.BackgroundReplacementVideoFrameProcessor=m(f(0x36f3f7d)).default,p.BaseConnectionHealthPolicy=m(f(0x21ae4c990)).default,p.BaseTask=m(f(0x113227692)).default,p.BitrateParameters=m(f(0x12d110f57)).default,p.CSPMonitor=m(f(0x13dedab0d)).default,p.CanvasVideoFrameBuffer=m(f(0x8cc00a0b)).default,p.CheckAudioConnectivityFeedback=m(f(0x4958dee5)).default,p.CheckAudioInputFeedback=m(f(0x3de98110)).default,p.CheckAudioOutputFeedback=m(f(0xdd5e551b)).default,p.CheckCameraResolutionFeedback=m(f(0x1dee20bef)).default,p.CheckContentShareConnectivityFeedback=m(f(0x23e9ed3f5)).default,p.CheckNetworkTCPConnectivityFeedback=m(f(0x21730e4e0)).default,p.CheckNetworkUDPConnectivityFeedback=m(f(0x11b30b010)).default,p.CheckVideoConnectivityFeedback=m(f(0x12ddfa430)).default,p.CheckVideoInputFeedback=m(f(0x15092d0fb)).default,p.CleanRestartedSessionTask=m(f(0x435994a8)).default,p.CleanStoppedSessionTask=m(f(0xbf52f99d)).default,p.ClientMetricReport=m(f(0x176b792fb)).default,p.ClientMetricReportDirection=m(f(0x243b8874c)).default,p.ClientMetricReportMediaType=m(f(0xebe235e1)).default,p.ClientVideoStreamReceivingReport=m(f(0x1ef8cd3d4)).default,p.ConnectionHealthData=m(f(0x18c985af)).default,p.ConnectionHealthPolicyConfiguration=m(f(0x1c17b91f1)).default,p.ConsoleLogger=m(f(0x12346a842)).default,p.ContentShareConstants=m(f(0x86facdd2)).default,p.ContentShareMediaStreamBroker=m(f(0x748652da)).default,p.CreatePeerConnectionTask=m(f(0x73c142bf)).default,p.CreateSDPTask=m(f(0x44174156)).default,p.DataMessage=m(f(0x200be574b)).default,p.DefaultActiveSpeakerDetector=m(f(0x1d159ee8)).default,p.DefaultActiveSpeakerPolicy=m(f(0x1055669a4)).default,p.DefaultAudioMixController=m(f(0x197b329a2)).default,p.DefaultAudioVideoController=m(f(0x11418f4a2)).default,p.DefaultAudioVideoFacade=m(f(0xf2ec2ef2)).default,p.DefaultBrowserBehavior=m(f(0x9a4430b2)).default,p.DefaultContentShareController=m(f(0x1d8dd5b36)).default,p.DefaultDeviceController=m(f(0x1db5b830a)).default,p.DefaultDevicePixelRatioMonitor=m(f(0x167bde784)).default,p.DefaultEventController=m(f(0x18e4b58c2)).default,p.DefaultMediaDeviceFactory=m(f(0xe13d341e)).default,p.DefaultMeetingEventReporter=m(f(0x164a41979)).default,p.DefaultMeetingReadinessChecker=m(f(0xcd9dd4aa)).default,p.DefaultMeetingSession=m(f(0x20de28c52)).default,p.DefaultMessagingSession=m(f(0xb40e079e)).default,p.DefaultModality=m(f(0x230534cc6)).default,p.DefaultPingPong=m(f(0x138580412)).default,p.DefaultRealtimeController=m(f(0x24bb989ba)).default,p.DefaultReconnectController=m(f(0x100e5c30c)).default,p.DefaultSessionStateController=m(f(0x1f3b38cfe)).default,p.DefaultSigV4=m(f(0x189468218)).default,p.DefaultSignalingClient=m(f(0x1bd55d3c4)).default,p.DefaultSimulcastUplinkPolicy=m(f(0x11b1e3853)).default,p.DefaultSimulcastUplinkPolicyForContentShare=m(f(0x13892dc9a)).default,p.DefaultTransceiverController=m(f(0x238ca30a)).default,p.DefaultTranscriptionController=m(f(0xf16d9918)).default,p.DefaultUserAgentParser=m(f(0x19f971fd8)).default,p.DefaultVideoCaptureAndEncodeParameter=m(f(0x17f8c39ba)).default,p.DefaultVideoElementResolutionMonitor=m(f(9224556e3)).default,p.DefaultVideoFrameProcessorPipeline=m(f(0x20f5ac25c)).default,p.DefaultVideoFrameProcessorTimer=m(f(0x86cb8dc3)).default,p.DefaultVideoStreamIdSet=m(f(0x5b4a3d7a)).default,p.DefaultVideoStreamIndex=m(f(0x151b9e5ee)).default,p.DefaultVideoTile=m(f(0xb747ec80)).default,p.DefaultVideoTileController=m(f(0x129e504bc)).default,p.DefaultVideoTileFactory=m(f(0x86c4609a)).default,p.DefaultVideoTransformDevice=m(f(0xd9718ba1)).default,p.DefaultVolumeIndicatorAdapter=m(f(0x20da5c30a)).default,p.DefaultWebSocketAdapter=m(f(0x947abb4a)).default,p.DevicePixelRatioWindowSource=m(f(0x2074869bd)).default,p.DeviceSelection=m(f(0x105f3de65)).default,p.EventBufferConfiguration=m(f(0x159d41205)).default,p.EventIngestionConfiguration=m(f(0x1077291f7)).default,p.FinishGatheringICECandidatesTask=m(f(0xa567a7ba)).default,p.FullJitterBackoff=m(f(0x14915840a)).default,p.FullJitterBackoffFactory=m(f(0x6e5ae8b8)).default,p.FullJitterLimitedBackoff=m(f(0x1e2c96978)).default,p.GetUserMediaError=m(f(0x19b2d97e8)).default,p.GlobalMetricReport=m(f(0x1bb68f383)).default,p.InMemoryJSONEventBuffer=m(f(0xfb871915)).default,p.IntervalScheduler=m(f(0xd475f02c)).default,p.JoinAndReceiveIndexTask=m(f(0x1b7bc4701)).default,p.LeaveAndReceiveLeaveAckTask=m(f(0x10a1c2ebe)).default,p.ListenForVolumeIndicatorsTask=m(f(0x8c94ea05)).default,p.Log=m(f(0x1b4d5ff2d)).default,p.LogLevel=m(f(0x19a5566fd)).default,p.MediaDeviceProxyHandler=m(f(0xf983d919)).default,p.MeetingEventsClientConfiguration=m(f(0x22e52699e)).default,p.MeetingFeatures=m(f(0xdbd73f5e)).default,p.MeetingReadinessCheckerConfiguration=m(f(0x24196756b)).default,p.MeetingSessionConfiguration=m(f(0x18e1c570f)).default,p.MeetingSessionCredentials=m(f(0x614ebca7)).default,p.MeetingSessionLifecycleEvent=m(f(0x15d56a943)).default,p.MeetingSessionLifecycleEventCondition=m(f(0xc7dc71d8)).default,p.MeetingSessionStatus=m(f(0x194415c85)).default,p.MeetingSessionStatusCode=m(f(0x11a9e868)).default,p.MeetingSessionTURNCredentials=m(f(0x15054ca8e)).default,p.MeetingSessionURLs=m(f(0xfce8eb05)).default,p.MeetingSessionVideoAvailability=m(f(0x1d61c1795)).default,p.Message=m(f(0xbb06a4cb)).default,p.MessagingSessionConfiguration=m(f(0x17056581)).default,p.ModelSpecBuilder=m(f(0x18769c7b5)).default,p.MonitorTask=m(f(0x1f9f2eb05)).default,p.MultiLogger=m(f(0x15964723e)).default,p.NScaleVideoUplinkBandwidthPolicy=m(f(0xf9210d7b)).default,p.NoOpAudioVideoController=m(f(0x191a3194b)).default,p.NoOpDebugLogger=m(f(0x1e9fbf678)).default,p.NoOpDeviceController=m(f(0xf371a16d)).default,p.NoOpEventReporter=m(f(0x91d5148b)).default,p.NoOpLogger=m(f(0xf05a6831)).default,p.NoOpMediaStreamBroker=m(f(0x203f02bb7)).default,p.NoOpTask=m(f(0x253700aaf)).default,p.NoOpVideoElementFactory=m(f(0x22bbb4e3f)).default,p.NoOpVideoFrameProcessor=m(f(0x84671e3f)).default,p.NoVideoDownlinkBandwidthPolicy=m(f(0x2c8ecde)).default,p.NoVideoUplinkBandwidthPolicy=m(f(0x143cfada8)).default,p.NotFoundError=m(f(0x4d06f54a)).default,p.NotReadableError=m(f(0x15ea31aea)).default,p.OnceTask=m(f(0x158630dfe)).default,p.OpenSignalingConnectionTask=m(f(0xc8b2a6fb)).default,p.OverconstrainedError=m(f(0x747ce3f3)).default,p.POSTLogger=m(f(0xd4e7af5f)).default,p.ParallelGroupTask=m(f(0x1a50cfb5)).default,p.PermissionDeniedError=m(f(0x1d643307b)).default,p.PrefetchOn=m(f(0xf0556527)).default,p.PrefetchSortBy=m(f(0x8b00d2e7)).default,p.PromiseQueue=m(f(0x172e1bd2a)).default,p.PromoteToPrimaryMeetingTask=m(f(0x8ef9a2fd)).default,p.RealtimeAttendeePositionInFrame=m(f(0x221e62772)).default,p.RealtimeState=m(f(0x1d68ccd4c)).default,p.RealtimeVolumeIndicator=m(f(0x69744cea)).default,p.ReceiveAudioInputTask=m(f(0x26b16a9c)).default,p.ReceiveRemoteVideoPauseResumeTask=m(f(0x141765a48)).default,p.ReceiveVideoInputTask=m(f(0x117aaca57)).default,p.ReceiveVideoStreamIndexTask=m(f(0x13a00d587)).default,p.ReconnectionHealthPolicy=m(f(0x61021f0c)).default,p.RedundantAudioEncoder=m(f(0x12d2b358b)).default,p.RedundantAudioEncoderWorkerCode=m(f(0x118a80d5b)).default,p.RedundantAudioRecoveryMetricReport=m(f(0x15a1c7c16)).default,p.RunnableTask=m(f(0x13eb8065e)).default,p.SDP=m(f(0x1a20e50ff)).default,p.SDPCandidateType=m(f(0x14f38fc30)).default,p.SDPMediaSection=m(f(0xed7d9b54)).default,p.SendAndReceiveDataMessagesTask=m(f(0x164fd248f)).default,p.SendingAudioFailureConnectionHealthPolicy=m(f(0x20ae9efa5)).default,p.SerialGroupTask=m(f(0x11bbef2ec)).default,p.ServerSideNetworkAdaption=m(f(0xf8b13aac)).default,p.SessionStateControllerAction=m(f(0x247795129)).default,p.SessionStateControllerDeferPriority=m(f(0x17ecda005)).default,p.SessionStateControllerState=m(f(0x1ac272bbc)).default,p.SessionStateControllerTransitionResult=m(f(0x15a2e95ed)).default,p.SetLocalDescriptionTask=m(f(0x23693b9e4)).default,p.SetRemoteDescriptionTask=m(f(0x1c9808277)).default,p.SignalingAndMetricsConnectionMonitor=m(f(0x202eb6fd7)).default,p.SignalingClientConnectionRequest=m(f(0x296cfbc0)).default,p.SignalingClientEvent=m(f(0x1e2f95c25)).default,p.SignalingClientEventType=m(f(0x216f98b8d)).default,p.SignalingClientJoin=m(f(0x1b32ed0f)).default,p.SignalingClientSubscribe=m(f(0x49608f19)).default,p.SignalingClientVideoSubscriptionConfiguration=m(f(0x1217c7f3f)).default,p.SimulcastContentShareTransceiverController=m(f(0xf1a8ac2)).default,p.SimulcastLayers=m(f(0x8f26277b)).default,p.SimulcastTransceiverController=m(f(0x4287252)).default,p.SimulcastVideoStreamIndex=m(f(0x25113bad6)).default,p.SingleNodeAudioTransformDevice=m(f(0xdeed8ee7)).default,p.StreamMetricReport=m(f(0x49c5e00)).default,p.SubscribeAndReceiveSubscribeAckTask=m(f(0x22ef5bfc)).default,p.TargetDisplaySize=m(f(0x195076b25)).default,p.TaskStatus=m(f(0xe2814d21)).default,p.TimeoutScheduler=m(f(0xa9a27686)).default,p.TimeoutTask=m(f(0xe6d64708)).default,p.Transcript=m(f(0x6bcf7aed)).default,p.TranscriptAlternative=m(f(0x235b3b0dc)).default,p.TranscriptEntity=m(f(0x10dd4ac72)).default,p.TranscriptItem=m(f(0x1b6467fba)).default,p.TranscriptItemType=m(f(0x22ea8d802)).default,p.TranscriptLanguageWithScore=m(f(0x176167e03)).default,p.TranscriptResult=m(f(0x147bf1250)).default,p.TranscriptionStatus=m(f(0x1b8f962c3)).default,p.TranscriptionStatusType=m(f(0x251900acb)).default,p.TypeError=m(f(0xdb2548f7)).default,p.UnusableAudioWarningConnectionHealthPolicy=m(f(0x1c6788b50)).default,p.Versioning=m(f(0x22a0f7c69)).default,p.VideoAdaptiveProbePolicy=m(f(0x171bbd0a0)).default,p.VideoCodecCapability=m(f(0x178bce6ff)).default,p.VideoEncodingConcurrentSendersHealthPolicy=m(f(0x201f8c5d2)).default,p.VideoEncodingConnectionHealthPolicyName=m(f(0x17469a88e)).default,p.VideoEncodingCpuConnectionHealthPolicy=m(f(0x1819749c9)).default,p.VideoEncodingFramerateConnectionHealthPolicy=m(f(0x2e16c318)).default,p.VideoFxProcessor=m(f(0x14b0f3819)).default,p.VideoLogEvent=m(f(0x15a7c8b4)).default,p.VideoOnlyTransceiverController=m(f(0x72848aa)).default,p.VideoPreference=m(f(0xdcca4e0f)).default,p.VideoPreferences=m(f(0xb8e111a8)).default,p.VideoPriorityBasedPolicy=m(f(0x1ea22295f)).default,p.VideoPriorityBasedPolicyConfig=m(f(0x206997fe9)).default,p.VideoQualityAdaptationPreference=m(f(0x5b9f0577)).default,p.VideoQualitySettings=m(f(0x170a3ef32)).default,p.VideoSource=m(f(0xe5d2d75f)).default,p.VideoStreamDescription=m(f(0x251ff39d9)).default,p.VideoTileState=m(f(0x1a64b5418)).default,p.VoiceFocusDeviceTransformer=m(f(0xbb137ed2)).default,p.VoiceFocusTransformDevice=m(f(0xa8bfd6e5)).default,p.WaitForAttendeePresenceTask=m(f(0x112462f64)).default,p.WebSocketReadyState=m(f(0x1a3216942)).default,p.ZLIBTextCompressor=m(f(0x1728c2fdd)).default;let _=f(0xb8e111a8);Object.defineProperty(p,"MutableVideoPreferences",{enumerable:!0,get:function(){return _.MutableVideoPreferences}});let w=f(0xab1ef933);Object.defineProperty(p,"Some",{enumerable:!0,get:function(){return w.Some}}),Object.defineProperty(p,"None",{enumerable:!0,get:function(){return w.None}}),Object.defineProperty(p,"Maybe",{enumerable:!0,get:function(){return w.Maybe}});let I=f(0x25cf5513);Object.defineProperty(p,"isAudioTransformDevice",{enumerable:!0,get:function(){return I.isAudioTransformDevice}});let k=f(0x24b1dc2b);Object.defineProperty(p,"isDestroyable",{enumerable:!0,get:function(){return k.isDestroyable}});let M=f(0x1a86248d4);Object.defineProperty(p,"isVideoTransformDevice",{enumerable:!0,get:function(){return M.isVideoTransformDevice}})},0x12346a842:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd));p.default=class{constructor(o,p=_.default.WARN){this.name=o,this.level=p}info(o){this.log(_.default.INFO,o)}warn(o){this.log(_.default.WARN,o)}error(o){this.log(_.default.ERROR,o)}debug(o){_.default.DEBUG<this.level||("string"==typeof o?this.log(_.default.DEBUG,o):o?this.log(_.default.DEBUG,o()):this.log(_.default.DEBUG,""+o))}setLogLevel(o){this.level=o}getLogLevel(){return this.level}log(o,p){if(o<this.level)return;let f=new Date().toISOString(),m=`${f} [${_.default[o]}] ${this.name} - ${p}`;switch(o){case _.default.ERROR:console.error(m);break;case _.default.WARN:console.warn(m);break;case _.default.DEBUG:console.debug(m.replace(/\\r\\n/g,`
`));break;case _.default.INFO:console.info(m)}}}},0x1b4d5ff2d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.sequenceNumber=o,this.message=p,this.timestampMs=f,this.logLevel=m}}},0x19a5566fd:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.LogLevel=void 0,(m=f=p.LogLevel||(p.LogLevel={}))[m.DEBUG=0]="DEBUG",m[m.INFO=1]="INFO",m[m.WARN=2]="WARN",m[m.ERROR=3]="ERROR",m[m.OFF=4]="OFF",p.default=f},0x15964723e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd));p.default=class{constructor(...o){this._loggers=o}info(o){for(let p of this._loggers)p.info(o)}warn(o){for(let p of this._loggers)p.warn(o)}error(o){for(let p of this._loggers)p.error(o)}debug(o){let p,f;for(let m of(f="string"==typeof o?o:o?()=>(p||(p=o()),p):""+o,this._loggers))m.debug(f)}setLogLevel(o){for(let p of this._loggers)p.setLogLevel(o)}getLogLevel(){for(let o of this._loggers)return o.getLogLevel();return _.default.OFF}}},0x1e9fbf678:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd)),w=m(f(0xf05a6831));p.default=class extends w.default{constructor(){super(_.default.DEBUG)}}},0xf05a6831:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd));p.default=class{constructor(o=_.default.OFF){this.level=o}info(o){}warn(o){}error(o){}debug(o){_.default.DEBUG<this.level||"string"!=typeof o&&o()}setLogLevel(o){this.level=o}getLogLevel(){return this.level}}},0xd4e7af5f:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xd475f02c)),I=_(f(0x1b4d5ff2d)),k=_(f(0x19a5566fd)),M=class POSTLogger{constructor(o){this.logCapture=[],this.lock=!1,this.sequenceNumber=0;const{url:p,batchSize:f=POSTLogger.BATCH_SIZE,intervalMs:m=POSTLogger.INTERVAL_MS,logLevel:_=k.default.WARN,metadata:w,headers:I}=o;this.url=p,this.batchSize=f,this.intervalMs=m,this.logLevel=_,this.metadata=w,this.headers=I,this.start(),this.eventListener=()=>{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in f.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in f.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(o){k.default.DEBUG<this.logLevel||("string"==typeof o?this.log(k.default.DEBUG,o):o?this.log(k.default.DEBUG,o()):this.log(k.default.DEBUG,""+o))}info(o){this.log(k.default.INFO,o)}warn(o){this.log(k.default.WARN,o)}error(o){this.log(k.default.ERROR,o)}setLogLevel(o){this.logLevel=o}getLogLevel(){return this.logLevel}getLogCaptureSize(){return this.logCapture.length}start(){this.addEventListener(),this.intervalScheduler=new w.default(this.intervalMs),this.intervalScheduler.start(()=>m(this,void 0,void 0,function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;let o=this.logCapture.slice(0,this.batchSize),p=this.makeRequestBody(o);try{let f=yield fetch(this.url,Object.assign({method:"POST",body:p},this.headers?{headers:this.headers}:{}));200===f.status&&(this.logCapture=this.logCapture.slice(o.length))}catch(o){console.warn("[POSTLogger] "+o.message)}finally{this.lock=!1}}))}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.removeEventListener();let p=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,p)}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.metadata=void 0,this.headers=void 0,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.batchSize=0,this.intervalMs=0,this.url=void 0})}makeRequestBody(o){return JSON.stringify(Object.assign(Object.assign({},this.metadata),{logs:o}))}log(o,p){if(o<this.logLevel)return;let f=Date.now();this.logCapture.push(new I.default(this.sequenceNumber,p,f,k.default[o])),this.sequenceNumber+=1}};p.default=M,M.BATCH_SIZE=85,M.INTERVAL_MS=2e3},0xe13d341e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf983d919));p.default=class{constructor(){this.isMediaDevicesSupported="u">typeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new _.default);throw Error("navigator.mediaDevices is not supported")}}},0xf983d919:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1158c4d3)),I=_(f(0xd475f02c)),k=class MediaDeviceProxyHandler{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(o,p,f)=>{if(!Reflect.has(o,p))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===p)return this.patchAddEventListener(o,p,f);else if("removeEventListener"===p)return this.patchRemoveEventListener(o,p,f)}let m=Reflect.get(o,p,f);return"function"==typeof m?m.bind(o):m},this.patchAddEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.add(f),this.scheduler||(this.scheduler=new I.default(MediaDeviceProxyHandler.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.delete(f),0===this.deviceChangeListeners.size&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null)}},this.pollDeviceLists=()=>m(this,void 0,void 0,function*(){let o=yield this.sortedDeviceList();this.devices&&(o.length!==this.devices.length||o.some((o,p)=>o.deviceId!==this.devices[p].deviceId))&&this.handleDeviceChangeEvent(),this.devices=o})}sortedDeviceList(){return m(this,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort((o,p)=>o.deviceId<p.deviceId?1:o.deviceId>p.deviceId?-1:0)})}handleDeviceChangeEvent(){for(let o of this.deviceChangeListeners)w.default.nextTick(()=>{if(this.deviceChangeListeners.has(o)){let p=new Event("devicechange");"function"==typeof o?o(p):o.handleEvent(p)}})}};p.default=k,k.INTERVAL_MS=1e3},0x203f02bb7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(o){return Promise.reject()}muteLocalAudioInputStream(){}unmuteLocalAudioInputStream(){}addMediaStreamBrokerObserver(o){}removeMediaStreamBrokerObserver(o){}}},0x4958dee5:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioConnectivityFeedback=void 0,(m=f=p.CheckAudioConnectivityFeedback||(p.CheckAudioConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.AudioInputRequestFailed=1]="AudioInputRequestFailed",m[m.AudioInputPermissionDenied=2]="AudioInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.AudioNotReceived=4]="AudioNotReceived",p.default=f},0x3de98110:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioInputFeedback=void 0,(m=f=p.CheckAudioInputFeedback||(p.CheckAudioInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0xdd5e551b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioOutputFeedback=void 0,(m=f=p.CheckAudioOutputFeedback||(p.CheckAudioOutputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",p.default=f},0x1dee20bef:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckCameraResolutionFeedback=void 0,(m=f=p.CheckCameraResolutionFeedback||(p.CheckCameraResolutionFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.ResolutionNotSupported=2]="ResolutionNotSupported",m[m.PermissionDenied=3]="PermissionDenied",p.default=f},0x23e9ed3f5:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckContentShareConnectivityFeedback=void 0,(m=f=p.CheckContentShareConnectivityFeedback||(p.CheckContentShareConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",m[m.TimedOut=3]="TimedOut",m[m.ConnectionFailed=4]="ConnectionFailed",p.default=f},0x21730e4e0:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkTCPConnectivityFeedback=void 0,(m=f=p.CheckNetworkTCPConnectivityFeedback||(p.CheckNetworkTCPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0x11b30b010:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkUDPConnectivityFeedback=void 0,(m=f=p.CheckNetworkUDPConnectivityFeedback||(p.CheckNetworkUDPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0x12ddfa430:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoConnectivityFeedback=void 0,(m=f=p.CheckVideoConnectivityFeedback||(p.CheckVideoConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.VideoInputRequestFailed=1]="VideoInputRequestFailed",m[m.VideoInputPermissionDenied=2]="VideoInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.VideoNotSent=4]="VideoNotSent",p.default=f},0x15092d0fb:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoInputFeedback=void 0,(m=f=p.CheckVideoInputFeedback||(p.CheckVideoInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0xcd9dd4aa:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x197b329a2)),I=_(f(0x9a4430b2)),k=_(f(0x1db5b830a)),M=_(f(0x1d643307b)),x=_(f(0x113227692)),O=_(f(0xe6d64708)),L=_(f(0x4958dee5)),B=_(f(0x3de98110)),U=_(f(0xdd5e551b)),$=_(f(0x1dee20bef)),q=_(f(0x23e9ed3f5)),Z=_(f(0x21730e4e0)),ee=_(f(0x11b30b010)),et=_(f(0x12ddfa430)),ei=_(f(0x15092d0fb)),er=_(f(0x24196756b));p.default=class DefaultMeetingReadinessChecker{constructor(o,p,f=new er.default){this.logger=o,this.meetingSession=p,this.configuration=f,this.browserBehavior=new I.default}static delay(o){return m(this,void 0,void 0,function*(){return new Promise(p=>setTimeout(p,o))})}checkAudioInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(o),yield this.meetingSession.audioVideo.stopAudioInput(),B.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${o}`),o instanceof M.default)return B.default.PermissionDenied;return B.default.Failed}})}checkAudioOutput(o,p,f=null){return m(this,void 0,void 0,function*(){try{let m=o?k.default.getIntrinsicDeviceId(o):"";if(yield this.playTone(m,this.configuration.audioOutputFrequency,f),yield p())return U.default.Succeeded;return U.default.Failed}catch(o){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${o}`),U.default.Failed}finally{yield this.stopTone()}})}playTone(o,p,f){return m(this,void 0,void 0,function*(){let m=this.configuration.audioOutputGain;this.oscillatorNode&&(yield this.stopTone()),this.audioContext=k.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=p,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);let _=this.audioContext.currentTime+.1;this.gainNode.gain.setValueAtTime(0,_),this.gainNode.gain.linearRampToValueAtTime(m,_+.1),this.oscillatorNode.start();let I=new w.default(this.logger),M=f||new Audio,x=this.destinationStream.stream;this.audioElement=M;try{this.browserBehavior.supportsSetSinkId()&&(yield I.bindAudioDevice({deviceId:o}))}catch(o){this.logger.error(`Failed to bind audio device: ${o}`)}try{yield I.bindAudioElement(M)}catch(o){this.logger.error(`Failed to bind audio element: ${o}`)}yield I.bindAudioStream(x)})}stopTone(){return m(this,void 0,void 0,function*(){if(!this.audioContext||!this.gainNode||!this.oscillatorNode||!this.destinationStream)return;let cleanup=()=>{this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null),this.oscillatorNode&&this.gainNode&&this.oscillatorNode.disconnect(this.gainNode),this.gainNode&&this.destinationStream&&this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null,this.audioElement=null},o=new Promise(o=>{this.oscillatorNode.addEventListener("ended",()=>{cleanup(),o()},{once:!0})}),p=this.configuration.audioOutputGain,f=this.audioContext.currentTime;this.gainNode.gain.setValueAtTime(p,f),this.gainNode.gain.linearRampToValueAtTime(0,f+.1),this.oscillatorNode.stop(f+.1+.1),yield o})}checkVideoInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(o),yield this.meetingSession.audioVideo.stopVideoInput(),ei.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Video check failed with error ${o}`),o instanceof M.default)return ei.default.PermissionDenied;return ei.default.Failed}})}checkCameraResolution(o,p,f){return m(this,void 0,void 0,function*(){let m;try{let _=k.default.getIntrinsicDeviceId(o),w={video:this.calculateVideoConstraint(_,p,f)};m=yield navigator.mediaDevices.getUserMedia(w)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${p} height ${f} failed with error ${o}`),o&&"OverconstrainedError"===o.name)return $.default.ResolutionNotSupported;if(o&&"NotAllowedError"===o.name)return $.default.PermissionDenied;return $.default.Failed}finally{m&&m.getTracks().forEach(function(o){o.stop()})}return $.default.Succeeded})}calculateVideoConstraint(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(p,f),_={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(_.deviceId=o,_.width=p,_.height=f):(_.deviceId={exact:o},_.width={exact:m[0]},_.height={exact:m[1]}),_}checkContentShareConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f=!1,_={contentShareDidStart:()=>{p=!0}},w={audioVideoDidStart:()=>{f=!0}};try{if(this.meetingSession.audioVideo.addObserver(w),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(_),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(o),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f&&p})),!f)return q.default.ConnectionFailed;return yield this.stopMeeting(),p?q.default.Succeeded:q.default.TimedOut}catch(o){if(this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${o}`),"NotAllowedError"===o.name)return q.default.PermissionDenied;return q.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(w),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(_)}})}checkAudioConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f={packetsReceived:0},_=this.meetingSession.audioVideo,w={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"inbound-rtp"===o.type&&("audio"===o.mediaType||"audio"===o.kind)&&(f.packetsReceived=o.packetsReceived)})}},attendeePresenceHandler=(o,f,m,_)=>{o===this.meetingSession.configuration.credentials.attendeeId&&f&&(p=!0)};try{yield _.startAudioInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${o}`),o instanceof M.default)return L.default.AudioInputPermissionDenied;return L.default.AudioInputRequestFailed}return(_.realtimeSubscribeToAttendeeIdPresence(attendeePresenceHandler),_.addObserver(w),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return this.isAudioConnectionSuccessful(p,f)})),_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),this.isAudioConnectionSuccessful(p,f)?L.default.Succeeded:L.default.AudioNotReceived):(_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.meetingSession.audioVideo.stopAudioInput(),L.default.ConnectionFailed)})}checkVideoConnectivity(o){return m(this,void 0,void 0,function*(){let p=this.meetingSession.audioVideo,f=0,_={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"outbound-rtp"===o.type&&("video"===o.mediaType||"video"===o.kind)&&(f=o.packetsSent)})}};try{yield p.startVideoInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${o}`),o instanceof M.default)return et.default.VideoInputPermissionDenied;return et.default.VideoInputRequestFailed}return(p.addObserver(_),yield this.startMeeting())?(p.startLocalVideoTile(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f>0})),yield p.stopVideoInput(),yield this.stopMeeting(),p.removeObserver(_),f<=0)?et.default.VideoNotSent:et.default.Succeeded:et.default.ConnectionFailed})}checkNetworkUDPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),ee.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=tcp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?ee.default.Succeeded:ee.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,ee.default.ConnectionFailed)})}checkNetworkTCPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),Z.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=udp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?Z.default.Succeeded:Z.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,Z.default.ConnectionFailed)})}startMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStart:()=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.start(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}stopMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStop:p=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.stop(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}executeTimeoutTask(o){return m(this,void 0,void 0,function*(){let p=!1,f=class extends x.default{constructor(o,p){super(o),this.waitDurationMs=p,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return m(this,void 0,void 0,function*(){for(;!this.isCancelled;){if(yield o()){p=!0;break}yield DefaultMeetingReadinessChecker.delay(this.waitDurationMs)}})}},_=new O.default(this.logger,new f(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield _.run(),p})}isAudioConnectionSuccessful(o,p){return o&&p.packetsReceived>0}}},0x24196756b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3,this.audioOutputFrequency=440,this.audioOutputGain=.1}}},0x20de28c52:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11418f4a2)),I=_(f(0xf2ec2ef2)),k=_(f(0x14915840a)),M=_(f(0x9a4430b2)),x=_(f(0x748652da)),O=_(f(0x1d8dd5b36)),L=_(f(0x13dedab0d)),B=f(0x24b1dc2b),U=_(f(0x18e4b58c2)),$=_(f(0x100e5c30c)),q=_(f(0x947abb4a));p.default=class{constructor(o,p,f,m){this._eventController=m,this._configuration=o,this._logger=p,this.checkBrowserSupportAndFeatureConfiguration(),L.default.addLogger(this._logger),L.default.register(),this._eventController||(this._eventController=new U.default(o,p)),f.eventController||(f.eventController=this.eventController),this.audioVideoController=new w.default(this._configuration,this._logger,new q.default(this._logger),f,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=f,this.logger.info(`MeetingFeatures: ${JSON.stringify(o.meetingFeatures)}`);const _=new x.default(this._logger);this.contentShareController=new O.default(_,new w.default(O.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new q.default(this._logger),_,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new I.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return m(this,void 0,void 0,function*(){B.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),B.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),B.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),L.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventController=void 0})}checkBrowserSupportAndFeatureConfiguration(){let o=new M.default,p=`${o.name()} ${o.majorVersion()} (${o.version()})`;if(this.logger.info(`browser is ${p}`),o.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${o.supportString()}.`),this._configuration.videoUplinkBandwidthPolicy)if(this.isSimulcastUplinkPolicy(this._configuration.videoUplinkBandwidthPolicy)){if(!o.hasChromiumWebRTC())throw Error("Simulcast is only supported on Chromium-based browsers");this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0}else this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1;this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(o.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${o.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast is only supported on Chromium-based browsers")),this._configuration.enableSVC&&(this._configuration.enableSVC=!1,this.logger.info("SVC is not successfully enabled since simulcast is enabled"))),this._configuration.enableSVC&&!o.supportsScalableVideoCoding()&&(this._configuration.enableSVC=!1,this.logger.info("SVC is only supported on Chromium-based browsers with version 111 or above"))}isSimulcastUplinkPolicy(o){return!!(o&&o.addObserver)}}},0xdbd73f5e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x170a3ef32));p.default=class MeetingFeatures{constructor(o=_.default.VideoResolutionHD,p=_.default.VideoResolutionFHD){this.videoMaxResolution=o,this.contentMaxResolution=p}clone(){return new MeetingFeatures(this.videoMaxResolution,this.contentMaxResolution)}}},0x18e1c570f:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1c17b91f1)),w=m(f(0x170a3ef32)),I=f(0xb79a45b7),k=m(f(0xdbd73f5e)),M=m(f(0x614ebca7)),x=m(f(0xfce8eb05));p.default=class{constructor(o,p){var f,m;if(this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new _.default,this.reconnectTimeoutMs=12e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1e3,this.reconnectLongBackOffMs=5e3,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.enableSVC=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1,this.meetingFeatures=new k.default,o){(o=I.toLowerCasePropertyNames(o)).meeting&&(o=o.meeting),this.meetingId=o.meetingid,this.externalMeetingId=o.externalmeetingid,this.urls=new x.default,this.urls.audioHostURL=o.mediaplacement.audiohosturl,this.urls.signalingURL=o.mediaplacement.signalingurl,this.urls.turnControlURL=o.mediaplacement.turncontrolurl,o.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=o.mediaplacement.eventingestionurl);const parseVideoResolution=(o,p)=>{switch(o){case"None":return w.default.VideoDisabled;case"HD":return w.default.VideoResolutionHD;case"FHD":return w.default.VideoResolutionFHD;case"UHD":return w.default.VideoResolutionUHD;default:return p}};if((null==(f=o.meetingfeatures)?void 0:f.video)!==void 0||(null==(m=o.meetingfeatures)?void 0:m.content)!==void 0){const p=void 0===o.meetingfeatures.video?"HD":o.meetingfeatures.video.maxresolution,f=void 0===o.meetingfeatures.content?"FHD":o.meetingfeatures.content.maxresolution;this.meetingFeatures=new k.default(parseVideoResolution(p,w.default.VideoResolutionHD),parseVideoResolution(f,w.default.VideoResolutionFHD))}}p&&((p=I.toLowerCasePropertyNames(p)).attendee&&(p=p.attendee),this.credentials=new M.default,this.credentials.attendeeId=p.attendeeid,this.credentials.externalUserId=p.externaluserid,this.credentials.joinToken=p.jointoken)}}},0x614ebca7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:"<redacted>"}}}},0x15d56a943:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEvent=void 0,(m=f=p.MeetingSessionLifecycleEvent||(p.MeetingSessionLifecycleEvent={}))[m.Connecting=0]="Connecting",m[m.Started=1]="Started",m[m.Stopped=2]="Stopped",p.default=f},0xc7dc71d8:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEventCondition=void 0,(m=f=p.MeetingSessionLifecycleEventCondition||(p.MeetingSessionLifecycleEventCondition={}))[m.ConnectingNew=0]="ConnectingNew",m[m.ReconnectingExisting=1]="ReconnectingExisting",m[m.StartedNew=2]="StartedNew",m[m.StartedExisting=3]="StartedExisting",m[m.StartedAfterReconnect=4]="StartedAfterReconnect",m[m.StoppedCleanly=5]="StoppedCleanly",m[m.StoppedWithFailure=6]="StoppedWithFailure",p.default=f},0x194415c85:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x252035ee7),w=m(f(0x11a9e868));p.default=class MeetingSessionStatus{constructor(o){this._statusCode=o}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:case w.default.VideoCallAtSourceCapacity:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.ICEGatheringTimeoutWorkaround:case w.default.ConnectionHealthReconnect:case w.default.RealtimeApiFailed:case w.default.TaskFailed:case w.default.NoAttendeePresent:case w.default.SignalingChannelClosedUnexpectedly:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case w.default.Left:case w.default.AudioJoinedFromAnotherDevice:case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.MeetingEnded:case w.default.AudioDisconnected:case w.default.TURNCredentialsForbidden:case w.default.SignalingBadRequest:case w.default.SignalingRequestFailed:case w.default.VideoCallAtSourceCapacity:case w.default.RealtimeApiFailed:case w.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.ICEGatheringTimeoutWorkaround:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.RealtimeApiFailed:case w.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case w.default.OK:return"Everything is OK so far.";case w.default.Left:return"The attendee left the meeting.";case w.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case w.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case w.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case w.default.MeetingEnded:return"The meeting ended.";case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:return"The audio connection failed.";case w.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case w.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:return"The signaling connection failed.";case w.default.ICEGatheringTimeoutWorkaround:return"Gathering ICE candidates timed out. In Chrome, this might indicate that the browser is in a bad state after reconnecting to VPN.";case w.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case w.default.RealtimeApiFailed:return"The real-time API failed. This status code might indicate that the callback you passed to the real-time API threw an exception.";case w.default.TaskFailed:return"The connection failed. See the error message for more details.";case w.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case w.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case w.default.NoAttendeePresent:return"The attendee was not present.";case w.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case w.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";case w.default.AudioVideoDisconnectedWhilePromoted:return"The client disconnected while promoted, which will automatically demote. The attendee must promote again to participate.";case w.default.AudioDisconnectAudio:return"The audio connection failed.";case w.default.SignalingChannelClosedUnexpectedly:return"The signaling channel was closed unexpectedly. This may be due to a network change or backend detected failure.";default:{let o=this._statusCode;throw Error(`Unhandled case: ${o}`)}}}static fromSignalFrame(o){return o.error&&o.error.status?this.fromSignalingStatus(o.error.status):o.type===_.SdkSignalFrame.Type.AUDIO_STATUS?o.audioStatus?this.fromAudioStatus(o.audioStatus.audioStatus):new MeetingSessionStatus(w.default.SignalingRequestFailed):o.type===_.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new MeetingSessionStatus(w.default.AudioVideoWasRemovedFromPrimaryMeeting):new MeetingSessionStatus(w.default.OK)}static fromAudioStatus(o){switch(o){case 200:return new MeetingSessionStatus(w.default.OK);case 301:return new MeetingSessionStatus(w.default.AudioJoinedFromAnotherDevice);case 302:return new MeetingSessionStatus(w.default.AudioDisconnectAudio);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);case 410:return new MeetingSessionStatus(w.default.MeetingEnded);case 411:return new MeetingSessionStatus(w.default.AudioAttendeeRemoved);case 500:return new MeetingSessionStatus(w.default.AudioInternalServerError);case 503:return new MeetingSessionStatus(w.default.AudioServiceUnavailable);default:if(2===Math.floor(o/100))return new MeetingSessionStatus(w.default.OK);return new MeetingSessionStatus(w.default.AudioDisconnected)}}static fromSignalingStatus(o){switch(o){case 206:return new MeetingSessionStatus(w.default.VideoCallSwitchToViewOnly);case 509:return new MeetingSessionStatus(w.default.VideoCallAtSourceCapacity);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);default:switch(Math.floor(o/100)){case 2:return new MeetingSessionStatus(w.default.OK);case 4:return new MeetingSessionStatus(w.default.SignalingBadRequest);case 5:return new MeetingSessionStatus(w.default.SignalingInternalServerError);default:return new MeetingSessionStatus(w.default.SignalingRequestFailed)}}}}},0x11a9e868:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionStatusCode=void 0,(m=f=p.MeetingSessionStatusCode||(p.MeetingSessionStatusCode={}))[m.OK=0]="OK",m[m.Left=1]="Left",m[m.AudioJoinedFromAnotherDevice=2]="AudioJoinedFromAnotherDevice",m[m.AudioAuthenticationRejected=3]="AudioAuthenticationRejected",m[m.AudioCallAtCapacity=4]="AudioCallAtCapacity",m[m.MeetingEnded=5]="MeetingEnded",m[m.AudioInternalServerError=6]="AudioInternalServerError",m[m.AudioServiceUnavailable=7]="AudioServiceUnavailable",m[m.AudioDisconnected=8]="AudioDisconnected",m[m.VideoCallSwitchToViewOnly=9]="VideoCallSwitchToViewOnly",m[m.VideoCallAtSourceCapacity=10]="VideoCallAtSourceCapacity",m[m.SignalingBadRequest=11]="SignalingBadRequest",m[m.SignalingInternalServerError=12]="SignalingInternalServerError",m[m.SignalingRequestFailed=13]="SignalingRequestFailed",m[m.SignalingChannelClosedUnexpectedly=14]="SignalingChannelClosedUnexpectedly",m[m.ICEGatheringTimeoutWorkaround=15]="ICEGatheringTimeoutWorkaround",m[m.ConnectionHealthReconnect=16]="ConnectionHealthReconnect",m[m.RealtimeApiFailed=17]="RealtimeApiFailed",m[m.TaskFailed=18]="TaskFailed",m[m.IncompatibleSDP=19]="IncompatibleSDP",m[m.TURNCredentialsForbidden=20]="TURNCredentialsForbidden",m[m.NoAttendeePresent=21]="NoAttendeePresent",m[m.AudioAttendeeRemoved=22]="AudioAttendeeRemoved",m[m.AudioVideoWasRemovedFromPrimaryMeeting=23]="AudioVideoWasRemovedFromPrimaryMeeting",m[m.AudioVideoDisconnectedWhilePromoted=24]="AudioVideoDisconnectedWhilePromoted",m[m.AudioDisconnectAudio=25]="AudioDisconnectAudio",p.default=f},0x15054ca8e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},0xfce8eb05:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this._audioHostURL=null,this._signalingURL=null,this._turnControlURL=null,this._eventIngestionURL=null,this.urlRewriter=o=>o,this.urlRewriterMulti=null}get audioHostURL(){return this.urlRewriter(this._audioHostURL)}set audioHostURL(o){this._audioHostURL=o}get signalingURL(){return this.urlRewriter(this._signalingURL)}set signalingURL(o){this._signalingURL=o}get turnControlURL(){return this.urlRewriter(this._turnControlURL)}set turnControlURL(o){this._turnControlURL=o}get eventIngestionURL(){return this.urlRewriter(this._eventIngestionURL)}set eventIngestionURL(o){this._eventIngestionURL=o}}},0x1d61c1795:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class MeetingSessionVideoAvailability{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(o){return this.remoteVideoAvailable===o.remoteVideoAvailable&&this.canStartLocalVideo===o.canStartLocalVideo}clone(){let o=new MeetingSessionVideoAvailability;return o.remoteVideoAvailable=this.remoteVideoAvailable,o.canStartLocalVideo=this.canStartLocalVideo,o}}},0xbb06a4cb:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.type=o,this.headers=p,this.payload=f}}},0xb40e079e:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x510b1d7f),I=_(f(0x14915840a)),k=_(f(0x13dedab0d)),M=_(f(0xbb06a4cb)),x=_(f(0x100e5c30c)),O=_(f(0x1158c4d3)),L=_(f(0x189468218)),B=_(f(0x947abb4a)),U=_(f(0x1a3216942)),$=_(f(0xf0556527));p.default=class{constructor(o,p,f,m,_){this.configuration=o,this.logger=p,this.webSocket=f,this.reconnectController=m,this.sigV4=_,this.observerQueue=new Set,this.webSocket||(this.webSocket=new B.default(this.logger)),this.reconnectController||(this.reconnectController=new x.default(o.reconnectTimeoutMs,new I.default(o.reconnectFixedWaitMs,o.reconnectShortBackoffMs,o.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new L.default(this.configuration.chimeClient)),k.default.addLogger(this.logger),k.default.register(),this.preBootstrapMessages=[]}addObserver(o){this.logger.info("adding messaging observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing messaging observer"),this.observerQueue.delete(o)}start(){return m(this,void 0,void 0,function*(){this.isClosed()?yield this.startConnecting(!1):this.logger.info("messaging session already started")})}stop(){this.isClosed()?this.logger.info("no existing messaging session needs closing"):(this.isClosing=!0,this.webSocket.close(),k.default.removeLogger(this.logger))}forEachObserver(o){for(let p of this.observerQueue)O.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.openEventHandler()}),this.webSocket.addEventListener("message",o=>{this.receiveMessageHandler(o.data)}),this.webSocket.addEventListener("close",o=>{this.closeEventHandler(o)}),this.webSocket.addEventListener("error",()=>{this.logger.error("WebSocket error")})}startConnecting(o){return m(this,void 0,void 0,function*(){return yield this.startConnectingInternal(o),yield new Promise((o,p)=>{this.bootstrapResolved=o,this.bootstrapRejected=p})})}startConnectingInternal(o){var p;return m(this,void 0,void 0,function*(){let f=this.configuration.endpointUrl;if(o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),o||void 0===f)try{if(this.configuration.chimeClient.getMessagingSessionEndpoint instanceof Function){let o=yield this.configuration.chimeClient.getMessagingSessionEndpoint();f=(null==(p=o.Endpoint)?void 0:p.Url)?o.Endpoint.Url:(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}else f=(yield this.configuration.chimeClient.send(new w.GetMessagingSessionEndpointCommand({}))).Endpoint.Url;this.logger.debug(`Messaging endpoint resolved to: ${f}`)}catch(p){this.logger.error(`Messaging Session failed to resolve endpoint: ${p}`);let o=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to get messaging session endpoint URL",bubbles:!1});this.closeEventHandler(o);return}let m=yield this.prepareWebSocketUrl(f);this.logger.info(`opening connection to ${m}`),o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(m,[],!0),this.forEachObserver(p=>{p.messagingSessionDidStartConnecting&&p.messagingSessionDidStartConnecting(o)}),this.setUpEventListeners()})}prepareWebSocketUrl(o){return m(this,void 0,void 0,function*(){let p=new Map;return p.set("userArn",[this.configuration.userArn]),p.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===$.default.Connect&&p.set("prefetch-on",[$.default.Connect]),this.configuration.prefetchSortBy&&p.set("prefetch-sort-by",[this.configuration.prefetchSortBy]),yield this.sigV4.signURL("GET","wss","chime",o,"/connect","",p)})}isClosed(){return this.webSocket.readyState()===U.default.None||this.webSocket.readyState()===U.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(o){try{let p=JSON.parse(o),f=p.Headers["x-amz-chime-event-type"],m=new M.default(f,p.Headers,p.Payload||null);if(this.isSessionEstablished||"SESSION_ESTABLISHED"!==f){if(!this.isSessionEstablished)return void this.preBootstrapMessages.push(m)}else{this.forEachObserver(o=>{o.messagingSessionDidStart&&o.messagingSessionDidStart()}),this.bootstrapResolved(),this.isSessionEstablished=!0;let o=this.preBootstrapMessages.length;for(let p=0;p<o;p++){let o=this.preBootstrapMessages.shift();this.forEachObserver(p=>{this.sendMessageToObserver(p,o)})}}this.forEachObserver(o=>{this.sendMessageToObserver(o,m)})}catch(o){this.logger.error(`Messaging parsing failed: ${o}`)}}sendMessageToObserver(o,p){o.messagingSessionDidReceiveMessage&&o.messagingSessionDidReceiveMessage(p)}retryConnection(){return this.reconnectController.retryWithBackoff(()=>m(this,void 0,void 0,function*(){yield this.startConnecting(!0)}),null)}closeEventHandler(o){this.logger.info(`WebSocket close: ${o.code} ${o.reason}`),4999!==o.code&&this.webSocket.destroy(),!this.isClosing&&this.canReconnect(o.code)&&this.retryConnection()||(this.isClosing=!1,this.isSessionEstablished?this.forEachObserver(p=>{p.messagingSessionDidStop&&p.messagingSessionDidStop(o)}):this.bootstrapRejected(o))}canReconnect(o){return 1001===o||1006===o||o>=1011&&o<=1014||o>4e3&&4002!==o&&4003!==o&&4401!==o}}},0x17056581:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xb79a45b7);p.default=class{constructor(o,p,f,m){this.userArn=o,this.messagingSessionId=p,this.endpointUrl=f,this.chimeClient=m,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.prefetchOn=void 0,this.prefetchSortBy=void 0,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){let o=new Uint32Array(1);return m.getRandomValues(o),o[0].toString()}}},0xf0556527:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Connect="connect",p.default=f},0x8b00d2e7:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).Unread="unread",m.LastMessageTimestamp="last-message-timestamp",p.default=f},0x230534cc6:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x86facdd2)),w=class DefaultModality{constructor(o){this._id=o}id(){return this._id}base(){return this._id?this._id.split(DefaultModality.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";let o=this._id.split(DefaultModality.MODALITY_SEPARATOR);return 2===o.length?o[1]:""}hasModality(o){return""!==o&&this.modality()===o}withModality(o){let p=new DefaultModality(this.base()+DefaultModality.MODALITY_SEPARATOR+o);return""===o||""===this.base()||new DefaultModality(p._id).modality()!==o?new DefaultModality(this.base()):p}};p.default=w,w.MODALITY_SEPARATOR=_.default.Modality[0],w.MODALITY_CONTENT=_.default.Modality.substring(1)},0x138580412:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1158c4d3)),w=m(f(0xd475f02c)),I=m(f(0x216f98b8d)),k=f(0x252035ee7),M=f(0xab1ef933);p.default=class{constructor(o,p,f){this.signalingClient=o,this.intervalMs=p,this.logger=f,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new w.default(this.intervalMs),this.pingId=0}addObserver(o){this.logger.info("adding a ping-pong observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing a ping-pong observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)_.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start(()=>{this.ping()}),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver(o=>{M.Maybe.of(o.didMissPongs).map(p=>p.bind(o)(this.consecutivePongsUnaccountedFor))})),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1|0;let o=k.SdkPingPongFrame.create();o.pingId=this.pingId,o.type=k.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(o),this.logger.debug(()=>`sent ping ${this.pingId}`)}pong(o){let p=k.SdkPingPongFrame.create();p.pingId=o,p.type=k.SdkPingPongType.PONG,this.signalingClient.pingPong(p)}handleSignalingClientEvent(o){switch(o.type){case I.default.WebSocketOpen:this.startPingInterval();break;case I.default.WebSocketFailed:case I.default.WebSocketError:this.logger.warn(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.WebSocketClosing:case I.default.WebSocketClosed:this.logger.info(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.ReceivedSignalFrame:if(o.message.type!==k.SdkSignalFrame.Type.PING_PONG)break;if(o.message.pingPong.type===k.SdkPingPongType.PONG){let p,f=o.message.pingPong.pingId;if(f!==this.pingId){this.logger.warn(`unexpected ping id ${f} (expected ${this.pingId})`);break}if(this.consecutivePongsUnaccountedFor=0,"number"==typeof o.message.timestampMs)p=o.message.timestampMs;else break;this.logger.debug(()=>`received pong ${f} with timestamp ${p}`);let m=o.timestampMs-this.pingTimestampLocalMs,_=Math.round(p-m/2),w=this.pingTimestampLocalMs-_;this.logger.info(`local clock skew estimate=${w}ms from ping-pong time=${m}ms`),this.forEachObserver(o=>{M.Maybe.of(o.didReceivePong).map(p=>p.bind(o)(f,w,m))})}else this.pong(o.message.pingPong.pingId)}}}},0x24bb989ba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf16d9918)),w=f(0xb79a45b7),I=m(f(0x1d68ccd4c)),k=m(f(0x69744cea));p.default=class{constructor(o,p){this.mediaStreamBroker=o,this.state=new I.default,this._transcriptionController=p||new _.default(this)}realtimeSetLocalAttendeeId(o,p){this.state.localAttendeeId=o,this.state.localExternalUserId=p}realtimeSetAttendeeIdPresence(o,p,f,m,_){try{for(let w of(p&&(this.state.attendeeIdToExternalUserId[o]=f),this.state.attendeeIdChangesCallbacks))w(o,p,f,m,_)}catch(o){this.onError(o)}}realtimeSubscribeToAttendeeIdPresence(o){try{this.state.attendeeIdChangesCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToAttendeeIdPresence(o){try{let p=this.state.attendeeIdChangesCallbacks.indexOf(o);-1!==p&&this.state.attendeeIdChangesCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSetCanUnmuteLocalAudio(o){try{if(this.state.canUnmute===o)return;for(let p of(this.state.canUnmute=o,this.state.setCanUnmuteLocalAudioCallbacks))p(o)}catch(o){this.onError(o)}}realtimeSubscribeToSetCanUnmuteLocalAudio(o){try{this.state.setCanUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){try{let p=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.setCanUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{for(let o of(this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!0)}catch(o){this.onError(o)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{for(let o of(this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!1);return!0}catch(o){return this.onError(o),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){try{let p=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(o,p){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(o)||(this.state.volumeIndicatorCallbacks[o]=[]),this.state.volumeIndicatorCallbacks[o].push(p),this.sendVolumeIndicatorChange(o,!0,!0,!0,this.state.attendeeIdToExternalUserId[o])}catch(o){this.onError(o)}}realtimeUnsubscribeFromVolumeIndicator(o,p){if(this.state.volumeIndicatorCallbacks[o])if(p){let f=this.state.volumeIndicatorCallbacks[o].indexOf(p);f>=0&&this.state.volumeIndicatorCallbacks[o].splice(f,1)}else delete this.state.volumeIndicatorCallbacks[o]}realtimeUpdateVolumeIndicator(o,p,f,m,_){try{f=this.applyLocalMuteOverride(o,f);let w=this.getVolumeIndicatorState(o),I=!1,k=!1,M=!1;null!==f&&w.muted!==f&&(w.muted=f,k=!0,w.muted&&0!==w.volume&&(w.volume=0,I=!0)),w.muted||null===p||(w.volume!==p&&(w.volume=p,I=!0),null===w.muted&&(w.muted=!1,k=!0)),null!==m&&w.signalStrength!==m&&(w.signalStrength=m,M=!0),this.sendVolumeIndicatorChange(o,I,k,M,_)}catch(o){this.onError(o)}}realtimeSubscribeToLocalSignalStrengthChange(o){try{if(this.state.localSignalStrengthChangeCallbacks.push(o),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(o){this.onError(o)}}realtimeUnsubscribeToLocalSignalStrengthChange(o){try{let p=this.state.localSignalStrengthChangeCallbacks.indexOf(o);-1!==p&&this.state.localSignalStrengthChangeCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSubscribeToSendDataMessage(o){try{this.state.sendDataMessageCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeFromSendDataMessage(o){try{let p=this.state.sendDataMessageCallbacks.indexOf(o);-1!==p&&this.state.sendDataMessageCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSendDataMessage(o,p,f){try{for(let m of this.state.sendDataMessageCallbacks)m(o,p,f)}catch(o){this.onError(o)}}realtimeSubscribeToReceiveDataMessage(o,p){try{this.state.receiveDataMessageCallbacks.has(o)?this.state.receiveDataMessageCallbacks.get(o).push(p):this.state.receiveDataMessageCallbacks.set(o,[p])}catch(o){this.onError(o)}}realtimeUnsubscribeFromReceiveDataMessage(o){try{this.state.receiveDataMessageCallbacks.delete(o)}catch(o){this.onError(o)}}realtimeReceiveDataMessage(o){try{w.iterateEvery(this.state.receiveDataMessageCallbacks.get(o.topic),p=>{p(o)})}catch(o){Promise.reject(o)}}realtimeSubscribeToFatalError(o){try{this.state.fatalErrorCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToFatalError(o){try{let p=this.state.fatalErrorCallbacks.indexOf(o);-1!==p&&this.state.fatalErrorCallbacks.splice(p,1)}catch(o){this.onError(o)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(o){o?this.mediaStreamBroker.unmuteLocalAudioInputStream():this.mediaStreamBroker.muteLocalAudioInputStream()}applyLocalMuteOverride(o,p){let f=this.state.localAttendeeId,m=this.state.muted;return o===f&&"activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio?m:p}sendVolumeIndicatorChange(o,p,f,m,_){if(this.sendLocalSignalStrengthChange(o,m),!this.state.volumeIndicatorCallbacks.hasOwnProperty(o))return;let w=this.getVolumeIndicatorState(o),I=new k.default;if(p&&(I.volume=w.volume),f&&(I.muted=w.muted),m&&(I.signalStrength=w.signalStrength),!this.stateIsEmpty(I))for(let p of this.state.volumeIndicatorCallbacks[o])p(o,I.volume,I.muted,I.signalStrength,_)}sendLocalSignalStrengthChange(o,p){if(!p||o!==this.state.localAttendeeId)return;let f=this.getVolumeIndicatorState(o).signalStrength;if(null!==f)for(let o of this.state.localSignalStrengthChangeCallbacks)o(f)}getVolumeIndicatorState(o){return this.state.volumeIndicatorState.hasOwnProperty(o)||(this.state.volumeIndicatorState[o]=new k.default),this.state.volumeIndicatorState[o]}stateIsEmpty(o){return null===o.volume&&null===o.muted&&null===o.signalStrength}onError(o){try{for(let p of this.state.fatalErrorCallbacks)p(o)}catch(p){try{console.error(o),console.error(p)}catch{}}}}},0x221e62772:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},0x1d68ccd4c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}}},0x69744cea:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},0x100e5c30c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xa9a27686));p.default=class DefaultReconnectController{constructor(o,p){this.reconnectTimeoutMs=o,this.backoffPolicy=p,this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this._isFirstConnection=!0,this.backoffTimer=null,this.backoffCancel=null,this.reset()}timeSpentReconnectingMs(){return this.firstConnectionAttempted?Date.now()-this.firstConnectionAttemptTimestampMs:0}hasPastReconnectDeadline(){return Date.now()-this.lastActiveTimestampMs>=this.reconnectTimeoutMs||this.timeSpentReconnectingMs()>=this.reconnectTimeoutMs}reset(){this.cancel(),this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this.backoffPolicy.reset()}startedConnectionAttempt(o){this._isFirstConnection=o,this.firstConnectionAttempted||(this.firstConnectionAttempted=!0,this.firstConnectionAttemptTimestampMs=Date.now())}hasStartedConnectionAttempt(){return this.firstConnectionAttempted}isFirstConnection(){return this._isFirstConnection}disableReconnect(){this.shouldReconnect=!1}enableRestartPeerConnection(){this.onlyRestartPeerConnection=!0}cancel(){this.disableReconnect(),this.backoffTimer&&(this.backoffTimer.stop(),this.backoffCancel&&(this.backoffCancel(),this.backoffCancel=null))}retryWithBackoff(o,p){let f=this.shouldReconnect&&!this.hasPastReconnectDeadline();return f&&(this.backoffCancel=p,this.backoffTimer=new _.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start(()=>{this.backoffCancel=null,o()})),f}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new DefaultReconnectController(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(o){this.lastActiveTimestampMs=o}}},0x12d2b358b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class RedundantAudioEncoder{constructor(){this.maxRedPacketSizeBytes=1024,this.maxAudioPayloadSizeBytes=1e3,this.maxRedTimestampOffset=16384,this.redHeaderSizeBytes=4,this.redLastHeaderSizeBytes=1,this.redPacketizationTime=960,this.redPacketDistance=2,this.maxRedEncodings=2,this.redMaxRecoveryDistance=this.redPacketDistance*this.maxRedEncodings+1,this.maxEncodingHistorySize=10,this.numRedundantEncodings=0,this.redundancyEnabled=!0,this.lossReportInterval=24e4,this.maxOutOfOrderPacketDistance=16,this.OPUS_BAD_ARG=-1,this.OPUS_INVALID_PACKET=-4,this.OPUS_MAX_OPUS_FRAMES=48,this.OPUS_MAX_FRAME_SIZE_BYTES=1275,this.encodingHistory=[],this.opusPayloadType=0,this.redPayloadType=0,this.initializePacketLogs()}static initializeWorker(){RedundantAudioEncoder.log("Initializing RedundantAudioEncoder");let o=new RedundantAudioEncoder;self.RTCRtpScriptTransformer&&(self.onrtctransform=p=>{"SenderTransform"===p.transformer.options.type?o.setupSenderTransform(p.transformer.readable,p.transformer.writable):"ReceiverTransform"===p.transformer.options.type?o.setupReceiverTransform(p.transformer.readable,p.transformer.writable):"PassthroughTransform"===p.transformer.options.type&&o.setupPassthroughTransform(p.transformer.readable,p.transformer.writable)}),self.onmessage=p=>{"StartRedWorker"===p.data.msgType?(o.setupSenderTransform(p.data.send.readable,p.data.send.writable),o.setupReceiverTransform(p.data.receive.readable,p.data.receive.writable)):"PassthroughTransform"===p.data.msgType?(o.setupPassthroughTransform(p.data.send.readable,p.data.send.writable),o.setupPassthroughTransform(p.data.receive.readable,p.data.receive.writable)):"RedPayloadType"===p.data.msgType?o.setRedPayloadType(p.data.payloadType):"OpusPayloadType"===p.data.msgType?o.setOpusPayloadType(p.data.payloadType):"UpdateNumRedundantEncodings"===p.data.msgType?o.setNumRedundantEncodings(p.data.numRedundantEncodings):"Enable"===p.data.msgType?o.setRedundancyEnabled(!0):"Disable"===p.data.msgType&&o.setRedundancyEnabled(!1)}}static log(o){RedundantAudioEncoder.shouldLog&&self.postMessage({type:"REDWorkerLog",log:`[AudioRed] ${o}`})}static getNumRedundantEncodingsForPacketLoss(o){let p=0,f=!1;return o<=8?p=0:o<=18?p=1:o<=75?p=2:(p=0,f=!0),[p,f]}setupPassthroughTransform(o,p){RedundantAudioEncoder.log("Setting up passthrough transform"),o.pipeTo(p)}setupSenderTransform(o,p){RedundantAudioEncoder.log("Setting up sender RED transform");let f=new TransformStream({transform:this.senderTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setupReceiverTransform(o,p){RedundantAudioEncoder.log("Setting up receiver RED transform");let f=new TransformStream({transform:this.receivePacketLogTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setRedPayloadType(o){this.redPayloadType=o,RedundantAudioEncoder.log(`red payload type set to ${this.redPayloadType}`)}setOpusPayloadType(o){this.opusPayloadType=o,RedundantAudioEncoder.log(`opus payload type set to ${this.opusPayloadType}`)}setNumRedundantEncodings(o){this.numRedundantEncodings=o,this.numRedundantEncodings>this.maxRedEncodings&&(this.numRedundantEncodings=this.maxRedEncodings),RedundantAudioEncoder.log(`Updated numRedundantEncodings to ${this.numRedundantEncodings}`)}setRedundancyEnabled(o){this.redundancyEnabled=o,RedundantAudioEncoder.log(`redundancy ${this.redundancyEnabled?"enabled":"disabled"}`)}enqueueAudioFrameIfPayloadSizeIsValid(o,p){o.data.byteLength>this.maxAudioPayloadSizeBytes||p.enqueue(o)}senderTransform(o,p){if(o.getMetadata().payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let f=this.getPrimaryPayload(o.timestamp,o.data);if(!f)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.encode(o.timestamp,f);m&&(o.data=m),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}getPrimaryPayload(o,p){let f=this.splitEncodings(o,p);return!f||f.length<1?null:f[f.length-1].payload}splitEncodings(o,p,f=!1,m){let _=new DataView(p),w=_.byteLength,I=0,k=0,M=0,x=0,O=!1,L=[],B=[],U=[];for(;w>0;){if(O=(128&_.getUint8(x))==0){if((127&_.getUint8(x))!==this.opusPayloadType||(I+=this.redLastHeaderSizeBytes,k+=this.redLastHeaderSizeBytes,I>=_.byteLength))return null;M=_.byteLength-I;break}{if(w<this.redHeaderSizeBytes)return null;let p=((3&_.getUint8(x+2))<<8)+_.getUint8(x+3);B.push(p);let f=o-(_.getUint16(x+1)>>2);U.push(f),I+=p+this.redHeaderSizeBytes,k+=this.redHeaderSizeBytes,x+=this.redHeaderSizeBytes,w-=this.redHeaderSizeBytes}}if(!O)return void 0!==m?(L.push({payload:p,isRedundant:!1,seq:m}),L):null;let $=k;for(let o=0;o<U.length;o++){let p=new ArrayBuffer(B[o]);new Uint8Array(p).set(new Uint8Array(_.buffer,$,B[o]),0);let m={timestamp:U[o],payload:p,isRedundant:!0};f&&(m.hasFec=this.opusPacketHasFec(new DataView(p),p.byteLength)),L.push(m),$+=B[o]}let q=_.byteLength-M,Z=new ArrayBuffer(M);new Uint8Array(Z).set(new Uint8Array(_.buffer,q,M),0);let ee={timestamp:o,payload:Z,isRedundant:!1,seq:m};return f&&(ee.hasFec=this.opusPacketHasFec(new DataView(Z),Z.byteLength)),L.push(ee),L}encode(o,p){let f=p.byteLength;if(0===f||f>=this.maxRedPacketSizeBytes||f>=this.maxAudioPayloadSizeBytes)return null;let m=this.numRedundantEncodings,_=this.redLastHeaderSizeBytes,w=f,I=this.maxAudioPayloadSizeBytes-f-_,k=[],M=[];if(this.redundancyEnabled){let p=this.uint32WrapAround(o-this.redPacketizationTime*this.redPacketDistance);for(let f=0;f<m&&!(this.uint32WrapAround(o-p)>=this.maxRedTimestampOffset);f++){let o=p,f=this.encodingHistory.find(p=>p.timestamp===o);if(f||(o=this.uint32WrapAround(p-this.redPacketizationTime),f=this.encodingHistory.find(p=>p.timestamp===o)),f){let o=f.payload.byteLength;if(I<this.redHeaderSizeBytes+o)break;I-=this.redHeaderSizeBytes+o,_+=this.redHeaderSizeBytes,w+=o,k.unshift(f.timestamp),M.unshift(f.payload)}p-=this.redPacketizationTime*this.redPacketDistance,p=this.uint32WrapAround(p)}}let x=new ArrayBuffer(_+w),O=new DataView(x),L=0;for(let p=0;p<k.length;p++){let f=o-k[p];O.setUint8(L,128|this.opusPayloadType),O.setUint16(L+1,f<<2|M[p].byteLength>>8),O.setUint8(L+3,255&M[p].byteLength),L+=this.redHeaderSizeBytes}O.setUint8(L,this.opusPayloadType),L+=this.redLastHeaderSizeBytes;let B=new Uint8Array(x);for(let o=0;o<M.length;o++)B.set(new Uint8Array(M[o]),L),L+=M[o].byteLength;return(B.set(new Uint8Array(p),L),(L+=p.byteLength)!==_+w)?null:(this.updateEncodingHistory(o,p),x)}updateEncodingHistory(o,p){for(let p of this.encodingHistory){let f=this.redPacketizationTime*this.redMaxRecoveryDistance;if(o-p.timestamp>=f)this.encodingHistory.shift();else break}let f=new DataView(p);(this.opusPacketIsCeltOnly(f)||this.opusPacketHasVoiceActivity(f,f.byteLength)>0)&&(this.encodingHistory.length+1>this.maxEncodingHistorySize&&(this.encodingHistory.length=0),this.encodingHistory.push({timestamp:o,payload:p}))}initializePacketLogs(){let o=this.maxOutOfOrderPacketDistance+this.redMaxRecoveryDistance;this.primaryPacketLog={window:Array(o),index:0,windowSize:o},this.redRecoveryLog={window:Array(o),index:0,windowSize:o},this.fecRecoveryLog={window:Array(o),index:0,windowSize:o},this.totalAudioPacketsExpected=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}receivePacketLogTransform(o,p){let f=o.getMetadata();if(f.payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.splitEncodings(o.timestamp,o.data,!0,f.sequenceNumber);if(!m)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);for(let o=m.length-1;o>=0;o--)this.updateLossStats(m[o])&&(this.updateRedStats(m[o]),this.updateFecStats(m[o]));this.maybeReportLossStats(f.synchronizationSource,m[m.length-1].timestamp),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}updateLossStats(o){if(o.isRedundant)return!0;let p=o.timestamp,f=o.seq;if(0===this.totalAudioPacketsExpected)return this.totalAudioPacketsExpected=1,this.newestSequenceNumber=f,this.addTimestamp(this.primaryPacketLog,p),!0;let m=this.int16(f-this.newestSequenceNumber);return!(m<-this.maxOutOfOrderPacketDistance)&&(m<0?this.hasTimestamp(this.primaryPacketLog,p)||(this.totalAudioPacketsLost>0&&this.totalAudioPacketsLost--,this.addTimestamp(this.primaryPacketLog,p),this.removeFromRecoveryWindows(p)):m>1&&(this.totalAudioPacketsLost+=m-1),m>0&&(this.totalAudioPacketsExpected+=m,this.newestSequenceNumber=o.seq,this.addTimestamp(this.primaryPacketLog,p)),!0)}updateRedStats(o){if(!o.isRedundant||0===this.totalAudioPacketsLost)return;let p=o.timestamp;!this.hasTimestamp(this.primaryPacketLog,p)&&(this.hasTimestamp(this.redRecoveryLog,p)||(this.totalAudioPacketsRecoveredRed++,this.addTimestamp(this.redRecoveryLog,p)),this.removeTimestamp(this.fecRecoveryLog,p)&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--)}updateFecStats(o){if(!o.hasFec||0===this.totalAudioPacketsLost)return;let p=o.timestamp-this.redPacketizationTime;this.hasTimestamp(this.primaryPacketLog,p)||this.hasTimestamp(this.redRecoveryLog,p)||this.hasTimestamp(this.fecRecoveryLog,p)||(this.totalAudioPacketsRecoveredFec++,this.addTimestamp(this.fecRecoveryLog,p))}maybeReportLossStats(o,p){void 0===p||p-this.lastLossReportTimestamp<this.lossReportInterval||(RedundantAudioEncoder.shouldReportStats&&self.postMessage({type:"RedundantAudioEncoderStats",ssrc:o,totalAudioPacketsLost:this.totalAudioPacketsLost,totalAudioPacketsExpected:this.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.totalAudioPacketsRecoveredFec}),this.lastLossReportTimestamp=p)}addTimestamp(o,p){void 0!==p&&(o.window[o.index]=p,o.index=(o.index+1)%o.windowSize)}hasTimestamp(o,p){return!!o.window.find(o=>o===p)}removeTimestamp(o,p){let f=o.window.indexOf(p);return f>=0&&(o.window[f]=void 0,!0)}removeFromRecoveryWindows(o){let p=this.removeTimestamp(this.redRecoveryLog,o);p&&this.totalAudioPacketsRecoveredRed>0&&this.totalAudioPacketsRecoveredRed--,(p=this.removeTimestamp(this.fecRecoveryLog,o))&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--}uint32WrapAround(o){let p=o;return o>=0x100000000?p=o-0x100000000:o<0&&(p=0x100000000+o),p}int16(o){return o<<16>>16}opusPacketIsCeltOnly(o){return!!(128&o.getUint8(0))}opusPacketGetSamplesPerFrame(o,p){let f,m;return p=Math.min(Math.max(p=Math.round(p),-0x100000000),0xffffffff),this.opusPacketIsCeltOnly(o)?(m=o.getUint8(0)>>3&3,f=(p<<m)/400):f=(96&o.getUint8(0))==96?8&o.getUint8(0)?p/50:p/100:3==(m=o.getUint8(0)>>3&3)?60*p/1e3:(p<<m)/100,f}opusNumSilkFrames(o){let p=this.opusPacketGetSamplesPerFrame(o,48e3)/48;switch(p<10&&(p=10),p){case 10:case 20:return 1;case 40:return 2;case 60:return 3;default:return 0}}opusPacketGetNumChannels(o){return 4&o.getUint8(0)?2:1}opusParseSize(o,p,f,m){return f<1?(m[0]=-1,-1):252>o.getUint8(p)?(m[0]=o.getUint8(p),1):f<2?(m[0]=-1,-1):(m[0]=4*o.getUint8(p+1)+o.getUint8(p),2)}opusPacketParseImpl(o,p,f,m,_,w,I,k){let M,x;if(!w||p<0)return this.OPUS_BAD_ARG;if(0===p)return this.OPUS_INVALID_PACKET;let O=0,L=!1,B=o.getUint8(0);m&&(m[0]=B);let U=p-1,$=1,q=U;switch(3&B){case 0:M=1;break;case 1:if(M=2,L=!0,!f){if(1&U)return this.OPUS_INVALID_PACKET;q=U/2,w[0][0]=q}break;case 2:if(M=2,x=this.opusParseSize(o,$,U,w[0]),U-=x,w[0][0]<0||w[0][0]>U)return this.OPUS_INVALID_PACKET;$+=x,q=U-w[0][0];break;default:if(U<1)return this.OPUS_INVALID_PACKET;let Z=o.getUint8($++);if(--U,(M=63&Z)<=0||this.opusPacketGetSamplesPerFrame(o,48e3)*M>5760)return this.OPUS_INVALID_PACKET;if(64&Z){let p,f;do{if(U<=0)return this.OPUS_INVALID_PACKET;p=o.getUint8($++),--U,U-=f=255===p?254:p,O+=f}while(255===p)}if(U<0)return this.OPUS_INVALID_PACKET;if(L=!(128&Z)){if(!f){if((q=Math.trunc(U/M))*M!==U)return this.OPUS_INVALID_PACKET;for(let o=0;o<M-1;++o)w[o][0]=q}}else{q=U;for(let p=0;p<M-1;++p){if(x=this.opusParseSize(o,$,U,w[p]),U-=x,w[p][0]<0||w[p][0]>U)return this.OPUS_INVALID_PACKET;$+=x,q-=x+w[p][0]}if(q<0)return this.OPUS_INVALID_PACKET}}if(f){if(x=this.opusParseSize(o,$,U,w[M-1]),U-=x,w[M-1][0]<0||w[M-1][0]>U)return this.OPUS_INVALID_PACKET;if($+=x,L){if(w[M-1][0]*M>U)return this.OPUS_INVALID_PACKET;for(let o=0;o<M-1;++o)w[o][0]=w[M-1][0]}else if(!(x+w[M-1][0]<=q))return this.OPUS_INVALID_PACKET}else{if(q>this.OPUS_MAX_FRAME_SIZE_BYTES)return this.OPUS_INVALID_PACKET;w[M-1][0]=q}I&&(I[0]=$);for(let o=0;o<M;++o)_&&(_[o][0]=$),$+=w[o][0];return k&&(k[0]=$+O),M}opusPacketParse(o,p,f,m,_,w){return this.opusPacketParseImpl(o,p,!1,f,m,_,w,null)}opusPacketHasVoiceActivity(o,p){if(!o||p<=0)return 0;if(this.opusPacketIsCeltOnly(o))return -1;let f=this.opusNumSilkFrames(o);if(0===f)return -1;let m=Array(this.OPUS_MAX_OPUS_FRAMES),_=Array(this.OPUS_MAX_OPUS_FRAMES);for(let o=0;o<this.OPUS_MAX_OPUS_FRAMES;++o)m[o]=[void 0],_[o]=[void 0];let w=this.opusPacketParse(o,p,null,m,_,null);if(w<0)return -1;for(let p=0;p<w;++p)if(!(_[p][0]<1)&&(o.getUint8(m[p][0])>>8-f||2===this.opusPacketGetNumChannels(o)&&o.getUint8(m[p][0])<<f+1>>8-f))return 1;return 0}opusPacketHasFec(o,p){if(!o||p<=0||this.opusPacketIsCeltOnly(o))return!1;let f=Array(this.OPUS_MAX_OPUS_FRAMES),m=Array(this.OPUS_MAX_OPUS_FRAMES);for(let o=0;o<this.OPUS_MAX_OPUS_FRAMES;++o)f[o]=[void 0],m[o]=[void 0];if(0>this.opusPacketParse(o,p,null,f,m,null)||m[0][0]<=1)return!1;let _=this.opusNumSilkFrames(o);if(0===_)return!1;let w=this.opusPacketGetNumChannels(o);if(1!==w&&2!==w)return!1;for(let p=0;p<w;p++)if(o.getUint8(f[0][0])&128>>(p+1)*(_+1)-1)return!0;return!1}};p.default=f,f.shouldLog=!1,f.shouldReportStats=!1},0x118a80d5b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=`class RedundantAudioEncoder {
    constructor() {
        // Each payload must be less than 1024 bytes to fit the 10 bit block length
        this.maxRedPacketSizeBytes = 1 << 10;
        // Limit payload to 1000 bytes to handle small MTU. 1000 is chosen because in Chromium-based browsers, writing audio
        // payloads larger than 1000 bytes using the WebRTC Insertable Streams API (which is used to enable dynamic audio
        // redundancy) will cause an error to be thrown and cause audio flow to permanently stop. See
        // https://crbug.com/1248479.
        this.maxAudioPayloadSizeBytes = 1000;
        // Each payload can encode a timestamp delta of 14 bits
        this.maxRedTimestampOffset = 1 << 14;
        // 4 byte RED header
        this.redHeaderSizeBytes = 4;
        // reduced size for last RED header
        this.redLastHeaderSizeBytes = 1;
        // P-Time for Opus 20 msec packets
        // We do not support other p-times or clock rates
        this.redPacketizationTime = 960;
        // distance between redundant payloads, Opus FEC handles a distance of 1
        // TODO(https://issues.amazon.com/issues/ChimeSDKAudio-55):
        // Consider making this dynamic
        this.redPacketDistance = 2;
        // maximum number of redundant payloads per RTP packet
        this.maxRedEncodings = 2;
        // Maximum number of encodings that can be recovered with a single RED packet, assuming the primary and redundant
        // payloads have FEC.
        this.redMaxRecoveryDistance = this.redPacketDistance * this.maxRedEncodings + 1;
        // maximum history of prior payloads to keep
        // generally we will expire old entries based on timestamp
        // this limit is in place just to make sure the history does not
        // grow too large in the case of erroneous timestamp inputs
        this.maxEncodingHistorySize = 10;
        // Current number of encodings we want to send
        // to the remote end. This will be dynamically
        // updated through the setNumEncodingsFromPacketloss API
        this.numRedundantEncodings = 0;
        // Used to enable or disable redundancy
        // in response to very high packet loss events
        this.redundancyEnabled = true;
        // Loss stats are reported to the main thread every 5 seconds.
        // Since timestamp differences between 2 consecutive packets
        // give us the number of samples in each channel, 1 second
        // is equivalent to 48000 samples:
        // P-time * (1000ms/1s)
        // = (960 samples/20ms) * (1000ms/1s)
        // = 48000 samples/s
        this.lossReportInterval = 48000 * 5;
        // Maximum distance of a packet from the most recent packet timestamp
        // that we will consider for recovery.
        this.maxOutOfOrderPacketDistance = 16;
        /**
         * Below are Opus helper methods and constants.
         */
        this.OPUS_BAD_ARG = -1;
        this.OPUS_INVALID_PACKET = -4;
        // Max number of Opus frames in an Opus packet is 48 (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5).
        this.OPUS_MAX_OPUS_FRAMES = 48;
        // Max number of bytes that any individual Opus frame can have.
        this.OPUS_MAX_FRAME_SIZE_BYTES = 1275;
        this.encodingHistory = new Array();
        this.opusPayloadType = 0;
        this.redPayloadType = 0;
        this.initializePacketLogs();
    }
    /**
     * Creates an instance of RedundantAudioEncoder and sets up callbacks.
     */
    static initializeWorker() {
        RedundantAudioEncoder.log('Initializing RedundantAudioEncoder');
        const encoder = new RedundantAudioEncoder();
        // RED encoding is done using WebRTC Encoded Transform
        // https://github.com/w3c/webrtc-encoded-transform/blob/main/explainer.md
        // Check the DedicatedWorkerGlobalScope for existence of
        // RTCRtpScriptTransformer interface. If exists, then
        // RTCRtpScriptTransform is supported by this browser.
        // @ts-ignore
        if (self.RTCRtpScriptTransformer) {
            // @ts-ignore
            self.onrtctransform = (event) => {
                if (event.transformer.options.type === 'SenderTransform') {
                    encoder.setupSenderTransform(event.transformer.readable, event.transformer.writable);
                }
                else if (event.transformer.options.type === 'ReceiverTransform') {
                    encoder.setupReceiverTransform(event.transformer.readable, event.transformer.writable);
                }
                else if (event.transformer.options.type === 'PassthroughTransform') {
                    encoder.setupPassthroughTransform(event.transformer.readable, event.transformer.writable);
                }
            };
        }
        self.onmessage = (event) => {
            if (event.data.msgType === 'StartRedWorker') {
                encoder.setupSenderTransform(event.data.send.readable, event.data.send.writable);
                encoder.setupReceiverTransform(event.data.receive.readable, event.data.receive.writable);
            }
            else if (event.data.msgType === 'PassthroughTransform') {
                encoder.setupPassthroughTransform(event.data.send.readable, event.data.send.writable);
                encoder.setupPassthroughTransform(event.data.receive.readable, event.data.receive.writable);
            }
            else if (event.data.msgType === 'RedPayloadType') {
                encoder.setRedPayloadType(event.data.payloadType);
            }
            else if (event.data.msgType === 'OpusPayloadType') {
                encoder.setOpusPayloadType(event.data.payloadType);
            }
            else if (event.data.msgType === 'UpdateNumRedundantEncodings') {
                encoder.setNumRedundantEncodings(event.data.numRedundantEncodings);
            }
            else if (event.data.msgType === 'Enable') {
                encoder.setRedundancyEnabled(true);
            }
            else if (event.data.msgType === 'Disable') {
                encoder.setRedundancyEnabled(false);
            }
        };
    }
    /**
     * Post logs to the main thread
     */
    static log(msg) {
        if (RedundantAudioEncoder.shouldLog) {
            // @ts-ignore
            self.postMessage({
                type: 'REDWorkerLog',
                log: \`[AudioRed] \${msg}\`,
            });
        }
    }
    /**
     * Returns the number of encodings based on packetLoss value. This is used by \`DefaultTransceiverController\` to
     * determine when to alert the encoder to update the number of encodings. It also determines if we need to
     * turn off red in cases of very high packet loss to avoid congestion collapse.
     */
    static getNumRedundantEncodingsForPacketLoss(packetLoss) {
        let recommendedRedundantEncodings = 0;
        let shouldTurnOffRed = false;
        if (packetLoss <= 8) {
            recommendedRedundantEncodings = 0;
        }
        else if (packetLoss <= 18) {
            recommendedRedundantEncodings = 1;
        }
        else if (packetLoss <= 75) {
            recommendedRedundantEncodings = 2;
        }
        else {
            recommendedRedundantEncodings = 0;
            shouldTurnOffRed = true;
        }
        return [recommendedRedundantEncodings, shouldTurnOffRed];
    }
    /**
     * Sets up a passthrough (no-op) transform for the given streams.
     */
    setupPassthroughTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up passthrough transform');
        readable.pipeTo(writable);
    }
    /**
     * Sets up the transform stream and pipes the outgoing encoded audio frames through the transform function.
     */
    setupSenderTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up sender RED transform');
        const transformStream = new TransformStream({
            transform: this.senderTransform.bind(this),
        });
        readable.pipeThrough(transformStream).pipeTo(writable);
        return;
    }
    /**
     * Sets up the transform stream and pipes the received encoded audio frames through the transform function.
     */
    setupReceiverTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up receiver RED transform');
        const transformStream = new TransformStream({
            transform: this.receivePacketLogTransform.bind(this),
        });
        readable.pipeThrough(transformStream).pipeTo(writable);
        return;
    }
    /**
     * Set the RED payload type ideally obtained from local offer.
     */
    setRedPayloadType(payloadType) {
        this.redPayloadType = payloadType;
        RedundantAudioEncoder.log(\`red payload type set to \${this.redPayloadType}\`);
    }
    /**
     * Set the opus payload type ideally obtained from local offer.
     */
    setOpusPayloadType(payloadType) {
        this.opusPayloadType = payloadType;
        RedundantAudioEncoder.log(\`opus payload type set to \${this.opusPayloadType}\`);
    }
    /**
     * Set the number of redundant encodings
     */
    setNumRedundantEncodings(numRedundantEncodings) {
        this.numRedundantEncodings = numRedundantEncodings;
        if (this.numRedundantEncodings > this.maxRedEncodings) {
            this.numRedundantEncodings = this.maxRedEncodings;
        }
        RedundantAudioEncoder.log(\`Updated numRedundantEncodings to \${this.numRedundantEncodings}\`);
    }
    /**
     * Enable or disable redundancy in response to
     * high packet loss event.
     */
    setRedundancyEnabled(enabled) {
        this.redundancyEnabled = enabled;
        RedundantAudioEncoder.log(\`redundancy \${this.redundancyEnabled ? 'enabled' : 'disabled'}\`);
    }
    /**
     * Helper function to only enqueue audio frames if they do not exceed the audio payload byte limit imposed by
     * Chromium-based browsers. Chromium will throw an error (https://crbug.com/1248479) if an audio payload larger than
     * 1000 bytes is enqueued. Any controller that attempts to enqueue an audio payload larger than 1000 bytes will
     * encounter this error and will permanently stop sending or receiving audio.
     */
    enqueueAudioFrameIfPayloadSizeIsValid(
    // @ts-ignore
    frame, controller) {
        if (frame.data.byteLength > this.maxAudioPayloadSizeBytes)
            return;
        controller.enqueue(frame);
    }
    /**
     * Receives encoded frames and modifies as needed before sending to transport.
     */
    senderTransform(
    // @ts-ignore
    frame, controller) {
        const frameMetadata = frame.getMetadata();
        // @ts-ignore
        if (frameMetadata.payloadType !== this.redPayloadType) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        const primaryPayloadBuffer = this.getPrimaryPayload(frame.timestamp, frame.data);
        if (!primaryPayloadBuffer) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        const encodedBuffer = this.encode(frame.timestamp, primaryPayloadBuffer);
        /* istanbul ignore next */
        if (!encodedBuffer) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        frame.data = encodedBuffer;
        this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
        return;
    }
    /**
     * Get the primary payload from encoding
     */
    getPrimaryPayload(primaryTimestamp, frame) {
        const encodings = this.splitEncodings(primaryTimestamp, frame);
        if (!encodings || encodings.length < 1)
            return null;
        return encodings[encodings.length - 1].payload;
    }
    /**
     * Split up the encoding received into primary and redundant encodings
     * These will be ordered oldest to newest which is the same ordering
     * in the RTP red payload.
     */
    splitEncodings(primaryTimestamp, frame, getFecInfo = false, primarySequenceNumber = undefined) {
        // process RED headers (according to RFC 2198)
        //   0                   1                   2                   3
        //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //  |F|   block PT  |  timestamp offset         |   block length    |
        //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //
        // last header
        //   0 1 2 3 4 5 6 7
        //  +-+-+-+-+-+-+-+-+
        //  |0|   Block PT  |
        //  +-+-+-+-+-+-+-+-+
        const payload = new DataView(frame);
        let payloadSizeBytes = payload.byteLength;
        let totalPayloadSizeBytes = 0;
        let totalHeaderSizeBytes = 0;
        let primaryPayloadSizeBytes = 0;
        let payloadOffset = 0;
        let gotLastBlock = false;
        const encodings = new Array();
        const redundantEncodingBlockLengths = new Array();
        const redundantEncodingTimestamps = new Array();
        while (payloadSizeBytes > 0) {
            gotLastBlock = (payload.getUint8(payloadOffset) & 0x80) === 0;
            if (gotLastBlock) {
                // Bits 1 through 7 are payload type
                const payloadType = payload.getUint8(payloadOffset) & 0x7f;
                // Unexpected payload type. This is a bad packet.
                if (payloadType !== this.opusPayloadType) {
                    return null;
                }
                totalPayloadSizeBytes += this.redLastHeaderSizeBytes;
                totalHeaderSizeBytes += this.redLastHeaderSizeBytes;
                // Accumulated block lengths are equal to or larger than the buffer, which means there is no primary block. This
                // is a bad packet.
                if (totalPayloadSizeBytes >= payload.byteLength) {
                    return null;
                }
                primaryPayloadSizeBytes = payload.byteLength - totalPayloadSizeBytes;
                break;
            }
            else {
                if (payloadSizeBytes < this.redHeaderSizeBytes) {
                    return null;
                }
                // Bits 22 through 31 are payload length
                const blockLength = ((payload.getUint8(payloadOffset + 2) & 0x03) << 8) + payload.getUint8(payloadOffset + 3);
                redundantEncodingBlockLengths.push(blockLength);
                const timestampOffset = payload.getUint16(payloadOffset + 1) >> 2;
                const timestamp = primaryTimestamp - timestampOffset;
                redundantEncodingTimestamps.push(timestamp);
                totalPayloadSizeBytes += blockLength + this.redHeaderSizeBytes;
                totalHeaderSizeBytes += this.redHeaderSizeBytes;
                payloadOffset += this.redHeaderSizeBytes;
                payloadSizeBytes -= this.redHeaderSizeBytes;
            }
        }
        // The last block was never found. The packet we received
        // does not have a good RED payload.
        if (!gotLastBlock) {
            // Note that sequence numbers only exist for
            // incoming audio frames.
            if (primarySequenceNumber !== undefined) {
                // This could be a possible padding packet used
                // for BWE with a good sequence number.
                // Create a dummy encoding to make sure loss values
                // are calculated correctly by consuming sequence number.
                // Note that for the receive side, we process packets only
                // for loss/recovery calculations and forward the original
                // packet without changing it even in the error case.
                encodings.push({
                    payload: frame,
                    isRedundant: false,
                    seq: primarySequenceNumber,
                });
                return encodings;
            }
            // This is a bad packet.
            return null;
        }
        let redundantPayloadOffset = totalHeaderSizeBytes;
        for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
            const redundantPayloadBuffer = new ArrayBuffer(redundantEncodingBlockLengths[i]);
            const redundantPayloadArray = new Uint8Array(redundantPayloadBuffer);
            redundantPayloadArray.set(new Uint8Array(payload.buffer, redundantPayloadOffset, redundantEncodingBlockLengths[i]), 0);
            const encoding = {
                timestamp: redundantEncodingTimestamps[i],
                payload: redundantPayloadBuffer,
                isRedundant: true,
            };
            if (getFecInfo) {
                encoding.hasFec = this.opusPacketHasFec(new DataView(redundantPayloadBuffer), redundantPayloadBuffer.byteLength);
            }
            encodings.push(encoding);
            redundantPayloadOffset += redundantEncodingBlockLengths[i];
        }
        const primaryPayloadOffset = payload.byteLength - primaryPayloadSizeBytes;
        const primaryPayloadBuffer = new ArrayBuffer(primaryPayloadSizeBytes);
        const primaryArray = new Uint8Array(primaryPayloadBuffer);
        primaryArray.set(new Uint8Array(payload.buffer, primaryPayloadOffset, primaryPayloadSizeBytes), 0);
        const encoding = {
            timestamp: primaryTimestamp,
            payload: primaryPayloadBuffer,
            isRedundant: false,
            seq: primarySequenceNumber,
        };
        if (getFecInfo) {
            encoding.hasFec = this.opusPacketHasFec(new DataView(primaryPayloadBuffer), primaryPayloadBuffer.byteLength);
        }
        encodings.push(encoding);
        return encodings;
    }
    /**
     * Create a new encoding with current primary payload and the older payloads of choice.
     */
    encode(primaryTimestamp, primaryPayload) {
        const primaryPayloadSize = primaryPayload.byteLength;
        // Payload size needs to be valid.
        if (primaryPayloadSize === 0 ||
            primaryPayloadSize >= this.maxRedPacketSizeBytes ||
            primaryPayloadSize >= this.maxAudioPayloadSizeBytes) {
            return null;
        }
        const numRedundantEncodings = this.numRedundantEncodings;
        let headerSizeBytes = this.redLastHeaderSizeBytes;
        let payloadSizeBytes = primaryPayloadSize;
        let bytesAvailable = this.maxAudioPayloadSizeBytes - primaryPayloadSize - headerSizeBytes;
        const redundantEncodingTimestamps = new Array();
        const redundantEncodingPayloads = new Array();
        // If redundancy is disabled then only send the primary payload
        if (this.redundancyEnabled) {
            // Determine how much redundancy we can fit into our packet
            let redundantTimestamp = this.uint32WrapAround(primaryTimestamp - this.redPacketizationTime * this.redPacketDistance);
            for (let i = 0; i < numRedundantEncodings; i++) {
                // Do not add redundant encodings that are beyond the maximum timestamp offset.
                if (this.uint32WrapAround(primaryTimestamp - redundantTimestamp) >= this.maxRedTimestampOffset) {
                    break;
                }
                let findTimestamp = redundantTimestamp;
                let encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
                if (!encoding) {
                    // If not found or not important then look for the previous packet.
                    // The current packet may have included FEC for the previous, so just
                    // use the previous packet instead provided that it has voice activity.
                    findTimestamp = this.uint32WrapAround(redundantTimestamp - this.redPacketizationTime);
                    encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
                }
                if (encoding) {
                    const redundantEncodingSizeBytes = encoding.payload.byteLength;
                    // Only add redundancy if there are enough bytes available.
                    if (bytesAvailable < this.redHeaderSizeBytes + redundantEncodingSizeBytes)
                        break;
                    bytesAvailable -= this.redHeaderSizeBytes + redundantEncodingSizeBytes;
                    headerSizeBytes += this.redHeaderSizeBytes;
                    payloadSizeBytes += redundantEncodingSizeBytes;
                    redundantEncodingTimestamps.unshift(encoding.timestamp);
                    redundantEncodingPayloads.unshift(encoding.payload);
                }
                redundantTimestamp -= this.redPacketizationTime * this.redPacketDistance;
                redundantTimestamp = this.uint32WrapAround(redundantTimestamp);
            }
        }
        const redPayloadBuffer = new ArrayBuffer(headerSizeBytes + payloadSizeBytes);
        const redPayloadView = new DataView(redPayloadBuffer);
        // Add redundant encoding header(s) to new buffer
        let redPayloadOffset = 0;
        for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
            const timestampDelta = primaryTimestamp - redundantEncodingTimestamps[i];
            redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType | 0x80);
            redPayloadView.setUint16(redPayloadOffset + 1, (timestampDelta << 2) | (redundantEncodingPayloads[i].byteLength >> 8));
            redPayloadView.setUint8(redPayloadOffset + 3, redundantEncodingPayloads[i].byteLength & 0xff);
            redPayloadOffset += this.redHeaderSizeBytes;
        }
        // Add primary encoding header to new buffer
        redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType);
        redPayloadOffset += this.redLastHeaderSizeBytes;
        // Add redundant payload(s) to new buffer
        const redPayloadArray = new Uint8Array(redPayloadBuffer);
        for (let i = 0; i < redundantEncodingPayloads.length; i++) {
            redPayloadArray.set(new Uint8Array(redundantEncodingPayloads[i]), redPayloadOffset);
            redPayloadOffset += redundantEncodingPayloads[i].byteLength;
        }
        // Add primary payload to new buffer
        redPayloadArray.set(new Uint8Array(primaryPayload), redPayloadOffset);
        redPayloadOffset += primaryPayload.byteLength;
        /* istanbul ignore next */
        // Sanity check that we got the expected total payload size.
        if (redPayloadOffset !== headerSizeBytes + payloadSizeBytes)
            return null;
        this.updateEncodingHistory(primaryTimestamp, primaryPayload);
        return redPayloadBuffer;
    }
    /**
     * Update the encoding history with the latest primary encoding
     */
    updateEncodingHistory(primaryTimestamp, primaryPayload) {
        // Remove encodings from the history if they are too old.
        for (const encoding of this.encodingHistory) {
            const maxTimestampDelta = this.redPacketizationTime * this.redMaxRecoveryDistance;
            if (primaryTimestamp - encoding.timestamp >= maxTimestampDelta) {
                this.encodingHistory.shift();
            }
            else {
                break;
            }
        }
        // Only add an encoding to the history if the encoding is deemed to be important. An encoding is important if it is
        // a CELT-only packet or contains voice activity.
        const packet = new DataView(primaryPayload);
        if (this.opusPacketIsCeltOnly(packet) ||
            this.opusPacketHasVoiceActivity(packet, packet.byteLength) > 0) {
            // Check if adding an encoding will cause the length of the encoding history to exceed the maximum history size.
            // This is not expected to happen but could occur if we get incorrect timestamps. We want to make sure our memory
            // usage is bounded. In this case, just clear the history and start over from empty.
            if (this.encodingHistory.length + 1 > this.maxEncodingHistorySize)
                this.encodingHistory.length = 0;
            this.encodingHistory.push({ timestamp: primaryTimestamp, payload: primaryPayload });
        }
    }
    /**
     * Initialize packet logs and metric values.
     */
    initializePacketLogs() {
        // The extra space from the max RED recovery distance is to ensure that we do not incorrectly count recovery for
        // packets that have already been received but are outside of the max out-of-order distance.
        const packetLogSize = this.maxOutOfOrderPacketDistance + this.redMaxRecoveryDistance;
        this.primaryPacketLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.redRecoveryLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.fecRecoveryLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.totalAudioPacketsExpected = 0;
        this.totalAudioPacketsLost = 0;
        this.totalAudioPacketsRecoveredRed = 0;
        this.totalAudioPacketsRecoveredFec = 0;
    }
    /**
     * Receives encoded frames from the server
     * and adds the timestamps to a packet log
     * to calculate an approximate recovery metric.
     */
    receivePacketLogTransform(
    // @ts-ignore
    frame, controller) {
        const frameMetadata = frame.getMetadata();
        // @ts-ignore
        if (frameMetadata.payloadType !== this.redPayloadType) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        // @ts-ignore
        const encodings = this.splitEncodings(frame.timestamp, frame.data, 
        /*getFecInfo*/ true, frameMetadata.sequenceNumber);
        if (!encodings) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        for (let i = encodings.length - 1; i >= 0; i--) {
            if (this.updateLossStats(encodings[i])) {
                this.updateRedStats(encodings[i]);
                this.updateFecStats(encodings[i]);
            }
        }
        this.maybeReportLossStats(frameMetadata.synchronizationSource, encodings[encodings.length - 1].timestamp);
        this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
    }
    /**
     * Adds a timestamp to the primary packet log.
     * This also updates totalAudioPacketsLost and totalAudioPacketsExpected by looking
     * at the difference between timestamps.
     *
     * @param encoding : The encoding to be analyzed
     * @returns false if sequence number was greater than max out of order distance
     *          true otherwise
     */
    updateLossStats(encoding) {
        if (encoding.isRedundant)
            return true;
        const timestamp = encoding.timestamp;
        const seq = encoding.seq;
        if (this.totalAudioPacketsExpected === 0) {
            this.totalAudioPacketsExpected = 1;
            this.newestSequenceNumber = seq;
            this.addTimestamp(this.primaryPacketLog, timestamp);
            return true;
        }
        const diff = this.int16(seq - this.newestSequenceNumber);
        if (diff < -this.maxOutOfOrderPacketDistance)
            return false;
        if (diff < 0) {
            if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
                if (this.totalAudioPacketsLost > 0)
                    this.totalAudioPacketsLost--;
                this.addTimestamp(this.primaryPacketLog, timestamp);
                this.removeFromRecoveryWindows(timestamp);
            }
        }
        else if (diff > 1) {
            this.totalAudioPacketsLost += diff - 1;
        }
        if (diff > 0) {
            this.totalAudioPacketsExpected += diff;
            this.newestSequenceNumber = encoding.seq;
            this.addTimestamp(this.primaryPacketLog, timestamp);
        }
        return true;
    }
    /**
     * Adds a timestamp to the red recovery log if it is not present in
     * the primary packet log and if it's not too old.
     *
     * @param encoding : The encoding to be analyzed
     */
    updateRedStats(encoding) {
        if (!encoding.isRedundant || this.totalAudioPacketsLost === 0)
            return;
        const timestamp = encoding.timestamp;
        if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
            if (!this.hasTimestamp(this.redRecoveryLog, timestamp)) {
                this.totalAudioPacketsRecoveredRed++;
                this.addTimestamp(this.redRecoveryLog, timestamp);
            }
            if (this.removeTimestamp(this.fecRecoveryLog, timestamp)) {
                /* istanbul ignore else */
                if (this.totalAudioPacketsRecoveredFec > 0)
                    this.totalAudioPacketsRecoveredFec--;
            }
        }
    }
    /**
     * Adds a timestamp to the fec recovery log if it is not present in
     * the primary packet log and red recovery log and if it is not too old.
     *
     * @param encoding : The encoding to be analyzed
     */
    updateFecStats(encoding) {
        if (!encoding.hasFec || this.totalAudioPacketsLost === 0)
            return;
        const fecTimestamp = encoding.timestamp - this.redPacketizationTime;
        if (this.hasTimestamp(this.primaryPacketLog, fecTimestamp) ||
            this.hasTimestamp(this.redRecoveryLog, fecTimestamp) ||
            this.hasTimestamp(this.fecRecoveryLog, fecTimestamp)) {
            return;
        }
        this.totalAudioPacketsRecoveredFec++;
        this.addTimestamp(this.fecRecoveryLog, fecTimestamp);
    }
    /**
     * Reports loss metrics to DefaultTransceiverController
     *
     * @param timestamp : Timestamp of most recent primary packet
     */
    maybeReportLossStats(ssrc, timestamp) {
        if (timestamp === undefined ||
            timestamp - this.lastLossReportTimestamp < this.lossReportInterval)
            return;
        /* istanbul ignore next */
        if (RedundantAudioEncoder.shouldReportStats) {
            // @ts-ignore
            self.postMessage({
                type: 'RedundantAudioEncoderStats',
                ssrc,
                totalAudioPacketsLost: this.totalAudioPacketsLost,
                totalAudioPacketsExpected: this.totalAudioPacketsExpected,
                totalAudioPacketsRecoveredRed: this.totalAudioPacketsRecoveredRed,
                totalAudioPacketsRecoveredFec: this.totalAudioPacketsRecoveredFec,
            });
        }
        this.lastLossReportTimestamp = timestamp;
    }
    /**
     * Adds a timestamp to a packet log
     *
     * @param packetLog : The packetlog to add the timestamp to
     * @param timestamp : The timestamp that should be added
     */
    addTimestamp(packetLog, timestamp) {
        if (timestamp === undefined) {
            return;
        }
        packetLog.window[packetLog.index] = timestamp;
        packetLog.index = (packetLog.index + 1) % packetLog.windowSize;
    }
    /**
     * Checks if a timestamp is in a packetlog
     *
     * @param packetLog : The packetlog to search
     * @param timestamp : The timestamp to search for
     * @returns true if timestamp is present, false otherwise
     */
    hasTimestamp(packetLog, timestamp) {
        const element = packetLog.window.find(t => t === timestamp);
        return !!element;
    }
    /**
     * Removes a timestamp from a packet log
     *
     * @param packetLog : The packetlog from which the timestamp should be removed
     * @param timestamp : The timestamp to be removed
     * @returns true if timestamp was present in the log and removed, false otherwise
     */
    removeTimestamp(packetLog, timestamp) {
        const index = packetLog.window.indexOf(timestamp);
        if (index >= 0) {
            packetLog.window[index] = undefined;
            return true;
        }
        return false;
    }
    /**
     * Removes a timestamp from red and fec recovery windows.
     *
     * @param timestamp : The timestamp to be removed
     */
    removeFromRecoveryWindows(timestamp) {
        let removed = this.removeTimestamp(this.redRecoveryLog, timestamp);
        if (removed) {
            if (this.totalAudioPacketsRecoveredRed > 0)
                this.totalAudioPacketsRecoveredRed--;
        }
        removed = this.removeTimestamp(this.fecRecoveryLog, timestamp);
        if (removed) {
            if (this.totalAudioPacketsRecoveredFec > 0)
                this.totalAudioPacketsRecoveredFec--;
        }
    }
    /**
     * Converts the supplied argument to 32-bit unsigned integer
     */
    uint32WrapAround(num) {
        const mod = 4294967296; // 2^32
        let res = num;
        if (num >= mod) {
            res = num - mod;
        }
        else if (num < 0) {
            res = mod + num;
        }
        return res;
    }
    /**
     * Converts the supplied argument to 16-bit signed integer
     */
    int16(num) {
        return (num << 16) >> 16;
    }
    /**
     * Determines if an Opus packet is in CELT-only mode.
     *
     * @param packet Opus packet.
     * @returns \`true\` if the packet is in CELT-only mode.
     */
    opusPacketIsCeltOnly(packet) {
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        // Since CELT-only packets are represented using configurations 16 to 31, the highest 'config' bit will always be 1
        // for CELT-only packets.
        return !!(packet.getUint8(0) & 0x80);
    }
    /**
     * Gets the number of samples per frame from an Opus packet.
     *
     * @param packet Opus packet. This must contain at least one byte of data.
     * @param sampleRateHz 32-bit integer sampling rate in Hz. This must be a multiple of 400 or inaccurate results will
     *                     be returned.
     * @returns Number of samples per frame.
     */
    opusPacketGetSamplesPerFrame(packet, sampleRateHz) {
        // Sample rate must be a 32-bit integer.
        sampleRateHz = Math.round(sampleRateHz);
        sampleRateHz = Math.min(Math.max(sampleRateHz, -(Math.pow(2, 32))), Math.pow(2, 32) - 1);
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        let numSamples;
        let frameSizeOption;
        // Case for CELT-only packet.
        if (this.opusPacketIsCeltOnly(packet)) {
            // The lower 3 'config' bits indicate the frame size option.
            frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
            // The frame size options 0, 1, 2, 3 correspond to frame sizes of 2.5, 5, 10, 20 ms. Notice that the frame sizes
            // can be represented as (2.5 * 2^0), (2.5 * 2^1), (2.5 * 2^2), (2.5 * 2^3) ms. So, the number of samples can be
            // calculated as follows:
            // (sample/s) * (1s/1000ms) * (2.5ms) * 2^(frameSizeOption)
            // = (sample/s) * (1s/400) * 2^(frameSizeOption)
            // = (sample/s) * 2^(frameSizeOption) * (1s/400)
            numSamples = (sampleRateHz << frameSizeOption) / 400;
        }
        // Case for Hybrid packet. Since Hybrid packets are represented using configurations 12 to 15, bits 1 and 2 in the
        // above TOC byte diagram will both be 1.
        else if ((packet.getUint8(0) & 0x60) === 0x60) {
            // In the case of configuration 13 or 15, bit 4 in the above TOC byte diagram will be 1. Configurations 13 and 15
            // correspond to a 20ms frame size, so the number of samples is calculated as follows:
            // (sample/s) * (1s/1000ms) * (20ms)
            // = (sample/s) * (1s/50)
            //
            // In the case of configuration 12 or 14, bit 4 in the above TOC byte diagram will be 0. Configurations 12 and 14
            // correspond to a 10ms frame size, so the number of samples is calculated as follows:
            // (sample/s) * (1s/1000ms) * (10ms)
            // = (sample/s) * (1s/100)
            numSamples = packet.getUint8(0) & 0x08 ? sampleRateHz / 50 : sampleRateHz / 100;
        }
        // Case for SILK-only packet.
        else {
            // The lower 3 'config' bits indicate the frame size option for SILK-only packets.
            frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
            if (frameSizeOption === 3) {
                // Frame size option 3 corresponds to a frame size of 60ms, so the number of samples is calculated as follows:
                // (sample/s) * (1s/1000ms) * (60ms)
                // = (sample/s) * (60ms) * (1s/1000ms)
                numSamples = (sampleRateHz * 60) / 1000;
            }
            else {
                // The frame size options 0, 1, 2 correspond to frame sizes of 10, 20, 40 ms. Notice that the frame sizes can be
                // represented as (10 * 2^0), (10 * 2^1), (10 * 2^2) ms. So, the number of samples can be calculated as follows:
                // (sample/s) * (1s/1000ms) * (10ms) * 2^(frameSizeOption)
                // = (sample/s) * (1s/100) * 2^(frameSizeOption)
                // = (sample/s) * 2^(frameSizeOption) * (1s/100)
                numSamples = (sampleRateHz << frameSizeOption) / 100;
            }
        }
        return numSamples;
    }
    /**
     * Gets the number of SILK frames per Opus frame.
     *
     * @param packet Opus packet.
     * @returns Number of SILK frames per Opus frame.
     */
    opusNumSilkFrames(packet) {
        // For computing the frame length in ms, the sample rate is not important since it cancels out. We use 48 kHz, but
        // any valid sample rate would work.
        //
        // To calculate the length of a frame (with a 48kHz sample rate) in ms:
        // (samples/frame) * (1s/48000 samples) * (1000ms/s)
        // = (samples/frame) * (1000ms/48000 samples)
        // = (samples/frame) * (1ms/48 samples)
        let frameLengthMs = this.opusPacketGetSamplesPerFrame(packet, 48000) / 48;
        if (frameLengthMs < 10)
            frameLengthMs = 10;
        // The number of SILK frames per Opus frame is described in https://www.rfc-editor.org/rfc/rfc6716#section-4.2.2.
        switch (frameLengthMs) {
            case 10:
            case 20:
                return 1;
            case 40:
                return 2;
            case 60:
                return 3;
            // It is not possible to reach the default case since an Opus packet can only encode sizes of 2.5, 5, 10, 20, 40,
            // or 60 ms, so we ignore the default case for test coverage.
            /* istanbul ignore next */
            default:
                return 0;
        }
    }
    /**
     * Gets the number of channels from an Opus packet.
     *
     * @param packet Opus packet.
     * @returns Number of channels.
     */
    opusPacketGetNumChannels(packet) {
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        // The 's' bit indicates mono or stereo audio, with 0 indicating mono and 1 indicating stereo.
        return packet.getUint8(0) & 0x4 ? 2 : 1;
    }
    /**
     * Determine the size (in bytes) of an Opus frame.
     *
     * @param packet Opus packet.
     * @param byteOffset Offset (from the start of the packet) to the byte containing the size information.
     * @param remainingBytes Remaining number of bytes to parse from the Opus packet.
     * @param sizeBytes Variable to store the parsed frame size (in bytes).
     * @returns Number of bytes that were parsed to determine the frame size.
     */
    opusParseSize(packet, byteOffset, remainingBytes, sizeBytes) {
        // See https://www.rfc-editor.org/rfc/rfc6716#section-3.2.1 for an explanation of how frame size is represented.
        // If there are no remaining bytes to parse the size from, then the size cannot be determined.
        if (remainingBytes < 1) {
            sizeBytes[0] = -1;
            return -1;
        }
        // If the first byte is in the range 0...251, then this value is the size of the frame.
        else if (packet.getUint8(byteOffset) < 252) {
            sizeBytes[0] = packet.getUint8(byteOffset);
            return 1;
        }
        // If the first byte is in the range 252...255, a second byte is needed. If there is no second byte, then the size
        // cannot be determined.
        else if (remainingBytes < 2) {
            sizeBytes[0] = -1;
            return -1;
        }
        // The total size of the frame given two size bytes is:
        // (4 * secondSizeByte) + firstSizeByte
        else {
            sizeBytes[0] = 4 * packet.getUint8(byteOffset + 1) + packet.getUint8(byteOffset);
            return 2;
        }
    }
    /**
     * Parse binary data containing an Opus packet into one or more Opus frames.
     *
     * @param data Binary data containing an Opus packet to be parsed. The data should begin with the first byte (i.e the
     *             TOC byte) of an Opus packet. Note that the size of the data does not have to equal the size of the
     *             contained Opus packet.
     * @param lenBytes Size of the data (in bytes).
     * @param selfDelimited Indicates if the Opus packet is self-delimiting
     *                      (https://www.rfc-editor.org/rfc/rfc6716#appendix-B).
     * @param tocByte Optional variable to store the TOC (table of contents) byte.
     * @param frameOffsets Optional variable to store the offsets (from the start of the data) to the first bytes of each
     *                     Opus frame.
     * @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
     * @param payloadOffset Optional variable to store the offset (from the start of the data) to the first byte of the
     *                      payload.
     * @param packetLenBytes Optional variable to store the length of the Opus packet (in bytes).
     * @returns Number of Opus frames.
     */
    opusPacketParseImpl(data, lenBytes, selfDelimited, tocByte, frameOffsets, frameSizes, payloadOffset, packetLenBytes) {
        if (!frameSizes || lenBytes < 0)
            return this.OPUS_BAD_ARG;
        if (lenBytes === 0)
            return this.OPUS_INVALID_PACKET;
        // The number of Opus frames in the packet.
        let numFrames;
        // Intermediate storage for the number of bytes parsed to determine the size of a frame.
        let numBytesParsed;
        // The number of the padding bytes (excluding the padding count bytes) in the packet.
        let paddingBytes = 0;
        // Indicates whether CBR (constant bitrate) framing is used.
        let cbr = false;
        // The TOC (table of contents) byte (https://www.rfc-editor.org/rfc/rfc6716#section-3.1).
        const toc = data.getUint8(0);
        // Store the TOC byte.
        if (tocByte)
            tocByte[0] = toc;
        // The remaining number of bytes to parse from the packet. Note that the TOC byte has already been parsed, hence the
        // minus 1.
        let remainingBytes = lenBytes - 1;
        // This keeps track of where we are in the packet. This starts at 1 since the TOC byte has already been read.
        let byteOffset = 1;
        // The size of the last Opus frame in bytes.
        let lastSizeBytes = remainingBytes;
        // Read the \`c\` bits (i.e. code bits) from the TOC byte.
        switch (toc & 0x3) {
            // A code 0 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.2) has one frame.
            case 0:
                numFrames = 1;
                break;
            // A code 1 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.3) has two CBR (constant bitrate) frames.
            case 1:
                numFrames = 2;
                cbr = true;
                if (!selfDelimited) {
                    // Undelimited code 1 packets must be an even number of data bytes, otherwise the packet is invalid.
                    if (remainingBytes & 0x1)
                        return this.OPUS_INVALID_PACKET;
                    // The sizes of both frames are equal (i.e. half of the number of data bytes).
                    lastSizeBytes = remainingBytes / 2;
                    // If \`lastSizeBytes\` is too large, we will catch it later.
                    frameSizes[0][0] = lastSizeBytes;
                }
                break;
            // A code 2 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.4) has two VBR (variable bitrate) frames.
            case 2:
                numFrames = 2;
                numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[0]);
                remainingBytes -= numBytesParsed;
                // The parsed size of the first frame cannot be larger than the number of remaining bytes in the packet.
                if (frameSizes[0][0] < 0 || frameSizes[0][0] > remainingBytes) {
                    return this.OPUS_INVALID_PACKET;
                }
                byteOffset += numBytesParsed;
                // The size of the second frame is the remaining number of bytes after the first frame.
                lastSizeBytes = remainingBytes - frameSizes[0][0];
                break;
            // A code 3 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5) has multiple CBR/VBR frames (from 0 to
            // 120 ms).
            default:
                // Code 3 packets must have at least 2 bytes (i.e. at least 1 byte after the TOC byte).
                if (remainingBytes < 1)
                    return this.OPUS_INVALID_PACKET;
                // Frame count byte format:
                //  0
                //  0 1 2 3 4 5 6 7
                // +-+-+-+-+-+-+-+-+
                // |v|p|     M     |
                // +-+-+-+-+-+-+-+-+
                //
                // Read the frame count byte, which immediately follows the TOC byte.
                const frameCountByte = data.getUint8(byteOffset++);
                --remainingBytes;
                // Read the 'M' bits of the frame count byte, which encode the number of frames.
                numFrames = frameCountByte & 0x3f;
                // The number of frames in a code 3 packet must not be 0.
                if (numFrames <= 0)
                    return this.OPUS_INVALID_PACKET;
                const samplesPerFrame = this.opusPacketGetSamplesPerFrame(data, 48000);
                // A single frame can have at most 2880 samples, which happens in the case where 60ms of 48kHz audio is encoded
                // per frame. A code 3 packet cannot contain more than 120ms of audio, so the total number of samples cannot
                // exceed 2880 * 2 = 5760.
                if (samplesPerFrame * numFrames > 5760)
                    return this.OPUS_INVALID_PACKET;
                // Parse padding bytes if the 'p' bit is 1.
                if (frameCountByte & 0x40) {
                    let paddingCountByte;
                    let numPaddingBytes;
                    // Remove padding bytes (including padding count bytes) from the remaining byte count.
                    do {
                        // Sanity check that there are enough bytes to parse and remove the padding.
                        if (remainingBytes <= 0)
                            return this.OPUS_INVALID_PACKET;
                        // Get the next padding count byte.
                        paddingCountByte = data.getUint8(byteOffset++);
                        --remainingBytes;
                        // If the padding count byte has a value in the range 0...254, then the total size of the padding is the
                        // value in the padding count byte.
                        //
                        // If the padding count byte has value 255, then the total size of the padding is 254 plus the value in the
                        // next padding count byte. Therefore, keep reading padding count bytes while the value is 255.
                        numPaddingBytes = paddingCountByte === 255 ? 254 : paddingCountByte;
                        remainingBytes -= numPaddingBytes;
                        paddingBytes += numPaddingBytes;
                    } while (paddingCountByte === 255);
                }
                // Sanity check that the remaining number of bytes is not negative after removing the padding.
                if (remainingBytes < 0)
                    return this.OPUS_INVALID_PACKET;
                // Read the 'v' bit (i.e. VBR bit).
                cbr = !(frameCountByte & 0x80);
                // VBR case
                if (!cbr) {
                    lastSizeBytes = remainingBytes;
                    // Let M be the number of frames. There will be M - 1 frame length indicators (which can be 1 or 2 bytes)
                    // corresponding to the lengths of frames 0 to M - 2. The size of the last frame (i.e. frame M - 1) is the
                    // number of data bytes after the end of frame M - 2 and before the start of the padding bytes.
                    for (let i = 0; i < numFrames - 1; ++i) {
                        numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[i]);
                        remainingBytes -= numBytesParsed;
                        // The remaining number of data bytes must be enough to contain each frame.
                        if (frameSizes[i][0] < 0 || frameSizes[i][0] > remainingBytes) {
                            return this.OPUS_INVALID_PACKET;
                        }
                        byteOffset += numBytesParsed;
                        lastSizeBytes -= numBytesParsed + frameSizes[i][0];
                    }
                    // Sanity check that the size of the last frame is not negative.
                    if (lastSizeBytes < 0)
                        return this.OPUS_INVALID_PACKET;
                }
                // CBR case
                else if (!selfDelimited) {
                    // The size of each frame is the number of data bytes divided by the number of frames.
                    lastSizeBytes = Math.trunc(remainingBytes / numFrames);
                    // The number of data bytes must be a non-negative integer multiple of the number of frames.
                    if (lastSizeBytes * numFrames !== remainingBytes)
                        return this.OPUS_INVALID_PACKET;
                    // All frames have equal size in the undelimited CBR case.
                    for (let i = 0; i < numFrames - 1; ++i) {
                        frameSizes[i][0] = lastSizeBytes;
                    }
                }
        }
        // Self-delimited framing uses an extra 1 or 2 bytes, immediately preceding the data bytes, to indicate either the
        // size of the last frame (for code 0, code 2, and VBR code 3 packets) or the size of all the frames (for code 1 and
        // CBR code 3 packets). See https://www.rfc-editor.org/rfc/rfc6716#appendix-B.
        if (selfDelimited) {
            // The extra frame size byte(s) will always indicate the size of the last frame.
            numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[numFrames - 1]);
            remainingBytes -= numBytesParsed;
            // There must be enough data bytes for the last frame.
            if (frameSizes[numFrames - 1][0] < 0 || frameSizes[numFrames - 1][0] > remainingBytes) {
                return this.OPUS_INVALID_PACKET;
            }
            byteOffset += numBytesParsed;
            // For CBR packets, the sizes of all the frames are equal.
            if (cbr) {
                // There must be enough data bytes for all the frames.
                if (frameSizes[numFrames - 1][0] * numFrames > remainingBytes) {
                    return this.OPUS_INVALID_PACKET;
                }
                for (let i = 0; i < numFrames - 1; ++i) {
                    frameSizes[i][0] = frameSizes[numFrames - 1][0];
                }
            }
            // At this point, \`lastSizeBytes\` contains the size of the last frame plus the size of the extra frame size
            // byte(s), so sanity check that \`lastSizeBytes\` is the upper bound for the size of the last frame.
            else if (!(numBytesParsed + frameSizes[numFrames - 1][0] <= lastSizeBytes)) {
                return this.OPUS_INVALID_PACKET;
            }
        }
        // Undelimited case
        else {
            // Because the size of the last packet is not encoded explicitly, it is possible that the size of the last packet
            // (or of all the packets, for the CBR case) is larger than maximum frame size.
            if (lastSizeBytes > this.OPUS_MAX_FRAME_SIZE_BYTES)
                return this.OPUS_INVALID_PACKET;
            frameSizes[numFrames - 1][0] = lastSizeBytes;
        }
        // Store the offset to the start of the payload.
        if (payloadOffset)
            payloadOffset[0] = byteOffset;
        // Store the offsets to the start of each frame.
        for (let i = 0; i < numFrames; ++i) {
            if (frameOffsets)
                frameOffsets[i][0] = byteOffset;
            byteOffset += frameSizes[i][0];
        }
        // Store the length of the Opus packet.
        if (packetLenBytes)
            packetLenBytes[0] = byteOffset + paddingBytes;
        return numFrames;
    }
    /**
     * Parse a single undelimited Opus packet into one or more Opus frames.
     *
     * @param packet Opus packet to be parsed.
     * @param lenBytes Size of the packet (in bytes).
     * @param tocByte Optional variable to store the TOC (table of contents) byte.
     * @param frameOffsets Optional variable to store the offsets (from the start of the packet) to the first bytes of
     *                     each Opus frame.
     * @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
     * @param payloadOffset Optional variable to store the offset (from the start of the packet) to the first byte of the
     *                      payload.
     * @returns Number of Opus frames.
     */
    opusPacketParse(packet, lenBytes, tocByte, frameOffsets, frameSizes, payloadOffset) {
        return this.opusPacketParseImpl(packet, lenBytes, 
        /* selfDelimited */ false, tocByte, frameOffsets, frameSizes, payloadOffset, null);
    }
    /**
     * This function returns the SILK VAD (voice activity detection) information encoded in the Opus packet. For CELT-only
     * packets that do not have VAD information, it returns -1.
     *
     * @param packet Opus packet.
     * @param lenBytes Size of the packet (in bytes).
     * @returns  0: no frame had the VAD flag set.
     *           1: at least one frame had the VAD flag set.
     *          -1: VAD status could not be determined.
     */
    opusPacketHasVoiceActivity(packet, lenBytes) {
        if (!packet || lenBytes <= 0)
            return 0;
        // In CELT-only mode, we can not determine whether there is VAD.
        if (this.opusPacketIsCeltOnly(packet))
            return -1;
        const numSilkFrames = this.opusNumSilkFrames(packet);
        // It is not possible for \`opusNumSilkFrames()\` to return 0, so we ignore the next sanity check for test coverage.
        /* istanbul ignore next */
        if (numSilkFrames === 0)
            return -1;
        const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
        const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
        for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
            opusFrameOffsets[i] = [undefined];
            opusFrameSizes[i] = [undefined];
        }
        // Parse packet to get the Opus frames.
        const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
        // VAD status cannot be determined for invalid packets.
        if (numOpusFrames < 0)
            return -1;
        // Iterate over all Opus frames, which may contain multiple SILK frames, to determine the VAD status.
        for (let i = 0; i < numOpusFrames; ++i) {
            if (opusFrameSizes[i][0] < 1)
                continue;
            // LP layer header bits format (https://www.rfc-editor.org/rfc/rfc6716#section-4.2.3):
            //
            // Mono case:
            // +-----------------+----------+
            // | 1 to 3 VAD bits | LBRR bit |
            // +-----------------+----------+
            //
            // Stereo case:
            // +---------------------+--------------+----------------------+---------------+
            // | 1 to 3 mid VAD bits | mid LBRR bit | 1 to 3 side VAD bits | side LBRR bit |
            // +---------------------+--------------+----------------------+---------------+
            // The upper 1 to 3 bits (dependent on the number of SILK frames) of the LP layer contain VAD bits. If any of
            // these VAD bits are 1, then voice activity is present.
            if (packet.getUint8(opusFrameOffsets[i][0]) >> (8 - numSilkFrames))
                return 1;
            // In the stereo case, there is a second set of 1 to 3 VAD bits, so also check these VAD bits.
            const channels = this.opusPacketGetNumChannels(packet);
            if (channels === 2 &&
                (packet.getUint8(opusFrameOffsets[i][0]) << (numSilkFrames + 1)) >> (8 - numSilkFrames)) {
                return 1;
            }
        }
        // No voice activity was detected.
        return 0;
    }
    /**
     * This method is based on Definition of the Opus Audio Codec
     * (https://tools.ietf.org/html/rfc6716). Basically, this method is based on
     * parsing the LP layer of an Opus packet, particularly the LBRR flag.
     *
     * @param packet Opus packet.
     * @param lenBytes Size of the packet (in bytes).
     * @returns  true: packet has fec encoding about previous packet.
     *           false: no fec encoding present.
     */
    opusPacketHasFec(packet, lenBytes) {
        if (!packet || lenBytes <= 0)
            return false;
        // In CELT-only mode, packets should not have FEC.
        if (this.opusPacketIsCeltOnly(packet))
            return false;
        const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
        const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
        for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
            opusFrameOffsets[i] = [undefined];
            opusFrameSizes[i] = [undefined];
        }
        // Parse packet to get the Opus frames.
        const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
        if (numOpusFrames < 0)
            return false;
        /* istanbul ignore next */
        if (opusFrameSizes[0][0] <= 1)
            return false;
        const numSilkFrames = this.opusNumSilkFrames(packet);
        /* istanbul ignore next */
        if (numSilkFrames === 0)
            return false;
        const channels = this.opusPacketGetNumChannels(packet);
        /* istanbul ignore next */
        if (channels !== 1 && channels !== 2)
            return false;
        // A frame starts with the LP layer. The LP layer begins with two to eight
        // header bits.These consist of one VAD bit per SILK frame (up to 3),
        // followed by a single flag indicating the presence of LBRR frames.
        // For a stereo packet, these first flags correspond to the mid channel, and
        // a second set of flags is included for the side channel. Because these are
        // the first symbols decoded by the range coder and because they are coded
        // as binary values with uniform probability, they can be extracted directly
        // from the most significant bits of the first byte of compressed data.
        for (let i = 0; i < channels; i++) {
            if (packet.getUint8(opusFrameOffsets[0][0]) & (0x80 >> ((i + 1) * (numSilkFrames + 1) - 1)))
                return true;
        }
        return false;
    }
}
RedundantAudioEncoder.shouldLog = true;
RedundantAudioEncoder.shouldReportStats = true;
RedundantAudioEncoder.initializeWorker();
`},0x1158c4d3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xa9a27686));p.default=class extends _.default{constructor(){super(0)}static nextTick(o){setTimeout(o,0)}}},0xd475f02c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.intervalMs=o}start(o){this.stop(),this.timer=setInterval(o,this.intervalMs)}stop(){void 0!==this.timer&&(clearInterval(this.timer),this.timer=void 0)}running(){return void 0!==this.timer}}},0xa9a27686:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.timeoutMs=o,this.timer=null}start(o){this.stop(),this.timer=setTimeout(()=>{clearTimeout(this.timer),o()},this.timeoutMs)}stop(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}}},0x1a20e50ff:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14f38fc30)),w=m(f(0xed7d9b54)),I=m(f(0x178bce6ff)),k=class SDP{constructor(o){this.sdp=o}clone(){return new SDP(this.sdp)}static isRTPCandidate(o){let p=/candidate[:](\S+) (\d+)/g.exec(o);return null!==p&&"1"===p[2]}static linesToSDP(o){return new SDP(o.join(SDP.CRLF))}static candidateTypeFromString(o){switch(o){case _.default.Host:return _.default.Host;case _.default.ServerReflexive:return _.default.ServerReflexive;case _.default.PeerReflexive:return _.default.PeerReflexive;case _.default.Relay:return _.default.Relay}return null}static candidateType(o){let p=/a[=]candidate[:].* typ ([a-z]+) /g.exec(o);return null===p?null:SDP.candidateTypeFromString(p[1])}static mediaType(o){let p=/m=(audio|video)/g.exec(o);if(null!==p)return p[1]}static mid(o){if(o.includes("a=mid:"))return o.replace(/^(a=mid:)/,"")}static direction(o){let p=/a=(sendrecv|sendonly|recvonly|inactive)/g.exec(o);if(null!==p)return p[1]}static splitLines(o){return o.trim().split(`
`).map(o=>o.trim())}static splitSections(o){return o.split(`
m=`).map((o,p)=>(p>0?"m="+o:o).trim()+SDP.CRLF)}static findActiveCameraSection(o){let p=0,f=!1;for(let m of o){if(/^m=video/.test(m)&&(m.indexOf("sendrecv")>-1||-1===m.indexOf("sendonly")&&-1===m.indexOf("recvonly")&&-1===m.indexOf("inactive"))){f=!0;break}p++}return!1===f&&(p=-1),p}static extractSSRCsFromFIDGroupLine(o){return/^a=ssrc-group:FID\s(.+)/.exec(o)[1]}static matchPrefix(o,p){return SDP.splitLines(o).filter(o=>0===o.indexOf(p))}lines(){return this.sdp.split(SDP.CRLF)}hasVideo(){return null!==/^m=video/gm.exec(this.sdp)}hasCandidates(){return null!==/a[=]candidate[:]/g.exec(this.sdp)}hasCandidatesForAllMLines(){return!(this.sdp.indexOf("c=IN IP4 0.0.0.0")>-1)}withoutCandidateType(o){return SDP.linesToSDP(this.lines().filter(p=>SDP.candidateType(p)!==o))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(_.default.ServerReflexive)}withAudioMaxAverageBitrate(o){if(!o)return this.clone();o=Math.trunc(Math.min(Math.max(o,SDP.rfc7587LowestBitrate),SDP.rfc7587HighestBitrate));let p=this.lines(),f=SDP.findOpusFmtpAttributes(p),m=SDP.updateOpusFmtpAttributes(p,f,[`maxaveragebitrate=${o}`]);return SDP.linesToSDP(m)}withStereoAudio(){let o=this.lines(),p=SDP.findOpusFmtpAttributes(o),f=SDP.updateOpusFmtpAttributes(o,p,["stereo=1","sprop-stereo=1"]);return SDP.linesToSDP(f)}static findOpusFmtpAttributes(o){let p=/^a=rtpmap:\s*(\d+)\s+opus\/48000/,f=!1,m=[];for(let _ of o)if(_.startsWith("m=audio")&&(m.push(null),f=!0),_.startsWith("m=video")&&(f=!1),f){let o=p.exec(_);null!==o&&(m[m.length-1]=`a=fmtp:${o[1]} `)}return m}static updateOpusFmtpAttributes(o,p,f){let m=[],_=0,w=null;for(let I of o)if(I.startsWith("m=audio")&&(w=p[_],_++),I.startsWith("m=video")&&(w=null),w&&I.startsWith(w)){let o=I.slice(w.length).split(";"),p=[];for(let m of o)0>f.findIndex(o=>o.startsWith(m.split("=")[0]))&&p.push(m);for(let o of f)p.push(o);m.push(w+p.join(";"))}else m.push(I);return m}withUnifiedPlanFormat(){let o=this.sdp;return o.includes("mozilla")?this.clone():new SDP(o=o.replace("o=-","o=mozilla-chrome"))}getUniqueRtpHeaderExtensionId(o){let p=[];for(let f of o)if(/^a=extmap:/.test(f.trim())){let o=+f.split("a=extmap:")[1].split(" ")[0];p.includes(o)||p.push(o)}p.sort((o,p)=>o-p);let f=0;for(let o of p){if(o-f>1)return f+1;f=o}return 14===f?-1:f+1}withVideoLayersAllocationRtpHeaderExtension(o){return this.withRtpHeaderExtension(o,SDP.videoLayersAllocationRtpHeaderExtensionUrl)}withDependencyDescriptorRtpHeaderExtension(o){return this.withRtpHeaderExtension(o,SDP.dependencyDescriptorRtpHeaderExtensionUrl)}withoutDependencyDescriptorRtpHeaderExtension(){let o=SDP.splitLines(this.sdp).filter(o=>!o.includes(SDP.dependencyDescriptorRtpHeaderExtensionUrl));return new SDP(o.join(SDP.CRLF)+SDP.CRLF)}withRtpHeaderExtension(o,p){let f=o?o.getRtpHeaderExtensionId(p):-1,m=-1===f?this.getUniqueRtpHeaderExtensionId(SDP.splitLines(this.sdp)):f,_=SDP.splitSections(this.sdp),w=[];for(let o of _){if(/^m=video/.test(o)&&-1===SDP.getRtpHeaderExtensionIdInSection(o,p)){let f=SDP.splitLines(o),_=[];if(-1===m||this.hasRtpHeaderExtensionId(m)){w.push(o);continue}for(let o of f)if(_.push(o),/^a=sendrecv/.test(o.trim())){let o="a=extmap:"+m+" "+p;_.push(o)}o=_.join(SDP.CRLF)+SDP.CRLF}else if(-1!==f&&/^m=video/.test(o)&&SDP.getRtpHeaderExtensionIdInSection(o,p)!==f){let m=SDP.splitLines(o),_=[];for(let o of m){if(/^a=extmap:/.test(o.trim())&&o.split("a=extmap:")[1].split(" ")[1]===p){if(!this.hasRtpHeaderExtensionId(f)){let o="a=extmap:"+f+" "+p;_.push(o)}continue}_.push(o)}o=_.join(SDP.CRLF)+SDP.CRLF}w.push(o)}return new SDP(w.join(""))}ssrcForVideoSendingSection(){let o=this.sdp,p=SDP.splitSections(o);if(p.length<2)return"";let f=SDP.findActiveCameraSection(p);if(-1===f)return"";let m=SDP.matchPrefix(p[f],"a=ssrc-group:FID ");if(m.length<1)return"";let[_]=SDP.extractSSRCsFromFIDGroupLine(m[0]).split(" ").map(o=>parseInt(o,10));return _.toString()}videoSendSectionHasDifferentSSRC(o){let p=this.ssrcForVideoSendingSection(),f=o.ssrcForVideoSendingSection();return""!==p&&""!==f&&parseInt(p,10)!==parseInt(f,10)}removeH264SupportFromSendSection(){let o=this.sdp,p=SDP.splitSections(o),f=SDP.findActiveCameraSection(p);if(-1===f)return new SDP(this.sdp);let m=p[f],_=SDP.splitLines(m),w=[],I=new Map;_.forEach(o=>{if(/^a=rtpmap:/.test(o)){let p=/^a=rtpmap:([0-9]+)\s/.exec(o);p&&o.toLowerCase().includes("h264")&&w.push(parseInt(p[1],10))}if(/^a=fmtp:/.test(o)){let p=/^a=fmtp:([0-9]+) apt=([0-9]+)/.exec(o);if(p&&3===p.length){let o=parseInt(p[1],10),f=parseInt(p[2],10);I.has(f)?I.get(f).push(o):I.set(f,[o])}}});let k=new Set;for(let o of w){k.add(o);let p=I.get(o);if(p)for(let o of p)k.add(o)}if(w.length>0){let o=_[0].split(" ");_[0]=o.filter(o=>!k.has(parseInt(o))).join(" ")}let M=_.filter(o=>{if(!o.includes("rtpmap")&&!o.includes("rtcp-fb")&&!o.includes("fmtp"))return!0;for(let p of k)if(o.includes(p.toString()))return!1;return!0});return p[f]=M.join(SDP.CRLF)+SDP.CRLF,new SDP(p.join(""))}mediaSections(){let o=SDP.splitSections(this.sdp);if(o.length<2)return[];let p=[];for(let f=1;f<o.length;f++){let m=new w.default;for(let p of SDP.splitLines(o[f])){let o=SDP.mediaType(p);if(void 0!==o){m.mediaType=o;continue}let f=SDP.direction(p);if(void 0!==f){m.direction=f;continue}let _=SDP.mid(p);if(void 0!==_){m.mid=_;continue}}p.push(m)}return p}static getRtpHeaderExtensionIdInSection(o,p){for(let f of SDP.splitLines(o))if(/^a=extmap:/.test(f.trim())){let o=f.split("a=extmap:")[1].split(" "),m=+o[0];if(o[1]===p)return m}return -1}getRtpHeaderExtensionId(o){for(let p of SDP.splitSections(this.sdp))if(/^m=video/.test(p)){let f=SDP.getRtpHeaderExtensionIdInSection(p,o);if(-1!==f)return f}return -1}hasRtpHeaderExtensionId(o){for(let p of SDP.splitLines(this.sdp))if(/^a=extmap:/.test(p.trim())&&+p.split("a=extmap:")[1].split(" ")[0]===o)return!0;return!1}withVideoSendCodecPreferences(o){let p=this.sdp,f=SDP.splitSections(p),m=SDP.findActiveCameraSection(f);return -1===m?new SDP(this.sdp):(f[m]=this.sectionWithCodecPreferences(f[m],o),new SDP(f.join("")))}sectionWithCodecPreferences(o,p){let f=new Map,m=SDP.splitLines(o);m.forEach(o=>{if(!o.startsWith("a=rtpmap:"))return;let _=/^a=rtpmap:(\d+)\s/.exec(o);if(!_)return;let w=_[1];for(let _ of p){if(!o.includes(`${_.codecName}/${_.codecCapability.clockRate}`))continue;let p=!1;if(void 0!==_.codecCapability.sdpFmtpLine){let o=!1;for(let f of m){if(_.fmtpLineMatches(f,parseInt(w))){p=!0;break}o||(o=f.startsWith(`a=fmtp:${w} profile-id=`))}_.equals(I.default.vp9Profile0())&&!o&&(p=!0)}else p=!0;if(p){f.set(w,_);break}}});let _=new Set(f.keys()),w=m[0].split(" ").filter(o=>!_.has(o)),k=Array.from(f.entries()).sort(([o,f],[m,_])=>p.indexOf(f)-p.indexOf(_)).map(([o,p])=>o);return w.splice(3,0,...k),m[0]=w.join(" "),m.join(SDP.CRLF)+SDP.CRLF}highestPriorityVideoSendCodec(){let o=this.prioritizedSendVideoCodecCapabilities();return o.length>0?o[0]:void 0}prioritizedSendVideoCodecCapabilities(){let o=this.sdp,p=SDP.splitSections(o),f=SDP.findActiveCameraSection(p);if(-1===f)return[];let m=SDP.splitLines(p[f]),_=m[0].split(" ");return _.length<4?[]:_.slice(3).map(o=>this.videoCodecCapabilityForPayloadType(m,o)).filter(o=>void 0!==o&&["VP8","H264","VP9","AV1"].includes(o.codecName))}videoCodecCapabilityForPayloadType(o,p){let f,m,_;for(let w of o){let o=/^a=rtpmap:([0-9]+)\s/.exec(w);if(o&&o[1]===p){let o=w.split(" ")[1].split("/");o.length>=2&&(f=o[0],m=o[1])}w.startsWith(`a=fmtp:${p} `)&&(_=w.split(" ")[1])}if(void 0!==f)return new I.default(f,{clockRate:parseInt(m),mimeType:`video/${f}`,sdpFmtpLine:_})}getAudioPayloadTypes(){let o=new Map,p=this.sdp,f=SDP.splitSections(p);return o.set("opus",SDP.findAudioPayloadType("opus",f)),o.set("red",SDP.findAudioPayloadType("red",f)),o}static findAudioPayloadType(o,p){let f=RegExp(`a=rtpmap:\\s*(\\d+)\\s+${o}\\/48000`);for(let o of p)if(/^m=audio/.test(o)){let p=f.exec(o);if(null!==p)return Number(p[1])}return 0}withStartingVideoSendBitrate(o){let p=SDP.splitSections(this.sdp);for(let f=0;f<p.length;f++){let m;if(!/^m=video/.test(p[f]))continue;let _=SDP.splitLines(p[f]),w=[],I=!1;for(let o of _){/^a=fmtp:\d*/.test(o)&&!/apt=/.test(o)&&(I=!0);let p=o.match(/^a=rtpmap:(\d+)/);p&&(m=p[1])}for(let p of _)if(!/^a=fmtp:\d*/.test(p)||/apt=/.test(p)||/x-google-start-bitrate=/.test(p))w.push(p);else{let f=p+`;x-google-start-bitrate=${o}`;w.push(f)}if(!I&&m){let p=w.findIndex(o=>o.match(/^a=rtpmap:\d+/));-1!==p&&w.splice(p+1,0,`a=fmtp:${m} x-google-start-bitrate=${o}`)}p[f]=w.join(SDP.CRLF)+SDP.CRLF}return new SDP(p.join(""))}};p.default=k,k.CRLF=`\r
`,k.rfc7587LowestBitrate=6e3,k.rfc7587HighestBitrate=51e4,k.dependencyDescriptorRtpHeaderExtensionUrl="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension",k.videoLayersAllocationRtpHeaderExtensionUrl="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"},0x14f38fc30:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SDPCandidateType=void 0,(m=f=p.SDPCandidateType||(p.SDPCandidateType={})).Host="host",m.ServerReflexive="srflx",m.PeerReflexive="prflx",m.Relay="relay",p.default=f},0xed7d9b54:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x178bce6ff:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x252035ee7);p.default=class VideoCodecCapability{constructor(o,p){this.codecName=o,this.codecCapability=p}equals(o){return void 0!==o&&this.codecName===o.codecName&&this.codecCapability.mimeType===o.codecCapability.mimeType&&this.codecCapability.clockRate===o.codecCapability.clockRate&&(this.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(this.codecCapability.sdpFmtpLine,this.codecName):"")===(o.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(o.codecCapability.sdpFmtpLine,o.codecName):"")}fmtpLineMatches(o,p){let f=this.codecCapability.sdpFmtpLine;if(!f)return!1;let m=`a=fmtp:${p} `;if(!o.startsWith(m))return!1;let _=o.substring(m.length);return this.cleanupFmtpLine(_,this.codecName)===this.cleanupFmtpLine(f,this.codecName)}cleanupFmtpLine(o,p){let f=o.replace(/;x-google-start-bitrate=\d+/g,"");return"H264"===p&&(f=f.replace(/profile-level-id=([0-9a-f]{4})[0-9a-f]{2}/i,"profile-level-id=$1")),f}static vp8(){return new VideoCodecCapability("VP8",{clockRate:9e4,mimeType:"video/VP8"})}static h264BaselineProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"})}static h264ConstrainedBaselineProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"})}static h264MainProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f"})}static h264HighProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f"})}static h264ConstrainedHighProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f"})}static h264(){return VideoCodecCapability.h264ConstrainedBaselineProfile()}static vp9Profile0(){return new VideoCodecCapability("VP9",{clockRate:9e4,mimeType:"video/VP9",sdpFmtpLine:"profile-id=0"})}static vp9(){return VideoCodecCapability.vp9Profile0()}static av1Main(){return new VideoCodecCapability("AV1",{clockRate:9e4,mimeType:"video/AV1"})}static av1(){return VideoCodecCapability.av1Main()}static fromSignaled(o){switch(o){case m.SdkVideoCodecCapability.VP8:return VideoCodecCapability.vp8();case m.SdkVideoCodecCapability.H264_BASELINE_PROFILE:return VideoCodecCapability.h264BaselineProfile();case m.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:return VideoCodecCapability.h264ConstrainedBaselineProfile();case m.SdkVideoCodecCapability.H264_MAIN_PROFILE:return VideoCodecCapability.h264MainProfile();case m.SdkVideoCodecCapability.H264_HIGH_PROFILE:return VideoCodecCapability.h264HighProfile();case m.SdkVideoCodecCapability.H264_CONSTRAINED_HIGH_PROFILE:return VideoCodecCapability.h264ConstrainedHighProfile();case m.SdkVideoCodecCapability.VP9_PROFILE_0:return VideoCodecCapability.vp9Profile0();case m.SdkVideoCodecCapability.AV1_MAIN_PROFILE:return VideoCodecCapability.av1Main();default:return}}}},0x1728c2fdd:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x10e0ee2b6),_=class ZLIBTextCompressor{constructor(o){this.logger=o}compress(o,p){if(p.length>0){let o=Math.min(p.length,ZLIBTextCompressor.MAX_DICTIONARY_SIZE);p=p.slice(0,o)}let f={memLevel:ZLIBTextCompressor.Z_MEM_LEVEL,dictionary:p};return m.deflateRaw(o,f)}decompress(o,p){if(p.length>0){let o=Math.min(p.length,ZLIBTextCompressor.MAX_DICTIONARY_SIZE);p=p.slice(0,o)}let f={to:"string",dictionary:p,chunkSize:4096},_="";try{_=m.inflateRaw(o,f)}catch(o){this.logger.error(`failed to decompress the string with error: [${o}]`)}return _}};p.default=_,_.Z_MEM_LEVEL=9,_.MAX_DICTIONARY_SIZE=31744},0x1f3b38cfe:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x247795129),_=f(0x17ecda005),w=f(0x1ac272bbc),I=f(0x15a2e95ed);p.default=class{constructor(o){this.logger=o,this.currentState=w.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(o,p){let f=this.currentState;if(f===w.SessionStateControllerState.NotConnected&&o===m.SessionStateControllerAction.Connect)this.transition(w.SessionStateControllerState.Connecting,o);else if(f===w.SessionStateControllerState.Connecting&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connecting&&o===m.SessionStateControllerAction.FinishConnecting)this.transition(w.SessionStateControllerState.Connected,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Disconnect)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Reconnect)this.transition(w.SessionStateControllerState.Connecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Update)this.transition(w.SessionStateControllerState.Updating,o);else if(f===w.SessionStateControllerState.Updating&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Updating&&o===m.SessionStateControllerAction.FinishUpdating)this.transition(w.SessionStateControllerState.Connected,o);else if(f===w.SessionStateControllerState.Disconnecting&&o===m.SessionStateControllerAction.FinishDisconnecting)this.transition(w.SessionStateControllerState.NotConnected,o);else if(this.canDefer(o))return this.logger.info(`deferring transition from ${w.SessionStateControllerState[this.currentState]} with ${m.SessionStateControllerAction[o]}`),this.deferAction(o,p),I.SessionStateControllerTransitionResult.DeferredTransition;else return this.logger.warn(`no transition found from ${w.SessionStateControllerState[this.currentState]} with ${m.SessionStateControllerAction[o]}`),I.SessionStateControllerTransitionResult.NoTransitionAvailable;try{p()}catch(p){return this.logger.error(`error during state ${w.SessionStateControllerState[this.currentState]} with action ${m.SessionStateControllerAction[o]}: ${p}`),this.logger.info(`rolling back transition to ${w.SessionStateControllerState[f]}`),this.currentState=f,I.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),I.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(o,p){this.logger.info(`transitioning from ${w.SessionStateControllerState[this.currentState]} to ${w.SessionStateControllerState[o]} with ${m.SessionStateControllerAction[p]}`),this.currentState=o}deferPriority(o){switch(o){case m.SessionStateControllerAction.Disconnect:return _.SessionStateControllerDeferPriority.VeryHigh;case m.SessionStateControllerAction.Fail:return _.SessionStateControllerDeferPriority.High;case m.SessionStateControllerAction.Reconnect:return _.SessionStateControllerDeferPriority.Medium;case m.SessionStateControllerAction.Update:return _.SessionStateControllerDeferPriority.Low;default:return _.SessionStateControllerDeferPriority.DoNotDefer}}deferAction(o,p){null!==this.deferredAction&&this.deferPriority(this.deferredAction)>this.deferPriority(o)||(this.deferredAction=o,this.deferredWork=p)}canDefer(o){return this.deferPriority(o)!==_.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===w.SessionStateControllerState.Connecting||this.currentState===w.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;let o=this.deferredAction,p=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${m.SessionStateControllerAction[o]}`),this.perform(o,p)!==I.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${m.SessionStateControllerAction[o]} in state ${w.SessionStateControllerState[this.currentState]}`)}}},0x247795129:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerAction=void 0,(m=f=p.SessionStateControllerAction||(p.SessionStateControllerAction={}))[m.Connect=0]="Connect",m[m.FinishConnecting=1]="FinishConnecting",m[m.Update=2]="Update",m[m.FinishUpdating=3]="FinishUpdating",m[m.Reconnect=4]="Reconnect",m[m.Disconnect=5]="Disconnect",m[m.Fail=6]="Fail",m[m.FinishDisconnecting=7]="FinishDisconnecting",p.default=f},0x17ecda005:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerDeferPriority=void 0,(m=f=p.SessionStateControllerDeferPriority||(p.SessionStateControllerDeferPriority={}))[m.DoNotDefer=0]="DoNotDefer",m[m.Low=1]="Low",m[m.Medium=2]="Medium",m[m.High=3]="High",m[m.VeryHigh=4]="VeryHigh",p.default=f},0x1ac272bbc:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerState=void 0,(m=f=p.SessionStateControllerState||(p.SessionStateControllerState={}))[m.NotConnected=0]="NotConnected",m[m.Connecting=1]="Connecting",m[m.Connected=2]="Connected",m[m.Updating=3]="Updating",m[m.Disconnecting=4]="Disconnecting",p.default=f},0x15a2e95ed:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerTransitionResult=void 0,(m=f=p.SessionStateControllerTransitionResult||(p.SessionStateControllerTransitionResult={}))[m.Transitioned=0]="Transitioned",m[m.NoTransitionAvailable=1]="NoTransitionAvailable",m[m.DeferredTransition=2]="DeferredTransition",m[m.TransitionFailed=3]="TransitionFailed",p.default=f},0x1bd55d3c4:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2)),w=m(f(0xa9a27686)),I=f(0x252035ee7),k=f(0xb79a45b7),M=m(f(0x22a0f7c69)),x=m(f(0x5b9f0577)),O=m(f(0x1a3216942)),L=f(0xf8b13aac),B=m(f(0x1e2f95c25)),U=m(f(0x216f98b8d)),$=class DefaultSignalingClient{constructor(o,p){this.webSocket=o,this.logger=p,this.closeEventHandler=o=>{this.resetConnection(),this.sendEvent(new B.default(this,U.default.WebSocketClosed,null,o.code,o.reason,o.wasClean)),this.serviceConnectionRequestQueue()},this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug(()=>"signaling client init"),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(o){this.logger.debug(()=>"registering signaling client observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.debug(()=>"removing signaling client observer"),this.observerQueue.delete(o)}openConnection(o){this.logger.info("adding connection request to queue: "+o.url()),this.connectionRequestQueue.push(o),this.closeConnection()}pingPong(o){this.logger.debug(()=>"sending ping");let p=I.SdkSignalFrame.create();return p.type=I.SdkSignalFrame.Type.PING_PONG,p.pingPong=o,this.sendMessage(p),p.timestampMs}join(o){this.logger.info("sending join");let p=I.SdkJoinFrame.create();p.protocolVersion=2,p.flags=I.SdkJoinFlags.HAS_STREAM_UPDATE;let f=new _.default,m={platformName:f.name(),platformVersion:f.version(),clientSource:M.default.sdkName,chimeSdkVersion:M.default.sdkVersion,clientUtcOffset:k.getFormattedOffset(new Date().getTimezoneOffset())};if(o.applicationMetadata){let{appName:p,appVersion:f}=o.applicationMetadata;m.appName=p,m.appVersion=f}p.clientDetails=I.SdkClientDetails.create(m),p.audioSessionId=this.audioSessionId,p.wantsCompressedSdp=DefaultSignalingClient.CLIENT_SUPPORTS_COMPRESSION,p.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender,p.serverSideNetworkAdaption=L.convertServerSideNetworkAdaptionEnumToSignaled(o.serverSideNetworkAdaption),p.supportedServerSideNetworkAdaptions=o.supportedServerSideNetworkAdaptions.map(L.convertServerSideNetworkAdaptionEnumToSignaled),p.wantsAllTemporalLayersInIndex=o.wantsAllTemporalLayersInIndex;let w=I.SdkSignalFrame.create();w.type=I.SdkSignalFrame.Type.JOIN,w.join=p,this.sendMessage(w)}subscribe(o){let p=I.SdkSubscribeFrame.create();if(p.sendStreams=[],p.sdpOffer=o.sdpOffer,o.connectionTypeHasVideo&&(p.receiveStreamIds=o.receiveStreamIds),o.audioHost&&(p.audioCheckin=o.audioCheckin,p.audioHost=o.audioHost,p.audioMuted=o.audioMuted,!o.audioCheckin)){let f=I.SdkStreamDescriptor.create();f.mediaType=I.SdkStreamMediaType.AUDIO,f.trackLabel="AmazonChimeExpressAudio",f.attendeeId=o.attendeeId,f.streamId=1,f.groupId=1,f.framerate=15,f.maxBitrateKbps=600,f.avgBitrateBps=4e5,p.sendStreams.push(f)}if(p.compressedSdpOffer=o.compressedSdpOffer,p.duplex=I.SdkStreamServiceType.RX,o.localVideoEnabled){p.duplex=I.SdkStreamServiceType.DUPLEX;for(let f=0;f<o.videoStreamDescriptions.length;f++){let m=o.videoStreamDescriptions[f].clone();m.attendeeId=o.attendeeId,p.sendStreams.push(m.toStreamDescriptor())}}o.videoSubscriptionConfiguration.length>0&&(p.videoSubscriptionConfiguration=o.videoSubscriptionConfiguration.map(this.convertSignalingClientVideoSubscriptionConfiguration));let f=I.SdkSignalFrame.create();f.type=I.SdkSignalFrame.Type.SUBSCRIBE,f.sub=p,this.sendMessage(f)}remoteVideoUpdate(o,p){let f=I.SdkRemoteVideoUpdateFrame.create();f.addedOrUpdatedVideoSubscriptions=o.map(this.convertSignalingClientVideoSubscriptionConfiguration),f.removedVideoSubscriptionMids=p;let m=I.SdkSignalFrame.create();m.type=I.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,m.remoteVideoUpdate=f,this.sendMessage(m)}convertSignalingClientVideoSubscriptionConfiguration(o){let p=new I.SdkVideoSubscriptionConfiguration;switch(p.mid=o.mid,p.attendeeId=o.attendeeId,p.streamId=o.streamId,p.groupId=o.groupId,p.priority=o.priority,p.targetBitrateKbps=o.targetBitrateKbps,o.qualityAdaptationPreference){case x.default.Balanced:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.BALANCED;break;case x.default.MaintainFramerate:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.MAINTAIN_FRAMERATE;break;case x.default.MaintainResolution:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.MAINTAIN_RESOLUTION;break;default:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.BALANCED}return p}leave(){let o=I.SdkSignalFrame.create();o.type=I.SdkSignalFrame.Type.LEAVE,o.leave=I.SdkLeaveFrame.create(),this.sendMessage(o),this.logger.debug(()=>"sent leave")}sendClientMetrics(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.CLIENT_METRIC,p.clientMetric=o,this.sendMessage(p)}sendDataMessage(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.DATA_MESSAGE,p.dataMessage=o,this.sendMessage(p)}closeConnection(){var o,p;if(this.webSocket.readyState()!==O.default.None&&this.webSocket.readyState()!==O.default.Closed){this.isClosing=!0,this.sendEvent(new B.default(this,U.default.WebSocketClosing,null));let f=new w.default(DefaultSignalingClient.CLOSE_EVENT_TIMEOUT_MS),handler=o=>{var p,m;null==(m=(p=this.webSocket).removeEventListener)||m.call(p,"close",handler),f.stop(),this.closeEventHandler(o)};null==(p=(o=this.webSocket).removeEventListener)||p.call(o,"close",this.closeEventHandler),this.webSocket.addEventListener("close",handler),f.start(()=>{handler(new CloseEvent("close",{wasClean:!1,code:1005,reason:"",bubbles:!1}))}),this.webSocket.close()}else this.logger.info("no existing signaling client connection needs closing"),this.serviceConnectionRequestQueue()}ready(){return this.webSocket.readyState()===O.default.Open&&!this.isClosing&&this.wasOpened}mute(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.AUDIO_CONTROL;let f=I.SdkAudioControlFrame.create();f.muted=o,p.audioControl=f,this.sendMessage(p)}pause(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.PAUSE,p.pause=I.SdkPauseResumeFrame.create(),p.pause.streamIds=o,this.sendMessage(p)}resume(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.RESUME,p.pause=I.SdkPauseResumeFrame.create(),p.pause.streamIds=o,this.sendMessage(p)}resetConnection(){this.webSocket.destroy(),this.wasOpened=!1}sendMessage(o){o.timestampMs=Date.now(),this.logger.debug(()=>`sending: ${JSON.stringify(o)}`);let p=this.prependWithFrameTypeRTC(I.SdkSignalFrame.encode(o).finish());if(this.ready()){if(!this.webSocket.send(p))return void this.sendEvent(new B.default(this,U.default.WebSocketSendMessageFailure,null));this.sendEvent(new B.default(this,U.default.WebSocketSentMessage,null))}else this.sendEvent(new B.default(this,U.default.WebSocketSkippedMessage,null))}receiveMessage(o){let p;try{p=I.SdkSignalFrame.decode(o)}catch(p){this.logger.info(`failed to decode: ${o}`),this.sendEvent(new B.default(this,U.default.ProtocolDecodeFailure,null));return}this.logger.debug(()=>`received: ${JSON.stringify(p)}`),this.webSocket.readyState()===O.default.Open?this.sendEvent(new B.default(this,U.default.ReceivedSignalFrame,p)):this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(p)}`)}stripFrameTypeRTC(o){let p=o[0];return p!==DefaultSignalingClient.FRAME_TYPE_RTC&&2!==p&&this.logger.warn(`expected FrameTypeRTC for message but got ${p}`),o.slice(1)}prependWithFrameTypeRTC(o){let p=new Uint8Array(o.length+1);return p[0]=DefaultSignalingClient.FRAME_TYPE_RTC,p.set(o,1),p}serviceConnectionRequestQueue(){if(0===this.connectionRequestQueue.length)return void this.logger.info("no connection requests to service");let o=this.connectionRequestQueue.shift();this.logger.info(`opening connection to ${o.url()}`),this.isClosing=!1,this.webSocket.create(o.url(),o.protocols()),this.setUpEventListeners(),this.sendEvent(new B.default(this,U.default.WebSocketConnecting,null))}sendEvent(o){switch(o.type){case U.default.WebSocketMessage:case U.default.ReceivedSignalFrame:case U.default.WebSocketSentMessage:this.logger.debug(()=>`notifying event: ${U.default[o.type]}`);break;case U.default.WebSocketSkippedMessage:this.logger.debug(()=>`notifying event: ${U.default[o.type]}, websocket state=${O.default[this.webSocket.readyState()]}`);break;case U.default.WebSocketClosed:this.logger.info(`Notifying event: ${U.default[o.type]}, 
              code: ${o.closeCode} reason: "${o.closeReason}" wasClean ${o.wasClean}`);break;default:this.logger.info(`notifying event: ${U.default[o.type]}`)}for(let p of this.observerQueue)p.handleSignalingClientEvent(o)}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.wasOpened=!0,this.sendEvent(new B.default(this,U.default.WebSocketOpen,null))}),this.webSocket.addEventListener("message",o=>{this.sendEvent(new B.default(this,U.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(o.data)))}),this.webSocket.addEventListener("close",this.closeEventHandler),this.webSocket.addEventListener("error",()=>{this.isClosing&&!this.wasOpened?this.logger.info("Signaling WebSocket ignoring error closing while connecting"):this.wasOpened?(this.logger.error("Signaling WebSocket received error while connected"),this.sendEvent(new B.default(this,U.default.WebSocketError,null))):(this.logger.error("Signaling WebSocket received error while connecting"),this.sendEvent(new B.default(this,U.default.WebSocketFailed,null)))})}generateNewAudioSessionId(){let o=new Uint32Array(1);return k.getRandomValues(o),o[0]}promoteToPrimaryMeeting(o){let p=I.SdkMeetingSessionCredentials.create();p.attendeeId=o.attendeeId,p.externalUserId=o.externalUserId,p.joinToken=o.joinToken;let f=I.SdkPrimaryMeetingJoinFrame.create();f.credentials=p;let m=I.SdkSignalFrame.create();m.type=I.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,m.primaryMeetingJoin=f,this.sendMessage(m)}demoteFromPrimaryMeeting(){let o=I.SdkPrimaryMeetingLeaveFrame.create(),p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,p.primaryMeetingLeave=o,this.sendMessage(p)}};p.default=$,$.FRAME_TYPE_RTC=5,$.CLOSE_EVENT_TIMEOUT_MS=2e3,$.CLIENT_SUPPORTS_COMPRESSION=!0},0xf8b13aac:(o,p,f)=>{"use strict";var m,_;Object.defineProperty(p,"__esModule",{value:!0}),p.convertServerSideNetworkAdaptionEnumToSignaled=p.convertServerSideNetworkAdaptionEnumFromSignaled=p.serverSideNetworkAdaptionIsNoneOrDefault=p.ServerSideNetworkAdaption=void 0;let w=f(0x252035ee7);(_=m=p.ServerSideNetworkAdaption||(p.ServerSideNetworkAdaption={}))[_.Default=0]="Default",_[_.None=1]="None",_[_.BandwidthProbing=2]="BandwidthProbing",_[_.BandwidthProbingAndRemoteVideoQualityAdaption=3]="BandwidthProbingAndRemoteVideoQualityAdaption",p.default=m,p.serverSideNetworkAdaptionIsNoneOrDefault=function(o){return o===m.None||o===m.Default},p.convertServerSideNetworkAdaptionEnumFromSignaled=function(o){switch(o){case w.SdkServerSideNetworkAdaption.DEFAULT:return m.Default;case w.SdkServerSideNetworkAdaption.NONE:return m.None;case w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:return m.BandwidthProbing;case w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION:return m.BandwidthProbingAndRemoteVideoQualityAdaption}},p.convertServerSideNetworkAdaptionEnumToSignaled=function(o){switch(o){case m.Default:return w.SdkServerSideNetworkAdaption.DEFAULT;case m.None:return w.SdkServerSideNetworkAdaption.NONE;case m.BandwidthProbing:return w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING;case m.BandwidthProbingAndRemoteVideoQualityAdaption:return w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION}}},0x296cfbc0:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){this.signalingURL=o,this.joinToken=p}url(){return this.signalingURL+"?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1"}protocols(){return["_aws_wt_session",this.joinToken]}}},0x1e2f95c25:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x216f98b8d));p.default=class{constructor(o,p,f,m,_,w){this.client=o,this.type=p,this.message=f,this.closeCode=m,this.closeReason=_,this.wasClean=w,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case _.default.WebSocketFailed:case _.default.WebSocketError:case _.default.WebSocketClosing:case _.default.WebSocketClosed:return!0;default:return!1}}}},0x216f98b8d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SignalingClientEventType=void 0,(m=f=p.SignalingClientEventType||(p.SignalingClientEventType={}))[m.WebSocketConnecting=0]="WebSocketConnecting",m[m.WebSocketOpen=1]="WebSocketOpen",m[m.WebSocketError=2]="WebSocketError",m[m.WebSocketClosing=3]="WebSocketClosing",m[m.WebSocketClosed=4]="WebSocketClosed",m[m.WebSocketFailed=5]="WebSocketFailed",m[m.WebSocketMessage=6]="WebSocketMessage",m[m.WebSocketSendMessageFailure=7]="WebSocketSendMessageFailure",m[m.WebSocketSentMessage=8]="WebSocketSentMessage",m[m.ProtocolDecodeFailure=9]="ProtocolDecodeFailure",m[m.ReceivedSignalFrame=10]="ReceivedSignalFrame",m[m.WebSocketSkippedMessage=11]="WebSocketSkippedMessage",p.default=f},0x1b32ed0f:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf8b13aac));p.default=class{constructor(o){this.applicationMetadata=o,this.serverSideNetworkAdaption=_.default.Default,this.supportedServerSideNetworkAdaptions=[],this.wantsAllTemporalLayersInIndex=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1}}},0x49608f19:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w,I,k,M,x){this.attendeeId=o,this.sdpOffer=p,this.audioHost=f,this.audioMuted=m,this.audioCheckin=_,this.receiveStreamIds=w,this.localVideoEnabled=I,this.videoStreamDescriptions=k,this.connectionTypeHasVideo=M,this.compressedSdpOffer=x,this.videoSubscriptionConfiguration=[]}}},0x1217c7f3f:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{equals(o){return void 0!==o&&this.mid===o.mid&&this.attendeeId===o.attendeeId&&this.streamId===o.streamId&&this.groupId===o.groupId&&this.priority===o.priority&&this.targetBitrateKbps===o.targetBitrateKbps&&this.qualityAdaptationPreference===o.qualityAdaptationPreference}}},0x252035ee7:(o,p,f)=>{"use strict";var m,_,w,I,k,M,x,O,L,B,U,$,q,Z,ee=f(0x1204db3cc),et=ee.Reader,ei=ee.Writer,er=ee.util,en=ee.roots.default||(ee.roots.default={});en.SdkSignalFrame=function(){var o,p;function SdkSignalFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkSignalFrame.prototype.timestampMs=er.Long?er.Long.fromBits(0,0,!0):0,SdkSignalFrame.prototype.type=1,SdkSignalFrame.prototype.error=null,SdkSignalFrame.prototype.join=null,SdkSignalFrame.prototype.joinack=null,SdkSignalFrame.prototype.sub=null,SdkSignalFrame.prototype.suback=null,SdkSignalFrame.prototype.index=null,SdkSignalFrame.prototype.pause=null,SdkSignalFrame.prototype.leave=null,SdkSignalFrame.prototype.leaveAck=null,SdkSignalFrame.prototype.bitrates=null,SdkSignalFrame.prototype.audioControl=null,SdkSignalFrame.prototype.audioMetadata=null,SdkSignalFrame.prototype.audioStreamIdInfo=null,SdkSignalFrame.prototype.pingPong=null,SdkSignalFrame.prototype.audioStatus=null,SdkSignalFrame.prototype.clientMetric=null,SdkSignalFrame.prototype.dataMessage=null,SdkSignalFrame.prototype.remoteVideoUpdate=null,SdkSignalFrame.prototype.primaryMeetingJoin=null,SdkSignalFrame.prototype.primaryMeetingJoinAck=null,SdkSignalFrame.prototype.primaryMeetingLeave=null,SdkSignalFrame.prototype.notification=null,SdkSignalFrame.create=function(o){return new SdkSignalFrame(o)},SdkSignalFrame.encode=function(o,p){return p||(p=ei.create()),p.uint32(8).uint64(o.timestampMs),p.uint32(16).int32(o.type),null!=o.error&&Object.hasOwnProperty.call(o,"error")&&en.SdkErrorFrame.encode(o.error,p.uint32(26).fork()).ldelim(),null!=o.join&&Object.hasOwnProperty.call(o,"join")&&en.SdkJoinFrame.encode(o.join,p.uint32(34).fork()).ldelim(),null!=o.joinack&&Object.hasOwnProperty.call(o,"joinack")&&en.SdkJoinAckFrame.encode(o.joinack,p.uint32(42).fork()).ldelim(),null!=o.sub&&Object.hasOwnProperty.call(o,"sub")&&en.SdkSubscribeFrame.encode(o.sub,p.uint32(50).fork()).ldelim(),null!=o.suback&&Object.hasOwnProperty.call(o,"suback")&&en.SdkSubscribeAckFrame.encode(o.suback,p.uint32(58).fork()).ldelim(),null!=o.index&&Object.hasOwnProperty.call(o,"index")&&en.SdkIndexFrame.encode(o.index,p.uint32(66).fork()).ldelim(),null!=o.pause&&Object.hasOwnProperty.call(o,"pause")&&en.SdkPauseResumeFrame.encode(o.pause,p.uint32(82).fork()).ldelim(),null!=o.leave&&Object.hasOwnProperty.call(o,"leave")&&en.SdkLeaveFrame.encode(o.leave,p.uint32(90).fork()).ldelim(),null!=o.leaveAck&&Object.hasOwnProperty.call(o,"leaveAck")&&en.SdkLeaveAckFrame.encode(o.leaveAck,p.uint32(98).fork()).ldelim(),null!=o.bitrates&&Object.hasOwnProperty.call(o,"bitrates")&&en.SdkBitrateFrame.encode(o.bitrates,p.uint32(114).fork()).ldelim(),null!=o.audioControl&&Object.hasOwnProperty.call(o,"audioControl")&&en.SdkAudioControlFrame.encode(o.audioControl,p.uint32(138).fork()).ldelim(),null!=o.audioMetadata&&Object.hasOwnProperty.call(o,"audioMetadata")&&en.SdkAudioMetadataFrame.encode(o.audioMetadata,p.uint32(146).fork()).ldelim(),null!=o.audioStreamIdInfo&&Object.hasOwnProperty.call(o,"audioStreamIdInfo")&&en.SdkAudioStreamIdInfoFrame.encode(o.audioStreamIdInfo,p.uint32(154).fork()).ldelim(),null!=o.pingPong&&Object.hasOwnProperty.call(o,"pingPong")&&en.SdkPingPongFrame.encode(o.pingPong,p.uint32(162).fork()).ldelim(),null!=o.audioStatus&&Object.hasOwnProperty.call(o,"audioStatus")&&en.SdkAudioStatusFrame.encode(o.audioStatus,p.uint32(170).fork()).ldelim(),null!=o.clientMetric&&Object.hasOwnProperty.call(o,"clientMetric")&&en.SdkClientMetricFrame.encode(o.clientMetric,p.uint32(178).fork()).ldelim(),null!=o.dataMessage&&Object.hasOwnProperty.call(o,"dataMessage")&&en.SdkDataMessageFrame.encode(o.dataMessage,p.uint32(186).fork()).ldelim(),null!=o.remoteVideoUpdate&&Object.hasOwnProperty.call(o,"remoteVideoUpdate")&&en.SdkRemoteVideoUpdateFrame.encode(o.remoteVideoUpdate,p.uint32(202).fork()).ldelim(),null!=o.primaryMeetingJoin&&Object.hasOwnProperty.call(o,"primaryMeetingJoin")&&en.SdkPrimaryMeetingJoinFrame.encode(o.primaryMeetingJoin,p.uint32(210).fork()).ldelim(),null!=o.primaryMeetingJoinAck&&Object.hasOwnProperty.call(o,"primaryMeetingJoinAck")&&en.SdkPrimaryMeetingJoinAckFrame.encode(o.primaryMeetingJoinAck,p.uint32(218).fork()).ldelim(),null!=o.primaryMeetingLeave&&Object.hasOwnProperty.call(o,"primaryMeetingLeave")&&en.SdkPrimaryMeetingLeaveFrame.encode(o.primaryMeetingLeave,p.uint32(226).fork()).ldelim(),null!=o.notification&&Object.hasOwnProperty.call(o,"notification")&&en.SdkNotificationFrame.encode(o.notification,p.uint32(282).fork()).ldelim(),p},SdkSignalFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkSignalFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkSignalFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.timestampMs=o.uint64();break;case 2:m.type=o.int32();break;case 3:m.error=en.SdkErrorFrame.decode(o,o.uint32());break;case 4:m.join=en.SdkJoinFrame.decode(o,o.uint32());break;case 5:m.joinack=en.SdkJoinAckFrame.decode(o,o.uint32());break;case 6:m.sub=en.SdkSubscribeFrame.decode(o,o.uint32());break;case 7:m.suback=en.SdkSubscribeAckFrame.decode(o,o.uint32());break;case 8:m.index=en.SdkIndexFrame.decode(o,o.uint32());break;case 10:m.pause=en.SdkPauseResumeFrame.decode(o,o.uint32());break;case 11:m.leave=en.SdkLeaveFrame.decode(o,o.uint32());break;case 12:m.leaveAck=en.SdkLeaveAckFrame.decode(o,o.uint32());break;case 14:m.bitrates=en.SdkBitrateFrame.decode(o,o.uint32());break;case 17:m.audioControl=en.SdkAudioControlFrame.decode(o,o.uint32());break;case 18:m.audioMetadata=en.SdkAudioMetadataFrame.decode(o,o.uint32());break;case 19:m.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.decode(o,o.uint32());break;case 20:m.pingPong=en.SdkPingPongFrame.decode(o,o.uint32());break;case 21:m.audioStatus=en.SdkAudioStatusFrame.decode(o,o.uint32());break;case 22:m.clientMetric=en.SdkClientMetricFrame.decode(o,o.uint32());break;case 23:m.dataMessage=en.SdkDataMessageFrame.decode(o,o.uint32());break;case 25:m.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.decode(o,o.uint32());break;case 26:m.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.decode(o,o.uint32());break;case 27:m.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.decode(o,o.uint32());break;case 28:m.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.decode(o,o.uint32());break;case 35:m.notification=en.SdkNotificationFrame.decode(o,o.uint32());break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("timestampMs"))throw er.ProtocolError("missing required 'timestampMs'",{instance:m});if(!m.hasOwnProperty("type"))throw er.ProtocolError("missing required 'type'",{instance:m});return m},SdkSignalFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSignalFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(!er.isInteger(o.timestampMs)&&!(o.timestampMs&&er.isInteger(o.timestampMs.low)&&er.isInteger(o.timestampMs.high)))return"timestampMs: integer|Long expected";switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 34:}},SdkSignalFrame.fromObject=function(o){if(o instanceof en.SdkSignalFrame)return o;var p=new en.SdkSignalFrame;switch(null!=o.timestampMs&&(er.Long?(p.timestampMs=er.Long.fromValue(o.timestampMs)).unsigned=!0:"string"==typeof o.timestampMs?p.timestampMs=parseInt(o.timestampMs,10):"number"==typeof o.timestampMs?p.timestampMs=o.timestampMs:"object"==typeof o.timestampMs&&(p.timestampMs=new er.LongBits(o.timestampMs.low>>>0,o.timestampMs.high>>>0).toNumber(!0))),o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"JOIN":case 1:p.type=1;break;case"JOIN_ACK":case 2:p.type=2;break;case"SUBSCRIBE":case 3:p.type=3;break;case"SUBSCRIBE_ACK":case 4:p.type=4;break;case"INDEX":case 5:p.type=5;break;case"PAUSE":case 7:p.type=7;break;case"RESUME":case 8:p.type=8;break;case"LEAVE":case 9:p.type=9;break;case"LEAVE_ACK":case 10:p.type=10;break;case"BITRATES":case 13:p.type=13;break;case"AUDIO_CONTROL":case 16:p.type=16;break;case"AUDIO_METADATA":case 17:p.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:p.type=18;break;case"PING_PONG":case 19:p.type=19;break;case"AUDIO_STATUS":case 20:p.type=20;break;case"CLIENT_METRIC":case 21:p.type=21;break;case"DATA_MESSAGE":case 22:p.type=22;break;case"REMOTE_VIDEO_UPDATE":case 24:p.type=24;break;case"PRIMARY_MEETING_JOIN":case 25:p.type=25;break;case"PRIMARY_MEETING_JOIN_ACK":case 26:p.type=26;break;case"PRIMARY_MEETING_LEAVE":case 27:p.type=27;break;case"NOTIFICATION":case 34:p.type=34}if(null!=o.error){if("object"!=typeof o.error)throw TypeError(".SdkSignalFrame.error: object expected");p.error=en.SdkErrorFrame.fromObject(o.error)}if(null!=o.join){if("object"!=typeof o.join)throw TypeError(".SdkSignalFrame.join: object expected");p.join=en.SdkJoinFrame.fromObject(o.join)}if(null!=o.joinack){if("object"!=typeof o.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");p.joinack=en.SdkJoinAckFrame.fromObject(o.joinack)}if(null!=o.sub){if("object"!=typeof o.sub)throw TypeError(".SdkSignalFrame.sub: object expected");p.sub=en.SdkSubscribeFrame.fromObject(o.sub)}if(null!=o.suback){if("object"!=typeof o.suback)throw TypeError(".SdkSignalFrame.suback: object expected");p.suback=en.SdkSubscribeAckFrame.fromObject(o.suback)}if(null!=o.index){if("object"!=typeof o.index)throw TypeError(".SdkSignalFrame.index: object expected");p.index=en.SdkIndexFrame.fromObject(o.index)}if(null!=o.pause){if("object"!=typeof o.pause)throw TypeError(".SdkSignalFrame.pause: object expected");p.pause=en.SdkPauseResumeFrame.fromObject(o.pause)}if(null!=o.leave){if("object"!=typeof o.leave)throw TypeError(".SdkSignalFrame.leave: object expected");p.leave=en.SdkLeaveFrame.fromObject(o.leave)}if(null!=o.leaveAck){if("object"!=typeof o.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");p.leaveAck=en.SdkLeaveAckFrame.fromObject(o.leaveAck)}if(null!=o.bitrates){if("object"!=typeof o.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");p.bitrates=en.SdkBitrateFrame.fromObject(o.bitrates)}if(null!=o.audioControl){if("object"!=typeof o.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");p.audioControl=en.SdkAudioControlFrame.fromObject(o.audioControl)}if(null!=o.audioMetadata){if("object"!=typeof o.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");p.audioMetadata=en.SdkAudioMetadataFrame.fromObject(o.audioMetadata)}if(null!=o.audioStreamIdInfo){if("object"!=typeof o.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");p.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.fromObject(o.audioStreamIdInfo)}if(null!=o.pingPong){if("object"!=typeof o.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");p.pingPong=en.SdkPingPongFrame.fromObject(o.pingPong)}if(null!=o.audioStatus){if("object"!=typeof o.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");p.audioStatus=en.SdkAudioStatusFrame.fromObject(o.audioStatus)}if(null!=o.clientMetric){if("object"!=typeof o.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");p.clientMetric=en.SdkClientMetricFrame.fromObject(o.clientMetric)}if(null!=o.dataMessage){if("object"!=typeof o.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");p.dataMessage=en.SdkDataMessageFrame.fromObject(o.dataMessage)}if(null!=o.remoteVideoUpdate){if("object"!=typeof o.remoteVideoUpdate)throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");p.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.fromObject(o.remoteVideoUpdate)}if(null!=o.primaryMeetingJoin){if("object"!=typeof o.primaryMeetingJoin)throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");p.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.fromObject(o.primaryMeetingJoin)}if(null!=o.primaryMeetingJoinAck){if("object"!=typeof o.primaryMeetingJoinAck)throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");p.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.fromObject(o.primaryMeetingJoinAck)}if(null!=o.primaryMeetingLeave){if("object"!=typeof o.primaryMeetingLeave)throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");p.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.fromObject(o.primaryMeetingLeave)}if(null!=o.notification){if("object"!=typeof o.notification)throw TypeError(".SdkSignalFrame.notification: object expected");p.notification=en.SdkNotificationFrame.fromObject(o.notification)}return p},SdkSignalFrame.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(er.Long){var m=new er.Long(0,0,!0);f.timestampMs=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.timestampMs=p.longs===String?"0":0;f.type=p.enums===String?"JOIN":1,f.error=null,f.join=null,f.joinack=null,f.sub=null,f.suback=null,f.index=null,f.pause=null,f.leave=null,f.leaveAck=null,f.bitrates=null,f.audioControl=null,f.audioMetadata=null,f.audioStreamIdInfo=null,f.pingPong=null,f.audioStatus=null,f.clientMetric=null,f.dataMessage=null,f.remoteVideoUpdate=null,f.primaryMeetingJoin=null,f.primaryMeetingJoinAck=null,f.primaryMeetingLeave=null,f.notification=null}return null!=o.timestampMs&&o.hasOwnProperty("timestampMs")&&("number"==typeof o.timestampMs?f.timestampMs=p.longs===String?String(o.timestampMs):o.timestampMs:f.timestampMs=p.longs===String?er.Long.prototype.toString.call(o.timestampMs):p.longs===Number?new er.LongBits(o.timestampMs.low>>>0,o.timestampMs.high>>>0).toNumber(!0):o.timestampMs),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkSignalFrame.Type[o.type]?o.type:en.SdkSignalFrame.Type[o.type]:o.type),null!=o.error&&o.hasOwnProperty("error")&&(f.error=en.SdkErrorFrame.toObject(o.error,p)),null!=o.join&&o.hasOwnProperty("join")&&(f.join=en.SdkJoinFrame.toObject(o.join,p)),null!=o.joinack&&o.hasOwnProperty("joinack")&&(f.joinack=en.SdkJoinAckFrame.toObject(o.joinack,p)),null!=o.sub&&o.hasOwnProperty("sub")&&(f.sub=en.SdkSubscribeFrame.toObject(o.sub,p)),null!=o.suback&&o.hasOwnProperty("suback")&&(f.suback=en.SdkSubscribeAckFrame.toObject(o.suback,p)),null!=o.index&&o.hasOwnProperty("index")&&(f.index=en.SdkIndexFrame.toObject(o.index,p)),null!=o.pause&&o.hasOwnProperty("pause")&&(f.pause=en.SdkPauseResumeFrame.toObject(o.pause,p)),null!=o.leave&&o.hasOwnProperty("leave")&&(f.leave=en.SdkLeaveFrame.toObject(o.leave,p)),null!=o.leaveAck&&o.hasOwnProperty("leaveAck")&&(f.leaveAck=en.SdkLeaveAckFrame.toObject(o.leaveAck,p)),null!=o.bitrates&&o.hasOwnProperty("bitrates")&&(f.bitrates=en.SdkBitrateFrame.toObject(o.bitrates,p)),null!=o.audioControl&&o.hasOwnProperty("audioControl")&&(f.audioControl=en.SdkAudioControlFrame.toObject(o.audioControl,p)),null!=o.audioMetadata&&o.hasOwnProperty("audioMetadata")&&(f.audioMetadata=en.SdkAudioMetadataFrame.toObject(o.audioMetadata,p)),null!=o.audioStreamIdInfo&&o.hasOwnProperty("audioStreamIdInfo")&&(f.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.toObject(o.audioStreamIdInfo,p)),null!=o.pingPong&&o.hasOwnProperty("pingPong")&&(f.pingPong=en.SdkPingPongFrame.toObject(o.pingPong,p)),null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&(f.audioStatus=en.SdkAudioStatusFrame.toObject(o.audioStatus,p)),null!=o.clientMetric&&o.hasOwnProperty("clientMetric")&&(f.clientMetric=en.SdkClientMetricFrame.toObject(o.clientMetric,p)),null!=o.dataMessage&&o.hasOwnProperty("dataMessage")&&(f.dataMessage=en.SdkDataMessageFrame.toObject(o.dataMessage,p)),null!=o.remoteVideoUpdate&&o.hasOwnProperty("remoteVideoUpdate")&&(f.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.toObject(o.remoteVideoUpdate,p)),null!=o.primaryMeetingJoin&&o.hasOwnProperty("primaryMeetingJoin")&&(f.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.toObject(o.primaryMeetingJoin,p)),null!=o.primaryMeetingJoinAck&&o.hasOwnProperty("primaryMeetingJoinAck")&&(f.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.toObject(o.primaryMeetingJoinAck,p)),null!=o.primaryMeetingLeave&&o.hasOwnProperty("primaryMeetingLeave")&&(f.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.toObject(o.primaryMeetingLeave,p)),null!=o.notification&&o.hasOwnProperty("notification")&&(f.notification=en.SdkNotificationFrame.toObject(o.notification,p)),f},SdkSignalFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSignalFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSignalFrame"},(p=Object.create(o={}))[o[1]="JOIN"]=1,p[o[2]="JOIN_ACK"]=2,p[o[3]="SUBSCRIBE"]=3,p[o[4]="SUBSCRIBE_ACK"]=4,p[o[5]="INDEX"]=5,p[o[7]="PAUSE"]=7,p[o[8]="RESUME"]=8,p[o[9]="LEAVE"]=9,p[o[10]="LEAVE_ACK"]=10,p[o[13]="BITRATES"]=13,p[o[16]="AUDIO_CONTROL"]=16,p[o[17]="AUDIO_METADATA"]=17,p[o[18]="AUDIO_STREAM_ID_INFO"]=18,p[o[19]="PING_PONG"]=19,p[o[20]="AUDIO_STATUS"]=20,p[o[21]="CLIENT_METRIC"]=21,p[o[22]="DATA_MESSAGE"]=22,p[o[24]="REMOTE_VIDEO_UPDATE"]=24,p[o[25]="PRIMARY_MEETING_JOIN"]=25,p[o[26]="PRIMARY_MEETING_JOIN_ACK"]=26,p[o[27]="PRIMARY_MEETING_LEAVE"]=27,p[o[34]="NOTIFICATION"]=34,SdkSignalFrame.Type=p,SdkSignalFrame}(),en.SdkErrorFrame=function(){function SdkErrorFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkErrorFrame.prototype.status=0,SdkErrorFrame.prototype.description="",SdkErrorFrame.create=function(o){return new SdkErrorFrame(o)},SdkErrorFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.status&&Object.hasOwnProperty.call(o,"status")&&p.uint32(8).uint32(o.status),null!=o.description&&Object.hasOwnProperty.call(o,"description")&&p.uint32(18).string(o.description),p},SdkErrorFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkErrorFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkErrorFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.status=o.uint32();break;case 2:m.description=o.string();break;default:o.skipType(7&_)}}return m},SdkErrorFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkErrorFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.status&&o.hasOwnProperty("status")&&!er.isInteger(o.status)?"status: integer expected":null!=o.description&&o.hasOwnProperty("description")&&!er.isString(o.description)?"description: string expected":null},SdkErrorFrame.fromObject=function(o){if(o instanceof en.SdkErrorFrame)return o;var p=new en.SdkErrorFrame;return null!=o.status&&(p.status=o.status>>>0),null!=o.description&&(p.description=String(o.description)),p},SdkErrorFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.status=0,f.description=""),null!=o.status&&o.hasOwnProperty("status")&&(f.status=o.status),null!=o.description&&o.hasOwnProperty("description")&&(f.description=o.description),f},SdkErrorFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkErrorFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkErrorFrame"},SdkErrorFrame}(),(_=Object.create(m={}))[m[2]="HAS_STREAM_UPDATE"]=2,_[m[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,_[m[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,en.SdkJoinFlags=_,en.SdkClientDetails=function(){function SdkClientDetails(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkClientDetails.prototype.appName="",SdkClientDetails.prototype.appVersion="",SdkClientDetails.prototype.deviceModel="",SdkClientDetails.prototype.deviceMake="",SdkClientDetails.prototype.platformName="",SdkClientDetails.prototype.platformVersion="",SdkClientDetails.prototype.clientSource="",SdkClientDetails.prototype.chimeSdkVersion="",SdkClientDetails.prototype.clientUtcOffset="",SdkClientDetails.create=function(o){return new SdkClientDetails(o)},SdkClientDetails.encode=function(o,p){return p||(p=ei.create()),null!=o.appName&&Object.hasOwnProperty.call(o,"appName")&&p.uint32(10).string(o.appName),null!=o.appVersion&&Object.hasOwnProperty.call(o,"appVersion")&&p.uint32(18).string(o.appVersion),null!=o.deviceModel&&Object.hasOwnProperty.call(o,"deviceModel")&&p.uint32(26).string(o.deviceModel),null!=o.deviceMake&&Object.hasOwnProperty.call(o,"deviceMake")&&p.uint32(34).string(o.deviceMake),null!=o.platformName&&Object.hasOwnProperty.call(o,"platformName")&&p.uint32(42).string(o.platformName),null!=o.platformVersion&&Object.hasOwnProperty.call(o,"platformVersion")&&p.uint32(50).string(o.platformVersion),null!=o.clientSource&&Object.hasOwnProperty.call(o,"clientSource")&&p.uint32(58).string(o.clientSource),null!=o.chimeSdkVersion&&Object.hasOwnProperty.call(o,"chimeSdkVersion")&&p.uint32(66).string(o.chimeSdkVersion),null!=o.clientUtcOffset&&Object.hasOwnProperty.call(o,"clientUtcOffset")&&p.uint32(74).string(o.clientUtcOffset),p},SdkClientDetails.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkClientDetails.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkClientDetails;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.appName=o.string();break;case 2:m.appVersion=o.string();break;case 3:m.deviceModel=o.string();break;case 4:m.deviceMake=o.string();break;case 5:m.platformName=o.string();break;case 6:m.platformVersion=o.string();break;case 7:m.clientSource=o.string();break;case 8:m.chimeSdkVersion=o.string();break;case 9:m.clientUtcOffset=o.string();break;default:o.skipType(7&_)}}return m},SdkClientDetails.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkClientDetails.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.appName&&o.hasOwnProperty("appName")&&!er.isString(o.appName)?"appName: string expected":null!=o.appVersion&&o.hasOwnProperty("appVersion")&&!er.isString(o.appVersion)?"appVersion: string expected":null!=o.deviceModel&&o.hasOwnProperty("deviceModel")&&!er.isString(o.deviceModel)?"deviceModel: string expected":null!=o.deviceMake&&o.hasOwnProperty("deviceMake")&&!er.isString(o.deviceMake)?"deviceMake: string expected":null!=o.platformName&&o.hasOwnProperty("platformName")&&!er.isString(o.platformName)?"platformName: string expected":null!=o.platformVersion&&o.hasOwnProperty("platformVersion")&&!er.isString(o.platformVersion)?"platformVersion: string expected":null!=o.clientSource&&o.hasOwnProperty("clientSource")&&!er.isString(o.clientSource)?"clientSource: string expected":null!=o.chimeSdkVersion&&o.hasOwnProperty("chimeSdkVersion")&&!er.isString(o.chimeSdkVersion)?"chimeSdkVersion: string expected":null!=o.clientUtcOffset&&o.hasOwnProperty("clientUtcOffset")&&!er.isString(o.clientUtcOffset)?"clientUtcOffset: string expected":null},SdkClientDetails.fromObject=function(o){if(o instanceof en.SdkClientDetails)return o;var p=new en.SdkClientDetails;return null!=o.appName&&(p.appName=String(o.appName)),null!=o.appVersion&&(p.appVersion=String(o.appVersion)),null!=o.deviceModel&&(p.deviceModel=String(o.deviceModel)),null!=o.deviceMake&&(p.deviceMake=String(o.deviceMake)),null!=o.platformName&&(p.platformName=String(o.platformName)),null!=o.platformVersion&&(p.platformVersion=String(o.platformVersion)),null!=o.clientSource&&(p.clientSource=String(o.clientSource)),null!=o.chimeSdkVersion&&(p.chimeSdkVersion=String(o.chimeSdkVersion)),null!=o.clientUtcOffset&&(p.clientUtcOffset=String(o.clientUtcOffset)),p},SdkClientDetails.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.appName="",f.appVersion="",f.deviceModel="",f.deviceMake="",f.platformName="",f.platformVersion="",f.clientSource="",f.chimeSdkVersion="",f.clientUtcOffset=""),null!=o.appName&&o.hasOwnProperty("appName")&&(f.appName=o.appName),null!=o.appVersion&&o.hasOwnProperty("appVersion")&&(f.appVersion=o.appVersion),null!=o.deviceModel&&o.hasOwnProperty("deviceModel")&&(f.deviceModel=o.deviceModel),null!=o.deviceMake&&o.hasOwnProperty("deviceMake")&&(f.deviceMake=o.deviceMake),null!=o.platformName&&o.hasOwnProperty("platformName")&&(f.platformName=o.platformName),null!=o.platformVersion&&o.hasOwnProperty("platformVersion")&&(f.platformVersion=o.platformVersion),null!=o.clientSource&&o.hasOwnProperty("clientSource")&&(f.clientSource=o.clientSource),null!=o.chimeSdkVersion&&o.hasOwnProperty("chimeSdkVersion")&&(f.chimeSdkVersion=o.chimeSdkVersion),null!=o.clientUtcOffset&&o.hasOwnProperty("clientUtcOffset")&&(f.clientUtcOffset=o.clientUtcOffset),f},SdkClientDetails.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkClientDetails.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkClientDetails"},SdkClientDetails}(),(I=Object.create(w={}))[w[1]="DEFAULT"]=1,I[w[2]="NONE"]=2,I[w[3]="BANDWIDTH_PROBING"]=3,I[w[4]="BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION"]=4,en.SdkServerSideNetworkAdaption=I,en.SdkJoinFrame=function(){function SdkJoinFrame(o){if(this.supportedServerSideNetworkAdaptions=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkJoinFrame.prototype.protocolVersion=2,SdkJoinFrame.prototype.maxNumOfVideos=0,SdkJoinFrame.prototype.flags=0,SdkJoinFrame.prototype.clientDetails=null,SdkJoinFrame.prototype.audioSessionId=er.Long?er.Long.fromBits(0,0,!0):0,SdkJoinFrame.prototype.wantsCompressedSdp=!1,SdkJoinFrame.prototype.serverSideNetworkAdaption=1,SdkJoinFrame.prototype.supportedServerSideNetworkAdaptions=er.emptyArray,SdkJoinFrame.prototype.wantsAllTemporalLayersInIndex=!1,SdkJoinFrame.prototype.disablePeriodicKeyframeRequestOnContentSender=!1,SdkJoinFrame.create=function(o){return new SdkJoinFrame(o)},SdkJoinFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.protocolVersion&&Object.hasOwnProperty.call(o,"protocolVersion")&&p.uint32(8).uint32(o.protocolVersion),null!=o.maxNumOfVideos&&Object.hasOwnProperty.call(o,"maxNumOfVideos")&&p.uint32(16).uint32(o.maxNumOfVideos),null!=o.flags&&Object.hasOwnProperty.call(o,"flags")&&p.uint32(24).uint32(o.flags),null!=o.clientDetails&&Object.hasOwnProperty.call(o,"clientDetails")&&en.SdkClientDetails.encode(o.clientDetails,p.uint32(34).fork()).ldelim(),null!=o.audioSessionId&&Object.hasOwnProperty.call(o,"audioSessionId")&&p.uint32(48).uint64(o.audioSessionId),null!=o.wantsCompressedSdp&&Object.hasOwnProperty.call(o,"wantsCompressedSdp")&&p.uint32(56).bool(o.wantsCompressedSdp),null!=o.serverSideNetworkAdaption&&Object.hasOwnProperty.call(o,"serverSideNetworkAdaption")&&p.uint32(80).int32(o.serverSideNetworkAdaption),null!=o.supportedServerSideNetworkAdaptions&&o.supportedServerSideNetworkAdaptions.length)for(var f=0;f<o.supportedServerSideNetworkAdaptions.length;++f)p.uint32(88).int32(o.supportedServerSideNetworkAdaptions[f]);return null!=o.wantsAllTemporalLayersInIndex&&Object.hasOwnProperty.call(o,"wantsAllTemporalLayersInIndex")&&p.uint32(96).bool(o.wantsAllTemporalLayersInIndex),null!=o.disablePeriodicKeyframeRequestOnContentSender&&Object.hasOwnProperty.call(o,"disablePeriodicKeyframeRequestOnContentSender")&&p.uint32(104).bool(o.disablePeriodicKeyframeRequestOnContentSender),p},SdkJoinFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkJoinFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkJoinFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.protocolVersion=o.uint32();break;case 2:m.maxNumOfVideos=o.uint32();break;case 3:m.flags=o.uint32();break;case 4:m.clientDetails=en.SdkClientDetails.decode(o,o.uint32());break;case 6:m.audioSessionId=o.uint64();break;case 7:m.wantsCompressedSdp=o.bool();break;case 10:m.serverSideNetworkAdaption=o.int32();break;case 11:if(m.supportedServerSideNetworkAdaptions&&m.supportedServerSideNetworkAdaptions.length||(m.supportedServerSideNetworkAdaptions=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.supportedServerSideNetworkAdaptions.push(o.int32());else m.supportedServerSideNetworkAdaptions.push(o.int32());break;case 12:m.wantsAllTemporalLayersInIndex=o.bool();break;case 13:m.disablePeriodicKeyframeRequestOnContentSender=o.bool();break;default:o.skipType(7&_)}}return m},SdkJoinFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkJoinFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.protocolVersion&&o.hasOwnProperty("protocolVersion")&&!er.isInteger(o.protocolVersion))return"protocolVersion: integer expected";if(null!=o.maxNumOfVideos&&o.hasOwnProperty("maxNumOfVideos")&&!er.isInteger(o.maxNumOfVideos))return"maxNumOfVideos: integer expected";if(null!=o.flags&&o.hasOwnProperty("flags")&&!er.isInteger(o.flags))return"flags: integer expected";if(null!=o.clientDetails&&o.hasOwnProperty("clientDetails")){var p=en.SdkClientDetails.verify(o.clientDetails);if(p)return"clientDetails."+p}if(null!=o.audioSessionId&&o.hasOwnProperty("audioSessionId")&&!er.isInteger(o.audioSessionId)&&!(o.audioSessionId&&er.isInteger(o.audioSessionId.low)&&er.isInteger(o.audioSessionId.high)))return"audioSessionId: integer|Long expected";if(null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof o.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=o.serverSideNetworkAdaption&&o.hasOwnProperty("serverSideNetworkAdaption"))switch(o.serverSideNetworkAdaption){default:return"serverSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:}if(null!=o.supportedServerSideNetworkAdaptions&&o.hasOwnProperty("supportedServerSideNetworkAdaptions")){if(!Array.isArray(o.supportedServerSideNetworkAdaptions))return"supportedServerSideNetworkAdaptions: array expected";for(var f=0;f<o.supportedServerSideNetworkAdaptions.length;++f)switch(o.supportedServerSideNetworkAdaptions[f]){default:return"supportedServerSideNetworkAdaptions: enum value[] expected";case 1:case 2:case 3:case 4:}}return null!=o.wantsAllTemporalLayersInIndex&&o.hasOwnProperty("wantsAllTemporalLayersInIndex")&&"boolean"!=typeof o.wantsAllTemporalLayersInIndex?"wantsAllTemporalLayersInIndex: boolean expected":null!=o.disablePeriodicKeyframeRequestOnContentSender&&o.hasOwnProperty("disablePeriodicKeyframeRequestOnContentSender")&&"boolean"!=typeof o.disablePeriodicKeyframeRequestOnContentSender?"disablePeriodicKeyframeRequestOnContentSender: boolean expected":null},SdkJoinFrame.fromObject=function(o){if(o instanceof en.SdkJoinFrame)return o;var p=new en.SdkJoinFrame;if(null!=o.protocolVersion&&(p.protocolVersion=o.protocolVersion>>>0),null!=o.maxNumOfVideos&&(p.maxNumOfVideos=o.maxNumOfVideos>>>0),null!=o.flags&&(p.flags=o.flags>>>0),null!=o.clientDetails){if("object"!=typeof o.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");p.clientDetails=en.SdkClientDetails.fromObject(o.clientDetails)}switch(null!=o.audioSessionId&&(er.Long?(p.audioSessionId=er.Long.fromValue(o.audioSessionId)).unsigned=!0:"string"==typeof o.audioSessionId?p.audioSessionId=parseInt(o.audioSessionId,10):"number"==typeof o.audioSessionId?p.audioSessionId=o.audioSessionId:"object"==typeof o.audioSessionId&&(p.audioSessionId=new er.LongBits(o.audioSessionId.low>>>0,o.audioSessionId.high>>>0).toNumber(!0))),null!=o.wantsCompressedSdp&&(p.wantsCompressedSdp=!!o.wantsCompressedSdp),o.serverSideNetworkAdaption){default:"number"==typeof o.serverSideNetworkAdaption&&(p.serverSideNetworkAdaption=o.serverSideNetworkAdaption);break;case"DEFAULT":case 1:p.serverSideNetworkAdaption=1;break;case"NONE":case 2:p.serverSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:p.serverSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.serverSideNetworkAdaption=4}if(o.supportedServerSideNetworkAdaptions){if(!Array.isArray(o.supportedServerSideNetworkAdaptions))throw TypeError(".SdkJoinFrame.supportedServerSideNetworkAdaptions: array expected");p.supportedServerSideNetworkAdaptions=[];for(var f=0;f<o.supportedServerSideNetworkAdaptions.length;++f)switch(o.supportedServerSideNetworkAdaptions[f]){default:if("number"==typeof o.supportedServerSideNetworkAdaptions[f]){p.supportedServerSideNetworkAdaptions[f]=o.supportedServerSideNetworkAdaptions[f];break}case"DEFAULT":case 1:p.supportedServerSideNetworkAdaptions[f]=1;break;case"NONE":case 2:p.supportedServerSideNetworkAdaptions[f]=2;break;case"BANDWIDTH_PROBING":case 3:p.supportedServerSideNetworkAdaptions[f]=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.supportedServerSideNetworkAdaptions[f]=4}}return null!=o.wantsAllTemporalLayersInIndex&&(p.wantsAllTemporalLayersInIndex=!!o.wantsAllTemporalLayersInIndex),null!=o.disablePeriodicKeyframeRequestOnContentSender&&(p.disablePeriodicKeyframeRequestOnContentSender=!!o.disablePeriodicKeyframeRequestOnContentSender),p},SdkJoinFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.supportedServerSideNetworkAdaptions=[]),p.defaults){if(f.protocolVersion=2,f.maxNumOfVideos=0,f.flags=0,f.clientDetails=null,er.Long){var m=new er.Long(0,0,!0);f.audioSessionId=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.audioSessionId=p.longs===String?"0":0;f.wantsCompressedSdp=!1,f.serverSideNetworkAdaption=p.enums===String?"DEFAULT":1,f.wantsAllTemporalLayersInIndex=!1,f.disablePeriodicKeyframeRequestOnContentSender=!1}if(null!=o.protocolVersion&&o.hasOwnProperty("protocolVersion")&&(f.protocolVersion=o.protocolVersion),null!=o.maxNumOfVideos&&o.hasOwnProperty("maxNumOfVideos")&&(f.maxNumOfVideos=o.maxNumOfVideos),null!=o.flags&&o.hasOwnProperty("flags")&&(f.flags=o.flags),null!=o.clientDetails&&o.hasOwnProperty("clientDetails")&&(f.clientDetails=en.SdkClientDetails.toObject(o.clientDetails,p)),null!=o.audioSessionId&&o.hasOwnProperty("audioSessionId")&&("number"==typeof o.audioSessionId?f.audioSessionId=p.longs===String?String(o.audioSessionId):o.audioSessionId:f.audioSessionId=p.longs===String?er.Long.prototype.toString.call(o.audioSessionId):p.longs===Number?new er.LongBits(o.audioSessionId.low>>>0,o.audioSessionId.high>>>0).toNumber(!0):o.audioSessionId),null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&(f.wantsCompressedSdp=o.wantsCompressedSdp),null!=o.serverSideNetworkAdaption&&o.hasOwnProperty("serverSideNetworkAdaption")&&(f.serverSideNetworkAdaption=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.serverSideNetworkAdaption]?o.serverSideNetworkAdaption:en.SdkServerSideNetworkAdaption[o.serverSideNetworkAdaption]:o.serverSideNetworkAdaption),o.supportedServerSideNetworkAdaptions&&o.supportedServerSideNetworkAdaptions.length){f.supportedServerSideNetworkAdaptions=[];for(var _=0;_<o.supportedServerSideNetworkAdaptions.length;++_)f.supportedServerSideNetworkAdaptions[_]=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.supportedServerSideNetworkAdaptions[_]]?o.supportedServerSideNetworkAdaptions[_]:en.SdkServerSideNetworkAdaption[o.supportedServerSideNetworkAdaptions[_]]:o.supportedServerSideNetworkAdaptions[_]}return null!=o.wantsAllTemporalLayersInIndex&&o.hasOwnProperty("wantsAllTemporalLayersInIndex")&&(f.wantsAllTemporalLayersInIndex=o.wantsAllTemporalLayersInIndex),null!=o.disablePeriodicKeyframeRequestOnContentSender&&o.hasOwnProperty("disablePeriodicKeyframeRequestOnContentSender")&&(f.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender),f},SdkJoinFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkJoinFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkJoinFrame"},SdkJoinFrame}(),en.SdkJoinAckFrame=function(){function SdkJoinAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkJoinAckFrame.prototype.turnCredentials=null,SdkJoinAckFrame.prototype.videoSubscriptionLimit=0,SdkJoinAckFrame.prototype.wantsCompressedSdp=!1,SdkJoinAckFrame.prototype.defaultServerSideNetworkAdaption=1,SdkJoinAckFrame.create=function(o){return new SdkJoinAckFrame(o)},SdkJoinAckFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.turnCredentials&&Object.hasOwnProperty.call(o,"turnCredentials")&&en.SdkTurnCredentials.encode(o.turnCredentials,p.uint32(10).fork()).ldelim(),null!=o.videoSubscriptionLimit&&Object.hasOwnProperty.call(o,"videoSubscriptionLimit")&&p.uint32(16).uint32(o.videoSubscriptionLimit),null!=o.wantsCompressedSdp&&Object.hasOwnProperty.call(o,"wantsCompressedSdp")&&p.uint32(24).bool(o.wantsCompressedSdp),null!=o.defaultServerSideNetworkAdaption&&Object.hasOwnProperty.call(o,"defaultServerSideNetworkAdaption")&&p.uint32(32).int32(o.defaultServerSideNetworkAdaption),p},SdkJoinAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkJoinAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkJoinAckFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.turnCredentials=en.SdkTurnCredentials.decode(o,o.uint32());break;case 2:m.videoSubscriptionLimit=o.uint32();break;case 3:m.wantsCompressedSdp=o.bool();break;case 4:m.defaultServerSideNetworkAdaption=o.int32();break;default:o.skipType(7&_)}}return m},SdkJoinAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkJoinAckFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.turnCredentials&&o.hasOwnProperty("turnCredentials")){var p=en.SdkTurnCredentials.verify(o.turnCredentials);if(p)return"turnCredentials."+p}if(null!=o.videoSubscriptionLimit&&o.hasOwnProperty("videoSubscriptionLimit")&&!er.isInteger(o.videoSubscriptionLimit))return"videoSubscriptionLimit: integer expected";if(null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof o.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=o.defaultServerSideNetworkAdaption&&o.hasOwnProperty("defaultServerSideNetworkAdaption"))switch(o.defaultServerSideNetworkAdaption){default:return"defaultServerSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:}return null},SdkJoinAckFrame.fromObject=function(o){if(o instanceof en.SdkJoinAckFrame)return o;var p=new en.SdkJoinAckFrame;if(null!=o.turnCredentials){if("object"!=typeof o.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");p.turnCredentials=en.SdkTurnCredentials.fromObject(o.turnCredentials)}switch(null!=o.videoSubscriptionLimit&&(p.videoSubscriptionLimit=o.videoSubscriptionLimit>>>0),null!=o.wantsCompressedSdp&&(p.wantsCompressedSdp=!!o.wantsCompressedSdp),o.defaultServerSideNetworkAdaption){default:"number"==typeof o.defaultServerSideNetworkAdaption&&(p.defaultServerSideNetworkAdaption=o.defaultServerSideNetworkAdaption);break;case"DEFAULT":case 1:p.defaultServerSideNetworkAdaption=1;break;case"NONE":case 2:p.defaultServerSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:p.defaultServerSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.defaultServerSideNetworkAdaption=4}return p},SdkJoinAckFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.turnCredentials=null,f.videoSubscriptionLimit=0,f.wantsCompressedSdp=!1,f.defaultServerSideNetworkAdaption=p.enums===String?"DEFAULT":1),null!=o.turnCredentials&&o.hasOwnProperty("turnCredentials")&&(f.turnCredentials=en.SdkTurnCredentials.toObject(o.turnCredentials,p)),null!=o.videoSubscriptionLimit&&o.hasOwnProperty("videoSubscriptionLimit")&&(f.videoSubscriptionLimit=o.videoSubscriptionLimit),null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&(f.wantsCompressedSdp=o.wantsCompressedSdp),null!=o.defaultServerSideNetworkAdaption&&o.hasOwnProperty("defaultServerSideNetworkAdaption")&&(f.defaultServerSideNetworkAdaption=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.defaultServerSideNetworkAdaption]?o.defaultServerSideNetworkAdaption:en.SdkServerSideNetworkAdaption[o.defaultServerSideNetworkAdaption]:o.defaultServerSideNetworkAdaption),f},SdkJoinAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkJoinAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkJoinAckFrame"},SdkJoinAckFrame}(),en.SdkLeaveFrame=function(){function SdkLeaveFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkLeaveFrame.create=function(o){return new SdkLeaveFrame(o)},SdkLeaveFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkLeaveFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkLeaveFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkLeaveFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkLeaveFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkLeaveFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkLeaveFrame.fromObject=function(o){return o instanceof en.SdkLeaveFrame?o:new en.SdkLeaveFrame},SdkLeaveFrame.toObject=function(){return{}},SdkLeaveFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkLeaveFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkLeaveFrame"},SdkLeaveFrame}(),en.SdkLeaveAckFrame=function(){function SdkLeaveAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkLeaveAckFrame.create=function(o){return new SdkLeaveAckFrame(o)},SdkLeaveAckFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkLeaveAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkLeaveAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkLeaveAckFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkLeaveAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkLeaveAckFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkLeaveAckFrame.fromObject=function(o){return o instanceof en.SdkLeaveAckFrame?o:new en.SdkLeaveAckFrame},SdkLeaveAckFrame.toObject=function(){return{}},SdkLeaveAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkLeaveAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkLeaveAckFrame"},SdkLeaveAckFrame}(),(M=Object.create(k={}))[k[1]="RX"]=1,M[k[2]="TX"]=2,M[k[3]="DUPLEX"]=3,en.SdkStreamServiceType=M,(O=Object.create(x={}))[x[1]="AUDIO"]=1,O[x[2]="VIDEO"]=2,en.SdkStreamMediaType=O,en.SdkSubscribeFrame=function(){function SdkSubscribeFrame(o){if(this.sendStreams=[],this.receiveStreamIds=[],this.videoSubscriptionConfiguration=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkSubscribeFrame.prototype.duplex=1,SdkSubscribeFrame.prototype.sendStreams=er.emptyArray,SdkSubscribeFrame.prototype.receiveStreamIds=er.emptyArray,SdkSubscribeFrame.prototype.sdpOffer="",SdkSubscribeFrame.prototype.audioHost="",SdkSubscribeFrame.prototype.audioCheckin=!1,SdkSubscribeFrame.prototype.audioMuted=!1,SdkSubscribeFrame.prototype.compressedSdpOffer=er.newBuffer([]),SdkSubscribeFrame.prototype.videoSubscriptionConfiguration=er.emptyArray,SdkSubscribeFrame.create=function(o){return new SdkSubscribeFrame(o)},SdkSubscribeFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.duplex&&Object.hasOwnProperty.call(o,"duplex")&&p.uint32(8).int32(o.duplex),null!=o.sendStreams&&o.sendStreams.length)for(var f=0;f<o.sendStreams.length;++f)en.SdkStreamDescriptor.encode(o.sendStreams[f],p.uint32(18).fork()).ldelim();if(null!=o.receiveStreamIds&&o.receiveStreamIds.length)for(var f=0;f<o.receiveStreamIds.length;++f)p.uint32(24).uint32(o.receiveStreamIds[f]);if(null!=o.sdpOffer&&Object.hasOwnProperty.call(o,"sdpOffer")&&p.uint32(34).string(o.sdpOffer),null!=o.audioHost&&Object.hasOwnProperty.call(o,"audioHost")&&p.uint32(42).string(o.audioHost),null!=o.audioCheckin&&Object.hasOwnProperty.call(o,"audioCheckin")&&p.uint32(48).bool(o.audioCheckin),null!=o.audioMuted&&Object.hasOwnProperty.call(o,"audioMuted")&&p.uint32(56).bool(o.audioMuted),null!=o.compressedSdpOffer&&Object.hasOwnProperty.call(o,"compressedSdpOffer")&&p.uint32(66).bytes(o.compressedSdpOffer),null!=o.videoSubscriptionConfiguration&&o.videoSubscriptionConfiguration.length)for(var f=0;f<o.videoSubscriptionConfiguration.length;++f)en.SdkVideoSubscriptionConfiguration.encode(o.videoSubscriptionConfiguration[f],p.uint32(74).fork()).ldelim();return p},SdkSubscribeFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkSubscribeFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkSubscribeFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.duplex=o.int32();break;case 2:m.sendStreams&&m.sendStreams.length||(m.sendStreams=[]),m.sendStreams.push(en.SdkStreamDescriptor.decode(o,o.uint32()));break;case 3:if(m.receiveStreamIds&&m.receiveStreamIds.length||(m.receiveStreamIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.receiveStreamIds.push(o.uint32());else m.receiveStreamIds.push(o.uint32());break;case 4:m.sdpOffer=o.string();break;case 5:m.audioHost=o.string();break;case 6:m.audioCheckin=o.bool();break;case 7:m.audioMuted=o.bool();break;case 8:m.compressedSdpOffer=o.bytes();break;case 9:m.videoSubscriptionConfiguration&&m.videoSubscriptionConfiguration.length||(m.videoSubscriptionConfiguration=[]),m.videoSubscriptionConfiguration.push(en.SdkVideoSubscriptionConfiguration.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkSubscribeFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSubscribeFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.duplex&&o.hasOwnProperty("duplex"))switch(o.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=o.sendStreams&&o.hasOwnProperty("sendStreams")){if(!Array.isArray(o.sendStreams))return"sendStreams: array expected";for(var p=0;p<o.sendStreams.length;++p){var f=en.SdkStreamDescriptor.verify(o.sendStreams[p]);if(f)return"sendStreams."+f}}if(null!=o.receiveStreamIds&&o.hasOwnProperty("receiveStreamIds")){if(!Array.isArray(o.receiveStreamIds))return"receiveStreamIds: array expected";for(var p=0;p<o.receiveStreamIds.length;++p)if(!er.isInteger(o.receiveStreamIds[p]))return"receiveStreamIds: integer[] expected"}if(null!=o.sdpOffer&&o.hasOwnProperty("sdpOffer")&&!er.isString(o.sdpOffer))return"sdpOffer: string expected";if(null!=o.audioHost&&o.hasOwnProperty("audioHost")&&!er.isString(o.audioHost))return"audioHost: string expected";if(null!=o.audioCheckin&&o.hasOwnProperty("audioCheckin")&&"boolean"!=typeof o.audioCheckin)return"audioCheckin: boolean expected";if(null!=o.audioMuted&&o.hasOwnProperty("audioMuted")&&"boolean"!=typeof o.audioMuted)return"audioMuted: boolean expected";if(null!=o.compressedSdpOffer&&o.hasOwnProperty("compressedSdpOffer")&&!(o.compressedSdpOffer&&"number"==typeof o.compressedSdpOffer.length||er.isString(o.compressedSdpOffer)))return"compressedSdpOffer: buffer expected";if(null!=o.videoSubscriptionConfiguration&&o.hasOwnProperty("videoSubscriptionConfiguration")){if(!Array.isArray(o.videoSubscriptionConfiguration))return"videoSubscriptionConfiguration: array expected";for(var p=0;p<o.videoSubscriptionConfiguration.length;++p){var f=en.SdkVideoSubscriptionConfiguration.verify(o.videoSubscriptionConfiguration[p]);if(f)return"videoSubscriptionConfiguration."+f}}return null},SdkSubscribeFrame.fromObject=function(o){if(o instanceof en.SdkSubscribeFrame)return o;var p=new en.SdkSubscribeFrame;switch(o.duplex){default:"number"==typeof o.duplex&&(p.duplex=o.duplex);break;case"RX":case 1:p.duplex=1;break;case"TX":case 2:p.duplex=2;break;case"DUPLEX":case 3:p.duplex=3}if(o.sendStreams){if(!Array.isArray(o.sendStreams))throw TypeError(".SdkSubscribeFrame.sendStreams: array expected");p.sendStreams=[];for(var f=0;f<o.sendStreams.length;++f){if("object"!=typeof o.sendStreams[f])throw TypeError(".SdkSubscribeFrame.sendStreams: object expected");p.sendStreams[f]=en.SdkStreamDescriptor.fromObject(o.sendStreams[f])}}if(o.receiveStreamIds){if(!Array.isArray(o.receiveStreamIds))throw TypeError(".SdkSubscribeFrame.receiveStreamIds: array expected");p.receiveStreamIds=[];for(var f=0;f<o.receiveStreamIds.length;++f)p.receiveStreamIds[f]=o.receiveStreamIds[f]>>>0}if(null!=o.sdpOffer&&(p.sdpOffer=String(o.sdpOffer)),null!=o.audioHost&&(p.audioHost=String(o.audioHost)),null!=o.audioCheckin&&(p.audioCheckin=!!o.audioCheckin),null!=o.audioMuted&&(p.audioMuted=!!o.audioMuted),null!=o.compressedSdpOffer&&("string"==typeof o.compressedSdpOffer?er.base64.decode(o.compressedSdpOffer,p.compressedSdpOffer=er.newBuffer(er.base64.length(o.compressedSdpOffer)),0):o.compressedSdpOffer.length>=0&&(p.compressedSdpOffer=o.compressedSdpOffer)),o.videoSubscriptionConfiguration){if(!Array.isArray(o.videoSubscriptionConfiguration))throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: array expected");p.videoSubscriptionConfiguration=[];for(var f=0;f<o.videoSubscriptionConfiguration.length;++f){if("object"!=typeof o.videoSubscriptionConfiguration[f])throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: object expected");p.videoSubscriptionConfiguration[f]=en.SdkVideoSubscriptionConfiguration.fromObject(o.videoSubscriptionConfiguration[f])}}return p},SdkSubscribeFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.sendStreams=[],f.receiveStreamIds=[],f.videoSubscriptionConfiguration=[]),p.defaults&&(f.duplex=p.enums===String?"RX":1,f.sdpOffer="",f.audioHost="",f.audioCheckin=!1,f.audioMuted=!1,p.bytes===String?f.compressedSdpOffer="":(f.compressedSdpOffer=[],p.bytes!==Array&&(f.compressedSdpOffer=er.newBuffer(f.compressedSdpOffer)))),null!=o.duplex&&o.hasOwnProperty("duplex")&&(f.duplex=p.enums===String?void 0===en.SdkStreamServiceType[o.duplex]?o.duplex:en.SdkStreamServiceType[o.duplex]:o.duplex),o.sendStreams&&o.sendStreams.length){f.sendStreams=[];for(var m=0;m<o.sendStreams.length;++m)f.sendStreams[m]=en.SdkStreamDescriptor.toObject(o.sendStreams[m],p)}if(o.receiveStreamIds&&o.receiveStreamIds.length){f.receiveStreamIds=[];for(var m=0;m<o.receiveStreamIds.length;++m)f.receiveStreamIds[m]=o.receiveStreamIds[m]}if(null!=o.sdpOffer&&o.hasOwnProperty("sdpOffer")&&(f.sdpOffer=o.sdpOffer),null!=o.audioHost&&o.hasOwnProperty("audioHost")&&(f.audioHost=o.audioHost),null!=o.audioCheckin&&o.hasOwnProperty("audioCheckin")&&(f.audioCheckin=o.audioCheckin),null!=o.audioMuted&&o.hasOwnProperty("audioMuted")&&(f.audioMuted=o.audioMuted),null!=o.compressedSdpOffer&&o.hasOwnProperty("compressedSdpOffer")&&(f.compressedSdpOffer=p.bytes===String?er.base64.encode(o.compressedSdpOffer,0,o.compressedSdpOffer.length):p.bytes===Array?Array.prototype.slice.call(o.compressedSdpOffer):o.compressedSdpOffer),o.videoSubscriptionConfiguration&&o.videoSubscriptionConfiguration.length){f.videoSubscriptionConfiguration=[];for(var m=0;m<o.videoSubscriptionConfiguration.length;++m)f.videoSubscriptionConfiguration[m]=en.SdkVideoSubscriptionConfiguration.toObject(o.videoSubscriptionConfiguration[m],p)}return f},SdkSubscribeFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSubscribeFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSubscribeFrame"},SdkSubscribeFrame}(),en.SdkSubscribeAckFrame=function(){function SdkSubscribeAckFrame(o){if(this.allocations=[],this.tracks=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkSubscribeAckFrame.prototype.duplex=1,SdkSubscribeAckFrame.prototype.allocations=er.emptyArray,SdkSubscribeAckFrame.prototype.sdpAnswer="",SdkSubscribeAckFrame.prototype.tracks=er.emptyArray,SdkSubscribeAckFrame.prototype.compressedSdpAnswer=er.newBuffer([]),SdkSubscribeAckFrame.create=function(o){return new SdkSubscribeAckFrame(o)},SdkSubscribeAckFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.duplex&&Object.hasOwnProperty.call(o,"duplex")&&p.uint32(8).int32(o.duplex),null!=o.allocations&&o.allocations.length)for(var f=0;f<o.allocations.length;++f)en.SdkStreamAllocation.encode(o.allocations[f],p.uint32(18).fork()).ldelim();if(null!=o.sdpAnswer&&Object.hasOwnProperty.call(o,"sdpAnswer")&&p.uint32(26).string(o.sdpAnswer),null!=o.tracks&&o.tracks.length)for(var f=0;f<o.tracks.length;++f)en.SdkTrackMapping.encode(o.tracks[f],p.uint32(34).fork()).ldelim();return null!=o.compressedSdpAnswer&&Object.hasOwnProperty.call(o,"compressedSdpAnswer")&&p.uint32(42).bytes(o.compressedSdpAnswer),p},SdkSubscribeAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkSubscribeAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkSubscribeAckFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.duplex=o.int32();break;case 2:m.allocations&&m.allocations.length||(m.allocations=[]),m.allocations.push(en.SdkStreamAllocation.decode(o,o.uint32()));break;case 3:m.sdpAnswer=o.string();break;case 4:m.tracks&&m.tracks.length||(m.tracks=[]),m.tracks.push(en.SdkTrackMapping.decode(o,o.uint32()));break;case 5:m.compressedSdpAnswer=o.bytes();break;default:o.skipType(7&_)}}return m},SdkSubscribeAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSubscribeAckFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.duplex&&o.hasOwnProperty("duplex"))switch(o.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=o.allocations&&o.hasOwnProperty("allocations")){if(!Array.isArray(o.allocations))return"allocations: array expected";for(var p=0;p<o.allocations.length;++p){var f=en.SdkStreamAllocation.verify(o.allocations[p]);if(f)return"allocations."+f}}if(null!=o.sdpAnswer&&o.hasOwnProperty("sdpAnswer")&&!er.isString(o.sdpAnswer))return"sdpAnswer: string expected";if(null!=o.tracks&&o.hasOwnProperty("tracks")){if(!Array.isArray(o.tracks))return"tracks: array expected";for(var p=0;p<o.tracks.length;++p){var f=en.SdkTrackMapping.verify(o.tracks[p]);if(f)return"tracks."+f}}return null!=o.compressedSdpAnswer&&o.hasOwnProperty("compressedSdpAnswer")&&!(o.compressedSdpAnswer&&"number"==typeof o.compressedSdpAnswer.length||er.isString(o.compressedSdpAnswer))?"compressedSdpAnswer: buffer expected":null},SdkSubscribeAckFrame.fromObject=function(o){if(o instanceof en.SdkSubscribeAckFrame)return o;var p=new en.SdkSubscribeAckFrame;switch(o.duplex){default:"number"==typeof o.duplex&&(p.duplex=o.duplex);break;case"RX":case 1:p.duplex=1;break;case"TX":case 2:p.duplex=2;break;case"DUPLEX":case 3:p.duplex=3}if(o.allocations){if(!Array.isArray(o.allocations))throw TypeError(".SdkSubscribeAckFrame.allocations: array expected");p.allocations=[];for(var f=0;f<o.allocations.length;++f){if("object"!=typeof o.allocations[f])throw TypeError(".SdkSubscribeAckFrame.allocations: object expected");p.allocations[f]=en.SdkStreamAllocation.fromObject(o.allocations[f])}}if(null!=o.sdpAnswer&&(p.sdpAnswer=String(o.sdpAnswer)),o.tracks){if(!Array.isArray(o.tracks))throw TypeError(".SdkSubscribeAckFrame.tracks: array expected");p.tracks=[];for(var f=0;f<o.tracks.length;++f){if("object"!=typeof o.tracks[f])throw TypeError(".SdkSubscribeAckFrame.tracks: object expected");p.tracks[f]=en.SdkTrackMapping.fromObject(o.tracks[f])}}return null!=o.compressedSdpAnswer&&("string"==typeof o.compressedSdpAnswer?er.base64.decode(o.compressedSdpAnswer,p.compressedSdpAnswer=er.newBuffer(er.base64.length(o.compressedSdpAnswer)),0):o.compressedSdpAnswer.length>=0&&(p.compressedSdpAnswer=o.compressedSdpAnswer)),p},SdkSubscribeAckFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.allocations=[],f.tracks=[]),p.defaults&&(f.duplex=p.enums===String?"RX":1,f.sdpAnswer="",p.bytes===String?f.compressedSdpAnswer="":(f.compressedSdpAnswer=[],p.bytes!==Array&&(f.compressedSdpAnswer=er.newBuffer(f.compressedSdpAnswer)))),null!=o.duplex&&o.hasOwnProperty("duplex")&&(f.duplex=p.enums===String?void 0===en.SdkStreamServiceType[o.duplex]?o.duplex:en.SdkStreamServiceType[o.duplex]:o.duplex),o.allocations&&o.allocations.length){f.allocations=[];for(var m=0;m<o.allocations.length;++m)f.allocations[m]=en.SdkStreamAllocation.toObject(o.allocations[m],p)}if(null!=o.sdpAnswer&&o.hasOwnProperty("sdpAnswer")&&(f.sdpAnswer=o.sdpAnswer),o.tracks&&o.tracks.length){f.tracks=[];for(var m=0;m<o.tracks.length;++m)f.tracks[m]=en.SdkTrackMapping.toObject(o.tracks[m],p)}return null!=o.compressedSdpAnswer&&o.hasOwnProperty("compressedSdpAnswer")&&(f.compressedSdpAnswer=p.bytes===String?er.base64.encode(o.compressedSdpAnswer,0,o.compressedSdpAnswer.length):p.bytes===Array?Array.prototype.slice.call(o.compressedSdpAnswer):o.compressedSdpAnswer),f},SdkSubscribeAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSubscribeAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSubscribeAckFrame"},SdkSubscribeAckFrame}(),en.SdkIndexFrame=function(){function SdkIndexFrame(o){if(this.sources=[],this.pausedAtSourceIds=[],this.supportedReceiveCodecIntersection=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkIndexFrame.prototype.atCapacity=!1,SdkIndexFrame.prototype.sources=er.emptyArray,SdkIndexFrame.prototype.pausedAtSourceIds=er.emptyArray,SdkIndexFrame.prototype.numParticipants=0,SdkIndexFrame.prototype.supportedReceiveCodecIntersection=er.emptyArray,SdkIndexFrame.create=function(o){return new SdkIndexFrame(o)},SdkIndexFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.atCapacity&&Object.hasOwnProperty.call(o,"atCapacity")&&p.uint32(8).bool(o.atCapacity),null!=o.sources&&o.sources.length)for(var f=0;f<o.sources.length;++f)en.SdkStreamDescriptor.encode(o.sources[f],p.uint32(18).fork()).ldelim();if(null!=o.pausedAtSourceIds&&o.pausedAtSourceIds.length)for(var f=0;f<o.pausedAtSourceIds.length;++f)p.uint32(24).uint32(o.pausedAtSourceIds[f]);if(null!=o.numParticipants&&Object.hasOwnProperty.call(o,"numParticipants")&&p.uint32(32).uint32(o.numParticipants),null!=o.supportedReceiveCodecIntersection&&o.supportedReceiveCodecIntersection.length)for(var f=0;f<o.supportedReceiveCodecIntersection.length;++f)p.uint32(40).int32(o.supportedReceiveCodecIntersection[f]);return p},SdkIndexFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkIndexFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkIndexFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.atCapacity=o.bool();break;case 2:m.sources&&m.sources.length||(m.sources=[]),m.sources.push(en.SdkStreamDescriptor.decode(o,o.uint32()));break;case 3:if(m.pausedAtSourceIds&&m.pausedAtSourceIds.length||(m.pausedAtSourceIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.pausedAtSourceIds.push(o.uint32());else m.pausedAtSourceIds.push(o.uint32());break;case 4:m.numParticipants=o.uint32();break;case 5:if(m.supportedReceiveCodecIntersection&&m.supportedReceiveCodecIntersection.length||(m.supportedReceiveCodecIntersection=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.supportedReceiveCodecIntersection.push(o.int32());else m.supportedReceiveCodecIntersection.push(o.int32());break;default:o.skipType(7&_)}}return m},SdkIndexFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkIndexFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.atCapacity&&o.hasOwnProperty("atCapacity")&&"boolean"!=typeof o.atCapacity)return"atCapacity: boolean expected";if(null!=o.sources&&o.hasOwnProperty("sources")){if(!Array.isArray(o.sources))return"sources: array expected";for(var p=0;p<o.sources.length;++p){var f=en.SdkStreamDescriptor.verify(o.sources[p]);if(f)return"sources."+f}}if(null!=o.pausedAtSourceIds&&o.hasOwnProperty("pausedAtSourceIds")){if(!Array.isArray(o.pausedAtSourceIds))return"pausedAtSourceIds: array expected";for(var p=0;p<o.pausedAtSourceIds.length;++p)if(!er.isInteger(o.pausedAtSourceIds[p]))return"pausedAtSourceIds: integer[] expected"}if(null!=o.numParticipants&&o.hasOwnProperty("numParticipants")&&!er.isInteger(o.numParticipants))return"numParticipants: integer expected";if(null!=o.supportedReceiveCodecIntersection&&o.hasOwnProperty("supportedReceiveCodecIntersection")){if(!Array.isArray(o.supportedReceiveCodecIntersection))return"supportedReceiveCodecIntersection: array expected";for(var p=0;p<o.supportedReceiveCodecIntersection.length;++p)switch(o.supportedReceiveCodecIntersection[p]){default:return"supportedReceiveCodecIntersection: enum value[] expected";case 1:case 2:case 3:case 4:case 5:case 6:case 8:case 11:}}return null},SdkIndexFrame.fromObject=function(o){if(o instanceof en.SdkIndexFrame)return o;var p=new en.SdkIndexFrame;if(null!=o.atCapacity&&(p.atCapacity=!!o.atCapacity),o.sources){if(!Array.isArray(o.sources))throw TypeError(".SdkIndexFrame.sources: array expected");p.sources=[];for(var f=0;f<o.sources.length;++f){if("object"!=typeof o.sources[f])throw TypeError(".SdkIndexFrame.sources: object expected");p.sources[f]=en.SdkStreamDescriptor.fromObject(o.sources[f])}}if(o.pausedAtSourceIds){if(!Array.isArray(o.pausedAtSourceIds))throw TypeError(".SdkIndexFrame.pausedAtSourceIds: array expected");p.pausedAtSourceIds=[];for(var f=0;f<o.pausedAtSourceIds.length;++f)p.pausedAtSourceIds[f]=o.pausedAtSourceIds[f]>>>0}if(null!=o.numParticipants&&(p.numParticipants=o.numParticipants>>>0),o.supportedReceiveCodecIntersection){if(!Array.isArray(o.supportedReceiveCodecIntersection))throw TypeError(".SdkIndexFrame.supportedReceiveCodecIntersection: array expected");p.supportedReceiveCodecIntersection=[];for(var f=0;f<o.supportedReceiveCodecIntersection.length;++f)switch(o.supportedReceiveCodecIntersection[f]){default:if("number"==typeof o.supportedReceiveCodecIntersection[f]){p.supportedReceiveCodecIntersection[f]=o.supportedReceiveCodecIntersection[f];break}case"VP8":case 1:p.supportedReceiveCodecIntersection[f]=1;break;case"H264_BASELINE_PROFILE":case 2:p.supportedReceiveCodecIntersection[f]=2;break;case"H264_CONSTRAINED_BASELINE_PROFILE":case 3:p.supportedReceiveCodecIntersection[f]=3;break;case"H264_MAIN_PROFILE":case 4:p.supportedReceiveCodecIntersection[f]=4;break;case"H264_HIGH_PROFILE":case 5:p.supportedReceiveCodecIntersection[f]=5;break;case"H264_CONSTRAINED_HIGH_PROFILE":case 6:p.supportedReceiveCodecIntersection[f]=6;break;case"VP9_PROFILE_0":case 8:p.supportedReceiveCodecIntersection[f]=8;break;case"AV1_MAIN_PROFILE":case 11:p.supportedReceiveCodecIntersection[f]=11}}return p},SdkIndexFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.sources=[],f.pausedAtSourceIds=[],f.supportedReceiveCodecIntersection=[]),p.defaults&&(f.atCapacity=!1,f.numParticipants=0),null!=o.atCapacity&&o.hasOwnProperty("atCapacity")&&(f.atCapacity=o.atCapacity),o.sources&&o.sources.length){f.sources=[];for(var m=0;m<o.sources.length;++m)f.sources[m]=en.SdkStreamDescriptor.toObject(o.sources[m],p)}if(o.pausedAtSourceIds&&o.pausedAtSourceIds.length){f.pausedAtSourceIds=[];for(var m=0;m<o.pausedAtSourceIds.length;++m)f.pausedAtSourceIds[m]=o.pausedAtSourceIds[m]}if(null!=o.numParticipants&&o.hasOwnProperty("numParticipants")&&(f.numParticipants=o.numParticipants),o.supportedReceiveCodecIntersection&&o.supportedReceiveCodecIntersection.length){f.supportedReceiveCodecIntersection=[];for(var m=0;m<o.supportedReceiveCodecIntersection.length;++m)f.supportedReceiveCodecIntersection[m]=p.enums===String?void 0===en.SdkVideoCodecCapability[o.supportedReceiveCodecIntersection[m]]?o.supportedReceiveCodecIntersection[m]:en.SdkVideoCodecCapability[o.supportedReceiveCodecIntersection[m]]:o.supportedReceiveCodecIntersection[m]}return f},SdkIndexFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkIndexFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkIndexFrame"},SdkIndexFrame}(),en.SdkPauseResumeFrame=function(){function SdkPauseResumeFrame(o){if(this.streamIds=[],this.groupIds=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPauseResumeFrame.prototype.streamIds=er.emptyArray,SdkPauseResumeFrame.prototype.groupIds=er.emptyArray,SdkPauseResumeFrame.create=function(o){return new SdkPauseResumeFrame(o)},SdkPauseResumeFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.streamIds&&o.streamIds.length)for(var f=0;f<o.streamIds.length;++f)p.uint32(8).uint32(o.streamIds[f]);if(null!=o.groupIds&&o.groupIds.length)for(var f=0;f<o.groupIds.length;++f)p.uint32(16).uint32(o.groupIds[f]);return p},SdkPauseResumeFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPauseResumeFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPauseResumeFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:if(m.streamIds&&m.streamIds.length||(m.streamIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.streamIds.push(o.uint32());else m.streamIds.push(o.uint32());break;case 2:if(m.groupIds&&m.groupIds.length||(m.groupIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.groupIds.push(o.uint32());else m.groupIds.push(o.uint32());break;default:o.skipType(7&_)}}return m},SdkPauseResumeFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPauseResumeFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamIds&&o.hasOwnProperty("streamIds")){if(!Array.isArray(o.streamIds))return"streamIds: array expected";for(var p=0;p<o.streamIds.length;++p)if(!er.isInteger(o.streamIds[p]))return"streamIds: integer[] expected"}if(null!=o.groupIds&&o.hasOwnProperty("groupIds")){if(!Array.isArray(o.groupIds))return"groupIds: array expected";for(var p=0;p<o.groupIds.length;++p)if(!er.isInteger(o.groupIds[p]))return"groupIds: integer[] expected"}return null},SdkPauseResumeFrame.fromObject=function(o){if(o instanceof en.SdkPauseResumeFrame)return o;var p=new en.SdkPauseResumeFrame;if(o.streamIds){if(!Array.isArray(o.streamIds))throw TypeError(".SdkPauseResumeFrame.streamIds: array expected");p.streamIds=[];for(var f=0;f<o.streamIds.length;++f)p.streamIds[f]=o.streamIds[f]>>>0}if(o.groupIds){if(!Array.isArray(o.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");p.groupIds=[];for(var f=0;f<o.groupIds.length;++f)p.groupIds[f]=o.groupIds[f]>>>0}return p},SdkPauseResumeFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.streamIds=[],f.groupIds=[]),o.streamIds&&o.streamIds.length){f.streamIds=[];for(var m=0;m<o.streamIds.length;++m)f.streamIds[m]=o.streamIds[m]}if(o.groupIds&&o.groupIds.length){f.groupIds=[];for(var m=0;m<o.groupIds.length;++m)f.groupIds[m]=o.groupIds[m]}return f},SdkPauseResumeFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPauseResumeFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPauseResumeFrame"},SdkPauseResumeFrame}(),en.SdkBitrateFrame=function(){function SdkBitrateFrame(o){if(this.bitrates=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkBitrateFrame.prototype.bitrates=er.emptyArray,SdkBitrateFrame.prototype.serverAvailableOutgoingBitrate=0,SdkBitrateFrame.create=function(o){return new SdkBitrateFrame(o)},SdkBitrateFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.bitrates&&o.bitrates.length)for(var f=0;f<o.bitrates.length;++f)en.SdkBitrate.encode(o.bitrates[f],p.uint32(10).fork()).ldelim();return null!=o.serverAvailableOutgoingBitrate&&Object.hasOwnProperty.call(o,"serverAvailableOutgoingBitrate")&&p.uint32(16).uint32(o.serverAvailableOutgoingBitrate),p},SdkBitrateFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkBitrateFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkBitrateFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.bitrates&&m.bitrates.length||(m.bitrates=[]),m.bitrates.push(en.SdkBitrate.decode(o,o.uint32()));break;case 2:m.serverAvailableOutgoingBitrate=o.uint32();break;default:o.skipType(7&_)}}return m},SdkBitrateFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkBitrateFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.bitrates&&o.hasOwnProperty("bitrates")){if(!Array.isArray(o.bitrates))return"bitrates: array expected";for(var p=0;p<o.bitrates.length;++p){var f=en.SdkBitrate.verify(o.bitrates[p]);if(f)return"bitrates."+f}}return null!=o.serverAvailableOutgoingBitrate&&o.hasOwnProperty("serverAvailableOutgoingBitrate")&&!er.isInteger(o.serverAvailableOutgoingBitrate)?"serverAvailableOutgoingBitrate: integer expected":null},SdkBitrateFrame.fromObject=function(o){if(o instanceof en.SdkBitrateFrame)return o;var p=new en.SdkBitrateFrame;if(o.bitrates){if(!Array.isArray(o.bitrates))throw TypeError(".SdkBitrateFrame.bitrates: array expected");p.bitrates=[];for(var f=0;f<o.bitrates.length;++f){if("object"!=typeof o.bitrates[f])throw TypeError(".SdkBitrateFrame.bitrates: object expected");p.bitrates[f]=en.SdkBitrate.fromObject(o.bitrates[f])}}return null!=o.serverAvailableOutgoingBitrate&&(p.serverAvailableOutgoingBitrate=o.serverAvailableOutgoingBitrate>>>0),p},SdkBitrateFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.bitrates=[]),p.defaults&&(f.serverAvailableOutgoingBitrate=0),o.bitrates&&o.bitrates.length){f.bitrates=[];for(var m=0;m<o.bitrates.length;++m)f.bitrates[m]=en.SdkBitrate.toObject(o.bitrates[m],p)}return null!=o.serverAvailableOutgoingBitrate&&o.hasOwnProperty("serverAvailableOutgoingBitrate")&&(f.serverAvailableOutgoingBitrate=o.serverAvailableOutgoingBitrate),f},SdkBitrateFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkBitrateFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkBitrateFrame"},SdkBitrateFrame}(),en.SdkStreamDescriptor=function(){function SdkStreamDescriptor(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamDescriptor.prototype.streamId=0,SdkStreamDescriptor.prototype.framerate=0,SdkStreamDescriptor.prototype.maxBitrateKbps=0,SdkStreamDescriptor.prototype.trackLabel="",SdkStreamDescriptor.prototype.groupId=0,SdkStreamDescriptor.prototype.avgBitrateBps=0,SdkStreamDescriptor.prototype.attendeeId="",SdkStreamDescriptor.prototype.mediaType=1,SdkStreamDescriptor.prototype.externalUserId="",SdkStreamDescriptor.prototype.width=0,SdkStreamDescriptor.prototype.height=0,SdkStreamDescriptor.create=function(o){return new SdkStreamDescriptor(o)},SdkStreamDescriptor.encode=function(o,p){return p||(p=ei.create()),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(8).uint32(o.streamId),null!=o.framerate&&Object.hasOwnProperty.call(o,"framerate")&&p.uint32(16).uint32(o.framerate),null!=o.maxBitrateKbps&&Object.hasOwnProperty.call(o,"maxBitrateKbps")&&p.uint32(24).uint32(o.maxBitrateKbps),null!=o.trackLabel&&Object.hasOwnProperty.call(o,"trackLabel")&&p.uint32(34).string(o.trackLabel),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(48).uint32(o.groupId),null!=o.avgBitrateBps&&Object.hasOwnProperty.call(o,"avgBitrateBps")&&p.uint32(56).uint32(o.avgBitrateBps),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(66).string(o.attendeeId),null!=o.mediaType&&Object.hasOwnProperty.call(o,"mediaType")&&p.uint32(72).int32(o.mediaType),null!=o.externalUserId&&Object.hasOwnProperty.call(o,"externalUserId")&&p.uint32(82).string(o.externalUserId),null!=o.width&&Object.hasOwnProperty.call(o,"width")&&p.uint32(88).uint32(o.width),null!=o.height&&Object.hasOwnProperty.call(o,"height")&&p.uint32(96).uint32(o.height),p},SdkStreamDescriptor.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamDescriptor.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamDescriptor;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.streamId=o.uint32();break;case 2:m.framerate=o.uint32();break;case 3:m.maxBitrateKbps=o.uint32();break;case 4:m.trackLabel=o.string();break;case 6:m.groupId=o.uint32();break;case 7:m.avgBitrateBps=o.uint32();break;case 8:m.attendeeId=o.string();break;case 9:m.mediaType=o.int32();break;case 10:m.externalUserId=o.string();break;case 11:m.width=o.uint32();break;case 12:m.height=o.uint32();break;default:o.skipType(7&_)}}return m},SdkStreamDescriptor.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamDescriptor.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.framerate&&o.hasOwnProperty("framerate")&&!er.isInteger(o.framerate))return"framerate: integer expected";if(null!=o.maxBitrateKbps&&o.hasOwnProperty("maxBitrateKbps")&&!er.isInteger(o.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel))return"trackLabel: string expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&!er.isInteger(o.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId))return"attendeeId: string expected";if(null!=o.mediaType&&o.hasOwnProperty("mediaType"))switch(o.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.width&&o.hasOwnProperty("width")&&!er.isInteger(o.width)?"width: integer expected":null!=o.height&&o.hasOwnProperty("height")&&!er.isInteger(o.height)?"height: integer expected":null},SdkStreamDescriptor.fromObject=function(o){if(o instanceof en.SdkStreamDescriptor)return o;var p=new en.SdkStreamDescriptor;switch(null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.framerate&&(p.framerate=o.framerate>>>0),null!=o.maxBitrateKbps&&(p.maxBitrateKbps=o.maxBitrateKbps>>>0),null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),null!=o.groupId&&(p.groupId=o.groupId>>>0),null!=o.avgBitrateBps&&(p.avgBitrateBps=o.avgBitrateBps>>>0),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),o.mediaType){default:"number"==typeof o.mediaType&&(p.mediaType=o.mediaType);break;case"AUDIO":case 1:p.mediaType=1;break;case"VIDEO":case 2:p.mediaType=2}return null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.width&&(p.width=o.width>>>0),null!=o.height&&(p.height=o.height>>>0),p},SdkStreamDescriptor.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.streamId=0,f.framerate=0,f.maxBitrateKbps=0,f.trackLabel="",f.groupId=0,f.avgBitrateBps=0,f.attendeeId="",f.mediaType=p.enums===String?"AUDIO":1,f.externalUserId="",f.width=0,f.height=0),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.framerate&&o.hasOwnProperty("framerate")&&(f.framerate=o.framerate),null!=o.maxBitrateKbps&&o.hasOwnProperty("maxBitrateKbps")&&(f.maxBitrateKbps=o.maxBitrateKbps),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&(f.avgBitrateBps=o.avgBitrateBps),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.mediaType&&o.hasOwnProperty("mediaType")&&(f.mediaType=p.enums===String?void 0===en.SdkStreamMediaType[o.mediaType]?o.mediaType:en.SdkStreamMediaType[o.mediaType]:o.mediaType),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.width&&o.hasOwnProperty("width")&&(f.width=o.width),null!=o.height&&o.hasOwnProperty("height")&&(f.height=o.height),f},SdkStreamDescriptor.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamDescriptor.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamDescriptor"},SdkStreamDescriptor}(),en.SdkStreamAllocation=function(){function SdkStreamAllocation(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamAllocation.prototype.trackLabel="",SdkStreamAllocation.prototype.streamId=0,SdkStreamAllocation.prototype.groupId=0,SdkStreamAllocation.create=function(o){return new SdkStreamAllocation(o)},SdkStreamAllocation.encode=function(o,p){return p||(p=ei.create()),null!=o.trackLabel&&Object.hasOwnProperty.call(o,"trackLabel")&&p.uint32(10).string(o.trackLabel),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(16).uint32(o.streamId),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(24).uint32(o.groupId),p},SdkStreamAllocation.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamAllocation.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamAllocation;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.trackLabel=o.string();break;case 2:m.streamId=o.uint32();break;case 3:m.groupId=o.uint32();break;default:o.skipType(7&_)}}return m},SdkStreamAllocation.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamAllocation.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel)?"trackLabel: string expected":null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId)?"streamId: integer expected":null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId)?"groupId: integer expected":null},SdkStreamAllocation.fromObject=function(o){if(o instanceof en.SdkStreamAllocation)return o;var p=new en.SdkStreamAllocation;return null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),p},SdkStreamAllocation.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.trackLabel="",f.streamId=0,f.groupId=0),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),f},SdkStreamAllocation.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamAllocation.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamAllocation"},SdkStreamAllocation}(),en.SdkTrackMapping=function(){function SdkTrackMapping(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTrackMapping.prototype.streamId=0,SdkTrackMapping.prototype.ssrc=0,SdkTrackMapping.prototype.trackLabel="",SdkTrackMapping.create=function(o){return new SdkTrackMapping(o)},SdkTrackMapping.encode=function(o,p){return p||(p=ei.create()),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(8).uint32(o.streamId),null!=o.ssrc&&Object.hasOwnProperty.call(o,"ssrc")&&p.uint32(16).uint32(o.ssrc),null!=o.trackLabel&&Object.hasOwnProperty.call(o,"trackLabel")&&p.uint32(26).string(o.trackLabel),p},SdkTrackMapping.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTrackMapping.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTrackMapping;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.streamId=o.uint32();break;case 2:m.ssrc=o.uint32();break;case 3:m.trackLabel=o.string();break;default:o.skipType(7&_)}}return m},SdkTrackMapping.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTrackMapping.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId)?"streamId: integer expected":null!=o.ssrc&&o.hasOwnProperty("ssrc")&&!er.isInteger(o.ssrc)?"ssrc: integer expected":null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel)?"trackLabel: string expected":null},SdkTrackMapping.fromObject=function(o){if(o instanceof en.SdkTrackMapping)return o;var p=new en.SdkTrackMapping;return null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.ssrc&&(p.ssrc=o.ssrc>>>0),null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),p},SdkTrackMapping.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.streamId=0,f.ssrc=0,f.trackLabel=""),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.ssrc&&o.hasOwnProperty("ssrc")&&(f.ssrc=o.ssrc),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),f},SdkTrackMapping.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTrackMapping.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTrackMapping"},SdkTrackMapping}(),en.SdkBitrate=function(){function SdkBitrate(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkBitrate.prototype.sourceStreamId=0,SdkBitrate.prototype.avgBitrateBps=0,SdkBitrate.create=function(o){return new SdkBitrate(o)},SdkBitrate.encode=function(o,p){return p||(p=ei.create()),null!=o.sourceStreamId&&Object.hasOwnProperty.call(o,"sourceStreamId")&&p.uint32(8).uint32(o.sourceStreamId),null!=o.avgBitrateBps&&Object.hasOwnProperty.call(o,"avgBitrateBps")&&p.uint32(16).uint32(o.avgBitrateBps),p},SdkBitrate.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkBitrate.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkBitrate;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.sourceStreamId=o.uint32();break;case 2:m.avgBitrateBps=o.uint32();break;default:o.skipType(7&_)}}return m},SdkBitrate.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkBitrate.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.sourceStreamId&&o.hasOwnProperty("sourceStreamId")&&!er.isInteger(o.sourceStreamId)?"sourceStreamId: integer expected":null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&!er.isInteger(o.avgBitrateBps)?"avgBitrateBps: integer expected":null},SdkBitrate.fromObject=function(o){if(o instanceof en.SdkBitrate)return o;var p=new en.SdkBitrate;return null!=o.sourceStreamId&&(p.sourceStreamId=o.sourceStreamId>>>0),null!=o.avgBitrateBps&&(p.avgBitrateBps=o.avgBitrateBps>>>0),p},SdkBitrate.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.sourceStreamId=0,f.avgBitrateBps=0),null!=o.sourceStreamId&&o.hasOwnProperty("sourceStreamId")&&(f.sourceStreamId=o.sourceStreamId),null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&(f.avgBitrateBps=o.avgBitrateBps),f},SdkBitrate.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkBitrate.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkBitrate"},SdkBitrate}(),en.SdkAudioControlFrame=function(){function SdkAudioControlFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioControlFrame.prototype.muted=!1,SdkAudioControlFrame.create=function(o){return new SdkAudioControlFrame(o)},SdkAudioControlFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.muted&&Object.hasOwnProperty.call(o,"muted")&&p.uint32(8).bool(o.muted),p},SdkAudioControlFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioControlFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioControlFrame;o.pos<f;){var _=o.uint32();_>>>3==1?m.muted=o.bool():o.skipType(7&_)}return m},SdkAudioControlFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioControlFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null},SdkAudioControlFrame.fromObject=function(o){if(o instanceof en.SdkAudioControlFrame)return o;var p=new en.SdkAudioControlFrame;return null!=o.muted&&(p.muted=!!o.muted),p},SdkAudioControlFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.muted=!1),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),f},SdkAudioControlFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioControlFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioControlFrame"},SdkAudioControlFrame}(),en.SdkAudioMetadataFrame=function(){function SdkAudioMetadataFrame(o){if(this.attendeeStates=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioMetadataFrame.prototype.attendeeStates=er.emptyArray,SdkAudioMetadataFrame.create=function(o){return new SdkAudioMetadataFrame(o)},SdkAudioMetadataFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.attendeeStates&&o.attendeeStates.length)for(var f=0;f<o.attendeeStates.length;++f)en.SdkAudioAttendeeState.encode(o.attendeeStates[f],p.uint32(10).fork()).ldelim();return p},SdkAudioMetadataFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioMetadataFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioMetadataFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.attendeeStates&&m.attendeeStates.length||(m.attendeeStates=[]),m.attendeeStates.push(en.SdkAudioAttendeeState.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkAudioMetadataFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioMetadataFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.attendeeStates&&o.hasOwnProperty("attendeeStates")){if(!Array.isArray(o.attendeeStates))return"attendeeStates: array expected";for(var p=0;p<o.attendeeStates.length;++p){var f=en.SdkAudioAttendeeState.verify(o.attendeeStates[p]);if(f)return"attendeeStates."+f}}return null},SdkAudioMetadataFrame.fromObject=function(o){if(o instanceof en.SdkAudioMetadataFrame)return o;var p=new en.SdkAudioMetadataFrame;if(o.attendeeStates){if(!Array.isArray(o.attendeeStates))throw TypeError(".SdkAudioMetadataFrame.attendeeStates: array expected");p.attendeeStates=[];for(var f=0;f<o.attendeeStates.length;++f){if("object"!=typeof o.attendeeStates[f])throw TypeError(".SdkAudioMetadataFrame.attendeeStates: object expected");p.attendeeStates[f]=en.SdkAudioAttendeeState.fromObject(o.attendeeStates[f])}}return p},SdkAudioMetadataFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.attendeeStates=[]),o.attendeeStates&&o.attendeeStates.length){f.attendeeStates=[];for(var m=0;m<o.attendeeStates.length;++m)f.attendeeStates[m]=en.SdkAudioAttendeeState.toObject(o.attendeeStates[m],p)}return f},SdkAudioMetadataFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioMetadataFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioMetadataFrame"},SdkAudioMetadataFrame}(),en.SdkAudioAttendeeState=function(){function SdkAudioAttendeeState(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioAttendeeState.prototype.audioStreamId=0,SdkAudioAttendeeState.prototype.volume=0,SdkAudioAttendeeState.prototype.muted=!1,SdkAudioAttendeeState.prototype.signalStrength=0,SdkAudioAttendeeState.create=function(o){return new SdkAudioAttendeeState(o)},SdkAudioAttendeeState.encode=function(o,p){return p||(p=ei.create()),null!=o.audioStreamId&&Object.hasOwnProperty.call(o,"audioStreamId")&&p.uint32(8).uint32(o.audioStreamId),null!=o.volume&&Object.hasOwnProperty.call(o,"volume")&&p.uint32(16).uint32(o.volume),null!=o.muted&&Object.hasOwnProperty.call(o,"muted")&&p.uint32(24).bool(o.muted),null!=o.signalStrength&&Object.hasOwnProperty.call(o,"signalStrength")&&p.uint32(32).uint32(o.signalStrength),p},SdkAudioAttendeeState.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioAttendeeState.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioAttendeeState;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.audioStreamId=o.uint32();break;case 2:m.volume=o.uint32();break;case 3:m.muted=o.bool();break;case 4:m.signalStrength=o.uint32();break;default:o.skipType(7&_)}}return m},SdkAudioAttendeeState.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioAttendeeState.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&!er.isInteger(o.audioStreamId)?"audioStreamId: integer expected":null!=o.volume&&o.hasOwnProperty("volume")&&!er.isInteger(o.volume)?"volume: integer expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null!=o.signalStrength&&o.hasOwnProperty("signalStrength")&&!er.isInteger(o.signalStrength)?"signalStrength: integer expected":null},SdkAudioAttendeeState.fromObject=function(o){if(o instanceof en.SdkAudioAttendeeState)return o;var p=new en.SdkAudioAttendeeState;return null!=o.audioStreamId&&(p.audioStreamId=o.audioStreamId>>>0),null!=o.volume&&(p.volume=o.volume>>>0),null!=o.muted&&(p.muted=!!o.muted),null!=o.signalStrength&&(p.signalStrength=o.signalStrength>>>0),p},SdkAudioAttendeeState.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStreamId=0,f.volume=0,f.muted=!1,f.signalStrength=0),null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&(f.audioStreamId=o.audioStreamId),null!=o.volume&&o.hasOwnProperty("volume")&&(f.volume=o.volume),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),null!=o.signalStrength&&o.hasOwnProperty("signalStrength")&&(f.signalStrength=o.signalStrength),f},SdkAudioAttendeeState.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioAttendeeState.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioAttendeeState"},SdkAudioAttendeeState}(),en.SdkAudioStreamIdInfoFrame=function(){function SdkAudioStreamIdInfoFrame(o){if(this.streams=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioStreamIdInfoFrame.prototype.streams=er.emptyArray,SdkAudioStreamIdInfoFrame.create=function(o){return new SdkAudioStreamIdInfoFrame(o)},SdkAudioStreamIdInfoFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.streams&&o.streams.length)for(var f=0;f<o.streams.length;++f)en.SdkAudioStreamIdInfo.encode(o.streams[f],p.uint32(10).fork()).ldelim();return p},SdkAudioStreamIdInfoFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioStreamIdInfoFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioStreamIdInfoFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.streams&&m.streams.length||(m.streams=[]),m.streams.push(en.SdkAudioStreamIdInfo.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkAudioStreamIdInfoFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStreamIdInfoFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streams&&o.hasOwnProperty("streams")){if(!Array.isArray(o.streams))return"streams: array expected";for(var p=0;p<o.streams.length;++p){var f=en.SdkAudioStreamIdInfo.verify(o.streams[p]);if(f)return"streams."+f}}return null},SdkAudioStreamIdInfoFrame.fromObject=function(o){if(o instanceof en.SdkAudioStreamIdInfoFrame)return o;var p=new en.SdkAudioStreamIdInfoFrame;if(o.streams){if(!Array.isArray(o.streams))throw TypeError(".SdkAudioStreamIdInfoFrame.streams: array expected");p.streams=[];for(var f=0;f<o.streams.length;++f){if("object"!=typeof o.streams[f])throw TypeError(".SdkAudioStreamIdInfoFrame.streams: object expected");p.streams[f]=en.SdkAudioStreamIdInfo.fromObject(o.streams[f])}}return p},SdkAudioStreamIdInfoFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.streams=[]),o.streams&&o.streams.length){f.streams=[];for(var m=0;m<o.streams.length;++m)f.streams[m]=en.SdkAudioStreamIdInfo.toObject(o.streams[m],p)}return f},SdkAudioStreamIdInfoFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStreamIdInfoFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStreamIdInfoFrame"},SdkAudioStreamIdInfoFrame}(),en.SdkAudioStreamIdInfo=function(){function SdkAudioStreamIdInfo(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioStreamIdInfo.prototype.audioStreamId=0,SdkAudioStreamIdInfo.prototype.attendeeId="",SdkAudioStreamIdInfo.prototype.muted=!1,SdkAudioStreamIdInfo.prototype.externalUserId="",SdkAudioStreamIdInfo.prototype.dropped=!1,SdkAudioStreamIdInfo.create=function(o){return new SdkAudioStreamIdInfo(o)},SdkAudioStreamIdInfo.encode=function(o,p){return p||(p=ei.create()),null!=o.audioStreamId&&Object.hasOwnProperty.call(o,"audioStreamId")&&p.uint32(8).uint32(o.audioStreamId),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(18).string(o.attendeeId),null!=o.muted&&Object.hasOwnProperty.call(o,"muted")&&p.uint32(24).bool(o.muted),null!=o.externalUserId&&Object.hasOwnProperty.call(o,"externalUserId")&&p.uint32(34).string(o.externalUserId),null!=o.dropped&&Object.hasOwnProperty.call(o,"dropped")&&p.uint32(40).bool(o.dropped),p},SdkAudioStreamIdInfo.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioStreamIdInfo.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioStreamIdInfo;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.audioStreamId=o.uint32();break;case 2:m.attendeeId=o.string();break;case 3:m.muted=o.bool();break;case 4:m.externalUserId=o.string();break;case 5:m.dropped=o.bool();break;default:o.skipType(7&_)}}return m},SdkAudioStreamIdInfo.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStreamIdInfo.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&!er.isInteger(o.audioStreamId)?"audioStreamId: integer expected":null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId)?"attendeeId: string expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.dropped&&o.hasOwnProperty("dropped")&&"boolean"!=typeof o.dropped?"dropped: boolean expected":null},SdkAudioStreamIdInfo.fromObject=function(o){if(o instanceof en.SdkAudioStreamIdInfo)return o;var p=new en.SdkAudioStreamIdInfo;return null!=o.audioStreamId&&(p.audioStreamId=o.audioStreamId>>>0),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.muted&&(p.muted=!!o.muted),null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.dropped&&(p.dropped=!!o.dropped),p},SdkAudioStreamIdInfo.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStreamId=0,f.attendeeId="",f.muted=!1,f.externalUserId="",f.dropped=!1),null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&(f.audioStreamId=o.audioStreamId),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.dropped&&o.hasOwnProperty("dropped")&&(f.dropped=o.dropped),f},SdkAudioStreamIdInfo.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStreamIdInfo.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStreamIdInfo"},SdkAudioStreamIdInfo}(),(B=Object.create(L={}))[L[1]="PING"]=1,B[L[2]="PONG"]=2,en.SdkPingPongType=B,en.SdkPingPongFrame=function(){function SdkPingPongFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPingPongFrame.prototype.type=1,SdkPingPongFrame.prototype.pingId=0,SdkPingPongFrame.create=function(o){return new SdkPingPongFrame(o)},SdkPingPongFrame.encode=function(o,p){return p||(p=ei.create()),p.uint32(8).int32(o.type),p.uint32(16).uint32(o.pingId),p},SdkPingPongFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPingPongFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPingPongFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.pingId=o.uint32();break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("type"))throw er.ProtocolError("missing required 'type'",{instance:m});if(!m.hasOwnProperty("pingId"))throw er.ProtocolError("missing required 'pingId'",{instance:m});return m},SdkPingPongFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPingPongFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";switch(o.type){default:return"type: enum value expected";case 1:case 2:}},SdkPingPongFrame.fromObject=function(o){if(o instanceof en.SdkPingPongFrame)return o;var p=new en.SdkPingPongFrame;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"PING":case 1:p.type=1;break;case"PONG":case 2:p.type=2}return null!=o.pingId&&(p.pingId=o.pingId>>>0),p},SdkPingPongFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"PING":1,f.pingId=0),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkPingPongType[o.type]?o.type:en.SdkPingPongType[o.type]:o.type),null!=o.pingId&&o.hasOwnProperty("pingId")&&(f.pingId=o.pingId),f},SdkPingPongFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPingPongFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPingPongFrame"},SdkPingPongFrame}(),en.SdkAudioStatusFrame=function(){function SdkAudioStatusFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioStatusFrame.prototype.audioStatus=0,SdkAudioStatusFrame.create=function(o){return new SdkAudioStatusFrame(o)},SdkAudioStatusFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.audioStatus&&Object.hasOwnProperty.call(o,"audioStatus")&&p.uint32(8).uint32(o.audioStatus),p},SdkAudioStatusFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioStatusFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioStatusFrame;o.pos<f;){var _=o.uint32();_>>>3==1?m.audioStatus=o.uint32():o.skipType(7&_)}return m},SdkAudioStatusFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStatusFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&!er.isInteger(o.audioStatus)?"audioStatus: integer expected":null},SdkAudioStatusFrame.fromObject=function(o){if(o instanceof en.SdkAudioStatusFrame)return o;var p=new en.SdkAudioStatusFrame;return null!=o.audioStatus&&(p.audioStatus=o.audioStatus>>>0),p},SdkAudioStatusFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStatus=0),null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&(f.audioStatus=o.audioStatus),f},SdkAudioStatusFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStatusFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStatusFrame"},SdkAudioStatusFrame}(),en.SdkMetric=function(){var o,p;function SdkMetric(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkMetric.prototype.type=1,SdkMetric.prototype.value=0,SdkMetric.create=function(o){return new SdkMetric(o)},SdkMetric.encode=function(o,p){return p||(p=ei.create()),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(8).int32(o.type),null!=o.value&&Object.hasOwnProperty.call(o,"value")&&p.uint32(17).double(o.value),p},SdkMetric.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkMetric.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkMetric;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.value=o.double();break;default:o.skipType(7&_)}}return m},SdkMetric.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkMetric.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 60:case 64:case 66:case 69:case 72:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:}return null!=o.value&&o.hasOwnProperty("value")&&"number"!=typeof o.value?"value: number expected":null},SdkMetric.fromObject=function(o){if(o instanceof en.SdkMetric)return o;var p=new en.SdkMetric;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:p.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:p.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:p.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:p.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:p.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:p.type=6;break;case"STUN_RTT_MS":case 7:p.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:p.type=8;break;case"RTC_MIC_JITTER_MS":case 9:p.type=9;break;case"RTC_MIC_PPS":case 10:p.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:p.type=11;break;case"RTC_MIC_BITRATE":case 12:p.type=12;break;case"RTC_MIC_RTT_MS":case 13:p.type=13;break;case"RTC_SPK_PPS":case 14:p.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:p.type=15;break;case"RTC_SPK_JITTER_MS":case 16:p.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:p.type=17;break;case"RTC_SPK_BITRATE":case 18:p.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:p.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:p.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:p.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:p.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:p.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:p.type=24;break;case"VIDEO_ENCODE_MS":case 25:p.type=25;break;case"VIDEO_INPUT_FPS":case 26:p.type=26;break;case"VIDEO_ENCODE_FPS":case 27:p.type=27;break;case"VIDEO_SENT_FPS":case 28:p.type=28;break;case"VIDEO_FIRS_RECEIVED":case 29:p.type=29;break;case"VIDEO_SENT_PPS":case 30:p.type=30;break;case"VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT":case 31:p.type=31;break;case"VIDEO_SENT_BITRATE":case 32:p.type=32;break;case"VIDEO_DROPPED_FPS":case 33:p.type=33;break;case"VIDEO_TARGET_DELAY_MS":case 34:p.type=34;break;case"VIDEO_DECODE_MS":case 35:p.type=35;break;case"VIDEO_OUTPUT_FPS":case 36:p.type=36;break;case"VIDEO_RECEIVED_PPS":case 37:p.type=37;break;case"VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT":case 38:p.type=38;break;case"VIDEO_RENDER_DELAY_MS":case 39:p.type=39;break;case"VIDEO_RECEIVED_FPS":case 40:p.type=40;break;case"VIDEO_DECODE_FPS":case 41:p.type=41;break;case"VIDEO_NACKS_SENT":case 42:p.type=42;break;case"VIDEO_FIRS_SENT":case 43:p.type=43;break;case"VIDEO_RECEIVED_BITRATE":case 44:p.type=44;break;case"VIDEO_CURRENT_DELAY_MS":case 45:p.type=45;break;case"VIDEO_JITTER_BUFFER_MS":case 46:p.type=46;break;case"VIDEO_DISCARDED_PPS":case 47:p.type=47;break;case"VIDEO_PLIS_SENT":case 48:p.type=48;break;case"VIDEO_RECEIVED_JITTER_MS":case 49:p.type=49;break;case"VIDEO_INPUT_HEIGHT":case 60:p.type=60;break;case"VIDEO_ENCODE_HEIGHT":case 64:p.type=64;break;case"VIDEO_SENT_QP_SUM":case 66:p.type=66;break;case"VIDEO_DECODE_HEIGHT":case 69:p.type=69;break;case"VIDEO_RECEIVED_QP_SUM":case 72:p.type=72;break;case"VIDEO_ENCODE_WIDTH":case 86:p.type=86;break;case"VIDEO_DECODE_WIDTH":case 87:p.type=87;break;case"VIDEO_ENCODER_IS_HARDWARE":case 88:p.type=88;break;case"VIDEO_DECODER_IS_HARDWARE":case 89:p.type=89;break;case"VIDEO_FREEZE_COUNT":case 90:p.type=90;break;case"VIDEO_FREEZE_DURATION":case 91:p.type=91;break;case"VIDEO_PAUSE_COUNT":case 92:p.type=92;break;case"VIDEO_PAUSE_DURATION":case 93:p.type=93;break;case"VIDEO_QUALITY_REASON":case 94:p.type=94;break;case"VIDEO_PROCESSING_TIME":case 95:p.type=95;break;case"RTC_SPK_AUDIO_LEVEL":case 96:p.type=96;break;case"RTC_MIC_AUDIO_LEVEL":case 97:p.type=97;break;case"RTC_SPK_TOTAL_LOST":case 98:p.type=98;break;case"RTC_SPK_TOTAL_EXPECTED":case 99:p.type=99;break;case"RTC_SPK_TOTAL_RECOVERED_RED":case 100:p.type=100;break;case"RTC_SPK_TOTAL_RECOVERED_FEC":case 101:p.type=101;break;case"VIDEO_QUALITY_LIMITATION_DURATION_CPU":case 102:p.type=102;break;case"VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU":case 103:p.type=103;break;case"VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE":case 104:p.type=104;break;case"VIDEO_RENDER_HEIGHT":case 105:p.type=105;break;case"VIDEO_RENDER_WIDTH":case 106:p.type=106;break;case"VIDEO_INPUT_WIDTH":case 107:p.type=107;break;case"VIDEO_SENT_JITTER_MS":case 108:p.type=108}return null!=o.value&&(p.value=Number(o.value)),p},SdkMetric.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,f.value=0),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkMetric.Type[o.type]?o.type:en.SdkMetric.Type[o.type]:o.type),null!=o.value&&o.hasOwnProperty("value")&&(f.value=p.json&&!isFinite(o.value)?String(o.value):o.value),f},SdkMetric.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkMetric.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkMetric"},(p=Object.create(o={}))[o[1]="VIDEO_ACTUAL_ENCODER_BITRATE"]=1,p[o[2]="VIDEO_AVAILABLE_SEND_BANDWIDTH"]=2,p[o[3]="VIDEO_RETRANSMIT_BITRATE"]=3,p[o[4]="VIDEO_AVAILABLE_RECEIVE_BANDWIDTH"]=4,p[o[5]="VIDEO_TARGET_ENCODER_BITRATE"]=5,p[o[6]="VIDEO_BUCKET_DELAY_MS"]=6,p[o[7]="STUN_RTT_MS"]=7,p[o[8]="SOCKET_DISCARDED_PPS"]=8,p[o[9]="RTC_MIC_JITTER_MS"]=9,p[o[10]="RTC_MIC_PPS"]=10,p[o[11]="RTC_MIC_FRACTION_PACKET_LOST_PERCENT"]=11,p[o[12]="RTC_MIC_BITRATE"]=12,p[o[13]="RTC_MIC_RTT_MS"]=13,p[o[14]="RTC_SPK_PPS"]=14,p[o[15]="RTC_SPK_FRACTION_PACKET_LOST_PERCENT"]=15,p[o[16]="RTC_SPK_JITTER_MS"]=16,p[o[17]="RTC_SPK_FRACTION_DECODER_LOSS_PERCENT"]=17,p[o[18]="RTC_SPK_BITRATE"]=18,p[o[19]="RTC_SPK_CURRENT_DELAY_MS"]=19,p[o[20]="RTC_SPK_JITTER_BUFFER_MS"]=20,p[o[21]="VIDEO_SENT_RTT_MS"]=21,p[o[22]="VIDEO_ENCODE_USAGE_PERCENT"]=22,p[o[23]="VIDEO_NACKS_RECEIVED"]=23,p[o[24]="VIDEO_PLIS_RECEIVED"]=24,p[o[25]="VIDEO_ENCODE_MS"]=25,p[o[26]="VIDEO_INPUT_FPS"]=26,p[o[27]="VIDEO_ENCODE_FPS"]=27,p[o[28]="VIDEO_SENT_FPS"]=28,p[o[29]="VIDEO_FIRS_RECEIVED"]=29,p[o[30]="VIDEO_SENT_PPS"]=30,p[o[31]="VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT"]=31,p[o[32]="VIDEO_SENT_BITRATE"]=32,p[o[33]="VIDEO_DROPPED_FPS"]=33,p[o[34]="VIDEO_TARGET_DELAY_MS"]=34,p[o[35]="VIDEO_DECODE_MS"]=35,p[o[36]="VIDEO_OUTPUT_FPS"]=36,p[o[37]="VIDEO_RECEIVED_PPS"]=37,p[o[38]="VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT"]=38,p[o[39]="VIDEO_RENDER_DELAY_MS"]=39,p[o[40]="VIDEO_RECEIVED_FPS"]=40,p[o[41]="VIDEO_DECODE_FPS"]=41,p[o[42]="VIDEO_NACKS_SENT"]=42,p[o[43]="VIDEO_FIRS_SENT"]=43,p[o[44]="VIDEO_RECEIVED_BITRATE"]=44,p[o[45]="VIDEO_CURRENT_DELAY_MS"]=45,p[o[46]="VIDEO_JITTER_BUFFER_MS"]=46,p[o[47]="VIDEO_DISCARDED_PPS"]=47,p[o[48]="VIDEO_PLIS_SENT"]=48,p[o[49]="VIDEO_RECEIVED_JITTER_MS"]=49,p[o[60]="VIDEO_INPUT_HEIGHT"]=60,p[o[64]="VIDEO_ENCODE_HEIGHT"]=64,p[o[66]="VIDEO_SENT_QP_SUM"]=66,p[o[69]="VIDEO_DECODE_HEIGHT"]=69,p[o[72]="VIDEO_RECEIVED_QP_SUM"]=72,p[o[86]="VIDEO_ENCODE_WIDTH"]=86,p[o[87]="VIDEO_DECODE_WIDTH"]=87,p[o[88]="VIDEO_ENCODER_IS_HARDWARE"]=88,p[o[89]="VIDEO_DECODER_IS_HARDWARE"]=89,p[o[90]="VIDEO_FREEZE_COUNT"]=90,p[o[91]="VIDEO_FREEZE_DURATION"]=91,p[o[92]="VIDEO_PAUSE_COUNT"]=92,p[o[93]="VIDEO_PAUSE_DURATION"]=93,p[o[94]="VIDEO_QUALITY_REASON"]=94,p[o[95]="VIDEO_PROCESSING_TIME"]=95,p[o[96]="RTC_SPK_AUDIO_LEVEL"]=96,p[o[97]="RTC_MIC_AUDIO_LEVEL"]=97,p[o[98]="RTC_SPK_TOTAL_LOST"]=98,p[o[99]="RTC_SPK_TOTAL_EXPECTED"]=99,p[o[100]="RTC_SPK_TOTAL_RECOVERED_RED"]=100,p[o[101]="RTC_SPK_TOTAL_RECOVERED_FEC"]=101,p[o[102]="VIDEO_QUALITY_LIMITATION_DURATION_CPU"]=102,p[o[103]="VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU"]=103,p[o[104]="VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE"]=104,p[o[105]="VIDEO_RENDER_HEIGHT"]=105,p[o[106]="VIDEO_RENDER_WIDTH"]=106,p[o[107]="VIDEO_INPUT_WIDTH"]=107,p[o[108]="VIDEO_SENT_JITTER_MS"]=108,SdkMetric.Type=p,SdkMetric}(),en.SdkStreamMetricFrame=function(){function SdkStreamMetricFrame(o){if(this.metrics=[],this.dimensions=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamMetricFrame.prototype.streamId=0,SdkStreamMetricFrame.prototype.groupId=0,SdkStreamMetricFrame.prototype.metrics=er.emptyArray,SdkStreamMetricFrame.prototype.dimensions=er.emptyArray,SdkStreamMetricFrame.prototype.mediaType=1,SdkStreamMetricFrame.create=function(o){return new SdkStreamMetricFrame(o)},SdkStreamMetricFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(24).uint32(o.streamId),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(32).uint32(o.groupId),null!=o.metrics&&o.metrics.length)for(var f=0;f<o.metrics.length;++f)en.SdkMetric.encode(o.metrics[f],p.uint32(42).fork()).ldelim();if(null!=o.dimensions&&o.dimensions.length)for(var f=0;f<o.dimensions.length;++f)en.SdkStreamDimension.encode(o.dimensions[f],p.uint32(50).fork()).ldelim();return null!=o.mediaType&&Object.hasOwnProperty.call(o,"mediaType")&&p.uint32(56).int32(o.mediaType),p},SdkStreamMetricFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamMetricFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamMetricFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 3:m.streamId=o.uint32();break;case 4:m.groupId=o.uint32();break;case 5:m.metrics&&m.metrics.length||(m.metrics=[]),m.metrics.push(en.SdkMetric.decode(o,o.uint32()));break;case 6:m.dimensions&&m.dimensions.length||(m.dimensions=[]),m.dimensions.push(en.SdkStreamDimension.decode(o,o.uint32()));break;case 7:m.mediaType=o.int32();break;default:o.skipType(7&_)}}return m},SdkStreamMetricFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamMetricFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.metrics&&o.hasOwnProperty("metrics")){if(!Array.isArray(o.metrics))return"metrics: array expected";for(var p=0;p<o.metrics.length;++p){var f=en.SdkMetric.verify(o.metrics[p]);if(f)return"metrics."+f}}if(null!=o.dimensions&&o.hasOwnProperty("dimensions")){if(!Array.isArray(o.dimensions))return"dimensions: array expected";for(var p=0;p<o.dimensions.length;++p){var f=en.SdkStreamDimension.verify(o.dimensions[p]);if(f)return"dimensions."+f}}if(null!=o.mediaType&&o.hasOwnProperty("mediaType"))switch(o.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null},SdkStreamMetricFrame.fromObject=function(o){if(o instanceof en.SdkStreamMetricFrame)return o;var p=new en.SdkStreamMetricFrame;if(null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),o.metrics){if(!Array.isArray(o.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");p.metrics=[];for(var f=0;f<o.metrics.length;++f){if("object"!=typeof o.metrics[f])throw TypeError(".SdkStreamMetricFrame.metrics: object expected");p.metrics[f]=en.SdkMetric.fromObject(o.metrics[f])}}if(o.dimensions){if(!Array.isArray(o.dimensions))throw TypeError(".SdkStreamMetricFrame.dimensions: array expected");p.dimensions=[];for(var f=0;f<o.dimensions.length;++f){if("object"!=typeof o.dimensions[f])throw TypeError(".SdkStreamMetricFrame.dimensions: object expected");p.dimensions[f]=en.SdkStreamDimension.fromObject(o.dimensions[f])}}switch(o.mediaType){default:"number"==typeof o.mediaType&&(p.mediaType=o.mediaType);break;case"AUDIO":case 1:p.mediaType=1;break;case"VIDEO":case 2:p.mediaType=2}return p},SdkStreamMetricFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.metrics=[],f.dimensions=[]),p.defaults&&(f.streamId=0,f.groupId=0,f.mediaType=p.enums===String?"AUDIO":1),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),o.metrics&&o.metrics.length){f.metrics=[];for(var m=0;m<o.metrics.length;++m)f.metrics[m]=en.SdkMetric.toObject(o.metrics[m],p)}if(o.dimensions&&o.dimensions.length){f.dimensions=[];for(var m=0;m<o.dimensions.length;++m)f.dimensions[m]=en.SdkStreamDimension.toObject(o.dimensions[m],p)}return null!=o.mediaType&&o.hasOwnProperty("mediaType")&&(f.mediaType=p.enums===String?void 0===en.SdkStreamMediaType[o.mediaType]?o.mediaType:en.SdkStreamMediaType[o.mediaType]:o.mediaType),f},SdkStreamMetricFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamMetricFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamMetricFrame"},SdkStreamMetricFrame}(),en.SdkClientMetricFrame=function(){function SdkClientMetricFrame(o){if(this.globalMetrics=[],this.streamMetricFrames=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkClientMetricFrame.prototype.globalMetrics=er.emptyArray,SdkClientMetricFrame.prototype.streamMetricFrames=er.emptyArray,SdkClientMetricFrame.create=function(o){return new SdkClientMetricFrame(o)},SdkClientMetricFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.globalMetrics&&o.globalMetrics.length)for(var f=0;f<o.globalMetrics.length;++f)en.SdkMetric.encode(o.globalMetrics[f],p.uint32(10).fork()).ldelim();if(null!=o.streamMetricFrames&&o.streamMetricFrames.length)for(var f=0;f<o.streamMetricFrames.length;++f)en.SdkStreamMetricFrame.encode(o.streamMetricFrames[f],p.uint32(18).fork()).ldelim();return p},SdkClientMetricFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkClientMetricFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkClientMetricFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.globalMetrics&&m.globalMetrics.length||(m.globalMetrics=[]),m.globalMetrics.push(en.SdkMetric.decode(o,o.uint32()));break;case 2:m.streamMetricFrames&&m.streamMetricFrames.length||(m.streamMetricFrames=[]),m.streamMetricFrames.push(en.SdkStreamMetricFrame.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkClientMetricFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkClientMetricFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.globalMetrics&&o.hasOwnProperty("globalMetrics")){if(!Array.isArray(o.globalMetrics))return"globalMetrics: array expected";for(var p=0;p<o.globalMetrics.length;++p){var f=en.SdkMetric.verify(o.globalMetrics[p]);if(f)return"globalMetrics."+f}}if(null!=o.streamMetricFrames&&o.hasOwnProperty("streamMetricFrames")){if(!Array.isArray(o.streamMetricFrames))return"streamMetricFrames: array expected";for(var p=0;p<o.streamMetricFrames.length;++p){var f=en.SdkStreamMetricFrame.verify(o.streamMetricFrames[p]);if(f)return"streamMetricFrames."+f}}return null},SdkClientMetricFrame.fromObject=function(o){if(o instanceof en.SdkClientMetricFrame)return o;var p=new en.SdkClientMetricFrame;if(o.globalMetrics){if(!Array.isArray(o.globalMetrics))throw TypeError(".SdkClientMetricFrame.globalMetrics: array expected");p.globalMetrics=[];for(var f=0;f<o.globalMetrics.length;++f){if("object"!=typeof o.globalMetrics[f])throw TypeError(".SdkClientMetricFrame.globalMetrics: object expected");p.globalMetrics[f]=en.SdkMetric.fromObject(o.globalMetrics[f])}}if(o.streamMetricFrames){if(!Array.isArray(o.streamMetricFrames))throw TypeError(".SdkClientMetricFrame.streamMetricFrames: array expected");p.streamMetricFrames=[];for(var f=0;f<o.streamMetricFrames.length;++f){if("object"!=typeof o.streamMetricFrames[f])throw TypeError(".SdkClientMetricFrame.streamMetricFrames: object expected");p.streamMetricFrames[f]=en.SdkStreamMetricFrame.fromObject(o.streamMetricFrames[f])}}return p},SdkClientMetricFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.globalMetrics=[],f.streamMetricFrames=[]),o.globalMetrics&&o.globalMetrics.length){f.globalMetrics=[];for(var m=0;m<o.globalMetrics.length;++m)f.globalMetrics[m]=en.SdkMetric.toObject(o.globalMetrics[m],p)}if(o.streamMetricFrames&&o.streamMetricFrames.length){f.streamMetricFrames=[];for(var m=0;m<o.streamMetricFrames.length;++m)f.streamMetricFrames[m]=en.SdkStreamMetricFrame.toObject(o.streamMetricFrames[m],p)}return f},SdkClientMetricFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkClientMetricFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkClientMetricFrame"},SdkClientMetricFrame}(),en.SdkStreamDimension=function(){var o,p;function SdkStreamDimension(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamDimension.prototype.type=1,SdkStreamDimension.prototype.value=null,SdkStreamDimension.create=function(o){return new SdkStreamDimension(o)},SdkStreamDimension.encode=function(o,p){return p||(p=ei.create()),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(8).int32(o.type),null!=o.value&&Object.hasOwnProperty.call(o,"value")&&en.SdkDimensionValue.encode(o.value,p.uint32(18).fork()).ldelim(),p},SdkStreamDimension.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamDimension.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamDimension;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.value=en.SdkDimensionValue.decode(o,o.uint32());break;default:o.skipType(7&_)}}return m},SdkStreamDimension.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamDimension.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:}if(null!=o.value&&o.hasOwnProperty("value")){var p=en.SdkDimensionValue.verify(o.value);if(p)return"value."+p}return null},SdkStreamDimension.fromObject=function(o){if(o instanceof en.SdkStreamDimension)return o;var p=new en.SdkStreamDimension;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"VIDEO_ENCODER_NAME":case 1:p.type=1;break;case"VIDEO_DECODER_NAME":case 2:p.type=2}if(null!=o.value){if("object"!=typeof o.value)throw TypeError(".SdkStreamDimension.value: object expected");p.value=en.SdkDimensionValue.fromObject(o.value)}return p},SdkStreamDimension.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"VIDEO_ENCODER_NAME":1,f.value=null),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkStreamDimension.Type[o.type]?o.type:en.SdkStreamDimension.Type[o.type]:o.type),null!=o.value&&o.hasOwnProperty("value")&&(f.value=en.SdkDimensionValue.toObject(o.value,p)),f},SdkStreamDimension.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamDimension.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamDimension"},(p=Object.create(o={}))[o[1]="VIDEO_ENCODER_NAME"]=1,p[o[2]="VIDEO_DECODER_NAME"]=2,SdkStreamDimension.Type=p,SdkStreamDimension}(),en.SdkDimensionValue=function(){function SdkDimensionValue(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkDimensionValue.prototype.stringValue="",SdkDimensionValue.prototype.boolValue=!1,SdkDimensionValue.prototype.uintValue=er.Long?er.Long.fromBits(0,0,!0):0,SdkDimensionValue.create=function(o){return new SdkDimensionValue(o)},SdkDimensionValue.encode=function(o,p){return p||(p=ei.create()),null!=o.stringValue&&Object.hasOwnProperty.call(o,"stringValue")&&p.uint32(10).string(o.stringValue),null!=o.boolValue&&Object.hasOwnProperty.call(o,"boolValue")&&p.uint32(16).bool(o.boolValue),null!=o.uintValue&&Object.hasOwnProperty.call(o,"uintValue")&&p.uint32(24).uint64(o.uintValue),p},SdkDimensionValue.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkDimensionValue.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkDimensionValue;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.stringValue=o.string();break;case 2:m.boolValue=o.bool();break;case 3:m.uintValue=o.uint64();break;default:o.skipType(7&_)}}return m},SdkDimensionValue.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDimensionValue.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.stringValue&&o.hasOwnProperty("stringValue")&&!er.isString(o.stringValue)?"stringValue: string expected":null!=o.boolValue&&o.hasOwnProperty("boolValue")&&"boolean"!=typeof o.boolValue?"boolValue: boolean expected":null!=o.uintValue&&o.hasOwnProperty("uintValue")&&!er.isInteger(o.uintValue)&&!(o.uintValue&&er.isInteger(o.uintValue.low)&&er.isInteger(o.uintValue.high))?"uintValue: integer|Long expected":null},SdkDimensionValue.fromObject=function(o){if(o instanceof en.SdkDimensionValue)return o;var p=new en.SdkDimensionValue;return null!=o.stringValue&&(p.stringValue=String(o.stringValue)),null!=o.boolValue&&(p.boolValue=!!o.boolValue),null!=o.uintValue&&(er.Long?(p.uintValue=er.Long.fromValue(o.uintValue)).unsigned=!0:"string"==typeof o.uintValue?p.uintValue=parseInt(o.uintValue,10):"number"==typeof o.uintValue?p.uintValue=o.uintValue:"object"==typeof o.uintValue&&(p.uintValue=new er.LongBits(o.uintValue.low>>>0,o.uintValue.high>>>0).toNumber(!0))),p},SdkDimensionValue.toObject=function(o,p){p||(p={});var f={};if(p.defaults)if(f.stringValue="",f.boolValue=!1,er.Long){var m=new er.Long(0,0,!0);f.uintValue=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.uintValue=p.longs===String?"0":0;return null!=o.stringValue&&o.hasOwnProperty("stringValue")&&(f.stringValue=o.stringValue),null!=o.boolValue&&o.hasOwnProperty("boolValue")&&(f.boolValue=o.boolValue),null!=o.uintValue&&o.hasOwnProperty("uintValue")&&("number"==typeof o.uintValue?f.uintValue=p.longs===String?String(o.uintValue):o.uintValue:f.uintValue=p.longs===String?er.Long.prototype.toString.call(o.uintValue):p.longs===Number?new er.LongBits(o.uintValue.low>>>0,o.uintValue.high>>>0).toNumber(!0):o.uintValue),f},SdkDimensionValue.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDimensionValue.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDimensionValue"},SdkDimensionValue}(),en.SdkDataMessageFrame=function(){function SdkDataMessageFrame(o){if(this.messages=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkDataMessageFrame.prototype.messages=er.emptyArray,SdkDataMessageFrame.create=function(o){return new SdkDataMessageFrame(o)},SdkDataMessageFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.messages&&o.messages.length)for(var f=0;f<o.messages.length;++f)en.SdkDataMessagePayload.encode(o.messages[f],p.uint32(10).fork()).ldelim();return p},SdkDataMessageFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkDataMessageFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkDataMessageFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.messages&&m.messages.length||(m.messages=[]),m.messages.push(en.SdkDataMessagePayload.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkDataMessageFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDataMessageFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.messages&&o.hasOwnProperty("messages")){if(!Array.isArray(o.messages))return"messages: array expected";for(var p=0;p<o.messages.length;++p){var f=en.SdkDataMessagePayload.verify(o.messages[p]);if(f)return"messages."+f}}return null},SdkDataMessageFrame.fromObject=function(o){if(o instanceof en.SdkDataMessageFrame)return o;var p=new en.SdkDataMessageFrame;if(o.messages){if(!Array.isArray(o.messages))throw TypeError(".SdkDataMessageFrame.messages: array expected");p.messages=[];for(var f=0;f<o.messages.length;++f){if("object"!=typeof o.messages[f])throw TypeError(".SdkDataMessageFrame.messages: object expected");p.messages[f]=en.SdkDataMessagePayload.fromObject(o.messages[f])}}return p},SdkDataMessageFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.messages=[]),o.messages&&o.messages.length){f.messages=[];for(var m=0;m<o.messages.length;++m)f.messages[m]=en.SdkDataMessagePayload.toObject(o.messages[m],p)}return f},SdkDataMessageFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDataMessageFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDataMessageFrame"},SdkDataMessageFrame}(),en.SdkDataMessagePayload=function(){function SdkDataMessagePayload(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkDataMessagePayload.prototype.topic="",SdkDataMessagePayload.prototype.data=er.newBuffer([]),SdkDataMessagePayload.prototype.lifetimeMs=0,SdkDataMessagePayload.prototype.senderAttendeeId="",SdkDataMessagePayload.prototype.ingestTimeNs=er.Long?er.Long.fromBits(0,0,!1):0,SdkDataMessagePayload.prototype.senderExternalUserId="",SdkDataMessagePayload.create=function(o){return new SdkDataMessagePayload(o)},SdkDataMessagePayload.encode=function(o,p){return p||(p=ei.create()),null!=o.topic&&Object.hasOwnProperty.call(o,"topic")&&p.uint32(10).string(o.topic),null!=o.data&&Object.hasOwnProperty.call(o,"data")&&p.uint32(18).bytes(o.data),null!=o.lifetimeMs&&Object.hasOwnProperty.call(o,"lifetimeMs")&&p.uint32(24).uint32(o.lifetimeMs),null!=o.senderAttendeeId&&Object.hasOwnProperty.call(o,"senderAttendeeId")&&p.uint32(34).string(o.senderAttendeeId),null!=o.ingestTimeNs&&Object.hasOwnProperty.call(o,"ingestTimeNs")&&p.uint32(40).int64(o.ingestTimeNs),null!=o.senderExternalUserId&&Object.hasOwnProperty.call(o,"senderExternalUserId")&&p.uint32(50).string(o.senderExternalUserId),p},SdkDataMessagePayload.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkDataMessagePayload.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkDataMessagePayload;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.topic=o.string();break;case 2:m.data=o.bytes();break;case 3:m.lifetimeMs=o.uint32();break;case 4:m.senderAttendeeId=o.string();break;case 5:m.ingestTimeNs=o.int64();break;case 6:m.senderExternalUserId=o.string();break;default:o.skipType(7&_)}}return m},SdkDataMessagePayload.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDataMessagePayload.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.topic&&o.hasOwnProperty("topic")&&!er.isString(o.topic)?"topic: string expected":null!=o.data&&o.hasOwnProperty("data")&&!(o.data&&"number"==typeof o.data.length||er.isString(o.data))?"data: buffer expected":null!=o.lifetimeMs&&o.hasOwnProperty("lifetimeMs")&&!er.isInteger(o.lifetimeMs)?"lifetimeMs: integer expected":null!=o.senderAttendeeId&&o.hasOwnProperty("senderAttendeeId")&&!er.isString(o.senderAttendeeId)?"senderAttendeeId: string expected":null!=o.ingestTimeNs&&o.hasOwnProperty("ingestTimeNs")&&!er.isInteger(o.ingestTimeNs)&&!(o.ingestTimeNs&&er.isInteger(o.ingestTimeNs.low)&&er.isInteger(o.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=o.senderExternalUserId&&o.hasOwnProperty("senderExternalUserId")&&!er.isString(o.senderExternalUserId)?"senderExternalUserId: string expected":null},SdkDataMessagePayload.fromObject=function(o){if(o instanceof en.SdkDataMessagePayload)return o;var p=new en.SdkDataMessagePayload;return null!=o.topic&&(p.topic=String(o.topic)),null!=o.data&&("string"==typeof o.data?er.base64.decode(o.data,p.data=er.newBuffer(er.base64.length(o.data)),0):o.data.length>=0&&(p.data=o.data)),null!=o.lifetimeMs&&(p.lifetimeMs=o.lifetimeMs>>>0),null!=o.senderAttendeeId&&(p.senderAttendeeId=String(o.senderAttendeeId)),null!=o.ingestTimeNs&&(er.Long?(p.ingestTimeNs=er.Long.fromValue(o.ingestTimeNs)).unsigned=!1:"string"==typeof o.ingestTimeNs?p.ingestTimeNs=parseInt(o.ingestTimeNs,10):"number"==typeof o.ingestTimeNs?p.ingestTimeNs=o.ingestTimeNs:"object"==typeof o.ingestTimeNs&&(p.ingestTimeNs=new er.LongBits(o.ingestTimeNs.low>>>0,o.ingestTimeNs.high>>>0).toNumber())),null!=o.senderExternalUserId&&(p.senderExternalUserId=String(o.senderExternalUserId)),p},SdkDataMessagePayload.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.topic="",p.bytes===String?f.data="":(f.data=[],p.bytes!==Array&&(f.data=er.newBuffer(f.data))),f.lifetimeMs=0,f.senderAttendeeId="",er.Long){var m=new er.Long(0,0,!1);f.ingestTimeNs=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.ingestTimeNs=p.longs===String?"0":0;f.senderExternalUserId=""}return null!=o.topic&&o.hasOwnProperty("topic")&&(f.topic=o.topic),null!=o.data&&o.hasOwnProperty("data")&&(f.data=p.bytes===String?er.base64.encode(o.data,0,o.data.length):p.bytes===Array?Array.prototype.slice.call(o.data):o.data),null!=o.lifetimeMs&&o.hasOwnProperty("lifetimeMs")&&(f.lifetimeMs=o.lifetimeMs),null!=o.senderAttendeeId&&o.hasOwnProperty("senderAttendeeId")&&(f.senderAttendeeId=o.senderAttendeeId),null!=o.ingestTimeNs&&o.hasOwnProperty("ingestTimeNs")&&("number"==typeof o.ingestTimeNs?f.ingestTimeNs=p.longs===String?String(o.ingestTimeNs):o.ingestTimeNs:f.ingestTimeNs=p.longs===String?er.Long.prototype.toString.call(o.ingestTimeNs):p.longs===Number?new er.LongBits(o.ingestTimeNs.low>>>0,o.ingestTimeNs.high>>>0).toNumber():o.ingestTimeNs),null!=o.senderExternalUserId&&o.hasOwnProperty("senderExternalUserId")&&(f.senderExternalUserId=o.senderExternalUserId),f},SdkDataMessagePayload.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDataMessagePayload.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDataMessagePayload"},SdkDataMessagePayload}(),en.SdkTurnCredentials=function(){function SdkTurnCredentials(o){if(this.uris=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTurnCredentials.prototype.username="",SdkTurnCredentials.prototype.password="",SdkTurnCredentials.prototype.ttl=0,SdkTurnCredentials.prototype.uris=er.emptyArray,SdkTurnCredentials.create=function(o){return new SdkTurnCredentials(o)},SdkTurnCredentials.encode=function(o,p){if(p||(p=ei.create()),null!=o.username&&Object.hasOwnProperty.call(o,"username")&&p.uint32(10).string(o.username),null!=o.password&&Object.hasOwnProperty.call(o,"password")&&p.uint32(18).string(o.password),null!=o.ttl&&Object.hasOwnProperty.call(o,"ttl")&&p.uint32(24).uint32(o.ttl),null!=o.uris&&o.uris.length)for(var f=0;f<o.uris.length;++f)p.uint32(34).string(o.uris[f]);return p},SdkTurnCredentials.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTurnCredentials.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTurnCredentials;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.username=o.string();break;case 2:m.password=o.string();break;case 3:m.ttl=o.uint32();break;case 4:m.uris&&m.uris.length||(m.uris=[]),m.uris.push(o.string());break;default:o.skipType(7&_)}}return m},SdkTurnCredentials.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTurnCredentials.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.username&&o.hasOwnProperty("username")&&!er.isString(o.username))return"username: string expected";if(null!=o.password&&o.hasOwnProperty("password")&&!er.isString(o.password))return"password: string expected";if(null!=o.ttl&&o.hasOwnProperty("ttl")&&!er.isInteger(o.ttl))return"ttl: integer expected";if(null!=o.uris&&o.hasOwnProperty("uris")){if(!Array.isArray(o.uris))return"uris: array expected";for(var p=0;p<o.uris.length;++p)if(!er.isString(o.uris[p]))return"uris: string[] expected"}return null},SdkTurnCredentials.fromObject=function(o){if(o instanceof en.SdkTurnCredentials)return o;var p=new en.SdkTurnCredentials;if(null!=o.username&&(p.username=String(o.username)),null!=o.password&&(p.password=String(o.password)),null!=o.ttl&&(p.ttl=o.ttl>>>0),o.uris){if(!Array.isArray(o.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");p.uris=[];for(var f=0;f<o.uris.length;++f)p.uris[f]=String(o.uris[f])}return p},SdkTurnCredentials.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.uris=[]),p.defaults&&(f.username="",f.password="",f.ttl=0),null!=o.username&&o.hasOwnProperty("username")&&(f.username=o.username),null!=o.password&&o.hasOwnProperty("password")&&(f.password=o.password),null!=o.ttl&&o.hasOwnProperty("ttl")&&(f.ttl=o.ttl),o.uris&&o.uris.length){f.uris=[];for(var m=0;m<o.uris.length;++m)f.uris[m]=o.uris[m]}return f},SdkTurnCredentials.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTurnCredentials.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTurnCredentials"},SdkTurnCredentials}(),en.SdkTranscriptItem=function(){var o,p;function SdkTranscriptItem(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptItem.prototype.content="",SdkTranscriptItem.prototype.endTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptItem.prototype.speakerAttendeeId="",SdkTranscriptItem.prototype.speakerExternalUserId="",SdkTranscriptItem.prototype.startTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptItem.prototype.type=1,SdkTranscriptItem.prototype.vocabularyFilterMatch=!1,SdkTranscriptItem.prototype.confidence=0,SdkTranscriptItem.prototype.stable=!1,SdkTranscriptItem.create=function(o){return new SdkTranscriptItem(o)},SdkTranscriptItem.encode=function(o,p){return p||(p=ei.create()),null!=o.content&&Object.hasOwnProperty.call(o,"content")&&p.uint32(10).string(o.content),null!=o.endTime&&Object.hasOwnProperty.call(o,"endTime")&&p.uint32(16).int64(o.endTime),null!=o.speakerAttendeeId&&Object.hasOwnProperty.call(o,"speakerAttendeeId")&&p.uint32(26).string(o.speakerAttendeeId),null!=o.speakerExternalUserId&&Object.hasOwnProperty.call(o,"speakerExternalUserId")&&p.uint32(34).string(o.speakerExternalUserId),null!=o.startTime&&Object.hasOwnProperty.call(o,"startTime")&&p.uint32(40).int64(o.startTime),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(48).int32(o.type),null!=o.vocabularyFilterMatch&&Object.hasOwnProperty.call(o,"vocabularyFilterMatch")&&p.uint32(56).bool(o.vocabularyFilterMatch),null!=o.confidence&&Object.hasOwnProperty.call(o,"confidence")&&p.uint32(65).double(o.confidence),null!=o.stable&&Object.hasOwnProperty.call(o,"stable")&&p.uint32(72).bool(o.stable),p},SdkTranscriptItem.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptItem.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptItem;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.content=o.string();break;case 2:m.endTime=o.int64();break;case 3:m.speakerAttendeeId=o.string();break;case 4:m.speakerExternalUserId=o.string();break;case 5:m.startTime=o.int64();break;case 6:m.type=o.int32();break;case 7:m.vocabularyFilterMatch=o.bool();break;case 8:m.confidence=o.double();break;case 9:m.stable=o.bool();break;default:o.skipType(7&_)}}return m},SdkTranscriptItem.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptItem.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.content&&o.hasOwnProperty("content")&&!er.isString(o.content))return"content: string expected";if(null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high)))return"endTime: integer|Long expected";if(null!=o.speakerAttendeeId&&o.hasOwnProperty("speakerAttendeeId")&&!er.isString(o.speakerAttendeeId))return"speakerAttendeeId: string expected";if(null!=o.speakerExternalUserId&&o.hasOwnProperty("speakerExternalUserId")&&!er.isString(o.speakerExternalUserId))return"speakerExternalUserId: string expected";if(null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high)))return"startTime: integer|Long expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:}return null!=o.vocabularyFilterMatch&&o.hasOwnProperty("vocabularyFilterMatch")&&"boolean"!=typeof o.vocabularyFilterMatch?"vocabularyFilterMatch: boolean expected":null!=o.confidence&&o.hasOwnProperty("confidence")&&"number"!=typeof o.confidence?"confidence: number expected":null!=o.stable&&o.hasOwnProperty("stable")&&"boolean"!=typeof o.stable?"stable: boolean expected":null},SdkTranscriptItem.fromObject=function(o){if(o instanceof en.SdkTranscriptItem)return o;var p=new en.SdkTranscriptItem;switch(null!=o.content&&(p.content=String(o.content)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.speakerAttendeeId&&(p.speakerAttendeeId=String(o.speakerAttendeeId)),null!=o.speakerExternalUserId&&(p.speakerExternalUserId=String(o.speakerExternalUserId)),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"PRONUNCIATION":case 1:p.type=1;break;case"PUNCTUATION":case 2:p.type=2}return null!=o.vocabularyFilterMatch&&(p.vocabularyFilterMatch=!!o.vocabularyFilterMatch),null!=o.confidence&&(p.confidence=Number(o.confidence)),null!=o.stable&&(p.stable=!!o.stable),p},SdkTranscriptItem.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.content="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(f.speakerAttendeeId="",f.speakerExternalUserId="",er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.type=p.enums===String?"PRONUNCIATION":1,f.vocabularyFilterMatch=!1,f.confidence=0,f.stable=!1}return null!=o.content&&o.hasOwnProperty("content")&&(f.content=o.content),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.speakerAttendeeId&&o.hasOwnProperty("speakerAttendeeId")&&(f.speakerAttendeeId=o.speakerAttendeeId),null!=o.speakerExternalUserId&&o.hasOwnProperty("speakerExternalUserId")&&(f.speakerExternalUserId=o.speakerExternalUserId),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkTranscriptItem.Type[o.type]?o.type:en.SdkTranscriptItem.Type[o.type]:o.type),null!=o.vocabularyFilterMatch&&o.hasOwnProperty("vocabularyFilterMatch")&&(f.vocabularyFilterMatch=o.vocabularyFilterMatch),null!=o.confidence&&o.hasOwnProperty("confidence")&&(f.confidence=p.json&&!isFinite(o.confidence)?String(o.confidence):o.confidence),null!=o.stable&&o.hasOwnProperty("stable")&&(f.stable=o.stable),f},SdkTranscriptItem.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptItem.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptItem"},(p=Object.create(o={}))[o[1]="PRONUNCIATION"]=1,p[o[2]="PUNCTUATION"]=2,SdkTranscriptItem.Type=p,SdkTranscriptItem}(),en.SdkTranscriptEntity=function(){function SdkTranscriptEntity(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptEntity.prototype.category="",SdkTranscriptEntity.prototype.confidence=0,SdkTranscriptEntity.prototype.content="",SdkTranscriptEntity.prototype.endTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptEntity.prototype.startTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptEntity.prototype.type="",SdkTranscriptEntity.create=function(o){return new SdkTranscriptEntity(o)},SdkTranscriptEntity.encode=function(o,p){return p||(p=ei.create()),null!=o.category&&Object.hasOwnProperty.call(o,"category")&&p.uint32(10).string(o.category),null!=o.confidence&&Object.hasOwnProperty.call(o,"confidence")&&p.uint32(17).double(o.confidence),null!=o.content&&Object.hasOwnProperty.call(o,"content")&&p.uint32(26).string(o.content),null!=o.endTime&&Object.hasOwnProperty.call(o,"endTime")&&p.uint32(32).int64(o.endTime),null!=o.startTime&&Object.hasOwnProperty.call(o,"startTime")&&p.uint32(40).int64(o.startTime),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(50).string(o.type),p},SdkTranscriptEntity.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptEntity.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptEntity;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.category=o.string();break;case 2:m.confidence=o.double();break;case 3:m.content=o.string();break;case 4:m.endTime=o.int64();break;case 5:m.startTime=o.int64();break;case 6:m.type=o.string();break;default:o.skipType(7&_)}}return m},SdkTranscriptEntity.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptEntity.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.category&&o.hasOwnProperty("category")&&!er.isString(o.category)?"category: string expected":null!=o.confidence&&o.hasOwnProperty("confidence")&&"number"!=typeof o.confidence?"confidence: number expected":null!=o.content&&o.hasOwnProperty("content")&&!er.isString(o.content)?"content: string expected":null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high))?"endTime: integer|Long expected":null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high))?"startTime: integer|Long expected":null!=o.type&&o.hasOwnProperty("type")&&!er.isString(o.type)?"type: string expected":null},SdkTranscriptEntity.fromObject=function(o){if(o instanceof en.SdkTranscriptEntity)return o;var p=new en.SdkTranscriptEntity;return null!=o.category&&(p.category=String(o.category)),null!=o.confidence&&(p.confidence=Number(o.confidence)),null!=o.content&&(p.content=String(o.content)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),null!=o.type&&(p.type=String(o.type)),p},SdkTranscriptEntity.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.category="",f.confidence=0,f.content="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.type=""}return null!=o.category&&o.hasOwnProperty("category")&&(f.category=o.category),null!=o.confidence&&o.hasOwnProperty("confidence")&&(f.confidence=p.json&&!isFinite(o.confidence)?String(o.confidence):o.confidence),null!=o.content&&o.hasOwnProperty("content")&&(f.content=o.content),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.type&&o.hasOwnProperty("type")&&(f.type=o.type),f},SdkTranscriptEntity.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptEntity.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptEntity"},SdkTranscriptEntity}(),en.SdkTranscriptAlternative=function(){function SdkTranscriptAlternative(o){if(this.items=[],this.entities=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptAlternative.prototype.items=er.emptyArray,SdkTranscriptAlternative.prototype.transcript="",SdkTranscriptAlternative.prototype.entities=er.emptyArray,SdkTranscriptAlternative.create=function(o){return new SdkTranscriptAlternative(o)},SdkTranscriptAlternative.encode=function(o,p){if(p||(p=ei.create()),null!=o.items&&o.items.length)for(var f=0;f<o.items.length;++f)en.SdkTranscriptItem.encode(o.items[f],p.uint32(10).fork()).ldelim();if(null!=o.transcript&&Object.hasOwnProperty.call(o,"transcript")&&p.uint32(18).string(o.transcript),null!=o.entities&&o.entities.length)for(var f=0;f<o.entities.length;++f)en.SdkTranscriptEntity.encode(o.entities[f],p.uint32(26).fork()).ldelim();return p},SdkTranscriptAlternative.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptAlternative.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptAlternative;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.items&&m.items.length||(m.items=[]),m.items.push(en.SdkTranscriptItem.decode(o,o.uint32()));break;case 2:m.transcript=o.string();break;case 3:m.entities&&m.entities.length||(m.entities=[]),m.entities.push(en.SdkTranscriptEntity.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkTranscriptAlternative.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptAlternative.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.items&&o.hasOwnProperty("items")){if(!Array.isArray(o.items))return"items: array expected";for(var p=0;p<o.items.length;++p){var f=en.SdkTranscriptItem.verify(o.items[p]);if(f)return"items."+f}}if(null!=o.transcript&&o.hasOwnProperty("transcript")&&!er.isString(o.transcript))return"transcript: string expected";if(null!=o.entities&&o.hasOwnProperty("entities")){if(!Array.isArray(o.entities))return"entities: array expected";for(var p=0;p<o.entities.length;++p){var f=en.SdkTranscriptEntity.verify(o.entities[p]);if(f)return"entities."+f}}return null},SdkTranscriptAlternative.fromObject=function(o){if(o instanceof en.SdkTranscriptAlternative)return o;var p=new en.SdkTranscriptAlternative;if(o.items){if(!Array.isArray(o.items))throw TypeError(".SdkTranscriptAlternative.items: array expected");p.items=[];for(var f=0;f<o.items.length;++f){if("object"!=typeof o.items[f])throw TypeError(".SdkTranscriptAlternative.items: object expected");p.items[f]=en.SdkTranscriptItem.fromObject(o.items[f])}}if(null!=o.transcript&&(p.transcript=String(o.transcript)),o.entities){if(!Array.isArray(o.entities))throw TypeError(".SdkTranscriptAlternative.entities: array expected");p.entities=[];for(var f=0;f<o.entities.length;++f){if("object"!=typeof o.entities[f])throw TypeError(".SdkTranscriptAlternative.entities: object expected");p.entities[f]=en.SdkTranscriptEntity.fromObject(o.entities[f])}}return p},SdkTranscriptAlternative.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.items=[],f.entities=[]),p.defaults&&(f.transcript=""),o.items&&o.items.length){f.items=[];for(var m=0;m<o.items.length;++m)f.items[m]=en.SdkTranscriptItem.toObject(o.items[m],p)}if(null!=o.transcript&&o.hasOwnProperty("transcript")&&(f.transcript=o.transcript),o.entities&&o.entities.length){f.entities=[];for(var m=0;m<o.entities.length;++m)f.entities[m]=en.SdkTranscriptEntity.toObject(o.entities[m],p)}return f},SdkTranscriptAlternative.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptAlternative.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptAlternative"},SdkTranscriptAlternative}(),en.SdkTranscriptLanguageWithScore=function(){function SdkTranscriptLanguageWithScore(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptLanguageWithScore.prototype.languageCode="",SdkTranscriptLanguageWithScore.prototype.score=0,SdkTranscriptLanguageWithScore.create=function(o){return new SdkTranscriptLanguageWithScore(o)},SdkTranscriptLanguageWithScore.encode=function(o,p){return p||(p=ei.create()),null!=o.languageCode&&Object.hasOwnProperty.call(o,"languageCode")&&p.uint32(10).string(o.languageCode),null!=o.score&&Object.hasOwnProperty.call(o,"score")&&p.uint32(17).double(o.score),p},SdkTranscriptLanguageWithScore.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptLanguageWithScore.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptLanguageWithScore;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.languageCode=o.string();break;case 2:m.score=o.double();break;default:o.skipType(7&_)}}return m},SdkTranscriptLanguageWithScore.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptLanguageWithScore.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.languageCode&&o.hasOwnProperty("languageCode")&&!er.isString(o.languageCode)?"languageCode: string expected":null!=o.score&&o.hasOwnProperty("score")&&"number"!=typeof o.score?"score: number expected":null},SdkTranscriptLanguageWithScore.fromObject=function(o){if(o instanceof en.SdkTranscriptLanguageWithScore)return o;var p=new en.SdkTranscriptLanguageWithScore;return null!=o.languageCode&&(p.languageCode=String(o.languageCode)),null!=o.score&&(p.score=Number(o.score)),p},SdkTranscriptLanguageWithScore.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.languageCode="",f.score=0),null!=o.languageCode&&o.hasOwnProperty("languageCode")&&(f.languageCode=o.languageCode),null!=o.score&&o.hasOwnProperty("score")&&(f.score=p.json&&!isFinite(o.score)?String(o.score):o.score),f},SdkTranscriptLanguageWithScore.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptLanguageWithScore.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptLanguageWithScore"},SdkTranscriptLanguageWithScore}(),en.SdkTranscriptResult=function(){function SdkTranscriptResult(o){if(this.alternatives=[],this.languageIdentification=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptResult.prototype.alternatives=er.emptyArray,SdkTranscriptResult.prototype.channelId="",SdkTranscriptResult.prototype.endTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptResult.prototype.isPartial=!1,SdkTranscriptResult.prototype.resultId="",SdkTranscriptResult.prototype.startTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptResult.prototype.languageCode="",SdkTranscriptResult.prototype.languageIdentification=er.emptyArray,SdkTranscriptResult.create=function(o){return new SdkTranscriptResult(o)},SdkTranscriptResult.encode=function(o,p){if(p||(p=ei.create()),null!=o.alternatives&&o.alternatives.length)for(var f=0;f<o.alternatives.length;++f)en.SdkTranscriptAlternative.encode(o.alternatives[f],p.uint32(10).fork()).ldelim();if(null!=o.channelId&&Object.hasOwnProperty.call(o,"channelId")&&p.uint32(18).string(o.channelId),null!=o.endTime&&Object.hasOwnProperty.call(o,"endTime")&&p.uint32(24).int64(o.endTime),null!=o.isPartial&&Object.hasOwnProperty.call(o,"isPartial")&&p.uint32(32).bool(o.isPartial),null!=o.resultId&&Object.hasOwnProperty.call(o,"resultId")&&p.uint32(42).string(o.resultId),null!=o.startTime&&Object.hasOwnProperty.call(o,"startTime")&&p.uint32(48).int64(o.startTime),null!=o.languageCode&&Object.hasOwnProperty.call(o,"languageCode")&&p.uint32(58).string(o.languageCode),null!=o.languageIdentification&&o.languageIdentification.length)for(var f=0;f<o.languageIdentification.length;++f)en.SdkTranscriptLanguageWithScore.encode(o.languageIdentification[f],p.uint32(66).fork()).ldelim();return p},SdkTranscriptResult.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptResult.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptResult;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.alternatives&&m.alternatives.length||(m.alternatives=[]),m.alternatives.push(en.SdkTranscriptAlternative.decode(o,o.uint32()));break;case 2:m.channelId=o.string();break;case 3:m.endTime=o.int64();break;case 4:m.isPartial=o.bool();break;case 5:m.resultId=o.string();break;case 6:m.startTime=o.int64();break;case 7:m.languageCode=o.string();break;case 8:m.languageIdentification&&m.languageIdentification.length||(m.languageIdentification=[]),m.languageIdentification.push(en.SdkTranscriptLanguageWithScore.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkTranscriptResult.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptResult.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.alternatives&&o.hasOwnProperty("alternatives")){if(!Array.isArray(o.alternatives))return"alternatives: array expected";for(var p=0;p<o.alternatives.length;++p){var f=en.SdkTranscriptAlternative.verify(o.alternatives[p]);if(f)return"alternatives."+f}}if(null!=o.channelId&&o.hasOwnProperty("channelId")&&!er.isString(o.channelId))return"channelId: string expected";if(null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high)))return"endTime: integer|Long expected";if(null!=o.isPartial&&o.hasOwnProperty("isPartial")&&"boolean"!=typeof o.isPartial)return"isPartial: boolean expected";if(null!=o.resultId&&o.hasOwnProperty("resultId")&&!er.isString(o.resultId))return"resultId: string expected";if(null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high)))return"startTime: integer|Long expected";if(null!=o.languageCode&&o.hasOwnProperty("languageCode")&&!er.isString(o.languageCode))return"languageCode: string expected";if(null!=o.languageIdentification&&o.hasOwnProperty("languageIdentification")){if(!Array.isArray(o.languageIdentification))return"languageIdentification: array expected";for(var p=0;p<o.languageIdentification.length;++p){var f=en.SdkTranscriptLanguageWithScore.verify(o.languageIdentification[p]);if(f)return"languageIdentification."+f}}return null},SdkTranscriptResult.fromObject=function(o){if(o instanceof en.SdkTranscriptResult)return o;var p=new en.SdkTranscriptResult;if(o.alternatives){if(!Array.isArray(o.alternatives))throw TypeError(".SdkTranscriptResult.alternatives: array expected");p.alternatives=[];for(var f=0;f<o.alternatives.length;++f){if("object"!=typeof o.alternatives[f])throw TypeError(".SdkTranscriptResult.alternatives: object expected");p.alternatives[f]=en.SdkTranscriptAlternative.fromObject(o.alternatives[f])}}if(null!=o.channelId&&(p.channelId=String(o.channelId)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.isPartial&&(p.isPartial=!!o.isPartial),null!=o.resultId&&(p.resultId=String(o.resultId)),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),null!=o.languageCode&&(p.languageCode=String(o.languageCode)),o.languageIdentification){if(!Array.isArray(o.languageIdentification))throw TypeError(".SdkTranscriptResult.languageIdentification: array expected");p.languageIdentification=[];for(var f=0;f<o.languageIdentification.length;++f){if("object"!=typeof o.languageIdentification[f])throw TypeError(".SdkTranscriptResult.languageIdentification: object expected");p.languageIdentification[f]=en.SdkTranscriptLanguageWithScore.fromObject(o.languageIdentification[f])}}return p},SdkTranscriptResult.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.alternatives=[],f.languageIdentification=[]),p.defaults){if(f.channelId="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(f.isPartial=!1,f.resultId="",er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.languageCode=""}if(o.alternatives&&o.alternatives.length){f.alternatives=[];for(var _=0;_<o.alternatives.length;++_)f.alternatives[_]=en.SdkTranscriptAlternative.toObject(o.alternatives[_],p)}if(null!=o.channelId&&o.hasOwnProperty("channelId")&&(f.channelId=o.channelId),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.isPartial&&o.hasOwnProperty("isPartial")&&(f.isPartial=o.isPartial),null!=o.resultId&&o.hasOwnProperty("resultId")&&(f.resultId=o.resultId),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.languageCode&&o.hasOwnProperty("languageCode")&&(f.languageCode=o.languageCode),o.languageIdentification&&o.languageIdentification.length){f.languageIdentification=[];for(var _=0;_<o.languageIdentification.length;++_)f.languageIdentification[_]=en.SdkTranscriptLanguageWithScore.toObject(o.languageIdentification[_],p)}return f},SdkTranscriptResult.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptResult.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptResult"},SdkTranscriptResult}(),en.SdkTranscript=function(){function SdkTranscript(o){if(this.results=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscript.prototype.results=er.emptyArray,SdkTranscript.create=function(o){return new SdkTranscript(o)},SdkTranscript.encode=function(o,p){if(p||(p=ei.create()),null!=o.results&&o.results.length)for(var f=0;f<o.results.length;++f)en.SdkTranscriptResult.encode(o.results[f],p.uint32(10).fork()).ldelim();return p},SdkTranscript.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscript.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscript;o.pos<f;){var _=o.uint32();_>>>3==1?(m.results&&m.results.length||(m.results=[]),m.results.push(en.SdkTranscriptResult.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkTranscript.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscript.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.results&&o.hasOwnProperty("results")){if(!Array.isArray(o.results))return"results: array expected";for(var p=0;p<o.results.length;++p){var f=en.SdkTranscriptResult.verify(o.results[p]);if(f)return"results."+f}}return null},SdkTranscript.fromObject=function(o){if(o instanceof en.SdkTranscript)return o;var p=new en.SdkTranscript;if(o.results){if(!Array.isArray(o.results))throw TypeError(".SdkTranscript.results: array expected");p.results=[];for(var f=0;f<o.results.length;++f){if("object"!=typeof o.results[f])throw TypeError(".SdkTranscript.results: object expected");p.results[f]=en.SdkTranscriptResult.fromObject(o.results[f])}}return p},SdkTranscript.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.results=[]),o.results&&o.results.length){f.results=[];for(var m=0;m<o.results.length;++m)f.results[m]=en.SdkTranscriptResult.toObject(o.results[m],p)}return f},SdkTranscript.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscript.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscript"},SdkTranscript}(),en.SdkTranscriptionStatus=function(){var o,p;function SdkTranscriptionStatus(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptionStatus.prototype.type=1,SdkTranscriptionStatus.prototype.eventTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptionStatus.prototype.transcriptionRegion="",SdkTranscriptionStatus.prototype.transcriptionConfiguration="",SdkTranscriptionStatus.prototype.message="",SdkTranscriptionStatus.create=function(o){return new SdkTranscriptionStatus(o)},SdkTranscriptionStatus.encode=function(o,p){return p||(p=ei.create()),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(8).int32(o.type),null!=o.eventTime&&Object.hasOwnProperty.call(o,"eventTime")&&p.uint32(16).int64(o.eventTime),null!=o.transcriptionRegion&&Object.hasOwnProperty.call(o,"transcriptionRegion")&&p.uint32(26).string(o.transcriptionRegion),null!=o.transcriptionConfiguration&&Object.hasOwnProperty.call(o,"transcriptionConfiguration")&&p.uint32(34).string(o.transcriptionConfiguration),null!=o.message&&Object.hasOwnProperty.call(o,"message")&&p.uint32(42).string(o.message),p},SdkTranscriptionStatus.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptionStatus.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptionStatus;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.eventTime=o.int64();break;case 3:m.transcriptionRegion=o.string();break;case 4:m.transcriptionConfiguration=o.string();break;case 5:m.message=o.string();break;default:o.skipType(7&_)}}return m},SdkTranscriptionStatus.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptionStatus.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:}return null!=o.eventTime&&o.hasOwnProperty("eventTime")&&!er.isInteger(o.eventTime)&&!(o.eventTime&&er.isInteger(o.eventTime.low)&&er.isInteger(o.eventTime.high))?"eventTime: integer|Long expected":null!=o.transcriptionRegion&&o.hasOwnProperty("transcriptionRegion")&&!er.isString(o.transcriptionRegion)?"transcriptionRegion: string expected":null!=o.transcriptionConfiguration&&o.hasOwnProperty("transcriptionConfiguration")&&!er.isString(o.transcriptionConfiguration)?"transcriptionConfiguration: string expected":null!=o.message&&o.hasOwnProperty("message")&&!er.isString(o.message)?"message: string expected":null},SdkTranscriptionStatus.fromObject=function(o){if(o instanceof en.SdkTranscriptionStatus)return o;var p=new en.SdkTranscriptionStatus;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"STARTED":case 1:p.type=1;break;case"INTERRUPTED":case 2:p.type=2;break;case"RESUMED":case 3:p.type=3;break;case"STOPPED":case 4:p.type=4;break;case"FAILED":case 5:p.type=5}return null!=o.eventTime&&(er.Long?(p.eventTime=er.Long.fromValue(o.eventTime)).unsigned=!1:"string"==typeof o.eventTime?p.eventTime=parseInt(o.eventTime,10):"number"==typeof o.eventTime?p.eventTime=o.eventTime:"object"==typeof o.eventTime&&(p.eventTime=new er.LongBits(o.eventTime.low>>>0,o.eventTime.high>>>0).toNumber())),null!=o.transcriptionRegion&&(p.transcriptionRegion=String(o.transcriptionRegion)),null!=o.transcriptionConfiguration&&(p.transcriptionConfiguration=String(o.transcriptionConfiguration)),null!=o.message&&(p.message=String(o.message)),p},SdkTranscriptionStatus.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.type=p.enums===String?"STARTED":1,er.Long){var m=new er.Long(0,0,!1);f.eventTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.eventTime=p.longs===String?"0":0;f.transcriptionRegion="",f.transcriptionConfiguration="",f.message=""}return null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkTranscriptionStatus.Type[o.type]?o.type:en.SdkTranscriptionStatus.Type[o.type]:o.type),null!=o.eventTime&&o.hasOwnProperty("eventTime")&&("number"==typeof o.eventTime?f.eventTime=p.longs===String?String(o.eventTime):o.eventTime:f.eventTime=p.longs===String?er.Long.prototype.toString.call(o.eventTime):p.longs===Number?new er.LongBits(o.eventTime.low>>>0,o.eventTime.high>>>0).toNumber():o.eventTime),null!=o.transcriptionRegion&&o.hasOwnProperty("transcriptionRegion")&&(f.transcriptionRegion=o.transcriptionRegion),null!=o.transcriptionConfiguration&&o.hasOwnProperty("transcriptionConfiguration")&&(f.transcriptionConfiguration=o.transcriptionConfiguration),null!=o.message&&o.hasOwnProperty("message")&&(f.message=o.message),f},SdkTranscriptionStatus.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptionStatus.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptionStatus"},(p=Object.create(o={}))[o[1]="STARTED"]=1,p[o[2]="INTERRUPTED"]=2,p[o[3]="RESUMED"]=3,p[o[4]="STOPPED"]=4,p[o[5]="FAILED"]=5,SdkTranscriptionStatus.Type=p,SdkTranscriptionStatus}(),en.SdkTranscriptEvent=function(){var o;function SdkTranscriptEvent(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptEvent.prototype.status=null,SdkTranscriptEvent.prototype.transcript=null,Object.defineProperty(SdkTranscriptEvent.prototype,"Event",{get:er.oneOfGetter(o=["status","transcript"]),set:er.oneOfSetter(o)}),SdkTranscriptEvent.create=function(o){return new SdkTranscriptEvent(o)},SdkTranscriptEvent.encode=function(o,p){return p||(p=ei.create()),null!=o.status&&Object.hasOwnProperty.call(o,"status")&&en.SdkTranscriptionStatus.encode(o.status,p.uint32(10).fork()).ldelim(),null!=o.transcript&&Object.hasOwnProperty.call(o,"transcript")&&en.SdkTranscript.encode(o.transcript,p.uint32(18).fork()).ldelim(),p},SdkTranscriptEvent.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptEvent.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptEvent;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.status=en.SdkTranscriptionStatus.decode(o,o.uint32());break;case 2:m.transcript=en.SdkTranscript.decode(o,o.uint32());break;default:o.skipType(7&_)}}return m},SdkTranscriptEvent.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptEvent.verify=function(o){if("object"!=typeof o||null===o)return"object expected";var p={};if(null!=o.status&&o.hasOwnProperty("status")){p.Event=1;var f=en.SdkTranscriptionStatus.verify(o.status);if(f)return"status."+f}if(null!=o.transcript&&o.hasOwnProperty("transcript")){if(1===p.Event)return"Event: multiple values";p.Event=1;var f=en.SdkTranscript.verify(o.transcript);if(f)return"transcript."+f}return null},SdkTranscriptEvent.fromObject=function(o){if(o instanceof en.SdkTranscriptEvent)return o;var p=new en.SdkTranscriptEvent;if(null!=o.status){if("object"!=typeof o.status)throw TypeError(".SdkTranscriptEvent.status: object expected");p.status=en.SdkTranscriptionStatus.fromObject(o.status)}if(null!=o.transcript){if("object"!=typeof o.transcript)throw TypeError(".SdkTranscriptEvent.transcript: object expected");p.transcript=en.SdkTranscript.fromObject(o.transcript)}return p},SdkTranscriptEvent.toObject=function(o,p){p||(p={});var f={};return null!=o.status&&o.hasOwnProperty("status")&&(f.status=en.SdkTranscriptionStatus.toObject(o.status,p),p.oneofs&&(f.Event="status")),null!=o.transcript&&o.hasOwnProperty("transcript")&&(f.transcript=en.SdkTranscript.toObject(o.transcript,p),p.oneofs&&(f.Event="transcript")),f},SdkTranscriptEvent.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptEvent.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptEvent"},SdkTranscriptEvent}(),en.SdkTranscriptFrame=function(){function SdkTranscriptFrame(o){if(this.events=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptFrame.prototype.events=er.emptyArray,SdkTranscriptFrame.create=function(o){return new SdkTranscriptFrame(o)},SdkTranscriptFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.events&&o.events.length)for(var f=0;f<o.events.length;++f)en.SdkTranscriptEvent.encode(o.events[f],p.uint32(10).fork()).ldelim();return p},SdkTranscriptFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.events&&m.events.length||(m.events=[]),m.events.push(en.SdkTranscriptEvent.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkTranscriptFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.events&&o.hasOwnProperty("events")){if(!Array.isArray(o.events))return"events: array expected";for(var p=0;p<o.events.length;++p){var f=en.SdkTranscriptEvent.verify(o.events[p]);if(f)return"events."+f}}return null},SdkTranscriptFrame.fromObject=function(o){if(o instanceof en.SdkTranscriptFrame)return o;var p=new en.SdkTranscriptFrame;if(o.events){if(!Array.isArray(o.events))throw TypeError(".SdkTranscriptFrame.events: array expected");p.events=[];for(var f=0;f<o.events.length;++f){if("object"!=typeof o.events[f])throw TypeError(".SdkTranscriptFrame.events: object expected");p.events[f]=en.SdkTranscriptEvent.fromObject(o.events[f])}}return p},SdkTranscriptFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.events=[]),o.events&&o.events.length){f.events=[];for(var m=0;m<o.events.length;++m)f.events[m]=en.SdkTranscriptEvent.toObject(o.events[m],p)}return f},SdkTranscriptFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptFrame"},SdkTranscriptFrame}(),en.SdkRemoteVideoUpdateFrame=function(){function SdkRemoteVideoUpdateFrame(o){if(this.addedOrUpdatedVideoSubscriptions=[],this.removedVideoSubscriptionMids=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkRemoteVideoUpdateFrame.prototype.addedOrUpdatedVideoSubscriptions=er.emptyArray,SdkRemoteVideoUpdateFrame.prototype.removedVideoSubscriptionMids=er.emptyArray,SdkRemoteVideoUpdateFrame.create=function(o){return new SdkRemoteVideoUpdateFrame(o)},SdkRemoteVideoUpdateFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.addedOrUpdatedVideoSubscriptions&&o.addedOrUpdatedVideoSubscriptions.length)for(var f=0;f<o.addedOrUpdatedVideoSubscriptions.length;++f)en.SdkVideoSubscriptionConfiguration.encode(o.addedOrUpdatedVideoSubscriptions[f],p.uint32(10).fork()).ldelim();if(null!=o.removedVideoSubscriptionMids&&o.removedVideoSubscriptionMids.length)for(var f=0;f<o.removedVideoSubscriptionMids.length;++f)p.uint32(18).string(o.removedVideoSubscriptionMids[f]);return p},SdkRemoteVideoUpdateFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkRemoteVideoUpdateFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkRemoteVideoUpdateFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.addedOrUpdatedVideoSubscriptions&&m.addedOrUpdatedVideoSubscriptions.length||(m.addedOrUpdatedVideoSubscriptions=[]),m.addedOrUpdatedVideoSubscriptions.push(en.SdkVideoSubscriptionConfiguration.decode(o,o.uint32()));break;case 2:m.removedVideoSubscriptionMids&&m.removedVideoSubscriptionMids.length||(m.removedVideoSubscriptionMids=[]),m.removedVideoSubscriptionMids.push(o.string());break;default:o.skipType(7&_)}}return m},SdkRemoteVideoUpdateFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkRemoteVideoUpdateFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.addedOrUpdatedVideoSubscriptions&&o.hasOwnProperty("addedOrUpdatedVideoSubscriptions")){if(!Array.isArray(o.addedOrUpdatedVideoSubscriptions))return"addedOrUpdatedVideoSubscriptions: array expected";for(var p=0;p<o.addedOrUpdatedVideoSubscriptions.length;++p){var f=en.SdkVideoSubscriptionConfiguration.verify(o.addedOrUpdatedVideoSubscriptions[p]);if(f)return"addedOrUpdatedVideoSubscriptions."+f}}if(null!=o.removedVideoSubscriptionMids&&o.hasOwnProperty("removedVideoSubscriptionMids")){if(!Array.isArray(o.removedVideoSubscriptionMids))return"removedVideoSubscriptionMids: array expected";for(var p=0;p<o.removedVideoSubscriptionMids.length;++p)if(!er.isString(o.removedVideoSubscriptionMids[p]))return"removedVideoSubscriptionMids: string[] expected"}return null},SdkRemoteVideoUpdateFrame.fromObject=function(o){if(o instanceof en.SdkRemoteVideoUpdateFrame)return o;var p=new en.SdkRemoteVideoUpdateFrame;if(o.addedOrUpdatedVideoSubscriptions){if(!Array.isArray(o.addedOrUpdatedVideoSubscriptions))throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: array expected");p.addedOrUpdatedVideoSubscriptions=[];for(var f=0;f<o.addedOrUpdatedVideoSubscriptions.length;++f){if("object"!=typeof o.addedOrUpdatedVideoSubscriptions[f])throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: object expected");p.addedOrUpdatedVideoSubscriptions[f]=en.SdkVideoSubscriptionConfiguration.fromObject(o.addedOrUpdatedVideoSubscriptions[f])}}if(o.removedVideoSubscriptionMids){if(!Array.isArray(o.removedVideoSubscriptionMids))throw TypeError(".SdkRemoteVideoUpdateFrame.removedVideoSubscriptionMids: array expected");p.removedVideoSubscriptionMids=[];for(var f=0;f<o.removedVideoSubscriptionMids.length;++f)p.removedVideoSubscriptionMids[f]=String(o.removedVideoSubscriptionMids[f])}return p},SdkRemoteVideoUpdateFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.addedOrUpdatedVideoSubscriptions=[],f.removedVideoSubscriptionMids=[]),o.addedOrUpdatedVideoSubscriptions&&o.addedOrUpdatedVideoSubscriptions.length){f.addedOrUpdatedVideoSubscriptions=[];for(var m=0;m<o.addedOrUpdatedVideoSubscriptions.length;++m)f.addedOrUpdatedVideoSubscriptions[m]=en.SdkVideoSubscriptionConfiguration.toObject(o.addedOrUpdatedVideoSubscriptions[m],p)}if(o.removedVideoSubscriptionMids&&o.removedVideoSubscriptionMids.length){f.removedVideoSubscriptionMids=[];for(var m=0;m<o.removedVideoSubscriptionMids.length;++m)f.removedVideoSubscriptionMids[m]=o.removedVideoSubscriptionMids[m]}return f},SdkRemoteVideoUpdateFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkRemoteVideoUpdateFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkRemoteVideoUpdateFrame"},SdkRemoteVideoUpdateFrame}(),($=Object.create(U={}))[U[1]="BALANCED"]=1,$[U[2]="MAINTAIN_FRAMERATE"]=2,$[U[3]="MAINTAIN_RESOLUTION"]=3,en.SdkVideoQualityAdaptationPreference=$,en.SdkVideoSubscriptionConfiguration=function(){function SdkVideoSubscriptionConfiguration(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkVideoSubscriptionConfiguration.prototype.mid="",SdkVideoSubscriptionConfiguration.prototype.attendeeId="",SdkVideoSubscriptionConfiguration.prototype.streamId=0,SdkVideoSubscriptionConfiguration.prototype.priority=0,SdkVideoSubscriptionConfiguration.prototype.targetBitrateKbps=0,SdkVideoSubscriptionConfiguration.prototype.groupId=0,SdkVideoSubscriptionConfiguration.prototype.qualityAdaptationPreference=1,SdkVideoSubscriptionConfiguration.create=function(o){return new SdkVideoSubscriptionConfiguration(o)},SdkVideoSubscriptionConfiguration.encode=function(o,p){return p||(p=ei.create()),p.uint32(10).string(o.mid),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(18).string(o.attendeeId),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(24).uint32(o.streamId),null!=o.priority&&Object.hasOwnProperty.call(o,"priority")&&p.uint32(32).uint32(o.priority),null!=o.targetBitrateKbps&&Object.hasOwnProperty.call(o,"targetBitrateKbps")&&p.uint32(40).uint32(o.targetBitrateKbps),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(48).uint32(o.groupId),null!=o.qualityAdaptationPreference&&Object.hasOwnProperty.call(o,"qualityAdaptationPreference")&&p.uint32(56).int32(o.qualityAdaptationPreference),p},SdkVideoSubscriptionConfiguration.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkVideoSubscriptionConfiguration.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkVideoSubscriptionConfiguration;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.mid=o.string();break;case 2:m.attendeeId=o.string();break;case 3:m.streamId=o.uint32();break;case 4:m.priority=o.uint32();break;case 5:m.targetBitrateKbps=o.uint32();break;case 6:m.groupId=o.uint32();break;case 7:m.qualityAdaptationPreference=o.int32();break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("mid"))throw er.ProtocolError("missing required 'mid'",{instance:m});return m},SdkVideoSubscriptionConfiguration.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkVideoSubscriptionConfiguration.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(!er.isString(o.mid))return"mid: string expected";if(null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId))return"attendeeId: string expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.priority&&o.hasOwnProperty("priority")&&!er.isInteger(o.priority))return"priority: integer expected";if(null!=o.targetBitrateKbps&&o.hasOwnProperty("targetBitrateKbps")&&!er.isInteger(o.targetBitrateKbps))return"targetBitrateKbps: integer expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.qualityAdaptationPreference&&o.hasOwnProperty("qualityAdaptationPreference"))switch(o.qualityAdaptationPreference){default:return"qualityAdaptationPreference: enum value expected";case 1:case 2:case 3:}return null},SdkVideoSubscriptionConfiguration.fromObject=function(o){if(o instanceof en.SdkVideoSubscriptionConfiguration)return o;var p=new en.SdkVideoSubscriptionConfiguration;switch(null!=o.mid&&(p.mid=String(o.mid)),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.priority&&(p.priority=o.priority>>>0),null!=o.targetBitrateKbps&&(p.targetBitrateKbps=o.targetBitrateKbps>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),o.qualityAdaptationPreference){default:"number"==typeof o.qualityAdaptationPreference&&(p.qualityAdaptationPreference=o.qualityAdaptationPreference);break;case"BALANCED":case 1:p.qualityAdaptationPreference=1;break;case"MAINTAIN_FRAMERATE":case 2:p.qualityAdaptationPreference=2;break;case"MAINTAIN_RESOLUTION":case 3:p.qualityAdaptationPreference=3}return p},SdkVideoSubscriptionConfiguration.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.mid="",f.attendeeId="",f.streamId=0,f.priority=0,f.targetBitrateKbps=0,f.groupId=0,f.qualityAdaptationPreference=p.enums===String?"BALANCED":1),null!=o.mid&&o.hasOwnProperty("mid")&&(f.mid=o.mid),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.priority&&o.hasOwnProperty("priority")&&(f.priority=o.priority),null!=o.targetBitrateKbps&&o.hasOwnProperty("targetBitrateKbps")&&(f.targetBitrateKbps=o.targetBitrateKbps),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),null!=o.qualityAdaptationPreference&&o.hasOwnProperty("qualityAdaptationPreference")&&(f.qualityAdaptationPreference=p.enums===String?void 0===en.SdkVideoQualityAdaptationPreference[o.qualityAdaptationPreference]?o.qualityAdaptationPreference:en.SdkVideoQualityAdaptationPreference[o.qualityAdaptationPreference]:o.qualityAdaptationPreference),f},SdkVideoSubscriptionConfiguration.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkVideoSubscriptionConfiguration.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkVideoSubscriptionConfiguration"},SdkVideoSubscriptionConfiguration}(),en.SdkNotificationFrame=function(){var o,p;function SdkNotificationFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkNotificationFrame.prototype.level=3,SdkNotificationFrame.prototype.message="",SdkNotificationFrame.create=function(o){return new SdkNotificationFrame(o)},SdkNotificationFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.level&&Object.hasOwnProperty.call(o,"level")&&p.uint32(8).int32(o.level),null!=o.message&&Object.hasOwnProperty.call(o,"message")&&p.uint32(18).string(o.message),p},SdkNotificationFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkNotificationFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkNotificationFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.level=o.int32();break;case 2:m.message=o.string();break;default:o.skipType(7&_)}}return m},SdkNotificationFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkNotificationFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.level&&o.hasOwnProperty("level"))switch(o.level){default:return"level: enum value expected";case 1:case 2:case 3:}return null!=o.message&&o.hasOwnProperty("message")&&!er.isString(o.message)?"message: string expected":null},SdkNotificationFrame.fromObject=function(o){if(o instanceof en.SdkNotificationFrame)return o;var p=new en.SdkNotificationFrame;switch(o.level){case"INFO":case 1:p.level=1;break;case"WARNING":case 2:p.level=2;break;default:"number"==typeof o.level&&(p.level=o.level);break;case"ERROR":case 3:p.level=3}return null!=o.message&&(p.message=String(o.message)),p},SdkNotificationFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.level=p.enums===String?"ERROR":3,f.message=""),null!=o.level&&o.hasOwnProperty("level")&&(f.level=p.enums===String?void 0===en.SdkNotificationFrame.NotificationLevel[o.level]?o.level:en.SdkNotificationFrame.NotificationLevel[o.level]:o.level),null!=o.message&&o.hasOwnProperty("message")&&(f.message=o.message),f},SdkNotificationFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkNotificationFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkNotificationFrame"},(p=Object.create(o={}))[o[1]="INFO"]=1,p[o[2]="WARNING"]=2,p[o[3]="ERROR"]=3,SdkNotificationFrame.NotificationLevel=p,SdkNotificationFrame}(),en.SdkPrimaryMeetingJoinFrame=function(){function SdkPrimaryMeetingJoinFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPrimaryMeetingJoinFrame.prototype.credentials=null,SdkPrimaryMeetingJoinFrame.create=function(o){return new SdkPrimaryMeetingJoinFrame(o)},SdkPrimaryMeetingJoinFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.credentials&&Object.hasOwnProperty.call(o,"credentials")&&en.SdkMeetingSessionCredentials.encode(o.credentials,p.uint32(10).fork()).ldelim(),p},SdkPrimaryMeetingJoinFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPrimaryMeetingJoinFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPrimaryMeetingJoinFrame;o.pos<f;){var _=o.uint32();_>>>3==1?m.credentials=en.SdkMeetingSessionCredentials.decode(o,o.uint32()):o.skipType(7&_)}return m},SdkPrimaryMeetingJoinFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingJoinFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.credentials&&o.hasOwnProperty("credentials")){var p=en.SdkMeetingSessionCredentials.verify(o.credentials);if(p)return"credentials."+p}return null},SdkPrimaryMeetingJoinFrame.fromObject=function(o){if(o instanceof en.SdkPrimaryMeetingJoinFrame)return o;var p=new en.SdkPrimaryMeetingJoinFrame;if(null!=o.credentials){if("object"!=typeof o.credentials)throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");p.credentials=en.SdkMeetingSessionCredentials.fromObject(o.credentials)}return p},SdkPrimaryMeetingJoinFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.credentials=null),null!=o.credentials&&o.hasOwnProperty("credentials")&&(f.credentials=en.SdkMeetingSessionCredentials.toObject(o.credentials,p)),f},SdkPrimaryMeetingJoinFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingJoinFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingJoinFrame"},SdkPrimaryMeetingJoinFrame}(),en.SdkPrimaryMeetingJoinAckFrame=function(){function SdkPrimaryMeetingJoinAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPrimaryMeetingJoinAckFrame.create=function(o){return new SdkPrimaryMeetingJoinAckFrame(o)},SdkPrimaryMeetingJoinAckFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkPrimaryMeetingJoinAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPrimaryMeetingJoinAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPrimaryMeetingJoinAckFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkPrimaryMeetingJoinAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingJoinAckFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkPrimaryMeetingJoinAckFrame.fromObject=function(o){return o instanceof en.SdkPrimaryMeetingJoinAckFrame?o:new en.SdkPrimaryMeetingJoinAckFrame},SdkPrimaryMeetingJoinAckFrame.toObject=function(){return{}},SdkPrimaryMeetingJoinAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingJoinAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingJoinAckFrame"},SdkPrimaryMeetingJoinAckFrame}(),en.SdkPrimaryMeetingLeaveFrame=function(){function SdkPrimaryMeetingLeaveFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPrimaryMeetingLeaveFrame.create=function(o){return new SdkPrimaryMeetingLeaveFrame(o)},SdkPrimaryMeetingLeaveFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkPrimaryMeetingLeaveFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPrimaryMeetingLeaveFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPrimaryMeetingLeaveFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkPrimaryMeetingLeaveFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingLeaveFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkPrimaryMeetingLeaveFrame.fromObject=function(o){return o instanceof en.SdkPrimaryMeetingLeaveFrame?o:new en.SdkPrimaryMeetingLeaveFrame},SdkPrimaryMeetingLeaveFrame.toObject=function(){return{}},SdkPrimaryMeetingLeaveFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingLeaveFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingLeaveFrame"},SdkPrimaryMeetingLeaveFrame}(),en.SdkMeetingSessionCredentials=function(){function SdkMeetingSessionCredentials(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkMeetingSessionCredentials.prototype.attendeeId="",SdkMeetingSessionCredentials.prototype.externalUserId="",SdkMeetingSessionCredentials.prototype.joinToken="",SdkMeetingSessionCredentials.create=function(o){return new SdkMeetingSessionCredentials(o)},SdkMeetingSessionCredentials.encode=function(o,p){return p||(p=ei.create()),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(10).string(o.attendeeId),null!=o.externalUserId&&Object.hasOwnProperty.call(o,"externalUserId")&&p.uint32(18).string(o.externalUserId),null!=o.joinToken&&Object.hasOwnProperty.call(o,"joinToken")&&p.uint32(26).string(o.joinToken),p},SdkMeetingSessionCredentials.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkMeetingSessionCredentials.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkMeetingSessionCredentials;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.attendeeId=o.string();break;case 2:m.externalUserId=o.string();break;case 3:m.joinToken=o.string();break;default:o.skipType(7&_)}}return m},SdkMeetingSessionCredentials.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkMeetingSessionCredentials.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId)?"attendeeId: string expected":null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.joinToken&&o.hasOwnProperty("joinToken")&&!er.isString(o.joinToken)?"joinToken: string expected":null},SdkMeetingSessionCredentials.fromObject=function(o){if(o instanceof en.SdkMeetingSessionCredentials)return o;var p=new en.SdkMeetingSessionCredentials;return null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.joinToken&&(p.joinToken=String(o.joinToken)),p},SdkMeetingSessionCredentials.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.attendeeId="",f.externalUserId="",f.joinToken=""),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.joinToken&&o.hasOwnProperty("joinToken")&&(f.joinToken=o.joinToken),f},SdkMeetingSessionCredentials.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkMeetingSessionCredentials.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkMeetingSessionCredentials"},SdkMeetingSessionCredentials}(),(Z=Object.create(q={}))[q[1]="VP8"]=1,Z[q[2]="H264_BASELINE_PROFILE"]=2,Z[q[3]="H264_CONSTRAINED_BASELINE_PROFILE"]=3,Z[q[4]="H264_MAIN_PROFILE"]=4,Z[q[5]="H264_HIGH_PROFILE"]=5,Z[q[6]="H264_CONSTRAINED_HIGH_PROFILE"]=6,Z[q[8]="VP9_PROFILE_0"]=8,Z[q[11]="AV1_MAIN_PROFILE"]=11,en.SdkVideoCodecCapability=Z,o.exports=en,er.Long=void 0,ee.configure()},0x189468218:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x2869cb2b),I=f(0x249059e84),k=_(f(0x22a0f7c69));p.default=class{constructor(o){this.chimeClient=o}makeTwoDigits(o){return o>9?o.toString():"0"+o.toString()}hmac(o,p){let f=new w.Sha256(p);return f.update(o),f.digest()}getDateTimeString(){let o=new Date;return o.getUTCFullYear()+this.makeTwoDigits(o.getUTCMonth()+1)+this.makeTwoDigits(o.getUTCDate())+"T"+this.makeTwoDigits(o.getUTCHours())+this.makeTwoDigits(o.getUTCMinutes())+this.makeTwoDigits(o.getUTCSeconds())+"Z"}getDateString(o){return o.substring(0,o.indexOf("T"))}getSignatureKey(o,p,f,_){return m(this,void 0,void 0,function*(){let m=yield this.hmac(p,"AWS4"+o),w=yield this.hmac(f,m),I=yield this.hmac(_,w);return yield this.hmac("aws4_request",I)})}signURL(o,p,f,_,w,M,x){return m(this,void 0,void 0,function*(){let m,O=this.getDateTimeString(),L=this.getDateString(O),B="";B=this.chimeClient.config.region instanceof Function?yield this.chimeClient.config.region():this.chimeClient.config.region;let U="host:"+_.toLowerCase()+`
`,$=L+"/"+B+"/"+f+"/aws4_request";m=this.chimeClient.config.credentials instanceof Function?yield this.chimeClient.config.credentials():this.chimeClient.config.credentials;let q=new Map;q.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),q.set("X-Amz-Credential",[encodeURIComponent(m.accessKeyId+"/"+$)]),q.set("X-Amz-Date",[O]),q.set("X-Amz-Expires",["10"]),q.set("X-Amz-SignedHeaders",["host"]),m.sessionToken&&q.set("X-Amz-Security-Token",[encodeURIComponent(m.sessionToken)]),q.set(k.default.X_AMZN_VERSION,[encodeURIComponent(k.default.sdkVersion)]),q.set(k.default.X_AMZN_USER_AGENT,[encodeURIComponent(k.default.sdkUserAgentLowResolution)]),null==x||x.forEach((o,p)=>{let f=encodeURIComponent(p);o.sort().forEach(o=>{q.has(f)||q.set(f,[]),q.get(f).push(encodeURIComponent(o))})});let Z="";(q=new Map([...q.entries()].sort())).forEach((o,p)=>{o.forEach(o=>{Z.length&&(Z+="&"),Z+=p+"="+o})});let ee=o+`
`+w+`
`+Z+`
`+U+`
`+"host"+`
`+I.toHex((yield this.hmac(M))),et=`AWS4-HMAC-SHA256
`+O+`
`+L+"/"+B+"/"+f+`/aws4_request
`+I.toHex((yield this.hmac(ee))),ei=yield this.getSignatureKey(m.secretAccessKey,L,B,f),er=I.toHex((yield this.hmac(et,ei)));return p+"://"+_+w+"?"+(Z+"&X-Amz-Signature=")+er})}}},0x8f26277b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SimulcastLayers=void 0,(m=f=p.SimulcastLayers||(p.SimulcastLayers={}))[m.Low=0]="Low",m[m.LowAndMedium=1]="LowAndMedium",m[m.LowAndHigh=2]="LowAndHigh",m[m.Medium=3]="Medium",m[m.MediumAndHigh=4]="MediumAndHigh",m[m.High=5]="High",p.default=f},0x1e4aafe7d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.AudioLogEvent=void 0,(m=f=p.AudioLogEvent||(p.AudioLogEvent={}))[m.DeviceChanged=0]="DeviceChanged",m[m.MutedLocal=1]="MutedLocal",m[m.UnmutedLocal=2]="UnmutedLocal",m[m.Connected=3]="Connected",m[m.ConnectFailed=4]="ConnectFailed",m[m.RedmicStartLoss=5]="RedmicStartLoss",m[m.RedmicEndLoss=6]="RedmicEndLoss",p.default=f},0x69c93909:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x176b792fb)),I=_(f(0x243b8874c)),k=_(f(0xebe235e1)),M=_(f(0x15a1c7c16)),x=_(f(0x49c5e00)),O=_(f(0x15d56a943)),L=_(f(0xc7dc71d8)),B=_(f(0xd475f02c)),U=f(0x252035ee7),$=f(0xab1ef933),q=_(f(0x1e4aafe7d)),Z=_(f(0x15a7c8b4)),ee=class StatsCollector{constructor(o,p,f=StatsCollector.INTERVAL_MS){this.audioVideoController=o,this.logger=p,this.interval=f,this.intervalScheduler=null,this.redRecoveryMetricReport=new M.default,this.lastRedRecoveryMetricReportConsumedTimestampMs=0,this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0,this.resolutionMap=new Map,this.metricsAddTime=(o,p,f)=>{},this.metricsLogEvent=(o,p)=>{}}toAttribute(o){return this.toSuffix(o).substring(1)}toSuffix(o){return o.toLowerCase()===o?`_${o}`:o.toUpperCase()===o?`_${o.toLowerCase()}`:o.replace(/([A-Z][a-z]+)/g,function(o){return`_${o}`}).replace(/([A-Z][A-Z]+)/g,function(o){return`_${o}`}).toLowerCase()}logLatency(o,p,f){let m=this.toSuffix(o);this.logEventTime("meeting"+m,p,f)}logStateTimeout(o,p){let f=this.toSuffix(o);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},p),{state:`state${f}`}))}logAudioEvent(o,p){let f="audio"+this.toSuffix(q.default[o]);this.logEvent(f,p)}logVideoEvent(o,p){let f="video"+this.toSuffix(Z.default[o]);this.logEvent(f,p)}logEventTime(o,p,f={}){let m=Object.assign(Object.assign({},f),{call_id:this.audioVideoController.configuration.meetingId,client_type:StatsCollector.CLIENT_TYPE,metric_type:"latency"});this.logger.debug(()=>`[StatsCollector] ${o}: ${JSON.stringify(m)}`),this.metricsAddTime(o,p,m)}logMeetingSessionStatus(o){let p=`${o.statusCode()}`;this.logEvent(p);let f={status:p,status_code:`${o.statusCode()}`};this.logEvent("meeting_session_status",f),o.isTerminal()&&this.logEvent("meeting_session_stopped",f),o.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",f),o.isFailure()&&this.logEvent("meeting_session_failed",f)}logLifecycleEvent(o,p){let f={lifecycle_event:`lifecycle${this.toSuffix(O.default[o])}`,lifecycle_event_code:`${o}`,lifecycle_event_condition:`condition${this.toSuffix(L.default[p])}`,lifecycle_event_condition_code:`${p}`};this.logEvent("meeting_session_lifecycle",f)}logEvent(o,p={}){let f=Object.assign(Object.assign({},p),{call_id:this.audioVideoController.configuration.meetingId,client_type:StatsCollector.CLIENT_TYPE});this.logger.debug(()=>`[StatsCollector] ${o}: ${JSON.stringify(f)}`),this.metricsLogEvent(o,f)}start(o,p){return!this.intervalScheduler&&(this.logger.info("Starting StatsCollector"),this.signalingClient=o,this.videoStreamIndex=p,this.clientMetricReport=new w.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new B.default(this.interval),this.intervalScheduler.start(()=>m(this,void 0,void 0,function*(){yield this.getStatsWrapper()})),!0)}stop(){this.logger.info("Stopping StatsCollector"),this.intervalScheduler&&this.intervalScheduler.stop(),this.intervalScheduler=null}videoTileResolutionDidChange(o,p,f){this.resolutionMap.set(o,{width:p,height:f})}videoTileUnbound(o){this.resolutionMap.delete(o)}updateMetricValues(o,p){let f,m=p?this.clientMetricReport.streamMetricReports[Number(o.ssrc)]:this.clientMetricReport.globalMetricReport;if(p){let p=m.mediaType,_=m.direction;f=this.clientMetricReport.getMetricMap(p,_),p===k.default.VIDEO&&_===I.default.DOWNSTREAM&&this.addRenderResolutionToVideoDownstreamMetrics(m,o.ssrc)}else f=this.clientMetricReport.getMetricMap();for(let p in o)p in f&&("number"==typeof o[p]?(m.previousMetrics[p]=m.currentMetrics[p],m.currentMetrics[p]=o[p]):"string"==typeof o[p]?m.currentStringMetrics[p]=o[p]:"object"==typeof o[p]?(m.previousObjectMetrics[p]=void 0===m.currentObjectMetrics[p]?o[p]:m.currentObjectMetrics[p],m.currentObjectMetrics[p]=o[p]):this.logger.error(`Unknown metric value type ${typeof o[p]} for metric ${p}`))}processRawMetricReports(o){this.clientMetricReport.currentSsrcs={};let p=Date.now();for(let p of o){if(this.isVideoSourceMetricReport(p))continue;let o=this.isStreamRawMetricReport(p);if(o){let o=this.clientMetricReport.streamMetricReports[Number(p.ssrc)];if(o)o.mediaType===k.default.VIDEO&&o.direction===I.default.UPSTREAM?o.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(p.rid):o.streamId=this.videoStreamIndex.streamIdForSSRC(Number(p.ssrc));else{let o=new x.default;o.mediaType=this.getMediaType(p),o.direction=this.getDirectionType(p),o.mediaType===k.default.VIDEO&&o.direction===I.default.UPSTREAM?o.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(p.rid):this.videoStreamIndex.allStreams().empty()||(o.streamId=this.videoStreamIndex.streamIdForSSRC(Number(p.ssrc)),void 0!==this.videoStreamIndex.groupIdForSSRC&&(o.groupId=this.videoStreamIndex.groupIdForSSRC(Number(p.ssrc)))),this.clientMetricReport.streamMetricReports[Number(p.ssrc)]=o}this.clientMetricReport.currentSsrcs[Number(p.ssrc)]=1}this.updateMetricValues(p,o)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=p,this.clientMetricReport.print()}addStreamMetricDimensionFrames(o,p){let f=this.clientMetricReport.getStreamDimensionMap();for(let m in p.currentStringMetrics)if(m in f){let _=U.SdkStreamDimension.create();_.type=f[m];let w=U.SdkDimensionValue.create();w.stringValue=p.currentStringMetrics[m],_.value=w,o.dimensions.push(_)}}addMetricFrame(o,p,f,m){let _=f.type,w=f.transform,I=f.source,k=p.streamMetricFrames.length,M=p.streamMetricFrames[k-1];if(_){let f=U.SdkMetric.create();f.type=_,f.value=w(I||o,m),m?M.metrics.push(f):p.globalMetrics.push(f)}}addGlobalMetricsToProtobuf(o){let p=this.clientMetricReport.getMetricMap();for(let f in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(f,o,p[f])}addStreamMetricsToProtobuf(o){for(let p in this.clientMetricReport.streamMetricReports){let f=this.clientMetricReport.streamMetricReports[p],m=U.SdkStreamMetricFrame.create();m.streamId=f.streamId,m.mediaType=f.mediaType===k.default.AUDIO?U.SdkStreamMediaType.AUDIO:U.SdkStreamMediaType.VIDEO,m.metrics=[],this.addStreamMetricDimensionFrames(m,f),o.streamMetricFrames.push(m);let _=this.clientMetricReport.getMetricMap(f.mediaType,f.direction);for(let m in _)this.hasMetricDependenciesInReport(m,f)&&this.addMetricFrame(m,o,_[m],Number(p))}}hasMetricDependenciesInReport(o,p){return"decoderLoss"===o&&void 0!==p.currentMetrics.concealedSamples&&void 0!==p.currentMetrics.totalSamplesReceived||"jitterBufferMs"===o&&void 0!==p.currentMetrics.jitterBufferDelay&&void 0!==p.currentMetrics.jitterBufferEmittedCount||o in p.currentMetrics||o in p.currentStringMetrics||o in p.currentObjectMetrics}makeClientMetricProtobuf(){let o=U.SdkClientMetricFrame.create();return o.globalMetrics=[],o.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(o),this.addStreamMetricsToProtobuf(o),o}sendClientMetricProtobuf(o){this.signalingClient.sendClientMetrics(o)}isStreamRawMetricReport(o){return["inbound-rtp","inbound-rtp-red","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(o.type)||this.isVideoSourceMetricReport(o)}getMediaType(o){return"audio"===o.kind?k.default.AUDIO:k.default.VIDEO}getDirectionType(o){let{type:p}=o;return"inbound-rtp"===p||"remote-outbound-rtp"===p||"inbound-rtp-red"===p?I.default.DOWNSTREAM:I.default.UPSTREAM}isValidStandardRawMetric(o){return"inbound-rtp"===o.type||"inbound-rtp-red"===o.type||"outbound-rtp"===o.type||"remote-inbound-rtp"===o.type||"remote-outbound-rtp"===o.type||"candidate-pair"===o.type&&"succeeded"===o.state||"media-source"===o.type}isValidSsrc(o){let p=!0;return this.isStreamRawMetricReport(o)&&this.getDirectionType(o)===I.default.DOWNSTREAM&&this.getMediaType(o)===k.default.VIDEO&&(p=this.videoStreamIndex.streamIdForSSRC(Number(o.ssrc))>0),p}isValidRawMetricReport(o){return this.isValidStandardRawMetric(o)&&this.isValidSsrc(o)}filterRawMetricReports(o){let p=[];for(let f of o)this.isValidRawMetricReport(f)&&p.push(f);return p}handleRawMetricReports(o){let p=this.filterRawMetricReports(o);this.logger.debug(()=>`Filtered raw metrics : ${JSON.stringify(p)}`);let f=[];this.maybeAddRedRecoveryMetrics(f);let m=this.getVideoUpstreamSsrcFromRawMetricReports(p);null!==m&&this.addVideoCodecDegradationMetrics(f,m),this.clientMetricReport.customStatsReports=f,p.push(...f),this.processRawMetricReports(p),this.updateVideoSourceMetrics(p);let _=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(_),this.audioVideoController.forEachObserver(o=>{$.Maybe.of(o.metricsDidReceive).map(p=>p.bind(o)(this.clientMetricReport.clone()))})}getStatsWrapper(){return m(this,void 0,void 0,function*(){if(!this.audioVideoController.rtcPeerConnection)return;let o=[];try{let p=yield this.audioVideoController.rtcPeerConnection.getStats();this.clientMetricReport.rtcStatsReport=p,p.forEach(p=>{o.push(p)}),this.handleRawMetricReports(o)}catch(o){this.logger.error(o.message)}})}overrideObservableMetric(o,p){this.clientMetricReport.overrideObservableMetric(o,p)}recoveryMetricsDidReceive(o){this.redRecoveryMetricReport=o}maybeAddRedRecoveryMetrics(o){this.redRecoveryMetricReport.currentTimestampMs!==this.lastRedRecoveryMetricReportConsumedTimestampMs&&(o.push({kind:"audio",type:"inbound-rtp-red",ssrc:this.redRecoveryMetricReport.ssrc,timestamp:this.redRecoveryMetricReport.currentTimestampMs,totalAudioPacketsLost:this.redRecoveryMetricReport.totalAudioPacketsLost,totalAudioPacketsExpected:this.redRecoveryMetricReport.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.redRecoveryMetricReport.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.redRecoveryMetricReport.totalAudioPacketsRecoveredFec}),this.lastRedRecoveryMetricReportConsumedTimestampMs=this.redRecoveryMetricReport.currentTimestampMs)}videoCodecDegradationHighEncodeCpuDidReceive(){this.videoCodecDegradationHighEncodeCpuCount+=1}videoCodecDegradationEncodeFailureDidReceive(){this.videoCodecDegradationEncodeFailureCount+=1}videoCodecDegradationConcurrentSendersDidReceive(){this.videoCodecDegradationConcurrentSendersCount+=1}addVideoCodecDegradationMetrics(o,p){o.push({kind:"video",type:"outbound-rtp",ssrc:p,timestamp:Date.now(),videoCodecDegradationHighEncodeCpu:this.videoCodecDegradationHighEncodeCpuCount,videoCodecDegradationEncodeFailure:this.videoCodecDegradationEncodeFailureCount,videoCodecDegradationConcurrentSenders:this.videoCodecDegradationConcurrentSendersCount}),this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0}getVideoUpstreamSsrcFromRawMetricReports(o){for(let p of o)if(this.isStreamRawMetricReport(p)&&this.getMediaType(p)===k.default.VIDEO&&this.getDirectionType(p)===I.default.UPSTREAM)return p.ssrc;return null}isVideoSourceMetricReport(o){return"media-source"===o.type&&"video"===o.kind}addRenderResolutionToVideoDownstreamMetrics(o,p){let f=this.videoStreamIndex.streamIdForSSRC(Number(p)),m=this.videoStreamIndex.attendeeIdForStreamId(f);void 0===f||""===m?this.logger.warn(`No attendee found for ssrc ${p}`):this.resolutionMap.has(m)&&(o.currentMetrics.videoRenderWidth=this.resolutionMap.get(m).width,o.currentMetrics.videoRenderHeight=this.resolutionMap.get(m).height)}updateVideoSourceMetrics(o){for(let p of o)if(this.isVideoSourceMetricReport(p)){let o=this.clientMetricReport.getVideoUpstreamSsrcs();if(0===o.length)return void this.logger.warn("No video upstream ssrcs found");for(let f of o)this.clientMetricReport.streamMetricReports[f].currentMetrics.videoInputWidth=p.width,this.clientMetricReport.streamMetricReports[f].currentMetrics.videoInputHeight=p.height}}};p.default=ee,ee.INTERVAL_MS=1e3,ee.CLIENT_TYPE="amazon-chime-sdk-js"},0x15a7c8b4:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoLogEvent=void 0,(m=f=p.VideoLogEvent||(p.VideoLogEvent={}))[m.InputAttached=0]="InputAttached",m[m.SendingFailed=1]="SendingFailed",m[m.SendingSuccess=2]="SendingSuccess",p.default=f},0x1c7d226ae:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x15a7c8b4)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="AttachMediaInputTask"}run(){return m(this,void 0,void 0,function*(){let o=this.context.transceiverController;o.setPeer(this.context.peer),o.setupLocalTransceivers();let p=this.context.activeAudioInput;if(p){let f=p.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield o.setAudioInput(f.length?f[0]:null)}else yield o.setAudioInput(null),this.context.logger.info("no audio track");this.setAudioCodecPreferences();let f=this.context.activeVideoInput;if(f){let p=f.getVideoTracks(),m=p.length?p[0]:null;if(this.context.logger.info("attaching video track to peer connection"),yield o.setVideoInput(m),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){let p=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();o.setEncodingParameters(p)}m&&this.context.statsCollector.logVideoEvent(w.default.InputAttached,this.context.videoDeviceInformation)}else yield o.setVideoInput(null),this.context.logger.info("no video track");this.context.videoSubscriptions=o.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive),this.context.videoStreamIndex.subscribeFrameSent()})}setAudioCodecPreferences(){let o=window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype,p=this.context.audioProfile.hasRedundancyEnabled();if(!o)return void this.context.logger.warn("Setting codec preferences not supported");let f=this.context.transceiverController.localAudioTransceiver(),{codecs:m}=RTCRtpSender.getCapabilities("audio");this.context.logger.debug(`Available audio codecs ${JSON.stringify(m,null,4)}`);let _=m.findIndex(o=>"audio/red"===o.mimeType);if(!f)return void this.context.logger.error("audio transceiver is null");if(_>=0){let o=m[_];m.splice(_,1),p?(m.unshift(o),this.context.logger.info("audio/red set as preferred codec")):this.context.logger.info("audio/red removed from preferred codec"),f.setCodecPreferences(m);return}this.context.logger.info("audio/red codec not supported")}}},0x113227692:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x158630dfe)),I=_(f(0xe2814d21));p.default=class{constructor(o){this.logger=o,this.taskName="BaseTask",this.parentTask=null,this.status=I.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...o){return new w.default(this.logger,this,o)}cancel(){}name(){return this.parentTask?`${this.parentTask.name()}/${this.taskName}`:this.taskName}setParent(o){this.parentTask=o}getStatus(){return this.status}logAndThrow(o){throw this.logger.info(o),Error(o)}baseRun(o){return m(this,void 0,void 0,function*(){try{let p=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case I.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case I.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case I.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=I.default.RUNNING,yield o.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-p)} ms`)}catch(o){throw o}finally{this.status!==I.default.CANCELED&&(this.status=I.default.FINISHED)}})}baseCancel(o){this.status===I.default.CANCELED||this.status===I.default.FINISHED?this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`):(this.logger.info(`canceling task ${this.name()}`),this.status=I.default.CANCELED,o.call(this))}}},0x435994a8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692));p.default=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="CleanRestartedSessionTask"}run(){return m(this,void 0,void 0,function*(){this.context.resetConnectionSpecificState()})}}},0xbf52f99d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(o){throw o}finally{for(let o of this.context.removableObservers)o.removeObserver();this.context.resetConnectionSpecificState(),this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.videoUplinkBandwidthPolicy.setTransceiverController&&this.context.videoUplinkBandwidthPolicy.setTransceiverController(void 0),this.context.videoDownlinkBandwidthPolicy.bindToTileController&&this.context.videoDownlinkBandwidthPolicy.bindToTileController(void 0);let o=this.context.videoTileController.getLocalVideoTile();o&&o.bindVideoStream("",!0,null,null,null,null),this.context.videoTileController.removeAllVideoTiles()}})}receiveWebSocketClosedEvent(){return new Promise((o,p)=>{let f=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("CleanStoppedSessionTask got canceled while waiting for the WebSocket closed event"))}handleSignalingClientEvent(p){p.type===w.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),o())}}(this.context.signalingClient);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x73c142bf:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692)),I=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="CreatePeerConnectionTask",this.removeTrackAddedEventListener=null,this.removeTrackRemovedEventListeners={},this.trackEvents=["ended","mute","unmute","isolationchange","overconstrained"],this.removeVideoTrackEventListeners={},this.trackAddedHandler=o=>{let p=o.track;if(this.context.logger.info(`received track event: kind=${p.kind} id=${p.id} label=${p.label}`),o.transceiver&&"inactive"===o.transceiver.currentDirection)return;if(0===o.streams.length)return void this.context.logger.warn("Track event but no stream");let f=o.streams[0];"audio"===p.kind?this.context.audioMixController.bindAudioStream(f):"video"!==p.kind||this.trackIsVideoInput(p)||this.addRemoteVideoTrack(p,f)}}removeObserver(){for(let o in this.removeTrackAddedEventListener&&this.removeTrackAddedEventListener(),this.removeTrackRemovedEventListeners)this.removeTrackRemovedEventListeners[o]()}addPeerConnectionEventLogger(){let o=this.context.peer;o.addEventListener("connectionstatechange",()=>{this.context.logger.info(`peer connection state changed: ${o.connectionState}`)}),o.addEventListener("negotiationneeded",()=>{this.context.logger.info("peer connection negotiation is needed")}),o.addEventListener("icegatheringstatechange",()=>{this.context.logger.info(`peer connection ice gathering state changed: ${o.iceGatheringState}`)}),o.addEventListener("icecandidate",o=>{this.context.logger.info(`peer connection ice candidate: ${o.candidate?o.candidate.candidate:"(null)"}`)}),o.addEventListener("iceconnectionstatechange",()=>{this.context.logger.info(`peer connection ice connection state changed: ${o.iceConnectionState}`)})}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this);let o=this.context.turnCredentials&&this.context.turnCredentials.uris.length>0?{iceServers:[{urls:this.context.turnCredentials.uris,username:this.context.turnCredentials.username,credential:this.context.turnCredentials.password,credentialType:"password"}],iceTransportPolicy:"relay"}:{};o.bundlePolicy=this.context.browserBehavior.requiresBundlePolicy(),o.sdpSemantics="unified-plan",window.RTCRtpScriptTransform||(o.encodedInsertableStreams=this.context.audioProfile.hasRedundancyEnabled()),this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(o),this.addPeerConnectionEventLogger()),this.removeTrackAddedEventListener=()=>{this.context.peer&&this.context.peer.removeEventListener("track",this.trackAddedHandler),this.removeTrackAddedEventListener=null},this.context.peer.addEventListener("track",this.trackAddedHandler)})}trackIsVideoInput(o){return!!this.context.transceiverController.useTransceivers()&&(this.logger.debug(()=>"getting video track type"),this.context.transceiverController.trackIsVideoInput(o))}addRemoteVideoTrack(o,p){var f;let m,_,w,I=p.id,k=this.context.videoStreamIndex.attendeeIdForTrack(I);if(this.context.videoTileController.getVideoTileForAttendeeId?!!(null==(f=null==(m=this.context.videoTileController.getVideoTileForAttendeeId(k))?void 0:m.state())?void 0:f.boundVideoStream):this.context.videoTileController.haveVideoTileForAttendeeId(k))return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId:  ${k}`);m||(m=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${m.id()}`));let M=this.context.videoStreamIndex.streamIdForTrack(I);void 0===M&&(this.logger.warn(`stream not found for tile=${m.id()} track=${I}`),M=null);let x=this.context.videoStreamIndex.groupIdForStreamId(M);void 0===x&&(x=null);for(let f=0;f<this.trackEvents.length;f++){let _=this.trackEvents[f],w=p.getVideoTracks();if(w&&w.length){let p=w[0],callback=()=>{this.context.logger.info(`received the ${_} event for tile=${m.id()} id=${o.id} streamId=${M}`),"ended"===_&&this.removeRemoteVideoTrack(o,m.state())};p.addEventListener(_,callback),this.removeVideoTrackEventListeners[o.id]||(this.removeVideoTrackEventListeners[o.id]=[]),this.removeVideoTrackEventListeners[o.id].push(()=>{p.removeEventListener(_,callback)})}}if(o.getSettings){let p=o.getSettings();_=p.width,w=p.height}else{let p=o.getCapabilities();_=p.width,w=p.height}let O=this.context.videoStreamIndex.externalUserIdForTrack(I);m.bindVideoStream(k,!1,p,_,w,M,O,x),this.logger.info(`video track added, use tile=${m.id()} track=${I} streamId=${M} groupId=${x}`);let L="removetrack",trackRemovedHandler=()=>this.removeRemoteVideoTrack(o,m.state());this.removeTrackRemovedEventListeners[o.id]=()=>{p.removeEventListener(L,trackRemovedHandler),delete this.removeTrackRemovedEventListeners[o.id]},p.addEventListener(L,trackRemovedHandler)}removeRemoteVideoTrack(o,p){if(this.removeTrackRemovedEventListeners.hasOwnProperty(o.id)){for(let p of(this.removeTrackRemovedEventListeners[o.id](),this.removeVideoTrackEventListeners[o.id]))p();delete this.removeVideoTrackEventListeners[o.id]}this.logger.info(`video track ended, removing tile=${p.tileId} id=${o.id} stream=${p.streamId}`),p.streamId?this.context.videosPaused.remove(p.streamId):this.logger.warn(`no stream found for tile=${p.tileId}`),this.context.videoTileController.removeVideoTile(p.tileId)}};p.default=I,I.REMOVE_HANDLER_INTERVAL_MS=1e4},0x44174156:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11a9e868)),I=_(f(0x1a20e50ff)),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="CreateSDPTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()}`);this.cancelPromise(o),delete this.cancelPromise}}sessionUsesAudio(){var o,p;return!!(null==(p=null==(o=this.context.meetingSessionConfiguration)?void 0:o.urls)?void 0:p.audioHostURL)}sessionUsesVideo(){let o;o=this.context.transceiverController.useTransceivers()?this.context.transceiverController.hasVideoInput():this.context.videoTileController.hasStartedLocalVideoTile();let p=!!this.context.videosToReceive&&!this.context.videosToReceive.empty(),f=o||p;return this.context.logger.info(`uses video: ${f} (enabled: true, sending: ${o}, receiving: ${p})`),f}run(){return m(this,void 0,void 0,function*(){let o={offerToReceiveAudio:this.sessionUsesAudio(),offerToReceiveVideo:this.sessionUsesVideo()};this.logger.info(`peer connection offerOptions: ${JSON.stringify(o)}`),yield new Promise((p,f)=>m(this,void 0,void 0,function*(){this.cancelPromise=o=>{f(o)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(o),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new I.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){let o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.IncompatibleSDP}`);this.context.previousSdpOffer=null,f(o);return}p()}catch(o){f(o)}finally{delete this.cancelPromise}}))})}}},0xa567a7ba:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11a9e868)),I=_(f(0x1a20e50ff)),k=_(f(0x113227692)),M=class FinishGatheringICECandidatesTask extends k.default{constructor(o,p=FinishGatheringICECandidatesTask.CHROME_VPN_TIMEOUT_MS){super(o.logger),this.context=o,this.chromeVpnTimeoutMs=p,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let o;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMs<this.context.meetingSessionConfiguration.connectionTimeoutMs&&Date.now()-this.startTimestampMs>this.chromeVpnTimeoutMs&&(o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(o=o||Error(`canceling ${this.name()}`),this.cancelPromise(o),delete this.cancelPromise)}run(){return m(this,void 0,void 0,function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new I.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if((this.context.browserBehavior.hasFirefoxWebRTC()||"complete"===this.context.peer.iceGatheringState)&&new I.default(this.context.peer.localDescription.sdp).hasCandidates())return void this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering");try{yield new Promise((o,p)=>{this.cancelPromise=o=>{this.removeEventListener(),p(o)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState){this.removeEventListener(),o(),delete this.cancelPromise;return}},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=f=>{if(this.context.logger.info(`ice candidate: ${f.candidate?f.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),f.candidate&&(I.default.isRTPCandidate(f.candidate.candidate)&&this.context.iceCandidates.push(f.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1)){this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),o(),delete this.cancelPromise;return}"complete"===this.context.peer.iceGatheringState&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),new I.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?o():p(Error("no ice candidates were gathered")),delete this.cancelPromise)},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()})}catch(o){throw o}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}})}};p.default=M,M.CHROME_VPN_TIMEOUT_MS=5e3},0x1b7bc4701:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0x194415c85)),x=k(f(0x11a9e868)),O=k(f(0x15054ca8e)),L=w(f(0xf8b13aac)),B=k(f(0x216f98b8d)),U=k(f(0x1b32ed0f)),$=f(0x252035ee7),q=k(f(0x113227692));function rewriteTurnUris(o,p){let{urlRewriterMulti:f,urlRewriter:m}=p;return o.flatMap(o=>{if(f)return f(o)||[];let p=m(o);return p?[p]:[]}).filter(o=>!!o)}p.default=class extends q.default{constructor(o){super(o.logger),this.context=o,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return I(this,void 0,void 0,function*(){let o=yield new Promise((o,p)=>{let f=this.context;f.turnCredentials=null;let m=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("JoinAndReceiveIndexTask got canceled while waiting for SdkIndexFrame"))}handleSignalingClientEvent(p){if(p.type===B.default.WebSocketClosed){let o=`The signaling connection was closed with code ${p.closeCode} and reason: ${p.closeReason}`;f.logger.warn(o);let m=x.default.SignalingBadRequest;4410===p.closeCode?(o="The meeting already ended.",f.logger.warn(o),m=x.default.MeetingEnded):p.closeCode>=4500&&p.closeCode<4600&&(m=x.default.SignalingInternalServerError),f.audioVideoController.handleMeetingSessionStatus(new M.default(m),Error(o));return}if(p.type===B.default.ReceivedSignalFrame){if(p.message.type===$.SdkSignalFrame.Type.JOIN_ACK){let o=p.message.joinack;if(!o)return void f.audioVideoController.handleMeetingSessionStatus(new M.default(x.default.SignalingRequestFailed),Error("Join ACK message did not include expected frame"));if(o.videoSubscriptionLimit&&(f.videoSubscriptionLimit=o.videoSubscriptionLimit),f.serverSupportsCompression=o.wantsCompressedSdp,void 0!==o.defaultServerSideNetworkAdaption&&o.defaultServerSideNetworkAdaption!==L.default.Default&&void 0!==f.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption){let p=o.defaultServerSideNetworkAdaption;f.logger.info(`Overriding server side network adaption value to ${p}`),f.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(L.convertServerSideNetworkAdaptionEnumFromSignaled(p))}return void(o&&o.turnCredentials?(f.turnCredentials=new O.default,f.turnCredentials.username=o.turnCredentials.username,f.turnCredentials.password=o.turnCredentials.password,f.turnCredentials.ttl=o.turnCredentials.ttl,f.turnCredentials.uris=rewriteTurnUris(o.turnCredentials.uris,f.meetingSessionConfiguration.urls)):f.logger.error("missing TURN credentials in JoinAckFrame"))}p.message.type!==$.SdkSignalFrame.Type.INDEX||(this.signalingClient.removeObserver(this),o(p.message.index))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(m),this.taskCanceler=m,this.context.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1;let _=new U.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(_.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),_.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),void 0!==this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex&&(_.wantsAllTemporalLayersInIndex=this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex()),_.disablePeriodicKeyframeRequestOnContentSender=this.context.meetingSessionConfiguration.disablePeriodicKeyframeRequestOnContentSender,this.context.signalingClient.join(_)});this.context.logger.info(`received first index ${JSON.stringify(o)}`),this.context.indexFrame=o})}}},0x10a1c2ebe:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="LeaveAndReceiveLeaveAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.ready()&&(this.context.signalingClient.leave(),this.context.logger.info("sent leave"),yield this.receiveLeaveAck())})}receiveLeaveAck(){return new Promise((o,p)=>{let f=new class{constructor(o,p){this.signalingClient=o,this.logger=p}cancel(){this.signalingClient.removeObserver(this),p(Error("LeaveAndReceiveLeaveAckTask got canceled while waiting for IndexFrame"))}handleSignalingClientEvent(p){if(p.isConnectionTerminated()){this.signalingClient.removeObserver(this),this.logger.info("LeaveAndReceiveLeaveAckTask connection terminated"),o();return}p.type===w.default.ReceivedSignalFrame&&p.message.type===I.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),o())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x8c94ea05:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=o=>{this.context.signalingClient.mute(o)}}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(o){if(o.type===w.default.ReceivedSignalFrame){if(o.message.type===I.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){let p=o.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(p)}else if(o.message.type===I.SdkSignalFrame.Type.AUDIO_METADATA){let p=o.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(p)}}}}},0x1f9f2eb05:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x243b8874c)),I=_(f(0xebe235e1)),k=_(f(0x61021f0c)),M=_(f(0x20ae9efa5)),x=_(f(0x1c6788b50)),O=_(f(0x17469a88e)),L=f(0x8fff55e5),B=_(f(0x194415c85)),U=_(f(0x11a9e868)),$=_(f(0x178bce6ff)),q=_(f(0x216f98b8d)),Z=f(0x252035ee7),ee=_(f(0x1e4aafe7d)),et=f(0xab1ef933),ei=_(f(0x113227692));p.default=class extends ei.default{constructor(o,p,f){for(const m of(super(o.logger),this.context=o,this.initialConnectionHealthData=f,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.isResubscribeCheckPaused=!1,this.pendingMetricsReport=void 0,this.videoEncodingHealthPolicies=[],this.checkAndSendWeakSignalEvent=o=>{let p=this.prevSignalStrength<1,f=o<1?p?null:ee.default.RedmicStartLoss:p?ee.default.RedmicEndLoss:null;f&&this.context.statsCollector.logAudioEvent(f),this.prevSignalStrength=o},this.realtimeFatalErrorCallback=o=>{this.logger.error(`realtime error: ${o}: ${o.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new B.default(U.default.RealtimeApiFailed),o)},this.realtimeAttendeeIdPresenceHandler=(o,p)=>{var f;let m=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${m}`),m===o&&p&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,null==(f=this.context.eventController)||f.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs,retryCount:this.context.retryCount}))},this.reconnectionHealthPolicy=new k.default(o.logger,Object.assign({},p),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new x.default(Object.assign({},p),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new M.default(o.logger,Object.assign({},p),this.initialConnectionHealthData.clone()),p.videoEncodingHealthPolicies))this.videoEncodingHealthPolicies.push(new m(Object.assign({},p),this.initialConnectionHealthData.clone()))}removeObserver(){this.context.audioVideoController.removeObserver(this),this.context.realtimeController.realtimeUnsubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.audioVideoController.addObserver(this),this.context.realtimeController.realtimeSubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.connectionMonitor.start(),this.context.statsCollector.start(this.context.signalingClient,this.context.videoStreamIndex),this.context.signalingClient.registerObserver(this)})}pauseResubscribeCheck(){this.isResubscribeCheckPaused=!0}resumeResubscribeCheck(){this.isResubscribeCheckPaused&&(this.isResubscribeCheckPaused=!1,this.pendingMetricsReport&&(this.context.logger.info("Resuming resubscribe check with pending metrics report"),this.checkResubscribe(this.pendingMetricsReport)&&this.context.audioVideoController.update({needsRenegotiation:!1})))}videoTileDidUpdate(o){this.context.maxVideoTileCount=Math.max(this.context.maxVideoTileCount,this.context.videoTileController.getAllVideoTiles().length)}checkResubscribe(o){if(this.isResubscribeCheckPaused){this.context.logger.info("Resubscribe check is paused, setting incoming client metric report as pending"),this.pendingMetricsReport=o;return}this.pendingMetricsReport=void 0;let p=o.getObservableMetrics(),f=p.availableOutgoingBitrate,m=p.nackCountReceivedPerSecond,_=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(o);let w=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(_=_||w,w){let o=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions();this.context.videosToReceive=o.truncate(this.context.videoSubscriptionLimit),o.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.logger.info(`trigger resubscribe for down=${w}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:f/1e3,nackCountPerSecond:m});let o=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();_=_||o,o&&(this.logger.info(`trigger resubscribe for up=${o}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters())}return _}metricsDidReceive(o){if(this.checkResubscribe(o)&&this.context.audioVideoController.update({needsRenegotiation:!1}),!this.currentAvailableStreamAvgBitrates)return;let p=o.streamMetricReports,f=new Map;for(let o in p)p[o].mediaType===I.default.VIDEO&&p[o].direction===w.default.DOWNSTREAM&&f.set(p[o].streamId,p[o])}connectionHealthDidChange(o){for(let p of(0===o.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.applyHealthPolicy(this.reconnectionHealthPolicy,o,()=>{this.context.audioVideoController.handleMeetingSessionStatus(new B.default(U.default.ConnectionHealthReconnect),null)}),this.applyHealthPolicy(this.unusableAudioWarningHealthPolicy,o,()=>{var o;this.context.poorConnectionCount+=1,null==(o=this.context.eventController)||o.publishEvent("receivingAudioDropped",L.audioVideoEventAttributesFromState(this.context)),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidSuggestStopVideo).map(p=>p.bind(o)())}):this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidBecomePoor).map(p=>p.bind(o)())})},()=>{this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidBecomeGood).map(p=>p.bind(o)())})}),this.videoEncodingHealthPolicies))this.applyHealthPolicy(p,o,()=>{switch(this.degradeVideoCodec(p.name),p.name){case O.default.VideoEncodingCpuHealth:this.context.statsCollector.videoCodecDegradationHighEncodeCpuDidReceive();break;case O.default.VideoEncodingFramerateHealth:this.context.statsCollector.videoCodecDegradationEncodeFailureDidReceive();break;case O.default.VideoConcurrentSendersHealth:this.context.statsCollector.videoCodecDegradationConcurrentSendersDidReceive()}});if(this.context.isSessionConnected){let publishFilteredEvent=o=>{var p;let f=L.audioVideoEventAttributesFromState(this.context);null==(p=this.context.eventController)||p.publishEvent(o,f)};this.applyHealthPolicy(this.sendingAudioFailureHealthPolicy,o,()=>publishFilteredEvent("sendingAudioFailed"),()=>publishFilteredEvent("sendingAudioRecovered"))}}applyHealthPolicy(o,p,f,m){o.update(p);let _=o.healthIfChanged();null!==_&&(this.logger.info(`${o.name} value is now ${_}`),_<=o.minimumHealth()?et.Maybe.of(f).map(o=>o.bind(this)()):et.Maybe.of(m).map(o=>o.bind(this)()))}handleBitrateFrame(o){this.currentAvailableStreamAvgBitrates=o,o.serverAvailableOutgoingBitrate>0&&(this.logger.info(`Received server side estimation of available incoming bitrate ${o.serverAvailableOutgoingBitrate}kbps`),this.context.statsCollector.overrideObservableMetric("availableIncomingBitrate",1e3*o.serverAvailableOutgoingBitrate))}handleSignalingClientEvent(o){var p;if(o.type===q.default.WebSocketClosed&&this.isUnexpectedsignalingCloseCode(o.closeCode)||o.type===q.default.WebSocketError||o.type===q.default.WebSocketFailed?(this.hasSignalingError||(null==(p=this.context.eventController)||p.publishEvent("signalingDropped",Object.assign(Object.assign(Object.assign(Object.assign({},L.audioVideoEventAttributesFromState(this.context)),void 0!==o.closeCode&&{signalingCloseCode:o.closeCode}),void 0!==o.closeReason&&{signalingCloseReason:o.closeReason}),void 0!==o.wasClean&&{signalingCloseWasClean:o.wasClean})),this.hasSignalingError=!0),this.context.isSessionConnected&&this.context.audioVideoController.handleMeetingSessionStatus(new B.default(this.isInternalServerFailureCloseCode(o.closeCode)?U.default.SignalingInternalServerError:U.default.SignalingChannelClosedUnexpectedly),null)):o.type===q.default.WebSocketOpen&&(this.hasSignalingError=!1),o.type===q.default.ReceivedSignalFrame){if(o.message.type===Z.SdkSignalFrame.Type.NOTIFICATION){switch(o.message.notification.level){case Z.SdkNotificationFrame.NotificationLevel.INFO:this.logger.info(`Received notification from server: ${o.message.notification.message}`);break;case Z.SdkNotificationFrame.NotificationLevel.WARNING:this.logger.warn(`Received warning from server: ${o.message.notification.message}`);break;case Z.SdkNotificationFrame.NotificationLevel.ERROR:this.logger.error(`Received error from server: ${o.message.notification.message}`);break;default:this.logger.error(`Received notification from server with unknown level ${o.message.notification.level}: ${o.message.notification.message}`)}return}if(o.message.bitrates){let p=o.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(p),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(o.message.bitrates)}let p=B.default.fromSignalFrame(o.message);o.message.type!==Z.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&p.statusCode()!==U.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(p,null)}}isUnexpectedsignalingCloseCode(o){return 1006===o||this.isInternalServerFailureCloseCode(o)}isInternalServerFailureCloseCode(o){return o>=4500&&o<4600}degradeVideoCodec(o){if(void 0!==this.context.meetingSupportedVideoSendCodecPreferences&&this.context.meetingSupportedVideoSendCodecPreferences.length>1&&!(this.context.meetingSupportedVideoSendCodecPreferences[0].equals($.default.h264ConstrainedBaselineProfile())||this.context.meetingSupportedVideoSendCodecPreferences[0].equals($.default.vp8()))){let p=[];for(let o of this.context.videoSendCodecPreferences)o.equals(this.context.meetingSupportedVideoSendCodecPreferences[0])||p.push(o);p.length>0?(this.context.logger.info(`Downgrading codec from ${this.context.meetingSupportedVideoSendCodecPreferences[0].codecName} to ${p[0].codecName} due to ${o}`),this.context.degradedVideoSendCodecs.push(this.context.meetingSupportedVideoSendCodecPreferences[0]),this.context.meetingSupportedVideoSendCodecPreferences=p,this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),this.context.audioVideoController.update({needsRenegotiation:!0})):this.context.logger.warn(`Degrading video codec failed since there is no alternative codec to select. Currently degraded codecs: ${this.context.degradedVideoSendCodecs.map(o=>o.codecName).join(",")}`)}}}},0x253700aaf:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(o){}}},0x158630dfe:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd)),w=m(f(0x1158c4d3));p.default=class{constructor(o,p,f){this.logger=o,this.task=p,this.dependencies=f,this.canceled=!1}name(){return`${this.task.name()} (once)`}cancel(){if(!this.canceled){if(this.dependencies)for(let o of this.dependencies)o.cancel();this.logger.info(`Canceling ${this.name()}`),w.default.nextTick(()=>this.task.cancel()),this.canceled=!0,this.cancelPromise&&w.default.nextTick(()=>this.cancelPromise(Error(`canceling ${this.name()}`)))}}logDependencies(){if(this.logger.getLogLevel()>_.default.INFO||!this.dependencies)return;let o=this.dependencies.filter(o=>o).map(o=>o.name()).join(", ");this.logger.info(`${this.task.name()} waiting for dependencies: ${o}`)}run(){if(this.promise)return this.promise;let o=this.dependencies?Promise.all(this.dependencies.map(o=>null==o?void 0:o.run())):Promise.resolve();return this.logDependencies(),this.ongoing=o.then(()=>this.task.run()),this.promise=new Promise((o,p)=>{this.cancelPromise=p,this.ongoing.then(o).catch(p)})}setParent(o){this.task.setParent(o)}}},0xc8b2a6fb:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x296cfbc0)),I=_(f(0x216f98b8d)),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="OpenSignalingConnectionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){let o=this.context.meetingSessionConfiguration;this.context.signalingClient.openConnection(new w.default(o.urls.signalingURL,o.credentials.joinToken));let p=Date.now();try{yield new Promise((o,p)=>{let f=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("OpenSignalingConnectionTask got canceled while waiting to open signaling connection"))}handleSignalingClientEvent(f){switch(f.type){case I.default.WebSocketOpen:this.signalingClient.removeObserver(this),o();break;case I.default.WebSocketFailed:this.signalingClient.removeObserver(this),p(Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(f),this.taskCanceler=f})}catch(o){throw o}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-p),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}})}}},0x1a50cfb5:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692));p.default=class extends w.default{constructor(o,p,f){for(const m of(super(o),this.taskName=p,this.tasksToRunParallel=f,f))m.setParent(this)}cancel(){for(let o of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${o.name()}`),o.cancel()}run(){return m(this,void 0,void 0,function*(){let o=[];for(let p of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${p.name()}`),o.push(p.run());let p=[];for(let f=0;f<o.length;f++){try{yield o[f]}catch(o){p.push(`task ${this.tasksToRunParallel[f].name()} failed: ${o.message}`)}this.logger.info(`parallel group task ${this.name()} completed subtask ${this.tasksToRunParallel[f].name()}`)}if(p.length>0){let o=p.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${o}`)}this.logger.info(`parallel group task ${this.name()} completed`)})}}},0x8ef9a2fd:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x1ec8c7574),I=_(f(0x216f98b8d)),k=f(0x252035ee7),M=_(f(0x113227692));p.default=class extends M.default{constructor(o,p,f){super(o.logger),this.context=o,this.credentials=p,this.completionCallback=f,this.taskName="PromoteToPrimaryMeetingTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.ready()?(this.context.signalingClient.promoteToPrimaryMeeting(this.credentials),this.context.logger.info("Sent request to join primary meeting"),yield this.receivePrimaryMeetingJoinAck()):this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed))})}receivePrimaryMeetingJoinAck(){return new Promise((o,p)=>{let f=new class{constructor(o,p,f){this.signalingClient=o,this.completionCallback=p,this.logger=f}cancel(){this.signalingClient.removeObserver(this),this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed)),o()}handleSignalingClientEvent(p){p.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed)),o()),p.type===I.default.ReceivedSignalFrame&&p.message.type===k.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(w.MeetingSessionStatus.fromSignalFrame(p.message)),o())}}(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x26b16a9c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692));p.default=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveAudioInputTask"}run(){var o,p;return m(this,void 0,void 0,function*(){let f;if(!(null==(p=null==(o=this.context.meetingSessionConfiguration)?void 0:o.urls)?void 0:p.audioHostURL))return void this.context.logger.info("No audio connection: not acquiring audio input");if(this.context.activeAudioInput)return void this.context.logger.info("an active audio input exists");try{f=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch{this.context.logger.warn("could not acquire audio input from current device")}f?this.context.activeAudioInput=f:this.context.logger.warn("an audio input is not available")})}}},0x141765a48:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveRemoteVideoPauseResume",this.serverPausedVideoTileIds=new Set}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}updateSubscribedGroupdIds(o){let p=new Set;for(let f of o){let o=this.context.videoStreamIndex.attendeeIdForGroupId(f);if(0===o.length){this.logger.warn(`Could not find attendee ID for newly subscribed group ID ${f}`);continue}let m=this.context.videoTileController.getVideoTileForAttendeeId(o);void 0===m&&(this.logger.info(`No existing video tile for attendee ID ${o} with new group ID ${f}. Creating new one.`),(m=this.context.videoTileController.addVideoTile()).bindVideoStream(o,!1,null,0,0,0,null)),p.add(m.id())}this.serverPausedVideoTileIds.forEach(o=>{p.has(o)||this.serverPausedVideoTileIds.delete(o)})}handleSignalingClientEvent(o){if(o.type!==w.default.ReceivedSignalFrame||o.message.type!==I.SdkSignalFrame.Type.PAUSE&&o.message.type!==I.SdkSignalFrame.Type.RESUME)return;let p=o.message.pause,f=o.message.type;if(this.logger.info(`Received new ${f===I.SdkSignalFrame.Type.PAUSE?"pause":"resume"} frame: ${JSON.stringify(p)}`),p&&void 0!==this.context.videoTileController.getVideoTileForAttendeeId&&void 0!==this.context.videoDownlinkBandwidthPolicy.forEachObserver&&void 0!==this.context.videoStreamIndex.attendeeIdForGroupId)for(let o of p.groupIds.map(o=>{let p=this.context.videoStreamIndex.attendeeIdForGroupId(o);return 0===p.length?void this.logger.warn(`Could not find attendee ID for paused group ID ${o}`):this.context.videoTileController.getVideoTileForAttendeeId(p)}))void 0!==o&&(f===I.SdkSignalFrame.Type.PAUSE?o.state().paused||(this.serverPausedVideoTileIds.add(o.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(p=>{p.tileWillBePausedByDownlinkPolicy(o.id())}),o.pause()):o.state().paused&&this.serverPausedVideoTileIds.has(o.id())&&(this.serverPausedVideoTileIds.delete(o.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(p=>{p.tileWillBeUnpausedByDownlinkPolicy(o.id())}),o.unpause()))}}},0x117aaca57:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x230534cc6)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveVideoInputTask"}checkAndApplyVideoConstraint(o,p,f,_,w){return m(this,void 0,void 0,function*(){let m=o?this.context.meetingSessionConfiguration.meetingFeatures.contentMaxResolution:this.context.meetingSessionConfiguration.meetingFeatures.videoMaxResolution;if(!o&&f<=m.videoWidth&&_<=m.videoHeight&&w<=m.videoFrameRate)return;let I={resizeMode:{ideal:"none"},width:{max:m.videoWidth},height:{max:m.videoHeight},frameRate:{ideal:w,max:m.videoFrameRate}};try{yield p.applyConstraints(I)}catch{this.context.logger.info(`Could not apply constraint for video track (content = ${o})`)}})}run(){return m(this,void 0,void 0,function*(){let o,p=this.context.videoDuplexMode===I.SdkStreamServiceType.RX||this.context.videoDuplexMode===I.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=p?I.SdkStreamServiceType.DUPLEX:I.SdkStreamServiceType.TX:this.context.videoDuplexMode=p?I.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile()){this.context.logger.info("has not started local video tile"),this.context.activeVideoInput&&(this.context.activeVideoInput=void 0,this.context.videoStreamIndex.integrateUplinkPolicyDecision([]));return}let f=this.context.videoTileController.getLocalVideoTile();try{o=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch{this.context.logger.warn("could not acquire video input from current device"),this.context.videoTileController.stopLocalVideoTile()}if(this.context.enableSimulcast){let o=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(o.values()))}if(this.context.activeVideoInput=o,o){let p=o.getVideoTracks();if(!p||0===p.length)return;let m=this.context.meetingSessionConfiguration.credentials.attendeeId,_=new w.default(m).hasModality(w.default.MODALITY_CONTENT),I=p[0].getSettings();this.checkAndApplyVideoConstraint(_,p[0],I.width,I.height,I.frameRate);let k=this.context.audioVideoController.configuration.credentials.externalUserId;for(let _ of(f.bindVideoStream(m,!0,o,I.width,I.height,null,k),p))this.logger.info(`Using video device label=${_.label} id=${_.id}`),this.context.videoDeviceInformation.current_camera_name=_.label,this.context.videoDeviceInformation.current_camera_id=_.id}})}}},0x13a00d587:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1d61c1795)),I=_(f(0x230534cc6)),k=_(f(0x178bce6ff)),M=_(f(0x216f98b8d)),x=f(0x252035ee7),O=f(0xab1ef933),L=_(f(0x113227692));p.default=class extends L.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}handleSignalingClientEvent(o){if(o.type!==M.default.ReceivedSignalFrame||o.message.type!==x.SdkSignalFrame.Type.INDEX)return;let p=o.message.index;this.context.logger.info(`received new index ${JSON.stringify(p)}`),this.handleIndexFrame(p)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(o){if(!o)return;if(this.isIngestionPaused){this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),this.pendingIndex=o;return}this.pendingIndex=null;let p=this.context.audioVideoController.configuration.credentials.attendeeId;o.sources=o.sources.filter(o=>{let f=new I.default(o.attendeeId);return!(f.base()===p&&f.hasModality(I.default.MODALITY_CONTENT))});let{videoStreamIndex:f,videoDownlinkBandwidthPolicy:m,videoUplinkBandwidthPolicy:_}=this.context,w=f.allVideoSendingSourcesExcludingSelf(p);f.integrateIndexFrame(o),m.updateIndex(f),_.updateIndex(f),this.resubscribe(m,_),this.updateVideoAvailability(o),this.handleIndexVideosPausedAtSource(),o.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(o);let k=f.allVideoSendingSourcesExcludingSelf(p);this.areVideoSourcesEqual(w,k)||this.context.audioVideoController.forEachObserver(o=>{O.Maybe.of(o.remoteVideoSourcesDidChange).map(p=>p.bind(o)(k))})}areVideoSourcesEqual(o,p){if(o.length!==p.length)return!1;let compare=(o,p)=>o.attendee.attendeeId.localeCompare(p.attendee.attendeeId),f=[...o].sort(compare),m=[...p].sort(compare);for(let o=0;o<f.length;o++)if(f[o].attendee.attendeeId!==m[o].attendee.attendeeId)return!1;return!0}resubscribe(o,p){let f=o.wantsResubscribe(),m=(this.context.videoDuplexMode===x.SdkStreamServiceType.TX||this.context.videoDuplexMode===x.SdkStreamServiceType.DUPLEX)&&p.wantsResubscribe(),_=f||m;if(this.logger.info(`should resubscribe: ${_} (downlink: ${f} uplink: ${m})`),!_)return;let w=o.chooseSubscriptions();this.context.videosToReceive=w.truncate(this.context.videoSubscriptionLimit),w.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=p.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${m} down=${f}; videosToReceive=[${this.context.videosToReceive.array()}] captureParams=${JSON.stringify(this.context.videoCaptureAndEncodeParameter)}`),this.context.audioVideoController.update({needsRenegotiation:!1})}updateVideoAvailability(o){if(!this.context.videosToReceive)return void this.logger.error("videosToReceive must be set in the meeting context.");let p=new w.default;p.remoteVideoAvailable=!this.context.videosToReceive.empty(),p.canStartLocalVideo=!o.atCapacity,this.context.lastKnownVideoAvailability&&this.context.lastKnownVideoAvailability.equal(p)||(this.context.lastKnownVideoAvailability=p.clone(),this.context.audioVideoController.forEachObserver(o=>{O.Maybe.of(o.videoAvailabilityDidChange).map(f=>f.bind(o)(p.clone()))}))}handleSupportedVideoReceiveCodecIntersection(o){if(void 0===this.context.videoSendCodecPreferences)return;let p=[],f=!1;for(let f of this.context.videoSendCodecPreferences){if(this.context.degradedVideoSendCodecs.some(o=>f.equals(o))){this.logger.info(`Skipping ${f.codecName} since the codec has been identfied as degraded`);continue}for(let m of o.supportedReceiveCodecIntersection)if(f.equals(k.default.fromSignaled(m))){p.push(f);break}}if(p.length>0){let o=p.find(o=>this.context.prioritizedSendVideoCodecCapabilities.some(p=>o.equals(p)));void 0===this.context.currentVideoSendCodec||void 0!==o&&this.context.currentVideoSendCodec.equals(o)||(f=!0),this.context.meetingSupportedVideoSendCodecPreferences=p}else this.logger.warn("Interesection of meeting receive codec support and send codec preferences has no overlap, falling back to just values provided in `setVideoCodecSendPreferences`"),this.context.meetingSupportedVideoSendCodecPreferences=void 0;this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),f&&this.context.audioVideoController.update({needsRenegotiation:!0})}handleIndexVideosPausedAtSource(){let o=this.context.videoStreamIndex.streamsPausedAtSource();for(let p of this.context.videoTileController.getAllVideoTiles()){let f=p.state();o.contain(f.streamId)?p.markPoorConnection()&&this.logger.info(`marks the tile ${f.tileId} as having a poor connection`):p.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${f.tileId} as having a poor connection`)}}}},0x13eb8065e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x113227692));p.default=class extends _.default{constructor(o,p,f="RunnableTask"){super(o),this.fn=p,this.taskName=f}run(){return this.fn().then(()=>{})}}},0x164fd248f:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x200be574b)),I=_(f(0x216f98b8d)),k=f(0x252035ee7),M=_(f(0x113227692)),x=class SendAndReceiveDataMessagesTask extends M.default{constructor(o){super(o.logger),this.context=o,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(o,p,f)=>{if(this.context.signalingClient.ready()){let m;m=p instanceof Uint8Array?p:"string"==typeof p?new TextEncoder().encode(p):new TextEncoder().encode(JSON.stringify(p)),this.validateDataMessage(o,m,f);let _=k.SdkDataMessagePayload.create();_.topic=o,_.lifetimeMs=f,_.data=m;let w=k.SdkDataMessageFrame.create();w.messages=[_],this.context.signalingClient.sendDataMessage(w)}else this.context.logger.error("Cannot send data message because signaling client is not ready")}}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(o){if(o.type===I.default.ReceivedSignalFrame&&o.message.type===k.SdkSignalFrame.Type.DATA_MESSAGE)for(let p of o.message.dataMessage.messages){let o=new w.default(p.ingestTimeNs/1e6,p.topic,p.data,p.senderAttendeeId,p.senderExternalUserId,0===p.ingestTimeNs);this.context.realtimeController.realtimeReceiveDataMessage(o)}}validateDataMessage(o,p,f){if(!SendAndReceiveDataMessagesTask.TOPIC_REGEX.test(o))throw Error("Invalid topic");if(p.length>SendAndReceiveDataMessagesTask.DATA_SIZE)throw Error("Data size has to be less than 2048 bytes");if(f&&f<0)throw Error("The life time of the message has to be non negative")}};p.default=x,x.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),x.DATA_SIZE=2048},0x11bbef2ec:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692)),I=_(f(0xe2814d21));p.default=class extends w.default{constructor(o,p,f){for(const m of(super(o),this.taskName=p,this.tasksToRunSerially=f,this.currentTask=null,f))m.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return m(this,void 0,void 0,function*(){for(let o of this.tasksToRunSerially){this.getStatus()===I.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${o.name()}`),this.currentTask=o,yield o.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${o.name()}`)}catch(o){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${o.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)})}}},0x23693b9e4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x1a20e50ff)),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="SetLocalDescriptionTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()}`);this.cancelPromise(o),delete this.cancelPromise}}run(){return m(this,void 0,void 0,function*(){let o=this.context.peer,p=this.context.sdpOfferInit.sdp;if(this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(p=new I.default(p).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),this.context.browserBehavior.supportsDependencyDescriptorRtpHeaderExtension()&&void 0!==this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()&&(p=new I.default(p).withDependencyDescriptorRtpHeaderExtension(this.context.previousSdpOffer).sdp),new w.default().requiresDisablingH264Encoding()&&(p=new I.default(p).removeH264SupportFromSendSection().sdp),p=new I.default(p).withStartingVideoSendBitrate(1e3).sdp,void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(p=new I.default(p).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(p=new I.default(p).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(p=new I.default(p).withStereoAudio().sdp),this.context.audioProfile.hasRedundancyEnabled())){let o=new I.default(p).getAudioPayloadTypes();this.context.transceiverController&&this.context.transceiverController.setAudioPayloadTypes&&this.context.transceiverController.setAudioPayloadTypes(o)}this.logger.debug(()=>`local description is >>>${p}<<<`);let f={type:"offer",sdp:p,toJSON:null};yield new Promise((p,_)=>m(this,void 0,void 0,function*(){this.cancelPromise=o=>{_(o)};try{yield o.setLocalDescription(f),p()}catch(o){_(o)}finally{delete this.cancelPromise}})),this.context.logger.info("set local description")})}}},0x1c9808277:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x230534cc6)),I=_(f(0x1a20e50ff)),k=_(f(0x178bce6ff)),M=_(f(0x113227692));p.default=class extends M.default{constructor(o){super(o.logger),this.context=o,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){var o;return m(this,void 0,void 0,function*(){this.context.peer||this.logAndThrow("session does not have peer connection; bypass set remote description");let p=this.context.sdpAnswer;p=new I.default(p).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(p=new I.default(p).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(p=new I.default(p).withStereoAudio().sdp)),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(p=new I.default(p).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.prioritizedSendVideoCodecCapabilities=new I.default(p).prioritizedSendVideoCodecCapabilities(),this.context.currentVideoSendCodec=this.context.prioritizedSendVideoCodecCapabilities.length>0?this.context.prioritizedSendVideoCodecCapabilities[0]:void 0;let f=this.context.activeVideoInput;if(void 0!==f){let p=this.context.audioVideoController.configuration.credentials.attendeeId,m=new w.default(p).hasModality(w.default.MODALITY_CONTENT),_=f.getVideoTracks()[0];m&&((null==(o=this.context.currentVideoSendCodec)?void 0:o.codecName)===k.default.av1Main().codecName?(_.contentHint="text",this.logger.info(`Setting content hint to text for AV1, attendee: ${p}`)):this.context.audioVideoController.configuration.enableSVC&&(_.contentHint="motion",this.logger.info(`Setting content hint to motion to enable SVC, attendee: ${p}`)))}this.logger.info(`processed remote description is >>>${p}<<<`);let m={type:"answer",sdp:p,toJSON:null};try{yield this.createICEConnectionCompletedPromise(m)}catch(o){throw o}})}createICEConnectionCompletedPromise(o){return new Promise((p,f)=>m(this,void 0,void 0,function*(){let checkConnectionCompleted=()=>{("connected"===this.context.peer.iceConnectionState||"completed"===this.context.peer.iceConnectionState)&&(this.context.peer.removeEventListener("iceconnectionstatechange",checkConnectionCompleted),p())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",checkConnectionCompleted),f(Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",checkConnectionCompleted);try{yield this.context.peer.setRemoteDescription(o),this.logger.info("set remote description, waiting for ICE connection"),checkConnectionCompleted()}catch(o){f(o)}}))}}},0x22ef5bfc:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x194415c85)),I=_(f(0x11a9e868)),k=_(f(0x1a20e50ff)),M=_(f(0x1728c2fdd)),x=f(0xf8b13aac),O=_(f(0x216f98b8d)),L=_(f(0x49608f19)),B=f(0x252035ee7),U=f(0xb8e111a8),$=_(f(0x113227692));p.default=class extends $.default{constructor(o){super(o.logger),this.context=o,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new M.default(o.logger)}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){let o,p="";if(this.context.peer&&this.context.peer.localDescription&&(p=new k.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().sdp),!this.context.enableSimulcast){let o=0,p=0;this.context.videoCaptureAndEncodeParameter&&(o=this.context.videoCaptureAndEncodeParameter.captureFrameRate(),p=this.context.videoCaptureAndEncodeParameter.encodeBitrates()[0]);let f={rid:"hi",maxBitrate:1e3*p,maxFramerate:o,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([f])}let f=this.fixUpSubscriptionOrder(p,this.context.videoSubscriptions),m=this.context.videoDuplexMode===B.SdkStreamServiceType.TX||this.context.videoDuplexMode===B.SdkStreamServiceType.DUPLEX,_=p;if(void 0!==this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()||(_=new k.default(_).withoutDependencyDescriptorRtpHeaderExtension().sdp),this.context.serverSupportsCompression){let f=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";o=this.textCompressor.compress(_,f),this.context.logger.info(`Compressed the SDP message from ${_.length} to ${o.length} bytes.`),p=""}this.context.previousSdpOffer=new k.default(p);let w=new L.default(this.context.meetingSessionConfiguration.credentials.attendeeId,p,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,f,m,this.context.videoStreamIndex.localStreamDescriptions(),!0,o);void 0===this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption||x.serverSideNetworkAdaptionIsNoneOrDefault(this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())||void 0===this.context.videoDownlinkBandwidthPolicy.getVideoPreferences||(w.videoSubscriptionConfiguration=U.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(this.context,f.map(o=>0===o?0:this.context.videoStreamIndex.groupIdForStreamId(o)),this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(w)}`),this.context.signalingClient.subscribe(w);let I=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(I)}`);let M="";I.compressedSdpAnswer&&I.compressedSdpAnswer.length?(0===(M=this.textCompressor.decompress(I.compressedSdpAnswer,this.context.previousSdpAnswerAsString)).length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${I.compressedSdpAnswer.length} to ${M.length} bytes.`),this.context.sdpAnswer=M):this.context.sdpAnswer=I.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(I)})}fixUpSubscriptionOrder(o,p){if(void 0===this.context.transceiverController.getMidForStreamId)return p;let f=new Map;for(let o of p){let p=this.context.transceiverController.getMidForStreamId(o);if(void 0===p){0!==o&&this.logger.warn(`Could not find MID for stream ID: ${o}`);continue}f.set(p,o)}let m=new k.default(o).mediaSections(),_=[];for(let o of m)if("video"===o.mediaType)if("recvonly"===o.direction){let p=f.get(o.mid);if(void 0===p){this.logger.warn(`Could not find stream ID for MID: ${o.mid}`);continue}_.push(p)}else _.push(0);return this.logger.info(`Fixed up ${JSON.stringify(p)} to ${JSON.stringify(_)} (may be same))}`),_}receiveSubscribeAck(){return new Promise((o,p)=>{let f=this.context,m=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("SubscribeAndReceiveSubscribeAckTask got canceled while waiting for SdkSubscribeAckFrame"))}handleSignalingClientEvent(p){if(p.isConnectionTerminated()){let o=`SubscribeAndReceiveSubscribeAckTask connection was terminated with code ${p.closeCode} and reason: ${p.closeReason}`;f.logger.warn(o);let m=I.default.TaskFailed;p.closeCode>=4500&&p.closeCode<4600&&(m=I.default.SignalingInternalServerError),f.audioVideoController.handleMeetingSessionStatus(new w.default(m),Error(o));return}p.type!==O.default.ReceivedSignalFrame||p.message.type!==B.SdkSignalFrame.Type.SUBSCRIBE_ACK||(this.signalingClient.removeObserver(this),o(p.message.suback))}}(this.context.signalingClient);this.context.signalingClient.registerObserver(m),this.taskCanceler=m})}}},0xe2814d21:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).IDLE="IDLE",m.RUNNING="RUNNING",m.CANCELED="CANCELED",m.FINISHED="FINISHED",p.default=f},0xe6d64708:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xa9a27686)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o,p,f){super(o),this.taskToRunBeforeTimeout=p,this.timeoutMs=f,this.taskName=`Timeout${this.timeoutMs}ms`,p.setParent(this)}cancel(){this.logger.info(`canceling timeout task ${this.name()} subtask ${this.taskToRunBeforeTimeout}`),this.taskToRunBeforeTimeout.cancel()}run(){return m(this,void 0,void 0,function*(){let o=new w.default(this.timeoutMs);o.start(()=>{this.logger.info(`timeout reached for task ${this.name()}`),this.taskToRunBeforeTimeout.cancel()});try{yield this.taskToRunBeforeTimeout.run()}finally{o.stop()}this.logger.info(`timeout task ${this.name()} completed`)})}}},0x112462f64:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11a9e868)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.NoAttendeePresent}`);this.cancelPromise(o),delete this.cancelPromise}}run(){return m(this,void 0,void 0,function*(){let o=this.context.meetingSessionConfiguration.credentials.attendeeId;return new Promise((p,f)=>{let handler=(f,m,_,w,I)=>{o===f&&m&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(handler),p(),delete this.cancelPromise)};this.cancelPromise=o=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(handler),f(o)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)})})}}},0x238ca30a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1be31fc8b)),I=_(f(0x15a1c7c16)),k=_(f(0x12d2b358b)),M=_(f(0x118a80d5b)),x=_(f(0x1158c4d3));p.default=class{constructor(o,p,f){this.logger=o,this.browserBehavior=p,this.meetingSessionContext=f,this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null,this.streamIdToTransceiver=new Map,this.groupIdToTransceiver=new Map,this.audioRedWorker=null,this.audioRedWorkerURL=null,this.audioMetricsHistory=[],this.redMetricsObservers=new Set,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.maxAudioMetricsHistory=20,this.audioRedPacketLossShortEvalPeriodMs=5e3,this.audioRedPacketLossLongEvalPeriodMs=15e3,this.audioRedHoldDownTimeMs=3e5,this.redRecoveryTimeMs=6e4,this.handleTrack=o=>{let p=!!window.RTCRtpScriptTransform;this.audioRedWorker&&p&&(o.receiver.transform||(this.logger.info(`Applying passthrough transform to receiver track ${o.track.id} not set after addTranceiver`),o.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"})))}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender;if(!o||0===o.size)return;let f=Array.from(o.values()),m=p.getParameters();if(m.encodings&&0!==m.encodings.length)for(let o of m.encodings)for(let p of f){let f;if(!o.rid&&!p.rid||o.rid===p.rid)for(f in p)"rid"!==f&&"codecPayloadType"!==f&&p.hasOwnProperty(f)&&(o[f]=p[f])}else m.encodings=f;yield p.setParameters(m)})}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender;if(!p||o<=0)return;let f=p.getParameters();for(let p of(f.encodings||(f.encodings=[{}]),f.encodings))p.maxBitrate=1e3*o;yield p.setParameters(f)})}setPeer(o){this.peer=o,this.peer.addEventListener("track",this.handleTrack)}reset(){this.destroyAudioRedWorkerAndStates(),this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer&&this.peer.removeEventListener("track",this.handleTrack),this.peer=null}useTransceivers(){return!!this.peer&&void 0!==this.peer.getTransceivers}hasVideoInput(){return!!this._localCameraTransceiver&&"sendrecv"===this._localCameraTransceiver.direction}trackIsVideoInput(o){return!!this._localCameraTransceiver&&(o===this._localCameraTransceiver.sender.track||o===this._localCameraTransceiver.receiver.track)}setupLocalTransceivers(){var o,p;this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),!this._localAudioTransceiver&&(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),(null==(p=null==(o=this.meetingSessionContext)?void 0:o.audioProfile)?void 0:p.hasRedundancyEnabled())&&this.setupAudioRedWorker()),this._localCameraTransceiver||(this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}replaceAudioTrack(o){return m(this,void 0,void 0,function*(){return this._localAudioTransceiver&&"sendrecv"===this._localAudioTransceiver.direction?(yield this._localAudioTransceiver.sender.replaceTrack(o),!0):(this.logger.info("audio transceiver direction is not set up or not activated"),!1)})}setAudioInput(o){return m(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localAudioTransceiver,o)})}setVideoInput(o){return m(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localCameraTransceiver,o)})}updateVideoTransceivers(o,p){if(!this.useTransceivers())return p.array();let f=this.peer.getTransceivers();return this.videoSubscriptions=[0],p=p.clone(),this.updateTransceivers(f,o,p),this.logger.debug(()=>this.debugDumpTransceivers()),this.videoSubscriptions}updateTransceivers(o,p,f){let m=f.array();for(let f of(0===o.length||o[0].stop?0!==o.length&&this.updateTransceiverWithStop(o,p,m):(this.logger.info("Updating transceivers without `stop` function"),this.updateTransceiverWithoutStop(o,p,m)),m)){let o=this.addTransceiver("video",{direction:"recvonly",streams:[new MediaStream]});this.streamIdToTransceiver.set(f,o),this.groupIdToTransceiver.set(p.groupIdForStreamId(f),o),this.videoSubscriptions.push(f),this.logger.info(`adding transceiver mid: ${o.mid} subscription: ${f} direction: recvonly`)}}updateTransceiverWithStop(o,p,f){let m=1;for(let _ of(this.videoSubscriptions=[0],o)){if(_===this._localCameraTransceiver||!this.transceiverIsVideo(_)||!_.mid)continue;let o=!1,w=p.streamIdForTrack("v_"+_.mid);if("inactive"!==_.direction&&void 0!==w){for(let[I,k]of f.entries())if(p.StreamIdsInSameGroup(w,k)){_.direction="recvonly",this.videoSubscriptions[m]=k,o=!0,this.streamIdToTransceiver.delete(w),this.streamIdToTransceiver.set(k,_),f.splice(I,1);break}}if(!o)for(let[o,f]of(this.videoSubscriptions[m]=0,this.logger.info(`Stopping MID: ${_.mid}, direction: ${_.direction}, current direction: ${_.currentDirection}`),_.stop(),this.streamIdToTransceiver.entries()))_.mid===f.mid&&(this.streamIdToTransceiver.delete(o),this.groupIdToTransceiver.delete(p.groupIdForStreamId(o)));m+=1}}updateTransceiverWithoutStop(o,p,f){let m=1;for(let _ of o)if(_!==this._localCameraTransceiver&&this.transceiverIsVideo(_)){if(this.videoSubscriptions[m]=0,"inactive"!==_.direction){let o=p.streamIdForTrack("v_"+_.mid);if(void 0!==o){for(let[w,I]of f.entries())if(p.StreamIdsInSameGroup(o,I)){_.direction="recvonly",this.videoSubscriptions[m]=I,this.streamIdToTransceiver.delete(o),this.streamIdToTransceiver.set(I,_),f.splice(w,1);break}}}m+=1}for(let _ of(m=1,o))if(_!==this._localCameraTransceiver&&this.transceiverIsVideo(_)){if("inactive"===_.direction&&f.length>0){_.direction="recvonly";let o=f.shift();this.videoSubscriptions[m]=o,this.streamIdToTransceiver.set(o,_),this.groupIdToTransceiver.set(p.groupIdForStreamId(o),_)}else if(0===this.videoSubscriptions[m])for(let[o,f]of(_.direction="inactive",this.streamIdToTransceiver.entries()))_===f&&(this.streamIdToTransceiver.delete(o),this.groupIdToTransceiver.delete(p.groupIdForStreamId(o)));m+=1}}getMidForStreamId(o){var p;return null==(p=this.streamIdToTransceiver.get(o))?void 0:p.mid}setStreamIdForMid(o,p){for(let[f,m]of this.streamIdToTransceiver.entries())if(m.mid===o){this.streamIdToTransceiver.delete(f),this.streamIdToTransceiver.set(p,m);return}}getMidForGroupId(o){var p,f;return null!=(f=null==(p=this.groupIdToTransceiver.get(o))?void 0:p.mid)?f:void 0}transceiverIsVideo(o){return o.receiver&&o.receiver.track&&"video"===o.receiver.track.kind||o.sender&&o.sender.track&&"video"===o.sender.track.kind}debugDumpTransceivers(){let o="",p=0;for(let f of this.peer.getTransceivers())this.transceiverIsVideo(f)&&(o+=`transceiver index=${p} mid=${f.mid} subscription=${this.videoSubscriptions[p]} direction=${f.direction}
`,p+=1);return o}setTransceiverInput(o,p){return m(this,void 0,void 0,function*(){o&&(p?o.direction="sendrecv":o.direction="inactive",yield o.sender.replaceTrack(p))})}forEachRedMetricsObserver(o){for(let p of this.redMetricsObservers)x.default.nextTick(()=>{this.redMetricsObservers.has(p)&&p.recoveryMetricsDidReceive(o)})}disableAudioRedundancy(){this.meetingSessionContext.audioProfile=new w.default(this.meetingSessionContext.audioProfile.audioBitrateBps,!1),this.meetingSessionContext.audioVideoController.setAudioProfile(this.meetingSessionContext.audioProfile)}setupAudioRedWorker(){var o,p;let f=!!window.RTCRtpScriptTransform,m=!!RTCRtpSender.prototype.createEncodedStreams;if(f)this.logger.info("[AudioRed] Supports encoded insertable streams using RTCRtpScriptTransform");else if(m)this.logger.info("[AudioRed] Supports encoded insertable streams using TransformStream");else throw this.disableAudioRedundancy(),Error("[AudioRed] Encoded insertable streams not supported. Recreating peer connection with audio redundancy disabled.");try{this.audioRedWorkerURL=URL.createObjectURL(new Blob([M.default],{type:"application/javascript"})),this.logger.info(`[AudioRed] Redundant audio worker URL ${this.audioRedWorkerURL}`),this.audioRedWorker=new Worker(this.audioRedWorkerURL)}catch(o){throw this.logger.error(`[AudioRed] Unable to create audio red worker due to ${o}`),URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker=null,this.disableAudioRedundancy(),this.logger.info("[AudioRed] Recreating peer connection with audio redundancy disabled"),o}if(this.audioRedEnabled=!0,this.audioRedWorker.onmessage=o=>{if("REDWorkerLog"===o.data.type)this.logger.info(o.data.log);else if("RedundantAudioEncoderStats"===o.data.type){let p=new I.default;p.currentTimestampMs=Date.now(),p.ssrc=o.data.ssrc,p.totalAudioPacketsLost=o.data.totalAudioPacketsLost,p.totalAudioPacketsExpected=o.data.totalAudioPacketsExpected,p.totalAudioPacketsRecoveredRed=o.data.totalAudioPacketsRecoveredRed,p.totalAudioPacketsRecoveredFec=o.data.totalAudioPacketsRecoveredFec,this.forEachRedMetricsObserver(p)}},f)this._localAudioTransceiver.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"SenderTransform"}),this._localAudioTransceiver.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"ReceiverTransform"});else if(m){let o=this._localAudioTransceiver.sender.createEncodedStreams(),p=this._localAudioTransceiver.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"StartRedWorker",send:o,receive:p},[o.readable,o.writable,p.readable,p.writable])}null==(o=this.meetingSessionContext)||o.audioVideoController.addObserver(this),this.addRedundantAudioRecoveryMetricsObserver(null==(p=this.meetingSessionContext)?void 0:p.statsCollector)}addTransceiver(o,p){var f;let m=this.peer.addTransceiver(o,p);if(!this.audioRedWorker)return m;let _=!!window.RTCRtpScriptTransform,w=!!RTCRtpSender.prototype.createEncodedStreams;if(_)"recvonly"!==p.direction&&(m.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"}));else if(w){if(!(null==(f=this.peer.getConfiguration())?void 0:f.encodedInsertableStreams))return m;let o=m.sender.createEncodedStreams(),p=m.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"PassthroughTransform",send:o,receive:p},[o.readable,o.writable,p.readable,p.writable])}return m}destroyAudioRedWorkerAndStates(){var o,p;this.audioRedWorker&&(URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker.terminate(),this.audioRedWorker=null,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.audioRedEnabled=!0,null==(o=this.meetingSessionContext)||o.audioVideoController.removeObserver(this),this.removeRedundantAudioRecoveryMetricsObserver(null==(p=this.meetingSessionContext)?void 0:p.statsCollector))}setAudioPayloadTypes(o){this.audioRedWorker&&(this.audioRedWorker.postMessage({msgType:"RedPayloadType",payloadType:o.get("red")}),this.audioRedWorker.postMessage({msgType:"OpusPayloadType",payloadType:o.get("opus")}))}metricsDidReceive(o){let{currentTimestampMs:p}=o,f=o.getRTCStatsReport(),m=0,_=0,w=0;f.forEach(o=>{"audio"===o.kind&&("outbound-rtp"===o.type?_=o.packetsSent:"remote-inbound-rtp"===o.type&&(m=o.timestamp,w=o.packetsLost))}),(0===this.audioMetricsHistory.length||m>this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs&&_>this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent)&&this.audioMetricsHistory.push({timestampMs:m,totalPacketsSent:_,totalPacketsLost:w}),this.audioMetricsHistory.length>this.maxAudioMetricsHistory&&this.audioMetricsHistory.shift();let I=Math.max(this.lossPercent(this.audioRedPacketLossShortEvalPeriodMs),this.lossPercent(this.audioRedPacketLossLongEvalPeriodMs)),[M,x]=k.default.getNumRedundantEncodingsForPacketLoss(I);if(x){this.lastHighPacketLossEventTimestampMs=p,this.audioRedEnabled&&(this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Disable"}),this.audioRedEnabled=!1,this.lastAudioRedTurnOffTimestampMs=p);return}if(!this.audioRedEnabled){let o=p-this.lastAudioRedTurnOffTimestampMs,f=p-this.lastHighPacketLossEventTimestampMs;if(o>=this.audioRedPacketLossLongEvalPeriodMs&&f<this.redRecoveryTimeMs)return;this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Enable"}),this.audioRedEnabled=!0,this.maybeResetHoldDownTimer(p)}this.shouldUpdateAudioRedWorkerEncodings(p,M)&&this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"UpdateNumRedundantEncodings",numRedundantEncodings:M})}maybeResetHoldDownTimer(o){this.currentNumRedundantEncodings>0&&(this.lastRedHolddownTimerStartTimestampMs=o)}lossPercent(o){if(this.audioMetricsHistory.length<2)return 0;let p=this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs,f=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent,m=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsLost;for(let _=this.audioMetricsHistory.length-2;_>=0;_--)if(p-this.audioMetricsHistory[_].timestampMs>=o)return Math.max(0,Math.min((m-this.audioMetricsHistory[_].totalPacketsLost)/(f-this.audioMetricsHistory[_].totalPacketsSent)*100,100));return 0}shouldUpdateAudioRedWorkerEncodings(o,p){return this.currentNumRedundantEncodings===p?(this.maybeResetHoldDownTimer(o),!1):(!(p<this.currentNumRedundantEncodings)||!(o-this.lastRedHolddownTimerStartTimestampMs<this.audioRedHoldDownTimeMs))&&(this.currentNumRedundantEncodings=p,this.maybeResetHoldDownTimer(o),!0)}addRedundantAudioRecoveryMetricsObserver(o){this.redMetricsObservers.add(o)}removeRedundantAudioRecoveryMetricsObserver(o){this.redMetricsObservers.delete(o)}}},0xf1a8ac2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x4287252)),I=class SimulcastContentShareTransceiverController extends w.default{constructor(o,p,f){super(o,p,f);let m=2;this.videoQualityControlParameterMap=new Map;for(let o=0;o<SimulcastContentShareTransceiverController.NAME_ARR_ASCENDING.length;o++){const p=SimulcastContentShareTransceiverController.NAME_ARR_ASCENDING[o];this.videoQualityControlParameterMap.set(p,{rid:p,scaleResolutionDownBy:m,maxBitrate:1e3*SimulcastContentShareTransceiverController.BITRATE_ARR_ASCENDING[o]}),m/=2}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender,f=Array.from(o.values());if(f.length<=0)return;let m=p.getParameters();if(m.encodings)for(let p=0;p<m.encodings.length;p++)m.encodings[p].rid===w.default.LOW_LEVEL_NAME&&this.copyEncodingParams(o.get(w.default.LOW_LEVEL_NAME),m.encodings[p]),m.encodings[p].rid===w.default.HIGH_LEVEL_NAME&&this.copyEncodingParams(o.get(w.default.HIGH_LEVEL_NAME),m.encodings[p]);else m.encodings=f;yield p.setParameters(m),this.logVideoTransceiverParameters()})}};p.default=I,I.NAME_ARR_ASCENDING=["low","hi"],I.BITRATE_ARR_ASCENDING=[300,1200]},0x4287252:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x238ca30a)),I=class SimulcastTransceiverController extends w.default{constructor(o,p,f){super(o,p,f),this.videoQualityControlParameterMap=new Map;let m=4;for(let o=0;o<SimulcastTransceiverController.NAME_ARR_ASCENDING.length;o++){const p=SimulcastTransceiverController.NAME_ARR_ASCENDING[o];this.videoQualityControlParameterMap.set(p,{rid:p,scaleResolutionDownBy:m,maxBitrate:1e3*SimulcastTransceiverController.BITRATE_ARR_ASCENDING[o]}),m/=2}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender,f=Array.from(o.values());if(f.length<=0)return;let m=p.getParameters();if(m.encodings)for(let p of m.encodings)p.rid===SimulcastTransceiverController.LOW_LEVEL_NAME&&this.copyEncodingParams(o.get(SimulcastTransceiverController.LOW_LEVEL_NAME),p),p.rid===SimulcastTransceiverController.MID_LEVEL_NAME&&this.copyEncodingParams(o.get(SimulcastTransceiverController.MID_LEVEL_NAME),p),p.rid===SimulcastTransceiverController.HIGH_LEVEL_NAME&&this.copyEncodingParams(o.get(SimulcastTransceiverController.HIGH_LEVEL_NAME),p);else m.encodings=f;yield p.setParameters(m),this.logVideoTransceiverParameters()})}setVideoSendingBitrateKbps(o){return m(this,void 0,void 0,function*(){})}setupLocalTransceivers(){var o,p;if(this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),!this._localAudioTransceiver&&(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),(null==(p=null==(o=this.meetingSessionContext)?void 0:o.audioProfile)?void 0:p.hasRedundancyEnabled())&&this.setupAudioRedWorker()),!this._localCameraTransceiver)){let o=Array.from(this.videoQualityControlParameterMap.values());this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream],sendEncodings:o})}}logVideoTransceiverParameters(){let o=this._localCameraTransceiver.sender.getParameters().encodings,p=`simulcast: current encoding parameters 
`;for(let f of o)p+=`rid=${f.rid} maxBitrate=${f.maxBitrate} active=${f.active} scaleDownBy=${f.scaleResolutionDownBy} maxFrameRate = ${f.maxFramerate} 
`;this.logger.info(p)}copyEncodingParams(o,p){p.active=o.active,p.maxBitrate=o.maxBitrate,p.scaleResolutionDownBy=o.scaleResolutionDownBy,p.maxFramerate=o.maxFramerate}};p.default=I,I.LOW_LEVEL_NAME="low",I.MID_LEVEL_NAME="mid",I.HIGH_LEVEL_NAME="hi",I.NAME_ARR_ASCENDING=["low","mid","hi"],I.BITRATE_ARR_ASCENDING=[200,400,1100]},0x72848aa:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x238ca30a));p.default=class extends _.default{constructor(o,p,f){super(o,p,f)}setupLocalTransceivers(){this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}}},0xf16d9918:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;let m=f(0x167d8cb53);p.TRANSCRIPTION_DATA_MESSAGE_TOPIC="aws:chime:transcription";let _=class{constructor(o){this.realtimeController=o,this.transcriptEventCallbacks=new Set}subscribeToTranscriptEvent(o){0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeSubscribeToReceiveDataMessage(p.TRANSCRIPTION_DATA_MESSAGE_TOPIC,o=>{for(let p of m.TranscriptEventConverter.from(o))for(let o of this.transcriptEventCallbacks)o(p)}),this.transcriptEventCallbacks.add(o)}unsubscribeFromTranscriptEvent(o){this.transcriptEventCallbacks.delete(o),0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(p.TRANSCRIPTION_DATA_MESSAGE_TOPIC)}};p.default=_},0x6bcf7aed:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x235b3b0dc:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x10dd4ac72:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x167d8cb53:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.TranscriptEventConverter=void 0;let _=f(0x252035ee7),w=m(f(0x6bcf7aed)),I=m(f(0x1b8f962c3)),k=m(f(0x251900acb)),M=m(f(0x22ea8d802)),x={[_.SdkTranscriptionStatus.Type.STARTED]:k.default.STARTED,[_.SdkTranscriptionStatus.Type.INTERRUPTED]:k.default.INTERRUPTED,[_.SdkTranscriptionStatus.Type.RESUMED]:k.default.RESUMED,[_.SdkTranscriptionStatus.Type.STOPPED]:k.default.STOPPED,[_.SdkTranscriptionStatus.Type.FAILED]:k.default.FAILED};p.TranscriptEventConverter=class{static from(o){let p;try{p=_.SdkTranscriptFrame.decode(o.data)}catch(o){throw Error("Cannot decode transcript data message: "+o)}let f=[];for(let o of p.events)if(o.status){let p=x[o.status.type];if(!p)continue;let m=new I.default;m.type=p,m.eventTimeMs=o.status.eventTime,m.transcriptionRegion=o.status.transcriptionRegion,m.transcriptionConfiguration=o.status.transcriptionConfiguration,o.status.message&&(m.message=o.status.message),f.push(m)}else if(o.transcript){let p=new w.default;for(let f of(p.results=[],o.transcript.results)){let o={channelId:f.channelId,isPartial:f.isPartial,resultId:f.resultId,startTimeMs:f.startTime,endTimeMs:f.endTime,alternatives:[]};if(f.languageCode&&(o.languageCode=f.languageCode),f.languageIdentification&&f.languageIdentification.length>0)for(let p of(o.languageIdentification=[],f.languageIdentification)){let f={languageCode:p.languageCode,score:p.score};o.languageIdentification.push(f)}for(let p of f.alternatives){let f={items:[],transcript:p.transcript};for(let o of p.items){let p={content:o.content,attendee:{attendeeId:o.speakerAttendeeId,externalUserId:o.speakerExternalUserId},startTimeMs:o.startTime,endTimeMs:o.endTime,type:null};switch(o.vocabularyFilterMatch&&(p.vocabularyFilterMatch=o.vocabularyFilterMatch),o.hasOwnProperty("stable")&&(p.stable=o.stable),o.hasOwnProperty("confidence")&&(p.confidence=o.confidence),o.type){case _.SdkTranscriptItem.Type.PRONUNCIATION:p.type=M.default.PRONUNCIATION;break;case _.SdkTranscriptItem.Type.PUNCTUATION:p.type=M.default.PUNCTUATION}f.items.push(p)}for(let o of p.entities){f.entities||(f.entities=[]);let p={category:o.category,confidence:o.confidence,content:o.content,startTimeMs:o.startTime,endTimeMs:o.endTime};o.type&&(p.type=o.type),f.entities.push(p)}o.alternatives.push(f)}p.results.push(o)}f.push(p)}return f}}},0x1b6467fba:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x22ea8d802:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).PRONUNCIATION="pronunciation",m.PUNCTUATION="punctuation",p.default=f},0x176167e03:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x147bf1250:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x1b8f962c3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x251900acb:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).STARTED="started",m.INTERRUPTED="interrupted",m.RESUMED="resumed",m.STOPPED="stopped",m.FAILED="failed",p.default=f},0x19f971fd8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x2056040c6),w=m(f(0x22a0f7c69)),I=class DefaultUserAgentParser{constructor(o){var p,f,m,w,I,k,M;try{this.parserResult=navigator&&navigator.userAgent?new _.UAParser(navigator.userAgent).getResult():void 0}catch(p){o.error(p.message)}this.browserMajorVersion=(null==(m=null==(f=null==(p=this.parserResult)?void 0:p.browser)?void 0:f.version)?void 0:m.split(".")[0])||DefaultUserAgentParser.UNAVAILABLE,this.browserName=(null==(w=this.parserResult)?void 0:w.browser.name)||DefaultUserAgentParser.UNAVAILABLE,this.browserVersion=(null==(I=this.parserResult)?void 0:I.browser.version)||DefaultUserAgentParser.UNAVAILABLE,this.deviceName=[(null==(k=this.parserResult)?void 0:k.device.vendor)||"",(null==(M=this.parserResult)?void 0:M.device.model)||""].join(" ").trim()||DefaultUserAgentParser.UNAVAILABLE}getParserResult(){var o,p;return{browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,osName:(null==(o=this.parserResult)?void 0:o.os.name)||DefaultUserAgentParser.UNAVAILABLE,osVersion:(null==(p=this.parserResult)?void 0:p.os.version)||DefaultUserAgentParser.UNAVAILABLE,sdkVersion:w.default.sdkVersion,sdkName:w.default.sdkName}}};p.default=I,I.UNAVAILABLE="Unavailable"},0x172e1bd2a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.queue=Promise.resolve()}add(o){return new Promise((p,f)=>{this.queue=this.queue.then(o).then(p).catch(f)})}}},0xab1ef933:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.None=p.Some=p.Maybe=void 0;let f=class{static of(o){return null==o?_.of():m.of(o)}};p.Maybe=f;let m=class Some{constructor(o){this.value=o,this.isSome=!0,this.isNone=!1}map(o){return f.of(o(this.value))}flatMap(o){return o(this.value)}get(){return this.value}getOrElse(o){return this.value}defaulting(o){return f.of(this.getOrElse(o))}static of(o){if(null==o)throw Error("value is ${value}");return new Some(o)}};p.Some=m;let _=class None{constructor(){this.isSome=!1,this.isNone=!0}get(){throw Error("value is null")}getOrElse(o){return o}map(o){return new None}flatMap(o){return new None}defaulting(o){return f.of(this.getOrElse(o))}static of(){return new None}};p.None=_},0xb79a45b7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.iterateEvery=p.SuppressedError=p.getRandomValues=p.getFormattedOffset=p.getDefaultAssetSpec=p.toLowerCasePropertyNames=p.isIFramed=p.wait=void 0;let _=m(f(0x22a0f7c69));function toLowerCasePropertyNames(o){return null===o?null:"object"!=typeof o?o:Array.isArray(o)?o.map(toLowerCasePropertyNames):Object.keys(o).reduce((p,f)=>{let m=o[f],_="object"==typeof m?toLowerCasePropertyNames(m):m;return p[f.toLowerCase()]=_,p},{})}p.wait=function(o){return new Promise(p=>setTimeout(p,o))},p.isIFramed=function(){var o;try{return(null==(o=window.frameElement)?void 0:o.nodeName)==="IFRAME"||parent!==top}catch{return!0}},p.toLowerCasePropertyNames=toLowerCasePropertyNames,p.getDefaultAssetSpec=function(){let o=_.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}},p.getFormattedOffset=function(o){let p=Math.abs(o),f=Math.floor(p/60).toString().padStart(2,"0"),m=Math.floor(p%60).toString().padStart(2,"0");return`${o<=0?"+":"-"}${f}:${m}`},p.getRandomValues=function(o){try{window.crypto.getRandomValues(o)}catch{new DataView(o.buffer).setUint32(0,Math.trunc(0x100000000*Math.random()),!0)}};let w=class extends Error{constructor(o,p,f){var m;super(null!=f?f:`${null!=(m=null==o?void 0:o.message)?m:o}`),this.error=o,this.suppressed=p}};p.SuppressedError=w,p.iterateEvery=function(o,p){let f;if(o){for(let m of o)try{p(m)}catch(o){f=new w(o,f)}if(f)throw f}}},0x22a0f7c69:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2)),w=m(f(0x14322fbcb)),I=class Versioning{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return w.default.semverString}static get sdkVersionSemVer(){var o,p,f,m;let _=w.default.semverString.match(/^(?<major>[0-9]+)\.(?<minor>[0-9]+)((?:\.(?<patch>[0-9]+))(?:-(?<preRelease>[a-zA-Z]+(\.[0-9])*))?)?/);return{major:null==(o=null==_?void 0:_.groups)?void 0:o.major,minor:null==(p=null==_?void 0:_.groups)?void 0:p.minor,patch:null==(f=null==_?void 0:_.groups)?void 0:f.patch,preRelease:null==(m=null==_?void 0:_.groups)?void 0:m.preRelease}}static get buildSHA(){return w.default.hash.substring(1)}static get sdkUserAgentLowResolution(){let o=new _.default;return`${o.name()}-${o.majorVersion()}`}static urlWithVersion(o){let p=new URL(o);return p.searchParams.append(Versioning.X_AMZN_VERSION,Versioning.sdkVersion),p.searchParams.append(Versioning.X_AMZN_USER_AGENT,Versioning.sdkUserAgentLowResolution),p.toString()}};p.default=I,I.X_AMZN_VERSION="X-Amzn-Version",I.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},0x14322fbcb:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default={hash:"802f244",raw:"v3.30.0",semverString:"3.30.0"}},0x17f8c39ba:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class DefaultVideoCaptureAndEncodeParameter{constructor(o,p,f,m,_,w=1,I=!1){this.cameraWidth=o,this.cameraHeight=p,this.cameraFrameRate=f,this.maxEncodeBitrateKbps=m,this.isSimulcast=_,this.scaleResolutionDownBy=w,this.isSVC=I}equal(o){let p=o.captureWidth()===this.cameraWidth&&o.captureHeight()===this.cameraHeight&&o.captureFrameRate()===this.cameraFrameRate&&o.encodeBitrates().length===this.encodeBitrates().length&&o.encodeScaleResolutionDownBy().length===this.encodeScaleResolutionDownBy().length&&o.encodeWidths().length===this.encodeWidths().length&&o.encodeHeights().length===this.encodeHeights().length&&o.isSVCEncoding()===this.isSVC;if(p){for(let f=0;f<o.encodeWidths().length;f++)if(o.encodeWidths()[f]!==this.encodeWidths()[f]||o.encodeHeights()[f]!==this.encodeHeights()[f]||o.encodeBitrates()[f]!==this.encodeBitrates()[f]||o.encodeScaleResolutionDownBy()[f]!==this.encodeScaleResolutionDownBy()[f]){p=!1;break}}return p}clone(){return new DefaultVideoCaptureAndEncodeParameter(this.cameraWidth,this.cameraHeight,this.cameraFrameRate,this.maxEncodeBitrateKbps,this.isSimulcast,this.scaleResolutionDownBy,this.isSVC)}captureWidth(){return this.cameraWidth}captureHeight(){return this.cameraHeight}captureFrameRate(){return this.cameraFrameRate}encodeBitrates(){return[this.maxEncodeBitrateKbps]}encodeScaleResolutionDownBy(){return[this.scaleResolutionDownBy]}encodeWidths(){return[this.cameraWidth]}encodeHeights(){return[this.cameraHeight]}isSVCEncoding(){return this.isSVC}}},0x38bf5f74:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x5b4a3d7a)),w=class AllHighestVideoBandwidthPolicy{constructor(o){this.selfAttendeeId=o,this.reset()}reset(){this.optimalReceiveSet=new _.default,this.subscribedReceiveSet=new _.default,this.videoSources=void 0}updateIndex(o){this.videoIndex=o,this.optimalReceiveSet=this.calculateOptimalReceiveSet(o)}updateMetrics(o){}wantsResubscribe(){return!this.subscribedReceiveSet.equal(this.optimalReceiveSet)}chooseSubscriptions(){return this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveSet.clone()}chooseRemoteVideoSources(o){this.videoSources=o,this.optimalReceiveSet=this.calculateOptimalReceiveSet(this.videoIndex).clone()}calculateOptimalReceiveSet(o){let p=new _.default;if(!this.videoIndex||this.videoIndex.allStreams().empty())return p;let f=o.highestQualityStreamFromEachGroupExcludingSelf(this.selfAttendeeId),m=this.videoSources?this.videoSources:this.videoIndex.allVideoSendingSourcesExcludingSelf(this.selfAttendeeId),w=this.videoIndex.remoteStreamDescriptions(),I=new Map;for(let o of w)f.contain(o.streamId)&&I.set(o.attendeeId,o);let k=0;for(let o of m){let f=o.attendee.attendeeId;if(I.has(f)){let o=I.get(f);if(k+o.maxBitrateKbps<=AllHighestVideoBandwidthPolicy.maxReceiveBitrateKbps)p.add(o.streamId),k+=o.maxBitrateKbps;else{console.warn("total bitrate "+(k+o.maxBitrateKbps)+" exceeds maximum limit (15000). Use chooseRemoteVideoSources to select a subset of participants to avoid this.");break}}}return p}};p.default=w,w.maxReceiveBitrateKbps=15e3},0x2c8ecde:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x5b4a3d7a));p.default=class{reset(){}updateIndex(o){}updateMetrics(o){}wantsResubscribe(){return!1}chooseSubscriptions(){return new _.default}}},0x195076b25:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.TargetDisplaySize=void 0,(m=f=p.TargetDisplaySize||(p.TargetDisplaySize={}))[m.Low=0]="Low",m[m.Medium=1]="Medium",m[m.High=2]="High",m[m.Maximum=3]="Maximum",p.default=f},0x171bbd0a0:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x86facdd2)),w=m(f(0xf8b13aac)),I=m(f(0xdcca4e0f)),k=f(0xb8e111a8),M=m(f(0x1ea22295f)),x=m(f(0x206997fe9));p.default=class VideoAdaptiveProbePolicy extends M.default{constructor(o){super(o,VideoAdaptiveProbePolicy.createConfig()),this.logger=o,super.shouldPauseTiles=!1,this.videoPreferences=void 0}static createConfig(){let o=new x.default;return o.serverSideNetworkAdaption=w.default.None,o}reset(){super.reset(),super.shouldPauseTiles=!1,this.videoPreferences=void 0}updateIndex(o){super.updateIndex(o);let p=k.VideoPreferences.prepare(),f=!1;for(let m of o.remoteStreamDescriptions())p.some(o=>o.attendeeId===m.attendeeId)||(m.attendeeId.endsWith(_.default.Modality)?(p.add(new I.default(m.attendeeId,1)),f=!0):p.add(new I.default(m.attendeeId,2)));f?(this.videoPreferences=p.build(),this.videoPreferencesUpdated=!0):this.videoPreferences=void 0}chooseRemoteVideoSources(o){this.logger.error("chooseRemoteVideoSources should not be called by VideoAdaptiveProbePolicy")}}},0xdcca4e0f:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x195076b25)),w=m(f(0x5b9f0577)),I=class VideoPreference{constructor(o,p,f,m){this.attendeeId=o,this.priority=p,this.targetSize=void 0!==f?f:_.default.Maximum,this.degradationPreference=void 0!==m?m:w.default.Balanced}partialCompare(o){return this.priority-o.priority}equals(o){return this.attendeeId===o.attendeeId&&this.targetSize===o.targetSize&&this.priority===o.priority&&this.degradationPreference===o.degradationPreference}clone(){return new VideoPreference(this.attendeeId,this.priority,this.targetSize,this.degradationPreference)}targetSizeToBitrateKbps(o){switch(o){case _.default.Maximum:return VideoPreference.MAXIMUM_BITRATE_KBPS;case _.default.High:return VideoPreference.HIGH_BITRATE_KBPS;case _.default.Medium:return VideoPreference.MID_BITRATE_KBPS;case _.default.Low:return VideoPreference.LOW_BITRATE_KBPS}}};p.default=I,I.LOW_BITRATE_KBPS=300,I.MID_BITRATE_KBPS=600,I.HIGH_BITRATE_KBPS=1500,I.MAXIMUM_BITRATE_KBPS=1e4},0xb8e111a8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.VideoPreferences=p.MutableVideoPreferences=p.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=void 0;let _=m(f(0x1217c7f3f));p.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=function(o,p,f){if(void 0===o.transceiverController.getMidForGroupId||void 0===o.videoStreamIndex.attendeeIdForGroupId||void 0===f)return[];let m=[],w=new Map,I=new Map;for(let f of p){let p=o.transceiverController.getMidForGroupId(f);if(void 0===p)continue;let m=o.videoStreamIndex.attendeeIdForGroupId(f);w.set(m,p),I.set(m,f)}for(let o of f){let p=new _.default,f=w.get(o.attendeeId);void 0!==f&&(p.mid=f,p.attendeeId=o.attendeeId,p.groupId=I.get(o.attendeeId),void 0!==p.groupId&&(p.priority=Number.MAX_SAFE_INTEGER-o.priority,p.targetBitrateKbps=o.targetSizeToBitrateKbps(o.targetSize),p.qualityAdaptationPreference=o.degradationPreference,m.push(p)))}return m};let w=class ObjectSet{constructor(o=[]){this.items=o}static default(){return new ObjectSet([])}[Symbol.iterator](){let o=0,p=this.items;return{next:()=>o<p.length?{done:!1,value:p[o++]}:{done:!0,value:null}}}first(){return this.items[0]}add(o){this.items.push(o)}replaceFirst(o,p){let f=this.items.findIndex(p);-1===f?this.items.push(o):this.has(o)?this.items.splice(f,1):this.items[f]=o}remove(o){this.items=this.items.filter(p=>!p.equals(o))}clear(){this.items=[]}isEmpty(){return 0===this.items.length}equals(o){if(o===this)return!0;if(o.items.length!==this.items.length)return!1;for(let p of this.items)if(!o.items.some(o=>o.equals(p)))return!1;return!0}has(o){return this.items.some(p=>p.equals(o))}some(o){return this.items.some(o)}clone(){return new ObjectSet([...this.items])}sort(){this.items.sort((o,p)=>o.partialCompare(p))}modify(){return new I(this)}},I=class{constructor(o=new w){this.items=o,this.copied=!1}cow(){this.copied||(this.items=this.items.clone(),this.copied=!0)}add(o){this.items.has(o)||(this.cow(),this.items.add(o))}replaceFirst(o,p){(!this.items.has(o)||this.items.some(p))&&(this.cow(),this.items.replaceFirst(o,p))}remove(o){this.items.has(o)&&(this.cow(),this.items.remove(o))}some(o){return this.items.some(o)}clear(){this.items.isEmpty()||(this.cow(),this.items.clear())}build(){return this.copied&&this.items.sort(),this.copied=!1,this.items}},k=class{constructor(o){this.builder=o}add(o){this.builder.add(o)}replaceFirst(o,p){this.builder.replaceFirst(o,p)}remove(o){this.builder.remove(o)}some(o){return this.builder.some(o)}clear(){this.builder.clear()}build(){return new M(this.builder.build())}};p.MutableVideoPreferences=k;let M=class VideoPreferences{constructor(o){this.items=o}static prepare(){return new k(new I)}static default(){return new VideoPreferences(w.default())}[Symbol.iterator](){return this.items[Symbol.iterator]()}highestPriority(){var o;return null==(o=this.items.first())?void 0:o.priority}sorted(){return this.items[Symbol.iterator]()}equals(o){return o===this||this.items.equals(o.items)}modify(){return new k(this.items.modify())}some(o){return this.items.some(o)}isEmpty(){return this.items.isEmpty()}clone(){let o=VideoPreferences.prepare();for(let p of this.items)o.add(p.clone());return o.build()}};p.VideoPreferences=M,p.default=M},0x1ea22295f:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let k=I(f(0x977823e1)),M=I(f(0x243b8874c)),x=I(f(0xebe235e1)),O=I(f(0x86facdd2)),L=f(0x19a5566fd),B=w(f(0xf8b13aac)),U=I(f(0xe5d2d75f)),$=I(f(0x5b4a3d7a)),q=I(f(0x38bf5f74)),Z=I(f(0x195076b25)),ee=I(f(0xdcca4e0f)),et=f(0xb8e111a8),ei=I(f(0x206997fe9)),er=I(f(0x5b9f0577)),en=class{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}},eo=class VideoPriorityBasedPolicy{constructor(o,p=ei.default.Default){this.logger=o,this.videoPriorityBasedPolicyConfig=p,this.shouldPauseTiles=!0,this.observerQueue=new Set,this.pausedBwAttendeeIds=new Set,this.wantsResubscribeObserver=void 0,this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption===B.default.Default&&(this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption=B.default.BandwidthProbingAndRemoteVideoQualityAdaption),this.reset()}reset(){this.allHighestPolicy=new q.default(""),this.optimalReceiveSet=new $.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new $.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new $.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new en,this.prevDownlinkStats=new en,this.probeFailed=!1,this.serverSideNetworkAdaption=this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption,this.pendingActionAfterUpdatedPreferences=!1}bindToTileController(o){this.tileController=o,this.logger.info("tileController bound")}setWantsResubscribeObserver(o){this.wantsResubscribeObserver=o}chooseRemoteVideoSources(o){var p;if(null==(p=this.videoPreferences)||!p.equals(o)){if(this.videoPreferences=null==o?void 0:o.clone(),!B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)&&(this.pendingActionAfterUpdatedPreferences=!0,void 0!==this.wantsResubscribeObserver&&(this.wantsResubscribeObserver(),this.pendingActionAfterUpdatedPreferences=!1),this.serverSideNetworkAdaption===B.default.BandwidthProbingAndRemoteVideoQualityAdaption)){let o=[];for(let p of this.videoPreferences){let f=new U.default;f.attendee=new k.default,f.attendee.attendeeId=p.attendeeId,o.push(f)}this.allHighestPolicy.chooseRemoteVideoSources(o);return}this.videoPreferencesUpdated=!0,this.logger.info(`bwe: setVideoPreferences bwe: new preferences: ${JSON.stringify(o)}`)}}updateIndex(o){this.videoIndex=o,this.serverSideNetworkAdaption===B.default.BandwidthProbingAndRemoteVideoQualityAdaption&&this.allHighestPolicy.updateIndex(o),this.videoPreferences||this.updateDefaultVideoPreferences()}updateDefaultVideoPreferences(){let o=new Set;for(let p of this.videoIndex.remoteStreamDescriptions())o.add(p.attendeeId);let p=et.VideoPreferences.prepare(),f=o.size,m=Z.default.Maximum;for(let _ of(f>8?m=Z.default.Low:f>4&&(m=Z.default.Medium),o))p.add(new ee.default(_,1,m));this.defaultVideoPreferences=p.build()}updateMetrics(o){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new en;let p=o.getObservableMetrics();for(let f in this.downlinkStats.bandwidthEstimateKbps=p.availableIncomingBitrate/1e3,o.streamMetricReports){let p=Number.parseInt(f,10),m=o.streamMetricReports[p];m.direction===M.default.DOWNSTREAM&&m.mediaType===x.default.VIDEO&&(m.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=o.countPerSecond("nackCount",p)),m.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=o.countPerSecond("packetsLost",p)),m.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=o.bitsPerSecond("bytesReceived",p)/1e3))}}wantsResubscribe(){let o=!1;return B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)||(o||(o=this.pendingActionAfterUpdatedPreferences),this.serverSideNetworkAdaption!==B.default.BandwidthProbingAndRemoteVideoQualityAdaption)?(this.calculateOptimalReceiveSet(),o||(o=!this.subscribedReceiveSet.equal(this.optimalReceiveSet)),o):o||this.allHighestPolicy.wantsResubscribe()}chooseSubscriptions(){return B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)||(this.pendingActionAfterUpdatedPreferences=!1,this.serverSideNetworkAdaption!==B.default.BandwidthProbingAndRemoteVideoQualityAdaption)?(this.subscribedReceiveSet.equal(this.optimalReceiveSet)||(this.lastSubscribeTimestamp=Date.now()),this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveStreams=this.optimalReceiveStreams.slice(),this.subscribedReceiveSet.clone()):this.allHighestPolicy.chooseSubscriptions()}addObserver(o){this.observerQueue.add(o)}removeObserver(o){this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)o(p)}setVideoPriorityBasedPolicyConfigs(o){this.videoPriorityBasedPolicyConfig=o}calculateOptimalReceiveStreams(){var o;let p=[],f=this.videoIndex.remoteStreamDescriptions();if(0===f.length||(null==(o=this.videoPreferences)?void 0:o.isEmpty())){this.optimalReceiveStreams=[];return}let m=this.rateProbeState;this.cleanBwPausedTiles(f),this.handleAppPausedStreams(p,f);let _=new Map;for(let o of this.getCurrentVideoPreferences())_.set(o.attendeeId,o);let w=f.filter(o=>_.has(o.attendeeId)),I=!this.streamsWithPreferenceDidChange(w),k=!this.startupPeriod&&I;if(k&&Date.now()-this.lastSubscribeTimestamp<this.timeBeforeAllowSubscribeMs)return;for(let o of(w.sort((o,p)=>o.maxBitrateKbps===p.maxBitrateKbps?o.streamId-p.streamId:o.maxBitrateKbps-p.maxBitrateKbps),w))(0===o.avgBitrateKbps||o.avgBitrateKbps>o.maxBitrateKbps)&&(o.attendeeId.endsWith(O.default.Modality)&&o.maxBitrateKbps<100?o.maxBitrateKbps=o.avgBitrateKbps:o.avgBitrateKbps=o.maxBitrateKbps);let M=new Set;for(let o of this.getCurrentVideoPreferences()){let p,f=w.filter(p=>p.attendeeId===o.attendeeId);if(f.length<3)continue;let m=15,_=153600;for(let w of(f.forEach(o=>{m=Math.max(m,o.maxFrameRate),_=Math.max(_,o.totalPixels())}),f.sort((p,f)=>{if(o.degradationPreference===er.default.MaintainResolution)return 2>Math.abs(p.maxFrameRate-f.maxFrameRate)?p.totalPixels()-f.totalPixels():p.maxFrameRate-f.maxFrameRate;if(o.degradationPreference===er.default.MaintainFramerate)return p.totalPixels()===f.totalPixels()?p.maxFrameRate-f.maxFrameRate:p.totalPixels()-f.totalPixels();{let weighByFramerate=o=>o.avgBitrateKbps*Math.pow(2,5*o.maxFrameRate/m*Math.pow(4,o.totalPixels()/_));return weighByFramerate(p)-weighByFramerate(f)}}),f)){if(void 0!==p&&(w.maxFrameRate<p.maxFrameRate&&Math.abs(p.maxFrameRate-w.maxFrameRate)>2||w.totalPixels()<p.totalPixels())){M.add(w.streamId);continue}p=w}}let x=w.filter(o=>!M.has(o.streamId));this.logger.info(`Filtered to ${JSON.stringify(x)}`);let U={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};U.targetDownlinkBitrate=this.determineTargetRate();let $=this.subscribedReceiveSet.size(),q=this.downlinkStats.bandwidthEstimateKbps,Z=!this.videoPriorityBasedPolicyConfig.allowSubscribe($,q);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,k&&Z))return;let ee=this.priorityPolicy(U,x,p),et=!B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption),ei=0;if(et||this.startupPeriod||!I?(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0):"Probing"===this.rateProbeState?ei=this.handleProbe(p,U.targetDownlinkBitrate):0!==U.deltaToNextUpgrade&&(ei=this.maybeOverrideOrProbe(p,U,ee)),this.previousStreamsWithPreference=w,this.videoPreferencesUpdated=!1,1===ei){this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),this.prevTargetRateKbps=U.targetDownlinkBitrate;return}if(2===ei){let o=this.calculateSubscribeRate(this.preProbeNonPausedReceiveStreams);this.optimalReceiveStreams=this.preProbeReceiveStreams.slice(),this.processBwPausedStreams(w,this.preProbeNonPausedReceiveStreams),this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+o);return}this.optimalNonPausedReceiveStreams=p.slice();let en=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(w,p),this.logger.getLogLevel()<=L.LogLevel.INFO&&(this.logCount%15==0||this.rateProbeState!==m||this.optimalReceiveStreams.length!==p.length||en!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(f,U.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=U.targetDownlinkBitrate,this.optimalReceiveStreams=p.slice()}calculateOptimalReceiveSet(){let o=new $.default;for(let p of(this.calculateOptimalReceiveStreams(),this.optimalReceiveStreams))o.add(p.streamId);if(!this.optimalReceiveSet.equal(o)){let p=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(o)} subscribedRate:${p}`)}this.optimalReceiveSet=o}determineTargetRate(){let o=0,p=Date.now();return 0!==this.downlinkStats.bandwidthEstimateKbps?(0===this.firstEstimateTimestamp&&(this.firstEstimateTimestamp=p),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||p-this.firstEstimateTimestamp>VideoPriorityBasedPolicy.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?o=VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost<VideoPriorityBasedPolicy.SPURIOUS_PACKET_LOST_THRESHOLD?(this.logger.info(`bwe: In probe state, overriding estimate ${this.downlinkStats.bandwidthEstimateKbps} with actual receive bitrate ${this.downlinkStats.usedBandwidthKbps}`),o=this.downlinkStats.usedBandwidthKbps+VideoPriorityBasedPolicy.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS):o=this.downlinkStats.bandwidthEstimateKbps):o=0===this.firstEstimateTimestamp?VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS:this.prevTargetRateKbps,!this.startupPeriod&&(this.usingPrevTargetRate&&this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps||this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps*(100-VideoPriorityBasedPolicy.LARGE_RATE_CHANGE_TRIGGER_PERCENT)/100||this.downlinkStats.bandwidthEstimateKbps<this.downlinkStats.usedBandwidthKbps*VideoPriorityBasedPolicy.LARGE_RATE_CHANGE_TRIGGER_PERCENT/100)&&0===this.downlinkStats.packetsLost?(this.logger.debug(()=>"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps),this.usingPrevTargetRate=!0,o=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,o>15e3&&this.logger.warn("bwe: "+o+" exceeds maximum limit (15000). Limit TargetDisplaySize with VideoPreferences to avoid this."),Math.min(o,15e3)}setProbeState(o){if(this.rateProbeState===o)return!1;let p=Date.now();switch(o){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(0!==this.lastProbeTimestamp&&!(p-this.lastProbeTimestamp>VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS))return!1;this.probePendingStartTimestamp=p;break;case"Probing":if(!(p-this.probePendingStartTimestamp>this.timeBeforeAllowProbeMs))return!1;this.lastProbeTimestamp=p,this.preProbeReceiveStreams=this.subscribedReceiveStreams.slice(),this.preProbeNonPausedReceiveStreams=this.optimalNonPausedReceiveStreams,this.timeBeforeAllowProbeMs=Math.min(2*this.timeBeforeAllowProbeMs,VideoPriorityBasedPolicy.MAX_HOLD_BEFORE_PROBE_MS)}return this.logger.info("bwe: setProbeState to "+o+" from "+this.rateProbeState),this.rateProbeState=o,!0}upgradeToStream(o,p){for(let f=0;f<o.length;f++)if(o[f].groupId===p.groupId){let m=p.avgBitrateKbps-o[f].avgBitrateKbps;return this.logger.info("bwe: upgradeStream from "+JSON.stringify(o[f])+" to "+p),this.lastUpgradeRateKbps=m,o[f]=p,m}return o.push(p),this.lastUpgradeRateKbps=p.avgBitrateKbps,this.lastUpgradeRateKbps}handleProbe(o,p){if(Date.now()-this.lastProbeTimestamp>VideoPriorityBasedPolicy.MAX_ALLOWED_PROBE_TIME_MS)return this.logger.info("bwe: Canceling probe due to timeout"),this.setProbeState("Not Probing"),0;if(this.downlinkStats.packetsLost>0&&(this.logger.info(`bwe: Probe encountering packets lost:${this.downlinkStats.packetsLost}`),this.downlinkStats.packetsLost>VideoPriorityBasedPolicy.SPURIOUS_PACKET_LOST_THRESHOLD))return this.setProbeState("Not Probing"),this.logger.info(`bwe: Canceling probe due to packets lost:${this.downlinkStats.packetsLost}`),this.probeFailed=!0,this.timeBeforeAllowSubscribeMs=3*Math.max(VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.timeBeforeAllowSubscribeMs),2;let f=this.calculateSubscribeRate(this.optimalReceiveStreams);return this.chosenStreamsSameAsLast(o)||p>f?(this.logger.info("bwe: Probe successful"),this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(o,p,f){let m=this.chosenStreamsSameAsLast(o),_=0,w=p.targetDownlinkBitrate>VideoPriorityBasedPolicy.LOW_BITRATE_THRESHOLD_KBPS?VideoPriorityBasedPolicy.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*VideoPriorityBasedPolicy.TARGET_RATE_CHANGE_TRIGGER_PERCENT,I=p.targetDownlinkBitrate*w/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!m&&Math.abs(p.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)<I?(this.logger.info("bwe: MaybeOverrideOrProbe: Reuse last decision based on delta rate. {"+JSON.stringify(this.subscribedReceiveSet)+"}"),_=1):this.targetRateBaselineForDeltaCheckKbps=p.targetDownlinkBitrate,this.downlinkStats.packetsLost>this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,_;if(m||1===_)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(o,f),_=0)}else this.setProbeState("Not Probing");return _}calculateSubscribeRate(o){let p=0;for(let f of o)this.pausedStreamIds.contain(f.streamId)||this.pausedBwAttendeeIds.has(f.attendeeId)||(p+=f.maxBitrateKbps);return p}handleAppPausedStreams(o,p){if(!this.tileController)return void this.logger.warn("tileController not found!");for(let f of(this.pausedStreamIds=new $.default,this.tileController.getAllRemoteVideoTiles())){let m=f.state();if(m.paused&&!this.pausedBwAttendeeIds.has(m.boundAttendeeId)){let f=p.length;for(;f--;)p[f].attendeeId===m.boundAttendeeId&&(this.logger.info("bwe: removed paused attendee "+m.boundAttendeeId+" streamId: "+p[f].streamId),this.pausedStreamIds.add(p[f].streamId),this.subscribedReceiveSet.contain(p[f].streamId)&&o.push(p[f]),p.splice(f,1))}}}processBwPausedStreams(o,p){if(!this.tileController)return void this.logger.warn("tileController not found!");let f=this.getCurrentVideoPreferences();if(f&&this.shouldPauseTiles){let m=this.tileController.getAllVideoTiles();for(let _ of f){let f=this.getVideoTileForAttendeeId(_.attendeeId,m),w=(null==f?void 0:f.state().paused)||!1;if(p.some(o=>o.attendeeId===_.attendeeId))w&&this.pausedBwAttendeeIds.has(_.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${_.attendeeId} due to bandwidth`),this.forEachObserver(o=>{o.tileWillBeUnpausedByDownlinkPolicy(f.id())}),this.tileController.unpauseVideoTile(f.id()),this.pausedBwAttendeeIds.delete(_.attendeeId));else{let m=o.some(o=>o.attendeeId===_.attendeeId);if(f&&m){let o=this.optimalReceiveStreams.find(o=>o.attendeeId===_.attendeeId);void 0!==o&&(w||(this.logger.info(`bwe: pausing streamId ${o.streamId} attendee ${_.attendeeId} due to bandwidth`),this.forEachObserver(o=>{o.tileWillBePausedByDownlinkPolicy(f.id())}),this.tileController.pauseVideoTile(f.id())),p.push(o)),this.pausedBwAttendeeIds.add(_.attendeeId)}else if(m){let o=this.tileController.addVideoTile();o.bindVideoStream(_.attendeeId,!1,null,0,0,0,null),this.forEachObserver(p=>{p.tileWillBePausedByDownlinkPolicy(o.id())}),o.pause(),this.logger.info(`bwe: Created video tile ${o.id()} for bw paused attendee ${_.attendeeId}`),this.pausedBwAttendeeIds.add(_.attendeeId)}}}}}cleanBwPausedTiles(o){if(!this.tileController)return void this.logger.warn("tileController not found!");let p=this.tileController.getAllRemoteVideoTiles(),f=this.getCurrentVideoPreferences();for(let m of p){let p=m.state();!p.boundVideoStream&&(o.some(o=>o.attendeeId===p.boundAttendeeId)?void 0===f||f.some(o=>o.attendeeId===p.boundAttendeeId)||this.tileController.removeVideoTile(p.tileId):(this.tileController.removeVideoTile(p.tileId),this.logger.info(`bwe: Removed video tile ${p.tileId} for bw paused attendee ${p.boundAttendeeId}`)))}}priorityPolicy(o,p,f){let m,_,w=this.getCurrentVideoPreferences(),I=w.highestPriority(),k=I;for(;-1!==k;){for(let I of(_=-1,w))if(I.priority===k)for(let _ of p)_.attendeeId!==I.attendeeId||f.some(o=>o.groupId===_.groupId)||(o.chosenTotalBitrate+_.avgBitrateKbps<=o.targetDownlinkBitrate?(f.push(_),o.chosenTotalBitrate+=_.avgBitrateKbps):0===o.deltaToNextUpgrade&&(o.deltaToNextUpgrade=_.avgBitrateKbps,m=_));else if(I.priority>k){_=I.priority;break}for(let _ of w)if(_.priority===k){for(let w of p)if(w.attendeeId===_.attendeeId){let I=f.findIndex(o=>o.groupId===w.groupId&&o.maxBitrateKbps<=w.maxBitrateKbps&&o.avgBitrateKbps<w.avgBitrateKbps);if(-1!==I){let k=w.avgBitrateKbps-f[I].avgBitrateKbps;this.hasSimulcastStreams(p,w.attendeeId,w.groupId)&&this.canUpgrade(w.avgBitrateKbps,_.targetSize,_.targetSizeToBitrateKbps(_.targetSize),w.attendeeId.endsWith(O.default.Modality))?(this.logger.info(`bwe: attendee: ${w.attendeeId} group: ${w.groupId} has simulcast and can upgrade avgBitrate: ${w.avgBitrateKbps} target: ${_.targetSizeToBitrateKbps(_.targetSize)} targetTotalBitrate: ${o.targetDownlinkBitrate}`),o.chosenTotalBitrate+k<=o.targetDownlinkBitrate?(o.chosenTotalBitrate+=k,f[I]=w):0===o.deltaToNextUpgrade&&(o.deltaToNextUpgrade=k,m=w)):this.logger.info("bwe: cannot upgrade stream quality beyond target size")}}}else if(_.priority>k)break;if(k===I&&0!==o.deltaToNextUpgrade)break;k=_}return m}getVideoTileForAttendeeId(o,p){for(let f of p)if(f.state().boundAttendeeId===o)return f;return null}canUpgrade(o,p,f,m){let _=!1;return(p===Z.default.High||!m&&o<=f?_=!0:m&&p===Z.default.Medium&&o<=f&&(_=!0),_)?(this.logger.info(`bwe: canUpgrade: bitrateKbps: ${o} targetBitrateKbps: ${f}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbps: ${o} targetBitrateKbps: ${f}`),!1)}hasSimulcastStreams(o,p,f){let m=0;for(let _ of o)_.attendeeId===p&&_.groupId===f&&m++;return this.logger.info(`bwe: attendeeId: ${p} groupId: ${f} hasSimulcastStreams: streamCount: ${m}`),m>1}streamsWithPreferenceDidChange(o){if(void 0===this.previousStreamsWithPreference||o.length!==this.previousStreamsWithPreference.length||!0===this.videoPreferencesUpdated)return!0;for(let p of o)if(void 0===this.previousStreamsWithPreference.find(o=>o.groupId===p.groupId&&o.streamId===p.streamId&&o.maxBitrateKbps===p.maxBitrateKbps))return!0;return!1}chosenStreamsSameAsLast(o){if(this.optimalNonPausedReceiveStreams.length!==o.length)return!1;for(let p of this.optimalNonPausedReceiveStreams)if(!o.some(o=>o.streamId===p.streamId))return!1;return!0}policyStateLogStr(o,p){let f={targetBitrate:p,subscribedRate:this.calculateSubscribeRate(this.optimalReceiveStreams),probeState:this.rateProbeState,startupPeriod:this.startupPeriod},m="remoteInfos: [";for(let p of o)m+=`{grpId:${p.groupId} strId:${p.streamId} maxBr:${p.maxBitrateKbps} avgBr:${p.avgBitrateKbps}}, `;m+="]";let _=`bwe: optimalReceiveSet ${JSON.stringify(f)}
bwe:   prev ${JSON.stringify(this.prevDownlinkStats)}
bwe:   now  ${JSON.stringify(this.downlinkStats)}
bwe:   ${m}
`;return(this.pausedStreamIds.size()>0||this.pausedBwAttendeeIds.size>0)&&(_+=`bwe:   paused: app stream ids ${JSON.stringify(this.pausedStreamIds)}  bw attendees { ${Array.from(this.pausedBwAttendeeIds).join(" ")} }
`),this.videoPreferences?_+=`bwe:   preferences: ${JSON.stringify(this.videoPreferences)}`:_+=`bwe:   default preferences: ${JSON.stringify(this.defaultVideoPreferences)}`,_}getCurrentVideoPreferences(){return this.videoPreferences||this.defaultVideoPreferences}getServerSideNetworkAdaption(){return this.serverSideNetworkAdaption}setServerSideNetworkAdaption(o){this.serverSideNetworkAdaption=o,this.setProbeState("Not Probing")}supportedServerSideNetworkAdaptions(){return[B.default.None,B.default.BandwidthProbing,B.default.BandwidthProbingAndRemoteVideoQualityAdaption]}getVideoPreferences(){let o=this.getCurrentVideoPreferences();return o||(o=et.VideoPreferences.prepare().build()),o}wantsAllTemporalLayersInIndex(){return!0}};p.default=eo,eo.DEFAULT_BANDWIDTH_KBPS=2800,eo.STARTUP_PERIOD_MS=6e3,eo.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,eo.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,eo.LOW_BITRATE_THRESHOLD_KBPS=300,eo.MIN_TIME_BETWEEN_PROBE_MS=5e3,eo.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,eo.MAX_HOLD_BEFORE_PROBE_MS=3e4,eo.MAX_ALLOWED_PROBE_TIME_MS=6e4,eo.SPURIOUS_PACKET_LOST_THRESHOLD=2,eo.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100},0x206997fe9:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf8b13aac)),w=class VideoPriorityBasedPolicyConfig{constructor(o=0,p=0){this.networkIssueResponseDelayFactor=o,this.networkIssueRecoveryDelayFactor=p,this.currentNetworkEvent=0,this.bandwidthDecreaseTimestamp=0,this.referenceBitrate=0,this.serverSideNetworkAdaption=_.default.BandwidthProbingAndRemoteVideoQualityAdaption,o<0?o=0:o>1&&(o=1),this.networkIssueResponseDelayFactor=o,p<0?p=0:p>1&&(p=1),this.networkIssueRecoveryDelayFactor=p}allowSubscribe(o,p){let f=0,m=this.currentNetworkEvent;if(p>this.referenceBitrate)return this.currentNetworkEvent=2,this.referenceBitrate=p,!0;if(!(p<this.referenceBitrate))return this.currentNetworkEvent=0,!1;if(this.currentNetworkEvent=1,f=this.getSubscribeDelay(this.currentNetworkEvent,o),1!==m)this.bandwidthDecreaseTimestamp=Date.now();else if(Date.now()-this.bandwidthDecreaseTimestamp>f)return this.referenceBitrate=p,!0;return!1}getSubscribeDelay(o,p){let f=VideoPriorityBasedPolicyConfig.MINIMUM_DELAY_MS,m=VideoPriorityBasedPolicyConfig.MAXIMUM_DELAY_MS-VideoPriorityBasedPolicyConfig.MINIMUM_DELAY_MS,_=this.networkIssueResponseDelayFactor;return 1===o&&(f+=m*_*(1+p/10),f=Math.min(VideoPriorityBasedPolicyConfig.MAXIMUM_DELAY_MS,f)),f}};p.default=w,w.MINIMUM_DELAY_MS=2e3,w.MAXIMUM_DELAY_MS=8e3,w.Default=new w(0,0),w.UnstableNetworkPreset=new w(0,1),w.StableNetworkPreset=new w(1,0)},0x5b9f0577:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoQualityAdaptationPreference=void 0,(m=f=p.VideoQualityAdaptationPreference||(p.VideoQualityAdaptationPreference={}))[m.Balanced=0]="Balanced",m[m.MaintainFramerate=1]="MaintainFramerate",m[m.MaintainResolution=2]="MaintainResolution",p.default=f},0x22bbb4e3f:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{create(){let o={clientWidth:400,clientHeight:300,width:400,height:300,videoWidth:400,videoHeight:300,style:{transform:""},hasAttribute:()=>!1,removeAttribute:()=>{},setAttribute:()=>{},srcObject:!1,paused:!0,pause:()=>{o.paused=!0},play:()=>(o.paused=!1,Promise.resolve())};return o}}},0x8cc00a0b:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.canvas=o,this.destroyed=!1}destroy(){this.canvas=null,this.destroyed=!0}asCanvasImageSource(){return f(this,void 0,void 0,function*(){return this.destroyed?Promise.reject("canvas buffer is destroyed"):Promise.resolve(this.canvas)})}asCanvasElement(){return this.canvas}}},0x20f5ac25c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x8cc00a0b)),I=_(f(0x86cb8dc3));p.default=class{constructor(o,p,f=new I.default){this.logger=o,this.stages=p,this.fr=15,this.outputMediaStream=new MediaStream,this.videoInput=document.createElement("video"),this.canvasOutput=document.createElement("canvas"),this.outputCtx=this.canvasOutput.getContext("2d"),this.canvasInput=document.createElement("canvas"),this.inputCtx=this.canvasInput.getContext("2d"),this.inputVideoStream=null,this.sourceBuffers=[],this.destBuffers=[],this.observers=new Set,this.hasStarted=!1,this.process=o=>m(this,void 0,void 0,function*(){let o;if(!this.inputVideoStream)return;let p=performance.now();this.videoInput.videoWidth&&(this.canvasInput.width!==this.videoInput.videoWidth&&(this.canvasInput.width=this.videoInput.videoWidth,this.canvasInput.height=this.videoInput.videoHeight,this.sourceBuffers[0].height=this.canvasInput.height,this.sourceBuffers[0].width=this.canvasInput.width,this.sourceBuffers[0].framerate=this.framerate),this.inputCtx.drawImage(this.videoInput,0,0));let f=[];f.push(this.sourceBuffers[0]);try{for(let o of this.processors)f=yield o.process(f)}catch{this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()});return}this.destBuffers=f;try{o=yield this.destBuffers[0].asCanvasImageSource()}catch{this.inputVideoStream&&(this.logger.info("buffers are destroyed and pipeline could not start"),this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()}));return}let m=o.width,_=o.height;0!==m&&0!==_&&(this.canvasOutput.width!==m&&this.canvasOutput.height!==_&&(this.canvasOutput.width=m,this.canvasOutput.height=_),this.outputCtx.drawImage(o,0,0,m,_,0,0,m,_),this.hasStarted||(this.hasStarted=!0,this.forEachObserver(o=>{o.processingDidStart&&o.processingDidStart()})));let w=performance.now()-p,I=2e3/this.framerate-w,k=Math.max(0,1e3/this.framerate-w);I<=0&&this.forEachObserver(o=>{o.processingLatencyTooHigh&&o.processingLatencyTooHigh(w)}),yield this.timer.start(k,this.process.bind(this))}),this.timer=f}destroy(){if(this.stop(),this.stages)for(let o of this.stages)o.destroy();this.timer.destroy()}get framerate(){return this.fr}set framerate(o){this.fr=o<0||void 0===o?15:o}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(let o of this.outputMediaStream.getVideoTracks())o.stop();this.hasStarted&&(this.hasStarted=!1,this.forEachObserver(o=>{o.processingDidStop&&o.processingDidStop()}))}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}getInputMediaStream(){return m(this,void 0,void 0,function*(){return this.inputVideoStream})}getActiveOutputMediaStream(){return this.isOutputMediaStreamActive()||(this.outputMediaStream=this.canvasOutput.captureStream(this.framerate),this.cloneInputAudioTracksToOutput()),this.outputMediaStream}setInputMediaStream(o){return m(this,void 0,void 0,function*(){if(!o)return void this.stop();if(0===o.getVideoTracks().length)return void this.logger.error("No video tracks in input media stream, ignoring");this.inputVideoStream=o;let p=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${JSON.stringify(p)}`),this.framerate=p.frameRate,this.canvasOutput.width=p.width,this.canvasOutput.height=p.height,this.videoInput.addEventListener("loadedmetadata",this.process),this.videoInput.srcObject=this.inputVideoStream,this.videoInput.setAttribute("playsinline","true");let f=new w.default(this.canvasInput);this.sourceBuffers.push(f),this.videoInput.load();try{yield this.videoInput.play()}catch{this.logger.warn("Video element play() overrided by another load().")}this.cloneInputAudioTracksToOutput()})}cloneInputAudioTracksToOutput(){if(!this.isOutputMediaStreamActive()||null===this.inputVideoStream)return void this.logger.info("Not cloning input audio tracks to output, do not have media streams ready");for(let o of this.outputMediaStream.getAudioTracks())this.logger.info(`Removing audio track ${o.id} from output stream`),this.outputMediaStream.removeTrack(o);for(let o of this.inputVideoStream.getAudioTracks())this.logger.info(`Adding audio track ${o.id} to output stream`),this.outputMediaStream.addTrack(o)}isOutputMediaStreamActive(){return this.outputMediaStream&&this.outputMediaStream.active}set processors(o){this.stages=o}get processors(){return this.stages}forEachObserver(o){for(let p of this.observers)setTimeout(()=>{o(p)},0)}destroyInputMediaStreamAndBuffers(){if(this.inputVideoStream)for(let o of this.inputVideoStream.getTracks())o.stop();for(let o of(this.inputVideoStream=null,this.sourceBuffers))o.destroy();this.sourceBuffers=[]}}},0x86cb8dc3:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.workerTimer=void 0,this.callback=void 0,this.workerTimer=this.createWorkerTimer()}createWorkerTimer(){try{let o=new Blob([`self.onmessage = async function(e){ 
            var timerID = null;
            const awaitTimeout = delay => new Promise( resolve => {
              timerID = setTimeout(resolve, delay);
            })
            await awaitTimeout(e.data);
            postMessage(timerID);
          }`],{type:"application/javascript"});return new Worker(window.URL.createObjectURL(o))}catch{}}start(o,p){return f(this,void 0,void 0,function*(){this.callback=p,this.workerTimer?(this.workerTimer.onmessage=o=>{this.lastTimeout=o.data,this.callback()},this.workerTimer.postMessage(o)):this.lastTimeout=setTimeout(()=>{this.callback()},o)})}destroy(){return f(this,void 0,void 0,function*(){this.callback=void 0,this.lastTimeout&&(clearTimeout(this.lastTimeout),this.lastTimeout=void 0),this.workerTimer&&(this.workerTimer.terminate(),this.workerTimer=void 0)})}}},0xd9718ba1:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x20f5ac25c));p.default=class DefaultVideoTransformDevice{constructor(o,p,f,m=new w.default){this.logger=o,this.device=p,this.processors=f,this.browserBehavior=m,this.observers=new Set,this.pipe=new I.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}passEventControllerToProcessors(o){if(this.pipe.processors)for(let p of this.pipe.processors)"function"==typeof p.setEventController&&p.setEventController(o)}chooseNewInnerDevice(o){let p=new DefaultVideoTransformDevice(this.logger,o,this.processors,this.browserBehavior);return p.pipe=this.pipe,p}getInnerDevice(){return this.device}intrinsicDevice(){return m(this,void 0,void 0,function*(){return this.device})}transformStream(o){return m(this,void 0,void 0,function*(){return yield this.pipe.setInputMediaStream(o),this.inputMediaStream=o,this.pipe.getActiveOutputMediaStream()})}onOutputStreamDisconnect(){this.logger.info("DefaultVideoTransformDevice: detach stopping input media stream");let o=this.device&&this.device.id;if(this.pipe.stop(),!o&&this.inputMediaStream)for(let o of this.inputMediaStream.getVideoTracks())o.stop()}stop(){return m(this,void 0,void 0,function*(){if(this.inputMediaStream)for(let o of this.inputMediaStream.getVideoTracks())o.stop();this.pipe.destroy(),this.inputMediaStream=null})}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}processingDidStart(){this.logger.info("video transform device processing started"),this.forEachObserver(o=>{o.processingDidStart&&o.processingDidStart()})}processingLatencyTooHigh(o){this.forEachObserver(p=>{p.processingLatencyTooHigh&&p.processingLatencyTooHigh(o)})}processingDidFailToStart(){this.logger.info("video transform device processing failed to start"),this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()})}processingDidStop(){this.logger.info("video transform device processing stopped"),this.forEachObserver(o=>{o.processingDidStop&&o.processingDidStop()})}forEachObserver(o){for(let p of this.observers)setTimeout(()=>{o(p)},0)}get framerate(){return this.pipe.framerate}set framerate(o){this.pipe.framerate=o}}},0x84671e3f:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{process(o){return f(this,void 0,void 0,function*(){return o})}destroy(){return f(this,void 0,void 0,function*(){})}}},0xabb871f6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.DeferredPromise=void 0,p.DeferredPromise=class{constructor(){this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}getPromise(){return this.promise}resolvePromise(o){this.resolve(o)}resolveAndReplacePromise(o){this.resolve(o),this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}rejectPromise(o){this.reject(o)}rejectAndReplacePromise(o){this.reject(o),this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}}},0x8012092c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.VideoFxCanvasOpsManager=void 0;let _=f(0x23955cc68);p.VideoFxCanvasOpsManager=class{constructor(o,p){this.streamParameters=o,this.outputCanvas=p,this.configureCanvasPipeline()}getInferenceInputData(o){return this.inferenceCtx.save(),this.inferenceCtx.scale(this.horizontalResizeScalar,this.verticalResizeScalar),this.inferenceCtx.drawImage(o,0,0),this.inferenceCtx.restore(),this.inferenceCtx.getImageData(0,0,_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS)}configureForStreamParameters(o){return m(this,void 0,void 0,function*(){if(this.streamParameters=o,this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.backgroundReplacementCanvas){let o=document.createElement("canvas");o.width=this.streamParameters.width,o.height=this.streamParameters.height,o.getContext("2d").drawImage(this.backgroundReplacementCanvas,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=o}this.configureCanvasPipeline()})}configureCanvasPipeline(){this.inferenceCanvas=document.createElement("canvas"),this.inferenceCtx=this.inferenceCanvas.getContext("2d",{willReadFrequently:!0}),this.inferenceCanvas.width=_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,this.inferenceCanvas.height=_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.horizontalResizeScalar=_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS/this.streamParameters.width,this.verticalResizeScalar=_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS/this.streamParameters.height}getBackgroundReplacementCanvas(){return this.backgroundReplacementCanvas}loadReplacementBackground(o){return m(this,void 0,void 0,function*(){let p=o.backgroundReplacement.backgroundImageURL,f=o.backgroundReplacement.defaultColor;if(p)try{let o=yield this.loadImage(p);this.backgroundReplacementImage=o,this.resizeAndSetReplacementImage(this.backgroundReplacementImage)}catch(o){throw this.logger.error(o),Error("Failed to set the replacement image.")}else this.resizeAndSetReplacementColor(f)})}resizeAndSetReplacementImage(o){let p=document.createElement("canvas"),f=p.getContext("2d");p.width=this.streamParameters.width,p.height=this.streamParameters.height,f.drawImage(o,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=p}resizeAndSetReplacementColor(o){let p=document.createElement("canvas"),f=p.getContext("2d");p.width=this.streamParameters.width,p.height=this.streamParameters.height,f.fillStyle=o,f.fillRect(0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=p}loadImage(o){return m(this,void 0,void 0,function*(){let p=yield fetch(o).catch(o=>{throw this.logger.error(o.toString()),Error("Failed to fetch image.")}),f=yield p.blob(),m=new Image;return m.src=URL.createObjectURL(f),new Promise((o,p)=>{m.onload=()=>{o(m)},m.onerror=o=>{p(o)}})})}}},0x23955cc68:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_FX_SPEC=p.FXLIB_PATH=p.WORKER_PATH=p.CDN_BASE_PATH=p.RESOURCE_CONSTRAINTS=p.SEGMENTATION_MODEL=p.DEFAULT_STREAM_PARAMETERS=p.WORKER_MSG=void 0,p.WORKER_MSG={BUILD_ENGINE_REQUEST:"BuildEngineRequest",BUILD_ENGINE_RESPONSE:"BuildEngineResponse",PERFORM_SEGMENTATION_REQUEST:"PerformSegmentationRequest",PERFORM_SEGMENTATION_RESPONSE:"PerformSegmentationResponse",PERFORM_SEGMENTATION_SAB_REQUEST:"PerformSegmentationSABRequest",PERFORM_SEGMENTATION_SAB_RESPONSE:"PerformSegmentationSABResponse",DESTROY_ASSETS_REQUEST:"DestroyAssetsRequest",DESTROY_ASSETS_RESPONSE:"DestroyAssetsResponse",CLOSE_WORKER_REQUEST:"CloseWorkerRequest"},p.DEFAULT_STREAM_PARAMETERS={FRAMES_PER_SECOND:15,WIDTH_IN_PIXEL:960,HEIGHT_IN_PIXEL:540,CHANNEL_COUNT:4},p.SEGMENTATION_MODEL={LOAD_SUCCESS:2,WIDTH_IN_PIXELS:176,HEIGHT_IN_PIXELS:160},p.RESOURCE_CONSTRAINTS={DEFAULT_PROCESSING_BUDGET_PER_FRAME:50,SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION:1,SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT:500,BLUR_DEFAULT_CYCLE_PERCENTAGE:10,BLUR_SAMPLING_PERIOD_FRAME_COUNT:1e3,MIN_PROCESSING_BUDGET:0,MAX_PROCESSING_BUDGET:100},p.CDN_BASE_PATH="https://static.sdkassets.chime.aws";let f="/ml_media_fx/otherassets";p.WORKER_PATH=`${f}/worker.js`,p.FXLIB_PATH=`${f}/fxlib.js`,p.DEFAULT_VIDEO_FX_SPEC={paths:{cdnBasePath:p.CDN_BASE_PATH,workerPath:p.WORKER_PATH,fxLibPath:p.FXLIB_PATH}}},0x14b0f3819:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x6cf4e7cb),I=f(0x1e62759b2),k=f(0x1676280b0),M=_(f(0x9a4430b2)),x=_(f(0xf05a6831)),O=f(0xb79a45b7),L=_(f(0x22a0f7c69)),B=_(f(0x8cc00a0b)),U=f(0xabb871f6),$=f(0x8012092c),q=f(0x23955cc68),Z=f(0x1d603096a),ee=class VideoFxProcessor{constructor(o,p=q.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,f){this.logger=o,this.outputCanvas=document.createElement("canvas"),this.canvasVideoFrameBuffer=new B.default(this.outputCanvas),this.videoFxSpec=q.DEFAULT_VIDEO_FX_SPEC;try{this.validateProcessingBudgetPerFrame(p)}catch(o){throw this.logger.error(o),Error(`Cannot instantiate VideoFxProcessor due to invalid processingBudgetPerFrame of ${p}`)}f&&(this.eventController=f),this.effectConfig={backgroundBlur:{isEnabled:!1,strength:"low"},backgroundReplacement:{isEnabled:!1,backgroundImageURL:null,defaultColor:"black"}},this.segmentationRequestPromise=new U.DeferredPromise,this.segmentationRateManager=new Z.VideoFxSegmentationRateManager(this.logger,p),this.streamParameters={framerate:q.DEFAULT_STREAM_PARAMETERS.FRAMES_PER_SECOND,width:q.DEFAULT_STREAM_PARAMETERS.WIDTH_IN_PIXEL,height:q.DEFAULT_STREAM_PARAMETERS.HEIGHT_IN_PIXEL,channels:q.DEFAULT_STREAM_PARAMETERS.CHANNEL_COUNT},VideoFxProcessor.isSharedArrayBufferSupported&&(this.sharedImageBuffer=new SharedArrayBuffer(q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS*q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS*this.streamParameters.channels),this.sharedImageData=new Uint8ClampedArray(this.sharedImageBuffer)),this.logger.info(`VideoFx supports Shared Array Buffer: ${VideoFxProcessor.isSharedArrayBufferSupported}`),this.canvasOpsManager=new $.VideoFxCanvasOpsManager(this.streamParameters,this.outputCanvas),this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.segmentationMask=new ImageData(this.streamParameters.width,this.streamParameters.height),this.logger.info(`VideoFxProcessor instantiated with a processingBudgetPerFrame of ${p}`)}process(o){return m(this,void 0,void 0,function*(){return o})}fxProcess(o){return m(this,void 0,void 0,function*(){let p=o[0].asCanvasElement();this.didStreamParametersChange(p)&&(yield this.adjustProcessorForNewStreamParameters(p));try{yield this.manageSegmentationMask(p)}catch(o){throw this.logger.error(o),Error("Video stream could not be processed")}return yield this.renderer.render(p,this.segmentationMask),o[0]=this.canvasVideoFrameBuffer,o})}noOpProcess(o){return m(this,void 0,void 0,function*(){return o})}didStreamParametersChange(o){return o.width!==this.streamParameters.width||o.height!==this.streamParameters.height}adjustProcessorForNewStreamParameters(o){return m(this,void 0,void 0,function*(){this.streamParameters.width=o.width,this.streamParameters.height=o.height,yield this.canvasOpsManager.configureForStreamParameters(this.streamParameters),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,this.effectConfig)})}destroy(){return m(this,void 0,void 0,function*(){this.canvasVideoFrameBuffer.destroy(),this.fxLibScript&&this.fxLibScript.parentNode&&this.fxLibScript.parentNode.removeChild(this.fxLibScript),this.engineWorker&&(this.destroyedAssetsPromise=new U.DeferredPromise,this.engineWorker.postMessage({msg:q.WORKER_MSG.DESTROY_ASSETS_REQUEST}),yield this.destroyedAssetsPromise.getPromise(),this.engineWorker.postMessage({msg:q.WORKER_MSG.CLOSE_WORKER_REQUEST})),this.logger.info("VideoFxProcessor destroyed.")})}manageSegmentationMask(o){return m(this,void 0,void 0,function*(){try{if(this.segmentationRateManager.submitFrame(),this.segmentationRateManager.shouldApplySegmentation()){this.segmentationRateManager.startSegmentation();let p=this.canvasOpsManager.getInferenceInputData(o);this.segmentationMask=yield this.generateSegmentationMask(p),this.segmentationRateManager.completeSegmentation()}}catch(o){throw this.logger.error(o.toString()),Error("Can not properly manage the returned segmentation mask")}})}generateSegmentationMask(o){return m(this,void 0,void 0,function*(){VideoFxProcessor.isSharedArrayBufferSupported?(this.sharedImageData.set(o.data),this.engineWorker.postMessage({msg:q.WORKER_MSG.PERFORM_SEGMENTATION_SAB_REQUEST,payload:this.sharedImageBuffer})):this.engineWorker.postMessage({msg:q.WORKER_MSG.PERFORM_SEGMENTATION_REQUEST,payload:o},[o.data.buffer]);try{return yield this.segmentationRequestPromise.getPromise()}catch(o){throw this.logger.error(o.toString()),Error("Segmentation mask could not be generated")}})}cloneConfigFrom(o){return{backgroundBlur:{isEnabled:o.backgroundBlur.isEnabled,strength:o.backgroundBlur.strength},backgroundReplacement:{isEnabled:o.backgroundReplacement.isEnabled,backgroundImageURL:o.backgroundReplacement.backgroundImageURL,defaultColor:o.backgroundReplacement.defaultColor}}}setVideoFxSpec(o){o.paths&&(this.videoFxSpec.paths=o.paths)}setEffectConfig(o){return m(this,void 0,void 0,function*(){if(this.sameVideoFxConfig(o,this.effectConfig))return;let p=this.cloneConfigFrom(o);try{yield this.validateEffectConfig(p)}catch(o){throw this.logger.error(o.toString()),Error("Provided effect config is invalid, not updating VideoFxProcessor")}p.backgroundReplacement.isEnabled&&(yield this.canvasOpsManager.loadReplacementBackground(p),yield this.renderer.setBackgroundReplacementCanvas(this.canvasOpsManager.getBackgroundReplacementCanvas())),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,p),this.effectConfig=p,this.effectConfig.backgroundBlur.isEnabled||this.effectConfig.backgroundReplacement.isEnabled?this.process=this.fxProcess:this.process=this.noOpProcess,this.logger.info(`VideoFxProcessor effect configuration updated to: ${JSON.stringify(this.effectConfig)}`),this.eventController&&this.publishVideoFxConfigEvent()})}validateEffectConfig(o){return m(this,void 0,void 0,function*(){if(o.backgroundBlur.isEnabled&&o.backgroundReplacement.isEnabled)throw Error("Invalid VideoFx configuration: Background Blur and Background Replacement can not both be enabled");o.backgroundReplacement.isEnabled&&(yield this.validateReplacementConfig(o))})}validateReplacementConfig(o){return m(this,void 0,void 0,function*(){if(o.backgroundReplacement.backgroundImageURL&&o.backgroundReplacement.defaultColor)throw Error("Invalid VideoFx configuration: Background Replacement can not have both an image URL and default color");if(!o.backgroundReplacement.backgroundImageURL&&!o.backgroundReplacement.defaultColor)throw Error("Invalid VideoFx configuration: Background Replacement image URL and default can not both be null/undefined");try{o.backgroundReplacement.backgroundImageURL&&(yield this.canvasOpsManager.loadImage(o.backgroundReplacement.backgroundImageURL))}catch(o){throw this.logger.error(o.toString()),Error("Invalid VideoFx configuration: backgroundImageURL failed to load")}let p=o.backgroundReplacement.defaultColor;if(p&&"black"!==p&&"#000000"!==p&&"#000"!==p){if(p.includes("#")&&!new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).test(p))throw Error(`Invalid hexadecimal color code for default replacement background: ${p}`);let o=document.createElement("canvas").getContext("2d"),f=o.fillStyle;if(o.fillStyle=p,o.fillStyle===f)throw Error(`Invalid color for default replacement background: ${p}`)}})}validateProcessingBudgetPerFrame(o){if(o<q.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET||o>q.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET)throw Error(`Invalid resource constraint: cycle percentage must be within range of ${q.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET} and ${q.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET}`)}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("Loading required assets for the VideoFxProcessor");try{let o=this.getVideoFxAssetParams();yield this.loadEngineWorker(o),yield this.buildEngine(o),yield this.loadFxLib(o),this.renderer=constructRenderer(q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.effectConfig,this.outputCanvas)}catch(o){throw this.logger.error(o.toString()),Error("Failed to load necessary assets for the VideoFxProcessor")}this.logger.info("Finished loading of essential VideoFxProcessor assets.")})}getVideoFxAssetParams(){let o=O.getDefaultAssetSpec();return{assetGroup:o.assetGroup,revisionID:o.revisionID,sdk:encodeURIComponent(L.default.sdkVersion),ua:encodeURIComponent(L.default.sdkUserAgentLowResolution)}}getPathFromVideoFxAssetParams(o,p){let f=new URL(o);for(let[o,m]of Object.entries(p))if(void 0!==m){let p=encodeURIComponent(o),_=encodeURIComponent(m);f.searchParams.set(p,_)}return f.toString()}loadEngineWorker(o){return m(this,void 0,void 0,function*(){try{let p=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.workerPath,o);this.engineWorker=yield I.loadWorker(p,"VideoFxEngineWorker",{},null),this.logger.info("Successfully loaded the VideoFxProcessor's engine worker"),this.engineWorker.addEventListener("message",o=>this.engineWorkerReceiver(o))}catch(o){throw this.logger.error(o.toString()),Error("Failed to load the VideoFxProcessor's engine worker")}})}buildEngine(o){return m(this,void 0,void 0,function*(){this.buildEnginePromise=new U.DeferredPromise,this.engineWorker.postMessage({msg:q.WORKER_MSG.BUILD_ENGINE_REQUEST,payload:{cdnBasePath:this.videoFxSpec.paths.cdnBasePath,sdkVersioningParams:o}});try{yield this.buildEnginePromise.getPromise()}catch(o){throw this.logger.error(o.toString()),Error("Failed to instantiate the VideoFxEngine")}})}loadFxLib(o){return m(this,void 0,void 0,function*(){let p=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.fxLibPath,o);try{let o=yield w.fetchWithBehavior(p,{method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"},{});if(!o.ok)throw Error("Fetch failed.");let f=window.URL.createObjectURL((yield o.blob()));yield new Promise((o,p)=>{this.fxLibScript=document.createElement("script"),this.fxLibScript.setAttribute("src",f),this.fxLibScript.setAttribute("type","module"),this.fxLibScript.setAttribute("async","false"),this.fxLibScript.addEventListener("load",o),this.fxLibScript.addEventListener("error",p),document.body.appendChild(this.fxLibScript)})}catch(o){throw this.logger.error(o.toString()),Error("Failed to load the fxlib")}})}getEffectConfig(){return this.cloneConfigFrom(this.effectConfig)}engineWorkerReceiver(o){let p=o.data;switch(p.msg){case q.WORKER_MSG.BUILD_ENGINE_RESPONSE:this.settleEngineBuildPromise(p.payload);break;case q.WORKER_MSG.PERFORM_SEGMENTATION_RESPONSE:this.settleSegmentationPromise(p.payload.output);break;case q.WORKER_MSG.PERFORM_SEGMENTATION_SAB_RESPONSE:this.settleSegmentationPromiseSAB();break;case q.WORKER_MSG.DESTROY_ASSETS_RESPONSE:this.destroyedAssetsPromise.resolvePromise();break;default:this.logger.info(`VideoFx worker received unknown event msg: ${JSON.stringify(p)}`)}}settleEngineBuildPromise(o){o!==q.SEGMENTATION_MODEL.LOAD_SUCCESS?this.buildEnginePromise.rejectPromise(Error("Failed to build VideoFxProcessor's engine")):(this.logger.info("Successfully built the VideoFxEngine"),this.buildEnginePromise.resolvePromise())}settleSegmentationPromise(o){o?this.segmentationRequestPromise.resolveAndReplacePromise(o):this.segmentationRequestPromise.rejectAndReplacePromise(Error("Failed to perform a segmentation on the input image"))}settleSegmentationPromiseSAB(){try{let o=new ImageData(new Uint8ClampedArray(this.sharedImageData),q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS);this.segmentationRequestPromise.resolveAndReplacePromise(o)}catch(o){this.segmentationRequestPromise.rejectAndReplacePromise(Error("Failed to perform a segmentation with a shared array buffer on the input image"))}}setToNoOpProcess(){this.process=this.noOpProcess}static isSupported(o=new x.default,p=!0){return m(this,void 0,void 0,function*(){let f=!0,checkEnv=(p,m)=>{p&&(o.info(m),f=!1)};checkEnv("u"<typeof globalThis,"Browser does not have globalThis."),checkEnv(!k.supportsWorker(globalThis,o),"Browser does not support web workers."),checkEnv(!k.supportsWASM(globalThis,o),"Browser does not support wasm."),checkEnv(!document.createElement("canvas").getContext("webgl2"),"Browser does not support webgl."),checkEnv(!new M.default().isVideoFxSupportedBrowser(),"Browser is unsupported for VideoFxProcessor");let checkProcessor=()=>m(this,void 0,void 0,function*(){if(p)try{let p=new VideoFxProcessor(o);yield p.loadAssets(),yield p.destroy()}catch{return o.info("Browser environment is unable to access the required external assets."),Promise.resolve(!1)}return Promise.resolve(!0)});return Promise.resolve(!!f&&(yield checkProcessor()))})}static create(o,p,f=q.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,_){return m(this,void 0,void 0,function*(){let m=new VideoFxProcessor(o,f);_&&m.setVideoFxSpec(_);try{return yield m.loadAssets(),yield m.setEffectConfig(p),m}catch(p){throw o.error(p.toString()),m.setToNoOpProcess(),Error("VideoFxProcessor built with support for only NoOp processing")}})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishVideoFxConfigEvent())}publishVideoFxConfigEvent(){let o={backgroundBlurEnabled:this.effectConfig.backgroundBlur.isEnabled.toString(),backgroundBlurStrength:this.effectConfig.backgroundBlur.strength,backgroundReplacementEnabled:this.effectConfig.backgroundReplacement.isEnabled.toString(),backgroundFilterVersion:2};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}sameVideoFxConfig(o,p){return o.backgroundBlur.isEnabled===p.backgroundBlur.isEnabled&&o.backgroundBlur.strength===p.backgroundBlur.strength&&o.backgroundReplacement.backgroundImageURL===p.backgroundReplacement.backgroundImageURL&&o.backgroundReplacement.defaultColor===p.backgroundReplacement.defaultColor&&o.backgroundReplacement.isEnabled===p.backgroundReplacement.isEnabled}};p.default=ee,ee.isSharedArrayBufferSupported="u">typeof SharedArrayBuffer},0x1d603096a:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.VideoFxSegmentationRateManager=void 0;let m=f(0x23955cc68);p.VideoFxSegmentationRateManager=class{constructor(o,p){this.logger=o,this.targetSegmentationCyclePercentage=p/100,this.frameCountOverSamplingPeriod=0,this.totalSegmentationDurationOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now(),this.framesPerSegmentation=m.RESOURCE_CONSTRAINTS.SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION}submitFrame(){this.frameCountOverSamplingPeriod++}shouldApplySegmentation(){return this.frameCountOverSamplingPeriod%this.framesPerSegmentation==0}startSegmentation(){this.frameSegmentationStartTime=performance.now()}completeSegmentation(){this.totalSegmentationDurationOverSamplingPeriod+=performance.now()-this.frameSegmentationStartTime,this.frameCountOverSamplingPeriod>=m.RESOURCE_CONSTRAINTS.SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT&&this.adjustFramesPerSegmentation(this.totalSegmentationDurationOverSamplingPeriod/(performance.now()-this.samplingPeriodStartTime))}adjustFramesPerSegmentation(o){o>this.targetSegmentationCyclePercentage?(this.framesPerSegmentation++,this.logger.info(`Segmentation cycle percentage above the configured maximal value. Decreasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)):this.framesPerSegmentation>1&&o<this.targetSegmentationCyclePercentage&&(this.framesPerSegmentation--,this.logger.info(`Segmentation cycle percentage below the configured maximal value. Increasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)),this.totalSegmentationDurationOverSamplingPeriod=0,this.frameCountOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now()}}},0xe5d2d75f:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x5b4a3d7a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class DefaultVideoStreamIdSet{constructor(o){this.ids=new Set(o)}add(o){this.ids.add(o)}array(){return Array.from(this.ids.values()).sort((o,p)=>o-p)}contain(o){return this.ids.has(o)}forEach(o){this.ids.forEach(o)}empty(){return 0===this.ids.size}size(){return this.ids.size}equal(o){if(!o)return 0===this.ids.size;let p=this.array(),f=o.array();if(p.length!==f.length)return!1;for(let o=0;o<p.length;o++)if(p[o]!==f[o])return!1;return!0}clone(){return new DefaultVideoStreamIdSet(this.array())}remove(o){this.ids.delete(o)}toJSON(){return this.array()}truncate(o){return new DefaultVideoStreamIdSet(this.array().splice(0,o))}}},0x151b9e5ee:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x252035ee7),w=m(f(0x5b4a3d7a)),I=m(f(0x251ff39d9));p.default=class{constructor(o){this.logger=o,this.currentIndex=null,this.indexForSubscribe=null,this.indexForLastRemoteVideoUpdate=null,this.currentSubscribeAck=null,this.subscribeTrackToStreamMap=null,this.subscribeStreamToAttendeeMap=null,this.subscribeStreamToExternalUserIdMap=null,this.subscribeSsrcToStreamMap=null,this.subscribeSsrcToGroupMap=null,this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null,this.videoStreamDescription=new I.default,this.sendVideoStreamId=0,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}convertBpsToKbps(o){return o>0&&o<1e3?1:Math.trunc(o/1e3)}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];let o=[];return this.currentIndex.sources.forEach(p=>{let f=new I.default;f.attendeeId=p.attendeeId,f.groupId=p.groupId,f.streamId=p.streamId,f.maxBitrateKbps=p.maxBitrateKbps,f.avgBitrateKbps=this.convertBpsToKbps(p.avgBitrateBps),f.width=p.width,f.height=p.height,f.maxFrameRate=p.framerate,o.push(f)}),o}integrateUplinkPolicyDecision(o){if(o&&o.length){let p=o[0];this.videoStreamDescription.maxBitrateKbps=p.maxBitrate/1e3,this.videoStreamDescription.maxFrameRate=p.maxFramerate}}integrateIndexFrame(o){if(this.currentIndex=o,!o)return;let p=new Map,f=!1;for(let m of o.sources){if(!p.has(m.attendeeId)){p.set(m.attendeeId,m.groupId);continue}let o=p.get(m.attendeeId);o<m.groupId&&(this.logger.warn(`Old group ID ${o} found for attendee ID ${m.attendeeId}, replacing with newer group ID ${m.groupId}`),p.set(m.attendeeId,m.groupId)),f=!0}f&&(this.currentIndex.sources=this.currentIndex.sources.filter(o=>p.get(o.attendeeId)===o.groupId)),this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}remoteVideoUpdateSent(){this.indexForLastRemoteVideoUpdate=this.currentIndex}integrateSubscribeAckFrame(o){this.currentSubscribeAck=o,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToGroupMap=this.buildSSRCToGroupMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe),this.sendVideoStreamId=0,o.allocations&&void 0!==o.allocations&&o.allocations.length>0&&(this.sendVideoStreamId=o.allocations[0].streamId)}integrateBitratesFrame(o){if(this.currentIndex)for(let p of o.bitrates){let o=this.currentIndex.sources.find(o=>o.streamId===p.sourceStreamId);void 0!==o&&(o.avgBitrateBps=p.avgBitrateBps)}}allStreams(){let o=new w.default;if(this.currentIndex)for(let p of this.currentIndex.sources)o.add(p.streamId);return o}allVideoSendingSourcesExcludingSelf(o){let p=[],f=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(let m of this.currentIndex.sources){let{attendeeId:w,externalUserId:I,mediaType:k}=m;w===o||k!==_.SdkStreamMediaType.VIDEO||f.has(w)||(p.push({attendee:{attendeeId:w,externalUserId:I}}),f.add(w))}return p}streamSelectionUnderBandwidthConstraint(o,p,f,m){let I=new Set;if(this.currentIndex)for(let m of this.currentIndex.sources)m.attendeeId!==o&&m.mediaType===_.SdkStreamMediaType.VIDEO&&(p.has(m.attendeeId)||f.has(m.attendeeId)||I.add(m.attendeeId));let k=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(o),M=new Map,x=0;k.forEach((o,p)=>{M.set(p,o[0]),x+=o[0].maxBitrateKbps}),x=this.trySelectHighBitrateForAttendees(k,p,x,m,M),this.trySelectHighBitrateForAttendees(k,I,x,m,M);let O=new w.default;for(let o of M.values())O.add(o.streamId);return O}highestQualityStreamFromEachGroupExcludingSelf(o){let p=new w.default;if(this.currentIndex){let f=new Map;for(let p of this.currentIndex.sources)p.attendeeId!==o&&p.mediaType===_.SdkStreamMediaType.VIDEO&&(!f.has(p.groupId)||p.maxBitrateKbps>f.get(p.groupId).maxBitrateKbps)&&f.set(p.groupId,p);for(let o of f.values())p.add(o.streamId)}return p}numberOfVideoPublishingParticipantsExcludingSelf(o){return this.highestQualityStreamFromEachGroupExcludingSelf(o).array().length}numberOfParticipants(){return this.currentIndex.numParticipants?this.currentIndex.numParticipants:-1}attendeeIdForTrack(o){let p=this.streamIdForTrack(o);if(void 0===p||!this.subscribeStreamToAttendeeMap)return this.logger.warn(`no attendee found for track ${o}`),"";let f=this.subscribeStreamToAttendeeMap.get(p);return f||(this.logger.info(`track ${o} (stream ${p}) does not correspond to a known attendee`),"")}externalUserIdForTrack(o){let p=this.streamIdForTrack(o);if(void 0===p||!this.subscribeStreamToExternalUserIdMap)return this.logger.warn(`no external user id found for track ${o}`),"";let f=this.subscribeStreamToExternalUserIdMap.get(p);return f||(this.logger.info(`track ${o} (stream ${p}) does not correspond to a known externalUserId`),"")}attendeeIdForStreamId(o){if(!this.streamToAttendeeMap)if(!this.currentIndex)return"";else this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex);let p=this.streamToAttendeeMap.get(o);return p||(this.logger.info(`stream ID ${o} does not correspond to a known attendee`),"")}attendeeIdForGroupId(o){if(!this.groupIdToAttendeeMap)if(!this.currentIndex)return"";else this.groupIdToAttendeeMap=this.buildGroupIdToAttendeeMap(this.currentIndex);let p=this.groupIdToAttendeeMap.get(o);return p||(this.logger.info(`group ID ${o} does not correspond to a known attendee`),"")}groupIdForStreamId(o){if(this.currentIndex&&this.currentIndex.sources){for(let p of this.currentIndex.sources)if(p.streamId===o)return p.groupId;if(this.indexForSubscribe){for(let p of this.indexForSubscribe.sources)if(p.streamId===o)return p.groupId}if(this.indexForLastRemoteVideoUpdate){for(let p of this.indexForLastRemoteVideoUpdate.sources)if(p.streamId===o)return p.groupId}}}StreamIdsInSameGroup(o,p){return this.groupIdForStreamId(o)===this.groupIdForStreamId(p)}streamIdForTrack(o){if(this.subscribeTrackToStreamMap)return this.subscribeTrackToStreamMap.get(o)}streamIdForSSRC(o){if(this.subscribeSsrcToStreamMap)return this.subscribeSsrcToStreamMap.get(o)}overrideStreamIdMappings(o,p){if(this.subscribeTrackToStreamMap){for(let[f,m]of this.subscribeTrackToStreamMap.entries())if(o===m){this.subscribeTrackToStreamMap.set(f,p);break}}if(this.subscribeSsrcToStreamMap){for(let[f,m]of this.subscribeSsrcToStreamMap.entries())if(o===m){this.subscribeSsrcToStreamMap.set(f,p);break}}}groupIdForSSRC(o){if(this.subscribeSsrcToGroupMap)return this.subscribeSsrcToGroupMap.get(o)}streamsPausedAtSource(){let o=new w.default;if(this.currentIndex)for(let p of this.currentIndex.pausedAtSourceIds)o.add(p);return o}sendVideoStreamIdFromRid(o){return this.sendVideoStreamId}buildTrackToStreamMap(o){let p=new Map;for(let f of(this.logger.debug(()=>`trackMap ${JSON.stringify(o.tracks)}`),o.tracks))f.trackLabel.length>0&&f.streamId>0&&p.set(f.trackLabel,f.streamId);return p}buildSSRCToStreamMap(o){let p=new Map;for(let f of(this.logger.debug(()=>`ssrcMap ${JSON.stringify(o.tracks)}`),o.tracks))f.trackLabel.length>0&&f.streamId>0&&p.set(f.ssrc,f.streamId);return p}buildSSRCToGroupMap(o){let p=new Map;for(let f of o.tracks)f.trackLabel.length>0&&f.streamId>0&&p.set(f.ssrc,this.groupIdForStreamId(f.streamId));return p}buildStreamToAttendeeMap(o){let p=new Map;if(o)for(let f of o.sources)p.set(f.streamId,f.attendeeId);return p}buildGroupIdToAttendeeMap(o){let p=new Map;for(let f of o.sources)p.set(f.groupId,f.attendeeId);return p}buildStreamExternalUserIdMap(o){let p=new Map;if(o)for(let f of o.sources)f.externalUserId&&p.set(f.streamId,f.externalUserId);return p}trySelectHighBitrateForAttendees(o,p,f,m,_){for(let w of p){if(f>=m)break;if(o.has(w)){for(let p of o.get(w).reverse())if(f-_.get(w).maxBitrateKbps+p.maxBitrateKbps<m){f=f-_.get(w).maxBitrateKbps+p.maxBitrateKbps,_.set(w,p);break}}}return f}buildAttendeeToSortedStreamDescriptorMapExcludingSelf(o){let p=new Map;if(this.currentIndex)for(let f of this.currentIndex.sources)f.attendeeId!==o&&f.mediaType===_.SdkStreamMediaType.VIDEO&&(p.has(f.attendeeId)?p.get(f.attendeeId).push(f):p.set(f.attendeeId,[f]));return p.forEach((o,p)=>{o.sort((o,p)=>o.maxBitrateKbps>p.maxBitrateKbps?1:o.maxBitrateKbps<p.maxBitrateKbps?-1:0)}),p}}},0x25113bad6:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x252035ee7),w=m(f(0x151b9e5ee)),I=m(f(0x251ff39d9)),k=class SimulcastVideoStreamIndex extends w.default{constructor(){super(...arguments),this.streamIdToBitrateKbpsMap=new Map,this._localStreamInfos=[],this._sendRidToVideoStreamIdMap=new Map}localStreamDescriptions(){let o=[];return this._localStreamInfos.forEach(p=>{o.push(p.clone())}),o}integrateUplinkPolicyDecision(o){let p=!0,f=0;for(let m=0;m<o.length;m++){let _=o[m].maxBitrate/1e3,w=o[m].maxFramerate;if(!p||m===this._localStreamInfos.length){p=!1;let k=new I.default;k.maxBitrateKbps=_,k.maxFrameRate=w,k.disabledByUplinkPolicy=0===_,k.rid=o[m].rid,0!==_&&(k.timeEnabled=Date.now()),this._localStreamInfos.push(k),f++;continue}0===this._localStreamInfos[f].maxBitrateKbps&&_>0&&(this._localStreamInfos[f].timeEnabled=Date.now()),this._localStreamInfos[f].maxBitrateKbps=_,this._localStreamInfos[f].maxFrameRate=w,this._localStreamInfos[f].disabledByUplinkPolicy=0===_,f++}p&&this._localStreamInfos.splice(f)}integrateBitratesFrame(o){super.integrateBitratesFrame(o);let p=new Set,f=new Set(this.streamIdToBitrateKbpsMap.keys());for(let f of o.bitrates)p.add(f.sourceStreamId),this.streamIdToBitrateKbpsMap.set(f.sourceStreamId,this.convertBpsToKbps(f.avgBitrateBps));for(let o of f)p.has(o)||(this.streamIdToBitrateKbpsMap.get(o)===SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(o,SimulcastVideoStreamIndex.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(o,SimulcastVideoStreamIndex.NOT_SENDING_STREAM_BITRATE));this.logLocalStreamDescriptions()}logLocalStreamDescriptions(){let o="";for(let p of this._localStreamInfos)o+=`streamId=${p.streamId} maxBitrate=${p.maxBitrateKbps} disabledByUplink=${p.disabledByUplinkPolicy}
`;this.logger.debug(()=>o)}integrateIndexFrame(o){super.integrateIndexFrame(o);let p=new Set,f=new Set(this.streamIdToBitrateKbpsMap.keys());for(let o of this.currentIndex.sources)o.mediaType===_.SdkStreamMediaType.VIDEO&&(p.add(o.streamId),this.streamIdToBitrateKbpsMap.has(o.streamId)||this.streamIdToBitrateKbpsMap.set(o.streamId,SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE));for(let o of f)p.has(o)||this.streamIdToBitrateKbpsMap.delete(o)}integrateSubscribeAckFrame(o){if(super.integrateSubscribeAckFrame(o),!o.allocations||void 0===o.allocations)return;let p=0;for(let f of(this._sendRidToVideoStreamIdMap.clear(),o.allocations)){if(this._localStreamInfos.length<p+1){this.logger.info("simulcast: allocation has more than number of local streams");break}this._localStreamInfos[p].groupId=f.groupId,this._localStreamInfos[p].streamId=f.streamId,this.streamIdToBitrateKbpsMap.has(f.streamId)||this.streamIdToBitrateKbpsMap.set(f.streamId,SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE),this._sendRidToVideoStreamIdMap.set(this._localStreamInfos[p].rid,f.streamId),p++}}sendVideoStreamIdFromRid(o){let p=0;return this._sendRidToVideoStreamIdMap.has(o)&&(p=this._sendRidToVideoStreamIdMap.get(o)),p}};p.default=k,k.UNSEEN_STREAM_BITRATE=-2,k.RECENTLY_INACTIVE_STREAM_BITRATE=-1,k.NOT_SENDING_STREAM_BITRATE=0,k.BitratesMsgFrequencyMs=4e3},0x251ff39d9:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x252035ee7);p.default=class VideoStreamDescription{constructor(o,p,f,m,_){this.attendeeId="",this.groupId=0,this.streamId=0,this.ssrc=0,this.trackLabel="",this.maxBitrateKbps=0,this.avgBitrateKbps=0,this.maxFrameRate=0,this.width=0,this.height=0,this.timeEnabled=0,this.disabledByWebRTC=!1,this.disabledByUplinkPolicy=!1,this.rid="",this.attendeeId=o,this.groupId=p,this.streamId=f,this.maxBitrateKbps=m,this.avgBitrateKbps=_}clone(){let o=new VideoStreamDescription;return o.attendeeId=this.attendeeId,o.groupId=this.groupId,o.streamId=this.streamId,o.ssrc=this.ssrc,o.trackLabel=this.trackLabel,o.maxBitrateKbps=this.maxBitrateKbps,o.avgBitrateKbps=this.avgBitrateKbps,o.maxFrameRate=this.maxFrameRate,o.timeEnabled=this.timeEnabled,o.disabledByUplinkPolicy=this.disabledByUplinkPolicy,o.width=this.width,o.height=this.height,o}toStreamDescriptor(){let o=m.SdkStreamDescriptor.create();return o.mediaType=m.SdkStreamMediaType.VIDEO,o.trackLabel=this.trackLabel,o.attendeeId=this.attendeeId,o.streamId=this.streamId,o.groupId=this.groupId,o.framerate=this.maxFrameRate,o.maxBitrateKbps=this.disabledByUplinkPolicy?0:this.maxBitrateKbps,o.avgBitrateBps=this.avgBitrateKbps,o}totalPixels(){return this.width*this.height}}},9224556e3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observerQueue=new Set,this.element=null,this.resizeObserver=new ResizeObserver(o=>{for(let p of o){let{width:o,height:f}=p.contentRect;this.notifyObservers(o,f)}})}notifyObservers(o,p){for(let f of this.observerQueue)f.videoElementResolutionChanged(o,p)}registerObserver(o){this.observerQueue.add(o)}removeObserver(o){this.observerQueue.delete(o)}bindVideoElement(o){this.element!==o&&(this.element&&this.resizeObserver.unobserve(this.element),this.element=o,this.element&&this.resizeObserver.observe(this.element))}}},0xb747ec80:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2)),w=m(f(0x230534cc6)),I=m(f(0x1a64b5418));p.default=class DefaultVideoTile{constructor(o,p,f,m,_){this.tileController=f,this.devicePixelRatioMonitor=m,this.resolutionMonitor=_,this.tileState=new I.default,this.tileState.tileId=o,this.tileState.localTile=p,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(o,p,f){let m=f&&"environment"!==o.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";if(DefaultVideoTile.setVideoElementFlag(p,"disablePictureInPicture",f),DefaultVideoTile.setVideoElementFlag(p,"disableRemotePlayback",f),p.style.transform!==m&&(p.style.transform=m),p.hasAttribute("controls")&&p.removeAttribute("controls"),p.hasAttribute("autoplay")||p.setAttribute("autoplay","true"),p.hasAttribute("playsinline")||p.setAttribute("playsinline","true"),p.hasAttribute("muted")||(p.setAttribute("muted","true"),p.muted=!0),p.srcObject!==o&&(p.srcObject=o,new _.default().requiresVideoPlayWorkaround()&&p.paused)){let o=p.play();void 0!==o&&o.catch(o=>{console.warn("Error playing video in Safari",o)}).then(()=>{console.debug("Video played successfully in Safari")})}}static disconnectVideoStreamFromVideoElement(o,p,f=!1){if(o)if(p)f||(o.srcObject=null,o.style.transform="");else{if(!o.srcObject)return;o.pause(),o.style.transform="",DefaultVideoTile.setVideoElementFlag(o,"disablePictureInPicture",!1),DefaultVideoTile.setVideoElementFlag(o,"disableRemotePlayback",!1),o.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&DefaultVideoTile.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new I.default}devicePixelRatioChanged(o){this.tileState.devicePixelRatio=o,this.sendTileStateUpdate()}id(){return this.tileState.tileId}state(){return this.tileState.clone()}stateRef(){return this.tileState}bindVideoStream(o,p,f,m,_,I,k,M){let x=!1;this.tileState.boundAttendeeId!==o&&(this.tileState.boundAttendeeId=o,new w.default(o).hasModality(w.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),x=!0),this.tileState.boundExternalUserId!==k&&(this.tileState.boundExternalUserId=k,x=!0),this.tileState.localTile!==p&&(this.tileState.localTile=p,x=!0),this.tileState.boundVideoStream!==f&&(this.tileState.boundVideoStream=f,x=!0),this.tileState.videoStreamContentWidth!==m&&(this.tileState.videoStreamContentWidth=m,x=!0),this.tileState.videoStreamContentHeight!==_&&(this.tileState.videoStreamContentHeight=_,x=!0),this.tileState.streamId!==I&&(this.tileState.streamId=I,x=!0),this.tileState.groupId!==M&&(this.tileState.groupId=M,x=!0),x&&this.sendTileStateUpdate()}bindVideoElement(o){var p;let f=!1;this.tileState.boundVideoElement!==o&&(this.tileState.boundVideoElement=o,null==(p=this.resolutionMonitor)||p.bindVideoElement(this.tileState.boundVideoElement),f=!0),null!==this.tileState.boundVideoElement?(this.tileState.videoElementCSSWidthPixels!==o.clientWidth&&(this.tileState.videoElementCSSWidthPixels=o.clientWidth,f=!0),this.tileState.videoElementCSSHeightPixels!==o.clientHeight&&(this.tileState.videoElementCSSHeightPixels=o.clientHeight,f=!0)):(this.tileState.videoElementCSSWidthPixels=null,this.tileState.videoElementCSSHeightPixels=null),f&&this.sendTileStateUpdate()}pause(){this.tileState.paused||(this.tileState.paused=!0,this.sendTileStateUpdate())}unpause(){this.tileState.paused&&(this.tileState.paused=!1,this.sendTileStateUpdate())}markPoorConnection(){return!this.tileState.poorConnection&&(this.tileState.poorConnection=!0,this.sendTileStateUpdate(),!0)}unmarkPoorConnection(){return!!this.tileState.poorConnection&&(this.tileState.poorConnection=!1,this.sendTileStateUpdate(),!0)}capture(){if(!this.tileState.active)return null;let o=document.createElement("canvas"),p=this.tileState.boundVideoElement;o.width=p.videoWidth||p.width,o.height=p.videoHeight||p.height;let f=o.getContext("2d");return f.drawImage(p,0,0,o.width,o.height),f.getImageData(0,0,o.width,o.height)}setStreamId(o){this.tileState.streamId=o,this.tileController.sendTileStateUpdate(this.state())}sendTileStateUpdate(){this.updateActiveState(),this.updateVideoStreamOnVideoElement(),this.updateVideoElementPhysicalPixels(),this.tileController.sendTileStateUpdate(this.state())}updateActiveState(){this.tileState.active=!!(!this.tileState.paused&&!this.tileState.poorConnection&&this.tileState.boundAttendeeId&&this.tileState.boundVideoElement&&this.tileState.boundVideoStream)}updateVideoElementPhysicalPixels(){"number"==typeof this.tileState.videoElementCSSWidthPixels&&"number"==typeof this.tileState.videoElementCSSHeightPixels?(this.tileState.videoElementPhysicalWidthPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSWidthPixels,this.tileState.videoElementPhysicalHeightPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSHeightPixels):(this.tileState.videoElementPhysicalWidthPixels=null,this.tileState.videoElementPhysicalHeightPixels=null)}updateVideoStreamOnVideoElement(){this.tileState.active?DefaultVideoTile.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):DefaultVideoTile.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(o,p,f){p in o&&(o[p]=f)}}},0x1a64b5418:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class VideoTileState{constructor(){this.tileId=null,this.localTile=!1,this.localTileStarted=!1,this.isContent=!1,this.active=!1,this.paused=!1,this.poorConnection=!1,this.boundAttendeeId=null,this.boundExternalUserId=null,this.boundVideoStream=null,this.boundVideoElement=null,this.nameplate=null,this.videoStreamContentWidth=null,this.videoStreamContentHeight=null,this.videoElementCSSWidthPixels=null,this.videoElementCSSHeightPixels=null,this.devicePixelRatio=0,this.videoElementPhysicalWidthPixels=null,this.videoElementPhysicalHeightPixels=null,this.streamId=null,this.groupId=null}clone(){let o=new VideoTileState;return o.tileId=this.tileId,o.localTile=this.localTile,o.isContent=this.isContent,o.active=this.active,o.paused=this.paused,o.poorConnection=this.poorConnection,o.boundAttendeeId=this.boundAttendeeId,o.boundExternalUserId=this.boundExternalUserId,o.boundVideoStream=this.boundVideoStream,o.boundVideoElement=this.boundVideoElement,o.nameplate=this.nameplate,o.videoStreamContentWidth=this.videoStreamContentWidth,o.videoStreamContentHeight=this.videoStreamContentHeight,o.videoElementCSSWidthPixels=this.videoElementCSSWidthPixels,o.videoElementCSSHeightPixels=this.videoElementCSSHeightPixels,o.devicePixelRatio=this.devicePixelRatio,o.videoElementPhysicalWidthPixels=this.videoElementPhysicalWidthPixels,o.videoElementPhysicalHeightPixels=this.videoElementPhysicalHeightPixels,o.streamId=this.streamId,o.groupId=this.groupId,o}}},0x129e504bc:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x170a3ef32)),I=_(f(0x167bde784)),k=_(f(0x2074869bd)),M=f(0xab1ef933),x=_(f(9224556e3)),O=_(f(0xb747ec80));p.default=class{constructor(o,p,f){this.tileFactory=o,this.audioVideoController=p,this.logger=f,this.tileMap=new Map,this.nextTileId=1,this.currentLocalTile=null,this.currentPausedTilesByIds=new Set,this.resolutionObservers=new Set,this.keepLastFrameWhenPaused=!1,this.keepLastFrameWhenPaused=p.configuration.keepLastFrameWhenPaused}createDevicePixelRatioMonitorIfNeeded(){this.devicePixelRatioMonitor||(this.devicePixelRatioMonitor=new I.default(new k.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return m(this,void 0,void 0,function*(){if(this.tileMap.size||!this.devicePixelRatioMonitor)return;let o=this.devicePixelRatioMonitor;return this.devicePixelRatioMonitor=void 0,o.destroy()})}bindVideoElement(o,p){let f=this.getVideoTile(o);null===f?this.logger.warn(`Ignoring video element binding for unknown tile id ${o}`):f.bindVideoElement(p)}unbindVideoElement(o,p=!0){let f=this.getVideoTile(o);if(null===f)return void this.logger.warn(`Ignoring video element unbinding for unknown tile id ${o}`);this.logger.info("Unbinding the video element"),this.notifyRemoteObserversOfUnbound(f.state().boundAttendeeId);let m=f.stateRef().boundVideoElement;f.bindVideoElement(null),p&&(this.logger.info("Cleaning up the video element"),O.default.disconnectVideoStreamFromVideoElement(m,!1))}startLocalVideoTile(){if(this.audioVideoController.configuration.meetingFeatures.videoMaxResolution===w.default.VideoDisabled)return this.logger.warn("Could not start camera video because max video resolution was set to None"),-1;let o=this.findOrCreateLocalVideoTile();return this.currentLocalTile.stateRef().localTileStarted=!0,this.audioVideoController.update({needsRenegotiation:!0}),o.id()}stopLocalVideoTile(){this.currentLocalTile&&(this.currentLocalTile.stateRef().localTileStarted=!1,this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId),this.audioVideoController.update({needsRenegotiation:!0}))}hasStartedLocalVideoTile(){return!!(this.currentLocalTile&&this.currentLocalTile.stateRef().localTileStarted)}removeLocalVideoTile(){this.currentLocalTile&&this.removeVideoTile(this.currentLocalTile.id())}getLocalVideoTile(){return this.currentLocalTile}pauseVideoTile(o){let p=this.getVideoTile(o);p&&(this.currentPausedTilesByIds.has(o)||(this.audioVideoController.pauseReceivingStream(p.stateRef().streamId),this.currentPausedTilesByIds.add(o)),p.pause())}unpauseVideoTile(o){let p=this.getVideoTile(o);p&&(this.currentPausedTilesByIds.has(o)&&(this.audioVideoController.resumeReceivingStream(p.stateRef().streamId),this.currentPausedTilesByIds.delete(o)),p.unpause())}getVideoTile(o){return this.tileMap.has(o)?this.tileMap.get(o):null}getVideoTileArea(o){let p=o.state(),f=0,m=0;return p.boundVideoElement&&(f=p.boundVideoElement.clientHeight*p.devicePixelRatio,m=p.boundVideoElement.clientWidth*p.devicePixelRatio),f*m}getAllRemoteVideoTiles(){let o=[];return this.tileMap.forEach((p,f)=>{this.currentLocalTile&&f===this.currentLocalTile.id()||o.push(p)}),o}getAllVideoTiles(){return Array.from(this.tileMap.values())}addVideoTile(o=!1){let p=this.nextTileId;this.nextTileId+=1,this.createDevicePixelRatioMonitorIfNeeded();let f=this.tileFactory.makeTile(p,o,this,this.devicePixelRatioMonitor,this.createResolutionMonitor(p));return this.tileMap.set(p,f),f}removeVideoTile(o){if(!this.tileMap.has(o))return;let p=this.tileMap.get(o);this.currentLocalTile===p&&(this.currentLocalTile=null),p.destroy(),this.tileMap.delete(o),this.audioVideoController.forEachObserver(p=>{M.Maybe.of(p.videoTileWasRemoved).map(f=>f.bind(p)(o))}),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(o){let p=[];for(let f of this.getAllVideoTiles()){let m=f.state();m.boundAttendeeId===o&&(this.removeVideoTile(m.tileId),p.push(m.tileId))}return p}removeAllVideoTiles(){for(let o of Array.from(this.tileMap.keys()))this.removeVideoTile(o)}sendTileStateUpdate(o){this.audioVideoController.forEachObserver(p=>{M.Maybe.of(p.videoTileDidUpdate).map(f=>f.bind(p)(o))})}haveVideoTilesWithStreams(){for(let o of this.getAllVideoTiles())if(o.state().boundVideoStream)return!0;return!1}haveVideoTileForAttendeeId(o){return!!this.getVideoTileForAttendeeId(o)}getVideoTileForAttendeeId(o){for(let p of this.getAllVideoTiles())if(p.state().boundAttendeeId===o)return p}captureVideoTile(o){let p=this.getVideoTile(o);return p?p.capture():null}registerVideoTileResolutionObserver(o){this.resolutionObservers.add(o)}removeVideoTileResolutionObserver(o){this.resolutionObservers.delete(o)}notifyResolutionObserversOfChange(o,p,f){for(let m of this.resolutionObservers)m.videoTileResolutionDidChange(o,p,f)}notifyRemoteObserversOfUnbound(o){for(let p of this.resolutionObservers)p.videoTileUnbound(o)}createResolutionMonitor(o){let p=new class{constructor(o,p){this.controller=o,this.tileId=p}videoElementResolutionChanged(o,p){let f=this.controller.getVideoTile(this.tileId);if(f){let m=f.state().boundAttendeeId;this.controller.notifyResolutionObserversOfChange(m,o,p)}}}(this,o),f=new x.default;return f.registerObserver(p),f}findOrCreateLocalVideoTile(){return this.currentLocalTile||(this.currentLocalTile=this.addVideoTile(!0),this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId)),this.currentLocalTile}}},0x86c4609a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xb747ec80));p.default=class{makeTile(o,p,f,m,w){return new _.default(o,p,f,m,w)}}},0x12d110f57:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x11b1e3853:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x8f26277b)),w=m(f(0x4287252)),I=f(0xab1ef933),k=m(f(0x17f8c39ba)),M=m(f(0x12d110f57)),x=class DefaultSimulcastUplinkPolicy{constructor(o,p){this.selfAttendeeId=o,this.logger=p,this.numSenders=0,this.shouldDisableSimulcast=!1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.videoIndex=null,this.observerQueue=new Set,this.hiTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsHd,this.enableFhdVideo=!1,this.optimalParameters=new k.default(0,0,0,0,!0),this.parametersInEffect=new k.default(0,0,0,0,!0),this.currentQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps]),this.newQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps])}updateConnectionMetric(o){}calculateEncodingParameters(){let o=[new M.default,new M.default,new M.default];this.shouldDisableSimulcast?(this.newActiveStreams=0,o[0].maxBitrateKbps=0,o[1].maxBitrateKbps=this.hiTargetBitrateKbps,o[2].maxBitrateKbps=0):this.numSenders<=4?(this.newActiveStreams=1,o[0].maxBitrateKbps=this.lowTargetBitrateKbps,o[1].maxBitrateKbps=0,o[2].maxBitrateKbps=this.hiTargetBitrateKbps):(this.newActiveStreams=2,o[0].maxBitrateKbps=2*this.lowTargetBitrateKbps/3,o[1].maxBitrateKbps=this.numSenders<=6?this.midTargetBitrateKbps:.6*this.midTargetBitrateKbps,o[2].maxBitrateKbps=0);let p=o.map((o,p,f)=>o.maxBitrateKbps);return this.newQualityMap=this.fillEncodingParamWithBitrates(p),this.encodingParametersEqual()||this.logger.info(`simulcast: policy:calculateEncodingParameters numSources:${this.numSenders} shouldDisableSimulcast:${this.shouldDisableSimulcast} newQualityMap: ${this.getQualityMapString(this.newQualityMap)}`),this.newQualityMap}chooseMediaTrackConstraints(){}chooseEncodingParameters(){return this.currentQualityMap=this.newQualityMap,this.activeStreamsToPublish!==this.newActiveStreams&&(this.activeStreamsToPublish=this.newActiveStreams,this.publishEncodingSimulcastLayer()),this.currentQualityMap}updateIndex(o){let p=o.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+1,f=p!==this.numSenders,m=o.numberOfParticipants(),_=m>=0&&m<=2,w=this.shouldDisableSimulcast!==_;this.numSenders=p,this.shouldDisableSimulcast=_,this.optimalParameters=new k.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=o,(f||w)&&(this.newQualityMap=this.calculateEncodingParameters())}wantsResubscribe(){return!this.encodingParametersEqual()}compareEncodingParameter(o,p){return JSON.stringify(o)===JSON.stringify(p)}encodingParametersEqual(){let o=!1;for(let p of w.default.NAME_ARR_ASCENDING)if(o=o||!this.compareEncodingParameter(this.newQualityMap.get(p),this.currentQualityMap.get(p)))break;return!o}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){return this.enableFhdVideo?1920:1280}captureHeight(){return this.enableFhdVideo?1080:768}captureFrameRate(){return 15}maxBandwidthKbps(){return this.enableFhdVideo?2500:1400}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){this.enableFhdVideo=o,this.hiTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsHd}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!0}fillEncodingParamWithBitrates(o){let p=new Map,f=w.default.NAME_ARR_ASCENDING,m=this.shouldDisableSimulcast?1:4;for(let _=0;_<f.length;_++){let w=f[_];p.set(w,{rid:w,active:o[_]>0,scaleResolutionDownBy:Math.max(m,1),maxBitrate:1e3*o[_]}),m/=2}return p}getQualityMapString(o){let p="";return 3===this.videoIndex.localStreamDescriptions().length&&o.forEach(o=>{p+=`{ rid: ${o.rid} active:${o.active} maxBitrate:${o.maxBitrate}}`}),p}getEncodingSimulcastLayer(o){switch(o){case 0:return _.default.High;case 1:return _.default.LowAndHigh;case 2:return _.default.LowAndMedium}}publishEncodingSimulcastLayer(){let o=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver(p=>{I.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}addObserver(o){this.logger.info("adding simulcast uplink observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing simulcast uplink observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)o(p)}};p.default=x,x.kHiTargetBitrateKbpsHd=1200,x.kMidTargetBitrateKbpsHd=600,x.kLowTargetBitrateKbpsHd=300,x.kHiTargetBitrateKbpsFhd=2e3,x.kMidTargetBitrateKbpsFhd=1e3,x.kLowTargetBitrateKbpsFhd=500},0x13892dc9a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf1a8ac2));p.default=class{constructor(o,p){this.encodingParams=p,this.enableUhdContent=!1,this.defaultHiTargetBitrateKbps=1200,this.defaultLowTargetBitrateKbps=300}updateConnectionMetric(o){}chooseMediaTrackConstraints(){}chooseEncodingParameters(){var o,p,f,m,w,I,k,M,x,O,L,B;let U=new Map,$=_.default.NAME_ARR_ASCENDING;return U.set($[0],{rid:$[0],active:!0,scaleResolutionDownBy:(null==(p=null==(o=this.encodingParams)?void 0:o.low)?void 0:p.scaleResolutionDownBy)||2,maxBitrate:1e3*((null==(m=null==(f=this.encodingParams)?void 0:f.low)?void 0:m.maxBitrateKbps)||this.defaultLowTargetBitrateKbps),maxFramerate:(null==(I=null==(w=this.encodingParams)?void 0:w.low)?void 0:I.maxFramerate)||5}),U.set($[1],{rid:$[1],active:!0,scaleResolutionDownBy:(null==(M=null==(k=this.encodingParams)?void 0:k.high)?void 0:M.scaleResolutionDownBy)||1,maxBitrate:1e3*((null==(O=null==(x=this.encodingParams)?void 0:x.high)?void 0:O.maxBitrateKbps)||this.defaultHiTargetBitrateKbps),maxFramerate:null==(B=null==(L=this.encodingParams)?void 0:L.high)?void 0:B.maxFramerate}),U}updateIndex(o){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){}maxBandwidthKbps(){return this.enableUhdContent?2e3:1200}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){this.enableUhdContent=o,this.defaultHiTargetBitrateKbps=o?2e3:1200,this.defaultLowTargetBitrateKbps=o?500:300}addObserver(o){}removeObserver(o){}forEachObserver(o){}}},0xf9210d7b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x17f8c39ba)),I=class NScaleVideoUplinkBandwidthPolicy{constructor(o,p=!0,f,m){this.selfAttendeeId=o,this.scaleResolution=p,this.logger=f,this.browserBehavior=m,this.numberOfPublishedVideoSources=void 0,this.idealMaxBandwidthKbps=1500,this.hasBandwidthPriority=!1,this.encodingParamMap=new Map,this.enableHighResolutionFeature=!1,this.enableSVC=!1,this.isUsingSVCCodec=!0,this.numParticipants=0,this.reset()}reset(){this.numberOfPublishedVideoSources=void 0,this.optimalParameters=new w.default(0,0,0,0,!1),this.parametersInEffect=new w.default(0,0,0,0,!1),this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(o){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(o){var p;let f=!0;this.transceiverController&&(f=this.transceiverController.hasVideoInput());let m=o.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+ +!!f,_=o.numberOfParticipants();if(this.numParticipants===_&&this.numberOfPublishedVideoSources===m){null==(p=this.logger)||p.debug("Skipping update index; Number of participants has not changed");return}this.numberOfPublishedVideoSources=m,this.numParticipants=_,this.updateOptimalParameters()}wantsResubscribe(){return!this.parametersInEffect.equal(this.optimalParameters)}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}updateOptimalParameters(){let o=1;if(this.transceiverController){let p=this.getStreamCaptureSetting();p&&(o=this.calculateEncodingParameters(p).scaleResolutionDownBy)}this.optimalParameters=new w.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,o,this.enableSVC&&this.numParticipants>2&&this.isUsingSVCCodec)}captureWidth(){let o=640;return this.getNumberOfPublishedVideoSources()>4&&(o=320),o}captureHeight(){let o=384;return this.getNumberOfPublishedVideoSources()>4&&(o=192),o}captureFrameRate(){return 15}maxBandwidthKbps(){if(this.hasBandwidthPriority)return Math.trunc(this.idealMaxBandwidthKbps);return Math.trunc(2>=this.getNumberOfPublishedVideoSources()?this.idealMaxBandwidthKbps:4>=this.getNumberOfPublishedVideoSources()?2*this.idealMaxBandwidthKbps/3:(544/11+14880/(11*this.getNumberOfPublishedVideoSources()))/600*this.idealMaxBandwidthKbps)}setIdealMaxBandwidthKbps(o){this.idealMaxBandwidthKbps=o}setHasBandwidthPriority(o){this.hasBandwidthPriority=o}setTransceiverController(o){this.transceiverController=o}setSVCEnabled(o){var p;this.enableSVC=o,null==(p=this.logger)||p.info(`setSVCEnabled, enable: ${o}}`)}setHighResolutionFeatureEnabled(o){this.enableHighResolutionFeature=o}updateTransceiverController(){return m(this,void 0,void 0,function*(){let o=this.getStreamCaptureSetting();if(!o)return;let p=this.calculateEncodingParameters(o);this.shouldUpdateEndcodingParameters(p)&&(this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey,p),this.transceiverController.setEncodingParameters(this.encodingParamMap))})}shouldUpdateEndcodingParameters(o){var p,f;let m=null==(f=null==(p=this.transceiverController.localVideoTransceiver().sender.getParameters())?void 0:p.encodings)?void 0:f[0];return o.maxBitrate!==(null==m?void 0:m.maxBitrate)||o.scaleResolutionDownBy!==(null==m?void 0:m.scaleResolutionDownBy)||(null==o?void 0:o.scalabilityMode)!==(null==m?void 0:m.scalabilityMode)}calculateEncodingParameters(o){var p,f,m;let _=1e3*this.maxBandwidthKbps(),w=1,I=720;if(void 0!==o.height&&void 0!==o.width&&this.scaleResolution&&!this.hasBandwidthPriority&&this.getNumberOfPublishedVideoSources()>2&&(480===(I=NScaleVideoUplinkBandwidthPolicy.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),NScaleVideoUplinkBandwidthPolicy.targetHeightArray.length-1)][+!!this.enableHighResolutionFeature])&&(null==(p=this.browserBehavior)?void 0:p.disable480pResolutionScaleDown())&&(I=360),w=Math.max(Math.min(o.height,o.width)/I,1),null==(f=this.logger)||f.info(`Resolution scale factor is ${w} for capture resolution ${o.width}x${o.height}. New dimension is ${o.width/w}x${o.height/w}`)),!this.enableSVC)return{scaleResolutionDownBy:w,maxBitrate:_};{let o;return o=this.numParticipants>=0&&this.numParticipants<3||!this.isUsingSVCCodec?"L1T1":"L3T3",null==(m=this.logger)||m.info(`calculateEncodingParameters: SVC: ${this.enableSVC}    participants: ${this.numParticipants}     publishers: ${this.getNumberOfPublishedVideoSources()}     bitrate: ${_}  targetHeight: ${I}  scalabilityMode: ${o}   isUsingSVCCodec: ${this.isUsingSVCCodec}`),{scaleResolutionDownBy:w,maxBitrate:_,scalabilityMode:o}}}getStreamCaptureSetting(){var o,p,f,m;return null==(m=null==(f=null==(p=null==(o=this.transceiverController)?void 0:o.localVideoTransceiver())?void 0:p.sender)?void 0:f.track)?void 0:m.getSettings()}getNumberOfPublishedVideoSources(){var o;return null!=(o=this.numberOfPublishedVideoSources)?o:0}wantsVideoDependencyDescriptorRtpHeaderExtension(){return this.enableSVC}setMeetingSupportedVideoSendCodecs(o,p){let f=null!=o?o:p,m=f.length>0&&NScaleVideoUplinkBandwidthPolicy.SVCCodecNames.includes(f[0].codecName);m!==this.isUsingSVCCodec&&(this.isUsingSVCCodec=m,this.updateOptimalParameters())}};p.default=I,I.encodingMapKey="video",I.targetHeightArray=[[0,0],[0,0],[0,0],[540,720],[540,720],[480,540],[480,540],[480,540],[480,540],[360,480],[360,480],[360,480],[360,480],[270,360],[270,360],[270,360],[270,360],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270]],I.SVCCodecNames=["VP9"]},0x143cfada8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x17f8c39ba));p.default=class{updateConnectionMetric(o){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(o){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new _.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!1}}},0x11982bbce:(o,p)=>{"use strict";function stringify(o){return o.map(o=>"object"==typeof o?JSON.stringify(o):`${o}`).join(" ")}Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.base=o}debug(...o){this.base.debug(stringify(o))}info(...o){this.base.info(stringify(o))}warn(...o){this.base.warn(stringify(o))}error(...o){this.base.error(stringify(o))}}},0xbb137ed2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.VoiceFocusDeviceTransformer=void 0;let w=f(0xed65dabf),I=f(0xb79a45b7),k=_(f(0x22a0f7c69)),M=_(f(0x11982bbce)),x=_(f(0xa8bfd6e5)),O=_(f(0x24cbcf4c2)),L=class VoiceFocusDeviceTransformer{constructor(o,{preload:p=!0,logger:f,fetchBehavior:m=VoiceFocusDeviceTransformer.defaultFetchBehavior()},_){this.spec=o,this.supported=!0,this.logger=f,this.vfLogger=f?new M.default(f):void 0,this.preload=p,this.fetchBehavior=m,this.spec=VoiceFocusDeviceTransformer.augmentSpec(this.spec),_&&(this.configuration=Promise.resolve(_))}static isSupported(o,p){var f,m;let _=VoiceFocusDeviceTransformer.defaultFetchBehavior(),k=(null==p?void 0:p.logger)?new M.default(p.logger):void 0;if(I.isIFramed())if((null==p?void 0:p.allowIFrame)===!1)return null==(f=null==p?void 0:p.logger)||f.error("Amazon Voice Focus support check inside iframe: not supported."),Promise.resolve(!1);else null==(m=null==p?void 0:p.logger)||m.warn("Amazon Voice Focus support check inside iframe: not recommended.");return w.VoiceFocus.isSupported(VoiceFocusDeviceTransformer.augmentSpec(o),{fetchBehavior:_,logger:k})}static create(o={},p={},f,_,w){var I,k,M;return m(this,void 0,void 0,function*(){_&&_.Meeting.Meeting&&(_=_.Meeting);let m=(null==(M=null==(k=null==(I=null==_?void 0:_.Meeting)?void 0:I.MeetingFeatures)?void 0:k.Audio)?void 0:M.EchoReduction)==="AVAILABLE",w=f&&!0===f.supported&&"ns_es"===f.model.name&&!m,x="ns_es"===o.name&&!m;if(w||x)throw Error("Echo Reduction requested but not enabled.");let O=new VoiceFocusDeviceTransformer(o,p,f);return yield O.init(),O})}static configure(o={},p={}){return m(this,void 0,void 0,function*(){return new VoiceFocusDeviceTransformer(o,p,void 0).configure(!0)})}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(o,p){return m(this,void 0,void 0,function*(){if(this.supported)try{let[f,m]=yield this.allocateVoiceFocus(!0),_=Object.assign(Object.assign({},p),{es:"ns_es"===this.spec.name});return new x.default(o,f,m,_)}catch{return}})}static destroyVoiceFocus(o){var p;return m(this,void 0,void 0,function*(){null==(p=null==o?void 0:o.vf)||p.destroy()})}static augmentSpec(o){return o&&(o.assetGroup||o.revisionID)?o:Object.assign(Object.assign({},o),{assetGroup:VoiceFocusDeviceTransformer.currentSDKAssetGroup()})}configure(o=!1){return m(this,void 0,void 0,function*(){let p={fetchBehavior:this.fetchBehavior,preResolve:o,logger:this.vfLogger};return w.VoiceFocus.configure(this.spec,p)})}init(){var o;return m(this,void 0,void 0,function*(){this.configuration||(this.configuration=this.configure());let p=yield this.configuration;if(!p.supported){this.supported=!1;return}this.pendingVoiceFocus=this.createVoiceFocus(p,this.preload);try{yield this.pendingVoiceFocus}catch(p){null==(o=this.logger)||o.error(`Unable to initialize Amazon Voice Focus: ${p}`),this.supported=!1}})}createVoiceFocus(o,p){return m(this,void 0,void 0,function*(){let f=new O.default;return this.vf=yield w.VoiceFocus.init(o,{delegate:f,preload:p,logger:this.vfLogger}),[this.vf,f]})}allocateVoiceFocus(o){return m(this,void 0,void 0,function*(){if(!this.supported)throw Error("Not supported.");if(this.pendingVoiceFocus){let o=this.pendingVoiceFocus;return this.pendingVoiceFocus=void 0,o}return this.createVoiceFocus((yield this.configuration),o)})}static majorVersion(){return k.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return k.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|(?:[1-9][0-9]*))\.(?:0|[1-9][0-9]*)/)[0]}static currentSDKAssetGroup(){let o=this.majorVersion();return o?`sdk-${o}`:"stable-v1"}static defaultFetchBehavior(){let o=VoiceFocusDeviceTransformer.majorMinorVersion()||"unknown",p=k.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(o)}&ua=${encodeURIComponent(p)}`}}};p.VoiceFocusDeviceTransformer=L,p.default=L},0xa8bfd6e5:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2));function isDefaultDevice(o){return"default"===o||!!o&&"object"==typeof o&&("deviceId"in o&&"default"===o.deviceId||"id"in o&&"default"===o.id)}p.default=class VoiceFocusTransformDevice{constructor(o,p,f,m,_=!1,I,k=new w.default,M=new Map,x,O){this.device=o,this.voiceFocus=p,this.delegate=f,this.nodeOptions=m,this.failed=_,this.node=I,this.browserBehavior=k,this.farEndStreamToAudioSourceNode=M,this.mixDestNode=x,this.mixSourceNode=O}getInnerDevice(){return this.device}mute(o){return m(this,void 0,void 0,function*(){this.node&&(o?yield this.node.disable():yield this.node.enable())})}stop(){return m(this,void 0,void 0,function*(){this.node&&(this.node.disconnect(),yield this.node.stop())})}chooseNewInnerDevice(o){return m(this,void 0,void 0,function*(){return this.device!==o||isDefaultDevice(o)?new VoiceFocusTransformDevice(o,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode):this})}intrinsicDevice(){return m(this,void 0,void 0,function*(){let o;if(this.failed)return this.device;let p=this.nodeOptions.es,f={echoCancellation:!p,googEchoCancellation:!p,googEchoCancellation2:!p,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googNoiseSuppression2:!1};return(f.autoGainControl=o=!this.nodeOptions||void 0===this.nodeOptions.agc||this.nodeOptions.agc.useBuiltInAGC,f.googAutoGainControl=o,f.googAutoGainControl2=o,this.device)?"string"==typeof this.device?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?f.deviceId=this.device:f.deviceId={exact:this.device},f):this.device.id?this.device:Object.assign(Object.assign({},this.device),f):f})}createAudioNode(o){var p,f;return m(this,void 0,void 0,function*(){if((null==(p=this.node)?void 0:p.context)===o)return{start:this.node,end:this.node};let m=Object.assign({enabled:!0,agc:{useVoiceFocusAGC:!1}},this.nodeOptions);try{if(null==(f=this.node)||f.disconnect(),this.node=yield this.voiceFocus.createNode(o,m),this.nodeOptions.es){for(let p of(this.mixDestNode=new MediaStreamAudioDestinationNode(o,{channelCount:1,channelCountMode:"explicit"}),this.farEndStreamToAudioSourceNode.keys()))this.assignFarEndStreamToAudioSourceNode(p);this.createMixSourceNode()}let p=this.node,_=this.node;return{start:p,end:_}}catch(o){throw this.failed=!0,this.delegate.onFallback(this,o),o}})}observeMeetingAudio(o){return m(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;o.addAudioMixObserver(this);let p=yield o.getCurrentMeetingAudioStream();p&&this.addFarEndStream(p)})}unObserveMeetingAudio(o){return m(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;o.removeAudioMixObserver(this);let p=yield o.getCurrentMeetingAudioStream();p&&this.removeFarendStream(p)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}addFarEndStream(o){return m(this,void 0,void 0,function*(){!this.nodeOptions.es||!o||this.farEndStreamToAudioSourceNode.has(o)||(this.node?this.assignFarEndStreamToAudioSourceNode(o):this.farEndStreamToAudioSourceNode.set(o,null))})}removeFarendStream(o){var p;return m(this,void 0,void 0,function*(){null==(p=this.farEndStreamToAudioSourceNode.get(o))||p.disconnect(),this.farEndStreamToAudioSourceNode.delete(o)})}meetingAudioStreamBecameActive(o){return m(this,void 0,void 0,function*(){this.addFarEndStream(o)})}meetingAudioStreamBecameInactive(o){return m(this,void 0,void 0,function*(){this.removeFarendStream(o)})}assignFarEndStreamToAudioSourceNode(o){let p=this.node.context.createMediaStreamSource(o);p.channelCount=1,p.channelCountMode="explicit",this.farEndStreamToAudioSourceNode.set(o,p),p.connect(this.mixDestNode,0)}createMixSourceNode(){this.mixSourceNode=this.node.context.createMediaStreamSource(this.mixDestNode.stream),this.mixSourceNode.channelCount=1,this.mixSourceNode.channelCountMode="explicit",this.mixSourceNode.connect(this.node,0,1)}}},0x24cbcf4c2:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}onFallback(o,p){var f;for(let m of this.observers)null==(f=m.voiceFocusFellBackToInnerStream)||f.call(m,o,p)}onCPUWarning(){var o;for(let p of this.observers)null==(o=p.voiceFocusInsufficientResources)||o.call(p)}}},0x20da5c30a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class DefaultVolumeIndicatorAdapter{constructor(o,p,f,m,_){this.logger=o,this.realtimeController=p,this.minVolumeDecibels=f,this.maxVolumeDecibels=m,this.selfAttendeeId=_,this.streamIdToAttendeeId={},this.streamIdToExternalUserId={},this.warnedAboutMissingStreamIdMapping={},this.attendeeIdToStreamId={},this.sessionReconnected=!1}onReconnect(){this.sessionReconnected=!0}sendRealtimeUpdatesForAudioStreamIdInfo(o){let p=0;for(let f of o.streams){let m=!!f.attendeeId,_=!!f.externalUserId,w=f.hasOwnProperty("muted"),I=!!f.dropped;if(m){this.attendeeIdToStreamId[f.attendeeId]&&this.attendeeIdToStreamId[f.attendeeId]<f.audioStreamId&&delete this.attendeeIdToStreamId[f.attendeeId],this.streamIdToAttendeeId[f.audioStreamId]=f.attendeeId;let m=_?f.externalUserId:f.attendeeId;this.streamIdToExternalUserId[f.audioStreamId]=m,this.attendeeIdToStreamId[f.attendeeId]=f.audioStreamId,this.realtimeController.realtimeSetAttendeeIdPresence(f.attendeeId,!0,m,!1,{attendeeIndex:p++,attendeesInFrame:o.streams.length})}if(w){let o=this.streamIdToAttendeeId[f.audioStreamId],p=this.streamIdToExternalUserId[f.audioStreamId];this.realtimeController.realtimeUpdateVolumeIndicator(o,null,f.muted,null,p)}if(!m&&!w){let m=this.streamIdToAttendeeId[f.audioStreamId];if(m){let _=this.streamIdToExternalUserId[f.audioStreamId];delete this.streamIdToAttendeeId[f.audioStreamId],delete this.streamIdToExternalUserId[f.audioStreamId],delete this.warnedAboutMissingStreamIdMapping[f.audioStreamId],this.attendeeIdToStreamId[m]===f.audioStreamId&&delete this.attendeeIdToStreamId[m];let w=!1;for(let o of Object.keys(this.streamIdToAttendeeId)){let p=parseInt(o);if(p>f.audioStreamId&&this.streamIdToAttendeeId[p]===m){w=!0;break}}w||this.realtimeController.realtimeSetAttendeeIdPresence(m,!1,_,I,{attendeeIndex:p++,attendeesInFrame:o.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(o),this.sessionReconnected=!1)}cleanUpState(o){let p=Object.values(this.streamIdToAttendeeId),f=o.streams.map(o=>o.attendeeId);for(let[o,m]of p.filter(o=>!f.includes(o)).entries()){let p=this.attendeeIdToStreamId[m],f=this.streamIdToExternalUserId[p];if(delete this.streamIdToAttendeeId[p],delete this.streamIdToExternalUserId[p],delete this.warnedAboutMissingStreamIdMapping[p],delete this.attendeeIdToStreamId[m],m===this.selfAttendeeId){this.logger.warn("the volume indicator adapter cleans up the current attendee (presence = false) after reconnection");continue}this.realtimeController.realtimeSetAttendeeIdPresence(m,!1,f,!1,{attendeeIndex:o,attendeesInFrame:m.length})}}sendRealtimeUpdatesForAudioMetadata(o){let p=null,f=null;for(let m of o.attendeeStates){let o=this.attendeeIdForStreamId(m.audioStreamId);m.hasOwnProperty("volume")&&(null===p&&(p={}),null!==o&&(p[o]=this.normalizedVolume(m))),m.hasOwnProperty("signalStrength")&&(null===f&&(f={}),null!==o&&(f[o]=this.normalizedSignalStrength(m)))}this.applyRealtimeUpdatesForAudioMetadata(p,f)}normalizedVolume(o){return Math.min(Math.max(1-(-o.volume-this.maxVolumeDecibels)/(this.minVolumeDecibels-this.maxVolumeDecibels),0),1)}normalizedSignalStrength(o){return Math.min(Math.max(o.signalStrength/DefaultVolumeIndicatorAdapter.MAX_SIGNAL_STRENGTH_LEVELS,0),1)}applyRealtimeUpdatesForAudioMetadata(o,p){for(let f in this.streamIdToAttendeeId){let m=this.streamIdToAttendeeId[f],_=this.streamIdToExternalUserId[f],w=null,I=null;null!==o&&(w=o.hasOwnProperty(m)?o[m]:DefaultVolumeIndicatorAdapter.IMPLICIT_VOLUME),null!==p&&(I=p.hasOwnProperty(m)?p[m]:DefaultVolumeIndicatorAdapter.IMPLICIT_SIGNAL_STRENGTH),(null!==w||null!==I)&&this.realtimeController.realtimeUpdateVolumeIndicator(m,w,null,I,_)}}attendeeIdForStreamId(o){if(0===o)return null;let p=this.streamIdToAttendeeId[o];return p||(this.warnedAboutMissingStreamIdMapping[o]||(this.warnedAboutMissingStreamIdMapping[o]=!0,this.logger.warn(`volume indicator stream id ${o} seen before being defined`)),null)}};p.default=f,f.MAX_SIGNAL_STRENGTH_LEVELS=2,f.IMPLICIT_VOLUME=0,f.IMPLICIT_SIGNAL_STRENGTH=1},0x947abb4a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x22a0f7c69)),w=m(f(0x1a3216942));p.default=class{constructor(o){this.logger=o}create(o,p,f){this.connection=new WebSocket(f?o:_.default.urlWithVersion(o),p),this.connection.binaryType="arraybuffer"}send(o){if(!this.connection)return this.logger.error("WebSocket not yet created or already destroyed."),!1;try{return o instanceof Uint8Array?this.connection.send(o.buffer):this.connection.send(o),!0}catch(o){return this.logger.debug(()=>`send error: ${o.message}, websocket state=${w.default[this.readyState()]}`),!1}}close(o,p){var f;null==(f=this.connection)||f.close(o,p)}destroy(){this.connection=void 0}addEventListener(o,p){this.connection?this.connection.addEventListener(o,p):this.logger.warn("Cannot add event listener with no WebSocket connection.")}removeEventListener(o,p){var f;null==(f=this.connection)||f.removeEventListener(o,p)}readyState(){if(!this.connection)return w.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return w.default.Connecting;case WebSocket.OPEN:return w.default.Open;case WebSocket.CLOSING:return w.default.Closing;case WebSocket.CLOSED:return w.default.Closed}}}},0x1a3216942:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.WebSocketReadyState=void 0,(m=f=p.WebSocketReadyState||(p.WebSocketReadyState={}))[m.None=0]="None",m[m.Connecting=1]="Connecting",m[m.Open=2]="Open",m[m.Closing=3]="Closing",m[m.Closed=4]="Closed",p.default=f},0x21cc7ae41:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.decideModel=p.measureAndDecideExecutionApproach=void 0;let _=f(0x1e62759b2),w=f(0x1676280b0),I=3,k={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}},M=class{constructor(o,p){this.fetchConfig=o,this.logger=p;const f=`${o.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:o.headers,escapedQueryString:o.escapedQueryString},this.worker=(0,_.loadWorker)(f,"VoiceFocusEstimator",this.fetchBehavior,p)}roundtrip(o,p,f){return new Promise((m,_)=>{this.worker.then(_=>{let w;w=o=>{let{message:I,key:k}=o.data;I===p&&k===f&&(_.removeEventListener("message",w),m(o.data))},_.addEventListener("message",w),_.postMessage(o)}).catch(o=>{var p;null==(p=this.logger)||p.error("Failed to load worker.",o),_(o)})})}supportsSIMD(o){let p="simd",f=o||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,m={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:f,key:p};return this.roundtrip(m,"simd-support",p).then(o=>o.supports)}measure(o,p){let f=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,m=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,_=`bench:${o}`,w={message:"measure",fetchBehavior:this.fetchBehavior,budget:p,path:o?m:f,key:_};return this.roundtrip(w,"measurement",_).then(o=>{if(o.measurement)return o.measurement;throw Error("Failed to measure.")})}stop(){this.worker.then(o=>{var p;null==(p=this.logger)||p.debug("Stopping estimator worker."),o.terminate()}).catch(o=>{})}},featureCheck=(o,p,f,_)=>m(void 0,void 0,void 0,function*(){let m={supportsSIMD:o,supportsSAB:(0,w.supportsSharedArrayBuffer)(globalThis,window,f),duration:-1};if(o)return null==f||f.info("Supports SIMD: true (force)"),m;let I=_||new M(p,f);try{let p=!(0,w.isOldChrome)(window,f)&&(yield I.supportsSIMD());return null==f||f.info(`Supports SIMD: ${p} (force: ${o})`),m.supportsSIMD=p,m}finally{_||I.stop()}});p.measureAndDecideExecutionApproach=(o,p,f,_=k)=>m(void 0,void 0,void 0,function*(){let x,O=o.executionPreference,{usagePreference:L,variantPreference:B,namePreference:U,simdPreference:$,estimatorBudget:q,executionQuantaPreference:Z}=o;"interactivity"===L&&"inline"!==O&&(null==f||f.debug(`Overriding execution preference ${O} to reflect interactivity preference.`),O="inline");let ee="force"===$,et="auto"!==B,ei="auto"!==O;try{if(et&&ei)x=yield featureCheck(ee,p,f);else x=yield m(void 0,void 0,void 0,function*(){let o=new M(p,f);try{let m=yield featureCheck(ee,p,f,o);if(m.supportsSIMD)try{return m.duration=yield o.measure(!0,q),null==f||f.info("SIMD timing:",m.duration),m}catch{null==f||f.warn("Failed SIMD estimation; falling back to non-SIMD."),m.supportsSIMD=!1}return m.duration=yield o.measure(!1,q),null==f||f.info("No-SIMD timing:",m.duration),m}catch(o){throw null==f||f.error("Could not feature check.",o),o}finally{o.stop()}})}catch(o){throw null==f||f.error("Could not load estimator.",o),Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:o,supportsSAB:p,duration:f,executionPreference:m="auto",simdPreference:_,variantPreference:M="auto",namePreference:x="default",usagePreference:O,executionQuantaPreference:L=I},B=k,U)=>{let $="force"===_||"disable"!==_&&o,q=-1!==f,Z=q?($?2.5:2.63)/f:0,ee=$?B.simd:B.wasm,et=q?(1===L?.6:"quality"===O?.65*L:.5*L)*Z:0,ei=q?.7*Z:0,unsupported=o=>({supported:!1,reason:o});if(q){if(Z<ee.noSupport)return unsupported(`Performance score ${Z} worse than threshold ${ee.noSupport}.`)}else if("auto"===m||"auto"===M)return unsupported(`Missing explicit execution (${m}) or variant (${M}) preference, but no scoring performed.`);null==U||U.debug(`Bench duration ${f} yields inline score ${et} and worker score ${ei}.`);let succeed=(o,p,f)=>({supported:!0,useSIMD:$,processor:o,executionApproach:p,variant:f,executionQuanta:"inline"===p?L:void 0,name:x}),resolveVariant=(o,p,f)=>"auto"!==p?!q||o>f[p]?p:"failed":o>f.c100?"c100":o>f.c50?"c50":o>f.c20?"c20":o>f.c10?"c10":"failed",reducePreference=o=>{switch(o||"auto"){case"auto":{let o=reducePreference("inline"),p=reducePreference("worker");if(null==U||U.debug(`Reducing auto preference: ${JSON.stringify(o)} vs ${JSON.stringify(p)}`),!1===o.supported||!1===p.supported)return p;if(o.variant===p.variant||"c50"===o.variant)return o;return p}case"worker":if((0,w.supportsSharedArrayBuffer)(globalThis,window,U))return reducePreference("worker-sab");return reducePreference("worker-postMessage");case"inline":{let o=resolveVariant(et,M,ee.inline);if("failed"===o)return unsupported(`Performance score ${et} not sufficient for inline use with variant preference ${M}.`);return succeed("voicefocus-inline-processor","inline",o)}case"worker-sab":{if(!p){let o="Requested worker-sab but no SharedArrayBuffer support.";return null==U||U.warn(o),{supported:!1,reason:o}}let o=resolveVariant(ei,M,ee.worker);if("failed"===o)return unsupported(`Performance score ${ei} not sufficient for worker use with variant preference ${M}.`);return succeed("voicefocus-worker-sab-processor","worker-sab",o)}case"worker-postMessage":{let o=resolveVariant(ei,M,ee.worker);if("failed"===o)return unsupported(`Performance score ${ei} not sufficient for worker use.`);if("ns_es"===x){let o="Requested echo suppression but postMessage executor does not support it.";return null==U||U.warn(o),{supported:!1,reason:o}}return succeed("voicefocus-worker-postMessage-processor","worker-postMessage",o)}}};return reducePreference(m)})(Object.assign(Object.assign({},x),{simdPreference:$,executionPreference:O,variantPreference:B,namePreference:U,usagePreference:L,executionQuantaPreference:Z}),_,f)}),p.decideModel=({category:o,name:p,variant:f,simd:m,url:_})=>`${o}-${p}-${f}-v1${m?"_simd":""}`},0x6cf4e7cb:(o,p)=>{"use strict";function fetchWithBehavior(o,p,f){return f?fetch(withQueryString(o,f),withRequestHeaders(p,f)):fetch(o,p)}function withRequestHeaders(o,p){return(null==p?void 0:p.headers)?o?Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},o.headers||{}),p.headers)}):{headers:p.headers}:o}function withQueryString(o,p){if(!(null==p?void 0:p.escapedQueryString))return o;let f=-1!==o.lastIndexOf("?");return`${o}${f?"&":"?"}${p.escapedQueryString}`}Object.defineProperty(p,"__esModule",{value:!0}),p.isValidRevisionID=p.isValidAssetGroup=p.resolveURL=p.addQueryParams=p.withQueryString=p.withRequestHeaders=p.fetchWithBehavior=void 0,p.fetchWithBehavior=fetchWithBehavior,p.withRequestHeaders=withRequestHeaders,p.withQueryString=withQueryString,p.addQueryParams=function(o,p){let f=Object.keys(p);if(!f.length)return o;let m=new URLSearchParams(null==o?void 0:o.escapedQueryString);for(let o of f)m.append(o,p[o]);return Object.assign(Object.assign({},o),{escapedQueryString:m.toString()})};let f={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};p.resolveURL=function(o,p){return fetchWithBehavior(o,f,p).then(p=>p.redirected?p.url:o)},p.isValidAssetGroup=function(o){return!!o&&/^[-.a-zA-Z0-9]+$/.test(o)},p.isValidRevisionID=function(o){return!!o&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(o)}},0x1e62759b2:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.loadWorker=void 0;let m=f(0x6cf4e7cb),_={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};p.loadWorker=(o,p,f,w)=>{null==w||w.debug(`Loading ${p} worker from ${o}.`);let I=!1;try{I=self.origin===new URL(o).origin}catch(o){null==w||w.error("Could not compare origins.",o)}return I?Promise.resolve(new Worker((0,m.withQueryString)(o,f),{name:p})):(0,m.fetchWithBehavior)(o,_,f).then(o=>{if(o.ok)return o.blob().then(o=>new Worker(window.URL.createObjectURL(o)));throw Error("Fetch failed.")})}},0x1676280b0:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.isOldChrome=p.supportsWASMStreaming=p.supportsSharedArrayBuffer=p.supportsWASM=p.supportsAudioWorklet=p.supportsWorker=p.supportsVoiceFocusWorker=p.supportsWASMPostMessage=p.isSafari=void 0;let _=f(0x1e62759b2);p.isSafari=(o=globalThis)=>{let p=o.navigator.userAgent,f=p.match(/Safari\//),m=p.match(/Chrom(?:e|ium)\//);return!!(f&&!m)},p.supportsWASMPostMessage=(o=globalThis)=>!(0,p.isSafari)(o)&&(!((o=globalThis)=>!!o.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/))(o)||95>(chromeVersion(o)||0)),p.supportsVoiceFocusWorker=(o=globalThis,f,w)=>m(void 0,void 0,void 0,function*(){if(!(0,p.supportsWorker)(o,w))return!1;let m=`${f.paths.workers}worker-v1.js`;try{let o=yield(0,_.loadWorker)(m,"VoiceFocusTestWorker",f,w);try{o.terminate()}catch(o){null==w||w.debug("Failed to terminate worker.",o)}return!0}catch(o){return null==w||w.info("Failed to fetch and instantiate test worker",o),!1}}),p.supportsWorker=(o=globalThis,p)=>{try{return!!o.Worker}catch(o){return null==p||p.info("Does not support Worker",o),!1}},p.supportsAudioWorklet=(o=globalThis,p)=>{try{return!!o.AudioWorklet&&!!o.AudioWorkletNode}catch(o){return null==p||p.info("Does not support Audio Worklet",o),!1}},p.supportsWASM=(o=globalThis,p)=>{try{return!!o.WebAssembly&&(!!o.WebAssembly.compile||!!o.WebAssembly.compileStreaming)}catch(o){return null==p||p.info("Does not support WASM",o),!1}},p.supportsSharedArrayBuffer=(o=globalThis,p=globalThis,f)=>{try{return!!o.SharedArrayBuffer&&(!!p.chrome||!!o.crossOriginIsolated)}catch{return null==f||f.info("Does not support SharedArrayBuffer."),!1}},p.supportsWASMStreaming=(o=globalThis,p)=>{var f;try{return!!(null==(f=o.WebAssembly)?void 0:f.compileStreaming)}catch(o){return null==p||p.info("Does not support WASM streaming compilation",o),!1}};let chromeVersion=(o=globalThis)=>{try{if(!o.chrome)return}catch{}let p=o.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/);if(p)return parseInt(p[1],10)};p.isOldChrome=(o=globalThis,p)=>{let f=chromeVersion(o);return!!f&&f<90&&(null==p||p.debug(`Chrome ${f} has incomplete SIMD support.`),!0)}},0x92a11642:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.VoiceFocusAudioWorkletNode=void 0,p.VoiceFocusAudioWorkletNode=class extends("u">typeof globalThis&&globalThis.AudioWorkletNode||class{}){}},0xed65dabf:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.getAudioInput=p.createAudioContext=p.VoiceFocus=void 0;let _=f(0x21cc7ae41),w=f(0x6cf4e7cb),I=f(0x1e62759b2),k=f(0x1676280b0),M=f(0x1f5a31ee0),x=f(0x54e7c75c),O=f(0xe087f61d),L={useVoiceFocusAGC:!1,useBuiltInAGC:!0},B="stable-v1",U="https://static.sdkassets.chime.aws",$={processors:`${U}/processors/`,workers:`${U}/workers/`,wasm:`${U}/wasm/`,models:`${U}/wasm/`},q={latencyHint:0},Z={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},ee=Object.assign(Object.assign({},Z),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),et=Object.assign(Object.assign({},Z),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),ei={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:x.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:O.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:M.default}},validateAssetSpec=(o,p)=>{if(void 0!==o&&!(0,w.isValidAssetGroup)(o))throw Error(`Invalid asset group ${o}`);if(void 0!==p&&!(0,w.isValidRevisionID)(p))throw Error(`Invalid revision ID ${p}`)},urlForModel=(o,p)=>`${p.models}${(0,_.decideModel)(o)}.wasm`,er=class VoiceFocus{constructor(o,p,f,m,_,w){this.processorURL=p,this.nodeConstructor=f,this.nodeOptions=m,this.executionQuanta=_,this.logger=w,this.internal={worker:o,isDestroyed:!1}}getModelMetrics(){var o;return null==(o=this.internal.voiceFocusNode)?void 0:o.getModelMetrics()}reset(){var o,p,f;null==(o=this.internal.voiceFocusNode)||o.reset(),null==(p=this.internal.sourceNode)||p.disconnect(),null==(f=this.internal.destinationNode)||f.disconnect()}enable(){var o;null==(o=this.internal.voiceFocusNode)||o.enable()}disable(){var o;null==(o=this.internal.voiceFocusNode)||o.disable()}setMode(o){var p;null==(p=this.internal.voiceFocusNode)||p.setMode(o)}destroy(){var o,p,f,_,w;return m(this,void 0,void 0,function*(){let{worker:m,isDestroyed:I,voiceFocusNode:k,destinationNode:M,sourceNode:x,audioContext:O}=this.internal;if(I){null==(o=this.logger)||o.debug("Voice Focus is already destroyed");return}try{null==m||m.terminate(),null==x||x.disconnect(),null==M||M.disconnect(),yield Promise.all([null!=(p=null==O?void 0:O.close().catch(o=>o))?p:yield Promise.resolve(),null!=(f=null==k?void 0:k.stop().catch(o=>o))?f:yield Promise.resolve()]),this.internal.audioContext=void 0,this.internal.voiceFocusNode=void 0,this.internal.sourceNode=void 0,this.internal.destinationNode=void 0,null==(_=this.logger)||_.debug("Voice Focus destroyed successfully")}catch(o){throw null==(w=this.logger)||w.error("Error while destroying the Voice Focus instance: ",o),o}finally{this.internal.isDestroyed=!0}})}static isSupported(o,p){let{fetchBehavior:f,logger:m}=p||{};if("u"<typeof globalThis)return null==m||m.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!(0,k.supportsAudioWorklet)(globalThis,m))return null==m||m.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!(0,k.supportsWASM)(globalThis,m))return null==m||m.debug("Browser does not support WASM."),Promise.resolve(!1);(0,k.supportsWASMStreaming)(globalThis,m)||null==m||m.debug("Browser does not support streaming WASM compilation.");let{assetGroup:_=B,revisionID:I,paths:M=$}=o||{};validateAssetSpec(_,I);let x=Object.assign(Object.assign({},(0,w.addQueryParams)(f,I?{revisionID:I}:{assetGroup:_})),{paths:M});return(0,k.supportsVoiceFocusWorker)(globalThis,x,m)}static mungeExecutionPreference(o,p){let f=void 0===o||"auto"===o;if((0,k.isSafari)(globalThis)){if(f||"inline"===o)return"inline";if(!f)throw Error(`Unsupported execution preference ${o}`)}if("worker-sab"===o&&!(0,k.supportsSharedArrayBuffer)(globalThis,globalThis,p))throw Error(`Unsupported execution preference ${o}`);return o||"auto"}static configure(o,p){return m(this,void 0,void 0,function*(){let{fetchBehavior:f,preResolve:m,logger:I}=p||{},{category:k="voicefocus",name:M="default",variant:x="auto",assetGroup:O=B,revisionID:L,simd:U="detect",mode:q="ns",executionPreference:Z="auto",executionQuantaPreference:ee,usagePreference:et="interactivity",estimatorBudget:ei=100,paths:er=$,thresholds:en}=o||{};if(null==I||I.debug("Configuring Voice Focus with spec",o),void 0!==k&&"voicefocus"!==k)throw Error(`Unrecognized category ${k}`);if(void 0!==M&&"default"!==M&&"ns_es"!==M)throw Error(`Unrecognized feature name ${M}`);if(void 0!==x&&!["auto","c100","c50","c20","c10"].includes(x))throw Error(`Unrecognized feature variant ${x}`);if(void 0!==ee&&![1,2,3].includes(ee))throw Error(`Unrecognized execution quanta preference ${ee}`);if(validateAssetSpec(O,L),void 0!==U&&!["detect","force","disable"].includes(U))throw Error(`Unrecognized SIMD option ${U}`);if(void 0!==Z&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(Z))throw Error(`Unrecognized execution preference ${Z}`);if(void 0!==et&&!["quality","interactivity"].includes(et))throw Error(`Unrecognized usage preference ${et}`);let eo={executionPreference:this.mungeExecutionPreference(Z,I),usagePreference:et,executionQuantaPreference:ee,variantPreference:x,namePreference:M,simdPreference:U,estimatorBudget:ei},es=(0,w.addQueryParams)(f,L?{revisionID:L}:{assetGroup:O}),ea=Object.assign({paths:er},es),el=yield(0,_.measureAndDecideExecutionApproach)(eo,ea,I,en);if(!1===el.supported)return{supported:!1,reason:el.reason};null==I||I.info("Decided execution approach",el);let{useSIMD:ed,processor:ec,variant:eu,executionQuanta:eh}=el,ep={category:k||"voicefocus",name:M||"default",mode:q,variant:eu,simd:ed};if(m){let o=urlForModel(ep,er);ep.url=yield(0,w.resolveURL)(o,es)}return{fetchConfig:ea,model:ep,processor:ec,executionQuanta:eh,supported:!0}})}static init(o,{delegate:p,preload:f=!0,logger:_}){return m(this,void 0,void 0,function*(){if(!1===o.supported)throw Error("Voice Focus not supported. Reason: "+o.reason);let{model:m,processor:w,fetchConfig:M,executionQuanta:x}=o,{simd:O,name:L,mode:B}=m,{paths:U}=M;if("voicefocus-inline-processor"!==w&&"voicefocus-worker-postMessage-processor"!==w&&"voicefocus-worker-sab-processor"!==w)throw Error(`Unknown processor ${w}`);let $=m.url||urlForModel(m,U);null==_||_.debug(`Using model URL ${$}.`);let q=`${U.wasm}audio_buffer-v1${O?"_simd":""}.wasm`,Z=`${U.wasm}resampler-v1${O?"_simd":""}.wasm`,ee=`${U.workers}worker-v1.js`,{file:et,node:er}=ei[w],en=`${U.processors}${et}`,eo=yield(0,I.loadWorker)(ee,"VoiceFocusWorker",M,_);if(f){null==_||_.debug("Preloading",$);let o=(0,k.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";eo.postMessage({message:o,preload:!0,key:"model",fetchBehavior:M,path:$})}return Promise.resolve(new VoiceFocus(eo,en,er,{processor:w,worker:eo,audioBufferURL:q,resamplerURL:Z,fetchBehavior:M,modelURL:$,delegate:p,logger:_,numberOfInputs:"ns_es"===L?2:1,mode:B},x,_))})}createNode(o,p){var f;if(this.internal.isDestroyed)throw Error("Unable to create node because VoiceFocus worker has been destroyed.");let{voiceFocusSampleRate:m=16e3===o.sampleRate?16e3:48e3,enabled:_=!0,agc:I=L}=p||{},k=null==p?void 0:p.es,M={voiceFocusSampleRate:m,enabled:_,sendBufferCount:10,prefill:6,agc:I,executionQuanta:this.executionQuanta,supportFarendStream:k,mode:this.nodeOptions.mode},x=(0,w.withQueryString)(this.processorURL,null==(f=this.nodeOptions)?void 0:f.fetchBehavior);return o.audioWorklet.addModule(x).then(()=>new this.nodeConstructor(o,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:M})))}applyToStream(o,p,f,_=!1){var w,I,k;return m(this,void 0,void 0,function*(){let m;if(this.internal.isDestroyed)throw Error("Unable to apply stream because VoiceFocus worker has been destroyed");null==(w=this.internal.sourceNode)||w.disconnect(),null==(I=this.internal.destinationNode)||I.disconnect(),_&&this.internal.voiceFocusNode&&this.internal.voiceFocusNode.isEnabled()?(null==(k=this.logger)||k.info("Re-using existing voice focus node"),m=this.internal.voiceFocusNode):m=yield this.createNode(p,f);let M=p.createMediaStreamSource(o);M.connect(m);let x=p.createMediaStreamDestination();return m.connect(x),this.internal=Object.assign(Object.assign({},this.internal),{voiceFocusNode:m,sourceNode:M,destinationNode:x,audioContext:p}),{node:m,source:M,destination:x,stream:x.stream}})}applyToSourceNode(o,p,f){return m(this,void 0,void 0,function*(){let m=yield this.createNode(p,f);return o.connect(m),m})}};p.VoiceFocus=er,p.createAudioContext=(o=q)=>new(window.AudioContext||window.webkitAudioContext)(o),p.getAudioInput=(o,p,f)=>m(void 0,void 0,void 0,function*(){var m,_;let{constraints:w,spec:I,delegate:k,preload:M=!0,options:x}=p,{logger:O}=f,B=yield er.configure(I,f);if(!B.supported)return null==(m=f.logger)||m.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(w);let U=yield er.init(B,{delegate:k,preload:M,logger:O}),$=(null==(_=p.options)?void 0:_.agc)||L,q=yield window.navigator.mediaDevices.getUserMedia(((o,p)=>{let f;if(f=p.useBuiltInAGC?ee:et,!o)return{audio:f};if(!o.audio)return o;if(o.video)throw Error("Not adding Voice Focus to multi-device getUserMedia call.");return Object.assign(Object.assign({},o),{audio:!0===o.audio?f:Object.assign(Object.assign({},o.audio),f)})})(w,$));return U.applyToStream(q,o,x).then(o=>o.stream)})},0x1f5a31ee0:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1676280b0),w=f(0x92a11642);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.cpuWarningCount=0,this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,worker:m,fetchBehavior:w,logger:I,delegate:k}=p;this.logger=I,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=k,I&&I.debug("VoiceFocusInlineNode:",f),this.worker=m,this.worker.onmessage=this.onWorkerMessage.bind(this);const M=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:M,key:"model",fetchBehavior:w,path:f}),this.enabled=!0}onModuleBufferLoaded(o,p){this.port.postMessage({message:"module-buffer",buffer:o,key:p})}onModuleLoaded(o,p){this.port.postMessage({message:"module",module:o,key:p})}enable(){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){var o;return m(this,void 0,void 0,function*(){this.port.postMessage({message:"stop"});try{null==(o=this.worker)||o.terminate()}catch(o){console.error("failed to terminate worker:",o)}this.disconnect(),this.enabled=!1})}reset(){this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.port.postMessage({message:"reset"})}isEnabled(){return this.enabled}onProcessorMessage(o){var p,f,m,_,w,I;let{data:k}=o,{message:M}=k;switch(M){case"cpu":let{reason:x,count:O}=k;x&&O&&(this.metrics.cpu=Object.assign(Object.assign({},this.metrics.cpu),{[x]:O+this.metrics.cpu[x]})),this.cpuWarningCount++;let L=Date.now(),B=this.cpuWarningLastTriggered||L,U=Math.abs(L-B);(!this.cpuWarningLastTriggered||U>5e3)&&(null==(p=this.logger)||p.warn(`CPU warning (count: ${this.cpuWarningCount}):`,M),this.cpuWarningCount=0,this.cpuWarningLastTriggered=L),null==(f=this.delegate)||f.onCPUWarning();break;case"metrics":let{metrics:$}=k;if(!$){null==(m=this.logger)||m.warn("Got metrics message but no metrics payload");break}if(this.metrics=Object.assign(Object.assign({},this.metrics),$),this.logger){let o=Date.now();o-(null!=(_=this.metricsLastRecorded)?_:0)>5e3&&(null==(w=this.logger)||w.debug("Contact metrics:",this.metrics),this.metricsLastRecorded=o)}break;default:null==(I=this.logger)||I.debug("Ignoring processor message.")}}getModelMetrics(){return this.metrics}onWorkerMessage(o){let p=o.data;switch(p.message){case"module-buffer":if(!p.buffer||!p.key)return;this.onModuleBufferLoaded(p.buffer,p.key);break;case"module":if(!p.module||!p.key)return;this.onModuleLoaded(p.module,p.key);break;case"stopped":this.worker&&this.worker.terminate();break;default:return}}}},0xe087f61d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1676280b0),w=f(0x92a11642);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,audioBufferURL:m,worker:w,fetchBehavior:I,delegate:k}=p;this.delegate=k,this.worker=w,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:M,agc:x,supportFarendStream:O}=p.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===o.sampleRate?160:480,enabled:M,agc:x,fetchBehavior:I,model:f,supportFarendStream:O});const L=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:L,key:"buffer",fetchBehavior:I,path:m}),this.enabled=!0}enable(){return m(this,void 0,void 0,function*(){this.worker.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.worker.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){return m(this,void 0,void 0,function*(){try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect(),this.enabled=!1})}getModelMetrics(){}reset(){}isEnabled(){return this.enabled}onWorkerMessage(o){var p;let f=o.data;switch(f.message){case"ready":this.port.postMessage({message:"ready",shared:f.shared},f.shared?Object.values(f.shared):[]);break;case"data":if(!f.buffer)return;this.port.postMessage({message:"data",buffer:f.buffer},[f.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(f);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;default:return}}onProcessorMessage(o){var p;let f=o.data;switch(f.message){case"data":if(!f.buffer)return;this.worker.postMessage({message:"data",buffer:f.buffer},[f.buffer]);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(f);break;default:return}}}},0x54e7c75c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1676280b0),w=f(0x92a11642);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,resamplerURL:m,worker:w,fetchBehavior:I,delegate:k}=p;this.delegate=k,this.worker=w,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:M,supportFarendStream:x}=p.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===o.sampleRate?160:480,enabled:M,model:f,supportFarendStream:x});const O=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:O,key:"resampler",fetchBehavior:I,path:m}),this.enabled=!0}enable(){return m(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,1,1),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,1,0),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){return m(this,void 0,void 0,function*(){if(this.state)Atomics.store(this.state,1,2),Atomics.notify(this.state,0,1);else try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect(),this.enabled=!1})}getModelMetrics(){}reset(){}isEnabled(){return this.enabled}onWorkerMessage(o){var p;let f=o.data;switch(f.message){case"ready":if(!f.shared)throw Error("No shared state.");this.state=new Int32Array(f.shared.state),this.port.postMessage(f);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(f);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;default:return}}onProcessorMessage(o){var p;let f=o.data;switch(f.message){case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(f)}}}},0x4a1b883a:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.RawSha256=void 0;var m=f(0x6d171382);p.RawSha256=function(){function RawSha256(){this.state=Int32Array.from(m.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return RawSha256.prototype.update=function(o){if(this.finished)throw Error("Attempted to update an already finished hash.");var p=0,f=o.byteLength;if(this.bytesHashed+=f,8*this.bytesHashed>m.MAX_HASHABLE_LENGTH)throw Error("Cannot hash more than 2^53 - 1 bits");for(;f>0;)this.buffer[this.bufferLength++]=o[p++],f--,this.bufferLength===m.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},RawSha256.prototype.digest=function(){if(!this.finished){var o=8*this.bytesHashed,p=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),f=this.bufferLength;if(p.setUint8(this.bufferLength++,128),f%m.BLOCK_SIZE>=m.BLOCK_SIZE-8){for(var _=this.bufferLength;_<m.BLOCK_SIZE;_++)p.setUint8(_,0);this.hashBuffer(),this.bufferLength=0}for(var _=this.bufferLength;_<m.BLOCK_SIZE-8;_++)p.setUint8(_,0);p.setUint32(m.BLOCK_SIZE-8,Math.floor(o/0x100000000),!0),p.setUint32(m.BLOCK_SIZE-4,o),this.hashBuffer(),this.finished=!0}for(var w=new Uint8Array(m.DIGEST_LENGTH),_=0;_<8;_++)w[4*_]=this.state[_]>>>24&255,w[4*_+1]=this.state[_]>>>16&255,w[4*_+2]=this.state[_]>>>8&255,w[4*_+3]=this.state[_]>>>0&255;return w},RawSha256.prototype.hashBuffer=function(){for(var o=this.buffer,p=this.state,f=p[0],_=p[1],w=p[2],I=p[3],k=p[4],M=p[5],x=p[6],O=p[7],L=0;L<m.BLOCK_SIZE;L++){if(L<16)this.temp[L]=(255&o[4*L])<<24|(255&o[4*L+1])<<16|(255&o[4*L+2])<<8|255&o[4*L+3];else{var B=this.temp[L-2],U=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,$=((B=this.temp[L-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3;this.temp[L]=(U+this.temp[L-7]|0)+($+this.temp[L-16]|0)}var q=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&M^~k&x)|0)+(O+(m.KEY[L]+this.temp[L]|0)|0)|0,Z=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&_^f&w^_&w)|0;O=x,x=M,M=k,k=I+q|0,I=w,w=_,_=f,f=q+Z|0}p[0]+=f,p[1]+=_,p[2]+=w,p[3]+=I,p[4]+=k,p[5]+=M,p[6]+=x,p[7]+=O},RawSha256}()},0x6d171382:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.MAX_HASHABLE_LENGTH=p.INIT=p.KEY=p.DIGEST_LENGTH=p.BLOCK_SIZE=void 0,p.BLOCK_SIZE=64,p.DIGEST_LENGTH=32,p.KEY=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),p.INIT=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],p.MAX_HASHABLE_LENGTH=0x1fffffffffffff},0x2869cb2b:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),f(0x2cf9a037).__exportStar(f(0xea66e871),p)},0xea66e871:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Sha256=void 0;var m=f(0x2cf9a037),_=f(0x6d171382),w=f(0x4a1b883a),I=f(0xfc6febaa);function bufferFromSecret(o){var p=(0,I.convertToBuffer)(o);if(p.byteLength>_.BLOCK_SIZE){var f=new w.RawSha256;f.update(p),p=f.digest()}var m=new Uint8Array(_.BLOCK_SIZE);return m.set(p),m}p.Sha256=function(){function Sha256(o){if(this.hash=new w.RawSha256,o){this.outer=new w.RawSha256;var p=bufferFromSecret(o),f=new Uint8Array(_.BLOCK_SIZE);f.set(p);for(var m=0;m<_.BLOCK_SIZE;m++)p[m]^=54,f[m]^=92;this.hash.update(p),this.outer.update(f);for(var m=0;m<p.byteLength;m++)p[m]=0}}return Sha256.prototype.update=function(o){if(!(0,I.isEmptyData)(o)&&!this.error)try{this.hash.update((0,I.convertToBuffer)(o))}catch(o){this.error=o}},Sha256.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},Sha256.prototype.digest=function(){return m.__awaiter(this,void 0,void 0,function(){return m.__generator(this,function(o){return[2,this.digestSync()]})})},Sha256}()},0x151526ea2:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.convertToBuffer=void 0;var m=f(0x1d34794c1),_="u">typeof Buffer&&Buffer.from?function(o){return Buffer.from(o,"utf8")}:m.fromUtf8;p.convertToBuffer=function(o){return o instanceof Uint8Array?o:"string"==typeof o?_(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o)}},0xfc6febaa:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.uint32ArrayFrom=p.numToUint8=p.isEmptyData=p.convertToBuffer=void 0;var m=f(0x151526ea2);Object.defineProperty(p,"convertToBuffer",{enumerable:!0,get:function(){return m.convertToBuffer}});var _=f(0x244fb30b3);Object.defineProperty(p,"isEmptyData",{enumerable:!0,get:function(){return _.isEmptyData}});var w=f(0xb35e88d9);Object.defineProperty(p,"numToUint8",{enumerable:!0,get:function(){return w.numToUint8}});var I=f(0x1f69f634);Object.defineProperty(p,"uint32ArrayFrom",{enumerable:!0,get:function(){return I.uint32ArrayFrom}})},0x244fb30b3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isEmptyData=void 0,p.isEmptyData=function(o){return"string"==typeof o?0===o.length:0===o.byteLength}},0xb35e88d9:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.numToUint8=void 0,p.numToUint8=function(o){return new Uint8Array([(0xff000000&o)>>24,(0xff0000&o)>>16,(65280&o)>>8,255&o])}},0x1f69f634:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.uint32ArrayFrom=void 0,p.uint32ArrayFrom=function(o){if(!Uint32Array.from){for(var p=new Uint32Array(o.length),f=0;f<o.length;)p[f]=o[f],f+=1;return p}return Uint32Array.from(o)}},0x10e0ee2b6:(o,p,f)=>{"use strict";let{Deflate:m,deflate:_,deflateRaw:w,gzip:I}=f(0xa9814691),{Inflate:k,inflate:M,inflateRaw:x,ungzip:O}=f(0xcafc2cd),L=f(0x7c5bfc5);o.exports.Deflate=m,o.exports.deflate=_,o.exports.deflateRaw=w,o.exports.gzip=I,o.exports.Inflate=k,o.exports.inflate=M,o.exports.inflateRaw=x,o.exports.ungzip=O,o.exports.constants=L},0xa9814691:(o,p,f)=>{"use strict";let m=f(0x1c125237f),_=f(0x69a3d875),w=f(0x1834971a6),I=f(0x16ee44604),k=f(0x1cd54c07e),M=Object.prototype.toString,{Z_NO_FLUSH:x,Z_SYNC_FLUSH:O,Z_FULL_FLUSH:L,Z_FINISH:B,Z_OK:U,Z_STREAM_END:$,Z_DEFAULT_COMPRESSION:q,Z_DEFAULT_STRATEGY:Z,Z_DEFLATED:ee}=f(0x7c5bfc5);function Deflate(o){this.options=_.assign({level:q,method:ee,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z},o||{});let p=this.options;p.raw&&p.windowBits>0?p.windowBits=-p.windowBits:p.gzip&&p.windowBits>0&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;let f=m.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(f!==U)throw Error(I[f]);if(p.header&&m.deflateSetHeader(this.strm,p.header),p.dictionary){let o;if(o="string"==typeof p.dictionary?w.string2buf(p.dictionary):"[object ArrayBuffer]"===M.call(p.dictionary)?new Uint8Array(p.dictionary):p.dictionary,(f=m.deflateSetDictionary(this.strm,o))!==U)throw Error(I[f]);this._dict_set=!0}}function deflate(o,p){let f=new Deflate(p);if(f.push(o,!0),f.err)throw f.msg||I[f.err];return f.result}function deflateRaw(o,p){return(p=p||{}).raw=!0,deflate(o,p)}function gzip(o,p){return(p=p||{}).gzip=!0,deflate(o,p)}Deflate.prototype.push=function(o,p){let f,_,I=this.strm,k=this.options.chunkSize;if(this.ended)return!1;for(_=p===~~p?p:!0===p?B:x,"string"==typeof o?I.input=w.string2buf(o):"[object ArrayBuffer]"===M.call(o)?I.input=new Uint8Array(o):I.input=o,I.next_in=0,I.avail_in=I.input.length;;){if(0===I.avail_out&&(I.output=new Uint8Array(k),I.next_out=0,I.avail_out=k),(_===O||_===L)&&I.avail_out<=6){this.onData(I.output.subarray(0,I.next_out)),I.avail_out=0;continue}if((f=m.deflate(I,_))===$)return I.next_out>0&&this.onData(I.output.subarray(0,I.next_out)),f=m.deflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===U;if(0===I.avail_out){this.onData(I.output);continue}if(_>0&&I.next_out>0){this.onData(I.output.subarray(0,I.next_out)),I.avail_out=0;continue}if(0===I.avail_in)break}return!0},Deflate.prototype.onData=function(o){this.chunks.push(o)},Deflate.prototype.onEnd=function(o){o===U&&(this.result=_.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},o.exports.Deflate=Deflate,o.exports.deflate=deflate,o.exports.deflateRaw=deflateRaw,o.exports.gzip=gzip,o.exports.constants=f(0x7c5bfc5)},0xcafc2cd:(o,p,f)=>{"use strict";let m=f(0x5ae41d37),_=f(0x69a3d875),w=f(0x1834971a6),I=f(0x16ee44604),k=f(0x1cd54c07e),M=f(0x1bc0bb2fc),x=Object.prototype.toString,{Z_NO_FLUSH:O,Z_FINISH:L,Z_OK:B,Z_STREAM_END:U,Z_NEED_DICT:$,Z_STREAM_ERROR:q,Z_DATA_ERROR:Z,Z_MEM_ERROR:ee}=f(0x7c5bfc5);function Inflate(o){this.options=_.assign({chunkSize:65536,windowBits:15,to:""},o||{});let p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,0===p.windowBits&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(o&&o.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(15&p.windowBits)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;let f=m.inflateInit2(this.strm,p.windowBits);if(f!==B||(this.header=new M,m.inflateGetHeader(this.strm,this.header),p.dictionary&&("string"==typeof p.dictionary?p.dictionary=w.string2buf(p.dictionary):"[object ArrayBuffer]"===x.call(p.dictionary)&&(p.dictionary=new Uint8Array(p.dictionary)),p.raw)&&(f=m.inflateSetDictionary(this.strm,p.dictionary))!==B))throw Error(I[f])}function inflate(o,p){let f=new Inflate(p);if(f.push(o),f.err)throw f.msg||I[f.err];return f.result}function inflateRaw(o,p){return(p=p||{}).raw=!0,inflate(o,p)}Inflate.prototype.push=function(o,p){let f,_,I,k=this.strm,M=this.options.chunkSize,et=this.options.dictionary;if(this.ended)return!1;for(_=p===~~p?p:!0===p?L:O,"[object ArrayBuffer]"===x.call(o)?k.input=new Uint8Array(o):k.input=o,k.next_in=0,k.avail_in=k.input.length;;){for(0===k.avail_out&&(k.output=new Uint8Array(M),k.next_out=0,k.avail_out=M),(f=m.inflate(k,_))===$&&et&&((f=m.inflateSetDictionary(k,et))===B?f=m.inflate(k,_):f===Z&&(f=$));k.avail_in>0&&f===U&&k.state.wrap>0&&0!==o[k.next_in];)m.inflateReset(k),f=m.inflate(k,_);switch(f){case q:case Z:case $:case ee:return this.onEnd(f),this.ended=!0,!1}if(I=k.avail_out,k.next_out&&(0===k.avail_out||f===U))if("string"===this.options.to){let o=w.utf8border(k.output,k.next_out),p=k.next_out-o,f=w.buf2string(k.output,o);k.next_out=p,k.avail_out=M-p,p&&k.output.set(k.output.subarray(o,o+p),0),this.onData(f)}else this.onData(k.output.length===k.next_out?k.output:k.output.subarray(0,k.next_out));if(f!==B||0!==I){if(f===U)return f=m.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,!0;if(0===k.avail_in)break}}return!0},Inflate.prototype.onData=function(o){this.chunks.push(o)},Inflate.prototype.onEnd=function(o){o===B&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=_.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},o.exports.Inflate=Inflate,o.exports.inflate=inflate,o.exports.inflateRaw=inflateRaw,o.exports.ungzip=inflate,o.exports.constants=f(0x7c5bfc5)},0x69a3d875:o=>{"use strict";let _has=(o,p)=>Object.prototype.hasOwnProperty.call(o,p);o.exports.assign=function(o){let p=Array.prototype.slice.call(arguments,1);for(;p.length;){let f=p.shift();if(f){if("object"!=typeof f)throw TypeError(f+"must be non-object");for(let p in f)_has(f,p)&&(o[p]=f[p])}}return o},o.exports.flattenChunks=o=>{let p=0;for(let f=0,m=o.length;f<m;f++)p+=o[f].length;let f=new Uint8Array(p);for(let p=0,m=0,_=o.length;p<_;p++){let _=o[p];f.set(_,m),m+=_.length}return f}},0x1834971a6:o=>{"use strict";let p=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{p=!1}let f=new Uint8Array(256);for(let o=0;o<256;o++)f[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;f[254]=f[254]=1,o.exports.string2buf=o=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(o);let p,f,m,_,w,I=o.length,k=0;for(_=0;_<I;_++)(64512&(f=o.charCodeAt(_)))==55296&&_+1<I&&(64512&(m=o.charCodeAt(_+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),_++),k+=f<128?1:f<2048?2:f<65536?3:4;for(w=0,p=new Uint8Array(k),_=0;w<k;_++)(64512&(f=o.charCodeAt(_)))==55296&&_+1<I&&(64512&(m=o.charCodeAt(_+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),_++),f<128?p[w++]=f:(f<2048?p[w++]=192|f>>>6:(f<65536?p[w++]=224|f>>>12:(p[w++]=240|f>>>18,p[w++]=128|f>>>12&63),p[w++]=128|f>>>6&63),p[w++]=128|63&f);return p},o.exports.buf2string=(o,m)=>{let _,w,I=m||o.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(o.subarray(0,m));let k=Array(2*I);for(w=0,_=0;_<I;){let p=o[_++];if(p<128){k[w++]=p;continue}let m=f[p];if(m>4){k[w++]=65533,_+=m-1;continue}for(p&=2===m?31:3===m?15:7;m>1&&_<I;)p=p<<6|63&o[_++],m--;if(m>1){k[w++]=65533;continue}p<65536?k[w++]=p:(p-=65536,k[w++]=55296|p>>10&1023,k[w++]=56320|1023&p)}var M=w;if(M<65534&&k.subarray&&p)return String.fromCharCode.apply(null,k.length===M?k:k.subarray(0,M));let x="";for(let o=0;o<M;o++)x+=String.fromCharCode(k[o]);return x},o.exports.utf8border=(o,p)=>{(p=p||o.length)>o.length&&(p=o.length);let m=p-1;for(;m>=0&&(192&o[m])==128;)m--;return m<0||0===m?p:m+f[o[m]]>p?m:p}},0x23985e12d:o=>{"use strict";o.exports=(o,p,f,m)=>{let _=65535&o,w=o>>>16&65535,I=0;for(;0!==f;){I=f>2e3?2e3:f,f-=I;do w=w+(_=_+p[m++]|0)|0;while(--I)_%=65521,w%=65521}return _|w<<16}},0x7c5bfc5:o=>{"use strict";o.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},0x23f5d121b:o=>{"use strict";let p=new Uint32Array((()=>{let o,p=[];for(var f=0;f<256;f++){o=f;for(var m=0;m<8;m++)o=1&o?0xedb88320^o>>>1:o>>>1;p[f]=o}return p})());o.exports=(o,f,m,_)=>{let w=_+m;o^=-1;for(let m=_;m<w;m++)o=o>>>8^p[(o^f[m])&255];return -1^o}},0x1c125237f:(o,p,f)=>{"use strict";let{_tr_init:m,_tr_stored_block:_,_tr_flush_block:w,_tr_tally:I,_tr_align:k}=f(0x148a53f1),M=f(0x23985e12d),x=f(0x23f5d121b),O=f(0x16ee44604),{Z_NO_FLUSH:L,Z_PARTIAL_FLUSH:B,Z_FULL_FLUSH:U,Z_FINISH:$,Z_BLOCK:q,Z_OK:Z,Z_STREAM_END:ee,Z_STREAM_ERROR:et,Z_DATA_ERROR:ei,Z_BUF_ERROR:er,Z_DEFAULT_COMPRESSION:en,Z_FILTERED:eo,Z_HUFFMAN_ONLY:es,Z_RLE:ea,Z_FIXED:el,Z_DEFAULT_STRATEGY:ed,Z_UNKNOWN:ec,Z_DEFLATED:eu}=f(0x7c5bfc5),eh=573,err=(o,p)=>(o.msg=O[p],p),rank=o=>(o<<1)-9*(o>4),zero=o=>{let p=o.length;for(;--p>=0;)o[p]=0},HASH=(o,p,f)=>(p<<o.hash_shift^f)&o.hash_mask,flush_pending=o=>{let p=o.state,f=p.pending;f>o.avail_out&&(f=o.avail_out),0!==f&&(o.output.set(p.pending_buf.subarray(p.pending_out,p.pending_out+f),o.next_out),o.next_out+=f,p.pending_out+=f,o.total_out+=f,o.avail_out-=f,p.pending-=f,0===p.pending&&(p.pending_out=0))},flush_block_only=(o,p)=>{w(o,o.block_start>=0?o.block_start:-1,o.strstart-o.block_start,p),o.block_start=o.strstart,flush_pending(o.strm)},put_byte=(o,p)=>{o.pending_buf[o.pending++]=p},putShortMSB=(o,p)=>{o.pending_buf[o.pending++]=p>>>8&255,o.pending_buf[o.pending++]=255&p},read_buf=(o,p,f,m)=>{let _=o.avail_in;return(_>m&&(_=m),0===_)?0:(o.avail_in-=_,p.set(o.input.subarray(o.next_in,o.next_in+_),f),1===o.state.wrap?o.adler=M(o.adler,p,_,f):2===o.state.wrap&&(o.adler=x(o.adler,p,_,f)),o.next_in+=_,o.total_in+=_,_)},longest_match=(o,p)=>{let f,m,_=o.max_chain_length,w=o.strstart,I=o.prev_length,k=o.nice_match,M=o.strstart>o.w_size-262?o.strstart-(o.w_size-262):0,x=o.window,O=o.w_mask,L=o.prev,B=o.strstart+258,U=x[w+I-1],$=x[w+I];o.prev_length>=o.good_match&&(_>>=2),k>o.lookahead&&(k=o.lookahead);do{if(x[(f=p)+I]!==$||x[f+I-1]!==U||x[f]!==x[w]||x[++f]!==x[w+1])continue;w+=2,f++;do;while(x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&w<B)if(m=258-(B-w),w=B-258,m>I){if(o.match_start=p,I=m,m>=k)break;U=x[w+I-1],$=x[w+I]}}while((p=L[p&O])>M&&0!=--_)return I<=o.lookahead?I:o.lookahead},fill_window=o=>{let p,f,m,_,w,I=o.w_size;do{if(_=o.window_size-o.lookahead-o.strstart,o.strstart>=I+(I-262)){o.window.set(o.window.subarray(I,I+I),0),o.match_start-=I,o.strstart-=I,o.block_start-=I,p=f=o.hash_size;do m=o.head[--p],o.head[p]=m>=I?m-I:0;while(--f)p=f=I;do m=o.prev[--p],o.prev[p]=m>=I?m-I:0;while(--f)_+=I}if(0===o.strm.avail_in)break;if(f=read_buf(o.strm,o.window,o.strstart+o.lookahead,_),o.lookahead+=f,o.lookahead+o.insert>=3)for(w=o.strstart-o.insert,o.ins_h=o.window[w],o.ins_h=HASH(o,o.ins_h,o.window[w+1]);o.insert&&(o.ins_h=HASH(o,o.ins_h,o.window[w+3-1]),o.prev[w&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=w,w++,o.insert--,!(o.lookahead+o.insert<3)););}while(o.lookahead<262&&0!==o.strm.avail_in)},deflate_fast=(o,p)=>{let f,m;for(;;){if(o.lookahead<262){if(fill_window(o),o.lookahead<262&&p===L)return 1;if(0===o.lookahead)break}if(f=0,o.lookahead>=3&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),0!==f&&o.strstart-f<=o.w_size-262&&(o.match_length=longest_match(o,f)),o.match_length>=3)if(m=I(o,o.strstart-o.match_start,o.match_length-3),o.lookahead-=o.match_length,o.match_length<=o.max_lazy_match&&o.lookahead>=3){o.match_length--;do o.strstart++,o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart;while(0!=--o.match_length)o.strstart++}else o.strstart+=o.match_length,o.match_length=0,o.ins_h=o.window[o.strstart],o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+1]);else m=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++;if(m&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=o.strstart<2?o.strstart:2,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2},deflate_slow=(o,p)=>{let f,m,_;for(;;){if(o.lookahead<262){if(fill_window(o),o.lookahead<262&&p===L)return 1;if(0===o.lookahead)break}if(f=0,o.lookahead>=3&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),o.prev_length=o.match_length,o.prev_match=o.match_start,o.match_length=2,0!==f&&o.prev_length<o.max_lazy_match&&o.strstart-f<=o.w_size-262&&(o.match_length=longest_match(o,f),o.match_length<=5&&(o.strategy===eo||3===o.match_length&&o.strstart-o.match_start>4096)&&(o.match_length=2)),o.prev_length>=3&&o.match_length<=o.prev_length){_=o.strstart+o.lookahead-3,m=I(o,o.strstart-1-o.prev_match,o.prev_length-3),o.lookahead-=o.prev_length-1,o.prev_length-=2;do++o.strstart<=_&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart);while(0!=--o.prev_length)if(o.match_available=0,o.match_length=2,o.strstart++,m&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}else if(o.match_available){if((m=I(o,0,o.window[o.strstart-1]))&&flush_block_only(o,!1),o.strstart++,o.lookahead--,0===o.strm.avail_out)return 1}else o.match_available=1,o.strstart++,o.lookahead--}return(o.match_available&&(m=I(o,0,o.window[o.strstart-1]),o.match_available=0),o.insert=o.strstart<2?o.strstart:2,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2};function Config(o,p,f,m,_){this.good_length=o,this.max_lazy=p,this.nice_length=f,this.max_chain=m,this.func=_}let ep=[new Config(0,0,0,0,(o,p)=>{let f=65535;for(65535>o.pending_buf_size-5&&(f=o.pending_buf_size-5);;){if(o.lookahead<=1){if(fill_window(o),0===o.lookahead&&p===L)return 1;if(0===o.lookahead)break}o.strstart+=o.lookahead,o.lookahead=0;let m=o.block_start+f;if((0===o.strstart||o.strstart>=m)&&(o.lookahead=o.strstart-m,o.strstart=m,flush_block_only(o,!1),0===o.strm.avail_out)||o.strstart-o.block_start>=o.w_size-262&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:(o.strstart>o.block_start&&(flush_block_only(o,!1),o.strm.avail_out),1)}),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=eu,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*eh),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),zero(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let deflateResetKeep=o=>{if(!o||!o.state)return err(o,et);o.total_in=o.total_out=0,o.data_type=ec;let p=o.state;return p.pending=0,p.pending_out=0,p.wrap<0&&(p.wrap=-p.wrap),p.status=p.wrap?42:113,o.adler=+(2!==p.wrap),p.last_flush=L,m(p),Z},deflateReset=o=>{var p;let f=deflateResetKeep(o);return f===Z&&((p=o.state).window_size=2*p.w_size,zero(p.head),p.max_lazy_match=ep[p.level].max_lazy,p.good_match=ep[p.level].good_length,p.nice_match=ep[p.level].nice_length,p.max_chain_length=ep[p.level].max_chain,p.strstart=0,p.block_start=0,p.lookahead=0,p.insert=0,p.match_length=p.prev_length=2,p.match_available=0,p.ins_h=0),f},deflateInit2=(o,p,f,m,_,w)=>{if(!o)return et;let I=1;if(p===en&&(p=6),m<0?(I=0,m=-m):m>15&&(I=2,m-=16),_<1||_>9||f!==eu||m<8||m>15||p<0||p>9||w<0||w>el)return err(o,et);8===m&&(m=9);let k=new DeflateState;return o.state=k,k.strm=o,k.wrap=I,k.gzhead=null,k.w_bits=m,k.w_size=1<<k.w_bits,k.w_mask=k.w_size-1,k.hash_bits=_+7,k.hash_size=1<<k.hash_bits,k.hash_mask=k.hash_size-1,k.hash_shift=~~((k.hash_bits+3-1)/3),k.window=new Uint8Array(2*k.w_size),k.head=new Uint16Array(k.hash_size),k.prev=new Uint16Array(k.w_size),k.lit_bufsize=1<<_+6,k.pending_buf_size=4*k.lit_bufsize,k.pending_buf=new Uint8Array(k.pending_buf_size),k.d_buf=+k.lit_bufsize,k.l_buf=3*k.lit_bufsize,k.level=p,k.strategy=w,k.method=f,deflateReset(o)};o.exports.deflateInit=(o,p)=>deflateInit2(o,p,eu,15,8,ed),o.exports.deflateInit2=deflateInit2,o.exports.deflateReset=deflateReset,o.exports.deflateResetKeep=deflateResetKeep,o.exports.deflateSetHeader=(o,p)=>o&&o.state&&2===o.state.wrap?(o.state.gzhead=p,Z):et,o.exports.deflate=(o,p)=>{let f,m;if(!o||!o.state||p>q||p<0)return o?err(o,et):et;let w=o.state;if(!o.output||!o.input&&0!==o.avail_in||666===w.status&&p!==$)return err(o,0===o.avail_out?er:et);w.strm=o;let M=w.last_flush;if(w.last_flush=p,42===w.status)if(2===w.wrap)o.adler=0,put_byte(w,31),put_byte(w,139),put_byte(w,8),w.gzhead?(put_byte(w,+!!w.gzhead.text+2*!!w.gzhead.hcrc+4*!!w.gzhead.extra+8*!!w.gzhead.name+16*!!w.gzhead.comment),put_byte(w,255&w.gzhead.time),put_byte(w,w.gzhead.time>>8&255),put_byte(w,w.gzhead.time>>16&255),put_byte(w,w.gzhead.time>>24&255),put_byte(w,9===w.level?2:4*(w.strategy>=es||w.level<2)),put_byte(w,255&w.gzhead.os),w.gzhead.extra&&w.gzhead.extra.length&&(put_byte(w,255&w.gzhead.extra.length),put_byte(w,w.gzhead.extra.length>>8&255)),w.gzhead.hcrc&&(o.adler=x(o.adler,w.pending_buf,w.pending,0)),w.gzindex=0,w.status=69):(put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,9===w.level?2:4*(w.strategy>=es||w.level<2)),put_byte(w,3),w.status=113);else{let p=eu+(w.w_bits-8<<4)<<8;p|=(w.strategy>=es||w.level<2?0:w.level<6?1:6===w.level?2:3)<<6,0!==w.strstart&&(p|=32),p+=31-p%31,w.status=113,putShortMSB(w,p),0!==w.strstart&&(putShortMSB(w,o.adler>>>16),putShortMSB(w,65535&o.adler)),o.adler=1}if(69===w.status)if(w.gzhead.extra){for(f=w.pending;w.gzindex<(65535&w.gzhead.extra.length)&&(w.pending!==w.pending_buf_size||(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending!==w.pending_buf_size));)put_byte(w,255&w.gzhead.extra[w.gzindex]),w.gzindex++;w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),w.gzindex===w.gzhead.extra.length&&(w.gzindex=0,w.status=73)}else w.status=73;if(73===w.status)if(w.gzhead.name){f=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending===w.pending_buf_size)){m=1;break}m=w.gzindex<w.gzhead.name.length?255&w.gzhead.name.charCodeAt(w.gzindex++):0,put_byte(w,m)}while(0!==m)w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),0===m&&(w.gzindex=0,w.status=91)}else w.status=91;if(91===w.status)if(w.gzhead.comment){f=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending===w.pending_buf_size)){m=1;break}m=w.gzindex<w.gzhead.comment.length?255&w.gzhead.comment.charCodeAt(w.gzindex++):0,put_byte(w,m)}while(0!==m)w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),0===m&&(w.status=103)}else w.status=103;if(103===w.status&&(w.gzhead.hcrc?(w.pending+2>w.pending_buf_size&&flush_pending(o),w.pending+2<=w.pending_buf_size&&(put_byte(w,255&o.adler),put_byte(w,o.adler>>8&255),o.adler=0,w.status=113)):w.status=113),0!==w.pending){if(flush_pending(o),0===o.avail_out)return w.last_flush=-1,Z}else if(0===o.avail_in&&rank(p)<=rank(M)&&p!==$)return err(o,er);if(666===w.status&&0!==o.avail_in)return err(o,er);if(0!==o.avail_in||0!==w.lookahead||p!==L&&666!==w.status){let f=w.strategy===es?((o,p)=>{let f;for(;;){if(0===o.lookahead&&(fill_window(o),0===o.lookahead)){if(p===L)return 1;break}if(o.match_length=0,f=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,f&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2})(w,p):w.strategy===ea?((o,p)=>{let f,m,_,w,k=o.window;for(;;){if(o.lookahead<=258){if(fill_window(o),o.lookahead<=258&&p===L)return 1;if(0===o.lookahead)break}if(o.match_length=0,o.lookahead>=3&&o.strstart>0&&(m=k[_=o.strstart-1])===k[++_]&&m===k[++_]&&m===k[++_]){w=o.strstart+258;do;while(m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&_<w)o.match_length=258-(w-_),o.match_length>o.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=3?(f=I(o,1,o.match_length-3),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(f=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),f&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2})(w,p):ep[w.level].func(w,p);if((3===f||4===f)&&(w.status=666),1===f||3===f)return 0===o.avail_out&&(w.last_flush=-1),Z;if(2===f&&(p===B?k(w):p!==q&&(_(w,0,0,!1),p===U&&(zero(w.head),0===w.lookahead&&(w.strstart=0,w.block_start=0,w.insert=0))),flush_pending(o),0===o.avail_out))return w.last_flush=-1,Z}return p!==$?Z:w.wrap<=0?ee:(2===w.wrap?(put_byte(w,255&o.adler),put_byte(w,o.adler>>8&255),put_byte(w,o.adler>>16&255),put_byte(w,o.adler>>24&255),put_byte(w,255&o.total_in),put_byte(w,o.total_in>>8&255),put_byte(w,o.total_in>>16&255),put_byte(w,o.total_in>>24&255)):(putShortMSB(w,o.adler>>>16),putShortMSB(w,65535&o.adler)),flush_pending(o),w.wrap>0&&(w.wrap=-w.wrap),0!==w.pending?Z:ee)},o.exports.deflateEnd=o=>{if(!o||!o.state)return et;let p=o.state.status;return 42!==p&&69!==p&&73!==p&&91!==p&&103!==p&&113!==p&&666!==p?err(o,et):(o.state=null,113===p?err(o,ei):Z)},o.exports.deflateSetDictionary=(o,p)=>{let f=p.length;if(!o||!o.state)return et;let m=o.state,_=m.wrap;if(2===_||1===_&&42!==m.status||m.lookahead)return et;if(1===_&&(o.adler=M(o.adler,p,f,0)),m.wrap=0,f>=m.w_size){0===_&&(zero(m.head),m.strstart=0,m.block_start=0,m.insert=0);let o=new Uint8Array(m.w_size);o.set(p.subarray(f-m.w_size,f),0),p=o,f=m.w_size}let w=o.avail_in,I=o.next_in,k=o.input;for(o.avail_in=f,o.next_in=0,o.input=p,fill_window(m);m.lookahead>=3;){let o=m.strstart,p=m.lookahead-2;do m.ins_h=HASH(m,m.ins_h,m.window[o+3-1]),m.prev[o&m.w_mask]=m.head[m.ins_h],m.head[m.ins_h]=o,o++;while(--p)m.strstart=o,m.lookahead=2,fill_window(m)}return m.strstart+=m.lookahead,m.block_start=m.strstart,m.insert=m.lookahead,m.lookahead=0,m.match_length=m.prev_length=2,m.match_available=0,o.next_in=I,o.input=k,o.avail_in=w,m.wrap=_,Z},o.exports.deflateInfo="pako deflate (from Nodeca project)"},0x1bc0bb2fc:o=>{"use strict";o.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},0xd44af05d:o=>{"use strict";o.exports=function(o,p){let f,m,_,w,I,k,M,x,O,L,B,U,$,q,Z,ee,et,ei,er,en,eo,es,ea,el,ed=o.state;f=o.next_in,ea=o.input,m=f+(o.avail_in-5),_=o.next_out,el=o.output,w=_-(p-o.avail_out),I=_+(o.avail_out-257),k=ed.dmax,M=ed.wsize,x=ed.whave,O=ed.wnext,L=ed.window,B=ed.hold,U=ed.bits,$=ed.lencode,q=ed.distcode,Z=(1<<ed.lenbits)-1,ee=(1<<ed.distbits)-1;e:do for(U<15&&(B+=ea[f++]<<U,U+=8,B+=ea[f++]<<U,U+=8),et=$[B&Z];;){if(B>>>=ei=et>>>24,U-=ei,0==(ei=et>>>16&255))el[_++]=65535&et;else if(16&ei)for(er=65535&et,(ei&=15)&&(U<ei&&(B+=ea[f++]<<U,U+=8),er+=B&(1<<ei)-1,B>>>=ei,U-=ei),U<15&&(B+=ea[f++]<<U,U+=8,B+=ea[f++]<<U,U+=8),et=q[B&ee];;){if(B>>>=ei=et>>>24,U-=ei,16&(ei=et>>>16&255)){if(en=65535&et,U<(ei&=15)&&(B+=ea[f++]<<U,(U+=8)<ei&&(B+=ea[f++]<<U,U+=8)),(en+=B&(1<<ei)-1)>k){o.msg="invalid distance too far back",ed.mode=30;break e}if(B>>>=ei,U-=ei,en>(ei=_-w)){if((ei=en-ei)>x&&ed.sane){o.msg="invalid distance too far back",ed.mode=30;break e}if(eo=0,es=L,0===O){if(eo+=M-ei,ei<er){er-=ei;do el[_++]=L[eo++];while(--ei)eo=_-en,es=el}}else if(O<ei){if(eo+=M+O-ei,(ei-=O)<er){er-=ei;do el[_++]=L[eo++];while(--ei)if(eo=0,O<er){er-=ei=O;do el[_++]=L[eo++];while(--ei)eo=_-en,es=el}}}else if(eo+=O-ei,ei<er){er-=ei;do el[_++]=L[eo++];while(--ei)eo=_-en,es=el}for(;er>2;)el[_++]=es[eo++],el[_++]=es[eo++],el[_++]=es[eo++],er-=3;er&&(el[_++]=es[eo++],er>1&&(el[_++]=es[eo++]))}else{eo=_-en;do el[_++]=el[eo++],el[_++]=el[eo++],el[_++]=el[eo++],er-=3;while(er>2)er&&(el[_++]=el[eo++],er>1&&(el[_++]=el[eo++]))}}else if((64&ei)==0){et=q[(65535&et)+(B&(1<<ei)-1)];continue}else{o.msg="invalid distance code",ed.mode=30;break e}break}else if((64&ei)==0){et=$[(65535&et)+(B&(1<<ei)-1)];continue}else if(32&ei){ed.mode=12;break e}else{o.msg="invalid literal/length code",ed.mode=30;break e}break}while(f<m&&_<I)f-=er=U>>3,U-=er<<3,B&=(1<<U)-1,o.next_in=f,o.next_out=_,o.avail_in=f<m?5+(m-f):5-(f-m),o.avail_out=_<I?257+(I-_):257-(_-I),ed.hold=B,ed.bits=U}},0x5ae41d37:(o,p,f)=>{"use strict";let m,_,w=f(0x23985e12d),I=f(0x23f5d121b),k=f(0xd44af05d),M=f(0x10d305eb4),{Z_FINISH:x,Z_BLOCK:O,Z_TREES:L,Z_OK:B,Z_STREAM_END:U,Z_NEED_DICT:$,Z_STREAM_ERROR:q,Z_DATA_ERROR:Z,Z_MEM_ERROR:ee,Z_BUF_ERROR:et,Z_DEFLATED:ei}=f(0x7c5bfc5),zswap32=o=>(o>>>24&255)+(o>>>8&65280)+((65280&o)<<8)+((255&o)<<24);function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let inflateResetKeep=o=>{if(!o||!o.state)return q;let p=o.state;return o.total_in=o.total_out=p.total=0,o.msg="",p.wrap&&(o.adler=1&p.wrap),p.mode=1,p.last=0,p.havedict=0,p.dmax=32768,p.head=null,p.hold=0,p.bits=0,p.lencode=p.lendyn=new Int32Array(852),p.distcode=p.distdyn=new Int32Array(592),p.sane=1,p.back=-1,B},inflateReset=o=>{if(!o||!o.state)return q;let p=o.state;return p.wsize=0,p.whave=0,p.wnext=0,inflateResetKeep(o)},inflateReset2=(o,p)=>{let f;if(!o||!o.state)return q;let m=o.state;return(p<0?(f=0,p=-p):(f=(p>>4)+1,p<48&&(p&=15)),p&&(p<8||p>15))?q:(null!==m.window&&m.wbits!==p&&(m.window=null),m.wrap=f,m.wbits=p,inflateReset(o))},inflateInit2=(o,p)=>{if(!o)return q;let f=new InflateState;o.state=f,f.window=null;let m=inflateReset2(o,p);return m!==B&&(o.state=null),m},er=!0,fixedtables=o=>{if(er){m=new Int32Array(512),_=new Int32Array(32);let p=0;for(;p<144;)o.lens[p++]=8;for(;p<256;)o.lens[p++]=9;for(;p<280;)o.lens[p++]=7;for(;p<288;)o.lens[p++]=8;for(M(1,o.lens,0,288,m,0,o.work,{bits:9}),p=0;p<32;)o.lens[p++]=5;M(2,o.lens,0,32,_,0,o.work,{bits:5}),er=!1}o.lencode=m,o.lenbits=9,o.distcode=_,o.distbits=5},updatewindow=(o,p,f,m)=>{let _,w=o.state;return null===w.window&&(w.wsize=1<<w.wbits,w.wnext=0,w.whave=0,w.window=new Uint8Array(w.wsize)),m>=w.wsize?(w.window.set(p.subarray(f-w.wsize,f),0),w.wnext=0,w.whave=w.wsize):((_=w.wsize-w.wnext)>m&&(_=m),w.window.set(p.subarray(f-m,f-m+_),w.wnext),(m-=_)?(w.window.set(p.subarray(f-m,f),0),w.wnext=m,w.whave=w.wsize):(w.wnext+=_,w.wnext===w.wsize&&(w.wnext=0),w.whave<w.wsize&&(w.whave+=_))),0};o.exports.inflateReset=inflateReset,o.exports.inflateReset2=inflateReset2,o.exports.inflateResetKeep=inflateResetKeep,o.exports.inflateInit=o=>inflateInit2(o,15),o.exports.inflateInit2=inflateInit2,o.exports.inflate=(o,p)=>{let f,m,_,er,en,eo,es,ea,el,ed,ec,eu,eh,ep,ef,em,eg,eS,ev,eb,ey,e_,eC,eT,eE=0,ew=new Uint8Array(4),eI=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!o||!o.state||!o.output||!o.input&&0!==o.avail_in)return q;12===(f=o.state).mode&&(f.mode=13),en=o.next_out,_=o.output,es=o.avail_out,er=o.next_in,m=o.input,eo=o.avail_in,ea=f.hold,el=f.bits,ed=eo,ec=es,e_=B;t:for(;;)switch(f.mode){case 1:if(0===f.wrap){f.mode=13;break}for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(2&f.wrap&&35615===ea){f.check=0,ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0),ea=0,el=0,f.mode=2;break}if(f.flags=0,f.head&&(f.head.done=!1),!(1&f.wrap)||(((255&ea)<<8)+(ea>>8))%31){o.msg="incorrect header check",f.mode=30;break}if((15&ea)!==ei){o.msg="unknown compression method",f.mode=30;break}if(ea>>>=4,el-=4,ey=(15&ea)+8,0===f.wbits)f.wbits=ey;else if(ey>f.wbits){o.msg="invalid window size",f.mode=30;break}f.dmax=1<<f.wbits,o.adler=f.check=1,f.mode=512&ea?10:12,ea=0,el=0;break;case 2:for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(f.flags=ea,(255&f.flags)!==ei){o.msg="unknown compression method",f.mode=30;break}if(57344&f.flags){o.msg="unknown header flags set",f.mode=30;break}f.head&&(f.head.text=ea>>8&1),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0,f.mode=3;case 3:for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.head&&(f.head.time=ea),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,ew[2]=ea>>>16&255,ew[3]=ea>>>24&255,f.check=I(f.check,ew,4,0)),ea=0,el=0,f.mode=4;case 4:for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.head&&(f.head.xflags=255&ea,f.head.os=ea>>8),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0,f.mode=5;case 5:if(1024&f.flags){for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.length=ea,f.head&&(f.head.extra_len=ea),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0}else f.head&&(f.head.extra=null);f.mode=6;case 6:if(1024&f.flags&&((eu=f.length)>eo&&(eu=eo),eu&&(f.head&&(ey=f.head.extra_len-f.length,f.head.extra||(f.head.extra=new Uint8Array(f.head.extra_len)),f.head.extra.set(m.subarray(er,er+eu),ey)),512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,f.length-=eu),f.length))break t;f.length=0,f.mode=7;case 7:if(2048&f.flags){if(0===eo)break t;eu=0;do ey=m[er+eu++],f.head&&ey&&f.length<65536&&(f.head.name+=String.fromCharCode(ey));while(ey&&eu<eo)if(512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,ey)break t}else f.head&&(f.head.name=null);f.length=0,f.mode=8;case 8:if(4096&f.flags){if(0===eo)break t;eu=0;do ey=m[er+eu++],f.head&&ey&&f.length<65536&&(f.head.comment+=String.fromCharCode(ey));while(ey&&eu<eo)if(512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,ey)break t}else f.head&&(f.head.comment=null);f.mode=9;case 9:if(512&f.flags){for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(ea!==(65535&f.check)){o.msg="header crc mismatch",f.mode=30;break}ea=0,el=0}f.head&&(f.head.hcrc=f.flags>>9&1,f.head.done=!0),o.adler=f.check=0,f.mode=12;break;case 10:for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}o.adler=f.check=zswap32(ea),ea=0,el=0,f.mode=11;case 11:if(0===f.havedict)return o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,$;o.adler=f.check=1,f.mode=12;case 12:if(p===O||p===L)break t;case 13:if(f.last){ea>>>=7&el,el-=7&el,f.mode=27;break}for(;el<3;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}switch(f.last=1&ea,el-=1,3&(ea>>>=1)){case 0:f.mode=14;break;case 1:if(fixedtables(f),f.mode=20,p===L){ea>>>=2,el-=2;break t}break;case 2:f.mode=17;break;case 3:o.msg="invalid block type",f.mode=30}ea>>>=2,el-=2;break;case 14:for(ea>>>=7&el,el-=7&el;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if((65535&ea)!=(ea>>>16^65535)){o.msg="invalid stored block lengths",f.mode=30;break}if(f.length=65535&ea,ea=0,el=0,f.mode=15,p===L)break t;case 15:f.mode=16;case 16:if(eu=f.length){if(eu>eo&&(eu=eo),eu>es&&(eu=es),0===eu)break t;_.set(m.subarray(er,er+eu),en),eo-=eu,er+=eu,es-=eu,en+=eu,f.length-=eu;break}f.mode=12;break;case 17:for(;el<14;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(f.nlen=(31&ea)+257,el-=5,f.ndist=(31&(ea>>>=5))+1,el-=5,f.ncode=(15&(ea>>>=5))+4,ea>>>=4,el-=4,f.nlen>286||f.ndist>30){o.msg="too many length or distance symbols",f.mode=30;break}f.have=0,f.mode=18;case 18:for(;f.have<f.ncode;){for(;el<3;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.lens[eI[f.have++]]=7&ea,ea>>>=3,el-=3}for(;f.have<19;)f.lens[eI[f.have++]]=0;if(f.lencode=f.lendyn,f.lenbits=7,eC={bits:f.lenbits},e_=M(0,f.lens,0,19,f.lencode,0,f.work,eC),f.lenbits=eC.bits,e_){o.msg="invalid code lengths set",f.mode=30;break}f.have=0,f.mode=19;case 19:for(;f.have<f.nlen+f.ndist;){for(;ef=(eE=f.lencode[ea&(1<<f.lenbits)-1])>>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(eg<16)ea>>>=ef,el-=ef,f.lens[f.have++]=eg;else{if(16===eg){for(eT=ef+2;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(ea>>>=ef,el-=ef,0===f.have){o.msg="invalid bit length repeat",f.mode=30;break}ey=f.lens[f.have-1],eu=3+(3&ea),ea>>>=2,el-=2}else if(17===eg){for(eT=ef+3;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=ef,el-=ef,ey=0,eu=3+(7&ea),ea>>>=3,el-=3}else{for(eT=ef+7;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=ef,el-=ef,ey=0,eu=11+(127&ea),ea>>>=7,el-=7}if(f.have+eu>f.nlen+f.ndist){o.msg="invalid bit length repeat",f.mode=30;break}for(;eu--;)f.lens[f.have++]=ey}}if(30===f.mode)break;if(0===f.lens[256]){o.msg="invalid code -- missing end-of-block",f.mode=30;break}if(f.lenbits=9,eC={bits:f.lenbits},e_=M(1,f.lens,0,f.nlen,f.lencode,0,f.work,eC),f.lenbits=eC.bits,e_){o.msg="invalid literal/lengths set",f.mode=30;break}if(f.distbits=6,f.distcode=f.distdyn,eC={bits:f.distbits},e_=M(2,f.lens,f.nlen,f.ndist,f.distcode,0,f.work,eC),f.distbits=eC.bits,e_){o.msg="invalid distances set",f.mode=30;break}if(f.mode=20,p===L)break t;case 20:f.mode=21;case 21:if(eo>=6&&es>=258){o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,k(o,ec),en=o.next_out,_=o.output,es=o.avail_out,er=o.next_in,m=o.input,eo=o.avail_in,ea=f.hold,el=f.bits,12===f.mode&&(f.back=-1);break}for(f.back=0;ef=(eE=f.lencode[ea&(1<<f.lenbits)-1])>>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(em&&(240&em)==0){for(eS=ef,ev=em,eb=eg;ef=(eE=f.lencode[eb+((ea&(1<<eS+ev)-1)>>eS)])>>>24,em=eE>>>16&255,eg=65535&eE,!(eS+ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=eS,el-=eS,f.back+=eS}if(ea>>>=ef,el-=ef,f.back+=ef,f.length=eg,0===em){f.mode=26;break}if(32&em){f.back=-1,f.mode=12;break}if(64&em){o.msg="invalid literal/length code",f.mode=30;break}f.extra=15&em,f.mode=22;case 22:if(f.extra){for(eT=f.extra;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.length+=ea&(1<<f.extra)-1,ea>>>=f.extra,el-=f.extra,f.back+=f.extra}f.was=f.length,f.mode=23;case 23:for(;ef=(eE=f.distcode[ea&(1<<f.distbits)-1])>>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if((240&em)==0){for(eS=ef,ev=em,eb=eg;ef=(eE=f.distcode[eb+((ea&(1<<eS+ev)-1)>>eS)])>>>24,em=eE>>>16&255,eg=65535&eE,!(eS+ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=eS,el-=eS,f.back+=eS}if(ea>>>=ef,el-=ef,f.back+=ef,64&em){o.msg="invalid distance code",f.mode=30;break}f.offset=eg,f.extra=15&em,f.mode=24;case 24:if(f.extra){for(eT=f.extra;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.offset+=ea&(1<<f.extra)-1,ea>>>=f.extra,el-=f.extra,f.back+=f.extra}if(f.offset>f.dmax){o.msg="invalid distance too far back",f.mode=30;break}f.mode=25;case 25:if(0===es)break t;if(eu=ec-es,f.offset>eu){if((eu=f.offset-eu)>f.whave&&f.sane){o.msg="invalid distance too far back",f.mode=30;break}eu>f.wnext?(eu-=f.wnext,eh=f.wsize-eu):eh=f.wnext-eu,eu>f.length&&(eu=f.length),ep=f.window}else ep=_,eh=en-f.offset,eu=f.length;eu>es&&(eu=es),es-=eu,f.length-=eu;do _[en++]=ep[eh++];while(--eu)0===f.length&&(f.mode=21);break;case 26:if(0===es)break t;_[en++]=f.length,es--,f.mode=21;break;case 27:if(f.wrap){for(;el<32;){if(0===eo)break t;eo--,ea|=m[er++]<<el,el+=8}if(ec-=es,o.total_out+=ec,f.total+=ec,ec&&(o.adler=f.check=f.flags?I(f.check,_,ec,en-ec):w(f.check,_,ec,en-ec)),ec=es,(f.flags?ea:zswap32(ea))!==f.check){o.msg="incorrect data check",f.mode=30;break}ea=0,el=0}f.mode=28;case 28:if(f.wrap&&f.flags){for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(ea!==(0|f.total)){o.msg="incorrect length check",f.mode=30;break}ea=0,el=0}f.mode=29;case 29:e_=U;break t;case 30:e_=Z;break t;case 31:return ee;default:return q}return(o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,(f.wsize||ec!==o.avail_out&&f.mode<30&&(f.mode<27||p!==x))&&updatewindow(o,o.output,o.next_out,ec-o.avail_out))?(f.mode=31,ee):(ed-=o.avail_in,ec-=o.avail_out,o.total_in+=ed,o.total_out+=ec,f.total+=ec,f.wrap&&ec&&(o.adler=f.check=f.flags?I(f.check,_,ec,o.next_out-ec):w(f.check,_,ec,o.next_out-ec)),o.data_type=f.bits+64*!!f.last+128*(12===f.mode)+256*(20===f.mode||15===f.mode),(0===ed&&0===ec||p===x)&&e_===B&&(e_=et),e_)},o.exports.inflateEnd=o=>{if(!o||!o.state)return q;let p=o.state;return p.window&&(p.window=null),o.state=null,B},o.exports.inflateGetHeader=(o,p)=>{if(!o||!o.state)return q;let f=o.state;return(2&f.wrap)==0?q:(f.head=p,p.done=!1,B)},o.exports.inflateSetDictionary=(o,p)=>{let f,m=p.length;return o&&o.state&&(0===(f=o.state).wrap||11===f.mode)?11===f.mode&&w(1,p,m,0)!==f.check?Z:updatewindow(o,p,m,m)?(f.mode=31,ee):(f.havedict=1,B):q},o.exports.inflateInfo="pako inflate (from Nodeca project)"},0x10d305eb4:o=>{"use strict";let p=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),f=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),m=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);o.exports=(o,w,I,k,M,x,O,L)=>{let B,U,$,q,Z,ee,et,ei,er,en=L.bits,eo=0,es=0,ea=0,el=0,ed=0,ec=0,eu=0,eh=0,ep=0,ef=0,em=null,eg=0,eS=new Uint16Array(16),ev=new Uint16Array(16),eb=null,ey=0;for(eo=0;eo<=15;eo++)eS[eo]=0;for(es=0;es<k;es++)eS[w[I+es]]++;for(el=15,ed=en;el>=1&&0===eS[el];el--);if(ed>el&&(ed=el),0===el)return M[x++]=0x1400000,M[x++]=0x1400000,L.bits=1,0;for(ea=1;ea<el&&0===eS[ea];ea++);for(ed<ea&&(ed=ea),eh=1,eo=1;eo<=15;eo++)if(eh<<=1,(eh-=eS[eo])<0)return -1;if(eh>0&&(0===o||1!==el))return -1;for(eo=1,ev[1]=0;eo<15;eo++)ev[eo+1]=ev[eo]+eS[eo];for(es=0;es<k;es++)0!==w[I+es]&&(O[ev[w[I+es]]++]=es);if(0===o?(em=eb=O,ee=19):1===o?(em=p,eg-=257,eb=f,ey-=257,ee=256):(em=m,eb=_,ee=-1),ef=0,es=0,eo=ea,Z=x,ec=ed,eu=0,$=-1,q=(ep=1<<ed)-1,1===o&&ep>852||2===o&&ep>592)return 1;for(;;){et=eo-eu,O[es]<ee?(ei=0,er=O[es]):O[es]>ee?(ei=eb[ey+O[es]],er=em[eg+O[es]]):(ei=96,er=0),B=1<<eo-eu,ea=U=1<<ec;do M[Z+(ef>>eu)+(U-=B)]=et<<24|ei<<16|er;while(0!==U)for(B=1<<eo-1;ef&B;)B>>=1;if(0!==B?(ef&=B-1,ef+=B):ef=0,es++,0==--eS[eo]){if(eo===el)break;eo=w[I+O[es]]}if(eo>ed&&(ef&q)!==$){for(0===eu&&(eu=ed),Z+=ea,eh=1<<(ec=eo-eu);ec+eu<el&&!((eh-=eS[ec+eu])<=0);)ec++,eh<<=1;if(ep+=1<<ec,1===o&&ep>852||2===o&&ep>592)return 1;M[$=ef&q]=ed<<24|ec<<16|Z-x}}return 0!==ef&&(M[Z+ef]=eo-eu<<24|4194304),L.bits=ed,0}},0x16ee44604:o=>{"use strict";o.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},0x148a53f1:o=>{"use strict";let p,f,m;function zero(o){let p=o.length;for(;--p>=0;)o[p]=0}let _=573,w=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),I=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),k=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x=Array(576);zero(x);let O=Array(60);zero(O);let L=Array(512);zero(L);let B=Array(256);zero(B);let U=Array(29);zero(U);let $=Array(30);function StaticTreeDesc(o,p,f,m,_){this.static_tree=o,this.extra_bits=p,this.extra_base=f,this.elems=m,this.max_length=_,this.has_stree=o&&o.length}function TreeDesc(o,p){this.dyn_tree=o,this.max_code=0,this.stat_desc=p}zero($);let d_code=o=>o<256?L[o]:L[256+(o>>>7)],put_short=(o,p)=>{o.pending_buf[o.pending++]=255&p,o.pending_buf[o.pending++]=p>>>8&255},send_bits=(o,p,f)=>{o.bi_valid>16-f?(o.bi_buf|=p<<o.bi_valid&65535,put_short(o,o.bi_buf),o.bi_buf=p>>16-o.bi_valid,o.bi_valid+=f-16):(o.bi_buf|=p<<o.bi_valid&65535,o.bi_valid+=f)},send_code=(o,p,f)=>{send_bits(o,f[2*p],f[2*p+1])},bi_reverse=(o,p)=>{let f=0;do f|=1&o,o>>>=1,f<<=1;while(--p>0)return f>>>1},gen_codes=(o,p,f)=>{let m,_,w=Array(16),I=0;for(m=1;m<=15;m++)w[m]=I=I+f[m-1]<<1;for(_=0;_<=p;_++){let p=o[2*_+1];0!==p&&(o[2*_]=bi_reverse(w[p]++,p))}},init_block=o=>{let p;for(p=0;p<286;p++)o.dyn_ltree[2*p]=0;for(p=0;p<30;p++)o.dyn_dtree[2*p]=0;for(p=0;p<19;p++)o.bl_tree[2*p]=0;o.dyn_ltree[512]=1,o.opt_len=o.static_len=0,o.last_lit=o.matches=0},bi_windup=o=>{o.bi_valid>8?put_short(o,o.bi_buf):o.bi_valid>0&&(o.pending_buf[o.pending++]=o.bi_buf),o.bi_buf=0,o.bi_valid=0},smaller=(o,p,f,m)=>{let _=2*p,w=2*f;return o[_]<o[w]||o[_]===o[w]&&m[p]<=m[f]},pqdownheap=(o,p,f)=>{let m=o.heap[f],_=f<<1;for(;_<=o.heap_len&&(_<o.heap_len&&smaller(p,o.heap[_+1],o.heap[_],o.depth)&&_++,!smaller(p,m,o.heap[_],o.depth));)o.heap[f]=o.heap[_],f=_,_<<=1;o.heap[f]=m},compress_block=(o,p,f)=>{let m,_,k,M,x=0;if(0!==o.last_lit)do m=o.pending_buf[o.d_buf+2*x]<<8|o.pending_buf[o.d_buf+2*x+1],_=o.pending_buf[o.l_buf+x],x++,0===m?send_code(o,_,p):(send_code(o,(k=B[_])+256+1,p),0!==(M=w[k])&&send_bits(o,_-=U[k],M),send_code(o,k=d_code(--m),f),0!==(M=I[k])&&send_bits(o,m-=$[k],M));while(x<o.last_lit)send_code(o,256,p)},build_tree=(o,p)=>{let f,m,w,I=p.dyn_tree,k=p.stat_desc.static_tree,M=p.stat_desc.has_stree,x=p.stat_desc.elems,O=-1;for(f=0,o.heap_len=0,o.heap_max=_;f<x;f++)0!==I[2*f]?(o.heap[++o.heap_len]=O=f,o.depth[f]=0):I[2*f+1]=0;for(;o.heap_len<2;)I[2*(w=o.heap[++o.heap_len]=O<2?++O:0)]=1,o.depth[w]=0,o.opt_len--,M&&(o.static_len-=k[2*w+1]);for(p.max_code=O,f=o.heap_len>>1;f>=1;f--)pqdownheap(o,I,f);w=x;do f=o.heap[1],o.heap[1]=o.heap[o.heap_len--],pqdownheap(o,I,1),m=o.heap[1],o.heap[--o.heap_max]=f,o.heap[--o.heap_max]=m,I[2*w]=I[2*f]+I[2*m],o.depth[w]=(o.depth[f]>=o.depth[m]?o.depth[f]:o.depth[m])+1,I[2*f+1]=I[2*m+1]=w,o.heap[1]=w++,pqdownheap(o,I,1);while(o.heap_len>=2)o.heap[--o.heap_max]=o.heap[1],((o,p)=>{let f,m,w,I,k,M,x=p.dyn_tree,O=p.max_code,L=p.stat_desc.static_tree,B=p.stat_desc.has_stree,U=p.stat_desc.extra_bits,$=p.stat_desc.extra_base,q=p.stat_desc.max_length,Z=0;for(I=0;I<=15;I++)o.bl_count[I]=0;for(x[2*o.heap[o.heap_max]+1]=0,f=o.heap_max+1;f<_;f++)(I=x[2*x[2*(m=o.heap[f])+1]+1]+1)>q&&(I=q,Z++),x[2*m+1]=I,!(m>O)&&(o.bl_count[I]++,k=0,m>=$&&(k=U[m-$]),M=x[2*m],o.opt_len+=M*(I+k),B&&(o.static_len+=M*(L[2*m+1]+k)));if(0!==Z){do{for(I=q-1;0===o.bl_count[I];)I--;o.bl_count[I]--,o.bl_count[I+1]+=2,o.bl_count[q]--,Z-=2}while(Z>0)for(I=q;0!==I;I--)for(m=o.bl_count[I];0!==m;)!((w=o.heap[--f])>O)&&(x[2*w+1]!==I&&(o.opt_len+=(I-x[2*w+1])*x[2*w],x[2*w+1]=I),m--)}})(o,p),gen_codes(I,O,o.bl_count)},scan_tree=(o,p,f)=>{let m,_,w=-1,I=p[1],k=0,M=7,x=4;for(0===I&&(M=138,x=3),p[(f+1)*2+1]=65535,m=0;m<=f;m++)_=I,I=p[(m+1)*2+1],++k<M&&_===I||(k<x?o.bl_tree[2*_]+=k:0!==_?(_!==w&&o.bl_tree[2*_]++,o.bl_tree[32]++):k<=10?o.bl_tree[34]++:o.bl_tree[36]++,k=0,w=_,0===I?(M=138,x=3):_===I?(M=6,x=3):(M=7,x=4))},send_tree=(o,p,f)=>{let m,_,w=-1,I=p[1],k=0,M=7,x=4;for(0===I&&(M=138,x=3),m=0;m<=f;m++)if(_=I,I=p[(m+1)*2+1],!(++k<M)||_!==I){if(k<x)do send_code(o,_,o.bl_tree);while(0!=--k)else 0!==_?(_!==w&&(send_code(o,_,o.bl_tree),k--),send_code(o,16,o.bl_tree),send_bits(o,k-3,2)):k<=10?(send_code(o,17,o.bl_tree),send_bits(o,k-3,3)):(send_code(o,18,o.bl_tree),send_bits(o,k-11,7));k=0,w=_,0===I?(M=138,x=3):_===I?(M=6,x=3):(M=7,x=4)}},q=!1,_tr_stored_block=(o,p,f,m)=>{send_bits(o,0+ +!!m,3),bi_windup(o),put_short(o,f),put_short(o,~f),o.pending_buf.set(o.window.subarray(p,p+f),o.pending),o.pending+=f};o.exports._tr_init=o=>{q||((()=>{let o,_,M,q,Z,ee=Array(16);for(q=0,M=0;q<28;q++)for(o=0,U[q]=M;o<1<<w[q];o++)B[M++]=q;for(B[M-1]=q,Z=0,q=0;q<16;q++)for(o=0,$[q]=Z;o<1<<I[q];o++)L[Z++]=q;for(Z>>=7;q<30;q++)for(o=0,$[q]=Z<<7;o<1<<I[q]-7;o++)L[256+Z++]=q;for(_=0;_<=15;_++)ee[_]=0;for(o=0;o<=143;)x[2*o+1]=8,o++,ee[8]++;for(;o<=255;)x[2*o+1]=9,o++,ee[9]++;for(;o<=279;)x[2*o+1]=7,o++,ee[7]++;for(;o<=287;)x[2*o+1]=8,o++,ee[8]++;for(gen_codes(x,287,ee),o=0;o<30;o++)O[2*o+1]=5,O[2*o]=bi_reverse(o,5);p=new StaticTreeDesc(x,w,257,286,15),f=new StaticTreeDesc(O,I,0,30,15),m=new StaticTreeDesc([],k,0,19,7)})(),q=!0),o.l_desc=new TreeDesc(o.dyn_ltree,p),o.d_desc=new TreeDesc(o.dyn_dtree,f),o.bl_desc=new TreeDesc(o.bl_tree,m),o.bi_buf=0,o.bi_valid=0,init_block(o)},o.exports._tr_stored_block=_tr_stored_block,o.exports._tr_flush_block=(o,p,f,m)=>{let _,w,I=0;o.level>0?(2===o.strm.data_type&&(o.strm.data_type=(o=>{let p,f=0xf3ffc07f;for(p=0;p<=31;p++,f>>>=1)if(1&f&&0!==o.dyn_ltree[2*p])return 0;if(0!==o.dyn_ltree[18]||0!==o.dyn_ltree[20]||0!==o.dyn_ltree[26])return 1;for(p=32;p<256;p++)if(0!==o.dyn_ltree[2*p])return 1;return 0})(o)),build_tree(o,o.l_desc),build_tree(o,o.d_desc),I=(o=>{let p;for(scan_tree(o,o.dyn_ltree,o.l_desc.max_code),scan_tree(o,o.dyn_dtree,o.d_desc.max_code),build_tree(o,o.bl_desc),p=18;p>=3&&0===o.bl_tree[2*M[p]+1];p--);return o.opt_len+=3*(p+1)+5+5+4,p})(o),_=o.opt_len+3+7>>>3,(w=o.static_len+3+7>>>3)<=_&&(_=w)):_=w=f+5,f+4<=_&&-1!==p?_tr_stored_block(o,p,f,m):4===o.strategy||w===_?(send_bits(o,2+ +!!m,3),compress_block(o,x,O)):(send_bits(o,4+ +!!m,3),((o,p,f,m)=>{let _;for(send_bits(o,p-257,5),send_bits(o,f-1,5),send_bits(o,m-4,4),_=0;_<m;_++)send_bits(o,o.bl_tree[2*M[_]+1],3);send_tree(o,o.dyn_ltree,p-1),send_tree(o,o.dyn_dtree,f-1)})(o,o.l_desc.max_code+1,o.d_desc.max_code+1,I+1),compress_block(o,o.dyn_ltree,o.dyn_dtree)),init_block(o),m&&bi_windup(o)},o.exports._tr_tally=(o,p,f)=>(o.pending_buf[o.d_buf+2*o.last_lit]=p>>>8&255,o.pending_buf[o.d_buf+2*o.last_lit+1]=255&p,o.pending_buf[o.l_buf+o.last_lit]=255&f,o.last_lit++,0===p?o.dyn_ltree[2*f]++:(o.matches++,p--,o.dyn_ltree[(B[f]+256+1)*2]++,o.dyn_dtree[2*d_code(p)]++),o.last_lit===o.lit_bufsize-1),o.exports._tr_align=o=>{send_bits(o,2,3),send_code(o,256,x),16===o.bi_valid?(put_short(o,o.bi_buf),o.bi_buf=0,o.bi_valid=0):o.bi_valid>=8&&(o.pending_buf[o.pending++]=255&o.bi_buf,o.bi_buf>>=8,o.bi_valid-=8)}},0x1cd54c07e:o=>{"use strict";o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},0x1204db3cc:(o,p,f)=>{"use strict";o.exports=f(0x169ae5e0c)},0x169ae5e0c:(o,p,f)=>{"use strict";function configure(){p.util._configure(),p.Writer._configure(p.BufferWriter),p.Reader._configure(p.BufferReader)}p.build="minimal",p.Writer=f(0x7d2690f1),p.BufferWriter=f(0x23920c7c0),p.Reader=f(0x1b9e9f855),p.BufferReader=f(0x156ec91a4),p.util=f(0x11446c62a),p.rpc=f(0xe0b485a5),p.roots=f(0x345f92ab),p.configure=configure,configure()},0x1b9e9f855:(o,p,f)=>{"use strict";o.exports=Reader;var m,_,w=f(0x11446c62a),I=w.LongBits,k=w.utf8;function indexOutOfRange(o,p){return RangeError("index out of range: "+o.pos+" + "+(p||1)+" > "+o.len)}function Reader(o){this.buf=o,this.pos=0,this.len=o.length}var M="u">typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new Reader(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new Reader(o);throw Error("illegal buffer")},create=function(){return w.Buffer?function(o){return(Reader.create=function(o){return w.Buffer.isBuffer(o)?new _(o):M(o)})(o)}:M};function readLongVarint(){var o=new I(0,0),p=0;if(this.len-this.pos>4){for(;p<4;++p)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*p)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;p=0}else{for(;p<3;++p){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*p)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*p)>>>0,o}if(this.len-this.pos>4){for(;p<5;++p)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*p+3)>>>0,this.buf[this.pos++]<128)return o}else for(;p<5;++p){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*p+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function readFixed32_end(o,p){return(o[p-4]|o[p-3]<<8|o[p-2]<<16|o[p-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new I(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader.create=create(),Reader.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice,Reader.prototype.uint32=(m=0xffffffff,function(){if(m=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(m=(m|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(m=(m|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(m=(m|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(m=(m|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return m;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return m}),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var o=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var o=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},Reader.prototype.bytes=function(){var o=this.uint32(),p=this.pos,f=this.pos+o;if(f>this.len)throw indexOutOfRange(this,o);if(this.pos+=o,Array.isArray(this.buf))return this.buf.slice(p,f);if(p===f){var m=w.Buffer;return m?m.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,p,f)},Reader.prototype.string=function(){var o=this.bytes();return k.read(o,0,o.length)},Reader.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw indexOutOfRange(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(128&this.buf[this.pos++])return this},Reader.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},Reader._configure=function(o){_=o,Reader.create=create(),_._configure();var p=w.Long?"toLong":"toNumber";w.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[p](!1)},uint64:function(){return readLongVarint.call(this)[p](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[p](!1)},fixed64:function(){return readFixed64.call(this)[p](!0)},sfixed64:function(){return readFixed64.call(this)[p](!1)}})}},0x156ec91a4:(o,p,f)=>{"use strict";o.exports=BufferReader;var m=f(0x1b9e9f855);(BufferReader.prototype=Object.create(m.prototype)).constructor=BufferReader;var _=f(0x11446c62a);function BufferReader(o){m.call(this,o)}BufferReader._configure=function(){_.Buffer&&(BufferReader.prototype._slice=_.Buffer.prototype.slice)},BufferReader.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},BufferReader._configure()},0x345f92ab:o=>{"use strict";o.exports={}},0xe0b485a5:(o,p,f)=>{"use strict";p.Service=f(0xbd812f41)},0xbd812f41:(o,p,f)=>{"use strict";o.exports=Service;var m=f(0x11446c62a);function Service(o,p,f){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");m.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!p,this.responseDelimited=!!f}(Service.prototype=Object.create(m.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function rpcCall(o,p,f,_,w){if(!_)throw TypeError("request must be specified");var I=this;if(!w)return m.asPromise(rpcCall,I,o,p,f,_);if(!I.rpcImpl)return void setTimeout(function(){w(Error("already ended"))},0);try{return I.rpcImpl(o,p[I.requestDelimited?"encodeDelimited":"encode"](_).finish(),function(p,m){if(p)return I.emit("error",p,o),w(p);if(null===m)return void I.end(!0);if(!(m instanceof f))try{m=f[I.responseDelimited?"decodeDelimited":"decode"](m)}catch(p){return I.emit("error",p,o),w(p)}return I.emit("data",m,o),w(null,m)})}catch(p){I.emit("error",p,o),setTimeout(function(){w(p)},0);return}},Service.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},0x55f77dd5:(o,p,f)=>{"use strict";o.exports=LongBits;var m=f(0x11446c62a);function LongBits(o,p){this.lo=o>>>0,this.hi=p>>>0}var _=LongBits.zero=new LongBits(0,0);_.toNumber=function(){return 0},_.zzEncode=_.zzDecode=function(){return this},_.length=function(){return 1};var w=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=function(o){if(0===o)return _;var p=o<0;p&&(o=-o);var f=o>>>0,m=(o-f)/0x100000000>>>0;return p&&(m=~m>>>0,f=~f>>>0,++f>0xffffffff&&(f=0,++m>0xffffffff&&(m=0))),new LongBits(f,m)},LongBits.from=function(o){if("number"==typeof o)return LongBits.fromNumber(o);if(m.isString(o))if(!m.Long)return LongBits.fromNumber(parseInt(o,10));else o=m.Long.fromString(o);return o.low||o.high?new LongBits(o.low>>>0,o.high>>>0):_},LongBits.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var p=~this.lo+1>>>0,f=~this.hi>>>0;return p||(f=f+1>>>0),-(p+0x100000000*f)}return this.lo+0x100000000*this.hi},LongBits.prototype.toLong=function(o){return m.Long?new m.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var I=String.prototype.charCodeAt;LongBits.fromHash=function(o){return o===w?_:new LongBits((I.call(o,0)|I.call(o,1)<<8|I.call(o,2)<<16|I.call(o,3)<<24)>>>0,(I.call(o,4)|I.call(o,5)<<8|I.call(o,6)<<16|I.call(o,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this},LongBits.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},LongBits.prototype.length=function(){var o=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return 0===f?0===p?o<16384?o<128?1:2:o<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:f<128?9:10}},0x11446c62a:function(o,p,f){"use strict";function merge(o,p,f){for(var m=Object.keys(p),_=0;_<m.length;++_)void 0!==o[m[_]]&&f||(o[m[_]]=p[m[_]]);return o}function newError(o){function CustomError(o,p){if(!(this instanceof CustomError))return new CustomError(o,p);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,CustomError):Object.defineProperty(this,"stack",{value:Error().stack||""}),p&&merge(this,p)}return CustomError.prototype=Object.create(Error.prototype,{constructor:{value:CustomError,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),CustomError}p.asPromise=f(0x1b9b9d364),p.base64=f(0xe3f8d71a),p.EventEmitter=f(0x18b00ebb3),p.float=f(0x1952be8cf),p.inquire=f(0x1b7035db9),p.utf8=f(0x112e6903a),p.pool=f(0xb2f775cb),p.LongBits=f(0x55f77dd5),p.isNode=!!(void 0!==f.g&&f.g&&f.g.process&&f.g.process.versions&&f.g.process.versions.node),p.global=p.isNode&&f.g||"u">typeof window&&window||"u">typeof self&&self||this,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},p.isString=function(o){return"string"==typeof o||o instanceof String},p.isObject=function(o){return o&&"object"==typeof o},p.isset=p.isSet=function(o,p){var f=o[p];return!!(null!=f&&o.hasOwnProperty(p))&&("object"!=typeof f||(Array.isArray(f)?f.length:Object.keys(f).length)>0)},p.Buffer=function(){try{var o=p.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch{return null}}(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(o){return"number"==typeof o?p.Buffer?p._Buffer_allocUnsafe(o):new p.Array(o):p.Buffer?p._Buffer_from(o):"u"<typeof Uint8Array?o:new Uint8Array(o)},p.Array="u">typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long"),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(o){return o?p.LongBits.from(o).toHash():p.LongBits.zeroHash},p.longFromHash=function(o,f){var m=p.LongBits.fromHash(o);return p.Long?p.Long.fromBits(m.lo,m.hi,f):m.toNumber(!!f)},p.merge=merge,p.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)},p.newError=newError,p.ProtocolError=newError("ProtocolError"),p.oneOfGetter=function(o){for(var p={},f=0;f<o.length;++f)p[o[f]]=1;return function(){for(var o=Object.keys(this),f=o.length-1;f>-1;--f)if(1===p[o[f]]&&void 0!==this[o[f]]&&null!==this[o[f]])return o[f]}},p.oneOfSetter=function(o){return function(p){for(var f=0;f<o.length;++f)o[f]!==p&&delete this[o[f]]}},p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},p._configure=function(){var o=p.Buffer;if(!o){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=o.from!==Uint8Array.from&&o.from||function(p,f){return new o(p,f)},p._Buffer_allocUnsafe=o.allocUnsafe||function(p){return new o(p)}}},0x7d2690f1:(o,p,f)=>{"use strict";o.exports=Writer;var m,_=f(0x11446c62a),w=_.LongBits,I=_.base64,k=_.utf8;function Op(o,p,f){this.fn=o,this.len=p,this.next=void 0,this.val=f}function noop(){}function State(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create=function(){return _.Buffer?function(){return(Writer.create=function(){return new m})()}:function(){return new Writer}};function writeByte(o,p,f){p[f]=255&o}function writeVarint32(o,p,f){for(;o>127;)p[f++]=127&o|128,o>>>=7;p[f]=o}function VarintOp(o,p){this.len=o,this.next=void 0,this.val=p}function writeVarint64(o,p,f){for(;o.hi;)p[f++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)p[f++]=127&o.lo|128,o.lo=o.lo>>>7;p[f++]=o.lo}function writeFixed32(o,p,f){p[f]=255&o,p[f+1]=o>>>8&255,p[f+2]=o>>>16&255,p[f+3]=o>>>24}Writer.create=create(),Writer.alloc=function(o){return new _.Array(o)},_.Array!==Array&&(Writer.alloc=_.pool(Writer.alloc,_.Array.prototype.subarray)),Writer.prototype._push=function(o,p,f){return this.tail=this.tail.next=new Op(o,p,f),this.len+=p,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new VarintOp((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<0x10000000?4:5,o)).len,this},Writer.prototype.int32=function(o){return o<0?this._push(writeVarint64,10,w.fromNumber(o)):this.uint32(o)},Writer.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},Writer.prototype.uint64=function(o){var p=w.from(o);return this._push(writeVarint64,p.length(),p)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(o){var p=w.from(o).zzEncode();return this._push(writeVarint64,p.length(),p)},Writer.prototype.bool=function(o){return this._push(writeByte,1,+!!o)},Writer.prototype.fixed32=function(o){return this._push(writeFixed32,4,o>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(o){var p=w.from(o);return this._push(writeFixed32,4,p.lo)._push(writeFixed32,4,p.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(o){return this._push(_.float.writeFloatLE,4,o)},Writer.prototype.double=function(o){return this._push(_.float.writeDoubleLE,8,o)};var M=_.Array.prototype.set?function(o,p,f){p.set(o,f)}:function(o,p,f){for(var m=0;m<o.length;++m)p[f+m]=o[m]};Writer.prototype.bytes=function(o){var p=o.length>>>0;if(!p)return this._push(writeByte,1,0);if(_.isString(o)){var f=Writer.alloc(p=I.length(o));I.decode(o,f,0),o=f}return this.uint32(p)._push(M,p,o)},Writer.prototype.string=function(o){var p=k.length(o);return p?this.uint32(p)._push(k.write,p,o):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var o=this.head,p=this.tail,f=this.len;return this.reset().uint32(f),f&&(this.tail.next=o.next,this.tail=p,this.len+=f),this},Writer.prototype.finish=function(){for(var o=this.head.next,p=this.constructor.alloc(this.len),f=0;o;)o.fn(o.val,p,f),f+=o.len,o=o.next;return p},Writer._configure=function(o){m=o,Writer.create=create(),m._configure()}},0x23920c7c0:(o,p,f)=>{"use strict";o.exports=BufferWriter;var m=f(0x7d2690f1);(BufferWriter.prototype=Object.create(m.prototype)).constructor=BufferWriter;var _=f(0x11446c62a);function BufferWriter(){m.call(this)}function writeStringBuffer(o,p,f){o.length<40?_.utf8.write(o,p,f):p.utf8Write?p.utf8Write(o,f):p.write(o,f)}BufferWriter._configure=function(){BufferWriter.alloc=_._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=_.Buffer&&_.Buffer.prototype instanceof Uint8Array&&"set"===_.Buffer.prototype.set.name?function(o,p,f){p.set(o,f)}:function(o,p,f){if(o.copy)o.copy(p,f,0,o.length);else for(var m=0;m<o.length;)p[f++]=o[m++]}},BufferWriter.prototype.bytes=function(o){_.isString(o)&&(o=_._Buffer_from(o,"base64"));var p=o.length>>>0;return this.uint32(p),p&&this._push(BufferWriter.writeBytesBuffer,p,o),this},BufferWriter.prototype.string=function(o){var p=_.Buffer.byteLength(o);return this.uint32(p),p&&this._push(writeStringBuffer,p,o),this},BufferWriter._configure()},0x2cf9a037:(o,p,f)=>{"use strict";f.r(p),f.d(p,{__assign:()=>__assign,__asyncDelegator:()=>__asyncDelegator,__asyncGenerator:()=>__asyncGenerator,__asyncValues:()=>__asyncValues,__await:()=>__await,__awaiter:()=>__awaiter,__classPrivateFieldGet:()=>__classPrivateFieldGet,__classPrivateFieldSet:()=>__classPrivateFieldSet,__createBinding:()=>__createBinding,__decorate:()=>__decorate,__exportStar:()=>__exportStar,__extends:()=>__extends,__generator:()=>__generator,__importDefault:()=>__importDefault,__importStar:()=>__importStar,__makeTemplateObject:()=>__makeTemplateObject,__metadata:()=>__metadata,__param:()=>__param,__read:()=>__read,__rest:()=>__rest,__spread:()=>__spread,__spreadArrays:()=>__spreadArrays,__values:()=>__values});var extendStatics=function(o,p){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(o,p){o.__proto__=p}||function(o,p){for(var f in p)p.hasOwnProperty(f)&&(o[f]=p[f])})(o,p)};function __extends(o,p){function __(){this.constructor=o}extendStatics(o,p),o.prototype=null===p?Object.create(p):(__.prototype=p.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(o){for(var p,f=1,m=arguments.length;f<m;f++)for(var _ in p=arguments[f])Object.prototype.hasOwnProperty.call(p,_)&&(o[_]=p[_]);return o}).apply(this,arguments)};function __rest(o,p){var f={};for(var m in o)Object.prototype.hasOwnProperty.call(o,m)&&0>p.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_<m.length;_++)0>p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f}function __decorate(o,p,f,m){var _,w=arguments.length,I=w<3?p:null===m?m=Object.getOwnPropertyDescriptor(p,f):m;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)I=Reflect.decorate(o,p,f,m);else for(var k=o.length-1;k>=0;k--)(_=o[k])&&(I=(w<3?_(I):w>3?_(p,f,I):_(p,f))||I);return w>3&&I&&Object.defineProperty(p,f,I),I}function __param(o,p){return function(f,m){p(f,m,o)}}function __metadata(o,p){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(o,p)}function __awaiter(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})}function __generator(o,p){var f,m,_,w,I={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return w={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(w[Symbol.iterator]=function(){return this}),w;function verb(o){return function(p){return step([o,p])}}function step(w){if(f)throw TypeError("Generator is already executing.");for(;I;)try{if(f=1,m&&(_=2&w[0]?m.return:w[0]?m.throw||((_=m.return)&&_.call(m),0):m.next)&&!(_=_.call(m,w[1])).done)return _;switch(m=0,_&&(w=[2&w[0],_.value]),w[0]){case 0:case 1:_=w;break;case 4:return I.label++,{value:w[1],done:!1};case 5:I.label++,m=w[1],w=[0];continue;case 7:w=I.ops.pop(),I.trys.pop();continue;default:if(!(_=(_=I.trys).length>0&&_[_.length-1])&&(6===w[0]||2===w[0])){I=0;continue}if(3===w[0]&&(!_||w[1]>_[0]&&w[1]<_[3])){I.label=w[1];break}if(6===w[0]&&I.label<_[1]){I.label=_[1],_=w;break}if(_&&I.label<_[2]){I.label=_[2],I.ops.push(w);break}_[2]&&I.ops.pop(),I.trys.pop();continue}w=p.call(o,I)}catch(o){w=[6,o],m=0}finally{f=_=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}}function __createBinding(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}function __exportStar(o,p){for(var f in o)"default"===f||p.hasOwnProperty(f)||(p[f]=o[f])}function __values(o){var p="function"==typeof Symbol&&Symbol.iterator,f=p&&o[p],m=0;if(f)return f.call(o);if(o&&"number"==typeof o.length)return{next:function(){return o&&m>=o.length&&(o=void 0),{value:o&&o[m++],done:!o}}};throw TypeError(p?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,p){var f="function"==typeof Symbol&&o[Symbol.iterator];if(!f)return o;var m,_,w=f.call(o),I=[];try{for(;(void 0===p||p-- >0)&&!(m=w.next()).done;)I.push(m.value)}catch(o){_={error:o}}finally{try{m&&!m.done&&(f=w.return)&&f.call(w)}finally{if(_)throw _.error}}return I}function __spread(){for(var o=[],p=0;p<arguments.length;p++)o=o.concat(__read(arguments[p]));return o}function __spreadArrays(){for(var o=0,p=0,f=arguments.length;p<f;p++)o+=arguments[p].length;for(var m=Array(o),_=0,p=0;p<f;p++)for(var w=arguments[p],I=0,k=w.length;I<k;I++,_++)m[_]=w[I];return m}function __await(o){return this instanceof __await?(this.v=o,this):new __await(o)}function __asyncGenerator(o,p,f){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var m,_=f.apply(o,p||[]),w=[];return m={},verb("next"),verb("throw"),verb("return"),m[Symbol.asyncIterator]=function(){return this},m;function verb(o){_[o]&&(m[o]=function(p){return new Promise(function(f,m){w.push([o,p,f,m])>1||resume(o,p)})})}function resume(o,p){try{step(_[o](p))}catch(o){settle(w[0][3],o)}}function step(o){o.value instanceof __await?Promise.resolve(o.value.v).then(fulfill,reject):settle(w[0][2],o)}function fulfill(o){resume("next",o)}function reject(o){resume("throw",o)}function settle(o,p){o(p),w.shift(),w.length&&resume(w[0][0],w[0][1])}}function __asyncDelegator(o){var p,f;return p={},verb("next"),verb("throw",function(o){throw o}),verb("return"),p[Symbol.iterator]=function(){return this},p;function verb(m,_){p[m]=o[m]?function(p){return(f=!f)?{value:__await(o[m](p)),done:"return"===m}:_?_(p):p}:_}}function __asyncValues(o){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var p,f=o[Symbol.asyncIterator];return f?f.call(o):(o=__values(o),p={},verb("next"),verb("throw"),verb("return"),p[Symbol.asyncIterator]=function(){return this},p);function verb(f){p[f]=o[f]&&function(p){return new Promise(function(m,_){settle(m,_,(p=o[f](p)).done,p.value)})}}function settle(o,p,f,m){Promise.resolve(m).then(function(p){o({value:p,done:f})},p)}}function __makeTemplateObject(o,p){return Object.defineProperty?Object.defineProperty(o,"raw",{value:p}):o.raw=p,o}function __importStar(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)Object.hasOwnProperty.call(o,f)&&(p[f]=o[f]);return p.default=o,p}function __importDefault(o){return o&&o.__esModule?o:{default:o}}function __classPrivateFieldGet(o,p){if(!p.has(o))throw TypeError("attempted to get private field on non-instance");return p.get(o)}function __classPrivateFieldSet(o,p,f){if(!p.has(o))throw TypeError("attempted to set private field on non-instance");return p.set(o,f),f}},0x2056040c6:function(o,p,f){var m;!function(_){"use strict";var w="function",I="undefined",k="object",M="string",x="major",O="model",L="name",B="type",U="vendor",$="version",q="architecture",Z="console",ee="mobile",et="tablet",ei="smarttv",er="wearable",en="embedded",eo="Amazon",es="Apple",ea="ASUS",el="BlackBerry",ed="Browser",ec="Chrome",eu="Firefox",eh="Google",ep="Huawei",ef="Microsoft",em="Motorola",eg="Opera",eS="Samsung",ev="Sharp",eb="Sony",ey="Xiaomi",e_="Zebra",eC="Facebook",eT="Chromium OS",eE="Mac OS",ew=" Browser",extend=function(o,p){var f={};for(var m in o)p[m]&&p[m].length%2==0?f[m]=p[m].concat(o[m]):f[m]=o[m];return f},enumerize=function(o){for(var p={},f=0;f<o.length;f++)p[o[f].toUpperCase()]=o[f];return p},has=function(o,p){return typeof o===M&&-1!==lowerize(p).indexOf(lowerize(o))},lowerize=function(o){return o.toLowerCase()},trim=function(o,p){if(typeof o===M)return o=o.replace(/^\s\s*/,""),typeof p===I?o:o.substring(0,500)},rgxMapper=function(o,p){for(var f,m,_,I,M,x,O=0;O<p.length&&!M;){var L=p[O],B=p[O+1];for(f=m=0;f<L.length&&!M&&L[f];)if(M=L[f++].exec(o))for(_=0;_<B.length;_++)x=M[++m],typeof(I=B[_])===k&&I.length>0?2===I.length?typeof I[1]==w?this[I[0]]=I[1].call(this,x):this[I[0]]=I[1]:3===I.length?typeof I[1]!==w||I[1].exec&&I[1].test?this[I[0]]=x?x.replace(I[1],I[2]):void 0:this[I[0]]=x?I[1].call(this,x,I[2]):void 0:4===I.length&&(this[I[0]]=x?I[3].call(this,x.replace(I[1],I[2])):void 0):this[I]=x||void 0;O+=2}},strMapper=function(o,p){for(var f in p)if(typeof p[f]===k&&p[f].length>0){for(var m=0;m<p[f].length;m++)if(has(p[f][m],o))return"?"===f?void 0:f}else if(has(p[f],o))return"?"===f?void 0:f;return p.hasOwnProperty("*")?p["*"]:o},eI={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"},eA={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[$,[L,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[$,[L,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[L,$],[/opios[\/ ]+([\w\.]+)/i],[$,[L,eg+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[$,[L,eg+" GX"]],[/\bopr\/([\w\.]+)/i],[$,[L,eg]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[$,[L,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[$,[L,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[L,$],[/quark(?:pc)?\/([-\w\.]+)/i],[$,[L,"Quark"]],[/\bddg\/([\w\.]+)/i],[$,[L,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[$,[L,"UC"+ed]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[$,[L,"WeChat"]],[/konqueror\/([\w\.]+)/i],[$,[L,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[$,[L,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[$,[L,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[$,[L,"Smart Lenovo "+ed]],[/(avast|avg)\/([\w\.]+)/i],[[L,/(.+)/,"$1 Secure "+ed],$],[/\bfocus\/([\w\.]+)/i],[$,[L,eu+" Focus"]],[/\bopt\/([\w\.]+)/i],[$,[L,eg+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[$,[L,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[$,[L,"Dolphin"]],[/coast\/([\w\.]+)/i],[$,[L,eg+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[$,[L,"MIUI"+ew]],[/fxios\/([\w\.-]+)/i],[$,[L,eu]],[/\bqihoobrowser\/?([\w\.]*)/i],[$,[L,"360"]],[/\b(qq)\/([\w\.]+)/i],[[L,/(.+)/,"$1Browser"],$],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[L,/(.+)/,"$1"+ew],$],[/samsungbrowser\/([\w\.]+)/i],[$,[L,eS+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[$,[L,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[L,"Sogou Mobile"],$],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[L,$],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[L],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[$,L],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[L,eC],$],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[L,$],[/\bgsa\/([\w\.]+) .*safari\//i],[$,[L,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[$,[L,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[$,[L,ec+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[L,ec+" WebView"],$],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[$,[L,"Android "+ed]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[L,$],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[$,[L,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[$,L],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[L,[$,strMapper,{"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],[L,$],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[L,"Netscape"],$],[/(wolvic|librewolf)\/([\w\.]+)/i],[L,$],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[$,[L,eu+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[L,[$,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[L,[$,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[q,"amd64"]],[/(ia32(?=;))/i],[[q,lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[q,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[q,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[q,"armhf"]],[/windows (ce|mobile); ppc;/i],[[q,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[q,/ower/,"",lowerize]],[/(sun4\w)[;\)]/i],[[q,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[q,lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[O,[U,eS],[B,et]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[O,[U,eS],[B,ee]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[O,[U,es],[B,ee]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[O,[U,es],[B,et]],[/(macintosh);/i],[O,[U,es]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[O,[U,ev],[B,ee]],[/(?:honor)([-\w ]+)[;\)]/i],[O,[U,"Honor"],[B,ee]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[O,[U,ep],[B,et]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[O,[U,ep],[B,ee]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[O,/_/g," "],[U,ey],[B,ee]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[O,/_/g," "],[U,ey],[B,et]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[O,[U,"OPPO"],[B,ee]],[/\b(opd2\d{3}a?) bui/i],[O,[U,"OPPO"],[B,et]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[O,[U,"Vivo"],[B,ee]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[O,[U,"Realme"],[B,ee]],[/\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],[O,[U,em],[B,ee]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[O,[U,em],[B,et]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[O,[U,"LG"],[B,et]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[O,[U,"LG"],[B,ee]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[O,[U,"Lenovo"],[B,et]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[O,/_/g," "],[U,"Nokia"],[B,ee]],[/(pixel c)\b/i],[O,[U,eh],[B,et]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[O,[U,eh],[B,ee]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[O,[U,eb],[B,ee]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[O,"Xperia Tablet"],[U,eb],[B,et]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[O,[U,"OnePlus"],[B,ee]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[O,[U,eo],[B,et]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[O,/(.+)/g,"Fire Phone $1"],[U,eo],[B,ee]],[/(playbook);[-\w\),; ]+(rim)/i],[O,U,[B,et]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[O,[U,el],[B,ee]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[O,[U,ea],[B,et]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[O,[U,ea],[B,ee]],[/(nexus 9)/i],[O,[U,"HTC"],[B,et]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[U,[O,/_/g," "],[B,ee]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[O,[U,"TCL"],[B,et]],[/(itel) ((\w+))/i],[[U,lowerize],O,[B,strMapper,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[O,[U,"Acer"],[B,et]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[O,[U,"Meizu"],[B,ee]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[O,[U,"Ulefone"],[B,ee]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[O,[U,"Energizer"],[B,ee]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[O,[U,"Cat"],[B,ee]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[O,[U,"Smartfren"],[B,ee]],[/droid.+; (a(?:015|06[35]|142p?))/i],[O,[U,"Nothing"],[B,ee]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[U,O,[B,ee]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[U,O,[B,et]],[/(surface duo)/i],[O,[U,ef],[B,et]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[O,[U,"Fairphone"],[B,ee]],[/(u304aa)/i],[O,[U,"AT&T"],[B,ee]],[/\bsie-(\w*)/i],[O,[U,"Siemens"],[B,ee]],[/\b(rct\w+) b/i],[O,[U,"RCA"],[B,et]],[/\b(venue[\d ]{2,7}) b/i],[O,[U,"Dell"],[B,et]],[/\b(q(?:mv|ta)\w+) b/i],[O,[U,"Verizon"],[B,et]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[O,[U,"Barnes & Noble"],[B,et]],[/\b(tm\d{3}\w+) b/i],[O,[U,"NuVision"],[B,et]],[/\b(k88) b/i],[O,[U,"ZTE"],[B,et]],[/\b(nx\d{3}j) b/i],[O,[U,"ZTE"],[B,ee]],[/\b(gen\d{3}) b.+49h/i],[O,[U,"Swiss"],[B,ee]],[/\b(zur\d{3}) b/i],[O,[U,"Swiss"],[B,et]],[/\b((zeki)?tb.*\b) b/i],[O,[U,"Zeki"],[B,et]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[U,"Dragon Touch"],O,[B,et]],[/\b(ns-?\w{0,9}) b/i],[O,[U,"Insignia"],[B,et]],[/\b((nxa|next)-?\w{0,9}) b/i],[O,[U,"NextBook"],[B,et]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[U,"Voice"],O,[B,ee]],[/\b(lvtel\-)?(v1[12]) b/i],[[U,"LvTel"],O,[B,ee]],[/\b(ph-1) /i],[O,[U,"Essential"],[B,ee]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[O,[U,"Envizen"],[B,et]],[/\b(trio[-\w\. ]+) b/i],[O,[U,"MachSpeed"],[B,et]],[/\btu_(1491) b/i],[O,[U,"Rotor"],[B,et]],[/(shield[\w ]+) b/i],[O,[U,"Nvidia"],[B,et]],[/(sprint) (\w+)/i],[U,O,[B,ee]],[/(kin\.[onetw]{3})/i],[[O,/\./g," "],[U,ef],[B,ee]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[O,[U,e_],[B,et]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[O,[U,e_],[B,ee]],[/smart-tv.+(samsung)/i],[U,[B,ei]],[/hbbtv.+maple;(\d+)/i],[[O,/^/,"SmartTV"],[U,eS],[B,ei]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[U,"LG"],[B,ei]],[/(apple) ?tv/i],[U,[O,es+" TV"],[B,ei]],[/crkey/i],[[O,ec+"cast"],[U,eh],[B,ei]],[/droid.+aft(\w+)( bui|\))/i],[O,[U,eo],[B,ei]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[O,[U,ev],[B,ei]],[/(bravia[\w ]+)( bui|\))/i],[O,[U,eb],[B,ei]],[/(mitv-\w{5}) bui/i],[O,[U,ey],[B,ei]],[/Hbbtv.*(technisat) (.*);/i],[U,O,[B,ei]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[U,trim],[O,trim],[B,ei]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[B,ei]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[U,O,[B,Z]],[/droid.+; (shield) bui/i],[O,[U,"Nvidia"],[B,Z]],[/(playstation [345portablevi]+)/i],[O,[U,eb],[B,Z]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[O,[U,ef],[B,Z]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[O,[U,eS],[B,er]],[/((pebble))app/i],[U,O,[B,er]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[O,[U,es],[B,er]],[/droid.+; (glass) \d/i],[O,[U,eh],[B,er]],[/droid.+; (wt63?0{2,3})\)/i],[O,[U,e_],[B,er]],[/droid.+; (glass) \d/i],[O,[U,eh],[B,er]],[/(pico) (4|neo3(?: link|pro)?)/i],[U,O,[B,er]],[/; (quest( \d| pro)?)/i],[O,[U,eC],[B,er]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[U,[B,en]],[/(aeobc)\b/i],[O,[U,eo],[B,en]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[O,[B,ee]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[O,[B,et]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[B,et]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[B,ee]],[/(android[-\w\. ]{0,9});.+buil/i],[O,[U,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[$,[L,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[L,$],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[$,[L,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[L,$],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[$,L]],os:[[/microsoft (windows) (vista|xp)/i],[L,$],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[L,[$,strMapper,eI]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[$,strMapper,eI],[L,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[$,/_/g,"."],[L,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[L,eE],[$,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[$,L],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[L,$],[/\(bb(10);/i],[$,[L,el]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[$,[L,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[$,[L,eu+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[$,[L,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[$,[L,"watchOS"]],[/crkey\/([\d\.]+)/i],[$,[L,ec+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[L,eT],$],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[L,$],[/(sunos) ?([\w\.\d]*)/i],[[L,"Solaris"],$],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[L,$]]},UAParser=function(o,p){if(typeof o===k&&(p=o,o=void 0),!(this instanceof UAParser))return new UAParser(o,p).getResult();var f=typeof _!==I&&_.navigator?_.navigator:void 0,m=o||(f&&f.userAgent?f.userAgent:""),Z=f&&f.userAgentData?f.userAgentData:void 0,ei=p?extend(eA,p):eA,er=f&&f.userAgent==m;return this.getBrowser=function(){var o,p={};return p[L]=void 0,p[$]=void 0,rgxMapper.call(p,m,ei.browser),p[x]=typeof(o=p[$])===M?o.replace(/[^\d\.]/g,"").split(".")[0]:void 0,er&&f&&f.brave&&typeof f.brave.isBrave==w&&(p[L]="Brave"),p},this.getCPU=function(){var o={};return o[q]=void 0,rgxMapper.call(o,m,ei.cpu),o},this.getDevice=function(){var o={};return o[U]=void 0,o[O]=void 0,o[B]=void 0,rgxMapper.call(o,m,ei.device),er&&!o[B]&&Z&&Z.mobile&&(o[B]=ee),er&&"Macintosh"==o[O]&&f&&typeof f.standalone!==I&&f.maxTouchPoints&&f.maxTouchPoints>2&&(o[O]="iPad",o[B]=et),o},this.getEngine=function(){var o={};return o[L]=void 0,o[$]=void 0,rgxMapper.call(o,m,ei.engine),o},this.getOS=function(){var o={};return o[L]=void 0,o[$]=void 0,rgxMapper.call(o,m,ei.os),er&&!o[L]&&Z&&Z.platform&&"Unknown"!=Z.platform&&(o[L]=Z.platform.replace(/chrome os/i,eT).replace(/macos/i,eE)),o},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 m},this.setUA=function(o){return m=typeof o===M&&o.length>500?trim(o,500):o,this},this.setUA(m),this};UAParser.VERSION="1.0.40",UAParser.BROWSER=enumerize([L,$,x]),UAParser.CPU=enumerize([q]),UAParser.DEVICE=enumerize([O,U,B,Z,ee,ei,et,er,en]),UAParser.ENGINE=UAParser.OS=enumerize([L,$]),typeof p!==I?(o.exports&&(p=o.exports=UAParser),p.UAParser=UAParser):f.amdO?void 0===(m=(function(){return UAParser}).call(p,f,p,o))||(o.exports=m):typeof _!==I&&(_.UAParser=UAParser);var ek=typeof _!==I&&(_.jQuery||_.Zepto);if(ek&&!ek.ua){var eM=new UAParser;ek.ua=eM.getResult(),ek.ua.get=function(){return eM.getUA()},ek.ua.set=function(o){eM.setUA(o);var p=eM.getResult();for(var f in p)ek.ua[f]=p[f]}}}("object"==typeof window?window:this)},0x173eb4b02:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x7b80cc62));p.default=class{constructor(o,p,f,m=1e3,_=200){this.realtimeController=o,this.selfAttendeeId=p,this.hasBandwidthPriorityCallback=f,this.waitIntervalMs=m,this.updateIntervalMs=_,this.speakerScores={},this.speakerMuteState={},this.detectorCallbackToHandler=new Map,this.detectorCallbackToScoresTimer=new Map,this.detectorCallbackToActivityTimer=new Map,this.hasBandwidthPriority=!1,this.mostRecentUpdateTimestamp={}}needUpdate(o){return!this.activeSpeakers||0===this.speakerScores[o]&&this.activeSpeakers.includes(o)||this.speakerScores[o]>0&&!this.activeSpeakers.includes(o)}updateActiveSpeakers(o,p,f){if(!this.needUpdate(f))return;let m=[],_=Object.keys(this.speakerScores);for(let o=0;o<_.length;o++){let p=_[o];m.push({attendeeId:p,activeScore:this.speakerScores[p]})}let w=m.sort((o,p)=>p.activeScore-o.activeScore).filter(function(o){return o.activeScore>0}).map(function(o){return o.attendeeId});this.activeSpeakers=w,p(w);let I=w.length>0&&w[0]===this.selfAttendeeId&&o.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==I&&(this.hasBandwidthPriority=I,this.hasBandwidthPriorityCallback(I))}updateScore(o,p,f,m,_){let w=o.calculateScore(f,m,_);this.speakerScores[f]!==w&&(this.speakerScores[f]=w,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f))}subscribe(o,p,f,m){let handler=(f,m)=>{if(!m){this.speakerScores[f]=0,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f);return}this.realtimeController.realtimeSubscribeToVolumeIndicator(f,(f,m,_,w)=>{this.mostRecentUpdateTimestamp[f]=Date.now(),null!==_&&(this.speakerMuteState[f]=_),this.updateScore(o,p,f,m,_)})};this.detectorCallbackToHandler.set(p,handler);let _=new w.default(this.updateIntervalMs);if(_.start(()=>{for(let f in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[f]>this.waitIntervalMs&&this.updateScore(o,p,f,0,this.speakerMuteState[f])}),this.detectorCallbackToActivityTimer.set(p,_),f&&m){let o=new w.default(m);o.start(()=>{f(this.speakerScores)}),this.detectorCallbackToScoresTimer.set(p,o)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)}unsubscribe(o){let p=this.detectorCallbackToHandler.get(o);this.detectorCallbackToHandler.delete(o),p&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(p);let f=this.detectorCallbackToActivityTimer.get(o);f&&(f.stop(),this.detectorCallbackToActivityTimer.delete(o));let m=this.detectorCallbackToScoresTimer.get(o);m&&(m.stop(),this.detectorCallbackToHandler.delete(o))}destroy(){return m(this,void 0,void 0,function*(){for(let o of this.detectorCallbackToHandler.values())this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o);for(let o of this.detectorCallbackToActivityTimer.values())o.stop();for(let o of this.detectorCallbackToScoresTimer.values())o.stop();this.detectorCallbackToHandler.clear(),this.detectorCallbackToActivityTimer.clear(),this.detectorCallbackToScoresTimer.clear()})}}},0x13c61502e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=.9,p=.01,f=.2,m=.2){this.speakerWeight=o,this.cutoffThreshold=p,this.silenceThreshold=f,this.takeoverRate=m,this.volumes={}}calculateScore(o,p,f){(f||null===p)&&(p=0),this.volumes.hasOwnProperty(o)||(this.volumes[o]=0),p=+(p>this.silenceThreshold);let m=this.volumes[o]*this.speakerWeight+p*(1-this.speakerWeight);for(let f in this.volumes[o]=m,this.volumes)f!==o&&(this.volumes[f]=Math.max(this.volumes[f]-this.takeoverRate*p,0));return m<this.cutoffThreshold?0:m}prioritizeVideoSendBandwidthForActiveSpeaker(){return!0}}},0x1f0ef6b1d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ApplicationMetadata{constructor(o,p){this.appName=o,this.appVersion=p}static create(o,p){let f=/^[a-zA-Z0-9]+[a-zA-Z0-9_-]*[a-zA-Z0-9]+$/g;if(!o||o.length>32)throw Error("appName should be a valid string and 1 to 32 characters in length");if(!f.test(o))throw Error(`appName must satisfy ${f} regular expression`);if(!p||p.length>32)throw Error("appVersion should be a valid string and 1 to 32 characters in length");if(!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm.test(p))throw Error("appVersion must satisfy Semantic Versioning format");return new ApplicationMetadata(o,p)}}},0xd80a42d3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x5cbe4bac:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0x573f705d));p.default=class{constructor(o){this.logger=o,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new w.default,this.observers=new Set}bindAudioElement(o){return m(this,void 0,void 0,function*(){if(!o)throw Error(`Cannot bind audio element: ${o}`);return this.audioElement=o,this.audioElement.autoplay=!0,this.bindAudioMix()})}unbindAudioElement(){this.audioElement&&(this.audioElement.srcObject=null,this.audioElement=null,this.forEachObserver(o=>{this.audioStream&&o.meetingAudioStreamBecameInactive(this.audioStream)}))}bindAudioStream(o){return m(this,void 0,void 0,function*(){if(o){this.audioStream=o;try{yield this.bindAudioMix()}catch(o){this.logger&&this.logger.warn(`Failed to bind audio stream: ${o}`)}}})}bindAudioDevice(o){return m(this,void 0,void 0,function*(){if(o&&!this.browserBehavior.supportsSetSinkId())throw Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=o,this.bindAudioMix()})}forEachObserver(o){for(let p of this.observers)I.default.nextTick(()=>{o(p)})}bindAudioMix(){var o,p;return m(this,void 0,void 0,function*(){if(!this.audioElement)return;let f=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),f!==this.audioStream&&this.forEachObserver(o=>{f&&o.meetingAudioStreamBecameInactive(f),this.audioStream&&o.meetingAudioStreamBecameActive(this.audioStream)});let m=(null==(o=this.audioDevice)?void 0:o.deviceId)!==this.audioElement.sinkId;if(m&&void 0===this.audioElement.sinkId)throw Error("Cannot select audio output device. This browser does not support setSinkId.");let _=this.audioDevice?this.audioDevice.deviceId:"";if(_===this.audioElement.sinkId)return;let w=this.audioElement,I=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=null),m)try{yield w.setSinkId(_)}catch(o){throw null==(p=this.logger)||p.error(`Failed to set sinkId for audio element: ${o}`),o}this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=I)})}getCurrentMeetingAudioStream(){return m(this,void 0,void 0,function*(){return this.audioStream})}addAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.add(o)})}removeAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.delete(o)})}audioOutputDidChange(o){return m(this,void 0,void 0,function*(){return this.logger.info("Receive an audio output change event"),this.bindAudioDevice(o)})}}},0x249fc81e5:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x165009cb4));p.default=class AudioProfile{constructor(o=null,p=!0){this.audioBitrateBps=o,this.enableAudioRedundancy=new _.default().supportsAudioRedundancy()&&p}static fullbandSpeechMono(o=!0){return new AudioProfile(4e4,o)}static fullbandMusicMono(o=!0){return new AudioProfile(64e3,o)}static fullbandMusicStereo(o=!0){return new AudioProfile(128e3,o)}isStereo(){return 128e3===this.audioBitrateBps}hasRedundancyEnabled(){return this.enableAudioRedundancy}}},0x1c48b14ba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=void 0;let _=m(f(0xc30676e4));p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=25;let w=class{constructor(){this.logger=null,this.browserBehavior=null,this.meetingSessionConfiguration=null,this.signalingClient=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.activeAudioInput=void 0,this.activeVideoInput=void 0,this.audioMixController=null,this.transceiverController=null,this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.iceGatheringStateEventHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.reconnectController=null,this.removableObservers=[],this.audioProfile=null,this.videoStreamIndex=null,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.lastKnownVideoAvailability=null,this.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.lastVideosToReceive=null,this.videoSubscriptions=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videoSendCodecPreferences=[],this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.prioritizedSendVideoCodecCapabilities=[],this.degradedVideoSendCodecs=[],this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.enableSVC=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null,this.retryCount=0,this.isSessionConnected=!1}resetConnectionSpecificState(){this.peer&&this.peer.close(),this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,void 0!==this.transceiverController&&this.transceiverController.reset(),this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.videoDownlinkBandwidthPolicy.reset(),this.videoUplinkBandwidthPolicy.reset&&this.videoUplinkBandwidthPolicy.reset(),this.lastVideosToReceive=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptions=null,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videosToReceive=new _.default,this.videosPaused=new _.default,this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.videoDuplexMode=null,this.isSessionConnected=!1}};p.default=w},0x10a965f7c:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0x173eb4b02)),x=k(f(0x5cbe4bac)),O=k(f(0x249fc81e5)),L=k(f(0x165009cb4)),B=k(f(0x73406699)),U=k(f(0x7cabad69)),$=k(f(0x3b3f192c)),q=f(0x1029db6ff),Z=k(f(0xb28de657)),ee=k(f(0x234745d42)),et=k(f(0x17310e8bb)),ei=k(f(0x1a154f9b0)),er=k(f(0x504c9394)),en=k(f(0x102abe35c)),eo=k(f(0x573f705d)),es=k(f(0x17e3191d)),ea=k(f(0x1c843e818)),el=k(f(0x195905627)),ed=k(f(0xd03588a6)),ec=k(f(0x14f60ed93)),eu=k(f(0x24718f0be)),eh=w(f(0x1e93e1412)),ep=k(f(0x16bec8feb)),ef=k(f(0xcb99c5a5)),em=f(0xe88b24d9),eg=k(f(0xf8f9c263)),eS=k(f(0xd60c9fd8)),ev=k(f(0x11ee4612e)),eb=k(f(0x302be147)),ey=k(f(0x1cd1bb811)),e_=k(f(0xad28f8b8)),eC=k(f(0x25372cf50)),eT=k(f(0x1c594fec7)),eE=k(f(0x20543e8f4)),ew=k(f(0x138bc4923)),eI=k(f(0x1f0d2ad73)),eA=k(f(0x1f9377021)),ek=k(f(0x1c97ddc23)),eM=k(f(0x1f71fad3b)),ex=k(f(0x2429ed05e)),eP=k(f(0x18781162e)),eR=k(f(0x130a7607d)),eO=k(f(0x151ad6ab5)),eD=k(f(0x222af4e39)),eL=k(f(0xc70eec36)),eN=k(f(0x1fc5185a)),eF=k(f(0x15fdb9011)),eV=k(f(0x21d574c92)),eB=k(f(0x1174c5f22)),eU=k(f(0x24564ad46)),ej=k(f(0x93a0ab1c)),eH=k(f(0xdeeb6fe4)),ez=k(f(0x2293b1f8c)),eG=k(f(0x24fd8c738)),eW=f(0xb529932d),e$=k(f(0xb40abe4c)),eK=k(f(0x1a174c132)),eq=k(f(0x15ad5180a)),eJ=f(0xfa5b698a),eY=k(f(0xc30676e4)),eX=k(f(0x243b05980)),eQ=k(f(0x217dc1bb8)),eZ=k(f(0x198994116)),e0=k(f(0x168367eac)),e1=k(f(0x16364c8d1)),e2=k(f(0xb231bce1)),e3=k(f(0x194492f4c)),e4=k(f(0x1c48b14ba)),e5=class DefaultAudioVideoController{constructor(o,p,f,m,_,w){this._audioProfile=new O.default,this.connectionHealthData=new B.default,this.observerQueue=new Set,this.meetingSessionContext=new e4.default,this.enableSimulcast=!1,this.enableSVC=!1,this.useUpdateTransceiverControllerForUplink=!1,this.startAudioVideoTimestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!1,this.receiveIndexTask=void 0,this.monitorTask=void 0,this.receiveRemotePauseResumeTask=void 0,this.destroyed=!1,this._logger=p,this.sessionStateController=new ea.default(this._logger),this._configuration=o,this._webSocketAdapter=f,this._realtimeController=new en.default(m),this._realtimeController.realtimeSetLocalAttendeeId(o.credentials.attendeeId,o.credentials.externalUserId),this._mediaStreamBroker=m,this._reconnectController=_,this._videoTileController=new eZ.default(new e0.default,this,this._logger),this._audioMixController=new x.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=w,this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers||(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)&&new L.default().hasChromiumWebRTC()?this.videoSendCodecPreferences=[es.default.av1Main(),es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()]:this.videoSendCodecPreferences=[es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()])}destroy(){return I(this,void 0,void 0,function*(){this.observerQueue.clear(),this._mediaStreamBroker.removeMediaStreamBrokerObserver(this._audioMixController),this.destroyed=!0})}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new M.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}get eventController(){return this._eventController}getRTCPeerConnectionStats(o){return(this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent||(this.logger.warn("The `getRTCPeerConnectionStats()` is on its way to be deprecated. It makes an additional call to the `getStats` API and therefore may cause slight performance degradation. Please use the new API `clientMetricReport.getRTCStatsReport()` returned by `metricsDidReceive(clientMetricReport)` callback instead."),this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!0),this.rtcPeerConnection)?this.rtcPeerConnection.getStats(o):null}setAudioProfile(o){this._audioProfile=o}addObserver(o){this.logger.info("adding meeting observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing meeting observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)eo.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}initSignalingClient(){this.connectionHealthData.reset(),this.meetingSessionContext.signalingClient||(this.meetingSessionContext=new e4.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new L.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.audioProfile=this._audioProfile,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new eu.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){this.meetingSessionContext.signalingClient.removeObserver(this.preStartObserver),this.preStartObserver=void 0}prestart(){return this.logger.info("Pre-connecting signaling connection."),this.createOrReuseSignalingTask().run().then(()=>{let handleClosed=()=>I(this,void 0,void 0,function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()});this.preStartObserver={handleSignalingClientEvent(o){o.type===ep.default.WebSocketClosed&&handleClosed()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)}).catch(o=>{this.logger.error(`Signaling task pre-start failed: ${o}`),this.signalingTask=void 0})}start(o){this.startReturningPromise(o).then(()=>{this.logger.info("start completed")}).catch(o=>{this.logger.error(`start failed: ${o}`)})}startReturningPromise(o){return(null==o?void 0:o.signalingOnly)===!0?this.prestart():(this.activeSpeakerDetector,new Promise((o,p)=>{this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!1).then(o).catch(p)})}))}connectWithPromises(o){let p=this.meetingSessionContext,timeout=(o,p)=>new eB.default(this.logger,p,o);this.monitorTask=new eI.default(p,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);let f=this.monitorTask.once(),m=new ex.default(p).once();this.receiveIndexTask=new eO.default(p),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();let _=new eL.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new ew.default(p),new eD.default(p),new eT.default(p),this.receiveIndexTask]).once(),w=new ey.default(p).once(_),I=new eS.default(p).once(w,m),k=new e_.default(p).once(I),M=new eN.default(p).once(k),x=new eC.default(p).once(M),O=new eV.default(p).once(x);return this.receiveRemotePauseResumeTask=new eP.default(p),this.receiveRemotePauseResumeTask.once(O),new eL.default(this.logger,this.wrapTaskName("AudioVideoStart"),[f,timeout(this.configuration.connectionTimeoutMs,new eL.default(this.logger,"Peer",[O,this.receiveRemotePauseResumeTask,o?new eB.default(this.logger,new ek.default(this.logger,"FinalizeConnection",[new eU.default(p),new eF.default(p)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new eF.default(p)]))])}actionConnect(o){var p;return I(this,void 0,void 0,function*(){this.initSignalingClient(),this.uninstallPreStartObserver(),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this,this.enableSimulcast=this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&new L.default().hasChromiumWebRTC(),this.enableSimulcast&&this.configuration.enableSVC&&this.logger.warn("SVC cannot be enabled at the same time as simulcast. Disabling SVC, using simulcast."),this.enableSVC=!this.enableSimulcast&&this.configuration.enableSVC&&new L.default().supportsScalableVideoCoding();let f=!!this.configuration.urls.audioHostURL;if(f?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new eH.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext):this.meetingSessionContext.transceiverController=new ez.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new ej.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new eG.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)),this.meetingSessionContext.volumeIndicatorAdapter=new e3.default(this.logger,this._realtimeController,DefaultAudioVideoController.MIN_VOLUME_DECIBELS,DefaultAudioVideoController.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.meetingSessionContext.enableSVC=this.enableSVC,this.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy;o||(o=new e1.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=o),o.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eq.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new eQ.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new eX.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new e2.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.videoUplinkBandwidthPolicy.setSVCEnabled(this.enableSVC)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eK.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController&&this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController&&(this.useUpdateTransceiverControllerForUplink=!0,this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController(this.meetingSessionContext.transceiverController)),this.meetingSessionContext.audioProfile=this._audioProfile;if(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)){let o=this.configuration.meetingFeatures.contentMaxResolution===$.default.VideoResolutionUHD;o&&this.setVideoMaxBandwidthKbps(2500),this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}else{let o=this.configuration.meetingFeatures.videoMaxResolution===$.default.VideoResolutionFHD;this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}this.meetingSessionContext.videoUplinkBandwidthPolicy&&this.maxUplinkBandwidthKbps&&this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(this.maxUplinkBandwidthKbps),this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController(this._videoTileController),this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver(()=>this.update({needsRenegotiation:!1})),this.meetingSessionContext.lastKnownVideoAvailability=new et.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new e$.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new eY.default,this.meetingSessionContext.videosPaused=new eY.default,this.meetingSessionContext.statsCollector=new eg.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new U.default(this,this._realtimeController,this.connectionHealthData,new er.default(this.meetingSessionContext.signalingClient,DefaultAudioVideoController.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},this._videoTileController.registerVideoTileResolutionObserver(this.meetingSessionContext.statsCollector),o||(this.meetingSessionContext.retryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!1))}),null==(p=this.eventController)||p.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);let m=f&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;this.logger.info("Needs to wait for attendee presence? "+m);let _=this.connectWithPromises(m);try{yield _.run(),this.connectionHealthData.setConnectionStartTime();let o=new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT);this.connectionHealthData.setIsContentShare(o),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var o;this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,null==(o=this.eventController)||o.publishEvent("meetingStartSucceeded",q.audioVideoEventAttributesFromState(this.meetingSessionContext)),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()})}catch(p){this.signalingTask=void 0;let o=new Z.default(this.getMeetingStatusCode(p)||ee.default.TaskFailed);if(this.logger.info(`Start failed: ${o} due to error ${p}.`),this.sessionStateController.state()===ed.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(el.default.Fail,()=>I(this,void 0,void 0,function*(){yield this.actionDisconnect(o,!0,p),this.handleMeetingSessionStatus(o,p)||this.notifyStop(o,p)}))}})}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new eB.default(this.logger,new eA.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=em.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.meetingSessionContext.isSessionConnected=!0,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStart).map(p=>p.bind(o)())}),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var o;return(this._reconnectController.disableReconnect(),this.sessionStateController.state()===ed.default.NotConnected)?(null==(o=this.meetingSessionContext.signalingClient)||o.closeConnection(),this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise((o,p)=>{this.sessionStateController.perform(el.default.Disconnect,()=>{this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new Z.default(ee.default.Left),!1,null).then(o).catch(p)})})}stop(){this.stopReturningPromise()}actionDisconnect(o,p,f){return I(this,void 0,void 0,function*(){try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new eB.default(this.logger,new eE.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(o){this.logger.info("fail to stop")}try{let o=[new eB.default(this.logger,new eb.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new eL.default(this.logger,this.wrapTaskName("AudioVideoClean"),o).run()}catch(o){this.logger.info("fail to clean")}this.sessionStateController.perform(el.default.FinishDisconnecting,()=>{p||this.notifyStop(o,f)}),this._videoTileController.removeVideoTileResolutionObserver(this.meetingSessionContext.statsCollector)})}update(o={needsRenegotiation:!0}){let p=o.needsRenegotiation;if(p||(p=void 0===this.meetingSessionContext.peer),p||(p=!this.updateRemoteVideosFromPolicy()),p||(p=!this.updateLocalVideoFromPolicy()),this.meetingSessionContext.lastVideosToReceive=this.meetingSessionContext.videosToReceive,!p)return this.logger.info("Update request does not require resubscribe"),this.actionFinishUpdating(),!0;this.logger.info("Update request requires resubscribe"),this.updateNumberOfPublishedVideoSources();let f=this.sessionStateController.perform(el.default.Update,()=>{this.actionUpdateWithRenegotiation(!0)});return f===ec.default.Transitioned||f===ec.default.DeferredTransition}updateNumberOfPublishedVideoSources(){let o=this.configuration.credentials.attendeeId,p=this._videoTileController.hasStartedLocalVideoTile();if(null!==this.meetingSessionContext.videoStreamIndex){let f=this.meetingSessionContext.videoStreamIndex.numberOfVideoPublishingParticipantsExcludingSelf(o)+ +!!p;this.connectionHealthData.setNumberOfPublishedVideoSources(f)}}updateRemoteVideosFromPolicy(){if(this.meetingSessionContext.videoDownlinkBandwidthPolicy&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getVideoPreferences&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&!eh.serverSideNetworkAdaptionIsNoneOrDefault(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())){if(!this.sendRemoteVideoUpdate())return!1;if(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()===eh.default.BandwidthProbingAndRemoteVideoQualityAdaption)return this.isNotAddingOrRemovingStreams()}return this.updateRemoteVideosIfNotAddingOrRemovingStreams()}updateRemoteVideosIfNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.simulcastStreamUpdates,m=o.removed,_=this.meetingSessionContext,w=[];for(let[o,p]of f.entries()){let f=new ef.default;if(f.streamId=p,f.attendeeId=_.videoStreamIndex.attendeeIdForStreamId(p),f.mid=_.transceiverController.getMidForStreamId(o),void 0===f.mid)return this.logger.info(`No MID found for stream ID ${o}, cannot update stream without renegotiation`),!1;if(w.push(f),_.transceiverController.setStreamIdForMid(f.mid,p),_.videoStreamIndex.overrideStreamIdMappings(o,p),_.videoTileController.haveVideoTileForAttendeeId(f.attendeeId)){let o=_.videoTileController.getVideoTileForAttendeeId(f.attendeeId);if(!o.setStreamId)return!1;o.setStreamId(p)}}return 0!==w.length&&_.signalingClient.remoteVideoUpdate(w,[]),0===p.length&&0===m.length&&(_.videoStreamIndex.remoteVideoUpdateSent(),!0)}detectChangesInVideosToReceive(){let o=this.meetingSessionContext;if(null===o.videosToReceive||!o.transceiverController||!o.transceiverController.getMidForStreamId||!o.transceiverController.setStreamIdForMid||!o.videosToReceive.forEach||!o.signalingClient.remoteVideoUpdate||!o.videoStreamIndex.overrideStreamIdMappings)return;let p=[],f=new Map,m=[];if(null===o.lastVideosToReceive)p=o.videosToReceive.array();else{let _=o.videoStreamIndex;o.videosToReceive.forEach(m=>{if(o.lastVideosToReceive.contain(m))return;let w=!1;o.lastVideosToReceive.forEach(o=>{!w&&_.StreamIdsInSameGroup(o,m)&&(f.set(o,m),w=!0)}),w||p.push(m)}),m=o.lastVideosToReceive.array().filter(p=>{let m=o.videosToReceive.contain(p),_=f.has(p);return!m&&!_})}return this.logger.info(`Request to update remote videos with added: [${p}], updated: [${Array.from(f.entries()).map(([o,p])=>`${o}->${p}`).join(",")}], removed: [${m}]`),{added:p,removed:m,simulcastStreamUpdates:f}}isNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.removed;return 0===p.length&&0===f.length&&(this.meetingSessionContext.videoStreamIndex.remoteVideoUpdateSent(),!0)}sendRemoteVideoUpdate(){let o=this.meetingSessionContext;if(null===o.videosToReceive)return!1;let p=o.videosToReceive.array().map(p=>o.videoStreamIndex.groupIdForStreamId(p));this.receiveRemotePauseResumeTask.updateSubscribedGroupdIds(new Set(p));let f=eJ.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(o,p,o.videoDownlinkBandwidthPolicy.getVideoPreferences()),m=new Map,_=[];for(let p of f){let f=!1;if(o.lastVideoSubscriptionConfiguration.has(p.groupId)){let m=o.lastVideoSubscriptionConfiguration.get(p.groupId);p.equals(m)||(this.logger.debug(`${JSON.stringify(p)} does not equal ${JSON.stringify(m)}, sending update`),f=!0)}else f=!0;m.set(p.groupId,p),f&&_.push(p)}o.lastVideoSubscriptionConfiguration=m;let w=[];if(null!==o.lastVideosToReceive){let f=new Set(p);for(let p of o.lastVideosToReceive.array()){let m=o.videoStreamIndex.groupIdForStreamId(p);if(!f.has(m)){let p=o.transceiverController.getMidForGroupId(m);if(void 0===p){o.logger.warn(`Could not find MID for group ID to remove: ${m}`);continue}w.push(p)}}}return(0!==_.length||0!==w.length)&&o.signalingClient.remoteVideoUpdate(_,w),!0}updateLocalVideoFromPolicy(){if(this.meetingSessionContext.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseEncodingParameters();if(this.mayNeedRenegotiationForSimulcastLayerChange&&this.meetingSessionContext.transceiverController.hasVideoInput()&&!this.negotiatedBitrateLayersAllocationRtpHeaderExtension())return this.logger.info("Needs regenotiation for local video simulcast layer change"),this.mayNeedRenegotiationForSimulcastLayerChange=!1,!1;this.meetingSessionContext.transceiverController.setEncodingParameters(o)}else this.meetingSessionContext.videoCaptureAndEncodeParameter=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters();return this.logger.info("Updated local video from policy without renegotiation"),!0}negotiatedBitrateLayersAllocationRtpHeaderExtension(){if(!this.meetingSessionContext.transceiverController.localVideoTransceiver())return!1;let o=this.meetingSessionContext.transceiverController.localVideoTransceiver().sender.getParameters();return!!o&&!!o.headerExtensions&&o.headerExtensions.some(o=>"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"===o.uri)}restartLocalVideo(o){let restartVideo=()=>I(this,void 0,void 0,function*(){this._videoTileController.hasStartedLocalVideoTile()&&(this.logger.info("stopping local video tile prior to local video restart"),this._videoTileController.stopLocalVideoTile(),this.logger.info("preparing local video restart update"),yield this.actionUpdateWithRenegotiation(!1),this.logger.info("starting local video tile for local video restart"),this._videoTileController.startLocalVideoTile()),this.logger.info("finalizing local video restart update"),yield this.actionUpdateWithRenegotiation(!0),o()}),p=this.sessionStateController.perform(el.default.Update,()=>{restartVideo()});return p===ec.default.Transitioned||p===ec.default.DeferredTransition}replaceLocalVideo(o){return I(this,void 0,void 0,function*(){if(!o||o.getVideoTracks().length<1)throw Error("could not acquire video track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");let p=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(p){let f=p.state(),m=o.getVideoTracks()[0].getSettings();p.bindVideoStream(f.boundAttendeeId,!0,o,m.width,m.height,f.streamId,f.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(o.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=o,this.logger.info("Local video input is updated")})}replaceLocalAudio(o){return I(this,void 0,void 0,function*(){if(!o||o.getAudioTracks().length<1)throw Error("could not acquire audio track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");if(this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime(),!(yield this.meetingSessionContext.transceiverController.replaceAudioTrack(o.getAudioTracks()[0])))throw Error("Failed to replace audio track");this.meetingSessionContext.activeAudioInput=o,this.logger.info("Local audio input is updated")})}actionUpdateWithRenegotiation(o){return I(this,void 0,void 0,function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),o&&this.sessionStateController.perform(el.default.FinishUpdating,()=>{this.actionFinishUpdating()})}catch(o){this.sessionStateController.perform(el.default.FinishUpdating,()=>{let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);p.statusCode()!==ee.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(p,o)})}})}notifyStop(o,p){var f;if(this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoDidStop).map(f=>f.bind(p)(o))}),this.eventController){let m=Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]}),_=p&&p.message||(null==(f=o.toString)?void 0:f.call(o))||"";null===this.meetingSessionContext.startTimeMs?(m.meetingErrorMessage=_,delete m.meetingDurationMs,delete m.attendeePresenceDurationMs,delete m.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",m)):o.isFailure()||o.isAudioConnectionFailure()?(m.meetingErrorMessage=_,this.eventController.publishEvent("meetingFailed",m)):this.eventController.publishEvent("meetingEnded",m)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{let o=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(o)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(o,p){this.promotedToPrimaryMeeting&&(this.promotedToPrimaryMeeting=!1,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.AudioVideoDisconnectedWhilePromoted)))}));let f=this._reconnectController.retryWithBackoff(()=>I(this,void 0,void 0,function*(){this.sessionStateController.state()===ed.default.NotConnected?this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!0)}):this.sessionStateController.perform(el.default.Reconnect,()=>{this.actionReconnect(o)}),this.meetingSessionContext.retryCount+=1}),()=>{this.logger.info("canceled retry")});return f||this.sessionStateController.perform(el.default.Fail,()=>{this.actionDisconnect(o,!1,p)}),f}actionReconnect(o){return I(this,void 0,void 0,function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!0))})),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset(),this.receiveRemotePauseResumeTask=new eP.default(this.meetingSessionContext);try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new eB.default(this.logger,new eL.default(this.logger,"Media",[new ev.default(this.meetingSessionContext),new eL.default(this.logger,"Signaling",[new eA.default(this.meetingSessionContext),new eT.default(this.meetingSessionContext)]),new ey.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext),this.receiveRemotePauseResumeTask]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var p;null==(p=this.eventController)||p.publishEvent("meetingReconnected",Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]})),this.actionFinishConnecting()})}catch(o){this.sessionStateController.perform(el.default.FinishConnecting,()=>{this.logger.info("failed to reconnect audio-video session");let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);this.handleMeetingSessionStatus(p,o)})}this.connectionHealthData.setConnectionStartTime()})}wrapTaskName(o){return`${o}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}getMeetingStatusCode(o){let p=/the meeting status code: (\d+)/.exec(o&&o.message);return p&&p.length>1?Number.parseInt(p[1],10):null}enforceBandwidthLimitationForSender(o){return I(this,void 0,void 0,function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(o)})}handleMeetingSessionStatus(o,p){if(this.logger.info(`handling status: ${ee.default[o.statusCode()]}`),!o.isTerminal()&&this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(o),o.statusCode()===ee.default.IncompatibleSDP)return this.restartLocalVideo(()=>{this.logger.info("handled incompatible SDP by attempting to restart video")}),!0;if(o.statusCode()===ee.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver(o=>{eW.Maybe.of(o.videoSendDidBecomeUnavailable).map(p=>p.bind(o)())}),!1;if(o.statusCode()===ee.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoWasDemotedFromPrimaryMeeting).map(f=>f.bind(p)(o))}),!1;if(o.isTerminal()&&(this.logger.error("session will not be reconnected"),this.meetingSessionContext.reconnectController&&this.meetingSessionContext.reconnectController.disableReconnect()),(o.isFailure()||o.isTerminal())&&this.meetingSessionContext.reconnectController){let f=this.reconnect(o,p);return f?this.logger.warn(`The audio video controller will reconnect due to status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`):this.logger.error(`The audio video controller failed with status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`),f}return!1}setVideoMaxBandwidthKbps(o){if(o<=0)throw Error("Max bandwidth kbps has to be greater than 0");this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&(this.logger.info(`video send has ideal max bandwidth ${o} kbps`),this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(o)),this.maxUplinkBandwidthKbps=o}handleHasBandwidthPriority(o){return I(this,void 0,void 0,function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){if(this.useUpdateTransceiverControllerForUplink){this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o),yield this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();return}let p=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o);let f=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();p!==f&&(this.logger.info(`video send bandwidth priority ${o} max has changed from ${p} kbps to ${f} kbps`),yield this.enforceBandwidthLimitationForSender(f))}})}pauseReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.pause([o])}resumeReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.resume([o])}setVideoCodecSendPreferences(o){this.videoSendCodecPreferences=o,this.meetingSessionContext.videoSendCodecPreferences=o,this.sessionStateController.state()!==ed.default.NotConnected&&this.update({needsRenegotiation:!0})}getRemoteVideoSources(){let{videoStreamIndex:o}=this.meetingSessionContext;if(!o)return this.logger.info("meeting has not started"),[];let p=this.configuration.credentials.attendeeId;return o.allVideoSendingSourcesExcludingSelf(p)}encodingSimulcastLayersDidChange(o){this.mayNeedRenegotiationForSimulcastLayerChange=!0,this.forEachObserver(p=>{eW.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}promoteToPrimaryMeeting(o){return this.actionPromoteToPrimaryMeeting(o)}actionPromoteToPrimaryMeeting(o){return I(this,void 0,void 0,function*(){let p=new Z.default(ee.default.SignalingRequestFailed);return yield new eL.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new eB.default(this.logger,new eM.default(this.meetingSessionContext,o,o=>{p=o}),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=p.statusCode()===ee.default.OK,p})}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.OK)))})}videoInputDidChange(o){return I(this,void 0,void 0,function*(){(this.logger.info("Receive a video input change event"),this.meetingSessionContext&&this.meetingSessionContext.peer)?this._videoTileController.hasStartedLocalVideoTile()&&(o?yield this.replaceLocalVideo(o):this._videoTileController.stopLocalVideoTile()):this.logger.info("Skip updating video input because there is no active meeting and peer connection")})}audioInputDidChange(o){return I(this,void 0,void 0,function*(){if(this.logger.info("Receive an audio input change event"),!this.meetingSessionContext||!this.meetingSessionContext.peer)return void this.logger.info("Skip updating audio input because there is no active meeting and peer connection");if(!o)try{o=yield this.mediaStreamBroker.acquireAudioInputStream()}catch(o){this.logger.error("Could not acquire audio track from mediaStreamBroker");return}yield this.replaceLocalAudio(o)})}};p.default=e5,e5.MIN_VOLUME_DECIBELS=-42,e5.MAX_VOLUME_DECIBELS=-14,e5.PING_PONG_INTERVAL_MS=1e4},0x233121a41:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(6329639e3)),w=m(f(0x674df13c)),I=m(f(0x23cb0924a)),k=m(f(0x41c6ff55)),M=m(f(0x13b48f1ad)),x=m(f(0x16342f6ad)),O=m(f(0xb28de657)),L=m(f(0x234745d42)),B=m(f(0xd5022a77)),U=m(f(0x1b1a7866)),$=m(f(0x5cfde354)),q=m(f(0x10a965f7c));p.default=class extends q.default{constructor(o){const p=new M.default;p.meetingId="",p.externalMeetingId="",p.credentials=new x.default,p.credentials.attendeeId="",p.credentials.joinToken="",p.urls=new B.default,p.urls.turnControlURL="",p.urls.audioHostURL="",p.urls.signalingURL="wss://localhost/";const f=new I.default;super(o||p,f,new $.default(new I.default),new k.default,new U.default(0,new _.default(0,0,0)),new w.default(o||p,f))}setAudioProfile(o){}start(){}stop(){}promoteToPrimaryMeeting(o){return Promise.resolve(new O.default(L.default.OK))}demoteFromPrimaryMeeting(){}}},0x12f2a530c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x20a4e5a2e);p.default=class{constructor(o,p,f,m,_,w){this.audioVideoController=o,this.videoTileController=p,this.realtimeController=f,this.audioMixController=m,this.deviceController=_,this.contentShareController=w}addObserver(o){this.audioVideoController.addObserver(o),this.trace("addObserver")}removeObserver(o){this.audioVideoController.removeObserver(o),this.trace("removeObserver")}setAudioProfile(o){this.trace("setAudioProfile",o),this.audioVideoController.setAudioProfile(o)}start(o){this.audioVideoController.start(o),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(o){return this.trace("getRTCPeerConnectionStats",o?o.id:null),this.audioVideoController.getRTCPeerConnectionStats(o)}bindAudioElement(o){let p=this.audioMixController.bindAudioElement(o);return this.trace("bindAudioElement",o.id,p),p}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(o){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(o)}removeAudioMixObserver(o){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(o)}bindVideoElement(o,p){this.videoTileController.bindVideoElement(o,p),this.trace("bindVideoElement",{tileId:o,videoElementId:p.id})}unbindVideoElement(o,p=!0){this.videoTileController.unbindVideoElement(o,p),this.trace("unbindVideoElement",{tileId:o,cleanUpVideoElement:p})}startLocalVideoTile(){let o=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,o),o}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){let o=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,o),o}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){let o=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),o}pauseVideoTile(o){this.videoTileController.pauseVideoTile(o),this.trace("pauseVideoTile",o)}unpauseVideoTile(o){this.videoTileController.unpauseVideoTile(o),this.trace("unpauseVideoTile",o)}getVideoTile(o){let p=this.videoTileController.getVideoTile(o);return this.trace("getVideoTile",o),p}getAllRemoteVideoTiles(){let o=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),o}getAllVideoTiles(){let o=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),o}addVideoTile(){let o=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,o.state()),o}removeVideoTile(o){this.videoTileController.removeVideoTile(o),this.trace("removeVideoTile",o)}removeVideoTilesByAttendeeId(o){let p=this.videoTileController.removeVideoTilesByAttendeeId(o);return this.trace("removeVideoTilesByAttendeeId",o,p),p}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(o){let p=this.videoTileController.captureVideoTile(o);return this.trace("captureVideoTile",o),p}realtimeSubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(o),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSetCanUnmuteLocalAudio(o),this.trace("realtimeSetCanUnmuteLocalAudio",o)}realtimeSubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToSetCanUnmuteLocalAudio")}realtimeCanUnmuteLocalAudio(){let o=this.realtimeController.realtimeCanUnmuteLocalAudio();return this.trace("realtimeCanUnmuteLocalAudio",null,o),o}realtimeMuteLocalAudio(){this.realtimeController.realtimeMuteLocalAudio(),this.trace("realtimeMuteLocalAudio")}realtimeUnmuteLocalAudio(){let o=this.realtimeController.realtimeUnmuteLocalAudio();return this.trace("realtimeUnmuteLocalAudio"),o}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeSubscribeToMuteAndUnmuteLocalAudio")}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToMuteAndUnmuteLocalAudio")}realtimeIsLocalAudioMuted(){let o=this.realtimeController.realtimeIsLocalAudioMuted();return this.trace("realtimeIsLocalAudioMuted"),o}realtimeSubscribeToVolumeIndicator(o,p){this.realtimeController.realtimeSubscribeToVolumeIndicator(o,p),this.trace("realtimeSubscribeToVolumeIndicator",o)}realtimeUnsubscribeFromVolumeIndicator(o,p){this.realtimeController.realtimeUnsubscribeFromVolumeIndicator(o,p),this.trace("realtimeUnsubscribeFromVolumeIndicator",o,p)}realtimeSubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o),this.trace("realtimeSubscribeToLocalSignalStrengthChange")}realtimeUnsubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(o),this.trace("realtimeUnsubscribeToLocalSignalStrengthChange")}realtimeSendDataMessage(o,p,f){this.realtimeController.realtimeSendDataMessage(o,p,f),this.trace("realtimeSendDataMessage")}realtimeSubscribeToReceiveDataMessage(o,p){this.realtimeController.realtimeSubscribeToReceiveDataMessage(o,p),this.trace("realtimeSubscribeToReceiveDataMessage")}realtimeUnsubscribeFromReceiveDataMessage(o){this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(o),this.trace("realtimeUnsubscribeFromReceiveDataMessage")}realtimeSubscribeToFatalError(o){this.realtimeController.realtimeSubscribeToFatalError(o),this.trace("realtimeSubscribeToFatalError")}realtimeUnsubscribeToFatalError(o){this.realtimeController.realtimeUnsubscribeToFatalError(o),this.trace("realtimeUnsubscribeToFatalError")}subscribeToActiveSpeakerDetector(o,p,f,m){this.audioVideoController.activeSpeakerDetector.subscribe(o,p,f,m),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(o){this.audioVideoController.activeSpeakerDetector.unsubscribe(o),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioInputDevices(o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listVideoInputDevices(o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioOutputDevices(o);return this.trace("listAudioOutputDevices",o,p),p})}startAudioInput(o){return m(this,void 0,void 0,function*(){return this.trace("startAudioInput",o),this.deviceController.startAudioInput(o)})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()})}startVideoInput(o){return m(this,void 0,void 0,function*(){return _.isVideoTransformDevice(o)?this.trace("startVideoInput with transform device"):this.trace("startVideoInput",o),this.deviceController.startVideoInput(o)})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.trace("stopVideoInput"),this.deviceController.stopVideoInput()})}chooseAudioOutput(o){let p=this.deviceController.chooseAudioOutput(o);return this.trace("chooseAudioOutput",o),p}addDeviceChangeObserver(o){this.deviceController.addDeviceChangeObserver(o),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.deviceController.removeDeviceChangeObserver(o),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){let o=this.deviceController.createAnalyserNodeForAudioInput();return this.trace("createAnalyserNodeForAudioInput"),o}startVideoPreviewForVideoInput(o){this.deviceController.startVideoPreviewForVideoInput(o),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){this.deviceController.stopVideoPreviewForVideoInput(o),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){this.deviceController.setDeviceLabelTrigger(o),this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=this.deviceController.mixIntoAudioInput(o);return this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){this.deviceController.chooseVideoInputQuality(o,p,f),this.trace("chooseVideoInputQuality",{width:o,height:p,frameRate:f})}setVideoMaxBandwidthKbps(o){this.audioVideoController.setVideoMaxBandwidthKbps(o),this.trace("setVideoMaxBandwidthKbps",o)}setVideoCodecSendPreferences(o){this.audioVideoController.setVideoCodecSendPreferences(o),this.trace("setVideoCodecSendPreferences",o)}getVideoInputQualitySettings(){let o=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),o}setContentAudioProfile(o){this.trace("setContentAudioProfile",o),this.contentShareController.setContentAudioProfile(o)}enableSimulcastForContentShare(o,p){this.trace("enableSimulcastForContentShare"),this.contentShareController.enableSimulcastForContentShare(o,p)}enableSVCForContentShare(o){this.trace("enableSVCForContentShare"),this.contentShareController.enableSVCForContentShare(o)}startContentShare(o){let p=this.contentShareController.startContentShare(o);return this.trace("startContentShare"),p}startContentShareFromScreenCapture(o,p){let f=this.contentShareController.startContentShareFromScreenCapture(o,p);return this.trace("startContentShareFromScreenCapture"),f}pauseContentShare(){this.contentShareController.pauseContentShare(),this.trace("pauseContentShare")}unpauseContentShare(){this.contentShareController.unpauseContentShare(),this.trace("unpauseContentShare")}stopContentShare(){this.contentShareController.stopContentShare(),this.trace("stopContentShare")}addContentShareObserver(o){this.contentShareController.addContentShareObserver(o),this.trace("addContentShareObserver")}removeContentShareObserver(o){this.contentShareController.removeContentShareObserver(o),this.trace("removeContentShareObserver")}setContentShareVideoCodecPreferences(o){this.contentShareController.setContentShareVideoCodecPreferences(o),this.trace("setContentShareVideoCodecPreferences")}trace(o,p,f){let m=this.audioVideoController.configuration.meetingId,_=this.audioVideoController.configuration.credentials.attendeeId,w=`API/DefaultAudioVideoFacade/${m}/${_}/${o}`;void 0!==p&&(w+=` ${JSON.stringify(p)}`),void 0!==f&&(w+=` -> ${JSON.stringify(f)}`),this.audioVideoController.logger.info(w)}getRemoteVideoSources(){let o=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,o),o}get transcriptionController(){return this.realtimeController.transcriptionController}promoteToPrimaryMeeting(o){this.audioVideoController.removeObserver(this),this.audioVideoController.addObserver(this);let p=this.audioVideoController.promoteToPrimaryMeeting(o);return this.trace("promoteToPrimaryMeeting",null,p),p}demoteFromPrimaryMeeting(){this.trace("demoteFromPrimaryMeeting"),this.audioVideoController.demoteFromPrimaryMeeting()}audioVideoWasDemotedFromPrimaryMeeting(o){this.contentShareController.stopContentShare(),this.audioVideoController.removeObserver(this)}}},0x17a4528e8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x24d089a26)),I=f(0x17991f3f2);p.default=class extends w.default{constructor(o,p){super(o,p),this.blurCanvas=document.createElement("canvas"),this.blurCanvasCtx=this.blurCanvas.getContext("2d"),this.blurCanvas.width=this.spec.model.input.width,this.blurCanvas.height=this.spec.model.input.height,this.logger.info("BackgroundBlur processor using builtin blur")}drawImageWithMask(o,p){let f=this.blurredImage,{canvasCtx:m,targetCanvas:_}=this,{width:w,height:I}=_;p&&f?(this.scaledCanvas.getContext("2d").putImageData(p,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),m.save(),m.clearRect(0,0,w,I),m.drawImage(this.scaledCanvas,0,0,w,I),m.globalCompositeOperation="source-in",m.drawImage(o,0,0,w,I),m.globalCompositeOperation="destination-over",m.drawImage(this.blurCanvas,0,0,w,I),m.restore()):m.clearRect(0,0,w,I)}setBlurStrength(o){if(super.setBlurStrength(o),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});let o=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:o.path,inputHeight:o.input.height,inputWidth:o.input.width,inputChannels:4,modelRangeMin:o.input.range[0],modelRangeMax:o.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(o){this.blurredImage=o.payload.blurOutput,super.handlePredict(o)}destroy(){var o;let p=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){p.destroy.call(this),null==(o=this.blurCanvas)||o.remove(),this.blurCanvas=void 0})}}},0x24d089a26:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16455e291)),I=f(0x17991f3f2),k=_(f(0xdfc34e9e));p.default=class extends w.default{constructor(o,p){super("background blur",o,p,new k.default),this.blurAmount=0,this.setBlurStrength(p.blurStrength),this.logger.info("BackgroundBlur processor successfully created"),this.logger.info(`BackgroundBlur spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundBlur options: { blurStrength: ${p.blurStrength}, filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}validateOptions(o){if(super.validateOptions(o),!o.blurStrength)throw Error("processor has null options - blurStrength")}initOnFirstExecution(){this.setBlurPixels()}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.filter=`blur(${this.blurAmount}px)`,f.drawImage(o,0,0,m.width,m.height),f.restore()}setBlurStrength(o){this._blurStrength=o,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}static isSupported(){return m(this,void 0,void 0,function*(){let o=document.createElement("canvas"),p=void 0!==o.getContext("2d").filter;return o.remove(),p})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){let o={backgroundBlurEnabled:"true",backgroundBlurStrength:this._blurStrength,backgroundReplacementEnabled:"false",backgroundFilterVersion:1};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}}},0x17991f3f2:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.BlurStrengthMapper=void 0;let f=class{static getBlurAmount(o,p){if(o<=0)throw Error(`invalid value for blur strength: ${o}`);return Math.round(o*p.height/this.BLUR_STRENGTH_DIVISOR)}};p.BlurStrengthMapper=f,f.BLUR_STRENGTH_DIVISOR=540,p.default={LOW:7,MEDIUM:15,HIGH:30}},0x20e5c1309:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x6e3c7bbd)),I=_(f(0xb3c65cf4)),k=_(f(0x1e476648b)),M=_(f(0x23b2002bd)),x=_(f(0x17a4528e8)),O=_(f(0x24d089a26)),L=_(f(0x17991f3f2)),B=class extends M.default{setBlurStrength(){}loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}};p.default=class BackgroundBlurVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){let f;o=BackgroundBlurVideoFrameProcessor.resolveSpec(o);let{logger:m}=p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),_=yield BackgroundBlurVideoFrameProcessor.isSupported(o,p);return(m.info(`processor is ${_?"":"not"} supported`),_)?((yield O.default.isSupported())?(m.info("Using browser-provided background blur"),f=new O.default(o,p)):(m.info("Using built-in background blur"),f=new x.default(o,p)),yield f.loadAssets(),f):(m.warn("Using no-op processor because background blur is not supported"),new B)})}static resolveOptions(o={}){let p=Object.assign({},o);return p.blurStrength||(p.blurStrength=L.default.MEDIUM),p.logger||(p.logger=new I.default("BackgroundBlurProcessor",k.default.INFO)),p=super.resolveOptions(p)}static isSupported(o,p){return o=BackgroundBlurVideoFrameProcessor.resolveSpec(o),p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),super.isSupported(o,p)}}},0xdfc34e9e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x10857f88a));p.default=class extends _.default{}},0xfc893d67:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ModelSpecBuilder{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new ModelSpecBuilder}withDefaultModel(){return this.withSelfieSegmentationDefaults()}withSelfieSegmentationDefaults(){return this.path="https://static.sdkassets.chime.aws/bgblur/models/selfie_segmentation_landscape.tflite",this.input={height:144,width:256,range:[0,1],channels:3},this.output={height:144,width:256,range:[0,1],channels:1},this}withPath(o){return this.path=o,this}withInput(o){return this.input=o,this}withOutput(o){return this.output=o,this}validate(){if(!this.path)throw Error("model spec path is not set");if(!this.input)throw Error("model spec input is not set");if(!this.output)throw Error("model spec output is not set")}build(){return this.validate(),{path:this.path,input:this.input,output:this.output}}}},0x129e30dac:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.delegate=o,this.reportingPeriodMillis=p,this.filterCPUUtilization=f,this.logger=m,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(o){let p=o-this.lastReportedEventTimestamp;if(p>=this.reportingPeriodMillis){let f=this.filterCount,m=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=o,0===this.framerate||0===f)return;let _=Math.round(m/f),w=Math.round(this.framerate*(p/1e3))-f,I=Math.round(100*m/p);_>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:w,avgFilterDurationMillis:_,framerate:this.framerate,periodMillis:p}),I>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:I,filterMillis:m,periodMillis:p})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*.8)}frameReceived(o){o!==this.framerate&&(this.framerate=o,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());let p=Date.now();this.reportEvent(p)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}}},0x16455e291:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.BackgroundFilterMonitor=void 0;let w=f(0x2037185f8),I=_(f(0x9ce0607d)),k=_(f(0x129e30dac)),M=class{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise(o=>this.resolve=o)),this.promise}next(o){this.value=o,this.resolve(o),delete this.promise}};p.default=class BackgroundFilterProcessor{constructor(o,p,f,m,_){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new I.default(this.targetCanvas),this.mask$=new M,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=BackgroundFilterProcessor.createWorkerPromise(),this.loadModelPromise=BackgroundFilterProcessor.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=o,this.validateSpec(p),this.validateOptions(f),this.spec=p,this.logger=f.logger,this.delegate=m,this.initCPUMonitor(f),this.eventController=_}static createWorkerPromise(){let o={resolve:null,reject:null,promise:null};return o.promise=new Promise((p,f)=>{o.resolve=p,o.reject=f}),o}validateSpec(o){if(!o)throw Error("processor has null spec");if(!o.model)throw Error("processor spec has null model");if(!o.paths)throw Error("processor spec has null paths")}validateOptions(o){if(!o)throw Error("processor has null options");if(!o.logger)throw Error("processor has null options - logger");if(!o.reportingPeriodMillis)throw Error("processor has null options - reportingPeriodMillis");if(!o.filterCPUUtilization)throw Error("processor has null options - filterCPUUtilization")}initCPUMonitor(o){this.videoFramesPerFilterUpdate=1,this.frameCounter=new k.default(this.delegate,o.reportingPeriodMillis,o.filterCPUUtilization,this.logger),this.cpuMonitor=new x(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(o){return JSON.stringify(o,null,2)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(o){if(this.logger.info(`received load model message: ${this.stringify(o)}`),2!==o.payload){this.logger.error("failed to load model! status: "+o.payload),this.loadModelPromise.reject(Error("failed to load model! status: "+o.payload));return}this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(o){this.mask$.next(o.payload.output)}handleWorkerEvent(o){let p=o.data;switch(p.msg){case"initialize":this.handleInitialize(p);break;case"loadModel":this.handleLoadModel(p);break;case"predict":this.handlePredict(p);break;default:this.logger.info(`unexpected event msg: ${this.stringify(p)}`)}}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("start initializing the processor");try{this.worker=yield w.loadWorker(this.spec.paths.worker,"BackgroundFilterWorker",{},null),this.worker.addEventListener("message",o=>this.handleWorkerEvent(o)),this.worker.postMessage({msg:"initialize",payload:{wasmPath:this.spec.paths.wasm,simdPath:this.spec.paths.simd}}),yield this.initWorkerPromise.promise,this.logger.info(`successfully initialized the ${this.filterType} worker`),yield this.loadModelPromise.promise,this.logger.info(`successfully loaded ${this.filterType} worker segmentation model`)}catch(o){throw Error(`could not initialize the ${this.filterType} video frame processor due to '${o.message}'`)}this.logger.info(`successfully initialized the ${this.filterType} processor`)})}process(o){return m(this,void 0,void 0,function*(){if(this.destroyed)return o;this.frameCounter.frameReceived(o[0].framerate),this.cpuMonitor.frameReceived();let p=o[0].asCanvasElement();if(!p)return o;if(!this.modelInitialized)return o[0]=this.canvasVideoFrameBuffer,o;let f=p.width,m=p.height;if(0===f||0===m)return o;0===this.sourceWidth&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight,this.logger.info(`${this.filterType} source width: ${this.sourceWidth}`),this.logger.info(`${this.filterType} source height: ${this.sourceHeight}`),this.initOnFirstExecution()),(this.sourceWidth!==f||this.sourceHeight!==m)&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let o=this.mask$.value,f=this.spec.model.input.width/p.width,m=this.spec.model.input.height/p.height;void 0===this.scaledCanvas&&(this.scaledCanvas=document.createElement("canvas"),this.scaledCanvas.width=this.spec.model.input.width,this.scaledCanvas.height=this.spec.model.input.height);let _=this.scaledCanvas.getContext("2d");_.save(),_.scale(f,m),_.drawImage(p,0,0),_.restore();let w=_.getImageData(0,0,this.scaledCanvas.width,this.scaledCanvas.height);if(this.frameNumber%this.videoFramesPerFilterUpdate==0){let p=this.mask$.whenNext();this.worker.postMessage({msg:"predict",payload:w},[w.data.buffer]),o=yield p}this.destroyed||this.drawImageWithMask(p,o)}catch(p){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${p}`),o}finally{this.frameCounter.filterComplete(),this.frameNumber++}return o[0]=this.canvasVideoFrameBuffer,o})}updateVideoFramesPerFilterUpdate(o){o!==this.videoFramesPerFilterUpdate&&(this.videoFramesPerFilterUpdate=o,this.logger.info(`Adjusting filter rate to compensate for CPU utilization. Filter rate is ${this.videoFramesPerFilterUpdate} video frames per filter.`))}destroy(){var o,p,f,_;return m(this,void 0,void 0,function*(){this.destroyed=!0,this.delegate.removeObserver(this.cpuMonitor),this.canvasVideoFrameBuffer.destroy(),null==(o=this.worker)||o.postMessage({msg:"destroy"}),null==(p=this.worker)||p.postMessage({msg:"stop"}),null==(f=this.targetCanvas)||f.remove(),this.targetCanvas=void 0,null==(_=this.scaledCanvas)||_.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)})}};let x=class{constructor(o,p){this.monitoringPeriodMillis=o,this.observer=p,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){let o=Date.now();o-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.reduceCPUUtilization())}frameReceived(){let o=Date.now();o-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.increaseCPUUtilization())}};p.BackgroundFilterMonitor=x},0x6e3c7bbd:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x2037185f8),I=f(0x19eda6376),k=_(f(0xfc893d67)),M=_(f(0x165009cb4)),x=_(f(0xaf1ae5b3)),O="https://static.sdkassets.chime.aws",L={worker:`${O}/bgblur/workers/worker.js`,wasm:`${O}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${O}/bgblur/wasm/_cwt-wasm-simd.wasm`};p.default=class{static defaultAssetSpec(){let o=x.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}}static createUrlWithParams(o,p){let f=new URL(o);for(let o of Object.keys(p))void 0!==p[o]&&f.searchParams.set(o,p[o]);return f.toString()}static resolveSpec(o){let{paths:p=L,model:f=k.default.builder().withSelfieSegmentationDefaults().build(),assetGroup:m=this.defaultAssetSpec().assetGroup,revisionID:_=this.defaultAssetSpec().revisionID}=o||{},w={assetGroup:m,revisionID:_,sdk:encodeURIComponent(x.default.sdkVersion),ua:encodeURIComponent(x.default.sdkUserAgentLowResolution)};return p.worker=this.createUrlWithParams(p.worker,w),p.wasm=this.createUrlWithParams(p.wasm,w),p.simd=this.createUrlWithParams(p.simd,w),f.path=this.createUrlWithParams(f.path,w),{paths:p,model:f,assetGroup:m,revisionID:_}}static resolveOptions(o){return o.reportingPeriodMillis||(o.reportingPeriodMillis=1e3),o.filterCPUUtilization?(o.filterCPUUtilization<0||o.filterCPUUtilization>100)&&(o.logger.warn("filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of 30 percent"),o.filterCPUUtilization=30):o.filterCPUUtilization=30,o}static isSupported(o,p){let{logger:f}=p;return"u"<typeof globalThis?(f.info("Browser does not have globalThis."),Promise.resolve(!1)):new M.default().supportsBackgroundFilter()?I.supportsWASM(globalThis,f)?this.supportsBackgroundFilter(globalThis,o,f):(f.info("Browser does not support WASM."),Promise.resolve(!1)):(f.info("Browser is not supported."),Promise.resolve(!1))}static supportsBackgroundFilter(o=globalThis,p,f){return m(this,void 0,void 0,function*(){if(!I.supportsWorker(o,f))return f.info("Browser does not support web workers."),!1;let m=p.paths.worker;try{let o=yield w.loadWorker(m,"BackgroundFilterWorker",{},null);try{o.terminate()}catch(o){f.info(`Failed to terminate worker. ${o.message}`)}return!0}catch(o){return f.info(`Failed to fetch and instantiate test worker ${o.message}`),!1}})}}},0x10857f88a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}filterFrameDurationHigh(o){var p;for(let f of this.observers)null==(p=f.filterFrameDurationHigh)||p.call(f,o)}filterCPUUtilizationHigh(o){var p;for(let f of this.observers)null==(p=f.filterCPUUtilizationHigh)||p.call(f,o)}}},0x93043d23:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16455e291)),I=_(f(0x190970c58));p.default=class BackgroundReplacementFilter extends w.default{constructor(o,p){super("background replacement",o,p,new I.default),this.replacementBlob=p.imageBlob,this.logger.info("BackgroundReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: { filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}setImageBlob(o){return m(this,void 0,void 0,function*(){this.replacementBlob=o,this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl())})}initOnFirstExecution(){}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.drawImage(this.replacementImage,0,0,m.width,m.height),f.restore()}static loadImageExecutor(o,p,f){let m=new Image;m.crossOrigin="Anonymous",m.addEventListener("load",()=>{o(m)},!1),m.addEventListener("error",o=>{p(Error(`Could not load replacement image ${m.src}: ${o.message}`))},!1),m.src=f}static loadImage(o){return m(this,void 0,void 0,function*(){return new Promise((p,f)=>this.loadImageExecutor(p,f,o))})}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){let o=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return m(this,void 0,void 0,function*(){this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl()),o.loadAssets.call(this)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}destroy(){let o=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){o.destroy.call(this),this.revokeReplacementObjectUrl()})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){this.eventController.publishEvent("backgroundFilterConfigSelected",{backgroundBlurEnabled:"false",backgroundBlurStrength:"low",backgroundReplacementEnabled:"true",backgroundFilterVersion:1})}}},0x1c4b3e1a7:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x6e3c7bbd)),I=_(f(0xb3c65cf4)),k=_(f(0x1e476648b)),M=_(f(0x23b2002bd)),x=_(f(0x93043d23)),O=class extends M.default{loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}setImageBlob(){return m(this,void 0,void 0,function*(){})}};p.default=class BackgroundReplacementVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let{logger:f}=p;if(!(yield BackgroundReplacementVideoFrameProcessor.isSupported(o,p)))return f.warn("Using no-op processor because background replacement is not supported"),new O;f.info("Using background replacement filter");let m=new x.default(o,p);return yield m.loadAssets(),m})}static resolveOptions(o={}){let p=Object.assign({},o);return p.logger||(p.logger=new I.default("BackgroundReplacementProcessor",k.default.INFO)),super.resolveOptions(p)}static resolveOptionsAsync(o){return m(this,void 0,void 0,function*(){if(!o.imageBlob){let p=document.createElement("canvas");p.width=100,p.height=100;let f=p.getContext("2d");f.fillStyle="blue",f.fillRect(0,0,100,100),o.imageBlob=yield new Promise(o=>{p.toBlob(o)})}})}static isSupported(o,p){let f=Object.create(null,{isSupported:{get:()=>super.isSupported}});return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let m=p.imageBlob,_=URL.createObjectURL(m);try{yield x.default.loadImage(_)}catch(o){return p.logger.info(`Failed to fetch load replacement image ${o.message}`),!1}finally{URL.revokeObjectURL(_)}return f.isSupported.call(this,o,p)})}}},0x190970c58:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x10857f88a));p.default=class extends _.default{}},6329639e3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f,this.currentRetry=0,this.fixedWaitMs<0&&(this.fixedWaitMs=0),this.shortBackoffMs<0&&(this.shortBackoffMs=0),this.longBackoffMs<0&&(this.longBackoffMs=0),this.reset()}reset(){this.currentRetry=0}nextBackoffAmountMs(){let o=Math.random()*Math.min(this.longBackoffMs,this.shortBackoffMs*Math.pow(2,this.currentRetry))+this.fixedWaitMs;return this.currentRetry+=1,o}}},0x1026e31ba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(6329639e3)),w=m(f(0x415bfbb2));p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f}create(){return new _.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(o){return new w.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,o)}}},0x415bfbb2:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(6329639e3));p.default=class extends _.default{constructor(o,p,f,m){super(o,p,f),this.limit=m,this.attempts=0}nextBackoffAmountMs(){if(this.attempts++,this.attempts>this.limit)throw Error("retry limit exceeded");return super.nextBackoffAmountMs()}}},0x165009cb4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x22e89c4d),w=f(0x13f6890b8),I=class DefaultBrowserBehavior{constructor(){this.FALLBACK_BROWSER={type:"browser",name:"unknown",version:"unknown",os:"unknown"},this.browser=_.detect()||this.FALLBACK_BROWSER,this.uaParserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null,this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:13,safari:13,opera:66,samsung:12,crios:86,fxios:23,"ios-webview":605,"chromium-webview":92},this.browserName={chrome:"Google Chrome","edge-chromium":"Microsoft Edge",electron:"Electron",firefox:"Mozilla Firefox",ios:"Safari iOS",safari:"Safari",opera:"Opera",samsung:"Samsung Internet",crios:"Chrome iOS",fxios:"Firefox iOS","ios-webview":"WKWebView iOS","chromium-webview":"Chrome WebView"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios","ios-webview","edge-ios"]}version(){return this.browser.version}majorVersion(){return null!==this.version()?parseInt(this.version().split(".")[0]):-1}osMajorVersion(){return parseInt(this.uaParserResult.os.version.split(".")[0])}engine(){return this.uaParserResult.engine.name}engineMajorVersion(){return parseInt(this.uaParserResult.engine.version.split(".")[0])}name(){return this.browser.name}hasChromiumWebRTC(){for(let o of this.chromeLike)if(o===this.browser.name)return!0;return!1}hasWebKitWebRTC(){for(let o of this.webkitBrowsers)if(o===this.browser.name)return!0;return!1}hasFirefoxWebRTC(){return this.isFirefox()}requiresPlaybackLatencyHintForAudioContext(){return -1!==navigator.userAgent.indexOf("Windows")}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()&&!this.isIOSEdge()||this.isIOSSafari()&&this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK||this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK}supportsBackgroundFilter(){return("safari"!==this.name()||15!==this.majorVersion())&&!!this.supportsCanvasCapturedStreamPlayback()}supportsVideoLayersAllocationRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsDependencyDescriptorRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsScalableVideoCoding(){return this.hasChromiumWebRTC()&&"Blink"===this.engine()&&this.engineMajorVersion()>=111}supportsAudioRedundancy(){return this.hasChromiumWebRTC()?this.engineMajorVersion()>=107:!this.hasFirefoxWebRTC()}requiresResolutionAlignment(o,p){return this.isAndroid()&&this.isPixel3()?[64*Math.ceil(o/64),64*Math.ceil(p/64)]:[o,p]}requiresCheckForSdpConnectionAttributes(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresIceCandidateGatheringTimeoutWorkaround(){return this.hasChromiumWebRTC()}requiresBundlePolicy(){return"max-bundle"}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}doesNotSupportMediaDeviceLabels(){return"chromium-webview"===this.browser.name}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()<this.browserSupport[this.browser.name]||"firefox"===this.browser.name&&this.isAndroid())}isSimulcastSupported(){return this.hasChromiumWebRTC()}supportDownlinkBandwidthEstimation(){return!this.isFirefox()}supportString(){if(this.isAndroid())return`${this.browserName.chrome} ${this.browserSupport.chrome}+, ${this.browserName.samsung} ${this.browserSupport.samsung}+`;let o=[];for(let p in this.browserSupport)o.push(`${this.browserName[p]} ${this.browserSupport[p]}+`);return o.join(", ")}supportedVideoCodecs(){return m(this,void 0,void 0,function*(){let o=new RTCPeerConnection;return o.addTransceiver("video",{direction:"inactive",streams:[]}),(yield o.createOffer({offerToReceiveVideo:!0})).sdp.split(`\r
`).filter(o=>o.includes("a=rtpmap:")).map(o=>o.replace(/.* /,"").replace(/\/.*/,"")).filter((o,p,f)=>f.indexOf(o)===p).filter(o=>"rtx"!==o&&"red"!==o&&"ulpfec"!==o)})}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}disableResolutionScaleDown(){return this.isAndroid()}disable480pResolutionScaleDown(){return/( Chrome\/98\.)/i.test(navigator.userAgent)&&this.browser.os.startsWith("Windows")}requiresDisablingH264Encoding(){return this.isIOS()&&("15.1.0"===this.version()||/( OS 15_1)/i.test(navigator.userAgent))}requiresVideoPlayWorkaround(){return this.isSafari()}requiresAudioContextResetOnDeviceFailureForWebAudio(){return this.isIOS()}isVideoFxSupportedBrowser(){return this.supportsBackgroundFilter()}isIOSSafari(){return"ios"===this.browser.name||"ios-webview"===this.browser.name||"safari"===this.browser.name&&/( Mac )/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1}isSafari(){return"safari"===this.browser.name||this.isIOSSafari()}isFirefox(){return"firefox"===this.browser.name}isIOSFirefox(){return"fxios"===this.browser.name}isIOSChrome(){return"crios"===this.browser.name}isChrome(){return"chrome"===this.browser.name}isEdge(){return"edge-chromium"===this.browser.name}isIOSEdge(){return"edge-ios"===this.browser.name}isSamsungInternet(){return"samsung"===this.browser.name}isAndroid(){return/(android)/i.test(navigator.userAgent)}isPixel3(){return/( pixel 3)/i.test(navigator.userAgent)}isIOS(){return this.isIOSSafari()||this.isIOSChrome()||this.isIOSFirefox()}};p.default=I,I.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK=16,I.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK=106},0xc9ba5f35:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0xe88b24d9),w=m(f(0x138ccc65a)),I=m(f(0x2fbf3af)),k=m(f(0x22562ac09));p.default=class ClientMetricReport{constructor(o,p,f){this.logger=o,this.videoStreamIndex=p,this.selfAttendeeId=f,this.globalMetricReport=new k.default,this.streamMetricReports={},this.rtcStatsReport={},this.customStatsReports=[],this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.overriddenObservableMetrics=new Map,this.identityValue=(o,p)=>Number((p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.decoderLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.concealedSamples-(f.previousMetrics.concealedSamples||0),_=f.currentMetrics.totalSamplesReceived-(f.previousMetrics.totalSamplesReceived||0);return _<=0||_-m<=0?0:m/_*100},this.packetLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics[o]-(f.previousMetrics[o]||0),_=f.currentMetrics.packetsLost-(f.previousMetrics.packetsLost||0),w=m+_;return w<=0||_<=0?0:100*_/w},this.jitterBufferMs=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.jitterBufferDelay-(f.previousMetrics.jitterBufferDelay||0),_=f.currentMetrics.jitterBufferEmittedCount-(f.previousMetrics.jitterBufferEmittedCount||0);return m<=0||_<=0?0:m/_*1e3},this.countPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:Math.trunc(_/m)},this.bitsPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=(f.currentMetrics[o]-(f.previousMetrics[o]||0))*8;return _<=0?0:Math.trunc(_/m)},this.secondsToMilliseconds=(o,p)=>Number(1e3*(p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.averageTimeSpentPerSecondInMilliseconds=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:1e3*_/m},this.averageCpuQualityLimitationDurationPerSecondInMilliseconds=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.previousObjectMetrics[o]||void 0===f.currentObjectMetrics[o])return NaN;let m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=0,w=0;for(let[p,m]of Object.entries(f.previousObjectMetrics[o]))"cpu"===p&&(_=m);for(let[p,m]of Object.entries(f.currentObjectMetrics[o]))"cpu"===p&&(w=m);let I=w-_;return I<=0?0:1e3*I/m},this.isHardwareImplementation=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.currentStringMetrics[o])return NaN;let m=String(f.currentStringMetrics[o]),_=m.includes("ExternalDecoder")||m.includes("ExternalEncoder")||m.includes("EncodeAccelerator")||m.includes("DecodeAccelerator"),w=m.includes("fallback from");return _&&!w?1:0},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:_.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.STUN_RTT_MS},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_MIC_AUDIO_LEVEL,source:"audioLevel"}},this.audioUpstreamMetricMap={jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_MIC_BITRATE},roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_MIC_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"}},this.audioDownstreamMetricMap={concealedSamples:{transform:this.countPerSecond},totalSamplesReceived:{transform:this.countPerSecond},decoderLoss:{transform:this.decoderLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_SPK_BITRATE},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_AUDIO_LEVEL},totalAudioPacketsLost:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_LOST},totalAudioPacketsExpected:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_EXPECTED},totalAudioPacketsRecoveredRed:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_RED},totalAudioPacketsRecoveredFec:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_FEC}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_ENCODE_FPS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_BITRATE},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_JITTER_MS},totalEncodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_ENCODE_MS},encoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE},qualityLimitationDurations:{transform:this.averageCpuQualityLimitationDurationPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_QUALITY_LIMITATION_DURATION_CPU},videoCodecDegradationHighEncodeCpu:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU},videoCodecDegradationEncodeFailure:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE},videoInputWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_WIDTH},videoInputHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_HEIGHT}},this.videoDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},framesReceived:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_WIDTH},totalDecodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_DECODE_MS},decoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE},totalFreezesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_FREEZE_DURATION},freezeCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FREEZE_COUNT},totalPausesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_PAUSE_DURATION},pauseCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PAUSE_COUNT},framesDropped:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DROPPED_FPS},videoRenderWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_WIDTH},videoRenderHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_HEIGHT}},this.streamDimensionMap={encoderImplementation:_.SdkStreamDimension.Type.VIDEO_ENCODER_NAME,decoderImplementation:_.SdkStreamDimension.Type.VIDEO_DECODER_NAME},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesInputPerSecond:{source:"framesPerSecond",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamEncoderImplementation:{source:"encoderImplementation",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamTotalEncodeTimePerSecond:{source:"totalEncodeTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamCpuQualityLimitationDurationPerSecond:{source:"qualityLimitationDurations",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:I.default.VIDEO,dir:w.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.AUDIO,dir:w.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:I.default.VIDEO,dir:w.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"},audioDownstreamLevel:{source:"audioLevel",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamLevel:{source:"audioLevel"}}}getMetricMap(o,p){switch(o){case I.default.AUDIO:switch(p){case w.default.UPSTREAM:return this.audioUpstreamMetricMap;case w.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case I.default.VIDEO:switch(p){case w.default.UPSTREAM:return this.videoUpstreamMetricMap;case w.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getStreamDimensionMap(){return this.streamDimensionMap}getObservableMetricValue(o){if(this.overriddenObservableMetrics.has(o))return this.overriddenObservableMetrics.get(o);let p=this.observableMetricSpec[o],{transform:f,source:m}=this.getMetricMap(p.media,p.dir)[p.source];if(!p.hasOwnProperty("media"))return f(m||p.source);for(let o in this.streamMetricReports){let _=this.streamMetricReports[o];if(_.direction===p.dir&&_.mediaType===p.media)return f(m||p.source,Number(o))}return 0}getObservableVideoMetricValue(o,p){let f=this.observableVideoMetricSpec[o],{transform:m,source:_}=this.getMetricMap(f.media,f.dir)[f.source];return m(_||f.source,p)}getVideoUpstreamSsrcs(){let o=[];for(let p in this.streamMetricReports)this.streamMetricReports[p].mediaType===I.default.VIDEO&&this.streamMetricReports[p].direction===w.default.UPSTREAM&&o.push(Number(p));return o}getObservableMetrics(){let o={};for(let p in this.observableMetricSpec)o[p]=this.getObservableMetricValue(p);return o}getObservableVideoMetrics(){let o={};if(!this.videoStreamIndex||!this.selfAttendeeId)return this.logger.error("Need to define VideoStreamIndex and selfAttendeeId if using getObservableVideoMetrics API"),o;for(let p in this.streamMetricReports)if(this.streamMetricReports[p].mediaType===I.default.VIDEO){let f={};for(let o in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[o].dir===this.streamMetricReports[p].direction){let m=this.getObservableVideoMetricValue(o,Number(p));isNaN(m)||(f[o]=m)}let m=this.streamMetricReports[p].groupId,_=this.streamMetricReports[p].streamId,w="";o[w=void 0!==this.videoStreamIndex.attendeeIdForGroupId?m?this.videoStreamIndex.attendeeIdForGroupId(m):this.selfAttendeeId:_?this.videoStreamIndex.attendeeIdForStreamId(_):this.selfAttendeeId]=o[w]?o[w]:{},o[w][p]=f}return o}getRTCStatsReport(){return this.rtcStatsReport}clone(){let o=new ClientMetricReport(this.logger,this.videoStreamIndex,this.selfAttendeeId);return o.globalMetricReport=this.globalMetricReport,o.streamMetricReports=this.streamMetricReports,o.rtcStatsReport=this.rtcStatsReport,o.customStatsReports=this.customStatsReports,o.currentTimestampMs=this.currentTimestampMs,o.previousTimestampMs=this.previousTimestampMs,o.overriddenObservableMetrics=this.overriddenObservableMetrics,o}print(){let o={globalMetricReport:this.globalMetricReport,streamMetricReports:this.streamMetricReports,currentTimestampMs:this.currentTimestampMs,previousTimestampMs:this.previousTimestampMs};this.logger.debug(()=>`Client Metric Report: ${JSON.stringify(o)}`)}removeDestroyedSsrcs(){for(let o in this.streamMetricReports)this.currentSsrcs[o]||delete this.streamMetricReports[o]}overrideObservableMetric(o,p){this.overriddenObservableMetrics.set(o,p)}}},0x138ccc65a:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportDirection=void 0,(m=f=p.ClientMetricReportDirection||(p.ClientMetricReportDirection={}))[m.UPSTREAM=0]="UPSTREAM",m[m.DOWNSTREAM=1]="DOWNSTREAM",p.default=f},0x2fbf3af:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportMediaType=void 0,(m=f=p.ClientMetricReportMediaType||(p.ClientMetricReportMediaType={}))[m.AUDIO=0]="AUDIO",m[m.VIDEO=1]="VIDEO",p.default=f},0x1979c5b3a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x22562ac09:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0x250d201d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.currentTimestampMs=0,this.ssrc=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsExpected=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}}},0x2e51c102:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0xbc5a8cda:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.minHealth=o.minHealth,this.maxHealth=o.maxHealth,this.currentHealth=o.initialHealth,this.currentData=p.clone(),this.name=f}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(o){this.currentData=o}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){let o=this.health();return o!==this.currentHealth?(this.currentHealth=o,o):null}}},0x73406699:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ConnectionHealthData{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(o,p){return Date.now()<o+p}setConnectionStartTime(){this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}reset(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now(),this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0}isConnectionStartRecent(o){return ConnectionHealthData.isTimestampRecent(this.connectionStartTimestampMs,o)}isLastPacketLossRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastPacketLossInboundTimestampMs,o)}isGoodSignalRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastGoodSignalTimestampMs,o)}isWeakSignalRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastWeakSignalTimestampMs,o)}isNoSignalRecent(o){return ConnectionHealthData.isTimestampRecent(this.lastNoSignalTimestampMs,o)}clone(){let o=new ConnectionHealthData;return o.connectionStartTimestampMs=this.connectionStartTimestampMs,o.consecutiveStatsWithNoPackets=this.consecutiveStatsWithNoPackets,o.consecutiveStatsWithNoAudioPacketsSent=this.consecutiveStatsWithNoAudioPacketsSent,o.lastPacketLossInboundTimestampMs=this.lastPacketLossInboundTimestampMs,o.lastGoodSignalTimestampMs=this.lastGoodSignalTimestampMs,o.lastWeakSignalTimestampMs=this.lastWeakSignalTimestampMs,o.lastNoSignalTimestampMs=this.lastNoSignalTimestampMs,o.consecutiveMissedPongs=this.consecutiveMissedPongs,o.packetsReceivedInLastMinute=this.packetsReceivedInLastMinute.slice(0),o.fractionPacketsLostInboundInLastMinute=this.fractionPacketsLostInboundInLastMinute.slice(0),o.audioSpeakerDelayMs=this.audioSpeakerDelayMs,o.isVideoEncoderHardware=this.isVideoEncoderHardware,o.videoEncodingTimeInMs=this.videoEncodingTimeInMs,o.videoEncodingTimePerFrameInMs=this.videoEncodingTimePerFrameInMs,o.cpuLimitationDuration=this.cpuLimitationDuration,o.videoInputFps=this.videoInputFps,o.videoEncodeFps=this.videoEncodeFps,o.isContentShare=this.isContentShare,o.numberOfPublishedVideoSources=this.numberOfPublishedVideoSources,o}setConsecutiveMissedPongs(o){this.consecutiveMissedPongs=o}setConsecutiveStatsWithNoPackets(o){this.consecutiveStatsWithNoPackets=o}setConsecutiveStatsWithNoAudioPacketsSent(o){this.consecutiveStatsWithNoAudioPacketsSent=o}setLastPacketLossInboundTimestampMs(o){this.lastPacketLossInboundTimestampMs=o}setLastNoSignalTimestampMs(o){this.lastNoSignalTimestampMs=o}setLastWeakSignalTimestampMs(o){this.lastWeakSignalTimestampMs=o}setLastGoodSignalTimestampMs(o){this.lastGoodSignalTimestampMs=o}setAudioSpeakerDelayMs(o){this.audioSpeakerDelayMs=o}setIsVideoEncoderHardware(o){this.isVideoEncoderHardware=o}setVideoEncodingTimeInMs(o){this.videoEncodingTimeInMs=o}setVideoEncodingTimePerFrameInMs(o){this.videoEncodingTimePerFrameInMs=o}setCpuLimitationDuration(o){this.cpuLimitationDuration=o}setVideoInputFps(o){this.videoInputFps=o}setVideoEncodeFps(o){this.videoEncodeFps=o}setIsContentShare(o){this.isContentShare=o}setNumberOfPublishedVideoSources(o){this.numberOfPublishedVideoSources=o}}},0x1a55f11d7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x109562310)),w=m(f(0x1bdf2cac3)),I=m(f(0x225dfdbba));p.default=class{constructor(){this.minHealth=0,this.maxHealth=1,this.initialHealth=1,this.connectionUnhealthyThreshold=25,this.noSignalThresholdTimeMs=1e4,this.connectionWaitTimeMs=1e4,this.zeroBarsNoSignalTimeMs=5e3,this.oneBarWeakSignalTimeMs=5e3,this.twoBarsTimeMs=5e3,this.threeBarsTimeMs=1e4,this.fourBarsTimeMs=2e4,this.fiveBarsTimeMs=6e4,this.cooldownTimeMs=6e4,this.pastSamplesToConsider=15,this.goodSignalTimeMs=15e3,this.fractionalLoss=.5,this.packetsExpected=50,this.maximumTimesToWarn=2,this.missedPongsLowerThreshold=1,this.missedPongsUpperThreshold=4,this.maximumAudioDelayMs=6e4,this.maximumAudioDelayDataPoints=10,this.sendingAudioFailureSamplesToConsider=2,this.sendingAudioFailureInitialWaitTimeMs=3e3,this.videoEncodingHealthPolicies=[_.default,w.default,I.default],this.consecutiveHighEncodeCpuThreshold=10,this.highEncodeCpuMsThreshold=500,this.highEncodeCpuMsPerFrameThreshold=15,this.consecutiveVideoEncodingFailureThreshold=5,this.concurrentVideoSendersThreshold=15}}},0x938e8e62:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda));p.default=class ReconnectionHealthPolicy extends _.default{constructor(o,p,f){super(p,f,"Reconnection Health"),this.logger=o,this.audioDelayPointsOverMaximum=0,ReconnectionHealthPolicy.CONNECTION_UNHEALTHY_THRESHOLD=p.connectionUnhealthyThreshold,ReconnectionHealthPolicy.CONNECTION_WAIT_TIME_MS=p.connectionWaitTimeMs,ReconnectionHealthPolicy.MISSED_PONGS_THRESHOLD=p.missedPongsUpperThreshold,ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_MS=p.maximumAudioDelayMs,ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_DATA_POINTS=p.maximumAudioDelayDataPoints}health(){if(this.currentData.isConnectionStartRecent(ReconnectionHealthPolicy.CONNECTION_WAIT_TIME_MS))return 1;let o=this.currentData.consecutiveStatsWithNoPackets>=ReconnectionHealthPolicy.CONNECTION_UNHEALTHY_THRESHOLD,p=this.currentData.consecutiveMissedPongs>=ReconnectionHealthPolicy.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;let f=this.audioDelayPointsOverMaximum>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return(f&&(this.audioDelayPointsOverMaximum=0),o||p||f)?(this.logger.warn(`reconnection recommended due to: no packets received: ${o}, missed pongs: ${p}, bad audio delay: ${f}`),0):1}}},0x19f6220b7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda));p.default=class extends _.default{constructor(o,p,f){super(p,f,"Sending Audio Health"),this.logger=o,this.sendingAudioFailureSamplesToConsider=p.sendingAudioFailureSamplesToConsider>0?p.sendingAudioFailureSamplesToConsider:1,this.sendingAudioFailureInitialWaitTimeMs=p.sendingAudioFailureInitialWaitTimeMs,this.maximumTimesToWarn=p.maximumTimesToWarn,this.coolDownTimeMs=p.cooldownTimeMs,this.lastWarnTimestampMs=0,this.warnCount=0}isSendingAudioUnhealthy(){let o=!this.currentData.isConnectionStartRecent(this.sendingAudioFailureInitialWaitTimeMs),p=this.currentData.consecutiveStatsWithNoAudioPacketsSent>=this.sendingAudioFailureSamplesToConsider;return o&&p}health(){if(this.isSendingAudioUnhealthy()){let o=Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs;return!(this.currentHealth>this.minimumHealth())||o?this.currentHealth:(this.logger.warn(`Sending Audio is unhealthy for ${this.sendingAudioFailureSamplesToConsider} seconds consecutively.`),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?(this.logger.warn("SendingAudioFailure health policy maximum warnings breached. Falling back to reporting healthy."),this.maximumHealth()):(this.lastWarnTimestampMs=Date.now(),this.minimumHealth())}return this.maximumHealth()}}},0x1461f4056:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda));p.default=class extends _.default{constructor(o,p){super(o,p,"Unusable Audio Warning"),this.coolDownTimeMs=o.cooldownTimeMs,this.pastSamplesToConsider=o.pastSamplesToConsider,this.fractionalLoss=o.fractionalLoss,this.packetsExpected=o.packetsExpected,this.maximumTimesToWarn=o.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length<this.pastSamplesToConsider)return 0;let o=this.pastSamplesToConsider,p=o*this.packetsExpected,f=0;for(let p=0;p<o;p++)f+=this.currentData.packetsReceivedInLastMinute[p];return Math.min(Math.max(1-f/p,0),1)}health(){if(Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs)return this.currentHealth;if(this.calculateFractionalLoss()>=this.fractionalLoss)return 1*(0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,!!(this.warnCount>this.maximumTimesToWarn)));return 1}}},0x109562310:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda)),w=m(f(0x1cdcbf76c));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoConcurrentSendersHealth),this.concurrentVideoSendersThreshold=o.concurrentVideoSendersThreshold}health(){return this.currentData.isContentShare?this.maximumHealth():this.currentData.numberOfPublishedVideoSources>this.concurrentVideoSendersThreshold?this.minimumHealth():this.maximumHealth()}}},0x1cdcbf76c:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoEncodingConnectionHealthPolicyName=void 0,(m=f=p.VideoEncodingConnectionHealthPolicyName||(p.VideoEncodingConnectionHealthPolicyName={})).VideoEncodingCpuHealth="Video Encoding CPU Health",m.VideoEncodingFramerateHealth="Video Encoding framerate Health",m.VideoConcurrentSendersHealth="Video Concurrent Senders Health",p.default=f},0x1bdf2cac3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda)),w=m(f(0x1cdcbf76c));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingCpuHealth),this.consecutiveHighEncodeCpuCnt=0,this.consecutiveHighEncodeCpuThreshold=o.consecutiveHighEncodeCpuThreshold,this.highEncodeCpuMsThreshold=o.highEncodeCpuMsThreshold,this.highEncodeCpuMsPerFrameThreshold=o.highEncodeCpuMsPerFrameThreshold}health(){let o=this.currentData.videoEncodingTimeInMs>=this.highEncodeCpuMsThreshold&&this.currentData.videoEncodingTimePerFrameInMs>=this.highEncodeCpuMsPerFrameThreshold;if(!this.currentData.isVideoEncoderHardware&&(o||this.currentData.cpuLimitationDuration>0)){if(this.consecutiveHighEncodeCpuCnt++,this.consecutiveHighEncodeCpuCnt>this.consecutiveHighEncodeCpuThreshold)return this.consecutiveHighEncodeCpuCnt=0,this.minimumHealth()}else this.consecutiveHighEncodeCpuCnt=0;return this.maximumHealth()}}},0x225dfdbba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda)),w=m(f(0x1cdcbf76c));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingFramerateHealth),this.consecutiveEncodeFailureCnt=0,this.consecutiveVideoEncodingFailureThreshold=o.consecutiveVideoEncodingFailureThreshold}health(){if(0===this.currentData.videoEncodeFps&&this.currentData.videoInputFps>0){if(this.consecutiveEncodeFailureCnt++,this.consecutiveEncodeFailureCnt>this.consecutiveVideoEncodingFailureThreshold)return this.consecutiveEncodeFailureCnt=0,this.minimumHealth()}else this.consecutiveEncodeFailureCnt=0;return this.maximumHealth()}}},0x7cabad69:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xb529932d);p.default=class{constructor(o,p,f,m,_){this.audioVideoController=o,this.realtimeController=p,this.connectionHealthData=f,this.pingPong=m,this.statsCollector=_,this.isActive=!1,this.hasSeenValidCandidatePairMetricsBefore=!1,this.lastTotalBytesReceived=0,this.lastTotalStunMessagesReceived=0,this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o=>{this.isActive&&this.receiveSignalStrengthChange(o)})}start(){this.isActive=!0,this.pingPong.addObserver(this),this.pingPong.start(),this.audioVideoController.addObserver(this)}stop(){this.isActive=!1,this.pingPong.removeObserver(this),this.pingPong.stop(),this.audioVideoController.removeObserver(this)}receiveSignalStrengthChange(o){0===o?this.connectionHealthData.setLastNoSignalTimestampMs(Date.now()):o<=.5?this.connectionHealthData.setLastWeakSignalTimestampMs(Date.now()):this.connectionHealthData.setLastGoodSignalTimestampMs(Date.now()),this.updateConnectionHealth()}didReceivePong(o,p,f){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",p),this.statsCollector.logLatency("ping_pong_clock_skew",f),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(o){let p=0,f=0,m=o.getObservableMetrics(),_=m.audioPacketsReceived,w=m.audioPacketsReceivedFractionLoss,I=m.audioSpeakerDelayMs;"number"!=typeof I||isNaN(I)||this.connectionHealthData.setAudioSpeakerDelayMs(I);let k=o.getRTCStatsReport(),M=0,x=0;k.forEach(o=>{"candidate-pair"===o.type&&(o.bytesReceived&&(M+=o.bytesReceived),o.requestsReceived&&(x+=o.requestsReceived),o.responsesReceived&&(x+=o.responsesReceived))});let O=M-this.lastTotalBytesReceived;this.lastTotalBytesReceived=M;let L=x-this.lastTotalStunMessagesReceived;this.lastTotalStunMessagesReceived=x,"number"!=typeof _||"number"!=typeof w||(p=_,f=w,p<0||f<0||O<0||L<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,p),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,f),O>0||L>0?(this.hasSeenValidCandidatePairMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidCandidatePairMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===p||f>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),"number"==typeof m.audioPacketsSent&&this.updateAudioPacketsSentInConnectionHealth(m.audioPacketsSent),this.updateVideoEncodingHealth(o),this.updateConnectionHealth()))}updateAudioPacketsSentInConnectionHealth(o){o>0?this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(0):this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(this.connectionHealthData.consecutiveStatsWithNoAudioPacketsSent+1)}updateVideoEncodingHealth(o){let p=this.audioVideoController.videoTileController.hasStartedLocalVideoTile(),f=o.getVideoUpstreamSsrcs();if(!p||0===f.length){this.connectionHealthData.setIsVideoEncoderHardware(!1),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(0),this.connectionHealthData.setCpuLimitationDuration(0),this.connectionHealthData.setVideoInputFps(0),this.connectionHealthData.setVideoEncodeFps(0);return}let m=!1,_=0,w=0,I=0,k=0;for(let p of f)m||(m=!!o.getObservableVideoMetricValue("videoUpstreamEncoderImplementation",p)),_+=o.getObservableVideoMetricValue("videoUpstreamTotalEncodeTimePerSecond",p),w+=o.getObservableVideoMetricValue("videoUpstreamCpuQualityLimitationDurationPerSecond",p),I+=o.getObservableVideoMetricValue("videoUpstreamFramesInputPerSecond",p),k+=o.getObservableVideoMetricValue("videoUpstreamFramesEncodedPerSecond",p);let M=k>0?_/k:0;this.connectionHealthData.setIsVideoEncoderHardware(!!m),this.connectionHealthData.setVideoEncodingTimeInMs(_),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(M),this.connectionHealthData.setCpuLimitationDuration(w),this.connectionHealthData.setVideoInputFps(I),this.connectionHealthData.setVideoEncodeFps(k)}addToMinuteWindow(o,p){o.unshift(p),o.length>60&&o.pop()}updateConnectionHealth(){this.audioVideoController.forEachObserver(o=>{m.Maybe.of(o.connectionHealthDidChange).map(p=>p.bind(o)(this.connectionHealthData.clone()))})}}},0x104cf28d8:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Modality="#content",p.default=f},0x11817b564:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0xba48c8f4)),k=class ContentShareMediaStreamBroker{constructor(o){this.logger=o}get mediaStream(){return this._mediaStream}set mediaStream(o){this._mediaStream=o}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return 0===this._mediaStream.getAudioTracks().length?(this.logger.info("No audio stream available. Synthesizing an audio stream."),I.default.synthesizeAudioDevice(0)):this._mediaStream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){return this._mediaStream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){return o&&o.video&&o.video.mandatory&&o.video.mandatory.chromeMediaSource&&o.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(o):navigator.mediaDevices.getDisplayMedia(o)})}acquireScreenCaptureDisplayInputStream(o,p){return m(this,void 0,void 0,function*(){return this.acquireDisplayInputStream(this.screenCaptureDisplayMediaConstraints(o,p))})}screenCaptureDisplayMediaConstraints(o,p){return{audio:!!(!o&&new w.default().getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!o&&{frameRate:{max:p||ContentShareMediaStreamBroker.defaultFrameRate}}),o&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:o,maxFrameRate:p||ContentShareMediaStreamBroker.defaultFrameRate}})}}toggleMediaStream(o){let p=!1;if(this.mediaStream)for(let f=0;f<this.mediaStream.getTracks().length;f++)this.mediaStream.getTracks()[f].enabled!==o&&(this.mediaStream.getTracks()[f].enabled=o,p=!0);return p}cleanup(){if(this.mediaStream)for(let o=0;o<this.mediaStream.getTracks().length;o++)this.mediaStream.getTracks()[o].stop();this.mediaStream=null}muteLocalAudioInputStream(){throw Error("unsupported")}unmuteLocalAudioInputStream(){throw Error("unsupported")}addMediaStreamBrokerObserver(o){}removeMediaStreamBrokerObserver(o){}};p.default=k,k.defaultFrameRate=15},0xd371be18:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x3b3f192c)),I=_(f(0x13b48f1ad)),k=_(f(0x16342f6ad)),M=_(f(0x1a154f9b0)),x=_(f(0x573f705d)),O=f(0xb529932d),L=_(f(0x1f64282a8)),B=_(f(0x111b8e0a0)),U=_(f(0x104cf28d8));p.default=class{constructor(o,p,f){this.mediaStreamBroker=o,this.contentAudioVideo=p,this.attendeeAudioVideo=f,this.observerQueue=new Set,this.destroyed=!1,this.contentAudioVideo.addObserver(this),this.setupContentShareEvents()}static createContentShareMeetingSessionConfigure(o){let p=new I.default;return p.meetingId=o.meetingId,p.externalMeetingId=o.externalMeetingId,p.urls=o.urls,p.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender,p.credentials=new k.default,p.credentials.attendeeId=o.credentials.attendeeId+U.default.Modality,p.credentials.externalUserId=o.credentials.externalUserId,p.credentials.joinToken=o.credentials.joinToken+U.default.Modality,p.meetingFeatures=o.meetingFeatures.clone(),p.videoDownlinkBandwidthPolicy=new L.default,p}setContentAudioProfile(o){this.contentAudioVideo.setAudioProfile(o)}enableSimulcastForContentShare(o,p){o?(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=new B.default(this.contentAudioVideo.logger,p)):(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=void 0)}enableSVCForContentShare(o){o?this.contentAudioVideo.configuration.enableSVC=!0:this.contentAudioVideo.configuration.enableSVC=!1}startContentShare(o){return m(this,void 0,void 0,function*(){if(o){if(this.contentAudioVideo.configuration.meetingFeatures.contentMaxResolution===w.default.VideoDisabled)return void this.contentAudioVideo.logger.info("Could not start content because max content resolution was set to None");this.mediaStreamBroker.mediaStream=o;for(let o=0;o<this.mediaStreamBroker.mediaStream.getTracks().length;o++)this.mediaStreamBroker.mediaStream.getTracks()[o].addEventListener("ended",()=>{this.stopContentShare()});this.contentAudioVideo.start()}})}startContentShareFromScreenCapture(o,p){return m(this,void 0,void 0,function*(){let f=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(o,p);return yield this.startContentShare(f),f})}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidPause).map(p=>p.call(o))})}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidUnpause).map(p=>p.call(o))})}setContentShareVideoCodecPreferences(o){this.contentAudioVideo.setVideoCodecSendPreferences(o)}destroy(){return m(this,void 0,void 0,function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)})}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(o){this.observerQueue.add(o)}removeContentShareObserver(o){this.observerQueue.delete(o)}forEachContentShareObserver(o){for(let p of this.observerQueue)x.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}audioVideoDidStart(){var o;(null==(o=this.mediaStreamBroker.mediaStream)?void 0:o.getVideoTracks().length)>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(o){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStop).map(p=>p.call(o))})}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence((o,p,f,m)=>{let _=new M.default(o).hasModality(M.default.MODALITY_CONTENT),w=new M.default(o).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!_||!w||!p||this.contentShareTile)return;let I=this.mediaStreamBroker.mediaStream;if(null==I?void 0:I.getVideoTracks().length){let o,p;this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();let f=I.getVideoTracks()[0];if(f.getSettings){let m=f.getSettings();o=m.width,p=m.height}else{let m=f.getCapabilities();o=m.width,p=m.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,I,o,p,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStart).map(p=>p.call(o))})})}}},0xd6e2cff:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=class CSPMonitor{static register(){"document"in f.g&&document.addEventListener&&CSPMonitor.shouldRegisterCSPMonitor&&!CSPMonitor.added&&(document.addEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.added=!0)}static unregister(){"document"in f.g&&document.removeEventListener&&(document.removeEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.loggers=new Set,CSPMonitor.added=!1)}static disable(){CSPMonitor.shouldRegisterCSPMonitor=!1,CSPMonitor.unregister()}static addLogger(o){o&&CSPMonitor.loggers.add(o)}static removeLogger(o){o&&CSPMonitor.loggers.delete(o)}};p.default=m,m.loggers=new Set,m.shouldRegisterCSPMonitor=!0,m.added=!1,m.listener=o=>{let p=`Security Policy Violation
Blocked URI: ${o.blockedURI}
Violated Directive: ${o.violatedDirective}
Original Policy: ${o.originalPolicy}
Document URI: ${o.documentURI}
Source File: ${o.sourceFile}
Line No.: ${o.lineNumber}
`;for(let o of m.loggers)o.error(p);0===m.loggers.size&&console.error(p)}},0x239b30f5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w){this.timestampMs=o,this.topic=p,this.data=f,this.senderAttendeeId=m,this.senderExternalUserId=_,this.throttled=!!w}text(){return new TextDecoder().decode(this.data)}json(){return JSON.parse(new TextDecoder().decode(this.data))}}},0x1f56347ad:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isDestroyable=void 0,p.isDestroyable=function(o){return o&&"destroy"in o}},0x97143bf9:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isAudioTransformDevice=void 0,p.isAudioTransformDevice=function(o){return!!o&&"object"==typeof o&&"mute"in o&&"stop"in o&&"intrinsicDevice"in o}},0xba48c8f4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0x2321cdcd0)),k=_(f(0x573f705d)),M=_(f(0x8f5563d8)),x=f(0xb529932d),O=_(f(0x18c01a5bb)),L=_(f(0x4c923b82)),B=f(0x97143bf9),U=_(f(0x12584ea7b)),$=_(f(0x1f53ed78a)),q=_(f(0x1db5bc494)),Z=_(f(0x1b486d07c)),ee=_(f(0xa4c520e9)),et=_(f(0xfb8fdb39)),ei=_(f(0x1055aac05)),er=_(f(0x3b3f192c)),en=f(0x20a4e5a2e),eo=class DefaultDeviceController{constructor(o,p,f=new w.default,m){this.logger=o,this.browserBehavior=f,this.eventController=m,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=void 0,this.deviceChangeObservers=new Set,this.mediaStreamBrokerObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.useMediaConstraintsFallback=!0,this.audioInputTaskQueue=new M.default,this.videoInputTaskQueue=new M.default,this.muted=!1,this.mediaStreamMuteObserver=(o,p)=>{for(let f of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(f)&&f.audioInputMuteStateChanged&&f.audioInputMuteStateChanged(o,p)})},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:_=!1,useMediaConstraintsFallback:x=!0}=p||{};this.useWebAudio=_,this.useMediaConstraintsFallback=x,this.videoInputQualitySettings=new er.default(DefaultDeviceController.defaultVideoWidth,DefaultDeviceController.defaultVideoHeight,DefaultDeviceController.defaultVideoFrameRate);const O=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=O[0],this.videoInputQualitySettings.videoHeight=O[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=new I.default().create();const o=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(o)}`)}catch(p){o.error(p.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>{this.logger.info("Device change event callback is triggered"),this.handleDeviceChange()},null==(o=this.mediaDeviceWrapper)||o.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),null==(o=this.mediaDeviceWrapper)||o.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){return!!this.deviceChangeObservers.size||this.activeDevices.audio&&null!==this.activeDevices.audio.constraints||this.activeDevices.video&&null!==this.activeDevices.video.constraints||!!this.audioOutputDeviceId}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){return m(this,void 0,void 0,function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()})}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audioinput",o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("videoinput",o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audiooutput",o);return this.trace("listAudioOutputDevices",o,p),p})}pushAudioMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"videoInputUnselected":"videoInputSelected")}startAudioInput(o){return m(this,void 0,void 0,function*(){return yield this.audioInputTaskQueue.add(()=>this.startAudioInputTask(o))})}startAudioInputTask(o){var p;return m(this,void 0,void 0,function*(){if(void 0===o)return void this.logger.error("Audio input device cannot be undefined");try{if(B.isAudioTransformDevice(o)?(this.logger.info(`Choosing transform input device ${o}`),yield this.chooseAudioTransformInputDevice(o)):(this.logger.info(`Choosing intrinsic audio input device ${o}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",o)),this.trace("startAudioInputDevice",o,"success"),this.useWebAudio)return this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield null==(p=this.transform)?void 0:p.device.mute(this.muted),this.getMediaStreamDestinationNode().stream;return this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream}catch(o){throw o}})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.audioInputTaskQueue.add(()=>this.stopAudioInputTask())})}stopAudioInputTask(){return m(this,void 0,void 0,function*(){try{if(this.useWebAudio)return void this.releaseAudioTransformStream();this.stopTracksAndRemoveCallbacks("audio")}finally{this.watchForDeviceChangesIfNecessary(),this.publishAudioInputDidChangeEvent(void 0)}})}chooseAudioTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){let f;if((null==(p=this.transform)?void 0:p.device)===o)return;if(!this.useWebAudio)throw Error("Cannot apply transform device without enabling Web Audio.");let m=DefaultDeviceController.getAudioContext();if(m instanceof OfflineAudioContext);else switch(m.state){case"running":break;case"closed":throw Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield m.resume()}try{f=yield o.createAudioNode(m)}catch(o){throw this.logger.error(`Unable to create transform device node: ${o}.`),o}let _=yield o.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",_),this.logger.debug(`Got inner stream: ${_}.`),this.setTransform(o,f)})}chooseVideoTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){if(this.eventController&&o instanceof O.default&&o.passEventControllerToProcessors(this.eventController),o===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");let f=this.chosenVideoTransformDevice;f&&this.logger.info("Switched from previous VideoTransformDevice");let m=!!f,_=yield o.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null==(p=this.activeDevices.video)?void 0:p.stream,_)){this.logger.info("video transform device needs new intrinsic device"),m&&f.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=o,this.activeDevices.video=null,yield this.chooseInputIntrinsicDevice("video",_),this.logger.info("apply processors to transform"),yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream);return}this.chosenVideoTransformDevice=o,this.logger.info("video transform device uses previous stream"),this.logger.info("apply processors to transform"),yield o.transformStream(this.activeDevices.video.stream)})}startVideoInput(o){return m(this,void 0,void 0,function*(){return yield this.videoInputTaskQueue.add(()=>this.startVideoInputTask(o))})}startVideoInputTask(o){return m(this,void 0,void 0,function*(){if(!o)return void this.logger.error("Invalid video input device");try{if(en.isVideoTransformDevice(o))return this.logger.info(`Choosing video transform device ${o}`),yield this.chooseVideoTransformInputDevice(o),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream;return this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",o),this.trace("startVideoInputDevice",o),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream}catch(o){throw o}})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.videoInputTaskQueue.add(()=>this.stopVideoInputTask())})}stopVideoInputTask(){return m(this,void 0,void 0,function*(){try{if(this.chosenVideoInputIsTransformDevice())return void this.releaseVideoTransformStream();this.stopTracksAndRemoveCallbacks("video")}finally{this.watchForDeviceChangesIfNecessary(),this.publishVideoInputDidChangeEvent(void 0)}})}chooseAudioOutput(o){return m(this,void 0,void 0,function*(){this.audioOutputDeviceId=o,this.watchForDeviceChangesIfNecessary();let p=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);this.publishAudioOutputDidChangeEvent(p),this.trace("chooseAudioOutput",o,null)})}addDeviceChangeObserver(o){this.logger.info("adding device change observer"),this.deviceChangeObservers.add(o),this.watchForDeviceChangesIfNecessary(),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.logger.info("removing device change observer"),this.deviceChangeObservers.delete(o),this.watchForDeviceChangesIfNecessary(),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){var o,p;if(!this.activeDevices.audio)return null;let f=null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.end;if(f){let o=f.context.createAnalyser();return o.removeOriginalInputs=()=>{try{f.disconnect(o)}catch(o){}},f.connect(o),o}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(o){let p=DefaultDeviceController.getAudioContext(),f=p.createAnalyser(),m=p.createMediaStreamSource(o);return m.connect(f),this.trace("createAnalyserNodeForAudioInput"),f.removeOriginalInputs=()=>{try{m.disconnect(f)}catch{}},f}startVideoPreviewForVideoInput(o){if(!this.activeDevices.video){this.logger.warn("cannot bind video preview since video input device has not been chosen"),this.trace("startVideoPreviewForVideoInput",o.id);return}L.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,o,!0),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){L.default.disconnectVideoStreamFromVideoElement(o,!1),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){if(this.deviceInfoCache){for(let o of this.deviceInfoCache)if(!o.label){this.deviceInfoCache=null;break}}this.deviceLabelTrigger=o,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=null;return this.useWebAudio?(p=DefaultDeviceController.getAudioContext().createMediaStreamSource(o)).connect(this.getMediaStreamOutputNode()):this.logger.warn("WebAudio is not enabled, mixIntoAudioInput will not work"),this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(o,p);this.videoInputQualitySettings=new er.default(m[0],m[1],f)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return(this.activeDevices.audio||(this.logger.info("No audio device chosen, creating empty audio device"),yield this.startAudioInput(null)),this.useWebAudio)?this.getMediaStreamDestinationNode().stream:this.activeDevices.audio.stream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){if(!this.activeDevices.video)throw Error("No video device chosen");return this.chosenVideoInputIsTransformDevice()?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){throw Error("unsupported")})}releaseAudioTransformStream(){this.logger.info("Stopping audio track for Web Audio graph"),this.stopTracksAndRemoveCallbacks("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0)}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallbacks("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallbacks(o){let p=this.activeDevices[o];if(!p)return;let f=p.endedCallback,m=p.trackMuteCallback,_=p.trackUnmuteCallback;for(let w of p.stream.getTracks())w.stop(),f&&w.removeEventListener("ended",f),m&&w.removeEventListener("mute",m),_&&w.removeEventListener("unmute",_),delete p.endedCallback,delete p.trackMuteCallback,delete p.trackUnmuteCallback,delete this.activeDevices[o]}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}muteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!1)}unmuteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!0)}toggleLocalAudioInputStream(o){var p;let f=this.activeDevices.audio;if(this.useWebAudio&&(f=this.getMediaStreamDestinationNode()),f){for(let p of f.stream.getTracks())p.enabled!==o&&(p.enabled=o);!o!==this.muted&&(this.muted=!o,null==(p=this.transform)||p.device.mute(this.muted))}}static getIntrinsicDeviceId(o){if(!o)return;if("string"==typeof o)return o;if(o.id)return o.id;let p=o.deviceId;return p?"string"==typeof p||Array.isArray(p)?p:"string"==typeof p.exact||Array.isArray(p.exact)?p.exact:void 0:void 0}static createEmptyAudioDevice(){return DefaultDeviceController.synthesizeAudioDevice(0)}static synthesizeAudioDevice(o){let p=DefaultDeviceController.getAudioContext(),f=p.createMediaStreamDestination();if(o){let m=p.createGain();m.gain.value=.1,m.connect(f);let _=p.createOscillator();_.frequency.value=o,_.connect(m),_.start()}else{let o=p.createBufferSource();try{o.buffer=p.createBuffer(1,5*p.sampleRate,p.sampleRate)}catch(f){if(f&&"NotSupportedError"===f.name)o.buffer=p.createBuffer(1,5*DefaultDeviceController.defaultSampleRate,DefaultDeviceController.defaultSampleRate);else throw f}o.buffer.getChannelData(0)[0]=3e-4,o.loop=!0,o.connect(f),o.start()}return f.stream}listDevicesOfKind(o,p){return m(this,void 0,void 0,function*(){return(p||null===this.deviceInfoCache||!this.isWatchingForDeviceChanges())&&(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(o)})}updateDeviceInfoCacheFromBrowser(){var o;return m(this,void 0,void 0,function*(){if("u"<typeof MediaDeviceInfo){this.deviceInfoCache=[];return}let p=yield navigator.mediaDevices.enumerateDevices(),f=!0;for(let o of p)if(!o.label){f=!1;break}if(!f)try{this.logger.info("attempting to trigger media device labels since they are hidden");let o=yield this.deviceLabelTrigger();for(let f of(p=yield navigator.mediaDevices.enumerateDevices(),o.getTracks()))f.stop()}catch(p){this.logger.info("unable to get media device labels"),null==(o=this.eventController)||o.publishEvent("deviceLabelTriggerFailed",{deviceLabelTriggerErrorMessage:this.getErrorMessage(p)})}this.logger.debug(`Update device info cache with devices: ${JSON.stringify(p)}`),this.deviceInfoCache=p})}listCachedDevicesOfKind(o){let p=[];if(this.deviceInfoCache)for(let f of this.deviceInfoCache)f.kind===o&&p.push(f);return p}handleDeviceChange(){return m(this,void 0,void 0,function*(){if(null===this.deviceInfoCache)return;if(this.alreadyHandlingDeviceChange)return void k.default.nextTick(()=>{this.handleDeviceChange()});this.alreadyHandlingDeviceChange=!0;let o=this.listCachedDevicesOfKind("audioinput"),p=this.listCachedDevicesOfKind("videoinput"),f=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();let m=this.listCachedDevicesOfKind("audioinput"),_=this.listCachedDevicesOfKind("videoinput"),w=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver(I=>{this.areDeviceListsEqual(o,m)||x.Maybe.of(I.audioInputsChanged).map(o=>o.bind(I)(m)),this.areDeviceListsEqual(p,_)||x.Maybe.of(I.videoInputsChanged).map(o=>o.bind(I)(_)),this.areDeviceListsEqual(f,w)||x.Maybe.of(I.audioOutputsChanged).map(o=>o.bind(I)(w))}),this.alreadyHandlingDeviceChange=!1})}handleDeviceStreamEnded(o,p){return m(this,void 0,void 0,function*(){try{"audio"===o?(this.useWebAudio&&this.browserBehavior.requiresAudioContextResetOnDeviceFailureForWebAudio()?(this.logger.warn("Audio input device which was active is no longer available, suspending and resuming audio context before resetting to empty device to ensure packets are sent"),yield this.stopAudioInput(),DefaultDeviceController.suspendAudioContext(),DefaultDeviceController.resumeAudioContext()):this.logger.warn("Audio input device which was active is no longer available, resetting to empty device to ensure packets are sent"),yield this.startAudioInput(null)):(this.logger.warn("Video input device which was active is no longer available, stopping video"),yield this.stopVideoInput())}catch(o){this.logger.error("Failed to choose null device after stream ended.")}"audio"===o?this.forEachObserver(o=>{x.Maybe.of(o.audioInputStreamEnded).map(f=>f.bind(o)(p))}):this.forEachObserver(o=>{x.Maybe.of(o.videoInputStreamEnded).map(f=>f.bind(o)(p))})})}forEachObserver(o){for(let p of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(p)&&o(p)})}forEachMediaStreamBrokerObserver(o){for(let p of this.mediaStreamBrokerObservers)k.default.nextTick(()=>{this.mediaStreamBrokerObservers.has(p)&&o(p)})}areDeviceListsEqual(o,p){return JSON.stringify(o.map(o=>JSON.stringify(o)).sort())===JSON.stringify(p.map(o=>JSON.stringify(o)).sort())}intrinsicDeviceAsMediaStream(o){return o&&o.id?o:null}hasSameMediaStreamId(o,p,f){var m,_,w,I;let k;return"audio"===o?!!(k=null==f?void 0:f.audio.streamId)&&k===(null==(_=null==(m=p.constraints)?void 0:m.audio)?void 0:_.streamId):!!(k=null==f?void 0:f.video.streamId)&&k===(null==(I=null==(w=null==p?void 0:p.constraints)?void 0:w.video)?void 0:I.streamId)}hasSameGroupId(o,p,f){if(""===o)return!0;let m=DefaultDeviceController.getIntrinsicDeviceId(f);return this.logger.debug(`Checking deviceIds ${m} of type ${typeof m} with groupId ${o}`),"string"==typeof m&&o===this.getGroupIdFromDeviceId(p,m)}getGroupIdFromDeviceId(o,p){if(null!==this.deviceInfoCache){let f=this.listCachedDevicesOfKind(`${o}input`).find(o=>o.deviceId===p);if(f&&f.groupId)return this.logger.debug(`GroupId of deviceId ${p} found in cache is ${f.groupId}`),f.groupId}return this.logger.debug(`GroupId of deviceId ${p} found in cache is empty`),""}handleGetUserMediaError(o,p){if(!o)throw new $.default(o);switch(o.name){case"NotReadableError":case"TrackStartError":throw new Z.default(o);case"NotFoundError":case"DevicesNotFoundError":throw new q.default(o);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":if(p&&p<DefaultDeviceController.permissionDeniedOriginDetectionThresholdMs)throw new et.default(o,"Permission denied by browser");throw new et.default(o,"Permission denied by user");case"OverconstrainedError":case"ConstraintNotSatisfiedError":throw new ee.default(o);case"TypeError":throw new ei.default(o);default:throw new $.default(o)}}matchesDeviceSelection(o,p,f,m){return!!(f&&f.stream.active&&(this.hasSameMediaStreamId(o,f,m)||null!==f.groupId&&this.hasSameGroupId(f.groupId,o,p)))&&(this.logger.debug(`Compare current device constraint ${JSON.stringify(f.constraints)} to proposed constraints ${JSON.stringify(m)}`),f.matchesConstraints(m))}chooseInputIntrinsicDevice(o,p){var f,_;return m(this,void 0,void 0,function*(){let m=this.getMediaStreamConstraints(o,p);if(this.matchesDeviceSelection(o,p,this.activeDevices[o],m))return void this.logger.info(`reusing existing ${o} input device`);this.activeDevices[o]&&this.activeDevices[o].stream&&this.stopTracksAndRemoveCallbacks(o);let w=Date.now(),I=new U.default;try{this.logger.info(`requesting new ${o} device with constraint ${JSON.stringify(m)}`);let f=this.intrinsicDeviceAsMediaStream(p);"audio"===o&&null===p?(I.stream=DefaultDeviceController.createEmptyAudioDevice(),I.constraints=null):(f?(this.logger.info(`using media stream ${f.id} for ${o} device`),I.stream=f):I.stream=yield navigator.mediaDevices.getUserMedia(m),I.constraints=m),yield this.handleNewInputDevice(o,I)}catch(x){let k=this.getErrorMessage(x);"audio"===o?null==(f=this.eventController)||f.publishEvent("audioInputFailed",{audioInputErrorMessage:k}):null==(_=this.eventController)||_.publishEvent("videoInputFailed",{videoInputErrorMessage:k}),this.logger.error(`failed to get ${o} device for constraints ${JSON.stringify(m)}: ${k}`);let M=!0;if(x&&"constraint"in x&&(this.logger.error(`Over-constrained by constraint: ${x.constraint}`),this.useMediaConstraintsFallback)){let f=this.getMediaStreamConstraints(o,p,!0),_=JSON.stringify(f);if(_!==JSON.stringify(m)){this.logger.info(`retry requesting new ${o} device with minimal constraint ${_}`);try{I.stream=yield navigator.mediaDevices.getUserMedia(f),I.constraints=f,yield this.handleNewInputDevice(o,I),M=!1}catch(p){this.logger.error(`failed to get ${o} device for constraints ${_}: ${this.getErrorMessage(p)}`)}}}if(M){if("audio"===o){this.logger.info(`choosing null ${o} device instead`);try{I.stream=DefaultDeviceController.createEmptyAudioDevice(),I.constraints=null,yield this.handleNewInputDevice(o,I)}catch(p){this.logger.error(`failed to choose null ${o} device. ${p.name}: ${p.message}`)}}this.handleGetUserMediaError(x,Date.now()-w)}}finally{this.watchForDeviceChangesIfNecessary()}})}getErrorMessage(o){return o?o.name&&o.message?`${o.name}: ${o.message}`:o.name?o.name:o.message?o.message:"UnknownError":"UnknownError"}handleNewInputDevice(o,p){var f;return m(this,void 0,void 0,function*(){this.logger.info(`got ${o} device for constraints ${JSON.stringify(p.constraints)}`);let m=null==(f=this.getMediaTrackSettings(p.stream))?void 0:f.deviceId;p.groupId=m?this.getGroupIdFromDeviceId(o,m):"",this.activeDevices[o]=p,this.logger.debug(`Set activeDevice to ${JSON.stringify(p)}`),this.watchForDeviceChangesIfNecessary();let _=p.stream.getTracks()[0];if(_&&(p.endedCallback=()=>{this.activeDevices[o]&&this.activeDevices[o].stream===p.stream&&(this.handleDeviceStreamEnded(o,m),delete p.endedCallback)},_.addEventListener("ended",p.endedCallback,{once:!0})),"audio"===o){let o=p.stream.getAudioTracks()[0];if(o){let f=o.getSettings().deviceId||p.stream;p.trackMuteCallback=()=>{this.mediaStreamMuteObserver(f,!0)},p.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(f,!1)},o.addEventListener("mute",p.trackMuteCallback,{once:!1}),o.addEventListener("unmute",p.trackUnmuteCallback,{once:!1}),this.logger.debug("Notifying mute state after selection"),o.muted?p.trackMuteCallback():p.trackUnmuteCallback()}}})}calculateMediaStreamConstraints(o,p,f,m){if(m&&1===this.listCachedDevicesOfKind(`${o}input`).length)return!0;let _={};return(this.browserBehavior.requiresNoExactMediaStreamConstraints()?_.deviceId=p:_.deviceId={exact:p},f&&(_.groupId=f),m)?_:"video"===o?(_.width={ideal:this.videoInputQualitySettings.videoWidth},_.height={ideal:this.videoInputQualitySettings.videoHeight},_.frameRate={ideal:this.videoInputQualitySettings.videoFrameRate},_):(this.supportSampleRateConstraint()&&(_.sampleRate={ideal:DefaultDeviceController.defaultSampleRate}),this.supportSampleSizeConstraint()&&(_.sampleSize={ideal:DefaultDeviceController.defaultSampleSize}),this.supportChannelCountConstraint()&&(_.channelCount={ideal:DefaultDeviceController.defaultChannelCount}),Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},_))}getMediaStreamConstraintsFromTrackConstraints(o,p){return"audio"===o?{audio:p}:{video:p}}getMediaStreamConstraints(o,p,f=!1){let m={};if(!p)return null;let _=this.intrinsicDeviceAsMediaStream(p);if(_)return m.streamId=_.id,this.getMediaStreamConstraintsFromTrackConstraints(o,m);if("string"==typeof p){let _="";return this.browserBehavior.requiresGroupIdMediaStreamConstraints()&&(null!==this.deviceInfoCache?_=this.getGroupIdFromDeviceId(o,p):this.logger.error("Device cache is not populated. Please make sure to call list devices first")),m=this.calculateMediaStreamConstraints(o,p,_,f),this.getMediaStreamConstraintsFromTrackConstraints(o,m)}return isMediaDeviceInfo(p)?m=this.calculateMediaStreamConstraints(o,p.deviceId,p.groupId,f):m=p,this.getMediaStreamConstraintsFromTrackConstraints(o,m)}deviceInfoFromDeviceId(o,p){if(null===this.deviceInfoCache)return null;for(let f of this.deviceInfoCache)if(f.kind===o&&f.deviceId===p)return f;return null}hasAppliedTransform(){return!!this.transform}isMediaStreamReusableByDeviceId(o,p){if(!o||!o.active||!p)return!1;if(p.id)return o.id===p.id;let f=this.getMediaTrackSettings(o);if(!f.deviceId)return!1;let m=DefaultDeviceController.getIntrinsicDeviceId(p);return"string"==typeof m&&f.deviceId===m}getMediaTrackSettings(o){var p;return null==(p=o.getTracks()[0])?void 0:p.getSettings()}reconnectAudioInputs(){if(!this.audioInputSourceNode)return;this.audioInputSourceNode.disconnect();let o=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(o)}setTransform(o,p){var f,m;null==(m=null==(f=this.transform)?void 0:f.nodes)||m.end.disconnect(),this.transform={nodes:p,device:o};let _=null==p?void 0:p.end,w=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${_} to destination ${w}.`),null==_||_.connect(w),this.reconnectAudioInputs()}removeTransform(){var o;let p=this.transform;if(p)return null==(o=this.transform.nodes)||o.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),p}attachAudioInputStreamToAudioContext(o){var p;null==(p=this.audioInputSourceNode)||p.disconnect(),this.audioInputSourceNode=DefaultDeviceController.getAudioContext().createMediaStreamSource(o);let f=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(f)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=DefaultDeviceController.getAudioContext().createMediaStreamDestination()),this.audioInputDestinationNode}getMediaStreamOutputNode(){var o,p;return(null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.start)||this.getMediaStreamDestinationNode()}static setDefaultLatencyHint(o){DefaultDeviceController.defaultLatencyHint=o}static getAudioContext(){if(!DefaultDeviceController.audioContext){let o={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(o.sampleRate=DefaultDeviceController.defaultSampleRate),new w.default().requiresPlaybackLatencyHintForAudioContext()&&(o.latencyHint="playback"),DefaultDeviceController.defaultLatencyHint&&(o.latencyHint=DefaultDeviceController.defaultLatencyHint),DefaultDeviceController.audioContext=new(window.AudioContext||window.webkitAudioContext)(o)}return DefaultDeviceController.audioContext}static suspendAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.suspend():Promise.resolve()})}static resumeAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.resume():Promise.resolve()})}static closeAudioContext(){if(DefaultDeviceController.audioContext)try{DefaultDeviceController.audioContext.close()}catch(o){}DefaultDeviceController.audioContext=null}addMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.add(o)}removeMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.delete(o)}publishVideoInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.videoInputDidChange&&p.videoInputDidChange(o)}),this.pushVideoMeetingStateForPermissions(o)}publishAudioInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioInputDidChange&&p.audioInputDidChange(o)}),this.pushAudioMeetingStateForPermissions(o)}publishAudioOutputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioOutputDidChange&&p.audioOutputDidChange(o)})}supportSampleRateConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleRate}supportSampleSizeConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleSize}supportChannelCountConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().channelCount}trace(o,p,f){let m=`API/DefaultDeviceController/${o}`;void 0!==p&&(m+=` ${JSON.stringify(p)}`),void 0!==f&&(m+=` -> ${JSON.stringify(f)}`),this.logger.info(m)}};function isMediaDeviceInfo(o){return"object"==typeof o&&"deviceId"in o&&"groupId"in o&&"kind"in o&&"label"in o}p.default=eo,eo.permissionDeniedOriginDetectionThresholdMs=500,eo.defaultVideoWidth=960,eo.defaultVideoHeight=540,eo.defaultVideoFrameRate=15,eo.defaultSampleRate=48e3,eo.defaultSampleSize=16,eo.defaultChannelCount=1,eo.audioContext=null},0x12584ea7b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.groupId=""}matchesConstraints(o){return JSON.stringify(this.constraints)===JSON.stringify(o)}}},0x1f53ed78a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class extends Error{constructor(o,p){super(p||"Error fetching device."),this.cause=o,this.name="GetUserMediaError"}}},0x19e6a0f9b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.NoOpDeviceControllerWithEventController=void 0;let w=_(f(0x41c6ff55)),I=_(f(0x3b3f192c)),k=class extends w.default{constructor(o){super(),this.destroyed=!1}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0})}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}startAudioInput(o){return Promise.reject()}stopAudioInput(){return Promise.resolve()}startVideoInput(o){return Promise.reject()}stopVideoInput(){return Promise.resolve()}chooseAudioOutput(o){return Promise.reject()}addDeviceChangeObserver(o){}removeDeviceChangeObserver(o){}createAnalyserNodeForAudioInput(){return null}startVideoPreviewForVideoInput(o){}stopVideoPreviewForVideoInput(o){}setDeviceLabelTrigger(o){}mixIntoAudioInput(o){return null}chooseVideoInputQuality(o,p,f){}getVideoInputQualitySettings(){return I.default.VideoDisabled}};p.default=k,p.NoOpDeviceControllerWithEventController=class extends k{constructor(o){super(),this.eventController=o}}},0x1db5bc494:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o){super(o),this.name="NotFoundError"}}},0x1b486d07c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o){super(o),this.name="NotReadableError"}}},0xa4c520e9:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o,p){super(o),this.constraint=p,this.name="OverconstrainedError"}}},0xfb8fdb39:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o,p){super(o,p),this.name="PermissionDeniedError"}}},0x215250f11:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.inner=o}mute(o){return f(this,void 0,void 0,function*(){})}stop(){var o;return f(this,void 0,void 0,function*(){null==(o=this.node)||o.disconnect()})}intrinsicDevice(){return f(this,void 0,void 0,function*(){return this.inner})}createAudioNode(o){var p;return f(this,void 0,void 0,function*(){return null==(p=this.node)||p.disconnect(),this.node=yield this.createSingleAudioNode(o),{start:this.node,end:this.node}})}}},0x1055aac05:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o){super(o),this.name="TypeError"}}},0x3b3f192c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class{constructor(o,p,f){this.videoWidth=o,this.videoHeight=p,this.videoFrameRate=f}equals(o){return this.videoWidth===o.videoWidth&&this.videoHeight===o.videoHeight&&this.videoFrameRate===o.videoFrameRate}};p.default=f,f.VideoDisabled=new f(0,0,0),f.VideoResolutionHD=new f(1280,720,30),f.VideoResolutionFHD=new f(1920,1080,30),f.VideoResolutionUHD=new f(3840,2160,30)},0x20a4e5a2e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isVideoTransformDevice=void 0,p.isVideoTransformDevice=function(o){return!!o&&"object"==typeof o&&"transformStream"in o&&"stop"in o&&"intrinsicDevice"in o}},0x16ee58416:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){if(this.devicePixelRatioSource=o,this.observerQueue=new Set,this.mediaQueryListener=()=>{this.observerQueue.forEach(o=>{o.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())})},"u"<typeof window)return;const f=matchMedia(`(resolution: ${this.devicePixelRatioSource.devicePixelRatio()}dppx)`);"function"==typeof f.addEventListener?(f.addEventListener("change",this.mediaQueryListener),this.mediaQueryList=f):"function"==typeof f.addListener?(f.addListener(this.mediaQueryListener),this.mediaQueryList=f):p.warn("ignoring DefaultDevicePixelRatioMonitor")}destroy(){return f(this,void 0,void 0,function*(){this.mediaQueryList&&("function"==typeof this.mediaQueryList.addEventListener?this.mediaQueryList.removeEventListener("change",this.mediaQueryListener):this.mediaQueryList.removeListener(this.mediaQueryListener)),delete this.mediaQueryListener,this.observerQueue.clear()})}registerObserver(o){this.observerQueue.add(o),o.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}removeObserver(o){this.observerQueue.delete(o)}}},0xc4db2fcf:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{devicePixelRatio(){return!("u"<typeof window)&&window&&window.devicePixelRatio?window.devicePixelRatio:1}}},0x27607683:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__rest||function(o,p){var f={};for(var m in o)Object.prototype.hasOwnProperty.call(o,m)&&0>p.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_<m.length;_++)0>p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f},w=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let I=w(f(6329639e3)),k=w(f(0x7b80cc62)),M=w(f(0x6cbaf532)),x=f(0x149d24991),O=class InMemoryJSONEventBuffer{constructor(o,p,f,w,I){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=o=>({type:o.type,v:o.v,payloads:[...o.payloads]}),this.sendEvents=()=>m(this,void 0,void 0,function*(){if(this.lock)return;let o=this.getItems(this.flushSize);if(0===o.length)return;this.lock=!0;let p=this.makeRequestBody(o),f=!1,m=Date.now();"firefox"===this.metadata.browserName.toLowerCase()&&this.cancellableEvents.set(m,o);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${p}`);let o=yield this.send(p);if(this.cancellableEvents.delete(m),o.ok)try{let f=yield o.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${p} message: ${JSON.stringify(f)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${o} for events ${p}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${p} with response status ${o.status}`),f=!0}catch(o){f=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${p} to the ingestion endpoint ${o}`)}finally{this.lock=!1}f&&(this.cancellableEvents.delete(m),this.failedIngestionEvents.push(...o))});const k=new M.default(I).getParserResult(),{browserMajorVersion:x}=k,O=_(k,["browserMajorVersion"]),L=p.toJSON(),{type:B,v:U}=L,$=_(L,["type","v"]);this.authenticationToken=p.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},O),$),Object.keys(this.metadata).forEach(o=>this.attributesToFilter.push(o)),this.type=B,this.v=U,this.ingestionURL=f,this.logger=I,this.importantEvents=new Set(w);const{maxBufferCapacityKb:q,totalBufferItems:Z,flushSize:ee,flushIntervalMs:et,retryCountLimit:ei}=o;this.maxBufferCapacityBytes=1024*q,this.totalBufferItems=Z,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/Z),this.flushIntervalMs=et,this.flushSize=ee,this.retryCountLimit=ei,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=o=>this.beaconEventHandler(o),this.addEventListeners()}addEventListeners(){this.beaconEventListener&&"window"in f.g&&window.addEventListener&&"document"in f.g&&document.addEventListener&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - addEventListeners - adding pagehide and visibility change event listeners"),window.addEventListener("pagehide",this.beaconEventListener),document.addEventListener("visibilitychange",this.beaconEventListener))}beaconEventHandler(o){("visibilitychange"===o.type&&"hidden"===document.visibilityState||"pagehide"===o.type)&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - beaconEventHandler is triggered calling sendBeacon"),this.sendBeacon())}removeEventListeners(){this.beaconEventListener&&"window"in f.g&&window.removeEventListener&&"document"in f.g&&document.removeEventListener&&(window.removeEventListener("pagehide",this.beaconEventListener),document.removeEventListener("visibilitychange",this.beaconEventListener),this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - removeEventListeners - removing pagehide and visibility change event listeners"))}start(){var o;this.removeEventListeners(),this.addEventListeners(),null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=new k.default(this.flushIntervalMs),this.intervalScheduler.start(()=>this.sendEvents())}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.sendBeacon(),this.removeEventListeners()}addItem(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_=m&&this.filterAttributes(m,this.attributesToFilter),w=Object.assign({name:p,ts:f},_);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(w)}`);let I=this.getSize(w);if(I>InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED)throw Error(`Event Reporting - Item to be added has size ${I} bytes. Item cannot exceed max item size allowed of ${InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(p)){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(w)}`),this.sendEventImmediately({name:p,ts:f,attributes:_});return}if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),Error("Buffer full");if(this.currentIngestionEvent.payloads.push(w),this.ingestionEventSize+=I,this.bufferItemThresholdReached(I)){let o=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);this.buffer.push(o),this.bufferSize+=this.ingestionEventSize,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - buffer item threshold reached updated buffer ${JSON.stringify(this.buffer)}`)}})}filterAttributes(o,p){let f=new Set(p);return Object.keys(o).filter(o=>f.has(o)).forEach(p=>delete o[p]),o}initializeAndGetCurrentIngestionEvent(){let o={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(o),o}bufferItemThresholdReached(o){return o+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===InMemoryJSONEventBuffer.MAX_PAYLOAD_ITEMS}getSize(o){let p=0;if("object"==typeof o)for(let[f,m]of Object.entries(o))p+=this.getPrimitiveSize(f),p+=this.getSize(m);else p+=this.getPrimitiveSize(o);return p}getPrimitiveSize(o){let p=0;return"string"==typeof o?p+=2*o.length:"number"==typeof o&&(p+=8),p}isFull(){return this.bufferSize===this.maxBufferCapacityBytes||this.buffer.length===this.totalBufferItems}isEmpty(){return 0===this.buffer.length||0===this.bufferSize}getItems(o,p=0){return this.isEmpty()?[]:(o=Math.min(this.buffer.length,o+1),this.buffer.splice(p,o))}makeBeaconRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o,authorization:this.authenticationToken})}makeRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o})}sendEventImmediately(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_={type:this.type,v:this.v,payloads:[Object.assign({name:p,ts:f},m)]},w=!1,I=null,k=this.makeRequestBody([_]);try{if((I=yield this.send(k)).ok){try{let o=yield I.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${k}, message: ${JSON.stringify(o)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${o} for event ${k}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${k} with response status ${I.status}`),w=!0}catch(o){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${k} to the ingestion endpoint ${o}.`),w=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){let o=this.makeBeaconRequestBody([_]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${o}`),w=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,o)}}catch(o){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${k}`),w=!0}}w&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${k}`),this.failedIngestionEvents.push(_))})}send(o){return m(this,void 0,void 0,function*(){let p=new I.default(InMemoryJSONEventBuffer.RETRY_FIXED_BACKOFF_WAIT_MS,InMemoryJSONEventBuffer.RETRY_SHORT_BACKOFF_MS,InMemoryJSONEventBuffer.RETRY_LONG_BACKOFF_MS);try{let f=0;for(;f<this.retryCountLimit;){let m=yield fetch(this.ingestionURL,{method:"POST",headers:{Authorization:`Bearer ${this.authenticationToken}`},body:o});if(m.ok||!InMemoryJSONEventBuffer.SENDING_FAILURE_CODES.has(m.status))return m;if(this.logger.warn(`Will retry sending failure for ${o} due to status code ${m.status}.`),++f<this.retryCountLimit){let o=p.nextBackoffAmountMs();yield x.wait(o)}}if(f===this.retryCountLimit)throw Error(`Retry count limit reached for ${o}`)}catch(o){throw o}})}sendBeacon(){return m(this,void 0,void 0,function*(){let o=this.buffer;if(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out buffer events ${JSON.stringify(o)}`),this.buffer=[],this.currentIngestionEvent.payloads.length>0){let p=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);o.push(p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(p)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){let p=this.failedIngestionEvents.map(o=>this.deepCopyCurrentIngestionEvent(o));o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(p)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>0&&(this.cancellableEvents.forEach(p=>{o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out each cancellable event ${JSON.stringify(p)}`)}),this.cancellableEvents.clear()),0===o.length)return;let p=this.makeBeaconRequestBody(o);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - beacon data to send ${p}`);try{navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,p)||this.logger.warn(`Event Reporting - Browser failed to queue beacon data ${p}`)}catch(o){this.logger.warn(`Event Reporting - Sending beacon data ${p} failed with error ${o}`)}})}reset(){this.maxBufferCapacityBytes=0,this.totalBufferItems=0,this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.lock=!1,this.beaconEventListener=void 0,this.cancellableEvents.clear()}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.reset()})}};p.default=O,O.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),O.RETRY_FIXED_BACKOFF_WAIT_MS=0,O.RETRY_SHORT_BACKOFF_MS=1e3,O.RETRY_LONG_BACKOFF_MS=15e3,O.MAX_PAYLOAD_ITEMS=2,O.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},0x75bc23e7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=5e3,p=2,f=64,m=100,_=15){this.flushIntervalMs=o,this.flushSize=p,this.maxBufferCapacityKb=f,this.totalBufferItems=m,this.retryCountLimit=_}}},0x1029db6ff:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.audioVideoEventAttributesFromState=void 0,p.audioVideoEventAttributesFromState=function(o){let p={};return null!==o.startTimeMs&&(p.meetingDurationMs=Math.round(Date.now()-o.startTimeMs)),null!==o.signalingOpenDurationMs&&(p.signalingOpenDurationMs=o.signalingOpenDurationMs),null!==o.iceGatheringDurationMs&&(p.iceGatheringDurationMs=o.iceGatheringDurationMs),null!==o.attendeePresenceDurationMs&&(p.attendeePresenceDurationMs=o.attendeePresenceDurationMs),null!==o.meetingStartDurationMs&&(p.meetingStartDurationMs=o.meetingStartDurationMs),void 0!==o.maxVideoTileCount&&(p.maxVideoTileCount=o.maxVideoTileCount),void 0!==o.poorConnectionCount&&(p.poorConnectionCount=o.poorConnectionCount),void 0!==o.retryCount&&(p.retryCount=o.retryCount),p}},0x674df13c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x13f6890b8),I=f(0x1f56347ad),k=_(f(0x1b3a9c949)),M=_(f(0x235df13ff)),x=_(f(0x1e8ca6e4)),O=_(f(0x573f705d)),L=_(f(0xaf1ae5b3)),B=_(f(0x1a5824c20)),U=class DefaultEventController{constructor(o,p,f){var m,_,I,k,M,x,O;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=p,this.configuration=o,this.setupEventReporter(o,p,f);try{this.parserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null}catch(o){this.logger.error(o.message)}this.browserMajorVersion=(null==(I=null==(_=null==(m=this.parserResult)?void 0:m.browser)?void 0:_.version)?void 0:I.split(".")[0])||DefaultEventController.UNAVAILABLE,this.browserName=(null==(k=this.parserResult)?void 0:k.browser.name)||DefaultEventController.UNAVAILABLE,this.browserVersion=(null==(M=this.parserResult)?void 0:M.browser.version)||DefaultEventController.UNAVAILABLE,this.deviceName=[(null==(x=this.parserResult)?void 0:x.device.vendor)||"",(null==(O=this.parserResult)?void 0:O.device.model)||""].join(" ").trim()||DefaultEventController.UNAVAILABLE}addObserver(o){this.observerSet.add(o)}removeObserver(o){this.observerSet.delete(o)}forEachObserver(o){for(let p of this.observerSet)O.default.nextTick(()=>{this.observerSet.has(p)&&o(p)})}publishEvent(o,p){return m(this,void 0,void 0,function*(){let f=Date.now();this.meetingHistoryStates.push({name:o,timestampMs:f});let m=Object.freeze(Object.assign(this.getAttributes(f),p));this.forEachObserver(p=>{p.eventDidReceive(o,m)}),this.reportEvent(o,f,p)})}reportEvent(o,p,f){var _;return m(this,void 0,void 0,function*(){let m;try{f&&(m=B.default(f)),yield null==(_=this.eventReporter)?void 0:_.reportEvent(p,o,m)}catch(o){this.logger.error(`Error reporting event ${o}`)}})}setupEventReporter(o,p,f){if(f)this._eventReporter=f;else if(o.urls){let f=o.urls.eventIngestionURL;if(f){this.logger.info("Event ingestion URL is present in the configuration");let{meetingId:m,credentials:{attendeeId:_,joinToken:w}}=o,I=new x.default(m,_,w),O=new k.default(I,f);this._eventReporter=new M.default(O,p)}}}getAttributes(o){var p,f;return{attendeeId:this.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:"string"==typeof this.configuration.externalMeetingId?this.configuration.externalMeetingId:"",externalUserId:this.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.configuration.meetingId,osName:(null==(p=this.parserResult)?void 0:p.os.name)||DefaultEventController.UNAVAILABLE,osVersion:(null==(f=this.parserResult)?void 0:f.os.version)||DefaultEventController.UNAVAILABLE,sdkVersion:L.default.sdkVersion,sdkName:L.default.sdkName,timestampMs:o}}get eventReporter(){return this._eventReporter}destroy(){return m(this,void 0,void 0,function*(){I.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0})}};p.default=U,U.UNAVAILABLE="Unavailable"},0x1a5824c20:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=o=>{let p={};for(let[f,m]of Object.entries(o))if(null==m||""===m)continue;else if("number"==typeof m||"string"==typeof m)p[f]=m;else throw TypeError("Unhandled type received while flattening attributes.");return p}},0x1b3a9c949:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x75bc23e7));p.default=class{constructor(o,p,f=new _.default){this.eventsClientConfiguration=o,this.ingestionURL=p,this.eventBufferConfiguration=f}}},0x235df13ff:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x1f56347ad),I=_(f(0x27607683));p.default=class{constructor(o,p){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded","deviceLabelTriggerFailed"],this.destroyed=!1;const{eventsClientConfiguration:f,ingestionURL:m,eventBufferConfiguration:_}=o,{eventsToIgnore:w}=f;this.eventBuffer=new I.default(_,f,m,this.importantEvents,p),this.logger=p,this.eventsToIgnore=w,this.start()}start(){if(!this.reportingEvents)try{this.eventBuffer.start(),this.logger.info("Event reporting started"),this.reportingEvents=!0}catch(o){this.logger.error(`Event Reporting - Error starting the event buffer ${o}`)}}stop(){if(this.reportingEvents)try{this.eventBuffer.stop(),this.logger.info("Event reporting stopped"),this.reportingEvents=!1}catch(o){this.logger.error(`Event Reporting - Error stopping the event buffer ${o}`)}}reportEvent(o,p,f){return m(this,void 0,void 0,function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${o}, ${p}, ${JSON.stringify(f)}`),this.eventsToIgnore.includes(p))return void this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - ${p} event will be ignored as it is in events to ignore`);try{this.logger.debug("Event Reporting - DefaultMeetingEventReporter - adding item to event buffer"),yield this.eventBuffer.addItem({ts:o,name:p,attributes:f})}catch(o){this.logger.error(`Event Reporting - Error adding event to buffer ${o}`)}})}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0,this.stop(),w.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0})}}},0xe23a89c1:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{reportEvent(o,p,f){}start(){}stop(){}}},0x1e8ca6e4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m=[]){this.type="Meet",this.v=1,this.meetingId=o,this.attendeeId=p,this.eventsToIgnore=m,this.authenticationToken=f}getAuthenticationToken(){return this.authenticationToken}toJSON(){let o={};return o.type=this.type,o.v=this.v,o.meetingId=this.meetingId,o.attendeeId=this.attendeeId,o}}},0x12192fed6:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DefaultEventController=p.DefaultDevicePixelRatioMonitor=p.DefaultDeviceController=p.DefaultContentShareController=p.DefaultBrowserBehavior=p.DefaultAudioVideoFacade=p.DefaultAudioVideoController=p.DefaultAudioMixController=p.DefaultActiveSpeakerPolicy=p.DefaultActiveSpeakerDetector=p.DataMessage=p.CreateSDPTask=p.CreatePeerConnectionTask=p.ContentShareMediaStreamBroker=p.ContentShareConstants=p.ConsoleLogger=p.ConnectionHealthPolicyConfiguration=p.ConnectionHealthData=p.ClientVideoStreamReceivingReport=p.ClientMetricReportMediaType=p.ClientMetricReportDirection=p.ClientMetricReport=p.CleanStoppedSessionTask=p.CleanRestartedSessionTask=p.CheckVideoInputFeedback=p.CheckVideoConnectivityFeedback=p.CheckNetworkUDPConnectivityFeedback=p.CheckNetworkTCPConnectivityFeedback=p.CheckContentShareConnectivityFeedback=p.CheckCameraResolutionFeedback=p.CheckAudioOutputFeedback=p.CheckAudioInputFeedback=p.CheckAudioConnectivityFeedback=p.CanvasVideoFrameBuffer=p.CSPMonitor=p.BitrateParameters=p.BaseTask=p.BaseConnectionHealthPolicy=p.BackgroundReplacementVideoFrameProcessor=p.BackgroundFilterVideoFrameProcessor=p.BackgroundBlurVideoFrameProcessor=p.BackgroundBlurStrength=p.AudioVideoControllerState=p.AudioProfile=p.AudioLogEvent=p.Attendee=p.AttachMediaInputTask=p.AsyncScheduler=p.ApplicationMetadata=p.AllHighestVideoBandwidthPolicy=void 0,p.MeetingFeatures=p.MeetingEventsClientConfiguration=p.MediaDeviceProxyHandler=p.Maybe=p.LogLevel=p.Log=p.ListenForVolumeIndicatorsTask=p.LeaveAndReceiveLeaveAckTask=p.JoinAndReceiveIndexTask=p.IntervalScheduler=p.InMemoryJSONEventBuffer=p.GlobalMetricReport=p.GetUserMediaError=p.FullJitterLimitedBackoff=p.FullJitterBackoffFactory=p.FullJitterBackoff=p.FinishGatheringICECandidatesTask=p.EventIngestionConfiguration=p.EventBufferConfiguration=p.DeviceSelection=p.DevicePixelRatioWindowSource=p.DefaultWebSocketAdapter=p.DefaultVolumeIndicatorAdapter=p.DefaultVideoTransformDevice=p.DefaultVideoTileFactory=p.DefaultVideoTileController=p.DefaultVideoTile=p.DefaultVideoStreamIndex=p.DefaultVideoStreamIdSet=p.DefaultVideoFrameProcessorTimer=p.DefaultVideoFrameProcessorPipeline=p.DefaultVideoElementResolutionMonitor=p.DefaultVideoCaptureAndEncodeParameter=p.DefaultUserAgentParser=p.DefaultTranscriptionController=p.DefaultTransceiverController=p.DefaultSimulcastUplinkPolicyForContentShare=p.DefaultSimulcastUplinkPolicy=p.DefaultSignalingClient=p.DefaultSigV4=p.DefaultSessionStateController=p.DefaultReconnectController=p.DefaultRealtimeController=p.DefaultPingPong=p.DefaultModality=p.DefaultMessagingSession=p.DefaultMeetingSession=p.DefaultMeetingReadinessChecker=p.DefaultMeetingEventReporter=p.DefaultMediaDeviceFactory=void 0,p.RedundantAudioEncoder=p.ReconnectionHealthPolicy=p.ReceiveVideoStreamIndexTask=p.ReceiveVideoInputTask=p.ReceiveRemoteVideoPauseResumeTask=p.ReceiveAudioInputTask=p.RealtimeVolumeIndicator=p.RealtimeState=p.RealtimeAttendeePositionInFrame=p.PromoteToPrimaryMeetingTask=p.PromiseQueue=p.PrefetchSortBy=p.PrefetchOn=p.PermissionDeniedError=p.ParallelGroupTask=p.POSTLogger=p.OverconstrainedError=p.OpenSignalingConnectionTask=p.OnceTask=p.NotReadableError=p.NotFoundError=p.None=p.NoVideoUplinkBandwidthPolicy=p.NoVideoDownlinkBandwidthPolicy=p.NoOpVideoFrameProcessor=p.NoOpVideoElementFactory=p.NoOpTask=p.NoOpMediaStreamBroker=p.NoOpLogger=p.NoOpEventReporter=p.NoOpDeviceController=p.NoOpDebugLogger=p.NoOpAudioVideoController=p.NScaleVideoUplinkBandwidthPolicy=p.MutableVideoPreferences=p.MultiLogger=p.MonitorTask=p.ModelSpecBuilder=p.MessagingSessionConfiguration=p.Message=p.MeetingSessionVideoAvailability=p.MeetingSessionURLs=p.MeetingSessionTURNCredentials=p.MeetingSessionStatusCode=p.MeetingSessionStatus=p.MeetingSessionLifecycleEventCondition=p.MeetingSessionLifecycleEvent=p.MeetingSessionCredentials=p.MeetingSessionConfiguration=p.MeetingReadinessCheckerConfiguration=void 0,p.VideoEncodingConcurrentSendersHealthPolicy=p.VideoCodecCapability=p.VideoAdaptiveProbePolicy=p.Versioning=p.UnusableAudioWarningConnectionHealthPolicy=p.TypeError=p.TranscriptionStatusType=p.TranscriptionStatus=p.TranscriptResult=p.TranscriptLanguageWithScore=p.TranscriptItemType=p.TranscriptItem=p.TranscriptEntity=p.TranscriptAlternative=p.Transcript=p.TimeoutTask=p.TimeoutScheduler=p.TaskStatus=p.TargetDisplaySize=p.SubscribeAndReceiveSubscribeAckTask=p.StreamMetricReport=p.Some=p.SingleNodeAudioTransformDevice=p.SimulcastVideoStreamIndex=p.SimulcastTransceiverController=p.SimulcastLayers=p.SimulcastContentShareTransceiverController=p.SignalingClientVideoSubscriptionConfiguration=p.SignalingClientSubscribe=p.SignalingClientJoin=p.SignalingClientEventType=p.SignalingClientEvent=p.SignalingClientConnectionRequest=p.SignalingAndMetricsConnectionMonitor=p.SetRemoteDescriptionTask=p.SetLocalDescriptionTask=p.SessionStateControllerTransitionResult=p.SessionStateControllerState=p.SessionStateControllerDeferPriority=p.SessionStateControllerAction=p.ServerSideNetworkAdaption=p.SerialGroupTask=p.SendingAudioFailureConnectionHealthPolicy=p.SendAndReceiveDataMessagesTask=p.SDPMediaSection=p.SDPCandidateType=p.SDP=p.RunnableTask=p.RedundantAudioRecoveryMetricReport=p.RedundantAudioEncoderWorkerCode=void 0,p.isVideoTransformDevice=p.isDestroyable=p.isAudioTransformDevice=p.ZLIBTextCompressor=p.WebSocketReadyState=p.WaitForAttendeePresenceTask=p.VoiceFocusTransformDevice=p.VoiceFocusDeviceTransformer=p.VideoTileState=p.VideoStreamDescription=p.VideoSource=p.VideoQualitySettings=p.VideoQualityAdaptationPreference=p.VideoPriorityBasedPolicyConfig=p.VideoPriorityBasedPolicy=p.VideoPreferences=p.VideoPreference=p.VideoOnlyTransceiverController=p.VideoLogEvent=p.VideoFxProcessor=p.VideoEncodingFramerateConnectionHealthPolicy=p.VideoEncodingCpuConnectionHealthPolicy=p.VideoEncodingConnectionHealthPolicyName=void 0,p.AllHighestVideoBandwidthPolicy=m(f(0x1a174c132)).default,p.ApplicationMetadata=m(f(0x1f0ef6b1d)).default,p.AsyncScheduler=m(f(0x573f705d)).default,p.AttachMediaInputTask=m(f(0xd60c9fd8)).default,p.Attendee=m(f(0xd80a42d3)).default,p.AudioLogEvent=m(f(0x77ea1113)).default,p.AudioProfile=m(f(0x249fc81e5)).default,p.AudioVideoControllerState=m(f(0x1c48b14ba)).default,p.BackgroundBlurStrength=m(f(0x17991f3f2)).default,p.BackgroundBlurVideoFrameProcessor=m(f(0x20e5c1309)).default,p.BackgroundFilterVideoFrameProcessor=m(f(0x6e3c7bbd)).default,p.BackgroundReplacementVideoFrameProcessor=m(f(0x1c4b3e1a7)).default,p.BaseConnectionHealthPolicy=m(f(0xbc5a8cda)).default,p.BaseTask=m(f(0xcef35194)).default,p.BitrateParameters=m(f(0x6e3f6fb5)).default,p.CSPMonitor=m(f(0xd6e2cff)).default,p.CanvasVideoFrameBuffer=m(f(0x9ce0607d)).default,p.CheckAudioConnectivityFeedback=m(f(0x24376ea0b)).default,p.CheckAudioInputFeedback=m(f(0x1413581de)).default,p.CheckAudioOutputFeedback=m(f(0x19a603785)).default,p.CheckCameraResolutionFeedback=m(f(0x1498c149)).default,p.CheckContentShareConnectivityFeedback=m(f(0x9ebd6343)).default,p.CheckNetworkTCPConnectivityFeedback=m(f(0x19b975cfe)).default,p.CheckNetworkUDPConnectivityFeedback=m(f(0x914a193a)).default,p.CheckVideoConnectivityFeedback=m(f(0xe0deb82)).default,p.CheckVideoInputFeedback=m(f(0x101039145)).default,p.CleanRestartedSessionTask=m(f(0x11ee4612e)).default,p.CleanStoppedSessionTask=m(f(0x302be147)).default,p.ClientMetricReport=m(f(0xc9ba5f35)).default,p.ClientMetricReportDirection=m(f(0x138ccc65a)).default,p.ClientMetricReportMediaType=m(f(0x2fbf3af)).default,p.ClientVideoStreamReceivingReport=m(f(0x1979c5b3a)).default,p.ConnectionHealthData=m(f(0x73406699)).default,p.ConnectionHealthPolicyConfiguration=m(f(0x1a55f11d7)).default,p.ConsoleLogger=m(f(0xb3c65cf4)).default,p.ContentShareConstants=m(f(0x104cf28d8)).default,p.ContentShareMediaStreamBroker=m(f(0x11817b564)).default,p.CreatePeerConnectionTask=m(f(0x1cd1bb811)).default,p.CreateSDPTask=m(f(0xad28f8b8)).default,p.DataMessage=m(f(0x239b30f5)).default,p.DefaultActiveSpeakerDetector=m(f(0x173eb4b02)).default,p.DefaultActiveSpeakerPolicy=m(f(0x13c61502e)).default,p.DefaultAudioMixController=m(f(0x5cbe4bac)).default,p.DefaultAudioVideoController=m(f(0x10a965f7c)).default,p.DefaultAudioVideoFacade=m(f(0x12f2a530c)).default,p.DefaultBrowserBehavior=m(f(0x165009cb4)).default,p.DefaultContentShareController=m(f(0xd371be18)).default,p.DefaultDeviceController=m(f(0xba48c8f4)).default,p.DefaultDevicePixelRatioMonitor=m(f(0x16ee58416)).default,p.DefaultEventController=m(f(0x674df13c)).default,p.DefaultMediaDeviceFactory=m(f(0x2321cdcd0)).default,p.DefaultMeetingEventReporter=m(f(0x235df13ff)).default,p.DefaultMeetingReadinessChecker=m(f(0x149c6311c)).default,p.DefaultMeetingSession=m(f(0x25170ce4c)).default,p.DefaultMessagingSession=m(f(0x1b035f840)).default,p.DefaultModality=m(f(0x1a154f9b0)).default,p.DefaultPingPong=m(f(0x504c9394)).default,p.DefaultRealtimeController=m(f(0x102abe35c)).default,p.DefaultReconnectController=m(f(0x1b1a7866)).default,p.DefaultSessionStateController=m(f(0x1c843e818)).default,p.DefaultSigV4=m(f(0x1303d0742)).default,p.DefaultSignalingClient=m(f(0x24718f0be)).default,p.DefaultSimulcastUplinkPolicy=m(f(0x16364c8d1)).default,p.DefaultSimulcastUplinkPolicyForContentShare=m(f(0x111b8e0a0)).default,p.DefaultTransceiverController=m(f(0x93a0ab1c)).default,p.DefaultTranscriptionController=m(f(0x81e9befe)).default,p.DefaultUserAgentParser=m(f(0x6cbaf532)).default,p.DefaultVideoCaptureAndEncodeParameter=m(f(0xb40abe4c)).default,p.DefaultVideoElementResolutionMonitor=m(f(0xf6f7535a)).default,p.DefaultVideoFrameProcessorPipeline=m(f(0x1217e92b2)).default,p.DefaultVideoFrameProcessorTimer=m(f(0x1a23785fd)).default,p.DefaultVideoStreamIdSet=m(f(0xc30676e4)).default,p.DefaultVideoStreamIndex=m(f(0x243b05980)).default,p.DefaultVideoTile=m(f(0x4c923b82)).default,p.DefaultVideoTileController=m(f(0x198994116)).default,p.DefaultVideoTileFactory=m(f(0x168367eac)).default,p.DefaultVideoTransformDevice=m(f(0x18c01a5bb)).default,p.DefaultVolumeIndicatorAdapter=m(f(0x194492f4c)).default,p.DefaultWebSocketAdapter=m(f(0x5cfde354)).default,p.DevicePixelRatioWindowSource=m(f(0xc4db2fcf)).default,p.DeviceSelection=m(f(0x12584ea7b)).default,p.EventBufferConfiguration=m(f(0x75bc23e7)).default,p.EventIngestionConfiguration=m(f(0x1b3a9c949)).default,p.FinishGatheringICECandidatesTask=m(f(0x25372cf50)).default,p.FullJitterBackoff=m(f(6329639e3)).default,p.FullJitterBackoffFactory=m(f(0x1026e31ba)).default,p.FullJitterLimitedBackoff=m(f(0x415bfbb2)).default,p.GetUserMediaError=m(f(0x1f53ed78a)).default,p.GlobalMetricReport=m(f(0x22562ac09)).default,p.InMemoryJSONEventBuffer=m(f(0x27607683)).default,p.IntervalScheduler=m(f(0x7b80cc62)).default,p.JoinAndReceiveIndexTask=m(f(0x1c594fec7)).default,p.LeaveAndReceiveLeaveAckTask=m(f(0x20543e8f4)).default,p.ListenForVolumeIndicatorsTask=m(f(0x138bc4923)).default,p.Log=m(f(0x191ba1823)).default,p.LogLevel=m(f(0x1e476648b)).default,p.MediaDeviceProxyHandler=m(f(0x183adc8bf)).default,p.MeetingEventsClientConfiguration=m(f(0x1e8ca6e4)).default,p.MeetingFeatures=m(f(0x899d3924)).default,p.MeetingReadinessCheckerConfiguration=m(f(0xa82cad81)).default,p.MeetingSessionConfiguration=m(f(0x13b48f1ad)).default,p.MeetingSessionCredentials=m(f(0x16342f6ad)).default,p.MeetingSessionLifecycleEvent=m(f(0x1cf28fcb9)).default,p.MeetingSessionLifecycleEventCondition=m(f(0x1210847be)).default,p.MeetingSessionStatus=m(f(0xb28de657)).default,p.MeetingSessionStatusCode=m(f(0x234745d42)).default,p.MeetingSessionTURNCredentials=m(f(0x1736cf0a4)).default,p.MeetingSessionURLs=m(f(0xd5022a77)).default,p.MeetingSessionVideoAvailability=m(f(0x17310e8bb)).default,p.Message=m(f(0x143e5a9e5)).default,p.MessagingSessionConfiguration=m(f(0x51d90877)).default,p.ModelSpecBuilder=m(f(0xfc893d67)).default,p.MonitorTask=m(f(0x1f0d2ad73)).default,p.MultiLogger=m(f(0x2a7fe8bc)).default,p.NScaleVideoUplinkBandwidthPolicy=m(f(0xb231bce1)).default,p.NoOpAudioVideoController=m(f(0x233121a41)).default,p.NoOpDebugLogger=m(f(0x23cb0924a)).default,p.NoOpDeviceController=m(f(0x19e6a0f9b)).default,p.NoOpEventReporter=m(f(0xe23a89c1)).default,p.NoOpLogger=m(f(0x53f60ff7)).default,p.NoOpMediaStreamBroker=m(f(0x41c6ff55)).default,p.NoOpTask=m(f(0xb013a83d)).default,p.NoOpVideoElementFactory=m(f(0x62a0374d)).default,p.NoOpVideoFrameProcessor=m(f(0x23b2002bd)).default,p.NoVideoDownlinkBandwidthPolicy=m(f(0x1f64282a8)).default,p.NoVideoUplinkBandwidthPolicy=m(f(0x1a94aa22a)).default,p.NotFoundError=m(f(0x1db5bc494)).default,p.NotReadableError=m(f(0x1b486d07c)).default,p.OnceTask=m(f(0xba0e3d5c)).default,p.OpenSignalingConnectionTask=m(f(0x1f9377021)).default,p.OverconstrainedError=m(f(0xa4c520e9)).default,p.POSTLogger=m(f(0x1693bacd9)).default,p.ParallelGroupTask=m(f(0x1c97ddc23)).default,p.PermissionDeniedError=m(f(0xfb8fdb39)).default,p.PrefetchOn=m(f(0x22cfd1a2d)).default,p.PrefetchSortBy=m(f(0x1c2a9938d)).default,p.PromiseQueue=m(f(0x8f5563d8)).default,p.PromoteToPrimaryMeetingTask=m(f(0x1f71fad3b)).default,p.RealtimeAttendeePositionInFrame=m(f(0x151a585f0)).default,p.RealtimeState=m(f(0x485efac6)).default,p.RealtimeVolumeIndicator=m(f(0xf6b5b898)).default,p.ReceiveAudioInputTask=m(f(0x2429ed05e)).default,p.ReceiveRemoteVideoPauseResumeTask=m(f(0x18781162e)).default,p.ReceiveVideoInputTask=m(f(0x130a7607d)).default,p.ReceiveVideoStreamIndexTask=m(f(0x151ad6ab5)).default,p.ReconnectionHealthPolicy=m(f(0x938e8e62)).default,p.RedundantAudioEncoder=m(f(0x1a763535d)).default,p.RedundantAudioEncoderWorkerCode=m(f(0x11e4e5f0d)).default,p.RedundantAudioRecoveryMetricReport=m(f(0x250d201d4)).default,p.RunnableTask=m(f(0x4d761108)).default,p.SDP=m(f(0x1fa7d4829)).default,p.SDPCandidateType=m(f(0x19cb5e2ee)).default,p.SDPMediaSection=m(f(0xe8571b46)).default,p.SendAndReceiveDataMessagesTask=m(f(0x222af4e39)).default,p.SendingAudioFailureConnectionHealthPolicy=m(f(0x19f6220b7)).default,p.SerialGroupTask=m(f(0xc70eec36)).default,p.ServerSideNetworkAdaption=m(f(0x1e93e1412)).default,p.SessionStateControllerAction=m(f(0x195905627)).default,p.SessionStateControllerDeferPriority=m(f(0xb577390f)).default,p.SessionStateControllerState=m(f(0xd03588a6)).default,p.SessionStateControllerTransitionResult=m(f(0x14f60ed93)).default,p.SetLocalDescriptionTask=m(f(0x1fc5185a)).default,p.SetRemoteDescriptionTask=m(f(0x15fdb9011)).default,p.SignalingAndMetricsConnectionMonitor=m(f(0x7cabad69)).default,p.SignalingClientConnectionRequest=m(f(0xe105a372)).default,p.SignalingClientEvent=m(f(0x872e39a3)).default,p.SignalingClientEventType=m(f(0x16bec8feb)).default,p.SignalingClientJoin=m(f(0x22a5b38fd)).default,p.SignalingClientSubscribe=m(f(0x5fcce137)).default,p.SignalingClientVideoSubscriptionConfiguration=m(f(0xcb99c5a5)).default,p.SimulcastContentShareTransceiverController=m(f(0xdeeb6fe4)).default,p.SimulcastLayers=m(f(0x14216d675)).default,p.SimulcastTransceiverController=m(f(0x2293b1f8c)).default,p.SimulcastVideoStreamIndex=m(f(0x217dc1bb8)).default,p.SingleNodeAudioTransformDevice=m(f(0x215250f11)).default,p.StreamMetricReport=m(f(0x2e51c102)).default,p.SubscribeAndReceiveSubscribeAckTask=m(f(0x21d574c92)).default,p.TargetDisplaySize=m(f(0x555510c7)).default,p.TaskStatus=m(f(0x372fc7cb)).default,p.TimeoutScheduler=m(f(0x6ee73800)).default,p.TimeoutTask=m(f(0x1174c5f22)).default,p.Transcript=m(f(0x1121523e7)).default,p.TranscriptAlternative=m(f(0x424746be)).default,p.TranscriptEntity=m(f(0x42b6168)).default,p.TranscriptItem=m(f(0x42104fac)).default,p.TranscriptItemType=m(f(0x232d483ec)).default,p.TranscriptLanguageWithScore=m(f(0x10098a09)).default,p.TranscriptResult=m(f(0x1dc662042)).default,p.TranscriptionStatus=m(f(0x7ae7be1)).default,p.TranscriptionStatusType=m(f(0xb7217889)).default,p.TypeError=m(f(0x1055aac05)).default,p.UnusableAudioWarningConnectionHealthPolicy=m(f(0x1461f4056)).default,p.Versioning=m(f(0xaf1ae5b3)).default,p.VideoAdaptiveProbePolicy=m(f(0x15ad5180a)).default,p.VideoCodecCapability=m(f(0x17e3191d)).default,p.VideoEncodingConcurrentSendersHealthPolicy=m(f(0x109562310)).default,p.VideoEncodingConnectionHealthPolicyName=m(f(0x1cdcbf76c)).default,p.VideoEncodingCpuConnectionHealthPolicy=m(f(0x1bdf2cac3)).default,p.VideoEncodingFramerateConnectionHealthPolicy=m(f(0x225dfdbba)).default,p.VideoFxProcessor=m(f(0xfbd337fb)).default,p.VideoLogEvent=m(f(0x154fd3c86)).default,p.VideoOnlyTransceiverController=m(f(0x24fd8c738)).default,p.VideoPreference=m(f(0x78621d61)).default,p.VideoPreferences=m(f(0xfa5b698a)).default,p.VideoPriorityBasedPolicy=m(f(0x1341fb415)).default,p.VideoPriorityBasedPolicyConfig=m(f(0x74de7c3b)).default,p.VideoQualityAdaptationPreference=m(f(0x3350552d)).default,p.VideoQualitySettings=m(f(0x3b3f192c)).default,p.VideoSource=m(f(0x15db02d39)).default,p.VideoStreamDescription=m(f(0x2187d54cb)).default,p.VideoTileState=m(f(0x131f83592)).default,p.VoiceFocusDeviceTransformer=m(f(0x21f91d24)).default,p.VoiceFocusTransformDevice=m(f(0xd91ec153)).default,p.WaitForAttendeePresenceTask=m(f(0x24564ad46)).default,p.WebSocketReadyState=m(f(0x165cc79a4)).default,p.ZLIBTextCompressor=m(f(0xb97f5b8b)).default;let _=f(0xfa5b698a);Object.defineProperty(p,"MutableVideoPreferences",{enumerable:!0,get:function(){return _.MutableVideoPreferences}});let w=f(0xb529932d);Object.defineProperty(p,"Some",{enumerable:!0,get:function(){return w.Some}}),Object.defineProperty(p,"None",{enumerable:!0,get:function(){return w.None}}),Object.defineProperty(p,"Maybe",{enumerable:!0,get:function(){return w.Maybe}});let I=f(0x97143bf9);Object.defineProperty(p,"isAudioTransformDevice",{enumerable:!0,get:function(){return I.isAudioTransformDevice}});let k=f(0x1f56347ad);Object.defineProperty(p,"isDestroyable",{enumerable:!0,get:function(){return k.isDestroyable}});let M=f(0x20a4e5a2e);Object.defineProperty(p,"isVideoTransformDevice",{enumerable:!0,get:function(){return M.isVideoTransformDevice}})},0xb3c65cf4:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b));p.default=class{constructor(o,p=_.default.WARN){this.name=o,this.level=p}info(o){this.log(_.default.INFO,o)}warn(o){this.log(_.default.WARN,o)}error(o){this.log(_.default.ERROR,o)}debug(o){_.default.DEBUG<this.level||("string"==typeof o?this.log(_.default.DEBUG,o):o?this.log(_.default.DEBUG,o()):this.log(_.default.DEBUG,""+o))}setLogLevel(o){this.level=o}getLogLevel(){return this.level}log(o,p){if(o<this.level)return;let f=new Date().toISOString(),m=`${f} [${_.default[o]}] ${this.name} - ${p}`;switch(o){case _.default.ERROR:console.error(m);break;case _.default.WARN:console.warn(m);break;case _.default.DEBUG:console.debug(m.replace(/\\r\\n/g,`
`));break;case _.default.INFO:console.info(m)}}}},0x191ba1823:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.sequenceNumber=o,this.message=p,this.timestampMs=f,this.logLevel=m}}},0x1e476648b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.LogLevel=void 0,(m=f=p.LogLevel||(p.LogLevel={}))[m.DEBUG=0]="DEBUG",m[m.INFO=1]="INFO",m[m.WARN=2]="WARN",m[m.ERROR=3]="ERROR",m[m.OFF=4]="OFF",p.default=f},0x2a7fe8bc:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b));p.default=class{constructor(...o){this._loggers=o}info(o){for(let p of this._loggers)p.info(o)}warn(o){for(let p of this._loggers)p.warn(o)}error(o){for(let p of this._loggers)p.error(o)}debug(o){let p,f;for(let m of(f="string"==typeof o?o:o?()=>(p||(p=o()),p):""+o,this._loggers))m.debug(f)}setLogLevel(o){for(let p of this._loggers)p.setLogLevel(o)}getLogLevel(){for(let o of this._loggers)return o.getLogLevel();return _.default.OFF}}},0x23cb0924a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b)),w=m(f(0x53f60ff7));p.default=class extends w.default{constructor(){super(_.default.DEBUG)}}},0x53f60ff7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b));p.default=class{constructor(o=_.default.OFF){this.level=o}info(o){}warn(o){}error(o){}debug(o){_.default.DEBUG<this.level||"string"!=typeof o&&o()}setLogLevel(o){this.level=o}getLogLevel(){return this.level}}},0x1693bacd9:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x7b80cc62)),I=_(f(0x191ba1823)),k=_(f(0x1e476648b)),M=class POSTLogger{constructor(o){this.logCapture=[],this.lock=!1,this.sequenceNumber=0;const{url:p,batchSize:f=POSTLogger.BATCH_SIZE,intervalMs:m=POSTLogger.INTERVAL_MS,logLevel:_=k.default.WARN,metadata:w,headers:I}=o;this.url=p,this.batchSize=f,this.intervalMs=m,this.logLevel=_,this.metadata=w,this.headers=I,this.start(),this.eventListener=()=>{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in f.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in f.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(o){k.default.DEBUG<this.logLevel||("string"==typeof o?this.log(k.default.DEBUG,o):o?this.log(k.default.DEBUG,o()):this.log(k.default.DEBUG,""+o))}info(o){this.log(k.default.INFO,o)}warn(o){this.log(k.default.WARN,o)}error(o){this.log(k.default.ERROR,o)}setLogLevel(o){this.logLevel=o}getLogLevel(){return this.logLevel}getLogCaptureSize(){return this.logCapture.length}start(){this.addEventListener(),this.intervalScheduler=new w.default(this.intervalMs),this.intervalScheduler.start(()=>m(this,void 0,void 0,function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;let o=this.logCapture.slice(0,this.batchSize),p=this.makeRequestBody(o);try{let f=yield fetch(this.url,Object.assign({method:"POST",body:p},this.headers?{headers:this.headers}:{}));200===f.status&&(this.logCapture=this.logCapture.slice(o.length))}catch(o){console.warn("[POSTLogger] "+o.message)}finally{this.lock=!1}}))}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.removeEventListener();let p=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,p)}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.metadata=void 0,this.headers=void 0,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.batchSize=0,this.intervalMs=0,this.url=void 0})}makeRequestBody(o){return JSON.stringify(Object.assign(Object.assign({},this.metadata),{logs:o}))}log(o,p){if(o<this.logLevel)return;let f=Date.now();this.logCapture.push(new I.default(this.sequenceNumber,p,f,k.default[o])),this.sequenceNumber+=1}};p.default=M,M.BATCH_SIZE=85,M.INTERVAL_MS=2e3},0x2321cdcd0:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x183adc8bf));p.default=class{constructor(){this.isMediaDevicesSupported="u">typeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new _.default);throw Error("navigator.mediaDevices is not supported")}}},0x183adc8bf:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x573f705d)),I=_(f(0x7b80cc62)),k=class MediaDeviceProxyHandler{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(o,p,f)=>{if(!Reflect.has(o,p))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===p)return this.patchAddEventListener(o,p,f);else if("removeEventListener"===p)return this.patchRemoveEventListener(o,p,f)}let m=Reflect.get(o,p,f);return"function"==typeof m?m.bind(o):m},this.patchAddEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.add(f),this.scheduler||(this.scheduler=new I.default(MediaDeviceProxyHandler.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.delete(f),0===this.deviceChangeListeners.size&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null)}},this.pollDeviceLists=()=>m(this,void 0,void 0,function*(){let o=yield this.sortedDeviceList();this.devices&&(o.length!==this.devices.length||o.some((o,p)=>o.deviceId!==this.devices[p].deviceId))&&this.handleDeviceChangeEvent(),this.devices=o})}sortedDeviceList(){return m(this,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort((o,p)=>o.deviceId<p.deviceId?1:o.deviceId>p.deviceId?-1:0)})}handleDeviceChangeEvent(){for(let o of this.deviceChangeListeners)w.default.nextTick(()=>{if(this.deviceChangeListeners.has(o)){let p=new Event("devicechange");"function"==typeof o?o(p):o.handleEvent(p)}})}};p.default=k,k.INTERVAL_MS=1e3},0x41c6ff55:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(o){return Promise.reject()}muteLocalAudioInputStream(){}unmuteLocalAudioInputStream(){}addMediaStreamBrokerObserver(o){}removeMediaStreamBrokerObserver(o){}}},0x24376ea0b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioConnectivityFeedback=void 0,(m=f=p.CheckAudioConnectivityFeedback||(p.CheckAudioConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.AudioInputRequestFailed=1]="AudioInputRequestFailed",m[m.AudioInputPermissionDenied=2]="AudioInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.AudioNotReceived=4]="AudioNotReceived",p.default=f},0x1413581de:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioInputFeedback=void 0,(m=f=p.CheckAudioInputFeedback||(p.CheckAudioInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0x19a603785:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioOutputFeedback=void 0,(m=f=p.CheckAudioOutputFeedback||(p.CheckAudioOutputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",p.default=f},0x1498c149:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckCameraResolutionFeedback=void 0,(m=f=p.CheckCameraResolutionFeedback||(p.CheckCameraResolutionFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.ResolutionNotSupported=2]="ResolutionNotSupported",m[m.PermissionDenied=3]="PermissionDenied",p.default=f},0x9ebd6343:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckContentShareConnectivityFeedback=void 0,(m=f=p.CheckContentShareConnectivityFeedback||(p.CheckContentShareConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",m[m.TimedOut=3]="TimedOut",m[m.ConnectionFailed=4]="ConnectionFailed",p.default=f},0x19b975cfe:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkTCPConnectivityFeedback=void 0,(m=f=p.CheckNetworkTCPConnectivityFeedback||(p.CheckNetworkTCPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0x914a193a:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkUDPConnectivityFeedback=void 0,(m=f=p.CheckNetworkUDPConnectivityFeedback||(p.CheckNetworkUDPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0xe0deb82:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoConnectivityFeedback=void 0,(m=f=p.CheckVideoConnectivityFeedback||(p.CheckVideoConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.VideoInputRequestFailed=1]="VideoInputRequestFailed",m[m.VideoInputPermissionDenied=2]="VideoInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.VideoNotSent=4]="VideoNotSent",p.default=f},0x101039145:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoInputFeedback=void 0,(m=f=p.CheckVideoInputFeedback||(p.CheckVideoInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0x149c6311c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x5cbe4bac)),I=_(f(0x165009cb4)),k=_(f(0xba48c8f4)),M=_(f(0xfb8fdb39)),x=_(f(0xcef35194)),O=_(f(0x1174c5f22)),L=_(f(0x24376ea0b)),B=_(f(0x1413581de)),U=_(f(0x19a603785)),$=_(f(0x1498c149)),q=_(f(0x9ebd6343)),Z=_(f(0x19b975cfe)),ee=_(f(0x914a193a)),et=_(f(0xe0deb82)),ei=_(f(0x101039145)),er=_(f(0xa82cad81));p.default=class DefaultMeetingReadinessChecker{constructor(o,p,f=new er.default){this.logger=o,this.meetingSession=p,this.configuration=f,this.browserBehavior=new I.default}static delay(o){return m(this,void 0,void 0,function*(){return new Promise(p=>setTimeout(p,o))})}checkAudioInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(o),yield this.meetingSession.audioVideo.stopAudioInput(),B.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${o}`),o instanceof M.default)return B.default.PermissionDenied;return B.default.Failed}})}checkAudioOutput(o,p,f=null){return m(this,void 0,void 0,function*(){try{let m=o?k.default.getIntrinsicDeviceId(o):"";if(yield this.playTone(m,this.configuration.audioOutputFrequency,f),yield p())return U.default.Succeeded;return U.default.Failed}catch(o){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${o}`),U.default.Failed}finally{yield this.stopTone()}})}playTone(o,p,f){return m(this,void 0,void 0,function*(){let m=this.configuration.audioOutputGain;this.oscillatorNode&&(yield this.stopTone()),this.audioContext=k.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=p,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);let _=this.audioContext.currentTime+.1;this.gainNode.gain.setValueAtTime(0,_),this.gainNode.gain.linearRampToValueAtTime(m,_+.1),this.oscillatorNode.start();let I=new w.default(this.logger),M=f||new Audio,x=this.destinationStream.stream;this.audioElement=M;try{this.browserBehavior.supportsSetSinkId()&&(yield I.bindAudioDevice({deviceId:o}))}catch(o){this.logger.error(`Failed to bind audio device: ${o}`)}try{yield I.bindAudioElement(M)}catch(o){this.logger.error(`Failed to bind audio element: ${o}`)}yield I.bindAudioStream(x)})}stopTone(){return m(this,void 0,void 0,function*(){if(!this.audioContext||!this.gainNode||!this.oscillatorNode||!this.destinationStream)return;let cleanup=()=>{this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null),this.oscillatorNode&&this.gainNode&&this.oscillatorNode.disconnect(this.gainNode),this.gainNode&&this.destinationStream&&this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null,this.audioElement=null},o=new Promise(o=>{this.oscillatorNode.addEventListener("ended",()=>{cleanup(),o()},{once:!0})}),p=this.configuration.audioOutputGain,f=this.audioContext.currentTime;this.gainNode.gain.setValueAtTime(p,f),this.gainNode.gain.linearRampToValueAtTime(0,f+.1),this.oscillatorNode.stop(f+.1+.1),yield o})}checkVideoInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(o),yield this.meetingSession.audioVideo.stopVideoInput(),ei.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Video check failed with error ${o}`),o instanceof M.default)return ei.default.PermissionDenied;return ei.default.Failed}})}checkCameraResolution(o,p,f){return m(this,void 0,void 0,function*(){let m;try{let _=k.default.getIntrinsicDeviceId(o),w={video:this.calculateVideoConstraint(_,p,f)};m=yield navigator.mediaDevices.getUserMedia(w)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${p} height ${f} failed with error ${o}`),o&&"OverconstrainedError"===o.name)return $.default.ResolutionNotSupported;if(o&&"NotAllowedError"===o.name)return $.default.PermissionDenied;return $.default.Failed}finally{m&&m.getTracks().forEach(function(o){o.stop()})}return $.default.Succeeded})}calculateVideoConstraint(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(p,f),_={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(_.deviceId=o,_.width=p,_.height=f):(_.deviceId={exact:o},_.width={exact:m[0]},_.height={exact:m[1]}),_}checkContentShareConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f=!1,_={contentShareDidStart:()=>{p=!0}},w={audioVideoDidStart:()=>{f=!0}};try{if(this.meetingSession.audioVideo.addObserver(w),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(_),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(o),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f&&p})),!f)return q.default.ConnectionFailed;return yield this.stopMeeting(),p?q.default.Succeeded:q.default.TimedOut}catch(o){if(this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${o}`),"NotAllowedError"===o.name)return q.default.PermissionDenied;return q.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(w),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(_)}})}checkAudioConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f={packetsReceived:0},_=this.meetingSession.audioVideo,w={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"inbound-rtp"===o.type&&("audio"===o.mediaType||"audio"===o.kind)&&(f.packetsReceived=o.packetsReceived)})}},attendeePresenceHandler=(o,f,m,_)=>{o===this.meetingSession.configuration.credentials.attendeeId&&f&&(p=!0)};try{yield _.startAudioInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${o}`),o instanceof M.default)return L.default.AudioInputPermissionDenied;return L.default.AudioInputRequestFailed}return(_.realtimeSubscribeToAttendeeIdPresence(attendeePresenceHandler),_.addObserver(w),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return this.isAudioConnectionSuccessful(p,f)})),_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),this.isAudioConnectionSuccessful(p,f)?L.default.Succeeded:L.default.AudioNotReceived):(_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.meetingSession.audioVideo.stopAudioInput(),L.default.ConnectionFailed)})}checkVideoConnectivity(o){return m(this,void 0,void 0,function*(){let p=this.meetingSession.audioVideo,f=0,_={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"outbound-rtp"===o.type&&("video"===o.mediaType||"video"===o.kind)&&(f=o.packetsSent)})}};try{yield p.startVideoInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${o}`),o instanceof M.default)return et.default.VideoInputPermissionDenied;return et.default.VideoInputRequestFailed}return(p.addObserver(_),yield this.startMeeting())?(p.startLocalVideoTile(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f>0})),yield p.stopVideoInput(),yield this.stopMeeting(),p.removeObserver(_),f<=0)?et.default.VideoNotSent:et.default.Succeeded:et.default.ConnectionFailed})}checkNetworkUDPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),ee.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=tcp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?ee.default.Succeeded:ee.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,ee.default.ConnectionFailed)})}checkNetworkTCPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),Z.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=udp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?Z.default.Succeeded:Z.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,Z.default.ConnectionFailed)})}startMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStart:()=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.start(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}stopMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStop:p=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.stop(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}executeTimeoutTask(o){return m(this,void 0,void 0,function*(){let p=!1,f=class extends x.default{constructor(o,p){super(o),this.waitDurationMs=p,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return m(this,void 0,void 0,function*(){for(;!this.isCancelled;){if(yield o()){p=!0;break}yield DefaultMeetingReadinessChecker.delay(this.waitDurationMs)}})}},_=new O.default(this.logger,new f(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield _.run(),p})}isAudioConnectionSuccessful(o,p){return o&&p.packetsReceived>0}}},0xa82cad81:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3,this.audioOutputFrequency=440,this.audioOutputGain=.1}}},0x25170ce4c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x10a965f7c)),I=_(f(0x12f2a530c)),k=_(f(6329639e3)),M=_(f(0x165009cb4)),x=_(f(0x11817b564)),O=_(f(0xd371be18)),L=_(f(0xd6e2cff)),B=f(0x1f56347ad),U=_(f(0x674df13c)),$=_(f(0x1b1a7866)),q=_(f(0x5cfde354));p.default=class{constructor(o,p,f,m){this._eventController=m,this._configuration=o,this._logger=p,this.checkBrowserSupportAndFeatureConfiguration(),L.default.addLogger(this._logger),L.default.register(),this._eventController||(this._eventController=new U.default(o,p)),f.eventController||(f.eventController=this.eventController),this.audioVideoController=new w.default(this._configuration,this._logger,new q.default(this._logger),f,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=f,this.logger.info(`MeetingFeatures: ${JSON.stringify(o.meetingFeatures)}`);const _=new x.default(this._logger);this.contentShareController=new O.default(_,new w.default(O.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new q.default(this._logger),_,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new I.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return m(this,void 0,void 0,function*(){B.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),B.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),B.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),L.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventController=void 0})}checkBrowserSupportAndFeatureConfiguration(){let o=new M.default,p=`${o.name()} ${o.majorVersion()} (${o.version()})`;if(this.logger.info(`browser is ${p}`),o.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${o.supportString()}.`),this._configuration.videoUplinkBandwidthPolicy)if(this.isSimulcastUplinkPolicy(this._configuration.videoUplinkBandwidthPolicy)){if(!o.hasChromiumWebRTC())throw Error("Simulcast is only supported on Chromium-based browsers");this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0}else this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1;this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(o.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${o.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast is only supported on Chromium-based browsers")),this._configuration.enableSVC&&(this._configuration.enableSVC=!1,this.logger.info("SVC is not successfully enabled since simulcast is enabled"))),this._configuration.enableSVC&&!o.supportsScalableVideoCoding()&&(this._configuration.enableSVC=!1,this.logger.info("SVC is only supported on Chromium-based browsers with version 111 or above"))}isSimulcastUplinkPolicy(o){return!!(o&&o.addObserver)}}},0x899d3924:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x3b3f192c));p.default=class MeetingFeatures{constructor(o=_.default.VideoResolutionHD,p=_.default.VideoResolutionFHD){this.videoMaxResolution=o,this.contentMaxResolution=p}clone(){return new MeetingFeatures(this.videoMaxResolution,this.contentMaxResolution)}}},0x13b48f1ad:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1a55f11d7)),w=m(f(0x3b3f192c)),I=f(0x149d24991),k=m(f(0x899d3924)),M=m(f(0x16342f6ad)),x=m(f(0xd5022a77));p.default=class{constructor(o,p){var f,m;if(this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new _.default,this.reconnectTimeoutMs=12e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1e3,this.reconnectLongBackOffMs=5e3,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.enableSVC=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1,this.meetingFeatures=new k.default,o){(o=I.toLowerCasePropertyNames(o)).meeting&&(o=o.meeting),this.meetingId=o.meetingid,this.externalMeetingId=o.externalmeetingid,this.urls=new x.default,this.urls.audioHostURL=o.mediaplacement.audiohosturl,this.urls.signalingURL=o.mediaplacement.signalingurl,this.urls.turnControlURL=o.mediaplacement.turncontrolurl,o.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=o.mediaplacement.eventingestionurl);const parseVideoResolution=(o,p)=>{switch(o){case"None":return w.default.VideoDisabled;case"HD":return w.default.VideoResolutionHD;case"FHD":return w.default.VideoResolutionFHD;case"UHD":return w.default.VideoResolutionUHD;default:return p}};if((null==(f=o.meetingfeatures)?void 0:f.video)!==void 0||(null==(m=o.meetingfeatures)?void 0:m.content)!==void 0){const p=void 0===o.meetingfeatures.video?"HD":o.meetingfeatures.video.maxresolution,f=void 0===o.meetingfeatures.content?"FHD":o.meetingfeatures.content.maxresolution;this.meetingFeatures=new k.default(parseVideoResolution(p,w.default.VideoResolutionHD),parseVideoResolution(f,w.default.VideoResolutionFHD))}}p&&((p=I.toLowerCasePropertyNames(p)).attendee&&(p=p.attendee),this.credentials=new M.default,this.credentials.attendeeId=p.attendeeid,this.credentials.externalUserId=p.externaluserid,this.credentials.joinToken=p.jointoken)}}},0x16342f6ad:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:"<redacted>"}}}},0x1cf28fcb9:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEvent=void 0,(m=f=p.MeetingSessionLifecycleEvent||(p.MeetingSessionLifecycleEvent={}))[m.Connecting=0]="Connecting",m[m.Started=1]="Started",m[m.Stopped=2]="Stopped",p.default=f},0x1210847be:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEventCondition=void 0,(m=f=p.MeetingSessionLifecycleEventCondition||(p.MeetingSessionLifecycleEventCondition={}))[m.ConnectingNew=0]="ConnectingNew",m[m.ReconnectingExisting=1]="ReconnectingExisting",m[m.StartedNew=2]="StartedNew",m[m.StartedExisting=3]="StartedExisting",m[m.StartedAfterReconnect=4]="StartedAfterReconnect",m[m.StoppedCleanly=5]="StoppedCleanly",m[m.StoppedWithFailure=6]="StoppedWithFailure",p.default=f},0xb28de657:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0xe88b24d9),w=m(f(0x234745d42));p.default=class MeetingSessionStatus{constructor(o){this._statusCode=o}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:case w.default.VideoCallAtSourceCapacity:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.ICEGatheringTimeoutWorkaround:case w.default.ConnectionHealthReconnect:case w.default.RealtimeApiFailed:case w.default.TaskFailed:case w.default.NoAttendeePresent:case w.default.SignalingChannelClosedUnexpectedly:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case w.default.Left:case w.default.AudioJoinedFromAnotherDevice:case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.MeetingEnded:case w.default.AudioDisconnected:case w.default.TURNCredentialsForbidden:case w.default.SignalingBadRequest:case w.default.SignalingRequestFailed:case w.default.VideoCallAtSourceCapacity:case w.default.RealtimeApiFailed:case w.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.ICEGatheringTimeoutWorkaround:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.RealtimeApiFailed:case w.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case w.default.OK:return"Everything is OK so far.";case w.default.Left:return"The attendee left the meeting.";case w.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case w.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case w.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case w.default.MeetingEnded:return"The meeting ended.";case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:return"The audio connection failed.";case w.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case w.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:return"The signaling connection failed.";case w.default.ICEGatheringTimeoutWorkaround:return"Gathering ICE candidates timed out. In Chrome, this might indicate that the browser is in a bad state after reconnecting to VPN.";case w.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case w.default.RealtimeApiFailed:return"The real-time API failed. This status code might indicate that the callback you passed to the real-time API threw an exception.";case w.default.TaskFailed:return"The connection failed. See the error message for more details.";case w.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case w.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case w.default.NoAttendeePresent:return"The attendee was not present.";case w.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case w.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";case w.default.AudioVideoDisconnectedWhilePromoted:return"The client disconnected while promoted, which will automatically demote. The attendee must promote again to participate.";case w.default.AudioDisconnectAudio:return"The audio connection failed.";case w.default.SignalingChannelClosedUnexpectedly:return"The signaling channel was closed unexpectedly. This may be due to a network change or backend detected failure.";default:{let o=this._statusCode;throw Error(`Unhandled case: ${o}`)}}}static fromSignalFrame(o){return o.error&&o.error.status?this.fromSignalingStatus(o.error.status):o.type===_.SdkSignalFrame.Type.AUDIO_STATUS?o.audioStatus?this.fromAudioStatus(o.audioStatus.audioStatus):new MeetingSessionStatus(w.default.SignalingRequestFailed):o.type===_.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new MeetingSessionStatus(w.default.AudioVideoWasRemovedFromPrimaryMeeting):new MeetingSessionStatus(w.default.OK)}static fromAudioStatus(o){switch(o){case 200:return new MeetingSessionStatus(w.default.OK);case 301:return new MeetingSessionStatus(w.default.AudioJoinedFromAnotherDevice);case 302:return new MeetingSessionStatus(w.default.AudioDisconnectAudio);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);case 410:return new MeetingSessionStatus(w.default.MeetingEnded);case 411:return new MeetingSessionStatus(w.default.AudioAttendeeRemoved);case 500:return new MeetingSessionStatus(w.default.AudioInternalServerError);case 503:return new MeetingSessionStatus(w.default.AudioServiceUnavailable);default:if(2===Math.floor(o/100))return new MeetingSessionStatus(w.default.OK);return new MeetingSessionStatus(w.default.AudioDisconnected)}}static fromSignalingStatus(o){switch(o){case 206:return new MeetingSessionStatus(w.default.VideoCallSwitchToViewOnly);case 509:return new MeetingSessionStatus(w.default.VideoCallAtSourceCapacity);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);default:switch(Math.floor(o/100)){case 2:return new MeetingSessionStatus(w.default.OK);case 4:return new MeetingSessionStatus(w.default.SignalingBadRequest);case 5:return new MeetingSessionStatus(w.default.SignalingInternalServerError);default:return new MeetingSessionStatus(w.default.SignalingRequestFailed)}}}}},0x234745d42:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionStatusCode=void 0,(m=f=p.MeetingSessionStatusCode||(p.MeetingSessionStatusCode={}))[m.OK=0]="OK",m[m.Left=1]="Left",m[m.AudioJoinedFromAnotherDevice=2]="AudioJoinedFromAnotherDevice",m[m.AudioAuthenticationRejected=3]="AudioAuthenticationRejected",m[m.AudioCallAtCapacity=4]="AudioCallAtCapacity",m[m.MeetingEnded=5]="MeetingEnded",m[m.AudioInternalServerError=6]="AudioInternalServerError",m[m.AudioServiceUnavailable=7]="AudioServiceUnavailable",m[m.AudioDisconnected=8]="AudioDisconnected",m[m.VideoCallSwitchToViewOnly=9]="VideoCallSwitchToViewOnly",m[m.VideoCallAtSourceCapacity=10]="VideoCallAtSourceCapacity",m[m.SignalingBadRequest=11]="SignalingBadRequest",m[m.SignalingInternalServerError=12]="SignalingInternalServerError",m[m.SignalingRequestFailed=13]="SignalingRequestFailed",m[m.SignalingChannelClosedUnexpectedly=14]="SignalingChannelClosedUnexpectedly",m[m.ICEGatheringTimeoutWorkaround=15]="ICEGatheringTimeoutWorkaround",m[m.ConnectionHealthReconnect=16]="ConnectionHealthReconnect",m[m.RealtimeApiFailed=17]="RealtimeApiFailed",m[m.TaskFailed=18]="TaskFailed",m[m.IncompatibleSDP=19]="IncompatibleSDP",m[m.TURNCredentialsForbidden=20]="TURNCredentialsForbidden",m[m.NoAttendeePresent=21]="NoAttendeePresent",m[m.AudioAttendeeRemoved=22]="AudioAttendeeRemoved",m[m.AudioVideoWasRemovedFromPrimaryMeeting=23]="AudioVideoWasRemovedFromPrimaryMeeting",m[m.AudioVideoDisconnectedWhilePromoted=24]="AudioVideoDisconnectedWhilePromoted",m[m.AudioDisconnectAudio=25]="AudioDisconnectAudio",p.default=f},0x1736cf0a4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},0xd5022a77:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this._audioHostURL=null,this._signalingURL=null,this._turnControlURL=null,this._eventIngestionURL=null,this.urlRewriter=o=>o,this.urlRewriterMulti=null}get audioHostURL(){return this.urlRewriter(this._audioHostURL)}set audioHostURL(o){this._audioHostURL=o}get signalingURL(){return this.urlRewriter(this._signalingURL)}set signalingURL(o){this._signalingURL=o}get turnControlURL(){return this.urlRewriter(this._turnControlURL)}set turnControlURL(o){this._turnControlURL=o}get eventIngestionURL(){return this.urlRewriter(this._eventIngestionURL)}set eventIngestionURL(o){this._eventIngestionURL=o}}},0x17310e8bb:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class MeetingSessionVideoAvailability{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(o){return this.remoteVideoAvailable===o.remoteVideoAvailable&&this.canStartLocalVideo===o.canStartLocalVideo}clone(){let o=new MeetingSessionVideoAvailability;return o.remoteVideoAvailable=this.remoteVideoAvailable,o.canStartLocalVideo=this.canStartLocalVideo,o}}},0x143e5a9e5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.type=o,this.headers=p,this.payload=f}}},0x1b035f840:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x510b1d7f),I=_(f(6329639e3)),k=_(f(0xd6e2cff)),M=_(f(0x143e5a9e5)),x=_(f(0x1b1a7866)),O=_(f(0x573f705d)),L=_(f(0x1303d0742)),B=_(f(0x5cfde354)),U=_(f(0x165cc79a4)),$=_(f(0x22cfd1a2d));p.default=class{constructor(o,p,f,m,_){this.configuration=o,this.logger=p,this.webSocket=f,this.reconnectController=m,this.sigV4=_,this.observerQueue=new Set,this.webSocket||(this.webSocket=new B.default(this.logger)),this.reconnectController||(this.reconnectController=new x.default(o.reconnectTimeoutMs,new I.default(o.reconnectFixedWaitMs,o.reconnectShortBackoffMs,o.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new L.default(this.configuration.chimeClient)),k.default.addLogger(this.logger),k.default.register(),this.preBootstrapMessages=[]}addObserver(o){this.logger.info("adding messaging observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing messaging observer"),this.observerQueue.delete(o)}start(){return m(this,void 0,void 0,function*(){this.isClosed()?yield this.startConnecting(!1):this.logger.info("messaging session already started")})}stop(){this.isClosed()?this.logger.info("no existing messaging session needs closing"):(this.isClosing=!0,this.webSocket.close(),k.default.removeLogger(this.logger))}forEachObserver(o){for(let p of this.observerQueue)O.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.openEventHandler()}),this.webSocket.addEventListener("message",o=>{this.receiveMessageHandler(o.data)}),this.webSocket.addEventListener("close",o=>{this.closeEventHandler(o)}),this.webSocket.addEventListener("error",()=>{this.logger.error("WebSocket error")})}startConnecting(o){return m(this,void 0,void 0,function*(){return yield this.startConnectingInternal(o),yield new Promise((o,p)=>{this.bootstrapResolved=o,this.bootstrapRejected=p})})}startConnectingInternal(o){var p;return m(this,void 0,void 0,function*(){let f=this.configuration.endpointUrl;if(o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),o||void 0===f)try{if(this.configuration.chimeClient.getMessagingSessionEndpoint instanceof Function){let o=yield this.configuration.chimeClient.getMessagingSessionEndpoint();f=(null==(p=o.Endpoint)?void 0:p.Url)?o.Endpoint.Url:(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}else f=(yield this.configuration.chimeClient.send(new w.GetMessagingSessionEndpointCommand({}))).Endpoint.Url;this.logger.debug(`Messaging endpoint resolved to: ${f}`)}catch(p){this.logger.error(`Messaging Session failed to resolve endpoint: ${p}`);let o=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to get messaging session endpoint URL",bubbles:!1});this.closeEventHandler(o);return}let m=yield this.prepareWebSocketUrl(f);this.logger.info(`opening connection to ${m}`),o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(m,[],!0),this.forEachObserver(p=>{p.messagingSessionDidStartConnecting&&p.messagingSessionDidStartConnecting(o)}),this.setUpEventListeners()})}prepareWebSocketUrl(o){return m(this,void 0,void 0,function*(){let p=new Map;return p.set("userArn",[this.configuration.userArn]),p.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===$.default.Connect&&p.set("prefetch-on",[$.default.Connect]),this.configuration.prefetchSortBy&&p.set("prefetch-sort-by",[this.configuration.prefetchSortBy]),yield this.sigV4.signURL("GET","wss","chime",o,"/connect","",p)})}isClosed(){return this.webSocket.readyState()===U.default.None||this.webSocket.readyState()===U.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(o){try{let p=JSON.parse(o),f=p.Headers["x-amz-chime-event-type"],m=new M.default(f,p.Headers,p.Payload||null);if(this.isSessionEstablished||"SESSION_ESTABLISHED"!==f){if(!this.isSessionEstablished)return void this.preBootstrapMessages.push(m)}else{this.forEachObserver(o=>{o.messagingSessionDidStart&&o.messagingSessionDidStart()}),this.bootstrapResolved(),this.isSessionEstablished=!0;let o=this.preBootstrapMessages.length;for(let p=0;p<o;p++){let o=this.preBootstrapMessages.shift();this.forEachObserver(p=>{this.sendMessageToObserver(p,o)})}}this.forEachObserver(o=>{this.sendMessageToObserver(o,m)})}catch(o){this.logger.error(`Messaging parsing failed: ${o}`)}}sendMessageToObserver(o,p){o.messagingSessionDidReceiveMessage&&o.messagingSessionDidReceiveMessage(p)}retryConnection(){return this.reconnectController.retryWithBackoff(()=>m(this,void 0,void 0,function*(){yield this.startConnecting(!0)}),null)}closeEventHandler(o){this.logger.info(`WebSocket close: ${o.code} ${o.reason}`),4999!==o.code&&this.webSocket.destroy(),!this.isClosing&&this.canReconnect(o.code)&&this.retryConnection()||(this.isClosing=!1,this.isSessionEstablished?this.forEachObserver(p=>{p.messagingSessionDidStop&&p.messagingSessionDidStop(o)}):this.bootstrapRejected(o))}canReconnect(o){return 1001===o||1006===o||o>=1011&&o<=1014||o>4e3&&4002!==o&&4003!==o&&4401!==o}}},0x51d90877:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x149d24991);p.default=class{constructor(o,p,f,m){this.userArn=o,this.messagingSessionId=p,this.endpointUrl=f,this.chimeClient=m,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.prefetchOn=void 0,this.prefetchSortBy=void 0,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){let o=new Uint32Array(1);return m.getRandomValues(o),o[0].toString()}}},0x22cfd1a2d:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Connect="connect",p.default=f},0x1c2a9938d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).Unread="unread",m.LastMessageTimestamp="last-message-timestamp",p.default=f},0x1a154f9b0:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x104cf28d8)),w=class DefaultModality{constructor(o){this._id=o}id(){return this._id}base(){return this._id?this._id.split(DefaultModality.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";let o=this._id.split(DefaultModality.MODALITY_SEPARATOR);return 2===o.length?o[1]:""}hasModality(o){return""!==o&&this.modality()===o}withModality(o){let p=new DefaultModality(this.base()+DefaultModality.MODALITY_SEPARATOR+o);return""===o||""===this.base()||new DefaultModality(p._id).modality()!==o?new DefaultModality(this.base()):p}};p.default=w,w.MODALITY_SEPARATOR=_.default.Modality[0],w.MODALITY_CONTENT=_.default.Modality.substring(1)},0x504c9394:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x573f705d)),w=m(f(0x7b80cc62)),I=m(f(0x16bec8feb)),k=f(0xe88b24d9),M=f(0xb529932d);p.default=class{constructor(o,p,f){this.signalingClient=o,this.intervalMs=p,this.logger=f,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new w.default(this.intervalMs),this.pingId=0}addObserver(o){this.logger.info("adding a ping-pong observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing a ping-pong observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)_.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start(()=>{this.ping()}),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver(o=>{M.Maybe.of(o.didMissPongs).map(p=>p.bind(o)(this.consecutivePongsUnaccountedFor))})),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1|0;let o=k.SdkPingPongFrame.create();o.pingId=this.pingId,o.type=k.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(o),this.logger.debug(()=>`sent ping ${this.pingId}`)}pong(o){let p=k.SdkPingPongFrame.create();p.pingId=o,p.type=k.SdkPingPongType.PONG,this.signalingClient.pingPong(p)}handleSignalingClientEvent(o){switch(o.type){case I.default.WebSocketOpen:this.startPingInterval();break;case I.default.WebSocketFailed:case I.default.WebSocketError:this.logger.warn(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.WebSocketClosing:case I.default.WebSocketClosed:this.logger.info(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.ReceivedSignalFrame:if(o.message.type!==k.SdkSignalFrame.Type.PING_PONG)break;if(o.message.pingPong.type===k.SdkPingPongType.PONG){let p,f=o.message.pingPong.pingId;if(f!==this.pingId){this.logger.warn(`unexpected ping id ${f} (expected ${this.pingId})`);break}if(this.consecutivePongsUnaccountedFor=0,"number"==typeof o.message.timestampMs)p=o.message.timestampMs;else break;this.logger.debug(()=>`received pong ${f} with timestamp ${p}`);let m=o.timestampMs-this.pingTimestampLocalMs,_=Math.round(p-m/2),w=this.pingTimestampLocalMs-_;this.logger.info(`local clock skew estimate=${w}ms from ping-pong time=${m}ms`),this.forEachObserver(o=>{M.Maybe.of(o.didReceivePong).map(p=>p.bind(o)(f,w,m))})}else this.pong(o.message.pingPong.pingId)}}}},0x102abe35c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x81e9befe)),w=f(0x149d24991),I=m(f(0x485efac6)),k=m(f(0xf6b5b898));p.default=class{constructor(o,p){this.mediaStreamBroker=o,this.state=new I.default,this._transcriptionController=p||new _.default(this)}realtimeSetLocalAttendeeId(o,p){this.state.localAttendeeId=o,this.state.localExternalUserId=p}realtimeSetAttendeeIdPresence(o,p,f,m,_){try{for(let w of(p&&(this.state.attendeeIdToExternalUserId[o]=f),this.state.attendeeIdChangesCallbacks))w(o,p,f,m,_)}catch(o){this.onError(o)}}realtimeSubscribeToAttendeeIdPresence(o){try{this.state.attendeeIdChangesCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToAttendeeIdPresence(o){try{let p=this.state.attendeeIdChangesCallbacks.indexOf(o);-1!==p&&this.state.attendeeIdChangesCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSetCanUnmuteLocalAudio(o){try{if(this.state.canUnmute===o)return;for(let p of(this.state.canUnmute=o,this.state.setCanUnmuteLocalAudioCallbacks))p(o)}catch(o){this.onError(o)}}realtimeSubscribeToSetCanUnmuteLocalAudio(o){try{this.state.setCanUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){try{let p=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.setCanUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{for(let o of(this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!0)}catch(o){this.onError(o)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{for(let o of(this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!1);return!0}catch(o){return this.onError(o),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){try{let p=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(o,p){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(o)||(this.state.volumeIndicatorCallbacks[o]=[]),this.state.volumeIndicatorCallbacks[o].push(p),this.sendVolumeIndicatorChange(o,!0,!0,!0,this.state.attendeeIdToExternalUserId[o])}catch(o){this.onError(o)}}realtimeUnsubscribeFromVolumeIndicator(o,p){if(this.state.volumeIndicatorCallbacks[o])if(p){let f=this.state.volumeIndicatorCallbacks[o].indexOf(p);f>=0&&this.state.volumeIndicatorCallbacks[o].splice(f,1)}else delete this.state.volumeIndicatorCallbacks[o]}realtimeUpdateVolumeIndicator(o,p,f,m,_){try{f=this.applyLocalMuteOverride(o,f);let w=this.getVolumeIndicatorState(o),I=!1,k=!1,M=!1;null!==f&&w.muted!==f&&(w.muted=f,k=!0,w.muted&&0!==w.volume&&(w.volume=0,I=!0)),w.muted||null===p||(w.volume!==p&&(w.volume=p,I=!0),null===w.muted&&(w.muted=!1,k=!0)),null!==m&&w.signalStrength!==m&&(w.signalStrength=m,M=!0),this.sendVolumeIndicatorChange(o,I,k,M,_)}catch(o){this.onError(o)}}realtimeSubscribeToLocalSignalStrengthChange(o){try{if(this.state.localSignalStrengthChangeCallbacks.push(o),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(o){this.onError(o)}}realtimeUnsubscribeToLocalSignalStrengthChange(o){try{let p=this.state.localSignalStrengthChangeCallbacks.indexOf(o);-1!==p&&this.state.localSignalStrengthChangeCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSubscribeToSendDataMessage(o){try{this.state.sendDataMessageCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeFromSendDataMessage(o){try{let p=this.state.sendDataMessageCallbacks.indexOf(o);-1!==p&&this.state.sendDataMessageCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSendDataMessage(o,p,f){try{for(let m of this.state.sendDataMessageCallbacks)m(o,p,f)}catch(o){this.onError(o)}}realtimeSubscribeToReceiveDataMessage(o,p){try{this.state.receiveDataMessageCallbacks.has(o)?this.state.receiveDataMessageCallbacks.get(o).push(p):this.state.receiveDataMessageCallbacks.set(o,[p])}catch(o){this.onError(o)}}realtimeUnsubscribeFromReceiveDataMessage(o){try{this.state.receiveDataMessageCallbacks.delete(o)}catch(o){this.onError(o)}}realtimeReceiveDataMessage(o){try{w.iterateEvery(this.state.receiveDataMessageCallbacks.get(o.topic),p=>{p(o)})}catch(o){Promise.reject(o)}}realtimeSubscribeToFatalError(o){try{this.state.fatalErrorCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToFatalError(o){try{let p=this.state.fatalErrorCallbacks.indexOf(o);-1!==p&&this.state.fatalErrorCallbacks.splice(p,1)}catch(o){this.onError(o)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(o){o?this.mediaStreamBroker.unmuteLocalAudioInputStream():this.mediaStreamBroker.muteLocalAudioInputStream()}applyLocalMuteOverride(o,p){let f=this.state.localAttendeeId,m=this.state.muted;return o===f&&"activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio?m:p}sendVolumeIndicatorChange(o,p,f,m,_){if(this.sendLocalSignalStrengthChange(o,m),!this.state.volumeIndicatorCallbacks.hasOwnProperty(o))return;let w=this.getVolumeIndicatorState(o),I=new k.default;if(p&&(I.volume=w.volume),f&&(I.muted=w.muted),m&&(I.signalStrength=w.signalStrength),!this.stateIsEmpty(I))for(let p of this.state.volumeIndicatorCallbacks[o])p(o,I.volume,I.muted,I.signalStrength,_)}sendLocalSignalStrengthChange(o,p){if(!p||o!==this.state.localAttendeeId)return;let f=this.getVolumeIndicatorState(o).signalStrength;if(null!==f)for(let o of this.state.localSignalStrengthChangeCallbacks)o(f)}getVolumeIndicatorState(o){return this.state.volumeIndicatorState.hasOwnProperty(o)||(this.state.volumeIndicatorState[o]=new k.default),this.state.volumeIndicatorState[o]}stateIsEmpty(o){return null===o.volume&&null===o.muted&&null===o.signalStrength}onError(o){try{for(let p of this.state.fatalErrorCallbacks)p(o)}catch(p){try{console.error(o),console.error(p)}catch{}}}}},0x151a585f0:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},0x485efac6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}}},0xf6b5b898:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},0x1b1a7866:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x6ee73800));p.default=class DefaultReconnectController{constructor(o,p){this.reconnectTimeoutMs=o,this.backoffPolicy=p,this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this._isFirstConnection=!0,this.backoffTimer=null,this.backoffCancel=null,this.reset()}timeSpentReconnectingMs(){return this.firstConnectionAttempted?Date.now()-this.firstConnectionAttemptTimestampMs:0}hasPastReconnectDeadline(){return Date.now()-this.lastActiveTimestampMs>=this.reconnectTimeoutMs||this.timeSpentReconnectingMs()>=this.reconnectTimeoutMs}reset(){this.cancel(),this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this.backoffPolicy.reset()}startedConnectionAttempt(o){this._isFirstConnection=o,this.firstConnectionAttempted||(this.firstConnectionAttempted=!0,this.firstConnectionAttemptTimestampMs=Date.now())}hasStartedConnectionAttempt(){return this.firstConnectionAttempted}isFirstConnection(){return this._isFirstConnection}disableReconnect(){this.shouldReconnect=!1}enableRestartPeerConnection(){this.onlyRestartPeerConnection=!0}cancel(){this.disableReconnect(),this.backoffTimer&&(this.backoffTimer.stop(),this.backoffCancel&&(this.backoffCancel(),this.backoffCancel=null))}retryWithBackoff(o,p){let f=this.shouldReconnect&&!this.hasPastReconnectDeadline();return f&&(this.backoffCancel=p,this.backoffTimer=new _.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start(()=>{this.backoffCancel=null,o()})),f}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new DefaultReconnectController(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(o){this.lastActiveTimestampMs=o}}},0x1a763535d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class RedundantAudioEncoder{constructor(){this.maxRedPacketSizeBytes=1024,this.maxAudioPayloadSizeBytes=1e3,this.maxRedTimestampOffset=16384,this.redHeaderSizeBytes=4,this.redLastHeaderSizeBytes=1,this.redPacketizationTime=960,this.redPacketDistance=2,this.maxRedEncodings=2,this.redMaxRecoveryDistance=this.redPacketDistance*this.maxRedEncodings+1,this.maxEncodingHistorySize=10,this.numRedundantEncodings=0,this.redundancyEnabled=!0,this.lossReportInterval=24e4,this.maxOutOfOrderPacketDistance=16,this.OPUS_BAD_ARG=-1,this.OPUS_INVALID_PACKET=-4,this.OPUS_MAX_OPUS_FRAMES=48,this.OPUS_MAX_FRAME_SIZE_BYTES=1275,this.encodingHistory=[],this.opusPayloadType=0,this.redPayloadType=0,this.initializePacketLogs()}static initializeWorker(){RedundantAudioEncoder.log("Initializing RedundantAudioEncoder");let o=new RedundantAudioEncoder;self.RTCRtpScriptTransformer&&(self.onrtctransform=p=>{"SenderTransform"===p.transformer.options.type?o.setupSenderTransform(p.transformer.readable,p.transformer.writable):"ReceiverTransform"===p.transformer.options.type?o.setupReceiverTransform(p.transformer.readable,p.transformer.writable):"PassthroughTransform"===p.transformer.options.type&&o.setupPassthroughTransform(p.transformer.readable,p.transformer.writable)}),self.onmessage=p=>{"StartRedWorker"===p.data.msgType?(o.setupSenderTransform(p.data.send.readable,p.data.send.writable),o.setupReceiverTransform(p.data.receive.readable,p.data.receive.writable)):"PassthroughTransform"===p.data.msgType?(o.setupPassthroughTransform(p.data.send.readable,p.data.send.writable),o.setupPassthroughTransform(p.data.receive.readable,p.data.receive.writable)):"RedPayloadType"===p.data.msgType?o.setRedPayloadType(p.data.payloadType):"OpusPayloadType"===p.data.msgType?o.setOpusPayloadType(p.data.payloadType):"UpdateNumRedundantEncodings"===p.data.msgType?o.setNumRedundantEncodings(p.data.numRedundantEncodings):"Enable"===p.data.msgType?o.setRedundancyEnabled(!0):"Disable"===p.data.msgType&&o.setRedundancyEnabled(!1)}}static log(o){RedundantAudioEncoder.shouldLog&&self.postMessage({type:"REDWorkerLog",log:`[AudioRed] ${o}`})}static getNumRedundantEncodingsForPacketLoss(o){let p=0,f=!1;return o<=8?p=0:o<=18?p=1:o<=75?p=2:(p=0,f=!0),[p,f]}setupPassthroughTransform(o,p){RedundantAudioEncoder.log("Setting up passthrough transform"),o.pipeTo(p)}setupSenderTransform(o,p){RedundantAudioEncoder.log("Setting up sender RED transform");let f=new TransformStream({transform:this.senderTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setupReceiverTransform(o,p){RedundantAudioEncoder.log("Setting up receiver RED transform");let f=new TransformStream({transform:this.receivePacketLogTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setRedPayloadType(o){this.redPayloadType=o,RedundantAudioEncoder.log(`red payload type set to ${this.redPayloadType}`)}setOpusPayloadType(o){this.opusPayloadType=o,RedundantAudioEncoder.log(`opus payload type set to ${this.opusPayloadType}`)}setNumRedundantEncodings(o){this.numRedundantEncodings=o,this.numRedundantEncodings>this.maxRedEncodings&&(this.numRedundantEncodings=this.maxRedEncodings),RedundantAudioEncoder.log(`Updated numRedundantEncodings to ${this.numRedundantEncodings}`)}setRedundancyEnabled(o){this.redundancyEnabled=o,RedundantAudioEncoder.log(`redundancy ${this.redundancyEnabled?"enabled":"disabled"}`)}enqueueAudioFrameIfPayloadSizeIsValid(o,p){o.data.byteLength>this.maxAudioPayloadSizeBytes||p.enqueue(o)}senderTransform(o,p){if(o.getMetadata().payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let f=this.getPrimaryPayload(o.timestamp,o.data);if(!f)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.encode(o.timestamp,f);m&&(o.data=m),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}getPrimaryPayload(o,p){let f=this.splitEncodings(o,p);return!f||f.length<1?null:f[f.length-1].payload}splitEncodings(o,p,f=!1,m){let _=new DataView(p),w=_.byteLength,I=0,k=0,M=0,x=0,O=!1,L=[],B=[],U=[];for(;w>0;){if(O=(128&_.getUint8(x))==0){if((127&_.getUint8(x))!==this.opusPayloadType||(I+=this.redLastHeaderSizeBytes,k+=this.redLastHeaderSizeBytes,I>=_.byteLength))return null;M=_.byteLength-I;break}{if(w<this.redHeaderSizeBytes)return null;let p=((3&_.getUint8(x+2))<<8)+_.getUint8(x+3);B.push(p);let f=o-(_.getUint16(x+1)>>2);U.push(f),I+=p+this.redHeaderSizeBytes,k+=this.redHeaderSizeBytes,x+=this.redHeaderSizeBytes,w-=this.redHeaderSizeBytes}}if(!O)return void 0!==m?(L.push({payload:p,isRedundant:!1,seq:m}),L):null;let $=k;for(let o=0;o<U.length;o++){let p=new ArrayBuffer(B[o]);new Uint8Array(p).set(new Uint8Array(_.buffer,$,B[o]),0);let m={timestamp:U[o],payload:p,isRedundant:!0};f&&(m.hasFec=this.opusPacketHasFec(new DataView(p),p.byteLength)),L.push(m),$+=B[o]}let q=_.byteLength-M,Z=new ArrayBuffer(M);new Uint8Array(Z).set(new Uint8Array(_.buffer,q,M),0);let ee={timestamp:o,payload:Z,isRedundant:!1,seq:m};return f&&(ee.hasFec=this.opusPacketHasFec(new DataView(Z),Z.byteLength)),L.push(ee),L}encode(o,p){let f=p.byteLength;if(0===f||f>=this.maxRedPacketSizeBytes||f>=this.maxAudioPayloadSizeBytes)return null;let m=this.numRedundantEncodings,_=this.redLastHeaderSizeBytes,w=f,I=this.maxAudioPayloadSizeBytes-f-_,k=[],M=[];if(this.redundancyEnabled){let p=this.uint32WrapAround(o-this.redPacketizationTime*this.redPacketDistance);for(let f=0;f<m&&!(this.uint32WrapAround(o-p)>=this.maxRedTimestampOffset);f++){let o=p,f=this.encodingHistory.find(p=>p.timestamp===o);if(f||(o=this.uint32WrapAround(p-this.redPacketizationTime),f=this.encodingHistory.find(p=>p.timestamp===o)),f){let o=f.payload.byteLength;if(I<this.redHeaderSizeBytes+o)break;I-=this.redHeaderSizeBytes+o,_+=this.redHeaderSizeBytes,w+=o,k.unshift(f.timestamp),M.unshift(f.payload)}p-=this.redPacketizationTime*this.redPacketDistance,p=this.uint32WrapAround(p)}}let x=new ArrayBuffer(_+w),O=new DataView(x),L=0;for(let p=0;p<k.length;p++){let f=o-k[p];O.setUint8(L,128|this.opusPayloadType),O.setUint16(L+1,f<<2|M[p].byteLength>>8),O.setUint8(L+3,255&M[p].byteLength),L+=this.redHeaderSizeBytes}O.setUint8(L,this.opusPayloadType),L+=this.redLastHeaderSizeBytes;let B=new Uint8Array(x);for(let o=0;o<M.length;o++)B.set(new Uint8Array(M[o]),L),L+=M[o].byteLength;return(B.set(new Uint8Array(p),L),(L+=p.byteLength)!==_+w)?null:(this.updateEncodingHistory(o,p),x)}updateEncodingHistory(o,p){for(let p of this.encodingHistory){let f=this.redPacketizationTime*this.redMaxRecoveryDistance;if(o-p.timestamp>=f)this.encodingHistory.shift();else break}let f=new DataView(p);(this.opusPacketIsCeltOnly(f)||this.opusPacketHasVoiceActivity(f,f.byteLength)>0)&&(this.encodingHistory.length+1>this.maxEncodingHistorySize&&(this.encodingHistory.length=0),this.encodingHistory.push({timestamp:o,payload:p}))}initializePacketLogs(){let o=this.maxOutOfOrderPacketDistance+this.redMaxRecoveryDistance;this.primaryPacketLog={window:Array(o),index:0,windowSize:o},this.redRecoveryLog={window:Array(o),index:0,windowSize:o},this.fecRecoveryLog={window:Array(o),index:0,windowSize:o},this.totalAudioPacketsExpected=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}receivePacketLogTransform(o,p){let f=o.getMetadata();if(f.payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.splitEncodings(o.timestamp,o.data,!0,f.sequenceNumber);if(!m)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);for(let o=m.length-1;o>=0;o--)this.updateLossStats(m[o])&&(this.updateRedStats(m[o]),this.updateFecStats(m[o]));this.maybeReportLossStats(f.synchronizationSource,m[m.length-1].timestamp),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}updateLossStats(o){if(o.isRedundant)return!0;let p=o.timestamp,f=o.seq;if(0===this.totalAudioPacketsExpected)return this.totalAudioPacketsExpected=1,this.newestSequenceNumber=f,this.addTimestamp(this.primaryPacketLog,p),!0;let m=this.int16(f-this.newestSequenceNumber);return!(m<-this.maxOutOfOrderPacketDistance)&&(m<0?this.hasTimestamp(this.primaryPacketLog,p)||(this.totalAudioPacketsLost>0&&this.totalAudioPacketsLost--,this.addTimestamp(this.primaryPacketLog,p),this.removeFromRecoveryWindows(p)):m>1&&(this.totalAudioPacketsLost+=m-1),m>0&&(this.totalAudioPacketsExpected+=m,this.newestSequenceNumber=o.seq,this.addTimestamp(this.primaryPacketLog,p)),!0)}updateRedStats(o){if(!o.isRedundant||0===this.totalAudioPacketsLost)return;let p=o.timestamp;!this.hasTimestamp(this.primaryPacketLog,p)&&(this.hasTimestamp(this.redRecoveryLog,p)||(this.totalAudioPacketsRecoveredRed++,this.addTimestamp(this.redRecoveryLog,p)),this.removeTimestamp(this.fecRecoveryLog,p)&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--)}updateFecStats(o){if(!o.hasFec||0===this.totalAudioPacketsLost)return;let p=o.timestamp-this.redPacketizationTime;this.hasTimestamp(this.primaryPacketLog,p)||this.hasTimestamp(this.redRecoveryLog,p)||this.hasTimestamp(this.fecRecoveryLog,p)||(this.totalAudioPacketsRecoveredFec++,this.addTimestamp(this.fecRecoveryLog,p))}maybeReportLossStats(o,p){void 0===p||p-this.lastLossReportTimestamp<this.lossReportInterval||(RedundantAudioEncoder.shouldReportStats&&self.postMessage({type:"RedundantAudioEncoderStats",ssrc:o,totalAudioPacketsLost:this.totalAudioPacketsLost,totalAudioPacketsExpected:this.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.totalAudioPacketsRecoveredFec}),this.lastLossReportTimestamp=p)}addTimestamp(o,p){void 0!==p&&(o.window[o.index]=p,o.index=(o.index+1)%o.windowSize)}hasTimestamp(o,p){return!!o.window.find(o=>o===p)}removeTimestamp(o,p){let f=o.window.indexOf(p);return f>=0&&(o.window[f]=void 0,!0)}removeFromRecoveryWindows(o){let p=this.removeTimestamp(this.redRecoveryLog,o);p&&this.totalAudioPacketsRecoveredRed>0&&this.totalAudioPacketsRecoveredRed--,(p=this.removeTimestamp(this.fecRecoveryLog,o))&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--}uint32WrapAround(o){let p=o;return o>=0x100000000?p=o-0x100000000:o<0&&(p=0x100000000+o),p}int16(o){return o<<16>>16}opusPacketIsCeltOnly(o){return!!(128&o.getUint8(0))}opusPacketGetSamplesPerFrame(o,p){let f,m;return p=Math.min(Math.max(p=Math.round(p),-0x100000000),0xffffffff),this.opusPacketIsCeltOnly(o)?(m=o.getUint8(0)>>3&3,f=(p<<m)/400):f=(96&o.getUint8(0))==96?8&o.getUint8(0)?p/50:p/100:3==(m=o.getUint8(0)>>3&3)?60*p/1e3:(p<<m)/100,f}opusNumSilkFrames(o){let p=this.opusPacketGetSamplesPerFrame(o,48e3)/48;switch(p<10&&(p=10),p){case 10:case 20:return 1;case 40:return 2;case 60:return 3;default:return 0}}opusPacketGetNumChannels(o){return 4&o.getUint8(0)?2:1}opusParseSize(o,p,f,m){return f<1?(m[0]=-1,-1):252>o.getUint8(p)?(m[0]=o.getUint8(p),1):f<2?(m[0]=-1,-1):(m[0]=4*o.getUint8(p+1)+o.getUint8(p),2)}opusPacketParseImpl(o,p,f,m,_,w,I,k){let M,x;if(!w||p<0)return this.OPUS_BAD_ARG;if(0===p)return this.OPUS_INVALID_PACKET;let O=0,L=!1,B=o.getUint8(0);m&&(m[0]=B);let U=p-1,$=1,q=U;switch(3&B){case 0:M=1;break;case 1:if(M=2,L=!0,!f){if(1&U)return this.OPUS_INVALID_PACKET;q=U/2,w[0][0]=q}break;case 2:if(M=2,x=this.opusParseSize(o,$,U,w[0]),U-=x,w[0][0]<0||w[0][0]>U)return this.OPUS_INVALID_PACKET;$+=x,q=U-w[0][0];break;default:if(U<1)return this.OPUS_INVALID_PACKET;let Z=o.getUint8($++);if(--U,(M=63&Z)<=0||this.opusPacketGetSamplesPerFrame(o,48e3)*M>5760)return this.OPUS_INVALID_PACKET;if(64&Z){let p,f;do{if(U<=0)return this.OPUS_INVALID_PACKET;p=o.getUint8($++),--U,U-=f=255===p?254:p,O+=f}while(255===p)}if(U<0)return this.OPUS_INVALID_PACKET;if(L=!(128&Z)){if(!f){if((q=Math.trunc(U/M))*M!==U)return this.OPUS_INVALID_PACKET;for(let o=0;o<M-1;++o)w[o][0]=q}}else{q=U;for(let p=0;p<M-1;++p){if(x=this.opusParseSize(o,$,U,w[p]),U-=x,w[p][0]<0||w[p][0]>U)return this.OPUS_INVALID_PACKET;$+=x,q-=x+w[p][0]}if(q<0)return this.OPUS_INVALID_PACKET}}if(f){if(x=this.opusParseSize(o,$,U,w[M-1]),U-=x,w[M-1][0]<0||w[M-1][0]>U)return this.OPUS_INVALID_PACKET;if($+=x,L){if(w[M-1][0]*M>U)return this.OPUS_INVALID_PACKET;for(let o=0;o<M-1;++o)w[o][0]=w[M-1][0]}else if(!(x+w[M-1][0]<=q))return this.OPUS_INVALID_PACKET}else{if(q>this.OPUS_MAX_FRAME_SIZE_BYTES)return this.OPUS_INVALID_PACKET;w[M-1][0]=q}I&&(I[0]=$);for(let o=0;o<M;++o)_&&(_[o][0]=$),$+=w[o][0];return k&&(k[0]=$+O),M}opusPacketParse(o,p,f,m,_,w){return this.opusPacketParseImpl(o,p,!1,f,m,_,w,null)}opusPacketHasVoiceActivity(o,p){if(!o||p<=0)return 0;if(this.opusPacketIsCeltOnly(o))return -1;let f=this.opusNumSilkFrames(o);if(0===f)return -1;let m=Array(this.OPUS_MAX_OPUS_FRAMES),_=Array(this.OPUS_MAX_OPUS_FRAMES);for(let o=0;o<this.OPUS_MAX_OPUS_FRAMES;++o)m[o]=[void 0],_[o]=[void 0];let w=this.opusPacketParse(o,p,null,m,_,null);if(w<0)return -1;for(let p=0;p<w;++p)if(!(_[p][0]<1)&&(o.getUint8(m[p][0])>>8-f||2===this.opusPacketGetNumChannels(o)&&o.getUint8(m[p][0])<<f+1>>8-f))return 1;return 0}opusPacketHasFec(o,p){if(!o||p<=0||this.opusPacketIsCeltOnly(o))return!1;let f=Array(this.OPUS_MAX_OPUS_FRAMES),m=Array(this.OPUS_MAX_OPUS_FRAMES);for(let o=0;o<this.OPUS_MAX_OPUS_FRAMES;++o)f[o]=[void 0],m[o]=[void 0];if(0>this.opusPacketParse(o,p,null,f,m,null)||m[0][0]<=1)return!1;let _=this.opusNumSilkFrames(o);if(0===_)return!1;let w=this.opusPacketGetNumChannels(o);if(1!==w&&2!==w)return!1;for(let p=0;p<w;p++)if(o.getUint8(f[0][0])&128>>(p+1)*(_+1)-1)return!0;return!1}};p.default=f,f.shouldLog=!1,f.shouldReportStats=!1},0x11e4e5f0d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=`class RedundantAudioEncoder {
    constructor() {
        // Each payload must be less than 1024 bytes to fit the 10 bit block length
        this.maxRedPacketSizeBytes = 1 << 10;
        // Limit payload to 1000 bytes to handle small MTU. 1000 is chosen because in Chromium-based browsers, writing audio
        // payloads larger than 1000 bytes using the WebRTC Insertable Streams API (which is used to enable dynamic audio
        // redundancy) will cause an error to be thrown and cause audio flow to permanently stop. See
        // https://crbug.com/1248479.
        this.maxAudioPayloadSizeBytes = 1000;
        // Each payload can encode a timestamp delta of 14 bits
        this.maxRedTimestampOffset = 1 << 14;
        // 4 byte RED header
        this.redHeaderSizeBytes = 4;
        // reduced size for last RED header
        this.redLastHeaderSizeBytes = 1;
        // P-Time for Opus 20 msec packets
        // We do not support other p-times or clock rates
        this.redPacketizationTime = 960;
        // distance between redundant payloads, Opus FEC handles a distance of 1
        // TODO(https://issues.amazon.com/issues/ChimeSDKAudio-55):
        // Consider making this dynamic
        this.redPacketDistance = 2;
        // maximum number of redundant payloads per RTP packet
        this.maxRedEncodings = 2;
        // Maximum number of encodings that can be recovered with a single RED packet, assuming the primary and redundant
        // payloads have FEC.
        this.redMaxRecoveryDistance = this.redPacketDistance * this.maxRedEncodings + 1;
        // maximum history of prior payloads to keep
        // generally we will expire old entries based on timestamp
        // this limit is in place just to make sure the history does not
        // grow too large in the case of erroneous timestamp inputs
        this.maxEncodingHistorySize = 10;
        // Current number of encodings we want to send
        // to the remote end. This will be dynamically
        // updated through the setNumEncodingsFromPacketloss API
        this.numRedundantEncodings = 0;
        // Used to enable or disable redundancy
        // in response to very high packet loss events
        this.redundancyEnabled = true;
        // Loss stats are reported to the main thread every 5 seconds.
        // Since timestamp differences between 2 consecutive packets
        // give us the number of samples in each channel, 1 second
        // is equivalent to 48000 samples:
        // P-time * (1000ms/1s)
        // = (960 samples/20ms) * (1000ms/1s)
        // = 48000 samples/s
        this.lossReportInterval = 48000 * 5;
        // Maximum distance of a packet from the most recent packet timestamp
        // that we will consider for recovery.
        this.maxOutOfOrderPacketDistance = 16;
        /**
         * Below are Opus helper methods and constants.
         */
        this.OPUS_BAD_ARG = -1;
        this.OPUS_INVALID_PACKET = -4;
        // Max number of Opus frames in an Opus packet is 48 (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5).
        this.OPUS_MAX_OPUS_FRAMES = 48;
        // Max number of bytes that any individual Opus frame can have.
        this.OPUS_MAX_FRAME_SIZE_BYTES = 1275;
        this.encodingHistory = new Array();
        this.opusPayloadType = 0;
        this.redPayloadType = 0;
        this.initializePacketLogs();
    }
    /**
     * Creates an instance of RedundantAudioEncoder and sets up callbacks.
     */
    static initializeWorker() {
        RedundantAudioEncoder.log('Initializing RedundantAudioEncoder');
        const encoder = new RedundantAudioEncoder();
        // RED encoding is done using WebRTC Encoded Transform
        // https://github.com/w3c/webrtc-encoded-transform/blob/main/explainer.md
        // Check the DedicatedWorkerGlobalScope for existence of
        // RTCRtpScriptTransformer interface. If exists, then
        // RTCRtpScriptTransform is supported by this browser.
        // @ts-ignore
        if (self.RTCRtpScriptTransformer) {
            // @ts-ignore
            self.onrtctransform = (event) => {
                if (event.transformer.options.type === 'SenderTransform') {
                    encoder.setupSenderTransform(event.transformer.readable, event.transformer.writable);
                }
                else if (event.transformer.options.type === 'ReceiverTransform') {
                    encoder.setupReceiverTransform(event.transformer.readable, event.transformer.writable);
                }
                else if (event.transformer.options.type === 'PassthroughTransform') {
                    encoder.setupPassthroughTransform(event.transformer.readable, event.transformer.writable);
                }
            };
        }
        self.onmessage = (event) => {
            if (event.data.msgType === 'StartRedWorker') {
                encoder.setupSenderTransform(event.data.send.readable, event.data.send.writable);
                encoder.setupReceiverTransform(event.data.receive.readable, event.data.receive.writable);
            }
            else if (event.data.msgType === 'PassthroughTransform') {
                encoder.setupPassthroughTransform(event.data.send.readable, event.data.send.writable);
                encoder.setupPassthroughTransform(event.data.receive.readable, event.data.receive.writable);
            }
            else if (event.data.msgType === 'RedPayloadType') {
                encoder.setRedPayloadType(event.data.payloadType);
            }
            else if (event.data.msgType === 'OpusPayloadType') {
                encoder.setOpusPayloadType(event.data.payloadType);
            }
            else if (event.data.msgType === 'UpdateNumRedundantEncodings') {
                encoder.setNumRedundantEncodings(event.data.numRedundantEncodings);
            }
            else if (event.data.msgType === 'Enable') {
                encoder.setRedundancyEnabled(true);
            }
            else if (event.data.msgType === 'Disable') {
                encoder.setRedundancyEnabled(false);
            }
        };
    }
    /**
     * Post logs to the main thread
     */
    static log(msg) {
        if (RedundantAudioEncoder.shouldLog) {
            // @ts-ignore
            self.postMessage({
                type: 'REDWorkerLog',
                log: \`[AudioRed] \${msg}\`,
            });
        }
    }
    /**
     * Returns the number of encodings based on packetLoss value. This is used by \`DefaultTransceiverController\` to
     * determine when to alert the encoder to update the number of encodings. It also determines if we need to
     * turn off red in cases of very high packet loss to avoid congestion collapse.
     */
    static getNumRedundantEncodingsForPacketLoss(packetLoss) {
        let recommendedRedundantEncodings = 0;
        let shouldTurnOffRed = false;
        if (packetLoss <= 8) {
            recommendedRedundantEncodings = 0;
        }
        else if (packetLoss <= 18) {
            recommendedRedundantEncodings = 1;
        }
        else if (packetLoss <= 75) {
            recommendedRedundantEncodings = 2;
        }
        else {
            recommendedRedundantEncodings = 0;
            shouldTurnOffRed = true;
        }
        return [recommendedRedundantEncodings, shouldTurnOffRed];
    }
    /**
     * Sets up a passthrough (no-op) transform for the given streams.
     */
    setupPassthroughTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up passthrough transform');
        readable.pipeTo(writable);
    }
    /**
     * Sets up the transform stream and pipes the outgoing encoded audio frames through the transform function.
     */
    setupSenderTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up sender RED transform');
        const transformStream = new TransformStream({
            transform: this.senderTransform.bind(this),
        });
        readable.pipeThrough(transformStream).pipeTo(writable);
        return;
    }
    /**
     * Sets up the transform stream and pipes the received encoded audio frames through the transform function.
     */
    setupReceiverTransform(readable, writable) {
        RedundantAudioEncoder.log('Setting up receiver RED transform');
        const transformStream = new TransformStream({
            transform: this.receivePacketLogTransform.bind(this),
        });
        readable.pipeThrough(transformStream).pipeTo(writable);
        return;
    }
    /**
     * Set the RED payload type ideally obtained from local offer.
     */
    setRedPayloadType(payloadType) {
        this.redPayloadType = payloadType;
        RedundantAudioEncoder.log(\`red payload type set to \${this.redPayloadType}\`);
    }
    /**
     * Set the opus payload type ideally obtained from local offer.
     */
    setOpusPayloadType(payloadType) {
        this.opusPayloadType = payloadType;
        RedundantAudioEncoder.log(\`opus payload type set to \${this.opusPayloadType}\`);
    }
    /**
     * Set the number of redundant encodings
     */
    setNumRedundantEncodings(numRedundantEncodings) {
        this.numRedundantEncodings = numRedundantEncodings;
        if (this.numRedundantEncodings > this.maxRedEncodings) {
            this.numRedundantEncodings = this.maxRedEncodings;
        }
        RedundantAudioEncoder.log(\`Updated numRedundantEncodings to \${this.numRedundantEncodings}\`);
    }
    /**
     * Enable or disable redundancy in response to
     * high packet loss event.
     */
    setRedundancyEnabled(enabled) {
        this.redundancyEnabled = enabled;
        RedundantAudioEncoder.log(\`redundancy \${this.redundancyEnabled ? 'enabled' : 'disabled'}\`);
    }
    /**
     * Helper function to only enqueue audio frames if they do not exceed the audio payload byte limit imposed by
     * Chromium-based browsers. Chromium will throw an error (https://crbug.com/1248479) if an audio payload larger than
     * 1000 bytes is enqueued. Any controller that attempts to enqueue an audio payload larger than 1000 bytes will
     * encounter this error and will permanently stop sending or receiving audio.
     */
    enqueueAudioFrameIfPayloadSizeIsValid(
    // @ts-ignore
    frame, controller) {
        if (frame.data.byteLength > this.maxAudioPayloadSizeBytes)
            return;
        controller.enqueue(frame);
    }
    /**
     * Receives encoded frames and modifies as needed before sending to transport.
     */
    senderTransform(
    // @ts-ignore
    frame, controller) {
        const frameMetadata = frame.getMetadata();
        // @ts-ignore
        if (frameMetadata.payloadType !== this.redPayloadType) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        const primaryPayloadBuffer = this.getPrimaryPayload(frame.timestamp, frame.data);
        if (!primaryPayloadBuffer) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        const encodedBuffer = this.encode(frame.timestamp, primaryPayloadBuffer);
        /* istanbul ignore next */
        if (!encodedBuffer) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        frame.data = encodedBuffer;
        this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
        return;
    }
    /**
     * Get the primary payload from encoding
     */
    getPrimaryPayload(primaryTimestamp, frame) {
        const encodings = this.splitEncodings(primaryTimestamp, frame);
        if (!encodings || encodings.length < 1)
            return null;
        return encodings[encodings.length - 1].payload;
    }
    /**
     * Split up the encoding received into primary and redundant encodings
     * These will be ordered oldest to newest which is the same ordering
     * in the RTP red payload.
     */
    splitEncodings(primaryTimestamp, frame, getFecInfo = false, primarySequenceNumber = undefined) {
        // process RED headers (according to RFC 2198)
        //   0                   1                   2                   3
        //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //  |F|   block PT  |  timestamp offset         |   block length    |
        //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        //
        // last header
        //   0 1 2 3 4 5 6 7
        //  +-+-+-+-+-+-+-+-+
        //  |0|   Block PT  |
        //  +-+-+-+-+-+-+-+-+
        const payload = new DataView(frame);
        let payloadSizeBytes = payload.byteLength;
        let totalPayloadSizeBytes = 0;
        let totalHeaderSizeBytes = 0;
        let primaryPayloadSizeBytes = 0;
        let payloadOffset = 0;
        let gotLastBlock = false;
        const encodings = new Array();
        const redundantEncodingBlockLengths = new Array();
        const redundantEncodingTimestamps = new Array();
        while (payloadSizeBytes > 0) {
            gotLastBlock = (payload.getUint8(payloadOffset) & 0x80) === 0;
            if (gotLastBlock) {
                // Bits 1 through 7 are payload type
                const payloadType = payload.getUint8(payloadOffset) & 0x7f;
                // Unexpected payload type. This is a bad packet.
                if (payloadType !== this.opusPayloadType) {
                    return null;
                }
                totalPayloadSizeBytes += this.redLastHeaderSizeBytes;
                totalHeaderSizeBytes += this.redLastHeaderSizeBytes;
                // Accumulated block lengths are equal to or larger than the buffer, which means there is no primary block. This
                // is a bad packet.
                if (totalPayloadSizeBytes >= payload.byteLength) {
                    return null;
                }
                primaryPayloadSizeBytes = payload.byteLength - totalPayloadSizeBytes;
                break;
            }
            else {
                if (payloadSizeBytes < this.redHeaderSizeBytes) {
                    return null;
                }
                // Bits 22 through 31 are payload length
                const blockLength = ((payload.getUint8(payloadOffset + 2) & 0x03) << 8) + payload.getUint8(payloadOffset + 3);
                redundantEncodingBlockLengths.push(blockLength);
                const timestampOffset = payload.getUint16(payloadOffset + 1) >> 2;
                const timestamp = primaryTimestamp - timestampOffset;
                redundantEncodingTimestamps.push(timestamp);
                totalPayloadSizeBytes += blockLength + this.redHeaderSizeBytes;
                totalHeaderSizeBytes += this.redHeaderSizeBytes;
                payloadOffset += this.redHeaderSizeBytes;
                payloadSizeBytes -= this.redHeaderSizeBytes;
            }
        }
        // The last block was never found. The packet we received
        // does not have a good RED payload.
        if (!gotLastBlock) {
            // Note that sequence numbers only exist for
            // incoming audio frames.
            if (primarySequenceNumber !== undefined) {
                // This could be a possible padding packet used
                // for BWE with a good sequence number.
                // Create a dummy encoding to make sure loss values
                // are calculated correctly by consuming sequence number.
                // Note that for the receive side, we process packets only
                // for loss/recovery calculations and forward the original
                // packet without changing it even in the error case.
                encodings.push({
                    payload: frame,
                    isRedundant: false,
                    seq: primarySequenceNumber,
                });
                return encodings;
            }
            // This is a bad packet.
            return null;
        }
        let redundantPayloadOffset = totalHeaderSizeBytes;
        for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
            const redundantPayloadBuffer = new ArrayBuffer(redundantEncodingBlockLengths[i]);
            const redundantPayloadArray = new Uint8Array(redundantPayloadBuffer);
            redundantPayloadArray.set(new Uint8Array(payload.buffer, redundantPayloadOffset, redundantEncodingBlockLengths[i]), 0);
            const encoding = {
                timestamp: redundantEncodingTimestamps[i],
                payload: redundantPayloadBuffer,
                isRedundant: true,
            };
            if (getFecInfo) {
                encoding.hasFec = this.opusPacketHasFec(new DataView(redundantPayloadBuffer), redundantPayloadBuffer.byteLength);
            }
            encodings.push(encoding);
            redundantPayloadOffset += redundantEncodingBlockLengths[i];
        }
        const primaryPayloadOffset = payload.byteLength - primaryPayloadSizeBytes;
        const primaryPayloadBuffer = new ArrayBuffer(primaryPayloadSizeBytes);
        const primaryArray = new Uint8Array(primaryPayloadBuffer);
        primaryArray.set(new Uint8Array(payload.buffer, primaryPayloadOffset, primaryPayloadSizeBytes), 0);
        const encoding = {
            timestamp: primaryTimestamp,
            payload: primaryPayloadBuffer,
            isRedundant: false,
            seq: primarySequenceNumber,
        };
        if (getFecInfo) {
            encoding.hasFec = this.opusPacketHasFec(new DataView(primaryPayloadBuffer), primaryPayloadBuffer.byteLength);
        }
        encodings.push(encoding);
        return encodings;
    }
    /**
     * Create a new encoding with current primary payload and the older payloads of choice.
     */
    encode(primaryTimestamp, primaryPayload) {
        const primaryPayloadSize = primaryPayload.byteLength;
        // Payload size needs to be valid.
        if (primaryPayloadSize === 0 ||
            primaryPayloadSize >= this.maxRedPacketSizeBytes ||
            primaryPayloadSize >= this.maxAudioPayloadSizeBytes) {
            return null;
        }
        const numRedundantEncodings = this.numRedundantEncodings;
        let headerSizeBytes = this.redLastHeaderSizeBytes;
        let payloadSizeBytes = primaryPayloadSize;
        let bytesAvailable = this.maxAudioPayloadSizeBytes - primaryPayloadSize - headerSizeBytes;
        const redundantEncodingTimestamps = new Array();
        const redundantEncodingPayloads = new Array();
        // If redundancy is disabled then only send the primary payload
        if (this.redundancyEnabled) {
            // Determine how much redundancy we can fit into our packet
            let redundantTimestamp = this.uint32WrapAround(primaryTimestamp - this.redPacketizationTime * this.redPacketDistance);
            for (let i = 0; i < numRedundantEncodings; i++) {
                // Do not add redundant encodings that are beyond the maximum timestamp offset.
                if (this.uint32WrapAround(primaryTimestamp - redundantTimestamp) >= this.maxRedTimestampOffset) {
                    break;
                }
                let findTimestamp = redundantTimestamp;
                let encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
                if (!encoding) {
                    // If not found or not important then look for the previous packet.
                    // The current packet may have included FEC for the previous, so just
                    // use the previous packet instead provided that it has voice activity.
                    findTimestamp = this.uint32WrapAround(redundantTimestamp - this.redPacketizationTime);
                    encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
                }
                if (encoding) {
                    const redundantEncodingSizeBytes = encoding.payload.byteLength;
                    // Only add redundancy if there are enough bytes available.
                    if (bytesAvailable < this.redHeaderSizeBytes + redundantEncodingSizeBytes)
                        break;
                    bytesAvailable -= this.redHeaderSizeBytes + redundantEncodingSizeBytes;
                    headerSizeBytes += this.redHeaderSizeBytes;
                    payloadSizeBytes += redundantEncodingSizeBytes;
                    redundantEncodingTimestamps.unshift(encoding.timestamp);
                    redundantEncodingPayloads.unshift(encoding.payload);
                }
                redundantTimestamp -= this.redPacketizationTime * this.redPacketDistance;
                redundantTimestamp = this.uint32WrapAround(redundantTimestamp);
            }
        }
        const redPayloadBuffer = new ArrayBuffer(headerSizeBytes + payloadSizeBytes);
        const redPayloadView = new DataView(redPayloadBuffer);
        // Add redundant encoding header(s) to new buffer
        let redPayloadOffset = 0;
        for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
            const timestampDelta = primaryTimestamp - redundantEncodingTimestamps[i];
            redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType | 0x80);
            redPayloadView.setUint16(redPayloadOffset + 1, (timestampDelta << 2) | (redundantEncodingPayloads[i].byteLength >> 8));
            redPayloadView.setUint8(redPayloadOffset + 3, redundantEncodingPayloads[i].byteLength & 0xff);
            redPayloadOffset += this.redHeaderSizeBytes;
        }
        // Add primary encoding header to new buffer
        redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType);
        redPayloadOffset += this.redLastHeaderSizeBytes;
        // Add redundant payload(s) to new buffer
        const redPayloadArray = new Uint8Array(redPayloadBuffer);
        for (let i = 0; i < redundantEncodingPayloads.length; i++) {
            redPayloadArray.set(new Uint8Array(redundantEncodingPayloads[i]), redPayloadOffset);
            redPayloadOffset += redundantEncodingPayloads[i].byteLength;
        }
        // Add primary payload to new buffer
        redPayloadArray.set(new Uint8Array(primaryPayload), redPayloadOffset);
        redPayloadOffset += primaryPayload.byteLength;
        /* istanbul ignore next */
        // Sanity check that we got the expected total payload size.
        if (redPayloadOffset !== headerSizeBytes + payloadSizeBytes)
            return null;
        this.updateEncodingHistory(primaryTimestamp, primaryPayload);
        return redPayloadBuffer;
    }
    /**
     * Update the encoding history with the latest primary encoding
     */
    updateEncodingHistory(primaryTimestamp, primaryPayload) {
        // Remove encodings from the history if they are too old.
        for (const encoding of this.encodingHistory) {
            const maxTimestampDelta = this.redPacketizationTime * this.redMaxRecoveryDistance;
            if (primaryTimestamp - encoding.timestamp >= maxTimestampDelta) {
                this.encodingHistory.shift();
            }
            else {
                break;
            }
        }
        // Only add an encoding to the history if the encoding is deemed to be important. An encoding is important if it is
        // a CELT-only packet or contains voice activity.
        const packet = new DataView(primaryPayload);
        if (this.opusPacketIsCeltOnly(packet) ||
            this.opusPacketHasVoiceActivity(packet, packet.byteLength) > 0) {
            // Check if adding an encoding will cause the length of the encoding history to exceed the maximum history size.
            // This is not expected to happen but could occur if we get incorrect timestamps. We want to make sure our memory
            // usage is bounded. In this case, just clear the history and start over from empty.
            if (this.encodingHistory.length + 1 > this.maxEncodingHistorySize)
                this.encodingHistory.length = 0;
            this.encodingHistory.push({ timestamp: primaryTimestamp, payload: primaryPayload });
        }
    }
    /**
     * Initialize packet logs and metric values.
     */
    initializePacketLogs() {
        // The extra space from the max RED recovery distance is to ensure that we do not incorrectly count recovery for
        // packets that have already been received but are outside of the max out-of-order distance.
        const packetLogSize = this.maxOutOfOrderPacketDistance + this.redMaxRecoveryDistance;
        this.primaryPacketLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.redRecoveryLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.fecRecoveryLog = {
            window: new Array(packetLogSize),
            index: 0,
            windowSize: packetLogSize,
        };
        this.totalAudioPacketsExpected = 0;
        this.totalAudioPacketsLost = 0;
        this.totalAudioPacketsRecoveredRed = 0;
        this.totalAudioPacketsRecoveredFec = 0;
    }
    /**
     * Receives encoded frames from the server
     * and adds the timestamps to a packet log
     * to calculate an approximate recovery metric.
     */
    receivePacketLogTransform(
    // @ts-ignore
    frame, controller) {
        const frameMetadata = frame.getMetadata();
        // @ts-ignore
        if (frameMetadata.payloadType !== this.redPayloadType) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        // @ts-ignore
        const encodings = this.splitEncodings(frame.timestamp, frame.data, 
        /*getFecInfo*/ true, frameMetadata.sequenceNumber);
        if (!encodings) {
            this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
            return;
        }
        for (let i = encodings.length - 1; i >= 0; i--) {
            if (this.updateLossStats(encodings[i])) {
                this.updateRedStats(encodings[i]);
                this.updateFecStats(encodings[i]);
            }
        }
        this.maybeReportLossStats(frameMetadata.synchronizationSource, encodings[encodings.length - 1].timestamp);
        this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
    }
    /**
     * Adds a timestamp to the primary packet log.
     * This also updates totalAudioPacketsLost and totalAudioPacketsExpected by looking
     * at the difference between timestamps.
     *
     * @param encoding : The encoding to be analyzed
     * @returns false if sequence number was greater than max out of order distance
     *          true otherwise
     */
    updateLossStats(encoding) {
        if (encoding.isRedundant)
            return true;
        const timestamp = encoding.timestamp;
        const seq = encoding.seq;
        if (this.totalAudioPacketsExpected === 0) {
            this.totalAudioPacketsExpected = 1;
            this.newestSequenceNumber = seq;
            this.addTimestamp(this.primaryPacketLog, timestamp);
            return true;
        }
        const diff = this.int16(seq - this.newestSequenceNumber);
        if (diff < -this.maxOutOfOrderPacketDistance)
            return false;
        if (diff < 0) {
            if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
                if (this.totalAudioPacketsLost > 0)
                    this.totalAudioPacketsLost--;
                this.addTimestamp(this.primaryPacketLog, timestamp);
                this.removeFromRecoveryWindows(timestamp);
            }
        }
        else if (diff > 1) {
            this.totalAudioPacketsLost += diff - 1;
        }
        if (diff > 0) {
            this.totalAudioPacketsExpected += diff;
            this.newestSequenceNumber = encoding.seq;
            this.addTimestamp(this.primaryPacketLog, timestamp);
        }
        return true;
    }
    /**
     * Adds a timestamp to the red recovery log if it is not present in
     * the primary packet log and if it's not too old.
     *
     * @param encoding : The encoding to be analyzed
     */
    updateRedStats(encoding) {
        if (!encoding.isRedundant || this.totalAudioPacketsLost === 0)
            return;
        const timestamp = encoding.timestamp;
        if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
            if (!this.hasTimestamp(this.redRecoveryLog, timestamp)) {
                this.totalAudioPacketsRecoveredRed++;
                this.addTimestamp(this.redRecoveryLog, timestamp);
            }
            if (this.removeTimestamp(this.fecRecoveryLog, timestamp)) {
                /* istanbul ignore else */
                if (this.totalAudioPacketsRecoveredFec > 0)
                    this.totalAudioPacketsRecoveredFec--;
            }
        }
    }
    /**
     * Adds a timestamp to the fec recovery log if it is not present in
     * the primary packet log and red recovery log and if it is not too old.
     *
     * @param encoding : The encoding to be analyzed
     */
    updateFecStats(encoding) {
        if (!encoding.hasFec || this.totalAudioPacketsLost === 0)
            return;
        const fecTimestamp = encoding.timestamp - this.redPacketizationTime;
        if (this.hasTimestamp(this.primaryPacketLog, fecTimestamp) ||
            this.hasTimestamp(this.redRecoveryLog, fecTimestamp) ||
            this.hasTimestamp(this.fecRecoveryLog, fecTimestamp)) {
            return;
        }
        this.totalAudioPacketsRecoveredFec++;
        this.addTimestamp(this.fecRecoveryLog, fecTimestamp);
    }
    /**
     * Reports loss metrics to DefaultTransceiverController
     *
     * @param timestamp : Timestamp of most recent primary packet
     */
    maybeReportLossStats(ssrc, timestamp) {
        if (timestamp === undefined ||
            timestamp - this.lastLossReportTimestamp < this.lossReportInterval)
            return;
        /* istanbul ignore next */
        if (RedundantAudioEncoder.shouldReportStats) {
            // @ts-ignore
            self.postMessage({
                type: 'RedundantAudioEncoderStats',
                ssrc,
                totalAudioPacketsLost: this.totalAudioPacketsLost,
                totalAudioPacketsExpected: this.totalAudioPacketsExpected,
                totalAudioPacketsRecoveredRed: this.totalAudioPacketsRecoveredRed,
                totalAudioPacketsRecoveredFec: this.totalAudioPacketsRecoveredFec,
            });
        }
        this.lastLossReportTimestamp = timestamp;
    }
    /**
     * Adds a timestamp to a packet log
     *
     * @param packetLog : The packetlog to add the timestamp to
     * @param timestamp : The timestamp that should be added
     */
    addTimestamp(packetLog, timestamp) {
        if (timestamp === undefined) {
            return;
        }
        packetLog.window[packetLog.index] = timestamp;
        packetLog.index = (packetLog.index + 1) % packetLog.windowSize;
    }
    /**
     * Checks if a timestamp is in a packetlog
     *
     * @param packetLog : The packetlog to search
     * @param timestamp : The timestamp to search for
     * @returns true if timestamp is present, false otherwise
     */
    hasTimestamp(packetLog, timestamp) {
        const element = packetLog.window.find(t => t === timestamp);
        return !!element;
    }
    /**
     * Removes a timestamp from a packet log
     *
     * @param packetLog : The packetlog from which the timestamp should be removed
     * @param timestamp : The timestamp to be removed
     * @returns true if timestamp was present in the log and removed, false otherwise
     */
    removeTimestamp(packetLog, timestamp) {
        const index = packetLog.window.indexOf(timestamp);
        if (index >= 0) {
            packetLog.window[index] = undefined;
            return true;
        }
        return false;
    }
    /**
     * Removes a timestamp from red and fec recovery windows.
     *
     * @param timestamp : The timestamp to be removed
     */
    removeFromRecoveryWindows(timestamp) {
        let removed = this.removeTimestamp(this.redRecoveryLog, timestamp);
        if (removed) {
            if (this.totalAudioPacketsRecoveredRed > 0)
                this.totalAudioPacketsRecoveredRed--;
        }
        removed = this.removeTimestamp(this.fecRecoveryLog, timestamp);
        if (removed) {
            if (this.totalAudioPacketsRecoveredFec > 0)
                this.totalAudioPacketsRecoveredFec--;
        }
    }
    /**
     * Converts the supplied argument to 32-bit unsigned integer
     */
    uint32WrapAround(num) {
        const mod = 4294967296; // 2^32
        let res = num;
        if (num >= mod) {
            res = num - mod;
        }
        else if (num < 0) {
            res = mod + num;
        }
        return res;
    }
    /**
     * Converts the supplied argument to 16-bit signed integer
     */
    int16(num) {
        return (num << 16) >> 16;
    }
    /**
     * Determines if an Opus packet is in CELT-only mode.
     *
     * @param packet Opus packet.
     * @returns \`true\` if the packet is in CELT-only mode.
     */
    opusPacketIsCeltOnly(packet) {
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        // Since CELT-only packets are represented using configurations 16 to 31, the highest 'config' bit will always be 1
        // for CELT-only packets.
        return !!(packet.getUint8(0) & 0x80);
    }
    /**
     * Gets the number of samples per frame from an Opus packet.
     *
     * @param packet Opus packet. This must contain at least one byte of data.
     * @param sampleRateHz 32-bit integer sampling rate in Hz. This must be a multiple of 400 or inaccurate results will
     *                     be returned.
     * @returns Number of samples per frame.
     */
    opusPacketGetSamplesPerFrame(packet, sampleRateHz) {
        // Sample rate must be a 32-bit integer.
        sampleRateHz = Math.round(sampleRateHz);
        sampleRateHz = Math.min(Math.max(sampleRateHz, -(Math.pow(2, 32))), Math.pow(2, 32) - 1);
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        let numSamples;
        let frameSizeOption;
        // Case for CELT-only packet.
        if (this.opusPacketIsCeltOnly(packet)) {
            // The lower 3 'config' bits indicate the frame size option.
            frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
            // The frame size options 0, 1, 2, 3 correspond to frame sizes of 2.5, 5, 10, 20 ms. Notice that the frame sizes
            // can be represented as (2.5 * 2^0), (2.5 * 2^1), (2.5 * 2^2), (2.5 * 2^3) ms. So, the number of samples can be
            // calculated as follows:
            // (sample/s) * (1s/1000ms) * (2.5ms) * 2^(frameSizeOption)
            // = (sample/s) * (1s/400) * 2^(frameSizeOption)
            // = (sample/s) * 2^(frameSizeOption) * (1s/400)
            numSamples = (sampleRateHz << frameSizeOption) / 400;
        }
        // Case for Hybrid packet. Since Hybrid packets are represented using configurations 12 to 15, bits 1 and 2 in the
        // above TOC byte diagram will both be 1.
        else if ((packet.getUint8(0) & 0x60) === 0x60) {
            // In the case of configuration 13 or 15, bit 4 in the above TOC byte diagram will be 1. Configurations 13 and 15
            // correspond to a 20ms frame size, so the number of samples is calculated as follows:
            // (sample/s) * (1s/1000ms) * (20ms)
            // = (sample/s) * (1s/50)
            //
            // In the case of configuration 12 or 14, bit 4 in the above TOC byte diagram will be 0. Configurations 12 and 14
            // correspond to a 10ms frame size, so the number of samples is calculated as follows:
            // (sample/s) * (1s/1000ms) * (10ms)
            // = (sample/s) * (1s/100)
            numSamples = packet.getUint8(0) & 0x08 ? sampleRateHz / 50 : sampleRateHz / 100;
        }
        // Case for SILK-only packet.
        else {
            // The lower 3 'config' bits indicate the frame size option for SILK-only packets.
            frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
            if (frameSizeOption === 3) {
                // Frame size option 3 corresponds to a frame size of 60ms, so the number of samples is calculated as follows:
                // (sample/s) * (1s/1000ms) * (60ms)
                // = (sample/s) * (60ms) * (1s/1000ms)
                numSamples = (sampleRateHz * 60) / 1000;
            }
            else {
                // The frame size options 0, 1, 2 correspond to frame sizes of 10, 20, 40 ms. Notice that the frame sizes can be
                // represented as (10 * 2^0), (10 * 2^1), (10 * 2^2) ms. So, the number of samples can be calculated as follows:
                // (sample/s) * (1s/1000ms) * (10ms) * 2^(frameSizeOption)
                // = (sample/s) * (1s/100) * 2^(frameSizeOption)
                // = (sample/s) * 2^(frameSizeOption) * (1s/100)
                numSamples = (sampleRateHz << frameSizeOption) / 100;
            }
        }
        return numSamples;
    }
    /**
     * Gets the number of SILK frames per Opus frame.
     *
     * @param packet Opus packet.
     * @returns Number of SILK frames per Opus frame.
     */
    opusNumSilkFrames(packet) {
        // For computing the frame length in ms, the sample rate is not important since it cancels out. We use 48 kHz, but
        // any valid sample rate would work.
        //
        // To calculate the length of a frame (with a 48kHz sample rate) in ms:
        // (samples/frame) * (1s/48000 samples) * (1000ms/s)
        // = (samples/frame) * (1000ms/48000 samples)
        // = (samples/frame) * (1ms/48 samples)
        let frameLengthMs = this.opusPacketGetSamplesPerFrame(packet, 48000) / 48;
        if (frameLengthMs < 10)
            frameLengthMs = 10;
        // The number of SILK frames per Opus frame is described in https://www.rfc-editor.org/rfc/rfc6716#section-4.2.2.
        switch (frameLengthMs) {
            case 10:
            case 20:
                return 1;
            case 40:
                return 2;
            case 60:
                return 3;
            // It is not possible to reach the default case since an Opus packet can only encode sizes of 2.5, 5, 10, 20, 40,
            // or 60 ms, so we ignore the default case for test coverage.
            /* istanbul ignore next */
            default:
                return 0;
        }
    }
    /**
     * Gets the number of channels from an Opus packet.
     *
     * @param packet Opus packet.
     * @returns Number of channels.
     */
    opusPacketGetNumChannels(packet) {
        // TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
        //  0
        //  0 1 2 3 4 5 6 7
        // +-+-+-+-+-+-+-+-+
        // | config  |s| c |
        // +-+-+-+-+-+-+-+-+
        // The 's' bit indicates mono or stereo audio, with 0 indicating mono and 1 indicating stereo.
        return packet.getUint8(0) & 0x4 ? 2 : 1;
    }
    /**
     * Determine the size (in bytes) of an Opus frame.
     *
     * @param packet Opus packet.
     * @param byteOffset Offset (from the start of the packet) to the byte containing the size information.
     * @param remainingBytes Remaining number of bytes to parse from the Opus packet.
     * @param sizeBytes Variable to store the parsed frame size (in bytes).
     * @returns Number of bytes that were parsed to determine the frame size.
     */
    opusParseSize(packet, byteOffset, remainingBytes, sizeBytes) {
        // See https://www.rfc-editor.org/rfc/rfc6716#section-3.2.1 for an explanation of how frame size is represented.
        // If there are no remaining bytes to parse the size from, then the size cannot be determined.
        if (remainingBytes < 1) {
            sizeBytes[0] = -1;
            return -1;
        }
        // If the first byte is in the range 0...251, then this value is the size of the frame.
        else if (packet.getUint8(byteOffset) < 252) {
            sizeBytes[0] = packet.getUint8(byteOffset);
            return 1;
        }
        // If the first byte is in the range 252...255, a second byte is needed. If there is no second byte, then the size
        // cannot be determined.
        else if (remainingBytes < 2) {
            sizeBytes[0] = -1;
            return -1;
        }
        // The total size of the frame given two size bytes is:
        // (4 * secondSizeByte) + firstSizeByte
        else {
            sizeBytes[0] = 4 * packet.getUint8(byteOffset + 1) + packet.getUint8(byteOffset);
            return 2;
        }
    }
    /**
     * Parse binary data containing an Opus packet into one or more Opus frames.
     *
     * @param data Binary data containing an Opus packet to be parsed. The data should begin with the first byte (i.e the
     *             TOC byte) of an Opus packet. Note that the size of the data does not have to equal the size of the
     *             contained Opus packet.
     * @param lenBytes Size of the data (in bytes).
     * @param selfDelimited Indicates if the Opus packet is self-delimiting
     *                      (https://www.rfc-editor.org/rfc/rfc6716#appendix-B).
     * @param tocByte Optional variable to store the TOC (table of contents) byte.
     * @param frameOffsets Optional variable to store the offsets (from the start of the data) to the first bytes of each
     *                     Opus frame.
     * @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
     * @param payloadOffset Optional variable to store the offset (from the start of the data) to the first byte of the
     *                      payload.
     * @param packetLenBytes Optional variable to store the length of the Opus packet (in bytes).
     * @returns Number of Opus frames.
     */
    opusPacketParseImpl(data, lenBytes, selfDelimited, tocByte, frameOffsets, frameSizes, payloadOffset, packetLenBytes) {
        if (!frameSizes || lenBytes < 0)
            return this.OPUS_BAD_ARG;
        if (lenBytes === 0)
            return this.OPUS_INVALID_PACKET;
        // The number of Opus frames in the packet.
        let numFrames;
        // Intermediate storage for the number of bytes parsed to determine the size of a frame.
        let numBytesParsed;
        // The number of the padding bytes (excluding the padding count bytes) in the packet.
        let paddingBytes = 0;
        // Indicates whether CBR (constant bitrate) framing is used.
        let cbr = false;
        // The TOC (table of contents) byte (https://www.rfc-editor.org/rfc/rfc6716#section-3.1).
        const toc = data.getUint8(0);
        // Store the TOC byte.
        if (tocByte)
            tocByte[0] = toc;
        // The remaining number of bytes to parse from the packet. Note that the TOC byte has already been parsed, hence the
        // minus 1.
        let remainingBytes = lenBytes - 1;
        // This keeps track of where we are in the packet. This starts at 1 since the TOC byte has already been read.
        let byteOffset = 1;
        // The size of the last Opus frame in bytes.
        let lastSizeBytes = remainingBytes;
        // Read the \`c\` bits (i.e. code bits) from the TOC byte.
        switch (toc & 0x3) {
            // A code 0 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.2) has one frame.
            case 0:
                numFrames = 1;
                break;
            // A code 1 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.3) has two CBR (constant bitrate) frames.
            case 1:
                numFrames = 2;
                cbr = true;
                if (!selfDelimited) {
                    // Undelimited code 1 packets must be an even number of data bytes, otherwise the packet is invalid.
                    if (remainingBytes & 0x1)
                        return this.OPUS_INVALID_PACKET;
                    // The sizes of both frames are equal (i.e. half of the number of data bytes).
                    lastSizeBytes = remainingBytes / 2;
                    // If \`lastSizeBytes\` is too large, we will catch it later.
                    frameSizes[0][0] = lastSizeBytes;
                }
                break;
            // A code 2 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.4) has two VBR (variable bitrate) frames.
            case 2:
                numFrames = 2;
                numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[0]);
                remainingBytes -= numBytesParsed;
                // The parsed size of the first frame cannot be larger than the number of remaining bytes in the packet.
                if (frameSizes[0][0] < 0 || frameSizes[0][0] > remainingBytes) {
                    return this.OPUS_INVALID_PACKET;
                }
                byteOffset += numBytesParsed;
                // The size of the second frame is the remaining number of bytes after the first frame.
                lastSizeBytes = remainingBytes - frameSizes[0][0];
                break;
            // A code 3 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5) has multiple CBR/VBR frames (from 0 to
            // 120 ms).
            default:
                // Code 3 packets must have at least 2 bytes (i.e. at least 1 byte after the TOC byte).
                if (remainingBytes < 1)
                    return this.OPUS_INVALID_PACKET;
                // Frame count byte format:
                //  0
                //  0 1 2 3 4 5 6 7
                // +-+-+-+-+-+-+-+-+
                // |v|p|     M     |
                // +-+-+-+-+-+-+-+-+
                //
                // Read the frame count byte, which immediately follows the TOC byte.
                const frameCountByte = data.getUint8(byteOffset++);
                --remainingBytes;
                // Read the 'M' bits of the frame count byte, which encode the number of frames.
                numFrames = frameCountByte & 0x3f;
                // The number of frames in a code 3 packet must not be 0.
                if (numFrames <= 0)
                    return this.OPUS_INVALID_PACKET;
                const samplesPerFrame = this.opusPacketGetSamplesPerFrame(data, 48000);
                // A single frame can have at most 2880 samples, which happens in the case where 60ms of 48kHz audio is encoded
                // per frame. A code 3 packet cannot contain more than 120ms of audio, so the total number of samples cannot
                // exceed 2880 * 2 = 5760.
                if (samplesPerFrame * numFrames > 5760)
                    return this.OPUS_INVALID_PACKET;
                // Parse padding bytes if the 'p' bit is 1.
                if (frameCountByte & 0x40) {
                    let paddingCountByte;
                    let numPaddingBytes;
                    // Remove padding bytes (including padding count bytes) from the remaining byte count.
                    do {
                        // Sanity check that there are enough bytes to parse and remove the padding.
                        if (remainingBytes <= 0)
                            return this.OPUS_INVALID_PACKET;
                        // Get the next padding count byte.
                        paddingCountByte = data.getUint8(byteOffset++);
                        --remainingBytes;
                        // If the padding count byte has a value in the range 0...254, then the total size of the padding is the
                        // value in the padding count byte.
                        //
                        // If the padding count byte has value 255, then the total size of the padding is 254 plus the value in the
                        // next padding count byte. Therefore, keep reading padding count bytes while the value is 255.
                        numPaddingBytes = paddingCountByte === 255 ? 254 : paddingCountByte;
                        remainingBytes -= numPaddingBytes;
                        paddingBytes += numPaddingBytes;
                    } while (paddingCountByte === 255);
                }
                // Sanity check that the remaining number of bytes is not negative after removing the padding.
                if (remainingBytes < 0)
                    return this.OPUS_INVALID_PACKET;
                // Read the 'v' bit (i.e. VBR bit).
                cbr = !(frameCountByte & 0x80);
                // VBR case
                if (!cbr) {
                    lastSizeBytes = remainingBytes;
                    // Let M be the number of frames. There will be M - 1 frame length indicators (which can be 1 or 2 bytes)
                    // corresponding to the lengths of frames 0 to M - 2. The size of the last frame (i.e. frame M - 1) is the
                    // number of data bytes after the end of frame M - 2 and before the start of the padding bytes.
                    for (let i = 0; i < numFrames - 1; ++i) {
                        numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[i]);
                        remainingBytes -= numBytesParsed;
                        // The remaining number of data bytes must be enough to contain each frame.
                        if (frameSizes[i][0] < 0 || frameSizes[i][0] > remainingBytes) {
                            return this.OPUS_INVALID_PACKET;
                        }
                        byteOffset += numBytesParsed;
                        lastSizeBytes -= numBytesParsed + frameSizes[i][0];
                    }
                    // Sanity check that the size of the last frame is not negative.
                    if (lastSizeBytes < 0)
                        return this.OPUS_INVALID_PACKET;
                }
                // CBR case
                else if (!selfDelimited) {
                    // The size of each frame is the number of data bytes divided by the number of frames.
                    lastSizeBytes = Math.trunc(remainingBytes / numFrames);
                    // The number of data bytes must be a non-negative integer multiple of the number of frames.
                    if (lastSizeBytes * numFrames !== remainingBytes)
                        return this.OPUS_INVALID_PACKET;
                    // All frames have equal size in the undelimited CBR case.
                    for (let i = 0; i < numFrames - 1; ++i) {
                        frameSizes[i][0] = lastSizeBytes;
                    }
                }
        }
        // Self-delimited framing uses an extra 1 or 2 bytes, immediately preceding the data bytes, to indicate either the
        // size of the last frame (for code 0, code 2, and VBR code 3 packets) or the size of all the frames (for code 1 and
        // CBR code 3 packets). See https://www.rfc-editor.org/rfc/rfc6716#appendix-B.
        if (selfDelimited) {
            // The extra frame size byte(s) will always indicate the size of the last frame.
            numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[numFrames - 1]);
            remainingBytes -= numBytesParsed;
            // There must be enough data bytes for the last frame.
            if (frameSizes[numFrames - 1][0] < 0 || frameSizes[numFrames - 1][0] > remainingBytes) {
                return this.OPUS_INVALID_PACKET;
            }
            byteOffset += numBytesParsed;
            // For CBR packets, the sizes of all the frames are equal.
            if (cbr) {
                // There must be enough data bytes for all the frames.
                if (frameSizes[numFrames - 1][0] * numFrames > remainingBytes) {
                    return this.OPUS_INVALID_PACKET;
                }
                for (let i = 0; i < numFrames - 1; ++i) {
                    frameSizes[i][0] = frameSizes[numFrames - 1][0];
                }
            }
            // At this point, \`lastSizeBytes\` contains the size of the last frame plus the size of the extra frame size
            // byte(s), so sanity check that \`lastSizeBytes\` is the upper bound for the size of the last frame.
            else if (!(numBytesParsed + frameSizes[numFrames - 1][0] <= lastSizeBytes)) {
                return this.OPUS_INVALID_PACKET;
            }
        }
        // Undelimited case
        else {
            // Because the size of the last packet is not encoded explicitly, it is possible that the size of the last packet
            // (or of all the packets, for the CBR case) is larger than maximum frame size.
            if (lastSizeBytes > this.OPUS_MAX_FRAME_SIZE_BYTES)
                return this.OPUS_INVALID_PACKET;
            frameSizes[numFrames - 1][0] = lastSizeBytes;
        }
        // Store the offset to the start of the payload.
        if (payloadOffset)
            payloadOffset[0] = byteOffset;
        // Store the offsets to the start of each frame.
        for (let i = 0; i < numFrames; ++i) {
            if (frameOffsets)
                frameOffsets[i][0] = byteOffset;
            byteOffset += frameSizes[i][0];
        }
        // Store the length of the Opus packet.
        if (packetLenBytes)
            packetLenBytes[0] = byteOffset + paddingBytes;
        return numFrames;
    }
    /**
     * Parse a single undelimited Opus packet into one or more Opus frames.
     *
     * @param packet Opus packet to be parsed.
     * @param lenBytes Size of the packet (in bytes).
     * @param tocByte Optional variable to store the TOC (table of contents) byte.
     * @param frameOffsets Optional variable to store the offsets (from the start of the packet) to the first bytes of
     *                     each Opus frame.
     * @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
     * @param payloadOffset Optional variable to store the offset (from the start of the packet) to the first byte of the
     *                      payload.
     * @returns Number of Opus frames.
     */
    opusPacketParse(packet, lenBytes, tocByte, frameOffsets, frameSizes, payloadOffset) {
        return this.opusPacketParseImpl(packet, lenBytes, 
        /* selfDelimited */ false, tocByte, frameOffsets, frameSizes, payloadOffset, null);
    }
    /**
     * This function returns the SILK VAD (voice activity detection) information encoded in the Opus packet. For CELT-only
     * packets that do not have VAD information, it returns -1.
     *
     * @param packet Opus packet.
     * @param lenBytes Size of the packet (in bytes).
     * @returns  0: no frame had the VAD flag set.
     *           1: at least one frame had the VAD flag set.
     *          -1: VAD status could not be determined.
     */
    opusPacketHasVoiceActivity(packet, lenBytes) {
        if (!packet || lenBytes <= 0)
            return 0;
        // In CELT-only mode, we can not determine whether there is VAD.
        if (this.opusPacketIsCeltOnly(packet))
            return -1;
        const numSilkFrames = this.opusNumSilkFrames(packet);
        // It is not possible for \`opusNumSilkFrames()\` to return 0, so we ignore the next sanity check for test coverage.
        /* istanbul ignore next */
        if (numSilkFrames === 0)
            return -1;
        const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
        const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
        for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
            opusFrameOffsets[i] = [undefined];
            opusFrameSizes[i] = [undefined];
        }
        // Parse packet to get the Opus frames.
        const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
        // VAD status cannot be determined for invalid packets.
        if (numOpusFrames < 0)
            return -1;
        // Iterate over all Opus frames, which may contain multiple SILK frames, to determine the VAD status.
        for (let i = 0; i < numOpusFrames; ++i) {
            if (opusFrameSizes[i][0] < 1)
                continue;
            // LP layer header bits format (https://www.rfc-editor.org/rfc/rfc6716#section-4.2.3):
            //
            // Mono case:
            // +-----------------+----------+
            // | 1 to 3 VAD bits | LBRR bit |
            // +-----------------+----------+
            //
            // Stereo case:
            // +---------------------+--------------+----------------------+---------------+
            // | 1 to 3 mid VAD bits | mid LBRR bit | 1 to 3 side VAD bits | side LBRR bit |
            // +---------------------+--------------+----------------------+---------------+
            // The upper 1 to 3 bits (dependent on the number of SILK frames) of the LP layer contain VAD bits. If any of
            // these VAD bits are 1, then voice activity is present.
            if (packet.getUint8(opusFrameOffsets[i][0]) >> (8 - numSilkFrames))
                return 1;
            // In the stereo case, there is a second set of 1 to 3 VAD bits, so also check these VAD bits.
            const channels = this.opusPacketGetNumChannels(packet);
            if (channels === 2 &&
                (packet.getUint8(opusFrameOffsets[i][0]) << (numSilkFrames + 1)) >> (8 - numSilkFrames)) {
                return 1;
            }
        }
        // No voice activity was detected.
        return 0;
    }
    /**
     * This method is based on Definition of the Opus Audio Codec
     * (https://tools.ietf.org/html/rfc6716). Basically, this method is based on
     * parsing the LP layer of an Opus packet, particularly the LBRR flag.
     *
     * @param packet Opus packet.
     * @param lenBytes Size of the packet (in bytes).
     * @returns  true: packet has fec encoding about previous packet.
     *           false: no fec encoding present.
     */
    opusPacketHasFec(packet, lenBytes) {
        if (!packet || lenBytes <= 0)
            return false;
        // In CELT-only mode, packets should not have FEC.
        if (this.opusPacketIsCeltOnly(packet))
            return false;
        const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
        const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
        for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
            opusFrameOffsets[i] = [undefined];
            opusFrameSizes[i] = [undefined];
        }
        // Parse packet to get the Opus frames.
        const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
        if (numOpusFrames < 0)
            return false;
        /* istanbul ignore next */
        if (opusFrameSizes[0][0] <= 1)
            return false;
        const numSilkFrames = this.opusNumSilkFrames(packet);
        /* istanbul ignore next */
        if (numSilkFrames === 0)
            return false;
        const channels = this.opusPacketGetNumChannels(packet);
        /* istanbul ignore next */
        if (channels !== 1 && channels !== 2)
            return false;
        // A frame starts with the LP layer. The LP layer begins with two to eight
        // header bits.These consist of one VAD bit per SILK frame (up to 3),
        // followed by a single flag indicating the presence of LBRR frames.
        // For a stereo packet, these first flags correspond to the mid channel, and
        // a second set of flags is included for the side channel. Because these are
        // the first symbols decoded by the range coder and because they are coded
        // as binary values with uniform probability, they can be extracted directly
        // from the most significant bits of the first byte of compressed data.
        for (let i = 0; i < channels; i++) {
            if (packet.getUint8(opusFrameOffsets[0][0]) & (0x80 >> ((i + 1) * (numSilkFrames + 1) - 1)))
                return true;
        }
        return false;
    }
}
RedundantAudioEncoder.shouldLog = true;
RedundantAudioEncoder.shouldReportStats = true;
RedundantAudioEncoder.initializeWorker();
`},0x573f705d:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x6ee73800));p.default=class extends _.default{constructor(){super(0)}static nextTick(o){setTimeout(o,0)}}},0x7b80cc62:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.intervalMs=o}start(o){this.stop(),this.timer=setInterval(o,this.intervalMs)}stop(){void 0!==this.timer&&(clearInterval(this.timer),this.timer=void 0)}running(){return void 0!==this.timer}}},0x6ee73800:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.timeoutMs=o,this.timer=null}start(o){this.stop(),this.timer=setTimeout(()=>{clearTimeout(this.timer),o()},this.timeoutMs)}stop(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}}},0x1fa7d4829:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19cb5e2ee)),w=m(f(0xe8571b46)),I=m(f(0x17e3191d)),k=class SDP{constructor(o){this.sdp=o}clone(){return new SDP(this.sdp)}static isRTPCandidate(o){let p=/candidate[:](\S+) (\d+)/g.exec(o);return null!==p&&"1"===p[2]}static linesToSDP(o){return new SDP(o.join(SDP.CRLF))}static candidateTypeFromString(o){switch(o){case _.default.Host:return _.default.Host;case _.default.ServerReflexive:return _.default.ServerReflexive;case _.default.PeerReflexive:return _.default.PeerReflexive;case _.default.Relay:return _.default.Relay}return null}static candidateType(o){let p=/a[=]candidate[:].* typ ([a-z]+) /g.exec(o);return null===p?null:SDP.candidateTypeFromString(p[1])}static mediaType(o){let p=/m=(audio|video)/g.exec(o);if(null!==p)return p[1]}static mid(o){if(o.includes("a=mid:"))return o.replace(/^(a=mid:)/,"")}static direction(o){let p=/a=(sendrecv|sendonly|recvonly|inactive)/g.exec(o);if(null!==p)return p[1]}static splitLines(o){return o.trim().split(`
`).map(o=>o.trim())}static splitSections(o){return o.split(`
m=`).map((o,p)=>(p>0?"m="+o:o).trim()+SDP.CRLF)}static findActiveCameraSection(o){let p=0,f=!1;for(let m of o){if(/^m=video/.test(m)&&(m.indexOf("sendrecv")>-1||-1===m.indexOf("sendonly")&&-1===m.indexOf("recvonly")&&-1===m.indexOf("inactive"))){f=!0;break}p++}return!1===f&&(p=-1),p}static extractSSRCsFromFIDGroupLine(o){return/^a=ssrc-group:FID\s(.+)/.exec(o)[1]}static matchPrefix(o,p){return SDP.splitLines(o).filter(o=>0===o.indexOf(p))}lines(){return this.sdp.split(SDP.CRLF)}hasVideo(){return null!==/^m=video/gm.exec(this.sdp)}hasCandidates(){return null!==/a[=]candidate[:]/g.exec(this.sdp)}hasCandidatesForAllMLines(){return!(this.sdp.indexOf("c=IN IP4 0.0.0.0")>-1)}withoutCandidateType(o){return SDP.linesToSDP(this.lines().filter(p=>SDP.candidateType(p)!==o))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(_.default.ServerReflexive)}withAudioMaxAverageBitrate(o){if(!o)return this.clone();o=Math.trunc(Math.min(Math.max(o,SDP.rfc7587LowestBitrate),SDP.rfc7587HighestBitrate));let p=this.lines(),f=SDP.findOpusFmtpAttributes(p),m=SDP.updateOpusFmtpAttributes(p,f,[`maxaveragebitrate=${o}`]);return SDP.linesToSDP(m)}withStereoAudio(){let o=this.lines(),p=SDP.findOpusFmtpAttributes(o),f=SDP.updateOpusFmtpAttributes(o,p,["stereo=1","sprop-stereo=1"]);return SDP.linesToSDP(f)}static findOpusFmtpAttributes(o){let p=/^a=rtpmap:\s*(\d+)\s+opus\/48000/,f=!1,m=[];for(let _ of o)if(_.startsWith("m=audio")&&(m.push(null),f=!0),_.startsWith("m=video")&&(f=!1),f){let o=p.exec(_);null!==o&&(m[m.length-1]=`a=fmtp:${o[1]} `)}return m}static updateOpusFmtpAttributes(o,p,f){let m=[],_=0,w=null;for(let I of o)if(I.startsWith("m=audio")&&(w=p[_],_++),I.startsWith("m=video")&&(w=null),w&&I.startsWith(w)){let o=I.slice(w.length).split(";"),p=[];for(let m of o)0>f.findIndex(o=>o.startsWith(m.split("=")[0]))&&p.push(m);for(let o of f)p.push(o);m.push(w+p.join(";"))}else m.push(I);return m}withUnifiedPlanFormat(){let o=this.sdp;return o.includes("mozilla")?this.clone():new SDP(o=o.replace("o=-","o=mozilla-chrome"))}getUniqueRtpHeaderExtensionId(o){let p=[];for(let f of o)if(/^a=extmap:/.test(f.trim())){let o=+f.split("a=extmap:")[1].split(" ")[0];p.includes(o)||p.push(o)}p.sort((o,p)=>o-p);let f=0;for(let o of p){if(o-f>1)return f+1;f=o}return 14===f?-1:f+1}withVideoLayersAllocationRtpHeaderExtension(o){return this.withRtpHeaderExtension(o,SDP.videoLayersAllocationRtpHeaderExtensionUrl)}withDependencyDescriptorRtpHeaderExtension(o){return this.withRtpHeaderExtension(o,SDP.dependencyDescriptorRtpHeaderExtensionUrl)}withoutDependencyDescriptorRtpHeaderExtension(){let o=SDP.splitLines(this.sdp).filter(o=>!o.includes(SDP.dependencyDescriptorRtpHeaderExtensionUrl));return new SDP(o.join(SDP.CRLF)+SDP.CRLF)}withRtpHeaderExtension(o,p){let f=o?o.getRtpHeaderExtensionId(p):-1,m=-1===f?this.getUniqueRtpHeaderExtensionId(SDP.splitLines(this.sdp)):f,_=SDP.splitSections(this.sdp),w=[];for(let o of _){if(/^m=video/.test(o)&&-1===SDP.getRtpHeaderExtensionIdInSection(o,p)){let f=SDP.splitLines(o),_=[];if(-1===m||this.hasRtpHeaderExtensionId(m)){w.push(o);continue}for(let o of f)if(_.push(o),/^a=sendrecv/.test(o.trim())){let o="a=extmap:"+m+" "+p;_.push(o)}o=_.join(SDP.CRLF)+SDP.CRLF}else if(-1!==f&&/^m=video/.test(o)&&SDP.getRtpHeaderExtensionIdInSection(o,p)!==f){let m=SDP.splitLines(o),_=[];for(let o of m){if(/^a=extmap:/.test(o.trim())&&o.split("a=extmap:")[1].split(" ")[1]===p){if(!this.hasRtpHeaderExtensionId(f)){let o="a=extmap:"+f+" "+p;_.push(o)}continue}_.push(o)}o=_.join(SDP.CRLF)+SDP.CRLF}w.push(o)}return new SDP(w.join(""))}ssrcForVideoSendingSection(){let o=this.sdp,p=SDP.splitSections(o);if(p.length<2)return"";let f=SDP.findActiveCameraSection(p);if(-1===f)return"";let m=SDP.matchPrefix(p[f],"a=ssrc-group:FID ");if(m.length<1)return"";let[_]=SDP.extractSSRCsFromFIDGroupLine(m[0]).split(" ").map(o=>parseInt(o,10));return _.toString()}videoSendSectionHasDifferentSSRC(o){let p=this.ssrcForVideoSendingSection(),f=o.ssrcForVideoSendingSection();return""!==p&&""!==f&&parseInt(p,10)!==parseInt(f,10)}removeH264SupportFromSendSection(){let o=this.sdp,p=SDP.splitSections(o),f=SDP.findActiveCameraSection(p);if(-1===f)return new SDP(this.sdp);let m=p[f],_=SDP.splitLines(m),w=[],I=new Map;_.forEach(o=>{if(/^a=rtpmap:/.test(o)){let p=/^a=rtpmap:([0-9]+)\s/.exec(o);p&&o.toLowerCase().includes("h264")&&w.push(parseInt(p[1],10))}if(/^a=fmtp:/.test(o)){let p=/^a=fmtp:([0-9]+) apt=([0-9]+)/.exec(o);if(p&&3===p.length){let o=parseInt(p[1],10),f=parseInt(p[2],10);I.has(f)?I.get(f).push(o):I.set(f,[o])}}});let k=new Set;for(let o of w){k.add(o);let p=I.get(o);if(p)for(let o of p)k.add(o)}if(w.length>0){let o=_[0].split(" ");_[0]=o.filter(o=>!k.has(parseInt(o))).join(" ")}let M=_.filter(o=>{if(!o.includes("rtpmap")&&!o.includes("rtcp-fb")&&!o.includes("fmtp"))return!0;for(let p of k)if(o.includes(p.toString()))return!1;return!0});return p[f]=M.join(SDP.CRLF)+SDP.CRLF,new SDP(p.join(""))}mediaSections(){let o=SDP.splitSections(this.sdp);if(o.length<2)return[];let p=[];for(let f=1;f<o.length;f++){let m=new w.default;for(let p of SDP.splitLines(o[f])){let o=SDP.mediaType(p);if(void 0!==o){m.mediaType=o;continue}let f=SDP.direction(p);if(void 0!==f){m.direction=f;continue}let _=SDP.mid(p);if(void 0!==_){m.mid=_;continue}}p.push(m)}return p}static getRtpHeaderExtensionIdInSection(o,p){for(let f of SDP.splitLines(o))if(/^a=extmap:/.test(f.trim())){let o=f.split("a=extmap:")[1].split(" "),m=+o[0];if(o[1]===p)return m}return -1}getRtpHeaderExtensionId(o){for(let p of SDP.splitSections(this.sdp))if(/^m=video/.test(p)){let f=SDP.getRtpHeaderExtensionIdInSection(p,o);if(-1!==f)return f}return -1}hasRtpHeaderExtensionId(o){for(let p of SDP.splitLines(this.sdp))if(/^a=extmap:/.test(p.trim())&&+p.split("a=extmap:")[1].split(" ")[0]===o)return!0;return!1}withVideoSendCodecPreferences(o){let p=this.sdp,f=SDP.splitSections(p),m=SDP.findActiveCameraSection(f);return -1===m?new SDP(this.sdp):(f[m]=this.sectionWithCodecPreferences(f[m],o),new SDP(f.join("")))}sectionWithCodecPreferences(o,p){let f=new Map,m=SDP.splitLines(o);m.forEach(o=>{if(!o.startsWith("a=rtpmap:"))return;let _=/^a=rtpmap:(\d+)\s/.exec(o);if(!_)return;let w=_[1];for(let _ of p){if(!o.includes(`${_.codecName}/${_.codecCapability.clockRate}`))continue;let p=!1;if(void 0!==_.codecCapability.sdpFmtpLine){let o=!1;for(let f of m){if(_.fmtpLineMatches(f,parseInt(w))){p=!0;break}o||(o=f.startsWith(`a=fmtp:${w} profile-id=`))}_.equals(I.default.vp9Profile0())&&!o&&(p=!0)}else p=!0;if(p){f.set(w,_);break}}});let _=new Set(f.keys()),w=m[0].split(" ").filter(o=>!_.has(o)),k=Array.from(f.entries()).sort(([o,f],[m,_])=>p.indexOf(f)-p.indexOf(_)).map(([o,p])=>o);return w.splice(3,0,...k),m[0]=w.join(" "),m.join(SDP.CRLF)+SDP.CRLF}highestPriorityVideoSendCodec(){let o=this.prioritizedSendVideoCodecCapabilities();return o.length>0?o[0]:void 0}prioritizedSendVideoCodecCapabilities(){let o=this.sdp,p=SDP.splitSections(o),f=SDP.findActiveCameraSection(p);if(-1===f)return[];let m=SDP.splitLines(p[f]),_=m[0].split(" ");return _.length<4?[]:_.slice(3).map(o=>this.videoCodecCapabilityForPayloadType(m,o)).filter(o=>void 0!==o&&["VP8","H264","VP9","AV1"].includes(o.codecName))}videoCodecCapabilityForPayloadType(o,p){let f,m,_;for(let w of o){let o=/^a=rtpmap:([0-9]+)\s/.exec(w);if(o&&o[1]===p){let o=w.split(" ")[1].split("/");o.length>=2&&(f=o[0],m=o[1])}w.startsWith(`a=fmtp:${p} `)&&(_=w.split(" ")[1])}if(void 0!==f)return new I.default(f,{clockRate:parseInt(m),mimeType:`video/${f}`,sdpFmtpLine:_})}getAudioPayloadTypes(){let o=new Map,p=this.sdp,f=SDP.splitSections(p);return o.set("opus",SDP.findAudioPayloadType("opus",f)),o.set("red",SDP.findAudioPayloadType("red",f)),o}static findAudioPayloadType(o,p){let f=RegExp(`a=rtpmap:\\s*(\\d+)\\s+${o}\\/48000`);for(let o of p)if(/^m=audio/.test(o)){let p=f.exec(o);if(null!==p)return Number(p[1])}return 0}withStartingVideoSendBitrate(o){let p=SDP.splitSections(this.sdp);for(let f=0;f<p.length;f++){let m;if(!/^m=video/.test(p[f]))continue;let _=SDP.splitLines(p[f]),w=[],I=!1;for(let o of _){/^a=fmtp:\d*/.test(o)&&!/apt=/.test(o)&&(I=!0);let p=o.match(/^a=rtpmap:(\d+)/);p&&(m=p[1])}for(let p of _)if(!/^a=fmtp:\d*/.test(p)||/apt=/.test(p)||/x-google-start-bitrate=/.test(p))w.push(p);else{let f=p+`;x-google-start-bitrate=${o}`;w.push(f)}if(!I&&m){let p=w.findIndex(o=>o.match(/^a=rtpmap:\d+/));-1!==p&&w.splice(p+1,0,`a=fmtp:${m} x-google-start-bitrate=${o}`)}p[f]=w.join(SDP.CRLF)+SDP.CRLF}return new SDP(p.join(""))}};p.default=k,k.CRLF=`\r
`,k.rfc7587LowestBitrate=6e3,k.rfc7587HighestBitrate=51e4,k.dependencyDescriptorRtpHeaderExtensionUrl="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension",k.videoLayersAllocationRtpHeaderExtensionUrl="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"},0x19cb5e2ee:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SDPCandidateType=void 0,(m=f=p.SDPCandidateType||(p.SDPCandidateType={})).Host="host",m.ServerReflexive="srflx",m.PeerReflexive="prflx",m.Relay="relay",p.default=f},0xe8571b46:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x17e3191d:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xe88b24d9);p.default=class VideoCodecCapability{constructor(o,p){this.codecName=o,this.codecCapability=p}equals(o){return void 0!==o&&this.codecName===o.codecName&&this.codecCapability.mimeType===o.codecCapability.mimeType&&this.codecCapability.clockRate===o.codecCapability.clockRate&&(this.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(this.codecCapability.sdpFmtpLine,this.codecName):"")===(o.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(o.codecCapability.sdpFmtpLine,o.codecName):"")}fmtpLineMatches(o,p){let f=this.codecCapability.sdpFmtpLine;if(!f)return!1;let m=`a=fmtp:${p} `;if(!o.startsWith(m))return!1;let _=o.substring(m.length);return this.cleanupFmtpLine(_,this.codecName)===this.cleanupFmtpLine(f,this.codecName)}cleanupFmtpLine(o,p){let f=o.replace(/;x-google-start-bitrate=\d+/g,"");return"H264"===p&&(f=f.replace(/profile-level-id=([0-9a-f]{4})[0-9a-f]{2}/i,"profile-level-id=$1")),f}static vp8(){return new VideoCodecCapability("VP8",{clockRate:9e4,mimeType:"video/VP8"})}static h264BaselineProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"})}static h264ConstrainedBaselineProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"})}static h264MainProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f"})}static h264HighProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f"})}static h264ConstrainedHighProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f"})}static h264(){return VideoCodecCapability.h264ConstrainedBaselineProfile()}static vp9Profile0(){return new VideoCodecCapability("VP9",{clockRate:9e4,mimeType:"video/VP9",sdpFmtpLine:"profile-id=0"})}static vp9(){return VideoCodecCapability.vp9Profile0()}static av1Main(){return new VideoCodecCapability("AV1",{clockRate:9e4,mimeType:"video/AV1"})}static av1(){return VideoCodecCapability.av1Main()}static fromSignaled(o){switch(o){case m.SdkVideoCodecCapability.VP8:return VideoCodecCapability.vp8();case m.SdkVideoCodecCapability.H264_BASELINE_PROFILE:return VideoCodecCapability.h264BaselineProfile();case m.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:return VideoCodecCapability.h264ConstrainedBaselineProfile();case m.SdkVideoCodecCapability.H264_MAIN_PROFILE:return VideoCodecCapability.h264MainProfile();case m.SdkVideoCodecCapability.H264_HIGH_PROFILE:return VideoCodecCapability.h264HighProfile();case m.SdkVideoCodecCapability.H264_CONSTRAINED_HIGH_PROFILE:return VideoCodecCapability.h264ConstrainedHighProfile();case m.SdkVideoCodecCapability.VP9_PROFILE_0:return VideoCodecCapability.vp9Profile0();case m.SdkVideoCodecCapability.AV1_MAIN_PROFILE:return VideoCodecCapability.av1Main();default:return}}}},0xb97f5b8b:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x168308164),_=class ZLIBTextCompressor{constructor(o){this.logger=o}compress(o,p){if(p.length>0){let o=Math.min(p.length,ZLIBTextCompressor.MAX_DICTIONARY_SIZE);p=p.slice(0,o)}let f={memLevel:ZLIBTextCompressor.Z_MEM_LEVEL,dictionary:p};return m.deflateRaw(o,f)}decompress(o,p){if(p.length>0){let o=Math.min(p.length,ZLIBTextCompressor.MAX_DICTIONARY_SIZE);p=p.slice(0,o)}let f={to:"string",dictionary:p,chunkSize:4096},_="";try{_=m.inflateRaw(o,f)}catch(o){this.logger.error(`failed to decompress the string with error: [${o}]`)}return _}};p.default=_,_.Z_MEM_LEVEL=9,_.MAX_DICTIONARY_SIZE=31744},0x1c843e818:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x195905627),_=f(0xb577390f),w=f(0xd03588a6),I=f(0x14f60ed93);p.default=class{constructor(o){this.logger=o,this.currentState=w.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(o,p){let f=this.currentState;if(f===w.SessionStateControllerState.NotConnected&&o===m.SessionStateControllerAction.Connect)this.transition(w.SessionStateControllerState.Connecting,o);else if(f===w.SessionStateControllerState.Connecting&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connecting&&o===m.SessionStateControllerAction.FinishConnecting)this.transition(w.SessionStateControllerState.Connected,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Disconnect)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Reconnect)this.transition(w.SessionStateControllerState.Connecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Update)this.transition(w.SessionStateControllerState.Updating,o);else if(f===w.SessionStateControllerState.Updating&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Updating&&o===m.SessionStateControllerAction.FinishUpdating)this.transition(w.SessionStateControllerState.Connected,o);else if(f===w.SessionStateControllerState.Disconnecting&&o===m.SessionStateControllerAction.FinishDisconnecting)this.transition(w.SessionStateControllerState.NotConnected,o);else if(this.canDefer(o))return this.logger.info(`deferring transition from ${w.SessionStateControllerState[this.currentState]} with ${m.SessionStateControllerAction[o]}`),this.deferAction(o,p),I.SessionStateControllerTransitionResult.DeferredTransition;else return this.logger.warn(`no transition found from ${w.SessionStateControllerState[this.currentState]} with ${m.SessionStateControllerAction[o]}`),I.SessionStateControllerTransitionResult.NoTransitionAvailable;try{p()}catch(p){return this.logger.error(`error during state ${w.SessionStateControllerState[this.currentState]} with action ${m.SessionStateControllerAction[o]}: ${p}`),this.logger.info(`rolling back transition to ${w.SessionStateControllerState[f]}`),this.currentState=f,I.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),I.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(o,p){this.logger.info(`transitioning from ${w.SessionStateControllerState[this.currentState]} to ${w.SessionStateControllerState[o]} with ${m.SessionStateControllerAction[p]}`),this.currentState=o}deferPriority(o){switch(o){case m.SessionStateControllerAction.Disconnect:return _.SessionStateControllerDeferPriority.VeryHigh;case m.SessionStateControllerAction.Fail:return _.SessionStateControllerDeferPriority.High;case m.SessionStateControllerAction.Reconnect:return _.SessionStateControllerDeferPriority.Medium;case m.SessionStateControllerAction.Update:return _.SessionStateControllerDeferPriority.Low;default:return _.SessionStateControllerDeferPriority.DoNotDefer}}deferAction(o,p){null!==this.deferredAction&&this.deferPriority(this.deferredAction)>this.deferPriority(o)||(this.deferredAction=o,this.deferredWork=p)}canDefer(o){return this.deferPriority(o)!==_.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===w.SessionStateControllerState.Connecting||this.currentState===w.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;let o=this.deferredAction,p=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${m.SessionStateControllerAction[o]}`),this.perform(o,p)!==I.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${m.SessionStateControllerAction[o]} in state ${w.SessionStateControllerState[this.currentState]}`)}}},0x195905627:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerAction=void 0,(m=f=p.SessionStateControllerAction||(p.SessionStateControllerAction={}))[m.Connect=0]="Connect",m[m.FinishConnecting=1]="FinishConnecting",m[m.Update=2]="Update",m[m.FinishUpdating=3]="FinishUpdating",m[m.Reconnect=4]="Reconnect",m[m.Disconnect=5]="Disconnect",m[m.Fail=6]="Fail",m[m.FinishDisconnecting=7]="FinishDisconnecting",p.default=f},0xb577390f:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerDeferPriority=void 0,(m=f=p.SessionStateControllerDeferPriority||(p.SessionStateControllerDeferPriority={}))[m.DoNotDefer=0]="DoNotDefer",m[m.Low=1]="Low",m[m.Medium=2]="Medium",m[m.High=3]="High",m[m.VeryHigh=4]="VeryHigh",p.default=f},0xd03588a6:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerState=void 0,(m=f=p.SessionStateControllerState||(p.SessionStateControllerState={}))[m.NotConnected=0]="NotConnected",m[m.Connecting=1]="Connecting",m[m.Connected=2]="Connected",m[m.Updating=3]="Updating",m[m.Disconnecting=4]="Disconnecting",p.default=f},0x14f60ed93:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerTransitionResult=void 0,(m=f=p.SessionStateControllerTransitionResult||(p.SessionStateControllerTransitionResult={}))[m.Transitioned=0]="Transitioned",m[m.NoTransitionAvailable=1]="NoTransitionAvailable",m[m.DeferredTransition=2]="DeferredTransition",m[m.TransitionFailed=3]="TransitionFailed",p.default=f},0x24718f0be:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x165009cb4)),w=m(f(0x6ee73800)),I=f(0xe88b24d9),k=f(0x149d24991),M=m(f(0xaf1ae5b3)),x=m(f(0x3350552d)),O=m(f(0x165cc79a4)),L=f(0x1e93e1412),B=m(f(0x872e39a3)),U=m(f(0x16bec8feb)),$=class DefaultSignalingClient{constructor(o,p){this.webSocket=o,this.logger=p,this.closeEventHandler=o=>{this.resetConnection(),this.sendEvent(new B.default(this,U.default.WebSocketClosed,null,o.code,o.reason,o.wasClean)),this.serviceConnectionRequestQueue()},this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug(()=>"signaling client init"),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(o){this.logger.debug(()=>"registering signaling client observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.debug(()=>"removing signaling client observer"),this.observerQueue.delete(o)}openConnection(o){this.logger.info("adding connection request to queue: "+o.url()),this.connectionRequestQueue.push(o),this.closeConnection()}pingPong(o){this.logger.debug(()=>"sending ping");let p=I.SdkSignalFrame.create();return p.type=I.SdkSignalFrame.Type.PING_PONG,p.pingPong=o,this.sendMessage(p),p.timestampMs}join(o){this.logger.info("sending join");let p=I.SdkJoinFrame.create();p.protocolVersion=2,p.flags=I.SdkJoinFlags.HAS_STREAM_UPDATE;let f=new _.default,m={platformName:f.name(),platformVersion:f.version(),clientSource:M.default.sdkName,chimeSdkVersion:M.default.sdkVersion,clientUtcOffset:k.getFormattedOffset(new Date().getTimezoneOffset())};if(o.applicationMetadata){let{appName:p,appVersion:f}=o.applicationMetadata;m.appName=p,m.appVersion=f}p.clientDetails=I.SdkClientDetails.create(m),p.audioSessionId=this.audioSessionId,p.wantsCompressedSdp=DefaultSignalingClient.CLIENT_SUPPORTS_COMPRESSION,p.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender,p.serverSideNetworkAdaption=L.convertServerSideNetworkAdaptionEnumToSignaled(o.serverSideNetworkAdaption),p.supportedServerSideNetworkAdaptions=o.supportedServerSideNetworkAdaptions.map(L.convertServerSideNetworkAdaptionEnumToSignaled),p.wantsAllTemporalLayersInIndex=o.wantsAllTemporalLayersInIndex;let w=I.SdkSignalFrame.create();w.type=I.SdkSignalFrame.Type.JOIN,w.join=p,this.sendMessage(w)}subscribe(o){let p=I.SdkSubscribeFrame.create();if(p.sendStreams=[],p.sdpOffer=o.sdpOffer,o.connectionTypeHasVideo&&(p.receiveStreamIds=o.receiveStreamIds),o.audioHost&&(p.audioCheckin=o.audioCheckin,p.audioHost=o.audioHost,p.audioMuted=o.audioMuted,!o.audioCheckin)){let f=I.SdkStreamDescriptor.create();f.mediaType=I.SdkStreamMediaType.AUDIO,f.trackLabel="AmazonChimeExpressAudio",f.attendeeId=o.attendeeId,f.streamId=1,f.groupId=1,f.framerate=15,f.maxBitrateKbps=600,f.avgBitrateBps=4e5,p.sendStreams.push(f)}if(p.compressedSdpOffer=o.compressedSdpOffer,p.duplex=I.SdkStreamServiceType.RX,o.localVideoEnabled){p.duplex=I.SdkStreamServiceType.DUPLEX;for(let f=0;f<o.videoStreamDescriptions.length;f++){let m=o.videoStreamDescriptions[f].clone();m.attendeeId=o.attendeeId,p.sendStreams.push(m.toStreamDescriptor())}}o.videoSubscriptionConfiguration.length>0&&(p.videoSubscriptionConfiguration=o.videoSubscriptionConfiguration.map(this.convertSignalingClientVideoSubscriptionConfiguration));let f=I.SdkSignalFrame.create();f.type=I.SdkSignalFrame.Type.SUBSCRIBE,f.sub=p,this.sendMessage(f)}remoteVideoUpdate(o,p){let f=I.SdkRemoteVideoUpdateFrame.create();f.addedOrUpdatedVideoSubscriptions=o.map(this.convertSignalingClientVideoSubscriptionConfiguration),f.removedVideoSubscriptionMids=p;let m=I.SdkSignalFrame.create();m.type=I.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,m.remoteVideoUpdate=f,this.sendMessage(m)}convertSignalingClientVideoSubscriptionConfiguration(o){let p=new I.SdkVideoSubscriptionConfiguration;switch(p.mid=o.mid,p.attendeeId=o.attendeeId,p.streamId=o.streamId,p.groupId=o.groupId,p.priority=o.priority,p.targetBitrateKbps=o.targetBitrateKbps,o.qualityAdaptationPreference){case x.default.Balanced:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.BALANCED;break;case x.default.MaintainFramerate:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.MAINTAIN_FRAMERATE;break;case x.default.MaintainResolution:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.MAINTAIN_RESOLUTION;break;default:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.BALANCED}return p}leave(){let o=I.SdkSignalFrame.create();o.type=I.SdkSignalFrame.Type.LEAVE,o.leave=I.SdkLeaveFrame.create(),this.sendMessage(o),this.logger.debug(()=>"sent leave")}sendClientMetrics(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.CLIENT_METRIC,p.clientMetric=o,this.sendMessage(p)}sendDataMessage(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.DATA_MESSAGE,p.dataMessage=o,this.sendMessage(p)}closeConnection(){var o,p;if(this.webSocket.readyState()!==O.default.None&&this.webSocket.readyState()!==O.default.Closed){this.isClosing=!0,this.sendEvent(new B.default(this,U.default.WebSocketClosing,null));let f=new w.default(DefaultSignalingClient.CLOSE_EVENT_TIMEOUT_MS),handler=o=>{var p,m;null==(m=(p=this.webSocket).removeEventListener)||m.call(p,"close",handler),f.stop(),this.closeEventHandler(o)};null==(p=(o=this.webSocket).removeEventListener)||p.call(o,"close",this.closeEventHandler),this.webSocket.addEventListener("close",handler),f.start(()=>{handler(new CloseEvent("close",{wasClean:!1,code:1005,reason:"",bubbles:!1}))}),this.webSocket.close()}else this.logger.info("no existing signaling client connection needs closing"),this.serviceConnectionRequestQueue()}ready(){return this.webSocket.readyState()===O.default.Open&&!this.isClosing&&this.wasOpened}mute(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.AUDIO_CONTROL;let f=I.SdkAudioControlFrame.create();f.muted=o,p.audioControl=f,this.sendMessage(p)}pause(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.PAUSE,p.pause=I.SdkPauseResumeFrame.create(),p.pause.streamIds=o,this.sendMessage(p)}resume(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.RESUME,p.pause=I.SdkPauseResumeFrame.create(),p.pause.streamIds=o,this.sendMessage(p)}resetConnection(){this.webSocket.destroy(),this.wasOpened=!1}sendMessage(o){o.timestampMs=Date.now(),this.logger.debug(()=>`sending: ${JSON.stringify(o)}`);let p=this.prependWithFrameTypeRTC(I.SdkSignalFrame.encode(o).finish());if(this.ready()){if(!this.webSocket.send(p))return void this.sendEvent(new B.default(this,U.default.WebSocketSendMessageFailure,null));this.sendEvent(new B.default(this,U.default.WebSocketSentMessage,null))}else this.sendEvent(new B.default(this,U.default.WebSocketSkippedMessage,null))}receiveMessage(o){let p;try{p=I.SdkSignalFrame.decode(o)}catch(p){this.logger.info(`failed to decode: ${o}`),this.sendEvent(new B.default(this,U.default.ProtocolDecodeFailure,null));return}this.logger.debug(()=>`received: ${JSON.stringify(p)}`),this.webSocket.readyState()===O.default.Open?this.sendEvent(new B.default(this,U.default.ReceivedSignalFrame,p)):this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(p)}`)}stripFrameTypeRTC(o){let p=o[0];return p!==DefaultSignalingClient.FRAME_TYPE_RTC&&2!==p&&this.logger.warn(`expected FrameTypeRTC for message but got ${p}`),o.slice(1)}prependWithFrameTypeRTC(o){let p=new Uint8Array(o.length+1);return p[0]=DefaultSignalingClient.FRAME_TYPE_RTC,p.set(o,1),p}serviceConnectionRequestQueue(){if(0===this.connectionRequestQueue.length)return void this.logger.info("no connection requests to service");let o=this.connectionRequestQueue.shift();this.logger.info(`opening connection to ${o.url()}`),this.isClosing=!1,this.webSocket.create(o.url(),o.protocols()),this.setUpEventListeners(),this.sendEvent(new B.default(this,U.default.WebSocketConnecting,null))}sendEvent(o){switch(o.type){case U.default.WebSocketMessage:case U.default.ReceivedSignalFrame:case U.default.WebSocketSentMessage:this.logger.debug(()=>`notifying event: ${U.default[o.type]}`);break;case U.default.WebSocketSkippedMessage:this.logger.debug(()=>`notifying event: ${U.default[o.type]}, websocket state=${O.default[this.webSocket.readyState()]}`);break;case U.default.WebSocketClosed:this.logger.info(`Notifying event: ${U.default[o.type]}, 
              code: ${o.closeCode} reason: "${o.closeReason}" wasClean ${o.wasClean}`);break;default:this.logger.info(`notifying event: ${U.default[o.type]}`)}for(let p of this.observerQueue)p.handleSignalingClientEvent(o)}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.wasOpened=!0,this.sendEvent(new B.default(this,U.default.WebSocketOpen,null))}),this.webSocket.addEventListener("message",o=>{this.sendEvent(new B.default(this,U.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(o.data)))}),this.webSocket.addEventListener("close",this.closeEventHandler),this.webSocket.addEventListener("error",()=>{this.isClosing&&!this.wasOpened?this.logger.info("Signaling WebSocket ignoring error closing while connecting"):this.wasOpened?(this.logger.error("Signaling WebSocket received error while connected"),this.sendEvent(new B.default(this,U.default.WebSocketError,null))):(this.logger.error("Signaling WebSocket received error while connecting"),this.sendEvent(new B.default(this,U.default.WebSocketFailed,null)))})}generateNewAudioSessionId(){let o=new Uint32Array(1);return k.getRandomValues(o),o[0]}promoteToPrimaryMeeting(o){let p=I.SdkMeetingSessionCredentials.create();p.attendeeId=o.attendeeId,p.externalUserId=o.externalUserId,p.joinToken=o.joinToken;let f=I.SdkPrimaryMeetingJoinFrame.create();f.credentials=p;let m=I.SdkSignalFrame.create();m.type=I.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,m.primaryMeetingJoin=f,this.sendMessage(m)}demoteFromPrimaryMeeting(){let o=I.SdkPrimaryMeetingLeaveFrame.create(),p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,p.primaryMeetingLeave=o,this.sendMessage(p)}};p.default=$,$.FRAME_TYPE_RTC=5,$.CLOSE_EVENT_TIMEOUT_MS=2e3,$.CLIENT_SUPPORTS_COMPRESSION=!0},0x1e93e1412:(o,p,f)=>{"use strict";var m,_;Object.defineProperty(p,"__esModule",{value:!0}),p.convertServerSideNetworkAdaptionEnumToSignaled=p.convertServerSideNetworkAdaptionEnumFromSignaled=p.serverSideNetworkAdaptionIsNoneOrDefault=p.ServerSideNetworkAdaption=void 0;let w=f(0xe88b24d9);(_=m=p.ServerSideNetworkAdaption||(p.ServerSideNetworkAdaption={}))[_.Default=0]="Default",_[_.None=1]="None",_[_.BandwidthProbing=2]="BandwidthProbing",_[_.BandwidthProbingAndRemoteVideoQualityAdaption=3]="BandwidthProbingAndRemoteVideoQualityAdaption",p.default=m,p.serverSideNetworkAdaptionIsNoneOrDefault=function(o){return o===m.None||o===m.Default},p.convertServerSideNetworkAdaptionEnumFromSignaled=function(o){switch(o){case w.SdkServerSideNetworkAdaption.DEFAULT:return m.Default;case w.SdkServerSideNetworkAdaption.NONE:return m.None;case w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:return m.BandwidthProbing;case w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION:return m.BandwidthProbingAndRemoteVideoQualityAdaption}},p.convertServerSideNetworkAdaptionEnumToSignaled=function(o){switch(o){case m.Default:return w.SdkServerSideNetworkAdaption.DEFAULT;case m.None:return w.SdkServerSideNetworkAdaption.NONE;case m.BandwidthProbing:return w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING;case m.BandwidthProbingAndRemoteVideoQualityAdaption:return w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION}}},0xe105a372:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){this.signalingURL=o,this.joinToken=p}url(){return this.signalingURL+"?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1"}protocols(){return["_aws_wt_session",this.joinToken]}}},0x872e39a3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x16bec8feb));p.default=class{constructor(o,p,f,m,_,w){this.client=o,this.type=p,this.message=f,this.closeCode=m,this.closeReason=_,this.wasClean=w,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case _.default.WebSocketFailed:case _.default.WebSocketError:case _.default.WebSocketClosing:case _.default.WebSocketClosed:return!0;default:return!1}}}},0x16bec8feb:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SignalingClientEventType=void 0,(m=f=p.SignalingClientEventType||(p.SignalingClientEventType={}))[m.WebSocketConnecting=0]="WebSocketConnecting",m[m.WebSocketOpen=1]="WebSocketOpen",m[m.WebSocketError=2]="WebSocketError",m[m.WebSocketClosing=3]="WebSocketClosing",m[m.WebSocketClosed=4]="WebSocketClosed",m[m.WebSocketFailed=5]="WebSocketFailed",m[m.WebSocketMessage=6]="WebSocketMessage",m[m.WebSocketSendMessageFailure=7]="WebSocketSendMessageFailure",m[m.WebSocketSentMessage=8]="WebSocketSentMessage",m[m.ProtocolDecodeFailure=9]="ProtocolDecodeFailure",m[m.ReceivedSignalFrame=10]="ReceivedSignalFrame",m[m.WebSocketSkippedMessage=11]="WebSocketSkippedMessage",p.default=f},0x22a5b38fd:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e93e1412));p.default=class{constructor(o){this.applicationMetadata=o,this.serverSideNetworkAdaption=_.default.Default,this.supportedServerSideNetworkAdaptions=[],this.wantsAllTemporalLayersInIndex=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1}}},0x5fcce137:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w,I,k,M,x){this.attendeeId=o,this.sdpOffer=p,this.audioHost=f,this.audioMuted=m,this.audioCheckin=_,this.receiveStreamIds=w,this.localVideoEnabled=I,this.videoStreamDescriptions=k,this.connectionTypeHasVideo=M,this.compressedSdpOffer=x,this.videoSubscriptionConfiguration=[]}}},0xcb99c5a5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{equals(o){return void 0!==o&&this.mid===o.mid&&this.attendeeId===o.attendeeId&&this.streamId===o.streamId&&this.groupId===o.groupId&&this.priority===o.priority&&this.targetBitrateKbps===o.targetBitrateKbps&&this.qualityAdaptationPreference===o.qualityAdaptationPreference}}},0xe88b24d9:(o,p,f)=>{"use strict";var m,_,w,I,k,M,x,O,L,B,U,$,q,Z,ee=f(0x1b47b3a66),et=ee.Reader,ei=ee.Writer,er=ee.util,en=ee.roots.default||(ee.roots.default={});en.SdkSignalFrame=function(){var o,p;function SdkSignalFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkSignalFrame.prototype.timestampMs=er.Long?er.Long.fromBits(0,0,!0):0,SdkSignalFrame.prototype.type=1,SdkSignalFrame.prototype.error=null,SdkSignalFrame.prototype.join=null,SdkSignalFrame.prototype.joinack=null,SdkSignalFrame.prototype.sub=null,SdkSignalFrame.prototype.suback=null,SdkSignalFrame.prototype.index=null,SdkSignalFrame.prototype.pause=null,SdkSignalFrame.prototype.leave=null,SdkSignalFrame.prototype.leaveAck=null,SdkSignalFrame.prototype.bitrates=null,SdkSignalFrame.prototype.audioControl=null,SdkSignalFrame.prototype.audioMetadata=null,SdkSignalFrame.prototype.audioStreamIdInfo=null,SdkSignalFrame.prototype.pingPong=null,SdkSignalFrame.prototype.audioStatus=null,SdkSignalFrame.prototype.clientMetric=null,SdkSignalFrame.prototype.dataMessage=null,SdkSignalFrame.prototype.remoteVideoUpdate=null,SdkSignalFrame.prototype.primaryMeetingJoin=null,SdkSignalFrame.prototype.primaryMeetingJoinAck=null,SdkSignalFrame.prototype.primaryMeetingLeave=null,SdkSignalFrame.prototype.notification=null,SdkSignalFrame.create=function(o){return new SdkSignalFrame(o)},SdkSignalFrame.encode=function(o,p){return p||(p=ei.create()),p.uint32(8).uint64(o.timestampMs),p.uint32(16).int32(o.type),null!=o.error&&Object.hasOwnProperty.call(o,"error")&&en.SdkErrorFrame.encode(o.error,p.uint32(26).fork()).ldelim(),null!=o.join&&Object.hasOwnProperty.call(o,"join")&&en.SdkJoinFrame.encode(o.join,p.uint32(34).fork()).ldelim(),null!=o.joinack&&Object.hasOwnProperty.call(o,"joinack")&&en.SdkJoinAckFrame.encode(o.joinack,p.uint32(42).fork()).ldelim(),null!=o.sub&&Object.hasOwnProperty.call(o,"sub")&&en.SdkSubscribeFrame.encode(o.sub,p.uint32(50).fork()).ldelim(),null!=o.suback&&Object.hasOwnProperty.call(o,"suback")&&en.SdkSubscribeAckFrame.encode(o.suback,p.uint32(58).fork()).ldelim(),null!=o.index&&Object.hasOwnProperty.call(o,"index")&&en.SdkIndexFrame.encode(o.index,p.uint32(66).fork()).ldelim(),null!=o.pause&&Object.hasOwnProperty.call(o,"pause")&&en.SdkPauseResumeFrame.encode(o.pause,p.uint32(82).fork()).ldelim(),null!=o.leave&&Object.hasOwnProperty.call(o,"leave")&&en.SdkLeaveFrame.encode(o.leave,p.uint32(90).fork()).ldelim(),null!=o.leaveAck&&Object.hasOwnProperty.call(o,"leaveAck")&&en.SdkLeaveAckFrame.encode(o.leaveAck,p.uint32(98).fork()).ldelim(),null!=o.bitrates&&Object.hasOwnProperty.call(o,"bitrates")&&en.SdkBitrateFrame.encode(o.bitrates,p.uint32(114).fork()).ldelim(),null!=o.audioControl&&Object.hasOwnProperty.call(o,"audioControl")&&en.SdkAudioControlFrame.encode(o.audioControl,p.uint32(138).fork()).ldelim(),null!=o.audioMetadata&&Object.hasOwnProperty.call(o,"audioMetadata")&&en.SdkAudioMetadataFrame.encode(o.audioMetadata,p.uint32(146).fork()).ldelim(),null!=o.audioStreamIdInfo&&Object.hasOwnProperty.call(o,"audioStreamIdInfo")&&en.SdkAudioStreamIdInfoFrame.encode(o.audioStreamIdInfo,p.uint32(154).fork()).ldelim(),null!=o.pingPong&&Object.hasOwnProperty.call(o,"pingPong")&&en.SdkPingPongFrame.encode(o.pingPong,p.uint32(162).fork()).ldelim(),null!=o.audioStatus&&Object.hasOwnProperty.call(o,"audioStatus")&&en.SdkAudioStatusFrame.encode(o.audioStatus,p.uint32(170).fork()).ldelim(),null!=o.clientMetric&&Object.hasOwnProperty.call(o,"clientMetric")&&en.SdkClientMetricFrame.encode(o.clientMetric,p.uint32(178).fork()).ldelim(),null!=o.dataMessage&&Object.hasOwnProperty.call(o,"dataMessage")&&en.SdkDataMessageFrame.encode(o.dataMessage,p.uint32(186).fork()).ldelim(),null!=o.remoteVideoUpdate&&Object.hasOwnProperty.call(o,"remoteVideoUpdate")&&en.SdkRemoteVideoUpdateFrame.encode(o.remoteVideoUpdate,p.uint32(202).fork()).ldelim(),null!=o.primaryMeetingJoin&&Object.hasOwnProperty.call(o,"primaryMeetingJoin")&&en.SdkPrimaryMeetingJoinFrame.encode(o.primaryMeetingJoin,p.uint32(210).fork()).ldelim(),null!=o.primaryMeetingJoinAck&&Object.hasOwnProperty.call(o,"primaryMeetingJoinAck")&&en.SdkPrimaryMeetingJoinAckFrame.encode(o.primaryMeetingJoinAck,p.uint32(218).fork()).ldelim(),null!=o.primaryMeetingLeave&&Object.hasOwnProperty.call(o,"primaryMeetingLeave")&&en.SdkPrimaryMeetingLeaveFrame.encode(o.primaryMeetingLeave,p.uint32(226).fork()).ldelim(),null!=o.notification&&Object.hasOwnProperty.call(o,"notification")&&en.SdkNotificationFrame.encode(o.notification,p.uint32(282).fork()).ldelim(),p},SdkSignalFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkSignalFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkSignalFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.timestampMs=o.uint64();break;case 2:m.type=o.int32();break;case 3:m.error=en.SdkErrorFrame.decode(o,o.uint32());break;case 4:m.join=en.SdkJoinFrame.decode(o,o.uint32());break;case 5:m.joinack=en.SdkJoinAckFrame.decode(o,o.uint32());break;case 6:m.sub=en.SdkSubscribeFrame.decode(o,o.uint32());break;case 7:m.suback=en.SdkSubscribeAckFrame.decode(o,o.uint32());break;case 8:m.index=en.SdkIndexFrame.decode(o,o.uint32());break;case 10:m.pause=en.SdkPauseResumeFrame.decode(o,o.uint32());break;case 11:m.leave=en.SdkLeaveFrame.decode(o,o.uint32());break;case 12:m.leaveAck=en.SdkLeaveAckFrame.decode(o,o.uint32());break;case 14:m.bitrates=en.SdkBitrateFrame.decode(o,o.uint32());break;case 17:m.audioControl=en.SdkAudioControlFrame.decode(o,o.uint32());break;case 18:m.audioMetadata=en.SdkAudioMetadataFrame.decode(o,o.uint32());break;case 19:m.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.decode(o,o.uint32());break;case 20:m.pingPong=en.SdkPingPongFrame.decode(o,o.uint32());break;case 21:m.audioStatus=en.SdkAudioStatusFrame.decode(o,o.uint32());break;case 22:m.clientMetric=en.SdkClientMetricFrame.decode(o,o.uint32());break;case 23:m.dataMessage=en.SdkDataMessageFrame.decode(o,o.uint32());break;case 25:m.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.decode(o,o.uint32());break;case 26:m.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.decode(o,o.uint32());break;case 27:m.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.decode(o,o.uint32());break;case 28:m.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.decode(o,o.uint32());break;case 35:m.notification=en.SdkNotificationFrame.decode(o,o.uint32());break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("timestampMs"))throw er.ProtocolError("missing required 'timestampMs'",{instance:m});if(!m.hasOwnProperty("type"))throw er.ProtocolError("missing required 'type'",{instance:m});return m},SdkSignalFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSignalFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(!er.isInteger(o.timestampMs)&&!(o.timestampMs&&er.isInteger(o.timestampMs.low)&&er.isInteger(o.timestampMs.high)))return"timestampMs: integer|Long expected";switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 34:}},SdkSignalFrame.fromObject=function(o){if(o instanceof en.SdkSignalFrame)return o;var p=new en.SdkSignalFrame;switch(null!=o.timestampMs&&(er.Long?(p.timestampMs=er.Long.fromValue(o.timestampMs)).unsigned=!0:"string"==typeof o.timestampMs?p.timestampMs=parseInt(o.timestampMs,10):"number"==typeof o.timestampMs?p.timestampMs=o.timestampMs:"object"==typeof o.timestampMs&&(p.timestampMs=new er.LongBits(o.timestampMs.low>>>0,o.timestampMs.high>>>0).toNumber(!0))),o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"JOIN":case 1:p.type=1;break;case"JOIN_ACK":case 2:p.type=2;break;case"SUBSCRIBE":case 3:p.type=3;break;case"SUBSCRIBE_ACK":case 4:p.type=4;break;case"INDEX":case 5:p.type=5;break;case"PAUSE":case 7:p.type=7;break;case"RESUME":case 8:p.type=8;break;case"LEAVE":case 9:p.type=9;break;case"LEAVE_ACK":case 10:p.type=10;break;case"BITRATES":case 13:p.type=13;break;case"AUDIO_CONTROL":case 16:p.type=16;break;case"AUDIO_METADATA":case 17:p.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:p.type=18;break;case"PING_PONG":case 19:p.type=19;break;case"AUDIO_STATUS":case 20:p.type=20;break;case"CLIENT_METRIC":case 21:p.type=21;break;case"DATA_MESSAGE":case 22:p.type=22;break;case"REMOTE_VIDEO_UPDATE":case 24:p.type=24;break;case"PRIMARY_MEETING_JOIN":case 25:p.type=25;break;case"PRIMARY_MEETING_JOIN_ACK":case 26:p.type=26;break;case"PRIMARY_MEETING_LEAVE":case 27:p.type=27;break;case"NOTIFICATION":case 34:p.type=34}if(null!=o.error){if("object"!=typeof o.error)throw TypeError(".SdkSignalFrame.error: object expected");p.error=en.SdkErrorFrame.fromObject(o.error)}if(null!=o.join){if("object"!=typeof o.join)throw TypeError(".SdkSignalFrame.join: object expected");p.join=en.SdkJoinFrame.fromObject(o.join)}if(null!=o.joinack){if("object"!=typeof o.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");p.joinack=en.SdkJoinAckFrame.fromObject(o.joinack)}if(null!=o.sub){if("object"!=typeof o.sub)throw TypeError(".SdkSignalFrame.sub: object expected");p.sub=en.SdkSubscribeFrame.fromObject(o.sub)}if(null!=o.suback){if("object"!=typeof o.suback)throw TypeError(".SdkSignalFrame.suback: object expected");p.suback=en.SdkSubscribeAckFrame.fromObject(o.suback)}if(null!=o.index){if("object"!=typeof o.index)throw TypeError(".SdkSignalFrame.index: object expected");p.index=en.SdkIndexFrame.fromObject(o.index)}if(null!=o.pause){if("object"!=typeof o.pause)throw TypeError(".SdkSignalFrame.pause: object expected");p.pause=en.SdkPauseResumeFrame.fromObject(o.pause)}if(null!=o.leave){if("object"!=typeof o.leave)throw TypeError(".SdkSignalFrame.leave: object expected");p.leave=en.SdkLeaveFrame.fromObject(o.leave)}if(null!=o.leaveAck){if("object"!=typeof o.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");p.leaveAck=en.SdkLeaveAckFrame.fromObject(o.leaveAck)}if(null!=o.bitrates){if("object"!=typeof o.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");p.bitrates=en.SdkBitrateFrame.fromObject(o.bitrates)}if(null!=o.audioControl){if("object"!=typeof o.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");p.audioControl=en.SdkAudioControlFrame.fromObject(o.audioControl)}if(null!=o.audioMetadata){if("object"!=typeof o.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");p.audioMetadata=en.SdkAudioMetadataFrame.fromObject(o.audioMetadata)}if(null!=o.audioStreamIdInfo){if("object"!=typeof o.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");p.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.fromObject(o.audioStreamIdInfo)}if(null!=o.pingPong){if("object"!=typeof o.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");p.pingPong=en.SdkPingPongFrame.fromObject(o.pingPong)}if(null!=o.audioStatus){if("object"!=typeof o.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");p.audioStatus=en.SdkAudioStatusFrame.fromObject(o.audioStatus)}if(null!=o.clientMetric){if("object"!=typeof o.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");p.clientMetric=en.SdkClientMetricFrame.fromObject(o.clientMetric)}if(null!=o.dataMessage){if("object"!=typeof o.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");p.dataMessage=en.SdkDataMessageFrame.fromObject(o.dataMessage)}if(null!=o.remoteVideoUpdate){if("object"!=typeof o.remoteVideoUpdate)throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");p.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.fromObject(o.remoteVideoUpdate)}if(null!=o.primaryMeetingJoin){if("object"!=typeof o.primaryMeetingJoin)throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");p.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.fromObject(o.primaryMeetingJoin)}if(null!=o.primaryMeetingJoinAck){if("object"!=typeof o.primaryMeetingJoinAck)throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");p.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.fromObject(o.primaryMeetingJoinAck)}if(null!=o.primaryMeetingLeave){if("object"!=typeof o.primaryMeetingLeave)throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");p.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.fromObject(o.primaryMeetingLeave)}if(null!=o.notification){if("object"!=typeof o.notification)throw TypeError(".SdkSignalFrame.notification: object expected");p.notification=en.SdkNotificationFrame.fromObject(o.notification)}return p},SdkSignalFrame.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(er.Long){var m=new er.Long(0,0,!0);f.timestampMs=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.timestampMs=p.longs===String?"0":0;f.type=p.enums===String?"JOIN":1,f.error=null,f.join=null,f.joinack=null,f.sub=null,f.suback=null,f.index=null,f.pause=null,f.leave=null,f.leaveAck=null,f.bitrates=null,f.audioControl=null,f.audioMetadata=null,f.audioStreamIdInfo=null,f.pingPong=null,f.audioStatus=null,f.clientMetric=null,f.dataMessage=null,f.remoteVideoUpdate=null,f.primaryMeetingJoin=null,f.primaryMeetingJoinAck=null,f.primaryMeetingLeave=null,f.notification=null}return null!=o.timestampMs&&o.hasOwnProperty("timestampMs")&&("number"==typeof o.timestampMs?f.timestampMs=p.longs===String?String(o.timestampMs):o.timestampMs:f.timestampMs=p.longs===String?er.Long.prototype.toString.call(o.timestampMs):p.longs===Number?new er.LongBits(o.timestampMs.low>>>0,o.timestampMs.high>>>0).toNumber(!0):o.timestampMs),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkSignalFrame.Type[o.type]?o.type:en.SdkSignalFrame.Type[o.type]:o.type),null!=o.error&&o.hasOwnProperty("error")&&(f.error=en.SdkErrorFrame.toObject(o.error,p)),null!=o.join&&o.hasOwnProperty("join")&&(f.join=en.SdkJoinFrame.toObject(o.join,p)),null!=o.joinack&&o.hasOwnProperty("joinack")&&(f.joinack=en.SdkJoinAckFrame.toObject(o.joinack,p)),null!=o.sub&&o.hasOwnProperty("sub")&&(f.sub=en.SdkSubscribeFrame.toObject(o.sub,p)),null!=o.suback&&o.hasOwnProperty("suback")&&(f.suback=en.SdkSubscribeAckFrame.toObject(o.suback,p)),null!=o.index&&o.hasOwnProperty("index")&&(f.index=en.SdkIndexFrame.toObject(o.index,p)),null!=o.pause&&o.hasOwnProperty("pause")&&(f.pause=en.SdkPauseResumeFrame.toObject(o.pause,p)),null!=o.leave&&o.hasOwnProperty("leave")&&(f.leave=en.SdkLeaveFrame.toObject(o.leave,p)),null!=o.leaveAck&&o.hasOwnProperty("leaveAck")&&(f.leaveAck=en.SdkLeaveAckFrame.toObject(o.leaveAck,p)),null!=o.bitrates&&o.hasOwnProperty("bitrates")&&(f.bitrates=en.SdkBitrateFrame.toObject(o.bitrates,p)),null!=o.audioControl&&o.hasOwnProperty("audioControl")&&(f.audioControl=en.SdkAudioControlFrame.toObject(o.audioControl,p)),null!=o.audioMetadata&&o.hasOwnProperty("audioMetadata")&&(f.audioMetadata=en.SdkAudioMetadataFrame.toObject(o.audioMetadata,p)),null!=o.audioStreamIdInfo&&o.hasOwnProperty("audioStreamIdInfo")&&(f.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.toObject(o.audioStreamIdInfo,p)),null!=o.pingPong&&o.hasOwnProperty("pingPong")&&(f.pingPong=en.SdkPingPongFrame.toObject(o.pingPong,p)),null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&(f.audioStatus=en.SdkAudioStatusFrame.toObject(o.audioStatus,p)),null!=o.clientMetric&&o.hasOwnProperty("clientMetric")&&(f.clientMetric=en.SdkClientMetricFrame.toObject(o.clientMetric,p)),null!=o.dataMessage&&o.hasOwnProperty("dataMessage")&&(f.dataMessage=en.SdkDataMessageFrame.toObject(o.dataMessage,p)),null!=o.remoteVideoUpdate&&o.hasOwnProperty("remoteVideoUpdate")&&(f.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.toObject(o.remoteVideoUpdate,p)),null!=o.primaryMeetingJoin&&o.hasOwnProperty("primaryMeetingJoin")&&(f.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.toObject(o.primaryMeetingJoin,p)),null!=o.primaryMeetingJoinAck&&o.hasOwnProperty("primaryMeetingJoinAck")&&(f.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.toObject(o.primaryMeetingJoinAck,p)),null!=o.primaryMeetingLeave&&o.hasOwnProperty("primaryMeetingLeave")&&(f.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.toObject(o.primaryMeetingLeave,p)),null!=o.notification&&o.hasOwnProperty("notification")&&(f.notification=en.SdkNotificationFrame.toObject(o.notification,p)),f},SdkSignalFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSignalFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSignalFrame"},(p=Object.create(o={}))[o[1]="JOIN"]=1,p[o[2]="JOIN_ACK"]=2,p[o[3]="SUBSCRIBE"]=3,p[o[4]="SUBSCRIBE_ACK"]=4,p[o[5]="INDEX"]=5,p[o[7]="PAUSE"]=7,p[o[8]="RESUME"]=8,p[o[9]="LEAVE"]=9,p[o[10]="LEAVE_ACK"]=10,p[o[13]="BITRATES"]=13,p[o[16]="AUDIO_CONTROL"]=16,p[o[17]="AUDIO_METADATA"]=17,p[o[18]="AUDIO_STREAM_ID_INFO"]=18,p[o[19]="PING_PONG"]=19,p[o[20]="AUDIO_STATUS"]=20,p[o[21]="CLIENT_METRIC"]=21,p[o[22]="DATA_MESSAGE"]=22,p[o[24]="REMOTE_VIDEO_UPDATE"]=24,p[o[25]="PRIMARY_MEETING_JOIN"]=25,p[o[26]="PRIMARY_MEETING_JOIN_ACK"]=26,p[o[27]="PRIMARY_MEETING_LEAVE"]=27,p[o[34]="NOTIFICATION"]=34,SdkSignalFrame.Type=p,SdkSignalFrame}(),en.SdkErrorFrame=function(){function SdkErrorFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkErrorFrame.prototype.status=0,SdkErrorFrame.prototype.description="",SdkErrorFrame.create=function(o){return new SdkErrorFrame(o)},SdkErrorFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.status&&Object.hasOwnProperty.call(o,"status")&&p.uint32(8).uint32(o.status),null!=o.description&&Object.hasOwnProperty.call(o,"description")&&p.uint32(18).string(o.description),p},SdkErrorFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkErrorFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkErrorFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.status=o.uint32();break;case 2:m.description=o.string();break;default:o.skipType(7&_)}}return m},SdkErrorFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkErrorFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.status&&o.hasOwnProperty("status")&&!er.isInteger(o.status)?"status: integer expected":null!=o.description&&o.hasOwnProperty("description")&&!er.isString(o.description)?"description: string expected":null},SdkErrorFrame.fromObject=function(o){if(o instanceof en.SdkErrorFrame)return o;var p=new en.SdkErrorFrame;return null!=o.status&&(p.status=o.status>>>0),null!=o.description&&(p.description=String(o.description)),p},SdkErrorFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.status=0,f.description=""),null!=o.status&&o.hasOwnProperty("status")&&(f.status=o.status),null!=o.description&&o.hasOwnProperty("description")&&(f.description=o.description),f},SdkErrorFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkErrorFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkErrorFrame"},SdkErrorFrame}(),(_=Object.create(m={}))[m[2]="HAS_STREAM_UPDATE"]=2,_[m[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,_[m[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,en.SdkJoinFlags=_,en.SdkClientDetails=function(){function SdkClientDetails(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkClientDetails.prototype.appName="",SdkClientDetails.prototype.appVersion="",SdkClientDetails.prototype.deviceModel="",SdkClientDetails.prototype.deviceMake="",SdkClientDetails.prototype.platformName="",SdkClientDetails.prototype.platformVersion="",SdkClientDetails.prototype.clientSource="",SdkClientDetails.prototype.chimeSdkVersion="",SdkClientDetails.prototype.clientUtcOffset="",SdkClientDetails.create=function(o){return new SdkClientDetails(o)},SdkClientDetails.encode=function(o,p){return p||(p=ei.create()),null!=o.appName&&Object.hasOwnProperty.call(o,"appName")&&p.uint32(10).string(o.appName),null!=o.appVersion&&Object.hasOwnProperty.call(o,"appVersion")&&p.uint32(18).string(o.appVersion),null!=o.deviceModel&&Object.hasOwnProperty.call(o,"deviceModel")&&p.uint32(26).string(o.deviceModel),null!=o.deviceMake&&Object.hasOwnProperty.call(o,"deviceMake")&&p.uint32(34).string(o.deviceMake),null!=o.platformName&&Object.hasOwnProperty.call(o,"platformName")&&p.uint32(42).string(o.platformName),null!=o.platformVersion&&Object.hasOwnProperty.call(o,"platformVersion")&&p.uint32(50).string(o.platformVersion),null!=o.clientSource&&Object.hasOwnProperty.call(o,"clientSource")&&p.uint32(58).string(o.clientSource),null!=o.chimeSdkVersion&&Object.hasOwnProperty.call(o,"chimeSdkVersion")&&p.uint32(66).string(o.chimeSdkVersion),null!=o.clientUtcOffset&&Object.hasOwnProperty.call(o,"clientUtcOffset")&&p.uint32(74).string(o.clientUtcOffset),p},SdkClientDetails.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkClientDetails.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkClientDetails;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.appName=o.string();break;case 2:m.appVersion=o.string();break;case 3:m.deviceModel=o.string();break;case 4:m.deviceMake=o.string();break;case 5:m.platformName=o.string();break;case 6:m.platformVersion=o.string();break;case 7:m.clientSource=o.string();break;case 8:m.chimeSdkVersion=o.string();break;case 9:m.clientUtcOffset=o.string();break;default:o.skipType(7&_)}}return m},SdkClientDetails.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkClientDetails.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.appName&&o.hasOwnProperty("appName")&&!er.isString(o.appName)?"appName: string expected":null!=o.appVersion&&o.hasOwnProperty("appVersion")&&!er.isString(o.appVersion)?"appVersion: string expected":null!=o.deviceModel&&o.hasOwnProperty("deviceModel")&&!er.isString(o.deviceModel)?"deviceModel: string expected":null!=o.deviceMake&&o.hasOwnProperty("deviceMake")&&!er.isString(o.deviceMake)?"deviceMake: string expected":null!=o.platformName&&o.hasOwnProperty("platformName")&&!er.isString(o.platformName)?"platformName: string expected":null!=o.platformVersion&&o.hasOwnProperty("platformVersion")&&!er.isString(o.platformVersion)?"platformVersion: string expected":null!=o.clientSource&&o.hasOwnProperty("clientSource")&&!er.isString(o.clientSource)?"clientSource: string expected":null!=o.chimeSdkVersion&&o.hasOwnProperty("chimeSdkVersion")&&!er.isString(o.chimeSdkVersion)?"chimeSdkVersion: string expected":null!=o.clientUtcOffset&&o.hasOwnProperty("clientUtcOffset")&&!er.isString(o.clientUtcOffset)?"clientUtcOffset: string expected":null},SdkClientDetails.fromObject=function(o){if(o instanceof en.SdkClientDetails)return o;var p=new en.SdkClientDetails;return null!=o.appName&&(p.appName=String(o.appName)),null!=o.appVersion&&(p.appVersion=String(o.appVersion)),null!=o.deviceModel&&(p.deviceModel=String(o.deviceModel)),null!=o.deviceMake&&(p.deviceMake=String(o.deviceMake)),null!=o.platformName&&(p.platformName=String(o.platformName)),null!=o.platformVersion&&(p.platformVersion=String(o.platformVersion)),null!=o.clientSource&&(p.clientSource=String(o.clientSource)),null!=o.chimeSdkVersion&&(p.chimeSdkVersion=String(o.chimeSdkVersion)),null!=o.clientUtcOffset&&(p.clientUtcOffset=String(o.clientUtcOffset)),p},SdkClientDetails.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.appName="",f.appVersion="",f.deviceModel="",f.deviceMake="",f.platformName="",f.platformVersion="",f.clientSource="",f.chimeSdkVersion="",f.clientUtcOffset=""),null!=o.appName&&o.hasOwnProperty("appName")&&(f.appName=o.appName),null!=o.appVersion&&o.hasOwnProperty("appVersion")&&(f.appVersion=o.appVersion),null!=o.deviceModel&&o.hasOwnProperty("deviceModel")&&(f.deviceModel=o.deviceModel),null!=o.deviceMake&&o.hasOwnProperty("deviceMake")&&(f.deviceMake=o.deviceMake),null!=o.platformName&&o.hasOwnProperty("platformName")&&(f.platformName=o.platformName),null!=o.platformVersion&&o.hasOwnProperty("platformVersion")&&(f.platformVersion=o.platformVersion),null!=o.clientSource&&o.hasOwnProperty("clientSource")&&(f.clientSource=o.clientSource),null!=o.chimeSdkVersion&&o.hasOwnProperty("chimeSdkVersion")&&(f.chimeSdkVersion=o.chimeSdkVersion),null!=o.clientUtcOffset&&o.hasOwnProperty("clientUtcOffset")&&(f.clientUtcOffset=o.clientUtcOffset),f},SdkClientDetails.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkClientDetails.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkClientDetails"},SdkClientDetails}(),(I=Object.create(w={}))[w[1]="DEFAULT"]=1,I[w[2]="NONE"]=2,I[w[3]="BANDWIDTH_PROBING"]=3,I[w[4]="BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION"]=4,en.SdkServerSideNetworkAdaption=I,en.SdkJoinFrame=function(){function SdkJoinFrame(o){if(this.supportedServerSideNetworkAdaptions=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkJoinFrame.prototype.protocolVersion=2,SdkJoinFrame.prototype.maxNumOfVideos=0,SdkJoinFrame.prototype.flags=0,SdkJoinFrame.prototype.clientDetails=null,SdkJoinFrame.prototype.audioSessionId=er.Long?er.Long.fromBits(0,0,!0):0,SdkJoinFrame.prototype.wantsCompressedSdp=!1,SdkJoinFrame.prototype.serverSideNetworkAdaption=1,SdkJoinFrame.prototype.supportedServerSideNetworkAdaptions=er.emptyArray,SdkJoinFrame.prototype.wantsAllTemporalLayersInIndex=!1,SdkJoinFrame.prototype.disablePeriodicKeyframeRequestOnContentSender=!1,SdkJoinFrame.create=function(o){return new SdkJoinFrame(o)},SdkJoinFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.protocolVersion&&Object.hasOwnProperty.call(o,"protocolVersion")&&p.uint32(8).uint32(o.protocolVersion),null!=o.maxNumOfVideos&&Object.hasOwnProperty.call(o,"maxNumOfVideos")&&p.uint32(16).uint32(o.maxNumOfVideos),null!=o.flags&&Object.hasOwnProperty.call(o,"flags")&&p.uint32(24).uint32(o.flags),null!=o.clientDetails&&Object.hasOwnProperty.call(o,"clientDetails")&&en.SdkClientDetails.encode(o.clientDetails,p.uint32(34).fork()).ldelim(),null!=o.audioSessionId&&Object.hasOwnProperty.call(o,"audioSessionId")&&p.uint32(48).uint64(o.audioSessionId),null!=o.wantsCompressedSdp&&Object.hasOwnProperty.call(o,"wantsCompressedSdp")&&p.uint32(56).bool(o.wantsCompressedSdp),null!=o.serverSideNetworkAdaption&&Object.hasOwnProperty.call(o,"serverSideNetworkAdaption")&&p.uint32(80).int32(o.serverSideNetworkAdaption),null!=o.supportedServerSideNetworkAdaptions&&o.supportedServerSideNetworkAdaptions.length)for(var f=0;f<o.supportedServerSideNetworkAdaptions.length;++f)p.uint32(88).int32(o.supportedServerSideNetworkAdaptions[f]);return null!=o.wantsAllTemporalLayersInIndex&&Object.hasOwnProperty.call(o,"wantsAllTemporalLayersInIndex")&&p.uint32(96).bool(o.wantsAllTemporalLayersInIndex),null!=o.disablePeriodicKeyframeRequestOnContentSender&&Object.hasOwnProperty.call(o,"disablePeriodicKeyframeRequestOnContentSender")&&p.uint32(104).bool(o.disablePeriodicKeyframeRequestOnContentSender),p},SdkJoinFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkJoinFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkJoinFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.protocolVersion=o.uint32();break;case 2:m.maxNumOfVideos=o.uint32();break;case 3:m.flags=o.uint32();break;case 4:m.clientDetails=en.SdkClientDetails.decode(o,o.uint32());break;case 6:m.audioSessionId=o.uint64();break;case 7:m.wantsCompressedSdp=o.bool();break;case 10:m.serverSideNetworkAdaption=o.int32();break;case 11:if(m.supportedServerSideNetworkAdaptions&&m.supportedServerSideNetworkAdaptions.length||(m.supportedServerSideNetworkAdaptions=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.supportedServerSideNetworkAdaptions.push(o.int32());else m.supportedServerSideNetworkAdaptions.push(o.int32());break;case 12:m.wantsAllTemporalLayersInIndex=o.bool();break;case 13:m.disablePeriodicKeyframeRequestOnContentSender=o.bool();break;default:o.skipType(7&_)}}return m},SdkJoinFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkJoinFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.protocolVersion&&o.hasOwnProperty("protocolVersion")&&!er.isInteger(o.protocolVersion))return"protocolVersion: integer expected";if(null!=o.maxNumOfVideos&&o.hasOwnProperty("maxNumOfVideos")&&!er.isInteger(o.maxNumOfVideos))return"maxNumOfVideos: integer expected";if(null!=o.flags&&o.hasOwnProperty("flags")&&!er.isInteger(o.flags))return"flags: integer expected";if(null!=o.clientDetails&&o.hasOwnProperty("clientDetails")){var p=en.SdkClientDetails.verify(o.clientDetails);if(p)return"clientDetails."+p}if(null!=o.audioSessionId&&o.hasOwnProperty("audioSessionId")&&!er.isInteger(o.audioSessionId)&&!(o.audioSessionId&&er.isInteger(o.audioSessionId.low)&&er.isInteger(o.audioSessionId.high)))return"audioSessionId: integer|Long expected";if(null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof o.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=o.serverSideNetworkAdaption&&o.hasOwnProperty("serverSideNetworkAdaption"))switch(o.serverSideNetworkAdaption){default:return"serverSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:}if(null!=o.supportedServerSideNetworkAdaptions&&o.hasOwnProperty("supportedServerSideNetworkAdaptions")){if(!Array.isArray(o.supportedServerSideNetworkAdaptions))return"supportedServerSideNetworkAdaptions: array expected";for(var f=0;f<o.supportedServerSideNetworkAdaptions.length;++f)switch(o.supportedServerSideNetworkAdaptions[f]){default:return"supportedServerSideNetworkAdaptions: enum value[] expected";case 1:case 2:case 3:case 4:}}return null!=o.wantsAllTemporalLayersInIndex&&o.hasOwnProperty("wantsAllTemporalLayersInIndex")&&"boolean"!=typeof o.wantsAllTemporalLayersInIndex?"wantsAllTemporalLayersInIndex: boolean expected":null!=o.disablePeriodicKeyframeRequestOnContentSender&&o.hasOwnProperty("disablePeriodicKeyframeRequestOnContentSender")&&"boolean"!=typeof o.disablePeriodicKeyframeRequestOnContentSender?"disablePeriodicKeyframeRequestOnContentSender: boolean expected":null},SdkJoinFrame.fromObject=function(o){if(o instanceof en.SdkJoinFrame)return o;var p=new en.SdkJoinFrame;if(null!=o.protocolVersion&&(p.protocolVersion=o.protocolVersion>>>0),null!=o.maxNumOfVideos&&(p.maxNumOfVideos=o.maxNumOfVideos>>>0),null!=o.flags&&(p.flags=o.flags>>>0),null!=o.clientDetails){if("object"!=typeof o.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");p.clientDetails=en.SdkClientDetails.fromObject(o.clientDetails)}switch(null!=o.audioSessionId&&(er.Long?(p.audioSessionId=er.Long.fromValue(o.audioSessionId)).unsigned=!0:"string"==typeof o.audioSessionId?p.audioSessionId=parseInt(o.audioSessionId,10):"number"==typeof o.audioSessionId?p.audioSessionId=o.audioSessionId:"object"==typeof o.audioSessionId&&(p.audioSessionId=new er.LongBits(o.audioSessionId.low>>>0,o.audioSessionId.high>>>0).toNumber(!0))),null!=o.wantsCompressedSdp&&(p.wantsCompressedSdp=!!o.wantsCompressedSdp),o.serverSideNetworkAdaption){default:"number"==typeof o.serverSideNetworkAdaption&&(p.serverSideNetworkAdaption=o.serverSideNetworkAdaption);break;case"DEFAULT":case 1:p.serverSideNetworkAdaption=1;break;case"NONE":case 2:p.serverSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:p.serverSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.serverSideNetworkAdaption=4}if(o.supportedServerSideNetworkAdaptions){if(!Array.isArray(o.supportedServerSideNetworkAdaptions))throw TypeError(".SdkJoinFrame.supportedServerSideNetworkAdaptions: array expected");p.supportedServerSideNetworkAdaptions=[];for(var f=0;f<o.supportedServerSideNetworkAdaptions.length;++f)switch(o.supportedServerSideNetworkAdaptions[f]){default:if("number"==typeof o.supportedServerSideNetworkAdaptions[f]){p.supportedServerSideNetworkAdaptions[f]=o.supportedServerSideNetworkAdaptions[f];break}case"DEFAULT":case 1:p.supportedServerSideNetworkAdaptions[f]=1;break;case"NONE":case 2:p.supportedServerSideNetworkAdaptions[f]=2;break;case"BANDWIDTH_PROBING":case 3:p.supportedServerSideNetworkAdaptions[f]=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.supportedServerSideNetworkAdaptions[f]=4}}return null!=o.wantsAllTemporalLayersInIndex&&(p.wantsAllTemporalLayersInIndex=!!o.wantsAllTemporalLayersInIndex),null!=o.disablePeriodicKeyframeRequestOnContentSender&&(p.disablePeriodicKeyframeRequestOnContentSender=!!o.disablePeriodicKeyframeRequestOnContentSender),p},SdkJoinFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.supportedServerSideNetworkAdaptions=[]),p.defaults){if(f.protocolVersion=2,f.maxNumOfVideos=0,f.flags=0,f.clientDetails=null,er.Long){var m=new er.Long(0,0,!0);f.audioSessionId=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.audioSessionId=p.longs===String?"0":0;f.wantsCompressedSdp=!1,f.serverSideNetworkAdaption=p.enums===String?"DEFAULT":1,f.wantsAllTemporalLayersInIndex=!1,f.disablePeriodicKeyframeRequestOnContentSender=!1}if(null!=o.protocolVersion&&o.hasOwnProperty("protocolVersion")&&(f.protocolVersion=o.protocolVersion),null!=o.maxNumOfVideos&&o.hasOwnProperty("maxNumOfVideos")&&(f.maxNumOfVideos=o.maxNumOfVideos),null!=o.flags&&o.hasOwnProperty("flags")&&(f.flags=o.flags),null!=o.clientDetails&&o.hasOwnProperty("clientDetails")&&(f.clientDetails=en.SdkClientDetails.toObject(o.clientDetails,p)),null!=o.audioSessionId&&o.hasOwnProperty("audioSessionId")&&("number"==typeof o.audioSessionId?f.audioSessionId=p.longs===String?String(o.audioSessionId):o.audioSessionId:f.audioSessionId=p.longs===String?er.Long.prototype.toString.call(o.audioSessionId):p.longs===Number?new er.LongBits(o.audioSessionId.low>>>0,o.audioSessionId.high>>>0).toNumber(!0):o.audioSessionId),null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&(f.wantsCompressedSdp=o.wantsCompressedSdp),null!=o.serverSideNetworkAdaption&&o.hasOwnProperty("serverSideNetworkAdaption")&&(f.serverSideNetworkAdaption=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.serverSideNetworkAdaption]?o.serverSideNetworkAdaption:en.SdkServerSideNetworkAdaption[o.serverSideNetworkAdaption]:o.serverSideNetworkAdaption),o.supportedServerSideNetworkAdaptions&&o.supportedServerSideNetworkAdaptions.length){f.supportedServerSideNetworkAdaptions=[];for(var _=0;_<o.supportedServerSideNetworkAdaptions.length;++_)f.supportedServerSideNetworkAdaptions[_]=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.supportedServerSideNetworkAdaptions[_]]?o.supportedServerSideNetworkAdaptions[_]:en.SdkServerSideNetworkAdaption[o.supportedServerSideNetworkAdaptions[_]]:o.supportedServerSideNetworkAdaptions[_]}return null!=o.wantsAllTemporalLayersInIndex&&o.hasOwnProperty("wantsAllTemporalLayersInIndex")&&(f.wantsAllTemporalLayersInIndex=o.wantsAllTemporalLayersInIndex),null!=o.disablePeriodicKeyframeRequestOnContentSender&&o.hasOwnProperty("disablePeriodicKeyframeRequestOnContentSender")&&(f.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender),f},SdkJoinFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkJoinFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkJoinFrame"},SdkJoinFrame}(),en.SdkJoinAckFrame=function(){function SdkJoinAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkJoinAckFrame.prototype.turnCredentials=null,SdkJoinAckFrame.prototype.videoSubscriptionLimit=0,SdkJoinAckFrame.prototype.wantsCompressedSdp=!1,SdkJoinAckFrame.prototype.defaultServerSideNetworkAdaption=1,SdkJoinAckFrame.create=function(o){return new SdkJoinAckFrame(o)},SdkJoinAckFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.turnCredentials&&Object.hasOwnProperty.call(o,"turnCredentials")&&en.SdkTurnCredentials.encode(o.turnCredentials,p.uint32(10).fork()).ldelim(),null!=o.videoSubscriptionLimit&&Object.hasOwnProperty.call(o,"videoSubscriptionLimit")&&p.uint32(16).uint32(o.videoSubscriptionLimit),null!=o.wantsCompressedSdp&&Object.hasOwnProperty.call(o,"wantsCompressedSdp")&&p.uint32(24).bool(o.wantsCompressedSdp),null!=o.defaultServerSideNetworkAdaption&&Object.hasOwnProperty.call(o,"defaultServerSideNetworkAdaption")&&p.uint32(32).int32(o.defaultServerSideNetworkAdaption),p},SdkJoinAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkJoinAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkJoinAckFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.turnCredentials=en.SdkTurnCredentials.decode(o,o.uint32());break;case 2:m.videoSubscriptionLimit=o.uint32();break;case 3:m.wantsCompressedSdp=o.bool();break;case 4:m.defaultServerSideNetworkAdaption=o.int32();break;default:o.skipType(7&_)}}return m},SdkJoinAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkJoinAckFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.turnCredentials&&o.hasOwnProperty("turnCredentials")){var p=en.SdkTurnCredentials.verify(o.turnCredentials);if(p)return"turnCredentials."+p}if(null!=o.videoSubscriptionLimit&&o.hasOwnProperty("videoSubscriptionLimit")&&!er.isInteger(o.videoSubscriptionLimit))return"videoSubscriptionLimit: integer expected";if(null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof o.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=o.defaultServerSideNetworkAdaption&&o.hasOwnProperty("defaultServerSideNetworkAdaption"))switch(o.defaultServerSideNetworkAdaption){default:return"defaultServerSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:}return null},SdkJoinAckFrame.fromObject=function(o){if(o instanceof en.SdkJoinAckFrame)return o;var p=new en.SdkJoinAckFrame;if(null!=o.turnCredentials){if("object"!=typeof o.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");p.turnCredentials=en.SdkTurnCredentials.fromObject(o.turnCredentials)}switch(null!=o.videoSubscriptionLimit&&(p.videoSubscriptionLimit=o.videoSubscriptionLimit>>>0),null!=o.wantsCompressedSdp&&(p.wantsCompressedSdp=!!o.wantsCompressedSdp),o.defaultServerSideNetworkAdaption){default:"number"==typeof o.defaultServerSideNetworkAdaption&&(p.defaultServerSideNetworkAdaption=o.defaultServerSideNetworkAdaption);break;case"DEFAULT":case 1:p.defaultServerSideNetworkAdaption=1;break;case"NONE":case 2:p.defaultServerSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:p.defaultServerSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.defaultServerSideNetworkAdaption=4}return p},SdkJoinAckFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.turnCredentials=null,f.videoSubscriptionLimit=0,f.wantsCompressedSdp=!1,f.defaultServerSideNetworkAdaption=p.enums===String?"DEFAULT":1),null!=o.turnCredentials&&o.hasOwnProperty("turnCredentials")&&(f.turnCredentials=en.SdkTurnCredentials.toObject(o.turnCredentials,p)),null!=o.videoSubscriptionLimit&&o.hasOwnProperty("videoSubscriptionLimit")&&(f.videoSubscriptionLimit=o.videoSubscriptionLimit),null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&(f.wantsCompressedSdp=o.wantsCompressedSdp),null!=o.defaultServerSideNetworkAdaption&&o.hasOwnProperty("defaultServerSideNetworkAdaption")&&(f.defaultServerSideNetworkAdaption=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.defaultServerSideNetworkAdaption]?o.defaultServerSideNetworkAdaption:en.SdkServerSideNetworkAdaption[o.defaultServerSideNetworkAdaption]:o.defaultServerSideNetworkAdaption),f},SdkJoinAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkJoinAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkJoinAckFrame"},SdkJoinAckFrame}(),en.SdkLeaveFrame=function(){function SdkLeaveFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkLeaveFrame.create=function(o){return new SdkLeaveFrame(o)},SdkLeaveFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkLeaveFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkLeaveFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkLeaveFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkLeaveFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkLeaveFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkLeaveFrame.fromObject=function(o){return o instanceof en.SdkLeaveFrame?o:new en.SdkLeaveFrame},SdkLeaveFrame.toObject=function(){return{}},SdkLeaveFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkLeaveFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkLeaveFrame"},SdkLeaveFrame}(),en.SdkLeaveAckFrame=function(){function SdkLeaveAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkLeaveAckFrame.create=function(o){return new SdkLeaveAckFrame(o)},SdkLeaveAckFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkLeaveAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkLeaveAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkLeaveAckFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkLeaveAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkLeaveAckFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkLeaveAckFrame.fromObject=function(o){return o instanceof en.SdkLeaveAckFrame?o:new en.SdkLeaveAckFrame},SdkLeaveAckFrame.toObject=function(){return{}},SdkLeaveAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkLeaveAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkLeaveAckFrame"},SdkLeaveAckFrame}(),(M=Object.create(k={}))[k[1]="RX"]=1,M[k[2]="TX"]=2,M[k[3]="DUPLEX"]=3,en.SdkStreamServiceType=M,(O=Object.create(x={}))[x[1]="AUDIO"]=1,O[x[2]="VIDEO"]=2,en.SdkStreamMediaType=O,en.SdkSubscribeFrame=function(){function SdkSubscribeFrame(o){if(this.sendStreams=[],this.receiveStreamIds=[],this.videoSubscriptionConfiguration=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkSubscribeFrame.prototype.duplex=1,SdkSubscribeFrame.prototype.sendStreams=er.emptyArray,SdkSubscribeFrame.prototype.receiveStreamIds=er.emptyArray,SdkSubscribeFrame.prototype.sdpOffer="",SdkSubscribeFrame.prototype.audioHost="",SdkSubscribeFrame.prototype.audioCheckin=!1,SdkSubscribeFrame.prototype.audioMuted=!1,SdkSubscribeFrame.prototype.compressedSdpOffer=er.newBuffer([]),SdkSubscribeFrame.prototype.videoSubscriptionConfiguration=er.emptyArray,SdkSubscribeFrame.create=function(o){return new SdkSubscribeFrame(o)},SdkSubscribeFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.duplex&&Object.hasOwnProperty.call(o,"duplex")&&p.uint32(8).int32(o.duplex),null!=o.sendStreams&&o.sendStreams.length)for(var f=0;f<o.sendStreams.length;++f)en.SdkStreamDescriptor.encode(o.sendStreams[f],p.uint32(18).fork()).ldelim();if(null!=o.receiveStreamIds&&o.receiveStreamIds.length)for(var f=0;f<o.receiveStreamIds.length;++f)p.uint32(24).uint32(o.receiveStreamIds[f]);if(null!=o.sdpOffer&&Object.hasOwnProperty.call(o,"sdpOffer")&&p.uint32(34).string(o.sdpOffer),null!=o.audioHost&&Object.hasOwnProperty.call(o,"audioHost")&&p.uint32(42).string(o.audioHost),null!=o.audioCheckin&&Object.hasOwnProperty.call(o,"audioCheckin")&&p.uint32(48).bool(o.audioCheckin),null!=o.audioMuted&&Object.hasOwnProperty.call(o,"audioMuted")&&p.uint32(56).bool(o.audioMuted),null!=o.compressedSdpOffer&&Object.hasOwnProperty.call(o,"compressedSdpOffer")&&p.uint32(66).bytes(o.compressedSdpOffer),null!=o.videoSubscriptionConfiguration&&o.videoSubscriptionConfiguration.length)for(var f=0;f<o.videoSubscriptionConfiguration.length;++f)en.SdkVideoSubscriptionConfiguration.encode(o.videoSubscriptionConfiguration[f],p.uint32(74).fork()).ldelim();return p},SdkSubscribeFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkSubscribeFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkSubscribeFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.duplex=o.int32();break;case 2:m.sendStreams&&m.sendStreams.length||(m.sendStreams=[]),m.sendStreams.push(en.SdkStreamDescriptor.decode(o,o.uint32()));break;case 3:if(m.receiveStreamIds&&m.receiveStreamIds.length||(m.receiveStreamIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.receiveStreamIds.push(o.uint32());else m.receiveStreamIds.push(o.uint32());break;case 4:m.sdpOffer=o.string();break;case 5:m.audioHost=o.string();break;case 6:m.audioCheckin=o.bool();break;case 7:m.audioMuted=o.bool();break;case 8:m.compressedSdpOffer=o.bytes();break;case 9:m.videoSubscriptionConfiguration&&m.videoSubscriptionConfiguration.length||(m.videoSubscriptionConfiguration=[]),m.videoSubscriptionConfiguration.push(en.SdkVideoSubscriptionConfiguration.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkSubscribeFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSubscribeFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.duplex&&o.hasOwnProperty("duplex"))switch(o.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=o.sendStreams&&o.hasOwnProperty("sendStreams")){if(!Array.isArray(o.sendStreams))return"sendStreams: array expected";for(var p=0;p<o.sendStreams.length;++p){var f=en.SdkStreamDescriptor.verify(o.sendStreams[p]);if(f)return"sendStreams."+f}}if(null!=o.receiveStreamIds&&o.hasOwnProperty("receiveStreamIds")){if(!Array.isArray(o.receiveStreamIds))return"receiveStreamIds: array expected";for(var p=0;p<o.receiveStreamIds.length;++p)if(!er.isInteger(o.receiveStreamIds[p]))return"receiveStreamIds: integer[] expected"}if(null!=o.sdpOffer&&o.hasOwnProperty("sdpOffer")&&!er.isString(o.sdpOffer))return"sdpOffer: string expected";if(null!=o.audioHost&&o.hasOwnProperty("audioHost")&&!er.isString(o.audioHost))return"audioHost: string expected";if(null!=o.audioCheckin&&o.hasOwnProperty("audioCheckin")&&"boolean"!=typeof o.audioCheckin)return"audioCheckin: boolean expected";if(null!=o.audioMuted&&o.hasOwnProperty("audioMuted")&&"boolean"!=typeof o.audioMuted)return"audioMuted: boolean expected";if(null!=o.compressedSdpOffer&&o.hasOwnProperty("compressedSdpOffer")&&!(o.compressedSdpOffer&&"number"==typeof o.compressedSdpOffer.length||er.isString(o.compressedSdpOffer)))return"compressedSdpOffer: buffer expected";if(null!=o.videoSubscriptionConfiguration&&o.hasOwnProperty("videoSubscriptionConfiguration")){if(!Array.isArray(o.videoSubscriptionConfiguration))return"videoSubscriptionConfiguration: array expected";for(var p=0;p<o.videoSubscriptionConfiguration.length;++p){var f=en.SdkVideoSubscriptionConfiguration.verify(o.videoSubscriptionConfiguration[p]);if(f)return"videoSubscriptionConfiguration."+f}}return null},SdkSubscribeFrame.fromObject=function(o){if(o instanceof en.SdkSubscribeFrame)return o;var p=new en.SdkSubscribeFrame;switch(o.duplex){default:"number"==typeof o.duplex&&(p.duplex=o.duplex);break;case"RX":case 1:p.duplex=1;break;case"TX":case 2:p.duplex=2;break;case"DUPLEX":case 3:p.duplex=3}if(o.sendStreams){if(!Array.isArray(o.sendStreams))throw TypeError(".SdkSubscribeFrame.sendStreams: array expected");p.sendStreams=[];for(var f=0;f<o.sendStreams.length;++f){if("object"!=typeof o.sendStreams[f])throw TypeError(".SdkSubscribeFrame.sendStreams: object expected");p.sendStreams[f]=en.SdkStreamDescriptor.fromObject(o.sendStreams[f])}}if(o.receiveStreamIds){if(!Array.isArray(o.receiveStreamIds))throw TypeError(".SdkSubscribeFrame.receiveStreamIds: array expected");p.receiveStreamIds=[];for(var f=0;f<o.receiveStreamIds.length;++f)p.receiveStreamIds[f]=o.receiveStreamIds[f]>>>0}if(null!=o.sdpOffer&&(p.sdpOffer=String(o.sdpOffer)),null!=o.audioHost&&(p.audioHost=String(o.audioHost)),null!=o.audioCheckin&&(p.audioCheckin=!!o.audioCheckin),null!=o.audioMuted&&(p.audioMuted=!!o.audioMuted),null!=o.compressedSdpOffer&&("string"==typeof o.compressedSdpOffer?er.base64.decode(o.compressedSdpOffer,p.compressedSdpOffer=er.newBuffer(er.base64.length(o.compressedSdpOffer)),0):o.compressedSdpOffer.length>=0&&(p.compressedSdpOffer=o.compressedSdpOffer)),o.videoSubscriptionConfiguration){if(!Array.isArray(o.videoSubscriptionConfiguration))throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: array expected");p.videoSubscriptionConfiguration=[];for(var f=0;f<o.videoSubscriptionConfiguration.length;++f){if("object"!=typeof o.videoSubscriptionConfiguration[f])throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: object expected");p.videoSubscriptionConfiguration[f]=en.SdkVideoSubscriptionConfiguration.fromObject(o.videoSubscriptionConfiguration[f])}}return p},SdkSubscribeFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.sendStreams=[],f.receiveStreamIds=[],f.videoSubscriptionConfiguration=[]),p.defaults&&(f.duplex=p.enums===String?"RX":1,f.sdpOffer="",f.audioHost="",f.audioCheckin=!1,f.audioMuted=!1,p.bytes===String?f.compressedSdpOffer="":(f.compressedSdpOffer=[],p.bytes!==Array&&(f.compressedSdpOffer=er.newBuffer(f.compressedSdpOffer)))),null!=o.duplex&&o.hasOwnProperty("duplex")&&(f.duplex=p.enums===String?void 0===en.SdkStreamServiceType[o.duplex]?o.duplex:en.SdkStreamServiceType[o.duplex]:o.duplex),o.sendStreams&&o.sendStreams.length){f.sendStreams=[];for(var m=0;m<o.sendStreams.length;++m)f.sendStreams[m]=en.SdkStreamDescriptor.toObject(o.sendStreams[m],p)}if(o.receiveStreamIds&&o.receiveStreamIds.length){f.receiveStreamIds=[];for(var m=0;m<o.receiveStreamIds.length;++m)f.receiveStreamIds[m]=o.receiveStreamIds[m]}if(null!=o.sdpOffer&&o.hasOwnProperty("sdpOffer")&&(f.sdpOffer=o.sdpOffer),null!=o.audioHost&&o.hasOwnProperty("audioHost")&&(f.audioHost=o.audioHost),null!=o.audioCheckin&&o.hasOwnProperty("audioCheckin")&&(f.audioCheckin=o.audioCheckin),null!=o.audioMuted&&o.hasOwnProperty("audioMuted")&&(f.audioMuted=o.audioMuted),null!=o.compressedSdpOffer&&o.hasOwnProperty("compressedSdpOffer")&&(f.compressedSdpOffer=p.bytes===String?er.base64.encode(o.compressedSdpOffer,0,o.compressedSdpOffer.length):p.bytes===Array?Array.prototype.slice.call(o.compressedSdpOffer):o.compressedSdpOffer),o.videoSubscriptionConfiguration&&o.videoSubscriptionConfiguration.length){f.videoSubscriptionConfiguration=[];for(var m=0;m<o.videoSubscriptionConfiguration.length;++m)f.videoSubscriptionConfiguration[m]=en.SdkVideoSubscriptionConfiguration.toObject(o.videoSubscriptionConfiguration[m],p)}return f},SdkSubscribeFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSubscribeFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSubscribeFrame"},SdkSubscribeFrame}(),en.SdkSubscribeAckFrame=function(){function SdkSubscribeAckFrame(o){if(this.allocations=[],this.tracks=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkSubscribeAckFrame.prototype.duplex=1,SdkSubscribeAckFrame.prototype.allocations=er.emptyArray,SdkSubscribeAckFrame.prototype.sdpAnswer="",SdkSubscribeAckFrame.prototype.tracks=er.emptyArray,SdkSubscribeAckFrame.prototype.compressedSdpAnswer=er.newBuffer([]),SdkSubscribeAckFrame.create=function(o){return new SdkSubscribeAckFrame(o)},SdkSubscribeAckFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.duplex&&Object.hasOwnProperty.call(o,"duplex")&&p.uint32(8).int32(o.duplex),null!=o.allocations&&o.allocations.length)for(var f=0;f<o.allocations.length;++f)en.SdkStreamAllocation.encode(o.allocations[f],p.uint32(18).fork()).ldelim();if(null!=o.sdpAnswer&&Object.hasOwnProperty.call(o,"sdpAnswer")&&p.uint32(26).string(o.sdpAnswer),null!=o.tracks&&o.tracks.length)for(var f=0;f<o.tracks.length;++f)en.SdkTrackMapping.encode(o.tracks[f],p.uint32(34).fork()).ldelim();return null!=o.compressedSdpAnswer&&Object.hasOwnProperty.call(o,"compressedSdpAnswer")&&p.uint32(42).bytes(o.compressedSdpAnswer),p},SdkSubscribeAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkSubscribeAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkSubscribeAckFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.duplex=o.int32();break;case 2:m.allocations&&m.allocations.length||(m.allocations=[]),m.allocations.push(en.SdkStreamAllocation.decode(o,o.uint32()));break;case 3:m.sdpAnswer=o.string();break;case 4:m.tracks&&m.tracks.length||(m.tracks=[]),m.tracks.push(en.SdkTrackMapping.decode(o,o.uint32()));break;case 5:m.compressedSdpAnswer=o.bytes();break;default:o.skipType(7&_)}}return m},SdkSubscribeAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSubscribeAckFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.duplex&&o.hasOwnProperty("duplex"))switch(o.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=o.allocations&&o.hasOwnProperty("allocations")){if(!Array.isArray(o.allocations))return"allocations: array expected";for(var p=0;p<o.allocations.length;++p){var f=en.SdkStreamAllocation.verify(o.allocations[p]);if(f)return"allocations."+f}}if(null!=o.sdpAnswer&&o.hasOwnProperty("sdpAnswer")&&!er.isString(o.sdpAnswer))return"sdpAnswer: string expected";if(null!=o.tracks&&o.hasOwnProperty("tracks")){if(!Array.isArray(o.tracks))return"tracks: array expected";for(var p=0;p<o.tracks.length;++p){var f=en.SdkTrackMapping.verify(o.tracks[p]);if(f)return"tracks."+f}}return null!=o.compressedSdpAnswer&&o.hasOwnProperty("compressedSdpAnswer")&&!(o.compressedSdpAnswer&&"number"==typeof o.compressedSdpAnswer.length||er.isString(o.compressedSdpAnswer))?"compressedSdpAnswer: buffer expected":null},SdkSubscribeAckFrame.fromObject=function(o){if(o instanceof en.SdkSubscribeAckFrame)return o;var p=new en.SdkSubscribeAckFrame;switch(o.duplex){default:"number"==typeof o.duplex&&(p.duplex=o.duplex);break;case"RX":case 1:p.duplex=1;break;case"TX":case 2:p.duplex=2;break;case"DUPLEX":case 3:p.duplex=3}if(o.allocations){if(!Array.isArray(o.allocations))throw TypeError(".SdkSubscribeAckFrame.allocations: array expected");p.allocations=[];for(var f=0;f<o.allocations.length;++f){if("object"!=typeof o.allocations[f])throw TypeError(".SdkSubscribeAckFrame.allocations: object expected");p.allocations[f]=en.SdkStreamAllocation.fromObject(o.allocations[f])}}if(null!=o.sdpAnswer&&(p.sdpAnswer=String(o.sdpAnswer)),o.tracks){if(!Array.isArray(o.tracks))throw TypeError(".SdkSubscribeAckFrame.tracks: array expected");p.tracks=[];for(var f=0;f<o.tracks.length;++f){if("object"!=typeof o.tracks[f])throw TypeError(".SdkSubscribeAckFrame.tracks: object expected");p.tracks[f]=en.SdkTrackMapping.fromObject(o.tracks[f])}}return null!=o.compressedSdpAnswer&&("string"==typeof o.compressedSdpAnswer?er.base64.decode(o.compressedSdpAnswer,p.compressedSdpAnswer=er.newBuffer(er.base64.length(o.compressedSdpAnswer)),0):o.compressedSdpAnswer.length>=0&&(p.compressedSdpAnswer=o.compressedSdpAnswer)),p},SdkSubscribeAckFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.allocations=[],f.tracks=[]),p.defaults&&(f.duplex=p.enums===String?"RX":1,f.sdpAnswer="",p.bytes===String?f.compressedSdpAnswer="":(f.compressedSdpAnswer=[],p.bytes!==Array&&(f.compressedSdpAnswer=er.newBuffer(f.compressedSdpAnswer)))),null!=o.duplex&&o.hasOwnProperty("duplex")&&(f.duplex=p.enums===String?void 0===en.SdkStreamServiceType[o.duplex]?o.duplex:en.SdkStreamServiceType[o.duplex]:o.duplex),o.allocations&&o.allocations.length){f.allocations=[];for(var m=0;m<o.allocations.length;++m)f.allocations[m]=en.SdkStreamAllocation.toObject(o.allocations[m],p)}if(null!=o.sdpAnswer&&o.hasOwnProperty("sdpAnswer")&&(f.sdpAnswer=o.sdpAnswer),o.tracks&&o.tracks.length){f.tracks=[];for(var m=0;m<o.tracks.length;++m)f.tracks[m]=en.SdkTrackMapping.toObject(o.tracks[m],p)}return null!=o.compressedSdpAnswer&&o.hasOwnProperty("compressedSdpAnswer")&&(f.compressedSdpAnswer=p.bytes===String?er.base64.encode(o.compressedSdpAnswer,0,o.compressedSdpAnswer.length):p.bytes===Array?Array.prototype.slice.call(o.compressedSdpAnswer):o.compressedSdpAnswer),f},SdkSubscribeAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSubscribeAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSubscribeAckFrame"},SdkSubscribeAckFrame}(),en.SdkIndexFrame=function(){function SdkIndexFrame(o){if(this.sources=[],this.pausedAtSourceIds=[],this.supportedReceiveCodecIntersection=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkIndexFrame.prototype.atCapacity=!1,SdkIndexFrame.prototype.sources=er.emptyArray,SdkIndexFrame.prototype.pausedAtSourceIds=er.emptyArray,SdkIndexFrame.prototype.numParticipants=0,SdkIndexFrame.prototype.supportedReceiveCodecIntersection=er.emptyArray,SdkIndexFrame.create=function(o){return new SdkIndexFrame(o)},SdkIndexFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.atCapacity&&Object.hasOwnProperty.call(o,"atCapacity")&&p.uint32(8).bool(o.atCapacity),null!=o.sources&&o.sources.length)for(var f=0;f<o.sources.length;++f)en.SdkStreamDescriptor.encode(o.sources[f],p.uint32(18).fork()).ldelim();if(null!=o.pausedAtSourceIds&&o.pausedAtSourceIds.length)for(var f=0;f<o.pausedAtSourceIds.length;++f)p.uint32(24).uint32(o.pausedAtSourceIds[f]);if(null!=o.numParticipants&&Object.hasOwnProperty.call(o,"numParticipants")&&p.uint32(32).uint32(o.numParticipants),null!=o.supportedReceiveCodecIntersection&&o.supportedReceiveCodecIntersection.length)for(var f=0;f<o.supportedReceiveCodecIntersection.length;++f)p.uint32(40).int32(o.supportedReceiveCodecIntersection[f]);return p},SdkIndexFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkIndexFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkIndexFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.atCapacity=o.bool();break;case 2:m.sources&&m.sources.length||(m.sources=[]),m.sources.push(en.SdkStreamDescriptor.decode(o,o.uint32()));break;case 3:if(m.pausedAtSourceIds&&m.pausedAtSourceIds.length||(m.pausedAtSourceIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.pausedAtSourceIds.push(o.uint32());else m.pausedAtSourceIds.push(o.uint32());break;case 4:m.numParticipants=o.uint32();break;case 5:if(m.supportedReceiveCodecIntersection&&m.supportedReceiveCodecIntersection.length||(m.supportedReceiveCodecIntersection=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.supportedReceiveCodecIntersection.push(o.int32());else m.supportedReceiveCodecIntersection.push(o.int32());break;default:o.skipType(7&_)}}return m},SdkIndexFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkIndexFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.atCapacity&&o.hasOwnProperty("atCapacity")&&"boolean"!=typeof o.atCapacity)return"atCapacity: boolean expected";if(null!=o.sources&&o.hasOwnProperty("sources")){if(!Array.isArray(o.sources))return"sources: array expected";for(var p=0;p<o.sources.length;++p){var f=en.SdkStreamDescriptor.verify(o.sources[p]);if(f)return"sources."+f}}if(null!=o.pausedAtSourceIds&&o.hasOwnProperty("pausedAtSourceIds")){if(!Array.isArray(o.pausedAtSourceIds))return"pausedAtSourceIds: array expected";for(var p=0;p<o.pausedAtSourceIds.length;++p)if(!er.isInteger(o.pausedAtSourceIds[p]))return"pausedAtSourceIds: integer[] expected"}if(null!=o.numParticipants&&o.hasOwnProperty("numParticipants")&&!er.isInteger(o.numParticipants))return"numParticipants: integer expected";if(null!=o.supportedReceiveCodecIntersection&&o.hasOwnProperty("supportedReceiveCodecIntersection")){if(!Array.isArray(o.supportedReceiveCodecIntersection))return"supportedReceiveCodecIntersection: array expected";for(var p=0;p<o.supportedReceiveCodecIntersection.length;++p)switch(o.supportedReceiveCodecIntersection[p]){default:return"supportedReceiveCodecIntersection: enum value[] expected";case 1:case 2:case 3:case 4:case 5:case 6:case 8:case 11:}}return null},SdkIndexFrame.fromObject=function(o){if(o instanceof en.SdkIndexFrame)return o;var p=new en.SdkIndexFrame;if(null!=o.atCapacity&&(p.atCapacity=!!o.atCapacity),o.sources){if(!Array.isArray(o.sources))throw TypeError(".SdkIndexFrame.sources: array expected");p.sources=[];for(var f=0;f<o.sources.length;++f){if("object"!=typeof o.sources[f])throw TypeError(".SdkIndexFrame.sources: object expected");p.sources[f]=en.SdkStreamDescriptor.fromObject(o.sources[f])}}if(o.pausedAtSourceIds){if(!Array.isArray(o.pausedAtSourceIds))throw TypeError(".SdkIndexFrame.pausedAtSourceIds: array expected");p.pausedAtSourceIds=[];for(var f=0;f<o.pausedAtSourceIds.length;++f)p.pausedAtSourceIds[f]=o.pausedAtSourceIds[f]>>>0}if(null!=o.numParticipants&&(p.numParticipants=o.numParticipants>>>0),o.supportedReceiveCodecIntersection){if(!Array.isArray(o.supportedReceiveCodecIntersection))throw TypeError(".SdkIndexFrame.supportedReceiveCodecIntersection: array expected");p.supportedReceiveCodecIntersection=[];for(var f=0;f<o.supportedReceiveCodecIntersection.length;++f)switch(o.supportedReceiveCodecIntersection[f]){default:if("number"==typeof o.supportedReceiveCodecIntersection[f]){p.supportedReceiveCodecIntersection[f]=o.supportedReceiveCodecIntersection[f];break}case"VP8":case 1:p.supportedReceiveCodecIntersection[f]=1;break;case"H264_BASELINE_PROFILE":case 2:p.supportedReceiveCodecIntersection[f]=2;break;case"H264_CONSTRAINED_BASELINE_PROFILE":case 3:p.supportedReceiveCodecIntersection[f]=3;break;case"H264_MAIN_PROFILE":case 4:p.supportedReceiveCodecIntersection[f]=4;break;case"H264_HIGH_PROFILE":case 5:p.supportedReceiveCodecIntersection[f]=5;break;case"H264_CONSTRAINED_HIGH_PROFILE":case 6:p.supportedReceiveCodecIntersection[f]=6;break;case"VP9_PROFILE_0":case 8:p.supportedReceiveCodecIntersection[f]=8;break;case"AV1_MAIN_PROFILE":case 11:p.supportedReceiveCodecIntersection[f]=11}}return p},SdkIndexFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.sources=[],f.pausedAtSourceIds=[],f.supportedReceiveCodecIntersection=[]),p.defaults&&(f.atCapacity=!1,f.numParticipants=0),null!=o.atCapacity&&o.hasOwnProperty("atCapacity")&&(f.atCapacity=o.atCapacity),o.sources&&o.sources.length){f.sources=[];for(var m=0;m<o.sources.length;++m)f.sources[m]=en.SdkStreamDescriptor.toObject(o.sources[m],p)}if(o.pausedAtSourceIds&&o.pausedAtSourceIds.length){f.pausedAtSourceIds=[];for(var m=0;m<o.pausedAtSourceIds.length;++m)f.pausedAtSourceIds[m]=o.pausedAtSourceIds[m]}if(null!=o.numParticipants&&o.hasOwnProperty("numParticipants")&&(f.numParticipants=o.numParticipants),o.supportedReceiveCodecIntersection&&o.supportedReceiveCodecIntersection.length){f.supportedReceiveCodecIntersection=[];for(var m=0;m<o.supportedReceiveCodecIntersection.length;++m)f.supportedReceiveCodecIntersection[m]=p.enums===String?void 0===en.SdkVideoCodecCapability[o.supportedReceiveCodecIntersection[m]]?o.supportedReceiveCodecIntersection[m]:en.SdkVideoCodecCapability[o.supportedReceiveCodecIntersection[m]]:o.supportedReceiveCodecIntersection[m]}return f},SdkIndexFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkIndexFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkIndexFrame"},SdkIndexFrame}(),en.SdkPauseResumeFrame=function(){function SdkPauseResumeFrame(o){if(this.streamIds=[],this.groupIds=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPauseResumeFrame.prototype.streamIds=er.emptyArray,SdkPauseResumeFrame.prototype.groupIds=er.emptyArray,SdkPauseResumeFrame.create=function(o){return new SdkPauseResumeFrame(o)},SdkPauseResumeFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.streamIds&&o.streamIds.length)for(var f=0;f<o.streamIds.length;++f)p.uint32(8).uint32(o.streamIds[f]);if(null!=o.groupIds&&o.groupIds.length)for(var f=0;f<o.groupIds.length;++f)p.uint32(16).uint32(o.groupIds[f]);return p},SdkPauseResumeFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPauseResumeFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPauseResumeFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:if(m.streamIds&&m.streamIds.length||(m.streamIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.streamIds.push(o.uint32());else m.streamIds.push(o.uint32());break;case 2:if(m.groupIds&&m.groupIds.length||(m.groupIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos<w;)m.groupIds.push(o.uint32());else m.groupIds.push(o.uint32());break;default:o.skipType(7&_)}}return m},SdkPauseResumeFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPauseResumeFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamIds&&o.hasOwnProperty("streamIds")){if(!Array.isArray(o.streamIds))return"streamIds: array expected";for(var p=0;p<o.streamIds.length;++p)if(!er.isInteger(o.streamIds[p]))return"streamIds: integer[] expected"}if(null!=o.groupIds&&o.hasOwnProperty("groupIds")){if(!Array.isArray(o.groupIds))return"groupIds: array expected";for(var p=0;p<o.groupIds.length;++p)if(!er.isInteger(o.groupIds[p]))return"groupIds: integer[] expected"}return null},SdkPauseResumeFrame.fromObject=function(o){if(o instanceof en.SdkPauseResumeFrame)return o;var p=new en.SdkPauseResumeFrame;if(o.streamIds){if(!Array.isArray(o.streamIds))throw TypeError(".SdkPauseResumeFrame.streamIds: array expected");p.streamIds=[];for(var f=0;f<o.streamIds.length;++f)p.streamIds[f]=o.streamIds[f]>>>0}if(o.groupIds){if(!Array.isArray(o.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");p.groupIds=[];for(var f=0;f<o.groupIds.length;++f)p.groupIds[f]=o.groupIds[f]>>>0}return p},SdkPauseResumeFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.streamIds=[],f.groupIds=[]),o.streamIds&&o.streamIds.length){f.streamIds=[];for(var m=0;m<o.streamIds.length;++m)f.streamIds[m]=o.streamIds[m]}if(o.groupIds&&o.groupIds.length){f.groupIds=[];for(var m=0;m<o.groupIds.length;++m)f.groupIds[m]=o.groupIds[m]}return f},SdkPauseResumeFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPauseResumeFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPauseResumeFrame"},SdkPauseResumeFrame}(),en.SdkBitrateFrame=function(){function SdkBitrateFrame(o){if(this.bitrates=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkBitrateFrame.prototype.bitrates=er.emptyArray,SdkBitrateFrame.prototype.serverAvailableOutgoingBitrate=0,SdkBitrateFrame.create=function(o){return new SdkBitrateFrame(o)},SdkBitrateFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.bitrates&&o.bitrates.length)for(var f=0;f<o.bitrates.length;++f)en.SdkBitrate.encode(o.bitrates[f],p.uint32(10).fork()).ldelim();return null!=o.serverAvailableOutgoingBitrate&&Object.hasOwnProperty.call(o,"serverAvailableOutgoingBitrate")&&p.uint32(16).uint32(o.serverAvailableOutgoingBitrate),p},SdkBitrateFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkBitrateFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkBitrateFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.bitrates&&m.bitrates.length||(m.bitrates=[]),m.bitrates.push(en.SdkBitrate.decode(o,o.uint32()));break;case 2:m.serverAvailableOutgoingBitrate=o.uint32();break;default:o.skipType(7&_)}}return m},SdkBitrateFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkBitrateFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.bitrates&&o.hasOwnProperty("bitrates")){if(!Array.isArray(o.bitrates))return"bitrates: array expected";for(var p=0;p<o.bitrates.length;++p){var f=en.SdkBitrate.verify(o.bitrates[p]);if(f)return"bitrates."+f}}return null!=o.serverAvailableOutgoingBitrate&&o.hasOwnProperty("serverAvailableOutgoingBitrate")&&!er.isInteger(o.serverAvailableOutgoingBitrate)?"serverAvailableOutgoingBitrate: integer expected":null},SdkBitrateFrame.fromObject=function(o){if(o instanceof en.SdkBitrateFrame)return o;var p=new en.SdkBitrateFrame;if(o.bitrates){if(!Array.isArray(o.bitrates))throw TypeError(".SdkBitrateFrame.bitrates: array expected");p.bitrates=[];for(var f=0;f<o.bitrates.length;++f){if("object"!=typeof o.bitrates[f])throw TypeError(".SdkBitrateFrame.bitrates: object expected");p.bitrates[f]=en.SdkBitrate.fromObject(o.bitrates[f])}}return null!=o.serverAvailableOutgoingBitrate&&(p.serverAvailableOutgoingBitrate=o.serverAvailableOutgoingBitrate>>>0),p},SdkBitrateFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.bitrates=[]),p.defaults&&(f.serverAvailableOutgoingBitrate=0),o.bitrates&&o.bitrates.length){f.bitrates=[];for(var m=0;m<o.bitrates.length;++m)f.bitrates[m]=en.SdkBitrate.toObject(o.bitrates[m],p)}return null!=o.serverAvailableOutgoingBitrate&&o.hasOwnProperty("serverAvailableOutgoingBitrate")&&(f.serverAvailableOutgoingBitrate=o.serverAvailableOutgoingBitrate),f},SdkBitrateFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkBitrateFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkBitrateFrame"},SdkBitrateFrame}(),en.SdkStreamDescriptor=function(){function SdkStreamDescriptor(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamDescriptor.prototype.streamId=0,SdkStreamDescriptor.prototype.framerate=0,SdkStreamDescriptor.prototype.maxBitrateKbps=0,SdkStreamDescriptor.prototype.trackLabel="",SdkStreamDescriptor.prototype.groupId=0,SdkStreamDescriptor.prototype.avgBitrateBps=0,SdkStreamDescriptor.prototype.attendeeId="",SdkStreamDescriptor.prototype.mediaType=1,SdkStreamDescriptor.prototype.externalUserId="",SdkStreamDescriptor.prototype.width=0,SdkStreamDescriptor.prototype.height=0,SdkStreamDescriptor.create=function(o){return new SdkStreamDescriptor(o)},SdkStreamDescriptor.encode=function(o,p){return p||(p=ei.create()),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(8).uint32(o.streamId),null!=o.framerate&&Object.hasOwnProperty.call(o,"framerate")&&p.uint32(16).uint32(o.framerate),null!=o.maxBitrateKbps&&Object.hasOwnProperty.call(o,"maxBitrateKbps")&&p.uint32(24).uint32(o.maxBitrateKbps),null!=o.trackLabel&&Object.hasOwnProperty.call(o,"trackLabel")&&p.uint32(34).string(o.trackLabel),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(48).uint32(o.groupId),null!=o.avgBitrateBps&&Object.hasOwnProperty.call(o,"avgBitrateBps")&&p.uint32(56).uint32(o.avgBitrateBps),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(66).string(o.attendeeId),null!=o.mediaType&&Object.hasOwnProperty.call(o,"mediaType")&&p.uint32(72).int32(o.mediaType),null!=o.externalUserId&&Object.hasOwnProperty.call(o,"externalUserId")&&p.uint32(82).string(o.externalUserId),null!=o.width&&Object.hasOwnProperty.call(o,"width")&&p.uint32(88).uint32(o.width),null!=o.height&&Object.hasOwnProperty.call(o,"height")&&p.uint32(96).uint32(o.height),p},SdkStreamDescriptor.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamDescriptor.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamDescriptor;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.streamId=o.uint32();break;case 2:m.framerate=o.uint32();break;case 3:m.maxBitrateKbps=o.uint32();break;case 4:m.trackLabel=o.string();break;case 6:m.groupId=o.uint32();break;case 7:m.avgBitrateBps=o.uint32();break;case 8:m.attendeeId=o.string();break;case 9:m.mediaType=o.int32();break;case 10:m.externalUserId=o.string();break;case 11:m.width=o.uint32();break;case 12:m.height=o.uint32();break;default:o.skipType(7&_)}}return m},SdkStreamDescriptor.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamDescriptor.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.framerate&&o.hasOwnProperty("framerate")&&!er.isInteger(o.framerate))return"framerate: integer expected";if(null!=o.maxBitrateKbps&&o.hasOwnProperty("maxBitrateKbps")&&!er.isInteger(o.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel))return"trackLabel: string expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&!er.isInteger(o.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId))return"attendeeId: string expected";if(null!=o.mediaType&&o.hasOwnProperty("mediaType"))switch(o.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.width&&o.hasOwnProperty("width")&&!er.isInteger(o.width)?"width: integer expected":null!=o.height&&o.hasOwnProperty("height")&&!er.isInteger(o.height)?"height: integer expected":null},SdkStreamDescriptor.fromObject=function(o){if(o instanceof en.SdkStreamDescriptor)return o;var p=new en.SdkStreamDescriptor;switch(null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.framerate&&(p.framerate=o.framerate>>>0),null!=o.maxBitrateKbps&&(p.maxBitrateKbps=o.maxBitrateKbps>>>0),null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),null!=o.groupId&&(p.groupId=o.groupId>>>0),null!=o.avgBitrateBps&&(p.avgBitrateBps=o.avgBitrateBps>>>0),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),o.mediaType){default:"number"==typeof o.mediaType&&(p.mediaType=o.mediaType);break;case"AUDIO":case 1:p.mediaType=1;break;case"VIDEO":case 2:p.mediaType=2}return null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.width&&(p.width=o.width>>>0),null!=o.height&&(p.height=o.height>>>0),p},SdkStreamDescriptor.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.streamId=0,f.framerate=0,f.maxBitrateKbps=0,f.trackLabel="",f.groupId=0,f.avgBitrateBps=0,f.attendeeId="",f.mediaType=p.enums===String?"AUDIO":1,f.externalUserId="",f.width=0,f.height=0),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.framerate&&o.hasOwnProperty("framerate")&&(f.framerate=o.framerate),null!=o.maxBitrateKbps&&o.hasOwnProperty("maxBitrateKbps")&&(f.maxBitrateKbps=o.maxBitrateKbps),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&(f.avgBitrateBps=o.avgBitrateBps),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.mediaType&&o.hasOwnProperty("mediaType")&&(f.mediaType=p.enums===String?void 0===en.SdkStreamMediaType[o.mediaType]?o.mediaType:en.SdkStreamMediaType[o.mediaType]:o.mediaType),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.width&&o.hasOwnProperty("width")&&(f.width=o.width),null!=o.height&&o.hasOwnProperty("height")&&(f.height=o.height),f},SdkStreamDescriptor.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamDescriptor.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamDescriptor"},SdkStreamDescriptor}(),en.SdkStreamAllocation=function(){function SdkStreamAllocation(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamAllocation.prototype.trackLabel="",SdkStreamAllocation.prototype.streamId=0,SdkStreamAllocation.prototype.groupId=0,SdkStreamAllocation.create=function(o){return new SdkStreamAllocation(o)},SdkStreamAllocation.encode=function(o,p){return p||(p=ei.create()),null!=o.trackLabel&&Object.hasOwnProperty.call(o,"trackLabel")&&p.uint32(10).string(o.trackLabel),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(16).uint32(o.streamId),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(24).uint32(o.groupId),p},SdkStreamAllocation.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamAllocation.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamAllocation;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.trackLabel=o.string();break;case 2:m.streamId=o.uint32();break;case 3:m.groupId=o.uint32();break;default:o.skipType(7&_)}}return m},SdkStreamAllocation.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamAllocation.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel)?"trackLabel: string expected":null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId)?"streamId: integer expected":null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId)?"groupId: integer expected":null},SdkStreamAllocation.fromObject=function(o){if(o instanceof en.SdkStreamAllocation)return o;var p=new en.SdkStreamAllocation;return null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),p},SdkStreamAllocation.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.trackLabel="",f.streamId=0,f.groupId=0),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),f},SdkStreamAllocation.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamAllocation.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamAllocation"},SdkStreamAllocation}(),en.SdkTrackMapping=function(){function SdkTrackMapping(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTrackMapping.prototype.streamId=0,SdkTrackMapping.prototype.ssrc=0,SdkTrackMapping.prototype.trackLabel="",SdkTrackMapping.create=function(o){return new SdkTrackMapping(o)},SdkTrackMapping.encode=function(o,p){return p||(p=ei.create()),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(8).uint32(o.streamId),null!=o.ssrc&&Object.hasOwnProperty.call(o,"ssrc")&&p.uint32(16).uint32(o.ssrc),null!=o.trackLabel&&Object.hasOwnProperty.call(o,"trackLabel")&&p.uint32(26).string(o.trackLabel),p},SdkTrackMapping.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTrackMapping.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTrackMapping;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.streamId=o.uint32();break;case 2:m.ssrc=o.uint32();break;case 3:m.trackLabel=o.string();break;default:o.skipType(7&_)}}return m},SdkTrackMapping.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTrackMapping.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId)?"streamId: integer expected":null!=o.ssrc&&o.hasOwnProperty("ssrc")&&!er.isInteger(o.ssrc)?"ssrc: integer expected":null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel)?"trackLabel: string expected":null},SdkTrackMapping.fromObject=function(o){if(o instanceof en.SdkTrackMapping)return o;var p=new en.SdkTrackMapping;return null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.ssrc&&(p.ssrc=o.ssrc>>>0),null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),p},SdkTrackMapping.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.streamId=0,f.ssrc=0,f.trackLabel=""),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.ssrc&&o.hasOwnProperty("ssrc")&&(f.ssrc=o.ssrc),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),f},SdkTrackMapping.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTrackMapping.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTrackMapping"},SdkTrackMapping}(),en.SdkBitrate=function(){function SdkBitrate(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkBitrate.prototype.sourceStreamId=0,SdkBitrate.prototype.avgBitrateBps=0,SdkBitrate.create=function(o){return new SdkBitrate(o)},SdkBitrate.encode=function(o,p){return p||(p=ei.create()),null!=o.sourceStreamId&&Object.hasOwnProperty.call(o,"sourceStreamId")&&p.uint32(8).uint32(o.sourceStreamId),null!=o.avgBitrateBps&&Object.hasOwnProperty.call(o,"avgBitrateBps")&&p.uint32(16).uint32(o.avgBitrateBps),p},SdkBitrate.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkBitrate.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkBitrate;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.sourceStreamId=o.uint32();break;case 2:m.avgBitrateBps=o.uint32();break;default:o.skipType(7&_)}}return m},SdkBitrate.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkBitrate.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.sourceStreamId&&o.hasOwnProperty("sourceStreamId")&&!er.isInteger(o.sourceStreamId)?"sourceStreamId: integer expected":null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&!er.isInteger(o.avgBitrateBps)?"avgBitrateBps: integer expected":null},SdkBitrate.fromObject=function(o){if(o instanceof en.SdkBitrate)return o;var p=new en.SdkBitrate;return null!=o.sourceStreamId&&(p.sourceStreamId=o.sourceStreamId>>>0),null!=o.avgBitrateBps&&(p.avgBitrateBps=o.avgBitrateBps>>>0),p},SdkBitrate.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.sourceStreamId=0,f.avgBitrateBps=0),null!=o.sourceStreamId&&o.hasOwnProperty("sourceStreamId")&&(f.sourceStreamId=o.sourceStreamId),null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&(f.avgBitrateBps=o.avgBitrateBps),f},SdkBitrate.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkBitrate.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkBitrate"},SdkBitrate}(),en.SdkAudioControlFrame=function(){function SdkAudioControlFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioControlFrame.prototype.muted=!1,SdkAudioControlFrame.create=function(o){return new SdkAudioControlFrame(o)},SdkAudioControlFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.muted&&Object.hasOwnProperty.call(o,"muted")&&p.uint32(8).bool(o.muted),p},SdkAudioControlFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioControlFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioControlFrame;o.pos<f;){var _=o.uint32();_>>>3==1?m.muted=o.bool():o.skipType(7&_)}return m},SdkAudioControlFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioControlFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null},SdkAudioControlFrame.fromObject=function(o){if(o instanceof en.SdkAudioControlFrame)return o;var p=new en.SdkAudioControlFrame;return null!=o.muted&&(p.muted=!!o.muted),p},SdkAudioControlFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.muted=!1),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),f},SdkAudioControlFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioControlFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioControlFrame"},SdkAudioControlFrame}(),en.SdkAudioMetadataFrame=function(){function SdkAudioMetadataFrame(o){if(this.attendeeStates=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioMetadataFrame.prototype.attendeeStates=er.emptyArray,SdkAudioMetadataFrame.create=function(o){return new SdkAudioMetadataFrame(o)},SdkAudioMetadataFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.attendeeStates&&o.attendeeStates.length)for(var f=0;f<o.attendeeStates.length;++f)en.SdkAudioAttendeeState.encode(o.attendeeStates[f],p.uint32(10).fork()).ldelim();return p},SdkAudioMetadataFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioMetadataFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioMetadataFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.attendeeStates&&m.attendeeStates.length||(m.attendeeStates=[]),m.attendeeStates.push(en.SdkAudioAttendeeState.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkAudioMetadataFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioMetadataFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.attendeeStates&&o.hasOwnProperty("attendeeStates")){if(!Array.isArray(o.attendeeStates))return"attendeeStates: array expected";for(var p=0;p<o.attendeeStates.length;++p){var f=en.SdkAudioAttendeeState.verify(o.attendeeStates[p]);if(f)return"attendeeStates."+f}}return null},SdkAudioMetadataFrame.fromObject=function(o){if(o instanceof en.SdkAudioMetadataFrame)return o;var p=new en.SdkAudioMetadataFrame;if(o.attendeeStates){if(!Array.isArray(o.attendeeStates))throw TypeError(".SdkAudioMetadataFrame.attendeeStates: array expected");p.attendeeStates=[];for(var f=0;f<o.attendeeStates.length;++f){if("object"!=typeof o.attendeeStates[f])throw TypeError(".SdkAudioMetadataFrame.attendeeStates: object expected");p.attendeeStates[f]=en.SdkAudioAttendeeState.fromObject(o.attendeeStates[f])}}return p},SdkAudioMetadataFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.attendeeStates=[]),o.attendeeStates&&o.attendeeStates.length){f.attendeeStates=[];for(var m=0;m<o.attendeeStates.length;++m)f.attendeeStates[m]=en.SdkAudioAttendeeState.toObject(o.attendeeStates[m],p)}return f},SdkAudioMetadataFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioMetadataFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioMetadataFrame"},SdkAudioMetadataFrame}(),en.SdkAudioAttendeeState=function(){function SdkAudioAttendeeState(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioAttendeeState.prototype.audioStreamId=0,SdkAudioAttendeeState.prototype.volume=0,SdkAudioAttendeeState.prototype.muted=!1,SdkAudioAttendeeState.prototype.signalStrength=0,SdkAudioAttendeeState.create=function(o){return new SdkAudioAttendeeState(o)},SdkAudioAttendeeState.encode=function(o,p){return p||(p=ei.create()),null!=o.audioStreamId&&Object.hasOwnProperty.call(o,"audioStreamId")&&p.uint32(8).uint32(o.audioStreamId),null!=o.volume&&Object.hasOwnProperty.call(o,"volume")&&p.uint32(16).uint32(o.volume),null!=o.muted&&Object.hasOwnProperty.call(o,"muted")&&p.uint32(24).bool(o.muted),null!=o.signalStrength&&Object.hasOwnProperty.call(o,"signalStrength")&&p.uint32(32).uint32(o.signalStrength),p},SdkAudioAttendeeState.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioAttendeeState.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioAttendeeState;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.audioStreamId=o.uint32();break;case 2:m.volume=o.uint32();break;case 3:m.muted=o.bool();break;case 4:m.signalStrength=o.uint32();break;default:o.skipType(7&_)}}return m},SdkAudioAttendeeState.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioAttendeeState.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&!er.isInteger(o.audioStreamId)?"audioStreamId: integer expected":null!=o.volume&&o.hasOwnProperty("volume")&&!er.isInteger(o.volume)?"volume: integer expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null!=o.signalStrength&&o.hasOwnProperty("signalStrength")&&!er.isInteger(o.signalStrength)?"signalStrength: integer expected":null},SdkAudioAttendeeState.fromObject=function(o){if(o instanceof en.SdkAudioAttendeeState)return o;var p=new en.SdkAudioAttendeeState;return null!=o.audioStreamId&&(p.audioStreamId=o.audioStreamId>>>0),null!=o.volume&&(p.volume=o.volume>>>0),null!=o.muted&&(p.muted=!!o.muted),null!=o.signalStrength&&(p.signalStrength=o.signalStrength>>>0),p},SdkAudioAttendeeState.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStreamId=0,f.volume=0,f.muted=!1,f.signalStrength=0),null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&(f.audioStreamId=o.audioStreamId),null!=o.volume&&o.hasOwnProperty("volume")&&(f.volume=o.volume),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),null!=o.signalStrength&&o.hasOwnProperty("signalStrength")&&(f.signalStrength=o.signalStrength),f},SdkAudioAttendeeState.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioAttendeeState.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioAttendeeState"},SdkAudioAttendeeState}(),en.SdkAudioStreamIdInfoFrame=function(){function SdkAudioStreamIdInfoFrame(o){if(this.streams=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioStreamIdInfoFrame.prototype.streams=er.emptyArray,SdkAudioStreamIdInfoFrame.create=function(o){return new SdkAudioStreamIdInfoFrame(o)},SdkAudioStreamIdInfoFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.streams&&o.streams.length)for(var f=0;f<o.streams.length;++f)en.SdkAudioStreamIdInfo.encode(o.streams[f],p.uint32(10).fork()).ldelim();return p},SdkAudioStreamIdInfoFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioStreamIdInfoFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioStreamIdInfoFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.streams&&m.streams.length||(m.streams=[]),m.streams.push(en.SdkAudioStreamIdInfo.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkAudioStreamIdInfoFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStreamIdInfoFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streams&&o.hasOwnProperty("streams")){if(!Array.isArray(o.streams))return"streams: array expected";for(var p=0;p<o.streams.length;++p){var f=en.SdkAudioStreamIdInfo.verify(o.streams[p]);if(f)return"streams."+f}}return null},SdkAudioStreamIdInfoFrame.fromObject=function(o){if(o instanceof en.SdkAudioStreamIdInfoFrame)return o;var p=new en.SdkAudioStreamIdInfoFrame;if(o.streams){if(!Array.isArray(o.streams))throw TypeError(".SdkAudioStreamIdInfoFrame.streams: array expected");p.streams=[];for(var f=0;f<o.streams.length;++f){if("object"!=typeof o.streams[f])throw TypeError(".SdkAudioStreamIdInfoFrame.streams: object expected");p.streams[f]=en.SdkAudioStreamIdInfo.fromObject(o.streams[f])}}return p},SdkAudioStreamIdInfoFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.streams=[]),o.streams&&o.streams.length){f.streams=[];for(var m=0;m<o.streams.length;++m)f.streams[m]=en.SdkAudioStreamIdInfo.toObject(o.streams[m],p)}return f},SdkAudioStreamIdInfoFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStreamIdInfoFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStreamIdInfoFrame"},SdkAudioStreamIdInfoFrame}(),en.SdkAudioStreamIdInfo=function(){function SdkAudioStreamIdInfo(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioStreamIdInfo.prototype.audioStreamId=0,SdkAudioStreamIdInfo.prototype.attendeeId="",SdkAudioStreamIdInfo.prototype.muted=!1,SdkAudioStreamIdInfo.prototype.externalUserId="",SdkAudioStreamIdInfo.prototype.dropped=!1,SdkAudioStreamIdInfo.create=function(o){return new SdkAudioStreamIdInfo(o)},SdkAudioStreamIdInfo.encode=function(o,p){return p||(p=ei.create()),null!=o.audioStreamId&&Object.hasOwnProperty.call(o,"audioStreamId")&&p.uint32(8).uint32(o.audioStreamId),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(18).string(o.attendeeId),null!=o.muted&&Object.hasOwnProperty.call(o,"muted")&&p.uint32(24).bool(o.muted),null!=o.externalUserId&&Object.hasOwnProperty.call(o,"externalUserId")&&p.uint32(34).string(o.externalUserId),null!=o.dropped&&Object.hasOwnProperty.call(o,"dropped")&&p.uint32(40).bool(o.dropped),p},SdkAudioStreamIdInfo.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioStreamIdInfo.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioStreamIdInfo;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.audioStreamId=o.uint32();break;case 2:m.attendeeId=o.string();break;case 3:m.muted=o.bool();break;case 4:m.externalUserId=o.string();break;case 5:m.dropped=o.bool();break;default:o.skipType(7&_)}}return m},SdkAudioStreamIdInfo.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStreamIdInfo.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&!er.isInteger(o.audioStreamId)?"audioStreamId: integer expected":null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId)?"attendeeId: string expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.dropped&&o.hasOwnProperty("dropped")&&"boolean"!=typeof o.dropped?"dropped: boolean expected":null},SdkAudioStreamIdInfo.fromObject=function(o){if(o instanceof en.SdkAudioStreamIdInfo)return o;var p=new en.SdkAudioStreamIdInfo;return null!=o.audioStreamId&&(p.audioStreamId=o.audioStreamId>>>0),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.muted&&(p.muted=!!o.muted),null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.dropped&&(p.dropped=!!o.dropped),p},SdkAudioStreamIdInfo.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStreamId=0,f.attendeeId="",f.muted=!1,f.externalUserId="",f.dropped=!1),null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&(f.audioStreamId=o.audioStreamId),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.dropped&&o.hasOwnProperty("dropped")&&(f.dropped=o.dropped),f},SdkAudioStreamIdInfo.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStreamIdInfo.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStreamIdInfo"},SdkAudioStreamIdInfo}(),(B=Object.create(L={}))[L[1]="PING"]=1,B[L[2]="PONG"]=2,en.SdkPingPongType=B,en.SdkPingPongFrame=function(){function SdkPingPongFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPingPongFrame.prototype.type=1,SdkPingPongFrame.prototype.pingId=0,SdkPingPongFrame.create=function(o){return new SdkPingPongFrame(o)},SdkPingPongFrame.encode=function(o,p){return p||(p=ei.create()),p.uint32(8).int32(o.type),p.uint32(16).uint32(o.pingId),p},SdkPingPongFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPingPongFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPingPongFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.pingId=o.uint32();break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("type"))throw er.ProtocolError("missing required 'type'",{instance:m});if(!m.hasOwnProperty("pingId"))throw er.ProtocolError("missing required 'pingId'",{instance:m});return m},SdkPingPongFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPingPongFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";switch(o.type){default:return"type: enum value expected";case 1:case 2:}},SdkPingPongFrame.fromObject=function(o){if(o instanceof en.SdkPingPongFrame)return o;var p=new en.SdkPingPongFrame;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"PING":case 1:p.type=1;break;case"PONG":case 2:p.type=2}return null!=o.pingId&&(p.pingId=o.pingId>>>0),p},SdkPingPongFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"PING":1,f.pingId=0),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkPingPongType[o.type]?o.type:en.SdkPingPongType[o.type]:o.type),null!=o.pingId&&o.hasOwnProperty("pingId")&&(f.pingId=o.pingId),f},SdkPingPongFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPingPongFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPingPongFrame"},SdkPingPongFrame}(),en.SdkAudioStatusFrame=function(){function SdkAudioStatusFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkAudioStatusFrame.prototype.audioStatus=0,SdkAudioStatusFrame.create=function(o){return new SdkAudioStatusFrame(o)},SdkAudioStatusFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.audioStatus&&Object.hasOwnProperty.call(o,"audioStatus")&&p.uint32(8).uint32(o.audioStatus),p},SdkAudioStatusFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkAudioStatusFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkAudioStatusFrame;o.pos<f;){var _=o.uint32();_>>>3==1?m.audioStatus=o.uint32():o.skipType(7&_)}return m},SdkAudioStatusFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStatusFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&!er.isInteger(o.audioStatus)?"audioStatus: integer expected":null},SdkAudioStatusFrame.fromObject=function(o){if(o instanceof en.SdkAudioStatusFrame)return o;var p=new en.SdkAudioStatusFrame;return null!=o.audioStatus&&(p.audioStatus=o.audioStatus>>>0),p},SdkAudioStatusFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStatus=0),null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&(f.audioStatus=o.audioStatus),f},SdkAudioStatusFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStatusFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStatusFrame"},SdkAudioStatusFrame}(),en.SdkMetric=function(){var o,p;function SdkMetric(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkMetric.prototype.type=1,SdkMetric.prototype.value=0,SdkMetric.create=function(o){return new SdkMetric(o)},SdkMetric.encode=function(o,p){return p||(p=ei.create()),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(8).int32(o.type),null!=o.value&&Object.hasOwnProperty.call(o,"value")&&p.uint32(17).double(o.value),p},SdkMetric.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkMetric.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkMetric;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.value=o.double();break;default:o.skipType(7&_)}}return m},SdkMetric.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkMetric.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 60:case 64:case 66:case 69:case 72:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:}return null!=o.value&&o.hasOwnProperty("value")&&"number"!=typeof o.value?"value: number expected":null},SdkMetric.fromObject=function(o){if(o instanceof en.SdkMetric)return o;var p=new en.SdkMetric;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:p.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:p.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:p.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:p.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:p.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:p.type=6;break;case"STUN_RTT_MS":case 7:p.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:p.type=8;break;case"RTC_MIC_JITTER_MS":case 9:p.type=9;break;case"RTC_MIC_PPS":case 10:p.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:p.type=11;break;case"RTC_MIC_BITRATE":case 12:p.type=12;break;case"RTC_MIC_RTT_MS":case 13:p.type=13;break;case"RTC_SPK_PPS":case 14:p.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:p.type=15;break;case"RTC_SPK_JITTER_MS":case 16:p.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:p.type=17;break;case"RTC_SPK_BITRATE":case 18:p.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:p.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:p.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:p.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:p.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:p.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:p.type=24;break;case"VIDEO_ENCODE_MS":case 25:p.type=25;break;case"VIDEO_INPUT_FPS":case 26:p.type=26;break;case"VIDEO_ENCODE_FPS":case 27:p.type=27;break;case"VIDEO_SENT_FPS":case 28:p.type=28;break;case"VIDEO_FIRS_RECEIVED":case 29:p.type=29;break;case"VIDEO_SENT_PPS":case 30:p.type=30;break;case"VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT":case 31:p.type=31;break;case"VIDEO_SENT_BITRATE":case 32:p.type=32;break;case"VIDEO_DROPPED_FPS":case 33:p.type=33;break;case"VIDEO_TARGET_DELAY_MS":case 34:p.type=34;break;case"VIDEO_DECODE_MS":case 35:p.type=35;break;case"VIDEO_OUTPUT_FPS":case 36:p.type=36;break;case"VIDEO_RECEIVED_PPS":case 37:p.type=37;break;case"VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT":case 38:p.type=38;break;case"VIDEO_RENDER_DELAY_MS":case 39:p.type=39;break;case"VIDEO_RECEIVED_FPS":case 40:p.type=40;break;case"VIDEO_DECODE_FPS":case 41:p.type=41;break;case"VIDEO_NACKS_SENT":case 42:p.type=42;break;case"VIDEO_FIRS_SENT":case 43:p.type=43;break;case"VIDEO_RECEIVED_BITRATE":case 44:p.type=44;break;case"VIDEO_CURRENT_DELAY_MS":case 45:p.type=45;break;case"VIDEO_JITTER_BUFFER_MS":case 46:p.type=46;break;case"VIDEO_DISCARDED_PPS":case 47:p.type=47;break;case"VIDEO_PLIS_SENT":case 48:p.type=48;break;case"VIDEO_RECEIVED_JITTER_MS":case 49:p.type=49;break;case"VIDEO_INPUT_HEIGHT":case 60:p.type=60;break;case"VIDEO_ENCODE_HEIGHT":case 64:p.type=64;break;case"VIDEO_SENT_QP_SUM":case 66:p.type=66;break;case"VIDEO_DECODE_HEIGHT":case 69:p.type=69;break;case"VIDEO_RECEIVED_QP_SUM":case 72:p.type=72;break;case"VIDEO_ENCODE_WIDTH":case 86:p.type=86;break;case"VIDEO_DECODE_WIDTH":case 87:p.type=87;break;case"VIDEO_ENCODER_IS_HARDWARE":case 88:p.type=88;break;case"VIDEO_DECODER_IS_HARDWARE":case 89:p.type=89;break;case"VIDEO_FREEZE_COUNT":case 90:p.type=90;break;case"VIDEO_FREEZE_DURATION":case 91:p.type=91;break;case"VIDEO_PAUSE_COUNT":case 92:p.type=92;break;case"VIDEO_PAUSE_DURATION":case 93:p.type=93;break;case"VIDEO_QUALITY_REASON":case 94:p.type=94;break;case"VIDEO_PROCESSING_TIME":case 95:p.type=95;break;case"RTC_SPK_AUDIO_LEVEL":case 96:p.type=96;break;case"RTC_MIC_AUDIO_LEVEL":case 97:p.type=97;break;case"RTC_SPK_TOTAL_LOST":case 98:p.type=98;break;case"RTC_SPK_TOTAL_EXPECTED":case 99:p.type=99;break;case"RTC_SPK_TOTAL_RECOVERED_RED":case 100:p.type=100;break;case"RTC_SPK_TOTAL_RECOVERED_FEC":case 101:p.type=101;break;case"VIDEO_QUALITY_LIMITATION_DURATION_CPU":case 102:p.type=102;break;case"VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU":case 103:p.type=103;break;case"VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE":case 104:p.type=104;break;case"VIDEO_RENDER_HEIGHT":case 105:p.type=105;break;case"VIDEO_RENDER_WIDTH":case 106:p.type=106;break;case"VIDEO_INPUT_WIDTH":case 107:p.type=107;break;case"VIDEO_SENT_JITTER_MS":case 108:p.type=108}return null!=o.value&&(p.value=Number(o.value)),p},SdkMetric.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,f.value=0),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkMetric.Type[o.type]?o.type:en.SdkMetric.Type[o.type]:o.type),null!=o.value&&o.hasOwnProperty("value")&&(f.value=p.json&&!isFinite(o.value)?String(o.value):o.value),f},SdkMetric.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkMetric.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkMetric"},(p=Object.create(o={}))[o[1]="VIDEO_ACTUAL_ENCODER_BITRATE"]=1,p[o[2]="VIDEO_AVAILABLE_SEND_BANDWIDTH"]=2,p[o[3]="VIDEO_RETRANSMIT_BITRATE"]=3,p[o[4]="VIDEO_AVAILABLE_RECEIVE_BANDWIDTH"]=4,p[o[5]="VIDEO_TARGET_ENCODER_BITRATE"]=5,p[o[6]="VIDEO_BUCKET_DELAY_MS"]=6,p[o[7]="STUN_RTT_MS"]=7,p[o[8]="SOCKET_DISCARDED_PPS"]=8,p[o[9]="RTC_MIC_JITTER_MS"]=9,p[o[10]="RTC_MIC_PPS"]=10,p[o[11]="RTC_MIC_FRACTION_PACKET_LOST_PERCENT"]=11,p[o[12]="RTC_MIC_BITRATE"]=12,p[o[13]="RTC_MIC_RTT_MS"]=13,p[o[14]="RTC_SPK_PPS"]=14,p[o[15]="RTC_SPK_FRACTION_PACKET_LOST_PERCENT"]=15,p[o[16]="RTC_SPK_JITTER_MS"]=16,p[o[17]="RTC_SPK_FRACTION_DECODER_LOSS_PERCENT"]=17,p[o[18]="RTC_SPK_BITRATE"]=18,p[o[19]="RTC_SPK_CURRENT_DELAY_MS"]=19,p[o[20]="RTC_SPK_JITTER_BUFFER_MS"]=20,p[o[21]="VIDEO_SENT_RTT_MS"]=21,p[o[22]="VIDEO_ENCODE_USAGE_PERCENT"]=22,p[o[23]="VIDEO_NACKS_RECEIVED"]=23,p[o[24]="VIDEO_PLIS_RECEIVED"]=24,p[o[25]="VIDEO_ENCODE_MS"]=25,p[o[26]="VIDEO_INPUT_FPS"]=26,p[o[27]="VIDEO_ENCODE_FPS"]=27,p[o[28]="VIDEO_SENT_FPS"]=28,p[o[29]="VIDEO_FIRS_RECEIVED"]=29,p[o[30]="VIDEO_SENT_PPS"]=30,p[o[31]="VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT"]=31,p[o[32]="VIDEO_SENT_BITRATE"]=32,p[o[33]="VIDEO_DROPPED_FPS"]=33,p[o[34]="VIDEO_TARGET_DELAY_MS"]=34,p[o[35]="VIDEO_DECODE_MS"]=35,p[o[36]="VIDEO_OUTPUT_FPS"]=36,p[o[37]="VIDEO_RECEIVED_PPS"]=37,p[o[38]="VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT"]=38,p[o[39]="VIDEO_RENDER_DELAY_MS"]=39,p[o[40]="VIDEO_RECEIVED_FPS"]=40,p[o[41]="VIDEO_DECODE_FPS"]=41,p[o[42]="VIDEO_NACKS_SENT"]=42,p[o[43]="VIDEO_FIRS_SENT"]=43,p[o[44]="VIDEO_RECEIVED_BITRATE"]=44,p[o[45]="VIDEO_CURRENT_DELAY_MS"]=45,p[o[46]="VIDEO_JITTER_BUFFER_MS"]=46,p[o[47]="VIDEO_DISCARDED_PPS"]=47,p[o[48]="VIDEO_PLIS_SENT"]=48,p[o[49]="VIDEO_RECEIVED_JITTER_MS"]=49,p[o[60]="VIDEO_INPUT_HEIGHT"]=60,p[o[64]="VIDEO_ENCODE_HEIGHT"]=64,p[o[66]="VIDEO_SENT_QP_SUM"]=66,p[o[69]="VIDEO_DECODE_HEIGHT"]=69,p[o[72]="VIDEO_RECEIVED_QP_SUM"]=72,p[o[86]="VIDEO_ENCODE_WIDTH"]=86,p[o[87]="VIDEO_DECODE_WIDTH"]=87,p[o[88]="VIDEO_ENCODER_IS_HARDWARE"]=88,p[o[89]="VIDEO_DECODER_IS_HARDWARE"]=89,p[o[90]="VIDEO_FREEZE_COUNT"]=90,p[o[91]="VIDEO_FREEZE_DURATION"]=91,p[o[92]="VIDEO_PAUSE_COUNT"]=92,p[o[93]="VIDEO_PAUSE_DURATION"]=93,p[o[94]="VIDEO_QUALITY_REASON"]=94,p[o[95]="VIDEO_PROCESSING_TIME"]=95,p[o[96]="RTC_SPK_AUDIO_LEVEL"]=96,p[o[97]="RTC_MIC_AUDIO_LEVEL"]=97,p[o[98]="RTC_SPK_TOTAL_LOST"]=98,p[o[99]="RTC_SPK_TOTAL_EXPECTED"]=99,p[o[100]="RTC_SPK_TOTAL_RECOVERED_RED"]=100,p[o[101]="RTC_SPK_TOTAL_RECOVERED_FEC"]=101,p[o[102]="VIDEO_QUALITY_LIMITATION_DURATION_CPU"]=102,p[o[103]="VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU"]=103,p[o[104]="VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE"]=104,p[o[105]="VIDEO_RENDER_HEIGHT"]=105,p[o[106]="VIDEO_RENDER_WIDTH"]=106,p[o[107]="VIDEO_INPUT_WIDTH"]=107,p[o[108]="VIDEO_SENT_JITTER_MS"]=108,SdkMetric.Type=p,SdkMetric}(),en.SdkStreamMetricFrame=function(){function SdkStreamMetricFrame(o){if(this.metrics=[],this.dimensions=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamMetricFrame.prototype.streamId=0,SdkStreamMetricFrame.prototype.groupId=0,SdkStreamMetricFrame.prototype.metrics=er.emptyArray,SdkStreamMetricFrame.prototype.dimensions=er.emptyArray,SdkStreamMetricFrame.prototype.mediaType=1,SdkStreamMetricFrame.create=function(o){return new SdkStreamMetricFrame(o)},SdkStreamMetricFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(24).uint32(o.streamId),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(32).uint32(o.groupId),null!=o.metrics&&o.metrics.length)for(var f=0;f<o.metrics.length;++f)en.SdkMetric.encode(o.metrics[f],p.uint32(42).fork()).ldelim();if(null!=o.dimensions&&o.dimensions.length)for(var f=0;f<o.dimensions.length;++f)en.SdkStreamDimension.encode(o.dimensions[f],p.uint32(50).fork()).ldelim();return null!=o.mediaType&&Object.hasOwnProperty.call(o,"mediaType")&&p.uint32(56).int32(o.mediaType),p},SdkStreamMetricFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamMetricFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamMetricFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 3:m.streamId=o.uint32();break;case 4:m.groupId=o.uint32();break;case 5:m.metrics&&m.metrics.length||(m.metrics=[]),m.metrics.push(en.SdkMetric.decode(o,o.uint32()));break;case 6:m.dimensions&&m.dimensions.length||(m.dimensions=[]),m.dimensions.push(en.SdkStreamDimension.decode(o,o.uint32()));break;case 7:m.mediaType=o.int32();break;default:o.skipType(7&_)}}return m},SdkStreamMetricFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamMetricFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.metrics&&o.hasOwnProperty("metrics")){if(!Array.isArray(o.metrics))return"metrics: array expected";for(var p=0;p<o.metrics.length;++p){var f=en.SdkMetric.verify(o.metrics[p]);if(f)return"metrics."+f}}if(null!=o.dimensions&&o.hasOwnProperty("dimensions")){if(!Array.isArray(o.dimensions))return"dimensions: array expected";for(var p=0;p<o.dimensions.length;++p){var f=en.SdkStreamDimension.verify(o.dimensions[p]);if(f)return"dimensions."+f}}if(null!=o.mediaType&&o.hasOwnProperty("mediaType"))switch(o.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null},SdkStreamMetricFrame.fromObject=function(o){if(o instanceof en.SdkStreamMetricFrame)return o;var p=new en.SdkStreamMetricFrame;if(null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),o.metrics){if(!Array.isArray(o.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");p.metrics=[];for(var f=0;f<o.metrics.length;++f){if("object"!=typeof o.metrics[f])throw TypeError(".SdkStreamMetricFrame.metrics: object expected");p.metrics[f]=en.SdkMetric.fromObject(o.metrics[f])}}if(o.dimensions){if(!Array.isArray(o.dimensions))throw TypeError(".SdkStreamMetricFrame.dimensions: array expected");p.dimensions=[];for(var f=0;f<o.dimensions.length;++f){if("object"!=typeof o.dimensions[f])throw TypeError(".SdkStreamMetricFrame.dimensions: object expected");p.dimensions[f]=en.SdkStreamDimension.fromObject(o.dimensions[f])}}switch(o.mediaType){default:"number"==typeof o.mediaType&&(p.mediaType=o.mediaType);break;case"AUDIO":case 1:p.mediaType=1;break;case"VIDEO":case 2:p.mediaType=2}return p},SdkStreamMetricFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.metrics=[],f.dimensions=[]),p.defaults&&(f.streamId=0,f.groupId=0,f.mediaType=p.enums===String?"AUDIO":1),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),o.metrics&&o.metrics.length){f.metrics=[];for(var m=0;m<o.metrics.length;++m)f.metrics[m]=en.SdkMetric.toObject(o.metrics[m],p)}if(o.dimensions&&o.dimensions.length){f.dimensions=[];for(var m=0;m<o.dimensions.length;++m)f.dimensions[m]=en.SdkStreamDimension.toObject(o.dimensions[m],p)}return null!=o.mediaType&&o.hasOwnProperty("mediaType")&&(f.mediaType=p.enums===String?void 0===en.SdkStreamMediaType[o.mediaType]?o.mediaType:en.SdkStreamMediaType[o.mediaType]:o.mediaType),f},SdkStreamMetricFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamMetricFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamMetricFrame"},SdkStreamMetricFrame}(),en.SdkClientMetricFrame=function(){function SdkClientMetricFrame(o){if(this.globalMetrics=[],this.streamMetricFrames=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkClientMetricFrame.prototype.globalMetrics=er.emptyArray,SdkClientMetricFrame.prototype.streamMetricFrames=er.emptyArray,SdkClientMetricFrame.create=function(o){return new SdkClientMetricFrame(o)},SdkClientMetricFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.globalMetrics&&o.globalMetrics.length)for(var f=0;f<o.globalMetrics.length;++f)en.SdkMetric.encode(o.globalMetrics[f],p.uint32(10).fork()).ldelim();if(null!=o.streamMetricFrames&&o.streamMetricFrames.length)for(var f=0;f<o.streamMetricFrames.length;++f)en.SdkStreamMetricFrame.encode(o.streamMetricFrames[f],p.uint32(18).fork()).ldelim();return p},SdkClientMetricFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkClientMetricFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkClientMetricFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.globalMetrics&&m.globalMetrics.length||(m.globalMetrics=[]),m.globalMetrics.push(en.SdkMetric.decode(o,o.uint32()));break;case 2:m.streamMetricFrames&&m.streamMetricFrames.length||(m.streamMetricFrames=[]),m.streamMetricFrames.push(en.SdkStreamMetricFrame.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkClientMetricFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkClientMetricFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.globalMetrics&&o.hasOwnProperty("globalMetrics")){if(!Array.isArray(o.globalMetrics))return"globalMetrics: array expected";for(var p=0;p<o.globalMetrics.length;++p){var f=en.SdkMetric.verify(o.globalMetrics[p]);if(f)return"globalMetrics."+f}}if(null!=o.streamMetricFrames&&o.hasOwnProperty("streamMetricFrames")){if(!Array.isArray(o.streamMetricFrames))return"streamMetricFrames: array expected";for(var p=0;p<o.streamMetricFrames.length;++p){var f=en.SdkStreamMetricFrame.verify(o.streamMetricFrames[p]);if(f)return"streamMetricFrames."+f}}return null},SdkClientMetricFrame.fromObject=function(o){if(o instanceof en.SdkClientMetricFrame)return o;var p=new en.SdkClientMetricFrame;if(o.globalMetrics){if(!Array.isArray(o.globalMetrics))throw TypeError(".SdkClientMetricFrame.globalMetrics: array expected");p.globalMetrics=[];for(var f=0;f<o.globalMetrics.length;++f){if("object"!=typeof o.globalMetrics[f])throw TypeError(".SdkClientMetricFrame.globalMetrics: object expected");p.globalMetrics[f]=en.SdkMetric.fromObject(o.globalMetrics[f])}}if(o.streamMetricFrames){if(!Array.isArray(o.streamMetricFrames))throw TypeError(".SdkClientMetricFrame.streamMetricFrames: array expected");p.streamMetricFrames=[];for(var f=0;f<o.streamMetricFrames.length;++f){if("object"!=typeof o.streamMetricFrames[f])throw TypeError(".SdkClientMetricFrame.streamMetricFrames: object expected");p.streamMetricFrames[f]=en.SdkStreamMetricFrame.fromObject(o.streamMetricFrames[f])}}return p},SdkClientMetricFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.globalMetrics=[],f.streamMetricFrames=[]),o.globalMetrics&&o.globalMetrics.length){f.globalMetrics=[];for(var m=0;m<o.globalMetrics.length;++m)f.globalMetrics[m]=en.SdkMetric.toObject(o.globalMetrics[m],p)}if(o.streamMetricFrames&&o.streamMetricFrames.length){f.streamMetricFrames=[];for(var m=0;m<o.streamMetricFrames.length;++m)f.streamMetricFrames[m]=en.SdkStreamMetricFrame.toObject(o.streamMetricFrames[m],p)}return f},SdkClientMetricFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkClientMetricFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkClientMetricFrame"},SdkClientMetricFrame}(),en.SdkStreamDimension=function(){var o,p;function SdkStreamDimension(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkStreamDimension.prototype.type=1,SdkStreamDimension.prototype.value=null,SdkStreamDimension.create=function(o){return new SdkStreamDimension(o)},SdkStreamDimension.encode=function(o,p){return p||(p=ei.create()),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(8).int32(o.type),null!=o.value&&Object.hasOwnProperty.call(o,"value")&&en.SdkDimensionValue.encode(o.value,p.uint32(18).fork()).ldelim(),p},SdkStreamDimension.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkStreamDimension.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkStreamDimension;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.value=en.SdkDimensionValue.decode(o,o.uint32());break;default:o.skipType(7&_)}}return m},SdkStreamDimension.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamDimension.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:}if(null!=o.value&&o.hasOwnProperty("value")){var p=en.SdkDimensionValue.verify(o.value);if(p)return"value."+p}return null},SdkStreamDimension.fromObject=function(o){if(o instanceof en.SdkStreamDimension)return o;var p=new en.SdkStreamDimension;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"VIDEO_ENCODER_NAME":case 1:p.type=1;break;case"VIDEO_DECODER_NAME":case 2:p.type=2}if(null!=o.value){if("object"!=typeof o.value)throw TypeError(".SdkStreamDimension.value: object expected");p.value=en.SdkDimensionValue.fromObject(o.value)}return p},SdkStreamDimension.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"VIDEO_ENCODER_NAME":1,f.value=null),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkStreamDimension.Type[o.type]?o.type:en.SdkStreamDimension.Type[o.type]:o.type),null!=o.value&&o.hasOwnProperty("value")&&(f.value=en.SdkDimensionValue.toObject(o.value,p)),f},SdkStreamDimension.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamDimension.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamDimension"},(p=Object.create(o={}))[o[1]="VIDEO_ENCODER_NAME"]=1,p[o[2]="VIDEO_DECODER_NAME"]=2,SdkStreamDimension.Type=p,SdkStreamDimension}(),en.SdkDimensionValue=function(){function SdkDimensionValue(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkDimensionValue.prototype.stringValue="",SdkDimensionValue.prototype.boolValue=!1,SdkDimensionValue.prototype.uintValue=er.Long?er.Long.fromBits(0,0,!0):0,SdkDimensionValue.create=function(o){return new SdkDimensionValue(o)},SdkDimensionValue.encode=function(o,p){return p||(p=ei.create()),null!=o.stringValue&&Object.hasOwnProperty.call(o,"stringValue")&&p.uint32(10).string(o.stringValue),null!=o.boolValue&&Object.hasOwnProperty.call(o,"boolValue")&&p.uint32(16).bool(o.boolValue),null!=o.uintValue&&Object.hasOwnProperty.call(o,"uintValue")&&p.uint32(24).uint64(o.uintValue),p},SdkDimensionValue.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkDimensionValue.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkDimensionValue;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.stringValue=o.string();break;case 2:m.boolValue=o.bool();break;case 3:m.uintValue=o.uint64();break;default:o.skipType(7&_)}}return m},SdkDimensionValue.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDimensionValue.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.stringValue&&o.hasOwnProperty("stringValue")&&!er.isString(o.stringValue)?"stringValue: string expected":null!=o.boolValue&&o.hasOwnProperty("boolValue")&&"boolean"!=typeof o.boolValue?"boolValue: boolean expected":null!=o.uintValue&&o.hasOwnProperty("uintValue")&&!er.isInteger(o.uintValue)&&!(o.uintValue&&er.isInteger(o.uintValue.low)&&er.isInteger(o.uintValue.high))?"uintValue: integer|Long expected":null},SdkDimensionValue.fromObject=function(o){if(o instanceof en.SdkDimensionValue)return o;var p=new en.SdkDimensionValue;return null!=o.stringValue&&(p.stringValue=String(o.stringValue)),null!=o.boolValue&&(p.boolValue=!!o.boolValue),null!=o.uintValue&&(er.Long?(p.uintValue=er.Long.fromValue(o.uintValue)).unsigned=!0:"string"==typeof o.uintValue?p.uintValue=parseInt(o.uintValue,10):"number"==typeof o.uintValue?p.uintValue=o.uintValue:"object"==typeof o.uintValue&&(p.uintValue=new er.LongBits(o.uintValue.low>>>0,o.uintValue.high>>>0).toNumber(!0))),p},SdkDimensionValue.toObject=function(o,p){p||(p={});var f={};if(p.defaults)if(f.stringValue="",f.boolValue=!1,er.Long){var m=new er.Long(0,0,!0);f.uintValue=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.uintValue=p.longs===String?"0":0;return null!=o.stringValue&&o.hasOwnProperty("stringValue")&&(f.stringValue=o.stringValue),null!=o.boolValue&&o.hasOwnProperty("boolValue")&&(f.boolValue=o.boolValue),null!=o.uintValue&&o.hasOwnProperty("uintValue")&&("number"==typeof o.uintValue?f.uintValue=p.longs===String?String(o.uintValue):o.uintValue:f.uintValue=p.longs===String?er.Long.prototype.toString.call(o.uintValue):p.longs===Number?new er.LongBits(o.uintValue.low>>>0,o.uintValue.high>>>0).toNumber(!0):o.uintValue),f},SdkDimensionValue.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDimensionValue.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDimensionValue"},SdkDimensionValue}(),en.SdkDataMessageFrame=function(){function SdkDataMessageFrame(o){if(this.messages=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkDataMessageFrame.prototype.messages=er.emptyArray,SdkDataMessageFrame.create=function(o){return new SdkDataMessageFrame(o)},SdkDataMessageFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.messages&&o.messages.length)for(var f=0;f<o.messages.length;++f)en.SdkDataMessagePayload.encode(o.messages[f],p.uint32(10).fork()).ldelim();return p},SdkDataMessageFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkDataMessageFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkDataMessageFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.messages&&m.messages.length||(m.messages=[]),m.messages.push(en.SdkDataMessagePayload.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkDataMessageFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDataMessageFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.messages&&o.hasOwnProperty("messages")){if(!Array.isArray(o.messages))return"messages: array expected";for(var p=0;p<o.messages.length;++p){var f=en.SdkDataMessagePayload.verify(o.messages[p]);if(f)return"messages."+f}}return null},SdkDataMessageFrame.fromObject=function(o){if(o instanceof en.SdkDataMessageFrame)return o;var p=new en.SdkDataMessageFrame;if(o.messages){if(!Array.isArray(o.messages))throw TypeError(".SdkDataMessageFrame.messages: array expected");p.messages=[];for(var f=0;f<o.messages.length;++f){if("object"!=typeof o.messages[f])throw TypeError(".SdkDataMessageFrame.messages: object expected");p.messages[f]=en.SdkDataMessagePayload.fromObject(o.messages[f])}}return p},SdkDataMessageFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.messages=[]),o.messages&&o.messages.length){f.messages=[];for(var m=0;m<o.messages.length;++m)f.messages[m]=en.SdkDataMessagePayload.toObject(o.messages[m],p)}return f},SdkDataMessageFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDataMessageFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDataMessageFrame"},SdkDataMessageFrame}(),en.SdkDataMessagePayload=function(){function SdkDataMessagePayload(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkDataMessagePayload.prototype.topic="",SdkDataMessagePayload.prototype.data=er.newBuffer([]),SdkDataMessagePayload.prototype.lifetimeMs=0,SdkDataMessagePayload.prototype.senderAttendeeId="",SdkDataMessagePayload.prototype.ingestTimeNs=er.Long?er.Long.fromBits(0,0,!1):0,SdkDataMessagePayload.prototype.senderExternalUserId="",SdkDataMessagePayload.create=function(o){return new SdkDataMessagePayload(o)},SdkDataMessagePayload.encode=function(o,p){return p||(p=ei.create()),null!=o.topic&&Object.hasOwnProperty.call(o,"topic")&&p.uint32(10).string(o.topic),null!=o.data&&Object.hasOwnProperty.call(o,"data")&&p.uint32(18).bytes(o.data),null!=o.lifetimeMs&&Object.hasOwnProperty.call(o,"lifetimeMs")&&p.uint32(24).uint32(o.lifetimeMs),null!=o.senderAttendeeId&&Object.hasOwnProperty.call(o,"senderAttendeeId")&&p.uint32(34).string(o.senderAttendeeId),null!=o.ingestTimeNs&&Object.hasOwnProperty.call(o,"ingestTimeNs")&&p.uint32(40).int64(o.ingestTimeNs),null!=o.senderExternalUserId&&Object.hasOwnProperty.call(o,"senderExternalUserId")&&p.uint32(50).string(o.senderExternalUserId),p},SdkDataMessagePayload.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkDataMessagePayload.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkDataMessagePayload;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.topic=o.string();break;case 2:m.data=o.bytes();break;case 3:m.lifetimeMs=o.uint32();break;case 4:m.senderAttendeeId=o.string();break;case 5:m.ingestTimeNs=o.int64();break;case 6:m.senderExternalUserId=o.string();break;default:o.skipType(7&_)}}return m},SdkDataMessagePayload.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDataMessagePayload.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.topic&&o.hasOwnProperty("topic")&&!er.isString(o.topic)?"topic: string expected":null!=o.data&&o.hasOwnProperty("data")&&!(o.data&&"number"==typeof o.data.length||er.isString(o.data))?"data: buffer expected":null!=o.lifetimeMs&&o.hasOwnProperty("lifetimeMs")&&!er.isInteger(o.lifetimeMs)?"lifetimeMs: integer expected":null!=o.senderAttendeeId&&o.hasOwnProperty("senderAttendeeId")&&!er.isString(o.senderAttendeeId)?"senderAttendeeId: string expected":null!=o.ingestTimeNs&&o.hasOwnProperty("ingestTimeNs")&&!er.isInteger(o.ingestTimeNs)&&!(o.ingestTimeNs&&er.isInteger(o.ingestTimeNs.low)&&er.isInteger(o.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=o.senderExternalUserId&&o.hasOwnProperty("senderExternalUserId")&&!er.isString(o.senderExternalUserId)?"senderExternalUserId: string expected":null},SdkDataMessagePayload.fromObject=function(o){if(o instanceof en.SdkDataMessagePayload)return o;var p=new en.SdkDataMessagePayload;return null!=o.topic&&(p.topic=String(o.topic)),null!=o.data&&("string"==typeof o.data?er.base64.decode(o.data,p.data=er.newBuffer(er.base64.length(o.data)),0):o.data.length>=0&&(p.data=o.data)),null!=o.lifetimeMs&&(p.lifetimeMs=o.lifetimeMs>>>0),null!=o.senderAttendeeId&&(p.senderAttendeeId=String(o.senderAttendeeId)),null!=o.ingestTimeNs&&(er.Long?(p.ingestTimeNs=er.Long.fromValue(o.ingestTimeNs)).unsigned=!1:"string"==typeof o.ingestTimeNs?p.ingestTimeNs=parseInt(o.ingestTimeNs,10):"number"==typeof o.ingestTimeNs?p.ingestTimeNs=o.ingestTimeNs:"object"==typeof o.ingestTimeNs&&(p.ingestTimeNs=new er.LongBits(o.ingestTimeNs.low>>>0,o.ingestTimeNs.high>>>0).toNumber())),null!=o.senderExternalUserId&&(p.senderExternalUserId=String(o.senderExternalUserId)),p},SdkDataMessagePayload.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.topic="",p.bytes===String?f.data="":(f.data=[],p.bytes!==Array&&(f.data=er.newBuffer(f.data))),f.lifetimeMs=0,f.senderAttendeeId="",er.Long){var m=new er.Long(0,0,!1);f.ingestTimeNs=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.ingestTimeNs=p.longs===String?"0":0;f.senderExternalUserId=""}return null!=o.topic&&o.hasOwnProperty("topic")&&(f.topic=o.topic),null!=o.data&&o.hasOwnProperty("data")&&(f.data=p.bytes===String?er.base64.encode(o.data,0,o.data.length):p.bytes===Array?Array.prototype.slice.call(o.data):o.data),null!=o.lifetimeMs&&o.hasOwnProperty("lifetimeMs")&&(f.lifetimeMs=o.lifetimeMs),null!=o.senderAttendeeId&&o.hasOwnProperty("senderAttendeeId")&&(f.senderAttendeeId=o.senderAttendeeId),null!=o.ingestTimeNs&&o.hasOwnProperty("ingestTimeNs")&&("number"==typeof o.ingestTimeNs?f.ingestTimeNs=p.longs===String?String(o.ingestTimeNs):o.ingestTimeNs:f.ingestTimeNs=p.longs===String?er.Long.prototype.toString.call(o.ingestTimeNs):p.longs===Number?new er.LongBits(o.ingestTimeNs.low>>>0,o.ingestTimeNs.high>>>0).toNumber():o.ingestTimeNs),null!=o.senderExternalUserId&&o.hasOwnProperty("senderExternalUserId")&&(f.senderExternalUserId=o.senderExternalUserId),f},SdkDataMessagePayload.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDataMessagePayload.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDataMessagePayload"},SdkDataMessagePayload}(),en.SdkTurnCredentials=function(){function SdkTurnCredentials(o){if(this.uris=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTurnCredentials.prototype.username="",SdkTurnCredentials.prototype.password="",SdkTurnCredentials.prototype.ttl=0,SdkTurnCredentials.prototype.uris=er.emptyArray,SdkTurnCredentials.create=function(o){return new SdkTurnCredentials(o)},SdkTurnCredentials.encode=function(o,p){if(p||(p=ei.create()),null!=o.username&&Object.hasOwnProperty.call(o,"username")&&p.uint32(10).string(o.username),null!=o.password&&Object.hasOwnProperty.call(o,"password")&&p.uint32(18).string(o.password),null!=o.ttl&&Object.hasOwnProperty.call(o,"ttl")&&p.uint32(24).uint32(o.ttl),null!=o.uris&&o.uris.length)for(var f=0;f<o.uris.length;++f)p.uint32(34).string(o.uris[f]);return p},SdkTurnCredentials.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTurnCredentials.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTurnCredentials;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.username=o.string();break;case 2:m.password=o.string();break;case 3:m.ttl=o.uint32();break;case 4:m.uris&&m.uris.length||(m.uris=[]),m.uris.push(o.string());break;default:o.skipType(7&_)}}return m},SdkTurnCredentials.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTurnCredentials.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.username&&o.hasOwnProperty("username")&&!er.isString(o.username))return"username: string expected";if(null!=o.password&&o.hasOwnProperty("password")&&!er.isString(o.password))return"password: string expected";if(null!=o.ttl&&o.hasOwnProperty("ttl")&&!er.isInteger(o.ttl))return"ttl: integer expected";if(null!=o.uris&&o.hasOwnProperty("uris")){if(!Array.isArray(o.uris))return"uris: array expected";for(var p=0;p<o.uris.length;++p)if(!er.isString(o.uris[p]))return"uris: string[] expected"}return null},SdkTurnCredentials.fromObject=function(o){if(o instanceof en.SdkTurnCredentials)return o;var p=new en.SdkTurnCredentials;if(null!=o.username&&(p.username=String(o.username)),null!=o.password&&(p.password=String(o.password)),null!=o.ttl&&(p.ttl=o.ttl>>>0),o.uris){if(!Array.isArray(o.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");p.uris=[];for(var f=0;f<o.uris.length;++f)p.uris[f]=String(o.uris[f])}return p},SdkTurnCredentials.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.uris=[]),p.defaults&&(f.username="",f.password="",f.ttl=0),null!=o.username&&o.hasOwnProperty("username")&&(f.username=o.username),null!=o.password&&o.hasOwnProperty("password")&&(f.password=o.password),null!=o.ttl&&o.hasOwnProperty("ttl")&&(f.ttl=o.ttl),o.uris&&o.uris.length){f.uris=[];for(var m=0;m<o.uris.length;++m)f.uris[m]=o.uris[m]}return f},SdkTurnCredentials.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTurnCredentials.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTurnCredentials"},SdkTurnCredentials}(),en.SdkTranscriptItem=function(){var o,p;function SdkTranscriptItem(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptItem.prototype.content="",SdkTranscriptItem.prototype.endTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptItem.prototype.speakerAttendeeId="",SdkTranscriptItem.prototype.speakerExternalUserId="",SdkTranscriptItem.prototype.startTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptItem.prototype.type=1,SdkTranscriptItem.prototype.vocabularyFilterMatch=!1,SdkTranscriptItem.prototype.confidence=0,SdkTranscriptItem.prototype.stable=!1,SdkTranscriptItem.create=function(o){return new SdkTranscriptItem(o)},SdkTranscriptItem.encode=function(o,p){return p||(p=ei.create()),null!=o.content&&Object.hasOwnProperty.call(o,"content")&&p.uint32(10).string(o.content),null!=o.endTime&&Object.hasOwnProperty.call(o,"endTime")&&p.uint32(16).int64(o.endTime),null!=o.speakerAttendeeId&&Object.hasOwnProperty.call(o,"speakerAttendeeId")&&p.uint32(26).string(o.speakerAttendeeId),null!=o.speakerExternalUserId&&Object.hasOwnProperty.call(o,"speakerExternalUserId")&&p.uint32(34).string(o.speakerExternalUserId),null!=o.startTime&&Object.hasOwnProperty.call(o,"startTime")&&p.uint32(40).int64(o.startTime),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(48).int32(o.type),null!=o.vocabularyFilterMatch&&Object.hasOwnProperty.call(o,"vocabularyFilterMatch")&&p.uint32(56).bool(o.vocabularyFilterMatch),null!=o.confidence&&Object.hasOwnProperty.call(o,"confidence")&&p.uint32(65).double(o.confidence),null!=o.stable&&Object.hasOwnProperty.call(o,"stable")&&p.uint32(72).bool(o.stable),p},SdkTranscriptItem.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptItem.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptItem;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.content=o.string();break;case 2:m.endTime=o.int64();break;case 3:m.speakerAttendeeId=o.string();break;case 4:m.speakerExternalUserId=o.string();break;case 5:m.startTime=o.int64();break;case 6:m.type=o.int32();break;case 7:m.vocabularyFilterMatch=o.bool();break;case 8:m.confidence=o.double();break;case 9:m.stable=o.bool();break;default:o.skipType(7&_)}}return m},SdkTranscriptItem.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptItem.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.content&&o.hasOwnProperty("content")&&!er.isString(o.content))return"content: string expected";if(null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high)))return"endTime: integer|Long expected";if(null!=o.speakerAttendeeId&&o.hasOwnProperty("speakerAttendeeId")&&!er.isString(o.speakerAttendeeId))return"speakerAttendeeId: string expected";if(null!=o.speakerExternalUserId&&o.hasOwnProperty("speakerExternalUserId")&&!er.isString(o.speakerExternalUserId))return"speakerExternalUserId: string expected";if(null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high)))return"startTime: integer|Long expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:}return null!=o.vocabularyFilterMatch&&o.hasOwnProperty("vocabularyFilterMatch")&&"boolean"!=typeof o.vocabularyFilterMatch?"vocabularyFilterMatch: boolean expected":null!=o.confidence&&o.hasOwnProperty("confidence")&&"number"!=typeof o.confidence?"confidence: number expected":null!=o.stable&&o.hasOwnProperty("stable")&&"boolean"!=typeof o.stable?"stable: boolean expected":null},SdkTranscriptItem.fromObject=function(o){if(o instanceof en.SdkTranscriptItem)return o;var p=new en.SdkTranscriptItem;switch(null!=o.content&&(p.content=String(o.content)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.speakerAttendeeId&&(p.speakerAttendeeId=String(o.speakerAttendeeId)),null!=o.speakerExternalUserId&&(p.speakerExternalUserId=String(o.speakerExternalUserId)),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"PRONUNCIATION":case 1:p.type=1;break;case"PUNCTUATION":case 2:p.type=2}return null!=o.vocabularyFilterMatch&&(p.vocabularyFilterMatch=!!o.vocabularyFilterMatch),null!=o.confidence&&(p.confidence=Number(o.confidence)),null!=o.stable&&(p.stable=!!o.stable),p},SdkTranscriptItem.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.content="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(f.speakerAttendeeId="",f.speakerExternalUserId="",er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.type=p.enums===String?"PRONUNCIATION":1,f.vocabularyFilterMatch=!1,f.confidence=0,f.stable=!1}return null!=o.content&&o.hasOwnProperty("content")&&(f.content=o.content),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.speakerAttendeeId&&o.hasOwnProperty("speakerAttendeeId")&&(f.speakerAttendeeId=o.speakerAttendeeId),null!=o.speakerExternalUserId&&o.hasOwnProperty("speakerExternalUserId")&&(f.speakerExternalUserId=o.speakerExternalUserId),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkTranscriptItem.Type[o.type]?o.type:en.SdkTranscriptItem.Type[o.type]:o.type),null!=o.vocabularyFilterMatch&&o.hasOwnProperty("vocabularyFilterMatch")&&(f.vocabularyFilterMatch=o.vocabularyFilterMatch),null!=o.confidence&&o.hasOwnProperty("confidence")&&(f.confidence=p.json&&!isFinite(o.confidence)?String(o.confidence):o.confidence),null!=o.stable&&o.hasOwnProperty("stable")&&(f.stable=o.stable),f},SdkTranscriptItem.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptItem.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptItem"},(p=Object.create(o={}))[o[1]="PRONUNCIATION"]=1,p[o[2]="PUNCTUATION"]=2,SdkTranscriptItem.Type=p,SdkTranscriptItem}(),en.SdkTranscriptEntity=function(){function SdkTranscriptEntity(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptEntity.prototype.category="",SdkTranscriptEntity.prototype.confidence=0,SdkTranscriptEntity.prototype.content="",SdkTranscriptEntity.prototype.endTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptEntity.prototype.startTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptEntity.prototype.type="",SdkTranscriptEntity.create=function(o){return new SdkTranscriptEntity(o)},SdkTranscriptEntity.encode=function(o,p){return p||(p=ei.create()),null!=o.category&&Object.hasOwnProperty.call(o,"category")&&p.uint32(10).string(o.category),null!=o.confidence&&Object.hasOwnProperty.call(o,"confidence")&&p.uint32(17).double(o.confidence),null!=o.content&&Object.hasOwnProperty.call(o,"content")&&p.uint32(26).string(o.content),null!=o.endTime&&Object.hasOwnProperty.call(o,"endTime")&&p.uint32(32).int64(o.endTime),null!=o.startTime&&Object.hasOwnProperty.call(o,"startTime")&&p.uint32(40).int64(o.startTime),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(50).string(o.type),p},SdkTranscriptEntity.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptEntity.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptEntity;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.category=o.string();break;case 2:m.confidence=o.double();break;case 3:m.content=o.string();break;case 4:m.endTime=o.int64();break;case 5:m.startTime=o.int64();break;case 6:m.type=o.string();break;default:o.skipType(7&_)}}return m},SdkTranscriptEntity.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptEntity.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.category&&o.hasOwnProperty("category")&&!er.isString(o.category)?"category: string expected":null!=o.confidence&&o.hasOwnProperty("confidence")&&"number"!=typeof o.confidence?"confidence: number expected":null!=o.content&&o.hasOwnProperty("content")&&!er.isString(o.content)?"content: string expected":null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high))?"endTime: integer|Long expected":null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high))?"startTime: integer|Long expected":null!=o.type&&o.hasOwnProperty("type")&&!er.isString(o.type)?"type: string expected":null},SdkTranscriptEntity.fromObject=function(o){if(o instanceof en.SdkTranscriptEntity)return o;var p=new en.SdkTranscriptEntity;return null!=o.category&&(p.category=String(o.category)),null!=o.confidence&&(p.confidence=Number(o.confidence)),null!=o.content&&(p.content=String(o.content)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),null!=o.type&&(p.type=String(o.type)),p},SdkTranscriptEntity.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.category="",f.confidence=0,f.content="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.type=""}return null!=o.category&&o.hasOwnProperty("category")&&(f.category=o.category),null!=o.confidence&&o.hasOwnProperty("confidence")&&(f.confidence=p.json&&!isFinite(o.confidence)?String(o.confidence):o.confidence),null!=o.content&&o.hasOwnProperty("content")&&(f.content=o.content),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.type&&o.hasOwnProperty("type")&&(f.type=o.type),f},SdkTranscriptEntity.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptEntity.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptEntity"},SdkTranscriptEntity}(),en.SdkTranscriptAlternative=function(){function SdkTranscriptAlternative(o){if(this.items=[],this.entities=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptAlternative.prototype.items=er.emptyArray,SdkTranscriptAlternative.prototype.transcript="",SdkTranscriptAlternative.prototype.entities=er.emptyArray,SdkTranscriptAlternative.create=function(o){return new SdkTranscriptAlternative(o)},SdkTranscriptAlternative.encode=function(o,p){if(p||(p=ei.create()),null!=o.items&&o.items.length)for(var f=0;f<o.items.length;++f)en.SdkTranscriptItem.encode(o.items[f],p.uint32(10).fork()).ldelim();if(null!=o.transcript&&Object.hasOwnProperty.call(o,"transcript")&&p.uint32(18).string(o.transcript),null!=o.entities&&o.entities.length)for(var f=0;f<o.entities.length;++f)en.SdkTranscriptEntity.encode(o.entities[f],p.uint32(26).fork()).ldelim();return p},SdkTranscriptAlternative.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptAlternative.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptAlternative;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.items&&m.items.length||(m.items=[]),m.items.push(en.SdkTranscriptItem.decode(o,o.uint32()));break;case 2:m.transcript=o.string();break;case 3:m.entities&&m.entities.length||(m.entities=[]),m.entities.push(en.SdkTranscriptEntity.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkTranscriptAlternative.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptAlternative.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.items&&o.hasOwnProperty("items")){if(!Array.isArray(o.items))return"items: array expected";for(var p=0;p<o.items.length;++p){var f=en.SdkTranscriptItem.verify(o.items[p]);if(f)return"items."+f}}if(null!=o.transcript&&o.hasOwnProperty("transcript")&&!er.isString(o.transcript))return"transcript: string expected";if(null!=o.entities&&o.hasOwnProperty("entities")){if(!Array.isArray(o.entities))return"entities: array expected";for(var p=0;p<o.entities.length;++p){var f=en.SdkTranscriptEntity.verify(o.entities[p]);if(f)return"entities."+f}}return null},SdkTranscriptAlternative.fromObject=function(o){if(o instanceof en.SdkTranscriptAlternative)return o;var p=new en.SdkTranscriptAlternative;if(o.items){if(!Array.isArray(o.items))throw TypeError(".SdkTranscriptAlternative.items: array expected");p.items=[];for(var f=0;f<o.items.length;++f){if("object"!=typeof o.items[f])throw TypeError(".SdkTranscriptAlternative.items: object expected");p.items[f]=en.SdkTranscriptItem.fromObject(o.items[f])}}if(null!=o.transcript&&(p.transcript=String(o.transcript)),o.entities){if(!Array.isArray(o.entities))throw TypeError(".SdkTranscriptAlternative.entities: array expected");p.entities=[];for(var f=0;f<o.entities.length;++f){if("object"!=typeof o.entities[f])throw TypeError(".SdkTranscriptAlternative.entities: object expected");p.entities[f]=en.SdkTranscriptEntity.fromObject(o.entities[f])}}return p},SdkTranscriptAlternative.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.items=[],f.entities=[]),p.defaults&&(f.transcript=""),o.items&&o.items.length){f.items=[];for(var m=0;m<o.items.length;++m)f.items[m]=en.SdkTranscriptItem.toObject(o.items[m],p)}if(null!=o.transcript&&o.hasOwnProperty("transcript")&&(f.transcript=o.transcript),o.entities&&o.entities.length){f.entities=[];for(var m=0;m<o.entities.length;++m)f.entities[m]=en.SdkTranscriptEntity.toObject(o.entities[m],p)}return f},SdkTranscriptAlternative.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptAlternative.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptAlternative"},SdkTranscriptAlternative}(),en.SdkTranscriptLanguageWithScore=function(){function SdkTranscriptLanguageWithScore(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptLanguageWithScore.prototype.languageCode="",SdkTranscriptLanguageWithScore.prototype.score=0,SdkTranscriptLanguageWithScore.create=function(o){return new SdkTranscriptLanguageWithScore(o)},SdkTranscriptLanguageWithScore.encode=function(o,p){return p||(p=ei.create()),null!=o.languageCode&&Object.hasOwnProperty.call(o,"languageCode")&&p.uint32(10).string(o.languageCode),null!=o.score&&Object.hasOwnProperty.call(o,"score")&&p.uint32(17).double(o.score),p},SdkTranscriptLanguageWithScore.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptLanguageWithScore.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptLanguageWithScore;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.languageCode=o.string();break;case 2:m.score=o.double();break;default:o.skipType(7&_)}}return m},SdkTranscriptLanguageWithScore.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptLanguageWithScore.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.languageCode&&o.hasOwnProperty("languageCode")&&!er.isString(o.languageCode)?"languageCode: string expected":null!=o.score&&o.hasOwnProperty("score")&&"number"!=typeof o.score?"score: number expected":null},SdkTranscriptLanguageWithScore.fromObject=function(o){if(o instanceof en.SdkTranscriptLanguageWithScore)return o;var p=new en.SdkTranscriptLanguageWithScore;return null!=o.languageCode&&(p.languageCode=String(o.languageCode)),null!=o.score&&(p.score=Number(o.score)),p},SdkTranscriptLanguageWithScore.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.languageCode="",f.score=0),null!=o.languageCode&&o.hasOwnProperty("languageCode")&&(f.languageCode=o.languageCode),null!=o.score&&o.hasOwnProperty("score")&&(f.score=p.json&&!isFinite(o.score)?String(o.score):o.score),f},SdkTranscriptLanguageWithScore.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptLanguageWithScore.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptLanguageWithScore"},SdkTranscriptLanguageWithScore}(),en.SdkTranscriptResult=function(){function SdkTranscriptResult(o){if(this.alternatives=[],this.languageIdentification=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptResult.prototype.alternatives=er.emptyArray,SdkTranscriptResult.prototype.channelId="",SdkTranscriptResult.prototype.endTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptResult.prototype.isPartial=!1,SdkTranscriptResult.prototype.resultId="",SdkTranscriptResult.prototype.startTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptResult.prototype.languageCode="",SdkTranscriptResult.prototype.languageIdentification=er.emptyArray,SdkTranscriptResult.create=function(o){return new SdkTranscriptResult(o)},SdkTranscriptResult.encode=function(o,p){if(p||(p=ei.create()),null!=o.alternatives&&o.alternatives.length)for(var f=0;f<o.alternatives.length;++f)en.SdkTranscriptAlternative.encode(o.alternatives[f],p.uint32(10).fork()).ldelim();if(null!=o.channelId&&Object.hasOwnProperty.call(o,"channelId")&&p.uint32(18).string(o.channelId),null!=o.endTime&&Object.hasOwnProperty.call(o,"endTime")&&p.uint32(24).int64(o.endTime),null!=o.isPartial&&Object.hasOwnProperty.call(o,"isPartial")&&p.uint32(32).bool(o.isPartial),null!=o.resultId&&Object.hasOwnProperty.call(o,"resultId")&&p.uint32(42).string(o.resultId),null!=o.startTime&&Object.hasOwnProperty.call(o,"startTime")&&p.uint32(48).int64(o.startTime),null!=o.languageCode&&Object.hasOwnProperty.call(o,"languageCode")&&p.uint32(58).string(o.languageCode),null!=o.languageIdentification&&o.languageIdentification.length)for(var f=0;f<o.languageIdentification.length;++f)en.SdkTranscriptLanguageWithScore.encode(o.languageIdentification[f],p.uint32(66).fork()).ldelim();return p},SdkTranscriptResult.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptResult.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptResult;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.alternatives&&m.alternatives.length||(m.alternatives=[]),m.alternatives.push(en.SdkTranscriptAlternative.decode(o,o.uint32()));break;case 2:m.channelId=o.string();break;case 3:m.endTime=o.int64();break;case 4:m.isPartial=o.bool();break;case 5:m.resultId=o.string();break;case 6:m.startTime=o.int64();break;case 7:m.languageCode=o.string();break;case 8:m.languageIdentification&&m.languageIdentification.length||(m.languageIdentification=[]),m.languageIdentification.push(en.SdkTranscriptLanguageWithScore.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkTranscriptResult.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptResult.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.alternatives&&o.hasOwnProperty("alternatives")){if(!Array.isArray(o.alternatives))return"alternatives: array expected";for(var p=0;p<o.alternatives.length;++p){var f=en.SdkTranscriptAlternative.verify(o.alternatives[p]);if(f)return"alternatives."+f}}if(null!=o.channelId&&o.hasOwnProperty("channelId")&&!er.isString(o.channelId))return"channelId: string expected";if(null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high)))return"endTime: integer|Long expected";if(null!=o.isPartial&&o.hasOwnProperty("isPartial")&&"boolean"!=typeof o.isPartial)return"isPartial: boolean expected";if(null!=o.resultId&&o.hasOwnProperty("resultId")&&!er.isString(o.resultId))return"resultId: string expected";if(null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high)))return"startTime: integer|Long expected";if(null!=o.languageCode&&o.hasOwnProperty("languageCode")&&!er.isString(o.languageCode))return"languageCode: string expected";if(null!=o.languageIdentification&&o.hasOwnProperty("languageIdentification")){if(!Array.isArray(o.languageIdentification))return"languageIdentification: array expected";for(var p=0;p<o.languageIdentification.length;++p){var f=en.SdkTranscriptLanguageWithScore.verify(o.languageIdentification[p]);if(f)return"languageIdentification."+f}}return null},SdkTranscriptResult.fromObject=function(o){if(o instanceof en.SdkTranscriptResult)return o;var p=new en.SdkTranscriptResult;if(o.alternatives){if(!Array.isArray(o.alternatives))throw TypeError(".SdkTranscriptResult.alternatives: array expected");p.alternatives=[];for(var f=0;f<o.alternatives.length;++f){if("object"!=typeof o.alternatives[f])throw TypeError(".SdkTranscriptResult.alternatives: object expected");p.alternatives[f]=en.SdkTranscriptAlternative.fromObject(o.alternatives[f])}}if(null!=o.channelId&&(p.channelId=String(o.channelId)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.isPartial&&(p.isPartial=!!o.isPartial),null!=o.resultId&&(p.resultId=String(o.resultId)),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),null!=o.languageCode&&(p.languageCode=String(o.languageCode)),o.languageIdentification){if(!Array.isArray(o.languageIdentification))throw TypeError(".SdkTranscriptResult.languageIdentification: array expected");p.languageIdentification=[];for(var f=0;f<o.languageIdentification.length;++f){if("object"!=typeof o.languageIdentification[f])throw TypeError(".SdkTranscriptResult.languageIdentification: object expected");p.languageIdentification[f]=en.SdkTranscriptLanguageWithScore.fromObject(o.languageIdentification[f])}}return p},SdkTranscriptResult.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.alternatives=[],f.languageIdentification=[]),p.defaults){if(f.channelId="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(f.isPartial=!1,f.resultId="",er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.languageCode=""}if(o.alternatives&&o.alternatives.length){f.alternatives=[];for(var _=0;_<o.alternatives.length;++_)f.alternatives[_]=en.SdkTranscriptAlternative.toObject(o.alternatives[_],p)}if(null!=o.channelId&&o.hasOwnProperty("channelId")&&(f.channelId=o.channelId),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.isPartial&&o.hasOwnProperty("isPartial")&&(f.isPartial=o.isPartial),null!=o.resultId&&o.hasOwnProperty("resultId")&&(f.resultId=o.resultId),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.languageCode&&o.hasOwnProperty("languageCode")&&(f.languageCode=o.languageCode),o.languageIdentification&&o.languageIdentification.length){f.languageIdentification=[];for(var _=0;_<o.languageIdentification.length;++_)f.languageIdentification[_]=en.SdkTranscriptLanguageWithScore.toObject(o.languageIdentification[_],p)}return f},SdkTranscriptResult.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptResult.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptResult"},SdkTranscriptResult}(),en.SdkTranscript=function(){function SdkTranscript(o){if(this.results=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscript.prototype.results=er.emptyArray,SdkTranscript.create=function(o){return new SdkTranscript(o)},SdkTranscript.encode=function(o,p){if(p||(p=ei.create()),null!=o.results&&o.results.length)for(var f=0;f<o.results.length;++f)en.SdkTranscriptResult.encode(o.results[f],p.uint32(10).fork()).ldelim();return p},SdkTranscript.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscript.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscript;o.pos<f;){var _=o.uint32();_>>>3==1?(m.results&&m.results.length||(m.results=[]),m.results.push(en.SdkTranscriptResult.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkTranscript.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscript.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.results&&o.hasOwnProperty("results")){if(!Array.isArray(o.results))return"results: array expected";for(var p=0;p<o.results.length;++p){var f=en.SdkTranscriptResult.verify(o.results[p]);if(f)return"results."+f}}return null},SdkTranscript.fromObject=function(o){if(o instanceof en.SdkTranscript)return o;var p=new en.SdkTranscript;if(o.results){if(!Array.isArray(o.results))throw TypeError(".SdkTranscript.results: array expected");p.results=[];for(var f=0;f<o.results.length;++f){if("object"!=typeof o.results[f])throw TypeError(".SdkTranscript.results: object expected");p.results[f]=en.SdkTranscriptResult.fromObject(o.results[f])}}return p},SdkTranscript.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.results=[]),o.results&&o.results.length){f.results=[];for(var m=0;m<o.results.length;++m)f.results[m]=en.SdkTranscriptResult.toObject(o.results[m],p)}return f},SdkTranscript.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscript.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscript"},SdkTranscript}(),en.SdkTranscriptionStatus=function(){var o,p;function SdkTranscriptionStatus(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptionStatus.prototype.type=1,SdkTranscriptionStatus.prototype.eventTime=er.Long?er.Long.fromBits(0,0,!1):0,SdkTranscriptionStatus.prototype.transcriptionRegion="",SdkTranscriptionStatus.prototype.transcriptionConfiguration="",SdkTranscriptionStatus.prototype.message="",SdkTranscriptionStatus.create=function(o){return new SdkTranscriptionStatus(o)},SdkTranscriptionStatus.encode=function(o,p){return p||(p=ei.create()),null!=o.type&&Object.hasOwnProperty.call(o,"type")&&p.uint32(8).int32(o.type),null!=o.eventTime&&Object.hasOwnProperty.call(o,"eventTime")&&p.uint32(16).int64(o.eventTime),null!=o.transcriptionRegion&&Object.hasOwnProperty.call(o,"transcriptionRegion")&&p.uint32(26).string(o.transcriptionRegion),null!=o.transcriptionConfiguration&&Object.hasOwnProperty.call(o,"transcriptionConfiguration")&&p.uint32(34).string(o.transcriptionConfiguration),null!=o.message&&Object.hasOwnProperty.call(o,"message")&&p.uint32(42).string(o.message),p},SdkTranscriptionStatus.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptionStatus.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptionStatus;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.type=o.int32();break;case 2:m.eventTime=o.int64();break;case 3:m.transcriptionRegion=o.string();break;case 4:m.transcriptionConfiguration=o.string();break;case 5:m.message=o.string();break;default:o.skipType(7&_)}}return m},SdkTranscriptionStatus.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptionStatus.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:}return null!=o.eventTime&&o.hasOwnProperty("eventTime")&&!er.isInteger(o.eventTime)&&!(o.eventTime&&er.isInteger(o.eventTime.low)&&er.isInteger(o.eventTime.high))?"eventTime: integer|Long expected":null!=o.transcriptionRegion&&o.hasOwnProperty("transcriptionRegion")&&!er.isString(o.transcriptionRegion)?"transcriptionRegion: string expected":null!=o.transcriptionConfiguration&&o.hasOwnProperty("transcriptionConfiguration")&&!er.isString(o.transcriptionConfiguration)?"transcriptionConfiguration: string expected":null!=o.message&&o.hasOwnProperty("message")&&!er.isString(o.message)?"message: string expected":null},SdkTranscriptionStatus.fromObject=function(o){if(o instanceof en.SdkTranscriptionStatus)return o;var p=new en.SdkTranscriptionStatus;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"STARTED":case 1:p.type=1;break;case"INTERRUPTED":case 2:p.type=2;break;case"RESUMED":case 3:p.type=3;break;case"STOPPED":case 4:p.type=4;break;case"FAILED":case 5:p.type=5}return null!=o.eventTime&&(er.Long?(p.eventTime=er.Long.fromValue(o.eventTime)).unsigned=!1:"string"==typeof o.eventTime?p.eventTime=parseInt(o.eventTime,10):"number"==typeof o.eventTime?p.eventTime=o.eventTime:"object"==typeof o.eventTime&&(p.eventTime=new er.LongBits(o.eventTime.low>>>0,o.eventTime.high>>>0).toNumber())),null!=o.transcriptionRegion&&(p.transcriptionRegion=String(o.transcriptionRegion)),null!=o.transcriptionConfiguration&&(p.transcriptionConfiguration=String(o.transcriptionConfiguration)),null!=o.message&&(p.message=String(o.message)),p},SdkTranscriptionStatus.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.type=p.enums===String?"STARTED":1,er.Long){var m=new er.Long(0,0,!1);f.eventTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.eventTime=p.longs===String?"0":0;f.transcriptionRegion="",f.transcriptionConfiguration="",f.message=""}return null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkTranscriptionStatus.Type[o.type]?o.type:en.SdkTranscriptionStatus.Type[o.type]:o.type),null!=o.eventTime&&o.hasOwnProperty("eventTime")&&("number"==typeof o.eventTime?f.eventTime=p.longs===String?String(o.eventTime):o.eventTime:f.eventTime=p.longs===String?er.Long.prototype.toString.call(o.eventTime):p.longs===Number?new er.LongBits(o.eventTime.low>>>0,o.eventTime.high>>>0).toNumber():o.eventTime),null!=o.transcriptionRegion&&o.hasOwnProperty("transcriptionRegion")&&(f.transcriptionRegion=o.transcriptionRegion),null!=o.transcriptionConfiguration&&o.hasOwnProperty("transcriptionConfiguration")&&(f.transcriptionConfiguration=o.transcriptionConfiguration),null!=o.message&&o.hasOwnProperty("message")&&(f.message=o.message),f},SdkTranscriptionStatus.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptionStatus.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptionStatus"},(p=Object.create(o={}))[o[1]="STARTED"]=1,p[o[2]="INTERRUPTED"]=2,p[o[3]="RESUMED"]=3,p[o[4]="STOPPED"]=4,p[o[5]="FAILED"]=5,SdkTranscriptionStatus.Type=p,SdkTranscriptionStatus}(),en.SdkTranscriptEvent=function(){var o;function SdkTranscriptEvent(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptEvent.prototype.status=null,SdkTranscriptEvent.prototype.transcript=null,Object.defineProperty(SdkTranscriptEvent.prototype,"Event",{get:er.oneOfGetter(o=["status","transcript"]),set:er.oneOfSetter(o)}),SdkTranscriptEvent.create=function(o){return new SdkTranscriptEvent(o)},SdkTranscriptEvent.encode=function(o,p){return p||(p=ei.create()),null!=o.status&&Object.hasOwnProperty.call(o,"status")&&en.SdkTranscriptionStatus.encode(o.status,p.uint32(10).fork()).ldelim(),null!=o.transcript&&Object.hasOwnProperty.call(o,"transcript")&&en.SdkTranscript.encode(o.transcript,p.uint32(18).fork()).ldelim(),p},SdkTranscriptEvent.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptEvent.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptEvent;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.status=en.SdkTranscriptionStatus.decode(o,o.uint32());break;case 2:m.transcript=en.SdkTranscript.decode(o,o.uint32());break;default:o.skipType(7&_)}}return m},SdkTranscriptEvent.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptEvent.verify=function(o){if("object"!=typeof o||null===o)return"object expected";var p={};if(null!=o.status&&o.hasOwnProperty("status")){p.Event=1;var f=en.SdkTranscriptionStatus.verify(o.status);if(f)return"status."+f}if(null!=o.transcript&&o.hasOwnProperty("transcript")){if(1===p.Event)return"Event: multiple values";p.Event=1;var f=en.SdkTranscript.verify(o.transcript);if(f)return"transcript."+f}return null},SdkTranscriptEvent.fromObject=function(o){if(o instanceof en.SdkTranscriptEvent)return o;var p=new en.SdkTranscriptEvent;if(null!=o.status){if("object"!=typeof o.status)throw TypeError(".SdkTranscriptEvent.status: object expected");p.status=en.SdkTranscriptionStatus.fromObject(o.status)}if(null!=o.transcript){if("object"!=typeof o.transcript)throw TypeError(".SdkTranscriptEvent.transcript: object expected");p.transcript=en.SdkTranscript.fromObject(o.transcript)}return p},SdkTranscriptEvent.toObject=function(o,p){p||(p={});var f={};return null!=o.status&&o.hasOwnProperty("status")&&(f.status=en.SdkTranscriptionStatus.toObject(o.status,p),p.oneofs&&(f.Event="status")),null!=o.transcript&&o.hasOwnProperty("transcript")&&(f.transcript=en.SdkTranscript.toObject(o.transcript,p),p.oneofs&&(f.Event="transcript")),f},SdkTranscriptEvent.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptEvent.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptEvent"},SdkTranscriptEvent}(),en.SdkTranscriptFrame=function(){function SdkTranscriptFrame(o){if(this.events=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkTranscriptFrame.prototype.events=er.emptyArray,SdkTranscriptFrame.create=function(o){return new SdkTranscriptFrame(o)},SdkTranscriptFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.events&&o.events.length)for(var f=0;f<o.events.length;++f)en.SdkTranscriptEvent.encode(o.events[f],p.uint32(10).fork()).ldelim();return p},SdkTranscriptFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkTranscriptFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkTranscriptFrame;o.pos<f;){var _=o.uint32();_>>>3==1?(m.events&&m.events.length||(m.events=[]),m.events.push(en.SdkTranscriptEvent.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkTranscriptFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.events&&o.hasOwnProperty("events")){if(!Array.isArray(o.events))return"events: array expected";for(var p=0;p<o.events.length;++p){var f=en.SdkTranscriptEvent.verify(o.events[p]);if(f)return"events."+f}}return null},SdkTranscriptFrame.fromObject=function(o){if(o instanceof en.SdkTranscriptFrame)return o;var p=new en.SdkTranscriptFrame;if(o.events){if(!Array.isArray(o.events))throw TypeError(".SdkTranscriptFrame.events: array expected");p.events=[];for(var f=0;f<o.events.length;++f){if("object"!=typeof o.events[f])throw TypeError(".SdkTranscriptFrame.events: object expected");p.events[f]=en.SdkTranscriptEvent.fromObject(o.events[f])}}return p},SdkTranscriptFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.events=[]),o.events&&o.events.length){f.events=[];for(var m=0;m<o.events.length;++m)f.events[m]=en.SdkTranscriptEvent.toObject(o.events[m],p)}return f},SdkTranscriptFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptFrame"},SdkTranscriptFrame}(),en.SdkRemoteVideoUpdateFrame=function(){function SdkRemoteVideoUpdateFrame(o){if(this.addedOrUpdatedVideoSubscriptions=[],this.removedVideoSubscriptionMids=[],o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkRemoteVideoUpdateFrame.prototype.addedOrUpdatedVideoSubscriptions=er.emptyArray,SdkRemoteVideoUpdateFrame.prototype.removedVideoSubscriptionMids=er.emptyArray,SdkRemoteVideoUpdateFrame.create=function(o){return new SdkRemoteVideoUpdateFrame(o)},SdkRemoteVideoUpdateFrame.encode=function(o,p){if(p||(p=ei.create()),null!=o.addedOrUpdatedVideoSubscriptions&&o.addedOrUpdatedVideoSubscriptions.length)for(var f=0;f<o.addedOrUpdatedVideoSubscriptions.length;++f)en.SdkVideoSubscriptionConfiguration.encode(o.addedOrUpdatedVideoSubscriptions[f],p.uint32(10).fork()).ldelim();if(null!=o.removedVideoSubscriptionMids&&o.removedVideoSubscriptionMids.length)for(var f=0;f<o.removedVideoSubscriptionMids.length;++f)p.uint32(18).string(o.removedVideoSubscriptionMids[f]);return p},SdkRemoteVideoUpdateFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkRemoteVideoUpdateFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkRemoteVideoUpdateFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.addedOrUpdatedVideoSubscriptions&&m.addedOrUpdatedVideoSubscriptions.length||(m.addedOrUpdatedVideoSubscriptions=[]),m.addedOrUpdatedVideoSubscriptions.push(en.SdkVideoSubscriptionConfiguration.decode(o,o.uint32()));break;case 2:m.removedVideoSubscriptionMids&&m.removedVideoSubscriptionMids.length||(m.removedVideoSubscriptionMids=[]),m.removedVideoSubscriptionMids.push(o.string());break;default:o.skipType(7&_)}}return m},SdkRemoteVideoUpdateFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkRemoteVideoUpdateFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.addedOrUpdatedVideoSubscriptions&&o.hasOwnProperty("addedOrUpdatedVideoSubscriptions")){if(!Array.isArray(o.addedOrUpdatedVideoSubscriptions))return"addedOrUpdatedVideoSubscriptions: array expected";for(var p=0;p<o.addedOrUpdatedVideoSubscriptions.length;++p){var f=en.SdkVideoSubscriptionConfiguration.verify(o.addedOrUpdatedVideoSubscriptions[p]);if(f)return"addedOrUpdatedVideoSubscriptions."+f}}if(null!=o.removedVideoSubscriptionMids&&o.hasOwnProperty("removedVideoSubscriptionMids")){if(!Array.isArray(o.removedVideoSubscriptionMids))return"removedVideoSubscriptionMids: array expected";for(var p=0;p<o.removedVideoSubscriptionMids.length;++p)if(!er.isString(o.removedVideoSubscriptionMids[p]))return"removedVideoSubscriptionMids: string[] expected"}return null},SdkRemoteVideoUpdateFrame.fromObject=function(o){if(o instanceof en.SdkRemoteVideoUpdateFrame)return o;var p=new en.SdkRemoteVideoUpdateFrame;if(o.addedOrUpdatedVideoSubscriptions){if(!Array.isArray(o.addedOrUpdatedVideoSubscriptions))throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: array expected");p.addedOrUpdatedVideoSubscriptions=[];for(var f=0;f<o.addedOrUpdatedVideoSubscriptions.length;++f){if("object"!=typeof o.addedOrUpdatedVideoSubscriptions[f])throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: object expected");p.addedOrUpdatedVideoSubscriptions[f]=en.SdkVideoSubscriptionConfiguration.fromObject(o.addedOrUpdatedVideoSubscriptions[f])}}if(o.removedVideoSubscriptionMids){if(!Array.isArray(o.removedVideoSubscriptionMids))throw TypeError(".SdkRemoteVideoUpdateFrame.removedVideoSubscriptionMids: array expected");p.removedVideoSubscriptionMids=[];for(var f=0;f<o.removedVideoSubscriptionMids.length;++f)p.removedVideoSubscriptionMids[f]=String(o.removedVideoSubscriptionMids[f])}return p},SdkRemoteVideoUpdateFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.addedOrUpdatedVideoSubscriptions=[],f.removedVideoSubscriptionMids=[]),o.addedOrUpdatedVideoSubscriptions&&o.addedOrUpdatedVideoSubscriptions.length){f.addedOrUpdatedVideoSubscriptions=[];for(var m=0;m<o.addedOrUpdatedVideoSubscriptions.length;++m)f.addedOrUpdatedVideoSubscriptions[m]=en.SdkVideoSubscriptionConfiguration.toObject(o.addedOrUpdatedVideoSubscriptions[m],p)}if(o.removedVideoSubscriptionMids&&o.removedVideoSubscriptionMids.length){f.removedVideoSubscriptionMids=[];for(var m=0;m<o.removedVideoSubscriptionMids.length;++m)f.removedVideoSubscriptionMids[m]=o.removedVideoSubscriptionMids[m]}return f},SdkRemoteVideoUpdateFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkRemoteVideoUpdateFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkRemoteVideoUpdateFrame"},SdkRemoteVideoUpdateFrame}(),($=Object.create(U={}))[U[1]="BALANCED"]=1,$[U[2]="MAINTAIN_FRAMERATE"]=2,$[U[3]="MAINTAIN_RESOLUTION"]=3,en.SdkVideoQualityAdaptationPreference=$,en.SdkVideoSubscriptionConfiguration=function(){function SdkVideoSubscriptionConfiguration(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkVideoSubscriptionConfiguration.prototype.mid="",SdkVideoSubscriptionConfiguration.prototype.attendeeId="",SdkVideoSubscriptionConfiguration.prototype.streamId=0,SdkVideoSubscriptionConfiguration.prototype.priority=0,SdkVideoSubscriptionConfiguration.prototype.targetBitrateKbps=0,SdkVideoSubscriptionConfiguration.prototype.groupId=0,SdkVideoSubscriptionConfiguration.prototype.qualityAdaptationPreference=1,SdkVideoSubscriptionConfiguration.create=function(o){return new SdkVideoSubscriptionConfiguration(o)},SdkVideoSubscriptionConfiguration.encode=function(o,p){return p||(p=ei.create()),p.uint32(10).string(o.mid),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(18).string(o.attendeeId),null!=o.streamId&&Object.hasOwnProperty.call(o,"streamId")&&p.uint32(24).uint32(o.streamId),null!=o.priority&&Object.hasOwnProperty.call(o,"priority")&&p.uint32(32).uint32(o.priority),null!=o.targetBitrateKbps&&Object.hasOwnProperty.call(o,"targetBitrateKbps")&&p.uint32(40).uint32(o.targetBitrateKbps),null!=o.groupId&&Object.hasOwnProperty.call(o,"groupId")&&p.uint32(48).uint32(o.groupId),null!=o.qualityAdaptationPreference&&Object.hasOwnProperty.call(o,"qualityAdaptationPreference")&&p.uint32(56).int32(o.qualityAdaptationPreference),p},SdkVideoSubscriptionConfiguration.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkVideoSubscriptionConfiguration.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkVideoSubscriptionConfiguration;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.mid=o.string();break;case 2:m.attendeeId=o.string();break;case 3:m.streamId=o.uint32();break;case 4:m.priority=o.uint32();break;case 5:m.targetBitrateKbps=o.uint32();break;case 6:m.groupId=o.uint32();break;case 7:m.qualityAdaptationPreference=o.int32();break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("mid"))throw er.ProtocolError("missing required 'mid'",{instance:m});return m},SdkVideoSubscriptionConfiguration.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkVideoSubscriptionConfiguration.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(!er.isString(o.mid))return"mid: string expected";if(null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId))return"attendeeId: string expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.priority&&o.hasOwnProperty("priority")&&!er.isInteger(o.priority))return"priority: integer expected";if(null!=o.targetBitrateKbps&&o.hasOwnProperty("targetBitrateKbps")&&!er.isInteger(o.targetBitrateKbps))return"targetBitrateKbps: integer expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.qualityAdaptationPreference&&o.hasOwnProperty("qualityAdaptationPreference"))switch(o.qualityAdaptationPreference){default:return"qualityAdaptationPreference: enum value expected";case 1:case 2:case 3:}return null},SdkVideoSubscriptionConfiguration.fromObject=function(o){if(o instanceof en.SdkVideoSubscriptionConfiguration)return o;var p=new en.SdkVideoSubscriptionConfiguration;switch(null!=o.mid&&(p.mid=String(o.mid)),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.priority&&(p.priority=o.priority>>>0),null!=o.targetBitrateKbps&&(p.targetBitrateKbps=o.targetBitrateKbps>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),o.qualityAdaptationPreference){default:"number"==typeof o.qualityAdaptationPreference&&(p.qualityAdaptationPreference=o.qualityAdaptationPreference);break;case"BALANCED":case 1:p.qualityAdaptationPreference=1;break;case"MAINTAIN_FRAMERATE":case 2:p.qualityAdaptationPreference=2;break;case"MAINTAIN_RESOLUTION":case 3:p.qualityAdaptationPreference=3}return p},SdkVideoSubscriptionConfiguration.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.mid="",f.attendeeId="",f.streamId=0,f.priority=0,f.targetBitrateKbps=0,f.groupId=0,f.qualityAdaptationPreference=p.enums===String?"BALANCED":1),null!=o.mid&&o.hasOwnProperty("mid")&&(f.mid=o.mid),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.priority&&o.hasOwnProperty("priority")&&(f.priority=o.priority),null!=o.targetBitrateKbps&&o.hasOwnProperty("targetBitrateKbps")&&(f.targetBitrateKbps=o.targetBitrateKbps),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),null!=o.qualityAdaptationPreference&&o.hasOwnProperty("qualityAdaptationPreference")&&(f.qualityAdaptationPreference=p.enums===String?void 0===en.SdkVideoQualityAdaptationPreference[o.qualityAdaptationPreference]?o.qualityAdaptationPreference:en.SdkVideoQualityAdaptationPreference[o.qualityAdaptationPreference]:o.qualityAdaptationPreference),f},SdkVideoSubscriptionConfiguration.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkVideoSubscriptionConfiguration.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkVideoSubscriptionConfiguration"},SdkVideoSubscriptionConfiguration}(),en.SdkNotificationFrame=function(){var o,p;function SdkNotificationFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkNotificationFrame.prototype.level=3,SdkNotificationFrame.prototype.message="",SdkNotificationFrame.create=function(o){return new SdkNotificationFrame(o)},SdkNotificationFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.level&&Object.hasOwnProperty.call(o,"level")&&p.uint32(8).int32(o.level),null!=o.message&&Object.hasOwnProperty.call(o,"message")&&p.uint32(18).string(o.message),p},SdkNotificationFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkNotificationFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkNotificationFrame;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.level=o.int32();break;case 2:m.message=o.string();break;default:o.skipType(7&_)}}return m},SdkNotificationFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkNotificationFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.level&&o.hasOwnProperty("level"))switch(o.level){default:return"level: enum value expected";case 1:case 2:case 3:}return null!=o.message&&o.hasOwnProperty("message")&&!er.isString(o.message)?"message: string expected":null},SdkNotificationFrame.fromObject=function(o){if(o instanceof en.SdkNotificationFrame)return o;var p=new en.SdkNotificationFrame;switch(o.level){case"INFO":case 1:p.level=1;break;case"WARNING":case 2:p.level=2;break;default:"number"==typeof o.level&&(p.level=o.level);break;case"ERROR":case 3:p.level=3}return null!=o.message&&(p.message=String(o.message)),p},SdkNotificationFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.level=p.enums===String?"ERROR":3,f.message=""),null!=o.level&&o.hasOwnProperty("level")&&(f.level=p.enums===String?void 0===en.SdkNotificationFrame.NotificationLevel[o.level]?o.level:en.SdkNotificationFrame.NotificationLevel[o.level]:o.level),null!=o.message&&o.hasOwnProperty("message")&&(f.message=o.message),f},SdkNotificationFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkNotificationFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkNotificationFrame"},(p=Object.create(o={}))[o[1]="INFO"]=1,p[o[2]="WARNING"]=2,p[o[3]="ERROR"]=3,SdkNotificationFrame.NotificationLevel=p,SdkNotificationFrame}(),en.SdkPrimaryMeetingJoinFrame=function(){function SdkPrimaryMeetingJoinFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPrimaryMeetingJoinFrame.prototype.credentials=null,SdkPrimaryMeetingJoinFrame.create=function(o){return new SdkPrimaryMeetingJoinFrame(o)},SdkPrimaryMeetingJoinFrame.encode=function(o,p){return p||(p=ei.create()),null!=o.credentials&&Object.hasOwnProperty.call(o,"credentials")&&en.SdkMeetingSessionCredentials.encode(o.credentials,p.uint32(10).fork()).ldelim(),p},SdkPrimaryMeetingJoinFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPrimaryMeetingJoinFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPrimaryMeetingJoinFrame;o.pos<f;){var _=o.uint32();_>>>3==1?m.credentials=en.SdkMeetingSessionCredentials.decode(o,o.uint32()):o.skipType(7&_)}return m},SdkPrimaryMeetingJoinFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingJoinFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.credentials&&o.hasOwnProperty("credentials")){var p=en.SdkMeetingSessionCredentials.verify(o.credentials);if(p)return"credentials."+p}return null},SdkPrimaryMeetingJoinFrame.fromObject=function(o){if(o instanceof en.SdkPrimaryMeetingJoinFrame)return o;var p=new en.SdkPrimaryMeetingJoinFrame;if(null!=o.credentials){if("object"!=typeof o.credentials)throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");p.credentials=en.SdkMeetingSessionCredentials.fromObject(o.credentials)}return p},SdkPrimaryMeetingJoinFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.credentials=null),null!=o.credentials&&o.hasOwnProperty("credentials")&&(f.credentials=en.SdkMeetingSessionCredentials.toObject(o.credentials,p)),f},SdkPrimaryMeetingJoinFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingJoinFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingJoinFrame"},SdkPrimaryMeetingJoinFrame}(),en.SdkPrimaryMeetingJoinAckFrame=function(){function SdkPrimaryMeetingJoinAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPrimaryMeetingJoinAckFrame.create=function(o){return new SdkPrimaryMeetingJoinAckFrame(o)},SdkPrimaryMeetingJoinAckFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkPrimaryMeetingJoinAckFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPrimaryMeetingJoinAckFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPrimaryMeetingJoinAckFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkPrimaryMeetingJoinAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingJoinAckFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkPrimaryMeetingJoinAckFrame.fromObject=function(o){return o instanceof en.SdkPrimaryMeetingJoinAckFrame?o:new en.SdkPrimaryMeetingJoinAckFrame},SdkPrimaryMeetingJoinAckFrame.toObject=function(){return{}},SdkPrimaryMeetingJoinAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingJoinAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingJoinAckFrame"},SdkPrimaryMeetingJoinAckFrame}(),en.SdkPrimaryMeetingLeaveFrame=function(){function SdkPrimaryMeetingLeaveFrame(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkPrimaryMeetingLeaveFrame.create=function(o){return new SdkPrimaryMeetingLeaveFrame(o)},SdkPrimaryMeetingLeaveFrame.encode=function(o,p){return p||(p=ei.create()),p},SdkPrimaryMeetingLeaveFrame.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkPrimaryMeetingLeaveFrame.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkPrimaryMeetingLeaveFrame;o.pos<f;){var _=o.uint32();o.skipType(7&_)}return m},SdkPrimaryMeetingLeaveFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingLeaveFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null},SdkPrimaryMeetingLeaveFrame.fromObject=function(o){return o instanceof en.SdkPrimaryMeetingLeaveFrame?o:new en.SdkPrimaryMeetingLeaveFrame},SdkPrimaryMeetingLeaveFrame.toObject=function(){return{}},SdkPrimaryMeetingLeaveFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingLeaveFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingLeaveFrame"},SdkPrimaryMeetingLeaveFrame}(),en.SdkMeetingSessionCredentials=function(){function SdkMeetingSessionCredentials(o){if(o)for(var p=Object.keys(o),f=0;f<p.length;++f)null!=o[p[f]]&&(this[p[f]]=o[p[f]])}return SdkMeetingSessionCredentials.prototype.attendeeId="",SdkMeetingSessionCredentials.prototype.externalUserId="",SdkMeetingSessionCredentials.prototype.joinToken="",SdkMeetingSessionCredentials.create=function(o){return new SdkMeetingSessionCredentials(o)},SdkMeetingSessionCredentials.encode=function(o,p){return p||(p=ei.create()),null!=o.attendeeId&&Object.hasOwnProperty.call(o,"attendeeId")&&p.uint32(10).string(o.attendeeId),null!=o.externalUserId&&Object.hasOwnProperty.call(o,"externalUserId")&&p.uint32(18).string(o.externalUserId),null!=o.joinToken&&Object.hasOwnProperty.call(o,"joinToken")&&p.uint32(26).string(o.joinToken),p},SdkMeetingSessionCredentials.encodeDelimited=function(o,p){return this.encode(o,p).ldelim()},SdkMeetingSessionCredentials.decode=function(o,p){o instanceof et||(o=et.create(o));for(var f=void 0===p?o.len:o.pos+p,m=new en.SdkMeetingSessionCredentials;o.pos<f;){var _=o.uint32();switch(_>>>3){case 1:m.attendeeId=o.string();break;case 2:m.externalUserId=o.string();break;case 3:m.joinToken=o.string();break;default:o.skipType(7&_)}}return m},SdkMeetingSessionCredentials.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkMeetingSessionCredentials.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId)?"attendeeId: string expected":null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.joinToken&&o.hasOwnProperty("joinToken")&&!er.isString(o.joinToken)?"joinToken: string expected":null},SdkMeetingSessionCredentials.fromObject=function(o){if(o instanceof en.SdkMeetingSessionCredentials)return o;var p=new en.SdkMeetingSessionCredentials;return null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.joinToken&&(p.joinToken=String(o.joinToken)),p},SdkMeetingSessionCredentials.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.attendeeId="",f.externalUserId="",f.joinToken=""),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.joinToken&&o.hasOwnProperty("joinToken")&&(f.joinToken=o.joinToken),f},SdkMeetingSessionCredentials.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkMeetingSessionCredentials.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkMeetingSessionCredentials"},SdkMeetingSessionCredentials}(),(Z=Object.create(q={}))[q[1]="VP8"]=1,Z[q[2]="H264_BASELINE_PROFILE"]=2,Z[q[3]="H264_CONSTRAINED_BASELINE_PROFILE"]=3,Z[q[4]="H264_MAIN_PROFILE"]=4,Z[q[5]="H264_HIGH_PROFILE"]=5,Z[q[6]="H264_CONSTRAINED_HIGH_PROFILE"]=6,Z[q[8]="VP9_PROFILE_0"]=8,Z[q[11]="AV1_MAIN_PROFILE"]=11,en.SdkVideoCodecCapability=Z,o.exports=en,er.Long=void 0,ee.configure()},0x1303d0742:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x709b03e9),I=f(0x249059e84),k=_(f(0xaf1ae5b3));p.default=class{constructor(o){this.chimeClient=o}makeTwoDigits(o){return o>9?o.toString():"0"+o.toString()}hmac(o,p){let f=new w.Sha256(p);return f.update(o),f.digest()}getDateTimeString(){let o=new Date;return o.getUTCFullYear()+this.makeTwoDigits(o.getUTCMonth()+1)+this.makeTwoDigits(o.getUTCDate())+"T"+this.makeTwoDigits(o.getUTCHours())+this.makeTwoDigits(o.getUTCMinutes())+this.makeTwoDigits(o.getUTCSeconds())+"Z"}getDateString(o){return o.substring(0,o.indexOf("T"))}getSignatureKey(o,p,f,_){return m(this,void 0,void 0,function*(){let m=yield this.hmac(p,"AWS4"+o),w=yield this.hmac(f,m),I=yield this.hmac(_,w);return yield this.hmac("aws4_request",I)})}signURL(o,p,f,_,w,M,x){return m(this,void 0,void 0,function*(){let m,O=this.getDateTimeString(),L=this.getDateString(O),B="";B=this.chimeClient.config.region instanceof Function?yield this.chimeClient.config.region():this.chimeClient.config.region;let U="host:"+_.toLowerCase()+`
`,$=L+"/"+B+"/"+f+"/aws4_request";m=this.chimeClient.config.credentials instanceof Function?yield this.chimeClient.config.credentials():this.chimeClient.config.credentials;let q=new Map;q.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),q.set("X-Amz-Credential",[encodeURIComponent(m.accessKeyId+"/"+$)]),q.set("X-Amz-Date",[O]),q.set("X-Amz-Expires",["10"]),q.set("X-Amz-SignedHeaders",["host"]),m.sessionToken&&q.set("X-Amz-Security-Token",[encodeURIComponent(m.sessionToken)]),q.set(k.default.X_AMZN_VERSION,[encodeURIComponent(k.default.sdkVersion)]),q.set(k.default.X_AMZN_USER_AGENT,[encodeURIComponent(k.default.sdkUserAgentLowResolution)]),null==x||x.forEach((o,p)=>{let f=encodeURIComponent(p);o.sort().forEach(o=>{q.has(f)||q.set(f,[]),q.get(f).push(encodeURIComponent(o))})});let Z="";(q=new Map([...q.entries()].sort())).forEach((o,p)=>{o.forEach(o=>{Z.length&&(Z+="&"),Z+=p+"="+o})});let ee=o+`
`+w+`
`+Z+`
`+U+`
`+"host"+`
`+I.toHex((yield this.hmac(M))),et=`AWS4-HMAC-SHA256
`+O+`
`+L+"/"+B+"/"+f+`/aws4_request
`+I.toHex((yield this.hmac(ee))),ei=yield this.getSignatureKey(m.secretAccessKey,L,B,f),er=I.toHex((yield this.hmac(et,ei)));return p+"://"+_+w+"?"+(Z+"&X-Amz-Signature=")+er})}}},0x14216d675:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SimulcastLayers=void 0,(m=f=p.SimulcastLayers||(p.SimulcastLayers={}))[m.Low=0]="Low",m[m.LowAndMedium=1]="LowAndMedium",m[m.LowAndHigh=2]="LowAndHigh",m[m.Medium=3]="Medium",m[m.MediumAndHigh=4]="MediumAndHigh",m[m.High=5]="High",p.default=f},0x77ea1113:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.AudioLogEvent=void 0,(m=f=p.AudioLogEvent||(p.AudioLogEvent={}))[m.DeviceChanged=0]="DeviceChanged",m[m.MutedLocal=1]="MutedLocal",m[m.UnmutedLocal=2]="UnmutedLocal",m[m.Connected=3]="Connected",m[m.ConnectFailed=4]="ConnectFailed",m[m.RedmicStartLoss=5]="RedmicStartLoss",m[m.RedmicEndLoss=6]="RedmicEndLoss",p.default=f},0xf8f9c263:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xc9ba5f35)),I=_(f(0x138ccc65a)),k=_(f(0x2fbf3af)),M=_(f(0x250d201d4)),x=_(f(0x2e51c102)),O=_(f(0x1cf28fcb9)),L=_(f(0x1210847be)),B=_(f(0x7b80cc62)),U=f(0xe88b24d9),$=f(0xb529932d),q=_(f(0x77ea1113)),Z=_(f(0x154fd3c86)),ee=class StatsCollector{constructor(o,p,f=StatsCollector.INTERVAL_MS){this.audioVideoController=o,this.logger=p,this.interval=f,this.intervalScheduler=null,this.redRecoveryMetricReport=new M.default,this.lastRedRecoveryMetricReportConsumedTimestampMs=0,this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0,this.resolutionMap=new Map,this.metricsAddTime=(o,p,f)=>{},this.metricsLogEvent=(o,p)=>{}}toAttribute(o){return this.toSuffix(o).substring(1)}toSuffix(o){return o.toLowerCase()===o?`_${o}`:o.toUpperCase()===o?`_${o.toLowerCase()}`:o.replace(/([A-Z][a-z]+)/g,function(o){return`_${o}`}).replace(/([A-Z][A-Z]+)/g,function(o){return`_${o}`}).toLowerCase()}logLatency(o,p,f){let m=this.toSuffix(o);this.logEventTime("meeting"+m,p,f)}logStateTimeout(o,p){let f=this.toSuffix(o);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},p),{state:`state${f}`}))}logAudioEvent(o,p){let f="audio"+this.toSuffix(q.default[o]);this.logEvent(f,p)}logVideoEvent(o,p){let f="video"+this.toSuffix(Z.default[o]);this.logEvent(f,p)}logEventTime(o,p,f={}){let m=Object.assign(Object.assign({},f),{call_id:this.audioVideoController.configuration.meetingId,client_type:StatsCollector.CLIENT_TYPE,metric_type:"latency"});this.logger.debug(()=>`[StatsCollector] ${o}: ${JSON.stringify(m)}`),this.metricsAddTime(o,p,m)}logMeetingSessionStatus(o){let p=`${o.statusCode()}`;this.logEvent(p);let f={status:p,status_code:`${o.statusCode()}`};this.logEvent("meeting_session_status",f),o.isTerminal()&&this.logEvent("meeting_session_stopped",f),o.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",f),o.isFailure()&&this.logEvent("meeting_session_failed",f)}logLifecycleEvent(o,p){let f={lifecycle_event:`lifecycle${this.toSuffix(O.default[o])}`,lifecycle_event_code:`${o}`,lifecycle_event_condition:`condition${this.toSuffix(L.default[p])}`,lifecycle_event_condition_code:`${p}`};this.logEvent("meeting_session_lifecycle",f)}logEvent(o,p={}){let f=Object.assign(Object.assign({},p),{call_id:this.audioVideoController.configuration.meetingId,client_type:StatsCollector.CLIENT_TYPE});this.logger.debug(()=>`[StatsCollector] ${o}: ${JSON.stringify(f)}`),this.metricsLogEvent(o,f)}start(o,p){return!this.intervalScheduler&&(this.logger.info("Starting StatsCollector"),this.signalingClient=o,this.videoStreamIndex=p,this.clientMetricReport=new w.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new B.default(this.interval),this.intervalScheduler.start(()=>m(this,void 0,void 0,function*(){yield this.getStatsWrapper()})),!0)}stop(){this.logger.info("Stopping StatsCollector"),this.intervalScheduler&&this.intervalScheduler.stop(),this.intervalScheduler=null}videoTileResolutionDidChange(o,p,f){this.resolutionMap.set(o,{width:p,height:f})}videoTileUnbound(o){this.resolutionMap.delete(o)}updateMetricValues(o,p){let f,m=p?this.clientMetricReport.streamMetricReports[Number(o.ssrc)]:this.clientMetricReport.globalMetricReport;if(p){let p=m.mediaType,_=m.direction;f=this.clientMetricReport.getMetricMap(p,_),p===k.default.VIDEO&&_===I.default.DOWNSTREAM&&this.addRenderResolutionToVideoDownstreamMetrics(m,o.ssrc)}else f=this.clientMetricReport.getMetricMap();for(let p in o)p in f&&("number"==typeof o[p]?(m.previousMetrics[p]=m.currentMetrics[p],m.currentMetrics[p]=o[p]):"string"==typeof o[p]?m.currentStringMetrics[p]=o[p]:"object"==typeof o[p]?(m.previousObjectMetrics[p]=void 0===m.currentObjectMetrics[p]?o[p]:m.currentObjectMetrics[p],m.currentObjectMetrics[p]=o[p]):this.logger.error(`Unknown metric value type ${typeof o[p]} for metric ${p}`))}processRawMetricReports(o){this.clientMetricReport.currentSsrcs={};let p=Date.now();for(let p of o){if(this.isVideoSourceMetricReport(p))continue;let o=this.isStreamRawMetricReport(p);if(o){let o=this.clientMetricReport.streamMetricReports[Number(p.ssrc)];if(o)o.mediaType===k.default.VIDEO&&o.direction===I.default.UPSTREAM?o.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(p.rid):o.streamId=this.videoStreamIndex.streamIdForSSRC(Number(p.ssrc));else{let o=new x.default;o.mediaType=this.getMediaType(p),o.direction=this.getDirectionType(p),o.mediaType===k.default.VIDEO&&o.direction===I.default.UPSTREAM?o.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(p.rid):this.videoStreamIndex.allStreams().empty()||(o.streamId=this.videoStreamIndex.streamIdForSSRC(Number(p.ssrc)),void 0!==this.videoStreamIndex.groupIdForSSRC&&(o.groupId=this.videoStreamIndex.groupIdForSSRC(Number(p.ssrc)))),this.clientMetricReport.streamMetricReports[Number(p.ssrc)]=o}this.clientMetricReport.currentSsrcs[Number(p.ssrc)]=1}this.updateMetricValues(p,o)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=p,this.clientMetricReport.print()}addStreamMetricDimensionFrames(o,p){let f=this.clientMetricReport.getStreamDimensionMap();for(let m in p.currentStringMetrics)if(m in f){let _=U.SdkStreamDimension.create();_.type=f[m];let w=U.SdkDimensionValue.create();w.stringValue=p.currentStringMetrics[m],_.value=w,o.dimensions.push(_)}}addMetricFrame(o,p,f,m){let _=f.type,w=f.transform,I=f.source,k=p.streamMetricFrames.length,M=p.streamMetricFrames[k-1];if(_){let f=U.SdkMetric.create();f.type=_,f.value=w(I||o,m),m?M.metrics.push(f):p.globalMetrics.push(f)}}addGlobalMetricsToProtobuf(o){let p=this.clientMetricReport.getMetricMap();for(let f in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(f,o,p[f])}addStreamMetricsToProtobuf(o){for(let p in this.clientMetricReport.streamMetricReports){let f=this.clientMetricReport.streamMetricReports[p],m=U.SdkStreamMetricFrame.create();m.streamId=f.streamId,m.mediaType=f.mediaType===k.default.AUDIO?U.SdkStreamMediaType.AUDIO:U.SdkStreamMediaType.VIDEO,m.metrics=[],this.addStreamMetricDimensionFrames(m,f),o.streamMetricFrames.push(m);let _=this.clientMetricReport.getMetricMap(f.mediaType,f.direction);for(let m in _)this.hasMetricDependenciesInReport(m,f)&&this.addMetricFrame(m,o,_[m],Number(p))}}hasMetricDependenciesInReport(o,p){return"decoderLoss"===o&&void 0!==p.currentMetrics.concealedSamples&&void 0!==p.currentMetrics.totalSamplesReceived||"jitterBufferMs"===o&&void 0!==p.currentMetrics.jitterBufferDelay&&void 0!==p.currentMetrics.jitterBufferEmittedCount||o in p.currentMetrics||o in p.currentStringMetrics||o in p.currentObjectMetrics}makeClientMetricProtobuf(){let o=U.SdkClientMetricFrame.create();return o.globalMetrics=[],o.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(o),this.addStreamMetricsToProtobuf(o),o}sendClientMetricProtobuf(o){this.signalingClient.sendClientMetrics(o)}isStreamRawMetricReport(o){return["inbound-rtp","inbound-rtp-red","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(o.type)||this.isVideoSourceMetricReport(o)}getMediaType(o){return"audio"===o.kind?k.default.AUDIO:k.default.VIDEO}getDirectionType(o){let{type:p}=o;return"inbound-rtp"===p||"remote-outbound-rtp"===p||"inbound-rtp-red"===p?I.default.DOWNSTREAM:I.default.UPSTREAM}isValidStandardRawMetric(o){return"inbound-rtp"===o.type||"inbound-rtp-red"===o.type||"outbound-rtp"===o.type||"remote-inbound-rtp"===o.type||"remote-outbound-rtp"===o.type||"candidate-pair"===o.type&&"succeeded"===o.state||"media-source"===o.type}isValidSsrc(o){let p=!0;return this.isStreamRawMetricReport(o)&&this.getDirectionType(o)===I.default.DOWNSTREAM&&this.getMediaType(o)===k.default.VIDEO&&(p=this.videoStreamIndex.streamIdForSSRC(Number(o.ssrc))>0),p}isValidRawMetricReport(o){return this.isValidStandardRawMetric(o)&&this.isValidSsrc(o)}filterRawMetricReports(o){let p=[];for(let f of o)this.isValidRawMetricReport(f)&&p.push(f);return p}handleRawMetricReports(o){let p=this.filterRawMetricReports(o);this.logger.debug(()=>`Filtered raw metrics : ${JSON.stringify(p)}`);let f=[];this.maybeAddRedRecoveryMetrics(f);let m=this.getVideoUpstreamSsrcFromRawMetricReports(p);null!==m&&this.addVideoCodecDegradationMetrics(f,m),this.clientMetricReport.customStatsReports=f,p.push(...f),this.processRawMetricReports(p),this.updateVideoSourceMetrics(p);let _=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(_),this.audioVideoController.forEachObserver(o=>{$.Maybe.of(o.metricsDidReceive).map(p=>p.bind(o)(this.clientMetricReport.clone()))})}getStatsWrapper(){return m(this,void 0,void 0,function*(){if(!this.audioVideoController.rtcPeerConnection)return;let o=[];try{let p=yield this.audioVideoController.rtcPeerConnection.getStats();this.clientMetricReport.rtcStatsReport=p,p.forEach(p=>{o.push(p)}),this.handleRawMetricReports(o)}catch(o){this.logger.error(o.message)}})}overrideObservableMetric(o,p){this.clientMetricReport.overrideObservableMetric(o,p)}recoveryMetricsDidReceive(o){this.redRecoveryMetricReport=o}maybeAddRedRecoveryMetrics(o){this.redRecoveryMetricReport.currentTimestampMs!==this.lastRedRecoveryMetricReportConsumedTimestampMs&&(o.push({kind:"audio",type:"inbound-rtp-red",ssrc:this.redRecoveryMetricReport.ssrc,timestamp:this.redRecoveryMetricReport.currentTimestampMs,totalAudioPacketsLost:this.redRecoveryMetricReport.totalAudioPacketsLost,totalAudioPacketsExpected:this.redRecoveryMetricReport.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.redRecoveryMetricReport.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.redRecoveryMetricReport.totalAudioPacketsRecoveredFec}),this.lastRedRecoveryMetricReportConsumedTimestampMs=this.redRecoveryMetricReport.currentTimestampMs)}videoCodecDegradationHighEncodeCpuDidReceive(){this.videoCodecDegradationHighEncodeCpuCount+=1}videoCodecDegradationEncodeFailureDidReceive(){this.videoCodecDegradationEncodeFailureCount+=1}videoCodecDegradationConcurrentSendersDidReceive(){this.videoCodecDegradationConcurrentSendersCount+=1}addVideoCodecDegradationMetrics(o,p){o.push({kind:"video",type:"outbound-rtp",ssrc:p,timestamp:Date.now(),videoCodecDegradationHighEncodeCpu:this.videoCodecDegradationHighEncodeCpuCount,videoCodecDegradationEncodeFailure:this.videoCodecDegradationEncodeFailureCount,videoCodecDegradationConcurrentSenders:this.videoCodecDegradationConcurrentSendersCount}),this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0}getVideoUpstreamSsrcFromRawMetricReports(o){for(let p of o)if(this.isStreamRawMetricReport(p)&&this.getMediaType(p)===k.default.VIDEO&&this.getDirectionType(p)===I.default.UPSTREAM)return p.ssrc;return null}isVideoSourceMetricReport(o){return"media-source"===o.type&&"video"===o.kind}addRenderResolutionToVideoDownstreamMetrics(o,p){let f=this.videoStreamIndex.streamIdForSSRC(Number(p)),m=this.videoStreamIndex.attendeeIdForStreamId(f);void 0===f||""===m?this.logger.warn(`No attendee found for ssrc ${p}`):this.resolutionMap.has(m)&&(o.currentMetrics.videoRenderWidth=this.resolutionMap.get(m).width,o.currentMetrics.videoRenderHeight=this.resolutionMap.get(m).height)}updateVideoSourceMetrics(o){for(let p of o)if(this.isVideoSourceMetricReport(p)){let o=this.clientMetricReport.getVideoUpstreamSsrcs();if(0===o.length)return void this.logger.warn("No video upstream ssrcs found");for(let f of o)this.clientMetricReport.streamMetricReports[f].currentMetrics.videoInputWidth=p.width,this.clientMetricReport.streamMetricReports[f].currentMetrics.videoInputHeight=p.height}}};p.default=ee,ee.INTERVAL_MS=1e3,ee.CLIENT_TYPE="amazon-chime-sdk-js"},0x154fd3c86:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoLogEvent=void 0,(m=f=p.VideoLogEvent||(p.VideoLogEvent={}))[m.InputAttached=0]="InputAttached",m[m.SendingFailed=1]="SendingFailed",m[m.SendingSuccess=2]="SendingSuccess",p.default=f},0xd60c9fd8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x154fd3c86)),I=_(f(0xcef35194));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="AttachMediaInputTask"}run(){return m(this,void 0,void 0,function*(){let o=this.context.transceiverController;o.setPeer(this.context.peer),o.setupLocalTransceivers();let p=this.context.activeAudioInput;if(p){let f=p.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield o.setAudioInput(f.length?f[0]:null)}else yield o.setAudioInput(null),this.context.logger.info("no audio track");this.setAudioCodecPreferences();let f=this.context.activeVideoInput;if(f){let p=f.getVideoTracks(),m=p.length?p[0]:null;if(this.context.logger.info("attaching video track to peer connection"),yield o.setVideoInput(m),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){let p=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();o.setEncodingParameters(p)}m&&this.context.statsCollector.logVideoEvent(w.default.InputAttached,this.context.videoDeviceInformation)}else yield o.setVideoInput(null),this.context.logger.info("no video track");this.context.videoSubscriptions=o.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive),this.context.videoStreamIndex.subscribeFrameSent()})}setAudioCodecPreferences(){let o=window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype,p=this.context.audioProfile.hasRedundancyEnabled();if(!o)return void this.context.logger.warn("Setting codec preferences not supported");let f=this.context.transceiverController.localAudioTransceiver(),{codecs:m}=RTCRtpSender.getCapabilities("audio");this.context.logger.debug(`Available audio codecs ${JSON.stringify(m,null,4)}`);let _=m.findIndex(o=>"audio/red"===o.mimeType);if(!f)return void this.context.logger.error("audio transceiver is null");if(_>=0){let o=m[_];m.splice(_,1),p?(m.unshift(o),this.context.logger.info("audio/red set as preferred codec")):this.context.logger.info("audio/red removed from preferred codec"),f.setCodecPreferences(m);return}this.context.logger.info("audio/red codec not supported")}}},0xcef35194:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xba0e3d5c)),I=_(f(0x372fc7cb));p.default=class{constructor(o){this.logger=o,this.taskName="BaseTask",this.parentTask=null,this.status=I.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...o){return new w.default(this.logger,this,o)}cancel(){}name(){return this.parentTask?`${this.parentTask.name()}/${this.taskName}`:this.taskName}setParent(o){this.parentTask=o}getStatus(){return this.status}logAndThrow(o){throw this.logger.info(o),Error(o)}baseRun(o){return m(this,void 0,void 0,function*(){try{let p=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case I.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case I.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case I.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=I.default.RUNNING,yield o.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-p)} ms`)}catch(o){throw o}finally{this.status!==I.default.CANCELED&&(this.status=I.default.FINISHED)}})}baseCancel(o){this.status===I.default.CANCELED||this.status===I.default.FINISHED?this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`):(this.logger.info(`canceling task ${this.name()}`),this.status=I.default.CANCELED,o.call(this))}}},0x11ee4612e:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xcef35194));p.default=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="CleanRestartedSessionTask"}run(){return m(this,void 0,void 0,function*(){this.context.resetConnectionSpecificState()})}}},0x302be147:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16bec8feb)),I=_(f(0xcef35194));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(o){throw o}finally{for(let o of this.context.removableObservers)o.removeObserver();this.context.resetConnectionSpecificState(),this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.videoUplinkBandwidthPolicy.setTransceiverController&&this.context.videoUplinkBandwidthPolicy.setTransceiverController(void 0),this.context.videoDownlinkBandwidthPolicy.bindToTileController&&this.context.videoDownlinkBandwidthPolicy.bindToTileController(void 0);let o=this.context.videoTileController.getLocalVideoTile();o&&o.bindVideoStream("",!0,null,null,null,null),this.context.videoTileController.removeAllVideoTiles()}})}receiveWebSocketClosedEvent(){return new Promise((o,p)=>{let f=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("CleanStoppedSessionTask got canceled while waiting for the WebSocket closed event"))}handleSignalingClientEvent(p){p.type===w.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),o())}}(this.context.signalingClient);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x1cd1bb811:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xcef35194)),I=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="CreatePeerConnectionTask",this.removeTrackAddedEventListener=null,this.removeTrackRemovedEventListeners={},this.trackEvents=["ended","mute","unmute","isolationchange","overconstrained"],this.removeVideoTrackEventListeners={},this.trackAddedHandler=o=>{let p=o.track;if(this.context.logger.info(`received track event: kind=${p.kind} id=${p.id} label=${p.label}`),o.transceiver&&"inactive"===o.transceiver.currentDirection)return;if(0===o.streams.length)return void this.context.logger.warn("Track event but no stream");let f=o.streams[0];"audio"===p.kind?this.context.audioMixController.bindAudioStream(f):"video"!==p.kind||this.trackIsVideoInput(p)||this.addRemoteVideoTrack(p,f)}}removeObserver(){for(let o in this.removeTrackAddedEventListener&&this.removeTrackAddedEventListener(),this.removeTrackRemovedEventListeners)this.removeTrackRemovedEventListeners[o]()}addPeerConnectionEventLogger(){let o=this.context.peer;o.addEventListener("connectionstatechange",()=>{this.context.logger.info(`peer connection state changed: ${o.connectionState}`)}),o.addEventListener("negotiationneeded",()=>{this.context.logger.info("peer connection negotiation is needed")}),o.addEventListener("icegatheringstatechange",()=>{this.context.logger.info(`peer connection ice gathering state changed: ${o.iceGatheringState}`)}),o.addEventListener("icecandidate",o=>{this.context.logger.info(`peer connection ice candidate: ${o.candidate?o.candidate.candidate:"(null)"}`)}),o.addEventListener("iceconnectionstatechange",()=>{this.context.logger.info(`peer connection ice connection state changed: ${o.iceConnectionState}`)})}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this);let o=this.context.turnCredentials&&this.context.turnCredentials.uris.length>0?{iceServers:[{urls:this.context.turnCredentials.uris,username:this.context.turnCredentials.username,credential:this.context.turnCredentials.password,credentialType:"password"}],iceTransportPolicy:"relay"}:{};o.bundlePolicy=this.context.browserBehavior.requiresBundlePolicy(),o.sdpSemantics="unified-plan",window.RTCRtpScriptTransform||(o.encodedInsertableStreams=this.context.audioProfile.hasRedundancyEnabled()),this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(o),this.addPeerConnectionEventLogger()),this.removeTrackAddedEventListener=()=>{this.context.peer&&this.context.peer.removeEventListener("track",this.trackAddedHandler),this.removeTrackAddedEventListener=null},this.context.peer.addEventListener("track",this.trackAddedHandler)})}trackIsVideoInput(o){return!!this.context.transceiverController.useTransceivers()&&(this.logger.debug(()=>"getting video track type"),this.context.transceiverController.trackIsVideoInput(o))}addRemoteVideoTrack(o,p){var f;let m,_,w,I=p.id,k=this.context.videoStreamIndex.attendeeIdForTrack(I);if(this.context.videoTileController.getVideoTileForAttendeeId?!!(null==(f=null==(m=this.context.videoTileController.getVideoTileForAttendeeId(k))?void 0:m.state())?void 0:f.boundVideoStream):this.context.videoTileController.haveVideoTileForAttendeeId(k))return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId:  ${k}`);m||(m=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${m.id()}`));let M=this.context.videoStreamIndex.streamIdForTrack(I);void 0===M&&(this.logger.warn(`stream not found for tile=${m.id()} track=${I}`),M=null);let x=this.context.videoStreamIndex.groupIdForStreamId(M);void 0===x&&(x=null);for(let f=0;f<this.trackEvents.length;f++){let _=this.trackEvents[f],w=p.getVideoTracks();if(w&&w.length){let p=w[0],callback=()=>{this.context.logger.info(`received the ${_} event for tile=${m.id()} id=${o.id} streamId=${M}`),"ended"===_&&this.removeRemoteVideoTrack(o,m.state())};p.addEventListener(_,callback),this.removeVideoTrackEventListeners[o.id]||(this.removeVideoTrackEventListeners[o.id]=[]),this.removeVideoTrackEventListeners[o.id].push(()=>{p.removeEventListener(_,callback)})}}if(o.getSettings){let p=o.getSettings();_=p.width,w=p.height}else{let p=o.getCapabilities();_=p.width,w=p.height}let O=this.context.videoStreamIndex.externalUserIdForTrack(I);m.bindVideoStream(k,!1,p,_,w,M,O,x),this.logger.info(`video track added, use tile=${m.id()} track=${I} streamId=${M} groupId=${x}`);let L="removetrack",trackRemovedHandler=()=>this.removeRemoteVideoTrack(o,m.state());this.removeTrackRemovedEventListeners[o.id]=()=>{p.removeEventListener(L,trackRemovedHandler),delete this.removeTrackRemovedEventListeners[o.id]},p.addEventListener(L,trackRemovedHandler)}removeRemoteVideoTrack(o,p){if(this.removeTrackRemovedEventListeners.hasOwnProperty(o.id)){for(let p of(this.removeTrackRemovedEventListeners[o.id](),this.removeVideoTrackEventListeners[o.id]))p();delete this.removeVideoTrackEventListeners[o.id]}this.logger.info(`video track ended, removing tile=${p.tileId} id=${o.id} stream=${p.streamId}`),p.streamId?this.context.videosPaused.remove(p.streamId):this.logger.warn(`no stream found for tile=${p.tileId}`),this.context.videoTileController.removeVideoTile(p.tileId)}};p.default=I,I.REMOVE_HANDLER_INTERVAL_MS=1e4},0xad28f8b8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x234745d42)),I=_(f(0x1fa7d4829)),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="CreateSDPTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()}`);this.cancelPromise(o),delete this.cancelPromise}}sessionUsesAudio(){var o,p;return!!(null==(p=null==(o=this.context.meetingSessionConfiguration)?void 0:o.urls)?void 0:p.audioHostURL)}sessionUsesVideo(){let o;o=this.context.transceiverController.useTransceivers()?this.context.transceiverController.hasVideoInput():this.context.videoTileController.hasStartedLocalVideoTile();let p=!!this.context.videosToReceive&&!this.context.videosToReceive.empty(),f=o||p;return this.context.logger.info(`uses video: ${f} (enabled: true, sending: ${o}, receiving: ${p})`),f}run(){return m(this,void 0,void 0,function*(){let o={offerToReceiveAudio:this.sessionUsesAudio(),offerToReceiveVideo:this.sessionUsesVideo()};this.logger.info(`peer connection offerOptions: ${JSON.stringify(o)}`),yield new Promise((p,f)=>m(this,void 0,void 0,function*(){this.cancelPromise=o=>{f(o)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(o),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new I.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){let o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.IncompatibleSDP}`);this.context.previousSdpOffer=null,f(o);return}p()}catch(o){f(o)}finally{delete this.cancelPromise}}))})}}},0x25372cf50:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x234745d42)),I=_(f(0x1fa7d4829)),k=_(f(0xcef35194)),M=class FinishGatheringICECandidatesTask extends k.default{constructor(o,p=FinishGatheringICECandidatesTask.CHROME_VPN_TIMEOUT_MS){super(o.logger),this.context=o,this.chromeVpnTimeoutMs=p,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let o;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMs<this.context.meetingSessionConfiguration.connectionTimeoutMs&&Date.now()-this.startTimestampMs>this.chromeVpnTimeoutMs&&(o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(o=o||Error(`canceling ${this.name()}`),this.cancelPromise(o),delete this.cancelPromise)}run(){return m(this,void 0,void 0,function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new I.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if((this.context.browserBehavior.hasFirefoxWebRTC()||"complete"===this.context.peer.iceGatheringState)&&new I.default(this.context.peer.localDescription.sdp).hasCandidates())return void this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering");try{yield new Promise((o,p)=>{this.cancelPromise=o=>{this.removeEventListener(),p(o)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState){this.removeEventListener(),o(),delete this.cancelPromise;return}},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=f=>{if(this.context.logger.info(`ice candidate: ${f.candidate?f.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),f.candidate&&(I.default.isRTPCandidate(f.candidate.candidate)&&this.context.iceCandidates.push(f.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1)){this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),o(),delete this.cancelPromise;return}"complete"===this.context.peer.iceGatheringState&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),new I.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?o():p(Error("no ice candidates were gathered")),delete this.cancelPromise)},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()})}catch(o){throw o}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}})}};p.default=M,M.CHROME_VPN_TIMEOUT_MS=5e3},0x1c594fec7:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0xb28de657)),x=k(f(0x234745d42)),O=k(f(0x1736cf0a4)),L=w(f(0x1e93e1412)),B=k(f(0x16bec8feb)),U=k(f(0x22a5b38fd)),$=f(0xe88b24d9),q=k(f(0xcef35194));function rewriteTurnUris(o,p){let{urlRewriterMulti:f,urlRewriter:m}=p;return o.flatMap(o=>{if(f)return f(o)||[];let p=m(o);return p?[p]:[]}).filter(o=>!!o)}p.default=class extends q.default{constructor(o){super(o.logger),this.context=o,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return I(this,void 0,void 0,function*(){let o=yield new Promise((o,p)=>{let f=this.context;f.turnCredentials=null;let m=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("JoinAndReceiveIndexTask got canceled while waiting for SdkIndexFrame"))}handleSignalingClientEvent(p){if(p.type===B.default.WebSocketClosed){let o=`The signaling connection was closed with code ${p.closeCode} and reason: ${p.closeReason}`;f.logger.warn(o);let m=x.default.SignalingBadRequest;4410===p.closeCode?(o="The meeting already ended.",f.logger.warn(o),m=x.default.MeetingEnded):p.closeCode>=4500&&p.closeCode<4600&&(m=x.default.SignalingInternalServerError),f.audioVideoController.handleMeetingSessionStatus(new M.default(m),Error(o));return}if(p.type===B.default.ReceivedSignalFrame){if(p.message.type===$.SdkSignalFrame.Type.JOIN_ACK){let o=p.message.joinack;if(!o)return void f.audioVideoController.handleMeetingSessionStatus(new M.default(x.default.SignalingRequestFailed),Error("Join ACK message did not include expected frame"));if(o.videoSubscriptionLimit&&(f.videoSubscriptionLimit=o.videoSubscriptionLimit),f.serverSupportsCompression=o.wantsCompressedSdp,void 0!==o.defaultServerSideNetworkAdaption&&o.defaultServerSideNetworkAdaption!==L.default.Default&&void 0!==f.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption){let p=o.defaultServerSideNetworkAdaption;f.logger.info(`Overriding server side network adaption value to ${p}`),f.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(L.convertServerSideNetworkAdaptionEnumFromSignaled(p))}return void(o&&o.turnCredentials?(f.turnCredentials=new O.default,f.turnCredentials.username=o.turnCredentials.username,f.turnCredentials.password=o.turnCredentials.password,f.turnCredentials.ttl=o.turnCredentials.ttl,f.turnCredentials.uris=rewriteTurnUris(o.turnCredentials.uris,f.meetingSessionConfiguration.urls)):f.logger.error("missing TURN credentials in JoinAckFrame"))}p.message.type!==$.SdkSignalFrame.Type.INDEX||(this.signalingClient.removeObserver(this),o(p.message.index))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(m),this.taskCanceler=m,this.context.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1;let _=new U.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(_.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),_.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),void 0!==this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex&&(_.wantsAllTemporalLayersInIndex=this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex()),_.disablePeriodicKeyframeRequestOnContentSender=this.context.meetingSessionConfiguration.disablePeriodicKeyframeRequestOnContentSender,this.context.signalingClient.join(_)});this.context.logger.info(`received first index ${JSON.stringify(o)}`),this.context.indexFrame=o})}}},0x20543e8f4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16bec8feb)),I=f(0xe88b24d9),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="LeaveAndReceiveLeaveAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.ready()&&(this.context.signalingClient.leave(),this.context.logger.info("sent leave"),yield this.receiveLeaveAck())})}receiveLeaveAck(){return new Promise((o,p)=>{let f=new class{constructor(o,p){this.signalingClient=o,this.logger=p}cancel(){this.signalingClient.removeObserver(this),p(Error("LeaveAndReceiveLeaveAckTask got canceled while waiting for IndexFrame"))}handleSignalingClientEvent(p){if(p.isConnectionTerminated()){this.signalingClient.removeObserver(this),this.logger.info("LeaveAndReceiveLeaveAckTask connection terminated"),o();return}p.type===w.default.ReceivedSignalFrame&&p.message.type===I.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),o())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x138bc4923:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16bec8feb)),I=f(0xe88b24d9),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=o=>{this.context.signalingClient.mute(o)}}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(o){if(o.type===w.default.ReceivedSignalFrame){if(o.message.type===I.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){let p=o.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(p)}else if(o.message.type===I.SdkSignalFrame.Type.AUDIO_METADATA){let p=o.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(p)}}}}},0x1f0d2ad73:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x138ccc65a)),I=_(f(0x2fbf3af)),k=_(f(0x938e8e62)),M=_(f(0x19f6220b7)),x=_(f(0x1461f4056)),O=_(f(0x1cdcbf76c)),L=f(0x1029db6ff),B=_(f(0xb28de657)),U=_(f(0x234745d42)),$=_(f(0x17e3191d)),q=_(f(0x16bec8feb)),Z=f(0xe88b24d9),ee=_(f(0x77ea1113)),et=f(0xb529932d),ei=_(f(0xcef35194));p.default=class extends ei.default{constructor(o,p,f){for(const m of(super(o.logger),this.context=o,this.initialConnectionHealthData=f,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.isResubscribeCheckPaused=!1,this.pendingMetricsReport=void 0,this.videoEncodingHealthPolicies=[],this.checkAndSendWeakSignalEvent=o=>{let p=this.prevSignalStrength<1,f=o<1?p?null:ee.default.RedmicStartLoss:p?ee.default.RedmicEndLoss:null;f&&this.context.statsCollector.logAudioEvent(f),this.prevSignalStrength=o},this.realtimeFatalErrorCallback=o=>{this.logger.error(`realtime error: ${o}: ${o.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new B.default(U.default.RealtimeApiFailed),o)},this.realtimeAttendeeIdPresenceHandler=(o,p)=>{var f;let m=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${m}`),m===o&&p&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,null==(f=this.context.eventController)||f.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs,retryCount:this.context.retryCount}))},this.reconnectionHealthPolicy=new k.default(o.logger,Object.assign({},p),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new x.default(Object.assign({},p),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new M.default(o.logger,Object.assign({},p),this.initialConnectionHealthData.clone()),p.videoEncodingHealthPolicies))this.videoEncodingHealthPolicies.push(new m(Object.assign({},p),this.initialConnectionHealthData.clone()))}removeObserver(){this.context.audioVideoController.removeObserver(this),this.context.realtimeController.realtimeUnsubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.audioVideoController.addObserver(this),this.context.realtimeController.realtimeSubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.connectionMonitor.start(),this.context.statsCollector.start(this.context.signalingClient,this.context.videoStreamIndex),this.context.signalingClient.registerObserver(this)})}pauseResubscribeCheck(){this.isResubscribeCheckPaused=!0}resumeResubscribeCheck(){this.isResubscribeCheckPaused&&(this.isResubscribeCheckPaused=!1,this.pendingMetricsReport&&(this.context.logger.info("Resuming resubscribe check with pending metrics report"),this.checkResubscribe(this.pendingMetricsReport)&&this.context.audioVideoController.update({needsRenegotiation:!1})))}videoTileDidUpdate(o){this.context.maxVideoTileCount=Math.max(this.context.maxVideoTileCount,this.context.videoTileController.getAllVideoTiles().length)}checkResubscribe(o){if(this.isResubscribeCheckPaused){this.context.logger.info("Resubscribe check is paused, setting incoming client metric report as pending"),this.pendingMetricsReport=o;return}this.pendingMetricsReport=void 0;let p=o.getObservableMetrics(),f=p.availableOutgoingBitrate,m=p.nackCountReceivedPerSecond,_=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(o);let w=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(_=_||w,w){let o=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions();this.context.videosToReceive=o.truncate(this.context.videoSubscriptionLimit),o.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.logger.info(`trigger resubscribe for down=${w}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:f/1e3,nackCountPerSecond:m});let o=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();_=_||o,o&&(this.logger.info(`trigger resubscribe for up=${o}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters())}return _}metricsDidReceive(o){if(this.checkResubscribe(o)&&this.context.audioVideoController.update({needsRenegotiation:!1}),!this.currentAvailableStreamAvgBitrates)return;let p=o.streamMetricReports,f=new Map;for(let o in p)p[o].mediaType===I.default.VIDEO&&p[o].direction===w.default.DOWNSTREAM&&f.set(p[o].streamId,p[o])}connectionHealthDidChange(o){for(let p of(0===o.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.applyHealthPolicy(this.reconnectionHealthPolicy,o,()=>{this.context.audioVideoController.handleMeetingSessionStatus(new B.default(U.default.ConnectionHealthReconnect),null)}),this.applyHealthPolicy(this.unusableAudioWarningHealthPolicy,o,()=>{var o;this.context.poorConnectionCount+=1,null==(o=this.context.eventController)||o.publishEvent("receivingAudioDropped",L.audioVideoEventAttributesFromState(this.context)),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidSuggestStopVideo).map(p=>p.bind(o)())}):this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidBecomePoor).map(p=>p.bind(o)())})},()=>{this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidBecomeGood).map(p=>p.bind(o)())})}),this.videoEncodingHealthPolicies))this.applyHealthPolicy(p,o,()=>{switch(this.degradeVideoCodec(p.name),p.name){case O.default.VideoEncodingCpuHealth:this.context.statsCollector.videoCodecDegradationHighEncodeCpuDidReceive();break;case O.default.VideoEncodingFramerateHealth:this.context.statsCollector.videoCodecDegradationEncodeFailureDidReceive();break;case O.default.VideoConcurrentSendersHealth:this.context.statsCollector.videoCodecDegradationConcurrentSendersDidReceive()}});if(this.context.isSessionConnected){let publishFilteredEvent=o=>{var p;let f=L.audioVideoEventAttributesFromState(this.context);null==(p=this.context.eventController)||p.publishEvent(o,f)};this.applyHealthPolicy(this.sendingAudioFailureHealthPolicy,o,()=>publishFilteredEvent("sendingAudioFailed"),()=>publishFilteredEvent("sendingAudioRecovered"))}}applyHealthPolicy(o,p,f,m){o.update(p);let _=o.healthIfChanged();null!==_&&(this.logger.info(`${o.name} value is now ${_}`),_<=o.minimumHealth()?et.Maybe.of(f).map(o=>o.bind(this)()):et.Maybe.of(m).map(o=>o.bind(this)()))}handleBitrateFrame(o){this.currentAvailableStreamAvgBitrates=o,o.serverAvailableOutgoingBitrate>0&&(this.logger.info(`Received server side estimation of available incoming bitrate ${o.serverAvailableOutgoingBitrate}kbps`),this.context.statsCollector.overrideObservableMetric("availableIncomingBitrate",1e3*o.serverAvailableOutgoingBitrate))}handleSignalingClientEvent(o){var p;if(o.type===q.default.WebSocketClosed&&this.isUnexpectedsignalingCloseCode(o.closeCode)||o.type===q.default.WebSocketError||o.type===q.default.WebSocketFailed?(this.hasSignalingError||(null==(p=this.context.eventController)||p.publishEvent("signalingDropped",Object.assign(Object.assign(Object.assign(Object.assign({},L.audioVideoEventAttributesFromState(this.context)),void 0!==o.closeCode&&{signalingCloseCode:o.closeCode}),void 0!==o.closeReason&&{signalingCloseReason:o.closeReason}),void 0!==o.wasClean&&{signalingCloseWasClean:o.wasClean})),this.hasSignalingError=!0),this.context.isSessionConnected&&this.context.audioVideoController.handleMeetingSessionStatus(new B.default(this.isInternalServerFailureCloseCode(o.closeCode)?U.default.SignalingInternalServerError:U.default.SignalingChannelClosedUnexpectedly),null)):o.type===q.default.WebSocketOpen&&(this.hasSignalingError=!1),o.type===q.default.ReceivedSignalFrame){if(o.message.type===Z.SdkSignalFrame.Type.NOTIFICATION){switch(o.message.notification.level){case Z.SdkNotificationFrame.NotificationLevel.INFO:this.logger.info(`Received notification from server: ${o.message.notification.message}`);break;case Z.SdkNotificationFrame.NotificationLevel.WARNING:this.logger.warn(`Received warning from server: ${o.message.notification.message}`);break;case Z.SdkNotificationFrame.NotificationLevel.ERROR:this.logger.error(`Received error from server: ${o.message.notification.message}`);break;default:this.logger.error(`Received notification from server with unknown level ${o.message.notification.level}: ${o.message.notification.message}`)}return}if(o.message.bitrates){let p=o.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(p),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(o.message.bitrates)}let p=B.default.fromSignalFrame(o.message);o.message.type!==Z.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&p.statusCode()!==U.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(p,null)}}isUnexpectedsignalingCloseCode(o){return 1006===o||this.isInternalServerFailureCloseCode(o)}isInternalServerFailureCloseCode(o){return o>=4500&&o<4600}degradeVideoCodec(o){if(void 0!==this.context.meetingSupportedVideoSendCodecPreferences&&this.context.meetingSupportedVideoSendCodecPreferences.length>1&&!(this.context.meetingSupportedVideoSendCodecPreferences[0].equals($.default.h264ConstrainedBaselineProfile())||this.context.meetingSupportedVideoSendCodecPreferences[0].equals($.default.vp8()))){let p=[];for(let o of this.context.videoSendCodecPreferences)o.equals(this.context.meetingSupportedVideoSendCodecPreferences[0])||p.push(o);p.length>0?(this.context.logger.info(`Downgrading codec from ${this.context.meetingSupportedVideoSendCodecPreferences[0].codecName} to ${p[0].codecName} due to ${o}`),this.context.degradedVideoSendCodecs.push(this.context.meetingSupportedVideoSendCodecPreferences[0]),this.context.meetingSupportedVideoSendCodecPreferences=p,this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),this.context.audioVideoController.update({needsRenegotiation:!0})):this.context.logger.warn(`Degrading video codec failed since there is no alternative codec to select. Currently degraded codecs: ${this.context.degradedVideoSendCodecs.map(o=>o.codecName).join(",")}`)}}}},0xb013a83d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(o){}}},0xba0e3d5c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b)),w=m(f(0x573f705d));p.default=class{constructor(o,p,f){this.logger=o,this.task=p,this.dependencies=f,this.canceled=!1}name(){return`${this.task.name()} (once)`}cancel(){if(!this.canceled){if(this.dependencies)for(let o of this.dependencies)o.cancel();this.logger.info(`Canceling ${this.name()}`),w.default.nextTick(()=>this.task.cancel()),this.canceled=!0,this.cancelPromise&&w.default.nextTick(()=>this.cancelPromise(Error(`canceling ${this.name()}`)))}}logDependencies(){if(this.logger.getLogLevel()>_.default.INFO||!this.dependencies)return;let o=this.dependencies.filter(o=>o).map(o=>o.name()).join(", ");this.logger.info(`${this.task.name()} waiting for dependencies: ${o}`)}run(){if(this.promise)return this.promise;let o=this.dependencies?Promise.all(this.dependencies.map(o=>null==o?void 0:o.run())):Promise.resolve();return this.logDependencies(),this.ongoing=o.then(()=>this.task.run()),this.promise=new Promise((o,p)=>{this.cancelPromise=p,this.ongoing.then(o).catch(p)})}setParent(o){this.task.setParent(o)}}},0x1f9377021:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xe105a372)),I=_(f(0x16bec8feb)),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="OpenSignalingConnectionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){let o=this.context.meetingSessionConfiguration;this.context.signalingClient.openConnection(new w.default(o.urls.signalingURL,o.credentials.joinToken));let p=Date.now();try{yield new Promise((o,p)=>{let f=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("OpenSignalingConnectionTask got canceled while waiting to open signaling connection"))}handleSignalingClientEvent(f){switch(f.type){case I.default.WebSocketOpen:this.signalingClient.removeObserver(this),o();break;case I.default.WebSocketFailed:this.signalingClient.removeObserver(this),p(Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(f),this.taskCanceler=f})}catch(o){throw o}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-p),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}})}}},0x1c97ddc23:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xcef35194));p.default=class extends w.default{constructor(o,p,f){for(const m of(super(o),this.taskName=p,this.tasksToRunParallel=f,f))m.setParent(this)}cancel(){for(let o of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${o.name()}`),o.cancel()}run(){return m(this,void 0,void 0,function*(){let o=[];for(let p of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${p.name()}`),o.push(p.run());let p=[];for(let f=0;f<o.length;f++){try{yield o[f]}catch(o){p.push(`task ${this.tasksToRunParallel[f].name()} failed: ${o.message}`)}this.logger.info(`parallel group task ${this.name()} completed subtask ${this.tasksToRunParallel[f].name()}`)}if(p.length>0){let o=p.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${o}`)}this.logger.info(`parallel group task ${this.name()} completed`)})}}},0x1f71fad3b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x12192fed6),I=_(f(0x16bec8feb)),k=f(0xe88b24d9),M=_(f(0xcef35194));p.default=class extends M.default{constructor(o,p,f){super(o.logger),this.context=o,this.credentials=p,this.completionCallback=f,this.taskName="PromoteToPrimaryMeetingTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.ready()?(this.context.signalingClient.promoteToPrimaryMeeting(this.credentials),this.context.logger.info("Sent request to join primary meeting"),yield this.receivePrimaryMeetingJoinAck()):this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed))})}receivePrimaryMeetingJoinAck(){return new Promise((o,p)=>{let f=new class{constructor(o,p,f){this.signalingClient=o,this.completionCallback=p,this.logger=f}cancel(){this.signalingClient.removeObserver(this),this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed)),o()}handleSignalingClientEvent(p){p.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed)),o()),p.type===I.default.ReceivedSignalFrame&&p.message.type===k.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(w.MeetingSessionStatus.fromSignalFrame(p.message)),o())}}(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x2429ed05e:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xcef35194));p.default=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveAudioInputTask"}run(){var o,p;return m(this,void 0,void 0,function*(){let f;if(!(null==(p=null==(o=this.context.meetingSessionConfiguration)?void 0:o.urls)?void 0:p.audioHostURL))return void this.context.logger.info("No audio connection: not acquiring audio input");if(this.context.activeAudioInput)return void this.context.logger.info("an active audio input exists");try{f=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch{this.context.logger.warn("could not acquire audio input from current device")}f?this.context.activeAudioInput=f:this.context.logger.warn("an audio input is not available")})}}},0x18781162e:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16bec8feb)),I=f(0xe88b24d9),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveRemoteVideoPauseResume",this.serverPausedVideoTileIds=new Set}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}updateSubscribedGroupdIds(o){let p=new Set;for(let f of o){let o=this.context.videoStreamIndex.attendeeIdForGroupId(f);if(0===o.length){this.logger.warn(`Could not find attendee ID for newly subscribed group ID ${f}`);continue}let m=this.context.videoTileController.getVideoTileForAttendeeId(o);void 0===m&&(this.logger.info(`No existing video tile for attendee ID ${o} with new group ID ${f}. Creating new one.`),(m=this.context.videoTileController.addVideoTile()).bindVideoStream(o,!1,null,0,0,0,null)),p.add(m.id())}this.serverPausedVideoTileIds.forEach(o=>{p.has(o)||this.serverPausedVideoTileIds.delete(o)})}handleSignalingClientEvent(o){if(o.type!==w.default.ReceivedSignalFrame||o.message.type!==I.SdkSignalFrame.Type.PAUSE&&o.message.type!==I.SdkSignalFrame.Type.RESUME)return;let p=o.message.pause,f=o.message.type;if(this.logger.info(`Received new ${f===I.SdkSignalFrame.Type.PAUSE?"pause":"resume"} frame: ${JSON.stringify(p)}`),p&&void 0!==this.context.videoTileController.getVideoTileForAttendeeId&&void 0!==this.context.videoDownlinkBandwidthPolicy.forEachObserver&&void 0!==this.context.videoStreamIndex.attendeeIdForGroupId)for(let o of p.groupIds.map(o=>{let p=this.context.videoStreamIndex.attendeeIdForGroupId(o);return 0===p.length?void this.logger.warn(`Could not find attendee ID for paused group ID ${o}`):this.context.videoTileController.getVideoTileForAttendeeId(p)}))void 0!==o&&(f===I.SdkSignalFrame.Type.PAUSE?o.state().paused||(this.serverPausedVideoTileIds.add(o.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(p=>{p.tileWillBePausedByDownlinkPolicy(o.id())}),o.pause()):o.state().paused&&this.serverPausedVideoTileIds.has(o.id())&&(this.serverPausedVideoTileIds.delete(o.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(p=>{p.tileWillBeUnpausedByDownlinkPolicy(o.id())}),o.unpause()))}}},0x130a7607d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1a154f9b0)),I=f(0xe88b24d9),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveVideoInputTask"}checkAndApplyVideoConstraint(o,p,f,_,w){return m(this,void 0,void 0,function*(){let m=o?this.context.meetingSessionConfiguration.meetingFeatures.contentMaxResolution:this.context.meetingSessionConfiguration.meetingFeatures.videoMaxResolution;if(!o&&f<=m.videoWidth&&_<=m.videoHeight&&w<=m.videoFrameRate)return;let I={resizeMode:{ideal:"none"},width:{max:m.videoWidth},height:{max:m.videoHeight},frameRate:{ideal:w,max:m.videoFrameRate}};try{yield p.applyConstraints(I)}catch{this.context.logger.info(`Could not apply constraint for video track (content = ${o})`)}})}run(){return m(this,void 0,void 0,function*(){let o,p=this.context.videoDuplexMode===I.SdkStreamServiceType.RX||this.context.videoDuplexMode===I.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=p?I.SdkStreamServiceType.DUPLEX:I.SdkStreamServiceType.TX:this.context.videoDuplexMode=p?I.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile()){this.context.logger.info("has not started local video tile"),this.context.activeVideoInput&&(this.context.activeVideoInput=void 0,this.context.videoStreamIndex.integrateUplinkPolicyDecision([]));return}let f=this.context.videoTileController.getLocalVideoTile();try{o=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch{this.context.logger.warn("could not acquire video input from current device"),this.context.videoTileController.stopLocalVideoTile()}if(this.context.enableSimulcast){let o=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(o.values()))}if(this.context.activeVideoInput=o,o){let p=o.getVideoTracks();if(!p||0===p.length)return;let m=this.context.meetingSessionConfiguration.credentials.attendeeId,_=new w.default(m).hasModality(w.default.MODALITY_CONTENT),I=p[0].getSettings();this.checkAndApplyVideoConstraint(_,p[0],I.width,I.height,I.frameRate);let k=this.context.audioVideoController.configuration.credentials.externalUserId;for(let _ of(f.bindVideoStream(m,!0,o,I.width,I.height,null,k),p))this.logger.info(`Using video device label=${_.label} id=${_.id}`),this.context.videoDeviceInformation.current_camera_name=_.label,this.context.videoDeviceInformation.current_camera_id=_.id}})}}},0x151ad6ab5:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x17310e8bb)),I=_(f(0x1a154f9b0)),k=_(f(0x17e3191d)),M=_(f(0x16bec8feb)),x=f(0xe88b24d9),O=f(0xb529932d),L=_(f(0xcef35194));p.default=class extends L.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}handleSignalingClientEvent(o){if(o.type!==M.default.ReceivedSignalFrame||o.message.type!==x.SdkSignalFrame.Type.INDEX)return;let p=o.message.index;this.context.logger.info(`received new index ${JSON.stringify(p)}`),this.handleIndexFrame(p)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(o){if(!o)return;if(this.isIngestionPaused){this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),this.pendingIndex=o;return}this.pendingIndex=null;let p=this.context.audioVideoController.configuration.credentials.attendeeId;o.sources=o.sources.filter(o=>{let f=new I.default(o.attendeeId);return!(f.base()===p&&f.hasModality(I.default.MODALITY_CONTENT))});let{videoStreamIndex:f,videoDownlinkBandwidthPolicy:m,videoUplinkBandwidthPolicy:_}=this.context,w=f.allVideoSendingSourcesExcludingSelf(p);f.integrateIndexFrame(o),m.updateIndex(f),_.updateIndex(f),this.resubscribe(m,_),this.updateVideoAvailability(o),this.handleIndexVideosPausedAtSource(),o.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(o);let k=f.allVideoSendingSourcesExcludingSelf(p);this.areVideoSourcesEqual(w,k)||this.context.audioVideoController.forEachObserver(o=>{O.Maybe.of(o.remoteVideoSourcesDidChange).map(p=>p.bind(o)(k))})}areVideoSourcesEqual(o,p){if(o.length!==p.length)return!1;let compare=(o,p)=>o.attendee.attendeeId.localeCompare(p.attendee.attendeeId),f=[...o].sort(compare),m=[...p].sort(compare);for(let o=0;o<f.length;o++)if(f[o].attendee.attendeeId!==m[o].attendee.attendeeId)return!1;return!0}resubscribe(o,p){let f=o.wantsResubscribe(),m=(this.context.videoDuplexMode===x.SdkStreamServiceType.TX||this.context.videoDuplexMode===x.SdkStreamServiceType.DUPLEX)&&p.wantsResubscribe(),_=f||m;if(this.logger.info(`should resubscribe: ${_} (downlink: ${f} uplink: ${m})`),!_)return;let w=o.chooseSubscriptions();this.context.videosToReceive=w.truncate(this.context.videoSubscriptionLimit),w.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=p.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${m} down=${f}; videosToReceive=[${this.context.videosToReceive.array()}] captureParams=${JSON.stringify(this.context.videoCaptureAndEncodeParameter)}`),this.context.audioVideoController.update({needsRenegotiation:!1})}updateVideoAvailability(o){if(!this.context.videosToReceive)return void this.logger.error("videosToReceive must be set in the meeting context.");let p=new w.default;p.remoteVideoAvailable=!this.context.videosToReceive.empty(),p.canStartLocalVideo=!o.atCapacity,this.context.lastKnownVideoAvailability&&this.context.lastKnownVideoAvailability.equal(p)||(this.context.lastKnownVideoAvailability=p.clone(),this.context.audioVideoController.forEachObserver(o=>{O.Maybe.of(o.videoAvailabilityDidChange).map(f=>f.bind(o)(p.clone()))}))}handleSupportedVideoReceiveCodecIntersection(o){if(void 0===this.context.videoSendCodecPreferences)return;let p=[],f=!1;for(let f of this.context.videoSendCodecPreferences){if(this.context.degradedVideoSendCodecs.some(o=>f.equals(o))){this.logger.info(`Skipping ${f.codecName} since the codec has been identfied as degraded`);continue}for(let m of o.supportedReceiveCodecIntersection)if(f.equals(k.default.fromSignaled(m))){p.push(f);break}}if(p.length>0){let o=p.find(o=>this.context.prioritizedSendVideoCodecCapabilities.some(p=>o.equals(p)));void 0===this.context.currentVideoSendCodec||void 0!==o&&this.context.currentVideoSendCodec.equals(o)||(f=!0),this.context.meetingSupportedVideoSendCodecPreferences=p}else this.logger.warn("Interesection of meeting receive codec support and send codec preferences has no overlap, falling back to just values provided in `setVideoCodecSendPreferences`"),this.context.meetingSupportedVideoSendCodecPreferences=void 0;this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),f&&this.context.audioVideoController.update({needsRenegotiation:!0})}handleIndexVideosPausedAtSource(){let o=this.context.videoStreamIndex.streamsPausedAtSource();for(let p of this.context.videoTileController.getAllVideoTiles()){let f=p.state();o.contain(f.streamId)?p.markPoorConnection()&&this.logger.info(`marks the tile ${f.tileId} as having a poor connection`):p.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${f.tileId} as having a poor connection`)}}}},0x4d761108:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xcef35194));p.default=class extends _.default{constructor(o,p,f="RunnableTask"){super(o),this.fn=p,this.taskName=f}run(){return this.fn().then(()=>{})}}},0x222af4e39:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x239b30f5)),I=_(f(0x16bec8feb)),k=f(0xe88b24d9),M=_(f(0xcef35194)),x=class SendAndReceiveDataMessagesTask extends M.default{constructor(o){super(o.logger),this.context=o,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(o,p,f)=>{if(this.context.signalingClient.ready()){let m;m=p instanceof Uint8Array?p:"string"==typeof p?new TextEncoder().encode(p):new TextEncoder().encode(JSON.stringify(p)),this.validateDataMessage(o,m,f);let _=k.SdkDataMessagePayload.create();_.topic=o,_.lifetimeMs=f,_.data=m;let w=k.SdkDataMessageFrame.create();w.messages=[_],this.context.signalingClient.sendDataMessage(w)}else this.context.logger.error("Cannot send data message because signaling client is not ready")}}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(o){if(o.type===I.default.ReceivedSignalFrame&&o.message.type===k.SdkSignalFrame.Type.DATA_MESSAGE)for(let p of o.message.dataMessage.messages){let o=new w.default(p.ingestTimeNs/1e6,p.topic,p.data,p.senderAttendeeId,p.senderExternalUserId,0===p.ingestTimeNs);this.context.realtimeController.realtimeReceiveDataMessage(o)}}validateDataMessage(o,p,f){if(!SendAndReceiveDataMessagesTask.TOPIC_REGEX.test(o))throw Error("Invalid topic");if(p.length>SendAndReceiveDataMessagesTask.DATA_SIZE)throw Error("Data size has to be less than 2048 bytes");if(f&&f<0)throw Error("The life time of the message has to be non negative")}};p.default=x,x.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),x.DATA_SIZE=2048},0xc70eec36:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xcef35194)),I=_(f(0x372fc7cb));p.default=class extends w.default{constructor(o,p,f){for(const m of(super(o),this.taskName=p,this.tasksToRunSerially=f,this.currentTask=null,f))m.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return m(this,void 0,void 0,function*(){for(let o of this.tasksToRunSerially){this.getStatus()===I.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${o.name()}`),this.currentTask=o,yield o.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${o.name()}`)}catch(o){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${o.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)})}}},0x1fc5185a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0x1fa7d4829)),k=_(f(0xcef35194));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="SetLocalDescriptionTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()}`);this.cancelPromise(o),delete this.cancelPromise}}run(){return m(this,void 0,void 0,function*(){let o=this.context.peer,p=this.context.sdpOfferInit.sdp;if(this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(p=new I.default(p).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),this.context.browserBehavior.supportsDependencyDescriptorRtpHeaderExtension()&&void 0!==this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()&&(p=new I.default(p).withDependencyDescriptorRtpHeaderExtension(this.context.previousSdpOffer).sdp),new w.default().requiresDisablingH264Encoding()&&(p=new I.default(p).removeH264SupportFromSendSection().sdp),p=new I.default(p).withStartingVideoSendBitrate(1e3).sdp,void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(p=new I.default(p).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(p=new I.default(p).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(p=new I.default(p).withStereoAudio().sdp),this.context.audioProfile.hasRedundancyEnabled())){let o=new I.default(p).getAudioPayloadTypes();this.context.transceiverController&&this.context.transceiverController.setAudioPayloadTypes&&this.context.transceiverController.setAudioPayloadTypes(o)}this.logger.debug(()=>`local description is >>>${p}<<<`);let f={type:"offer",sdp:p,toJSON:null};yield new Promise((p,_)=>m(this,void 0,void 0,function*(){this.cancelPromise=o=>{_(o)};try{yield o.setLocalDescription(f),p()}catch(o){_(o)}finally{delete this.cancelPromise}})),this.context.logger.info("set local description")})}}},0x15fdb9011:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1a154f9b0)),I=_(f(0x1fa7d4829)),k=_(f(0x17e3191d)),M=_(f(0xcef35194));p.default=class extends M.default{constructor(o){super(o.logger),this.context=o,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){var o;return m(this,void 0,void 0,function*(){this.context.peer||this.logAndThrow("session does not have peer connection; bypass set remote description");let p=this.context.sdpAnswer;p=new I.default(p).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(p=new I.default(p).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(p=new I.default(p).withStereoAudio().sdp)),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(p=new I.default(p).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.prioritizedSendVideoCodecCapabilities=new I.default(p).prioritizedSendVideoCodecCapabilities(),this.context.currentVideoSendCodec=this.context.prioritizedSendVideoCodecCapabilities.length>0?this.context.prioritizedSendVideoCodecCapabilities[0]:void 0;let f=this.context.activeVideoInput;if(void 0!==f){let p=this.context.audioVideoController.configuration.credentials.attendeeId,m=new w.default(p).hasModality(w.default.MODALITY_CONTENT),_=f.getVideoTracks()[0];m&&((null==(o=this.context.currentVideoSendCodec)?void 0:o.codecName)===k.default.av1Main().codecName?(_.contentHint="text",this.logger.info(`Setting content hint to text for AV1, attendee: ${p}`)):this.context.audioVideoController.configuration.enableSVC&&(_.contentHint="motion",this.logger.info(`Setting content hint to motion to enable SVC, attendee: ${p}`)))}this.logger.info(`processed remote description is >>>${p}<<<`);let m={type:"answer",sdp:p,toJSON:null};try{yield this.createICEConnectionCompletedPromise(m)}catch(o){throw o}})}createICEConnectionCompletedPromise(o){return new Promise((p,f)=>m(this,void 0,void 0,function*(){let checkConnectionCompleted=()=>{("connected"===this.context.peer.iceConnectionState||"completed"===this.context.peer.iceConnectionState)&&(this.context.peer.removeEventListener("iceconnectionstatechange",checkConnectionCompleted),p())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",checkConnectionCompleted),f(Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",checkConnectionCompleted);try{yield this.context.peer.setRemoteDescription(o),this.logger.info("set remote description, waiting for ICE connection"),checkConnectionCompleted()}catch(o){f(o)}}))}}},0x21d574c92:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xb28de657)),I=_(f(0x234745d42)),k=_(f(0x1fa7d4829)),M=_(f(0xb97f5b8b)),x=f(0x1e93e1412),O=_(f(0x16bec8feb)),L=_(f(0x5fcce137)),B=f(0xe88b24d9),U=f(0xfa5b698a),$=_(f(0xcef35194));p.default=class extends $.default{constructor(o){super(o.logger),this.context=o,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new M.default(o.logger)}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){let o,p="";if(this.context.peer&&this.context.peer.localDescription&&(p=new k.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().sdp),!this.context.enableSimulcast){let o=0,p=0;this.context.videoCaptureAndEncodeParameter&&(o=this.context.videoCaptureAndEncodeParameter.captureFrameRate(),p=this.context.videoCaptureAndEncodeParameter.encodeBitrates()[0]);let f={rid:"hi",maxBitrate:1e3*p,maxFramerate:o,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([f])}let f=this.fixUpSubscriptionOrder(p,this.context.videoSubscriptions),m=this.context.videoDuplexMode===B.SdkStreamServiceType.TX||this.context.videoDuplexMode===B.SdkStreamServiceType.DUPLEX,_=p;if(void 0!==this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()||(_=new k.default(_).withoutDependencyDescriptorRtpHeaderExtension().sdp),this.context.serverSupportsCompression){let f=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";o=this.textCompressor.compress(_,f),this.context.logger.info(`Compressed the SDP message from ${_.length} to ${o.length} bytes.`),p=""}this.context.previousSdpOffer=new k.default(p);let w=new L.default(this.context.meetingSessionConfiguration.credentials.attendeeId,p,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,f,m,this.context.videoStreamIndex.localStreamDescriptions(),!0,o);void 0===this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption||x.serverSideNetworkAdaptionIsNoneOrDefault(this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())||void 0===this.context.videoDownlinkBandwidthPolicy.getVideoPreferences||(w.videoSubscriptionConfiguration=U.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(this.context,f.map(o=>0===o?0:this.context.videoStreamIndex.groupIdForStreamId(o)),this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(w)}`),this.context.signalingClient.subscribe(w);let I=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(I)}`);let M="";I.compressedSdpAnswer&&I.compressedSdpAnswer.length?(0===(M=this.textCompressor.decompress(I.compressedSdpAnswer,this.context.previousSdpAnswerAsString)).length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${I.compressedSdpAnswer.length} to ${M.length} bytes.`),this.context.sdpAnswer=M):this.context.sdpAnswer=I.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(I)})}fixUpSubscriptionOrder(o,p){if(void 0===this.context.transceiverController.getMidForStreamId)return p;let f=new Map;for(let o of p){let p=this.context.transceiverController.getMidForStreamId(o);if(void 0===p){0!==o&&this.logger.warn(`Could not find MID for stream ID: ${o}`);continue}f.set(p,o)}let m=new k.default(o).mediaSections(),_=[];for(let o of m)if("video"===o.mediaType)if("recvonly"===o.direction){let p=f.get(o.mid);if(void 0===p){this.logger.warn(`Could not find stream ID for MID: ${o.mid}`);continue}_.push(p)}else _.push(0);return this.logger.info(`Fixed up ${JSON.stringify(p)} to ${JSON.stringify(_)} (may be same))}`),_}receiveSubscribeAck(){return new Promise((o,p)=>{let f=this.context,m=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("SubscribeAndReceiveSubscribeAckTask got canceled while waiting for SdkSubscribeAckFrame"))}handleSignalingClientEvent(p){if(p.isConnectionTerminated()){let o=`SubscribeAndReceiveSubscribeAckTask connection was terminated with code ${p.closeCode} and reason: ${p.closeReason}`;f.logger.warn(o);let m=I.default.TaskFailed;p.closeCode>=4500&&p.closeCode<4600&&(m=I.default.SignalingInternalServerError),f.audioVideoController.handleMeetingSessionStatus(new w.default(m),Error(o));return}p.type!==O.default.ReceivedSignalFrame||p.message.type!==B.SdkSignalFrame.Type.SUBSCRIBE_ACK||(this.signalingClient.removeObserver(this),o(p.message.suback))}}(this.context.signalingClient);this.context.signalingClient.registerObserver(m),this.taskCanceler=m})}}},0x372fc7cb:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).IDLE="IDLE",m.RUNNING="RUNNING",m.CANCELED="CANCELED",m.FINISHED="FINISHED",p.default=f},0x1174c5f22:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x6ee73800)),I=_(f(0xcef35194));p.default=class extends I.default{constructor(o,p,f){super(o),this.taskToRunBeforeTimeout=p,this.timeoutMs=f,this.taskName=`Timeout${this.timeoutMs}ms`,p.setParent(this)}cancel(){this.logger.info(`canceling timeout task ${this.name()} subtask ${this.taskToRunBeforeTimeout}`),this.taskToRunBeforeTimeout.cancel()}run(){return m(this,void 0,void 0,function*(){let o=new w.default(this.timeoutMs);o.start(()=>{this.logger.info(`timeout reached for task ${this.name()}`),this.taskToRunBeforeTimeout.cancel()});try{yield this.taskToRunBeforeTimeout.run()}finally{o.stop()}this.logger.info(`timeout task ${this.name()} completed`)})}}},0x24564ad46:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x234745d42)),I=_(f(0xcef35194));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.NoAttendeePresent}`);this.cancelPromise(o),delete this.cancelPromise}}run(){return m(this,void 0,void 0,function*(){let o=this.context.meetingSessionConfiguration.credentials.attendeeId;return new Promise((p,f)=>{let handler=(f,m,_,w,I)=>{o===f&&m&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(handler),p(),delete this.cancelPromise)};this.cancelPromise=o=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(handler),f(o)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)})})}}},0x93a0ab1c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x249fc81e5)),I=_(f(0x250d201d4)),k=_(f(0x1a763535d)),M=_(f(0x11e4e5f0d)),x=_(f(0x573f705d));p.default=class{constructor(o,p,f){this.logger=o,this.browserBehavior=p,this.meetingSessionContext=f,this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null,this.streamIdToTransceiver=new Map,this.groupIdToTransceiver=new Map,this.audioRedWorker=null,this.audioRedWorkerURL=null,this.audioMetricsHistory=[],this.redMetricsObservers=new Set,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.maxAudioMetricsHistory=20,this.audioRedPacketLossShortEvalPeriodMs=5e3,this.audioRedPacketLossLongEvalPeriodMs=15e3,this.audioRedHoldDownTimeMs=3e5,this.redRecoveryTimeMs=6e4,this.handleTrack=o=>{let p=!!window.RTCRtpScriptTransform;this.audioRedWorker&&p&&(o.receiver.transform||(this.logger.info(`Applying passthrough transform to receiver track ${o.track.id} not set after addTranceiver`),o.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"})))}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender;if(!o||0===o.size)return;let f=Array.from(o.values()),m=p.getParameters();if(m.encodings&&0!==m.encodings.length)for(let o of m.encodings)for(let p of f){let f;if(!o.rid&&!p.rid||o.rid===p.rid)for(f in p)"rid"!==f&&"codecPayloadType"!==f&&p.hasOwnProperty(f)&&(o[f]=p[f])}else m.encodings=f;yield p.setParameters(m)})}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender;if(!p||o<=0)return;let f=p.getParameters();for(let p of(f.encodings||(f.encodings=[{}]),f.encodings))p.maxBitrate=1e3*o;yield p.setParameters(f)})}setPeer(o){this.peer=o,this.peer.addEventListener("track",this.handleTrack)}reset(){this.destroyAudioRedWorkerAndStates(),this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer&&this.peer.removeEventListener("track",this.handleTrack),this.peer=null}useTransceivers(){return!!this.peer&&void 0!==this.peer.getTransceivers}hasVideoInput(){return!!this._localCameraTransceiver&&"sendrecv"===this._localCameraTransceiver.direction}trackIsVideoInput(o){return!!this._localCameraTransceiver&&(o===this._localCameraTransceiver.sender.track||o===this._localCameraTransceiver.receiver.track)}setupLocalTransceivers(){var o,p;this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),!this._localAudioTransceiver&&(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),(null==(p=null==(o=this.meetingSessionContext)?void 0:o.audioProfile)?void 0:p.hasRedundancyEnabled())&&this.setupAudioRedWorker()),this._localCameraTransceiver||(this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}replaceAudioTrack(o){return m(this,void 0,void 0,function*(){return this._localAudioTransceiver&&"sendrecv"===this._localAudioTransceiver.direction?(yield this._localAudioTransceiver.sender.replaceTrack(o),!0):(this.logger.info("audio transceiver direction is not set up or not activated"),!1)})}setAudioInput(o){return m(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localAudioTransceiver,o)})}setVideoInput(o){return m(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localCameraTransceiver,o)})}updateVideoTransceivers(o,p){if(!this.useTransceivers())return p.array();let f=this.peer.getTransceivers();return this.videoSubscriptions=[0],p=p.clone(),this.updateTransceivers(f,o,p),this.logger.debug(()=>this.debugDumpTransceivers()),this.videoSubscriptions}updateTransceivers(o,p,f){let m=f.array();for(let f of(0===o.length||o[0].stop?0!==o.length&&this.updateTransceiverWithStop(o,p,m):(this.logger.info("Updating transceivers without `stop` function"),this.updateTransceiverWithoutStop(o,p,m)),m)){let o=this.addTransceiver("video",{direction:"recvonly",streams:[new MediaStream]});this.streamIdToTransceiver.set(f,o),this.groupIdToTransceiver.set(p.groupIdForStreamId(f),o),this.videoSubscriptions.push(f),this.logger.info(`adding transceiver mid: ${o.mid} subscription: ${f} direction: recvonly`)}}updateTransceiverWithStop(o,p,f){let m=1;for(let _ of(this.videoSubscriptions=[0],o)){if(_===this._localCameraTransceiver||!this.transceiverIsVideo(_)||!_.mid)continue;let o=!1,w=p.streamIdForTrack("v_"+_.mid);if("inactive"!==_.direction&&void 0!==w){for(let[I,k]of f.entries())if(p.StreamIdsInSameGroup(w,k)){_.direction="recvonly",this.videoSubscriptions[m]=k,o=!0,this.streamIdToTransceiver.delete(w),this.streamIdToTransceiver.set(k,_),f.splice(I,1);break}}if(!o)for(let[o,f]of(this.videoSubscriptions[m]=0,this.logger.info(`Stopping MID: ${_.mid}, direction: ${_.direction}, current direction: ${_.currentDirection}`),_.stop(),this.streamIdToTransceiver.entries()))_.mid===f.mid&&(this.streamIdToTransceiver.delete(o),this.groupIdToTransceiver.delete(p.groupIdForStreamId(o)));m+=1}}updateTransceiverWithoutStop(o,p,f){let m=1;for(let _ of o)if(_!==this._localCameraTransceiver&&this.transceiverIsVideo(_)){if(this.videoSubscriptions[m]=0,"inactive"!==_.direction){let o=p.streamIdForTrack("v_"+_.mid);if(void 0!==o){for(let[w,I]of f.entries())if(p.StreamIdsInSameGroup(o,I)){_.direction="recvonly",this.videoSubscriptions[m]=I,this.streamIdToTransceiver.delete(o),this.streamIdToTransceiver.set(I,_),f.splice(w,1);break}}}m+=1}for(let _ of(m=1,o))if(_!==this._localCameraTransceiver&&this.transceiverIsVideo(_)){if("inactive"===_.direction&&f.length>0){_.direction="recvonly";let o=f.shift();this.videoSubscriptions[m]=o,this.streamIdToTransceiver.set(o,_),this.groupIdToTransceiver.set(p.groupIdForStreamId(o),_)}else if(0===this.videoSubscriptions[m])for(let[o,f]of(_.direction="inactive",this.streamIdToTransceiver.entries()))_===f&&(this.streamIdToTransceiver.delete(o),this.groupIdToTransceiver.delete(p.groupIdForStreamId(o)));m+=1}}getMidForStreamId(o){var p;return null==(p=this.streamIdToTransceiver.get(o))?void 0:p.mid}setStreamIdForMid(o,p){for(let[f,m]of this.streamIdToTransceiver.entries())if(m.mid===o){this.streamIdToTransceiver.delete(f),this.streamIdToTransceiver.set(p,m);return}}getMidForGroupId(o){var p,f;return null!=(f=null==(p=this.groupIdToTransceiver.get(o))?void 0:p.mid)?f:void 0}transceiverIsVideo(o){return o.receiver&&o.receiver.track&&"video"===o.receiver.track.kind||o.sender&&o.sender.track&&"video"===o.sender.track.kind}debugDumpTransceivers(){let o="",p=0;for(let f of this.peer.getTransceivers())this.transceiverIsVideo(f)&&(o+=`transceiver index=${p} mid=${f.mid} subscription=${this.videoSubscriptions[p]} direction=${f.direction}
`,p+=1);return o}setTransceiverInput(o,p){return m(this,void 0,void 0,function*(){o&&(p?o.direction="sendrecv":o.direction="inactive",yield o.sender.replaceTrack(p))})}forEachRedMetricsObserver(o){for(let p of this.redMetricsObservers)x.default.nextTick(()=>{this.redMetricsObservers.has(p)&&p.recoveryMetricsDidReceive(o)})}disableAudioRedundancy(){this.meetingSessionContext.audioProfile=new w.default(this.meetingSessionContext.audioProfile.audioBitrateBps,!1),this.meetingSessionContext.audioVideoController.setAudioProfile(this.meetingSessionContext.audioProfile)}setupAudioRedWorker(){var o,p;let f=!!window.RTCRtpScriptTransform,m=!!RTCRtpSender.prototype.createEncodedStreams;if(f)this.logger.info("[AudioRed] Supports encoded insertable streams using RTCRtpScriptTransform");else if(m)this.logger.info("[AudioRed] Supports encoded insertable streams using TransformStream");else throw this.disableAudioRedundancy(),Error("[AudioRed] Encoded insertable streams not supported. Recreating peer connection with audio redundancy disabled.");try{this.audioRedWorkerURL=URL.createObjectURL(new Blob([M.default],{type:"application/javascript"})),this.logger.info(`[AudioRed] Redundant audio worker URL ${this.audioRedWorkerURL}`),this.audioRedWorker=new Worker(this.audioRedWorkerURL)}catch(o){throw this.logger.error(`[AudioRed] Unable to create audio red worker due to ${o}`),URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker=null,this.disableAudioRedundancy(),this.logger.info("[AudioRed] Recreating peer connection with audio redundancy disabled"),o}if(this.audioRedEnabled=!0,this.audioRedWorker.onmessage=o=>{if("REDWorkerLog"===o.data.type)this.logger.info(o.data.log);else if("RedundantAudioEncoderStats"===o.data.type){let p=new I.default;p.currentTimestampMs=Date.now(),p.ssrc=o.data.ssrc,p.totalAudioPacketsLost=o.data.totalAudioPacketsLost,p.totalAudioPacketsExpected=o.data.totalAudioPacketsExpected,p.totalAudioPacketsRecoveredRed=o.data.totalAudioPacketsRecoveredRed,p.totalAudioPacketsRecoveredFec=o.data.totalAudioPacketsRecoveredFec,this.forEachRedMetricsObserver(p)}},f)this._localAudioTransceiver.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"SenderTransform"}),this._localAudioTransceiver.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"ReceiverTransform"});else if(m){let o=this._localAudioTransceiver.sender.createEncodedStreams(),p=this._localAudioTransceiver.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"StartRedWorker",send:o,receive:p},[o.readable,o.writable,p.readable,p.writable])}null==(o=this.meetingSessionContext)||o.audioVideoController.addObserver(this),this.addRedundantAudioRecoveryMetricsObserver(null==(p=this.meetingSessionContext)?void 0:p.statsCollector)}addTransceiver(o,p){var f;let m=this.peer.addTransceiver(o,p);if(!this.audioRedWorker)return m;let _=!!window.RTCRtpScriptTransform,w=!!RTCRtpSender.prototype.createEncodedStreams;if(_)"recvonly"!==p.direction&&(m.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"}));else if(w){if(!(null==(f=this.peer.getConfiguration())?void 0:f.encodedInsertableStreams))return m;let o=m.sender.createEncodedStreams(),p=m.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"PassthroughTransform",send:o,receive:p},[o.readable,o.writable,p.readable,p.writable])}return m}destroyAudioRedWorkerAndStates(){var o,p;this.audioRedWorker&&(URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker.terminate(),this.audioRedWorker=null,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.audioRedEnabled=!0,null==(o=this.meetingSessionContext)||o.audioVideoController.removeObserver(this),this.removeRedundantAudioRecoveryMetricsObserver(null==(p=this.meetingSessionContext)?void 0:p.statsCollector))}setAudioPayloadTypes(o){this.audioRedWorker&&(this.audioRedWorker.postMessage({msgType:"RedPayloadType",payloadType:o.get("red")}),this.audioRedWorker.postMessage({msgType:"OpusPayloadType",payloadType:o.get("opus")}))}metricsDidReceive(o){let{currentTimestampMs:p}=o,f=o.getRTCStatsReport(),m=0,_=0,w=0;f.forEach(o=>{"audio"===o.kind&&("outbound-rtp"===o.type?_=o.packetsSent:"remote-inbound-rtp"===o.type&&(m=o.timestamp,w=o.packetsLost))}),(0===this.audioMetricsHistory.length||m>this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs&&_>this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent)&&this.audioMetricsHistory.push({timestampMs:m,totalPacketsSent:_,totalPacketsLost:w}),this.audioMetricsHistory.length>this.maxAudioMetricsHistory&&this.audioMetricsHistory.shift();let I=Math.max(this.lossPercent(this.audioRedPacketLossShortEvalPeriodMs),this.lossPercent(this.audioRedPacketLossLongEvalPeriodMs)),[M,x]=k.default.getNumRedundantEncodingsForPacketLoss(I);if(x){this.lastHighPacketLossEventTimestampMs=p,this.audioRedEnabled&&(this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Disable"}),this.audioRedEnabled=!1,this.lastAudioRedTurnOffTimestampMs=p);return}if(!this.audioRedEnabled){let o=p-this.lastAudioRedTurnOffTimestampMs,f=p-this.lastHighPacketLossEventTimestampMs;if(o>=this.audioRedPacketLossLongEvalPeriodMs&&f<this.redRecoveryTimeMs)return;this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Enable"}),this.audioRedEnabled=!0,this.maybeResetHoldDownTimer(p)}this.shouldUpdateAudioRedWorkerEncodings(p,M)&&this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"UpdateNumRedundantEncodings",numRedundantEncodings:M})}maybeResetHoldDownTimer(o){this.currentNumRedundantEncodings>0&&(this.lastRedHolddownTimerStartTimestampMs=o)}lossPercent(o){if(this.audioMetricsHistory.length<2)return 0;let p=this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs,f=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent,m=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsLost;for(let _=this.audioMetricsHistory.length-2;_>=0;_--)if(p-this.audioMetricsHistory[_].timestampMs>=o)return Math.max(0,Math.min((m-this.audioMetricsHistory[_].totalPacketsLost)/(f-this.audioMetricsHistory[_].totalPacketsSent)*100,100));return 0}shouldUpdateAudioRedWorkerEncodings(o,p){return this.currentNumRedundantEncodings===p?(this.maybeResetHoldDownTimer(o),!1):(!(p<this.currentNumRedundantEncodings)||!(o-this.lastRedHolddownTimerStartTimestampMs<this.audioRedHoldDownTimeMs))&&(this.currentNumRedundantEncodings=p,this.maybeResetHoldDownTimer(o),!0)}addRedundantAudioRecoveryMetricsObserver(o){this.redMetricsObservers.add(o)}removeRedundantAudioRecoveryMetricsObserver(o){this.redMetricsObservers.delete(o)}}},0xdeeb6fe4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x2293b1f8c)),I=class SimulcastContentShareTransceiverController extends w.default{constructor(o,p,f){super(o,p,f);let m=2;this.videoQualityControlParameterMap=new Map;for(let o=0;o<SimulcastContentShareTransceiverController.NAME_ARR_ASCENDING.length;o++){const p=SimulcastContentShareTransceiverController.NAME_ARR_ASCENDING[o];this.videoQualityControlParameterMap.set(p,{rid:p,scaleResolutionDownBy:m,maxBitrate:1e3*SimulcastContentShareTransceiverController.BITRATE_ARR_ASCENDING[o]}),m/=2}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender,f=Array.from(o.values());if(f.length<=0)return;let m=p.getParameters();if(m.encodings)for(let p=0;p<m.encodings.length;p++)m.encodings[p].rid===w.default.LOW_LEVEL_NAME&&this.copyEncodingParams(o.get(w.default.LOW_LEVEL_NAME),m.encodings[p]),m.encodings[p].rid===w.default.HIGH_LEVEL_NAME&&this.copyEncodingParams(o.get(w.default.HIGH_LEVEL_NAME),m.encodings[p]);else m.encodings=f;yield p.setParameters(m),this.logVideoTransceiverParameters()})}};p.default=I,I.NAME_ARR_ASCENDING=["low","hi"],I.BITRATE_ARR_ASCENDING=[300,1200]},0x2293b1f8c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x93a0ab1c)),I=class SimulcastTransceiverController extends w.default{constructor(o,p,f){super(o,p,f),this.videoQualityControlParameterMap=new Map;let m=4;for(let o=0;o<SimulcastTransceiverController.NAME_ARR_ASCENDING.length;o++){const p=SimulcastTransceiverController.NAME_ARR_ASCENDING[o];this.videoQualityControlParameterMap.set(p,{rid:p,scaleResolutionDownBy:m,maxBitrate:1e3*SimulcastTransceiverController.BITRATE_ARR_ASCENDING[o]}),m/=2}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender,f=Array.from(o.values());if(f.length<=0)return;let m=p.getParameters();if(m.encodings)for(let p of m.encodings)p.rid===SimulcastTransceiverController.LOW_LEVEL_NAME&&this.copyEncodingParams(o.get(SimulcastTransceiverController.LOW_LEVEL_NAME),p),p.rid===SimulcastTransceiverController.MID_LEVEL_NAME&&this.copyEncodingParams(o.get(SimulcastTransceiverController.MID_LEVEL_NAME),p),p.rid===SimulcastTransceiverController.HIGH_LEVEL_NAME&&this.copyEncodingParams(o.get(SimulcastTransceiverController.HIGH_LEVEL_NAME),p);else m.encodings=f;yield p.setParameters(m),this.logVideoTransceiverParameters()})}setVideoSendingBitrateKbps(o){return m(this,void 0,void 0,function*(){})}setupLocalTransceivers(){var o,p;if(this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),!this._localAudioTransceiver&&(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),(null==(p=null==(o=this.meetingSessionContext)?void 0:o.audioProfile)?void 0:p.hasRedundancyEnabled())&&this.setupAudioRedWorker()),!this._localCameraTransceiver)){let o=Array.from(this.videoQualityControlParameterMap.values());this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream],sendEncodings:o})}}logVideoTransceiverParameters(){let o=this._localCameraTransceiver.sender.getParameters().encodings,p=`simulcast: current encoding parameters 
`;for(let f of o)p+=`rid=${f.rid} maxBitrate=${f.maxBitrate} active=${f.active} scaleDownBy=${f.scaleResolutionDownBy} maxFrameRate = ${f.maxFramerate} 
`;this.logger.info(p)}copyEncodingParams(o,p){p.active=o.active,p.maxBitrate=o.maxBitrate,p.scaleResolutionDownBy=o.scaleResolutionDownBy,p.maxFramerate=o.maxFramerate}};p.default=I,I.LOW_LEVEL_NAME="low",I.MID_LEVEL_NAME="mid",I.HIGH_LEVEL_NAME="hi",I.NAME_ARR_ASCENDING=["low","mid","hi"],I.BITRATE_ARR_ASCENDING=[200,400,1100]},0x24fd8c738:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x93a0ab1c));p.default=class extends _.default{constructor(o,p,f){super(o,p,f)}setupLocalTransceivers(){this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}}},0x81e9befe:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;let m=f(0x1f65f6c49);p.TRANSCRIPTION_DATA_MESSAGE_TOPIC="aws:chime:transcription";let _=class{constructor(o){this.realtimeController=o,this.transcriptEventCallbacks=new Set}subscribeToTranscriptEvent(o){0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeSubscribeToReceiveDataMessage(p.TRANSCRIPTION_DATA_MESSAGE_TOPIC,o=>{for(let p of m.TranscriptEventConverter.from(o))for(let o of this.transcriptEventCallbacks)o(p)}),this.transcriptEventCallbacks.add(o)}unsubscribeFromTranscriptEvent(o){this.transcriptEventCallbacks.delete(o),0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(p.TRANSCRIPTION_DATA_MESSAGE_TOPIC)}};p.default=_},0x1121523e7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x424746be:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x42b6168:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x1f65f6c49:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.TranscriptEventConverter=void 0;let _=f(0xe88b24d9),w=m(f(0x1121523e7)),I=m(f(0x7ae7be1)),k=m(f(0xb7217889)),M=m(f(0x232d483ec)),x={[_.SdkTranscriptionStatus.Type.STARTED]:k.default.STARTED,[_.SdkTranscriptionStatus.Type.INTERRUPTED]:k.default.INTERRUPTED,[_.SdkTranscriptionStatus.Type.RESUMED]:k.default.RESUMED,[_.SdkTranscriptionStatus.Type.STOPPED]:k.default.STOPPED,[_.SdkTranscriptionStatus.Type.FAILED]:k.default.FAILED};p.TranscriptEventConverter=class{static from(o){let p;try{p=_.SdkTranscriptFrame.decode(o.data)}catch(o){throw Error("Cannot decode transcript data message: "+o)}let f=[];for(let o of p.events)if(o.status){let p=x[o.status.type];if(!p)continue;let m=new I.default;m.type=p,m.eventTimeMs=o.status.eventTime,m.transcriptionRegion=o.status.transcriptionRegion,m.transcriptionConfiguration=o.status.transcriptionConfiguration,o.status.message&&(m.message=o.status.message),f.push(m)}else if(o.transcript){let p=new w.default;for(let f of(p.results=[],o.transcript.results)){let o={channelId:f.channelId,isPartial:f.isPartial,resultId:f.resultId,startTimeMs:f.startTime,endTimeMs:f.endTime,alternatives:[]};if(f.languageCode&&(o.languageCode=f.languageCode),f.languageIdentification&&f.languageIdentification.length>0)for(let p of(o.languageIdentification=[],f.languageIdentification)){let f={languageCode:p.languageCode,score:p.score};o.languageIdentification.push(f)}for(let p of f.alternatives){let f={items:[],transcript:p.transcript};for(let o of p.items){let p={content:o.content,attendee:{attendeeId:o.speakerAttendeeId,externalUserId:o.speakerExternalUserId},startTimeMs:o.startTime,endTimeMs:o.endTime,type:null};switch(o.vocabularyFilterMatch&&(p.vocabularyFilterMatch=o.vocabularyFilterMatch),o.hasOwnProperty("stable")&&(p.stable=o.stable),o.hasOwnProperty("confidence")&&(p.confidence=o.confidence),o.type){case _.SdkTranscriptItem.Type.PRONUNCIATION:p.type=M.default.PRONUNCIATION;break;case _.SdkTranscriptItem.Type.PUNCTUATION:p.type=M.default.PUNCTUATION}f.items.push(p)}for(let o of p.entities){f.entities||(f.entities=[]);let p={category:o.category,confidence:o.confidence,content:o.content,startTimeMs:o.startTime,endTimeMs:o.endTime};o.type&&(p.type=o.type),f.entities.push(p)}o.alternatives.push(f)}p.results.push(o)}f.push(p)}return f}}},0x42104fac:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x232d483ec:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).PRONUNCIATION="pronunciation",m.PUNCTUATION="punctuation",p.default=f},0x10098a09:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x1dc662042:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x7ae7be1:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0xb7217889:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).STARTED="started",m.INTERRUPTED="interrupted",m.RESUMED="resumed",m.STOPPED="stopped",m.FAILED="failed",p.default=f},0x6cbaf532:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x13f6890b8),w=m(f(0xaf1ae5b3)),I=class DefaultUserAgentParser{constructor(o){var p,f,m,w,I,k,M;try{this.parserResult=navigator&&navigator.userAgent?new _.UAParser(navigator.userAgent).getResult():void 0}catch(p){o.error(p.message)}this.browserMajorVersion=(null==(m=null==(f=null==(p=this.parserResult)?void 0:p.browser)?void 0:f.version)?void 0:m.split(".")[0])||DefaultUserAgentParser.UNAVAILABLE,this.browserName=(null==(w=this.parserResult)?void 0:w.browser.name)||DefaultUserAgentParser.UNAVAILABLE,this.browserVersion=(null==(I=this.parserResult)?void 0:I.browser.version)||DefaultUserAgentParser.UNAVAILABLE,this.deviceName=[(null==(k=this.parserResult)?void 0:k.device.vendor)||"",(null==(M=this.parserResult)?void 0:M.device.model)||""].join(" ").trim()||DefaultUserAgentParser.UNAVAILABLE}getParserResult(){var o,p;return{browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,osName:(null==(o=this.parserResult)?void 0:o.os.name)||DefaultUserAgentParser.UNAVAILABLE,osVersion:(null==(p=this.parserResult)?void 0:p.os.version)||DefaultUserAgentParser.UNAVAILABLE,sdkVersion:w.default.sdkVersion,sdkName:w.default.sdkName}}};p.default=I,I.UNAVAILABLE="Unavailable"},0x8f5563d8:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.queue=Promise.resolve()}add(o){return new Promise((p,f)=>{this.queue=this.queue.then(o).then(p).catch(f)})}}},0xb529932d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.None=p.Some=p.Maybe=void 0;let f=class{static of(o){return null==o?_.of():m.of(o)}};p.Maybe=f;let m=class Some{constructor(o){this.value=o,this.isSome=!0,this.isNone=!1}map(o){return f.of(o(this.value))}flatMap(o){return o(this.value)}get(){return this.value}getOrElse(o){return this.value}defaulting(o){return f.of(this.getOrElse(o))}static of(o){if(null==o)throw Error("value is ${value}");return new Some(o)}};p.Some=m;let _=class None{constructor(){this.isSome=!1,this.isNone=!0}get(){throw Error("value is null")}getOrElse(o){return o}map(o){return new None}flatMap(o){return new None}defaulting(o){return f.of(this.getOrElse(o))}static of(){return new None}};p.None=_},0x149d24991:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.iterateEvery=p.SuppressedError=p.getRandomValues=p.getFormattedOffset=p.getDefaultAssetSpec=p.toLowerCasePropertyNames=p.isIFramed=p.wait=void 0;let _=m(f(0xaf1ae5b3));function toLowerCasePropertyNames(o){return null===o?null:"object"!=typeof o?o:Array.isArray(o)?o.map(toLowerCasePropertyNames):Object.keys(o).reduce((p,f)=>{let m=o[f],_="object"==typeof m?toLowerCasePropertyNames(m):m;return p[f.toLowerCase()]=_,p},{})}p.wait=function(o){return new Promise(p=>setTimeout(p,o))},p.isIFramed=function(){var o;try{return(null==(o=window.frameElement)?void 0:o.nodeName)==="IFRAME"||parent!==top}catch{return!0}},p.toLowerCasePropertyNames=toLowerCasePropertyNames,p.getDefaultAssetSpec=function(){let o=_.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}},p.getFormattedOffset=function(o){let p=Math.abs(o),f=Math.floor(p/60).toString().padStart(2,"0"),m=Math.floor(p%60).toString().padStart(2,"0");return`${o<=0?"+":"-"}${f}:${m}`},p.getRandomValues=function(o){try{window.crypto.getRandomValues(o)}catch{new DataView(o.buffer).setUint32(0,Math.trunc(0x100000000*Math.random()),!0)}};let w=class extends Error{constructor(o,p,f){var m;super(null!=f?f:`${null!=(m=null==o?void 0:o.message)?m:o}`),this.error=o,this.suppressed=p}};p.SuppressedError=w,p.iterateEvery=function(o,p){let f;if(o){for(let m of o)try{p(m)}catch(o){f=new w(o,f)}if(f)throw f}}},0xaf1ae5b3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x165009cb4)),w=m(f(0x25a5d599)),I=class Versioning{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return w.default.semverString}static get sdkVersionSemVer(){var o,p,f,m;let _=w.default.semverString.match(/^(?<major>[0-9]+)\.(?<minor>[0-9]+)((?:\.(?<patch>[0-9]+))(?:-(?<preRelease>[a-zA-Z]+(\.[0-9])*))?)?/);return{major:null==(o=null==_?void 0:_.groups)?void 0:o.major,minor:null==(p=null==_?void 0:_.groups)?void 0:p.minor,patch:null==(f=null==_?void 0:_.groups)?void 0:f.patch,preRelease:null==(m=null==_?void 0:_.groups)?void 0:m.preRelease}}static get buildSHA(){return w.default.hash.substring(1)}static get sdkUserAgentLowResolution(){let o=new _.default;return`${o.name()}-${o.majorVersion()}`}static urlWithVersion(o){let p=new URL(o);return p.searchParams.append(Versioning.X_AMZN_VERSION,Versioning.sdkVersion),p.searchParams.append(Versioning.X_AMZN_USER_AGENT,Versioning.sdkUserAgentLowResolution),p.toString()}};p.default=I,I.X_AMZN_VERSION="X-Amzn-Version",I.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},0x25a5d599:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default={hash:"802f244",raw:"v3.30.0",semverString:"3.30.0"}},0xb40abe4c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class DefaultVideoCaptureAndEncodeParameter{constructor(o,p,f,m,_,w=1,I=!1){this.cameraWidth=o,this.cameraHeight=p,this.cameraFrameRate=f,this.maxEncodeBitrateKbps=m,this.isSimulcast=_,this.scaleResolutionDownBy=w,this.isSVC=I}equal(o){let p=o.captureWidth()===this.cameraWidth&&o.captureHeight()===this.cameraHeight&&o.captureFrameRate()===this.cameraFrameRate&&o.encodeBitrates().length===this.encodeBitrates().length&&o.encodeScaleResolutionDownBy().length===this.encodeScaleResolutionDownBy().length&&o.encodeWidths().length===this.encodeWidths().length&&o.encodeHeights().length===this.encodeHeights().length&&o.isSVCEncoding()===this.isSVC;if(p){for(let f=0;f<o.encodeWidths().length;f++)if(o.encodeWidths()[f]!==this.encodeWidths()[f]||o.encodeHeights()[f]!==this.encodeHeights()[f]||o.encodeBitrates()[f]!==this.encodeBitrates()[f]||o.encodeScaleResolutionDownBy()[f]!==this.encodeScaleResolutionDownBy()[f]){p=!1;break}}return p}clone(){return new DefaultVideoCaptureAndEncodeParameter(this.cameraWidth,this.cameraHeight,this.cameraFrameRate,this.maxEncodeBitrateKbps,this.isSimulcast,this.scaleResolutionDownBy,this.isSVC)}captureWidth(){return this.cameraWidth}captureHeight(){return this.cameraHeight}captureFrameRate(){return this.cameraFrameRate}encodeBitrates(){return[this.maxEncodeBitrateKbps]}encodeScaleResolutionDownBy(){return[this.scaleResolutionDownBy]}encodeWidths(){return[this.cameraWidth]}encodeHeights(){return[this.cameraHeight]}isSVCEncoding(){return this.isSVC}}},0x1a174c132:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xc30676e4)),w=class AllHighestVideoBandwidthPolicy{constructor(o){this.selfAttendeeId=o,this.reset()}reset(){this.optimalReceiveSet=new _.default,this.subscribedReceiveSet=new _.default,this.videoSources=void 0}updateIndex(o){this.videoIndex=o,this.optimalReceiveSet=this.calculateOptimalReceiveSet(o)}updateMetrics(o){}wantsResubscribe(){return!this.subscribedReceiveSet.equal(this.optimalReceiveSet)}chooseSubscriptions(){return this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveSet.clone()}chooseRemoteVideoSources(o){this.videoSources=o,this.optimalReceiveSet=this.calculateOptimalReceiveSet(this.videoIndex).clone()}calculateOptimalReceiveSet(o){let p=new _.default;if(!this.videoIndex||this.videoIndex.allStreams().empty())return p;let f=o.highestQualityStreamFromEachGroupExcludingSelf(this.selfAttendeeId),m=this.videoSources?this.videoSources:this.videoIndex.allVideoSendingSourcesExcludingSelf(this.selfAttendeeId),w=this.videoIndex.remoteStreamDescriptions(),I=new Map;for(let o of w)f.contain(o.streamId)&&I.set(o.attendeeId,o);let k=0;for(let o of m){let f=o.attendee.attendeeId;if(I.has(f)){let o=I.get(f);if(k+o.maxBitrateKbps<=AllHighestVideoBandwidthPolicy.maxReceiveBitrateKbps)p.add(o.streamId),k+=o.maxBitrateKbps;else{console.warn("total bitrate "+(k+o.maxBitrateKbps)+" exceeds maximum limit (15000). Use chooseRemoteVideoSources to select a subset of participants to avoid this.");break}}}return p}};p.default=w,w.maxReceiveBitrateKbps=15e3},0x1f64282a8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xc30676e4));p.default=class{reset(){}updateIndex(o){}updateMetrics(o){}wantsResubscribe(){return!1}chooseSubscriptions(){return new _.default}}},0x555510c7:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.TargetDisplaySize=void 0,(m=f=p.TargetDisplaySize||(p.TargetDisplaySize={}))[m.Low=0]="Low",m[m.Medium=1]="Medium",m[m.High=2]="High",m[m.Maximum=3]="Maximum",p.default=f},0x15ad5180a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x104cf28d8)),w=m(f(0x1e93e1412)),I=m(f(0x78621d61)),k=f(0xfa5b698a),M=m(f(0x1341fb415)),x=m(f(0x74de7c3b));p.default=class VideoAdaptiveProbePolicy extends M.default{constructor(o){super(o,VideoAdaptiveProbePolicy.createConfig()),this.logger=o,super.shouldPauseTiles=!1,this.videoPreferences=void 0}static createConfig(){let o=new x.default;return o.serverSideNetworkAdaption=w.default.None,o}reset(){super.reset(),super.shouldPauseTiles=!1,this.videoPreferences=void 0}updateIndex(o){super.updateIndex(o);let p=k.VideoPreferences.prepare(),f=!1;for(let m of o.remoteStreamDescriptions())p.some(o=>o.attendeeId===m.attendeeId)||(m.attendeeId.endsWith(_.default.Modality)?(p.add(new I.default(m.attendeeId,1)),f=!0):p.add(new I.default(m.attendeeId,2)));f?(this.videoPreferences=p.build(),this.videoPreferencesUpdated=!0):this.videoPreferences=void 0}chooseRemoteVideoSources(o){this.logger.error("chooseRemoteVideoSources should not be called by VideoAdaptiveProbePolicy")}}},0x78621d61:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x555510c7)),w=m(f(0x3350552d)),I=class VideoPreference{constructor(o,p,f,m){this.attendeeId=o,this.priority=p,this.targetSize=void 0!==f?f:_.default.Maximum,this.degradationPreference=void 0!==m?m:w.default.Balanced}partialCompare(o){return this.priority-o.priority}equals(o){return this.attendeeId===o.attendeeId&&this.targetSize===o.targetSize&&this.priority===o.priority&&this.degradationPreference===o.degradationPreference}clone(){return new VideoPreference(this.attendeeId,this.priority,this.targetSize,this.degradationPreference)}targetSizeToBitrateKbps(o){switch(o){case _.default.Maximum:return VideoPreference.MAXIMUM_BITRATE_KBPS;case _.default.High:return VideoPreference.HIGH_BITRATE_KBPS;case _.default.Medium:return VideoPreference.MID_BITRATE_KBPS;case _.default.Low:return VideoPreference.LOW_BITRATE_KBPS}}};p.default=I,I.LOW_BITRATE_KBPS=300,I.MID_BITRATE_KBPS=600,I.HIGH_BITRATE_KBPS=1500,I.MAXIMUM_BITRATE_KBPS=1e4},0xfa5b698a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.VideoPreferences=p.MutableVideoPreferences=p.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=void 0;let _=m(f(0xcb99c5a5));p.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=function(o,p,f){if(void 0===o.transceiverController.getMidForGroupId||void 0===o.videoStreamIndex.attendeeIdForGroupId||void 0===f)return[];let m=[],w=new Map,I=new Map;for(let f of p){let p=o.transceiverController.getMidForGroupId(f);if(void 0===p)continue;let m=o.videoStreamIndex.attendeeIdForGroupId(f);w.set(m,p),I.set(m,f)}for(let o of f){let p=new _.default,f=w.get(o.attendeeId);void 0!==f&&(p.mid=f,p.attendeeId=o.attendeeId,p.groupId=I.get(o.attendeeId),void 0!==p.groupId&&(p.priority=Number.MAX_SAFE_INTEGER-o.priority,p.targetBitrateKbps=o.targetSizeToBitrateKbps(o.targetSize),p.qualityAdaptationPreference=o.degradationPreference,m.push(p)))}return m};let w=class ObjectSet{constructor(o=[]){this.items=o}static default(){return new ObjectSet([])}[Symbol.iterator](){let o=0,p=this.items;return{next:()=>o<p.length?{done:!1,value:p[o++]}:{done:!0,value:null}}}first(){return this.items[0]}add(o){this.items.push(o)}replaceFirst(o,p){let f=this.items.findIndex(p);-1===f?this.items.push(o):this.has(o)?this.items.splice(f,1):this.items[f]=o}remove(o){this.items=this.items.filter(p=>!p.equals(o))}clear(){this.items=[]}isEmpty(){return 0===this.items.length}equals(o){if(o===this)return!0;if(o.items.length!==this.items.length)return!1;for(let p of this.items)if(!o.items.some(o=>o.equals(p)))return!1;return!0}has(o){return this.items.some(p=>p.equals(o))}some(o){return this.items.some(o)}clone(){return new ObjectSet([...this.items])}sort(){this.items.sort((o,p)=>o.partialCompare(p))}modify(){return new I(this)}},I=class{constructor(o=new w){this.items=o,this.copied=!1}cow(){this.copied||(this.items=this.items.clone(),this.copied=!0)}add(o){this.items.has(o)||(this.cow(),this.items.add(o))}replaceFirst(o,p){(!this.items.has(o)||this.items.some(p))&&(this.cow(),this.items.replaceFirst(o,p))}remove(o){this.items.has(o)&&(this.cow(),this.items.remove(o))}some(o){return this.items.some(o)}clear(){this.items.isEmpty()||(this.cow(),this.items.clear())}build(){return this.copied&&this.items.sort(),this.copied=!1,this.items}},k=class{constructor(o){this.builder=o}add(o){this.builder.add(o)}replaceFirst(o,p){this.builder.replaceFirst(o,p)}remove(o){this.builder.remove(o)}some(o){return this.builder.some(o)}clear(){this.builder.clear()}build(){return new M(this.builder.build())}};p.MutableVideoPreferences=k;let M=class VideoPreferences{constructor(o){this.items=o}static prepare(){return new k(new I)}static default(){return new VideoPreferences(w.default())}[Symbol.iterator](){return this.items[Symbol.iterator]()}highestPriority(){var o;return null==(o=this.items.first())?void 0:o.priority}sorted(){return this.items[Symbol.iterator]()}equals(o){return o===this||this.items.equals(o.items)}modify(){return new k(this.items.modify())}some(o){return this.items.some(o)}isEmpty(){return this.items.isEmpty()}clone(){let o=VideoPreferences.prepare();for(let p of this.items)o.add(p.clone());return o.build()}};p.VideoPreferences=M,p.default=M},0x1341fb415:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let k=I(f(0xd80a42d3)),M=I(f(0x138ccc65a)),x=I(f(0x2fbf3af)),O=I(f(0x104cf28d8)),L=f(0x1e476648b),B=w(f(0x1e93e1412)),U=I(f(0x15db02d39)),$=I(f(0xc30676e4)),q=I(f(0x1a174c132)),Z=I(f(0x555510c7)),ee=I(f(0x78621d61)),et=f(0xfa5b698a),ei=I(f(0x74de7c3b)),er=I(f(0x3350552d)),en=class{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}},eo=class VideoPriorityBasedPolicy{constructor(o,p=ei.default.Default){this.logger=o,this.videoPriorityBasedPolicyConfig=p,this.shouldPauseTiles=!0,this.observerQueue=new Set,this.pausedBwAttendeeIds=new Set,this.wantsResubscribeObserver=void 0,this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption===B.default.Default&&(this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption=B.default.BandwidthProbingAndRemoteVideoQualityAdaption),this.reset()}reset(){this.allHighestPolicy=new q.default(""),this.optimalReceiveSet=new $.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new $.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new $.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new en,this.prevDownlinkStats=new en,this.probeFailed=!1,this.serverSideNetworkAdaption=this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption,this.pendingActionAfterUpdatedPreferences=!1}bindToTileController(o){this.tileController=o,this.logger.info("tileController bound")}setWantsResubscribeObserver(o){this.wantsResubscribeObserver=o}chooseRemoteVideoSources(o){var p;if(null==(p=this.videoPreferences)||!p.equals(o)){if(this.videoPreferences=null==o?void 0:o.clone(),!B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)&&(this.pendingActionAfterUpdatedPreferences=!0,void 0!==this.wantsResubscribeObserver&&(this.wantsResubscribeObserver(),this.pendingActionAfterUpdatedPreferences=!1),this.serverSideNetworkAdaption===B.default.BandwidthProbingAndRemoteVideoQualityAdaption)){let o=[];for(let p of this.videoPreferences){let f=new U.default;f.attendee=new k.default,f.attendee.attendeeId=p.attendeeId,o.push(f)}this.allHighestPolicy.chooseRemoteVideoSources(o);return}this.videoPreferencesUpdated=!0,this.logger.info(`bwe: setVideoPreferences bwe: new preferences: ${JSON.stringify(o)}`)}}updateIndex(o){this.videoIndex=o,this.serverSideNetworkAdaption===B.default.BandwidthProbingAndRemoteVideoQualityAdaption&&this.allHighestPolicy.updateIndex(o),this.videoPreferences||this.updateDefaultVideoPreferences()}updateDefaultVideoPreferences(){let o=new Set;for(let p of this.videoIndex.remoteStreamDescriptions())o.add(p.attendeeId);let p=et.VideoPreferences.prepare(),f=o.size,m=Z.default.Maximum;for(let _ of(f>8?m=Z.default.Low:f>4&&(m=Z.default.Medium),o))p.add(new ee.default(_,1,m));this.defaultVideoPreferences=p.build()}updateMetrics(o){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new en;let p=o.getObservableMetrics();for(let f in this.downlinkStats.bandwidthEstimateKbps=p.availableIncomingBitrate/1e3,o.streamMetricReports){let p=Number.parseInt(f,10),m=o.streamMetricReports[p];m.direction===M.default.DOWNSTREAM&&m.mediaType===x.default.VIDEO&&(m.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=o.countPerSecond("nackCount",p)),m.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=o.countPerSecond("packetsLost",p)),m.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=o.bitsPerSecond("bytesReceived",p)/1e3))}}wantsResubscribe(){let o=!1;return B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)||(o||(o=this.pendingActionAfterUpdatedPreferences),this.serverSideNetworkAdaption!==B.default.BandwidthProbingAndRemoteVideoQualityAdaption)?(this.calculateOptimalReceiveSet(),o||(o=!this.subscribedReceiveSet.equal(this.optimalReceiveSet)),o):o||this.allHighestPolicy.wantsResubscribe()}chooseSubscriptions(){return B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)||(this.pendingActionAfterUpdatedPreferences=!1,this.serverSideNetworkAdaption!==B.default.BandwidthProbingAndRemoteVideoQualityAdaption)?(this.subscribedReceiveSet.equal(this.optimalReceiveSet)||(this.lastSubscribeTimestamp=Date.now()),this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveStreams=this.optimalReceiveStreams.slice(),this.subscribedReceiveSet.clone()):this.allHighestPolicy.chooseSubscriptions()}addObserver(o){this.observerQueue.add(o)}removeObserver(o){this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)o(p)}setVideoPriorityBasedPolicyConfigs(o){this.videoPriorityBasedPolicyConfig=o}calculateOptimalReceiveStreams(){var o;let p=[],f=this.videoIndex.remoteStreamDescriptions();if(0===f.length||(null==(o=this.videoPreferences)?void 0:o.isEmpty())){this.optimalReceiveStreams=[];return}let m=this.rateProbeState;this.cleanBwPausedTiles(f),this.handleAppPausedStreams(p,f);let _=new Map;for(let o of this.getCurrentVideoPreferences())_.set(o.attendeeId,o);let w=f.filter(o=>_.has(o.attendeeId)),I=!this.streamsWithPreferenceDidChange(w),k=!this.startupPeriod&&I;if(k&&Date.now()-this.lastSubscribeTimestamp<this.timeBeforeAllowSubscribeMs)return;for(let o of(w.sort((o,p)=>o.maxBitrateKbps===p.maxBitrateKbps?o.streamId-p.streamId:o.maxBitrateKbps-p.maxBitrateKbps),w))(0===o.avgBitrateKbps||o.avgBitrateKbps>o.maxBitrateKbps)&&(o.attendeeId.endsWith(O.default.Modality)&&o.maxBitrateKbps<100?o.maxBitrateKbps=o.avgBitrateKbps:o.avgBitrateKbps=o.maxBitrateKbps);let M=new Set;for(let o of this.getCurrentVideoPreferences()){let p,f=w.filter(p=>p.attendeeId===o.attendeeId);if(f.length<3)continue;let m=15,_=153600;for(let w of(f.forEach(o=>{m=Math.max(m,o.maxFrameRate),_=Math.max(_,o.totalPixels())}),f.sort((p,f)=>{if(o.degradationPreference===er.default.MaintainResolution)return 2>Math.abs(p.maxFrameRate-f.maxFrameRate)?p.totalPixels()-f.totalPixels():p.maxFrameRate-f.maxFrameRate;if(o.degradationPreference===er.default.MaintainFramerate)return p.totalPixels()===f.totalPixels()?p.maxFrameRate-f.maxFrameRate:p.totalPixels()-f.totalPixels();{let weighByFramerate=o=>o.avgBitrateKbps*Math.pow(2,5*o.maxFrameRate/m*Math.pow(4,o.totalPixels()/_));return weighByFramerate(p)-weighByFramerate(f)}}),f)){if(void 0!==p&&(w.maxFrameRate<p.maxFrameRate&&Math.abs(p.maxFrameRate-w.maxFrameRate)>2||w.totalPixels()<p.totalPixels())){M.add(w.streamId);continue}p=w}}let x=w.filter(o=>!M.has(o.streamId));this.logger.info(`Filtered to ${JSON.stringify(x)}`);let U={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};U.targetDownlinkBitrate=this.determineTargetRate();let $=this.subscribedReceiveSet.size(),q=this.downlinkStats.bandwidthEstimateKbps,Z=!this.videoPriorityBasedPolicyConfig.allowSubscribe($,q);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,k&&Z))return;let ee=this.priorityPolicy(U,x,p),et=!B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption),ei=0;if(et||this.startupPeriod||!I?(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0):"Probing"===this.rateProbeState?ei=this.handleProbe(p,U.targetDownlinkBitrate):0!==U.deltaToNextUpgrade&&(ei=this.maybeOverrideOrProbe(p,U,ee)),this.previousStreamsWithPreference=w,this.videoPreferencesUpdated=!1,1===ei){this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),this.prevTargetRateKbps=U.targetDownlinkBitrate;return}if(2===ei){let o=this.calculateSubscribeRate(this.preProbeNonPausedReceiveStreams);this.optimalReceiveStreams=this.preProbeReceiveStreams.slice(),this.processBwPausedStreams(w,this.preProbeNonPausedReceiveStreams),this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+o);return}this.optimalNonPausedReceiveStreams=p.slice();let en=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(w,p),this.logger.getLogLevel()<=L.LogLevel.INFO&&(this.logCount%15==0||this.rateProbeState!==m||this.optimalReceiveStreams.length!==p.length||en!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(f,U.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=U.targetDownlinkBitrate,this.optimalReceiveStreams=p.slice()}calculateOptimalReceiveSet(){let o=new $.default;for(let p of(this.calculateOptimalReceiveStreams(),this.optimalReceiveStreams))o.add(p.streamId);if(!this.optimalReceiveSet.equal(o)){let p=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(o)} subscribedRate:${p}`)}this.optimalReceiveSet=o}determineTargetRate(){let o=0,p=Date.now();return 0!==this.downlinkStats.bandwidthEstimateKbps?(0===this.firstEstimateTimestamp&&(this.firstEstimateTimestamp=p),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||p-this.firstEstimateTimestamp>VideoPriorityBasedPolicy.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?o=VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost<VideoPriorityBasedPolicy.SPURIOUS_PACKET_LOST_THRESHOLD?(this.logger.info(`bwe: In probe state, overriding estimate ${this.downlinkStats.bandwidthEstimateKbps} with actual receive bitrate ${this.downlinkStats.usedBandwidthKbps}`),o=this.downlinkStats.usedBandwidthKbps+VideoPriorityBasedPolicy.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS):o=this.downlinkStats.bandwidthEstimateKbps):o=0===this.firstEstimateTimestamp?VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS:this.prevTargetRateKbps,!this.startupPeriod&&(this.usingPrevTargetRate&&this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps||this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps*(100-VideoPriorityBasedPolicy.LARGE_RATE_CHANGE_TRIGGER_PERCENT)/100||this.downlinkStats.bandwidthEstimateKbps<this.downlinkStats.usedBandwidthKbps*VideoPriorityBasedPolicy.LARGE_RATE_CHANGE_TRIGGER_PERCENT/100)&&0===this.downlinkStats.packetsLost?(this.logger.debug(()=>"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps),this.usingPrevTargetRate=!0,o=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,o>15e3&&this.logger.warn("bwe: "+o+" exceeds maximum limit (15000). Limit TargetDisplaySize with VideoPreferences to avoid this."),Math.min(o,15e3)}setProbeState(o){if(this.rateProbeState===o)return!1;let p=Date.now();switch(o){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(0!==this.lastProbeTimestamp&&!(p-this.lastProbeTimestamp>VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS))return!1;this.probePendingStartTimestamp=p;break;case"Probing":if(!(p-this.probePendingStartTimestamp>this.timeBeforeAllowProbeMs))return!1;this.lastProbeTimestamp=p,this.preProbeReceiveStreams=this.subscribedReceiveStreams.slice(),this.preProbeNonPausedReceiveStreams=this.optimalNonPausedReceiveStreams,this.timeBeforeAllowProbeMs=Math.min(2*this.timeBeforeAllowProbeMs,VideoPriorityBasedPolicy.MAX_HOLD_BEFORE_PROBE_MS)}return this.logger.info("bwe: setProbeState to "+o+" from "+this.rateProbeState),this.rateProbeState=o,!0}upgradeToStream(o,p){for(let f=0;f<o.length;f++)if(o[f].groupId===p.groupId){let m=p.avgBitrateKbps-o[f].avgBitrateKbps;return this.logger.info("bwe: upgradeStream from "+JSON.stringify(o[f])+" to "+p),this.lastUpgradeRateKbps=m,o[f]=p,m}return o.push(p),this.lastUpgradeRateKbps=p.avgBitrateKbps,this.lastUpgradeRateKbps}handleProbe(o,p){if(Date.now()-this.lastProbeTimestamp>VideoPriorityBasedPolicy.MAX_ALLOWED_PROBE_TIME_MS)return this.logger.info("bwe: Canceling probe due to timeout"),this.setProbeState("Not Probing"),0;if(this.downlinkStats.packetsLost>0&&(this.logger.info(`bwe: Probe encountering packets lost:${this.downlinkStats.packetsLost}`),this.downlinkStats.packetsLost>VideoPriorityBasedPolicy.SPURIOUS_PACKET_LOST_THRESHOLD))return this.setProbeState("Not Probing"),this.logger.info(`bwe: Canceling probe due to packets lost:${this.downlinkStats.packetsLost}`),this.probeFailed=!0,this.timeBeforeAllowSubscribeMs=3*Math.max(VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.timeBeforeAllowSubscribeMs),2;let f=this.calculateSubscribeRate(this.optimalReceiveStreams);return this.chosenStreamsSameAsLast(o)||p>f?(this.logger.info("bwe: Probe successful"),this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(o,p,f){let m=this.chosenStreamsSameAsLast(o),_=0,w=p.targetDownlinkBitrate>VideoPriorityBasedPolicy.LOW_BITRATE_THRESHOLD_KBPS?VideoPriorityBasedPolicy.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*VideoPriorityBasedPolicy.TARGET_RATE_CHANGE_TRIGGER_PERCENT,I=p.targetDownlinkBitrate*w/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!m&&Math.abs(p.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)<I?(this.logger.info("bwe: MaybeOverrideOrProbe: Reuse last decision based on delta rate. {"+JSON.stringify(this.subscribedReceiveSet)+"}"),_=1):this.targetRateBaselineForDeltaCheckKbps=p.targetDownlinkBitrate,this.downlinkStats.packetsLost>this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,_;if(m||1===_)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(o,f),_=0)}else this.setProbeState("Not Probing");return _}calculateSubscribeRate(o){let p=0;for(let f of o)this.pausedStreamIds.contain(f.streamId)||this.pausedBwAttendeeIds.has(f.attendeeId)||(p+=f.maxBitrateKbps);return p}handleAppPausedStreams(o,p){if(!this.tileController)return void this.logger.warn("tileController not found!");for(let f of(this.pausedStreamIds=new $.default,this.tileController.getAllRemoteVideoTiles())){let m=f.state();if(m.paused&&!this.pausedBwAttendeeIds.has(m.boundAttendeeId)){let f=p.length;for(;f--;)p[f].attendeeId===m.boundAttendeeId&&(this.logger.info("bwe: removed paused attendee "+m.boundAttendeeId+" streamId: "+p[f].streamId),this.pausedStreamIds.add(p[f].streamId),this.subscribedReceiveSet.contain(p[f].streamId)&&o.push(p[f]),p.splice(f,1))}}}processBwPausedStreams(o,p){if(!this.tileController)return void this.logger.warn("tileController not found!");let f=this.getCurrentVideoPreferences();if(f&&this.shouldPauseTiles){let m=this.tileController.getAllVideoTiles();for(let _ of f){let f=this.getVideoTileForAttendeeId(_.attendeeId,m),w=(null==f?void 0:f.state().paused)||!1;if(p.some(o=>o.attendeeId===_.attendeeId))w&&this.pausedBwAttendeeIds.has(_.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${_.attendeeId} due to bandwidth`),this.forEachObserver(o=>{o.tileWillBeUnpausedByDownlinkPolicy(f.id())}),this.tileController.unpauseVideoTile(f.id()),this.pausedBwAttendeeIds.delete(_.attendeeId));else{let m=o.some(o=>o.attendeeId===_.attendeeId);if(f&&m){let o=this.optimalReceiveStreams.find(o=>o.attendeeId===_.attendeeId);void 0!==o&&(w||(this.logger.info(`bwe: pausing streamId ${o.streamId} attendee ${_.attendeeId} due to bandwidth`),this.forEachObserver(o=>{o.tileWillBePausedByDownlinkPolicy(f.id())}),this.tileController.pauseVideoTile(f.id())),p.push(o)),this.pausedBwAttendeeIds.add(_.attendeeId)}else if(m){let o=this.tileController.addVideoTile();o.bindVideoStream(_.attendeeId,!1,null,0,0,0,null),this.forEachObserver(p=>{p.tileWillBePausedByDownlinkPolicy(o.id())}),o.pause(),this.logger.info(`bwe: Created video tile ${o.id()} for bw paused attendee ${_.attendeeId}`),this.pausedBwAttendeeIds.add(_.attendeeId)}}}}}cleanBwPausedTiles(o){if(!this.tileController)return void this.logger.warn("tileController not found!");let p=this.tileController.getAllRemoteVideoTiles(),f=this.getCurrentVideoPreferences();for(let m of p){let p=m.state();!p.boundVideoStream&&(o.some(o=>o.attendeeId===p.boundAttendeeId)?void 0===f||f.some(o=>o.attendeeId===p.boundAttendeeId)||this.tileController.removeVideoTile(p.tileId):(this.tileController.removeVideoTile(p.tileId),this.logger.info(`bwe: Removed video tile ${p.tileId} for bw paused attendee ${p.boundAttendeeId}`)))}}priorityPolicy(o,p,f){let m,_,w=this.getCurrentVideoPreferences(),I=w.highestPriority(),k=I;for(;-1!==k;){for(let I of(_=-1,w))if(I.priority===k)for(let _ of p)_.attendeeId!==I.attendeeId||f.some(o=>o.groupId===_.groupId)||(o.chosenTotalBitrate+_.avgBitrateKbps<=o.targetDownlinkBitrate?(f.push(_),o.chosenTotalBitrate+=_.avgBitrateKbps):0===o.deltaToNextUpgrade&&(o.deltaToNextUpgrade=_.avgBitrateKbps,m=_));else if(I.priority>k){_=I.priority;break}for(let _ of w)if(_.priority===k){for(let w of p)if(w.attendeeId===_.attendeeId){let I=f.findIndex(o=>o.groupId===w.groupId&&o.maxBitrateKbps<=w.maxBitrateKbps&&o.avgBitrateKbps<w.avgBitrateKbps);if(-1!==I){let k=w.avgBitrateKbps-f[I].avgBitrateKbps;this.hasSimulcastStreams(p,w.attendeeId,w.groupId)&&this.canUpgrade(w.avgBitrateKbps,_.targetSize,_.targetSizeToBitrateKbps(_.targetSize),w.attendeeId.endsWith(O.default.Modality))?(this.logger.info(`bwe: attendee: ${w.attendeeId} group: ${w.groupId} has simulcast and can upgrade avgBitrate: ${w.avgBitrateKbps} target: ${_.targetSizeToBitrateKbps(_.targetSize)} targetTotalBitrate: ${o.targetDownlinkBitrate}`),o.chosenTotalBitrate+k<=o.targetDownlinkBitrate?(o.chosenTotalBitrate+=k,f[I]=w):0===o.deltaToNextUpgrade&&(o.deltaToNextUpgrade=k,m=w)):this.logger.info("bwe: cannot upgrade stream quality beyond target size")}}}else if(_.priority>k)break;if(k===I&&0!==o.deltaToNextUpgrade)break;k=_}return m}getVideoTileForAttendeeId(o,p){for(let f of p)if(f.state().boundAttendeeId===o)return f;return null}canUpgrade(o,p,f,m){let _=!1;return(p===Z.default.High||!m&&o<=f?_=!0:m&&p===Z.default.Medium&&o<=f&&(_=!0),_)?(this.logger.info(`bwe: canUpgrade: bitrateKbps: ${o} targetBitrateKbps: ${f}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbps: ${o} targetBitrateKbps: ${f}`),!1)}hasSimulcastStreams(o,p,f){let m=0;for(let _ of o)_.attendeeId===p&&_.groupId===f&&m++;return this.logger.info(`bwe: attendeeId: ${p} groupId: ${f} hasSimulcastStreams: streamCount: ${m}`),m>1}streamsWithPreferenceDidChange(o){if(void 0===this.previousStreamsWithPreference||o.length!==this.previousStreamsWithPreference.length||!0===this.videoPreferencesUpdated)return!0;for(let p of o)if(void 0===this.previousStreamsWithPreference.find(o=>o.groupId===p.groupId&&o.streamId===p.streamId&&o.maxBitrateKbps===p.maxBitrateKbps))return!0;return!1}chosenStreamsSameAsLast(o){if(this.optimalNonPausedReceiveStreams.length!==o.length)return!1;for(let p of this.optimalNonPausedReceiveStreams)if(!o.some(o=>o.streamId===p.streamId))return!1;return!0}policyStateLogStr(o,p){let f={targetBitrate:p,subscribedRate:this.calculateSubscribeRate(this.optimalReceiveStreams),probeState:this.rateProbeState,startupPeriod:this.startupPeriod},m="remoteInfos: [";for(let p of o)m+=`{grpId:${p.groupId} strId:${p.streamId} maxBr:${p.maxBitrateKbps} avgBr:${p.avgBitrateKbps}}, `;m+="]";let _=`bwe: optimalReceiveSet ${JSON.stringify(f)}
bwe:   prev ${JSON.stringify(this.prevDownlinkStats)}
bwe:   now  ${JSON.stringify(this.downlinkStats)}
bwe:   ${m}
`;return(this.pausedStreamIds.size()>0||this.pausedBwAttendeeIds.size>0)&&(_+=`bwe:   paused: app stream ids ${JSON.stringify(this.pausedStreamIds)}  bw attendees { ${Array.from(this.pausedBwAttendeeIds).join(" ")} }
`),this.videoPreferences?_+=`bwe:   preferences: ${JSON.stringify(this.videoPreferences)}`:_+=`bwe:   default preferences: ${JSON.stringify(this.defaultVideoPreferences)}`,_}getCurrentVideoPreferences(){return this.videoPreferences||this.defaultVideoPreferences}getServerSideNetworkAdaption(){return this.serverSideNetworkAdaption}setServerSideNetworkAdaption(o){this.serverSideNetworkAdaption=o,this.setProbeState("Not Probing")}supportedServerSideNetworkAdaptions(){return[B.default.None,B.default.BandwidthProbing,B.default.BandwidthProbingAndRemoteVideoQualityAdaption]}getVideoPreferences(){let o=this.getCurrentVideoPreferences();return o||(o=et.VideoPreferences.prepare().build()),o}wantsAllTemporalLayersInIndex(){return!0}};p.default=eo,eo.DEFAULT_BANDWIDTH_KBPS=2800,eo.STARTUP_PERIOD_MS=6e3,eo.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,eo.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,eo.LOW_BITRATE_THRESHOLD_KBPS=300,eo.MIN_TIME_BETWEEN_PROBE_MS=5e3,eo.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,eo.MAX_HOLD_BEFORE_PROBE_MS=3e4,eo.MAX_ALLOWED_PROBE_TIME_MS=6e4,eo.SPURIOUS_PACKET_LOST_THRESHOLD=2,eo.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100},0x74de7c3b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e93e1412)),w=class VideoPriorityBasedPolicyConfig{constructor(o=0,p=0){this.networkIssueResponseDelayFactor=o,this.networkIssueRecoveryDelayFactor=p,this.currentNetworkEvent=0,this.bandwidthDecreaseTimestamp=0,this.referenceBitrate=0,this.serverSideNetworkAdaption=_.default.BandwidthProbingAndRemoteVideoQualityAdaption,o<0?o=0:o>1&&(o=1),this.networkIssueResponseDelayFactor=o,p<0?p=0:p>1&&(p=1),this.networkIssueRecoveryDelayFactor=p}allowSubscribe(o,p){let f=0,m=this.currentNetworkEvent;if(p>this.referenceBitrate)return this.currentNetworkEvent=2,this.referenceBitrate=p,!0;if(!(p<this.referenceBitrate))return this.currentNetworkEvent=0,!1;if(this.currentNetworkEvent=1,f=this.getSubscribeDelay(this.currentNetworkEvent,o),1!==m)this.bandwidthDecreaseTimestamp=Date.now();else if(Date.now()-this.bandwidthDecreaseTimestamp>f)return this.referenceBitrate=p,!0;return!1}getSubscribeDelay(o,p){let f=VideoPriorityBasedPolicyConfig.MINIMUM_DELAY_MS,m=VideoPriorityBasedPolicyConfig.MAXIMUM_DELAY_MS-VideoPriorityBasedPolicyConfig.MINIMUM_DELAY_MS,_=this.networkIssueResponseDelayFactor;return 1===o&&(f+=m*_*(1+p/10),f=Math.min(VideoPriorityBasedPolicyConfig.MAXIMUM_DELAY_MS,f)),f}};p.default=w,w.MINIMUM_DELAY_MS=2e3,w.MAXIMUM_DELAY_MS=8e3,w.Default=new w(0,0),w.UnstableNetworkPreset=new w(0,1),w.StableNetworkPreset=new w(1,0)},0x3350552d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoQualityAdaptationPreference=void 0,(m=f=p.VideoQualityAdaptationPreference||(p.VideoQualityAdaptationPreference={}))[m.Balanced=0]="Balanced",m[m.MaintainFramerate=1]="MaintainFramerate",m[m.MaintainResolution=2]="MaintainResolution",p.default=f},0x62a0374d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{create(){let o={clientWidth:400,clientHeight:300,width:400,height:300,videoWidth:400,videoHeight:300,style:{transform:""},hasAttribute:()=>!1,removeAttribute:()=>{},setAttribute:()=>{},srcObject:!1,paused:!0,pause:()=>{o.paused=!0},play:()=>(o.paused=!1,Promise.resolve())};return o}}},0x9ce0607d:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.canvas=o,this.destroyed=!1}destroy(){this.canvas=null,this.destroyed=!0}asCanvasImageSource(){return f(this,void 0,void 0,function*(){return this.destroyed?Promise.reject("canvas buffer is destroyed"):Promise.resolve(this.canvas)})}asCanvasElement(){return this.canvas}}},0x1217e92b2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9ce0607d)),I=_(f(0x1a23785fd));p.default=class{constructor(o,p,f=new I.default){this.logger=o,this.stages=p,this.fr=15,this.outputMediaStream=new MediaStream,this.videoInput=document.createElement("video"),this.canvasOutput=document.createElement("canvas"),this.outputCtx=this.canvasOutput.getContext("2d"),this.canvasInput=document.createElement("canvas"),this.inputCtx=this.canvasInput.getContext("2d"),this.inputVideoStream=null,this.sourceBuffers=[],this.destBuffers=[],this.observers=new Set,this.hasStarted=!1,this.process=o=>m(this,void 0,void 0,function*(){let o;if(!this.inputVideoStream)return;let p=performance.now();this.videoInput.videoWidth&&(this.canvasInput.width!==this.videoInput.videoWidth&&(this.canvasInput.width=this.videoInput.videoWidth,this.canvasInput.height=this.videoInput.videoHeight,this.sourceBuffers[0].height=this.canvasInput.height,this.sourceBuffers[0].width=this.canvasInput.width,this.sourceBuffers[0].framerate=this.framerate),this.inputCtx.drawImage(this.videoInput,0,0));let f=[];f.push(this.sourceBuffers[0]);try{for(let o of this.processors)f=yield o.process(f)}catch{this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()});return}this.destBuffers=f;try{o=yield this.destBuffers[0].asCanvasImageSource()}catch{this.inputVideoStream&&(this.logger.info("buffers are destroyed and pipeline could not start"),this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()}));return}let m=o.width,_=o.height;0!==m&&0!==_&&(this.canvasOutput.width!==m&&this.canvasOutput.height!==_&&(this.canvasOutput.width=m,this.canvasOutput.height=_),this.outputCtx.drawImage(o,0,0,m,_,0,0,m,_),this.hasStarted||(this.hasStarted=!0,this.forEachObserver(o=>{o.processingDidStart&&o.processingDidStart()})));let w=performance.now()-p,I=2e3/this.framerate-w,k=Math.max(0,1e3/this.framerate-w);I<=0&&this.forEachObserver(o=>{o.processingLatencyTooHigh&&o.processingLatencyTooHigh(w)}),yield this.timer.start(k,this.process.bind(this))}),this.timer=f}destroy(){if(this.stop(),this.stages)for(let o of this.stages)o.destroy();this.timer.destroy()}get framerate(){return this.fr}set framerate(o){this.fr=o<0||void 0===o?15:o}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(let o of this.outputMediaStream.getVideoTracks())o.stop();this.hasStarted&&(this.hasStarted=!1,this.forEachObserver(o=>{o.processingDidStop&&o.processingDidStop()}))}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}getInputMediaStream(){return m(this,void 0,void 0,function*(){return this.inputVideoStream})}getActiveOutputMediaStream(){return this.isOutputMediaStreamActive()||(this.outputMediaStream=this.canvasOutput.captureStream(this.framerate),this.cloneInputAudioTracksToOutput()),this.outputMediaStream}setInputMediaStream(o){return m(this,void 0,void 0,function*(){if(!o)return void this.stop();if(0===o.getVideoTracks().length)return void this.logger.error("No video tracks in input media stream, ignoring");this.inputVideoStream=o;let p=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${JSON.stringify(p)}`),this.framerate=p.frameRate,this.canvasOutput.width=p.width,this.canvasOutput.height=p.height,this.videoInput.addEventListener("loadedmetadata",this.process),this.videoInput.srcObject=this.inputVideoStream,this.videoInput.setAttribute("playsinline","true");let f=new w.default(this.canvasInput);this.sourceBuffers.push(f),this.videoInput.load();try{yield this.videoInput.play()}catch{this.logger.warn("Video element play() overrided by another load().")}this.cloneInputAudioTracksToOutput()})}cloneInputAudioTracksToOutput(){if(!this.isOutputMediaStreamActive()||null===this.inputVideoStream)return void this.logger.info("Not cloning input audio tracks to output, do not have media streams ready");for(let o of this.outputMediaStream.getAudioTracks())this.logger.info(`Removing audio track ${o.id} from output stream`),this.outputMediaStream.removeTrack(o);for(let o of this.inputVideoStream.getAudioTracks())this.logger.info(`Adding audio track ${o.id} to output stream`),this.outputMediaStream.addTrack(o)}isOutputMediaStreamActive(){return this.outputMediaStream&&this.outputMediaStream.active}set processors(o){this.stages=o}get processors(){return this.stages}forEachObserver(o){for(let p of this.observers)setTimeout(()=>{o(p)},0)}destroyInputMediaStreamAndBuffers(){if(this.inputVideoStream)for(let o of this.inputVideoStream.getTracks())o.stop();for(let o of(this.inputVideoStream=null,this.sourceBuffers))o.destroy();this.sourceBuffers=[]}}},0x1a23785fd:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.workerTimer=void 0,this.callback=void 0,this.workerTimer=this.createWorkerTimer()}createWorkerTimer(){try{let o=new Blob([`self.onmessage = async function(e){ 
            var timerID = null;
            const awaitTimeout = delay => new Promise( resolve => {
              timerID = setTimeout(resolve, delay);
            })
            await awaitTimeout(e.data);
            postMessage(timerID);
          }`],{type:"application/javascript"});return new Worker(window.URL.createObjectURL(o))}catch{}}start(o,p){return f(this,void 0,void 0,function*(){this.callback=p,this.workerTimer?(this.workerTimer.onmessage=o=>{this.lastTimeout=o.data,this.callback()},this.workerTimer.postMessage(o)):this.lastTimeout=setTimeout(()=>{this.callback()},o)})}destroy(){return f(this,void 0,void 0,function*(){this.callback=void 0,this.lastTimeout&&(clearTimeout(this.lastTimeout),this.lastTimeout=void 0),this.workerTimer&&(this.workerTimer.terminate(),this.workerTimer=void 0)})}}},0x18c01a5bb:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0x1217e92b2));p.default=class DefaultVideoTransformDevice{constructor(o,p,f,m=new w.default){this.logger=o,this.device=p,this.processors=f,this.browserBehavior=m,this.observers=new Set,this.pipe=new I.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}passEventControllerToProcessors(o){if(this.pipe.processors)for(let p of this.pipe.processors)"function"==typeof p.setEventController&&p.setEventController(o)}chooseNewInnerDevice(o){let p=new DefaultVideoTransformDevice(this.logger,o,this.processors,this.browserBehavior);return p.pipe=this.pipe,p}getInnerDevice(){return this.device}intrinsicDevice(){return m(this,void 0,void 0,function*(){return this.device})}transformStream(o){return m(this,void 0,void 0,function*(){return yield this.pipe.setInputMediaStream(o),this.inputMediaStream=o,this.pipe.getActiveOutputMediaStream()})}onOutputStreamDisconnect(){this.logger.info("DefaultVideoTransformDevice: detach stopping input media stream");let o=this.device&&this.device.id;if(this.pipe.stop(),!o&&this.inputMediaStream)for(let o of this.inputMediaStream.getVideoTracks())o.stop()}stop(){return m(this,void 0,void 0,function*(){if(this.inputMediaStream)for(let o of this.inputMediaStream.getVideoTracks())o.stop();this.pipe.destroy(),this.inputMediaStream=null})}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}processingDidStart(){this.logger.info("video transform device processing started"),this.forEachObserver(o=>{o.processingDidStart&&o.processingDidStart()})}processingLatencyTooHigh(o){this.forEachObserver(p=>{p.processingLatencyTooHigh&&p.processingLatencyTooHigh(o)})}processingDidFailToStart(){this.logger.info("video transform device processing failed to start"),this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()})}processingDidStop(){this.logger.info("video transform device processing stopped"),this.forEachObserver(o=>{o.processingDidStop&&o.processingDidStop()})}forEachObserver(o){for(let p of this.observers)setTimeout(()=>{o(p)},0)}get framerate(){return this.pipe.framerate}set framerate(o){this.pipe.framerate=o}}},0x23b2002bd:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{process(o){return f(this,void 0,void 0,function*(){return o})}destroy(){return f(this,void 0,void 0,function*(){})}}},0xd1c028d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.DeferredPromise=void 0,p.DeferredPromise=class{constructor(){this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}getPromise(){return this.promise}resolvePromise(o){this.resolve(o)}resolveAndReplacePromise(o){this.resolve(o),this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}rejectPromise(o){this.reject(o)}rejectAndReplacePromise(o){this.reject(o),this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}}},0x809a3b1a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.VideoFxCanvasOpsManager=void 0;let _=f(0xf2c0957e);p.VideoFxCanvasOpsManager=class{constructor(o,p){this.streamParameters=o,this.outputCanvas=p,this.configureCanvasPipeline()}getInferenceInputData(o){return this.inferenceCtx.save(),this.inferenceCtx.scale(this.horizontalResizeScalar,this.verticalResizeScalar),this.inferenceCtx.drawImage(o,0,0),this.inferenceCtx.restore(),this.inferenceCtx.getImageData(0,0,_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS)}configureForStreamParameters(o){return m(this,void 0,void 0,function*(){if(this.streamParameters=o,this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.backgroundReplacementCanvas){let o=document.createElement("canvas");o.width=this.streamParameters.width,o.height=this.streamParameters.height,o.getContext("2d").drawImage(this.backgroundReplacementCanvas,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=o}this.configureCanvasPipeline()})}configureCanvasPipeline(){this.inferenceCanvas=document.createElement("canvas"),this.inferenceCtx=this.inferenceCanvas.getContext("2d",{willReadFrequently:!0}),this.inferenceCanvas.width=_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,this.inferenceCanvas.height=_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.horizontalResizeScalar=_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS/this.streamParameters.width,this.verticalResizeScalar=_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS/this.streamParameters.height}getBackgroundReplacementCanvas(){return this.backgroundReplacementCanvas}loadReplacementBackground(o){return m(this,void 0,void 0,function*(){let p=o.backgroundReplacement.backgroundImageURL,f=o.backgroundReplacement.defaultColor;if(p)try{let o=yield this.loadImage(p);this.backgroundReplacementImage=o,this.resizeAndSetReplacementImage(this.backgroundReplacementImage)}catch(o){throw this.logger.error(o),Error("Failed to set the replacement image.")}else this.resizeAndSetReplacementColor(f)})}resizeAndSetReplacementImage(o){let p=document.createElement("canvas"),f=p.getContext("2d");p.width=this.streamParameters.width,p.height=this.streamParameters.height,f.drawImage(o,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=p}resizeAndSetReplacementColor(o){let p=document.createElement("canvas"),f=p.getContext("2d");p.width=this.streamParameters.width,p.height=this.streamParameters.height,f.fillStyle=o,f.fillRect(0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=p}loadImage(o){return m(this,void 0,void 0,function*(){let p=yield fetch(o).catch(o=>{throw this.logger.error(o.toString()),Error("Failed to fetch image.")}),f=yield p.blob(),m=new Image;return m.src=URL.createObjectURL(f),new Promise((o,p)=>{m.onload=()=>{o(m)},m.onerror=o=>{p(o)}})})}}},0xf2c0957e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_FX_SPEC=p.FXLIB_PATH=p.WORKER_PATH=p.CDN_BASE_PATH=p.RESOURCE_CONSTRAINTS=p.SEGMENTATION_MODEL=p.DEFAULT_STREAM_PARAMETERS=p.WORKER_MSG=void 0,p.WORKER_MSG={BUILD_ENGINE_REQUEST:"BuildEngineRequest",BUILD_ENGINE_RESPONSE:"BuildEngineResponse",PERFORM_SEGMENTATION_REQUEST:"PerformSegmentationRequest",PERFORM_SEGMENTATION_RESPONSE:"PerformSegmentationResponse",PERFORM_SEGMENTATION_SAB_REQUEST:"PerformSegmentationSABRequest",PERFORM_SEGMENTATION_SAB_RESPONSE:"PerformSegmentationSABResponse",DESTROY_ASSETS_REQUEST:"DestroyAssetsRequest",DESTROY_ASSETS_RESPONSE:"DestroyAssetsResponse",CLOSE_WORKER_REQUEST:"CloseWorkerRequest"},p.DEFAULT_STREAM_PARAMETERS={FRAMES_PER_SECOND:15,WIDTH_IN_PIXEL:960,HEIGHT_IN_PIXEL:540,CHANNEL_COUNT:4},p.SEGMENTATION_MODEL={LOAD_SUCCESS:2,WIDTH_IN_PIXELS:176,HEIGHT_IN_PIXELS:160},p.RESOURCE_CONSTRAINTS={DEFAULT_PROCESSING_BUDGET_PER_FRAME:50,SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION:1,SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT:500,BLUR_DEFAULT_CYCLE_PERCENTAGE:10,BLUR_SAMPLING_PERIOD_FRAME_COUNT:1e3,MIN_PROCESSING_BUDGET:0,MAX_PROCESSING_BUDGET:100},p.CDN_BASE_PATH="https://static.sdkassets.chime.aws";let f="/ml_media_fx/otherassets";p.WORKER_PATH=`${f}/worker.js`,p.FXLIB_PATH=`${f}/fxlib.js`,p.DEFAULT_VIDEO_FX_SPEC={paths:{cdnBasePath:p.CDN_BASE_PATH,workerPath:p.WORKER_PATH,fxLibPath:p.FXLIB_PATH}}},0xfbd337fb:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x8c0c7fbd),I=f(0x2037185f8),k=f(0x19eda6376),M=_(f(0x165009cb4)),x=_(f(0x53f60ff7)),O=f(0x149d24991),L=_(f(0xaf1ae5b3)),B=_(f(0x9ce0607d)),U=f(0xd1c028d4),$=f(0x809a3b1a),q=f(0xf2c0957e),Z=f(0xba3babcc),ee=class VideoFxProcessor{constructor(o,p=q.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,f){this.logger=o,this.outputCanvas=document.createElement("canvas"),this.canvasVideoFrameBuffer=new B.default(this.outputCanvas),this.videoFxSpec=q.DEFAULT_VIDEO_FX_SPEC;try{this.validateProcessingBudgetPerFrame(p)}catch(o){throw this.logger.error(o),Error(`Cannot instantiate VideoFxProcessor due to invalid processingBudgetPerFrame of ${p}`)}f&&(this.eventController=f),this.effectConfig={backgroundBlur:{isEnabled:!1,strength:"low"},backgroundReplacement:{isEnabled:!1,backgroundImageURL:null,defaultColor:"black"}},this.segmentationRequestPromise=new U.DeferredPromise,this.segmentationRateManager=new Z.VideoFxSegmentationRateManager(this.logger,p),this.streamParameters={framerate:q.DEFAULT_STREAM_PARAMETERS.FRAMES_PER_SECOND,width:q.DEFAULT_STREAM_PARAMETERS.WIDTH_IN_PIXEL,height:q.DEFAULT_STREAM_PARAMETERS.HEIGHT_IN_PIXEL,channels:q.DEFAULT_STREAM_PARAMETERS.CHANNEL_COUNT},VideoFxProcessor.isSharedArrayBufferSupported&&(this.sharedImageBuffer=new SharedArrayBuffer(q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS*q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS*this.streamParameters.channels),this.sharedImageData=new Uint8ClampedArray(this.sharedImageBuffer)),this.logger.info(`VideoFx supports Shared Array Buffer: ${VideoFxProcessor.isSharedArrayBufferSupported}`),this.canvasOpsManager=new $.VideoFxCanvasOpsManager(this.streamParameters,this.outputCanvas),this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.segmentationMask=new ImageData(this.streamParameters.width,this.streamParameters.height),this.logger.info(`VideoFxProcessor instantiated with a processingBudgetPerFrame of ${p}`)}process(o){return m(this,void 0,void 0,function*(){return o})}fxProcess(o){return m(this,void 0,void 0,function*(){let p=o[0].asCanvasElement();this.didStreamParametersChange(p)&&(yield this.adjustProcessorForNewStreamParameters(p));try{yield this.manageSegmentationMask(p)}catch(o){throw this.logger.error(o),Error("Video stream could not be processed")}return yield this.renderer.render(p,this.segmentationMask),o[0]=this.canvasVideoFrameBuffer,o})}noOpProcess(o){return m(this,void 0,void 0,function*(){return o})}didStreamParametersChange(o){return o.width!==this.streamParameters.width||o.height!==this.streamParameters.height}adjustProcessorForNewStreamParameters(o){return m(this,void 0,void 0,function*(){this.streamParameters.width=o.width,this.streamParameters.height=o.height,yield this.canvasOpsManager.configureForStreamParameters(this.streamParameters),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,this.effectConfig)})}destroy(){return m(this,void 0,void 0,function*(){this.canvasVideoFrameBuffer.destroy(),this.fxLibScript&&this.fxLibScript.parentNode&&this.fxLibScript.parentNode.removeChild(this.fxLibScript),this.engineWorker&&(this.destroyedAssetsPromise=new U.DeferredPromise,this.engineWorker.postMessage({msg:q.WORKER_MSG.DESTROY_ASSETS_REQUEST}),yield this.destroyedAssetsPromise.getPromise(),this.engineWorker.postMessage({msg:q.WORKER_MSG.CLOSE_WORKER_REQUEST})),this.logger.info("VideoFxProcessor destroyed.")})}manageSegmentationMask(o){return m(this,void 0,void 0,function*(){try{if(this.segmentationRateManager.submitFrame(),this.segmentationRateManager.shouldApplySegmentation()){this.segmentationRateManager.startSegmentation();let p=this.canvasOpsManager.getInferenceInputData(o);this.segmentationMask=yield this.generateSegmentationMask(p),this.segmentationRateManager.completeSegmentation()}}catch(o){throw this.logger.error(o.toString()),Error("Can not properly manage the returned segmentation mask")}})}generateSegmentationMask(o){return m(this,void 0,void 0,function*(){VideoFxProcessor.isSharedArrayBufferSupported?(this.sharedImageData.set(o.data),this.engineWorker.postMessage({msg:q.WORKER_MSG.PERFORM_SEGMENTATION_SAB_REQUEST,payload:this.sharedImageBuffer})):this.engineWorker.postMessage({msg:q.WORKER_MSG.PERFORM_SEGMENTATION_REQUEST,payload:o},[o.data.buffer]);try{return yield this.segmentationRequestPromise.getPromise()}catch(o){throw this.logger.error(o.toString()),Error("Segmentation mask could not be generated")}})}cloneConfigFrom(o){return{backgroundBlur:{isEnabled:o.backgroundBlur.isEnabled,strength:o.backgroundBlur.strength},backgroundReplacement:{isEnabled:o.backgroundReplacement.isEnabled,backgroundImageURL:o.backgroundReplacement.backgroundImageURL,defaultColor:o.backgroundReplacement.defaultColor}}}setVideoFxSpec(o){o.paths&&(this.videoFxSpec.paths=o.paths)}setEffectConfig(o){return m(this,void 0,void 0,function*(){if(this.sameVideoFxConfig(o,this.effectConfig))return;let p=this.cloneConfigFrom(o);try{yield this.validateEffectConfig(p)}catch(o){throw this.logger.error(o.toString()),Error("Provided effect config is invalid, not updating VideoFxProcessor")}p.backgroundReplacement.isEnabled&&(yield this.canvasOpsManager.loadReplacementBackground(p),yield this.renderer.setBackgroundReplacementCanvas(this.canvasOpsManager.getBackgroundReplacementCanvas())),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,p),this.effectConfig=p,this.effectConfig.backgroundBlur.isEnabled||this.effectConfig.backgroundReplacement.isEnabled?this.process=this.fxProcess:this.process=this.noOpProcess,this.logger.info(`VideoFxProcessor effect configuration updated to: ${JSON.stringify(this.effectConfig)}`),this.eventController&&this.publishVideoFxConfigEvent()})}validateEffectConfig(o){return m(this,void 0,void 0,function*(){if(o.backgroundBlur.isEnabled&&o.backgroundReplacement.isEnabled)throw Error("Invalid VideoFx configuration: Background Blur and Background Replacement can not both be enabled");o.backgroundReplacement.isEnabled&&(yield this.validateReplacementConfig(o))})}validateReplacementConfig(o){return m(this,void 0,void 0,function*(){if(o.backgroundReplacement.backgroundImageURL&&o.backgroundReplacement.defaultColor)throw Error("Invalid VideoFx configuration: Background Replacement can not have both an image URL and default color");if(!o.backgroundReplacement.backgroundImageURL&&!o.backgroundReplacement.defaultColor)throw Error("Invalid VideoFx configuration: Background Replacement image URL and default can not both be null/undefined");try{o.backgroundReplacement.backgroundImageURL&&(yield this.canvasOpsManager.loadImage(o.backgroundReplacement.backgroundImageURL))}catch(o){throw this.logger.error(o.toString()),Error("Invalid VideoFx configuration: backgroundImageURL failed to load")}let p=o.backgroundReplacement.defaultColor;if(p&&"black"!==p&&"#000000"!==p&&"#000"!==p){if(p.includes("#")&&!new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).test(p))throw Error(`Invalid hexadecimal color code for default replacement background: ${p}`);let o=document.createElement("canvas").getContext("2d"),f=o.fillStyle;if(o.fillStyle=p,o.fillStyle===f)throw Error(`Invalid color for default replacement background: ${p}`)}})}validateProcessingBudgetPerFrame(o){if(o<q.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET||o>q.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET)throw Error(`Invalid resource constraint: cycle percentage must be within range of ${q.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET} and ${q.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET}`)}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("Loading required assets for the VideoFxProcessor");try{let o=this.getVideoFxAssetParams();yield this.loadEngineWorker(o),yield this.buildEngine(o),yield this.loadFxLib(o),this.renderer=constructRenderer(q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.effectConfig,this.outputCanvas)}catch(o){throw this.logger.error(o.toString()),Error("Failed to load necessary assets for the VideoFxProcessor")}this.logger.info("Finished loading of essential VideoFxProcessor assets.")})}getVideoFxAssetParams(){let o=O.getDefaultAssetSpec();return{assetGroup:o.assetGroup,revisionID:o.revisionID,sdk:encodeURIComponent(L.default.sdkVersion),ua:encodeURIComponent(L.default.sdkUserAgentLowResolution)}}getPathFromVideoFxAssetParams(o,p){let f=new URL(o);for(let[o,m]of Object.entries(p))if(void 0!==m){let p=encodeURIComponent(o),_=encodeURIComponent(m);f.searchParams.set(p,_)}return f.toString()}loadEngineWorker(o){return m(this,void 0,void 0,function*(){try{let p=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.workerPath,o);this.engineWorker=yield I.loadWorker(p,"VideoFxEngineWorker",{},null),this.logger.info("Successfully loaded the VideoFxProcessor's engine worker"),this.engineWorker.addEventListener("message",o=>this.engineWorkerReceiver(o))}catch(o){throw this.logger.error(o.toString()),Error("Failed to load the VideoFxProcessor's engine worker")}})}buildEngine(o){return m(this,void 0,void 0,function*(){this.buildEnginePromise=new U.DeferredPromise,this.engineWorker.postMessage({msg:q.WORKER_MSG.BUILD_ENGINE_REQUEST,payload:{cdnBasePath:this.videoFxSpec.paths.cdnBasePath,sdkVersioningParams:o}});try{yield this.buildEnginePromise.getPromise()}catch(o){throw this.logger.error(o.toString()),Error("Failed to instantiate the VideoFxEngine")}})}loadFxLib(o){return m(this,void 0,void 0,function*(){let p=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.fxLibPath,o);try{let o=yield w.fetchWithBehavior(p,{method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"},{});if(!o.ok)throw Error("Fetch failed.");let f=window.URL.createObjectURL((yield o.blob()));yield new Promise((o,p)=>{this.fxLibScript=document.createElement("script"),this.fxLibScript.setAttribute("src",f),this.fxLibScript.setAttribute("type","module"),this.fxLibScript.setAttribute("async","false"),this.fxLibScript.addEventListener("load",o),this.fxLibScript.addEventListener("error",p),document.body.appendChild(this.fxLibScript)})}catch(o){throw this.logger.error(o.toString()),Error("Failed to load the fxlib")}})}getEffectConfig(){return this.cloneConfigFrom(this.effectConfig)}engineWorkerReceiver(o){let p=o.data;switch(p.msg){case q.WORKER_MSG.BUILD_ENGINE_RESPONSE:this.settleEngineBuildPromise(p.payload);break;case q.WORKER_MSG.PERFORM_SEGMENTATION_RESPONSE:this.settleSegmentationPromise(p.payload.output);break;case q.WORKER_MSG.PERFORM_SEGMENTATION_SAB_RESPONSE:this.settleSegmentationPromiseSAB();break;case q.WORKER_MSG.DESTROY_ASSETS_RESPONSE:this.destroyedAssetsPromise.resolvePromise();break;default:this.logger.info(`VideoFx worker received unknown event msg: ${JSON.stringify(p)}`)}}settleEngineBuildPromise(o){o!==q.SEGMENTATION_MODEL.LOAD_SUCCESS?this.buildEnginePromise.rejectPromise(Error("Failed to build VideoFxProcessor's engine")):(this.logger.info("Successfully built the VideoFxEngine"),this.buildEnginePromise.resolvePromise())}settleSegmentationPromise(o){o?this.segmentationRequestPromise.resolveAndReplacePromise(o):this.segmentationRequestPromise.rejectAndReplacePromise(Error("Failed to perform a segmentation on the input image"))}settleSegmentationPromiseSAB(){try{let o=new ImageData(new Uint8ClampedArray(this.sharedImageData),q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS);this.segmentationRequestPromise.resolveAndReplacePromise(o)}catch(o){this.segmentationRequestPromise.rejectAndReplacePromise(Error("Failed to perform a segmentation with a shared array buffer on the input image"))}}setToNoOpProcess(){this.process=this.noOpProcess}static isSupported(o=new x.default,p=!0){return m(this,void 0,void 0,function*(){let f=!0,checkEnv=(p,m)=>{p&&(o.info(m),f=!1)};checkEnv("u"<typeof globalThis,"Browser does not have globalThis."),checkEnv(!k.supportsWorker(globalThis,o),"Browser does not support web workers."),checkEnv(!k.supportsWASM(globalThis,o),"Browser does not support wasm."),checkEnv(!document.createElement("canvas").getContext("webgl2"),"Browser does not support webgl."),checkEnv(!new M.default().isVideoFxSupportedBrowser(),"Browser is unsupported for VideoFxProcessor");let checkProcessor=()=>m(this,void 0,void 0,function*(){if(p)try{let p=new VideoFxProcessor(o);yield p.loadAssets(),yield p.destroy()}catch{return o.info("Browser environment is unable to access the required external assets."),Promise.resolve(!1)}return Promise.resolve(!0)});return Promise.resolve(!!f&&(yield checkProcessor()))})}static create(o,p,f=q.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,_){return m(this,void 0,void 0,function*(){let m=new VideoFxProcessor(o,f);_&&m.setVideoFxSpec(_);try{return yield m.loadAssets(),yield m.setEffectConfig(p),m}catch(p){throw o.error(p.toString()),m.setToNoOpProcess(),Error("VideoFxProcessor built with support for only NoOp processing")}})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishVideoFxConfigEvent())}publishVideoFxConfigEvent(){let o={backgroundBlurEnabled:this.effectConfig.backgroundBlur.isEnabled.toString(),backgroundBlurStrength:this.effectConfig.backgroundBlur.strength,backgroundReplacementEnabled:this.effectConfig.backgroundReplacement.isEnabled.toString(),backgroundFilterVersion:2};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}sameVideoFxConfig(o,p){return o.backgroundBlur.isEnabled===p.backgroundBlur.isEnabled&&o.backgroundBlur.strength===p.backgroundBlur.strength&&o.backgroundReplacement.backgroundImageURL===p.backgroundReplacement.backgroundImageURL&&o.backgroundReplacement.defaultColor===p.backgroundReplacement.defaultColor&&o.backgroundReplacement.isEnabled===p.backgroundReplacement.isEnabled}};p.default=ee,ee.isSharedArrayBufferSupported="u">typeof SharedArrayBuffer},0xba3babcc:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.VideoFxSegmentationRateManager=void 0;let m=f(0xf2c0957e);p.VideoFxSegmentationRateManager=class{constructor(o,p){this.logger=o,this.targetSegmentationCyclePercentage=p/100,this.frameCountOverSamplingPeriod=0,this.totalSegmentationDurationOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now(),this.framesPerSegmentation=m.RESOURCE_CONSTRAINTS.SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION}submitFrame(){this.frameCountOverSamplingPeriod++}shouldApplySegmentation(){return this.frameCountOverSamplingPeriod%this.framesPerSegmentation==0}startSegmentation(){this.frameSegmentationStartTime=performance.now()}completeSegmentation(){this.totalSegmentationDurationOverSamplingPeriod+=performance.now()-this.frameSegmentationStartTime,this.frameCountOverSamplingPeriod>=m.RESOURCE_CONSTRAINTS.SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT&&this.adjustFramesPerSegmentation(this.totalSegmentationDurationOverSamplingPeriod/(performance.now()-this.samplingPeriodStartTime))}adjustFramesPerSegmentation(o){o>this.targetSegmentationCyclePercentage?(this.framesPerSegmentation++,this.logger.info(`Segmentation cycle percentage above the configured maximal value. Decreasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)):this.framesPerSegmentation>1&&o<this.targetSegmentationCyclePercentage&&(this.framesPerSegmentation--,this.logger.info(`Segmentation cycle percentage below the configured maximal value. Increasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)),this.totalSegmentationDurationOverSamplingPeriod=0,this.frameCountOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now()}}},0x15db02d39:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0xc30676e4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class DefaultVideoStreamIdSet{constructor(o){this.ids=new Set(o)}add(o){this.ids.add(o)}array(){return Array.from(this.ids.values()).sort((o,p)=>o-p)}contain(o){return this.ids.has(o)}forEach(o){this.ids.forEach(o)}empty(){return 0===this.ids.size}size(){return this.ids.size}equal(o){if(!o)return 0===this.ids.size;let p=this.array(),f=o.array();if(p.length!==f.length)return!1;for(let o=0;o<p.length;o++)if(p[o]!==f[o])return!1;return!0}clone(){return new DefaultVideoStreamIdSet(this.array())}remove(o){this.ids.delete(o)}toJSON(){return this.array()}truncate(o){return new DefaultVideoStreamIdSet(this.array().splice(0,o))}}},0x243b05980:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0xe88b24d9),w=m(f(0xc30676e4)),I=m(f(0x2187d54cb));p.default=class{constructor(o){this.logger=o,this.currentIndex=null,this.indexForSubscribe=null,this.indexForLastRemoteVideoUpdate=null,this.currentSubscribeAck=null,this.subscribeTrackToStreamMap=null,this.subscribeStreamToAttendeeMap=null,this.subscribeStreamToExternalUserIdMap=null,this.subscribeSsrcToStreamMap=null,this.subscribeSsrcToGroupMap=null,this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null,this.videoStreamDescription=new I.default,this.sendVideoStreamId=0,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}convertBpsToKbps(o){return o>0&&o<1e3?1:Math.trunc(o/1e3)}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];let o=[];return this.currentIndex.sources.forEach(p=>{let f=new I.default;f.attendeeId=p.attendeeId,f.groupId=p.groupId,f.streamId=p.streamId,f.maxBitrateKbps=p.maxBitrateKbps,f.avgBitrateKbps=this.convertBpsToKbps(p.avgBitrateBps),f.width=p.width,f.height=p.height,f.maxFrameRate=p.framerate,o.push(f)}),o}integrateUplinkPolicyDecision(o){if(o&&o.length){let p=o[0];this.videoStreamDescription.maxBitrateKbps=p.maxBitrate/1e3,this.videoStreamDescription.maxFrameRate=p.maxFramerate}}integrateIndexFrame(o){if(this.currentIndex=o,!o)return;let p=new Map,f=!1;for(let m of o.sources){if(!p.has(m.attendeeId)){p.set(m.attendeeId,m.groupId);continue}let o=p.get(m.attendeeId);o<m.groupId&&(this.logger.warn(`Old group ID ${o} found for attendee ID ${m.attendeeId}, replacing with newer group ID ${m.groupId}`),p.set(m.attendeeId,m.groupId)),f=!0}f&&(this.currentIndex.sources=this.currentIndex.sources.filter(o=>p.get(o.attendeeId)===o.groupId)),this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}remoteVideoUpdateSent(){this.indexForLastRemoteVideoUpdate=this.currentIndex}integrateSubscribeAckFrame(o){this.currentSubscribeAck=o,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToGroupMap=this.buildSSRCToGroupMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe),this.sendVideoStreamId=0,o.allocations&&void 0!==o.allocations&&o.allocations.length>0&&(this.sendVideoStreamId=o.allocations[0].streamId)}integrateBitratesFrame(o){if(this.currentIndex)for(let p of o.bitrates){let o=this.currentIndex.sources.find(o=>o.streamId===p.sourceStreamId);void 0!==o&&(o.avgBitrateBps=p.avgBitrateBps)}}allStreams(){let o=new w.default;if(this.currentIndex)for(let p of this.currentIndex.sources)o.add(p.streamId);return o}allVideoSendingSourcesExcludingSelf(o){let p=[],f=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(let m of this.currentIndex.sources){let{attendeeId:w,externalUserId:I,mediaType:k}=m;w===o||k!==_.SdkStreamMediaType.VIDEO||f.has(w)||(p.push({attendee:{attendeeId:w,externalUserId:I}}),f.add(w))}return p}streamSelectionUnderBandwidthConstraint(o,p,f,m){let I=new Set;if(this.currentIndex)for(let m of this.currentIndex.sources)m.attendeeId!==o&&m.mediaType===_.SdkStreamMediaType.VIDEO&&(p.has(m.attendeeId)||f.has(m.attendeeId)||I.add(m.attendeeId));let k=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(o),M=new Map,x=0;k.forEach((o,p)=>{M.set(p,o[0]),x+=o[0].maxBitrateKbps}),x=this.trySelectHighBitrateForAttendees(k,p,x,m,M),this.trySelectHighBitrateForAttendees(k,I,x,m,M);let O=new w.default;for(let o of M.values())O.add(o.streamId);return O}highestQualityStreamFromEachGroupExcludingSelf(o){let p=new w.default;if(this.currentIndex){let f=new Map;for(let p of this.currentIndex.sources)p.attendeeId!==o&&p.mediaType===_.SdkStreamMediaType.VIDEO&&(!f.has(p.groupId)||p.maxBitrateKbps>f.get(p.groupId).maxBitrateKbps)&&f.set(p.groupId,p);for(let o of f.values())p.add(o.streamId)}return p}numberOfVideoPublishingParticipantsExcludingSelf(o){return this.highestQualityStreamFromEachGroupExcludingSelf(o).array().length}numberOfParticipants(){return this.currentIndex.numParticipants?this.currentIndex.numParticipants:-1}attendeeIdForTrack(o){let p=this.streamIdForTrack(o);if(void 0===p||!this.subscribeStreamToAttendeeMap)return this.logger.warn(`no attendee found for track ${o}`),"";let f=this.subscribeStreamToAttendeeMap.get(p);return f||(this.logger.info(`track ${o} (stream ${p}) does not correspond to a known attendee`),"")}externalUserIdForTrack(o){let p=this.streamIdForTrack(o);if(void 0===p||!this.subscribeStreamToExternalUserIdMap)return this.logger.warn(`no external user id found for track ${o}`),"";let f=this.subscribeStreamToExternalUserIdMap.get(p);return f||(this.logger.info(`track ${o} (stream ${p}) does not correspond to a known externalUserId`),"")}attendeeIdForStreamId(o){if(!this.streamToAttendeeMap)if(!this.currentIndex)return"";else this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex);let p=this.streamToAttendeeMap.get(o);return p||(this.logger.info(`stream ID ${o} does not correspond to a known attendee`),"")}attendeeIdForGroupId(o){if(!this.groupIdToAttendeeMap)if(!this.currentIndex)return"";else this.groupIdToAttendeeMap=this.buildGroupIdToAttendeeMap(this.currentIndex);let p=this.groupIdToAttendeeMap.get(o);return p||(this.logger.info(`group ID ${o} does not correspond to a known attendee`),"")}groupIdForStreamId(o){if(this.currentIndex&&this.currentIndex.sources){for(let p of this.currentIndex.sources)if(p.streamId===o)return p.groupId;if(this.indexForSubscribe){for(let p of this.indexForSubscribe.sources)if(p.streamId===o)return p.groupId}if(this.indexForLastRemoteVideoUpdate){for(let p of this.indexForLastRemoteVideoUpdate.sources)if(p.streamId===o)return p.groupId}}}StreamIdsInSameGroup(o,p){return this.groupIdForStreamId(o)===this.groupIdForStreamId(p)}streamIdForTrack(o){if(this.subscribeTrackToStreamMap)return this.subscribeTrackToStreamMap.get(o)}streamIdForSSRC(o){if(this.subscribeSsrcToStreamMap)return this.subscribeSsrcToStreamMap.get(o)}overrideStreamIdMappings(o,p){if(this.subscribeTrackToStreamMap){for(let[f,m]of this.subscribeTrackToStreamMap.entries())if(o===m){this.subscribeTrackToStreamMap.set(f,p);break}}if(this.subscribeSsrcToStreamMap){for(let[f,m]of this.subscribeSsrcToStreamMap.entries())if(o===m){this.subscribeSsrcToStreamMap.set(f,p);break}}}groupIdForSSRC(o){if(this.subscribeSsrcToGroupMap)return this.subscribeSsrcToGroupMap.get(o)}streamsPausedAtSource(){let o=new w.default;if(this.currentIndex)for(let p of this.currentIndex.pausedAtSourceIds)o.add(p);return o}sendVideoStreamIdFromRid(o){return this.sendVideoStreamId}buildTrackToStreamMap(o){let p=new Map;for(let f of(this.logger.debug(()=>`trackMap ${JSON.stringify(o.tracks)}`),o.tracks))f.trackLabel.length>0&&f.streamId>0&&p.set(f.trackLabel,f.streamId);return p}buildSSRCToStreamMap(o){let p=new Map;for(let f of(this.logger.debug(()=>`ssrcMap ${JSON.stringify(o.tracks)}`),o.tracks))f.trackLabel.length>0&&f.streamId>0&&p.set(f.ssrc,f.streamId);return p}buildSSRCToGroupMap(o){let p=new Map;for(let f of o.tracks)f.trackLabel.length>0&&f.streamId>0&&p.set(f.ssrc,this.groupIdForStreamId(f.streamId));return p}buildStreamToAttendeeMap(o){let p=new Map;if(o)for(let f of o.sources)p.set(f.streamId,f.attendeeId);return p}buildGroupIdToAttendeeMap(o){let p=new Map;for(let f of o.sources)p.set(f.groupId,f.attendeeId);return p}buildStreamExternalUserIdMap(o){let p=new Map;if(o)for(let f of o.sources)f.externalUserId&&p.set(f.streamId,f.externalUserId);return p}trySelectHighBitrateForAttendees(o,p,f,m,_){for(let w of p){if(f>=m)break;if(o.has(w)){for(let p of o.get(w).reverse())if(f-_.get(w).maxBitrateKbps+p.maxBitrateKbps<m){f=f-_.get(w).maxBitrateKbps+p.maxBitrateKbps,_.set(w,p);break}}}return f}buildAttendeeToSortedStreamDescriptorMapExcludingSelf(o){let p=new Map;if(this.currentIndex)for(let f of this.currentIndex.sources)f.attendeeId!==o&&f.mediaType===_.SdkStreamMediaType.VIDEO&&(p.has(f.attendeeId)?p.get(f.attendeeId).push(f):p.set(f.attendeeId,[f]));return p.forEach((o,p)=>{o.sort((o,p)=>o.maxBitrateKbps>p.maxBitrateKbps?1:o.maxBitrateKbps<p.maxBitrateKbps?-1:0)}),p}}},0x217dc1bb8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0xe88b24d9),w=m(f(0x243b05980)),I=m(f(0x2187d54cb)),k=class SimulcastVideoStreamIndex extends w.default{constructor(){super(...arguments),this.streamIdToBitrateKbpsMap=new Map,this._localStreamInfos=[],this._sendRidToVideoStreamIdMap=new Map}localStreamDescriptions(){let o=[];return this._localStreamInfos.forEach(p=>{o.push(p.clone())}),o}integrateUplinkPolicyDecision(o){let p=!0,f=0;for(let m=0;m<o.length;m++){let _=o[m].maxBitrate/1e3,w=o[m].maxFramerate;if(!p||m===this._localStreamInfos.length){p=!1;let k=new I.default;k.maxBitrateKbps=_,k.maxFrameRate=w,k.disabledByUplinkPolicy=0===_,k.rid=o[m].rid,0!==_&&(k.timeEnabled=Date.now()),this._localStreamInfos.push(k),f++;continue}0===this._localStreamInfos[f].maxBitrateKbps&&_>0&&(this._localStreamInfos[f].timeEnabled=Date.now()),this._localStreamInfos[f].maxBitrateKbps=_,this._localStreamInfos[f].maxFrameRate=w,this._localStreamInfos[f].disabledByUplinkPolicy=0===_,f++}p&&this._localStreamInfos.splice(f)}integrateBitratesFrame(o){super.integrateBitratesFrame(o);let p=new Set,f=new Set(this.streamIdToBitrateKbpsMap.keys());for(let f of o.bitrates)p.add(f.sourceStreamId),this.streamIdToBitrateKbpsMap.set(f.sourceStreamId,this.convertBpsToKbps(f.avgBitrateBps));for(let o of f)p.has(o)||(this.streamIdToBitrateKbpsMap.get(o)===SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(o,SimulcastVideoStreamIndex.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(o,SimulcastVideoStreamIndex.NOT_SENDING_STREAM_BITRATE));this.logLocalStreamDescriptions()}logLocalStreamDescriptions(){let o="";for(let p of this._localStreamInfos)o+=`streamId=${p.streamId} maxBitrate=${p.maxBitrateKbps} disabledByUplink=${p.disabledByUplinkPolicy}
`;this.logger.debug(()=>o)}integrateIndexFrame(o){super.integrateIndexFrame(o);let p=new Set,f=new Set(this.streamIdToBitrateKbpsMap.keys());for(let o of this.currentIndex.sources)o.mediaType===_.SdkStreamMediaType.VIDEO&&(p.add(o.streamId),this.streamIdToBitrateKbpsMap.has(o.streamId)||this.streamIdToBitrateKbpsMap.set(o.streamId,SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE));for(let o of f)p.has(o)||this.streamIdToBitrateKbpsMap.delete(o)}integrateSubscribeAckFrame(o){if(super.integrateSubscribeAckFrame(o),!o.allocations||void 0===o.allocations)return;let p=0;for(let f of(this._sendRidToVideoStreamIdMap.clear(),o.allocations)){if(this._localStreamInfos.length<p+1){this.logger.info("simulcast: allocation has more than number of local streams");break}this._localStreamInfos[p].groupId=f.groupId,this._localStreamInfos[p].streamId=f.streamId,this.streamIdToBitrateKbpsMap.has(f.streamId)||this.streamIdToBitrateKbpsMap.set(f.streamId,SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE),this._sendRidToVideoStreamIdMap.set(this._localStreamInfos[p].rid,f.streamId),p++}}sendVideoStreamIdFromRid(o){let p=0;return this._sendRidToVideoStreamIdMap.has(o)&&(p=this._sendRidToVideoStreamIdMap.get(o)),p}};p.default=k,k.UNSEEN_STREAM_BITRATE=-2,k.RECENTLY_INACTIVE_STREAM_BITRATE=-1,k.NOT_SENDING_STREAM_BITRATE=0,k.BitratesMsgFrequencyMs=4e3},0x2187d54cb:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xe88b24d9);p.default=class VideoStreamDescription{constructor(o,p,f,m,_){this.attendeeId="",this.groupId=0,this.streamId=0,this.ssrc=0,this.trackLabel="",this.maxBitrateKbps=0,this.avgBitrateKbps=0,this.maxFrameRate=0,this.width=0,this.height=0,this.timeEnabled=0,this.disabledByWebRTC=!1,this.disabledByUplinkPolicy=!1,this.rid="",this.attendeeId=o,this.groupId=p,this.streamId=f,this.maxBitrateKbps=m,this.avgBitrateKbps=_}clone(){let o=new VideoStreamDescription;return o.attendeeId=this.attendeeId,o.groupId=this.groupId,o.streamId=this.streamId,o.ssrc=this.ssrc,o.trackLabel=this.trackLabel,o.maxBitrateKbps=this.maxBitrateKbps,o.avgBitrateKbps=this.avgBitrateKbps,o.maxFrameRate=this.maxFrameRate,o.timeEnabled=this.timeEnabled,o.disabledByUplinkPolicy=this.disabledByUplinkPolicy,o.width=this.width,o.height=this.height,o}toStreamDescriptor(){let o=m.SdkStreamDescriptor.create();return o.mediaType=m.SdkStreamMediaType.VIDEO,o.trackLabel=this.trackLabel,o.attendeeId=this.attendeeId,o.streamId=this.streamId,o.groupId=this.groupId,o.framerate=this.maxFrameRate,o.maxBitrateKbps=this.disabledByUplinkPolicy?0:this.maxBitrateKbps,o.avgBitrateBps=this.avgBitrateKbps,o}totalPixels(){return this.width*this.height}}},0xf6f7535a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observerQueue=new Set,this.element=null,this.resizeObserver=new ResizeObserver(o=>{for(let p of o){let{width:o,height:f}=p.contentRect;this.notifyObservers(o,f)}})}notifyObservers(o,p){for(let f of this.observerQueue)f.videoElementResolutionChanged(o,p)}registerObserver(o){this.observerQueue.add(o)}removeObserver(o){this.observerQueue.delete(o)}bindVideoElement(o){this.element!==o&&(this.element&&this.resizeObserver.unobserve(this.element),this.element=o,this.element&&this.resizeObserver.observe(this.element))}}},0x4c923b82:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x165009cb4)),w=m(f(0x1a154f9b0)),I=m(f(0x131f83592));p.default=class DefaultVideoTile{constructor(o,p,f,m,_){this.tileController=f,this.devicePixelRatioMonitor=m,this.resolutionMonitor=_,this.tileState=new I.default,this.tileState.tileId=o,this.tileState.localTile=p,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(o,p,f){let m=f&&"environment"!==o.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";if(DefaultVideoTile.setVideoElementFlag(p,"disablePictureInPicture",f),DefaultVideoTile.setVideoElementFlag(p,"disableRemotePlayback",f),p.style.transform!==m&&(p.style.transform=m),p.hasAttribute("controls")&&p.removeAttribute("controls"),p.hasAttribute("autoplay")||p.setAttribute("autoplay","true"),p.hasAttribute("playsinline")||p.setAttribute("playsinline","true"),p.hasAttribute("muted")||(p.setAttribute("muted","true"),p.muted=!0),p.srcObject!==o&&(p.srcObject=o,new _.default().requiresVideoPlayWorkaround()&&p.paused)){let o=p.play();void 0!==o&&o.catch(o=>{console.warn("Error playing video in Safari",o)}).then(()=>{console.debug("Video played successfully in Safari")})}}static disconnectVideoStreamFromVideoElement(o,p,f=!1){if(o)if(p)f||(o.srcObject=null,o.style.transform="");else{if(!o.srcObject)return;o.pause(),o.style.transform="",DefaultVideoTile.setVideoElementFlag(o,"disablePictureInPicture",!1),DefaultVideoTile.setVideoElementFlag(o,"disableRemotePlayback",!1),o.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&DefaultVideoTile.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new I.default}devicePixelRatioChanged(o){this.tileState.devicePixelRatio=o,this.sendTileStateUpdate()}id(){return this.tileState.tileId}state(){return this.tileState.clone()}stateRef(){return this.tileState}bindVideoStream(o,p,f,m,_,I,k,M){let x=!1;this.tileState.boundAttendeeId!==o&&(this.tileState.boundAttendeeId=o,new w.default(o).hasModality(w.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),x=!0),this.tileState.boundExternalUserId!==k&&(this.tileState.boundExternalUserId=k,x=!0),this.tileState.localTile!==p&&(this.tileState.localTile=p,x=!0),this.tileState.boundVideoStream!==f&&(this.tileState.boundVideoStream=f,x=!0),this.tileState.videoStreamContentWidth!==m&&(this.tileState.videoStreamContentWidth=m,x=!0),this.tileState.videoStreamContentHeight!==_&&(this.tileState.videoStreamContentHeight=_,x=!0),this.tileState.streamId!==I&&(this.tileState.streamId=I,x=!0),this.tileState.groupId!==M&&(this.tileState.groupId=M,x=!0),x&&this.sendTileStateUpdate()}bindVideoElement(o){var p;let f=!1;this.tileState.boundVideoElement!==o&&(this.tileState.boundVideoElement=o,null==(p=this.resolutionMonitor)||p.bindVideoElement(this.tileState.boundVideoElement),f=!0),null!==this.tileState.boundVideoElement?(this.tileState.videoElementCSSWidthPixels!==o.clientWidth&&(this.tileState.videoElementCSSWidthPixels=o.clientWidth,f=!0),this.tileState.videoElementCSSHeightPixels!==o.clientHeight&&(this.tileState.videoElementCSSHeightPixels=o.clientHeight,f=!0)):(this.tileState.videoElementCSSWidthPixels=null,this.tileState.videoElementCSSHeightPixels=null),f&&this.sendTileStateUpdate()}pause(){this.tileState.paused||(this.tileState.paused=!0,this.sendTileStateUpdate())}unpause(){this.tileState.paused&&(this.tileState.paused=!1,this.sendTileStateUpdate())}markPoorConnection(){return!this.tileState.poorConnection&&(this.tileState.poorConnection=!0,this.sendTileStateUpdate(),!0)}unmarkPoorConnection(){return!!this.tileState.poorConnection&&(this.tileState.poorConnection=!1,this.sendTileStateUpdate(),!0)}capture(){if(!this.tileState.active)return null;let o=document.createElement("canvas"),p=this.tileState.boundVideoElement;o.width=p.videoWidth||p.width,o.height=p.videoHeight||p.height;let f=o.getContext("2d");return f.drawImage(p,0,0,o.width,o.height),f.getImageData(0,0,o.width,o.height)}setStreamId(o){this.tileState.streamId=o,this.tileController.sendTileStateUpdate(this.state())}sendTileStateUpdate(){this.updateActiveState(),this.updateVideoStreamOnVideoElement(),this.updateVideoElementPhysicalPixels(),this.tileController.sendTileStateUpdate(this.state())}updateActiveState(){this.tileState.active=!!(!this.tileState.paused&&!this.tileState.poorConnection&&this.tileState.boundAttendeeId&&this.tileState.boundVideoElement&&this.tileState.boundVideoStream)}updateVideoElementPhysicalPixels(){"number"==typeof this.tileState.videoElementCSSWidthPixels&&"number"==typeof this.tileState.videoElementCSSHeightPixels?(this.tileState.videoElementPhysicalWidthPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSWidthPixels,this.tileState.videoElementPhysicalHeightPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSHeightPixels):(this.tileState.videoElementPhysicalWidthPixels=null,this.tileState.videoElementPhysicalHeightPixels=null)}updateVideoStreamOnVideoElement(){this.tileState.active?DefaultVideoTile.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):DefaultVideoTile.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(o,p,f){p in o&&(o[p]=f)}}},0x131f83592:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class VideoTileState{constructor(){this.tileId=null,this.localTile=!1,this.localTileStarted=!1,this.isContent=!1,this.active=!1,this.paused=!1,this.poorConnection=!1,this.boundAttendeeId=null,this.boundExternalUserId=null,this.boundVideoStream=null,this.boundVideoElement=null,this.nameplate=null,this.videoStreamContentWidth=null,this.videoStreamContentHeight=null,this.videoElementCSSWidthPixels=null,this.videoElementCSSHeightPixels=null,this.devicePixelRatio=0,this.videoElementPhysicalWidthPixels=null,this.videoElementPhysicalHeightPixels=null,this.streamId=null,this.groupId=null}clone(){let o=new VideoTileState;return o.tileId=this.tileId,o.localTile=this.localTile,o.isContent=this.isContent,o.active=this.active,o.paused=this.paused,o.poorConnection=this.poorConnection,o.boundAttendeeId=this.boundAttendeeId,o.boundExternalUserId=this.boundExternalUserId,o.boundVideoStream=this.boundVideoStream,o.boundVideoElement=this.boundVideoElement,o.nameplate=this.nameplate,o.videoStreamContentWidth=this.videoStreamContentWidth,o.videoStreamContentHeight=this.videoStreamContentHeight,o.videoElementCSSWidthPixels=this.videoElementCSSWidthPixels,o.videoElementCSSHeightPixels=this.videoElementCSSHeightPixels,o.devicePixelRatio=this.devicePixelRatio,o.videoElementPhysicalWidthPixels=this.videoElementPhysicalWidthPixels,o.videoElementPhysicalHeightPixels=this.videoElementPhysicalHeightPixels,o.streamId=this.streamId,o.groupId=this.groupId,o}}},0x198994116:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x3b3f192c)),I=_(f(0x16ee58416)),k=_(f(0xc4db2fcf)),M=f(0xb529932d),x=_(f(0xf6f7535a)),O=_(f(0x4c923b82));p.default=class{constructor(o,p,f){this.tileFactory=o,this.audioVideoController=p,this.logger=f,this.tileMap=new Map,this.nextTileId=1,this.currentLocalTile=null,this.currentPausedTilesByIds=new Set,this.resolutionObservers=new Set,this.keepLastFrameWhenPaused=!1,this.keepLastFrameWhenPaused=p.configuration.keepLastFrameWhenPaused}createDevicePixelRatioMonitorIfNeeded(){this.devicePixelRatioMonitor||(this.devicePixelRatioMonitor=new I.default(new k.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return m(this,void 0,void 0,function*(){if(this.tileMap.size||!this.devicePixelRatioMonitor)return;let o=this.devicePixelRatioMonitor;return this.devicePixelRatioMonitor=void 0,o.destroy()})}bindVideoElement(o,p){let f=this.getVideoTile(o);null===f?this.logger.warn(`Ignoring video element binding for unknown tile id ${o}`):f.bindVideoElement(p)}unbindVideoElement(o,p=!0){let f=this.getVideoTile(o);if(null===f)return void this.logger.warn(`Ignoring video element unbinding for unknown tile id ${o}`);this.logger.info("Unbinding the video element"),this.notifyRemoteObserversOfUnbound(f.state().boundAttendeeId);let m=f.stateRef().boundVideoElement;f.bindVideoElement(null),p&&(this.logger.info("Cleaning up the video element"),O.default.disconnectVideoStreamFromVideoElement(m,!1))}startLocalVideoTile(){if(this.audioVideoController.configuration.meetingFeatures.videoMaxResolution===w.default.VideoDisabled)return this.logger.warn("Could not start camera video because max video resolution was set to None"),-1;let o=this.findOrCreateLocalVideoTile();return this.currentLocalTile.stateRef().localTileStarted=!0,this.audioVideoController.update({needsRenegotiation:!0}),o.id()}stopLocalVideoTile(){this.currentLocalTile&&(this.currentLocalTile.stateRef().localTileStarted=!1,this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId),this.audioVideoController.update({needsRenegotiation:!0}))}hasStartedLocalVideoTile(){return!!(this.currentLocalTile&&this.currentLocalTile.stateRef().localTileStarted)}removeLocalVideoTile(){this.currentLocalTile&&this.removeVideoTile(this.currentLocalTile.id())}getLocalVideoTile(){return this.currentLocalTile}pauseVideoTile(o){let p=this.getVideoTile(o);p&&(this.currentPausedTilesByIds.has(o)||(this.audioVideoController.pauseReceivingStream(p.stateRef().streamId),this.currentPausedTilesByIds.add(o)),p.pause())}unpauseVideoTile(o){let p=this.getVideoTile(o);p&&(this.currentPausedTilesByIds.has(o)&&(this.audioVideoController.resumeReceivingStream(p.stateRef().streamId),this.currentPausedTilesByIds.delete(o)),p.unpause())}getVideoTile(o){return this.tileMap.has(o)?this.tileMap.get(o):null}getVideoTileArea(o){let p=o.state(),f=0,m=0;return p.boundVideoElement&&(f=p.boundVideoElement.clientHeight*p.devicePixelRatio,m=p.boundVideoElement.clientWidth*p.devicePixelRatio),f*m}getAllRemoteVideoTiles(){let o=[];return this.tileMap.forEach((p,f)=>{this.currentLocalTile&&f===this.currentLocalTile.id()||o.push(p)}),o}getAllVideoTiles(){return Array.from(this.tileMap.values())}addVideoTile(o=!1){let p=this.nextTileId;this.nextTileId+=1,this.createDevicePixelRatioMonitorIfNeeded();let f=this.tileFactory.makeTile(p,o,this,this.devicePixelRatioMonitor,this.createResolutionMonitor(p));return this.tileMap.set(p,f),f}removeVideoTile(o){if(!this.tileMap.has(o))return;let p=this.tileMap.get(o);this.currentLocalTile===p&&(this.currentLocalTile=null),p.destroy(),this.tileMap.delete(o),this.audioVideoController.forEachObserver(p=>{M.Maybe.of(p.videoTileWasRemoved).map(f=>f.bind(p)(o))}),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(o){let p=[];for(let f of this.getAllVideoTiles()){let m=f.state();m.boundAttendeeId===o&&(this.removeVideoTile(m.tileId),p.push(m.tileId))}return p}removeAllVideoTiles(){for(let o of Array.from(this.tileMap.keys()))this.removeVideoTile(o)}sendTileStateUpdate(o){this.audioVideoController.forEachObserver(p=>{M.Maybe.of(p.videoTileDidUpdate).map(f=>f.bind(p)(o))})}haveVideoTilesWithStreams(){for(let o of this.getAllVideoTiles())if(o.state().boundVideoStream)return!0;return!1}haveVideoTileForAttendeeId(o){return!!this.getVideoTileForAttendeeId(o)}getVideoTileForAttendeeId(o){for(let p of this.getAllVideoTiles())if(p.state().boundAttendeeId===o)return p}captureVideoTile(o){let p=this.getVideoTile(o);return p?p.capture():null}registerVideoTileResolutionObserver(o){this.resolutionObservers.add(o)}removeVideoTileResolutionObserver(o){this.resolutionObservers.delete(o)}notifyResolutionObserversOfChange(o,p,f){for(let m of this.resolutionObservers)m.videoTileResolutionDidChange(o,p,f)}notifyRemoteObserversOfUnbound(o){for(let p of this.resolutionObservers)p.videoTileUnbound(o)}createResolutionMonitor(o){let p=new class{constructor(o,p){this.controller=o,this.tileId=p}videoElementResolutionChanged(o,p){let f=this.controller.getVideoTile(this.tileId);if(f){let m=f.state().boundAttendeeId;this.controller.notifyResolutionObserversOfChange(m,o,p)}}}(this,o),f=new x.default;return f.registerObserver(p),f}findOrCreateLocalVideoTile(){return this.currentLocalTile||(this.currentLocalTile=this.addVideoTile(!0),this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId)),this.currentLocalTile}}},0x168367eac:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x4c923b82));p.default=class{makeTile(o,p,f,m,w){return new _.default(o,p,f,m,w)}}},0x6e3f6fb5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x16364c8d1:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14216d675)),w=m(f(0x2293b1f8c)),I=f(0xb529932d),k=m(f(0xb40abe4c)),M=m(f(0x6e3f6fb5)),x=class DefaultSimulcastUplinkPolicy{constructor(o,p){this.selfAttendeeId=o,this.logger=p,this.numSenders=0,this.shouldDisableSimulcast=!1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.videoIndex=null,this.observerQueue=new Set,this.hiTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsHd,this.enableFhdVideo=!1,this.optimalParameters=new k.default(0,0,0,0,!0),this.parametersInEffect=new k.default(0,0,0,0,!0),this.currentQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps]),this.newQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps])}updateConnectionMetric(o){}calculateEncodingParameters(){let o=[new M.default,new M.default,new M.default];this.shouldDisableSimulcast?(this.newActiveStreams=0,o[0].maxBitrateKbps=0,o[1].maxBitrateKbps=this.hiTargetBitrateKbps,o[2].maxBitrateKbps=0):this.numSenders<=4?(this.newActiveStreams=1,o[0].maxBitrateKbps=this.lowTargetBitrateKbps,o[1].maxBitrateKbps=0,o[2].maxBitrateKbps=this.hiTargetBitrateKbps):(this.newActiveStreams=2,o[0].maxBitrateKbps=2*this.lowTargetBitrateKbps/3,o[1].maxBitrateKbps=this.numSenders<=6?this.midTargetBitrateKbps:.6*this.midTargetBitrateKbps,o[2].maxBitrateKbps=0);let p=o.map((o,p,f)=>o.maxBitrateKbps);return this.newQualityMap=this.fillEncodingParamWithBitrates(p),this.encodingParametersEqual()||this.logger.info(`simulcast: policy:calculateEncodingParameters numSources:${this.numSenders} shouldDisableSimulcast:${this.shouldDisableSimulcast} newQualityMap: ${this.getQualityMapString(this.newQualityMap)}`),this.newQualityMap}chooseMediaTrackConstraints(){}chooseEncodingParameters(){return this.currentQualityMap=this.newQualityMap,this.activeStreamsToPublish!==this.newActiveStreams&&(this.activeStreamsToPublish=this.newActiveStreams,this.publishEncodingSimulcastLayer()),this.currentQualityMap}updateIndex(o){let p=o.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+1,f=p!==this.numSenders,m=o.numberOfParticipants(),_=m>=0&&m<=2,w=this.shouldDisableSimulcast!==_;this.numSenders=p,this.shouldDisableSimulcast=_,this.optimalParameters=new k.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=o,(f||w)&&(this.newQualityMap=this.calculateEncodingParameters())}wantsResubscribe(){return!this.encodingParametersEqual()}compareEncodingParameter(o,p){return JSON.stringify(o)===JSON.stringify(p)}encodingParametersEqual(){let o=!1;for(let p of w.default.NAME_ARR_ASCENDING)if(o=o||!this.compareEncodingParameter(this.newQualityMap.get(p),this.currentQualityMap.get(p)))break;return!o}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){return this.enableFhdVideo?1920:1280}captureHeight(){return this.enableFhdVideo?1080:768}captureFrameRate(){return 15}maxBandwidthKbps(){return this.enableFhdVideo?2500:1400}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){this.enableFhdVideo=o,this.hiTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsHd}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!0}fillEncodingParamWithBitrates(o){let p=new Map,f=w.default.NAME_ARR_ASCENDING,m=this.shouldDisableSimulcast?1:4;for(let _=0;_<f.length;_++){let w=f[_];p.set(w,{rid:w,active:o[_]>0,scaleResolutionDownBy:Math.max(m,1),maxBitrate:1e3*o[_]}),m/=2}return p}getQualityMapString(o){let p="";return 3===this.videoIndex.localStreamDescriptions().length&&o.forEach(o=>{p+=`{ rid: ${o.rid} active:${o.active} maxBitrate:${o.maxBitrate}}`}),p}getEncodingSimulcastLayer(o){switch(o){case 0:return _.default.High;case 1:return _.default.LowAndHigh;case 2:return _.default.LowAndMedium}}publishEncodingSimulcastLayer(){let o=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver(p=>{I.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}addObserver(o){this.logger.info("adding simulcast uplink observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing simulcast uplink observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)o(p)}};p.default=x,x.kHiTargetBitrateKbpsHd=1200,x.kMidTargetBitrateKbpsHd=600,x.kLowTargetBitrateKbpsHd=300,x.kHiTargetBitrateKbpsFhd=2e3,x.kMidTargetBitrateKbpsFhd=1e3,x.kLowTargetBitrateKbpsFhd=500},0x111b8e0a0:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xdeeb6fe4));p.default=class{constructor(o,p){this.encodingParams=p,this.enableUhdContent=!1,this.defaultHiTargetBitrateKbps=1200,this.defaultLowTargetBitrateKbps=300}updateConnectionMetric(o){}chooseMediaTrackConstraints(){}chooseEncodingParameters(){var o,p,f,m,w,I,k,M,x,O,L,B;let U=new Map,$=_.default.NAME_ARR_ASCENDING;return U.set($[0],{rid:$[0],active:!0,scaleResolutionDownBy:(null==(p=null==(o=this.encodingParams)?void 0:o.low)?void 0:p.scaleResolutionDownBy)||2,maxBitrate:1e3*((null==(m=null==(f=this.encodingParams)?void 0:f.low)?void 0:m.maxBitrateKbps)||this.defaultLowTargetBitrateKbps),maxFramerate:(null==(I=null==(w=this.encodingParams)?void 0:w.low)?void 0:I.maxFramerate)||5}),U.set($[1],{rid:$[1],active:!0,scaleResolutionDownBy:(null==(M=null==(k=this.encodingParams)?void 0:k.high)?void 0:M.scaleResolutionDownBy)||1,maxBitrate:1e3*((null==(O=null==(x=this.encodingParams)?void 0:x.high)?void 0:O.maxBitrateKbps)||this.defaultHiTargetBitrateKbps),maxFramerate:null==(B=null==(L=this.encodingParams)?void 0:L.high)?void 0:B.maxFramerate}),U}updateIndex(o){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){}maxBandwidthKbps(){return this.enableUhdContent?2e3:1200}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){this.enableUhdContent=o,this.defaultHiTargetBitrateKbps=o?2e3:1200,this.defaultLowTargetBitrateKbps=o?500:300}addObserver(o){}removeObserver(o){}forEachObserver(o){}}},0xb231bce1:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xb40abe4c)),I=class NScaleVideoUplinkBandwidthPolicy{constructor(o,p=!0,f,m){this.selfAttendeeId=o,this.scaleResolution=p,this.logger=f,this.browserBehavior=m,this.numberOfPublishedVideoSources=void 0,this.idealMaxBandwidthKbps=1500,this.hasBandwidthPriority=!1,this.encodingParamMap=new Map,this.enableHighResolutionFeature=!1,this.enableSVC=!1,this.isUsingSVCCodec=!0,this.numParticipants=0,this.reset()}reset(){this.numberOfPublishedVideoSources=void 0,this.optimalParameters=new w.default(0,0,0,0,!1),this.parametersInEffect=new w.default(0,0,0,0,!1),this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(o){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(o){var p;let f=!0;this.transceiverController&&(f=this.transceiverController.hasVideoInput());let m=o.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+ +!!f,_=o.numberOfParticipants();if(this.numParticipants===_&&this.numberOfPublishedVideoSources===m){null==(p=this.logger)||p.debug("Skipping update index; Number of participants has not changed");return}this.numberOfPublishedVideoSources=m,this.numParticipants=_,this.updateOptimalParameters()}wantsResubscribe(){return!this.parametersInEffect.equal(this.optimalParameters)}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}updateOptimalParameters(){let o=1;if(this.transceiverController){let p=this.getStreamCaptureSetting();p&&(o=this.calculateEncodingParameters(p).scaleResolutionDownBy)}this.optimalParameters=new w.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,o,this.enableSVC&&this.numParticipants>2&&this.isUsingSVCCodec)}captureWidth(){let o=640;return this.getNumberOfPublishedVideoSources()>4&&(o=320),o}captureHeight(){let o=384;return this.getNumberOfPublishedVideoSources()>4&&(o=192),o}captureFrameRate(){return 15}maxBandwidthKbps(){if(this.hasBandwidthPriority)return Math.trunc(this.idealMaxBandwidthKbps);return Math.trunc(2>=this.getNumberOfPublishedVideoSources()?this.idealMaxBandwidthKbps:4>=this.getNumberOfPublishedVideoSources()?2*this.idealMaxBandwidthKbps/3:(544/11+14880/(11*this.getNumberOfPublishedVideoSources()))/600*this.idealMaxBandwidthKbps)}setIdealMaxBandwidthKbps(o){this.idealMaxBandwidthKbps=o}setHasBandwidthPriority(o){this.hasBandwidthPriority=o}setTransceiverController(o){this.transceiverController=o}setSVCEnabled(o){var p;this.enableSVC=o,null==(p=this.logger)||p.info(`setSVCEnabled, enable: ${o}}`)}setHighResolutionFeatureEnabled(o){this.enableHighResolutionFeature=o}updateTransceiverController(){return m(this,void 0,void 0,function*(){let o=this.getStreamCaptureSetting();if(!o)return;let p=this.calculateEncodingParameters(o);this.shouldUpdateEndcodingParameters(p)&&(this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey,p),this.transceiverController.setEncodingParameters(this.encodingParamMap))})}shouldUpdateEndcodingParameters(o){var p,f;let m=null==(f=null==(p=this.transceiverController.localVideoTransceiver().sender.getParameters())?void 0:p.encodings)?void 0:f[0];return o.maxBitrate!==(null==m?void 0:m.maxBitrate)||o.scaleResolutionDownBy!==(null==m?void 0:m.scaleResolutionDownBy)||(null==o?void 0:o.scalabilityMode)!==(null==m?void 0:m.scalabilityMode)}calculateEncodingParameters(o){var p,f,m;let _=1e3*this.maxBandwidthKbps(),w=1,I=720;if(void 0!==o.height&&void 0!==o.width&&this.scaleResolution&&!this.hasBandwidthPriority&&this.getNumberOfPublishedVideoSources()>2&&(480===(I=NScaleVideoUplinkBandwidthPolicy.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),NScaleVideoUplinkBandwidthPolicy.targetHeightArray.length-1)][+!!this.enableHighResolutionFeature])&&(null==(p=this.browserBehavior)?void 0:p.disable480pResolutionScaleDown())&&(I=360),w=Math.max(Math.min(o.height,o.width)/I,1),null==(f=this.logger)||f.info(`Resolution scale factor is ${w} for capture resolution ${o.width}x${o.height}. New dimension is ${o.width/w}x${o.height/w}`)),!this.enableSVC)return{scaleResolutionDownBy:w,maxBitrate:_};{let o;return o=this.numParticipants>=0&&this.numParticipants<3||!this.isUsingSVCCodec?"L1T1":"L3T3",null==(m=this.logger)||m.info(`calculateEncodingParameters: SVC: ${this.enableSVC}    participants: ${this.numParticipants}     publishers: ${this.getNumberOfPublishedVideoSources()}     bitrate: ${_}  targetHeight: ${I}  scalabilityMode: ${o}   isUsingSVCCodec: ${this.isUsingSVCCodec}`),{scaleResolutionDownBy:w,maxBitrate:_,scalabilityMode:o}}}getStreamCaptureSetting(){var o,p,f,m;return null==(m=null==(f=null==(p=null==(o=this.transceiverController)?void 0:o.localVideoTransceiver())?void 0:p.sender)?void 0:f.track)?void 0:m.getSettings()}getNumberOfPublishedVideoSources(){var o;return null!=(o=this.numberOfPublishedVideoSources)?o:0}wantsVideoDependencyDescriptorRtpHeaderExtension(){return this.enableSVC}setMeetingSupportedVideoSendCodecs(o,p){let f=null!=o?o:p,m=f.length>0&&NScaleVideoUplinkBandwidthPolicy.SVCCodecNames.includes(f[0].codecName);m!==this.isUsingSVCCodec&&(this.isUsingSVCCodec=m,this.updateOptimalParameters())}};p.default=I,I.encodingMapKey="video",I.targetHeightArray=[[0,0],[0,0],[0,0],[540,720],[540,720],[480,540],[480,540],[480,540],[480,540],[360,480],[360,480],[360,480],[360,480],[270,360],[270,360],[270,360],[270,360],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270]],I.SVCCodecNames=["VP9"]},0x1a94aa22a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xb40abe4c));p.default=class{updateConnectionMetric(o){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(o){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new _.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!1}}},0xfc7acd24:(o,p)=>{"use strict";function stringify(o){return o.map(o=>"object"==typeof o?JSON.stringify(o):`${o}`).join(" ")}Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.base=o}debug(...o){this.base.debug(stringify(o))}info(...o){this.base.info(stringify(o))}warn(...o){this.base.warn(stringify(o))}error(...o){this.base.error(stringify(o))}}},0x21f91d24:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.VoiceFocusDeviceTransformer=void 0;let w=f(0x166a4bc39),I=f(0x149d24991),k=_(f(0xaf1ae5b3)),M=_(f(0xfc7acd24)),x=_(f(0xd91ec153)),O=_(f(0x3b476f1c)),L=class VoiceFocusDeviceTransformer{constructor(o,{preload:p=!0,logger:f,fetchBehavior:m=VoiceFocusDeviceTransformer.defaultFetchBehavior()},_){this.spec=o,this.supported=!0,this.logger=f,this.vfLogger=f?new M.default(f):void 0,this.preload=p,this.fetchBehavior=m,this.spec=VoiceFocusDeviceTransformer.augmentSpec(this.spec),_&&(this.configuration=Promise.resolve(_))}static isSupported(o,p){var f,m;let _=VoiceFocusDeviceTransformer.defaultFetchBehavior(),k=(null==p?void 0:p.logger)?new M.default(p.logger):void 0;if(I.isIFramed())if((null==p?void 0:p.allowIFrame)===!1)return null==(f=null==p?void 0:p.logger)||f.error("Amazon Voice Focus support check inside iframe: not supported."),Promise.resolve(!1);else null==(m=null==p?void 0:p.logger)||m.warn("Amazon Voice Focus support check inside iframe: not recommended.");return w.VoiceFocus.isSupported(VoiceFocusDeviceTransformer.augmentSpec(o),{fetchBehavior:_,logger:k})}static create(o={},p={},f,_,w){var I,k,M;return m(this,void 0,void 0,function*(){_&&_.Meeting.Meeting&&(_=_.Meeting);let m=(null==(M=null==(k=null==(I=null==_?void 0:_.Meeting)?void 0:I.MeetingFeatures)?void 0:k.Audio)?void 0:M.EchoReduction)==="AVAILABLE",w=f&&!0===f.supported&&"ns_es"===f.model.name&&!m,x="ns_es"===o.name&&!m;if(w||x)throw Error("Echo Reduction requested but not enabled.");let O=new VoiceFocusDeviceTransformer(o,p,f);return yield O.init(),O})}static configure(o={},p={}){return m(this,void 0,void 0,function*(){return new VoiceFocusDeviceTransformer(o,p,void 0).configure(!0)})}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(o,p){return m(this,void 0,void 0,function*(){if(this.supported)try{let[f,m]=yield this.allocateVoiceFocus(!0),_=Object.assign(Object.assign({},p),{es:"ns_es"===this.spec.name});return new x.default(o,f,m,_)}catch{return}})}static destroyVoiceFocus(o){var p;return m(this,void 0,void 0,function*(){null==(p=null==o?void 0:o.vf)||p.destroy()})}static augmentSpec(o){return o&&(o.assetGroup||o.revisionID)?o:Object.assign(Object.assign({},o),{assetGroup:VoiceFocusDeviceTransformer.currentSDKAssetGroup()})}configure(o=!1){return m(this,void 0,void 0,function*(){let p={fetchBehavior:this.fetchBehavior,preResolve:o,logger:this.vfLogger};return w.VoiceFocus.configure(this.spec,p)})}init(){var o;return m(this,void 0,void 0,function*(){this.configuration||(this.configuration=this.configure());let p=yield this.configuration;if(!p.supported){this.supported=!1;return}this.pendingVoiceFocus=this.createVoiceFocus(p,this.preload);try{yield this.pendingVoiceFocus}catch(p){null==(o=this.logger)||o.error(`Unable to initialize Amazon Voice Focus: ${p}`),this.supported=!1}})}createVoiceFocus(o,p){return m(this,void 0,void 0,function*(){let f=new O.default;return this.vf=yield w.VoiceFocus.init(o,{delegate:f,preload:p,logger:this.vfLogger}),[this.vf,f]})}allocateVoiceFocus(o){return m(this,void 0,void 0,function*(){if(!this.supported)throw Error("Not supported.");if(this.pendingVoiceFocus){let o=this.pendingVoiceFocus;return this.pendingVoiceFocus=void 0,o}return this.createVoiceFocus((yield this.configuration),o)})}static majorVersion(){return k.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return k.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|(?:[1-9][0-9]*))\.(?:0|[1-9][0-9]*)/)[0]}static currentSDKAssetGroup(){let o=this.majorVersion();return o?`sdk-${o}`:"stable-v1"}static defaultFetchBehavior(){let o=VoiceFocusDeviceTransformer.majorMinorVersion()||"unknown",p=k.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(o)}&ua=${encodeURIComponent(p)}`}}};p.VoiceFocusDeviceTransformer=L,p.default=L},0xd91ec153:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4));function isDefaultDevice(o){return"default"===o||!!o&&"object"==typeof o&&("deviceId"in o&&"default"===o.deviceId||"id"in o&&"default"===o.id)}p.default=class VoiceFocusTransformDevice{constructor(o,p,f,m,_=!1,I,k=new w.default,M=new Map,x,O){this.device=o,this.voiceFocus=p,this.delegate=f,this.nodeOptions=m,this.failed=_,this.node=I,this.browserBehavior=k,this.farEndStreamToAudioSourceNode=M,this.mixDestNode=x,this.mixSourceNode=O}getInnerDevice(){return this.device}mute(o){return m(this,void 0,void 0,function*(){this.node&&(o?yield this.node.disable():yield this.node.enable())})}stop(){return m(this,void 0,void 0,function*(){this.node&&(this.node.disconnect(),yield this.node.stop())})}chooseNewInnerDevice(o){return m(this,void 0,void 0,function*(){return this.device!==o||isDefaultDevice(o)?new VoiceFocusTransformDevice(o,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode):this})}intrinsicDevice(){return m(this,void 0,void 0,function*(){let o;if(this.failed)return this.device;let p=this.nodeOptions.es,f={echoCancellation:!p,googEchoCancellation:!p,googEchoCancellation2:!p,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googNoiseSuppression2:!1};return(f.autoGainControl=o=!this.nodeOptions||void 0===this.nodeOptions.agc||this.nodeOptions.agc.useBuiltInAGC,f.googAutoGainControl=o,f.googAutoGainControl2=o,this.device)?"string"==typeof this.device?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?f.deviceId=this.device:f.deviceId={exact:this.device},f):this.device.id?this.device:Object.assign(Object.assign({},this.device),f):f})}createAudioNode(o){var p,f;return m(this,void 0,void 0,function*(){if((null==(p=this.node)?void 0:p.context)===o)return{start:this.node,end:this.node};let m=Object.assign({enabled:!0,agc:{useVoiceFocusAGC:!1}},this.nodeOptions);try{if(null==(f=this.node)||f.disconnect(),this.node=yield this.voiceFocus.createNode(o,m),this.nodeOptions.es){for(let p of(this.mixDestNode=new MediaStreamAudioDestinationNode(o,{channelCount:1,channelCountMode:"explicit"}),this.farEndStreamToAudioSourceNode.keys()))this.assignFarEndStreamToAudioSourceNode(p);this.createMixSourceNode()}let p=this.node,_=this.node;return{start:p,end:_}}catch(o){throw this.failed=!0,this.delegate.onFallback(this,o),o}})}observeMeetingAudio(o){return m(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;o.addAudioMixObserver(this);let p=yield o.getCurrentMeetingAudioStream();p&&this.addFarEndStream(p)})}unObserveMeetingAudio(o){return m(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;o.removeAudioMixObserver(this);let p=yield o.getCurrentMeetingAudioStream();p&&this.removeFarendStream(p)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}addFarEndStream(o){return m(this,void 0,void 0,function*(){!this.nodeOptions.es||!o||this.farEndStreamToAudioSourceNode.has(o)||(this.node?this.assignFarEndStreamToAudioSourceNode(o):this.farEndStreamToAudioSourceNode.set(o,null))})}removeFarendStream(o){var p;return m(this,void 0,void 0,function*(){null==(p=this.farEndStreamToAudioSourceNode.get(o))||p.disconnect(),this.farEndStreamToAudioSourceNode.delete(o)})}meetingAudioStreamBecameActive(o){return m(this,void 0,void 0,function*(){this.addFarEndStream(o)})}meetingAudioStreamBecameInactive(o){return m(this,void 0,void 0,function*(){this.removeFarendStream(o)})}assignFarEndStreamToAudioSourceNode(o){let p=this.node.context.createMediaStreamSource(o);p.channelCount=1,p.channelCountMode="explicit",this.farEndStreamToAudioSourceNode.set(o,p),p.connect(this.mixDestNode,0)}createMixSourceNode(){this.mixSourceNode=this.node.context.createMediaStreamSource(this.mixDestNode.stream),this.mixSourceNode.channelCount=1,this.mixSourceNode.channelCountMode="explicit",this.mixSourceNode.connect(this.node,0,1)}}},0x3b476f1c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}onFallback(o,p){var f;for(let m of this.observers)null==(f=m.voiceFocusFellBackToInnerStream)||f.call(m,o,p)}onCPUWarning(){var o;for(let p of this.observers)null==(o=p.voiceFocusInsufficientResources)||o.call(p)}}},0x194492f4c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class DefaultVolumeIndicatorAdapter{constructor(o,p,f,m,_){this.logger=o,this.realtimeController=p,this.minVolumeDecibels=f,this.maxVolumeDecibels=m,this.selfAttendeeId=_,this.streamIdToAttendeeId={},this.streamIdToExternalUserId={},this.warnedAboutMissingStreamIdMapping={},this.attendeeIdToStreamId={},this.sessionReconnected=!1}onReconnect(){this.sessionReconnected=!0}sendRealtimeUpdatesForAudioStreamIdInfo(o){let p=0;for(let f of o.streams){let m=!!f.attendeeId,_=!!f.externalUserId,w=f.hasOwnProperty("muted"),I=!!f.dropped;if(m){this.attendeeIdToStreamId[f.attendeeId]&&this.attendeeIdToStreamId[f.attendeeId]<f.audioStreamId&&delete this.attendeeIdToStreamId[f.attendeeId],this.streamIdToAttendeeId[f.audioStreamId]=f.attendeeId;let m=_?f.externalUserId:f.attendeeId;this.streamIdToExternalUserId[f.audioStreamId]=m,this.attendeeIdToStreamId[f.attendeeId]=f.audioStreamId,this.realtimeController.realtimeSetAttendeeIdPresence(f.attendeeId,!0,m,!1,{attendeeIndex:p++,attendeesInFrame:o.streams.length})}if(w){let o=this.streamIdToAttendeeId[f.audioStreamId],p=this.streamIdToExternalUserId[f.audioStreamId];this.realtimeController.realtimeUpdateVolumeIndicator(o,null,f.muted,null,p)}if(!m&&!w){let m=this.streamIdToAttendeeId[f.audioStreamId];if(m){let _=this.streamIdToExternalUserId[f.audioStreamId];delete this.streamIdToAttendeeId[f.audioStreamId],delete this.streamIdToExternalUserId[f.audioStreamId],delete this.warnedAboutMissingStreamIdMapping[f.audioStreamId],this.attendeeIdToStreamId[m]===f.audioStreamId&&delete this.attendeeIdToStreamId[m];let w=!1;for(let o of Object.keys(this.streamIdToAttendeeId)){let p=parseInt(o);if(p>f.audioStreamId&&this.streamIdToAttendeeId[p]===m){w=!0;break}}w||this.realtimeController.realtimeSetAttendeeIdPresence(m,!1,_,I,{attendeeIndex:p++,attendeesInFrame:o.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(o),this.sessionReconnected=!1)}cleanUpState(o){let p=Object.values(this.streamIdToAttendeeId),f=o.streams.map(o=>o.attendeeId);for(let[o,m]of p.filter(o=>!f.includes(o)).entries()){let p=this.attendeeIdToStreamId[m],f=this.streamIdToExternalUserId[p];if(delete this.streamIdToAttendeeId[p],delete this.streamIdToExternalUserId[p],delete this.warnedAboutMissingStreamIdMapping[p],delete this.attendeeIdToStreamId[m],m===this.selfAttendeeId){this.logger.warn("the volume indicator adapter cleans up the current attendee (presence = false) after reconnection");continue}this.realtimeController.realtimeSetAttendeeIdPresence(m,!1,f,!1,{attendeeIndex:o,attendeesInFrame:m.length})}}sendRealtimeUpdatesForAudioMetadata(o){let p=null,f=null;for(let m of o.attendeeStates){let o=this.attendeeIdForStreamId(m.audioStreamId);m.hasOwnProperty("volume")&&(null===p&&(p={}),null!==o&&(p[o]=this.normalizedVolume(m))),m.hasOwnProperty("signalStrength")&&(null===f&&(f={}),null!==o&&(f[o]=this.normalizedSignalStrength(m)))}this.applyRealtimeUpdatesForAudioMetadata(p,f)}normalizedVolume(o){return Math.min(Math.max(1-(-o.volume-this.maxVolumeDecibels)/(this.minVolumeDecibels-this.maxVolumeDecibels),0),1)}normalizedSignalStrength(o){return Math.min(Math.max(o.signalStrength/DefaultVolumeIndicatorAdapter.MAX_SIGNAL_STRENGTH_LEVELS,0),1)}applyRealtimeUpdatesForAudioMetadata(o,p){for(let f in this.streamIdToAttendeeId){let m=this.streamIdToAttendeeId[f],_=this.streamIdToExternalUserId[f],w=null,I=null;null!==o&&(w=o.hasOwnProperty(m)?o[m]:DefaultVolumeIndicatorAdapter.IMPLICIT_VOLUME),null!==p&&(I=p.hasOwnProperty(m)?p[m]:DefaultVolumeIndicatorAdapter.IMPLICIT_SIGNAL_STRENGTH),(null!==w||null!==I)&&this.realtimeController.realtimeUpdateVolumeIndicator(m,w,null,I,_)}}attendeeIdForStreamId(o){if(0===o)return null;let p=this.streamIdToAttendeeId[o];return p||(this.warnedAboutMissingStreamIdMapping[o]||(this.warnedAboutMissingStreamIdMapping[o]=!0,this.logger.warn(`volume indicator stream id ${o} seen before being defined`)),null)}};p.default=f,f.MAX_SIGNAL_STRENGTH_LEVELS=2,f.IMPLICIT_VOLUME=0,f.IMPLICIT_SIGNAL_STRENGTH=1},0x5cfde354:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xaf1ae5b3)),w=m(f(0x165cc79a4));p.default=class{constructor(o){this.logger=o}create(o,p,f){this.connection=new WebSocket(f?o:_.default.urlWithVersion(o),p),this.connection.binaryType="arraybuffer"}send(o){if(!this.connection)return this.logger.error("WebSocket not yet created or already destroyed."),!1;try{return o instanceof Uint8Array?this.connection.send(o.buffer):this.connection.send(o),!0}catch(o){return this.logger.debug(()=>`send error: ${o.message}, websocket state=${w.default[this.readyState()]}`),!1}}close(o,p){var f;null==(f=this.connection)||f.close(o,p)}destroy(){this.connection=void 0}addEventListener(o,p){this.connection?this.connection.addEventListener(o,p):this.logger.warn("Cannot add event listener with no WebSocket connection.")}removeEventListener(o,p){var f;null==(f=this.connection)||f.removeEventListener(o,p)}readyState(){if(!this.connection)return w.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return w.default.Connecting;case WebSocket.OPEN:return w.default.Open;case WebSocket.CLOSING:return w.default.Closing;case WebSocket.CLOSED:return w.default.Closed}}}},0x165cc79a4:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.WebSocketReadyState=void 0,(m=f=p.WebSocketReadyState||(p.WebSocketReadyState={}))[m.None=0]="None",m[m.Connecting=1]="Connecting",m[m.Open=2]="Open",m[m.Closing=3]="Closing",m[m.Closed=4]="Closed",p.default=f},0x808e38bb:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.decideModel=p.measureAndDecideExecutionApproach=void 0;let _=f(0x2037185f8),w=f(0x19eda6376),I=3,k={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}},M=class{constructor(o,p){this.fetchConfig=o,this.logger=p;const f=`${o.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:o.headers,escapedQueryString:o.escapedQueryString},this.worker=(0,_.loadWorker)(f,"VoiceFocusEstimator",this.fetchBehavior,p)}roundtrip(o,p,f){return new Promise((m,_)=>{this.worker.then(_=>{let w;w=o=>{let{message:I,key:k}=o.data;I===p&&k===f&&(_.removeEventListener("message",w),m(o.data))},_.addEventListener("message",w),_.postMessage(o)}).catch(o=>{var p;null==(p=this.logger)||p.error("Failed to load worker.",o),_(o)})})}supportsSIMD(o){let p="simd",f=o||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,m={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:f,key:p};return this.roundtrip(m,"simd-support",p).then(o=>o.supports)}measure(o,p){let f=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,m=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,_=`bench:${o}`,w={message:"measure",fetchBehavior:this.fetchBehavior,budget:p,path:o?m:f,key:_};return this.roundtrip(w,"measurement",_).then(o=>{if(o.measurement)return o.measurement;throw Error("Failed to measure.")})}stop(){this.worker.then(o=>{var p;null==(p=this.logger)||p.debug("Stopping estimator worker."),o.terminate()}).catch(o=>{})}},featureCheck=(o,p,f,_)=>m(void 0,void 0,void 0,function*(){let m={supportsSIMD:o,supportsSAB:(0,w.supportsSharedArrayBuffer)(globalThis,window,f),duration:-1};if(o)return null==f||f.info("Supports SIMD: true (force)"),m;let I=_||new M(p,f);try{let p=!(0,w.isOldChrome)(window,f)&&(yield I.supportsSIMD());return null==f||f.info(`Supports SIMD: ${p} (force: ${o})`),m.supportsSIMD=p,m}finally{_||I.stop()}});p.measureAndDecideExecutionApproach=(o,p,f,_=k)=>m(void 0,void 0,void 0,function*(){let x,O=o.executionPreference,{usagePreference:L,variantPreference:B,namePreference:U,simdPreference:$,estimatorBudget:q,executionQuantaPreference:Z}=o;"interactivity"===L&&"inline"!==O&&(null==f||f.debug(`Overriding execution preference ${O} to reflect interactivity preference.`),O="inline");let ee="force"===$,et="auto"!==B,ei="auto"!==O;try{if(et&&ei)x=yield featureCheck(ee,p,f);else x=yield m(void 0,void 0,void 0,function*(){let o=new M(p,f);try{let m=yield featureCheck(ee,p,f,o);if(m.supportsSIMD)try{return m.duration=yield o.measure(!0,q),null==f||f.info("SIMD timing:",m.duration),m}catch{null==f||f.warn("Failed SIMD estimation; falling back to non-SIMD."),m.supportsSIMD=!1}return m.duration=yield o.measure(!1,q),null==f||f.info("No-SIMD timing:",m.duration),m}catch(o){throw null==f||f.error("Could not feature check.",o),o}finally{o.stop()}})}catch(o){throw null==f||f.error("Could not load estimator.",o),Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:o,supportsSAB:p,duration:f,executionPreference:m="auto",simdPreference:_,variantPreference:M="auto",namePreference:x="default",usagePreference:O,executionQuantaPreference:L=I},B=k,U)=>{let $="force"===_||"disable"!==_&&o,q=-1!==f,Z=q?($?2.5:2.63)/f:0,ee=$?B.simd:B.wasm,et=q?(1===L?.6:"quality"===O?.65*L:.5*L)*Z:0,ei=q?.7*Z:0,unsupported=o=>({supported:!1,reason:o});if(q){if(Z<ee.noSupport)return unsupported(`Performance score ${Z} worse than threshold ${ee.noSupport}.`)}else if("auto"===m||"auto"===M)return unsupported(`Missing explicit execution (${m}) or variant (${M}) preference, but no scoring performed.`);null==U||U.debug(`Bench duration ${f} yields inline score ${et} and worker score ${ei}.`);let succeed=(o,p,f)=>({supported:!0,useSIMD:$,processor:o,executionApproach:p,variant:f,executionQuanta:"inline"===p?L:void 0,name:x}),resolveVariant=(o,p,f)=>"auto"!==p?!q||o>f[p]?p:"failed":o>f.c100?"c100":o>f.c50?"c50":o>f.c20?"c20":o>f.c10?"c10":"failed",reducePreference=o=>{switch(o||"auto"){case"auto":{let o=reducePreference("inline"),p=reducePreference("worker");if(null==U||U.debug(`Reducing auto preference: ${JSON.stringify(o)} vs ${JSON.stringify(p)}`),!1===o.supported||!1===p.supported)return p;if(o.variant===p.variant||"c50"===o.variant)return o;return p}case"worker":if((0,w.supportsSharedArrayBuffer)(globalThis,window,U))return reducePreference("worker-sab");return reducePreference("worker-postMessage");case"inline":{let o=resolveVariant(et,M,ee.inline);if("failed"===o)return unsupported(`Performance score ${et} not sufficient for inline use with variant preference ${M}.`);return succeed("voicefocus-inline-processor","inline",o)}case"worker-sab":{if(!p){let o="Requested worker-sab but no SharedArrayBuffer support.";return null==U||U.warn(o),{supported:!1,reason:o}}let o=resolveVariant(ei,M,ee.worker);if("failed"===o)return unsupported(`Performance score ${ei} not sufficient for worker use with variant preference ${M}.`);return succeed("voicefocus-worker-sab-processor","worker-sab",o)}case"worker-postMessage":{let o=resolveVariant(ei,M,ee.worker);if("failed"===o)return unsupported(`Performance score ${ei} not sufficient for worker use.`);if("ns_es"===x){let o="Requested echo suppression but postMessage executor does not support it.";return null==U||U.warn(o),{supported:!1,reason:o}}return succeed("voicefocus-worker-postMessage-processor","worker-postMessage",o)}}};return reducePreference(m)})(Object.assign(Object.assign({},x),{simdPreference:$,executionPreference:O,variantPreference:B,namePreference:U,usagePreference:L,executionQuantaPreference:Z}),_,f)}),p.decideModel=({category:o,name:p,variant:f,simd:m,url:_})=>`${o}-${p}-${f}-v1${m?"_simd":""}`},0x8c0c7fbd:(o,p)=>{"use strict";function fetchWithBehavior(o,p,f){return f?fetch(withQueryString(o,f),withRequestHeaders(p,f)):fetch(o,p)}function withRequestHeaders(o,p){return(null==p?void 0:p.headers)?o?Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},o.headers||{}),p.headers)}):{headers:p.headers}:o}function withQueryString(o,p){if(!(null==p?void 0:p.escapedQueryString))return o;let f=-1!==o.lastIndexOf("?");return`${o}${f?"&":"?"}${p.escapedQueryString}`}Object.defineProperty(p,"__esModule",{value:!0}),p.isValidRevisionID=p.isValidAssetGroup=p.resolveURL=p.addQueryParams=p.withQueryString=p.withRequestHeaders=p.fetchWithBehavior=void 0,p.fetchWithBehavior=fetchWithBehavior,p.withRequestHeaders=withRequestHeaders,p.withQueryString=withQueryString,p.addQueryParams=function(o,p){let f=Object.keys(p);if(!f.length)return o;let m=new URLSearchParams(null==o?void 0:o.escapedQueryString);for(let o of f)m.append(o,p[o]);return Object.assign(Object.assign({},o),{escapedQueryString:m.toString()})};let f={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};p.resolveURL=function(o,p){return fetchWithBehavior(o,f,p).then(p=>p.redirected?p.url:o)},p.isValidAssetGroup=function(o){return!!o&&/^[-.a-zA-Z0-9]+$/.test(o)},p.isValidRevisionID=function(o){return!!o&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(o)}},0x2037185f8:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.loadWorker=void 0;let m=f(0x8c0c7fbd),_={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};p.loadWorker=(o,p,f,w)=>{null==w||w.debug(`Loading ${p} worker from ${o}.`);let I=!1;try{I=self.origin===new URL(o).origin}catch(o){null==w||w.error("Could not compare origins.",o)}return I?Promise.resolve(new Worker((0,m.withQueryString)(o,f),{name:p})):(0,m.fetchWithBehavior)(o,_,f).then(o=>{if(o.ok)return o.blob().then(o=>new Worker(window.URL.createObjectURL(o)));throw Error("Fetch failed.")})}},0x19eda6376:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.isOldChrome=p.supportsWASMStreaming=p.supportsSharedArrayBuffer=p.supportsWASM=p.supportsAudioWorklet=p.supportsWorker=p.supportsVoiceFocusWorker=p.supportsWASMPostMessage=p.isSafari=void 0;let _=f(0x2037185f8);p.isSafari=(o=globalThis)=>{let p=o.navigator.userAgent,f=p.match(/Safari\//),m=p.match(/Chrom(?:e|ium)\//);return!!(f&&!m)},p.supportsWASMPostMessage=(o=globalThis)=>!(0,p.isSafari)(o)&&(!((o=globalThis)=>!!o.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/))(o)||95>(chromeVersion(o)||0)),p.supportsVoiceFocusWorker=(o=globalThis,f,w)=>m(void 0,void 0,void 0,function*(){if(!(0,p.supportsWorker)(o,w))return!1;let m=`${f.paths.workers}worker-v1.js`;try{let o=yield(0,_.loadWorker)(m,"VoiceFocusTestWorker",f,w);try{o.terminate()}catch(o){null==w||w.debug("Failed to terminate worker.",o)}return!0}catch(o){return null==w||w.info("Failed to fetch and instantiate test worker",o),!1}}),p.supportsWorker=(o=globalThis,p)=>{try{return!!o.Worker}catch(o){return null==p||p.info("Does not support Worker",o),!1}},p.supportsAudioWorklet=(o=globalThis,p)=>{try{return!!o.AudioWorklet&&!!o.AudioWorkletNode}catch(o){return null==p||p.info("Does not support Audio Worklet",o),!1}},p.supportsWASM=(o=globalThis,p)=>{try{return!!o.WebAssembly&&(!!o.WebAssembly.compile||!!o.WebAssembly.compileStreaming)}catch(o){return null==p||p.info("Does not support WASM",o),!1}},p.supportsSharedArrayBuffer=(o=globalThis,p=globalThis,f)=>{try{return!!o.SharedArrayBuffer&&(!!p.chrome||!!o.crossOriginIsolated)}catch{return null==f||f.info("Does not support SharedArrayBuffer."),!1}},p.supportsWASMStreaming=(o=globalThis,p)=>{var f;try{return!!(null==(f=o.WebAssembly)?void 0:f.compileStreaming)}catch(o){return null==p||p.info("Does not support WASM streaming compilation",o),!1}};let chromeVersion=(o=globalThis)=>{try{if(!o.chrome)return}catch{}let p=o.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/);if(p)return parseInt(p[1],10)};p.isOldChrome=(o=globalThis,p)=>{let f=chromeVersion(o);return!!f&&f<90&&(null==p||p.debug(`Chrome ${f} has incomplete SIMD support.`),!0)}},0x8225a8f0:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.VoiceFocusAudioWorkletNode=void 0,p.VoiceFocusAudioWorkletNode=class extends("u">typeof globalThis&&globalThis.AudioWorkletNode||class{}){}},0x166a4bc39:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.getAudioInput=p.createAudioContext=p.VoiceFocus=void 0;let _=f(0x808e38bb),w=f(0x8c0c7fbd),I=f(0x2037185f8),k=f(0x19eda6376),M=f(0xa486546a),x=f(0x24e1ef5ba),O=f(0x1e2f61ed7),L={useVoiceFocusAGC:!1,useBuiltInAGC:!0},B="stable-v1",U="https://static.sdkassets.chime.aws",$={processors:`${U}/processors/`,workers:`${U}/workers/`,wasm:`${U}/wasm/`,models:`${U}/wasm/`},q={latencyHint:0},Z={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},ee=Object.assign(Object.assign({},Z),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),et=Object.assign(Object.assign({},Z),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),ei={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:x.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:O.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:M.default}},validateAssetSpec=(o,p)=>{if(void 0!==o&&!(0,w.isValidAssetGroup)(o))throw Error(`Invalid asset group ${o}`);if(void 0!==p&&!(0,w.isValidRevisionID)(p))throw Error(`Invalid revision ID ${p}`)},urlForModel=(o,p)=>`${p.models}${(0,_.decideModel)(o)}.wasm`,er=class VoiceFocus{constructor(o,p,f,m,_,w){this.processorURL=p,this.nodeConstructor=f,this.nodeOptions=m,this.executionQuanta=_,this.logger=w,this.internal={worker:o,isDestroyed:!1}}getModelMetrics(){var o;return null==(o=this.internal.voiceFocusNode)?void 0:o.getModelMetrics()}reset(){var o,p,f;null==(o=this.internal.voiceFocusNode)||o.reset(),null==(p=this.internal.sourceNode)||p.disconnect(),null==(f=this.internal.destinationNode)||f.disconnect()}enable(){var o;null==(o=this.internal.voiceFocusNode)||o.enable()}disable(){var o;null==(o=this.internal.voiceFocusNode)||o.disable()}setMode(o){var p;null==(p=this.internal.voiceFocusNode)||p.setMode(o)}destroy(){var o,p,f,_,w;return m(this,void 0,void 0,function*(){let{worker:m,isDestroyed:I,voiceFocusNode:k,destinationNode:M,sourceNode:x,audioContext:O}=this.internal;if(I){null==(o=this.logger)||o.debug("Voice Focus is already destroyed");return}try{null==m||m.terminate(),null==x||x.disconnect(),null==M||M.disconnect(),yield Promise.all([null!=(p=null==O?void 0:O.close().catch(o=>o))?p:yield Promise.resolve(),null!=(f=null==k?void 0:k.stop().catch(o=>o))?f:yield Promise.resolve()]),this.internal.audioContext=void 0,this.internal.voiceFocusNode=void 0,this.internal.sourceNode=void 0,this.internal.destinationNode=void 0,null==(_=this.logger)||_.debug("Voice Focus destroyed successfully")}catch(o){throw null==(w=this.logger)||w.error("Error while destroying the Voice Focus instance: ",o),o}finally{this.internal.isDestroyed=!0}})}static isSupported(o,p){let{fetchBehavior:f,logger:m}=p||{};if("u"<typeof globalThis)return null==m||m.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!(0,k.supportsAudioWorklet)(globalThis,m))return null==m||m.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!(0,k.supportsWASM)(globalThis,m))return null==m||m.debug("Browser does not support WASM."),Promise.resolve(!1);(0,k.supportsWASMStreaming)(globalThis,m)||null==m||m.debug("Browser does not support streaming WASM compilation.");let{assetGroup:_=B,revisionID:I,paths:M=$}=o||{};validateAssetSpec(_,I);let x=Object.assign(Object.assign({},(0,w.addQueryParams)(f,I?{revisionID:I}:{assetGroup:_})),{paths:M});return(0,k.supportsVoiceFocusWorker)(globalThis,x,m)}static mungeExecutionPreference(o,p){let f=void 0===o||"auto"===o;if((0,k.isSafari)(globalThis)){if(f||"inline"===o)return"inline";if(!f)throw Error(`Unsupported execution preference ${o}`)}if("worker-sab"===o&&!(0,k.supportsSharedArrayBuffer)(globalThis,globalThis,p))throw Error(`Unsupported execution preference ${o}`);return o||"auto"}static configure(o,p){return m(this,void 0,void 0,function*(){let{fetchBehavior:f,preResolve:m,logger:I}=p||{},{category:k="voicefocus",name:M="default",variant:x="auto",assetGroup:O=B,revisionID:L,simd:U="detect",mode:q="ns",executionPreference:Z="auto",executionQuantaPreference:ee,usagePreference:et="interactivity",estimatorBudget:ei=100,paths:er=$,thresholds:en}=o||{};if(null==I||I.debug("Configuring Voice Focus with spec",o),void 0!==k&&"voicefocus"!==k)throw Error(`Unrecognized category ${k}`);if(void 0!==M&&"default"!==M&&"ns_es"!==M)throw Error(`Unrecognized feature name ${M}`);if(void 0!==x&&!["auto","c100","c50","c20","c10"].includes(x))throw Error(`Unrecognized feature variant ${x}`);if(void 0!==ee&&![1,2,3].includes(ee))throw Error(`Unrecognized execution quanta preference ${ee}`);if(validateAssetSpec(O,L),void 0!==U&&!["detect","force","disable"].includes(U))throw Error(`Unrecognized SIMD option ${U}`);if(void 0!==Z&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(Z))throw Error(`Unrecognized execution preference ${Z}`);if(void 0!==et&&!["quality","interactivity"].includes(et))throw Error(`Unrecognized usage preference ${et}`);let eo={executionPreference:this.mungeExecutionPreference(Z,I),usagePreference:et,executionQuantaPreference:ee,variantPreference:x,namePreference:M,simdPreference:U,estimatorBudget:ei},es=(0,w.addQueryParams)(f,L?{revisionID:L}:{assetGroup:O}),ea=Object.assign({paths:er},es),el=yield(0,_.measureAndDecideExecutionApproach)(eo,ea,I,en);if(!1===el.supported)return{supported:!1,reason:el.reason};null==I||I.info("Decided execution approach",el);let{useSIMD:ed,processor:ec,variant:eu,executionQuanta:eh}=el,ep={category:k||"voicefocus",name:M||"default",mode:q,variant:eu,simd:ed};if(m){let o=urlForModel(ep,er);ep.url=yield(0,w.resolveURL)(o,es)}return{fetchConfig:ea,model:ep,processor:ec,executionQuanta:eh,supported:!0}})}static init(o,{delegate:p,preload:f=!0,logger:_}){return m(this,void 0,void 0,function*(){if(!1===o.supported)throw Error("Voice Focus not supported. Reason: "+o.reason);let{model:m,processor:w,fetchConfig:M,executionQuanta:x}=o,{simd:O,name:L,mode:B}=m,{paths:U}=M;if("voicefocus-inline-processor"!==w&&"voicefocus-worker-postMessage-processor"!==w&&"voicefocus-worker-sab-processor"!==w)throw Error(`Unknown processor ${w}`);let $=m.url||urlForModel(m,U);null==_||_.debug(`Using model URL ${$}.`);let q=`${U.wasm}audio_buffer-v1${O?"_simd":""}.wasm`,Z=`${U.wasm}resampler-v1${O?"_simd":""}.wasm`,ee=`${U.workers}worker-v1.js`,{file:et,node:er}=ei[w],en=`${U.processors}${et}`,eo=yield(0,I.loadWorker)(ee,"VoiceFocusWorker",M,_);if(f){null==_||_.debug("Preloading",$);let o=(0,k.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";eo.postMessage({message:o,preload:!0,key:"model",fetchBehavior:M,path:$})}return Promise.resolve(new VoiceFocus(eo,en,er,{processor:w,worker:eo,audioBufferURL:q,resamplerURL:Z,fetchBehavior:M,modelURL:$,delegate:p,logger:_,numberOfInputs:"ns_es"===L?2:1,mode:B},x,_))})}createNode(o,p){var f;if(this.internal.isDestroyed)throw Error("Unable to create node because VoiceFocus worker has been destroyed.");let{voiceFocusSampleRate:m=16e3===o.sampleRate?16e3:48e3,enabled:_=!0,agc:I=L}=p||{},k=null==p?void 0:p.es,M={voiceFocusSampleRate:m,enabled:_,sendBufferCount:10,prefill:6,agc:I,executionQuanta:this.executionQuanta,supportFarendStream:k,mode:this.nodeOptions.mode},x=(0,w.withQueryString)(this.processorURL,null==(f=this.nodeOptions)?void 0:f.fetchBehavior);return o.audioWorklet.addModule(x).then(()=>new this.nodeConstructor(o,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:M})))}applyToStream(o,p,f,_=!1){var w,I,k;return m(this,void 0,void 0,function*(){let m;if(this.internal.isDestroyed)throw Error("Unable to apply stream because VoiceFocus worker has been destroyed");null==(w=this.internal.sourceNode)||w.disconnect(),null==(I=this.internal.destinationNode)||I.disconnect(),_&&this.internal.voiceFocusNode&&this.internal.voiceFocusNode.isEnabled()?(null==(k=this.logger)||k.info("Re-using existing voice focus node"),m=this.internal.voiceFocusNode):m=yield this.createNode(p,f);let M=p.createMediaStreamSource(o);M.connect(m);let x=p.createMediaStreamDestination();return m.connect(x),this.internal=Object.assign(Object.assign({},this.internal),{voiceFocusNode:m,sourceNode:M,destinationNode:x,audioContext:p}),{node:m,source:M,destination:x,stream:x.stream}})}applyToSourceNode(o,p,f){return m(this,void 0,void 0,function*(){let m=yield this.createNode(p,f);return o.connect(m),m})}};p.VoiceFocus=er,p.createAudioContext=(o=q)=>new(window.AudioContext||window.webkitAudioContext)(o),p.getAudioInput=(o,p,f)=>m(void 0,void 0,void 0,function*(){var m,_;let{constraints:w,spec:I,delegate:k,preload:M=!0,options:x}=p,{logger:O}=f,B=yield er.configure(I,f);if(!B.supported)return null==(m=f.logger)||m.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(w);let U=yield er.init(B,{delegate:k,preload:M,logger:O}),$=(null==(_=p.options)?void 0:_.agc)||L,q=yield window.navigator.mediaDevices.getUserMedia(((o,p)=>{let f;if(f=p.useBuiltInAGC?ee:et,!o)return{audio:f};if(!o.audio)return o;if(o.video)throw Error("Not adding Voice Focus to multi-device getUserMedia call.");return Object.assign(Object.assign({},o),{audio:!0===o.audio?f:Object.assign(Object.assign({},o.audio),f)})})(w,$));return U.applyToStream(q,o,x).then(o=>o.stream)})},0xa486546a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x19eda6376),w=f(0x8225a8f0);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.cpuWarningCount=0,this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,worker:m,fetchBehavior:w,logger:I,delegate:k}=p;this.logger=I,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=k,I&&I.debug("VoiceFocusInlineNode:",f),this.worker=m,this.worker.onmessage=this.onWorkerMessage.bind(this);const M=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:M,key:"model",fetchBehavior:w,path:f}),this.enabled=!0}onModuleBufferLoaded(o,p){this.port.postMessage({message:"module-buffer",buffer:o,key:p})}onModuleLoaded(o,p){this.port.postMessage({message:"module",module:o,key:p})}enable(){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){var o;return m(this,void 0,void 0,function*(){this.port.postMessage({message:"stop"});try{null==(o=this.worker)||o.terminate()}catch(o){console.error("failed to terminate worker:",o)}this.disconnect(),this.enabled=!1})}reset(){this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.port.postMessage({message:"reset"})}isEnabled(){return this.enabled}onProcessorMessage(o){var p,f,m,_,w,I;let{data:k}=o,{message:M}=k;switch(M){case"cpu":let{reason:x,count:O}=k;x&&O&&(this.metrics.cpu=Object.assign(Object.assign({},this.metrics.cpu),{[x]:O+this.metrics.cpu[x]})),this.cpuWarningCount++;let L=Date.now(),B=this.cpuWarningLastTriggered||L,U=Math.abs(L-B);(!this.cpuWarningLastTriggered||U>5e3)&&(null==(p=this.logger)||p.warn(`CPU warning (count: ${this.cpuWarningCount}):`,M),this.cpuWarningCount=0,this.cpuWarningLastTriggered=L),null==(f=this.delegate)||f.onCPUWarning();break;case"metrics":let{metrics:$}=k;if(!$){null==(m=this.logger)||m.warn("Got metrics message but no metrics payload");break}if(this.metrics=Object.assign(Object.assign({},this.metrics),$),this.logger){let o=Date.now();o-(null!=(_=this.metricsLastRecorded)?_:0)>5e3&&(null==(w=this.logger)||w.debug("Contact metrics:",this.metrics),this.metricsLastRecorded=o)}break;default:null==(I=this.logger)||I.debug("Ignoring processor message.")}}getModelMetrics(){return this.metrics}onWorkerMessage(o){let p=o.data;switch(p.message){case"module-buffer":if(!p.buffer||!p.key)return;this.onModuleBufferLoaded(p.buffer,p.key);break;case"module":if(!p.module||!p.key)return;this.onModuleLoaded(p.module,p.key);break;case"stopped":this.worker&&this.worker.terminate();break;default:return}}}},0x1e2f61ed7:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x19eda6376),w=f(0x8225a8f0);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,audioBufferURL:m,worker:w,fetchBehavior:I,delegate:k}=p;this.delegate=k,this.worker=w,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:M,agc:x,supportFarendStream:O}=p.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===o.sampleRate?160:480,enabled:M,agc:x,fetchBehavior:I,model:f,supportFarendStream:O});const L=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:L,key:"buffer",fetchBehavior:I,path:m}),this.enabled=!0}enable(){return m(this,void 0,void 0,function*(){this.worker.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.worker.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){return m(this,void 0,void 0,function*(){try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect(),this.enabled=!1})}getModelMetrics(){}reset(){}isEnabled(){return this.enabled}onWorkerMessage(o){var p;let f=o.data;switch(f.message){case"ready":this.port.postMessage({message:"ready",shared:f.shared},f.shared?Object.values(f.shared):[]);break;case"data":if(!f.buffer)return;this.port.postMessage({message:"data",buffer:f.buffer},[f.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(f);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;default:return}}onProcessorMessage(o){var p;let f=o.data;switch(f.message){case"data":if(!f.buffer)return;this.worker.postMessage({message:"data",buffer:f.buffer},[f.buffer]);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(f);break;default:return}}}},0x24e1ef5ba:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x19eda6376),w=f(0x8225a8f0);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,resamplerURL:m,worker:w,fetchBehavior:I,delegate:k}=p;this.delegate=k,this.worker=w,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:M,supportFarendStream:x}=p.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===o.sampleRate?160:480,enabled:M,model:f,supportFarendStream:x});const O=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:O,key:"resampler",fetchBehavior:I,path:m}),this.enabled=!0}enable(){return m(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,1,1),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,1,0),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){return m(this,void 0,void 0,function*(){if(this.state)Atomics.store(this.state,1,2),Atomics.notify(this.state,0,1);else try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect(),this.enabled=!1})}getModelMetrics(){}reset(){}isEnabled(){return this.enabled}onWorkerMessage(o){var p;let f=o.data;switch(f.message){case"ready":if(!f.shared)throw Error("No shared state.");this.state=new Int32Array(f.shared.state),this.port.postMessage(f);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(f);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;default:return}}onProcessorMessage(o){var p;let f=o.data;switch(f.message){case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(f)}}}},0x1d0948268:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.RawSha256=void 0;var m=f(0x4429cdcc);p.RawSha256=function(){function RawSha256(){this.state=Int32Array.from(m.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return RawSha256.prototype.update=function(o){if(this.finished)throw Error("Attempted to update an already finished hash.");var p=0,f=o.byteLength;if(this.bytesHashed+=f,8*this.bytesHashed>m.MAX_HASHABLE_LENGTH)throw Error("Cannot hash more than 2^53 - 1 bits");for(;f>0;)this.buffer[this.bufferLength++]=o[p++],f--,this.bufferLength===m.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},RawSha256.prototype.digest=function(){if(!this.finished){var o=8*this.bytesHashed,p=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),f=this.bufferLength;if(p.setUint8(this.bufferLength++,128),f%m.BLOCK_SIZE>=m.BLOCK_SIZE-8){for(var _=this.bufferLength;_<m.BLOCK_SIZE;_++)p.setUint8(_,0);this.hashBuffer(),this.bufferLength=0}for(var _=this.bufferLength;_<m.BLOCK_SIZE-8;_++)p.setUint8(_,0);p.setUint32(m.BLOCK_SIZE-8,Math.floor(o/0x100000000),!0),p.setUint32(m.BLOCK_SIZE-4,o),this.hashBuffer(),this.finished=!0}for(var w=new Uint8Array(m.DIGEST_LENGTH),_=0;_<8;_++)w[4*_]=this.state[_]>>>24&255,w[4*_+1]=this.state[_]>>>16&255,w[4*_+2]=this.state[_]>>>8&255,w[4*_+3]=this.state[_]>>>0&255;return w},RawSha256.prototype.hashBuffer=function(){for(var o=this.buffer,p=this.state,f=p[0],_=p[1],w=p[2],I=p[3],k=p[4],M=p[5],x=p[6],O=p[7],L=0;L<m.BLOCK_SIZE;L++){if(L<16)this.temp[L]=(255&o[4*L])<<24|(255&o[4*L+1])<<16|(255&o[4*L+2])<<8|255&o[4*L+3];else{var B=this.temp[L-2],U=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,$=((B=this.temp[L-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3;this.temp[L]=(U+this.temp[L-7]|0)+($+this.temp[L-16]|0)}var q=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&M^~k&x)|0)+(O+(m.KEY[L]+this.temp[L]|0)|0)|0,Z=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&_^f&w^_&w)|0;O=x,x=M,M=k,k=I+q|0,I=w,w=_,_=f,f=q+Z|0}p[0]+=f,p[1]+=_,p[2]+=w,p[3]+=I,p[4]+=k,p[5]+=M,p[6]+=x,p[7]+=O},RawSha256}()},0x4429cdcc:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.MAX_HASHABLE_LENGTH=p.INIT=p.KEY=p.DIGEST_LENGTH=p.BLOCK_SIZE=void 0,p.BLOCK_SIZE=64,p.DIGEST_LENGTH=32,p.KEY=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),p.INIT=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],p.MAX_HASHABLE_LENGTH=0x1fffffffffffff},0x709b03e9:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),f(0x373d7a51).__exportStar(f(0x631b9f3),p)},0x631b9f3:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Sha256=void 0;var m=f(0x373d7a51),_=f(0x4429cdcc),w=f(0x1d0948268),I=f(0x209a14018);function bufferFromSecret(o){var p=(0,I.convertToBuffer)(o);if(p.byteLength>_.BLOCK_SIZE){var f=new w.RawSha256;f.update(p),p=f.digest()}var m=new Uint8Array(_.BLOCK_SIZE);return m.set(p),m}p.Sha256=function(){function Sha256(o){if(this.hash=new w.RawSha256,o){this.outer=new w.RawSha256;var p=bufferFromSecret(o),f=new Uint8Array(_.BLOCK_SIZE);f.set(p);for(var m=0;m<_.BLOCK_SIZE;m++)p[m]^=54,f[m]^=92;this.hash.update(p),this.outer.update(f);for(var m=0;m<p.byteLength;m++)p[m]=0}}return Sha256.prototype.update=function(o){if(!(0,I.isEmptyData)(o)&&!this.error)try{this.hash.update((0,I.convertToBuffer)(o))}catch(o){this.error=o}},Sha256.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},Sha256.prototype.digest=function(){return m.__awaiter(this,void 0,void 0,function(){return m.__generator(this,function(o){return[2,this.digestSync()]})})},Sha256}()},0x5e9f0f54:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.convertToBuffer=void 0;var m=f(0x1d34794c1),_="u">typeof Buffer&&Buffer.from?function(o){return Buffer.from(o,"utf8")}:m.fromUtf8;p.convertToBuffer=function(o){return o instanceof Uint8Array?o:"string"==typeof o?_(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o)}},0x209a14018:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.uint32ArrayFrom=p.numToUint8=p.isEmptyData=p.convertToBuffer=void 0;var m=f(0x5e9f0f54);Object.defineProperty(p,"convertToBuffer",{enumerable:!0,get:function(){return m.convertToBuffer}});var _=f(0x57397821);Object.defineProperty(p,"isEmptyData",{enumerable:!0,get:function(){return _.isEmptyData}});var w=f(0x15702f6f3);Object.defineProperty(p,"numToUint8",{enumerable:!0,get:function(){return w.numToUint8}});var I=f(0x1592736a6);Object.defineProperty(p,"uint32ArrayFrom",{enumerable:!0,get:function(){return I.uint32ArrayFrom}})},0x57397821:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isEmptyData=void 0,p.isEmptyData=function(o){return"string"==typeof o?0===o.length:0===o.byteLength}},0x15702f6f3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.numToUint8=void 0,p.numToUint8=function(o){return new Uint8Array([(0xff000000&o)>>24,(0xff0000&o)>>16,(65280&o)>>8,255&o])}},0x1592736a6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.uint32ArrayFrom=void 0,p.uint32ArrayFrom=function(o){if(!Uint32Array.from){for(var p=new Uint32Array(o.length),f=0;f<o.length;)p[f]=o[f],f+=1;return p}return Uint32Array.from(o)}},0x168308164:(o,p,f)=>{"use strict";let{Deflate:m,deflate:_,deflateRaw:w,gzip:I}=f(0xa381bc8f),{Inflate:k,inflate:M,inflateRaw:x,ungzip:O}=f(0xbefab207),L=f(0x1d1fb08ff);o.exports.Deflate=m,o.exports.deflate=_,o.exports.deflateRaw=w,o.exports.gzip=I,o.exports.Inflate=k,o.exports.inflate=M,o.exports.inflateRaw=x,o.exports.ungzip=O,o.exports.constants=L},0xa381bc8f:(o,p,f)=>{"use strict";let m=f(0x1e8586b55),_=f(0x1fc89dbe3),w=f(0x20971d884),I=f(0x247c3b7f2),k=f(0x80696b4c),M=Object.prototype.toString,{Z_NO_FLUSH:x,Z_SYNC_FLUSH:O,Z_FULL_FLUSH:L,Z_FINISH:B,Z_OK:U,Z_STREAM_END:$,Z_DEFAULT_COMPRESSION:q,Z_DEFAULT_STRATEGY:Z,Z_DEFLATED:ee}=f(0x1d1fb08ff);function Deflate(o){this.options=_.assign({level:q,method:ee,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z},o||{});let p=this.options;p.raw&&p.windowBits>0?p.windowBits=-p.windowBits:p.gzip&&p.windowBits>0&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;let f=m.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(f!==U)throw Error(I[f]);if(p.header&&m.deflateSetHeader(this.strm,p.header),p.dictionary){let o;if(o="string"==typeof p.dictionary?w.string2buf(p.dictionary):"[object ArrayBuffer]"===M.call(p.dictionary)?new Uint8Array(p.dictionary):p.dictionary,(f=m.deflateSetDictionary(this.strm,o))!==U)throw Error(I[f]);this._dict_set=!0}}function deflate(o,p){let f=new Deflate(p);if(f.push(o,!0),f.err)throw f.msg||I[f.err];return f.result}function deflateRaw(o,p){return(p=p||{}).raw=!0,deflate(o,p)}function gzip(o,p){return(p=p||{}).gzip=!0,deflate(o,p)}Deflate.prototype.push=function(o,p){let f,_,I=this.strm,k=this.options.chunkSize;if(this.ended)return!1;for(_=p===~~p?p:!0===p?B:x,"string"==typeof o?I.input=w.string2buf(o):"[object ArrayBuffer]"===M.call(o)?I.input=new Uint8Array(o):I.input=o,I.next_in=0,I.avail_in=I.input.length;;){if(0===I.avail_out&&(I.output=new Uint8Array(k),I.next_out=0,I.avail_out=k),(_===O||_===L)&&I.avail_out<=6){this.onData(I.output.subarray(0,I.next_out)),I.avail_out=0;continue}if((f=m.deflate(I,_))===$)return I.next_out>0&&this.onData(I.output.subarray(0,I.next_out)),f=m.deflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===U;if(0===I.avail_out){this.onData(I.output);continue}if(_>0&&I.next_out>0){this.onData(I.output.subarray(0,I.next_out)),I.avail_out=0;continue}if(0===I.avail_in)break}return!0},Deflate.prototype.onData=function(o){this.chunks.push(o)},Deflate.prototype.onEnd=function(o){o===U&&(this.result=_.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},o.exports.Deflate=Deflate,o.exports.deflate=deflate,o.exports.deflateRaw=deflateRaw,o.exports.gzip=gzip,o.exports.constants=f(0x1d1fb08ff)},0xbefab207:(o,p,f)=>{"use strict";let m=f(0x1e4aca509),_=f(0x1fc89dbe3),w=f(0x20971d884),I=f(0x247c3b7f2),k=f(0x80696b4c),M=f(0x24adb59e6),x=Object.prototype.toString,{Z_NO_FLUSH:O,Z_FINISH:L,Z_OK:B,Z_STREAM_END:U,Z_NEED_DICT:$,Z_STREAM_ERROR:q,Z_DATA_ERROR:Z,Z_MEM_ERROR:ee}=f(0x1d1fb08ff);function Inflate(o){this.options=_.assign({chunkSize:65536,windowBits:15,to:""},o||{});let p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,0===p.windowBits&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(o&&o.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(15&p.windowBits)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;let f=m.inflateInit2(this.strm,p.windowBits);if(f!==B||(this.header=new M,m.inflateGetHeader(this.strm,this.header),p.dictionary&&("string"==typeof p.dictionary?p.dictionary=w.string2buf(p.dictionary):"[object ArrayBuffer]"===x.call(p.dictionary)&&(p.dictionary=new Uint8Array(p.dictionary)),p.raw)&&(f=m.inflateSetDictionary(this.strm,p.dictionary))!==B))throw Error(I[f])}function inflate(o,p){let f=new Inflate(p);if(f.push(o),f.err)throw f.msg||I[f.err];return f.result}function inflateRaw(o,p){return(p=p||{}).raw=!0,inflate(o,p)}Inflate.prototype.push=function(o,p){let f,_,I,k=this.strm,M=this.options.chunkSize,et=this.options.dictionary;if(this.ended)return!1;for(_=p===~~p?p:!0===p?L:O,"[object ArrayBuffer]"===x.call(o)?k.input=new Uint8Array(o):k.input=o,k.next_in=0,k.avail_in=k.input.length;;){for(0===k.avail_out&&(k.output=new Uint8Array(M),k.next_out=0,k.avail_out=M),(f=m.inflate(k,_))===$&&et&&((f=m.inflateSetDictionary(k,et))===B?f=m.inflate(k,_):f===Z&&(f=$));k.avail_in>0&&f===U&&k.state.wrap>0&&0!==o[k.next_in];)m.inflateReset(k),f=m.inflate(k,_);switch(f){case q:case Z:case $:case ee:return this.onEnd(f),this.ended=!0,!1}if(I=k.avail_out,k.next_out&&(0===k.avail_out||f===U))if("string"===this.options.to){let o=w.utf8border(k.output,k.next_out),p=k.next_out-o,f=w.buf2string(k.output,o);k.next_out=p,k.avail_out=M-p,p&&k.output.set(k.output.subarray(o,o+p),0),this.onData(f)}else this.onData(k.output.length===k.next_out?k.output:k.output.subarray(0,k.next_out));if(f!==B||0!==I){if(f===U)return f=m.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,!0;if(0===k.avail_in)break}}return!0},Inflate.prototype.onData=function(o){this.chunks.push(o)},Inflate.prototype.onEnd=function(o){o===B&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=_.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},o.exports.Inflate=Inflate,o.exports.inflate=inflate,o.exports.inflateRaw=inflateRaw,o.exports.ungzip=inflate,o.exports.constants=f(0x1d1fb08ff)},0x1fc89dbe3:o=>{"use strict";let _has=(o,p)=>Object.prototype.hasOwnProperty.call(o,p);o.exports.assign=function(o){let p=Array.prototype.slice.call(arguments,1);for(;p.length;){let f=p.shift();if(f){if("object"!=typeof f)throw TypeError(f+"must be non-object");for(let p in f)_has(f,p)&&(o[p]=f[p])}}return o},o.exports.flattenChunks=o=>{let p=0;for(let f=0,m=o.length;f<m;f++)p+=o[f].length;let f=new Uint8Array(p);for(let p=0,m=0,_=o.length;p<_;p++){let _=o[p];f.set(_,m),m+=_.length}return f}},0x20971d884:o=>{"use strict";let p=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{p=!1}let f=new Uint8Array(256);for(let o=0;o<256;o++)f[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;f[254]=f[254]=1,o.exports.string2buf=o=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(o);let p,f,m,_,w,I=o.length,k=0;for(_=0;_<I;_++)(64512&(f=o.charCodeAt(_)))==55296&&_+1<I&&(64512&(m=o.charCodeAt(_+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),_++),k+=f<128?1:f<2048?2:f<65536?3:4;for(w=0,p=new Uint8Array(k),_=0;w<k;_++)(64512&(f=o.charCodeAt(_)))==55296&&_+1<I&&(64512&(m=o.charCodeAt(_+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),_++),f<128?p[w++]=f:(f<2048?p[w++]=192|f>>>6:(f<65536?p[w++]=224|f>>>12:(p[w++]=240|f>>>18,p[w++]=128|f>>>12&63),p[w++]=128|f>>>6&63),p[w++]=128|63&f);return p},o.exports.buf2string=(o,m)=>{let _,w,I=m||o.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(o.subarray(0,m));let k=Array(2*I);for(w=0,_=0;_<I;){let p=o[_++];if(p<128){k[w++]=p;continue}let m=f[p];if(m>4){k[w++]=65533,_+=m-1;continue}for(p&=2===m?31:3===m?15:7;m>1&&_<I;)p=p<<6|63&o[_++],m--;if(m>1){k[w++]=65533;continue}p<65536?k[w++]=p:(p-=65536,k[w++]=55296|p>>10&1023,k[w++]=56320|1023&p)}var M=w;if(M<65534&&k.subarray&&p)return String.fromCharCode.apply(null,k.length===M?k:k.subarray(0,M));let x="";for(let o=0;o<M;o++)x+=String.fromCharCode(k[o]);return x},o.exports.utf8border=(o,p)=>{(p=p||o.length)>o.length&&(p=o.length);let m=p-1;for(;m>=0&&(192&o[m])==128;)m--;return m<0||0===m?p:m+f[o[m]]>p?m:p}},0x1bfa1058b:o=>{"use strict";o.exports=(o,p,f,m)=>{let _=65535&o,w=o>>>16&65535,I=0;for(;0!==f;){I=f>2e3?2e3:f,f-=I;do w=w+(_=_+p[m++]|0)|0;while(--I)_%=65521,w%=65521}return _|w<<16}},0x1d1fb08ff:o=>{"use strict";o.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},0x23eeac0f9:o=>{"use strict";let p=new Uint32Array((()=>{let o,p=[];for(var f=0;f<256;f++){o=f;for(var m=0;m<8;m++)o=1&o?0xedb88320^o>>>1:o>>>1;p[f]=o}return p})());o.exports=(o,f,m,_)=>{let w=_+m;o^=-1;for(let m=_;m<w;m++)o=o>>>8^p[(o^f[m])&255];return -1^o}},0x1e8586b55:(o,p,f)=>{"use strict";let{_tr_init:m,_tr_stored_block:_,_tr_flush_block:w,_tr_tally:I,_tr_align:k}=f(0x167000253),M=f(0x1bfa1058b),x=f(0x23eeac0f9),O=f(0x247c3b7f2),{Z_NO_FLUSH:L,Z_PARTIAL_FLUSH:B,Z_FULL_FLUSH:U,Z_FINISH:$,Z_BLOCK:q,Z_OK:Z,Z_STREAM_END:ee,Z_STREAM_ERROR:et,Z_DATA_ERROR:ei,Z_BUF_ERROR:er,Z_DEFAULT_COMPRESSION:en,Z_FILTERED:eo,Z_HUFFMAN_ONLY:es,Z_RLE:ea,Z_FIXED:el,Z_DEFAULT_STRATEGY:ed,Z_UNKNOWN:ec,Z_DEFLATED:eu}=f(0x1d1fb08ff),eh=573,err=(o,p)=>(o.msg=O[p],p),rank=o=>(o<<1)-9*(o>4),zero=o=>{let p=o.length;for(;--p>=0;)o[p]=0},HASH=(o,p,f)=>(p<<o.hash_shift^f)&o.hash_mask,flush_pending=o=>{let p=o.state,f=p.pending;f>o.avail_out&&(f=o.avail_out),0!==f&&(o.output.set(p.pending_buf.subarray(p.pending_out,p.pending_out+f),o.next_out),o.next_out+=f,p.pending_out+=f,o.total_out+=f,o.avail_out-=f,p.pending-=f,0===p.pending&&(p.pending_out=0))},flush_block_only=(o,p)=>{w(o,o.block_start>=0?o.block_start:-1,o.strstart-o.block_start,p),o.block_start=o.strstart,flush_pending(o.strm)},put_byte=(o,p)=>{o.pending_buf[o.pending++]=p},putShortMSB=(o,p)=>{o.pending_buf[o.pending++]=p>>>8&255,o.pending_buf[o.pending++]=255&p},read_buf=(o,p,f,m)=>{let _=o.avail_in;return(_>m&&(_=m),0===_)?0:(o.avail_in-=_,p.set(o.input.subarray(o.next_in,o.next_in+_),f),1===o.state.wrap?o.adler=M(o.adler,p,_,f):2===o.state.wrap&&(o.adler=x(o.adler,p,_,f)),o.next_in+=_,o.total_in+=_,_)},longest_match=(o,p)=>{let f,m,_=o.max_chain_length,w=o.strstart,I=o.prev_length,k=o.nice_match,M=o.strstart>o.w_size-262?o.strstart-(o.w_size-262):0,x=o.window,O=o.w_mask,L=o.prev,B=o.strstart+258,U=x[w+I-1],$=x[w+I];o.prev_length>=o.good_match&&(_>>=2),k>o.lookahead&&(k=o.lookahead);do{if(x[(f=p)+I]!==$||x[f+I-1]!==U||x[f]!==x[w]||x[++f]!==x[w+1])continue;w+=2,f++;do;while(x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&w<B)if(m=258-(B-w),w=B-258,m>I){if(o.match_start=p,I=m,m>=k)break;U=x[w+I-1],$=x[w+I]}}while((p=L[p&O])>M&&0!=--_)return I<=o.lookahead?I:o.lookahead},fill_window=o=>{let p,f,m,_,w,I=o.w_size;do{if(_=o.window_size-o.lookahead-o.strstart,o.strstart>=I+(I-262)){o.window.set(o.window.subarray(I,I+I),0),o.match_start-=I,o.strstart-=I,o.block_start-=I,p=f=o.hash_size;do m=o.head[--p],o.head[p]=m>=I?m-I:0;while(--f)p=f=I;do m=o.prev[--p],o.prev[p]=m>=I?m-I:0;while(--f)_+=I}if(0===o.strm.avail_in)break;if(f=read_buf(o.strm,o.window,o.strstart+o.lookahead,_),o.lookahead+=f,o.lookahead+o.insert>=3)for(w=o.strstart-o.insert,o.ins_h=o.window[w],o.ins_h=HASH(o,o.ins_h,o.window[w+1]);o.insert&&(o.ins_h=HASH(o,o.ins_h,o.window[w+3-1]),o.prev[w&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=w,w++,o.insert--,!(o.lookahead+o.insert<3)););}while(o.lookahead<262&&0!==o.strm.avail_in)},deflate_fast=(o,p)=>{let f,m;for(;;){if(o.lookahead<262){if(fill_window(o),o.lookahead<262&&p===L)return 1;if(0===o.lookahead)break}if(f=0,o.lookahead>=3&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),0!==f&&o.strstart-f<=o.w_size-262&&(o.match_length=longest_match(o,f)),o.match_length>=3)if(m=I(o,o.strstart-o.match_start,o.match_length-3),o.lookahead-=o.match_length,o.match_length<=o.max_lazy_match&&o.lookahead>=3){o.match_length--;do o.strstart++,o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart;while(0!=--o.match_length)o.strstart++}else o.strstart+=o.match_length,o.match_length=0,o.ins_h=o.window[o.strstart],o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+1]);else m=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++;if(m&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=o.strstart<2?o.strstart:2,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2},deflate_slow=(o,p)=>{let f,m,_;for(;;){if(o.lookahead<262){if(fill_window(o),o.lookahead<262&&p===L)return 1;if(0===o.lookahead)break}if(f=0,o.lookahead>=3&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),o.prev_length=o.match_length,o.prev_match=o.match_start,o.match_length=2,0!==f&&o.prev_length<o.max_lazy_match&&o.strstart-f<=o.w_size-262&&(o.match_length=longest_match(o,f),o.match_length<=5&&(o.strategy===eo||3===o.match_length&&o.strstart-o.match_start>4096)&&(o.match_length=2)),o.prev_length>=3&&o.match_length<=o.prev_length){_=o.strstart+o.lookahead-3,m=I(o,o.strstart-1-o.prev_match,o.prev_length-3),o.lookahead-=o.prev_length-1,o.prev_length-=2;do++o.strstart<=_&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart);while(0!=--o.prev_length)if(o.match_available=0,o.match_length=2,o.strstart++,m&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}else if(o.match_available){if((m=I(o,0,o.window[o.strstart-1]))&&flush_block_only(o,!1),o.strstart++,o.lookahead--,0===o.strm.avail_out)return 1}else o.match_available=1,o.strstart++,o.lookahead--}return(o.match_available&&(m=I(o,0,o.window[o.strstart-1]),o.match_available=0),o.insert=o.strstart<2?o.strstart:2,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2};function Config(o,p,f,m,_){this.good_length=o,this.max_lazy=p,this.nice_length=f,this.max_chain=m,this.func=_}let ep=[new Config(0,0,0,0,(o,p)=>{let f=65535;for(65535>o.pending_buf_size-5&&(f=o.pending_buf_size-5);;){if(o.lookahead<=1){if(fill_window(o),0===o.lookahead&&p===L)return 1;if(0===o.lookahead)break}o.strstart+=o.lookahead,o.lookahead=0;let m=o.block_start+f;if((0===o.strstart||o.strstart>=m)&&(o.lookahead=o.strstart-m,o.strstart=m,flush_block_only(o,!1),0===o.strm.avail_out)||o.strstart-o.block_start>=o.w_size-262&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:(o.strstart>o.block_start&&(flush_block_only(o,!1),o.strm.avail_out),1)}),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=eu,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*eh),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),zero(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let deflateResetKeep=o=>{if(!o||!o.state)return err(o,et);o.total_in=o.total_out=0,o.data_type=ec;let p=o.state;return p.pending=0,p.pending_out=0,p.wrap<0&&(p.wrap=-p.wrap),p.status=p.wrap?42:113,o.adler=+(2!==p.wrap),p.last_flush=L,m(p),Z},deflateReset=o=>{var p;let f=deflateResetKeep(o);return f===Z&&((p=o.state).window_size=2*p.w_size,zero(p.head),p.max_lazy_match=ep[p.level].max_lazy,p.good_match=ep[p.level].good_length,p.nice_match=ep[p.level].nice_length,p.max_chain_length=ep[p.level].max_chain,p.strstart=0,p.block_start=0,p.lookahead=0,p.insert=0,p.match_length=p.prev_length=2,p.match_available=0,p.ins_h=0),f},deflateInit2=(o,p,f,m,_,w)=>{if(!o)return et;let I=1;if(p===en&&(p=6),m<0?(I=0,m=-m):m>15&&(I=2,m-=16),_<1||_>9||f!==eu||m<8||m>15||p<0||p>9||w<0||w>el)return err(o,et);8===m&&(m=9);let k=new DeflateState;return o.state=k,k.strm=o,k.wrap=I,k.gzhead=null,k.w_bits=m,k.w_size=1<<k.w_bits,k.w_mask=k.w_size-1,k.hash_bits=_+7,k.hash_size=1<<k.hash_bits,k.hash_mask=k.hash_size-1,k.hash_shift=~~((k.hash_bits+3-1)/3),k.window=new Uint8Array(2*k.w_size),k.head=new Uint16Array(k.hash_size),k.prev=new Uint16Array(k.w_size),k.lit_bufsize=1<<_+6,k.pending_buf_size=4*k.lit_bufsize,k.pending_buf=new Uint8Array(k.pending_buf_size),k.d_buf=+k.lit_bufsize,k.l_buf=3*k.lit_bufsize,k.level=p,k.strategy=w,k.method=f,deflateReset(o)};o.exports.deflateInit=(o,p)=>deflateInit2(o,p,eu,15,8,ed),o.exports.deflateInit2=deflateInit2,o.exports.deflateReset=deflateReset,o.exports.deflateResetKeep=deflateResetKeep,o.exports.deflateSetHeader=(o,p)=>o&&o.state&&2===o.state.wrap?(o.state.gzhead=p,Z):et,o.exports.deflate=(o,p)=>{let f,m;if(!o||!o.state||p>q||p<0)return o?err(o,et):et;let w=o.state;if(!o.output||!o.input&&0!==o.avail_in||666===w.status&&p!==$)return err(o,0===o.avail_out?er:et);w.strm=o;let M=w.last_flush;if(w.last_flush=p,42===w.status)if(2===w.wrap)o.adler=0,put_byte(w,31),put_byte(w,139),put_byte(w,8),w.gzhead?(put_byte(w,+!!w.gzhead.text+2*!!w.gzhead.hcrc+4*!!w.gzhead.extra+8*!!w.gzhead.name+16*!!w.gzhead.comment),put_byte(w,255&w.gzhead.time),put_byte(w,w.gzhead.time>>8&255),put_byte(w,w.gzhead.time>>16&255),put_byte(w,w.gzhead.time>>24&255),put_byte(w,9===w.level?2:4*(w.strategy>=es||w.level<2)),put_byte(w,255&w.gzhead.os),w.gzhead.extra&&w.gzhead.extra.length&&(put_byte(w,255&w.gzhead.extra.length),put_byte(w,w.gzhead.extra.length>>8&255)),w.gzhead.hcrc&&(o.adler=x(o.adler,w.pending_buf,w.pending,0)),w.gzindex=0,w.status=69):(put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,9===w.level?2:4*(w.strategy>=es||w.level<2)),put_byte(w,3),w.status=113);else{let p=eu+(w.w_bits-8<<4)<<8;p|=(w.strategy>=es||w.level<2?0:w.level<6?1:6===w.level?2:3)<<6,0!==w.strstart&&(p|=32),p+=31-p%31,w.status=113,putShortMSB(w,p),0!==w.strstart&&(putShortMSB(w,o.adler>>>16),putShortMSB(w,65535&o.adler)),o.adler=1}if(69===w.status)if(w.gzhead.extra){for(f=w.pending;w.gzindex<(65535&w.gzhead.extra.length)&&(w.pending!==w.pending_buf_size||(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending!==w.pending_buf_size));)put_byte(w,255&w.gzhead.extra[w.gzindex]),w.gzindex++;w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),w.gzindex===w.gzhead.extra.length&&(w.gzindex=0,w.status=73)}else w.status=73;if(73===w.status)if(w.gzhead.name){f=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending===w.pending_buf_size)){m=1;break}m=w.gzindex<w.gzhead.name.length?255&w.gzhead.name.charCodeAt(w.gzindex++):0,put_byte(w,m)}while(0!==m)w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),0===m&&(w.gzindex=0,w.status=91)}else w.status=91;if(91===w.status)if(w.gzhead.comment){f=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending===w.pending_buf_size)){m=1;break}m=w.gzindex<w.gzhead.comment.length?255&w.gzhead.comment.charCodeAt(w.gzindex++):0,put_byte(w,m)}while(0!==m)w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),0===m&&(w.status=103)}else w.status=103;if(103===w.status&&(w.gzhead.hcrc?(w.pending+2>w.pending_buf_size&&flush_pending(o),w.pending+2<=w.pending_buf_size&&(put_byte(w,255&o.adler),put_byte(w,o.adler>>8&255),o.adler=0,w.status=113)):w.status=113),0!==w.pending){if(flush_pending(o),0===o.avail_out)return w.last_flush=-1,Z}else if(0===o.avail_in&&rank(p)<=rank(M)&&p!==$)return err(o,er);if(666===w.status&&0!==o.avail_in)return err(o,er);if(0!==o.avail_in||0!==w.lookahead||p!==L&&666!==w.status){let f=w.strategy===es?((o,p)=>{let f;for(;;){if(0===o.lookahead&&(fill_window(o),0===o.lookahead)){if(p===L)return 1;break}if(o.match_length=0,f=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,f&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2})(w,p):w.strategy===ea?((o,p)=>{let f,m,_,w,k=o.window;for(;;){if(o.lookahead<=258){if(fill_window(o),o.lookahead<=258&&p===L)return 1;if(0===o.lookahead)break}if(o.match_length=0,o.lookahead>=3&&o.strstart>0&&(m=k[_=o.strstart-1])===k[++_]&&m===k[++_]&&m===k[++_]){w=o.strstart+258;do;while(m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&_<w)o.match_length=258-(w-_),o.match_length>o.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=3?(f=I(o,1,o.match_length-3),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(f=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),f&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2})(w,p):ep[w.level].func(w,p);if((3===f||4===f)&&(w.status=666),1===f||3===f)return 0===o.avail_out&&(w.last_flush=-1),Z;if(2===f&&(p===B?k(w):p!==q&&(_(w,0,0,!1),p===U&&(zero(w.head),0===w.lookahead&&(w.strstart=0,w.block_start=0,w.insert=0))),flush_pending(o),0===o.avail_out))return w.last_flush=-1,Z}return p!==$?Z:w.wrap<=0?ee:(2===w.wrap?(put_byte(w,255&o.adler),put_byte(w,o.adler>>8&255),put_byte(w,o.adler>>16&255),put_byte(w,o.adler>>24&255),put_byte(w,255&o.total_in),put_byte(w,o.total_in>>8&255),put_byte(w,o.total_in>>16&255),put_byte(w,o.total_in>>24&255)):(putShortMSB(w,o.adler>>>16),putShortMSB(w,65535&o.adler)),flush_pending(o),w.wrap>0&&(w.wrap=-w.wrap),0!==w.pending?Z:ee)},o.exports.deflateEnd=o=>{if(!o||!o.state)return et;let p=o.state.status;return 42!==p&&69!==p&&73!==p&&91!==p&&103!==p&&113!==p&&666!==p?err(o,et):(o.state=null,113===p?err(o,ei):Z)},o.exports.deflateSetDictionary=(o,p)=>{let f=p.length;if(!o||!o.state)return et;let m=o.state,_=m.wrap;if(2===_||1===_&&42!==m.status||m.lookahead)return et;if(1===_&&(o.adler=M(o.adler,p,f,0)),m.wrap=0,f>=m.w_size){0===_&&(zero(m.head),m.strstart=0,m.block_start=0,m.insert=0);let o=new Uint8Array(m.w_size);o.set(p.subarray(f-m.w_size,f),0),p=o,f=m.w_size}let w=o.avail_in,I=o.next_in,k=o.input;for(o.avail_in=f,o.next_in=0,o.input=p,fill_window(m);m.lookahead>=3;){let o=m.strstart,p=m.lookahead-2;do m.ins_h=HASH(m,m.ins_h,m.window[o+3-1]),m.prev[o&m.w_mask]=m.head[m.ins_h],m.head[m.ins_h]=o,o++;while(--p)m.strstart=o,m.lookahead=2,fill_window(m)}return m.strstart+=m.lookahead,m.block_start=m.strstart,m.insert=m.lookahead,m.lookahead=0,m.match_length=m.prev_length=2,m.match_available=0,o.next_in=I,o.input=k,o.avail_in=w,m.wrap=_,Z},o.exports.deflateInfo="pako deflate (from Nodeca project)"},0x24adb59e6:o=>{"use strict";o.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},0x20027491f:o=>{"use strict";o.exports=function(o,p){let f,m,_,w,I,k,M,x,O,L,B,U,$,q,Z,ee,et,ei,er,en,eo,es,ea,el,ed=o.state;f=o.next_in,ea=o.input,m=f+(o.avail_in-5),_=o.next_out,el=o.output,w=_-(p-o.avail_out),I=_+(o.avail_out-257),k=ed.dmax,M=ed.wsize,x=ed.whave,O=ed.wnext,L=ed.window,B=ed.hold,U=ed.bits,$=ed.lencode,q=ed.distcode,Z=(1<<ed.lenbits)-1,ee=(1<<ed.distbits)-1;e:do for(U<15&&(B+=ea[f++]<<U,U+=8,B+=ea[f++]<<U,U+=8),et=$[B&Z];;){if(B>>>=ei=et>>>24,U-=ei,0==(ei=et>>>16&255))el[_++]=65535&et;else if(16&ei)for(er=65535&et,(ei&=15)&&(U<ei&&(B+=ea[f++]<<U,U+=8),er+=B&(1<<ei)-1,B>>>=ei,U-=ei),U<15&&(B+=ea[f++]<<U,U+=8,B+=ea[f++]<<U,U+=8),et=q[B&ee];;){if(B>>>=ei=et>>>24,U-=ei,16&(ei=et>>>16&255)){if(en=65535&et,U<(ei&=15)&&(B+=ea[f++]<<U,(U+=8)<ei&&(B+=ea[f++]<<U,U+=8)),(en+=B&(1<<ei)-1)>k){o.msg="invalid distance too far back",ed.mode=30;break e}if(B>>>=ei,U-=ei,en>(ei=_-w)){if((ei=en-ei)>x&&ed.sane){o.msg="invalid distance too far back",ed.mode=30;break e}if(eo=0,es=L,0===O){if(eo+=M-ei,ei<er){er-=ei;do el[_++]=L[eo++];while(--ei)eo=_-en,es=el}}else if(O<ei){if(eo+=M+O-ei,(ei-=O)<er){er-=ei;do el[_++]=L[eo++];while(--ei)if(eo=0,O<er){er-=ei=O;do el[_++]=L[eo++];while(--ei)eo=_-en,es=el}}}else if(eo+=O-ei,ei<er){er-=ei;do el[_++]=L[eo++];while(--ei)eo=_-en,es=el}for(;er>2;)el[_++]=es[eo++],el[_++]=es[eo++],el[_++]=es[eo++],er-=3;er&&(el[_++]=es[eo++],er>1&&(el[_++]=es[eo++]))}else{eo=_-en;do el[_++]=el[eo++],el[_++]=el[eo++],el[_++]=el[eo++],er-=3;while(er>2)er&&(el[_++]=el[eo++],er>1&&(el[_++]=el[eo++]))}}else if((64&ei)==0){et=q[(65535&et)+(B&(1<<ei)-1)];continue}else{o.msg="invalid distance code",ed.mode=30;break e}break}else if((64&ei)==0){et=$[(65535&et)+(B&(1<<ei)-1)];continue}else if(32&ei){ed.mode=12;break e}else{o.msg="invalid literal/length code",ed.mode=30;break e}break}while(f<m&&_<I)f-=er=U>>3,U-=er<<3,B&=(1<<U)-1,o.next_in=f,o.next_out=_,o.avail_in=f<m?5+(m-f):5-(f-m),o.avail_out=_<I?257+(I-_):257-(_-I),ed.hold=B,ed.bits=U}},0x1e4aca509:(o,p,f)=>{"use strict";let m,_,w=f(0x1bfa1058b),I=f(0x23eeac0f9),k=f(0x20027491f),M=f(0x14abe8992),{Z_FINISH:x,Z_BLOCK:O,Z_TREES:L,Z_OK:B,Z_STREAM_END:U,Z_NEED_DICT:$,Z_STREAM_ERROR:q,Z_DATA_ERROR:Z,Z_MEM_ERROR:ee,Z_BUF_ERROR:et,Z_DEFLATED:ei}=f(0x1d1fb08ff),zswap32=o=>(o>>>24&255)+(o>>>8&65280)+((65280&o)<<8)+((255&o)<<24);function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let inflateResetKeep=o=>{if(!o||!o.state)return q;let p=o.state;return o.total_in=o.total_out=p.total=0,o.msg="",p.wrap&&(o.adler=1&p.wrap),p.mode=1,p.last=0,p.havedict=0,p.dmax=32768,p.head=null,p.hold=0,p.bits=0,p.lencode=p.lendyn=new Int32Array(852),p.distcode=p.distdyn=new Int32Array(592),p.sane=1,p.back=-1,B},inflateReset=o=>{if(!o||!o.state)return q;let p=o.state;return p.wsize=0,p.whave=0,p.wnext=0,inflateResetKeep(o)},inflateReset2=(o,p)=>{let f;if(!o||!o.state)return q;let m=o.state;return(p<0?(f=0,p=-p):(f=(p>>4)+1,p<48&&(p&=15)),p&&(p<8||p>15))?q:(null!==m.window&&m.wbits!==p&&(m.window=null),m.wrap=f,m.wbits=p,inflateReset(o))},inflateInit2=(o,p)=>{if(!o)return q;let f=new InflateState;o.state=f,f.window=null;let m=inflateReset2(o,p);return m!==B&&(o.state=null),m},er=!0,fixedtables=o=>{if(er){m=new Int32Array(512),_=new Int32Array(32);let p=0;for(;p<144;)o.lens[p++]=8;for(;p<256;)o.lens[p++]=9;for(;p<280;)o.lens[p++]=7;for(;p<288;)o.lens[p++]=8;for(M(1,o.lens,0,288,m,0,o.work,{bits:9}),p=0;p<32;)o.lens[p++]=5;M(2,o.lens,0,32,_,0,o.work,{bits:5}),er=!1}o.lencode=m,o.lenbits=9,o.distcode=_,o.distbits=5},updatewindow=(o,p,f,m)=>{let _,w=o.state;return null===w.window&&(w.wsize=1<<w.wbits,w.wnext=0,w.whave=0,w.window=new Uint8Array(w.wsize)),m>=w.wsize?(w.window.set(p.subarray(f-w.wsize,f),0),w.wnext=0,w.whave=w.wsize):((_=w.wsize-w.wnext)>m&&(_=m),w.window.set(p.subarray(f-m,f-m+_),w.wnext),(m-=_)?(w.window.set(p.subarray(f-m,f),0),w.wnext=m,w.whave=w.wsize):(w.wnext+=_,w.wnext===w.wsize&&(w.wnext=0),w.whave<w.wsize&&(w.whave+=_))),0};o.exports.inflateReset=inflateReset,o.exports.inflateReset2=inflateReset2,o.exports.inflateResetKeep=inflateResetKeep,o.exports.inflateInit=o=>inflateInit2(o,15),o.exports.inflateInit2=inflateInit2,o.exports.inflate=(o,p)=>{let f,m,_,er,en,eo,es,ea,el,ed,ec,eu,eh,ep,ef,em,eg,eS,ev,eb,ey,e_,eC,eT,eE=0,ew=new Uint8Array(4),eI=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!o||!o.state||!o.output||!o.input&&0!==o.avail_in)return q;12===(f=o.state).mode&&(f.mode=13),en=o.next_out,_=o.output,es=o.avail_out,er=o.next_in,m=o.input,eo=o.avail_in,ea=f.hold,el=f.bits,ed=eo,ec=es,e_=B;t:for(;;)switch(f.mode){case 1:if(0===f.wrap){f.mode=13;break}for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(2&f.wrap&&35615===ea){f.check=0,ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0),ea=0,el=0,f.mode=2;break}if(f.flags=0,f.head&&(f.head.done=!1),!(1&f.wrap)||(((255&ea)<<8)+(ea>>8))%31){o.msg="incorrect header check",f.mode=30;break}if((15&ea)!==ei){o.msg="unknown compression method",f.mode=30;break}if(ea>>>=4,el-=4,ey=(15&ea)+8,0===f.wbits)f.wbits=ey;else if(ey>f.wbits){o.msg="invalid window size",f.mode=30;break}f.dmax=1<<f.wbits,o.adler=f.check=1,f.mode=512&ea?10:12,ea=0,el=0;break;case 2:for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(f.flags=ea,(255&f.flags)!==ei){o.msg="unknown compression method",f.mode=30;break}if(57344&f.flags){o.msg="unknown header flags set",f.mode=30;break}f.head&&(f.head.text=ea>>8&1),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0,f.mode=3;case 3:for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.head&&(f.head.time=ea),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,ew[2]=ea>>>16&255,ew[3]=ea>>>24&255,f.check=I(f.check,ew,4,0)),ea=0,el=0,f.mode=4;case 4:for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.head&&(f.head.xflags=255&ea,f.head.os=ea>>8),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0,f.mode=5;case 5:if(1024&f.flags){for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.length=ea,f.head&&(f.head.extra_len=ea),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0}else f.head&&(f.head.extra=null);f.mode=6;case 6:if(1024&f.flags&&((eu=f.length)>eo&&(eu=eo),eu&&(f.head&&(ey=f.head.extra_len-f.length,f.head.extra||(f.head.extra=new Uint8Array(f.head.extra_len)),f.head.extra.set(m.subarray(er,er+eu),ey)),512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,f.length-=eu),f.length))break t;f.length=0,f.mode=7;case 7:if(2048&f.flags){if(0===eo)break t;eu=0;do ey=m[er+eu++],f.head&&ey&&f.length<65536&&(f.head.name+=String.fromCharCode(ey));while(ey&&eu<eo)if(512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,ey)break t}else f.head&&(f.head.name=null);f.length=0,f.mode=8;case 8:if(4096&f.flags){if(0===eo)break t;eu=0;do ey=m[er+eu++],f.head&&ey&&f.length<65536&&(f.head.comment+=String.fromCharCode(ey));while(ey&&eu<eo)if(512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,ey)break t}else f.head&&(f.head.comment=null);f.mode=9;case 9:if(512&f.flags){for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(ea!==(65535&f.check)){o.msg="header crc mismatch",f.mode=30;break}ea=0,el=0}f.head&&(f.head.hcrc=f.flags>>9&1,f.head.done=!0),o.adler=f.check=0,f.mode=12;break;case 10:for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}o.adler=f.check=zswap32(ea),ea=0,el=0,f.mode=11;case 11:if(0===f.havedict)return o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,$;o.adler=f.check=1,f.mode=12;case 12:if(p===O||p===L)break t;case 13:if(f.last){ea>>>=7&el,el-=7&el,f.mode=27;break}for(;el<3;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}switch(f.last=1&ea,el-=1,3&(ea>>>=1)){case 0:f.mode=14;break;case 1:if(fixedtables(f),f.mode=20,p===L){ea>>>=2,el-=2;break t}break;case 2:f.mode=17;break;case 3:o.msg="invalid block type",f.mode=30}ea>>>=2,el-=2;break;case 14:for(ea>>>=7&el,el-=7&el;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if((65535&ea)!=(ea>>>16^65535)){o.msg="invalid stored block lengths",f.mode=30;break}if(f.length=65535&ea,ea=0,el=0,f.mode=15,p===L)break t;case 15:f.mode=16;case 16:if(eu=f.length){if(eu>eo&&(eu=eo),eu>es&&(eu=es),0===eu)break t;_.set(m.subarray(er,er+eu),en),eo-=eu,er+=eu,es-=eu,en+=eu,f.length-=eu;break}f.mode=12;break;case 17:for(;el<14;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(f.nlen=(31&ea)+257,el-=5,f.ndist=(31&(ea>>>=5))+1,el-=5,f.ncode=(15&(ea>>>=5))+4,ea>>>=4,el-=4,f.nlen>286||f.ndist>30){o.msg="too many length or distance symbols",f.mode=30;break}f.have=0,f.mode=18;case 18:for(;f.have<f.ncode;){for(;el<3;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.lens[eI[f.have++]]=7&ea,ea>>>=3,el-=3}for(;f.have<19;)f.lens[eI[f.have++]]=0;if(f.lencode=f.lendyn,f.lenbits=7,eC={bits:f.lenbits},e_=M(0,f.lens,0,19,f.lencode,0,f.work,eC),f.lenbits=eC.bits,e_){o.msg="invalid code lengths set",f.mode=30;break}f.have=0,f.mode=19;case 19:for(;f.have<f.nlen+f.ndist;){for(;ef=(eE=f.lencode[ea&(1<<f.lenbits)-1])>>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(eg<16)ea>>>=ef,el-=ef,f.lens[f.have++]=eg;else{if(16===eg){for(eT=ef+2;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(ea>>>=ef,el-=ef,0===f.have){o.msg="invalid bit length repeat",f.mode=30;break}ey=f.lens[f.have-1],eu=3+(3&ea),ea>>>=2,el-=2}else if(17===eg){for(eT=ef+3;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=ef,el-=ef,ey=0,eu=3+(7&ea),ea>>>=3,el-=3}else{for(eT=ef+7;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=ef,el-=ef,ey=0,eu=11+(127&ea),ea>>>=7,el-=7}if(f.have+eu>f.nlen+f.ndist){o.msg="invalid bit length repeat",f.mode=30;break}for(;eu--;)f.lens[f.have++]=ey}}if(30===f.mode)break;if(0===f.lens[256]){o.msg="invalid code -- missing end-of-block",f.mode=30;break}if(f.lenbits=9,eC={bits:f.lenbits},e_=M(1,f.lens,0,f.nlen,f.lencode,0,f.work,eC),f.lenbits=eC.bits,e_){o.msg="invalid literal/lengths set",f.mode=30;break}if(f.distbits=6,f.distcode=f.distdyn,eC={bits:f.distbits},e_=M(2,f.lens,f.nlen,f.ndist,f.distcode,0,f.work,eC),f.distbits=eC.bits,e_){o.msg="invalid distances set",f.mode=30;break}if(f.mode=20,p===L)break t;case 20:f.mode=21;case 21:if(eo>=6&&es>=258){o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,k(o,ec),en=o.next_out,_=o.output,es=o.avail_out,er=o.next_in,m=o.input,eo=o.avail_in,ea=f.hold,el=f.bits,12===f.mode&&(f.back=-1);break}for(f.back=0;ef=(eE=f.lencode[ea&(1<<f.lenbits)-1])>>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(em&&(240&em)==0){for(eS=ef,ev=em,eb=eg;ef=(eE=f.lencode[eb+((ea&(1<<eS+ev)-1)>>eS)])>>>24,em=eE>>>16&255,eg=65535&eE,!(eS+ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=eS,el-=eS,f.back+=eS}if(ea>>>=ef,el-=ef,f.back+=ef,f.length=eg,0===em){f.mode=26;break}if(32&em){f.back=-1,f.mode=12;break}if(64&em){o.msg="invalid literal/length code",f.mode=30;break}f.extra=15&em,f.mode=22;case 22:if(f.extra){for(eT=f.extra;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.length+=ea&(1<<f.extra)-1,ea>>>=f.extra,el-=f.extra,f.back+=f.extra}f.was=f.length,f.mode=23;case 23:for(;ef=(eE=f.distcode[ea&(1<<f.distbits)-1])>>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if((240&em)==0){for(eS=ef,ev=em,eb=eg;ef=(eE=f.distcode[eb+((ea&(1<<eS+ev)-1)>>eS)])>>>24,em=eE>>>16&255,eg=65535&eE,!(eS+ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}ea>>>=eS,el-=eS,f.back+=eS}if(ea>>>=ef,el-=ef,f.back+=ef,64&em){o.msg="invalid distance code",f.mode=30;break}f.offset=eg,f.extra=15&em,f.mode=24;case 24:if(f.extra){for(eT=f.extra;el<eT;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}f.offset+=ea&(1<<f.extra)-1,ea>>>=f.extra,el-=f.extra,f.back+=f.extra}if(f.offset>f.dmax){o.msg="invalid distance too far back",f.mode=30;break}f.mode=25;case 25:if(0===es)break t;if(eu=ec-es,f.offset>eu){if((eu=f.offset-eu)>f.whave&&f.sane){o.msg="invalid distance too far back",f.mode=30;break}eu>f.wnext?(eu-=f.wnext,eh=f.wsize-eu):eh=f.wnext-eu,eu>f.length&&(eu=f.length),ep=f.window}else ep=_,eh=en-f.offset,eu=f.length;eu>es&&(eu=es),es-=eu,f.length-=eu;do _[en++]=ep[eh++];while(--eu)0===f.length&&(f.mode=21);break;case 26:if(0===es)break t;_[en++]=f.length,es--,f.mode=21;break;case 27:if(f.wrap){for(;el<32;){if(0===eo)break t;eo--,ea|=m[er++]<<el,el+=8}if(ec-=es,o.total_out+=ec,f.total+=ec,ec&&(o.adler=f.check=f.flags?I(f.check,_,ec,en-ec):w(f.check,_,ec,en-ec)),ec=es,(f.flags?ea:zswap32(ea))!==f.check){o.msg="incorrect data check",f.mode=30;break}ea=0,el=0}f.mode=28;case 28:if(f.wrap&&f.flags){for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<<el,el+=8}if(ea!==(0|f.total)){o.msg="incorrect length check",f.mode=30;break}ea=0,el=0}f.mode=29;case 29:e_=U;break t;case 30:e_=Z;break t;case 31:return ee;default:return q}return(o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,(f.wsize||ec!==o.avail_out&&f.mode<30&&(f.mode<27||p!==x))&&updatewindow(o,o.output,o.next_out,ec-o.avail_out))?(f.mode=31,ee):(ed-=o.avail_in,ec-=o.avail_out,o.total_in+=ed,o.total_out+=ec,f.total+=ec,f.wrap&&ec&&(o.adler=f.check=f.flags?I(f.check,_,ec,o.next_out-ec):w(f.check,_,ec,o.next_out-ec)),o.data_type=f.bits+64*!!f.last+128*(12===f.mode)+256*(20===f.mode||15===f.mode),(0===ed&&0===ec||p===x)&&e_===B&&(e_=et),e_)},o.exports.inflateEnd=o=>{if(!o||!o.state)return q;let p=o.state;return p.window&&(p.window=null),o.state=null,B},o.exports.inflateGetHeader=(o,p)=>{if(!o||!o.state)return q;let f=o.state;return(2&f.wrap)==0?q:(f.head=p,p.done=!1,B)},o.exports.inflateSetDictionary=(o,p)=>{let f,m=p.length;return o&&o.state&&(0===(f=o.state).wrap||11===f.mode)?11===f.mode&&w(1,p,m,0)!==f.check?Z:updatewindow(o,p,m,m)?(f.mode=31,ee):(f.havedict=1,B):q},o.exports.inflateInfo="pako inflate (from Nodeca project)"},0x14abe8992:o=>{"use strict";let p=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),f=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),m=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);o.exports=(o,w,I,k,M,x,O,L)=>{let B,U,$,q,Z,ee,et,ei,er,en=L.bits,eo=0,es=0,ea=0,el=0,ed=0,ec=0,eu=0,eh=0,ep=0,ef=0,em=null,eg=0,eS=new Uint16Array(16),ev=new Uint16Array(16),eb=null,ey=0;for(eo=0;eo<=15;eo++)eS[eo]=0;for(es=0;es<k;es++)eS[w[I+es]]++;for(el=15,ed=en;el>=1&&0===eS[el];el--);if(ed>el&&(ed=el),0===el)return M[x++]=0x1400000,M[x++]=0x1400000,L.bits=1,0;for(ea=1;ea<el&&0===eS[ea];ea++);for(ed<ea&&(ed=ea),eh=1,eo=1;eo<=15;eo++)if(eh<<=1,(eh-=eS[eo])<0)return -1;if(eh>0&&(0===o||1!==el))return -1;for(eo=1,ev[1]=0;eo<15;eo++)ev[eo+1]=ev[eo]+eS[eo];for(es=0;es<k;es++)0!==w[I+es]&&(O[ev[w[I+es]]++]=es);if(0===o?(em=eb=O,ee=19):1===o?(em=p,eg-=257,eb=f,ey-=257,ee=256):(em=m,eb=_,ee=-1),ef=0,es=0,eo=ea,Z=x,ec=ed,eu=0,$=-1,q=(ep=1<<ed)-1,1===o&&ep>852||2===o&&ep>592)return 1;for(;;){et=eo-eu,O[es]<ee?(ei=0,er=O[es]):O[es]>ee?(ei=eb[ey+O[es]],er=em[eg+O[es]]):(ei=96,er=0),B=1<<eo-eu,ea=U=1<<ec;do M[Z+(ef>>eu)+(U-=B)]=et<<24|ei<<16|er;while(0!==U)for(B=1<<eo-1;ef&B;)B>>=1;if(0!==B?(ef&=B-1,ef+=B):ef=0,es++,0==--eS[eo]){if(eo===el)break;eo=w[I+O[es]]}if(eo>ed&&(ef&q)!==$){for(0===eu&&(eu=ed),Z+=ea,eh=1<<(ec=eo-eu);ec+eu<el&&!((eh-=eS[ec+eu])<=0);)ec++,eh<<=1;if(ep+=1<<ec,1===o&&ep>852||2===o&&ep>592)return 1;M[$=ef&q]=ed<<24|ec<<16|Z-x}}return 0!==ef&&(M[Z+ef]=eo-eu<<24|4194304),L.bits=ed,0}},0x247c3b7f2:o=>{"use strict";o.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},0x167000253:o=>{"use strict";let p,f,m;function zero(o){let p=o.length;for(;--p>=0;)o[p]=0}let _=573,w=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),I=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),k=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x=Array(576);zero(x);let O=Array(60);zero(O);let L=Array(512);zero(L);let B=Array(256);zero(B);let U=Array(29);zero(U);let $=Array(30);function StaticTreeDesc(o,p,f,m,_){this.static_tree=o,this.extra_bits=p,this.extra_base=f,this.elems=m,this.max_length=_,this.has_stree=o&&o.length}function TreeDesc(o,p){this.dyn_tree=o,this.max_code=0,this.stat_desc=p}zero($);let d_code=o=>o<256?L[o]:L[256+(o>>>7)],put_short=(o,p)=>{o.pending_buf[o.pending++]=255&p,o.pending_buf[o.pending++]=p>>>8&255},send_bits=(o,p,f)=>{o.bi_valid>16-f?(o.bi_buf|=p<<o.bi_valid&65535,put_short(o,o.bi_buf),o.bi_buf=p>>16-o.bi_valid,o.bi_valid+=f-16):(o.bi_buf|=p<<o.bi_valid&65535,o.bi_valid+=f)},send_code=(o,p,f)=>{send_bits(o,f[2*p],f[2*p+1])},bi_reverse=(o,p)=>{let f=0;do f|=1&o,o>>>=1,f<<=1;while(--p>0)return f>>>1},gen_codes=(o,p,f)=>{let m,_,w=Array(16),I=0;for(m=1;m<=15;m++)w[m]=I=I+f[m-1]<<1;for(_=0;_<=p;_++){let p=o[2*_+1];0!==p&&(o[2*_]=bi_reverse(w[p]++,p))}},init_block=o=>{let p;for(p=0;p<286;p++)o.dyn_ltree[2*p]=0;for(p=0;p<30;p++)o.dyn_dtree[2*p]=0;for(p=0;p<19;p++)o.bl_tree[2*p]=0;o.dyn_ltree[512]=1,o.opt_len=o.static_len=0,o.last_lit=o.matches=0},bi_windup=o=>{o.bi_valid>8?put_short(o,o.bi_buf):o.bi_valid>0&&(o.pending_buf[o.pending++]=o.bi_buf),o.bi_buf=0,o.bi_valid=0},smaller=(o,p,f,m)=>{let _=2*p,w=2*f;return o[_]<o[w]||o[_]===o[w]&&m[p]<=m[f]},pqdownheap=(o,p,f)=>{let m=o.heap[f],_=f<<1;for(;_<=o.heap_len&&(_<o.heap_len&&smaller(p,o.heap[_+1],o.heap[_],o.depth)&&_++,!smaller(p,m,o.heap[_],o.depth));)o.heap[f]=o.heap[_],f=_,_<<=1;o.heap[f]=m},compress_block=(o,p,f)=>{let m,_,k,M,x=0;if(0!==o.last_lit)do m=o.pending_buf[o.d_buf+2*x]<<8|o.pending_buf[o.d_buf+2*x+1],_=o.pending_buf[o.l_buf+x],x++,0===m?send_code(o,_,p):(send_code(o,(k=B[_])+256+1,p),0!==(M=w[k])&&send_bits(o,_-=U[k],M),send_code(o,k=d_code(--m),f),0!==(M=I[k])&&send_bits(o,m-=$[k],M));while(x<o.last_lit)send_code(o,256,p)},build_tree=(o,p)=>{let f,m,w,I=p.dyn_tree,k=p.stat_desc.static_tree,M=p.stat_desc.has_stree,x=p.stat_desc.elems,O=-1;for(f=0,o.heap_len=0,o.heap_max=_;f<x;f++)0!==I[2*f]?(o.heap[++o.heap_len]=O=f,o.depth[f]=0):I[2*f+1]=0;for(;o.heap_len<2;)I[2*(w=o.heap[++o.heap_len]=O<2?++O:0)]=1,o.depth[w]=0,o.opt_len--,M&&(o.static_len-=k[2*w+1]);for(p.max_code=O,f=o.heap_len>>1;f>=1;f--)pqdownheap(o,I,f);w=x;do f=o.heap[1],o.heap[1]=o.heap[o.heap_len--],pqdownheap(o,I,1),m=o.heap[1],o.heap[--o.heap_max]=f,o.heap[--o.heap_max]=m,I[2*w]=I[2*f]+I[2*m],o.depth[w]=(o.depth[f]>=o.depth[m]?o.depth[f]:o.depth[m])+1,I[2*f+1]=I[2*m+1]=w,o.heap[1]=w++,pqdownheap(o,I,1);while(o.heap_len>=2)o.heap[--o.heap_max]=o.heap[1],((o,p)=>{let f,m,w,I,k,M,x=p.dyn_tree,O=p.max_code,L=p.stat_desc.static_tree,B=p.stat_desc.has_stree,U=p.stat_desc.extra_bits,$=p.stat_desc.extra_base,q=p.stat_desc.max_length,Z=0;for(I=0;I<=15;I++)o.bl_count[I]=0;for(x[2*o.heap[o.heap_max]+1]=0,f=o.heap_max+1;f<_;f++)(I=x[2*x[2*(m=o.heap[f])+1]+1]+1)>q&&(I=q,Z++),x[2*m+1]=I,!(m>O)&&(o.bl_count[I]++,k=0,m>=$&&(k=U[m-$]),M=x[2*m],o.opt_len+=M*(I+k),B&&(o.static_len+=M*(L[2*m+1]+k)));if(0!==Z){do{for(I=q-1;0===o.bl_count[I];)I--;o.bl_count[I]--,o.bl_count[I+1]+=2,o.bl_count[q]--,Z-=2}while(Z>0)for(I=q;0!==I;I--)for(m=o.bl_count[I];0!==m;)!((w=o.heap[--f])>O)&&(x[2*w+1]!==I&&(o.opt_len+=(I-x[2*w+1])*x[2*w],x[2*w+1]=I),m--)}})(o,p),gen_codes(I,O,o.bl_count)},scan_tree=(o,p,f)=>{let m,_,w=-1,I=p[1],k=0,M=7,x=4;for(0===I&&(M=138,x=3),p[(f+1)*2+1]=65535,m=0;m<=f;m++)_=I,I=p[(m+1)*2+1],++k<M&&_===I||(k<x?o.bl_tree[2*_]+=k:0!==_?(_!==w&&o.bl_tree[2*_]++,o.bl_tree[32]++):k<=10?o.bl_tree[34]++:o.bl_tree[36]++,k=0,w=_,0===I?(M=138,x=3):_===I?(M=6,x=3):(M=7,x=4))},send_tree=(o,p,f)=>{let m,_,w=-1,I=p[1],k=0,M=7,x=4;for(0===I&&(M=138,x=3),m=0;m<=f;m++)if(_=I,I=p[(m+1)*2+1],!(++k<M)||_!==I){if(k<x)do send_code(o,_,o.bl_tree);while(0!=--k)else 0!==_?(_!==w&&(send_code(o,_,o.bl_tree),k--),send_code(o,16,o.bl_tree),send_bits(o,k-3,2)):k<=10?(send_code(o,17,o.bl_tree),send_bits(o,k-3,3)):(send_code(o,18,o.bl_tree),send_bits(o,k-11,7));k=0,w=_,0===I?(M=138,x=3):_===I?(M=6,x=3):(M=7,x=4)}},q=!1,_tr_stored_block=(o,p,f,m)=>{send_bits(o,0+ +!!m,3),bi_windup(o),put_short(o,f),put_short(o,~f),o.pending_buf.set(o.window.subarray(p,p+f),o.pending),o.pending+=f};o.exports._tr_init=o=>{q||((()=>{let o,_,M,q,Z,ee=Array(16);for(q=0,M=0;q<28;q++)for(o=0,U[q]=M;o<1<<w[q];o++)B[M++]=q;for(B[M-1]=q,Z=0,q=0;q<16;q++)for(o=0,$[q]=Z;o<1<<I[q];o++)L[Z++]=q;for(Z>>=7;q<30;q++)for(o=0,$[q]=Z<<7;o<1<<I[q]-7;o++)L[256+Z++]=q;for(_=0;_<=15;_++)ee[_]=0;for(o=0;o<=143;)x[2*o+1]=8,o++,ee[8]++;for(;o<=255;)x[2*o+1]=9,o++,ee[9]++;for(;o<=279;)x[2*o+1]=7,o++,ee[7]++;for(;o<=287;)x[2*o+1]=8,o++,ee[8]++;for(gen_codes(x,287,ee),o=0;o<30;o++)O[2*o+1]=5,O[2*o]=bi_reverse(o,5);p=new StaticTreeDesc(x,w,257,286,15),f=new StaticTreeDesc(O,I,0,30,15),m=new StaticTreeDesc([],k,0,19,7)})(),q=!0),o.l_desc=new TreeDesc(o.dyn_ltree,p),o.d_desc=new TreeDesc(o.dyn_dtree,f),o.bl_desc=new TreeDesc(o.bl_tree,m),o.bi_buf=0,o.bi_valid=0,init_block(o)},o.exports._tr_stored_block=_tr_stored_block,o.exports._tr_flush_block=(o,p,f,m)=>{let _,w,I=0;o.level>0?(2===o.strm.data_type&&(o.strm.data_type=(o=>{let p,f=0xf3ffc07f;for(p=0;p<=31;p++,f>>>=1)if(1&f&&0!==o.dyn_ltree[2*p])return 0;if(0!==o.dyn_ltree[18]||0!==o.dyn_ltree[20]||0!==o.dyn_ltree[26])return 1;for(p=32;p<256;p++)if(0!==o.dyn_ltree[2*p])return 1;return 0})(o)),build_tree(o,o.l_desc),build_tree(o,o.d_desc),I=(o=>{let p;for(scan_tree(o,o.dyn_ltree,o.l_desc.max_code),scan_tree(o,o.dyn_dtree,o.d_desc.max_code),build_tree(o,o.bl_desc),p=18;p>=3&&0===o.bl_tree[2*M[p]+1];p--);return o.opt_len+=3*(p+1)+5+5+4,p})(o),_=o.opt_len+3+7>>>3,(w=o.static_len+3+7>>>3)<=_&&(_=w)):_=w=f+5,f+4<=_&&-1!==p?_tr_stored_block(o,p,f,m):4===o.strategy||w===_?(send_bits(o,2+ +!!m,3),compress_block(o,x,O)):(send_bits(o,4+ +!!m,3),((o,p,f,m)=>{let _;for(send_bits(o,p-257,5),send_bits(o,f-1,5),send_bits(o,m-4,4),_=0;_<m;_++)send_bits(o,o.bl_tree[2*M[_]+1],3);send_tree(o,o.dyn_ltree,p-1),send_tree(o,o.dyn_dtree,f-1)})(o,o.l_desc.max_code+1,o.d_desc.max_code+1,I+1),compress_block(o,o.dyn_ltree,o.dyn_dtree)),init_block(o),m&&bi_windup(o)},o.exports._tr_tally=(o,p,f)=>(o.pending_buf[o.d_buf+2*o.last_lit]=p>>>8&255,o.pending_buf[o.d_buf+2*o.last_lit+1]=255&p,o.pending_buf[o.l_buf+o.last_lit]=255&f,o.last_lit++,0===p?o.dyn_ltree[2*f]++:(o.matches++,p--,o.dyn_ltree[(B[f]+256+1)*2]++,o.dyn_dtree[2*d_code(p)]++),o.last_lit===o.lit_bufsize-1),o.exports._tr_align=o=>{send_bits(o,2,3),send_code(o,256,x),16===o.bi_valid?(put_short(o,o.bi_buf),o.bi_buf=0,o.bi_valid=0):o.bi_valid>=8&&(o.pending_buf[o.pending++]=255&o.bi_buf,o.bi_buf>>=8,o.bi_valid-=8)}},0x80696b4c:o=>{"use strict";o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},0x1b47b3a66:(o,p,f)=>{"use strict";o.exports=f(0x11b3ca472)},0x11b3ca472:(o,p,f)=>{"use strict";function configure(){p.util._configure(),p.Writer._configure(p.BufferWriter),p.Reader._configure(p.BufferReader)}p.build="minimal",p.Writer=f(0x28a80bef),p.BufferWriter=f(0x1c7a0fc56),p.Reader=f(0x1799ca70f),p.BufferReader=f(0xdef97ab6),p.util=f(0x48fcd504),p.rpc=f(0xbbbb3413),p.roots=f(0x15069b6e9),p.configure=configure,configure()},0x1799ca70f:(o,p,f)=>{"use strict";o.exports=Reader;var m,_,w=f(0x48fcd504),I=w.LongBits,k=w.utf8;function indexOutOfRange(o,p){return RangeError("index out of range: "+o.pos+" + "+(p||1)+" > "+o.len)}function Reader(o){this.buf=o,this.pos=0,this.len=o.length}var M="u">typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new Reader(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new Reader(o);throw Error("illegal buffer")},create=function(){return w.Buffer?function(o){return(Reader.create=function(o){return w.Buffer.isBuffer(o)?new _(o):M(o)})(o)}:M};function readLongVarint(){var o=new I(0,0),p=0;if(this.len-this.pos>4){for(;p<4;++p)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*p)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;p=0}else{for(;p<3;++p){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*p)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*p)>>>0,o}if(this.len-this.pos>4){for(;p<5;++p)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*p+3)>>>0,this.buf[this.pos++]<128)return o}else for(;p<5;++p){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*p+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function readFixed32_end(o,p){return(o[p-4]|o[p-3]<<8|o[p-2]<<16|o[p-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new I(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader.create=create(),Reader.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice,Reader.prototype.uint32=(m=0xffffffff,function(){if(m=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(m=(m|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(m=(m|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(m=(m|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(m=(m|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return m;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return m}),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var o=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var o=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},Reader.prototype.bytes=function(){var o=this.uint32(),p=this.pos,f=this.pos+o;if(f>this.len)throw indexOutOfRange(this,o);if(this.pos+=o,Array.isArray(this.buf))return this.buf.slice(p,f);if(p===f){var m=w.Buffer;return m?m.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,p,f)},Reader.prototype.string=function(){var o=this.bytes();return k.read(o,0,o.length)},Reader.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw indexOutOfRange(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(128&this.buf[this.pos++])return this},Reader.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},Reader._configure=function(o){_=o,Reader.create=create(),_._configure();var p=w.Long?"toLong":"toNumber";w.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[p](!1)},uint64:function(){return readLongVarint.call(this)[p](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[p](!1)},fixed64:function(){return readFixed64.call(this)[p](!0)},sfixed64:function(){return readFixed64.call(this)[p](!1)}})}},0xdef97ab6:(o,p,f)=>{"use strict";o.exports=BufferReader;var m=f(0x1799ca70f);(BufferReader.prototype=Object.create(m.prototype)).constructor=BufferReader;var _=f(0x48fcd504);function BufferReader(o){m.call(this,o)}BufferReader._configure=function(){_.Buffer&&(BufferReader.prototype._slice=_.Buffer.prototype.slice)},BufferReader.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},BufferReader._configure()},0x15069b6e9:o=>{"use strict";o.exports={}},0xbbbb3413:(o,p,f)=>{"use strict";p.Service=f(0x126f238e3)},0x126f238e3:(o,p,f)=>{"use strict";o.exports=Service;var m=f(0x48fcd504);function Service(o,p,f){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");m.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!p,this.responseDelimited=!!f}(Service.prototype=Object.create(m.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function rpcCall(o,p,f,_,w){if(!_)throw TypeError("request must be specified");var I=this;if(!w)return m.asPromise(rpcCall,I,o,p,f,_);if(!I.rpcImpl)return void setTimeout(function(){w(Error("already ended"))},0);try{return I.rpcImpl(o,p[I.requestDelimited?"encodeDelimited":"encode"](_).finish(),function(p,m){if(p)return I.emit("error",p,o),w(p);if(null===m)return void I.end(!0);if(!(m instanceof f))try{m=f[I.responseDelimited?"decodeDelimited":"decode"](m)}catch(p){return I.emit("error",p,o),w(p)}return I.emit("data",m,o),w(null,m)})}catch(p){I.emit("error",p,o),setTimeout(function(){w(p)},0);return}},Service.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},0x12350b7f3:(o,p,f)=>{"use strict";o.exports=LongBits;var m=f(0x48fcd504);function LongBits(o,p){this.lo=o>>>0,this.hi=p>>>0}var _=LongBits.zero=new LongBits(0,0);_.toNumber=function(){return 0},_.zzEncode=_.zzDecode=function(){return this},_.length=function(){return 1};var w=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=function(o){if(0===o)return _;var p=o<0;p&&(o=-o);var f=o>>>0,m=(o-f)/0x100000000>>>0;return p&&(m=~m>>>0,f=~f>>>0,++f>0xffffffff&&(f=0,++m>0xffffffff&&(m=0))),new LongBits(f,m)},LongBits.from=function(o){if("number"==typeof o)return LongBits.fromNumber(o);if(m.isString(o))if(!m.Long)return LongBits.fromNumber(parseInt(o,10));else o=m.Long.fromString(o);return o.low||o.high?new LongBits(o.low>>>0,o.high>>>0):_},LongBits.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var p=~this.lo+1>>>0,f=~this.hi>>>0;return p||(f=f+1>>>0),-(p+0x100000000*f)}return this.lo+0x100000000*this.hi},LongBits.prototype.toLong=function(o){return m.Long?new m.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var I=String.prototype.charCodeAt;LongBits.fromHash=function(o){return o===w?_:new LongBits((I.call(o,0)|I.call(o,1)<<8|I.call(o,2)<<16|I.call(o,3)<<24)>>>0,(I.call(o,4)|I.call(o,5)<<8|I.call(o,6)<<16|I.call(o,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this},LongBits.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},LongBits.prototype.length=function(){var o=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return 0===f?0===p?o<16384?o<128?1:2:o<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:f<128?9:10}},0x48fcd504:function(o,p,f){"use strict";function merge(o,p,f){for(var m=Object.keys(p),_=0;_<m.length;++_)void 0!==o[m[_]]&&f||(o[m[_]]=p[m[_]]);return o}function newError(o){function CustomError(o,p){if(!(this instanceof CustomError))return new CustomError(o,p);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,CustomError):Object.defineProperty(this,"stack",{value:Error().stack||""}),p&&merge(this,p)}return CustomError.prototype=Object.create(Error.prototype,{constructor:{value:CustomError,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return o},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),CustomError}p.asPromise=f(0x1b9b9d364),p.base64=f(0xe3f8d71a),p.EventEmitter=f(0x18b00ebb3),p.float=f(0x1952be8cf),p.inquire=f(0x1b7035db9),p.utf8=f(0x112e6903a),p.pool=f(0xb2f775cb),p.LongBits=f(0x12350b7f3),p.isNode=!!(void 0!==f.g&&f.g&&f.g.process&&f.g.process.versions&&f.g.process.versions.node),p.global=p.isNode&&f.g||"u">typeof window&&window||"u">typeof self&&self||this,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},p.isString=function(o){return"string"==typeof o||o instanceof String},p.isObject=function(o){return o&&"object"==typeof o},p.isset=p.isSet=function(o,p){var f=o[p];return!!(null!=f&&o.hasOwnProperty(p))&&("object"!=typeof f||(Array.isArray(f)?f.length:Object.keys(f).length)>0)},p.Buffer=function(){try{var o=p.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch{return null}}(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(o){return"number"==typeof o?p.Buffer?p._Buffer_allocUnsafe(o):new p.Array(o):p.Buffer?p._Buffer_from(o):"u"<typeof Uint8Array?o:new Uint8Array(o)},p.Array="u">typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long"),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(o){return o?p.LongBits.from(o).toHash():p.LongBits.zeroHash},p.longFromHash=function(o,f){var m=p.LongBits.fromHash(o);return p.Long?p.Long.fromBits(m.lo,m.hi,f):m.toNumber(!!f)},p.merge=merge,p.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)},p.newError=newError,p.ProtocolError=newError("ProtocolError"),p.oneOfGetter=function(o){for(var p={},f=0;f<o.length;++f)p[o[f]]=1;return function(){for(var o=Object.keys(this),f=o.length-1;f>-1;--f)if(1===p[o[f]]&&void 0!==this[o[f]]&&null!==this[o[f]])return o[f]}},p.oneOfSetter=function(o){return function(p){for(var f=0;f<o.length;++f)o[f]!==p&&delete this[o[f]]}},p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},p._configure=function(){var o=p.Buffer;if(!o){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=o.from!==Uint8Array.from&&o.from||function(p,f){return new o(p,f)},p._Buffer_allocUnsafe=o.allocUnsafe||function(p){return new o(p)}}},0x28a80bef:(o,p,f)=>{"use strict";o.exports=Writer;var m,_=f(0x48fcd504),w=_.LongBits,I=_.base64,k=_.utf8;function Op(o,p,f){this.fn=o,this.len=p,this.next=void 0,this.val=f}function noop(){}function State(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create=function(){return _.Buffer?function(){return(Writer.create=function(){return new m})()}:function(){return new Writer}};function writeByte(o,p,f){p[f]=255&o}function writeVarint32(o,p,f){for(;o>127;)p[f++]=127&o|128,o>>>=7;p[f]=o}function VarintOp(o,p){this.len=o,this.next=void 0,this.val=p}function writeVarint64(o,p,f){for(;o.hi;)p[f++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)p[f++]=127&o.lo|128,o.lo=o.lo>>>7;p[f++]=o.lo}function writeFixed32(o,p,f){p[f]=255&o,p[f+1]=o>>>8&255,p[f+2]=o>>>16&255,p[f+3]=o>>>24}Writer.create=create(),Writer.alloc=function(o){return new _.Array(o)},_.Array!==Array&&(Writer.alloc=_.pool(Writer.alloc,_.Array.prototype.subarray)),Writer.prototype._push=function(o,p,f){return this.tail=this.tail.next=new Op(o,p,f),this.len+=p,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new VarintOp((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<0x10000000?4:5,o)).len,this},Writer.prototype.int32=function(o){return o<0?this._push(writeVarint64,10,w.fromNumber(o)):this.uint32(o)},Writer.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},Writer.prototype.uint64=function(o){var p=w.from(o);return this._push(writeVarint64,p.length(),p)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(o){var p=w.from(o).zzEncode();return this._push(writeVarint64,p.length(),p)},Writer.prototype.bool=function(o){return this._push(writeByte,1,+!!o)},Writer.prototype.fixed32=function(o){return this._push(writeFixed32,4,o>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(o){var p=w.from(o);return this._push(writeFixed32,4,p.lo)._push(writeFixed32,4,p.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(o){return this._push(_.float.writeFloatLE,4,o)},Writer.prototype.double=function(o){return this._push(_.float.writeDoubleLE,8,o)};var M=_.Array.prototype.set?function(o,p,f){p.set(o,f)}:function(o,p,f){for(var m=0;m<o.length;++m)p[f+m]=o[m]};Writer.prototype.bytes=function(o){var p=o.length>>>0;if(!p)return this._push(writeByte,1,0);if(_.isString(o)){var f=Writer.alloc(p=I.length(o));I.decode(o,f,0),o=f}return this.uint32(p)._push(M,p,o)},Writer.prototype.string=function(o){var p=k.length(o);return p?this.uint32(p)._push(k.write,p,o):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var o=this.head,p=this.tail,f=this.len;return this.reset().uint32(f),f&&(this.tail.next=o.next,this.tail=p,this.len+=f),this},Writer.prototype.finish=function(){for(var o=this.head.next,p=this.constructor.alloc(this.len),f=0;o;)o.fn(o.val,p,f),f+=o.len,o=o.next;return p},Writer._configure=function(o){m=o,Writer.create=create(),m._configure()}},0x1c7a0fc56:(o,p,f)=>{"use strict";o.exports=BufferWriter;var m=f(0x28a80bef);(BufferWriter.prototype=Object.create(m.prototype)).constructor=BufferWriter;var _=f(0x48fcd504);function BufferWriter(){m.call(this)}function writeStringBuffer(o,p,f){o.length<40?_.utf8.write(o,p,f):p.utf8Write?p.utf8Write(o,f):p.write(o,f)}BufferWriter._configure=function(){BufferWriter.alloc=_._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=_.Buffer&&_.Buffer.prototype instanceof Uint8Array&&"set"===_.Buffer.prototype.set.name?function(o,p,f){p.set(o,f)}:function(o,p,f){if(o.copy)o.copy(p,f,0,o.length);else for(var m=0;m<o.length;)p[f++]=o[m++]}},BufferWriter.prototype.bytes=function(o){_.isString(o)&&(o=_._Buffer_from(o,"base64"));var p=o.length>>>0;return this.uint32(p),p&&this._push(BufferWriter.writeBytesBuffer,p,o),this},BufferWriter.prototype.string=function(o){var p=_.Buffer.byteLength(o);return this.uint32(p),p&&this._push(writeStringBuffer,p,o),this},BufferWriter._configure()},0x373d7a51:(o,p,f)=>{"use strict";f.r(p),f.d(p,{__assign:()=>__assign,__asyncDelegator:()=>__asyncDelegator,__asyncGenerator:()=>__asyncGenerator,__asyncValues:()=>__asyncValues,__await:()=>__await,__awaiter:()=>__awaiter,__classPrivateFieldGet:()=>__classPrivateFieldGet,__classPrivateFieldSet:()=>__classPrivateFieldSet,__createBinding:()=>__createBinding,__decorate:()=>__decorate,__exportStar:()=>__exportStar,__extends:()=>__extends,__generator:()=>__generator,__importDefault:()=>__importDefault,__importStar:()=>__importStar,__makeTemplateObject:()=>__makeTemplateObject,__metadata:()=>__metadata,__param:()=>__param,__read:()=>__read,__rest:()=>__rest,__spread:()=>__spread,__spreadArrays:()=>__spreadArrays,__values:()=>__values});var extendStatics=function(o,p){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(o,p){o.__proto__=p}||function(o,p){for(var f in p)p.hasOwnProperty(f)&&(o[f]=p[f])})(o,p)};function __extends(o,p){function __(){this.constructor=o}extendStatics(o,p),o.prototype=null===p?Object.create(p):(__.prototype=p.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(o){for(var p,f=1,m=arguments.length;f<m;f++)for(var _ in p=arguments[f])Object.prototype.hasOwnProperty.call(p,_)&&(o[_]=p[_]);return o}).apply(this,arguments)};function __rest(o,p){var f={};for(var m in o)Object.prototype.hasOwnProperty.call(o,m)&&0>p.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_<m.length;_++)0>p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f}function __decorate(o,p,f,m){var _,w=arguments.length,I=w<3?p:null===m?m=Object.getOwnPropertyDescriptor(p,f):m;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)I=Reflect.decorate(o,p,f,m);else for(var k=o.length-1;k>=0;k--)(_=o[k])&&(I=(w<3?_(I):w>3?_(p,f,I):_(p,f))||I);return w>3&&I&&Object.defineProperty(p,f,I),I}function __param(o,p){return function(f,m){p(f,m,o)}}function __metadata(o,p){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(o,p)}function __awaiter(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})}function __generator(o,p){var f,m,_,w,I={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return w={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(w[Symbol.iterator]=function(){return this}),w;function verb(o){return function(p){return step([o,p])}}function step(w){if(f)throw TypeError("Generator is already executing.");for(;I;)try{if(f=1,m&&(_=2&w[0]?m.return:w[0]?m.throw||((_=m.return)&&_.call(m),0):m.next)&&!(_=_.call(m,w[1])).done)return _;switch(m=0,_&&(w=[2&w[0],_.value]),w[0]){case 0:case 1:_=w;break;case 4:return I.label++,{value:w[1],done:!1};case 5:I.label++,m=w[1],w=[0];continue;case 7:w=I.ops.pop(),I.trys.pop();continue;default:if(!(_=(_=I.trys).length>0&&_[_.length-1])&&(6===w[0]||2===w[0])){I=0;continue}if(3===w[0]&&(!_||w[1]>_[0]&&w[1]<_[3])){I.label=w[1];break}if(6===w[0]&&I.label<_[1]){I.label=_[1],_=w;break}if(_&&I.label<_[2]){I.label=_[2],I.ops.push(w);break}_[2]&&I.ops.pop(),I.trys.pop();continue}w=p.call(o,I)}catch(o){w=[6,o],m=0}finally{f=_=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}}function __createBinding(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}function __exportStar(o,p){for(var f in o)"default"===f||p.hasOwnProperty(f)||(p[f]=o[f])}function __values(o){var p="function"==typeof Symbol&&Symbol.iterator,f=p&&o[p],m=0;if(f)return f.call(o);if(o&&"number"==typeof o.length)return{next:function(){return o&&m>=o.length&&(o=void 0),{value:o&&o[m++],done:!o}}};throw TypeError(p?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,p){var f="function"==typeof Symbol&&o[Symbol.iterator];if(!f)return o;var m,_,w=f.call(o),I=[];try{for(;(void 0===p||p-- >0)&&!(m=w.next()).done;)I.push(m.value)}catch(o){_={error:o}}finally{try{m&&!m.done&&(f=w.return)&&f.call(w)}finally{if(_)throw _.error}}return I}function __spread(){for(var o=[],p=0;p<arguments.length;p++)o=o.concat(__read(arguments[p]));return o}function __spreadArrays(){for(var o=0,p=0,f=arguments.length;p<f;p++)o+=arguments[p].length;for(var m=Array(o),_=0,p=0;p<f;p++)for(var w=arguments[p],I=0,k=w.length;I<k;I++,_++)m[_]=w[I];return m}function __await(o){return this instanceof __await?(this.v=o,this):new __await(o)}function __asyncGenerator(o,p,f){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var m,_=f.apply(o,p||[]),w=[];return m={},verb("next"),verb("throw"),verb("return"),m[Symbol.asyncIterator]=function(){return this},m;function verb(o){_[o]&&(m[o]=function(p){return new Promise(function(f,m){w.push([o,p,f,m])>1||resume(o,p)})})}function resume(o,p){try{step(_[o](p))}catch(o){settle(w[0][3],o)}}function step(o){o.value instanceof __await?Promise.resolve(o.value.v).then(fulfill,reject):settle(w[0][2],o)}function fulfill(o){resume("next",o)}function reject(o){resume("throw",o)}function settle(o,p){o(p),w.shift(),w.length&&resume(w[0][0],w[0][1])}}function __asyncDelegator(o){var p,f;return p={},verb("next"),verb("throw",function(o){throw o}),verb("return"),p[Symbol.iterator]=function(){return this},p;function verb(m,_){p[m]=o[m]?function(p){return(f=!f)?{value:__await(o[m](p)),done:"return"===m}:_?_(p):p}:_}}function __asyncValues(o){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var p,f=o[Symbol.asyncIterator];return f?f.call(o):(o=__values(o),p={},verb("next"),verb("throw"),verb("return"),p[Symbol.asyncIterator]=function(){return this},p);function verb(f){p[f]=o[f]&&function(p){return new Promise(function(m,_){settle(m,_,(p=o[f](p)).done,p.value)})}}function settle(o,p,f,m){Promise.resolve(m).then(function(p){o({value:p,done:f})},p)}}function __makeTemplateObject(o,p){return Object.defineProperty?Object.defineProperty(o,"raw",{value:p}):o.raw=p,o}function __importStar(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)Object.hasOwnProperty.call(o,f)&&(p[f]=o[f]);return p.default=o,p}function __importDefault(o){return o&&o.__esModule?o:{default:o}}function __classPrivateFieldGet(o,p){if(!p.has(o))throw TypeError("attempted to get private field on non-instance");return p.get(o)}function __classPrivateFieldSet(o,p,f){if(!p.has(o))throw TypeError("attempted to set private field on non-instance");return p.set(o,f),f}},0x13f6890b8:function(o,p,f){var m;!function(_){"use strict";var w="function",I="undefined",k="object",M="string",x="major",O="model",L="name",B="type",U="vendor",$="version",q="architecture",Z="console",ee="mobile",et="tablet",ei="smarttv",er="wearable",en="embedded",eo="Amazon",es="Apple",ea="ASUS",el="BlackBerry",ed="Browser",ec="Chrome",eu="Firefox",eh="Google",ep="Huawei",ef="Microsoft",em="Motorola",eg="Opera",eS="Samsung",ev="Sharp",eb="Sony",ey="Xiaomi",e_="Zebra",eC="Facebook",eT="Chromium OS",eE="Mac OS",ew=" Browser",extend=function(o,p){var f={};for(var m in o)p[m]&&p[m].length%2==0?f[m]=p[m].concat(o[m]):f[m]=o[m];return f},enumerize=function(o){for(var p={},f=0;f<o.length;f++)p[o[f].toUpperCase()]=o[f];return p},has=function(o,p){return typeof o===M&&-1!==lowerize(p).indexOf(lowerize(o))},lowerize=function(o){return o.toLowerCase()},trim=function(o,p){if(typeof o===M)return o=o.replace(/^\s\s*/,""),typeof p===I?o:o.substring(0,500)},rgxMapper=function(o,p){for(var f,m,_,I,M,x,O=0;O<p.length&&!M;){var L=p[O],B=p[O+1];for(f=m=0;f<L.length&&!M&&L[f];)if(M=L[f++].exec(o))for(_=0;_<B.length;_++)x=M[++m],typeof(I=B[_])===k&&I.length>0?2===I.length?typeof I[1]==w?this[I[0]]=I[1].call(this,x):this[I[0]]=I[1]:3===I.length?typeof I[1]!==w||I[1].exec&&I[1].test?this[I[0]]=x?x.replace(I[1],I[2]):void 0:this[I[0]]=x?I[1].call(this,x,I[2]):void 0:4===I.length&&(this[I[0]]=x?I[3].call(this,x.replace(I[1],I[2])):void 0):this[I]=x||void 0;O+=2}},strMapper=function(o,p){for(var f in p)if(typeof p[f]===k&&p[f].length>0){for(var m=0;m<p[f].length;m++)if(has(p[f][m],o))return"?"===f?void 0:f}else if(has(p[f],o))return"?"===f?void 0:f;return p.hasOwnProperty("*")?p["*"]:o},eI={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"},eA={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[$,[L,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[$,[L,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[L,$],[/opios[\/ ]+([\w\.]+)/i],[$,[L,eg+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[$,[L,eg+" GX"]],[/\bopr\/([\w\.]+)/i],[$,[L,eg]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[$,[L,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[$,[L,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[L,$],[/quark(?:pc)?\/([-\w\.]+)/i],[$,[L,"Quark"]],[/\bddg\/([\w\.]+)/i],[$,[L,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[$,[L,"UC"+ed]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[$,[L,"WeChat"]],[/konqueror\/([\w\.]+)/i],[$,[L,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[$,[L,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[$,[L,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[$,[L,"Smart Lenovo "+ed]],[/(avast|avg)\/([\w\.]+)/i],[[L,/(.+)/,"$1 Secure "+ed],$],[/\bfocus\/([\w\.]+)/i],[$,[L,eu+" Focus"]],[/\bopt\/([\w\.]+)/i],[$,[L,eg+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[$,[L,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[$,[L,"Dolphin"]],[/coast\/([\w\.]+)/i],[$,[L,eg+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[$,[L,"MIUI"+ew]],[/fxios\/([\w\.-]+)/i],[$,[L,eu]],[/\bqihoobrowser\/?([\w\.]*)/i],[$,[L,"360"]],[/\b(qq)\/([\w\.]+)/i],[[L,/(.+)/,"$1Browser"],$],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[L,/(.+)/,"$1"+ew],$],[/samsungbrowser\/([\w\.]+)/i],[$,[L,eS+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[$,[L,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[L,"Sogou Mobile"],$],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[L,$],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[L],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[$,L],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[L,eC],$],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[L,$],[/\bgsa\/([\w\.]+) .*safari\//i],[$,[L,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[$,[L,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[$,[L,ec+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[L,ec+" WebView"],$],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[$,[L,"Android "+ed]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[L,$],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[$,[L,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[$,L],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[L,[$,strMapper,{"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],[L,$],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[L,"Netscape"],$],[/(wolvic|librewolf)\/([\w\.]+)/i],[L,$],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[$,[L,eu+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[L,[$,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[L,[$,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[q,"amd64"]],[/(ia32(?=;))/i],[[q,lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[q,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[q,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[q,"armhf"]],[/windows (ce|mobile); ppc;/i],[[q,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[q,/ower/,"",lowerize]],[/(sun4\w)[;\)]/i],[[q,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[q,lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[O,[U,eS],[B,et]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[O,[U,eS],[B,ee]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[O,[U,es],[B,ee]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[O,[U,es],[B,et]],[/(macintosh);/i],[O,[U,es]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[O,[U,ev],[B,ee]],[/(?:honor)([-\w ]+)[;\)]/i],[O,[U,"Honor"],[B,ee]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[O,[U,ep],[B,et]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[O,[U,ep],[B,ee]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[O,/_/g," "],[U,ey],[B,ee]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[O,/_/g," "],[U,ey],[B,et]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[O,[U,"OPPO"],[B,ee]],[/\b(opd2\d{3}a?) bui/i],[O,[U,"OPPO"],[B,et]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[O,[U,"Vivo"],[B,ee]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[O,[U,"Realme"],[B,ee]],[/\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],[O,[U,em],[B,ee]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[O,[U,em],[B,et]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[O,[U,"LG"],[B,et]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[O,[U,"LG"],[B,ee]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[O,[U,"Lenovo"],[B,et]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[O,/_/g," "],[U,"Nokia"],[B,ee]],[/(pixel c)\b/i],[O,[U,eh],[B,et]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[O,[U,eh],[B,ee]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[O,[U,eb],[B,ee]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[O,"Xperia Tablet"],[U,eb],[B,et]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[O,[U,"OnePlus"],[B,ee]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[O,[U,eo],[B,et]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[O,/(.+)/g,"Fire Phone $1"],[U,eo],[B,ee]],[/(playbook);[-\w\),; ]+(rim)/i],[O,U,[B,et]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[O,[U,el],[B,ee]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[O,[U,ea],[B,et]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[O,[U,ea],[B,ee]],[/(nexus 9)/i],[O,[U,"HTC"],[B,et]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[U,[O,/_/g," "],[B,ee]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[O,[U,"TCL"],[B,et]],[/(itel) ((\w+))/i],[[U,lowerize],O,[B,strMapper,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[O,[U,"Acer"],[B,et]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[O,[U,"Meizu"],[B,ee]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[O,[U,"Ulefone"],[B,ee]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[O,[U,"Energizer"],[B,ee]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[O,[U,"Cat"],[B,ee]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[O,[U,"Smartfren"],[B,ee]],[/droid.+; (a(?:015|06[35]|142p?))/i],[O,[U,"Nothing"],[B,ee]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[U,O,[B,ee]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[U,O,[B,et]],[/(surface duo)/i],[O,[U,ef],[B,et]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[O,[U,"Fairphone"],[B,ee]],[/(u304aa)/i],[O,[U,"AT&T"],[B,ee]],[/\bsie-(\w*)/i],[O,[U,"Siemens"],[B,ee]],[/\b(rct\w+) b/i],[O,[U,"RCA"],[B,et]],[/\b(venue[\d ]{2,7}) b/i],[O,[U,"Dell"],[B,et]],[/\b(q(?:mv|ta)\w+) b/i],[O,[U,"Verizon"],[B,et]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[O,[U,"Barnes & Noble"],[B,et]],[/\b(tm\d{3}\w+) b/i],[O,[U,"NuVision"],[B,et]],[/\b(k88) b/i],[O,[U,"ZTE"],[B,et]],[/\b(nx\d{3}j) b/i],[O,[U,"ZTE"],[B,ee]],[/\b(gen\d{3}) b.+49h/i],[O,[U,"Swiss"],[B,ee]],[/\b(zur\d{3}) b/i],[O,[U,"Swiss"],[B,et]],[/\b((zeki)?tb.*\b) b/i],[O,[U,"Zeki"],[B,et]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[U,"Dragon Touch"],O,[B,et]],[/\b(ns-?\w{0,9}) b/i],[O,[U,"Insignia"],[B,et]],[/\b((nxa|next)-?\w{0,9}) b/i],[O,[U,"NextBook"],[B,et]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[U,"Voice"],O,[B,ee]],[/\b(lvtel\-)?(v1[12]) b/i],[[U,"LvTel"],O,[B,ee]],[/\b(ph-1) /i],[O,[U,"Essential"],[B,ee]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[O,[U,"Envizen"],[B,et]],[/\b(trio[-\w\. ]+) b/i],[O,[U,"MachSpeed"],[B,et]],[/\btu_(1491) b/i],[O,[U,"Rotor"],[B,et]],[/(shield[\w ]+) b/i],[O,[U,"Nvidia"],[B,et]],[/(sprint) (\w+)/i],[U,O,[B,ee]],[/(kin\.[onetw]{3})/i],[[O,/\./g," "],[U,ef],[B,ee]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[O,[U,e_],[B,et]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[O,[U,e_],[B,ee]],[/smart-tv.+(samsung)/i],[U,[B,ei]],[/hbbtv.+maple;(\d+)/i],[[O,/^/,"SmartTV"],[U,eS],[B,ei]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[U,"LG"],[B,ei]],[/(apple) ?tv/i],[U,[O,es+" TV"],[B,ei]],[/crkey/i],[[O,ec+"cast"],[U,eh],[B,ei]],[/droid.+aft(\w+)( bui|\))/i],[O,[U,eo],[B,ei]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[O,[U,ev],[B,ei]],[/(bravia[\w ]+)( bui|\))/i],[O,[U,eb],[B,ei]],[/(mitv-\w{5}) bui/i],[O,[U,ey],[B,ei]],[/Hbbtv.*(technisat) (.*);/i],[U,O,[B,ei]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[U,trim],[O,trim],[B,ei]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[B,ei]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[U,O,[B,Z]],[/droid.+; (shield) bui/i],[O,[U,"Nvidia"],[B,Z]],[/(playstation [345portablevi]+)/i],[O,[U,eb],[B,Z]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[O,[U,ef],[B,Z]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[O,[U,eS],[B,er]],[/((pebble))app/i],[U,O,[B,er]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[O,[U,es],[B,er]],[/droid.+; (glass) \d/i],[O,[U,eh],[B,er]],[/droid.+; (wt63?0{2,3})\)/i],[O,[U,e_],[B,er]],[/droid.+; (glass) \d/i],[O,[U,eh],[B,er]],[/(pico) (4|neo3(?: link|pro)?)/i],[U,O,[B,er]],[/; (quest( \d| pro)?)/i],[O,[U,eC],[B,er]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[U,[B,en]],[/(aeobc)\b/i],[O,[U,eo],[B,en]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[O,[B,ee]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[O,[B,et]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[B,et]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[B,ee]],[/(android[-\w\. ]{0,9});.+buil/i],[O,[U,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[$,[L,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[L,$],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[$,[L,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[L,$],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[$,L]],os:[[/microsoft (windows) (vista|xp)/i],[L,$],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[L,[$,strMapper,eI]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[$,strMapper,eI],[L,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[$,/_/g,"."],[L,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[L,eE],[$,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[$,L],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[L,$],[/\(bb(10);/i],[$,[L,el]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[$,[L,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[$,[L,eu+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[$,[L,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[$,[L,"watchOS"]],[/crkey\/([\d\.]+)/i],[$,[L,ec+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[L,eT],$],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[L,$],[/(sunos) ?([\w\.\d]*)/i],[[L,"Solaris"],$],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[L,$]]},UAParser=function(o,p){if(typeof o===k&&(p=o,o=void 0),!(this instanceof UAParser))return new UAParser(o,p).getResult();var f=typeof _!==I&&_.navigator?_.navigator:void 0,m=o||(f&&f.userAgent?f.userAgent:""),Z=f&&f.userAgentData?f.userAgentData:void 0,ei=p?extend(eA,p):eA,er=f&&f.userAgent==m;return this.getBrowser=function(){var o,p={};return p[L]=void 0,p[$]=void 0,rgxMapper.call(p,m,ei.browser),p[x]=typeof(o=p[$])===M?o.replace(/[^\d\.]/g,"").split(".")[0]:void 0,er&&f&&f.brave&&typeof f.brave.isBrave==w&&(p[L]="Brave"),p},this.getCPU=function(){var o={};return o[q]=void 0,rgxMapper.call(o,m,ei.cpu),o},this.getDevice=function(){var o={};return o[U]=void 0,o[O]=void 0,o[B]=void 0,rgxMapper.call(o,m,ei.device),er&&!o[B]&&Z&&Z.mobile&&(o[B]=ee),er&&"Macintosh"==o[O]&&f&&typeof f.standalone!==I&&f.maxTouchPoints&&f.maxTouchPoints>2&&(o[O]="iPad",o[B]=et),o},this.getEngine=function(){var o={};return o[L]=void 0,o[$]=void 0,rgxMapper.call(o,m,ei.engine),o},this.getOS=function(){var o={};return o[L]=void 0,o[$]=void 0,rgxMapper.call(o,m,ei.os),er&&!o[L]&&Z&&Z.platform&&"Unknown"!=Z.platform&&(o[L]=Z.platform.replace(/chrome os/i,eT).replace(/macos/i,eE)),o},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 m},this.setUA=function(o){return m=typeof o===M&&o.length>500?trim(o,500):o,this},this.setUA(m),this};UAParser.VERSION="1.0.40",UAParser.BROWSER=enumerize([L,$,x]),UAParser.CPU=enumerize([q]),UAParser.DEVICE=enumerize([O,U,B,Z,ee,ei,et,er,en]),UAParser.ENGINE=UAParser.OS=enumerize([L,$]),typeof p!==I?(o.exports&&(p=o.exports=UAParser),p.UAParser=UAParser):f.amdO?void 0===(m=(function(){return UAParser}).call(p,f,p,o))||(o.exports=m):typeof _!==I&&(_.UAParser=UAParser);var ek=typeof _!==I&&(_.jQuery||_.Zepto);if(ek&&!ek.ua){var eM=new UAParser;ek.ua=eM.getResult(),ek.ua.get=function(){return eM.getUA()},ek.ua.set=function(o){eM.setUA(o);var p=eM.getResult();for(var f in p)ek.ua[f]=p[f]}}}("object"==typeof window?window:this)},0x15b6c0ccc:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});let __WEBPACK_DEFAULT_EXPORT__=function(o,p){}},0x1aee62d78:o=>{o.exports=JSON.parse('{"name":"@aws-sdk/client-chime-sdk-messaging","description":"AWS SDK for JavaScript Chime Sdk Messaging Client for Node.js, Browser and React Native","version":"3.662.0","scripts":{"build":"concurrently \'yarn:build:cjs\' \'yarn:build:es\' \'yarn:build:types\'","build:cjs":"node ../../scripts/compilation/inline client-chime-sdk-messaging","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo chime-sdk-messaging"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.662.0","@aws-sdk/client-sts":"3.662.0","@aws-sdk/core":"3.662.0","@aws-sdk/credential-provider-node":"3.662.0","@aws-sdk/middleware-host-header":"3.662.0","@aws-sdk/middleware-logger":"3.662.0","@aws-sdk/middleware-recursion-detection":"3.662.0","@aws-sdk/middleware-user-agent":"3.662.0","@aws-sdk/region-config-resolver":"3.662.0","@aws-sdk/types":"3.662.0","@aws-sdk/util-endpoints":"3.662.0","@aws-sdk/util-user-agent-browser":"3.662.0","@aws-sdk/util-user-agent-node":"3.662.0","@smithy/config-resolver":"^3.0.9","@smithy/core":"^2.4.7","@smithy/fetch-http-handler":"^3.2.9","@smithy/hash-node":"^3.0.7","@smithy/invalid-dependency":"^3.0.7","@smithy/middleware-content-length":"^3.0.9","@smithy/middleware-endpoint":"^3.1.4","@smithy/middleware-retry":"^3.0.22","@smithy/middleware-serde":"^3.0.7","@smithy/middleware-stack":"^3.0.7","@smithy/node-config-provider":"^3.1.8","@smithy/node-http-handler":"^3.2.4","@smithy/protocol-http":"^4.1.4","@smithy/smithy-client":"^3.3.6","@smithy/types":"^3.5.0","@smithy/url-parser":"^3.0.7","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.22","@smithy/util-defaults-mode-node":"^3.0.22","@smithy/util-endpoints":"^2.1.3","@smithy/util-middleware":"^3.0.7","@smithy/util-retry":"^3.0.7","@smithy/util-utf8":"^3.0.0","tslib":"^2.6.2","uuid":"^9.0.1"},"devDependencies":{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96","@types/uuid":"^9.0.4","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~4.9.5"},"engines":{"node":">=16.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-chime-sdk-messaging","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-chime-sdk-messaging"}}')},0x48128888:o=>{o.exports=JSON.parse('{"partitions":[{"id":"aws","outputs":{"dnsSuffix":"amazonaws.com","dualStackDnsSuffix":"api.aws","implicitGlobalRegion":"us-east-1","name":"aws","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^(us|eu|ap|sa|ca|me|af|il|mx)\\\\-\\\\w+\\\\-\\\\d+$","regions":{"af-south-1":{"description":"Africa (Cape Town)"},"ap-east-1":{"description":"Asia Pacific (Hong Kong)"},"ap-northeast-1":{"description":"Asia Pacific (Tokyo)"},"ap-northeast-2":{"description":"Asia Pacific (Seoul)"},"ap-northeast-3":{"description":"Asia Pacific (Osaka)"},"ap-south-1":{"description":"Asia Pacific (Mumbai)"},"ap-south-2":{"description":"Asia Pacific (Hyderabad)"},"ap-southeast-1":{"description":"Asia Pacific (Singapore)"},"ap-southeast-2":{"description":"Asia Pacific (Sydney)"},"ap-southeast-3":{"description":"Asia Pacific (Jakarta)"},"ap-southeast-4":{"description":"Asia Pacific (Melbourne)"},"ap-southeast-5":{"description":"Asia Pacific (Malaysia)"},"aws-global":{"description":"AWS Standard global region"},"ca-central-1":{"description":"Canada (Central)"},"ca-west-1":{"description":"Canada West (Calgary)"},"eu-central-1":{"description":"Europe (Frankfurt)"},"eu-central-2":{"description":"Europe (Zurich)"},"eu-north-1":{"description":"Europe (Stockholm)"},"eu-south-1":{"description":"Europe (Milan)"},"eu-south-2":{"description":"Europe (Spain)"},"eu-west-1":{"description":"Europe (Ireland)"},"eu-west-2":{"description":"Europe (London)"},"eu-west-3":{"description":"Europe (Paris)"},"il-central-1":{"description":"Israel (Tel Aviv)"},"me-central-1":{"description":"Middle East (UAE)"},"me-south-1":{"description":"Middle East (Bahrain)"},"sa-east-1":{"description":"South America (Sao Paulo)"},"us-east-1":{"description":"US East (N. Virginia)"},"us-east-2":{"description":"US East (Ohio)"},"us-west-1":{"description":"US West (N. California)"},"us-west-2":{"description":"US West (Oregon)"}}},{"id":"aws-cn","outputs":{"dnsSuffix":"amazonaws.com.cn","dualStackDnsSuffix":"api.amazonwebservices.com.cn","implicitGlobalRegion":"cn-northwest-1","name":"aws-cn","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^cn\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-cn-global":{"description":"AWS China global region"},"cn-north-1":{"description":"China (Beijing)"},"cn-northwest-1":{"description":"China (Ningxia)"}}},{"id":"aws-us-gov","outputs":{"dnsSuffix":"amazonaws.com","dualStackDnsSuffix":"api.aws","implicitGlobalRegion":"us-gov-west-1","name":"aws-us-gov","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^us\\\\-gov\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-us-gov-global":{"description":"AWS GovCloud (US) global region"},"us-gov-east-1":{"description":"AWS GovCloud (US-East)"},"us-gov-west-1":{"description":"AWS GovCloud (US-West)"}}},{"id":"aws-iso","outputs":{"dnsSuffix":"c2s.ic.gov","dualStackDnsSuffix":"c2s.ic.gov","implicitGlobalRegion":"us-iso-east-1","name":"aws-iso","supportsDualStack":false,"supportsFIPS":true},"regionRegex":"^us\\\\-iso\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-global":{"description":"AWS ISO (US) global region"},"us-iso-east-1":{"description":"US ISO East"},"us-iso-west-1":{"description":"US ISO WEST"}}},{"id":"aws-iso-b","outputs":{"dnsSuffix":"sc2s.sgov.gov","dualStackDnsSuffix":"sc2s.sgov.gov","implicitGlobalRegion":"us-isob-east-1","name":"aws-iso-b","supportsDualStack":false,"supportsFIPS":true},"regionRegex":"^us\\\\-isob\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-b-global":{"description":"AWS ISOB (US) global region"},"us-isob-east-1":{"description":"US ISOB East (Ohio)"}}},{"id":"aws-iso-e","outputs":{"dnsSuffix":"cloud.adc-e.uk","dualStackDnsSuffix":"cloud.adc-e.uk","implicitGlobalRegion":"eu-isoe-west-1","name":"aws-iso-e","supportsDualStack":false,"supportsFIPS":true},"regionRegex":"^eu\\\\-isoe\\\\-\\\\w+\\\\-\\\\d+$","regions":{"eu-isoe-west-1":{"description":"EU ISOE West"}}},{"id":"aws-iso-f","outputs":{"dnsSuffix":"csp.hci.ic.gov","dualStackDnsSuffix":"csp.hci.ic.gov","implicitGlobalRegion":"us-isof-south-1","name":"aws-iso-f","supportsDualStack":false,"supportsFIPS":true},"regionRegex":"^us\\\\-isof\\\\-\\\\w+\\\\-\\\\d+$","regions":{}}],"version":"1.1"}')},0x1113da030:(o,p,f)=>{"use strict";function _arrayLikeToArray(o,p){(null==p||p>o.length)&&(p=o.length);for(var f=0,m=Array(p);f<p;f++)m[f]=o[f];return m}f.d(p,{A:()=>_arrayLikeToArray})},0x241c9be90:(o,p,f)=>{"use strict";function _assertThisInitialized(o){if(void 0===o)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return o}f.d(p,{A:()=>_assertThisInitialized})},0x1ea9aeffc:(o,p,f)=>{"use strict";function _classCallCheck(o,p){if(!(o instanceof p))throw TypeError("Cannot call a class as a function")}f.d(p,{A:()=>_classCallCheck})},0x5ab4fe2c:(o,p,f)=>{"use strict";f.d(p,{A:()=>_createClass});var m=f(0xa258e609);function _defineProperties(o,p){for(var f=0;f<p.length;f++){var _=p[f];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(o,(0,m.A)(_.key),_)}}function _createClass(o,p,f){return p&&_defineProperties(o.prototype,p),f&&_defineProperties(o,f),Object.defineProperty(o,"prototype",{writable:!1}),o}},0x230683f4f:(o,p,f)=>{"use strict";function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}f.d(p,{A:()=>_getPrototypeOf})},0x15b373e44:(o,p,f)=>{"use strict";f.d(p,{A:()=>_inherits});var m=f(0xcc9097b);function _inherits(o,p){if("function"!=typeof p&&null!==p)throw TypeError("Super expression must either be null or a function");o.prototype=Object.create(p&&p.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),p&&(0,m.A)(o,p)}},0x106d6e483:(o,p,f)=>{"use strict";f.d(p,{A:()=>_possibleConstructorReturn});var m=f(0x116cb6d85),_=f(0x241c9be90);function _possibleConstructorReturn(o,p){if(p&&("object"==(0,m.A)(p)||"function"==typeof p))return p;if(void 0!==p)throw TypeError("Derived constructors may only return object or undefined");return(0,_.A)(o)}},0x20d9752e1:(o,p,f)=>{"use strict";function _arrayWithHoles(o){if(Array.isArray(o))return o}function _iterableToArrayLimit(o,p){var f=null==o?null:"u">typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(null!=f){var m,_,w,I,k=[],M=!0,x=!1;try{if(w=(f=f.call(o)).next,0===p){if(Object(f)!==f)return;M=!1}else for(;!(M=(m=w.call(f)).done)&&(k.push(m.value),k.length!==p);M=!0);}catch(o){x=!0,_=o}finally{try{if(!M&&null!=f.return&&(I=f.return(),Object(I)!==I))return}finally{if(x)throw _}}return k}}f.d(p,{A:()=>_slicedToArray});var m=f(0x220f5fef1);function _nonIterableRest(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _slicedToArray(o,p){return _arrayWithHoles(o)||_iterableToArrayLimit(o,p)||(0,m.A)(o,p)||_nonIterableRest()}},0x250cdd33f:(o,p,f)=>{"use strict";f.d(p,{A:()=>_toConsumableArray});var m=f(0x1113da030);function _arrayWithoutHoles(o){if(Array.isArray(o))return(0,m.A)(o)}function _iterableToArray(o){if("u">typeof Symbol&&null!=o[Symbol.iterator]||null!=o["@@iterator"])return Array.from(o)}var _=f(0x220f5fef1);function _nonIterableSpread(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _toConsumableArray(o){return _arrayWithoutHoles(o)||_iterableToArray(o)||(0,_.A)(o)||_nonIterableSpread()}},0x220f5fef1:(o,p,f)=>{"use strict";f.d(p,{A:()=>_unsupportedIterableToArray});var m=f(0x1113da030);function _unsupportedIterableToArray(o,p){if(o){if("string"==typeof o)return(0,m.A)(o,p);var f=({}).toString.call(o).slice(8,-1);return"Object"===f&&o.constructor&&(f=o.constructor.name),"Map"===f||"Set"===f?Array.from(o):"Arguments"===f||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f)?(0,m.A)(o,p):void 0}}},0x15ee65f83:(o,p,f)=>{"use strict";let m,_,w;function base64Decode(o){let p=getDecodeTable(),f=3*o.length/4;"="==o[o.length-2]?f-=2:"="==o[o.length-1]&&(f-=1);let m=new Uint8Array(f),_=0,w=0,I,k=0;for(let f=0;f<o.length;f++){if(void 0===(I=p[o.charCodeAt(f)]))switch(o[f]){case"=":w=0;case`
`:case`\r`:case"	":case" ":continue;default:throw Error("invalid base64 string")}switch(w){case 0:k=I,w=1;break;case 1:m[_++]=k<<2|(48&I)>>4,k=I,w=2;break;case 2:m[_++]=(15&k)<<4|(60&I)>>2,k=I,w=3;break;case 3:m[_++]=(3&k)<<6|I,w=0}}if(1==w)throw Error("invalid base64 string");return m.subarray(0,_)}function getEncodeTable(o){return m||(_=(m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("")).slice(0,-2).concat("-","_")),"url"==o?_:m}function getDecodeTable(){if(!w){w=[];let o=getEncodeTable("std");for(let p=0;p<o.length;p++)w[o[p].charCodeAt(0)]=p;w[45]=o.indexOf("+"),w[95]=o.indexOf("/")}return w}function protoCamelCase(o){let p=!1,f=[];for(let m=0;m<o.length;m++){let _=o.charAt(m);switch(_){case"_":p=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":f.push(_),p=!1;break;default:p&&(p=!1,_=_.toUpperCase()),f.push(_)}}return f.join("")}f.d(p,{w:()=>fileDesc});let I=new Set(["constructor","toString","toJSON","valueOf"]);function safeObjectProperty(o){return I.has(o)?o+"$":o}var k,M,x,O,L,B,U,$,q,Z,ee,et,ei,er,en,eo,es,ea,el,ed,ec,eu,eh,ep,ef,em,eg,eS,ev,eb,ey,e_,eC,eT,eE,ew,eI,eA,ek,eM,ex=f(0x12ea8153);function restoreJsonNames(o){for(let p of o.field)(0,ex.b1)(p,"jsonName")||(p.jsonName=protoCamelCase(p.name));o.nestedType.forEach(restoreJsonNames)}var eP=f(0x15ee7d00f),eR=f(0x9003db35);function parseTextFormatEnumValue(o,p){let f=o.values.find(o=>o.name===p);if(!f)throw Error(`cannot parse ${o} default value: ${p}`);return f.number}function parseTextFormatScalarValue(o,p){switch(o){case eP.L.STRING:return p;case eP.L.BYTES:{let f=unescapeBytesDefaultValue(p);if(!1===f)throw Error(`cannot parse ${eP.L[o]} default value: ${p}`);return f}case eP.L.INT64:case eP.L.SFIXED64:case eP.L.SINT64:return eR.M.parse(p);case eP.L.UINT64:case eP.L.FIXED64:return eR.M.uParse(p);case eP.L.DOUBLE:case eP.L.FLOAT:switch(p){case"inf":return 1/0;case"-inf":return-1/0;case"nan":return NaN;default:return parseFloat(p)}case eP.L.BOOL:return"true"===p;case eP.L.INT32:case eP.L.UINT32:case eP.L.SINT32:case eP.L.FIXED32:case eP.L.SFIXED32:return parseInt(p,10)}}function unescapeBytesDefaultValue(o){let p=[],f={tail:o,c:"",next(){return 0!=this.tail.length&&(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(o){if(this.tail.length>=o){let p=this.tail.substring(0,o);return this.tail=this.tail.substring(o),p}return!1}};for(;f.next();)if("\\"===f.c){if(f.next())switch(f.c){case"\\":p.push(f.c.charCodeAt(0));break;case"b":p.push(8);break;case"f":p.push(12);break;case"n":p.push(10);break;case"r":p.push(13);break;case"t":p.push(9);break;case"v":p.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let o=f.c,m=f.take(2);if(!1===m)return!1;let _=parseInt(o+m,8);if(Number.isNaN(_))return!1;p.push(_);break}case"x":{let o=f.c,m=f.take(2);if(!1===m)return!1;let _=parseInt(o+m,16);if(Number.isNaN(_))return!1;p.push(_);break}case"u":{let o=f.c,m=f.take(4);if(!1===m)return!1;let _=parseInt(o+m,16);if(Number.isNaN(_))return!1;let w=new Uint8Array(4);new DataView(w.buffer).setInt32(0,_,!0),p.push(w[0],w[1],w[2],w[3]);break}case"U":{let o=f.c,m=f.take(8);if(!1===m)return!1;let _=eR.M.uEnc(o+m),w=new Uint8Array(8),I=new DataView(w.buffer);I.setInt32(0,_.lo,!0),I.setInt32(4,_.hi,!0),p.push(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7])}}}else p.push(f.c.charCodeAt(0));return new Uint8Array(p)}function*nestedTypes(o){switch(o.kind){case"file":for(let p of o.messages)yield p,yield*nestedTypes(p);yield*o.enums,yield*o.services,yield*o.extensions;break;case"message":for(let p of o.nestedMessages)yield p,yield*nestedTypes(p);yield*o.nestedEnums,yield*o.nestedExtensions}}function createFileRegistry(...o){let p=createBaseRegistry();if(!o.length)return p;if("$typeName"in o[0]&&"google.protobuf.FileDescriptorSet"==o[0].$typeName){for(let f of o[0].file)addFile(f,p);return p}if("$typeName"in o[0]){let f=o[0],m=o[1],_=new Set;function recurseDeps(o){let f=[];for(let w of o.dependency){if(void 0!=p.getFile(w)||_.has(w))continue;let I=m(w);if(!I)throw Error(`Unable to resolve ${w}, imported by ${o.name}`);"kind"in I?p.addFile(I,!1,!0):(_.add(I.name),f.push(I))}return f.concat(...f.map(recurseDeps))}for(let o of[f,...recurseDeps(f)].reverse())addFile(o,p)}else for(let f of o)for(let o of f.files)p.addFile(o);return p}function createBaseRegistry(){let o=new Map,p=new Map,f=new Map;return{kind:"registry",types:o,extendees:p,[Symbol.iterator]:()=>o.values(),get files(){return f.values()},addFile(o,p,m){if(f.set(o.proto.name,o),!p)for(let p of nestedTypes(o))this.add(p);if(m)for(let f of o.dependencies)this.addFile(f,p,m)},add(f){if("extension"==f.kind){let o=p.get(f.extendee.typeName);o||p.set(f.extendee.typeName,o=new Map),o.set(f.number,f)}o.set(f.typeName,f)},get:p=>o.get(p),getFile:o=>f.get(o),getMessage(p){let f=o.get(p);return(null==f?void 0:f.kind)=="message"?f:void 0},getEnum(p){let f=o.get(p);return(null==f?void 0:f.kind)=="enum"?f:void 0},getExtension(p){let f=o.get(p);return(null==f?void 0:f.kind)=="extension"?f:void 0},getExtensionFor(o,f){var m;return null==(m=p.get(o.typeName))?void 0:m.get(f)},getService(p){let f=o.get(p);return(null==f?void 0:f.kind)=="service"?f:void 0}}}let eO={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function addFile(o,p){var f,m;let _={kind:"file",proto:o,deprecated:null!=(m=null==(f=o.options)?void 0:f.deprecated)&&m,edition:getFileEdition(o),name:o.name.replace(/\.proto$/,""),dependencies:findFileDependencies(o,p),enums:[],messages:[],extensions:[],services:[],toString:()=>`file ${o.name}`},w=new Map,I={get:o=>w.get(o),add(o){var p;assert((null==(p=o.proto.options)?void 0:p.mapEntry)===!0),w.set(o.typeName,o)}};for(let f of o.enumType)addEnum(f,_,void 0,p);for(let f of o.messageType)addMessage(f,_,void 0,p,I);for(let f of o.service)addService(f,_,p);for(let o of(addExtensions(_,p),w.values()))addFields(o,p,I);for(let o of _.messages)addFields(o,p,I),addExtensions(o,p);p.addFile(_,!0)}function addExtensions(o,p){switch(o.kind){case"file":for(let f of o.proto.extension){let m=newField(f,o,p);o.extensions.push(m),p.add(m)}break;case"message":for(let f of o.proto.extension){let m=newField(f,o,p);o.nestedExtensions.push(m),p.add(m)}for(let f of o.nestedMessages)addExtensions(f,p)}}function addFields(o,p,f){let m=o.proto.oneofDecl.map(p=>newOneof(p,o)),_=new Set;for(let w of o.proto.field){let I=findOneof(w,m),k=newField(w,o,p,I,f);o.fields.push(k),o.field[k.localName]=k,void 0===I?o.members.push(k):(I.fields.push(k),_.has(I)||(_.add(I),o.members.push(I)))}for(let p of m.filter(o=>_.has(o)))o.oneofs.push(p);for(let m of o.nestedMessages)addFields(m,p,f)}function addEnum(o,p,f,m){var _,w,I,k,M;let x=findEnumSharedPrefix(o.name,o.value),O={kind:"enum",proto:o,deprecated:null!=(w=null==(_=o.options)?void 0:_.deprecated)&&w,file:p,parent:f,open:!0,name:o.name,typeName:makeTypeName(o,f,p),value:{},values:[],sharedPrefix:x,toString(){return`enum ${this.typeName}`}};for(let p of(O.open=isEnumOpen(O),m.add(O),o.value)){let o=p.name;O.values.push(O.value[p.number]={kind:"enum_value",proto:p,deprecated:null!=(k=null==(I=p.options)?void 0:I.deprecated)&&k,parent:O,name:o,localName:safeObjectProperty(void 0==x?o:o.substring(x.length)),number:p.number,toString:()=>`enum value ${O.typeName}.${o}`})}(null!=(M=null==f?void 0:f.nestedEnums)?M:p.enums).push(O)}function addMessage(o,p,f,m,_){var w,I,k,M;let x={kind:"message",proto:o,deprecated:null!=(I=null==(w=o.options)?void 0:w.deprecated)&&I,file:p,parent:f,name:o.name,typeName:makeTypeName(o,f,p),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};for(let w of((null==(k=o.options)?void 0:k.mapEntry)===!0?_.add(x):((null!=(M=null==f?void 0:f.nestedMessages)?M:p.messages).push(x),m.add(x)),o.enumType))addEnum(w,p,x,m);for(let f of o.nestedType)addMessage(f,p,x,m,_)}function addService(o,p,f){var m,_;let w={kind:"service",proto:o,deprecated:null!=(_=null==(m=o.options)?void 0:m.deprecated)&&_,file:p,name:o.name,typeName:makeTypeName(o,void 0,p),methods:[],method:{},toString(){return`service ${this.typeName}`}};for(let m of(p.services.push(w),f.add(w),o.method)){let o=newMethod(m,w,f);w.methods.push(o),w.method[o.localName]=o}}function newMethod(o,p,f){var m,_,w,I;let k;k=o.clientStreaming&&o.serverStreaming?"bidi_streaming":o.clientStreaming?"client_streaming":o.serverStreaming?"server_streaming":"unary";let M=f.getMessage(trimLeadingDot(o.inputType)),x=f.getMessage(trimLeadingDot(o.outputType));assert(M,`invalid MethodDescriptorProto: input_type ${o.inputType} not found`),assert(x,`invalid MethodDescriptorProto: output_type ${o.inputType} not found`);let O=o.name;return{kind:"rpc",proto:o,deprecated:null!=(_=null==(m=o.options)?void 0:m.deprecated)&&_,parent:p,name:O,localName:safeObjectProperty(O.length?safeObjectProperty(O[0].toLowerCase()+O.substring(1)):O),methodKind:k,input:M,output:x,idempotency:null!=(I=null==(w=o.options)?void 0:w.idempotencyLevel)?I:0,toString:()=>`rpc ${p.typeName}.${O}`}}function newOneof(o,p){return{kind:"oneof",proto:o,deprecated:!1,parent:p,fields:[],name:o.name,localName:safeObjectProperty(protoCamelCase(o.name)),toString(){return`oneof ${p.typeName}.${this.name}`}}}function newField(o,p,f,m,_){var w,I,k;let M=void 0===_,x={kind:"field",proto:o,deprecated:null!=(I=null==(w=o.options)?void 0:w.deprecated)&&I,name:o.name,number:o.number,scalar:void 0,message:void 0,enum:void 0,presence:getFieldPresence(o,m,M,p),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(M){let m="file"==p.kind?p:p.file,_="file"==p.kind?void 0:p,w=makeTypeName(o,_,m);x.kind="extension",x.file=m,x.parent=_,x.oneof=void 0,x.typeName=w,x.jsonName=`[${w}]`,x.toString=()=>`extension ${w}`;let I=f.getMessage(trimLeadingDot(o.extendee));assert(I,`invalid FieldDescriptorProto: extendee ${o.extendee} not found`),x.extendee=I}else assert("message"==p.kind),x.parent=p,x.oneof=m,x.localName=m?protoCamelCase(o.name):safeObjectProperty(protoCamelCase(o.name)),x.jsonName=o.jsonName,x.toString=()=>`field ${p.typeName}.${o.name}`;let O=o.label,L=o.type,B=null==(k=o.options)?void 0:k.jstype;if(3===O){let m=11==L?null==_?void 0:_.get(trimLeadingDot(o.typeName)):void 0;if(m){x.fieldKind="map";let{key:o,value:p}=findMapEntryFields(m);return x.mapKey=o.scalar,x.mapKind=p.fieldKind,x.message=p.message,x.delimitedEncoding=!1,x.enum=p.enum,x.scalar=p.scalar,x}switch(x.fieldKind="list",L){case 11:case 10:x.listKind="message",x.message=f.getMessage(trimLeadingDot(o.typeName)),assert(x.message),x.delimitedEncoding=isDelimitedEncoding(o,p);break;case 14:x.listKind="enum",x.enum=f.getEnum(trimLeadingDot(o.typeName)),assert(x.enum);break;default:x.listKind="scalar",x.scalar=L,x.longAsString=1==B}return x.packed=isPackedField(o,p),x}switch(L){case 11:case 10:x.fieldKind="message",x.message=f.getMessage(trimLeadingDot(o.typeName)),assert(x.message,`invalid FieldDescriptorProto: type_name ${o.typeName} not found`),x.delimitedEncoding=isDelimitedEncoding(o,p),x.getDefaultValue=()=>void 0;break;case 14:{let p=f.getEnum(trimLeadingDot(o.typeName));assert(void 0!==p,`invalid FieldDescriptorProto: type_name ${o.typeName} not found`),x.fieldKind="enum",x.enum=f.getEnum(trimLeadingDot(o.typeName)),x.getDefaultValue=()=>(0,ex.b1)(o,"defaultValue")?parseTextFormatEnumValue(p,o.defaultValue):void 0;break}default:x.fieldKind="scalar",x.scalar=L,x.longAsString=1==B,x.getDefaultValue=()=>(0,ex.b1)(o,"defaultValue")?parseTextFormatScalarValue(L,o.defaultValue):void 0}return x}function getFileEdition(o){switch(o.syntax){case"":case"proto2":return 998;case"proto3":return 999;case"editions":if(o.edition in eO)return o.edition;throw Error(`${o.name}: unsupported edition`);default:throw Error(`${o.name}: unsupported syntax "${o.syntax}"`)}}function findFileDependencies(o,p){return o.dependency.map(f=>{let m=p.getFile(f);if(!m)throw Error(`Cannot find ${f}, imported by ${o.name}`);return m})}function findEnumSharedPrefix(o,p){let f=camelToSnakeCase(o)+"_";for(let o of p){if(!o.name.toLowerCase().startsWith(f))return;let p=o.name.substring(f.length);if(0==p.length||/^\d/.test(p))return}return f}function camelToSnakeCase(o){return(o.substring(0,1)+o.substring(1).replace(/[A-Z]/g,o=>"_"+o)).toLowerCase()}function makeTypeName(o,p,f){return p?`${p.typeName}.${o.name}`:f.proto.package.length>0?`${f.proto.package}.${o.name}`:`${o.name}`}function trimLeadingDot(o){return o.startsWith(".")?o.substring(1):o}function findOneof(o,p){if(!(0,ex.b1)(o,"oneofIndex")||o.proto3Optional)return;let f=p[o.oneofIndex];return assert(f,`invalid FieldDescriptorProto: oneof #${o.oneofIndex} for field #${o.number} not found`),f}function getFieldPresence(o,p,f,m){if(2==o.label)return 3;if(3==o.label)return 2;if(p||o.proto3Optional||f)return 1;let _=resolveFeature("fieldPresence",{proto:o,parent:m});return 2==_&&(11==o.type||10==o.type)?1:_}function isPackedField(o,p){if(3!=o.label)return!1;switch(o.type){case 9:case 12:case 10:case 11:return!1}let f=o.options;return f&&(0,ex.b1)(f,"packed")?f.packed:1==resolveFeature("repeatedFieldEncoding",{proto:o,parent:p})}function findMapEntryFields(o){let p=o.fields.find(o=>1===o.number),f=o.fields.find(o=>2===o.number);return assert(p&&"scalar"==p.fieldKind&&p.scalar!=eP.L.BYTES&&p.scalar!=eP.L.FLOAT&&p.scalar!=eP.L.DOUBLE&&f&&"list"!=f.fieldKind&&"map"!=f.fieldKind),{key:p,value:f}}function isEnumOpen(o){var p;return 1==resolveFeature("enumType",{proto:o.proto,parent:null!=(p=o.parent)?p:o.file})}function isDelimitedEncoding(o,p){return 10==o.type||2==resolveFeature("messageEncoding",{proto:o,parent:p})}function resolveFeature(o,p){var f,m;let _=null==(f=p.proto.options)?void 0:f.features;if(_){let p=_[o];if(0!=p)return p}if("kind"in p){if("message"==p.kind)return resolveFeature(o,null!=(m=p.parent)?m:p.file);let f=eO[p.edition];if(!f)throw Error(`feature default for edition ${p.edition} not found`);return f[o]}return resolveFeature(o,p.parent)}function assert(o,p){if(!o)throw Error(p)}function boot(o){let p=bootFileDescriptorProto(o);return p.messageType.forEach(restoreJsonNames),createFileRegistry(p,()=>void 0).getFile(p.name)}function bootFileDescriptorProto(o){return Object.assign(Object.create({syntax:"",edition:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},o),{messageType:o.messageType.map(bootDescriptorProto),enumType:o.enumType.map(bootEnumDescriptorProto)}))}function bootDescriptorProto(o){var p,f,m,_,w,I,k,M;return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.DescriptorProto",name:o.name,field:null!=(f=null==(p=o.field)?void 0:p.map(bootFieldDescriptorProto))?f:[],extension:[],nestedType:null!=(_=null==(m=o.nestedType)?void 0:m.map(bootDescriptorProto))?_:[],enumType:null!=(I=null==(w=o.enumType)?void 0:w.map(bootEnumDescriptorProto))?I:[],extensionRange:null!=(M=null==(k=o.extensionRange)?void 0:k.map(o=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},o)))?M:[],oneofDecl:[],reservedRange:[],reservedName:[]})}function bootFieldDescriptorProto(o){return Object.assign(Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},o),{options:o.options?bootFieldOptions(o.options):void 0}))}function bootFieldOptions(o){var p,f,m;return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldOptions"},o),{targets:null!=(p=o.targets)?p:[],editionDefaults:null!=(m=null==(f=o.editionDefaults)?void 0:f.map(o=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},o)))?m:[],uninterpretedOption:[]}))}function bootEnumDescriptorProto(o){return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.EnumDescriptorProto",name:o.name,reservedName:[],reservedRange:[],value:o.value.map(o=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},o))})}var eD=f(0x13ffa45d4);let eL=boot({name:"google/protobuf/descriptor.proto",package:"google.protobuf",messageType:[{name:"FileDescriptorSet",field:[{name:"file",number:1,type:11,label:3,typeName:".google.protobuf.FileDescriptorProto"}],extensionRange:[{start:536e6,end:0x1ff2b601}]},{name:"FileDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"package",number:2,type:9,label:1},{name:"dependency",number:3,type:9,label:3},{name:"public_dependency",number:10,type:5,label:3},{name:"weak_dependency",number:11,type:5,label:3},{name:"option_dependency",number:15,type:9,label:3},{name:"message_type",number:4,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:5,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"service",number:6,type:11,label:3,typeName:".google.protobuf.ServiceDescriptorProto"},{name:"extension",number:7,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FileOptions"},{name:"source_code_info",number:9,type:11,label:1,typeName:".google.protobuf.SourceCodeInfo"},{name:"syntax",number:12,type:9,label:1},{name:"edition",number:14,type:14,label:1,typeName:".google.protobuf.Edition"}]},{name:"DescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"field",number:2,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"extension",number:6,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"nested_type",number:3,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"extension_range",number:5,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ExtensionRange"},{name:"oneof_decl",number:8,type:11,label:3,typeName:".google.protobuf.OneofDescriptorProto"},{name:"options",number:7,type:11,label:1,typeName:".google.protobuf.MessageOptions"},{name:"reserved_range",number:9,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ReservedRange"},{name:"reserved_name",number:10,type:9,label:3},{name:"visibility",number:11,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"ExtensionRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ExtensionRangeOptions"}]},{name:"ReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"ExtensionRangeOptions",field:[{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"},{name:"declaration",number:2,type:11,label:3,typeName:".google.protobuf.ExtensionRangeOptions.Declaration",options:{retention:2}},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"verification",number:3,type:14,label:1,typeName:".google.protobuf.ExtensionRangeOptions.VerificationState",defaultValue:"UNVERIFIED",options:{retention:2}}],nestedType:[{name:"Declaration",field:[{name:"number",number:1,type:5,label:1},{name:"full_name",number:2,type:9,label:1},{name:"type",number:3,type:9,label:1},{name:"reserved",number:5,type:8,label:1},{name:"repeated",number:6,type:8,label:1}]}],enumType:[{name:"VerificationState",value:[{name:"DECLARATION",number:0},{name:"UNVERIFIED",number:1}]}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"FieldDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:3,type:5,label:1},{name:"label",number:4,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Label"},{name:"type",number:5,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Type"},{name:"type_name",number:6,type:9,label:1},{name:"extendee",number:2,type:9,label:1},{name:"default_value",number:7,type:9,label:1},{name:"oneof_index",number:9,type:5,label:1},{name:"json_name",number:10,type:9,label:1},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FieldOptions"},{name:"proto3_optional",number:17,type:8,label:1}],enumType:[{name:"Type",value:[{name:"TYPE_DOUBLE",number:1},{name:"TYPE_FLOAT",number:2},{name:"TYPE_INT64",number:3},{name:"TYPE_UINT64",number:4},{name:"TYPE_INT32",number:5},{name:"TYPE_FIXED64",number:6},{name:"TYPE_FIXED32",number:7},{name:"TYPE_BOOL",number:8},{name:"TYPE_STRING",number:9},{name:"TYPE_GROUP",number:10},{name:"TYPE_MESSAGE",number:11},{name:"TYPE_BYTES",number:12},{name:"TYPE_UINT32",number:13},{name:"TYPE_ENUM",number:14},{name:"TYPE_SFIXED32",number:15},{name:"TYPE_SFIXED64",number:16},{name:"TYPE_SINT32",number:17},{name:"TYPE_SINT64",number:18}]},{name:"Label",value:[{name:"LABEL_OPTIONAL",number:1},{name:"LABEL_REPEATED",number:3},{name:"LABEL_REQUIRED",number:2}]}]},{name:"OneofDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"options",number:2,type:11,label:1,typeName:".google.protobuf.OneofOptions"}]},{name:"EnumDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"value",number:2,type:11,label:3,typeName:".google.protobuf.EnumValueDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumOptions"},{name:"reserved_range",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto.EnumReservedRange"},{name:"reserved_name",number:5,type:9,label:3},{name:"visibility",number:6,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"EnumReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"EnumValueDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumValueOptions"}]},{name:"ServiceDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"method",number:2,type:11,label:3,typeName:".google.protobuf.MethodDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ServiceOptions"}]},{name:"MethodDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"input_type",number:2,type:9,label:1},{name:"output_type",number:3,type:9,label:1},{name:"options",number:4,type:11,label:1,typeName:".google.protobuf.MethodOptions"},{name:"client_streaming",number:5,type:8,label:1,defaultValue:"false"},{name:"server_streaming",number:6,type:8,label:1,defaultValue:"false"}]},{name:"FileOptions",field:[{name:"java_package",number:1,type:9,label:1},{name:"java_outer_classname",number:8,type:9,label:1},{name:"java_multiple_files",number:10,type:8,label:1,defaultValue:"false"},{name:"java_generate_equals_and_hash",number:20,type:8,label:1,options:{deprecated:!0}},{name:"java_string_check_utf8",number:27,type:8,label:1,defaultValue:"false"},{name:"optimize_for",number:9,type:14,label:1,typeName:".google.protobuf.FileOptions.OptimizeMode",defaultValue:"SPEED"},{name:"go_package",number:11,type:9,label:1},{name:"cc_generic_services",number:16,type:8,label:1,defaultValue:"false"},{name:"java_generic_services",number:17,type:8,label:1,defaultValue:"false"},{name:"py_generic_services",number:18,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:23,type:8,label:1,defaultValue:"false"},{name:"cc_enable_arenas",number:31,type:8,label:1,defaultValue:"true"},{name:"objc_class_prefix",number:36,type:9,label:1},{name:"csharp_namespace",number:37,type:9,label:1},{name:"swift_prefix",number:39,type:9,label:1},{name:"php_class_prefix",number:40,type:9,label:1},{name:"php_namespace",number:41,type:9,label:1},{name:"php_metadata_namespace",number:44,type:9,label:1},{name:"ruby_package",number:45,type:9,label:1},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"OptimizeMode",value:[{name:"SPEED",number:1},{name:"CODE_SIZE",number:2},{name:"LITE_RUNTIME",number:3}]}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"MessageOptions",field:[{name:"message_set_wire_format",number:1,type:8,label:1,defaultValue:"false"},{name:"no_standard_descriptor_accessor",number:2,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"map_entry",number:7,type:8,label:1},{name:"deprecated_legacy_json_field_conflicts",number:11,type:8,label:1,options:{deprecated:!0}},{name:"features",number:12,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"FieldOptions",field:[{name:"ctype",number:1,type:14,label:1,typeName:".google.protobuf.FieldOptions.CType",defaultValue:"STRING"},{name:"packed",number:2,type:8,label:1},{name:"jstype",number:6,type:14,label:1,typeName:".google.protobuf.FieldOptions.JSType",defaultValue:"JS_NORMAL"},{name:"lazy",number:5,type:8,label:1,defaultValue:"false"},{name:"unverified_lazy",number:15,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"weak",number:10,type:8,label:1,defaultValue:"false",options:{deprecated:!0}},{name:"debug_redact",number:16,type:8,label:1,defaultValue:"false"},{name:"retention",number:17,type:14,label:1,typeName:".google.protobuf.FieldOptions.OptionRetention"},{name:"targets",number:19,type:14,label:3,typeName:".google.protobuf.FieldOptions.OptionTargetType"},{name:"edition_defaults",number:20,type:11,label:3,typeName:".google.protobuf.FieldOptions.EditionDefault"},{name:"features",number:21,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"feature_support",number:22,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],nestedType:[{name:"EditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"value",number:2,type:9,label:1}]},{name:"FeatureSupport",field:[{name:"edition_introduced",number:1,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"edition_deprecated",number:2,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"deprecation_warning",number:3,type:9,label:1},{name:"edition_removed",number:4,type:14,label:1,typeName:".google.protobuf.Edition"}]}],enumType:[{name:"CType",value:[{name:"STRING",number:0},{name:"CORD",number:1},{name:"STRING_PIECE",number:2}]},{name:"JSType",value:[{name:"JS_NORMAL",number:0},{name:"JS_STRING",number:1},{name:"JS_NUMBER",number:2}]},{name:"OptionRetention",value:[{name:"RETENTION_UNKNOWN",number:0},{name:"RETENTION_RUNTIME",number:1},{name:"RETENTION_SOURCE",number:2}]},{name:"OptionTargetType",value:[{name:"TARGET_TYPE_UNKNOWN",number:0},{name:"TARGET_TYPE_FILE",number:1},{name:"TARGET_TYPE_EXTENSION_RANGE",number:2},{name:"TARGET_TYPE_MESSAGE",number:3},{name:"TARGET_TYPE_FIELD",number:4},{name:"TARGET_TYPE_ONEOF",number:5},{name:"TARGET_TYPE_ENUM",number:6},{name:"TARGET_TYPE_ENUM_ENTRY",number:7},{name:"TARGET_TYPE_SERVICE",number:8},{name:"TARGET_TYPE_METHOD",number:9}]}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"OneofOptions",field:[{name:"features",number:1,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"EnumOptions",field:[{name:"allow_alias",number:2,type:8,label:1},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"deprecated_legacy_json_field_conflicts",number:6,type:8,label:1,options:{deprecated:!0}},{name:"features",number:7,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"EnumValueOptions",field:[{name:"deprecated",number:1,type:8,label:1,defaultValue:"false"},{name:"features",number:2,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"debug_redact",number:3,type:8,label:1,defaultValue:"false"},{name:"feature_support",number:4,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"ServiceOptions",field:[{name:"features",number:34,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"MethodOptions",field:[{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"idempotency_level",number:34,type:14,label:1,typeName:".google.protobuf.MethodOptions.IdempotencyLevel",defaultValue:"IDEMPOTENCY_UNKNOWN"},{name:"features",number:35,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"IdempotencyLevel",value:[{name:"IDEMPOTENCY_UNKNOWN",number:0},{name:"NO_SIDE_EFFECTS",number:1},{name:"IDEMPOTENT",number:2}]}],extensionRange:[{start:1e3,end:0x20000000}]},{name:"UninterpretedOption",field:[{name:"name",number:2,type:11,label:3,typeName:".google.protobuf.UninterpretedOption.NamePart"},{name:"identifier_value",number:3,type:9,label:1},{name:"positive_int_value",number:4,type:4,label:1},{name:"negative_int_value",number:5,type:3,label:1},{name:"double_value",number:6,type:1,label:1},{name:"string_value",number:7,type:12,label:1},{name:"aggregate_value",number:8,type:9,label:1}],nestedType:[{name:"NamePart",field:[{name:"name_part",number:1,type:9,label:2},{name:"is_extension",number:2,type:8,label:2}]}]},{name:"FeatureSet",field:[{name:"field_presence",number:1,type:14,label:1,typeName:".google.protobuf.FeatureSet.FieldPresence",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPLICIT",edition:900},{value:"IMPLICIT",edition:999},{value:"EXPLICIT",edition:1e3}]}},{name:"enum_type",number:2,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnumType",options:{retention:1,targets:[6,1],editionDefaults:[{value:"CLOSED",edition:900},{value:"OPEN",edition:999}]}},{name:"repeated_field_encoding",number:3,type:14,label:1,typeName:".google.protobuf.FeatureSet.RepeatedFieldEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPANDED",edition:900},{value:"PACKED",edition:999}]}},{name:"utf8_validation",number:4,type:14,label:1,typeName:".google.protobuf.FeatureSet.Utf8Validation",options:{retention:1,targets:[4,1],editionDefaults:[{value:"NONE",edition:900},{value:"VERIFY",edition:999}]}},{name:"message_encoding",number:5,type:14,label:1,typeName:".google.protobuf.FeatureSet.MessageEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"LENGTH_PREFIXED",edition:900}]}},{name:"json_format",number:6,type:14,label:1,typeName:".google.protobuf.FeatureSet.JsonFormat",options:{retention:1,targets:[3,6,1],editionDefaults:[{value:"LEGACY_BEST_EFFORT",edition:900},{value:"ALLOW",edition:999}]}},{name:"enforce_naming_style",number:7,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnforceNamingStyle",options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:"STYLE_LEGACY",edition:900},{value:"STYLE2024",edition:1001}]}},{name:"default_symbol_visibility",number:8,type:14,label:1,typeName:".google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility",options:{retention:2,targets:[1],editionDefaults:[{value:"EXPORT_ALL",edition:900},{value:"EXPORT_TOP_LEVEL",edition:1001}]}}],nestedType:[{name:"VisibilityFeature",enumType:[{name:"DefaultSymbolVisibility",value:[{name:"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",number:0},{name:"EXPORT_ALL",number:1},{name:"EXPORT_TOP_LEVEL",number:2},{name:"LOCAL_ALL",number:3},{name:"STRICT",number:4}]}]}],enumType:[{name:"FieldPresence",value:[{name:"FIELD_PRESENCE_UNKNOWN",number:0},{name:"EXPLICIT",number:1},{name:"IMPLICIT",number:2},{name:"LEGACY_REQUIRED",number:3}]},{name:"EnumType",value:[{name:"ENUM_TYPE_UNKNOWN",number:0},{name:"OPEN",number:1},{name:"CLOSED",number:2}]},{name:"RepeatedFieldEncoding",value:[{name:"REPEATED_FIELD_ENCODING_UNKNOWN",number:0},{name:"PACKED",number:1},{name:"EXPANDED",number:2}]},{name:"Utf8Validation",value:[{name:"UTF8_VALIDATION_UNKNOWN",number:0},{name:"VERIFY",number:2},{name:"NONE",number:3}]},{name:"MessageEncoding",value:[{name:"MESSAGE_ENCODING_UNKNOWN",number:0},{name:"LENGTH_PREFIXED",number:1},{name:"DELIMITED",number:2}]},{name:"JsonFormat",value:[{name:"JSON_FORMAT_UNKNOWN",number:0},{name:"ALLOW",number:1},{name:"LEGACY_BEST_EFFORT",number:2}]},{name:"EnforceNamingStyle",value:[{name:"ENFORCE_NAMING_STYLE_UNKNOWN",number:0},{name:"STYLE2024",number:1},{name:"STYLE_LEGACY",number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:"FeatureSetDefaults",field:[{name:"defaults",number:1,type:11,label:3,typeName:".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"},{name:"minimum_edition",number:4,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"maximum_edition",number:5,type:14,label:1,typeName:".google.protobuf.Edition"}],nestedType:[{name:"FeatureSetEditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"overridable_features",number:4,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"fixed_features",number:5,type:11,label:1,typeName:".google.protobuf.FeatureSet"}]}]},{name:"SourceCodeInfo",field:[{name:"location",number:1,type:11,label:3,typeName:".google.protobuf.SourceCodeInfo.Location"}],nestedType:[{name:"Location",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"span",number:2,type:5,label:3,options:{packed:!0}},{name:"leading_comments",number:3,type:9,label:1},{name:"trailing_comments",number:4,type:9,label:1},{name:"leading_detached_comments",number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:0x1ff2b601}]},{name:"GeneratedCodeInfo",field:[{name:"annotation",number:1,type:11,label:3,typeName:".google.protobuf.GeneratedCodeInfo.Annotation"}],nestedType:[{name:"Annotation",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"source_file",number:2,type:9,label:1},{name:"begin",number:3,type:5,label:1},{name:"end",number:4,type:5,label:1},{name:"semantic",number:5,type:14,label:1,typeName:".google.protobuf.GeneratedCodeInfo.Annotation.Semantic"}],enumType:[{name:"Semantic",value:[{name:"NONE",number:0},{name:"SET",number:1},{name:"ALIAS",number:2}]}]}]}],enumType:[{name:"Edition",value:[{name:"EDITION_UNKNOWN",number:0},{name:"EDITION_LEGACY",number:900},{name:"EDITION_PROTO2",number:998},{name:"EDITION_PROTO3",number:999},{name:"EDITION_2023",number:1e3},{name:"EDITION_2024",number:1001},{name:"EDITION_UNSTABLE",number:9999},{name:"EDITION_1_TEST_ONLY",number:1},{name:"EDITION_2_TEST_ONLY",number:2},{name:"EDITION_99997_TEST_ONLY",number:99997},{name:"EDITION_99998_TEST_ONLY",number:99998},{name:"EDITION_99999_TEST_ONLY",number:99999},{name:"EDITION_MAX",number:0x7fffffff}]},{name:"SymbolVisibility",value:[{name:"VISIBILITY_UNSET",number:0},{name:"VISIBILITY_LOCAL",number:1},{name:"VISIBILITY_EXPORT",number:2}]}]}),eN=(0,eD.Z)(eL,1);(k=ec||(ec={}))[k.DECLARATION=0]="DECLARATION",k[k.UNVERIFIED=1]="UNVERIFIED",(M=eu||(eu={}))[M.DOUBLE=1]="DOUBLE",M[M.FLOAT=2]="FLOAT",M[M.INT64=3]="INT64",M[M.UINT64=4]="UINT64",M[M.INT32=5]="INT32",M[M.FIXED64=6]="FIXED64",M[M.FIXED32=7]="FIXED32",M[M.BOOL=8]="BOOL",M[M.STRING=9]="STRING",M[M.GROUP=10]="GROUP",M[M.MESSAGE=11]="MESSAGE",M[M.BYTES=12]="BYTES",M[M.UINT32=13]="UINT32",M[M.ENUM=14]="ENUM",M[M.SFIXED32=15]="SFIXED32",M[M.SFIXED64=16]="SFIXED64",M[M.SINT32=17]="SINT32",M[M.SINT64=18]="SINT64",(x=eh||(eh={}))[x.OPTIONAL=1]="OPTIONAL",x[x.REPEATED=3]="REPEATED",x[x.REQUIRED=2]="REQUIRED",(O=ep||(ep={}))[O.SPEED=1]="SPEED",O[O.CODE_SIZE=2]="CODE_SIZE",O[O.LITE_RUNTIME=3]="LITE_RUNTIME",(L=ef||(ef={}))[L.STRING=0]="STRING",L[L.CORD=1]="CORD",L[L.STRING_PIECE=2]="STRING_PIECE",(B=em||(em={}))[B.JS_NORMAL=0]="JS_NORMAL",B[B.JS_STRING=1]="JS_STRING",B[B.JS_NUMBER=2]="JS_NUMBER",(U=eg||(eg={}))[U.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",U[U.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",U[U.RETENTION_SOURCE=2]="RETENTION_SOURCE",($=eS||(eS={}))[$.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",$[$.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",$[$.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",$[$.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",$[$.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",$[$.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",$[$.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",$[$.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",$[$.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",$[$.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD",(q=ev||(ev={}))[q.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",q[q.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",q[q.IDEMPOTENT=2]="IDEMPOTENT",(Z=eb||(eb={}))[Z.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]="DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",Z[Z.EXPORT_ALL=1]="EXPORT_ALL",Z[Z.EXPORT_TOP_LEVEL=2]="EXPORT_TOP_LEVEL",Z[Z.LOCAL_ALL=3]="LOCAL_ALL",Z[Z.STRICT=4]="STRICT",(ee=ey||(ey={}))[ee.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",ee[ee.EXPLICIT=1]="EXPLICIT",ee[ee.IMPLICIT=2]="IMPLICIT",ee[ee.LEGACY_REQUIRED=3]="LEGACY_REQUIRED",(et=e_||(e_={}))[et.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",et[et.OPEN=1]="OPEN",et[et.CLOSED=2]="CLOSED",(ei=eC||(eC={}))[ei.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",ei[ei.PACKED=1]="PACKED",ei[ei.EXPANDED=2]="EXPANDED",(er=eT||(eT={}))[er.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",er[er.VERIFY=2]="VERIFY",er[er.NONE=3]="NONE",(en=eE||(eE={}))[en.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",en[en.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",en[en.DELIMITED=2]="DELIMITED",(eo=ew||(ew={}))[eo.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",eo[eo.ALLOW=1]="ALLOW",eo[eo.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT",(es=eI||(eI={}))[es.ENFORCE_NAMING_STYLE_UNKNOWN=0]="ENFORCE_NAMING_STYLE_UNKNOWN",es[es.STYLE2024=1]="STYLE2024",es[es.STYLE_LEGACY=2]="STYLE_LEGACY",(ea=eA||(eA={}))[ea.NONE=0]="NONE",ea[ea.SET=1]="SET",ea[ea.ALIAS=2]="ALIAS",(el=ek||(ek={}))[el.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",el[el.EDITION_LEGACY=900]="EDITION_LEGACY",el[el.EDITION_PROTO2=998]="EDITION_PROTO2",el[el.EDITION_PROTO3=999]="EDITION_PROTO3",el[el.EDITION_2023=1e3]="EDITION_2023",el[el.EDITION_2024=1001]="EDITION_2024",el[el.EDITION_UNSTABLE=9999]="EDITION_UNSTABLE",el[el.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",el[el.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",el[el.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",el[el.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",el[el.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY",el[el.EDITION_MAX=0x7fffffff]="EDITION_MAX",(ed=eM||(eM={}))[ed.VISIBILITY_UNSET=0]="VISIBILITY_UNSET",ed[ed.VISIBILITY_LOCAL=1]="VISIBILITY_LOCAL",ed[ed.VISIBILITY_EXPORT=2]="VISIBILITY_EXPORT";var eF=f(0xc56ae113);function fileDesc(o,p){var f;let m=(0,eF.Er)(eN,base64Decode(o));return m.messageType.forEach(restoreJsonNames),m.dependency=null!=(f=null==p?void 0:p.map(o=>o.proto.name))?f:[],createFileRegistry(m,o=>null==p?void 0:p.find(p=>p.proto.name===o)).getFile(m.name)}},0x13ffa45d4:(o,p,f)=>{"use strict";function messageDesc(o,p,...f){return f.reduce((o,p)=>o.nestedMessages[p],o.messages[p])}f.d(p,{Z:()=>messageDesc})},0xcf98861b:(o,p,f)=>{"use strict";f.d(p,{v:()=>create});var m=f(0x1225402b5),_=f(0x15ee7d00f),w=f(0x1b978a41),I=f(0xe4d30b8e),k=f(0x12ea8153),M=f(0x224f89d0c);function create(o,p){if((0,m.K)(p,o))return p;let f=createZeroMessage(o);return void 0!==p&&initMessage(o,f,p),f}function initMessage(o,p,f){for(let m of o.members){let o,_=f[m.localName];if(null!=_){if("oneof"==m.kind){let p=(0,k.mO)(f,m);if(!p)continue;o=p,_=(0,k.$v)(f,p)}else o=m;switch(o.fieldKind){case"message":_=toMessage(o,_);break;case"scalar":_=initScalar(o,_);break;case"list":_=initList(o,_);break;case"map":_=initMap(o,_)}(0,k.lA)(p,o,_)}}return p}function initScalar(o,p){return o.scalar==_.L.BYTES?toU8Arr(p):p}function initMap(o,p){if((0,I.Gv)(p)){if(o.scalar==_.L.BYTES)return convertObjectValues(p,toU8Arr);if("message"==o.mapKind)return convertObjectValues(p,p=>toMessage(o,p))}return p}function initList(o,p){if(Array.isArray(p)){if(o.scalar==_.L.BYTES)return p.map(toU8Arr);if("message"==o.listKind)return p.map(p=>toMessage(o,p))}return p}function toMessage(o,p){if("message"==o.fieldKind&&!o.oneof&&(0,M.l)(o.message))return initScalar(o.message.fields[0],p);if((0,I.Gv)(p)){if("google.protobuf.Struct"==o.message.typeName&&"google.protobuf.Value"!==o.parent.typeName)return p;if(!(0,m.K)(p,o.message))return create(o.message,p)}return p}function toU8Arr(o){return Array.isArray(o)?new Uint8Array(o):o}function convertObjectValues(o,p){let f={};for(let m of Object.entries(o))f[m[0]]=p(m[1]);return f}let x=Symbol(),O=new WeakMap;function createZeroMessage(o){let p;if(needsPrototypeChain(o)){let f,m,_=O.get(o);if(_)({prototype:f,members:m}=_);else{for(let p of(f={},m=new Set,o.members))"oneof"!=p.kind&&("scalar"==p.fieldKind||"enum"==p.fieldKind)&&2!=p.presence&&(m.add(p),f[p.localName]=createZeroField(p));O.set(o,{prototype:f,members:m})}for(let _ of((p=Object.create(f)).$typeName=o.typeName,o.members))if(!m.has(_)){if("field"==_.kind&&("message"==_.fieldKind||("scalar"==_.fieldKind||"enum"==_.fieldKind)&&2!=_.presence))continue;p[_.localName]=createZeroField(_)}}else for(let f of(p={$typeName:o.typeName},o.members))("oneof"==f.kind||2==f.presence)&&(p[f.localName]=createZeroField(f));return p}function needsPrototypeChain(o){switch(o.file.edition){case 999:return!1;case 998:return!0;default:return o.fields.some(o=>2!=o.presence&&"message"!=o.fieldKind&&!o.oneof)}}function createZeroField(o){if("oneof"==o.kind)return{case:void 0};if("list"==o.fieldKind)return[];if("map"==o.fieldKind)return{};if("message"==o.fieldKind)return x;let p=o.getDefaultValue();return void 0!==p?"scalar"==o.fieldKind&&o.longAsString?p.toString():p:"scalar"==o.fieldKind?(0,w.M7)(o.scalar,o.longAsString):o.enum.values[0].number}},0x15ee7d00f:(o,p,f)=>{"use strict";var m,_;f.d(p,{L:()=>m}),(_=m||(m={}))[_.DOUBLE=1]="DOUBLE",_[_.FLOAT=2]="FLOAT",_[_.INT64=3]="INT64",_[_.UINT64=4]="UINT64",_[_.INT32=5]="INT32",_[_.FIXED64=6]="FIXED64",_[_.FIXED32=7]="FIXED32",_[_.BOOL=8]="BOOL",_[_.STRING=9]="STRING",_[_.BYTES=12]="BYTES",_[_.UINT32=13]="UINT32",_[_.SFIXED32=15]="SFIXED32",_[_.SFIXED64=16]="SFIXED64",_[_.SINT32=17]="SINT32",_[_.SINT64=18]="SINT64"},0xc56ae113:(o,p,f)=>{"use strict";f.d(p,{Er:()=>fromBinary});var m=f(0x15ee7d00f),_=f(0x1b978a41),w=f(0x1c94ab981),I=f(0x1157d5c2c),k=f(0x14db667d5);let M={readUnknownFields:!0};function makeReadOptions(o){return o?Object.assign(Object.assign({},M),o):M}function fromBinary(o,p,f){let m=(0,w.E4)(o,void 0,!1);return readMessage(m,new I.V5(p),makeReadOptions(f),!1,p.byteLength),m.message}function readMessage(o,p,f,m,_){var w;let k,M,x=m?p.len:p.pos+_,O=null!=(w=o.getUnknown())?w:[];for(;p.pos<x&&([k,M]=p.tag(),!m||M!=I.O0.EndGroup);){let m=o.findNumber(k);if(!m){let o=p.skip(M,k);f.readUnknownFields&&O.push({no:k,wireType:M,data:o});continue}readField(o,p,m,M,f)}if(m&&(M!=I.O0.EndGroup||k!==_))throw Error("invalid end group tag");O.length>0&&o.setUnknown(O)}function readField(o,p,f,_,w){var I;switch(f.fieldKind){case"scalar":o.set(f,readScalar(p,f.scalar));break;case"enum":let M=readScalar(p,m.L.INT32);if(f.enum.open)o.set(f,M);else if(f.enum.values.some(o=>o.number===M))o.set(f,M);else if(w.readUnknownFields){let p=[];(0,k.f7)(M,p);let m=null!=(I=o.getUnknown())?I:[];m.push({no:f.number,wireType:_,data:new Uint8Array(p)}),o.setUnknown(m)}break;case"message":o.set(f,readMessageField(p,w,f,o.get(f)));break;case"list":readListField(p,_,o.get(f),w);break;case"map":readMapEntry(p,o.get(f),w)}}function readMapEntry(o,p,f){let m,I,k=p.field(),M=o.uint32(),x=o.pos+M;for(;o.pos<x;){let[p]=o.tag();switch(p){case 1:m=readScalar(o,k.mapKey);break;case 2:switch(k.mapKind){case"scalar":I=readScalar(o,k.scalar);break;case"enum":I=o.int32();break;case"message":I=readMessageField(o,f,k)}}}if(void 0===m&&(m=(0,_.M7)(k.mapKey,!1)),void 0===I)switch(k.mapKind){case"scalar":I=(0,_.M7)(k.scalar,!1);break;case"enum":I=k.enum.values[0].number;break;case"message":I=(0,w.E4)(k.message,void 0,!1)}p.set(m,I)}function readListField(o,p,f,_){var w;let k=f.field();if("message"===k.listKind)return void f.add(readMessageField(o,_,k));let M=null!=(w=k.scalar)?w:m.L.INT32;if(p!=I.O0.LengthDelimited||M==m.L.STRING||M==m.L.BYTES)return void f.add(readScalar(o,M));let x=o.uint32()+o.pos;for(;o.pos<x;)f.add(readScalar(o,M))}function readMessageField(o,p,f,m){let _=f.delimitedEncoding,I=null!=m?m:(0,w.E4)(f.message,void 0,!1);return readMessage(I,o,p,_,_?f.number:o.uint32()),I}function readScalar(o,p){switch(p){case m.L.STRING:return o.string();case m.L.BOOL:return o.bool();case m.L.DOUBLE:return o.double();case m.L.FLOAT:return o.float();case m.L.INT32:return o.int32();case m.L.INT64:return o.int64();case m.L.UINT64:return o.uint64();case m.L.FIXED64:return o.fixed64();case m.L.BYTES:return o.bytes();case m.L.FIXED32:return o.fixed32();case m.L.SFIXED32:return o.sfixed32();case m.L.SFIXED64:return o.sfixed64();case m.L.SINT64:return o.sint64();case m.L.UINT32:return o.uint32();case m.L.SINT32:return o.sint32()}}},0x1225402b5:(o,p,f)=>{"use strict";function isMessage(o,p){return!!(null!==o&&"object"==typeof o&&"$typeName"in o&&"string"==typeof o.$typeName)&&(void 0===p||p.typeName===o.$typeName)}f.d(p,{K:()=>isMessage})},0x9003db35:(o,p,f)=>{"use strict";f.d(p,{M:()=>_});var m=f(0x14db667d5);let _=makeInt64Support();function makeInt64Support(){let o=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof o.getBigInt64&&"function"==typeof o.getBigUint64&&"function"==typeof o.setBigInt64&&"function"==typeof o.setBigUint64&&(globalThis.Deno||1)){let p=BigInt("-9223372036854775808"),f=BigInt("9223372036854775807"),m=BigInt("0"),_=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(o){let m="bigint"==typeof o?o:BigInt(o);if(m>f||m<p)throw Error(`invalid int64: ${o}`);return m},uParse(o){let p="bigint"==typeof o?o:BigInt(o);if(p>_||p<m)throw Error(`invalid uint64: ${o}`);return p},enc(p){return o.setBigInt64(0,this.parse(p),!0),{lo:o.getInt32(0,!0),hi:o.getInt32(4,!0)}},uEnc(p){return o.setBigInt64(0,this.uParse(p),!0),{lo:o.getInt32(0,!0),hi:o.getInt32(4,!0)}},dec:(p,f)=>(o.setInt32(0,p,!0),o.setInt32(4,f,!0),o.getBigInt64(0,!0)),uDec:(p,f)=>(o.setInt32(0,p,!0),o.setInt32(4,f,!0),o.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:o=>("string"!=typeof o&&(o=o.toString()),assertInt64String(o),o),uParse:o=>("string"!=typeof o&&(o=o.toString()),assertUInt64String(o),o),enc:o=>("string"!=typeof o&&(o=o.toString()),assertInt64String(o),(0,m.LJ)(o)),uEnc:o=>("string"!=typeof o&&(o=o.toString()),assertUInt64String(o),(0,m.LJ)(o)),dec:(o,p)=>(0,m._Q)(o,p),uDec:(o,p)=>(0,m.Hc)(o,p)}}function assertInt64String(o){if(!/^-?[0-9]+$/.test(o))throw Error("invalid int64: "+o)}function assertUInt64String(o){if(!/^[0-9]+$/.test(o))throw Error("invalid uint64: "+o)}},0xe4d30b8e:(o,p,f)=>{"use strict";f.d(p,{G6:()=>isReflectMap,Gv:()=>isObject,LT:()=>isReflectMessage,sG:()=>isReflectList});var m=f(0x12ea8153);function isObject(o){return null!==o&&"object"==typeof o&&!Array.isArray(o)}function isReflectList(o,p){var f,_,w,I;if(isObject(o)&&m.I4 in o&&"add"in o&&"field"in o&&"function"==typeof o.field){if(void 0!==p){let m=o.field();return p.listKind==m.listKind&&p.scalar===m.scalar&&(null==(f=p.message)?void 0:f.typeName)===(null==(_=m.message)?void 0:_.typeName)&&(null==(w=p.enum)?void 0:w.typeName)===(null==(I=m.enum)?void 0:I.typeName)}return!0}return!1}function isReflectMap(o,p){var f,_,w,I;if(isObject(o)&&m.I4 in o&&"has"in o&&"field"in o&&"function"==typeof o.field){if(void 0!==p){let m=o.field();return p.mapKey===m.mapKey&&p.mapKind==m.mapKind&&p.scalar===m.scalar&&(null==(f=p.message)?void 0:f.typeName)===(null==(_=m.message)?void 0:_.typeName)&&(null==(w=p.enum)?void 0:w.typeName)===(null==(I=m.enum)?void 0:I.typeName)}return!0}return!1}function isReflectMessage(o,p){return isObject(o)&&m.I4 in o&&"desc"in o&&isObject(o.desc)&&"message"===o.desc.kind&&(void 0===p||o.desc.typeName==p.typeName)}},0x1c94ab981:(o,p,f)=>{"use strict";f.d(p,{E4:()=>reflect});var m=f(0x15ee7d00f),_=f(0x1225402b5);let FieldError=class FieldError extends Error{constructor(o,p,f="FieldValueInvalidError"){super(p),this.name=f,this.field=()=>o}};var w=f(0xe4d30b8e),I=f(0x1157d5c2c),k=f(0x7b8b1b5e),M=f(0x9003db35);function checkField(o,p){let f,m="list"==o.fieldKind?(0,w.sG)(p,o):"map"==o.fieldKind?(0,w.G6)(p,o):checkSingular(o,p);if(!0!==m){switch(o.fieldKind){case"list":f=`expected ${formatReflectList(o)}, got ${formatVal(p)}`;break;case"map":f=`expected ${formatReflectMap(o)}, got ${formatVal(p)}`;break;default:f=reasonSingular(o,p,m)}return new FieldError(o,f)}}function checkListItem(o,p,f){let m=checkSingular(o,f);if(!0!==m)return new FieldError(o,`list item #${p+1}: ${reasonSingular(o,f,m)}`)}function checkMapEntry(o,p,f){let m=checkScalarValue(p,o.mapKey);if(!0!==m)return new FieldError(o,`invalid map key: ${reasonSingular({scalar:o.mapKey},p,m)}`);let _=checkSingular(o,f);if(!0!==_)return new FieldError(o,`map entry ${formatVal(p)}: ${reasonSingular(o,f,_)}`)}function checkSingular(o,p){return void 0!==o.scalar?checkScalarValue(p,o.scalar):void 0!==o.enum?o.enum.open?Number.isInteger(p):o.enum.values.some(o=>o.number===p):(0,w.LT)(p,o.message)}function checkScalarValue(o,p){switch(p){case m.L.DOUBLE:return"number"==typeof o;case m.L.FLOAT:if("number"!=typeof o)return!1;if(Number.isNaN(o)||!Number.isFinite(o))return!0;if(o>I.xY||o<I.T)return`${o.toFixed()} out of range`;return!0;case m.L.INT32:case m.L.SFIXED32:case m.L.SINT32:if("number"!=typeof o||!Number.isInteger(o))return!1;if(o>I.go||o<I.Qh)return`${o.toFixed()} out of range`;return!0;case m.L.FIXED32:case m.L.UINT32:if("number"!=typeof o||!Number.isInteger(o))return!1;if(o>I.f7||o<0)return`${o.toFixed()} out of range`;return!0;case m.L.BOOL:return"boolean"==typeof o;case m.L.STRING:if("string"!=typeof o)return!1;return(0,k.d)().checkUtf8(o)||"invalid UTF8";case m.L.BYTES:return o instanceof Uint8Array;case m.L.INT64:case m.L.SFIXED64:case m.L.SINT64:if("bigint"==typeof o||"number"==typeof o||"string"==typeof o&&o.length>0)try{return M.M.parse(o),!0}catch{return`${o} out of range`}return!1;case m.L.FIXED64:case m.L.UINT64:if("bigint"==typeof o||"number"==typeof o||"string"==typeof o&&o.length>0)try{return M.M.uParse(o),!0}catch{return`${o} out of range`}return!1}}function reasonSingular(o,p,f){return(f="string"==typeof f?`: ${f}`:`, got ${formatVal(p)}`,void 0!==o.scalar)?`expected ${scalarTypeDescription(o.scalar)}`+f:void 0!==o.enum?`expected ${o.enum.toString()}`+f:`expected ${formatReflectMessage(o.message)}`+f}function formatVal(o){switch(typeof o){case"object":if(null===o)return"null";if(o instanceof Uint8Array)return`Uint8Array(${o.length})`;if(Array.isArray(o))return`Array(${o.length})`;if((0,w.sG)(o))return formatReflectList(o.field());if((0,w.G6)(o))return formatReflectMap(o.field());if((0,w.LT)(o))return formatReflectMessage(o.desc);if((0,_.K)(o))return`message ${o.$typeName}`;return"object";case"string":return o.length>30?"string":`"${o.split('"').join('\\"')}"`;case"boolean":case"number":return String(o);case"bigint":return String(o)+"n";default:return typeof o}}function formatReflectMessage(o){return`ReflectMessage (${o.typeName})`}function formatReflectList(o){switch(o.listKind){case"message":return`ReflectList (${o.message.toString()})`;case"enum":return`ReflectList (${o.enum.toString()})`;case"scalar":return`ReflectList (${m.L[o.scalar]})`}}function formatReflectMap(o){switch(o.mapKind){case"message":return`ReflectMap (${m.L[o.mapKey]}, ${o.message.toString()})`;case"enum":return`ReflectMap (${m.L[o.mapKey]}, ${o.enum.toString()})`;case"scalar":return`ReflectMap (${m.L[o.mapKey]}, ${m.L[o.scalar]})`}}function scalarTypeDescription(o){switch(o){case m.L.STRING:return"string";case m.L.BOOL:return"boolean";case m.L.INT64:case m.L.SINT64:case m.L.SFIXED64:return"bigint (int64)";case m.L.UINT64:case m.L.FIXED64:return"bigint (uint64)";case m.L.BYTES:return"Uint8Array";case m.L.DOUBLE:return"number (float64)";case m.L.FLOAT:return"number (float32)";case m.L.FIXED32:case m.L.UINT32:return"number (uint32)";case m.L.INT32:case m.L.SFIXED32:case m.L.SINT32:return"number (int32)"}}var x=f(0x12ea8153),O=f(0xcf98861b),L=f(0x224f89d0c),B=f(0x1b978a41);function reflect(o,p,f=!0){return new ReflectMessageImpl(o,p,f)}let U=new WeakMap;let ReflectMessageImpl=class ReflectMessageImpl{get sortedFields(){let o=U.get(this.desc);if(o)return o;let p=this.desc.fields.concat().sort((o,p)=>o.number-p.number);return U.set(this.desc,p),p}constructor(o,p,f=!0){this.lists=new Map,this.maps=new Map,this.check=f,this.desc=o,this.message=this[x.I4]=null!=p?p:(0,O.v)(o),this.fields=o.fields,this.oneofs=o.oneofs,this.members=o.members}findNumber(o){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(o=>[o.number,o]))),this._fieldsByNumber.get(o)}oneofCase(o){return assertOwn(this.message,o),(0,x.mO)(this.message,o)}isSet(o){return assertOwn(this.message,o),(0,x.zB)(this.message,o)}clear(o){assertOwn(this.message,o),(0,x.yO)(this.message,o)}get(o){assertOwn(this.message,o);let p=(0,x.$v)(this.message,o);switch(o.fieldKind){case"list":let f=this.lists.get(o);return f&&f[x.I4]===p||this.lists.set(o,f=new ReflectListImpl(o,p,this.check)),f;case"map":let m=this.maps.get(o);return m&&m[x.I4]===p||this.maps.set(o,m=new ReflectMapImpl(o,p,this.check)),m;case"message":return messageToReflect(o,p,this.check);case"scalar":return void 0===p?(0,B.M7)(o.scalar,!1):longToReflect(o,p);case"enum":return null!=p?p:o.enum.values[0].number}}set(o,p){let f;if(assertOwn(this.message,o),this.check){let f=checkField(o,p);if(f)throw f}f="message"==o.fieldKind?messageToLocal(o,p):(0,w.G6)(p)||(0,w.sG)(p)?p[x.I4]:longToLocal(o,p),(0,x.lA)(this.message,o,f)}getUnknown(){return this.message.$unknown}setUnknown(o){this.message.$unknown=o}};function assertOwn(o,p){if(p.parent.typeName!==o.$typeName)throw new FieldError(p,`cannot use ${p.toString()} with message ${o.$typeName}`,"ForeignFieldError")}let ReflectListImpl=class ReflectListImpl{field(){return this._field}get size(){return this._arr.length}constructor(o,p,f){this._field=o,this._arr=this[x.I4]=p,this.check=f}get(o){let p=this._arr[o];return void 0===p?void 0:listItemToReflect(this._field,p,this.check)}set(o,p){if(o<0||o>=this._arr.length)throw new FieldError(this._field,`list item #${o+1}: out of range`);if(this.check){let f=checkListItem(this._field,o,p);if(f)throw f}this._arr[o]=listItemToLocal(this._field,p)}add(o){if(this.check){let p=checkListItem(this._field,this._arr.length,o);if(p)throw p}this._arr.push(listItemToLocal(this._field,o))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let o of this._arr)yield listItemToReflect(this._field,o,this.check)}*entries(){for(let o=0;o<this._arr.length;o++)yield[o,listItemToReflect(this._field,this._arr[o],this.check)]}};let ReflectMapImpl=class ReflectMapImpl{constructor(o,p,f=!0){this.obj=this[x.I4]=null!=p?p:{},this.check=f,this._field=o}field(){return this._field}set(o,p){if(this.check){let f=checkMapEntry(this._field,o,p);if(f)throw f}return this.obj[mapKeyToLocal(o)]=mapValueToLocal(this._field,p),this}delete(o){let p=mapKeyToLocal(o),f=Object.prototype.hasOwnProperty.call(this.obj,p);return f&&delete this.obj[p],f}clear(){for(let o of Object.keys(this.obj))delete this.obj[o]}get(o){let p=this.obj[mapKeyToLocal(o)];return void 0!==p&&(p=mapValueToReflect(this._field,p,this.check)),p}has(o){return Object.prototype.hasOwnProperty.call(this.obj,mapKeyToLocal(o))}*keys(){for(let o of Object.keys(this.obj))yield mapKeyToReflect(o,this._field.mapKey)}*entries(){for(let o of Object.entries(this.obj))yield[mapKeyToReflect(o[0],this._field.mapKey),mapValueToReflect(this._field,o[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let o of Object.values(this.obj))yield mapValueToReflect(this._field,o,this.check)}forEach(o,p){for(let f of this.entries())o.call(p,f[1],f[0],this)}};function messageToLocal(o,p){return(0,w.LT)(p)?(0,L.Y)(p.message)&&!o.oneof&&"message"==o.fieldKind?p.message.value:"google.protobuf.Struct"==p.desc.typeName&&"google.protobuf.Value"!=o.parent.typeName?wktStructToLocal(p.message):p.message:p}function messageToReflect(o,p,f){return void 0!==p&&((0,L.l)(o.message)&&!o.oneof&&"message"==o.fieldKind?p={$typeName:o.message.typeName,value:longToReflect(o.message.fields[0],p)}:"google.protobuf.Struct"==o.message.typeName&&"google.protobuf.Value"!=o.parent.typeName&&(0,w.Gv)(p)&&(p=wktStructToReflect(p))),new ReflectMessageImpl(o.message,p,f)}function listItemToLocal(o,p){return"message"==o.listKind?messageToLocal(o,p):longToLocal(o,p)}function listItemToReflect(o,p,f){return"message"==o.listKind?messageToReflect(o,p,f):longToReflect(o,p)}function mapValueToLocal(o,p){return"message"==o.mapKind?messageToLocal(o,p):longToLocal(o,p)}function mapValueToReflect(o,p,f){return"message"==o.mapKind?messageToReflect(o,p,f):p}function mapKeyToLocal(o){return"string"==typeof o||"number"==typeof o?o:String(o)}function mapKeyToReflect(o,p){switch(p){case m.L.STRING:break;case m.L.INT32:case m.L.FIXED32:case m.L.UINT32:case m.L.SFIXED32:case m.L.SINT32:{let p=Number.parseInt(o);if(Number.isFinite(p))return p;break}case m.L.BOOL:switch(o){case"true":return!0;case"false":return!1}break;case m.L.UINT64:case m.L.FIXED64:try{return M.M.uParse(o)}catch{}break;default:try{return M.M.parse(o)}catch{}}return o}function longToReflect(o,p){switch(o.scalar){case m.L.INT64:case m.L.SFIXED64:case m.L.SINT64:"longAsString"in o&&o.longAsString&&"string"==typeof p&&(p=M.M.parse(p));break;case m.L.FIXED64:case m.L.UINT64:"longAsString"in o&&o.longAsString&&"string"==typeof p&&(p=M.M.uParse(p))}return p}function longToLocal(o,p){switch(o.scalar){case m.L.INT64:case m.L.SFIXED64:case m.L.SINT64:"longAsString"in o&&o.longAsString?p=String(p):("string"==typeof p||"number"==typeof p)&&(p=M.M.parse(p));break;case m.L.FIXED64:case m.L.UINT64:"longAsString"in o&&o.longAsString?p=String(p):("string"==typeof p||"number"==typeof p)&&(p=M.M.uParse(p))}return p}function wktStructToReflect(o){let p={$typeName:"google.protobuf.Struct",fields:{}};if((0,w.Gv)(o))for(let[f,m]of Object.entries(o))p.fields[f]=wktValueToReflect(m);return p}function wktStructToLocal(o){let p={};for(let[f,m]of Object.entries(o.fields))p[f]=wktValueToLocal(m);return p}function wktValueToLocal(o){switch(o.kind.case){case"structValue":return wktStructToLocal(o.kind.value);case"listValue":return o.kind.value.values.map(wktValueToLocal);case"nullValue":case void 0:return null;default:return o.kind.value}}function wktValueToReflect(o){let p={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof o){case"number":p.kind={case:"numberValue",value:o};break;case"string":p.kind={case:"stringValue",value:o};break;case"boolean":p.kind={case:"boolValue",value:o};break;case"object":if(null===o)p.kind={case:"nullValue",value:0};else if(Array.isArray(o)){let f={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(o))for(let p of o)f.values.push(wktValueToReflect(p));p.kind={case:"listValue",value:f}}else p.kind={case:"structValue",value:wktStructToReflect(o)}}return p}},0x1b978a41:(o,p,f)=>{"use strict";f.d(p,{M7:()=>scalarZeroValue,MZ:()=>isScalarZeroValue});var m=f(0x9003db35),_=f(0x15ee7d00f);function scalarZeroValue(o,p){switch(o){case _.L.STRING:return"";case _.L.BOOL:return!1;case _.L.DOUBLE:case _.L.FLOAT:return 0;case _.L.INT64:case _.L.UINT64:case _.L.SFIXED64:case _.L.FIXED64:case _.L.SINT64:return p?"0":m.M.zero;case _.L.BYTES:return new Uint8Array(0);default:return 0}}function isScalarZeroValue(o,p){switch(o){case _.L.BOOL:return!1===p;case _.L.STRING:return""===p;case _.L.BYTES:return p instanceof Uint8Array&&!p.byteLength;default:return 0==p}}},0x12ea8153:(o,p,f)=>{"use strict";f.d(p,{$v:()=>unsafeGet,I4:()=>_,b1:()=>unsafeIsSetExplicit,lA:()=>unsafeSet,mO:()=>unsafeOneofCase,yO:()=>unsafeClear,zB:()=>unsafeIsSet});var m=f(0x1b978a41);let _=Symbol.for("reflect unsafe local");function unsafeOneofCase(o,p){let f=o[p.localName].case;return void 0===f?f:p.fields.find(o=>o.localName===f)}function unsafeIsSet(o,p){let f=p.localName;if(p.oneof)return o[p.oneof.localName].case===f;if(2!=p.presence)return void 0!==o[f]&&Object.prototype.hasOwnProperty.call(o,f);switch(p.fieldKind){case"list":return o[f].length>0;case"map":return Object.keys(o[f]).length>0;case"scalar":return!(0,m.MZ)(p.scalar,o[f]);case"enum":return o[f]!==p.enum.values[0].number}throw Error("message field with implicit presence")}function unsafeIsSetExplicit(o,p){return Object.prototype.hasOwnProperty.call(o,p)&&void 0!==o[p]}function unsafeGet(o,p){if(p.oneof){let f=o[p.oneof.localName];return f.case===p.localName?f.value:void 0}return o[p.localName]}function unsafeSet(o,p,f){p.oneof?o[p.oneof.localName]={case:p.localName,value:f}:o[p.localName]=f}function unsafeClear(o,p){let f=p.localName;if(p.oneof){let m=p.oneof.localName;o[m].case===f&&(o[m]={case:void 0})}else if(2!=p.presence)delete o[f];else switch(p.fieldKind){case"map":o[f]={};break;case"list":o[f]=[];break;case"enum":o[f]=p.enum.values[0].number;break;case"scalar":o[f]=(0,m.M7)(p.scalar,p.longAsString)}}},0xcb734b68:(o,p,f)=>{"use strict";f.d(p,{R:()=>toBinary});var m=f(0x1c94ab981),_=f(0x1157d5c2c),w=f(0x15ee7d00f);let I={writeUnknownFields:!0};function makeWriteOptions(o){return o?Object.assign(Object.assign({},I),o):I}function toBinary(o,p,f){return writeFields(new _.fI,makeWriteOptions(f),(0,m.E4)(o,p)).finish()}function writeFields(o,p,f){var m;for(let m of f.sortedFields){if(!f.isSet(m)){if(3==m.presence)throw Error(`cannot encode ${m} to binary: required field not set`);continue}writeField(o,p,f,m)}if(p.writeUnknownFields)for(let{no:p,wireType:_,data:w}of null!=(m=f.getUnknown())?m:[])o.tag(p,_).raw(w);return o}function writeField(o,p,f,m){var _;switch(m.fieldKind){case"scalar":case"enum":writeScalar(o,f.desc.typeName,m.name,null!=(_=m.scalar)?_:w.L.INT32,m.number,f.get(m));break;case"list":writeListField(o,p,m,f.get(m));break;case"message":writeMessageField(o,p,m,f.get(m));break;case"map":for(let[_,w]of f.get(m))writeMapEntry(o,p,m,_,w)}}function writeScalar(o,p,f,m,_,w){writeScalarValue(o.tag(_,writeTypeOfScalar(m)),p,f,m,w)}function writeMessageField(o,p,f,m){f.delimitedEncoding?writeFields(o.tag(f.number,_.O0.StartGroup),p,m).tag(f.number,_.O0.EndGroup):writeFields(o.tag(f.number,_.O0.LengthDelimited).fork(),p,m).join()}function writeListField(o,p,f,m){var I;if("message"==f.listKind){for(let _ of m)writeMessageField(o,p,f,_);return}let k=null!=(I=f.scalar)?I:w.L.INT32;if(f.packed){if(!m.size)return;for(let p of(o.tag(f.number,_.O0.LengthDelimited).fork(),m))writeScalarValue(o,f.parent.typeName,f.name,k,p);o.join();return}for(let p of m)writeScalar(o,f.parent.typeName,f.name,k,f.number,p)}function writeMapEntry(o,p,f,m,I){var k;switch(o.tag(f.number,_.O0.LengthDelimited).fork(),writeScalar(o,f.parent.typeName,f.name,f.mapKey,1,m),f.mapKind){case"scalar":case"enum":writeScalar(o,f.parent.typeName,f.name,null!=(k=f.scalar)?k:w.L.INT32,2,I);break;case"message":writeFields(o.tag(2,_.O0.LengthDelimited).fork(),p,I).join()}o.join()}function writeScalarValue(o,p,f,m,_){try{switch(m){case w.L.STRING:o.string(_);break;case w.L.BOOL:o.bool(_);break;case w.L.DOUBLE:o.double(_);break;case w.L.FLOAT:o.float(_);break;case w.L.INT32:o.int32(_);break;case w.L.INT64:o.int64(_);break;case w.L.UINT64:o.uint64(_);break;case w.L.FIXED64:o.fixed64(_);break;case w.L.BYTES:o.bytes(_);break;case w.L.FIXED32:o.fixed32(_);break;case w.L.SFIXED32:o.sfixed32(_);break;case w.L.SFIXED64:o.sfixed64(_);break;case w.L.SINT64:o.sint64(_);break;case w.L.UINT32:o.uint32(_);break;case w.L.SINT32:o.sint32(_)}}catch(o){if(o instanceof Error)throw Error(`cannot encode field ${p}.${f} to binary: ${o.message}`);throw o}}function writeTypeOfScalar(o){switch(o){case w.L.BYTES:case w.L.STRING:return _.O0.LengthDelimited;case w.L.DOUBLE:case w.L.FIXED64:case w.L.SFIXED64:return _.O0.Bit64;case w.L.FIXED32:case w.L.SFIXED32:case w.L.FLOAT:return _.O0.Bit32;default:return _.O0.Varint}}},0x1157d5c2c:(o,p,f)=>{"use strict";f.d(p,{O0:()=>_,Qh:()=>B,T:()=>x,V5:()=>BinaryReader,f7:()=>O,fI:()=>BinaryWriter,go:()=>L,xY:()=>M});var m,_,w=f(0x14db667d5),I=f(0x9003db35),k=f(0x7b8b1b5e);(m=_||(_={}))[m.Varint=0]="Varint",m[m.Bit64=1]="Bit64",m[m.LengthDelimited=2]="LengthDelimited",m[m.StartGroup=3]="StartGroup",m[m.EndGroup=4]="EndGroup",m[m.Bit32=5]="Bit32";let M=34028234663852886e22,x=-34028234663852886e22,O=0xffffffff,L=0x7fffffff,B=-0x80000000;let BinaryWriter=class BinaryWriter{constructor(o=(0,k.d)().encodeUtf8){this.encodeUtf8=o,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let o=0;for(let p=0;p<this.chunks.length;p++)o+=this.chunks[p].length;let p=new Uint8Array(o),f=0;for(let o=0;o<this.chunks.length;o++)p.set(this.chunks[o],f),f+=this.chunks[o].length;return this.chunks=[],p}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let o=this.finish(),p=this.stack.pop();if(!p)throw Error("invalid state, fork stack empty");return this.chunks=p.chunks,this.buf=p.buf,this.uint32(o.byteLength),this.raw(o)}tag(o,p){return this.uint32((o<<3|p)>>>0)}raw(o){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(o),this}uint32(o){for(assertUInt32(o);o>127;)this.buf.push(127&o|128),o>>>=7;return this.buf.push(o),this}int32(o){return assertInt32(o),(0,w.f7)(o,this.buf),this}bool(o){return this.buf.push(+!!o),this}bytes(o){return this.uint32(o.byteLength),this.raw(o)}string(o){let p=this.encodeUtf8(o);return this.uint32(p.byteLength),this.raw(p)}float(o){assertFloat32(o);let p=new Uint8Array(4);return new DataView(p.buffer).setFloat32(0,o,!0),this.raw(p)}double(o){let p=new Uint8Array(8);return new DataView(p.buffer).setFloat64(0,o,!0),this.raw(p)}fixed32(o){assertUInt32(o);let p=new Uint8Array(4);return new DataView(p.buffer).setUint32(0,o,!0),this.raw(p)}sfixed32(o){assertInt32(o);let p=new Uint8Array(4);return new DataView(p.buffer).setInt32(0,o,!0),this.raw(p)}sint32(o){return assertInt32(o),o=(o<<1^o>>31)>>>0,(0,w.f7)(o,this.buf),this}sfixed64(o){let p=new Uint8Array(8),f=new DataView(p.buffer),m=I.M.enc(o);return f.setInt32(0,m.lo,!0),f.setInt32(4,m.hi,!0),this.raw(p)}fixed64(o){let p=new Uint8Array(8),f=new DataView(p.buffer),m=I.M.uEnc(o);return f.setInt32(0,m.lo,!0),f.setInt32(4,m.hi,!0),this.raw(p)}int64(o){let p=I.M.enc(o);return(0,w.cV)(p.lo,p.hi,this.buf),this}sint64(o){let p=I.M.enc(o),f=p.hi>>31,m=p.lo<<1^f,_=(p.hi<<1|p.lo>>>31)^f;return(0,w.cV)(m,_,this.buf),this}uint64(o){let p=I.M.uEnc(o);return(0,w.cV)(p.lo,p.hi,this.buf),this}};let BinaryReader=class BinaryReader{constructor(o,p=(0,k.d)().decodeUtf8){this.decodeUtf8=p,this.varint64=w.ls,this.uint32=w.Gn,this.buf=o,this.len=o.length,this.pos=0,this.view=new DataView(o.buffer,o.byteOffset,o.byteLength)}tag(){let o=this.uint32(),p=o>>>3,f=7&o;if(p<=0||f<0||f>5)throw Error("illegal tag: field no "+p+" wire type "+f);return[p,f]}skip(o,p){let f=this.pos;switch(o){case _.Varint:for(;128&this.buf[this.pos++];);break;case _.Bit64:this.pos+=4;case _.Bit32:this.pos+=4;break;case _.LengthDelimited:let m=this.uint32();this.pos+=m;break;case _.StartGroup:for(;;){let[o,f]=this.tag();if(f===_.EndGroup){if(void 0!==p&&o!==p)throw Error("invalid end group tag");break}this.skip(f,o)}break;default:throw Error("cant skip wire type "+o)}return this.assertBounds(),this.buf.subarray(f,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let o=this.uint32();return o>>>1^-(1&o)}int64(){return I.M.dec(...this.varint64())}uint64(){return I.M.uDec(...this.varint64())}sint64(){let[o,p]=this.varint64(),f=-(1&o);return o=(o>>>1|(1&p)<<31)^f,p=p>>>1^f,I.M.dec(o,p)}bool(){let[o,p]=this.varint64();return 0!==o||0!==p}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return I.M.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return I.M.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let o=this.uint32(),p=this.pos;return this.pos+=o,this.assertBounds(),this.buf.subarray(p,p+o)}string(){return this.decodeUtf8(this.bytes())}};function assertInt32(o){if("string"==typeof o)o=Number(o);else if("number"!=typeof o)throw Error("invalid int32: "+typeof o);if(!Number.isInteger(o)||o>L||o<B)throw Error("invalid int32: "+o)}function assertUInt32(o){if("string"==typeof o)o=Number(o);else if("number"!=typeof o)throw Error("invalid uint32: "+typeof o);if(!Number.isInteger(o)||o>O||o<0)throw Error("invalid uint32: "+o)}function assertFloat32(o){if("string"==typeof o){let p=o;if(Number.isNaN(o=Number(o))&&"NaN"!==p)throw Error("invalid float32: "+p)}else if("number"!=typeof o)throw Error("invalid float32: "+typeof o);if(Number.isFinite(o)&&(o>M||o<x))throw Error("invalid float32: "+o)}},0x7b8b1b5e:(o,p,f)=>{"use strict";f.d(p,{d:()=>getTextEncoding});let m=Symbol.for("@bufbuild/protobuf/text-encoding");function getTextEncoding(){if(void 0==globalThis[m]){let o=new globalThis.TextEncoder,p=new globalThis.TextDecoder;globalThis[m]={encodeUtf8:p=>o.encode(p),decodeUtf8:o=>p.decode(o),checkUtf8(o){try{return encodeURIComponent(o),!0}catch{return!1}}}}return globalThis[m]}},0x14db667d5:(o,p,f)=>{"use strict";function varint64read(){let o=0,p=0;for(let f=0;f<28;f+=7){let m=this.buf[this.pos++];if(o|=(127&m)<<f,(128&m)==0)return this.assertBounds(),[o,p]}let f=this.buf[this.pos++];if(o|=(15&f)<<28,p=(112&f)>>4,(128&f)==0)return this.assertBounds(),[o,p];for(let f=3;f<=31;f+=7){let m=this.buf[this.pos++];if(p|=(127&m)<<f,(128&m)==0)return this.assertBounds(),[o,p]}throw Error("invalid varint")}function varint64write(o,p,f){for(let m=0;m<28;m+=7){let _=o>>>m,w=_>>>7!=0||0!=p,I=(w?128|_:_)&255;if(f.push(I),!w)return}let m=o>>>28&15|(7&p)<<4,_=p>>3!=0;if(f.push((_?128|m:m)&255),_){for(let o=3;o<31;o+=7){let m=p>>>o,_=m>>>7!=0,w=(_?128|m:m)&255;if(f.push(w),!_)return}f.push(p>>>31&1)}}function int64FromString(o){let p="-"===o[0];p&&(o=o.slice(1));let f=0,m=0;function add1e6digit(p,_){let w=Number(o.slice(p,_));m*=1e6,(f=1e6*f+w)>=0x100000000&&(m+=f/0x100000000|0,f%=0x100000000)}return add1e6digit(-24,-18),add1e6digit(-18,-12),add1e6digit(-12,-6),add1e6digit(-6),p?negate(f,m):newBits(f,m)}function int64ToString(o,p){let f=newBits(o,p),m=0x80000000&f.hi;m&&(f=negate(f.lo,f.hi));let _=uInt64ToString(f.lo,f.hi);return m?"-"+_:_}function uInt64ToString(o,p){if({lo:o,hi:p}=toUnsigned(o,p),p<=2097151)return String(0x100000000*p+o);let f=0xffffff&o,m=(o>>>24|p<<8)&0xffffff,_=p>>16&65535,w=f+6777216*m+6710656*_,I=m+8147497*_,k=2*_;return w>=1e7&&(I+=Math.floor(w/1e7),w%=1e7),I>=1e7&&(k+=Math.floor(I/1e7),I%=1e7),k.toString()+decimalFrom1e7WithLeadingZeros(I)+decimalFrom1e7WithLeadingZeros(w)}function toUnsigned(o,p){return{lo:o>>>0,hi:p>>>0}}function newBits(o,p){return{lo:0|o,hi:0|p}}function negate(o,p){return p=~p,o?o=~o+1:p+=1,newBits(o,p)}f.d(p,{Gn:()=>varint32read,Hc:()=>uInt64ToString,LJ:()=>int64FromString,_Q:()=>int64ToString,cV:()=>varint64write,f7:()=>varint32write,ls:()=>varint64read});let decimalFrom1e7WithLeadingZeros=o=>{let p=String(o);return"0000000".slice(p.length)+p};function varint32write(o,p){if(o>=0){for(;o>127;)p.push(127&o|128),o>>>=7;p.push(o)}else{for(let f=0;f<9;f++)p.push(127&o|128),o>>=7;p.push(1)}}function varint32read(){let o=this.buf[this.pos++],p=127&o;if((128&o)==0||(p|=(127&(o=this.buf[this.pos++]))<<7,(128&o)==0)||(p|=(127&(o=this.buf[this.pos++]))<<14,(128&o)==0)||(p|=(127&(o=this.buf[this.pos++]))<<21,(128&o)==0))return this.assertBounds(),p;p|=(15&(o=this.buf[this.pos++]))<<28;for(let p=5;(128&o)!=0&&p<10;p++)o=this.buf[this.pos++];if((128&o)!=0)throw Error("invalid varint");return this.assertBounds(),p>>>0}},0x224f89d0c:(o,p,f)=>{"use strict";function isWrapper(o){return isWrapperTypeName(o.$typeName)}function isWrapperDesc(o){let p=o.fields[0];return isWrapperTypeName(o.typeName)&&void 0!==p&&"scalar"==p.fieldKind&&"value"==p.name&&1==p.number}function isWrapperTypeName(o){return o.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(o.substring(16))}f.d(p,{Y:()=>isWrapper,l:()=>isWrapperDesc})},0x17fd3f3e8:(o,p,f)=>{"use strict";f.d(p,{A:()=>w});var m=f(0xf55ff5b9),_=f(0x1c3af1a08);function LodashWrapper(o,p){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!p,this.__index__=0,this.__values__=void 0}LodashWrapper.prototype=(0,m.A)(_.A.prototype),LodashWrapper.prototype.constructor=LodashWrapper;let w=LodashWrapper},0x1c3af1a08:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});let __WEBPACK_DEFAULT_EXPORT__=function(){}},0xb9f5ba19:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});let __WEBPACK_DEFAULT_EXPORT__=function(o,p){return o<p}},0x4ef0b5f:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m=f(0x1b14b1a9b),_=f(0xdcca10),w=Array.prototype.splice;let __WEBPACK_DEFAULT_EXPORT__=function(o,p){for(var f=o?p.length:0,I=f-1;f--;){var k=p[f];if(f==I||k!==M){var M=k;(0,_.A)(k)?w.call(o,k,1):(0,m.A)(o,k)}}return o}},0x23d8cd587:(o,p,f)=>{"use strict";f.d(p,{A:()=>_createWrap});var m=f(0x854f5389),_=f(0x96760ac1),w=_.A?function(o,p){return _.A.set(o,p),o}:m.A,I=f(0xf55ff5b9),k=f(0x1598e5174);let _createCtor=function(o){return function(){var p=arguments;switch(p.length){case 0:return new o;case 1:return new o(p[0]);case 2:return new o(p[0],p[1]);case 3:return new o(p[0],p[1],p[2]);case 4:return new o(p[0],p[1],p[2],p[3]);case 5:return new o(p[0],p[1],p[2],p[3],p[4]);case 6:return new o(p[0],p[1],p[2],p[3],p[4],p[5]);case 7:return new o(p[0],p[1],p[2],p[3],p[4],p[5],p[6])}var f=(0,I.A)(o.prototype),m=o.apply(f,p);return(0,k.A)(m)?m:f}};var M=f(0xeae6be84);let _createBind=function(o,p,f){var m=1&p,_=_createCtor(o);function wrapper(){return(this&&this!==M.A&&this instanceof wrapper?_:o).apply(m?f:this,arguments)}return wrapper};var x=f(0x113eea6d0),O=Math.max;let _composeArgs=function(o,p,f,m){for(var _=-1,w=o.length,I=f.length,k=-1,M=p.length,x=O(w-I,0),L=Array(M+x),B=!m;++k<M;)L[k]=p[k];for(;++_<I;)(B||_<w)&&(L[f[_]]=o[_]);for(;x--;)L[k++]=o[_++];return L};var L=Math.max;let _composeArgsRight=function(o,p,f,m){for(var _=-1,w=o.length,I=-1,k=f.length,M=-1,x=p.length,O=L(w-k,0),B=Array(O+x),U=!m;++_<O;)B[_]=o[_];for(var $=_;++M<x;)B[$+M]=p[M];for(;++I<k;)(U||_<w)&&(B[$+f[I]]=o[_++]);return B},_countHolders=function(o,p){for(var f=o.length,m=0;f--;)o[f]===p&&++m;return m};var B=f(0x37b2f68e),U=(0,f(0xec89e206).A)(w),$=/\{\n\/\* \[wrapped with (.+)\] \*/,q=/,? & /;let _getWrapDetails=function(o){var p=o.match($);return p?p[1].split(q):[]};var Z=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;let _insertWrapDetails=function(o,p){var f=p.length;if(!f)return o;var m=f-1;return p[m]=(f>1?"& ":"")+p[m],p=p.join(f>2?", ":" "),o.replace(Z,`{
/* [wrapped with `+p+`] */
`)};var ee=f(0x134a4c004),et=f(0x14ea66d08),ei=f(0x1b9344374),er=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];let _setWrapToString=function(o,p,f){var m,_,w=p+"";return(0,ee.A)(o,_insertWrapDetails(w,(m=_getWrapDetails(w),_=f,(0,et.A)(er,function(o){var p="_."+o[0];_&o[1]&&!(0,ei.A)(m,p)&&m.push(p)}),m.sort())))},_createRecurry=function(o,p,f,m,_,w,I,k,M,x){var O=8&p;p|=O?32:64,4&(p&=~(O?64:32))||(p&=-4);var L=[o,p,_,O?w:void 0,O?I:void 0,O?void 0:w,O?void 0:I,k,M,x],$=f.apply(void 0,L);return(0,B.A)(o)&&U($,L),$.placeholder=m,_setWrapToString($,o,p)};var en=f(0x207108f5a),eo=f(0x1232ccac2),es=f(0xdcca10),ea=Math.min;let _reorder=function(o,p){for(var f=o.length,m=ea(p.length,f),_=(0,eo.A)(o);m--;){var w=p[m];o[m]=(0,es.A)(w,f)?_[w]:void 0}return o};var el=f(0x20222d68f);function createHybrid(o,p,f,m,_,w,I,k,x,O){var L=128&p,B=1&p,U=2&p,$=24&p,q=512&p,Z=U?void 0:_createCtor(o);function wrapper(){for(var ee=arguments.length,et=Array(ee),ei=ee;ei--;)et[ei]=arguments[ei];if($)var er=(0,en.A)(wrapper),eo=_countHolders(et,er);if(m&&(et=_composeArgs(et,m,_,$)),w&&(et=_composeArgsRight(et,w,I,$)),ee-=eo,$&&ee<O){var es=(0,el.A)(et,er);return _createRecurry(o,p,createHybrid,wrapper.placeholder,f,et,es,k,x,O-ee)}var ea=B?f:this,ed=U?ea[o]:o;return ee=et.length,k?et=_reorder(et,k):q&&ee>1&&et.reverse(),L&&x<ee&&(et.length=x),this&&this!==M.A&&this instanceof wrapper&&(ed=Z||_createCtor(ed)),ed.apply(ea,et)}return wrapper}let ed=createHybrid,_createCurry=function(o,p,f){var m=_createCtor(o);function wrapper(){for(var _=arguments.length,w=Array(_),I=_,k=(0,en.A)(wrapper);I--;)w[I]=arguments[I];var O=_<3&&w[0]!==k&&w[_-1]!==k?[]:(0,el.A)(w,k);if((_-=O.length)<f)return _createRecurry(o,p,ed,wrapper.placeholder,void 0,w,O,void 0,void 0,f-_);var L=this&&this!==M.A&&this instanceof wrapper?m:o;return(0,x.A)(L,this,w)}return wrapper},_createPartial=function(o,p,f,m){var _=1&p,w=_createCtor(o);function wrapper(){for(var p=-1,I=arguments.length,k=-1,O=m.length,L=Array(O+I),B=this&&this!==M.A&&this instanceof wrapper?w:o;++k<O;)L[k]=m[k];for(;I--;)L[k++]=arguments[++p];return(0,x.A)(B,_?f:this,L)}return wrapper};var ec=f(0x4269b8fc),eu="__lodash_placeholder__",eh=Math.min;let _mergeData=function(o,p){var f=o[1],m=p[1],_=f|m,w=_<131,I=128==m&&8==f||128==m&&256==f&&o[7].length<=p[8]||384==m&&p[7].length<=p[8]&&8==f;if(!(w||I))return o;1&m&&(o[2]=p[2],_|=1&f?0:4);var k=p[3];if(k){var M=o[3];o[3]=M?_composeArgs(M,k,p[4]):k,o[4]=M?(0,el.A)(o[3],eu):p[4]}return(k=p[5])&&(M=o[5],o[5]=M?_composeArgsRight(M,k,p[6]):k,o[6]=M?(0,el.A)(o[5],eu):p[6]),(k=p[7])&&(o[7]=k),128&m&&(o[8]=null==o[8]?p[8]:eh(o[8],p[8])),null==o[9]&&(o[9]=p[9]),o[0]=p[0],o[1]=_,o};var ep=f(0xf1f069a8),ef=Math.max;let _createWrap=function(o,p,f,m,_,I,k,M){var x=2&p;if(!x&&"function"!=typeof o)throw TypeError("Expected a function");var O=m?m.length:0;if(O||(p&=-97,m=_=void 0),k=void 0===k?k:ef((0,ep.A)(k),0),M=void 0===M?M:(0,ep.A)(M),O-=_?_.length:0,64&p){var L=m,B=_;m=_=void 0}var $=x?void 0:(0,ec.A)(o),q=[o,p,f,m,_,L,B,I,k,M];if($&&_mergeData(q,$),o=q[0],p=q[1],f=q[2],m=q[3],_=q[4],(M=q[9]=void 0===q[9]?x?0:o.length:ef(q[9]-O,0))||!(24&p)||(p&=-25),p&&1!=p)Z=8==p||16==p?_createCurry(o,p,M):32!=p&&33!=p||_.length?ed.apply(void 0,q):_createPartial(o,p,f,m);else var Z=_createBind(o,p,f);return _setWrapToString(($?w:U)(Z,q),o,p)}},0x4269b8fc:(o,p,f)=>{"use strict";f.d(p,{A:()=>w});var m=f(0x96760ac1),_=f(0x1cbdfeceb);let w=m.A?function(o){return m.A.get(o)}:_.A},0x1c90390ca:(o,p,f)=>{"use strict";f.d(p,{A:()=>_getFuncName});let m={};var _=Object.prototype.hasOwnProperty;let _getFuncName=function(o){for(var p=o.name+"",f=m[p],w=_.call(m,p)?f.length:0;w--;){var I=f[w],k=I.func;if(null==k||k==o)return I.name}return p}},0x207108f5a:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});let __WEBPACK_DEFAULT_EXPORT__=function(o){return o.placeholder}},0x37b2f68e:(o,p,f)=>{"use strict";f.d(p,{A:()=>_isLaziable});var m=f(0xf55ff5b9),_=f(0x1c3af1a08);function LazyWrapper(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=0xffffffff,this.__views__=[]}LazyWrapper.prototype=(0,m.A)(_.A.prototype),LazyWrapper.prototype.constructor=LazyWrapper;let w=LazyWrapper;var I=f(0x4269b8fc),k=f(0x1c90390ca),M=f(0x17fd3f3e8),x=f(0x244f35bf8),O=f(0x4c1ca4d7),L=f(0x1232ccac2);let _wrapperClone=function(o){if(o instanceof w)return o.clone();var p=new M.A(o.__wrapped__,o.__chain__);return p.__actions__=(0,L.A)(o.__actions__),p.__index__=o.__index__,p.__values__=o.__values__,p};var B=Object.prototype.hasOwnProperty;function lodash(o){if((0,O.A)(o)&&!(0,x.A)(o)&&!(o instanceof w)){if(o instanceof M.A)return o;if(B.call(o,"__wrapped__"))return _wrapperClone(o)}return new M.A(o)}lodash.prototype=_.A.prototype,lodash.prototype.constructor=lodash;let U=lodash,_isLaziable=function(o){var p=(0,k.A)(o),f=U[p];if("function"!=typeof f||!(p in w.prototype))return!1;if(o===f)return!0;var m=(0,I.A)(f);return!!m&&o===m[0]}},0x96760ac1:(o,p,f)=>{"use strict";f.d(p,{A:()=>_});var m=f(0x204e5a0b2);let _=m.A&&new m.A},0x20222d68f:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m="__lodash_placeholder__";let __WEBPACK_DEFAULT_EXPORT__=function(o,p){for(var f=-1,_=o.length,w=0,I=[];++f<_;){var k=o[f];(k===p||k===m)&&(o[f]=m,I[w++]=f)}return I}},0x1d25c929:(o,p,f)=>{"use strict";f.d(p,{A:()=>B});var m=f(0x14ea66d08),_=f(0x1ded1a2c9),w=f(0x21b3c8033),I=f(0x23d8cd587),k=f(0x207108f5a),M=f(0x20222d68f),x=(0,w.A)(function(o,p,f){var m=1;if(f.length){var _=(0,M.A)(f,(0,k.A)(x));m|=32}return(0,I.A)(o,m,p,f,_)});x.placeholder={};var O=f(0x12dd0649),L=f(0xb61f2b3c);let B=(0,O.A)(function(o,p){return(0,m.A)(p,function(p){p=(0,L.A)(p),(0,_.A)(o,p,x(o[p],o))}),o})},0xd6ebaea7:(o,p,f)=>{"use strict";f.d(p,{A:()=>I});var m=f(0x1ded1a2c9),_=f(0x4ed17f99),w=Object.prototype.hasOwnProperty;let I=(0,_.A)(function(o,p,f){w.call(o,f)?++o[f]:(0,m.A)(o,f,1)})},0x5d5e4f92:(o,p,f)=>{"use strict";f.d(p,{A:()=>x});var m=f(0x113eea6d0),_=f(0x21b3c8033),w=f(0x1774318f5),I=f(0x1598e5174);function customDefaultsMerge(o,p,f,m,_,k){return(0,I.A)(o)&&(0,I.A)(p)&&(k.set(p,o),(0,w.A)(o,p,void 0,customDefaultsMerge,k),k.delete(p)),o}let k=customDefaultsMerge;var M=f(0x6497d5b5);let x=(0,_.A)(function(o){return o.push(void 0,k),(0,m.A)(M.A,void 0,o)})},0x103edac79:(o,p,f)=>{"use strict";f.d(p,{A:()=>x});var m=f(0x19f42982e),_=f(0x152d4868a),w=f(0x1cf885968),I=f(0x21b3c8033),k=f(0x1144c65c4),M=f(0x20bafd237);let x=(0,I.A)(function(o,p){var f=(0,M.A)(p);return(0,k.A)(f)&&(f=void 0),(0,k.A)(o)?(0,m.A)(o,(0,_.A)(p,1,k.A,!0),(0,w.A)(f,2)):[]})},0x6497d5b5:(o,p,f)=>{"use strict";f.d(p,{A:()=>_});var m=f(0x1774318f5);let _=(0,f(0x2188ae44a).A)(function(o,p,f,_){(0,m.A)(o,p,f,_)})},0x1557e938d:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m=f(0xdf203402),_=f(0xb9f5ba19),w=f(0x854f5389);let __WEBPACK_DEFAULT_EXPORT__=function(o){return o&&o.length?(0,m.A)(o,w.A,_.A):void 0}},0xfd43ac2c:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m=f(0xdf203402),_=f(0x1cf885968),w=f(0xb9f5ba19);let __WEBPACK_DEFAULT_EXPORT__=function(o,p){return o&&o.length?(0,m.A)(o,(0,_.A)(p,2),w.A):void 0}},0xc8b3fd9b:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m=f(0x1cf885968),_=f(0x4ef0b5f);let __WEBPACK_DEFAULT_EXPORT__=function(o,p){var f=[];if(!(o&&o.length))return f;var w=-1,I=[],k=o.length;for(p=(0,m.A)(p,3);++w<k;){var M=o[w];p(M,w,o)&&(f.push(M),I.push(w))}return(0,_.A)(o,I),f}},0x13d24b8d1:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m=f(0xbf5284af);let __WEBPACK_DEFAULT_EXPORT__=function(o,p,f){return null==o?o:(0,m.A)(o,p,f)}},0x24c261bcb:(o,p,f)=>{"use strict";f.d(p,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var m=f(0x1ca9f58d9),_=f(0x1a43449ff),w=f(0xf1f069a8),I=Math.min;let __WEBPACK_DEFAULT_EXPORT__=function(o,p){if((o=(0,w.A)(o))<1||o>0x1fffffffffffff)return[];var f=0xffffffff,k=I(o,0xffffffff);p=(0,_.A)(p),o-=0xffffffff;for(var M=(0,m.A)(k,p);++f<o;)p(f);return M}}}]);
//# sourceMappingURL=https://slack.com/source-maps/bv1-13/gantry-v2-vendors-client.67b1ae48b04c384a9dd2.min.js.mapØA
—Eoúô