agora的web rtc的sdk库,基于3.0.1进行的一些临时额外处理

AgoraRTCSDK.min.js 1.1MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389
  1. /*! AgoraRTC|BUILD v3.2.1-0-gf393343 */
  2. !
  3. function(e, t) {
  4. "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("AgoraRTC", [], t) : "object" == typeof exports ? exports.AgoraRTC = t() : e.AgoraRTC = t()
  5. } (window, (function() {
  6. return function(e) {
  7. var t = {};
  8. function n(r) {
  9. if (t[r]) return t[r].exports;
  10. var i = t[r] = {
  11. i: r,
  12. l: !1,
  13. exports: {}
  14. };
  15. return e[r].call(i.exports, i, i.exports, n),
  16. i.l = !0,
  17. i.exports
  18. }
  19. return n.m = e,
  20. n.c = t,
  21. n.d = function(e, t, r) {
  22. n.o(e, t) || Object.defineProperty(e, t, {
  23. enumerable: !0,
  24. get: r
  25. })
  26. },
  27. n.r = function(e) {
  28. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  29. value: "Module"
  30. }),
  31. Object.defineProperty(e, "__esModule", {
  32. value: !0
  33. })
  34. },
  35. n.t = function(e, t) {
  36. if (1 & t && (e = n(e)), 8 & t) return e;
  37. if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  38. var r = Object.create(null);
  39. if (n.r(r), Object.defineProperty(r, "default", {
  40. enumerable: !0,
  41. value: e
  42. }), 2 & t && "string" != typeof e) for (var i in e) n.d(r, i,
  43. function(t) {
  44. return e[t]
  45. }.bind(null, i));
  46. return r
  47. },
  48. n.n = function(e) {
  49. var t = e && e.__esModule ?
  50. function() {
  51. return e.
  52. default
  53. }:
  54. function() {
  55. return e
  56. };
  57. return n.d(t, "a", t),
  58. t
  59. },
  60. n.o = function(e, t) {
  61. return Object.prototype.hasOwnProperty.call(e, t)
  62. },
  63. n.p = "",
  64. n(n.s = 92)
  65. } ([function(e, t, n) {
  66. "use strict";
  67. n.r(t);
  68. var r, i = n(11),
  69. o = n.n(i),
  70. a = function() {
  71. var e = new Date;
  72. return e.toTimeString().split(" ")[0] + ":" + e.getMilliseconds()
  73. },
  74. s = n(14),
  75. c = n(3),
  76. d = n(1),
  77. u = n(46),
  78. l = n.n(u),
  79. p = n(47),
  80. f = n.n(p),
  81. g = new Array(32).fill(void 0);
  82. function m(e) {
  83. return g[e]
  84. }
  85. g.push(void 0, null, !0, !1);
  86. var h = g.length;
  87. function v(e) {
  88. var t = m(e);
  89. return function(e) {
  90. e < 36 || (g[e] = h, h = e)
  91. } (e),
  92. t
  93. }
  94. var E = new TextDecoder("utf-8", {
  95. ignoreBOM: !0,
  96. fatal: !0
  97. });
  98. E.decode();
  99. var _ = null;
  100. function S() {
  101. return null !== _ && _.buffer === r.memory.buffer || (_ = new Uint8Array(r.memory.buffer)),
  102. _
  103. }
  104. function y(e, t) {
  105. return E.decode(S().subarray(e, e + t))
  106. }
  107. function R(e) {
  108. h === g.length && g.push(g.length + 1);
  109. var t = h;
  110. return h = g[t],
  111. g[t] = e,
  112. t
  113. }
  114. var T = 0,
  115. I = new TextEncoder("utf-8"),
  116. A = "function" == typeof I.encodeInto ?
  117. function(e, t) {
  118. return I.encodeInto(e, t)
  119. }: function(e, t) {
  120. var n = I.encode(e);
  121. return t.set(n),
  122. {
  123. read: e.length,
  124. written: n.length
  125. }
  126. };
  127. var b = null;
  128. function O() {
  129. return null !== b && b.buffer === r.memory.buffer || (b = new Int32Array(r.memory.buffer)),
  130. b
  131. }
  132. var C = function() {
  133. function e() {
  134. l()(this, e)
  135. }
  136. return f()(e, [{
  137. key: "free",
  138. value: function() {
  139. var e = this.ptr;
  140. this.ptr = 0,
  141. r.__wbg_signmanager_free(e)
  142. }
  143. },
  144. {
  145. key: "get_digest",
  146. value: function(e) {
  147. return v(r.signmanager_get_digest(this.ptr, R(e)))
  148. }
  149. }], [{
  150. key: "__wrap",
  151. value: function(t) {
  152. var n = Object.create(e.prototype);
  153. return n.ptr = t,
  154. n
  155. }
  156. },
  157. {
  158. key: "new",
  159. value: function() {
  160. var t = r.signmanager_new();
  161. return e.__wrap(t)
  162. }
  163. }]),
  164. e
  165. } (),
  166. N = !1,
  167. w = null;
  168. var L, D = 0,
  169. k = "free",
  170. M = [],
  171. P = [],
  172. U = 0; (w ? Promise.resolve(w) : new Promise((function(e) {
  173. N || r ||
  174. function e() {
  175. var t = {
  176. wbg: {}
  177. };
  178. t.wbg.__wbindgen_object_drop_ref = function(e) {
  179. v(e)
  180. },
  181. t.wbg.__wbindgen_string_new = function(e, t) {
  182. return R(y(e, t))
  183. },
  184. t.wbg.__wbindgen_string_get = function(e, t) {
  185. var n = m(t),
  186. i = "string" == typeof n ? n: void 0,
  187. o = null == i ? 0 : function(e, t, n) {
  188. if (void 0 === n) {
  189. var r = I.encode(e),
  190. i = t(r.length);
  191. return S().subarray(i, i + r.length).set(r),
  192. T = r.length,
  193. i
  194. }
  195. for (var o = e.length,
  196. a = (i = t(o), S()), s = 0; s < o; s++) {
  197. var c = e.charCodeAt(s);
  198. if (c > 127) break;
  199. a[i + s] = c
  200. }
  201. if (s !== o) {
  202. 0 !== s && (e = e.slice(s)),
  203. i = n(i, o, o = s + 3 * e.length);
  204. var d = S().subarray(i + s, i + o);
  205. s += A(e, d).written
  206. }
  207. return T = s,
  208. i
  209. } (i, r.__wbindgen_malloc, r.__wbindgen_realloc),
  210. a = T;
  211. O()[e / 4 + 1] = a,
  212. O()[e / 4 + 0] = o
  213. },
  214. t.wbg.__wbindgen_throw = function(e, t) {
  215. throw new Error(y(e, t))
  216. };
  217. for (var n = Uint8Array.from(atob("55ZBgM/2Bzm2JGhNn//ljJsSorhWUYE66a1Hf8O7pfQGR2zfol8qRP6CDhsi3iG7nFZu9stSyPq/qu2Rr2w8QkTGP6Gm2cg3J5qsQgq5bcHA9mDpGv/b24uEwsixZVl1eGkdV4SB/6ayw2v48hLmNA+w5UlnTCiWwerzESQPidpSUMbamXL3pU815EQm12GhhZ9aWzo568gdZvXevBc/WHfFKQSuTgWva4e4eSmW7UxpH8sY4HlDsCTMu0WwEB8B95XsZwOp3GLgfOQmJBw036DgIKU+XGn4KpIEq77WE/h6R7sZKsFUp+u+2cDnW7IPNe7xfd9areFo0EUh0/9K9CqxUkLqMB5hlgS1fwQHRzKPhQ7gALyc6HwMCPooS0M1NrzjdfH3vUn0PeQ1GBlnrnXgiu8TunfHg5TcbBfPEbxbyiiow1Np+VEBlHNh00PiAWyu024NHaPbDGfMtzu4WF02fgkh8Pxb7bCSpCZndjTytQgAzfZxk2bbe6NoHHFnsviqYzHVpxoPEk7icHRWcZC28d2muthq673KCMQay1fJcPqSTuYhWUZS5eylIguT33lP+TBbOWQI8KtCzBN5FzqILfKzRkzrJ3L192BUF8SILdwmriv10HU9ZlQAyQA1VdegnzOl/dYk2GGsB3724y7w/7aJLHJzEfwrfIzFd5CoAft7ct+zQW2G4Wm2kpoz6uJfgrNyykQgwCO6pkPy1ADrBUuJon9ySjhgcFru6AKa99wTlIhzBw3FKFt9Aa1/1KWWy7W1wAIGzRTs/7rLXRkKFjNqGVXBdoVNTpHFtfEFsuX0X98ISr0Bennlx0h2Yl/CGNb5Kc7i3bio1XJHX24avcMsEAwfdfskCki4/dkStn7QC97YJC3z+7gD84IiEEeGcnn7gHJyeALr0ssbqDUcKqxEyheyFs9FToJziLB+eYw6nMQLmYTrQyrg3b+3YBdgx7pzNEDSyz3tmaPaikwcLSyB/Igo6U/oP/fS2TZLtmN03m4iS76YrDJAgI+2W1GboabuixVcLdxm6SQ4CzUnHSPl1knhcGhW/+OcKa53tB5j5C4wEpiENv6T9PUu4K0YwtEAqFbd/eN2wVAYCKn/nlVA8uiESxCfgs0411mRFk4i1pixJLPP5AFPG9QFZnj6X19TqmhmIhl8D6Q1rOvPCqPZV/z04HjayX4qPzPzP/5NVilN/sHhQe7ulriGmU/3rj5QEuiOymsL7EdCQMc/4mXDPdVrDBfbt6dnv11oLYGmqOP1oSBj02FtsmYrMn9pRg7HJoCh86jAnzuOYn4tGnQ4gw/89sb64NAXcoIbTIjyiHBAQCCK2Yn4I/fNF10rkQlvSvkpqLG2eYpJmpWrcouNDEUtJFR607oNraLdmUKyLc1g7SNpS+ofp1FL6rua/HFSrb5kTF2Vcy2gl+6MACbFRChKoP/un7IbYJuOima/JWFZcs/MXokIx+ijuqjMtVKaYRTzNI5ncPa2y/EXTNdUUFpMhbE7sa39Uoh6Hci/viXy2KFTNbiw+BkWOPnyOr04LjIYKlJ8ud/KvjuvNUGQOHJvj6tpZJxj97tr0OrgZCAxSHGU5JQfqEd/U0QfzGM8Wh3zdsnd9LhoIIRJAtyA2PmjwJk4zTxeYlgwPqAVTU3+9bA1QD+jLZZ3Ffk3MRq+Ar2RT8YN6ASR4bItt3omBj0LJe0zeGY3OzfhljL6LA1m4+IUp+CzeWo0aEjnvRk3iCJeajgdC+NUGB5qh8PWKtBeC58woavnRjvRNphXS4b9M7Aymcfq26B2YY2lS+wLf763OnGJlVdV/srgyAUJJZjarxom4zrYy23kLFB8zFzWuwSMue5Xm1YWape91JGDuRLIctrJWU47/XfLm6Zgei4xOwq1RcjikGuaZtDwcFg9aKtO+JOGJsCjy9AiPnmt+rmdX83GsT3KtTETnLv6ZQcnGtmt4H8AjFgGYePdQc40cj8VAOV8NCLspyW5w63b3g37GXJrzjm9Fym3fh27psjo5RuTs7XCSrNENxKm9jCcXPqWxyuXJSn6dhdWnw5SAnUjixXviWS4HsnYjw4Xt4cSwkqCB9naLstVXt5D2HgG4fzHFNHvnETft0mrhU81IBDTSyNFdDvFEX8cifoc6FcNq7pzXlotl2ZS1FIzNXddZrdXpBNYZPV52gtCok6ePpUR/Y8jyJpE9P3q8dmFVivVGgmKTcBKMDDbzeOfl4MpOGBtBX/Lab/kzqG42sTyOyGUyOoFXYGMUWJ33GPI2KNa/mW8zVl+imshfbj7PiK1qRUn74KjAkH4wjKnu50AONYUaiveSdwnEc1zCjZSJ3dmBKSxhWAcO2PdHBg5m9+JCiPGCVfK9dzoM8Bm7xx9noJiqt4hNiVa5di1Fd1JRN4rnd1DbKglKpAVSoqvJPxmuyH56TFE4BQjhfKbDMZezQJqx+KXDiW1JWGeDYaPVBWPYeZX6STIzC/DjS7UFlqoKgGGAGP17x8wmMRE6O/axG5jDzloCGxCmrymT0ZGCh4g54O1iDYUtmJr7Bo1d+H9RQj2Y10BxcMkLFTIZVjm9e3vtIbeRx0OdXE1Ou37J/WeJZyPXn1fszvp/KonCqVnt862LrxfoB/0sF5gk4Y/f6LVneU5hun9/V1OVre9XrnDBhcVaQa9Ye6gs8sHW9HCNchaFbkUpxSiyxVEFZIlbejbjSPFlkYOLhtQHduwZWRHWA9akqykJNG3PKvOZAaJG5nWQq8+e4K0JF/AXTKIIr4J7zDt8ZR4xb9T2gxjl1nfqzidMRIY5B4rkw0oetta+j8rqkFpTEGA+hU/tw7bDtpkPYvCguwncnCjwULNFT9I9jXx3H4Ws3WWMCit29F7kGq2Ka+rU/MjnuP0lsXkoB1rr8LawHH5gaf8rajq/BhKrGTIfjDiZG5qz+L7SZBZsMSZZ9pM1QhKju+GTD9iC+9HlhfXMtj94gz8U4h7eGXziEO7lo7LwLL6/DVMrGbkv68JYUYhGz2yBm/8cbQEh5vhakbhmpv1K6XYM9rzdsd9bwYcYt3cfKE3m+/NrUa42+RpJBdFg7cAmxsZ7/0TMyVw6Aqu2gzldb2ag4iLrPNEyW1ywaJ2DXMgPi/sjnDzhuo+vIUrc86j4ZLhT4GAN6uqwbnXq5UDzX7TfuB48oMvvE1sK5q6owkdWfklgnC6pSBpK7wl+e3kuvaYnGRGJJMBQuVgWL1awHrVtfOTsSE1vc0ZdG+a/Jbza6pHbyfi5L7FXJAGdQTk0EP3VT54+F7RZ/MJ9fj56aMxzhJRwQJ6df3cM26qSc5bW/zP3PFXypTOBwzCvVtwGQzkGvDW7XGwgLbTNHDpQXOd2BQ5Zd9bjQqGg+S+kIqWZVZCqVLfyFPF9bEOHfPepL6nRDJUD2l5uRnXqeTvidaSIoqS1Fbc6mLPtYnbp6uuts6Qo8TbMzFuI7NuaPuKnQIyVu7vUGJ8jg1uVOjlMNKdVtLPr9/ZEKVZVj7lsFA+nm3zRjjr1DRKhr/wY1CI1iXKVTeQZ0i2PSnN99j4iVTSwNAYQLWWD+KyZ/xRLVxmZQPuSkLeKBRAkavxjWnIFQb1dn72wMSUdcB9cNCNJNdyTkrl44MRR+pUuiVrTAnTlzL33X32eEYwT+vn564yxFJLUDyIMNjJ0nx+GreKSOglI2et0kAwRHKYFclH9GVTiVlB0TWeUJGD+7JYogF7BizjTGyPOUEWQCguIEmtC4fHD5461T80Z3Mp7rhNTI+Cswuknr9hrIZmpRyFSrSrP8R4S1Cf34Tu4RNrDxpofVK9nGTklZPsYM6eiP29Lx264fsX9oLdYhq7vCwcrRMJ1a5d0QHXUYRV5IqTFBoUSpxkQ6IHHL8ckM4NCzwk8K0CA3pj5Jp2a9wZjfKq7R/eukzQFuhMxV2qgHf2E3t7/SA8N7sMvsmF0p3J96QRE3rA85ekH1q8nrBVujlIqahmL0Qto3+JxdqAfnKMCblQGSKVWZgWLMm82MG/9pjhdkMzG7C2GRLGMty2y8NhX1pZWHNbLOmvaC424LNz/Nl5tkPv7fVbCT2ItB+/dx3ZhVhmgSLd1zL+2PsNFmj7VGBruTttezlo1mDKErjY27nTswjf2fY/Uq8lPcVAgRpJM+m7jS/8dk8cdl7fkY7Tuj4TfiSe0tiNSoJgZwom4+9haoBQ65AifaB7pUiTc0MAXCvG+nDydkRIbKx5fL6gAlyMAnBbQf+Qh1naLfzzwLVTP0EEyoenW2W1zKqfMql5rwGlyCB9mSa2s25yHf4SDSBlgEVMJtplpRgegZvDakpWDKgx3UR4W7yKW+RD7bd7rEa/GQmA/q0RYAOIaXfO/2CgEUPtNhPS2uqy29lBYFPPv5SHQ0t/jRxQLBpe09ateAWKypt9TWS7Z5gynOePS5M2NC16AhF0Xz6s7DUjtI0xNho9Y6GK16J5V8HqHypV/OAz7+VBzTaiR57XGH4r62GoAiJqfWOM7okzKCeeSBnOIKPHtwgM0SQbvCvv7rmS6ZAacu4BbXZ5R9gOhdR9H3bi7lWLBNnqqLPIy0k6m4XBhtl40B6z/5AcJxjtKfwvIExl7VsQRqbW8gpPMsmJZfSp3uC35g1AkP+BJlju3RVoFZNo3JR18A5uc60NGD4zvzIdGTAOth4ZAZx0ZGQItHuNcLz/0CiavJdkjD65h4avf1vf7LFZ1uogJz6vLK3uDisXIBIGkXOlIpxTdjjjTQt6Khy50bYbXsG9JBrSUGhsBWpeRUnq2cZWOifhfueY95gFIDAu37oKR3FQ1YxGMg3UMq+L2VN2rtqodelSHof8SyYZVQWs7L0bjtgolId1tAAjHI7J1/+JIRXeUBjjaGGQAU+az9XFfiqn+VRAGG8JDdP/WmEqjhYpcy00LIBIBzCF9I9mbXCv8IX9fhPlI5NqWGO/v0ikpfn+hb5U16FcPYsx+xLb4la6nSbvrTDP5MthPyeLIIY7ZE/rNU4ajgPmI0/3RvD7WtEbo8UGPjnev55N2ELuFpEPzkNu9MzXqq8K0cWxk4lT2DQPi3rDO8x8i5jX7wWQi8e0neCMb0SUO67zRfaekZONGfaFl47LByciUuy5dhqxMPokhTE2WbzxqCyt/s2TqG66R0ocYHmzv9f7tJ+TES8NFyzL3fhNoZoW5IxWNE+stYWutd3LPwa7HKhhRAbl5uCEbEGjrUzTXwbzG0qvpmNtpnYnmKjzTaSAFNCxfw9edcjaxCiRKKIDd6GS/eDsGBgTvJexDfwGmVWm9jadZhee9jRFiZFtL6m7sY1oQa8F9ycxSuPANXCqWkApcaEfQLkt1yyfeRs5yC5O/6XGJ4TEtJmCTPJFRr95au20STIPgkoEF1mzZ+5ZRtWKUYuWJVZDwcA/lTy6oYp0/d0LGPRUXnXRm0qtIXQVdnoVhKZPeWACt9rujRL57MEDi2kHtfV/ucu+k03bN0fQlbalUJ0faY99GC6L8MO8MXTSmqDAxNSpqpIFPhgHgAg0YK/GZhlQjbQXE4tMDEDO9obNfp4W6m8fdznMesSSRINBG5FDf//DkT9pSRQsIdSg4VK7W7j2d2jsQUIyjJmbd/2zCTaqh0Yq0cH6mS/5g/cq3eGOiJbaCNo6oVwGURzXVAeVaGIfJFhd2A59sVp+rVfe1f8B6bVbCLIKgGUgpUokO0vTg6ouAxXGQKtveMhhBT83ukPIRZ02+qF1kvM+nNCVy8uzrB0+W9QIKbMio2m/7zW78xd5Tf9itocpLbRuNC5cuS/GyRGXw6fzFzjM1UITlQ5dlvoyYxuvb7ol4S1MyhkfMNZbif6/xic0wB3uSScez3oFTRbCHBd0cbJL3cLwfQjCBpGBrRVC7174qW4XWnw0eYGSSzTVSEDOlMaTUIGJO+s7/z8JxaZprcEsoB4+vt9/+uwtM/iyqLVPidu8ZTh+F1rsEWKwZhDAg/giVc6VzRq+DJCrhn81b/LYlLJOdgoAjID2VnwgU+mQhCL6KhgIqqiVraD25UIYEqxMcZ1aRcZvHa8x5gh5onPtsVcl53Xek9BOYqkyj64acX921zwqoY0lmNA81NE7BzVts3cwWDZ4Dk6uuzwtfJuJc7vVS+fdVDEg3ATwC9oG5/Vb1swTyzTsl2V4m+93bSQo5STFG5AruTDWTym6Lxtt4OrAeIVgdoyTJL+keHiHTNiL0/nO5oYwftSQK1aYBuA0e12t/FVN+LsCk0L/hfCCcke89LuP4d46qnFo3NLpHb+NFrvekXVT4GiZgMW2H0orIY0TpS15wlxVUaGCUo7YSN0yWDRU5+p41dCOs5/vXq1do7K+Byjj35/mPlQ+VEDqqF7OIBQrXfHgCXYPy8ye3Ih3io+tYA6nK0/2clIERrpA0AMHKLTGEO7q/IzIcOCwYN9W/ISH4v4uk9MhzNu7Fg2IPCq5CQF1GLuzQu+wNv2h94NIA2UJydawv5X2bHkZjv+kB/WQCYjxUNEU8ssUdxDZstpv2qNAHmI6BMD84olxMiwFdK5J80zc9x7de/cz3ZNIkkGIpMCZJqKKkaLVo1MLnR/h/hQeUvfqJmvkPeIre3EjnliNkKJKL0KNaupHzY7Eoztaj0cNOhJ5dxIRB2is3kLcSK1FZswRJR0B5OXX+Q4UlFIrhR10lIge3Fg5DnaGoZoOyFaaHztrdF251JubDsCZRDSWA0y6ysykO+h4jhXtuWF7D5Wp7B4Hx3EQvKsmPPZYcLevowjlWghHbRBEhwPI3bzjhNWXlqtym5ObYAeYxuHyvyYue2X4651f7Om3+m8KT7Y/JqLWXwgayCdzxHuJidti1ITuf/oXzeCfTRbG5ytXlDk/epX061W6BO074jI7nV518OkYtRJDnPqdDFAf0uWcATfk0h17+gP7GHjy0Rc0Ive9XmvA6gCkoMjNjMEA7GQ3xy7e12DzfNpIfND7GKKojMifTrvkDXrfa3o4wNYktY6/VlBdHtrcH9F7uMWICej/BjZXVX83WFGcVHx3nOXxSL59kE9bSmHc3Xp8iDbPuSG5GIRp3fTFHnmTzzGedl6al2gUbGFKtkC0jFNtKTk2rr8LEObiGgfCoSpTWknvAYDQBoj93s0KiRNPOqgY++Xka2cQiDwqUsLl8/i57YC/V6sy5/NvhViRRZgCzcyjNHGzZsYA5YMtUntyfC1gNFP7cL3AwVA+326NJI7MQJoxTqcHL/YhntsnYTR5R6GVVvFYIlW8Nv9qn3daoGXMz0MoAsXpCzbiHZ0XWkfw2qlJkmZjgQtMAEhHXNgokGRPfOprmtlvNZaNlGB1EjQTVX1Y4tCyJFZhdhID4CowB23uQF16NifyxH+DGnQrnxeklnG7UQV2BRVdr6ZEKZYv7Gj+PbpojzAskvbdtaFsataqPrLDoejjc6ZfPA5zA0iYcCvcNjzuy9SuT0uG8NWMTLv2OsImL++PQV1sifUENAwi4O3yBvzTy4J77B7mMBpjCYGXAyjFGFZL4eAazSmvZ8thJ0FFW+keLHL+ft1dQBKmXY6JatelGebcIC/PyLBHdfX9bRcauGg4xEO7mMl8AjlcPMczkPniNQpiQFqcDJYrFGoxMV2hskxMn0bRQT8Ajc6w6sQYkGl0CQUImPrGfie9dsk4mrCLMIFOqcm0WT8O8AiREEGmooBTO7WI0qk506NsV7ffvc0rVJERJKcyRyCmFZdTSn/SrBfjV7SXT3pQlgluoY4FBUCDDkzwBgjkrE1oFUA3ls+xVP10w5jjBIMwKBSQqRVAEDXw+Dyj+jH3ila8czULWsCKhWd4qGsMFN7++OGBAz9eXHjAO9m++mTXF6qiyG35Q+61yjYQKsBrjR4NNexrwVGqBwAZA6cr5mp8AhoyzPomJ6TLfWEJjEeRI3QsX5oQkNuyF7u650QFka+VjFeNRY6ALklleTW9I0v4ABKDCXTGkjv80vqVNk+FTL0bJK7ndSjjMJD7OBFIEywBPJFrxTdyzocmxEgG0zu1VDgsQuXITYCx1RRty89A/F+CdSAlbMlIkptCC0GrF/jFS8PAU+6TNV1eBqJrCr9BgH1mth8FtdfE7druR+xyZKn5idfUKzGW6ACGF4M61IRoSs9o6xmaj3dnAVQvFWUsMcR6MI3xTKJNyMxkhXhhvT0IxialnG7i/BBzXfMXYh5jl4BXzCSNlxU4+aboEgIDr48/+pfj8J3WcNccFfzV6eiX05qkNktmafoBcxrEsrM8WQV0VVSRybQyXPOqJ1yndwBI6BOGO9oGxGDAd+HcKaZlptCMJsR1Cp3m7F9HpBFSu/NYVj+WSDY7jWSFBlTBSCFyyPEUn8S9NmBVa+mwGVsz0Q+fxe23w1w6wVO7sVnZqRpmXJeXg72QFkl7Qda1lBzn/FW+rRwLvFxCsuad67Wmzab1RJdzPGsuq8AzW6tL+JiwW/VPUSBbBmV1+EjqQ28x1u9W5Eoy7zhsU8NT87CtNbZ0lPEpsoWMewxC80kPanfWPrQXmixWDXXz7uf1kBTr1J/iYuls7fUsyAChXjKcKOaCF4ySqkhMTGmjNqYiG5joBUi/SZpWvgxk28pyIPhf28YULINiqmbWPBKuTCLFruV7JfRgGM87XfNEFc7tgnYx503k/0UXJfpmjx6wKbKcvV5fqrctx+OrIn++TxRxSKlTScEIwd2vG5mg/p5wsQDpiD+X91XbkReKLB25Jvp/IJaJh715RXqBzwCwlY3URonyy+oZoTD8Ym8XMMv/dMllh0LCFZkZFn2gYcLG9iO+I5S/GyxwjajQLQtwH7o+n50vimC+ES8ePOpPDwlu4oG8KhS7NL/OTdIWPIHbSa6/9DfjOq9W66EpaK57R78PpEzVNLkTP2L6lllqDT6SDhIDIvQS3SQbxG96khXgvW/rME+tiXFXi+BC0udi9keyGlc3sLBN3CP3QXzswhBGTxvz2LmRMkU3rLuSkYR1Gzr7vj1VxTN1y1iciA0DswsPZ38eB6X10Uzk6HZqjzBK+EJ5osJJJ/s3b0MFRIWYlM15TPm1uzeOk1zQ96quClQLEZbpxmV/eAduIotXUYQZjWAkTulBJt7kw9uEnLo7OpZrf8k+0ZQP0agcOTLbfrekHji86Mxr7rTwve82mePKoAkkEthE45VI+f1VqpyWNW1kbBbVVfuatKt6MEKqyTUyxSFGHk81kY7CxkgMNexiikN0+IeiUNsfuktjfOAiMfDhbTe4rtxSEPvO4CCUGaktA58TGnSO8rHdCicmGkNrwWsnXgUWjhp8bllNcnQN10TbwxYPAwQKW/JJiYQadr4THXO+vWudiq3I47vqmEM/Ab3Dlq11Q7RmRWntYOEyESbTI8PZYwbtsmjcSwBtTAIHQ5h3I633h3FpOkT2c0PlMjzj0Q/OuqaTVt639fowVppqvSlNcK5KupBnrxfKHQK+SoKSuaO8PNMkYkbcEAc9F0I4uzPfRVP/q5QkvJVsVoJ8BEWW/q1+kivHEMQfb+J2NfJjSTG+WhjHjL8eqi7FgfVewxwmqG9IOnTkwDjAHUaJMIyhVkadW/+GQjLyNP4zyHcLAdWcB5zQ2kc/blAx2RKfG+ON3RfC+iQ5Th7V2i5abkoy0pjfyOwTjIvaq9slSCtoNGBZggBDOiWwau0CX4NAIThFyqu9VWCLr8TsqhQZvQP+xrywovGs6A079U7YBjhEXyQw4Q3rbQY1EQnxTPXNlHfn9vQnuhsJnzx6PZrCqry8fidPz2U1scmAMVPHxa/injIf+hDziEU02xWm9ou67OgebktON9V6wwVotoNOzVNJhiDBlHbktBwOjX1BlJHybLox5y/7NhR7uc8f85O6xdxueabhwtJjYcBzac56v6RbuI9IRvPzOnNbltj8Hh0ftwwhWyHAyiEat0oDSEVZ925jmxJKAqTo4/uHnkozgMDsnkzXPXBDJ1sDTawXy23mXuTJOYV6ZVWrervMaGGGQpgQjAnfP7KPZro+OKt/MpnoM0NeGQgIFAiH7dU7Nl1QbcMiwO6/5nIosJtrFB8w1kpqb6OjI9BgZHG1nzTMGA++HNrl4WQNcq3SajD4C9utQYAu/fETPFMMJeCDwHRCnPuRAlqJ5t0E5h3Wlh1Nw57LQ36kDjC3lS9w0a89eI8ym6BzEA25Cdz3LQAyz94Fvjqp7MyHrpm3PzmsV/tbSLF9NJBjFmzWPQ8Tfgvj3fi8dg78tXvEatqtUhLxsNp2VCU6IzSqafxWw93+Wk47skJv5qxM+tv7CrpYKvWLEylJNEXlh7GHm9UenNf2/szZOl+54P4ZWksh1r6+rphL68QYhmqW7DqKVrc2rjzPYcvFDmKtCGL/F62i3riMV9z+LoLnuVaMn4dtpNNFmQEQ4uEhDfLYU4x8G2OHCz7gnxLCa4zE4CFo9m/+ECmdzziVumHM/P00/BESH2rxUYMBL8/9NRG5fiskFJr4AO0qNUKUCgTRgEiFsTbGXtP4DTTzc8ZAmfNJuJQE5Kp7W7U7QZnBXKepfSHkYTEqgOhqo95Jw9i56kYGt4BWwX50mC27CCW92SVMl4tbUEhBDSB36zgztz5Zts0563Kjc34B+6ZUnMIk+BiQNvqSkZHnk3rHNSaYthO72IWLIxij0hcv7n228yc82FsQLK9jmptjY6estDfH3OSMaAj+poCLKwRFXvXWb6jwM9mG4nu1yug0Cc4L89w4EYek6dnV17VBfIxB2dmFFQdp0kqx3BM9gdMAr0KS7WLOSf3cn5eDItDLP2UW7MWaIR+GJ0EGcEL3ejBdu0to6vDh04JcRMNU55usmSn3jp74myzWE3azMIT96wr39F62c3G/ldGskbqTIMTk3gMg61vNBQ0cJSIxVdcgNb3xFDowwVyIqYz54F8Rqg0uQE4FIiUGZxJhND/AWhkukqIqLLZEpxj07kPBN6Zb2pWht/X5JrC8yJzPlvFhfJndQ4jcgjFyhvymr/a17uxTKHpKNWDEoL4nNa9/Prf7TYRw6Gyo6vcwYcUHk17SMb9aEdVnx24msNCDEKbj0OVzRaA3gFJeXZPObqJKvWqFlavGpxXnP+4ZYTl0Dmcri6vMdwX687ApG+ygiGHZDwNzU68F4JMPQ9JB45vLkCsE2w50QNP1kJZlI56dVGzfK1MyRqP4J6VshesfOT4hzR6MYq373IoONlLvENdYXN6pTxo5eRzQkwk2tZ1zmZqczCytqTEhpweKcBCCZ/FhizgLm8/x5ScBlO0wEXHZm90mpmL1gR/J2CUnz3wDU99YFFKqm01AZ8q2S5Fnh81CbD687c7K2OjWlZgdvEJA9M0JT3eKdIRd9GCx6g1TO5PWTE8OOphUDKdazyYnmMqFhFxfJ//cWJTsgYbol2a7Ob/Q69Fy3kb9K7aZLzH+Kl/uCzWnqTOrQonVL7LTFPr7wbTaepfAl5zSgMInjrGXY+Gspw+fCNgEU1zyC0Suum6VFyHBjdKWft7strrOXqOSQwxsYXp4F013mN9gZyu4Hc84A4dzIHN5UNXmxNn+vPjS82JM6klySWB9pLCzLBUgXiMDllaG6fT2PSBv/b+yaruyWBVcpsOKuEaQ37W3A3t9YFRcgB5rFMDjwOn3c0lfsg+5V+dBX2EmWLTSelNZkeq67CFnxaKtnlsAJRPBqYvoWVZcJKn0zSelrO2TwnailO7zgAHaMRmQYbXo9beBs16JWf7V8LjYGS/DYUKTTE1zKECC/pK1EKf6mxIgmV+mJ+Mc8h04qep+okIIEXaN351J3N0VUk7cEEaOLE1rFF3W4vqRcodPfbLqINF6QtTsfny1+O46J5ahlamZEyxglZtpjEkKd9yKDsgwnzqoAPN5o76IsI+FRaBc8u1qLBWxpKU615chTVegNFR5V4o1T2JGwVkueD6CjAhOplPnRyv8sauMnMy2wEMARR6AmCQ8S5ebL0nCEqjSztMoUyAEjQ6FDYqkGweu48DkBR5HjwlBloKVawYcDezxKBH8WWnMpJKZj1Ol+OHMmg5iq9xDswLx0iTNkujgatOkeRU0c/GmSSH+7GTTMLQJdj51l3EkojjEwWOjw8XBOm88GqC4bWPEE+U/5XYtZNJG/X4FYjgIvVd69RYVbMEMfPSKJ825e3XQ6RBesp/G+lkMk4VIxRakyUBPLO1u0UYnNG9ExAnPdOO0OfFvcPOL9rBJO8bR+q9Lp9/i+fH32KkaNR2WgoxQY3FY+rS2NUvtCOgZAaF9vny16WG/3zeUtRP9V28PcGivAHAwwCcRk0D0iohjAfgL/EKXJkr8gIFqbNq7lXUFRKqMbpBa182ol77SqJq1M5setGUJuSBKqYBYKdDZv3XdT/u6J5aKKkLvA5ez6PuWX0RT7kELSKDKfg9w9nwSmMmJHjbnr0blM2WvpiirR/nLid6SRN9+5KoLUb+pLw3QzD8JlS3X2q0m4BNRxfltr5KWqryOuuGDt6IOHSE8/zqGXMiTqgrUOfDH58NoWe0te4mFc1GxswvhZXWJZmaWaMJo2SBnuXa7+jIfFbnhNH74Z6jygwcqXsldYfI/Zh8BZbqTh2I7Hu44dilfbX8Uh18NVB3phRnTwpUonKquUs/iZXRnDFjtEmKg2YRQm2CP1FWRb/B92HqJlHT7Hs/Tpl3RrlxvkoskpNlW53/6Ujse0fkHLNeUm97TlDsaRXpfZkR1uWMTwhPv4oYM2Bv941R+c7nQ0yBdFNVQpZRkpejmIfjFrdQUA7DPwR69aq6Pzmk3IXarIMKG6R4MBdkB3j3HWxohnZLWpaNy/BMxS+84e4vPPfO/7+nLWVZsdpUY/nGDkQts0NGnRpZK/lW60tmncMoTepY5fMbow1GyKhqSXLbOZkz59l8DG9v9ZHPwA1roKz3MW/j2tN/U+lPQVYXTa6h1ePQkSWR2bp9OHmCCvT6s8v9PVG2ufK7dkbpY500gNx7fdArzH3yCjY33Fa5TbOuybLNdW8juJyJtikDn+5jMnMzIWP/+v12XkaXj195xk6eOKuvA5zeKk1i1PrSnmWA46Ca2ldgNqJ0rvLqM9X2EPn/QuMjLnLg0iVJ4H4r5S2PgpGdSdfVoiX/rBAq6yVDc30v8DOUae4oquSM0YDCIafLQ+hvEmB5b/f+QsTFtAR0zIVWeLyYbmrx3g9gHhVRfelCz9/exh19AGsyXcwuSaBiCzQIoctYvyhhkdCsC/cdZDce/1Fav35JQt+RJFAjiMRQhCdE4eS3SmfsREHe9LZa0ElOLhxxvs5uS/SnMYssyK9FxiucRjjOqfaIp2N8CmuNJqg3WvtMk+MlbAYeji9K94rx6U7nj9L1TGhVcAyz+Gb4sib21AW94HRzWbTrRKEkx5+KLE69Vc+8Cj1Vu2GkZ1AA2E4kaJ2aTjsEL2C0srAINXRAjnxwI3p5ED0NRYn9sT1iY9GPBJwhhd6WXEJ/Z44D0rufaDOA8dUj1SIqywRs2b7SjYcCYS8eefkwdWlpN0DvnecdwHVc3TqyCcUy7K2PMS2l2KZHzZfLCTCPaPq/NVc/Nlc5hVJoFvnNUpKWZcTsxVeHfH1mnELREECq9YES9v6FcvONCxXLQmf0k3S2dyNmsxbvlXM0u7lSqkx81md0rad3E33PPuPpDGM9UiBhSeJn3Sejmx+LdLCiZYcVxow59nCqrUmXGAbsR4O7wVQzyHdL6DX5s8k5BjHXlONz0PaIqS89xMhkYetMw6w7JZ5c/oJBH2jdZPbS6KbR0RpEe16BATLzU4QiHybxArrjBM8MKKP8Zz6MVbg/d8yb76U8nQzCK4Eqa5ombBm7/6xo2dR9O/ByfcU6qDu+efdLFAP4LiCr6C3aihDPjigUYuy0voLuX3Flevl7xXRtRZ4Vc48j2tgA7tK0wqv4OjLwCzZJn9lYIQuScQBEFMBjA6Vj8FTp4h3OphB6g0uA13nTnVLmKQ+zfELl+6znWX5nCWvbwak0t3q4qwWK3MAPKE2vqDEeCsFKvmJ2Ws+VOqnrA+ekCk9jaszBsZd71InADWijT4SHnyVmc55dv5ivXl1fED4vwNrxbiZHWeGinS3ImcoDAT1vGiLpP/D3NaiIPq9A2h5DT5SgaCVCh0JKu7DKsHjW9ZAACRxHgTSo5jrVWUJfGKweg2auQuittVidB+JaCdwYd0x9oJ4jyI5UygrB9Nzi2gbLVcCnpu+1ytsiWCbJb1Xxas8FhG/EX86taG6flZZauhaGnpRyfBB5ojGdsdPBVHEtb8R951oaNTvKXK7CddSeWaeOi2FIDPEhWhAk19RzuR9wSKEwvvi8nQFz649+fUlBMuDL7VmUBSsC1ExWwqY+uSdNKowEkpsBb+/KpWl6oGxymyR/e4uKjipBJrVPXg0nE2j6HL2JbCHNh01lV+/+6FUglhV8GTypzdvdfhYc7t0ZYtkyH/17wDakU7r1GAdUIXXmtxamhK2FdelBa4BPryblCC9gJG9htJue9LMrNS7mM6gbRA1xSFnWNsziDuGZeS3Dcu4bjsWaIebrgNnxpl/pLGxV5EtkFwDeh8fPyfPU8CZAM/Ljk3+Vi7jUtNZmZM8+f7d4wlUIkTHiAULRUKu0ODFIeyk20BiqLB7vvAT342SIDP+z5FPaa6Tjyqh/AsX2jFhbeIXKxDMb8fid0jHAWk6JKhswbtvtP6bDz+lYjvXIPwV1Y+nyft2uM8c1aUxmDHAUmZnJBvZXT43mxjXDHP05R1/dKfoExcgcYzv3wO5mazi7ugS01z6oUmByKtfQ6fA2+MQynPCoDHcp1eDtag/E3HQpHMWAgGkNh9wWR5Y48YG0W4CgvOrngI111j/x+MIuH5xFlVkxqptSjW+hnVbt9qxtXndEH5RtnxWfd9eP+kli/x3LU1WGsZVAkVElXD274LBGK0bMveEUbj/6EpnocEnvRSlglpE4GiAO5S4JdYb4uYd6oeK8vuZvTQaWMS3dEIJ2ssCxWz8DqYmc/b38ynz0DWCCeF1gCyipaLG2Kq9wqfHz3S6m7CS+H42nmDYAz2dYcx77M8purGOS5tQ4aykJXIDQBwHjIGSU+52M+1OV53rp4B3JbIXecQWEjfk9gkVoz8T6HJbIhFgm3quNMk+cIyRHlj/BdURXY8o7H7dBQfsdpLJhAsxS/1JtMkY8JoP4YdyOxzJY5x/+A9scOTXvPVoQAMqgmP899s6GvRtzNFGXLX7VHSnUj7VPO8K1qxaS/a/6v/YhRlUtNgnqnth3Jo/DKbdhdPn6HgB9YjU5GuN1uPyUXZJDZYfFwMfdqNPVoI8d1csoHMK5tquGoK060mIwBHMk3pFGqBosajr9g/5kBPrrtuIIEPFZnaAKSCQqLdeQq2B6Bs8WxD8+DfzGJ2nu0Xeb58spPoiHZAVV+I5lRUseUE0IA4E844UzFYADNYcLBW3zsP7aWzLnUZoQPuIDR3FX3bkM5mCunvXaPSi4PRkKnItEv8/OYiq8RSKQcaTwxX9YgdNbgPuXLwb5ARofv0Zj3WpHhNnlTq2Qu/lwvM3PUaqv8L7kpFqQR9aRaXfFanbLgbyxJ2kAx9oA1kRMyH3JXI06oQhRiZQ1LtWz+QKKxme0zAgI2q6/dmYApsA7WGeBae5+Y3eqkqDjXyS7Q+LzYgrM3EiqGHsibaKZKgFecxpGiMLXY5+kkuDKBdMkj2Bd8uTKI+aTWpu97gNp78fm891zYuT68sIEzE5JggpWjlWFSpzYayxvnOxJ3JYK/q8WbCy14KhtCFhdLOxCEAvyqXN3K+oP52ZzdxHiCAac5LX2TO5CTmkxp6zCT5JZDIBgnnmQU8GBowEvogfPni17fE1sljd55P2C4mWCNDr8l3hMH+4zpyZqp3iFbJx20nGtU+9LJozl0OxNrk/c0C9chEe+k4vUECnUaXbS8JqdnymqbZ1SCI+4+1BYMW4nzYKDLaqL3Nm08C/Ug7zNg2BuwhWepXrkqaRX58LCWLPDQyUzn369E1drtekeuNcI4SgdmyQZ/7xhXZ6sOKg9G/HEiJQsriRQThvHz4BhaFaXic4nlrz4LhUthGBLbnnB6tufJizYx4c6b2rY1E63pLDA8QdZsTOD7euNMku1a0T2nNQ9rOPBYPDyksaP+EmKTvqcgRycKMtzhHh37mAqVERuzIIMs/zXE9jGBpJBBWb8KCPZne6Sxw0+UFlY6/VeXJUHunHXY1csfc40Tw95XrkpLzxqX/LrsaYM7Y0UQ/Qe6PTjMQUXDseSMhYwHTXCohySQ+1fIjz/yjZWRFI1/a4d9eQzWLoGjz8O8ldPhzhpWFwwlaR0T1gpMP3VeHvDOx4RJocHJOSRQ+H4/nHJsiuXWDKowYZZW8Jk9vUiw2jExedn7glAsC/bgN1NrgIp1y+y3tmLd2V9x7yKVC+QK6MOFq19dlQflj350qUavBULMCTn0BvCRQY4q6VjniU6XHISUsaApCVoQeevAOuCUFcnwWfK+44XDo1qSpPF1wcnbH7N9aO+AzD212PgFlGkXlaQ3Gbfz9XIUMjulgGUREelr6IX+tR2K9H/yep959z5WLXlZ81Z8HCIV8CyU0JKYzkIeFqf6o2ywb2O73oRi7i8F6Vcn2zU1VWZpLfSXgTNkRtqM7r5s13UimLWtAVZs97rLcMRlwXzYp98ZnKvQLj/dpKn8nfNnU9V2Bp90frlQedeKt6zd4mPR53FKQ1J4r95n1G8ph0XG37DC9b185sWbnoyC4Q1iUvyy5IOxBrIqbqn/JSUWzdrlOiZGDJrU5IGuzUl5TaupUTIgFeLfT6uh0gIEJ5nZQ/8XjB0mmEZxTvocrU/BFoOaUvV/N48W3W/aQu5nR3KwsSByfSDAEq6qBqTVTkZtkaAd/1Rie2jkdRlZvxFMu0MGnLc0SHPII8eOz/bjfIhSQhAb38dSRcFmfRb+fpDrDHeazED6EHNayy0kESoRG+XFbJa6xWB6OlbwHVDwdO9Ka7bIOqLRHpZjwXmv/2DR9nu+2xwxE39cBHq/7Vv99HcvH8ZJeGmgHr8mBKQmOCTkvLkxf5k4FrqZuNpaRNhCB3puFuF5d2nnQbhgAaANLMCYAiGsJhX2bFM/r3BGhR/dkGPXeBQUJ4tTARQnVqA07mW/42Dv2k7Wa7hWU/wv7FTIWLwWyHX0Vqdg4BHrlJ7zh+b+T6fH+W3d53LS5rkXK5GIctMIttK+osfGYIvOD0BkkXBJR0EYUmteToIxpoaMVKZmCRC2BbmBLdUTIZiI1kVYKYnq9Q5xMGODu+6vCT2ofvYE0pmGbQ9Ln6wnBDYZUD/BL9rmiPn3n28Zs33OsHUQcLp2vjUEV5sOBLO2ScyescGu0N58y1q1NSNJuXCzI4fu4RWJtSIn3P3+9eAsMo/2NupFeaf70/usLGd2Z0F27EjLoIj+nmJ4/Q5edPFhVNpPURQrUzPALNNzEvx3e82rDtPpbZjugv7Abm2q2vMGwz5W+hGH0hkCzXdZhPFbLk0sR5vVhScLgAPdZIVZIjTuzwIKVuWmvpMr7Gwxgiglpy8ecfOAZcCpXRzG6lNuRB64D4G9AWD9vQi/crWV4Xq5VjJnRjQc3g4bJe+MmksjEctghn27n5i5PHZvW/gM0BsXzo8Pou6yOLnp49dGXpK/oLAbOdOel9h+kDqEtZunvsXa9EFomdl0QbDvk+H58SjszCVqVOXSgDpOdZjXWfZpFL6S/fd1Lq8FQS3LklgiNhdvE5GzgSO8uq3gtj8I2o+JzucnrUSrtoxa6IejmVQLGzF3rSCy3fdhBPhZnDdgctC89dRJ+PTfW4ga5WWAyaWspzFg5251FoByB8LUbD3AxhvV6M1ARNXRJ4NhPe2j9WOlu5I2KmCMGvGP5CbHAyZk3YhiuIdtDgOvre9Cz0yOWvHH5FpZQzqzyHE5XkTTFMU2JhG1nvne9SCi9zNvPnGj9h/bQXgpue78rpogXJl8oDSfMwz9fp4ocyOxEV1JCEslSsRvodEzPbUsMUYWDERNzR6f45Ku6EmW3qdD48dcFQtc9rr2wF3o85edZ/2SY0BSkOdQX1ahwPVBP554Q1Z4lbd0d/vrRCO5k3QBWOb3iML0vI4MRkiKwqt735Q2fkq0Xl1pI3nk4ll51cSEHOrFTctkxwLOiQl6HJh2q3iqHFmtOCSo0A4YLl+mllolm7FLpe/79gMoe7A5cbFPCbX9Z3GhI43FgBbWoq8pwaIoDlklRimVauOx355pv7v26P0MLrgiqWTOxJaIGO/UhHf7GSOm0r1O5m1sPYYn1bathmEkYfrQLiEWQ2/3IjunsIxgAmi6t4JsxalYxE4YyvD59EpzvswOjZUvSgkHwPZonVtaiMTLXnV3p0dKpCSSz38Kv8QbNFzqLbwbBBRUHw/nHSxNipNm5vtjfkuf06jWRwkctgu8wZqKwS/7IcGnFtmwnbJFPhpGcyV9GVFzCCG+TOeNgAWxOUPgmtLdD8JawVVDV+e3iR8kHuaZXIknncI/3uFnblTd2P/OdWvxl+9CXbqJb1CS8osg2fg/qaA9KvM3FQoZQ79JRZC/Upm90ABPCGzksTWJ7Xy9VHpnPZCgGzAVbJhmurq8tm24BjBvnm1GOKfotvCqXyIXFE1bYTRS1WtzgZrGWgR/oOUDnNgDPXqUfTmyFPfNCD9MX22hvuBans/Kl1DustiTunl9Kravj0NG1Ds5nkTqlQSYOfhgvRIowimmWAYWma55eqvaQL9GvHmuH/hIVB/tiN6s7yOW2iahReL8dNddIbMJ6BLVguJ4n1dnquV3ZNqi6V0H/Vn00j0cE80ERsZTgsHPJ0eUjxYik+eDtaEHnyAsYeR2AjRcGw=="), (function(e) {
  218. return e.charCodeAt(0)
  219. })), i = new Uint8Array([177, 156, 215, 89, 13, 111, 230, 1]), o = new Uint8Array(n.length), a = new Uint8Array(256), s = 0; s < 256; s++) a[s] = s;
  220. var c, d = 0;
  221. for (s = 0; s < 256; s++) {
  222. d = (d + a[s] + i[s % i.length]) % 256;
  223. var u = [a[d], a[s]];
  224. a[s] = u[0],
  225. a[d] = u[1]
  226. }
  227. s = 0,
  228. d = 0;
  229. for (var l = 0; l < 0 + n.length; l++) {
  230. d = (d + a[s = (s + 1) % 256]) % 256;
  231. var p = [a[d], a[s]];
  232. a[s] = p[0],
  233. a[d] = p[1],
  234. c = a[(a[s] + a[d]) % 256],
  235. l >= 0 && (o[l - 0] = n[l - 0] ^ c)
  236. }
  237. return N = !0,
  238. new Promise((function(n) { (function(e, t) {
  239. return WebAssembly.instantiate(e, t)
  240. })(o.buffer, t).then((function(t) {
  241. N = !1,
  242. r = t.instance.exports,
  243. e.__wbindgen_wasm_module = t.module,
  244. n()
  245. }))
  246. }))
  247. } ().then((function() {
  248. w = C.new(),
  249. e(w)
  250. }))
  251. }))).then((function(e) {
  252. L = e
  253. })),
  254. setInterval((function() {
  255. Object(c.getParameter)("UPLOAD_LOG") && x.info("console log upload")
  256. }), 9e5);
  257. var x = function() {
  258. var e, t, n, r, i, u, l = null,
  259. p = ["DEBUG", "INFO", "WARNING", "ERROR", "NONE"],
  260. f = 0,
  261. g = function(e, t, n) {
  262. var r = {};
  263. Array.isArray(e) || (e = [e]),
  264. e = e.map((function(e) {
  265. return {
  266. log_item_id: D++,
  267. log_level: e.log_level,
  268. payload_str: e.payload
  269. }
  270. })),
  271. r = {
  272. timestamp: Date.now(),
  273. sdk_version: c.VERSION,
  274. process_id: Object(d.getProcessId)(),
  275. payload: JSON.stringify(e)
  276. },
  277. L ? r.hash = L.get_digest("".concat(r.payload).concat(r.process_id).concat(r.timestamp)) : n && n();
  278. try {
  279. var i = l || "https://".concat(Object(c.getParameter)("LOG_UPLOAD_SERVER"), "/upload/v2");
  280. Object(s.post)(i, r, (function(e) {
  281. "OK" === e ? t && t(e) : n && n(e)
  282. }), (function(e) {
  283. n && n(e)
  284. }), {
  285. withCredentials: !0
  286. })
  287. } catch(e) {
  288. n && n(e)
  289. }
  290. },
  291. m = function(e, t) {
  292. if (Object(c.getParameter)("UPLOAD_LOG")) try {
  293. t = Array.prototype.slice.call(t);
  294. var n = "";
  295. t.forEach((function(e) {
  296. "object" === o()(e) && (e = JSON.stringify(e)),
  297. n = n + e + " "
  298. })),
  299. M.push({
  300. payload: n,
  301. log_level: e
  302. }),
  303. "free" === k &&
  304. function e(t) {
  305. k = "uploading",
  306. setTimeout((function() {
  307. g(t, (function() {
  308. U = 0,
  309. 0 !== M.length ? (P = M.length < 10 ? M.splice(0, M.length) : M.splice(0, 10), e(P)) : k = "free"
  310. }), (function() {
  311. setTimeout((function() {
  312. e(P)
  313. }), U++<2 ? 200 : 1e4)
  314. }))
  315. }), 3e3)
  316. } (P = M.length < 10 ? M.splice(0, M.length) : M.splice(0, 10))
  317. } catch(e) {}
  318. };
  319. t = function() {
  320. for (var t = [0], n = 0; n < arguments.length; n++) t.push(arguments[n]);
  321. e.apply(this, t)
  322. },
  323. n = function() {
  324. for (var t = [1], n = 0; n < arguments.length; n++) t.push(arguments[n]);
  325. e.apply(this, t)
  326. },
  327. r = function() {
  328. for (var t = [2], n = 0; n < arguments.length; n++) t.push(arguments[n]);
  329. e.apply(this, t)
  330. },
  331. i = function() {
  332. for (var t = [3], n = 0; n < arguments.length; n++) t.push(arguments[n]);
  333. e.apply(this, t)
  334. };
  335. var h = {};
  336. return u = function(e) {
  337. h[e] || (r.apply(void 0, arguments), h[e] = !0)
  338. },
  339. {
  340. DEBUG: 0,
  341. INFO: 1,
  342. WARNING: 2,
  343. ERROR: 3,
  344. NONE: 4,
  345. enableLogUpload: function() {
  346. Object(c.setParameter)("UPLOAD_LOG", !0)
  347. },
  348. disableLogUpload: function() {
  349. Object(c.setParameter)("UPLOAD_LOG", !1)
  350. },
  351. setProxyServer: function(e) {
  352. l = e ? "https://".concat(l, "/ls/?h=").concat(Object(c.getParameter)("LOG_UPLOAD_SERVER"), "&p=443&d=upload/v2") : "https://".concat(Object(c.getParameter)("LOG_UPLOAD_SERVER"), "/upload/v2")
  353. },
  354. setLogLevel: function(e) {
  355. e > 4 ? e = 4 : e < 0 && (e = 0),
  356. f = e
  357. },
  358. log: e = function() {
  359. var e = arguments[0],
  360. t = arguments;
  361. if (t[0] = a() + " Agora-SDK [" + (p[e] || "DEFAULT") + "]:", m(e, t), !(e < f)) switch (e) {
  362. case 0:
  363. case 1:
  364. console.log.apply(console, t);
  365. break;
  366. case 2:
  367. console.warn.apply(console, t);
  368. break;
  369. case 3:
  370. console.log.apply(console, t);
  371. break;
  372. default:
  373. return void console.log.apply(console, t)
  374. }
  375. },
  376. debug: t,
  377. info: n,
  378. warning: r,
  379. deprecate: u,
  380. error: i
  381. }
  382. } ();
  383. t.
  384. default = x
  385. },
  386. function(e, t, n) {
  387. "use strict";
  388. n.r(t),
  389. n.d(t, "report", (function() {
  390. return b
  391. })),
  392. n.d(t, "SESSION_INIT", (function() {
  393. return v
  394. })),
  395. n.d(t, "JOIN_CHOOSE_SERVER", (function() {
  396. return E
  397. })),
  398. n.d(t, "JOIN_GATEWAY", (function() {
  399. return _
  400. })),
  401. n.d(t, "PUBLISH", (function() {
  402. return S
  403. })),
  404. n.d(t, "SUBSCRIBE", (function() {
  405. return y
  406. })),
  407. n.d(t, "getProcessId", (function() {
  408. return A
  409. }));
  410. var r = n(44),
  411. i = n.n(r),
  412. o = n(7),
  413. a = n.n(o),
  414. s = n(3),
  415. c = n(0),
  416. d = n(14),
  417. u = n(27),
  418. l = n.n(u),
  419. p = n(45);
  420. function f(e, t) {
  421. var n = Object.keys(e);
  422. if (Object.getOwnPropertySymbols) {
  423. var r = Object.getOwnPropertySymbols(e);
  424. t && (r = r.filter((function(t) {
  425. return Object.getOwnPropertyDescriptor(e, t).enumerable
  426. }))),
  427. n.push.apply(n, r)
  428. }
  429. return n
  430. }
  431. function g(e) {
  432. for (var t = 1; t < arguments.length; t++) {
  433. var n = null != arguments[t] ? arguments[t] : {};
  434. t % 2 ? f(Object(n), !0).forEach((function(t) {
  435. i()(e, t, n[t])
  436. })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : f(Object(n)).forEach((function(t) {
  437. Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t))
  438. }))
  439. }
  440. return e
  441. }
  442. var m, h, v = "session_init",
  443. E = "join_choose_server",
  444. _ = "join_gateway",
  445. S = "publish",
  446. y = "subscribe",
  447. R = new(n.n(p).a),
  448. T = {
  449. eventType: null,
  450. sid: null,
  451. lts: null,
  452. success: null,
  453. cname: null,
  454. uid: null,
  455. peer: null,
  456. cid: null,
  457. elapse: null,
  458. extend: null,
  459. vid: 0
  460. },
  461. I = null,
  462. A = function() {
  463. return I || (I = "process-" + l()(), c.
  464. default.info("processId: " + I)),
  465. I
  466. },
  467. b = (h = 0, (m = {
  468. list: {},
  469. setProxyServer: function(e) {
  470. R.setProxy(e),
  471. m.proxyServerURL = e
  472. },
  473. getUrl: function() {
  474. return m.proxyServerURL ? "https://".concat(m.proxyServerURL, "/rs/?h=").concat(Object(s.getParameter)("EVENT_REPORT_DOMAIN"), "&p=6443&d=events/message") : "https://".concat(Object(s.getParameter)("EVENT_REPORT_DOMAIN"), ":6443/events/message")
  475. },
  476. getBackUrl: function() {
  477. return m.proxyServerURL ? "https://".concat(m.proxyServerURL, "/rs/?h=").concat(Object(s.getParameter)("EVENT_REPORT_BACKUP_DOMAIN"), "&p=6443&d=events/message") : "https://".concat(Object(s.getParameter)("EVENT_REPORT_BACKUP_DOMAIN"), ":6443/events/message")
  478. },
  479. getSessionStartTime: function(e) {
  480. return m.list[e].startTime
  481. },
  482. sessionInit: function(e, t) {
  483. var n = a()({},
  484. T);
  485. n.startTime = +new Date,
  486. n.sid = e,
  487. n.cname = t.cname,
  488. m.list[e] = n;
  489. var r = a()({},
  490. {
  491. willUploadConsoleLog: Object(s.getParameter)("UPLOAD_LOG"),
  492. areaVersion: "global"
  493. },
  494. t.extend),
  495. i = a()({},
  496. n);
  497. i.eventType = v,
  498. i.appid = t.appid,
  499. i.browser = navigator.userAgent,
  500. i.build = s.BUILD,
  501. i.lts = +new Date,
  502. i.elapse = i.lts - i.startTime,
  503. i.extend = JSON.stringify(r),
  504. i.mode = t.mode,
  505. i.process = A(),
  506. i.success = t.succ,
  507. i.version = s.VERSION,
  508. delete i.startTime,
  509. m.send({
  510. type: "Session",
  511. data: i
  512. }),
  513. m._flushInvokeReport(e)
  514. },
  515. joinChooseServer: function(e, t, n) {
  516. if (m.list[e]) {
  517. t.uid && (m.list[e].uid = parseInt(t.uid)),
  518. t.cid && (m.list[e].cid = parseInt(t.cid));
  519. var r = a()({},
  520. m.list[e]);
  521. r.eventType = E;
  522. var i = t.lts;
  523. r.lts = Date.now(),
  524. r.eventElapse = r.lts - i,
  525. r.chooseServerAddr = t.csAddr,
  526. r.errorCode = t.ec,
  527. r.elapse = r.lts - r.startTime,
  528. r.success = t.succ,
  529. r.chooseServerAddrList = JSON.stringify(t.serverList),
  530. delete r.startTime,
  531. m.send({
  532. type: "JoinChooseServer",
  533. data: r
  534. })
  535. }
  536. },
  537. reqUserAccount: function(e, t) {
  538. t.vid && (m.list[e].vid = t.vid);
  539. var n = a()({},
  540. m.list[e]),
  541. r = t.lts;
  542. n.eventType = "req_user_account",
  543. n.lts = Date.now(),
  544. n.success = t.success,
  545. n.serverAddress = t.serverAddress,
  546. n.stringUid = t.stringUid,
  547. n.uid = t.uid,
  548. n.errorCode = t.errorCode,
  549. n.elapse = n.lts - n.startTime,
  550. n.eventElapse = n.lts - r,
  551. n.extend = "string" == typeof t.extend ? t.extend: JSON.stringify(t.extend),
  552. delete n.startTime,
  553. m.send({
  554. type: "ReqUserAccount",
  555. data: n
  556. })
  557. },
  558. joinGateway: function(e, t) {
  559. t.vid && (m.list[e].vid = t.vid);
  560. var n = a()({},
  561. m.list[e]),
  562. r = t.lts;
  563. n.eventType = _,
  564. n.firstSuccess = t.firstSuccess,
  565. n.lts = Date.now(),
  566. n.gatewayAddr = t.addr,
  567. n.success = t.succ,
  568. n.errorCode = t.ec,
  569. n.elapse = n.lts - n.startTime,
  570. n.eventElapse = n.lts - r,
  571. delete n.startTime,
  572. m.send({
  573. type: "JoinGateway",
  574. data: n
  575. })
  576. },
  577. publish: function(e, t) {
  578. var n = a()({},
  579. m.list[e]);
  580. n.eventType = S;
  581. var r = t.lts;
  582. n.lts = Date.now(),
  583. n.eventElapse = n.lts - r,
  584. n.elapse = n.lts - n.startTime,
  585. n.success = t.succ,
  586. n.errorCode = t.ec,
  587. n.audio = t.audio,
  588. n.video = t.video,
  589. n.screenshare = t.screenshare,
  590. n.publishRequestid = t.publishRequestid,
  591. n.p2pid = t.p2pid,
  592. t.videoName && (n.videoName = t.videoName),
  593. t.audioName && (n.audioName = t.audioName),
  594. t.screenName && (n.screenName = t.screenName),
  595. delete n.startTime,
  596. m.send({
  597. type: "Publish",
  598. data: n
  599. }),
  600. m._flushInvokeReport(e)
  601. },
  602. subscribe: function(e, t) {
  603. var n = a()({},
  604. m.list[e]);
  605. n.eventType = y;
  606. var r = t.lts;
  607. n.lts = Date.now(),
  608. n.eventElapse = n.lts - r,
  609. n.elapse = n.lts - n.startTime,
  610. n.errorCode = t.ec,
  611. n.success = t.succ,
  612. n.subscribeRequestid = t.subscribeRequestid,
  613. n.p2pid = t.p2pid,
  614. isFinite(t.peerid) ? n.peer = t.peerid: n.peerSuid = "" + t.peerid,
  615. "boolean" == typeof t.video && (n.video = t.video),
  616. "boolean" == typeof t.audio && (n.audio = t.audio),
  617. delete n.startTime,
  618. m.send({
  619. type: "Subscribe",
  620. data: n
  621. }),
  622. m._flushInvokeReport(e)
  623. },
  624. firstRemoteFrame: function(e, t) {
  625. var n = a()({},
  626. m.list[e]);
  627. n.eventType = "first_remote_frame";
  628. var r = t.lts;
  629. n.lts = Date.now(),
  630. n.eventElapse = n.lts - r,
  631. n.elapse = n.lts - n.startTime,
  632. n.width = t.width,
  633. n.height = t.height,
  634. n.success = t.succ,
  635. n.errorCode = t.ec,
  636. isFinite(t.peerid) ? n.peer = t.peerid: n.peerSuid = "" + t.peerid,
  637. delete n.startTime,
  638. m.send({
  639. type: "FirstFrame",
  640. data: n
  641. })
  642. },
  643. firstVideoReceived: function(e, t) {
  644. var n = a()({},
  645. m.list[e]);
  646. n.eventType = "first_video_received",
  647. n.lts = Date.now(),
  648. n.peer = t.peerid,
  649. n.uid = t.uid,
  650. n.elapse = t.elapse,
  651. n.subscribeElapse = t.subscribeElapse,
  652. n.subscribeRequestid = t.subscribeRequestid,
  653. n.p2pid = t.p2pid,
  654. m.send({
  655. type: "FirstVideoReceived",
  656. data: n
  657. })
  658. },
  659. firstAudioReceived: function(e, t) {
  660. var n = a()({},
  661. m.list[e]);
  662. n.eventType = "first_audio_received",
  663. n.lts = Date.now(),
  664. n.peer = t.peerid,
  665. n.uid = t.uid,
  666. n.elapse = t.elapse,
  667. n.subscribeElapse = t.subscribeElapse,
  668. n.subscribeRequestid = t.subscribeRequestid,
  669. n.p2pid = t.p2pid,
  670. m.send({
  671. type: "FirstAudioReceived",
  672. data: n
  673. })
  674. },
  675. firstVideoDecode: function(e, t) {
  676. var n = a()({},
  677. m.list[e]);
  678. n.eventType = "first_video_decode",
  679. n.lts = Date.now(),
  680. n.peer = t.peerid,
  681. n.uid = t.uid,
  682. n.elapse = t.elapse,
  683. n.videowidth = t.width,
  684. n.videoheight = t.height,
  685. n.subscribeElapse = t.subscribeElapse,
  686. n.subscribeRequestid = t.subscribeRequestid,
  687. n.p2pid = t.p2pid,
  688. m.send({
  689. type: "FirstVideoDecode",
  690. data: n
  691. })
  692. },
  693. firstAudioDecode: function(e, t) {
  694. var n = a()({},
  695. m.list[e]);
  696. n.eventType = "first_audio_decode",
  697. n.lts = Date.now(),
  698. n.uid = t.uid,
  699. n.peer = t.peerid,
  700. n.elapse = t.elapse,
  701. n.subscribeElapse = t.subscribeElapse,
  702. n.subscribeRequestid = t.subscribeRequestid,
  703. n.p2pid = t.p2pid,
  704. m.send({
  705. type: "FirstAudioDecode",
  706. data: n
  707. })
  708. },
  709. onAddAudioStream: function(e, t) {
  710. var n = a()({},
  711. m.list[e]);
  712. n.eventType = "on_add_audio_stream",
  713. n.lts = Date.now(),
  714. n.uid = t.uid,
  715. n.peer = t.peerid,
  716. m.send({
  717. type: "OnAddAudioStream",
  718. data: n
  719. })
  720. },
  721. onAddVideoStream: function(e, t) {
  722. var n = a()({},
  723. m.list[e]);
  724. n.eventType = "on_add_video_stream",
  725. n.lts = Date.now(),
  726. n.uid = t.uid,
  727. n.peer = t.peerid,
  728. m.send({
  729. type: "OnAddVideoStream",
  730. data: n
  731. })
  732. },
  733. onUpdateStream: function(e, t) {
  734. var n = a()({},
  735. m.list[e]);
  736. n.eventType = "on_update_stream",
  737. n.lts = Date.now(),
  738. n.uid = t.uid,
  739. n.peer = t.peerid,
  740. n.audio = t.audio,
  741. n.video = t.video,
  742. m.send({
  743. type: "OnUpdateStream",
  744. data: n
  745. })
  746. },
  747. onRemoveStream: function(e, t) {
  748. var n = a()({},
  749. m.list[e]);
  750. n.eventType = "on_remove_stream",
  751. n.lts = Date.now(),
  752. n.uid = t.uid,
  753. n.peer = t.peerid,
  754. m.send({
  755. type: "OnRemoveStream",
  756. data: n
  757. })
  758. },
  759. streamSwitch: function(e, t) {
  760. var n = a()({},
  761. m.list[e]);
  762. n.eventType = "stream_switch",
  763. n.lts = Date.now(),
  764. n.isDual = t.isdual,
  765. n.elapse = n.lts - n.startTime,
  766. n.success = n.succ,
  767. delete n.startTime,
  768. m.send({
  769. type: "StreamSwitch",
  770. data: n
  771. })
  772. },
  773. audioSendingStopped: function(e, t) {
  774. var n = a()({},
  775. m.list[e]);
  776. n.eventType = "audio_sending_stopped",
  777. n.lts = Date.now(),
  778. n.elapse = n.lts - n.startTime,
  779. n.reason = t.reason,
  780. n.success = t.succ,
  781. delete n.startTime,
  782. m.send({
  783. type: "AudioSendingStopped",
  784. data: n
  785. })
  786. },
  787. videoSendingStopped: function(e, t) {
  788. var n = a()({},
  789. m.list[e]);
  790. n.eventType = "video_sending_stopped",
  791. n.lts = Date.now(),
  792. n.elapse = n.lts - n.startTime,
  793. n.reson = t.reason,
  794. n.success = t.succ,
  795. delete n.startTime,
  796. m.send({
  797. type: "VideoSendingStopped",
  798. data: n
  799. })
  800. },
  801. requestProxyAppCenter: function(e, t) {
  802. var n = a()({},
  803. m.list[e]),
  804. r = t.lts;
  805. n.eventType = "request_proxy_appcenter",
  806. n.lts = Date.now(),
  807. n.eventElapse = n.lts - r,
  808. n.elapse = n.lts - n.startTime,
  809. n.extend = t.extend + "",
  810. n.APAddr = t.APAddr,
  811. n.workerManagerList = t.workerManagerList,
  812. n.response = t.response,
  813. n.errorCode = t.ec,
  814. n.success = t.succ,
  815. delete n.startTime,
  816. m.send({
  817. type: "RequestProxyAppCenter",
  818. data: n
  819. })
  820. },
  821. requestProxyWorkerManager: function(e, t) {
  822. var n = a()({},
  823. m.list[e]),
  824. r = t.lts;
  825. n.eventType = "request_proxy_worker_manager",
  826. n.lts = Date.now(),
  827. n.eventElapse = n.lts - r,
  828. n.elapse = n.lts - n.startTime,
  829. n.extend = t.extend,
  830. n.workerManagerAddr = t.workerManagerAddr,
  831. n.response = t.response,
  832. n.errorCode = t.ec,
  833. n.success = t.succ,
  834. delete n.startTime,
  835. m.send({
  836. type: "RequestProxyWorkerManager",
  837. data: n
  838. })
  839. },
  840. requestWorkerEvent: function(e, t) {
  841. var n = a()({},
  842. m.list[e]),
  843. r = n.startTime,
  844. i = Date.now();
  845. delete(n = g({},
  846. n, {},
  847. t, {
  848. elapse: i - r,
  849. lts: i,
  850. productType: "WebRTC"
  851. })).startTime,
  852. m.send({
  853. type: "WorkerEvent",
  854. data: n
  855. })
  856. },
  857. requestApWorkerEvent: function(e, t) {
  858. var n = a()({},
  859. m.list[e]),
  860. r = n.startTime,
  861. i = Date.now();
  862. n = g({},
  863. n, {},
  864. t, {
  865. elapse: i - r,
  866. lts: i
  867. }),
  868. m.send({
  869. type: "APWorkerEvent",
  870. data: n
  871. })
  872. },
  873. sendCustomReportMessage: function(e, t, n) {
  874. var r = {
  875. type: "UserAnalytics",
  876. data: g({
  877. sid: e
  878. },
  879. t)
  880. },
  881. i = m.getUrl();
  882. Object(d.post)(i, r, (function(e) {
  883. n && n()
  884. }), (function(e) {
  885. var t = m.getBackUrl();
  886. Object(d.post)(t, r, (function(e) {
  887. n && n()
  888. }), (function(e) {
  889. n && n("Failed")
  890. }), {
  891. timeout: Object(s.getParameter)("CUSTOMER_REPORT_TIMEOUT")
  892. })
  893. }), {
  894. timeout: Object(s.getParameter)("CUSTOMER_REPORT_TIMEOUT")
  895. })
  896. },
  897. joinChannelTimeOut: function(e) {
  898. m.send({
  899. type: "JoinChannelTimeout",
  900. data: g({},
  901. e)
  902. })
  903. },
  904. peerPublishStatus: function(e) {
  905. m.send({
  906. type: "PeerPublishStatus",
  907. data: g({},
  908. e)
  909. })
  910. }
  911. }).reportApiInvoke = function(e, t) {
  912. var n = t.tag,
  913. r = t.name,
  914. i = t.getStates,
  915. o = t.options,
  916. a = t.timeout,
  917. d = void 0 === a ? 6e4: a,
  918. u = t.callback,
  919. l = t.reportResult,
  920. p = void 0 === l || l,
  921. f = Date.now(),
  922. m = 0,
  923. v = h++,
  924. E = function() {
  925. return g({
  926. tag: n,
  927. invokeId: v,
  928. sid: e,
  929. name: r,
  930. apiInvokeTime: f,
  931. options: o
  932. },
  933. i && {
  934. states: (t = i(), Object.keys(t).reduce((function(e, n) {
  935. var r = e;
  936. return null != t[n] && (r[n] = t[n]),
  937. r
  938. }), {}))
  939. });
  940. var t
  941. }, _ = !!Object(s.getParameter)("SHOW_REPORT_INVOKER_LOG");
  942. _ && c.
  943. default.info("".concat(r, " start"));
  944. var S = setTimeout((function() {
  945. b._sendApiInvoke(g({},
  946. E(), {
  947. error: "API_INVOKE_TIMEOUT",
  948. success: !1
  949. }))
  950. }), d);
  951. return function(e, t) {
  952. if (clearTimeout(S), ++m > 1 && (e = "EXECUTOR_INVOKE_".concat(m)), e) return b._sendApiInvoke(g({},
  953. E(), {
  954. success: !1,
  955. error: e
  956. },
  957. i && {
  958. states: i()
  959. })),
  960. _ && c.
  961. default.info("".concat(r, " onFailure"), e),
  962. u && u(e);
  963. b._sendApiInvoke(g({},
  964. E(), {
  965. success: !0
  966. },
  967. p && {
  968. result: t
  969. },
  970. {},
  971. i && {
  972. states: i()
  973. })),
  974. _ && c.
  975. default.info("".concat(r, " onSuccess")),
  976. u && u(null, t)
  977. }
  978. },
  979. m._cachedItems = [], m._cacheInvokeReport = function(e) {
  980. e.lts || (e.lts = Date.now()),
  981. m._cachedItems.push(e),
  982. m._cachedItems.length > 50 && m._cachedItems.shift()
  983. },
  984. m._flushInvokeReport = function(e) {
  985. if (m._cachedItems.length) {
  986. var t = m._cachedItems;
  987. m._cachedItems = [],
  988. c.
  989. default.debug("Flush cached event reporting:", t.length),
  990. t.forEach((function(t, n) {
  991. t.sid = e,
  992. setTimeout((function() {
  993. m._sendApiInvoke(t)
  994. }), 5e3 + 500 * n)
  995. }))
  996. }
  997. },
  998. m._sendApiInvoke = function(e) {
  999. var t = e.tag,
  1000. n = e.invokeId,
  1001. r = e.sid,
  1002. i = e.name,
  1003. o = e.result,
  1004. a = e.states,
  1005. c = e.options,
  1006. d = e.error,
  1007. u = e.success,
  1008. l = e.apiInvokeTime,
  1009. p = e.lts,
  1010. f = Object(s.getParameter)("NOT_REPORT_EVENT");
  1011. if (! (t && f instanceof Array && -1 !== f.indexOf(t))) if (m.list[r]) {
  1012. var h = m.list[r],
  1013. v = h.startTime,
  1014. E = h.cname,
  1015. _ = h.uid,
  1016. S = h.cid,
  1017. y = (p = p || Date.now()) - v,
  1018. R = p - l,
  1019. T = "";
  1020. if (c) try {
  1021. T = JSON.stringify(c)
  1022. } catch(e) {
  1023. T = c.toString()
  1024. }
  1025. var I = g({
  1026. invokeId: n,
  1027. sid: r,
  1028. cname: E,
  1029. cid: S,
  1030. lts: p,
  1031. uid: _,
  1032. success: u,
  1033. elapse: y,
  1034. apiName: i,
  1035. execElapse: R
  1036. },
  1037. void 0 !== c && {
  1038. options: T
  1039. },
  1040. {},
  1041. void 0 !== a && {
  1042. execStates: JSON.stringify(a)
  1043. },
  1044. {},
  1045. void 0 !== d && {
  1046. errorCode: JSON.stringify(d)
  1047. },
  1048. {},
  1049. void 0 !== o && {
  1050. execResult: JSON.stringify(o)
  1051. });
  1052. m.send({
  1053. type: "ApiInvoke",
  1054. data: I
  1055. })
  1056. } else m._cacheInvokeReport(arguments[0])
  1057. },
  1058. m.sendCache = [], m.sendTimer = null, m.send = function(e) {
  1059. if (e.data) {
  1060. var t = e.data;
  1061. m._lastLts && m._lastLts >= t.lts && (t.lts = m._lastLts + 1),
  1062. m._lastLts = t.lts
  1063. }
  1064. if (m.sendCache.push(e), null === m.sendTimer) return function e() {
  1065. m.sendTimer = setTimeout((function() {
  1066. if (0 !== m.sendCache.length) {
  1067. var t = m.sendCache.length < 10 ? m.sendCache.splice(0, m.sendCache.length) : m.sendCache.splice(0, 10);
  1068. return R.sendReportList(t),
  1069. e()
  1070. }
  1071. m.sendTimer = null
  1072. }), Object(s.getParameter)("EVENT_REPORT_SEND_INTERVAL"))
  1073. } ()
  1074. },
  1075. m)
  1076. },
  1077. function(e, t, n) {
  1078. "use strict";
  1079. n.r(t),
  1080. n.d(t, "checkValidObject", (function() {
  1081. return s
  1082. })),
  1083. n.d(t, "checkValidString", (function() {
  1084. return c
  1085. })),
  1086. n.d(t, "checkValidNumber", (function() {
  1087. return d
  1088. })),
  1089. n.d(t, "checkValidArray", (function() {
  1090. return u
  1091. })),
  1092. n.d(t, "checkValidFloatNumber", (function() {
  1093. return l
  1094. })),
  1095. n.d(t, "checkValidBoolean", (function() {
  1096. return p
  1097. })),
  1098. n.d(t, "checkValidEnum", (function() {
  1099. return a
  1100. })),
  1101. n.d(t, "checkValidUID", (function() {
  1102. return f
  1103. })),
  1104. n.d(t, "isValidString", (function() {
  1105. return g
  1106. })),
  1107. n.d(t, "isValidNumber", (function() {
  1108. return m
  1109. })),
  1110. n.d(t, "isValidBoolean", (function() {
  1111. return v
  1112. })),
  1113. n.d(t, "isASCII", (function() {
  1114. return S
  1115. })),
  1116. n.d(t, "isInteger", (function() {
  1117. return y
  1118. })),
  1119. n.d(t, "isNumber", (function() {
  1120. return R
  1121. })),
  1122. n.d(t, "isString", (function() {
  1123. return T
  1124. })),
  1125. n.d(t, "isArray", (function() {
  1126. return I
  1127. })),
  1128. n.d(t, "isEmpty", (function() {
  1129. return A
  1130. })),
  1131. n.d(t, "isValidToken", (function() {
  1132. return E
  1133. })),
  1134. n.d(t, "isValidChannelName", (function() {
  1135. return _
  1136. }));
  1137. var r = n(11),
  1138. i = n.n(r),
  1139. o = n(10),
  1140. a = function(e, t, n) {
  1141. for (var r = 0; r < n.length; r++) if (e === n[r]) return ! 0;
  1142. throw new Error("".concat(t, " can only be set as ").concat(JSON.stringify(n)))
  1143. },
  1144. s = function(e, t) {
  1145. if (!e) throw new Error("Invalid param: ".concat(t || "param", " cannot be empty"));
  1146. if ("object" !== i()(e)) throw new Error("".concat(t || "This paramter", " is of the object type"));
  1147. return ! 0
  1148. },
  1149. c = function(e, t, n, r, i) {
  1150. if (A(n) && (n = 1), r = r || 255, A(i) && (i = !0), A(e)) throw new Error("".concat(t || "param", " cannot be empty"));
  1151. if (!g(e, n, r, i)) throw new Error("Invalid ".concat(t || "string param", ": Length of the string: [").concat(n, ",").concat(r, "].").concat(i ? " ASCII characters only.": ""))
  1152. },
  1153. d = function(e, t, n, r) {
  1154. if (A(n) && (n = 1), r = r || 1e4, A(e)) throw new Error("".concat(t || "param", " cannot be empty"));
  1155. if (!m(e, n, r)) throw new Error("Invalid ".concat(t || "number param", ": The value range is [").concat(n, ",").concat(r, "]. integer only"))
  1156. },
  1157. u = function(e, t) {
  1158. if (!Array.isArray(e)) throw new Error("".concat(t, " should be an array"))
  1159. },
  1160. l = function(e, t, n, r) {
  1161. if (null == e) throw new Error("".concat(t || "param", " cannot be null"));
  1162. if (A(n) && (n = 0), r = r || 1e4, A(e)) throw new Error("".concat(t || "param", " cannot be empty"));
  1163. if (!h(e, n, r)) throw new Error("Invalid ".concat(t || "number param", ": The value range is [").concat(n, ",").concat(r, "]."))
  1164. },
  1165. p = function(e, t) {
  1166. if (A(e)) throw new Error("".concat(t || "param", " cannot be empty"));
  1167. if (!v(e)) throw new Error("Invalid ".concat(t || "boolean param", ": The value is of the boolean type."))
  1168. },
  1169. f = function(e) {
  1170. if (!Object(o.is32Uint)(e) && !g(e, 1, 255)) throw logger.error("Invalid UID ".concat(e, " ").concat(i()(e))),
  1171. new Error("[String uid] Length of the string: [1,255]. ASCII characters only. [Number uid] The value range is [0,10000]")
  1172. },
  1173. g = function(e, t, n, r) {
  1174. return t || (t = 0),
  1175. n || (n = Number.MAX_SAFE_INTEGER),
  1176. A(r) && (r = !0),
  1177. T(e) && (!r || S(e)) && e.length >= t && e.length <= n
  1178. },
  1179. m = function(e, t, n) {
  1180. return y(e) && e >= t && e <= n
  1181. },
  1182. h = function(e, t, n) {
  1183. return R(e) && e >= t && e <= n
  1184. },
  1185. v = function(e) {
  1186. return "boolean" == typeof e
  1187. },
  1188. E = function(e) {
  1189. return g(e, 1, 2047)
  1190. },
  1191. _ = function(e) {
  1192. return T(e) && /^[a-zA-Z0-9 \!\#\$\%\&\(\)\+\-\:\;\<\=\.\>\?\@\[\]\^\_\{\}\|\~\,]{1,64}$/.test(e)
  1193. },
  1194. S = function(e) {
  1195. if ("string" == typeof e) {
  1196. for (var t = 0; t < e.length; t++) {
  1197. var n = e.charCodeAt(t);
  1198. if (n < 0 || n > 255) return ! 1
  1199. }
  1200. return ! 0
  1201. }
  1202. },
  1203. y = function(e) {
  1204. return "number" == typeof e && e % 1 == 0
  1205. },
  1206. R = function(e) {
  1207. return "number" == typeof e
  1208. },
  1209. T = function(e) {
  1210. return "string" == typeof e
  1211. },
  1212. I = function(e) {
  1213. return e instanceof Array
  1214. },
  1215. A = function(e) {
  1216. return null == e
  1217. }
  1218. },
  1219. function(e, t, n) {
  1220. "use strict";
  1221. Object.defineProperty(t, "__esModule", {
  1222. value: !0
  1223. });
  1224. t.BUILD = "v3.2.1-0-gf393343";
  1225. t.VERSION = "3.2.1";
  1226. var r = 0 * Date.now() + 11499 + 86604 + 5615 + 6547 + 846;
  1227. t.SUPPORT_RESOLUTION_LIST = {
  1228. "90p_1": [160, 90, null, null, null, null],
  1229. "120p_1": [160, 120, 15, 15, 30, 65],
  1230. "120p_3": [120, 120, 15, 15, 30, 50],
  1231. "120p_4": [212, 120, null, null, null, null],
  1232. "180p_1": [320, 180, 15, 15, 30, 140],
  1233. "180p_3": [180, 180, 15, 15, 30, 100],
  1234. "180p_4": [240, 180, 15, 15, 30, 120],
  1235. "240p_1": [320, 240, 15, 15, 40, 200],
  1236. "240p_3": [240, 240, 15, 15, 40, 140],
  1237. "240p_4": [424, 240, 15, 15, 40, 220],
  1238. "360p_1": [640, 360, 15, 15, 80, 400],
  1239. "360p_3": [360, 360, 15, 15, 80, 260],
  1240. "360p_4": [640, 360, 30, 30, 80, 600],
  1241. "360p_6": [360, 360, 30, 30, 80, 400],
  1242. "360p_7": [480, 360, 15, 15, 80, 320],
  1243. "360p_8": [480, 360, 30, 30, 80, 490],
  1244. "360p_9": [640, 360, 15, 15, 80, 800],
  1245. "360p_10": [640, 360, 24, 24, 80, 800],
  1246. "360p_11": [640, 360, 24, 24, 80, 1e3],
  1247. "480p_1": [640, 480, 15, 15, 100, 500, 1, 5],
  1248. "480p_2": [640, 480, 30, 30, 100, 1e3, 25, 30],
  1249. "480p_3": [480, 480, 15, 15, 100, 400],
  1250. "480p_4": [640, 480, 30, 30, 100, 750],
  1251. "480p_6": [480, 480, 30, 30, 100, 600],
  1252. "480p_8": [848, 480, 15, 15, 100, 610],
  1253. "480p_9": [848, 480, 30, 30, 100, 930],
  1254. "480p_10": [640, 480, 10, 10, 100, 400],
  1255. "720p_1": [1280, 720, 15, 15, 120, 1130, 1, 5],
  1256. "720p_2": [1280, 720, 30, 30, 120, 2e3, 25, 30],
  1257. "720p_3": [1280, 720, 30, 30, 120, 1710],
  1258. "720p_5": [960, 720, 15, 15, 120, 910],
  1259. "720p_6": [960, 720, 30, 30, 120, 1380],
  1260. "1080p_1": [1920, 1080, 15, 15, 120, 2080, 1, 5],
  1261. "1080p_2": [1920, 1080, 30, 30, 120, 3e3, 25, 30],
  1262. "1080p_3": [1920, 1080, 30, 30, 120, 3150],
  1263. "1080p_5": [1920, 1080, 60, 60, 120, 4780],
  1264. "1440p_1": [2560, 1440, 30, 30, 120, 4850],
  1265. "1440p_2": [2560, 1440, 60, 60, 120, 7350],
  1266. "4k_1": [3840, 2160, 30, 30, 120, 8910],
  1267. "4k_3": [3840, 2160, 60, 60, 120, 13500]
  1268. };
  1269. t.AUDIO_PROFILE_SETTINGS = {
  1270. speech_low_quality: [!1, !1, !0, !0],
  1271. speech_standard: [!1, !1, !0, !1],
  1272. music_standard: [!1, !1, !1, !1],
  1273. standard_stereo: [!1, !0, !1, !1],
  1274. high_quality: [!0, !1, !1, !1],
  1275. high_quality_stereo: [!0, !0, !1, !1],
  1276. default:
  1277. [!1, !1, !1, !1]
  1278. };
  1279. var i = {
  1280. WEBCS_DOMAIN: ["ap-web-1-oversea.agora.io", "ap-web-1-north-america.agora.io"],
  1281. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-oversea.agora.io", "ap-web-2-north-america.agora.io"],
  1282. PROXY_CS: ["proxy-ap-web-oversea.agora.io", "proxy-ap-web-america.agora.io"],
  1283. CDS_AP: ["cds-ap-web-oversea.agora.io", "cds-ap-web-america.agora.io", "cds-ap-web-america2.agora.io"],
  1284. ACCOUNT_REGISTER: ["sua-ap-web-oversea.agora.io", "sua-ap-web-america.agora.io", "sua-ap-web-america2.agora.io"],
  1285. UAP_AP: ["uap-ap-web-oversea.agora.io", "uap-ap-web-america.agora.io", "uap-ap-web-america2.agora.io"],
  1286. LOG_UPLOAD_SERVER: "logservice-oversea.agora.io",
  1287. EVENT_REPORT_DOMAIN: "statscollector-1-oversea.agora.io",
  1288. EVENT_REPORT_BACKUP_DOMAIN: "statscollector-2-oversea.agora.io",
  1289. ENABLE_LIVE_SERVER_LIST: !1,
  1290. LIVE_SERVER_LIST: [],
  1291. ACCOUNT_REGISTER_RETRY_TIMEOUT: 1,
  1292. ACCOUNT_REGISTER_RETRY_RATIO: 2,
  1293. ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX: 6e4,
  1294. ACCOUNT_REGISTER_RETRY_COUNT_MAX: 1e5,
  1295. AUDIO_CONTEXT: null,
  1296. GATEWAY_DOMAINS: ["edge.agora.io"],
  1297. WEBCS_BACKUP_CONNECT_TIMEOUT: 6e3,
  1298. LIVESTREAMING_ALIGN: !0,
  1299. HTTP_CONNECT_TIMEOUT: 5e3,
  1300. PLAYER_STATE_DEFER: 2e3,
  1301. SIGNAL_REQUEST_TIMEOUT: 1e7,
  1302. SIGNAL_REQUEST_WATCH_INTERVAL: 1e3,
  1303. REPORT_STATS: !0,
  1304. REPORT_STATS_TIMEOUT: 3e3,
  1305. UPLOAD_LOG: !1,
  1306. NOT_REPORT_EVENT: [],
  1307. FILEPATH_LENMAX: 255,
  1308. SUBSCRIBE_TCC: !1,
  1309. PING_PONG_TIME_OUT: 10,
  1310. DUALSTREAM_OPERATION_CHECK: !0,
  1311. WEBSOCKET_TIMEOUT_MIN: 1e4,
  1312. EVENT_REPORT_SEND_INTERVAL: 1e3,
  1313. MEDIA_ELEMENT_EXISTS_DEPTH: 3,
  1314. CANDIDATE_TIMEOUT: 2e3,
  1315. SHIM_CANDIDATE: !1,
  1316. LEAVE_MSG_TIMEOUT: 2e3,
  1317. TICKET_RENEW_TIMEOUT: 828e5,
  1318. SHOW_REPORT_INVOKER_LOG: !1,
  1319. STATS_FILTER: {
  1320. transportId: !0,
  1321. googTrackId: !0
  1322. },
  1323. FORCE_TURN: !1,
  1324. TURN_ENABLE_TCP: !0,
  1325. TURN_ENABLE_UDP: !0,
  1326. FORCE_CHANGED_GATEWAY_FLAG: !1,
  1327. JOIN_EXTEND: "",
  1328. PUB_EXTEND: "",
  1329. SUB_EXTEND: "",
  1330. CHROME_NEW_STATS: !1,
  1331. AP_BACKOFF_MAX_TIME: 8,
  1332. SET_DEFAULT_TURNSERVER: !0,
  1333. TURN_SERVER_PASSWORD: r.toString(),
  1334. PROXY_SERVER_TYPE2: "webnginx-proxy.agora.io",
  1335. CR: !0,
  1336. CRL: 10,
  1337. CRI: 6,
  1338. CUSTOMER_REPORT_TIMEOUT: 5e3,
  1339. LIVE_STREAMING_ADDRESS: ""
  1340. };
  1341. i.WEBCS_DOMAIN = ["webrtc2-ap-web-1.agora.io", "webrtc2-ap-web-2.agoraio.cn"],
  1342. i.WEBCS_DOMAIN_BACKUP_LIST = ["webrtc2-ap-web-3.agora.io", "webrtc2-ap-web-4.agoraio.cn"],
  1343. i.PROXY_CS = ["ap-proxy-1.agora.io", "ap-proxy-2.agora.io"],
  1344. i.CDS_AP = ["cds-ap-web-1.agora.io", "cds-ap-web-2.agoraio.cn", "cds-ap-web-3.agora.io", "cds-ap-web-4.agoraio.cn"],
  1345. i.ACCOUNT_REGISTER = ["sua-ap-web-1.agora.io", "sua-ap-web-2.agoraio.cn", "sua-ap-web-3.agora.io", "sua-ap-web-4.agoraio.cn"],
  1346. i.UAP_AP = ["uap-ap-web-1.agora.io", "uap-ap-web-2.agoraio.cn", "uap-ap-web-3.agora.io", "uap-ap-web-4.agoraio.cn"],
  1347. i.LOG_UPLOAD_SERVER = "logservice.agora.io",
  1348. i.EVENT_REPORT_DOMAIN = "webcollector-1.agora.io",
  1349. i.EVENT_REPORT_BACKUP_DOMAIN = "webcollector-2.agoraio.cn",
  1350. i.GATEWAY_DOMAINS = ["edge.agora.io", "edge.agoraio.cn"];
  1351. t.setParameter = function(e, t) {
  1352. return void 0 !== i[e] && (i[e] = t, !0)
  1353. };
  1354. t.getParameter = function(e) {
  1355. return void 0 !== i[e] ? i[e] : null
  1356. }
  1357. },
  1358. function(e, t, n) {
  1359. "use strict";
  1360. n.r(t),
  1361. n.d(t, "getBrowserInfo", (function() {
  1362. return E
  1363. })),
  1364. n.d(t, "getBrowserVersion", (function() {
  1365. return p
  1366. })),
  1367. n.d(t, "getBrowserOS", (function() {
  1368. return f
  1369. })),
  1370. n.d(t, "isChrome", (function() {
  1371. return r
  1372. })),
  1373. n.d(t, "isSafari", (function() {
  1374. return i
  1375. })),
  1376. n.d(t, "isFireFox", (function() {
  1377. return a
  1378. })),
  1379. n.d(t, "isOpera", (function() {
  1380. return s
  1381. })),
  1382. n.d(t, "isEdge", (function() {
  1383. return o
  1384. })),
  1385. n.d(t, "isQQBrowser", (function() {
  1386. return c
  1387. })),
  1388. n.d(t, "isWeChatBrowser", (function() {
  1389. return d
  1390. })),
  1391. n.d(t, "isLegacyChrome", (function() {
  1392. return m
  1393. })),
  1394. n.d(t, "isSupportedPC", (function() {
  1395. return u
  1396. })),
  1397. n.d(t, "isSupportedMobile", (function() {
  1398. return l
  1399. })),
  1400. n.d(t, "getChromeKernelVersion", (function() {
  1401. return v
  1402. })),
  1403. n.d(t, "isChromeKernel", (function() {
  1404. return g
  1405. }));
  1406. var r = function() {
  1407. var e = E();
  1408. return e.name && "Chrome" === e.name
  1409. },
  1410. i = function() {
  1411. var e = E();
  1412. return e.name && "Safari" === e.name
  1413. },
  1414. o = function() {
  1415. var e = E();
  1416. return e.name && "Edge" === e.name
  1417. },
  1418. a = function() {
  1419. var e = E();
  1420. return e.name && "Firefox" === e.name
  1421. },
  1422. s = function() {
  1423. var e = E();
  1424. return e.name && "OPR" === e.name
  1425. },
  1426. c = function() {
  1427. var e = E();
  1428. return e.name && "QQBrowser" === e.name
  1429. },
  1430. d = function() {
  1431. var e = E();
  1432. return e.name && "MicroMessenger" === e.name
  1433. },
  1434. u = function() {
  1435. var e = f();
  1436. return "Linux" === e || "Mac OS X" === e || "Mac OS" === e || -1 !== e.indexOf("Windows")
  1437. },
  1438. l = function() {
  1439. var e = f();
  1440. return "Android" === e || "iOS" === e
  1441. },
  1442. p = function() {
  1443. return E().version
  1444. },
  1445. f = function() {
  1446. return E().os
  1447. },
  1448. g = function() {
  1449. return !! navigator.userAgent.match(/chrome\/[\d]./i)
  1450. };
  1451. function m() {
  1452. return window.navigator.appVersion && null !== window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./) && window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1] <= 35
  1453. }
  1454. var h, v = function() {
  1455. var e = navigator.userAgent.match(/chrome\/[\d]./i);
  1456. return e && e[0] && e[0].split("/")[1]
  1457. },
  1458. E = (h = function() {
  1459. var e, t = navigator.userAgent,
  1460. n = t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
  1461. "Chrome" === n[1] && null != (e = t.match(/(OPR(?=\/))\/?(\d+)/i)) && (n = e),
  1462. "Safari" === n[1] && null != (e = t.match(/version\/(\d+)/i)) && (n[2] = e[1]),
  1463. ~t.toLowerCase().indexOf("qqbrowser") && null != (e = t.match(/(qqbrowser(?=\/))\/?(\d+)/i)) && (n = e),
  1464. ~t.toLowerCase().indexOf("micromessenger") && null != (e = t.match(/(micromessenger(?=\/))\/?(\d+)/i)) && (n = e),
  1465. ~t.toLowerCase().indexOf("edge") && null != (e = t.match(/(edge(?=\/))\/?(\d+)/i)) && (n = e),
  1466. ~t.toLowerCase().indexOf("trident") && null != (e = /\brv[ :]+(\d+)/g.exec(t) || []) && (n = [null, "IE", e[1]]);
  1467. var r = void 0,
  1468. i = [{
  1469. s: "Windows 10",
  1470. r: /(Windows 10.0|Windows NT 10.0)/
  1471. },
  1472. {
  1473. s: "Windows 8.1",
  1474. r: /(Windows 8.1|Windows NT 6.3)/
  1475. },
  1476. {
  1477. s: "Windows 8",
  1478. r: /(Windows 8|Windows NT 6.2)/
  1479. },
  1480. {
  1481. s: "Windows 7",
  1482. r: /(Windows 7|Windows NT 6.1)/
  1483. },
  1484. {
  1485. s: "Windows Vista",
  1486. r: /Windows NT 6.0/
  1487. },
  1488. {
  1489. s: "Windows Server 2003",
  1490. r: /Windows NT 5.2/
  1491. },
  1492. {
  1493. s: "Windows XP",
  1494. r: /(Windows NT 5.1|Windows XP)/
  1495. },
  1496. {
  1497. s: "Windows 2000",
  1498. r: /(Windows NT 5.0|Windows 2000)/
  1499. },
  1500. {
  1501. s: "Windows ME",
  1502. r: /(Win 9x 4.90|Windows ME)/
  1503. },
  1504. {
  1505. s: "Windows 98",
  1506. r: /(Windows 98|Win98)/
  1507. },
  1508. {
  1509. s: "Windows 95",
  1510. r: /(Windows 95|Win95|Windows_95)/
  1511. },
  1512. {
  1513. s: "Windows NT 4.0",
  1514. r: /(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/
  1515. },
  1516. {
  1517. s: "Windows CE",
  1518. r: /Windows CE/
  1519. },
  1520. {
  1521. s: "Windows 3.11",
  1522. r: /Win16/
  1523. },
  1524. {
  1525. s: "Android",
  1526. r: /Android/
  1527. },
  1528. {
  1529. s: "Open BSD",
  1530. r: /OpenBSD/
  1531. },
  1532. {
  1533. s: "Sun OS",
  1534. r: /SunOS/
  1535. },
  1536. {
  1537. s: "Linux",
  1538. r: /(Linux|X11)/
  1539. },
  1540. {
  1541. s: "iOS",
  1542. r: /(iPhone|iPad|iPod)/
  1543. },
  1544. {
  1545. s: "Mac OS X",
  1546. r: /Mac OS X/
  1547. },
  1548. {
  1549. s: "Mac OS",
  1550. r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/
  1551. },
  1552. {
  1553. s: "QNX",
  1554. r: /QNX/
  1555. },
  1556. {
  1557. s: "UNIX",
  1558. r: /UNIX/
  1559. },
  1560. {
  1561. s: "BeOS",
  1562. r: /BeOS/
  1563. },
  1564. {
  1565. s: "OS/2",
  1566. r: /OS\/2/
  1567. },
  1568. {
  1569. s: "Search Bot",
  1570. r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
  1571. }];
  1572. for (var o in i) {
  1573. var a = i[o];
  1574. if (a.r.test(navigator.userAgent)) {
  1575. r = a.s;
  1576. break
  1577. }
  1578. }
  1579. return {
  1580. name: n[1],
  1581. version: n[2],
  1582. os: r
  1583. }
  1584. } (),
  1585. function() {
  1586. return h
  1587. })
  1588. },
  1589. function(e, t, n) {
  1590. "use strict";
  1591. n.r(t),
  1592. n.d(t, "APErrorCode", (function() {
  1593. return r
  1594. })),
  1595. n.d(t, "GatewayErrorCode", (function() {
  1596. return i
  1597. })),
  1598. n.d(t, "StringUidErrorCode", (function() {
  1599. return o
  1600. })),
  1601. n.d(t, "JOIN_GS_TRYNEXT_LIST", (function() {
  1602. return a
  1603. })),
  1604. n.d(t, "JOIN_CS_RETRY_LIST", (function() {
  1605. return s
  1606. })),
  1607. n.d(t, "INJECT_STREAM_STATUS", (function() {
  1608. return c
  1609. }));
  1610. var r = {
  1611. 1010100 : "NO_FLAG_SET",
  1612. 1010101 : "FLAG_SET_BUT_EMPTY",
  1613. 1010102 : "INVALID_FALG_SET",
  1614. 2010005 : "INVALID_VENDOR_KEY",
  1615. 2010007 : "INVALID_CHANNEL_NAME",
  1616. 2010008 : "INTERNAL_ERROR",
  1617. 2010009 : "NO_AUTHORIZED",
  1618. 2010010 : "DYNAMIC_KEY_TIMEOUT",
  1619. 2010011 : "NO_ACTIVE_STATUS",
  1620. 2010013 : "DYNAMIC_KEY_EXPIRED",
  1621. 2010014 : "STATIC_USE_DYANMIC_KEY",
  1622. 2010015 : "DYNAMIC_USE_STATIC_KEY",
  1623. 2010016 : "USER_OVERLOAD",
  1624. 2010018 : "FORBIDDEN_REGION",
  1625. 2010019 : "CANNOT_MEET_AREA_DEMAND"
  1626. },
  1627. i = {
  1628. 2e3: "ERR_NO_VOCS_AVAILABLE",
  1629. 2001 : "ERR_NO_VOS_AVAILABLE",
  1630. 2002 : "ERR_JOIN_CHANNEL_TIMEOUT",
  1631. 2003 : "WARN_REPEAT_JOIN",
  1632. 2004 : "ERR_JOIN_BY_MULTI_IP",
  1633. 2011 : "ERR_NOT_JOINED",
  1634. 2012 : "WARN_REPEAT_JOIN",
  1635. 2013 : "ERR_INVALID_VENDOR_KEY",
  1636. 2014 : "ERR_INVALID_CHANNEL_NAME",
  1637. 2015 : "ERR_INVALID_STRINGUID",
  1638. 2016 : "ERR_TOO_MANY_USERS",
  1639. 2017 : "ERR_SET_CLIENT_ROLE_TIMEOUT",
  1640. 2018 : "ERR_SET_CLIENT_ROLE_NO_PERMISSION",
  1641. 2019 : "ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",
  1642. 2020 : "ERR_PUBLISH_REQUEST_INVALID",
  1643. 2021 : "ERR_SUBSCRIBE_REQUEST_INVALID",
  1644. 2022 : "ERR_NOT_SUPPORTED_MESSAGE",
  1645. 2023 : "ERR_ILLEAGAL_PLUGIN",
  1646. 101 : "ERR_INVALID_VENDOR_KEY",
  1647. 102 : "ERR_INVALID_CHANNEL_NAME",
  1648. 103 : "WARN_NO_AVAILABLE_CHANNEL",
  1649. 104 : "WARN_LOOKUP_CHANNEL_TIMEOUT",
  1650. 105 : "WARN_LOOKUP_CHANNEL_REJECTED",
  1651. 106 : "WARN_OPEN_CHANNEL_TIMEOUT",
  1652. 107 : "WARN_OPEN_CHANNEL_REJECTED",
  1653. 108 : "WARN_REQUEST_DEFERRED",
  1654. 109 : "ERR_DYNAMIC_KEY_TIMEOUT",
  1655. 110 : "ERR_NO_AUTHORIZED",
  1656. 111 : "ERR_VOM_SERVICE_UNAVAILABLE",
  1657. 112 : "ERR_NO_CHANNEL_AVAILABLE_CODE",
  1658. 113 : "ERR_TOO_MANY_USERS",
  1659. 114 : "ERR_MASTER_VOCS_UNAVAILABLE",
  1660. 115 : "ERR_INTERNAL_ERROR",
  1661. 116 : "ERR_NO_ACTIVE_STATUS",
  1662. 117 : "ERR_INVALID_UID",
  1663. 118 : "ERR_DYNAMIC_KEY_EXPIRED",
  1664. 119 : "ERR_STATIC_USE_DYANMIC_KE",
  1665. 120 : "ERR_DYNAMIC_USE_STATIC_KE",
  1666. 2 : "K_TIMESTAMP_EXPIRED",
  1667. 3 : "K_CHANNEL_PERMISSION_INVALID",
  1668. 4 : "K_CERTIFICATE_INVALID",
  1669. 5 : "K_CHANNEL_NAME_EMPTY",
  1670. 6 : "K_CHANNEL_NOT_FOUND",
  1671. 7 : "K_TICKET_INVALID",
  1672. 8 : "K_CHANNEL_CONFLICTED",
  1673. 9 : "K_SERVICE_NOT_READY",
  1674. 10 : "K_SERVICE_TOO_HEAVY",
  1675. 14 : "K_UID_BANNED",
  1676. 15 : "K_IP_BANNED",
  1677. 16 : "K_CHANNEL_BANNED"
  1678. },
  1679. o = {
  1680. 1 : "ERROR_ILLEAGAL_APPID",
  1681. 2 : "ERROR_ILLEAGAL_UID",
  1682. 3 : "INTERNAL_SERVER_ERROR"
  1683. },
  1684. a = ["ERR_NO_VOCS_AVAILABLE", "ERR_NO_VOS_AVAILABLE", "ERR_JOIN_CHANNEL_TIMEOUT", "WARN_LOOKUP_CHANNEL_TIMEOUT", "WARN_OPEN_CHANNEL_TIMEOUT", "ERR_VOM_SERVICE_UNAVAILABLE", "ERR_TOO_MANY_USERS", "ERR_MASTER_VOCS_UNAVAILABLE", "ERR_INTERNAL_ERROR"],
  1685. s = ["NO_SERVICE_AVAILABLE"],
  1686. c = {
  1687. INJECT_STREAM_STATUS_START_SUCCESS: 0,
  1688. INJECT_STREAM_STATUS_START_ALREADY_EXISTS: 1,
  1689. INJECT_STREAM_STATUS_START_UNAUTHORIZED: 2,
  1690. INJECT_STREAM_STATUS_START_TIMEDOUT: 3,
  1691. INJECT_STREAM_STATUS_START_FAILED: 4,
  1692. INJECT_STREAM_STATUS_STOP_SUCCESS: 5,
  1693. INJECT_STREAM_STATUS_STOP_NOT_FOUND: 6,
  1694. INJECT_STREAM_STATUS_STOP_UNAUTHORIZED: 7,
  1695. INJECT_STREAM_STATUS_STOP_TIMEDOUT: 8,
  1696. INJECT_STREAM_STATUS_STOP_FAILED: 9,
  1697. INJECT_STREAM_STATUS_BROKEN: 10
  1698. };
  1699. t.
  1700. default = {
  1701. FAILED: "FAILED",
  1702. INVALID_KEY: "INVALID_KEY",
  1703. INVALID_CLIENT_MODE: "INVALID_CLIENT_MODE",
  1704. INVALID_CLIENT_CODEC: "INVALID_CLIENT_CODEC",
  1705. CLIENT_MODE_CODEC_MISMATCH: "CLIENT_MODE_CODEC_MISMATCH",
  1706. WEB_API_NOT_SUPPORTED: "WEB_API_NOT_SUPPORTED",
  1707. INVALID_PARAMETER: "INVALID_PARAMETER",
  1708. NO_TRACK_IN_STREAM: "NO_TRACK_IN_STREAM",
  1709. INVALID_OPERATION: "INVALID_OPERATION",
  1710. INVALID_LOCAL_STREAM: "INVALID_LOCAL_STREAM",
  1711. INVALID_REMOTE_STREAM: "INVALID_REMOTE_STREAM",
  1712. INVALID_DYNAMIC_KEY: "INVALID_DYNAMIC_KEY",
  1713. DYNAMIC_KEY_TIMEOUT: "DYNAMIC_KEY_TIMEOUT",
  1714. NO_VOCS_AVAILABLE: "NO_VOCS_AVAILABLE",
  1715. NO_VOS_AVAILABLE: "ERR_NO_VOS_AVAILABLE",
  1716. JOIN_CHANNEL_TIMEOUT: "ERR_JOIN_CHANNEL_TIMEOUT",
  1717. NO_AVAILABLE_CHANNEL: "NO_AVAILABLE_CHANNEL",
  1718. LOOKUP_CHANNEL_TIMEOUT: "LOOKUP_CHANNEL_TIMEOUT",
  1719. LOOKUP_CHANNEL_REJECTED: "LOOKUP_CHANNEL_REJECTED",
  1720. OPEN_CHANNEL_TIMEOUT: "OPEN_CHANNEL_TIMEOUT",
  1721. OPEN_CHANNEL_REJECTED: "OPEN_CHANNEL_REJECTED",
  1722. REQUEST_DEFERRED: "REQUEST_DEFERRED",
  1723. STREAM_ALREADY_PUBLISHED: "STREAM_ALREADY_PUBLISHED",
  1724. STREAM_NOT_YET_PUBLISHED: "STREAM_NOT_YET_PUBLISHED",
  1725. JOIN_TOO_FREQUENT: "JOIN_TOO_FREQUENT",
  1726. SOCKET_ERROR: "SOCKET_ERROR",
  1727. SOCKET_DISCONNECTED: "SOCKET_DISCONNECTED",
  1728. PEERCONNECTION_FAILED: "PEERCONNECTION_FAILED",
  1729. CONNECT_GATEWAY_ERROR: "CONNECT_GATEWAY_ERROR",
  1730. SERVICE_NOT_AVAILABLE: "SERVICE_NOT_AVAILABLE",
  1731. JOIN_CHANNEL_FAILED: "JOIN_CHANNEL_FAILED",
  1732. PUBLISH_STREAM_FAILED: "PUBLISH_STREAM_FAILED",
  1733. UNPUBLISH_STREAM_FAILED: "UNPUBLISH_STREAM_FAILED",
  1734. SUBSCRIBE_STREAM_FAILED: "SUBSCRIBE_STREAM_FAILED",
  1735. UNSUBSCRIBE_STREAM_FAILED: "UNSUBSCRIBE_STREAM_FAILED",
  1736. NO_SUCH_REMOTE_STREAM: "NO_SUCH_REMOTE_STREAM",
  1737. ERR_FAILED: "1",
  1738. ERR_INVALID_VENDOR_KEY: "101",
  1739. ERR_INVALID_CHANNEL_NAME: "102",
  1740. WARN_NO_AVAILABLE_CHANNEL: "103",
  1741. WARN_LOOKUP_CHANNEL_TIMEOUT: "104",
  1742. WARN_LOOKUP_CHANNEL_REJECTED: "105",
  1743. WARN_OPEN_CHANNEL_TIMEOUT: "106",
  1744. WARN_OPEN_CHANNEL_REJECTED: "107",
  1745. WARN_REQUEST_DEFERRED: "108",
  1746. ERR_DYNAMIC_KEY_TIMEOUT: "109",
  1747. ERR_INVALID_DYNAMIC_KEY: "110",
  1748. ERR_NO_VOCS_AVAILABLE: "2000",
  1749. ERR_NO_VOS_AVAILABLE: "2001",
  1750. ERR_JOIN_CHANNEL_TIMEOUT: "2002",
  1751. IOS_NOT_SUPPORT: "IOS_NOT_SUPPORT",
  1752. WECHAT_NOT_SUPPORT: "WECHAT_NOT_SUPPORT",
  1753. SHARING_SCREEN_NOT_SUPPORT: "SHARING_SCREEN_NOT_SUPPORT",
  1754. STILL_ON_PUBLISHING: "STILL_ON_PUBLISHING",
  1755. LOW_STREAM_ALREADY_PUBLISHED: "LOW_STREAM_ALREADY_PUBLISHED",
  1756. LOW_STREAM_NOT_YET_PUBLISHED: "LOW_STREAM_ALREADY_PUBLISHED",
  1757. HIGH_STREAM_NOT_VIDEO_TRACE: "HIGH_STREAM_NOT_VIDEO_TRACE",
  1758. NOT_FIND_DEVICE_BY_LABEL: "NOT_FIND_DEVICE_BY_LABEL",
  1759. ENABLE_DUALSTREAM_FAILED: "ENABLE_DUALSTREAM_FAILED",
  1760. DISABLE_DUALSTREAM_FAILED: "DISABLE_DUALSTREAM_FAILED",
  1761. PLAYER_NOT_FOUND: "PLAYER_NOT_FOUND",
  1762. ELECTRON_NOT_SUPPORT_SHARING_SCREEN: "ELECTRON_NOT_SUPPORT_SHARING_SCREEN",
  1763. BAD_ENVIRONMENT: "BAD_ENVIRONMENT",
  1764. LOAD_AUDIO_FAILED: "LOAD_AUDIO_FAILED"
  1765. }
  1766. },
  1767. function(e, t, n) {
  1768. "use strict";
  1769. n.d(t, "b", (function() {
  1770. return r
  1771. })),
  1772. n.d(t, "a", (function() {
  1773. return i
  1774. })),
  1775. n.d(t, "c", (function() {
  1776. return o
  1777. }));
  1778. n(0);
  1779. var r = function(e, t, n) {
  1780. if (["End2EndDelay", "TransportDelay", "PacketLossRate", "RecvLevel", "RecvBitrate", "CodecType", "MuteState", "TotalFreezeTime", "TotalPlayDuration", "RecordingLevel", "SendLevel", "SamplingRate", "SendBitrate", "CodecType", "MuteState", "End2EndDelay", "TransportDelay", "PacketLossRate", "RecvBitrate", "RecvResolutionWidth", "RecvResolutionHeight", "RenderResolutionHeight", "RenderResolutionWidth", "RenderFrameRate", "TotalFreezeTime", "TotalPlayDuration", "TargetSendBitrate", "SendFrameRate", "SendFrameRate", "SendBitrate", "SendResolutionWidth", "SendResolutionHeight", "CaptureResolutionHeight", "CaptureResolutionWidth", "EncodeDelay", "MuteState", "TotalFreezeTime", "TotalDuration", "CaptureFrameRate", "RTT", "OutgoingAvailableBandwidth", "Duration", "UserCount", "SendBytes", "RecvBytes", "SendBitrate", "RecvBitrate", "accessDelay", "audioSendBytes", "audioSendPackets", "videoSendBytes", "videoSendPackets", "videoSendPacketsLost", "videoSendFrameRate", "audioSendPacketsLost", "videoSendResolutionWidth", "videoSendResolutionHeight", "accessDelay", "audioReceiveBytes", "audioReceivePackets", "audioReceivePacketsLost", "videoReceiveBytes", "videoReceivePackets", "videoReceivePacketsLost", "videoReceiveFrameRate", "videoReceiveDecodeFrameRate", "videoReceiveResolutionWidth", "videoReceiveResolutionHeight", "endToEndDelay", "videoReceiveDelay", "audioReceiveDelay", "FirstFrameTime", "VideoFreezeRate", "AudioFreezeRate", "RenderResolutionWidth", "RenderResolutionHeight", "VideoPublishDuration", "AudioPublishDuration"].indexOf(t) > -1 && ("string" == typeof n || isFinite(n))) return e[t] = "" + n
  1781. },
  1782. i = function(e) {
  1783. var t = {};
  1784. return e.forEach((function(e) {
  1785. e.id && e.type && ( - 1 === e.id.indexOf("send") && -1 === e.type.toLowerCase().indexOf("outbound") && -1 === e.id.indexOf("outbound_rtp") && -1 === e.id.indexOf("OutboundRTP") || ("audio" === e.mediaType ? (r(t, "audioSendBytes", e.bytesSent), r(t, "audioSendPackets", e.packetsSent), r(t, "audioSendPacketsLost", e.packetsLost)) : (r(t, "videoSendBytes", e.bytesSent), r(t, "videoSendPackets", e.packetsSent), r(t, "videoSendPacketsLost", e.packetsLost), r(t, "videoSendFrameRate", e.googFrameRateSent), r(t, "videoSendResolutionWidth", e.googFrameWidthSent), r(t, "videoSendResolutionHeight", e.googFrameHeightSent))))
  1786. })),
  1787. t
  1788. },
  1789. o = function(e) {
  1790. var t = {};
  1791. return e.forEach((function(e) {
  1792. e.id && e.type && ( - 1 === e.id.indexOf("recv") && -1 === e.type.toLowerCase().indexOf("inbound") && -1 === e.id.indexOf("inbound_rtp") && -1 === e.id.indexOf("inbound-rtp") && -1 === e.id.indexOf("InboundRTP") || ("audio" === e.mediaType ? (r(t, "audioReceiveBytes", e.bytesReceived), r(t, "audioReceivePackets", e.packetsReceived), r(t, "audioReceivePacketsLost", e.packetsLost)) : (r(t, "videoReceiveBytes", e.bytesReceived), r(t, "videoReceivePacketsLost", e.packetsLost), r(t, "videoReceivePackets", e.packetsReceived), r(t, "videoReceiveFrameRate", e.googFrameRateReceived), r(t, "videoReceiveDecodeFrameRate", e.googFrameRateDecoded), r(t, "videoReceiveResolutionWidth", e.googFrameWidthReceived), r(t, "videoReceiveResolutionHeight", e.googFrameHeightReceived))))
  1793. })),
  1794. t
  1795. }
  1796. },
  1797. function(e, t) {
  1798. function n() {
  1799. return e.exports = n = Object.assign ||
  1800. function(e) {
  1801. for (var t = 1; t < arguments.length; t++) {
  1802. var n = arguments[t];
  1803. for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r])
  1804. }
  1805. return e
  1806. },
  1807. n.apply(this, arguments)
  1808. }
  1809. e.exports = n
  1810. },
  1811. function(e, t, n) {
  1812. "use strict";
  1813. n.d(t, "b", (function() {
  1814. return i
  1815. })),
  1816. n.d(t, "e", (function() {
  1817. return a
  1818. })),
  1819. n.d(t, "a", (function() {
  1820. return s
  1821. })),
  1822. n.d(t, "d", (function() {
  1823. return c
  1824. })),
  1825. n.d(t, "c", (function() {
  1826. return d
  1827. }));
  1828. var r = n(0),
  1829. i = function() {
  1830. var e = {
  1831. dispatcher: {}
  1832. };
  1833. return e.dispatcher.eventListeners = {},
  1834. e.addEventListener = function(t, n) {
  1835. void 0 === e.dispatcher.eventListeners[t] && (e.dispatcher.eventListeners[t] = []),
  1836. e.dispatcher.eventListeners[t].push(n)
  1837. },
  1838. e.hasListeners = function(t) {
  1839. return ! (!e.dispatcher.eventListeners[t] || !e.dispatcher.eventListeners[t].length)
  1840. },
  1841. e.on = e.addEventListener,
  1842. e.removeEventListener = function(t, n) {
  1843. var r;
  1844. e.dispatcher.eventListeners[t] && -1 !== (r = e.dispatcher.eventListeners[t].indexOf(n)) && e.dispatcher.eventListeners[t].splice(r, 1)
  1845. },
  1846. e.dispatchEvent = function(t) {
  1847. var n;
  1848. for (n in e.dispatcher.eventListeners[t.type]) if (e.dispatcher.eventListeners[t.type] && e.dispatcher.eventListeners[t.type].hasOwnProperty(n) && "function" == typeof e.dispatcher.eventListeners[t.type][n]) try {
  1849. e.dispatcher.eventListeners[t.type][n](t)
  1850. } catch(n) {
  1851. r.
  1852. default.debug("[".concat(e.clientId, "] Error in ").concat(t.type, " event"), n)
  1853. }
  1854. },
  1855. e.dispatchSocketEvent = function(t) {
  1856. var n;
  1857. for (n in e.dispatcher.eventListeners[t.type]) e.dispatcher.eventListeners[t.type] && e.dispatcher.eventListeners[t.type].hasOwnProperty(n) && "function" == typeof e.dispatcher.eventListeners[t.type][n] && e.dispatcher.eventListeners[t.type][n](t.msg)
  1858. },
  1859. e
  1860. },
  1861. o = function(e) {
  1862. var t = {};
  1863. return t.type = e.type,
  1864. t
  1865. },
  1866. a = function(e) {
  1867. var t = o(e);
  1868. return t.stream = e.stream,
  1869. t.reason = e.reason,
  1870. t.msg = e.msg,
  1871. t
  1872. },
  1873. s = function(e) {
  1874. var t = o(e);
  1875. return t.uid = e.uid,
  1876. t.attr = e.attr,
  1877. t.stream = e.stream,
  1878. t
  1879. },
  1880. c = function(e) {
  1881. var t = o(e);
  1882. return t.msg = e.msg,
  1883. t
  1884. },
  1885. d = function(e) {
  1886. var t = o(e);
  1887. return t.url = e.url,
  1888. t.uid = e.uid,
  1889. t.status = e.status,
  1890. t.reason = e.reason,
  1891. t
  1892. }
  1893. },
  1894. function(e, t, n) {
  1895. "use strict";
  1896. var r, i = this && this.__extends || (r = function(e, t) {
  1897. return (r = Object.setPrototypeOf || {
  1898. __proto__: []
  1899. }
  1900. instanceof Array &&
  1901. function(e, t) {
  1902. e.__proto__ = t
  1903. } ||
  1904. function(e, t) {
  1905. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n])
  1906. })(e, t)
  1907. },
  1908. function(e, t) {
  1909. function n() {
  1910. this.constructor = e
  1911. }
  1912. r(e, t),
  1913. e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
  1914. }),
  1915. o = this && this.__awaiter ||
  1916. function(e, t, n, r) {
  1917. return new(n || (n = Promise))((function(i, o) {
  1918. function a(e) {
  1919. try {
  1920. c(r.next(e))
  1921. } catch(e) {
  1922. o(e)
  1923. }
  1924. }
  1925. function s(e) {
  1926. try {
  1927. c(r.
  1928. throw (e))
  1929. } catch(e) {
  1930. o(e)
  1931. }
  1932. }
  1933. function c(e) {
  1934. var t;
  1935. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  1936. e(t)
  1937. }))).then(a, s)
  1938. }
  1939. c((r = r.apply(e, t || [])).next())
  1940. }))
  1941. },
  1942. a = this && this.__generator ||
  1943. function(e, t) {
  1944. var n, r, i, o, a = {
  1945. label: 0,
  1946. sent: function() {
  1947. if (1 & i[0]) throw i[1];
  1948. return i[1]
  1949. },
  1950. trys: [],
  1951. ops: []
  1952. };
  1953. return o = {
  1954. next: s(0),
  1955. throw: s(1),
  1956. return: s(2)
  1957. },
  1958. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  1959. return this
  1960. }),
  1961. o;
  1962. function s(o) {
  1963. return function(s) {
  1964. return function(o) {
  1965. if (n) throw new TypeError("Generator is already executing.");
  1966. for (; a;) try {
  1967. if (n = 1, r && (i = 2 & o[0] ? r.
  1968. return: o[0] ? r.
  1969. throw || ((i = r.
  1970. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  1971. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  1972. case 0:
  1973. case 1:
  1974. i = o;
  1975. break;
  1976. case 4:
  1977. return a.label++,
  1978. {
  1979. value: o[1],
  1980. done: !1
  1981. };
  1982. case 5:
  1983. a.label++,
  1984. r = o[1],
  1985. o = [0];
  1986. continue;
  1987. case 7:
  1988. o = a.ops.pop(),
  1989. a.trys.pop();
  1990. continue;
  1991. default:
  1992. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  1993. a = 0;
  1994. continue
  1995. }
  1996. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  1997. a.label = o[1];
  1998. break
  1999. }
  2000. if (6 === o[0] && a.label < i[1]) {
  2001. a.label = i[1],
  2002. i = o;
  2003. break
  2004. }
  2005. if (i && a.label < i[2]) {
  2006. a.label = i[2],
  2007. a.ops.push(o);
  2008. break
  2009. }
  2010. i[2] && a.ops.pop(),
  2011. a.trys.pop();
  2012. continue
  2013. }
  2014. o = t.call(e, a)
  2015. } catch(e) {
  2016. o = [6, e],
  2017. r = 0
  2018. } finally {
  2019. n = i = 0
  2020. }
  2021. if (5 & o[0]) throw o[1];
  2022. return {
  2023. value: o[0] ? o[1] : void 0,
  2024. done: !0
  2025. }
  2026. } ([o, s])
  2027. }
  2028. }
  2029. },
  2030. s = this && this.__importDefault ||
  2031. function(e) {
  2032. return e && e.__esModule ? e: {
  2033. default:
  2034. e
  2035. }
  2036. };
  2037. Object.defineProperty(t, "__esModule", {
  2038. value: !0
  2039. });
  2040. var c = s(n(67)),
  2041. d = n(3),
  2042. u = s(n(0)),
  2043. l = n(2),
  2044. p = n(14),
  2045. f = n(10),
  2046. g = function(e) {
  2047. function t(t, n) {
  2048. var r = e.call(this) || this;
  2049. return r._state = _.RELAY_STATE_IDLE,
  2050. r._onStatus = function(e) {
  2051. u.
  2052. default.debug("[" + r.clientId + "] ChannelMediaStatus: " + JSON.stringify(e)),
  2053. e && e.command && ("onAudioPacketReceived" === e.command && r.emit("event", E.PACKET_RECEIVED_AUDIO_FROM_SRC), "onVideoPacketReceived" === e.command && r.emit("event", E.PACKET_RECEIVED_VIDEO_FROM_SRC), "onSrcTokenPrivilegeDidExpire" === e.command && (r._state = _.RELAY_STATE_FAILURE, r.emit("state", _.RELAY_STATE_FAILURE, S.SRC_TOKEN_EXPIRED)), "onDestTokenPrivilegeDidExpire" === e.command && (r._state = _.RELAY_STATE_FAILURE, r.emit("state", _.RELAY_STATE_FAILURE, S.DEST_TOKEN_EXPIRED, e.channelName ? {
  2054. came: e.channelName
  2055. }: null)))
  2056. },
  2057. r._onClose = function() {
  2058. return o(r, void 0, void 0, (function() {
  2059. var e;
  2060. return a(this, (function(t) {
  2061. switch (t.label) {
  2062. case 0:
  2063. if (u.
  2064. default.debug("[" + this.clientId + "] ChannelMediaSocket onClose"), this.emit("event", E.NETWORK_DISCONNECTED), this.state = _.RELAY_STATE_IDLE, !this._prevChannelMediaConfig) return [3, 4];
  2065. t.label = 1;
  2066. case 1:
  2067. return t.trys.push([1, 3, , 4]),
  2068. [4, this.startChannelMediaRelay(this._prevChannelMediaConfig)];
  2069. case 2:
  2070. return t.sent(),
  2071. [3, 4];
  2072. case 3:
  2073. return (e = t.sent()) instanceof R && (e.message === h.WS_ABORT || e.message === h.AP_REQUEST_ABORT) ? [2] : (this.emit("state", _.RELAY_STATE_FAILURE, S.SERVER_CONNECTION_LOST), [3, 4]);
  2074. case 4:
  2075. return [2]
  2076. }
  2077. }))
  2078. }))
  2079. },
  2080. r.token = t.appId,
  2081. r.appId = t.appId,
  2082. r.cname = t.cname,
  2083. r.uid = t.uid,
  2084. r.sid = t.sid,
  2085. r.clientId = n,
  2086. r
  2087. }
  2088. return i(t, e),
  2089. Object.defineProperty(t.prototype, "state", {
  2090. get: function() {
  2091. return this._state
  2092. },
  2093. set: function(e) {
  2094. var t = this._state;
  2095. this._state = e,
  2096. t !== e && this.emit("state", e)
  2097. },
  2098. enumerable: !0,
  2099. configurable: !0
  2100. }),
  2101. t.prototype.startChannelMediaRelay = function(e) {
  2102. return o(this, void 0, void 0, (function() {
  2103. return a(this, (function(t) {
  2104. switch (t.label) {
  2105. case 0:
  2106. if (this.state !== _.RELAY_STATE_IDLE) throw new R(h.BAD_STATE);
  2107. return this.state = _.RELAY_STATE_CONNECTING,
  2108. [4, this._connect()];
  2109. case 1:
  2110. return t.sent(),
  2111. u.
  2112. default.debug("[" + this.clientId + "] startChannelMediaRelay: connect success"),
  2113. [4, this._sendStartRelayMessage(e)];
  2114. case 2:
  2115. return t.sent(),
  2116. this._prevChannelMediaConfig = e,
  2117. [2]
  2118. }
  2119. }))
  2120. }))
  2121. },
  2122. t.prototype.updateChannelMediaRelay = function(e) {
  2123. return o(this, void 0, void 0, (function() {
  2124. return a(this, (function(t) {
  2125. switch (t.label) {
  2126. case 0:
  2127. if (this.state !== _.RELAY_STATE_RUNNING) throw new R(h.BAD_STATE);
  2128. return [4, this._sendUpdateMessage(e)];
  2129. case 1:
  2130. return t.sent(),
  2131. this._prevChannelMediaConfig = e,
  2132. [2]
  2133. }
  2134. }))
  2135. }))
  2136. },
  2137. t.prototype.stopChannelMediaRelay = function() {
  2138. return o(this, void 0, void 0, (function() {
  2139. return a(this, (function(e) {
  2140. switch (e.label) {
  2141. case 0:
  2142. return [4, this._sendStopRelayMessage()];
  2143. case 1:
  2144. return e.sent(),
  2145. u.
  2146. default.debug("[" + this.clientId + "] stopChannelMediaRelay: send stop message success"),
  2147. this.state = _.RELAY_STATE_IDLE,
  2148. this.dispose(),
  2149. [2]
  2150. }
  2151. }))
  2152. }))
  2153. },
  2154. t.prototype.dispose = function() {
  2155. u.
  2156. default.debug("[" + this.clientId + "] disposeChannelMediaRelay"),
  2157. this.state = _.RELAY_STATE_IDLE,
  2158. this.emit("dispose"),
  2159. this._signal && this._signal.dispose(),
  2160. this._prevChannelMediaConfig = null,
  2161. this.removeEvent()
  2162. },
  2163. t.prototype._requestOneAP = function(e) {
  2164. var t = this;
  2165. return new Promise((function(n, r) {
  2166. var i = {
  2167. command: "convergeAllocateEdge",
  2168. sid: t.sid,
  2169. appId: t.appId,
  2170. token: "",
  2171. ts: +new Date,
  2172. version: d.VERSION,
  2173. cname: t.cname,
  2174. uid: t.uid + "",
  2175. seq: 1,
  2176. requestId: 1
  2177. },
  2178. o = {
  2179. service_name: "tele_channel",
  2180. json_body: JSON.stringify(i)
  2181. },
  2182. a = "https://" + e;
  2183. p.post(a, o, (function(e) {
  2184. var t = null,
  2185. i = null;
  2186. try {
  2187. t = JSON.parse(e)
  2188. } catch(e) {
  2189. r(new R(h.AP_JSON_PARSE_ERROR, e))
  2190. }
  2191. 0 !== t.code && r(new R(h.AP_REQUEST_ERROR, t));
  2192. try {
  2193. i = JSON.parse(t.json_body)
  2194. } catch(e) {
  2195. r(new R(h.AP_JSON_PARSE_ERROR, e))
  2196. }
  2197. 200 !== i.code && r(new R(h.AP_REQUEST_ERROR, i)),
  2198. i.servers ? n(i.servers) : r(new R(h.AP_JSON_PARSE_ERROR, i))
  2199. }), (function(e) {
  2200. return r(e)
  2201. }), {
  2202. "X-Packet-Service-Type": 0,
  2203. "X-Packet-URI": 61
  2204. })
  2205. }))
  2206. },
  2207. t.prototype._requestAP = function() {
  2208. var e = this,
  2209. t = d.getParameter("UAP_AP");
  2210. return new Promise((function(n, r) {
  2211. setTimeout((function() {
  2212. r(new R(h.AP_REQUEST_TIMEOUT))
  2213. }), 5e3),
  2214. e.on("dispose", (function() {
  2215. r(new R(h.AP_REQUEST_ABORT))
  2216. })),
  2217. t.forEach((function(t) {
  2218. t += "/api/v1",
  2219. e._requestOneAP(t).then((function(r) {
  2220. u.
  2221. default.debug("[" + e.clientId + "] startChannelMediaRelay request AP " + t + " success: " + JSON.stringify(r));
  2222. var i = r[0],
  2223. o = "wss://" + i.address.replace(/\./g, "-") + ".edge.agora.io:" + i.wss;
  2224. n(o)
  2225. })).
  2226. catch((function(n) {
  2227. u.
  2228. default.debug("[" + e.clientId + "] startChannelMediaRelay request AP " + t + " failed: " + JSON.stringify(n))
  2229. }))
  2230. }))
  2231. }))
  2232. },
  2233. t.prototype._connectWebsocket = function(e) {
  2234. return this._signal = new y(this.appId, this.cname, this.uid, this.sid),
  2235. this._signal.connect(e)
  2236. },
  2237. t.prototype._connect = function() {
  2238. return o(this, void 0, void 0, (function() {
  2239. var e;
  2240. return a(this, (function(t) {
  2241. switch (t.label) {
  2242. case 0:
  2243. return [4, this._requestAP()];
  2244. case 1:
  2245. return e = t.sent(),
  2246. [4, this._connectWebsocket(e)];
  2247. case 2:
  2248. return t.sent(),
  2249. this._signal.on("close", this._onClose.bind(this)),
  2250. this._signal.on("status", this._onStatus.bind(this)),
  2251. this.emit("event", E.NETWORK_CONNECTED),
  2252. [2]
  2253. }
  2254. }))
  2255. }))
  2256. },
  2257. t.prototype._sendStartRelayMessage = function(e) {
  2258. return o(this, void 0, void 0, (function() {
  2259. var t, n, r, i, o, s;
  2260. return a(this, (function(a) {
  2261. switch (a.label) {
  2262. case 0:
  2263. return this._checkSignal(),
  2264. t = this._genMessage(v.StopPacketTransfer),
  2265. [4, this._signal.request(t)];
  2266. case 1:
  2267. return a.sent(),
  2268. [4, this._signal.waitStatus("Normal Quit")];
  2269. case 2:
  2270. return a.sent(),
  2271. u.
  2272. default.debug("[" + this.clientId + "] startChannelMediaRelay: StopPacketTransfer success"),
  2273. n = this._genMessage(v.SetSdkProfile, e),
  2274. [4, this._signal.request(n)];
  2275. case 3:
  2276. return a.sent(),
  2277. u.
  2278. default.debug("[" + this.clientId + "] startChannelMediaRelay: SetSdkProfile success"),
  2279. r = this._genMessage(v.SetSourceChannel, e),
  2280. [4, this._signal.request(r)];
  2281. case 4:
  2282. return a.sent(),
  2283. [4, this._signal.waitStatus("SetSourceChannelStatus")];
  2284. case 5:
  2285. return a.sent(),
  2286. this.emit("event", E.PACKET_JOINED_SRC_CHANNEL),
  2287. u.
  2288. default.debug("[" + this.clientId + "] startChannelMediaRelay: SetSourceChannel success"),
  2289. i = this._genMessage(v.SetSourceUserId, e),
  2290. [4, this._signal.request(i)];
  2291. case 6:
  2292. return a.sent(),
  2293. u.
  2294. default.debug("[" + this.clientId + "] startChannelMediaRelay: SetSourceUserId success"),
  2295. o = this._genMessage(v.SetDestChannel, e),
  2296. [4, this._signal.request(o)];
  2297. case 7:
  2298. return a.sent(),
  2299. [4, this._signal.waitStatus("SetDestChannelStatus")];
  2300. case 8:
  2301. return a.sent(),
  2302. this.emit("event", E.PACKET_JOINED_DEST_CHANNEL),
  2303. u.
  2304. default.debug("[" + this.clientId + "] startChannelMediaRelay: SetDestChannel success"),
  2305. s = this._genMessage(v.StartPacketTransfer, e),
  2306. [4, this._signal.request(s)];
  2307. case 9:
  2308. return a.sent(),
  2309. this.emit("event", E.PACKET_SENT_TO_DEST_CHANNEL),
  2310. this.state = _.RELAY_STATE_RUNNING,
  2311. u.
  2312. default.debug("[" + this.clientId + "] startChannelMediaRelay: StartPacketTransfer success"),
  2313. [2]
  2314. }
  2315. }))
  2316. }))
  2317. },
  2318. t.prototype._sendReconnectMessage = function(e) {
  2319. return o(this, void 0, void 0, (function() {
  2320. var t;
  2321. return a(this, (function(n) {
  2322. switch (n.label) {
  2323. case 0:
  2324. return this._checkSignal(),
  2325. t = this._genMessage(v.Reconnect, e),
  2326. [4, this._signal.request(t)];
  2327. case 1:
  2328. return n.sent(),
  2329. [2]
  2330. }
  2331. }))
  2332. }))
  2333. },
  2334. t.prototype._sendUpdateMessage = function(e) {
  2335. return o(this, void 0, void 0, (function() {
  2336. var t;
  2337. return a(this, (function(n) {
  2338. switch (n.label) {
  2339. case 0:
  2340. return this._checkSignal(),
  2341. t = this._genMessage(v.UpdateDestChannel, e),
  2342. [4, this._signal.request(t)];
  2343. case 1:
  2344. return n.sent(),
  2345. this.emit("event", E.PACKET_UPDATE_DEST_CHANNEL),
  2346. u.
  2347. default.debug("[" + this.clientId + "] sendUpdateMessage: UpdateDestChannel success"),
  2348. [2]
  2349. }
  2350. }))
  2351. }))
  2352. },
  2353. t.prototype._sendStopRelayMessage = function() {
  2354. return o(this, void 0, void 0, (function() {
  2355. var e;
  2356. return a(this, (function(t) {
  2357. switch (t.label) {
  2358. case 0:
  2359. return this._checkSignal(),
  2360. e = this._genMessage(v.StopPacketTransfer),
  2361. [4, this._signal.request(e)];
  2362. case 1:
  2363. return t.sent(),
  2364. u.
  2365. default.debug("[" + this.clientId + "] sendStopRelayMessage: StopPacketTransfer success"),
  2366. [2]
  2367. }
  2368. }))
  2369. }))
  2370. },
  2371. t.prototype._genMessage = function(e, t) {
  2372. var n = this,
  2373. r = [],
  2374. i = [],
  2375. o = [],
  2376. a = {
  2377. appId: this.appId,
  2378. cname: this.cname,
  2379. uid: this.uid + "",
  2380. sdkVersion: d.VERSION,
  2381. sid: this.sid,
  2382. ts: +new Date,
  2383. requestId: 0,
  2384. seq: 0,
  2385. allocate: !0,
  2386. clientRequest: {}
  2387. },
  2388. s = null;
  2389. switch (e) {
  2390. case v.SetSdkProfile:
  2391. return a.clientRequest = {
  2392. command: "SetSdkProfile",
  2393. type: "multi_channel"
  2394. },
  2395. a;
  2396. case v.SetSourceChannel:
  2397. return s = t.getSrcChannelMediaInfo(),
  2398. a.clientRequest = {
  2399. command: "SetSourceChannel",
  2400. uid: s.uid + "",
  2401. channelName: s.channelName,
  2402. token: s.token || this.appId
  2403. },
  2404. a;
  2405. case v.SetSourceUserId:
  2406. return s = t.getSrcChannelMediaInfo(),
  2407. a.clientRequest = {
  2408. command: "SetSourceUserId",
  2409. uid: this.uid + ""
  2410. },
  2411. a;
  2412. case v.SetDestChannel:
  2413. return t.getDestChannelMediaInfos().forEach((function(e) {
  2414. r.push(e.channelName),
  2415. i.push(e.uid + ""),
  2416. o.push(e.token || n.appId)
  2417. })),
  2418. a.clientRequest = {
  2419. command: "SetDestChannel",
  2420. channelName: r,
  2421. uid: i,
  2422. token: o
  2423. },
  2424. a;
  2425. case v.StartPacketTransfer:
  2426. return a.clientRequest = {
  2427. command: "StartPacketTransfer"
  2428. },
  2429. a;
  2430. case v.Reconnect:
  2431. return a.clientRequest = {
  2432. command: "Reconnect"
  2433. },
  2434. a;
  2435. case v.StopPacketTransfer:
  2436. return a.clientRequest = {
  2437. command: "StopPacketTransfer"
  2438. },
  2439. a;
  2440. case v.UpdateDestChannel:
  2441. return t.getDestChannelMediaInfos().forEach((function(e) {
  2442. r.push(e.channelName),
  2443. i.push(e.uid + ""),
  2444. o.push(e.token || n.appId)
  2445. })),
  2446. a.clientRequest = {
  2447. command: "UpdateDestChannel",
  2448. channelName: r,
  2449. uid: i,
  2450. token: o
  2451. },
  2452. a
  2453. }
  2454. },
  2455. t.prototype._checkSignal = function() {
  2456. if (!this._signal || !this._signal.isConnect()) throw new R(h.WS_DISCONNECTED)
  2457. },
  2458. t
  2459. } (c.
  2460. default);
  2461. t.
  2462. default = g;
  2463. var m = function() {
  2464. function e() {
  2465. this.destChannelMediaInfos = new Map
  2466. }
  2467. return e.prototype.setSrcChannelInfo = function(e) {
  2468. l.checkValidObject(e, "srcInfo");
  2469. var t = e.uid,
  2470. n = e.channelName,
  2471. r = e.token;
  2472. if (r && !l.isValidToken(r)) throw new Error("Invalid token in SrcChannelInfo");
  2473. if (!l.isValidChannelName(n)) throw new Error("Invalid channelName in SrcChannelInfo");
  2474. if (!f.is32Uint(t)) throw new Error("Invalid uid in SrcChannelInfo");
  2475. this.srcChannelMediaInfo = e
  2476. },
  2477. e.prototype.setDestChannelInfo = function(e, t) {
  2478. if (!l.isValidChannelName(e)) throw new Error("Invalid channelName in DestChannelInfo");
  2479. l.checkValidObject(t, "destInfo");
  2480. var n = t.uid,
  2481. r = t.token,
  2482. i = t.channelName;
  2483. if (r && !l.isValidToken(r)) throw new Error("Invalid token in DestChannelInfo");
  2484. if (!l.isValidChannelName(i)) throw new Error("Invalid channelName in DestChannelInfo");
  2485. if (!f.is32Uint(n)) throw new Error("Invalid uid in DestChannelInfo");
  2486. this.destChannelMediaInfos.set(e, t)
  2487. },
  2488. e.prototype.removeDestChannelInfo = function(e) {
  2489. if (!l.isValidChannelName(e)) throw new Error("Invalid channelName when invoke removeDestChannelInfo");
  2490. this.destChannelMediaInfos.delete(e)
  2491. },
  2492. e.prototype.getSrcChannelMediaInfo = function() {
  2493. return this.srcChannelMediaInfo
  2494. },
  2495. e.prototype.getDestChannelMediaInfos = function() {
  2496. return this.destChannelMediaInfos
  2497. },
  2498. e
  2499. } ();
  2500. t.ChannelMediaRelayConfiguration = m;
  2501. var h, v, E, _, S, y = function(e) {
  2502. function t(t, n, r, i) {
  2503. var o = e.call(this) || this;
  2504. return o._onOpen = function() {
  2505. o.emit("open")
  2506. },
  2507. o._onClose = function(e) {
  2508. o.emit("close"),
  2509. o.dispose()
  2510. },
  2511. o._onMessage = function(e) {
  2512. var t = JSON.parse(e.data);
  2513. if (!t || "serverResponse" !== t.command || !t.requestId) return t && "serverStatus" === t.command && t.serverStatus && t.serverStatus.command ? (o.emit("status", t.serverStatus), void o.emit(t.serverStatus.command, t.serverStatus)) : void 0;
  2514. o.emit("req_" + t.requestId, t)
  2515. },
  2516. o._requestId = 1,
  2517. o.appId = t,
  2518. o.cname = n,
  2519. o.uid = r,
  2520. o.sid = i,
  2521. o
  2522. }
  2523. return i(t, e),
  2524. t.prototype.isConnect = function() {
  2525. return this._ws && this._ws.readyState === WebSocket.OPEN
  2526. },
  2527. t.prototype.sendMessage = function(e) {
  2528. if (!this._ws || this._ws.readyState !== WebSocket.OPEN) throw new R(h.WS_DISCONNECTED);
  2529. var t = this._requestId++;
  2530. return e.requestId = t,
  2531. e.seq = t,
  2532. this._ws.send(JSON.stringify(e)),
  2533. t
  2534. },
  2535. t.prototype.waitStatus = function(e) {
  2536. var t = this;
  2537. return new Promise((function(n, r) {
  2538. var i = window.setTimeout((function() {
  2539. r(new R(h.WAIT_STATUS_TIMEOUT, e))
  2540. }), 5e3);
  2541. t.once(e, (function(t) {
  2542. clearTimeout(i),
  2543. t.state && 0 !== t.state ? r(new R(h.WAIT_STATUS_ERROR, e)) : n()
  2544. })),
  2545. t.once("dispose", (function() {
  2546. clearTimeout(i),
  2547. r(new R(h.WS_ABORT))
  2548. }))
  2549. }))
  2550. },
  2551. t.prototype.request = function(e) {
  2552. var t = this;
  2553. return new Promise((function(n, r) {
  2554. var i = t.sendMessage(e),
  2555. o = window.setTimeout((function() {
  2556. t.removeAllListeners("req_" + i),
  2557. r(new R(h.REQUEST_TIMEOUT))
  2558. }), 3e3);
  2559. t.once("req_" + i, (function(e) {
  2560. clearTimeout(o),
  2561. e && 200 === e.code ? n(e) : r(new R(h.REQUEST_FAILED, e))
  2562. })),
  2563. t.once("dispose", (function() {
  2564. clearTimeout(o),
  2565. r(new R(h.WS_ABORT))
  2566. }))
  2567. }))
  2568. },
  2569. t.prototype.connect = function(e) {
  2570. var t = this;
  2571. return new Promise((function(n, r) {
  2572. t._ws = new WebSocket(e),
  2573. t._ws.onopen = function() {
  2574. t._onOpen(),
  2575. t._prvUrl = e,
  2576. t._ws.onmessage = t._onMessage,
  2577. t._ws.onclose = t._onClose,
  2578. t._startHeartBeatCheck(),
  2579. n()
  2580. },
  2581. t._ws.onclose = function(e) {
  2582. t._ws = null,
  2583. r(new R(h.CONNECT_FAILED, "websocket error code: " + e.code))
  2584. },
  2585. setTimeout((function() {
  2586. t._ws && t._ws.readyState !== WebSocket.OPEN && (t._ws.onopen = null, t._ws.onclose = null, t._ws.close(), t._ws = null, r(new R(h.CONNECT_TIMEOUT)))
  2587. }), 5e3),
  2588. t.once("dispose", (function() {
  2589. r(new R(h.WS_ABORT))
  2590. }))
  2591. }))
  2592. },
  2593. t.prototype.dispose = function() {
  2594. this._clearHeartBeatCheck(),
  2595. this.emit("dispose"),
  2596. this.removeEvent(),
  2597. this._ws && (this._ws.onopen = null, this._ws.onclose = null, this._ws.onmessage = null, this._ws.close()),
  2598. this._ws = null
  2599. },
  2600. t.prototype._sendPing = function(e) {
  2601. if (!this._ws || this._ws.readyState !== WebSocket.OPEN) throw new R(h.WS_DISCONNECTED);
  2602. var t = this._requestId++;
  2603. return e.requestId = t,
  2604. this._ws.send(JSON.stringify(e)),
  2605. t
  2606. },
  2607. t.prototype._startHeartBeatCheck = function() {
  2608. var e = this;
  2609. this._heartBeatTimer = window.setInterval((function() {
  2610. e._sendPing({
  2611. command: "ping",
  2612. appId: e.appId,
  2613. cname: e.cname,
  2614. uid: e.uid + "",
  2615. sid: e.sid,
  2616. ts: +new Date,
  2617. requestId: 0
  2618. })
  2619. }), 3e3)
  2620. },
  2621. t.prototype._clearHeartBeatCheck = function() {
  2622. window.clearInterval(this._heartBeatTimer)
  2623. },
  2624. t
  2625. } (c.
  2626. default),
  2627. R = function(e, t, n) {
  2628. void 0 === e && (e = ""),
  2629. this.code = n,
  2630. this.data = t,
  2631. this.message = e
  2632. };
  2633. t.ChannelMediaError = R,
  2634. function(e) {
  2635. e.CONNECT_FAILED = "connect failed",
  2636. e.CONNECT_TIMEOUT = "connect timeout",
  2637. e.WS_DISCONNECTED = "websocket disconnected",
  2638. e.REQUEST_TIMEOUT = "request timeout",
  2639. e.REQUEST_FAILED = "request failed",
  2640. e.WAIT_STATUS_TIMEOUT = "wait status timeout",
  2641. e.WAIT_STATUS_ERROR = "wait status error",
  2642. e.BAD_STATE = "bad state",
  2643. e.WS_ABORT = "ws abort",
  2644. e.AP_REQUEST_TIMEOUT = "AP request timeout",
  2645. e.AP_JSON_PARSE_ERROR = "AP json parse error",
  2646. e.AP_REQUEST_ERROR = "AP request error",
  2647. e.AP_REQUEST_ABORT = "AP request abort"
  2648. } (h = t.CHANNEL_MEDIA_ERROR || (t.CHANNEL_MEDIA_ERROR = {})),
  2649. function(e) {
  2650. e[e.SetSdkProfile = 0] = "SetSdkProfile",
  2651. e[e.SetSourceChannel = 1] = "SetSourceChannel",
  2652. e[e.SetSourceUserId = 2] = "SetSourceUserId",
  2653. e[e.SetDestChannel = 3] = "SetDestChannel",
  2654. e[e.StartPacketTransfer = 4] = "StartPacketTransfer",
  2655. e[e.StopPacketTransfer = 5] = "StopPacketTransfer",
  2656. e[e.UpdateDestChannel = 6] = "UpdateDestChannel",
  2657. e[e.Reconnect = 7] = "Reconnect",
  2658. e[e.SetVideoProfile = 8] = "SetVideoProfile"
  2659. } (v || (v = {})),
  2660. function(e) {
  2661. e[e.NETWORK_DISCONNECTED = 0] = "NETWORK_DISCONNECTED",
  2662. e[e.NETWORK_CONNECTED = 1] = "NETWORK_CONNECTED",
  2663. e[e.PACKET_JOINED_SRC_CHANNEL = 2] = "PACKET_JOINED_SRC_CHANNEL",
  2664. e[e.PACKET_JOINED_DEST_CHANNEL = 3] = "PACKET_JOINED_DEST_CHANNEL",
  2665. e[e.PACKET_SENT_TO_DEST_CHANNEL = 4] = "PACKET_SENT_TO_DEST_CHANNEL",
  2666. e[e.PACKET_RECEIVED_VIDEO_FROM_SRC = 5] = "PACKET_RECEIVED_VIDEO_FROM_SRC",
  2667. e[e.PACKET_RECEIVED_AUDIO_FROM_SRC = 6] = "PACKET_RECEIVED_AUDIO_FROM_SRC",
  2668. e[e.PACKET_UPDATE_DEST_CHANNEL = 7] = "PACKET_UPDATE_DEST_CHANNEL",
  2669. e[e.PACKET_UPDATE_DEST_CHANNEL_REFUSED = 8] = "PACKET_UPDATE_DEST_CHANNEL_REFUSED",
  2670. e[e.PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = 9] = "PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE"
  2671. } (E = t.CHANNEL_MEDIA_RELAY_EVENT || (t.CHANNEL_MEDIA_RELAY_EVENT = {})),
  2672. function(e) {
  2673. e[e.RELAY_STATE_IDLE = 0] = "RELAY_STATE_IDLE",
  2674. e[e.RELAY_STATE_CONNECTING = 1] = "RELAY_STATE_CONNECTING",
  2675. e[e.RELAY_STATE_RUNNING = 2] = "RELAY_STATE_RUNNING",
  2676. e[e.RELAY_STATE_FAILURE = 3] = "RELAY_STATE_FAILURE"
  2677. } (_ = t.CHANNEL_MEDIA_RELAY_STATE || (t.CHANNEL_MEDIA_RELAY_STATE = {})),
  2678. function(e) {
  2679. e[e.RELAY_OK = 0] = "RELAY_OK",
  2680. e[e.SERVER_ERROR_RESPONSE = 1] = "SERVER_ERROR_RESPONSE",
  2681. e[e.SERVER_NO_RESPONSE = 2] = "SERVER_NO_RESPONSE",
  2682. e[e.NO_RESOURCE_AVAILABLE = 3] = "NO_RESOURCE_AVAILABLE",
  2683. e[e.FAILED_JOIN_SRC = 4] = "FAILED_JOIN_SRC",
  2684. e[e.FAILED_JOIN_DEST = 5] = "FAILED_JOIN_DEST",
  2685. e[e.FAILED_PACKET_RECEIVED_FROM_SRC = 6] = "FAILED_PACKET_RECEIVED_FROM_SRC",
  2686. e[e.FAILED_PACKET_SENT_TO_DEST = 7] = "FAILED_PACKET_SENT_TO_DEST",
  2687. e[e.SERVER_CONNECTION_LOST = 8] = "SERVER_CONNECTION_LOST",
  2688. e[e.INTERNAL_ERROR = 9] = "INTERNAL_ERROR",
  2689. e[e.SRC_TOKEN_EXPIRED = 10] = "SRC_TOKEN_EXPIRED",
  2690. e[e.DEST_TOKEN_EXPIRED = 11] = "DEST_TOKEN_EXPIRED",
  2691. e[e.RELAY_ALREADY_START = 12] = "RELAY_ALREADY_START",
  2692. e[e.RELAY_NOT_START = 13] = "RELAY_NOT_START",
  2693. e[e.OPERATION_ABORT = 14] = "OPERATION_ABORT"
  2694. } (S = t.CHANNEL_MEDIA_RELAY_ERROR || (t.CHANNEL_MEDIA_RELAY_ERROR = {}))
  2695. },
  2696. function(e, t, n) {
  2697. "use strict";
  2698. n.r(t),
  2699. n.d(t, "isLiveTranscodingValid", (function() {
  2700. return E
  2701. })),
  2702. n.d(t, "generateSessionId", (function() {
  2703. return m
  2704. })),
  2705. n.d(t, "audioLevelHelper", (function() {
  2706. return p
  2707. })),
  2708. n.d(t, "vsResHack", (function() {
  2709. return h
  2710. })),
  2711. n.d(t, "is32Uint", (function() {
  2712. return v
  2713. })),
  2714. n.d(t, "safeCall", (function() {
  2715. return l
  2716. })),
  2717. n.d(t, "random", (function() {
  2718. return S
  2719. })),
  2720. n.d(t, "popBanTip", (function() {
  2721. return T
  2722. })),
  2723. n.d(t, "lengthInUtf8Bytes", (function() {
  2724. return y
  2725. })),
  2726. n.d(t, "audioTimerLoop", (function() {
  2727. return R
  2728. })),
  2729. n.d(t, "generateId", (function() {
  2730. return g
  2731. }));
  2732. var r = n(11),
  2733. i = n.n(r),
  2734. o = n(4),
  2735. a = n(0),
  2736. s = n(27),
  2737. c = n.n(s),
  2738. d = n(24),
  2739. u = n(15),
  2740. l = function() {
  2741. var e = arguments[0];
  2742. if ("function" == typeof e) {
  2743. var t = Array.prototype.slice.call(arguments, 1);
  2744. e.apply(null, t)
  2745. }
  2746. },
  2747. p = function(e) {
  2748. return this.audioContext = Object(d.a)(),
  2749. this.sourceNode = e.otWebkitAudioSource || this.audioContext.createMediaStreamSource(e),
  2750. this.analyser = this.audioContext.createAnalyser(),
  2751. this.timeDomainData = new Uint8Array(this.analyser.frequencyBinCount),
  2752. this.sourceNode.connect(this.analyser),
  2753. this.getAudioLevel = function() {
  2754. if (this.analyser) {
  2755. this.analyser.getByteTimeDomainData(this.timeDomainData);
  2756. for (var e = 0,
  2757. t = 0; t < this.timeDomainData.length; t++) e = Math.max(e, Math.abs(this.timeDomainData[t] - 128));
  2758. return e / 128
  2759. }
  2760. return a.
  2761. default.warning("can't find analyser in audioLevelHelper"),
  2762. 0
  2763. },
  2764. this
  2765. },
  2766. f = 1e4;
  2767. function g() {
  2768. return++f
  2769. }
  2770. function m() {
  2771. return c()().replace(/-/g, "").toUpperCase()
  2772. }
  2773. var h = function(e, t, n) {
  2774. try {
  2775. a.
  2776. default.debug("start vsResHack", e);
  2777. var r = document.createElement("video");
  2778. r.setAttribute("autoplay", ""),
  2779. r.setAttribute("muted", ""),
  2780. r.muted = !0,
  2781. r.setAttribute("playsinline", ""),
  2782. r.setAttribute("style", "position: absolute; top: 0; left: 0; width:1px; high:1px;"),
  2783. document.body.appendChild(r),
  2784. r.addEventListener("playing", (function(n) {
  2785. o.isFireFox() ? r.videoWidth && (a.
  2786. default.debug("[vsResHack] get stream resolution: ", "".concat(r.videoWidth, " x ").concat(r.videoHeight), e), t(r.videoWidth, r.videoHeight), document.body.removeChild(r)) : (a.
  2787. default.debug("[vsResHack] get stream resolution: ", "".concat(r.videoWidth, " x ").concat(r.videoHeight), e), t(r.videoWidth, r.videoHeight), document.body.removeChild(r))
  2788. })),
  2789. Object(u.setSrcObject)(r, e)
  2790. } catch(e) {
  2791. n(e)
  2792. }
  2793. },
  2794. v = function(e) {
  2795. return "number" == typeof e && 0 <= e && e <= 4294967295
  2796. },
  2797. E = function(e) {
  2798. var t = ["lowLatency", "userConfigExtraInfo", "transcodingUsers"];
  2799. for (var n in e) if ("lowLatency" === n && "boolean" != typeof e[n] || "userConfigExtraInfo" === n && "object" !== i()(e[n]) || "transcodingUsers" === n && !_(e[n]) || !~t.indexOf(n) && "number" != typeof e[n]) throw new Error("Param [" + n + "] is inValid");
  2800. return ! 0
  2801. },
  2802. _ = function(e) {
  2803. for (var t = 0; t < e.length; t++) for (var n in e[t]) if ("number" != typeof e[t][n]) throw new Error("Param user[" + t + "] - [" + n + "] is inValid");
  2804. return ! 0
  2805. },
  2806. S = function(e) {
  2807. isNaN(e) && (e = 1e3);
  2808. var t = +new Date,
  2809. n = (t = (9301 * t + 49297) % 233280) / 233280;
  2810. return Math.ceil(n * e)
  2811. },
  2812. y = function(e) {
  2813. var t = encodeURIComponent(e).match(/%[89ABab]/g);
  2814. return e.length + (t ? t.length: 0)
  2815. },
  2816. R = function(e, t) {
  2817. var n = 1 / t,
  2818. r = Object(d.a)(),
  2819. i = r.createGain();
  2820. i.gain.value = 0,
  2821. i.connect(r.destination);
  2822. var o = !1;
  2823. return function t() {
  2824. var a = r.createOscillator();
  2825. a.onended = t,
  2826. a.connect(i),
  2827. a.start(0),
  2828. a.stop(r.currentTime + n),
  2829. e(r.currentTime),
  2830. o && (a.onended = function() {})
  2831. } (),
  2832. function() {
  2833. o = !0
  2834. }
  2835. },
  2836. T = function() {
  2837. if (!document.getElementById("agora-ban-tip")) {
  2838. var e = document.createElement("div");
  2839. e.id = "agora-ban-tip",
  2840. e.style = "position: absolute; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; color: #fff;",
  2841. document.querySelector("body").prepend(e);
  2842. var t = document.createElement("div");
  2843. t.style = "background: #000; width: 346px; height: 116px; z-index: 100000; opacity: 0.6; border-radius: 10px; box-shadow: 0 2px 4px #000;",
  2844. e.append(t);
  2845. var n = document.createElement("div");
  2846. n.style = "height: 76px; display: flex; justify-content: center; align-items: center;";
  2847. var r = document.createElement("span");
  2848. r.style = "height: 28px; width: 28px; color: #000; text-align: center; line-height: 30px; background: #fff; border-radius: 50%; font-weight: 600; font-size: 20px;margin-right: 5px;",
  2849. r.innerText = "!";
  2850. var i = document.createElement("span");
  2851. i.innerText = "This browser does not support webRTC",
  2852. n.append(r),
  2853. n.append(i);
  2854. var o = document.createElement("div");
  2855. o.style = "height: 38px; display: flex; border-top: #fff 1px solid; justify-content: center; align-items: center;",
  2856. o.innerText = "OK",
  2857. t.append(n),
  2858. t.append(o),
  2859. o.onclick = function() {
  2860. var e = document.getElementById("agora-ban-tip");
  2861. e.parentNode.removeChild(e)
  2862. }
  2863. }
  2864. }
  2865. },
  2866. function(e, t) {
  2867. function n(t) {
  2868. return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? e.exports = n = function(e) {
  2869. return typeof e
  2870. }: e.exports = n = function(e) {
  2871. return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
  2872. },
  2873. n(t)
  2874. }
  2875. e.exports = n
  2876. },
  2877. function(t, n, r) {
  2878. "use strict";
  2879. var i = r(13),
  2880. o = r.n(i),
  2881. a = r(17),
  2882. s = r.n(a),
  2883. c = r(11),
  2884. d = r.n(c),
  2885. u = r(29),
  2886. l = r.n(u),
  2887. p = r(7),
  2888. f = r.n(p),
  2889. g = r(21),
  2890. m = r(8),
  2891. h = function(e) {
  2892. e && e.apply(this, [].slice.call(arguments, 1))
  2893. },
  2894. v = r(0),
  2895. E = r(1),
  2896. _ = r(10),
  2897. S = r(14),
  2898. y = r(3),
  2899. R = function(e) {
  2900. var t = Object(m.b)(e);
  2901. t.needReconnect = !0,
  2902. t.isTimeout = !1,
  2903. t.isInit = !0,
  2904. t.sendbytes = 0,
  2905. t.recvbytes = 0,
  2906. t.startTime = Date.now(),
  2907. t.lastMsgTime = null,
  2908. t.clientId = e.clientId,
  2909. t.hostIndex = 0,
  2910. t.requestID = 0,
  2911. e.host instanceof Array ? t.host = e.host: t.host = [e.host],
  2912. t.getSendBytes = function() {
  2913. return t.sendbytes
  2914. },
  2915. t.getRecvBytes = function() {
  2916. return t.recvbytes
  2917. },
  2918. t.getDuration = function() {
  2919. return Math.ceil((Date.now() - t.startTime) / 1e3)
  2920. },
  2921. t.getURL = function() {
  2922. return t.connection.url
  2923. },
  2924. t.reconnect = function() {
  2925. t.isInit = !0,
  2926. t.creatConnection()
  2927. },
  2928. t.connectNext = function() {
  2929. t.isInit = !0,
  2930. ++t.hostIndex,
  2931. v.
  2932. default.debug("[" + t.clientId + "] Gateway length:" + t.host.length + " current index:" + t.hostIndex),
  2933. t.hostIndex >= t.host.length ? t.dispatchEvent(Object(m.d)({
  2934. type: "recover"
  2935. })) : t.creatConnection()
  2936. },
  2937. t.replaceHost = function(e) {
  2938. t.host = e || t.host,
  2939. t.hostIndex = 0,
  2940. t.creatConnection()
  2941. },
  2942. t.creatConnection = function() {
  2943. if (t.needReconnect = !0, t.lts = (new Date).getTime(), t.connection = new WebSocket("wss://" + t.host[t.hostIndex]), t.connection.binaryType = "arraybuffer", t.turnConfig = {},
  2944. t.connection.url) {
  2945. var n = t.connection.url.match(/wss\:\/\/([^:]+):(\d+)/),
  2946. r = t.host[t.hostIndex].split(":"),
  2947. i = t.connection.url.match(/h=([^:]+)&p=(\d+)/);
  2948. n ? (t.turnConfig.url = n[1], Object(y.getParameter)("TURN_ENABLE_TCP") && (t.turnConfig.tcpport = parseInt(n[2]) + 30), Object(y.getParameter)("TURN_ENABLE_UDP") && (t.turnConfig.udpport = parseInt(n[2]) + 30)) : i ? (t.turnConfig.url = i[1], Object(y.getParameter)("TURN_ENABLE_TCP") && (t.turnConfig.tcpport = parseInt(i[2]) + 30), Object(y.getParameter)("TURN_ENABLE_UDP") && (t.turnConfig.udpport = parseInt(i[2]) + 30)) : r && (t.turnConfig.url = r[0], Object(y.getParameter)("TURN_ENABLE_TCP") && (t.turnConfig.tcpport = parseInt(r[1]) + 30), Object(y.getParameter)("TURN_ENABLE_UDP") && (t.turnConfig.udpport = parseInt(r[1]) + 30))
  2949. }
  2950. t.connection.onopen = function(e) {
  2951. t.needReconnect = !0,
  2952. t.isTimeout = !1,
  2953. t.isInit = !1,
  2954. t.sendbytes = 0,
  2955. t.recvbytes = 0,
  2956. t.startTime = Date.now(),
  2957. Object(S.resetHTTPByetsCount)(),
  2958. clearTimeout(t.timeoutCheck),
  2959. t.dispatchEvent(Object(m.d)({
  2960. type: "onopen",
  2961. event: e,
  2962. socket: t
  2963. }))
  2964. },
  2965. t.connection.onmessage = function(e) {
  2966. if (e.data instanceof ArrayBuffer) t.dispatchEvent({
  2967. type: "onBinaryData",
  2968. data: e.data
  2969. });
  2970. else {
  2971. t.recvbytes += Object(_.lengthInUtf8Bytes)(e.data);
  2972. var n = JSON.parse(e.data);
  2973. t.lastMsgTime = Date.now(),
  2974. n.hasOwnProperty("_id") ? t.dispatchEvent(Object(m.d)({
  2975. type: n._id,
  2976. msg: n
  2977. })) : n.hasOwnProperty("_type") && t.dispatchSocketEvent(Object(m.d)({
  2978. type: n._type,
  2979. msg: n._message
  2980. }))
  2981. }
  2982. },
  2983. t.connection.onclose = function(n) {
  2984. t.needReconnect ? t.isTimeout || t.isInit ? (v.
  2985. default.debug("[" + t.clientId + "] websockect connect timeout"), E.report.joinGateway(e.sid, {
  2986. lts: t.lts,
  2987. succ: !1,
  2988. ec: "timeout",
  2989. addr: t.connection.url
  2990. }), t.connectNext()) : (t.dispatchEvent(Object(m.d)({
  2991. type: "disconnect",
  2992. event: n
  2993. })), t.requests && t.requests instanceof Array && (t.requests.map((function(e) {
  2994. e.callback("REQUEST_ABORT")
  2995. })), t.requests = [])) : (v.
  2996. default.debug("[" + t.clientId + "] websockect closeed"), h(e.onFailure, n), clearTimeout(t.timeoutCheck), t.dispatchEvent(Object(m.d)({
  2997. type: "close",
  2998. event: n
  2999. })), t.connection.onopen = void 0, t.connection.onclose = void 0, t.connection.onerror = void 0, t.connection.onmessage = void 0, t.connection = void 0)
  3000. },
  3001. t.connection.onerror = function(e) {};
  3002. setTimeout((function() {
  3003. t.connection && t.connection.readyState != WebSocket.OPEN && (t.isTimeout = !0, t.connection.close())
  3004. }), 5e3)
  3005. },
  3006. t.creatConnection(),
  3007. t.sendMessage = function(e, n) {
  3008. if (t.connection && t.connection.readyState == WebSocket.OPEN) {
  3009. var r = JSON.stringify(e);
  3010. t.sendbytes += Object(_.lengthInUtf8Bytes)(r),
  3011. t.connection.send(r)
  3012. } else n({
  3013. error: "Gateway not connected"
  3014. })
  3015. },
  3016. t.disconnect = function() {
  3017. t.needReconnect = !0,
  3018. t.connection.close()
  3019. },
  3020. t.close = function() {
  3021. t.needReconnect = !1,
  3022. t.connection.onclose = void 0,
  3023. t.connection.close(),
  3024. clearInterval(t.requestTimer),
  3025. t.requests && t.requests instanceof Array && (t.requests.map((function(e) {
  3026. e.callback("REQUEST_ABORT")
  3027. })), t.requests = [])
  3028. },
  3029. t.sendSignalCommand = function(e, n) {
  3030. e._id = "_request_" + t.requestID,
  3031. t.requestID += 1,
  3032. "publish_stats" !== e._type && "subscribe_stats" !== e._type && "publish_stats_low" !== e._type && t.on(e._id, (function(r) {
  3033. r.msg && n && n(r.msg._result, r.msg.message),
  3034. delete t.dispatcher.eventListeners[e._id]
  3035. })),
  3036. t.sendMessage(e, (function(e) {
  3037. e.reason = "NOT_CONNECTED",
  3038. n && n(e.reason, e)
  3039. }))
  3040. },
  3041. t.requests = [];
  3042. var n = function(e) {
  3043. var n = t.requests.findIndex((function(t) {
  3044. return t.id === e.type
  3045. }));
  3046. if (n >= 0) var r = t.requests.splice(n, 1)[0];
  3047. r && t.dispatcher.eventListeners[e.type] ? (delete t.dispatcher.eventListeners[e.type], e.msg && r.callback && r.callback(e.msg._result, e.msg._message)) : v.
  3048. default.warning("Detached Response", e.type, e.msg)
  3049. },
  3050. r = function(e) {
  3051. var n = this,
  3052. r = t.requests.findIndex((function(e) {
  3053. return e.id === n.id
  3054. }));
  3055. r >= 0 && (n = t.requests.splice(r, 1)[0]),
  3056. n && t.dispatcher.eventListeners[e.type] ? (delete t.dispatcher.eventListeners[e.type], e.reason = "NOT_CONNECTED", n.callback && n.callback(e.reason, e)) : v.
  3057. default.warning("handleSendError", n)
  3058. };
  3059. return t.sendRequest = function(e, i) {
  3060. e = f()({
  3061. _id: "_request_" + t.requestID
  3062. },
  3063. e),
  3064. t.requestID += 1;
  3065. var o = {
  3066. id: e._id,
  3067. timeoutCounter: 0,
  3068. stalledAt: Date.now(),
  3069. message: e,
  3070. callback: i
  3071. };
  3072. t.requests.push(o),
  3073. t.addEventListener(e._id, n),
  3074. t.sendMessage(e, r.bind(o))
  3075. },
  3076. t.checkRequestTimeout = function() {
  3077. for (var e = Math.ceil(Object(y.getParameter)("SIGNAL_REQUEST_TIMEOUT") / Object(y.getParameter)("SIGNAL_REQUEST_WATCH_INTERVAL")), n = t.requests.length - 1; n >= 0; n--) {
  3078. var r = t.requests[n];
  3079. r.timeoutCounter >= e ? (t.requests.splice(n, 1), v.
  3080. default.error("Request Timeout", r.timeoutCounter, r.message), r.callback && r.callback("TIMEOUT")) : r.timeoutCounter++
  3081. }
  3082. },
  3083. clearInterval(t.requestTimer),
  3084. t.requestTimer = setInterval(t.checkRequestTimeout, Object(y.getParameter)("SIGNAL_REQUEST_WATCH_INTERVAL")),
  3085. t.sendReport = function(e) {
  3086. t.sendMessage(e, (function() {}))
  3087. },
  3088. t
  3089. },
  3090. T = function(e, t) {
  3091. var n = {
  3092. connect: function() {
  3093. t.host = e,
  3094. n.signal = R(t),
  3095. n.on = n.signal.on,
  3096. n.dispatchEvent = n.signal.dispatchEvent,
  3097. n.signal.on("onopen", (function(e) {
  3098. n.signal.onEvent = function(e) {
  3099. n.dispatchEvent(Object(m.d)({
  3100. type: e.event,
  3101. msg: e
  3102. }))
  3103. },
  3104. n.dispatchEvent(Object(m.d)({
  3105. type: "connect",
  3106. msg: e
  3107. }))
  3108. })),
  3109. n.signal.on("onError", (function(e) {
  3110. var t = e.msg;
  3111. onError(t.code, "error")
  3112. }))
  3113. },
  3114. getLastMsgTime: function() {
  3115. return n.signal && n.signal.lastMsgTime
  3116. },
  3117. getSendBytes: function() {
  3118. return n.signal.getSendBytes()
  3119. },
  3120. getRecvBytes: function() {
  3121. return n.signal.getRecvBytes()
  3122. },
  3123. getDuration: function() {
  3124. return n.signal.getDuration()
  3125. },
  3126. disconnect: function() {
  3127. n.signal.disconnect()
  3128. },
  3129. close: function() {
  3130. n.signal.close()
  3131. },
  3132. getURL: function() {
  3133. return n.signal.getURL()
  3134. },
  3135. reconnect: function() {
  3136. n.signal.reconnect()
  3137. },
  3138. connectNext: function() {
  3139. n.signal.connectNext()
  3140. },
  3141. replaceHost: function(e) {
  3142. n.signal.replaceHost(e)
  3143. },
  3144. emitSimpleMessage: function(e, t) {
  3145. n.signal.sendSignalCommand(e, t)
  3146. },
  3147. emitRequest: function(e, t) {
  3148. n.signal.sendRequest(e, t)
  3149. },
  3150. emitReport: function(e) {
  3151. n.signal.sendReport(e)
  3152. }
  3153. };
  3154. return n.connect(),
  3155. n
  3156. },
  3157. I = r(22),
  3158. A = r(5),
  3159. b = r(20),
  3160. O = r(4),
  3161. C = {
  3162. ERR_NO_VOCS_AVAILABLE: "tryNext",
  3163. ERR_NO_VOS_AVAILABLE: "tryNext",
  3164. ERR_JOIN_CHANNEL_TIMEOUT: "tryNext",
  3165. WARN_REPEAT_JOIN: "quit",
  3166. ERR_JOIN_BY_MULTI_IP: "recover",
  3167. WARN_LOOKUP_CHANNEL_TIMEOUT: "tryNext",
  3168. WARN_OPEN_CHANNEL_TIMEOUT: "tryNext",
  3169. ERR_VOM_SERVICE_UNAVAILABLE: "tryNext",
  3170. ERR_TOO_MANY_USERS: "tryNext",
  3171. ERR_MASTER_VOCS_UNAVAILABLE: "tryNext",
  3172. ERR_INTERNAL_ERROR: "tryNext",
  3173. K_SERVICE_NOT_READY: "recover",
  3174. K_SERVICE_TOO_HEAVY: "tryNext",
  3175. notification_test_recover: "recover",
  3176. notification_test_tryNext: "tryNext",
  3177. notification_test_retry: "retry"
  3178. },
  3179. N = {
  3180. googActualEncBitrate: "A_aeb",
  3181. googAvailableSendBandwidth: "A_asb",
  3182. googRetransmitBitrate: "A_rb",
  3183. googAvailableReceiveBandwidth: "A_arb",
  3184. googTargetEncBitrate: "A_teb",
  3185. googBucketDelay: "A_bd",
  3186. googTransmitBitrate: "A_tb",
  3187. googCodecName: "A_cn",
  3188. bytesSent: "bytesSent",
  3189. packetsLost: "packetsLost",
  3190. packetsSent: "packetsSent",
  3191. googAdaptationChanges: "A_ac",
  3192. googAvgEncodeMs: "A_aem",
  3193. googEncodeUsagePercent: "A_eup",
  3194. googFirsReceived: "A_fr",
  3195. googFrameHeightInput: "A_fhi",
  3196. googFrameHeightSent: "A_fhs",
  3197. googFrameRateInput: "A_fri",
  3198. googFrameRateSent: "A_frs",
  3199. googFrameWidthInput: "A_fwi",
  3200. googFrameWidthSent: "A_fws",
  3201. googNacksReceived: "A_nr",
  3202. googPlisReceived: "A_pr",
  3203. googRtt: "A_rtt",
  3204. aecDivergentFilterFraction: "A_adff",
  3205. audioInputLevel: "A_ail",
  3206. googEchoCancellationReturnLoss: "A_ecrl",
  3207. googEchoCancellationReturnLossEnhancement: "A_ecrle",
  3208. googResidualEchoLikelihood: "A_rel",
  3209. googResidualEchoLikelihoodRecentMax: "A_relrm",
  3210. googTargetDelayMs: "A_tdm",
  3211. bytesReceived: "bytesReceived",
  3212. packetsReceived: "packetsReceived",
  3213. googDecodeMs: "A_dm",
  3214. googMaxDecodeMs: "A_mdm",
  3215. googRenderDelayMs: "A_rdm",
  3216. googFrameWidthReceived: "A_fwr",
  3217. googFrameHeightReceived: "A_fhr",
  3218. googFrameRateReceived: "A_frr",
  3219. googFrameRateDecoded: "A_frd",
  3220. googFrameRateOutput: "A_fro",
  3221. googJitterBufferMs: "A_jbm",
  3222. googCurrentDelayMs: "A_cdm",
  3223. googMinPlayoutDelayMs: "A_mpdm",
  3224. googNacksSent: "A_ns",
  3225. googPlisSent: "A_ps",
  3226. googFirsSent: "A_fs",
  3227. audioOutputLevel: "A_aol",
  3228. googAccelerateRate: "A_ar",
  3229. googDecodingCNG: "A_dcng",
  3230. googDecodingCTN: "A_dctn",
  3231. googDecodingCTSG: "A_dctsg",
  3232. googDecodingNormal: "A_dn",
  3233. googDecodingPLC: "A_dplc",
  3234. googDecodingPLCCNG: "A_dplccng",
  3235. googExpandRate: "A_er",
  3236. googJitterReceived: "A_jr",
  3237. googPreemptiveExpandRate: "A_per",
  3238. googPreferredJitterBufferMs: "A_pjbm",
  3239. googSecondaryDecodedRate: "A_sdr",
  3240. googSpeechExpandRate: "A_ser",
  3241. uplink_fraction_lost: "B_ufl",
  3242. uplink_cumulative_lost: "B_ucl",
  3243. uplink_available_bandwidth: "B_uab",
  3244. period_fir: "B_fir",
  3245. access_delay: "B_acd",
  3246. uplink_network_quality: "B_unq",
  3247. downlink_network_quality: "B_dnq",
  3248. pub_audio_lost_ratio_400ms: "B_palr4",
  3249. pub_video_lost_ratio_400ms: "B_pvlr4",
  3250. e2e_delay: "B_ed",
  3251. audio_delay: "B_ad",
  3252. video_delay: "B_vd",
  3253. stream_type: "B_st",
  3254. e2e_audio_lost_ratio_400ms: "B_ealr4",
  3255. e2e_video_lost_ratio_400ms: "B_evlr4",
  3256. downlink_estimate_bandwidth: "B_deb",
  3257. peer_publish_audio_duration: "B_ppad",
  3258. peer_publish_video_duration: "B_ppvd"
  3259. },
  3260. w = {};
  3261. for (var L in N) {
  3262. var D = N[L];
  3263. w[D] && v.
  3264. default.error("Key Conflict: ".concat(D, ": ").concat(N[D], "| ").concat(L)),
  3265. w[D] = L
  3266. }
  3267. var k = function(e) {
  3268. return N[e] || e
  3269. },
  3270. M = function(e) {
  3271. return w[e] || e
  3272. };
  3273. var P = r(9),
  3274. U = r.n(P),
  3275. x = function t(n) {
  3276. var r = !1,
  3277. i = function(e) {
  3278. return {
  3279. _type: "control",
  3280. _message: e
  3281. }
  3282. },
  3283. a = function(e, t) {
  3284. var n = {};
  3285. return Object.keys(t).forEach((function(e) {
  3286. Object(y.getParameter)("STATS_FILTER")[e] || (n[k(e)] = t[e])
  3287. })),
  3288. {
  3289. _type: "subscribe_related_stats",
  3290. _message: {
  3291. stream_type: "high",
  3292. stream_id: e,
  3293. stats: n
  3294. }
  3295. }
  3296. },
  3297. c = function(e) {
  3298. return {
  3299. _type: "publish",
  3300. _message: e
  3301. }
  3302. },
  3303. u = function(e, t) {
  3304. var n = {};
  3305. return Object.keys(t).forEach((function(e) {
  3306. Object(y.getParameter)("STATS_FILTER")[e] || (n[k(e)] = t[e])
  3307. })),
  3308. {
  3309. _type: "subscribe_stats",
  3310. _message: {
  3311. stream_id: e,
  3312. stats: n
  3313. }
  3314. }
  3315. },
  3316. p = t.DISCONNECTED,
  3317. S = t.CONNECTING,
  3318. R = t.CONNECTED,
  3319. N = t.DISCONNECTING,
  3320. w = p,
  3321. L = Object(m.b)(n);
  3322. Object.defineProperty(L, "state", {
  3323. set: function(e) {
  3324. var n = w;
  3325. w = e,
  3326. Object(b._setClientConnectionStateRecord)(L.clientId, e),
  3327. e !== t.CONNECTED && (L.hasJoined = !1),
  3328. n !== e && L.dispatchEvent({
  3329. type: "connection-state-change",
  3330. prevState: t.connetionStateMap[n],
  3331. curState: t.connetionStateMap[e]
  3332. })
  3333. },
  3334. get: function() {
  3335. return w
  3336. }
  3337. }),
  3338. L.socket = void 0,
  3339. L.state = p,
  3340. L.mode = n.mode,
  3341. L.role = n.role,
  3342. L.codec = n.codec,
  3343. L.config = {},
  3344. L.timers = {},
  3345. L.timer_counter = {},
  3346. L.localStreams = {},
  3347. L.remoteStreams = {},
  3348. L.remoteMuteState = {},
  3349. L.attemps = 1,
  3350. L.p2p_attemps = 1,
  3351. L.audioLevel = {},
  3352. L.activeSpeaker = void 0,
  3353. L.reconnectMode = "tryNext",
  3354. L.rejoinAttempt = 0,
  3355. L.hasChangeBGPAddress = !1,
  3356. L.traffic_stats = {},
  3357. L.clientId = n.clientId,
  3358. L.pingpongCounter = 0,
  3359. L.hasInvokeLeave = !1,
  3360. L.p2ps = new Map,
  3361. L.liveStreams = new Map,
  3362. L.injectLiveStreams = new Map,
  3363. L.remoteStreamsInChannel = new Set,
  3364. L.subscribeRequestId = new Map,
  3365. L.publishRequestId = 0,
  3366. L.hasJoined = !1,
  3367. L.isFirstSuccess = !0,
  3368. L.peerPublishDurationMap = new Map,
  3369. function(e) {
  3370. var t = h;
  3371. e.makeRequest = function(n, r, i) {
  3372. if (void 0 === e.socket) return v.
  3373. default.debug("[".concat(e.clientId, "] No socket available")),
  3374. void t(i, A.
  3375. default.INVALID_OPERATION);
  3376. try {
  3377. e.socket.emitRequest(n, (function(e, t) {
  3378. var n;
  3379. "success" === e ? "function" == typeof r && r(t) : "function" == typeof i && (n = t && t.error_code && A.GatewayErrorCode[t.error_code] ? A.GatewayErrorCode[t.error_code] : t && t.error_str ? t.error_str: t && t.error_code ? "UNKNOW_ERROR_".concat(t.error_code) : e, i(n, t))
  3380. }))
  3381. } catch(r) {
  3382. v.
  3383. default.debug("[".concat(e.clientId, "] Socket emit message failed ").concat(JSON.stringify(n))),
  3384. v.
  3385. default.debug("[".concat(e.clientId, "] "), r),
  3386. t(i, A.
  3387. default.SOCKET_ERROR)
  3388. }
  3389. },
  3390. e.makeReport = function(t) {
  3391. void 0 === e.socket && v.
  3392. default.debug("[".concat(e.clientId, "] No socket available"));
  3393. try {
  3394. e.socket.emitReport(t)
  3395. } catch(n) {
  3396. v.
  3397. default.debug("[".concat(e.clientId, "] Socket emit report failed ").concat(JSON.stringify(t)))
  3398. }
  3399. }
  3400. } (L),
  3401. L.inChannelInfo = {
  3402. joinAt: null,
  3403. duration: 0
  3404. },
  3405. L._sendMessage = function(e, t) {
  3406. switch (e) {
  3407. case "SubscribeStats":
  3408. L.makeReport(u.apply(void 0, l()(t)));
  3409. break;
  3410. case "SubscribeRelatedStats":
  3411. L.makeReport(a.apply(void 0, l()(t)))
  3412. }
  3413. };
  3414. var D = h;
  3415. L.p2pCounter = Object(_.random)(1e5),
  3416. L.generateP2PId = function() {
  3417. return++L.p2pCounter
  3418. },
  3419. L.audioVolumeIndication = {
  3420. enabled: !1,
  3421. sortedAudioVolumes: [],
  3422. smooth: 3,
  3423. interval: 2e3
  3424. },
  3425. L.remoteVideoStreamTypes = {
  3426. REMOTE_VIDEO_STREAM_HIGH: 0,
  3427. REMOTE_VIDEO_STREAM_LOW: 1,
  3428. REMOTE_VIDEO_STREAM_MEDIUM: 2
  3429. },
  3430. L.streamFallbackTypes = {
  3431. STREAM_FALLBACK_OPTION_DISABLED: 0,
  3432. STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW: 1,
  3433. STREAM_FALLBACK_OPTION_AUDIO_ONLY: 2
  3434. },
  3435. L.configPublisher = function(e) {
  3436. L.config = e
  3437. },
  3438. L.getGatewayInfo = function(e, t) {
  3439. L.makeRequest({
  3440. _type: "gateway_info"
  3441. },
  3442. e, t)
  3443. },
  3444. L.setClientRole = function(e, t) {
  3445. v.
  3446. default.debug("[".concat(L.clientId, "] setClientRole to ").concat(e));
  3447. var n = E.report.reportApiInvoke(L.joinInfo.sid, {
  3448. name: "_setClientRole",
  3449. callback: t
  3450. });
  3451. L.makeRequest({
  3452. _type: "set_client_role",
  3453. _message: {
  3454. role: e
  3455. }
  3456. },
  3457. (function() {
  3458. L.role = e,
  3459. L.dispatchEvent({
  3460. type: "client-role-changed",
  3461. role: e
  3462. }),
  3463. n && n(null, {
  3464. role: e
  3465. })
  3466. }), (function(t, r) {
  3467. if (r && r.code && (t = A.GatewayErrorCode[r.code] || "UNKNOW_ERROR_" + r.code), "ERR_SET_CLIENT_ROLE_ALREADY_IN_USE" === t) return n && n(null);
  3468. v.
  3469. default.error("set Client role error to " + e + ": " + t),
  3470. n && n(t)
  3471. }))
  3472. },
  3473. L.join = function(e, t, r, i) {
  3474. L.hasInvokeLeave = !1,
  3475. e.useProxyServer && (L.hasChangeBGPAddress = !0);
  3476. var o = (new Date).getTime(),
  3477. a = e.uid;
  3478. if (L.inChannelInfo.joinAt && (L.inChannelInfo.duration += o - L.inChannelInfo.joinAt), L.inChannelInfo.joinAt = o, L.state !== S) return v.
  3479. default.error("[".concat(L.clientId, "] GatewayClient.join Failed: state "), L.state),
  3480. i && i(A.
  3481. default.INVALID_OPERATION),
  3482. void E.report.joinGateway(e.sid, {
  3483. lts: o,
  3484. succ: !1,
  3485. ec: A.
  3486. default.INVALID_OPERATION,
  3487. addr: null
  3488. });
  3489. if (null != a && parseInt(a) !== a) return v.
  3490. default.error("[".concat(L.clientId, "] Input uid is invalid")),
  3491. L.state = p,
  3492. i && i(A.
  3493. default.INVALID_PARAMETER),
  3494. void E.report.joinGateway(e.sid, {
  3495. lts: o,
  3496. succ: !1,
  3497. ec: A.
  3498. default.INVALID_PARAMETER,
  3499. addr: null
  3500. });
  3501. var s = j.register(L, {
  3502. uid: a,
  3503. cname: e && e.cname
  3504. });
  3505. if (s) return L.state = p,
  3506. i && i(s),
  3507. void E.report.joinGateway(e.sid, {
  3508. lts: o,
  3509. succ: !1,
  3510. ec: s,
  3511. addr: null
  3512. });
  3513. L.joinInfo = f()({},
  3514. e),
  3515. L.uid = a,
  3516. L.key = t,
  3517. L.pingpongCounter = 0,
  3518. F(e, (function(t) {
  3519. if (L.state === N || L.state === p) return i && i("LEAVE_BEFORE_JOIN_SUCCESS");
  3520. L.state = R,
  3521. v.
  3522. default.debug("[".concat(L.clientId, "] Connected to gateway server")),
  3523. clearInterval(L.pingTimer),
  3524. L.pingTimer = setInterval((function() {
  3525. var e = Object(y.getParameter)("PING_PONG_TIME_OUT");
  3526. if (++L.pingpongCounter >= e) {
  3527. var t = Date.now();
  3528. L.socket && v.
  3529. default.warning("PINGPONG Timeout. Last Socket Message: ".concat(t - L.socket.getLastMsgTime(), "ms")),
  3530. L.socket && L.socket.getLastMsgTime() && t - L.socket.getLastMsgTime() > Object(y.getParameter)("WEBSOCKET_TIMEOUT_MIN") && (L.pingpongCounter = 0, L.socket.close(), L.socket.dispatchEvent(Object(m.d)({
  3531. type: "disconnect",
  3532. event: {
  3533. msg: "PING_PONG_TIME_OUT"
  3534. }
  3535. })))
  3536. }
  3537. var n = Date.now();
  3538. L.makeRequest({
  3539. _type: "ping"
  3540. },
  3541. (function() {
  3542. L.pingpongCounter = 0;
  3543. var e = Date.now() - n;
  3544. setTimeout((function() {
  3545. Object(y.getParameter)("REPORT_STATS") && L.makeRequest({
  3546. _type: "ping_back",
  3547. _message: {
  3548. pingpongElapse: e
  3549. }
  3550. })
  3551. }), 1e3)
  3552. }), (function(e, t) {
  3553. "TIMEOUT" !== e && (v.
  3554. default.error("Ping Error ".concat(e, " ").concat(JSON.stringify(t))), t && t.error_code && L.socket && L.socket.signal && L.socket.signal.connection && L.socket.signal.connection.readyState === WebSocket.OPEN && (v.
  3555. default.info("Disconnecting websocket connection"), L.socket.signal.connection.close()))
  3556. }))
  3557. }), 3e3),
  3558. L.makeRequest(function(e) {
  3559. var t = e.role,
  3560. r = f()({},
  3561. L.joinInfo.apResponse),
  3562. i = {
  3563. session_id: L.joinInfo.sid,
  3564. app_id: n.appId,
  3565. channel_key: L.key,
  3566. channel_name: L.joinInfo.cname,
  3567. sdk_version: y.VERSION,
  3568. browser: navigator.userAgent,
  3569. process_id: Object(E.getProcessId)(),
  3570. mode: L.mode,
  3571. codec: L.codec,
  3572. role: t,
  3573. has_changed_gateway: Object(y.getParameter)("FORCE_CHANGED_GATEWAY_FLAG") || L.hasChangeBGPAddress,
  3574. ap_response: r,
  3575. optionalInfo: L.joinInfo.optionalInfo,
  3576. extend: Object(y.getParameter)("JOIN_EXTEND"),
  3577. details: {}
  3578. };
  3579. if (L.joinInfo.hasOwnProperty("stringUid") && (i.string_uid = L.joinInfo.stringUid), L.joinInfo.aesmode && L.joinInfo.aespassword && (i.aes_mode = L.joinInfo.aesmode, i.aes_secret = L.joinInfo.aespassword), L.socket && L.socket.signal && L.socket.signal && (r.addresses[L.socket.signal.hostIndex] && (i.ap_response.ticket = r.addresses[L.socket.signal.hostIndex].ticket, delete r.addresses), Object(y.getParameter)("SET_DEFAULT_TURNSERVER") && L.socket.signal.turnConfig)) {
  3580. var o = {
  3581. username: "test",
  3582. credential: Object(y.getParameter)("TURN_SERVER_PASSWORD"),
  3583. forceturn: Object(y.getParameter)("FORCE_TURN")
  3584. };
  3585. o.url = L.socket.signal.turnConfig.url,
  3586. L.socket.signal.turnConfig.tcpport && (o.tcpport = "" + L.socket.signal.turnConfig.tcpport),
  3587. L.socket.signal.turnConfig.udpport && (o.udpport = "" + L.socket.signal.turnConfig.udpport),
  3588. L.joinInfo.turnServers.push(o)
  3589. }
  3590. return L.dispatchEvent({
  3591. type: "join-message-hook",
  3592. joinMessage: i
  3593. }),
  3594. {
  3595. _type: "join",
  3596. _message: i
  3597. }
  3598. } ({
  3599. role: L.role
  3600. }), (function(t) {
  3601. if (E.report.joinGateway(e.sid, {
  3602. lts: o,
  3603. succ: !0,
  3604. ec: null,
  3605. vid: e.vid,
  3606. addr: L.socket.getURL(),
  3607. firstSuccess: L.isFirstSuccess
  3608. }), L.joinSuccessLts = Date.now(), L.isFirstSuccess = !1, L.rejoinAttempt = 0, L.hasJoined = !0, r && r(t.uid), !0 === t.return_vosip || !0 === Object(y.getParameter)("ENABLE_LIVE_SERVER_LIST")) {
  3609. var n = null;
  3610. try {
  3611. n = L.socket.signal.connection.url
  3612. } catch(e) {
  3613. v.
  3614. default.debug("[".concat(L.clientId, "] Can not get gateway ip: ").concat(e))
  3615. }
  3616. n ? Object(y.setParameter)("LIVE_SERVER_LIST", [n]) : Object(y.setParameter)("LIVE_SERVER_LIST", [])
  3617. }
  3618. L.dispatchEvent({
  3619. type: "join"
  3620. }),
  3621. clearInterval(L.timers.trafficStats),
  3622. L.timers.trafficStats = setInterval((function() {
  3623. L.makeRequest({
  3624. _type: "traffic_stats"
  3625. },
  3626. (function(e) {
  3627. var t = {};
  3628. for (var n in e) t[M(n)] = e[n];
  3629. if (t.peer_delay && t.peer_delay.length) {
  3630. var r = [];
  3631. t.peer_delay.forEach((function(e) {
  3632. var t = {};
  3633. for (var n in e) t[M(n)] = e[n];
  3634. r.push(t)
  3635. })),
  3636. t.peer_delay = r
  3637. }
  3638. L.traffic_stats = t,
  3639. L.traffic_stats.timestamp = Date.now();
  3640. var i = L.joinInfo.stringUid,
  3641. o = L.localStreams[a] || L.localStreams[i];
  3642. o && (o.traffic_stats = {
  3643. access_delay: t.access_delay
  3644. }),
  3645. t.peer_delay && t.peer_delay.forEach((function(e) {
  3646. var n = L.remoteStreams[e.peer_uid];
  3647. n && (n.traffic_stats = {
  3648. access_delay: t.access_delay,
  3649. e2e_delay: e.e2e_delay,
  3650. audio_delay: e.audio_delay,
  3651. video_delay: e.video_delay
  3652. })
  3653. })),
  3654. L.dispatchEvent({
  3655. type: "after-getTrafficStats",
  3656. trafficStats: t
  3657. })
  3658. }))
  3659. }), 3e3)
  3660. }), (function(t, n) {
  3661. if (v.
  3662. default.error("[".concat(L.clientId, "] User join failed [").concat(t, "]")), "ERR_JOIN_BY_MULTI_IP" === t) {
  3663. try {
  3664. E.report.joinGateway(e.sid, {
  3665. lts: o,
  3666. succ: !1,
  3667. ec: "ERR_JOIN_BY_MULTI_IP",
  3668. addr: L.socket.getURL()
  3669. })
  3670. } catch(e) {}
  3671. return L.dispatchEvent({
  3672. type: "onMultiIP",
  3673. option: n.option
  3674. })
  3675. }
  3676. C[t] && L.rejoinAttempt < 4 ? L._doWithAction(C[t], r, i) : i && i(t),
  3677. E.report.joinGateway(e.sid, {
  3678. lts: o,
  3679. succ: !1,
  3680. ec: t,
  3681. addr: L.socket && L.socket.getURL()
  3682. })
  3683. }))
  3684. }), (function(t) {
  3685. v.
  3686. default.error("[".concat(L.clientId, "] User join failed [").concat(t, "]")),
  3687. i && i(t),
  3688. E.report.joinGateway(e.sid, {
  3689. lts: o,
  3690. succ: !1,
  3691. ec: t,
  3692. addr: L.socket.getURL()
  3693. })
  3694. })),
  3695. this.remoteMuteState = {},
  3696. L.resetAudioVolumeIndication()
  3697. },
  3698. L.leave = function(e, t) {
  3699. var n = j.unregister(L);
  3700. switch (n && v.
  3701. default.debug("[".concat(L.clientId, "] "), n), L.p2ps.clear(), L.state) {
  3702. case p:
  3703. return v.
  3704. default.debug("[".concat(L.clientId, "] Client Already in DISCONNECTED status")),
  3705. void D(e);
  3706. case N:
  3707. return v.
  3708. default.debug("[".concat(L.clientId, "] Client Already in DISCONNECTING status")),
  3709. void D(t, A.
  3710. default.INVALID_OPERATION);
  3711. case S:
  3712. return L.socket && L.socket.close(),
  3713. L.socket = void 0,
  3714. v.
  3715. default.info("[".concat(L.clientId, "] Client connecting, Leave channel success")),
  3716. L.state = p,
  3717. e && e()
  3718. }
  3719. for (var r in L.state = N,
  3720. L.channelMediaConfig && (L.channelMediaRelayController && L.channelMediaRelayController.dispose(), L.channelMediaConfig, L.channelMediaRelayController = null), clearInterval(L.pingTimer), L.timers) L.timers.hasOwnProperty(r) && clearInterval(L.timers[r]);
  3721. for (var r in L.inChannelInfo.joinAt && (L.inChannelInfo.duration += Date.now() - L.inChannelInfo.joinAt, L.inChannelInfo.joinAt = null), L.hasJoined ? L.makeRequest({
  3722. _type: "leave"
  3723. },
  3724. (function(t) {
  3725. L.socket.close(),
  3726. L.socket = void 0,
  3727. v.
  3728. default.info("[".concat(L.clientId, "] Leave channel success")),
  3729. L.state = p,
  3730. e && e(t)
  3731. }), (function(e) {
  3732. "TIMEOUT" !== e && (v.
  3733. default.error("[".concat(L.clientId, "] Leave Channel Failed"), e), L.state = R, t && t(e))
  3734. })) : (L.socket && (L.socket.close(), L.socket = void 0), v.
  3735. default.info("[".concat(L.clientId, "] Leave channel before joined")), L.state = p, e && e()), L.localStreams) if (L.localStreams.hasOwnProperty(r)) {
  3736. var i = L.localStreams[r];
  3737. delete L.localStreams[r],
  3738. void 0 !== i.pc && (i.pc.close(), i.pc = void 0)
  3739. }
  3740. H()
  3741. },
  3742. L.publish = function(e, t, n, r) {
  3743. var o = (new Date).getTime(),
  3744. a = !1;
  3745. if (e.publishLTS = o, "object" !== d()(e) || null === e) return v.
  3746. default.error("[".concat(L.clientId, "] Invalid local stream")),
  3747. r && r(A.
  3748. default.INVALID_LOCAL_STREAM),
  3749. void E.report.publish(L.joinInfo.sid, {
  3750. lts: o,
  3751. succ: !1,
  3752. audio: !1,
  3753. video: !1,
  3754. screenshare: !1,
  3755. audioName: "",
  3756. videoName: "",
  3757. screenName: "",
  3758. ec: A.
  3759. default.INVALID_LOCAL_STREAM
  3760. });
  3761. if (!e.stream && void 0 === e.url) return v.
  3762. default.error("[".concat(L.clientId, "] Invalid local media stream")),
  3763. r && r(A.
  3764. default.INVALID_LOCAL_STREAM),
  3765. void E.report.publish(L.joinInfo.sid, {
  3766. lts: o,
  3767. succ: !1,
  3768. audio: !1,
  3769. video: !1,
  3770. screenshare: !1,
  3771. audioName: "",
  3772. videoName: "",
  3773. screenName: "",
  3774. ec: A.
  3775. default.INVALID_LOCAL_STREAM
  3776. });
  3777. if (L.state !== R) return v.
  3778. default.error("[".concat(L.clientId, "] User is not in the session")),
  3779. r && r(A.
  3780. default.INVALID_OPERATION),
  3781. void E.report.publish(L.joinInfo.sid, {
  3782. lts: o,
  3783. succ: !1,
  3784. audio: e.hasAudio(),
  3785. video: e.hasVideo(),
  3786. screenshare: e.hasScreen(),
  3787. audioName: e.hasAudio() && e.audioName,
  3788. videoName: e.hasVideo() && e.videoName,
  3789. screenName: e.hasScreen() && e.screenName,
  3790. ec: A.
  3791. default.INVALID_OPERATION
  3792. });
  3793. var s = e.getAttributes() || {};
  3794. if (e.local && void 0 === L.localStreams[e.getId()] && (e.hasAudio() || e.hasVideo() || e.hasScreen())) {
  3795. var u = L.generateP2PId();
  3796. if (L.p2ps.set(u, e), e.p2pId = u, void 0 !== e.url) W(c({
  3797. state: "url",
  3798. audio: e.hasAudio(),
  3799. video: e.hasVideo(),
  3800. attributes: e.getAttributes()
  3801. },
  3802. e.url), (function(t, n) {
  3803. "success" === t ? (e.getUserId() !== n && e.setUserId(n), L.localStreams[n] = e, e.onClose = function() {
  3804. L.unpublish(e)
  3805. }) : v.
  3806. default.error("[".concat(L.clientId, "] Publish local stream failed"), t)
  3807. }));
  3808. else {
  3809. L.localStreams[e.getId()] = e,
  3810. e.connectionSpec = {
  3811. callback: function(s) {
  3812. "motion" === e.optimizationMode && e.pc.setRtpSenderParameters("maintain-framerate"),
  3813. "detail" === e.optimizationMode && e.pc.setRtpSenderParameters("maintain-resolution"),
  3814. L.makeRequest(c({
  3815. state: "offer",
  3816. stream_type: 1 == t.streamType ? "low": "high",
  3817. p2p_id: u,
  3818. sdp: s,
  3819. audio: e.audio || e.screenAudio,
  3820. video: e.screen || e.video,
  3821. screen: e.screen,
  3822. attributes: e.getAttributes(),
  3823. dtx: e.DTX,
  3824. hq: e.highQuality,
  3825. lq: e.lowQuality,
  3826. stereo: e.stereo,
  3827. speech: e.speech,
  3828. codec: L.codec,
  3829. extend: Object(y.getParameter)("PUB_EXTEND")
  3830. }), (function(t) {
  3831. e.getUserId() !== t.uid && e.setUserId(t.uid),
  3832. v.
  3833. default.info("[".concat(L.clientId, "] Local stream published with uid"), t.uid),
  3834. e.onClose = function() {
  3835. L.unpublish(e)
  3836. },
  3837. e._onAudioUnmute = function() {
  3838. L.makeReport(i({
  3839. action: "unmute_local_audio",
  3840. stream_id: e.getId()
  3841. }))
  3842. },
  3843. e._onVideoUnmute = function() {
  3844. L.makeReport(i({
  3845. action: "unmute_local_video",
  3846. stream_id: e.getId()
  3847. }))
  3848. },
  3849. e._onAudioMute = function() {
  3850. L.makeReport(i({
  3851. action: "mute_local_audio",
  3852. stream_id: e.getId()
  3853. }))
  3854. },
  3855. e._onVideoMute = function() {
  3856. L.makeReport(i({
  3857. action: "mute_local_video",
  3858. stream_id: e.getId()
  3859. }))
  3860. },
  3861. e.getId() === e.getUserId() && (e.isAudioOn() || e.hasAudio() && (v.
  3862. default.debug("[".concat(L.clientId, "] local stream audio mute")), e._onAudioMute()), e.isVideoOn() || (e.hasVideo() || e.hasScreen()) && (v.
  3863. default.debug("[".concat(L.clientId, "] local stream video mute")), e._onVideoMute())),
  3864. e.pc.oniceconnectionstatechange = function(t) {
  3865. if ("failed" === t) {
  3866. if (null != L.timers[e.getId()] && (clearInterval(L.timers[e.getId()]), clearInterval(L.timers[e.getId()] + "_RelatedStats")), v.
  3867. default.error("[".concat(L.clientId, "] Publisher connection is lost -- streamId: ").concat(e.getId(), ", p2pId: ").concat(u)), L.p2ps.delete(u), v.
  3868. default.debug("[".concat(L.clientId, "] publish p2p failed: "), L.p2ps), !a) return a = !0,
  3869. E.report.publish(L.joinInfo.sid, {
  3870. lts: o,
  3871. succ: !1,
  3872. audio: e.hasAudio(),
  3873. video: e.hasVideo(),
  3874. screenshare: e.hasScreen(),
  3875. audioName: e.hasAudio() && e.audioName,
  3876. videoName: e.hasVideo() && e.videoName,
  3877. screenName: e.hasScreen() && e.screenName,
  3878. ec: A.
  3879. default.PEERCONNECTION_FAILED,
  3880. publishRequestid: L.publishRequestId || 0,
  3881. p2pid: u
  3882. }),
  3883. L.dispatchEvent(Object(m.a)({
  3884. type: "pubP2PLost",
  3885. stream: e
  3886. })),
  3887. r && r(A.
  3888. default.PEERCONNECTION_FAILED);
  3889. L.dispatchEvent(Object(m.a)({
  3890. type:
  3891. "pubP2PLost",
  3892. stream: e
  3893. }))
  3894. } else if ("connected" === t && (v.
  3895. default.debug("[".concat(L.clientId, "] publish p2p connected: "), L.p2ps), e.getId() === e.getUserId() && (e._isAudioMuted() ? L.makeReport(i({
  3896. action: "mute_local_audio",
  3897. stream_id: e.getId()
  3898. })) : L.makeReport(i({
  3899. action: "unmute_local_audio",
  3900. stream_id: e.getId()
  3901. })), e._isVideoMuted() ? L.makeReport(i({
  3902. action: "mute_local_video",
  3903. stream_id: e.getId()
  3904. })) : L.makeReport(i({
  3905. action: "unmute_local_video",
  3906. stream_id: e.getId()
  3907. }))), !a)) return a = !0,
  3908. E.report.publish(L.joinInfo.sid, {
  3909. lts: o,
  3910. succ: !0,
  3911. audio: e.hasAudio(),
  3912. video: e.hasVideo(),
  3913. screenshare: e.hasScreen(),
  3914. audioName: e.hasAudio() && e.audioName,
  3915. videoName: e.hasVideo() && e.videoName,
  3916. screenName: e.hasScreen() && e.screenName,
  3917. ec: null,
  3918. publishRequestid: L.publishRequestId || 0,
  3919. p2pid: u
  3920. }),
  3921. n && n()
  3922. },
  3923. e.pc.processSignalingMessage(t.sdp)
  3924. }), (function(t, n) {
  3925. v.
  3926. default.error("Publish Failed: ".concat(t)),
  3927. E.report.publish(L.joinInfo.sid, {
  3928. lts: o,
  3929. succ: !1,
  3930. audio: e.hasAudio(),
  3931. video: e.hasVideo(),
  3932. screenshare: e.hasScreen(),
  3933. audioName: e.hasAudio() && e.audioName,
  3934. videoName: e.hasVideo() && e.videoName,
  3935. screenName: e.hasScreen() && e.screenName,
  3936. ec: t,
  3937. publishRequestid: L.publishRequestId || 0,
  3938. p2pid: u
  3939. }),
  3940. "TIMEOUT" != t && (L.processPublishFailure(e), r && r(t))
  3941. }))
  3942. },
  3943. audio: e.hasAudio(),
  3944. video: e.hasVideo(),
  3945. screen: e.hasScreen(),
  3946. optimizationMode: e.optimizationMode,
  3947. isSubscriber: !1,
  3948. stunServerUrl: L.stunServerUrl,
  3949. turnServers: L.joinInfo.turnServers,
  3950. maxAudioBW: s.maxAudioBW,
  3951. minVideoBW: s.minVideoBW,
  3952. maxVideoBW: s.maxVideoBW,
  3953. mode: L.mode,
  3954. codec: L.codec,
  3955. isVideoMute: e.userMuteVideo || e.peerMuteVideo,
  3956. isAudioMute: e.userMuteAudio || e.peerMuteAudio,
  3957. maxFrameRate: e.attributes.maxFrameRate,
  3958. agoraStream: e,
  3959. clientId: L.clientId
  3960. },
  3961. e.pc = Object(I.a)(e.connectionSpec),
  3962. e.pc.addStream(e.stream),
  3963. v.
  3964. default.debug("[".concat(L.clientId, "] PeerConnection add stream :"), e.stream),
  3965. e.pc.onnegotiationneeded = function(n) {
  3966. "motion" === e.optimizationMode && e.pc.setRtpSenderParameters("maintain-framerate"),
  3967. "detail" === e.optimizationMode && e.pc.setRtpSenderParameters("maintain-resolution");
  3968. var r = {
  3969. state: "negotiation",
  3970. stream_type: 1 === t.streamType ? "low": "high",
  3971. p2p_id: u,
  3972. sdp: n
  3973. };
  3974. L.makeRequest(c(r), (function(t) {
  3975. v.
  3976. default.debug("Negotating Stream ".concat(e.getId())),
  3977. e.pc.processSignalingMessage(t.sdp)
  3978. }), (function(e, t) {
  3979. v.
  3980. default.error("Negotiation failed ".concat(e), t, r)
  3981. }))
  3982. },
  3983. clearInterval(L.timers[e.getId()]),
  3984. L.timers[e.getId()] = setInterval((function() {
  3985. if (Object(y.getParameter)("REPORT_STATS")) {
  3986. var t = 0;
  3987. e && e.pc && e.pc.getStats && e.pc.getStatsRate((function(n) {
  3988. n.forEach((function(n) {
  3989. if (n && n.id && !/_recv$/.test(n.id) && !/^time$/.test(n.id) && e.getUserId()) {
  3990. if ( - 1 === n.id.indexOf("outbound_rtp") && -1 === n.id.indexOf("OutboundRTP") && -1 === n.type.toLowerCase().indexOf("outbound") || "video" !== n.mediaType || (n.googFrameWidthSent = e.videoWidth + "", n.googFrameHeightSent = e.videoHeight + ""), "video" === n.mediaType) try {
  3991. var r = e.stream.getVideoTracks()[0];
  3992. n.A_vstd = r.enabled ? "0": "1"
  3993. } catch(e) {}
  3994. if ("audio" === n.mediaType) try {
  3995. var i = e.stream.getAudioTracks()[0];
  3996. n.A_astd = i.enabled ? "0": "1"
  3997. } catch(e) {}
  3998. if (e.getId() == e.getUserId()) {
  3999. var o = 200 * t;
  4000. t++,
  4001. setTimeout((function() {
  4002. var e = L.socket && L.socket.getLastMsgTime() && Date.now() - L.socket.getLastMsgTime();
  4003. e > Object(y.getParameter)("REPORT_STATS_TIMEOUT") ? v.
  4004. default.debug("PublishStats report blocked by REPORT_STATS_TIMEOUT ".concat(e)):
  4005. L.makeReport(function(e) {
  4006. var t = {};
  4007. return Object.keys(e).forEach((function(n) {
  4008. Object(y.getParameter)("STATS_FILTER")[n] || (t[k(n)] = e[n])
  4009. })),
  4010. {
  4011. _type: "publish_stats",
  4012. _message: {
  4013. stream_type: "high",
  4014. stats: t
  4015. }
  4016. }
  4017. } (n))
  4018. }), o)
  4019. } else {
  4020. o = 200 * t;
  4021. t++,
  4022. setTimeout((function() {
  4023. var e = L.socket && L.socket.getLastMsgTime() && Date.now() - L.socket.getLastMsgTime();
  4024. e > Object(y.getParameter)("REPORT_STATS_TIMEOUT") ? v.
  4025. default.debug("PublishStatsLow report blocked by REPORT_STATS_TIMEOUT ".concat(e)):
  4026. L.makeReport(function(e) {
  4027. var t = {};
  4028. return Object.keys(e).forEach((function(n) {
  4029. Object(y.getParameter)("STATS_FILTER")[n] || (t[k(n)] = e[n])
  4030. })),
  4031. {
  4032. _type: "publish_stats",
  4033. _message: {
  4034. stream_type: "low",
  4035. stats: t
  4036. }
  4037. }
  4038. } (n))
  4039. }), o)
  4040. }
  4041. }
  4042. }))
  4043. }))
  4044. }
  4045. }), 3e3);
  4046. var l = function() {
  4047. Object(y.getParameter)("REPORT_STATS") && e && e.pc && e.pc.getVideoRelatedStats && e.pc.getVideoRelatedStats((function(t) {
  4048. var n, r, i = L.socket && L.socket.getLastMsgTime() && Date.now() - L.socket.getLastMsgTime();
  4049. i > Object(y.getParameter)("REPORT_STATS_TIMEOUT") ? v.
  4050. default.debug("PublishRelatedStats report blocked by REPORT_STATS_TIMEOUT ".concat(i)):
  4051. e.getId() === e.getUserId() ? L.makeReport((n = t, r = {},
  4052. Object.keys(n).forEach((function(e) {
  4053. Object(y.getParameter)("STATS_FILTER")[e] || (r[k(e)] = n[e])
  4054. })), {
  4055. _type: "publish_related_stats",
  4056. _message: {
  4057. stream_type: "high",
  4058. stats: r
  4059. }
  4060. })) : L.makeReport(function(e) {
  4061. var t = {};
  4062. return Object.keys(e).forEach((function(n) {
  4063. Object(y.getParameter)("STATS_FILTER")[n] || (t[k(n)] = e[n])
  4064. })),
  4065. {
  4066. _type: "publish_related_stats",
  4067. _message: {
  4068. stream_type: "low",
  4069. stats: t
  4070. }
  4071. }
  4072. } (t))
  4073. }))
  4074. };
  4075. l(),
  4076. clearInterval(L.timers[e.getId() + "_RelatedStats"]),
  4077. L.timers[e.getId() + "_RelatedStats"] = setInterval(l, 1e3)
  4078. }
  4079. }
  4080. },
  4081. L.unpublish = function(e, t, n, r) {
  4082. if ("object" !== d()(e) || null === e) return v.
  4083. default.error("[".concat(L.clientId, "] Invalid local stream")),
  4084. void D(r, A.
  4085. default.INVALID_LOCAL_STREAM);
  4086. if (L.state !== R) return v.
  4087. default.error("[".concat(L.clientId, "] User not in the session")),
  4088. void D(r, A.
  4089. default.INVALID_OPERATION);
  4090. if (null != L.timers[e.getId()] && (clearInterval(L.timers[e.getId()]), clearInterval(L.timers[e.getId() + "_RelatedStats"])), void 0 !== L.socket) if (e.local && void 0 !== L.localStreams[e.getId()]) {
  4091. delete L.localStreams[e.getId()];
  4092. var i = {
  4093. stream_id: e.getUserId(),
  4094. stream_type: 1 === t.streamType ? "low": "high"
  4095. };
  4096. L.makeRequest({
  4097. _type: "unpublish",
  4098. _message: i
  4099. }),
  4100. (e.hasAudio() || e.hasVideo() || e.hasScreen()) && void 0 === e.url && void 0 !== e.pc && (e.pc.close(), e.pc = void 0),
  4101. e.onClose = void 0,
  4102. e._onAudioMute = void 0,
  4103. e._onAudioUnute = void 0,
  4104. e._onVideoMute = void 0,
  4105. e._onVideoUnmute = void 0,
  4106. L.p2ps.delete(e.p2pId),
  4107. L.dispatchEvent({
  4108. type: "stream-unpublished",
  4109. stream: e,
  4110. options: t
  4111. }),
  4112. n && n()
  4113. } else v.
  4114. default.error("[".concat(L.clientId, "] Invalid local stream")),
  4115. D(r, A.
  4116. default.INVALID_LOCAL_STREAM);
  4117. else v.
  4118. default.error("[".concat(L.clientId, "] User not in the session")),
  4119. D(r, A.
  4120. default.INVALID_OPERATION)
  4121. },
  4122. L.subscribe = function(e, t, n) {
  4123. var r = (new Date).getTime();
  4124. e.subscribeLTS = r;
  4125. var o = !1;
  4126. if (v.
  4127. default.info("[".concat(L.clientId, "] Gatewayclient ").concat(L.uid, " Subscribe ").concat(e.getId(), ": ").concat(JSON.stringify(e.subscribeOptions))), "object" !== d()(e) || null === e) return v.
  4128. default.error("[".concat(L.clientId, "] Invalid remote stream")),
  4129. n && n(A.
  4130. default.INVALID_REMOTE_STREAM),
  4131. void E.report.subscribe(L.joinInfo.sid, {
  4132. lts: r,
  4133. succ: !1,
  4134. video: e.subscribeOptions && e.subscribeOptions.video,
  4135. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4136. peerid: e.getId(),
  4137. ec: A.
  4138. default.INVALID_REMOTE_STREAM
  4139. });
  4140. if (L.state !== R && (v.
  4141. default.error("[".concat(L.clientId, "] User is not in the session")), !o)) return o = !0,
  4142. E.report.subscribe(L.joinInfo.sid, {
  4143. lts: r,
  4144. succ: !1,
  4145. video: e.subscribeOptions && e.subscribeOptions.video,
  4146. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4147. peerid: e.getId(),
  4148. ec: A.
  4149. default.INVALID_OPERATION
  4150. }),
  4151. n && n(A.
  4152. default.INVALID_OPERATION);
  4153. if (!e.local && L.remoteStreams.hasOwnProperty(e.getId())) if (e.hasAudio() || e.hasVideo() || e.hasScreen()) {
  4154. var s = L.generateP2PId();
  4155. L.p2ps.set(s, e),
  4156. e.p2pId = s,
  4157. e.pc = Object(I.a)({
  4158. callback: function(t) {
  4159. var i = {
  4160. stream_id: e.getId(),
  4161. audio: !e.subscribeOptions || e.subscribeOptions.audio,
  4162. video: !e.subscribeOptions || e.subscribeOptions.video,
  4163. codec: L.codec,
  4164. p2p_id: s,
  4165. sdp: t,
  4166. tcc: Object(y.getParameter)("SUBSCRIBE_TCC"),
  4167. extend: Object(y.getParameter)("SUB_EXTEND")
  4168. };
  4169. L.makeRequest({
  4170. _type: "subscribe",
  4171. _message: i
  4172. },
  4173. (function(t) {
  4174. e.pc.processSignalingMessage(t.sdp)
  4175. }), (function(t, i) {
  4176. v.
  4177. default.error("[".concat(L.clientId, "] Subscribe remote stream Failed: ").concat(t, ", closing stream "), e.getId(), i),
  4178. E.report.subscribe(L.joinInfo.sid, {
  4179. lts: r,
  4180. succ: !1,
  4181. video: e.subscribeOptions && e.subscribeOptions.video,
  4182. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4183. peerid: e.getId(),
  4184. ec: t
  4185. }),
  4186. "TIMEOUT" != t && (L.processSubscribeFailure(e), n && n(t))
  4187. }))
  4188. },
  4189. nop2p: !0,
  4190. audio: !0,
  4191. video: !0,
  4192. screen: e.hasScreen(),
  4193. isSubscriber: !0,
  4194. stunServerUrl: L.stunServerUrl,
  4195. turnServers: L.joinInfo.turnServers,
  4196. isVideoMute: e.userMuteVideo,
  4197. isAudioMute: e.userMuteAudio,
  4198. uid: e.getId(),
  4199. agoraStream: e,
  4200. clientId: L.clientId
  4201. }),
  4202. e.pc.onaddstream = function(t, n) {
  4203. if (e._onAudioUnmute = function() {
  4204. L.makeReport(i({
  4205. action: "unmute_remote_audio",
  4206. stream_id: e.getId()
  4207. }), (function() {}), (function() {}))
  4208. },
  4209. e._onAudioMute = function() {
  4210. L.makeReport(i({
  4211. action: "mute_remote_audio",
  4212. stream_id: e.getId()
  4213. }), (function() {}), (function() {}))
  4214. },
  4215. e._onVideoUnmute = function() {
  4216. L.makeReport(i({
  4217. action: "unmute_remote_video",
  4218. stream_id: e.getId()
  4219. }), (function() {}), (function() {}))
  4220. },
  4221. e._onVideoMute = function() {
  4222. L.makeReport(i({
  4223. action: "mute_remote_video",
  4224. stream_id: e.getId()
  4225. }), (function() {}), (function() {}))
  4226. },
  4227. "ontrack" === n && "video" === t.track.kind || "onaddstream" === n) {
  4228. v.
  4229. default.info("[".concat(L.clientId, "] Remote stream subscribed with uid "), e.getId());
  4230. var r = L.remoteStreams[e.getId()];
  4231. if (L.remoteStreams[e.getId()].stream = "onaddstream" === n ? t.stream: t.streams[0], L.remoteStreams[e.getId()].hasVideo()) {
  4232. if (Object(O.isFireFox)() || Object(O.isSafari)()) {
  4233. var o = L.remoteStreams[e.getId()].stream;
  4234. Object(_.vsResHack)(o, (function(t, n) {
  4235. e.videoWidth = t,
  4236. e.videoHeight = n
  4237. }), (function(e) {
  4238. return v.
  4239. default.warning("[".concat(L.clientId, "] vsResHack failed: ") + e)
  4240. }))
  4241. }
  4242. } else {
  4243. var a = L.remoteStreams[e.getId()];
  4244. a.peerMuteVideo = !0,
  4245. L._adjustPCMuteStatus(a)
  4246. }
  4247. r && r.isPlaying() && r.elementID && (v.
  4248. default.debug("[".concat(L.clientId, "] Reload Player ").concat(r.elementID, " StreamId ").concat(r.getId())), e.audioOutput = r.audioOutput, r.stop(), e.play(r.elementID, r.playOptions)),
  4249. delete e.audioLevelHelper;
  4250. var s = Object(m.e)({
  4251. type: "stream-subscribed",
  4252. stream: L.remoteStreams[e.getId()]
  4253. });
  4254. L.dispatchEvent(s)
  4255. }
  4256. },
  4257. clearInterval(L.timers[e.getId()]),
  4258. L.timers[e.getId()] = setInterval((function() {
  4259. if (Object(y.getParameter)("REPORT_STATS")) {
  4260. var t = 0;
  4261. e && e.pc && e.pc.getStats && e.pc.getStatsRate((function(n) {
  4262. n.forEach((function(n) {
  4263. if (n && n.id) {
  4264. if (/_send$/.test(n.id) || /^time$/.test(n.id) || /^bweforvideo$/.test(n.id)) return; - 1 === n.id.indexOf("inbound_rtp") && -1 === n.id.indexOf("inbound-rtp") && -1 === n.type.toLowerCase().indexOf("inbound") || "video" !== n.mediaType || (n.googFrameWidthReceived = e.videoWidth + "", n.googFrameHeightReceived = e.videoHeight + "");
  4265. var r = 200 * t;
  4266. t++;
  4267. var i = e.getId();
  4268. setTimeout((function() {
  4269. var t = L.socket && L.socket.getLastMsgTime() && Date.now() - L.socket.getLastMsgTime();
  4270. if (t > Object(y.getParameter)("REPORT_STATS_TIMEOUT")) v.
  4271. default.debug("SubscribeStats report blocked by REPORT_STATS_TIMEOUT ".concat(t));
  4272. else {
  4273. if ("video" === n.mediaType) try {
  4274. var r = e.stream.getVideoTracks()[0];
  4275. n.A_vrtd = r.enabled ? "0": "1",
  4276. e.player && e.player.freezeTimeCounterList.length > 0 && (n.A_vrft = e.player.freezeTimeCounterList.splice(0, 1)[0].toString())
  4277. } catch(e) {}
  4278. if ("audio" === n.mediaType) try {
  4279. var o = e.stream.getAudioTracks()[0];
  4280. n.A_artd = o.enabled ? "0": "1"
  4281. } catch(e) {}
  4282. L.makeReport(u(i, n))
  4283. }
  4284. }), r)
  4285. } else;
  4286. }))
  4287. }))
  4288. }
  4289. }), 3e3),
  4290. clearInterval(L.timers[e.getId() + "_RelatedStats"]),
  4291. L.timers[e.getId() + "_RelatedStats"] = setInterval((function() {
  4292. if (Object(y.getParameter)("REPORT_STATS") && e && e.pc) {
  4293. var t = L.socket && L.socket.getLastMsgTime() && Date.now() - L.socket.getLastMsgTime();
  4294. if (t > Object(y.getParameter)("REPORT_STATS_TIMEOUT")) return void v.
  4295. default.debug("SubscribeRelatedStats report blocked by REPORT_STATS_TIMEOUT ".concat(t));
  4296. e.pc.getVideoRelatedStats && e.pc.getVideoRelatedStats((function(t) {
  4297. e.player && (e.hasVideo() && !e.peerMuteVideo && (t.isFreeze = e.player.freezeCount > e.player.lastFreezeCount), e.player.lastFreezeCount = e.player.freezeCount),
  4298. L.makeReport(a(e.getId(), t))
  4299. })),
  4300. e.pc.getAudioRelatedStats && e.pc.getAudioRelatedStats((function(t) {
  4301. L.makeReport(a(e.getId(), t))
  4302. }))
  4303. }
  4304. }), 1e3),
  4305. L.audioLevel[e.getId()] = 0,
  4306. clearInterval(L.timers[e.getId() + "audio"]),
  4307. L.timers[e.getId() + "audio"] = setInterval((function() {
  4308. L.hasListeners("active-speaker") && e && e.pc && "established" === e.pc.state && e.pc.getStats && e.pc.getStats((function(t) {
  4309. t.forEach((function(t) {
  4310. if ("audio" === t.mediaType) {
  4311. if (t.audioOutputLevel > 5e3) for (var n in L.audioLevel[e.getId()] < 20 && (L.audioLevel[e.getId()] += 1), L.audioLevel) n !== "" + e.getId() && L.audioLevel[n] > 0 && (L.audioLevel[n] -= 1);
  4312. var r = Object.keys(L.audioLevel).sort((function(e, t) {
  4313. return L.audioLevel[t] - L.audioLevel[e]
  4314. }));
  4315. if (L.activeSpeaker !== r[0]) {
  4316. var i = Object(m.a)({
  4317. type: "active-speaker",
  4318. uid: r[0]
  4319. });
  4320. L.dispatchEvent(i),
  4321. L.activeSpeaker = r[0],
  4322. v.
  4323. default.debug("[".concat(L.clientId, "] Update active speaker: ").concat(L.activeSpeaker))
  4324. }
  4325. }
  4326. }))
  4327. }), 50)
  4328. }), 50),
  4329. e.pc.oniceconnectionstatechange = function(i) {
  4330. if ("failed" === i) null != L.timers[e.getId()] && (clearInterval(L.timers[e.getId()]), clearInterval(L.timers[e.getId()] + "audio")),
  4331. v.
  4332. default.error("[".concat(L.clientId, "] Subscriber connection is lost -- streamId: ").concat(e.getId(), ", p2pId: ").concat(s)),
  4333. v.
  4334. default.debug("[".concat(L.clientId, "] subscribe p2p failed: "), L.p2ps),
  4335. o || (o = !0, n && n(A.
  4336. default.PEERCONNECTION_FAILED), E.report.subscribe(L.joinInfo.sid, {
  4337. lts: r,
  4338. succ: !1,
  4339. video: e.subscribeOptions && e.subscribeOptions.video,
  4340. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4341. peerid: e.getId(),
  4342. ec: A.
  4343. default.PEERCONNECTION_FAILED,
  4344. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4345. p2pid: s
  4346. })),
  4347. L.remoteStreams[e.getId()] && L.p2ps.has(s) && (L.p2ps.delete(s), L.dispatchEvent(Object(m.a)({
  4348. type: "subP2PLost",
  4349. stream: e
  4350. })));
  4351. else if ("connected" === i && (v.
  4352. default.debug("[".concat(L.clientId, "] subscribe p2p connected: "), L.p2ps), !o)) {
  4353. o = !0,
  4354. E.report.subscribe(L.joinInfo.sid, {
  4355. lts: r,
  4356. succ: !0,
  4357. video: e.subscribeOptions && e.subscribeOptions.video,
  4358. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4359. peerid: e.getId(),
  4360. ec: null,
  4361. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4362. p2pid: s
  4363. }),
  4364. L._adjustPCMuteStatus(e);
  4365. var a = !1,
  4366. c = !1,
  4367. d = !1,
  4368. u = setInterval((function() {
  4369. a && c || (e.pc ? e.pc.getStats((function(t) {
  4370. t.forEach((function(t) {
  4371. if (( - 1 !== t.id.indexOf("recv") || t.type && -1 !== t.type.toLowerCase().indexOf("inbound") || -1 !== t.id.indexOf("inbound_rtp") || -1 !== t.id.indexOf("inbound-rtp") || -1 !== t.id.indexOf("InboundRTP")) && "audio" === t.mediaType) {
  4372. if ((t.googDecodingNormal > 0 || t.audioOutputLevel > 0) && !a) {
  4373. a = !0,
  4374. L.dispatchEvent({
  4375. type: "first-audio-frame-decode",
  4376. stream: e
  4377. }),
  4378. a && c && clearInterval(u);
  4379. var n = Date.now(),
  4380. r = E.report.getSessionStartTime(L.joinInfo.sid);
  4381. E.report.firstAudioDecode(L.joinInfo.sid, {
  4382. peerid: e.uintId,
  4383. uid: L.uid,
  4384. elapse: n - r,
  4385. subscribeElapse: n - e.subscribeLTS,
  4386. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4387. p2pid: s
  4388. })
  4389. }
  4390. if (parseInt(t.packetsReceived) > 0 && !c) {
  4391. c = !0,
  4392. L.dispatchEvent({
  4393. type: "first-audio-packet-received",
  4394. stream: e
  4395. }),
  4396. a && c && clearInterval(u);
  4397. n = Date.now(),
  4398. r = E.report.getSessionStartTime(L.joinInfo.sid);
  4399. E.report.firstAudioReceived(L.joinInfo.sid, {
  4400. peerid: e.uintId,
  4401. uid: L.uid,
  4402. elapse: n - r,
  4403. subscribeElapse: n - e.subscribeLTS,
  4404. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4405. p2pid: s
  4406. })
  4407. }
  4408. }
  4409. }))
  4410. }), 100) : clearInterval(u))
  4411. }), 100),
  4412. l = !1,
  4413. p = !1,
  4414. f = setInterval((function() {
  4415. l && p || (e.pc ? e.pc.getStats((function(t) {
  4416. t.forEach((function(t) {
  4417. if (( - 1 !== t.id.indexOf("recv") || t.type && -1 !== t.type.toLowerCase().indexOf("inbound") || -1 !== t.id.indexOf("inbound_rtp") || -1 !== t.id.indexOf("inbound-rtp") || -1 !== t.id.indexOf("InboundRTP")) && "video" === t.mediaType) {
  4418. if ((t.framesDecoded > 0 || t.googFramesDecoded > 0) && !l) {
  4419. l = !0,
  4420. L.dispatchEvent({
  4421. type: "first-video-frame-decode",
  4422. stream: e
  4423. }),
  4424. l && p && clearInterval(f);
  4425. var n = Date.now(),
  4426. r = E.report.getSessionStartTime(L.joinInfo.sid);
  4427. e.firstFrameTime = (new Date).getTime() - e.subscribeLTS,
  4428. E.report.firstVideoDecode(L.joinInfo.sid, {
  4429. peerid: e.uintId,
  4430. width: parseInt(t.googFrameWidthReceived) || 0,
  4431. height: parseInt(t.googFrameHeightReceived) || 0,
  4432. uid: L.uid,
  4433. elapse: n - r,
  4434. subscribeElapse: n - e.subscribeLTS,
  4435. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4436. p2pid: s
  4437. })
  4438. }
  4439. if (t.packetsReceived > 0 && !p) {
  4440. p = !0,
  4441. L.dispatchEvent({
  4442. type: "first-video-packet-received",
  4443. stream: e
  4444. }),
  4445. l && p && clearInterval(f);
  4446. n = Date.now(),
  4447. r = E.report.getSessionStartTime(L.joinInfo.sid);
  4448. E.report.firstVideoReceived(L.joinInfo.sid, {
  4449. peerid: e.uintId,
  4450. uid: L.uid,
  4451. elapse: n - r,
  4452. subscribeElapse: n - e.subscribeLTS,
  4453. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4454. p2pid: s
  4455. })
  4456. }
  4457. }
  4458. }))
  4459. }), 100) : clearInterval(f))
  4460. }), 100),
  4461. g = setInterval((function() {
  4462. if (!d) {
  4463. var t = e.getId(),
  4464. n = L.traffic_stats;
  4465. if (n && n.peer_delay) {
  4466. var r = n.peer_delay.find((function(e) {
  4467. return e.peer_uid == t
  4468. }));
  4469. if (r) {
  4470. if (d = !0, L.peerPublishDurationMap.get(e.getId())) return void clearInterval(g);
  4471. var i = r.peer_publish_audio_duration,
  4472. o = r.peer_publish_video_duration;
  4473. if (void 0 === i || void 0 === o) return;
  4474. L.peerPublishDurationMap.set(e.getId(), !0);
  4475. var a = E.report.getSessionStartTime(L.joinInfo.sid),
  4476. s = (i || o) + (Date.now() - n.timestamp),
  4477. c = Date.now();
  4478. E.report.peerPublishStatus({
  4479. audiotag: i ? 1 : -1,
  4480. videotag: o ? 1 : -1,
  4481. lts: c,
  4482. sid: L.joinInfo.sid,
  4483. cname: L.joinInfo.cname,
  4484. cid: L.joinInfo.cid,
  4485. uid: L.joinInfo.uid,
  4486. elapse: c - a,
  4487. peer: t,
  4488. peerPublishDuration: s,
  4489. joinChannelSuccessElapse: c - L.joinSuccessLts,
  4490. subscribeElapse: c - e.subscribeLTS
  4491. }),
  4492. clearInterval(g)
  4493. }
  4494. }
  4495. }
  4496. }), 1e3);
  4497. return e.sid = L.joinInfo.sid,
  4498. t && t()
  4499. }
  4500. }
  4501. } else v.
  4502. default.error("[".concat(L.clientId, "] Invalid remote stream")),
  4503. o || (o = !0, n && n(A.
  4504. default.INVALID_REMOTE_STREAM), E.report.subscribe(L.joinInfo.sid, {
  4505. lts: r,
  4506. succ: !1,
  4507. video: e.subscribeOptions && e.subscribeOptions.video,
  4508. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4509. peerid: e.getId(),
  4510. ec: A.
  4511. default.INVALID_REMOTE_STREAM
  4512. }));
  4513. else v.
  4514. default.error("[".concat(L.clientId, "] No such remote stream")),
  4515. o || (o = !0, n && n(A.
  4516. default.NO_SUCH_REMOTE_STREAM), E.report.subscribe(L.joinInfo.sid, {
  4517. lts: r,
  4518. succ: !1,
  4519. video: e.subscribeOptions && e.subscribeOptions.video,
  4520. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4521. peerid: e.getId(),
  4522. ec: A.
  4523. default.NO_SUCH_REMOTE_STREAM
  4524. }))
  4525. },
  4526. L.subscribeChange = function(e, t, n) {
  4527. var r = Date.now();
  4528. v.
  4529. default.info("[".concat(L.clientId, "] Gatewayclient ").concat(L.uid, " SubscribeChange ").concat(e.getId(), ": ").concat(JSON.stringify(e.subscribeOptions))),
  4530. L._adjustPCMuteStatus(e);
  4531. var i = {
  4532. stream_id: e.getId(),
  4533. audio: e.subscribeOptions.audio,
  4534. video: e.subscribeOptions.video
  4535. };
  4536. L.makeRequest({
  4537. _type: "subscribe_change",
  4538. _message: i
  4539. },
  4540. (function(n) {
  4541. var i = Object(m.e)({
  4542. type: "stream-subscribe-changed",
  4543. stream: L.remoteStreams[e.getId()]
  4544. });
  4545. E.report.subscribe(L.joinInfo.sid, {
  4546. lts: r,
  4547. succ: !0,
  4548. video: e.subscribeOptions && e.subscribeOptions.video,
  4549. audio: e.subscribeOptions && e.subscribeOptions.audio,
  4550. peerid: e.getId(),
  4551. ec: null,
  4552. subscribeRequestid: L.subscribeRequestId.get(e.getId()) || 0,
  4553. p2pid: L.p2ps.get(e.getId())
  4554. }),
  4555. L.dispatchEvent(i),
  4556. t && t()
  4557. }), (function(t, r) {
  4558. v.
  4559. default.error("[".concat(L.clientId, "] Subscribe Change Failed ").concat(e.getId()), t, r),
  4560. n && n(t, r)
  4561. }))
  4562. },
  4563. L.processPublishFailure = function(e) {
  4564. e.publishLTS = null,
  4565. e.p2pId && L.p2ps.get(e.p2pId) === e && L.p2ps.delete(e.p2pId),
  4566. L.localStreams[e.getUserId()] === e && delete L.localStreams[e.getUserId()],
  4567. L.localStreams[e.getId()] === e && delete L.localStreams[e.getId()],
  4568. e.pc && (e.pc.processSignalingMessage = function() {},
  4569. e.pc.oniceconnectionstatechange = function() {},
  4570. e.pc.close(), delete e.pc),
  4571. delete e.onClose,
  4572. delete e._onAudioUnmute,
  4573. delete e._onVideoUnmute,
  4574. delete e._onAudioMute,
  4575. delete e._onVideoMute,
  4576. delete e._onAudioUnmute
  4577. },
  4578. L.processSubscribeFailure = function(e) {
  4579. e.p2pId && L.p2ps.get(e.p2pId) === e && L.p2ps.delete(e.p2pId),
  4580. e.pc && (e.pc.onaddstream = function() {},
  4581. e.pc.processSignalingMessage = function() {},
  4582. e.pc.oniceconnectionstatechange = function() {},
  4583. e.pc.close(), delete e.pc),
  4584. delete e.onClose,
  4585. delete e._onAudioUnmute,
  4586. delete e._onVideoUnmute,
  4587. delete e._onAudioMute,
  4588. delete e._onVideoMute,
  4589. delete e._onAudioUnmute
  4590. },
  4591. L._adjustPCMuteStatus = function(e) { ! e.local && e.pc && e.pc.peerConnection.getReceivers && e.pc.peerConnection.getReceivers().forEach((function(t) {
  4592. if (t && t.track && "audio" === t.track.kind) {
  4593. var n = !e.userMuteAudio && !e.peerMuteAudio;
  4594. e.subscribeOptions && !e.subscribeOptions.audio && (n = !1),
  4595. t.track.enabled = !!n
  4596. } else if (t && t.track && "video" === t.track.kind) {
  4597. var r = !e.userMuteVideo && !e.peerMuteVideo;
  4598. e.subscribeOptions && !e.subscribeOptions.video && (r = !1),
  4599. t.track.enabled = !!r
  4600. }
  4601. }))
  4602. },
  4603. L.unsubscribe = function(e, t, n) {
  4604. if ("object" !== d()(e) || null === e) return v.
  4605. default.error("[".concat(L.clientId, "] Invalid remote stream")),
  4606. void D(n, A.
  4607. default.INVALID_REMOTE_STREAM);
  4608. if (L.state !== R) return v.
  4609. default.error("[".concat(L.clientId, "] User is not in the session")),
  4610. void D(n, A.
  4611. default.INVALID_OPERATION);
  4612. if (null != L.timers[e.getId()] && (clearInterval(L.timers[e.getId()]), clearInterval(L.timers[e.getId()] + "audio")), null != L.audioLevel[e.getId()] && delete L.audioLevel[e.getId()], null != L.timer_counter[e.getId()] && delete L.timer_counter[e.getId()], L.remoteStreams.hasOwnProperty(e.getId())) {
  4613. if (!L.socket) return v.
  4614. default.error("[".concat(L.clientId, "] User is not in the session")),
  4615. void D(n, A.
  4616. default.INVALID_OPERATION);
  4617. if (e.local) return v.
  4618. default.error("[".concat(L.clientId, "] Invalid remote stream")),
  4619. void D(n, A.
  4620. default.INVALID_REMOTE_STREAM);
  4621. e.close(),
  4622. e.stop();
  4623. var r = {
  4624. stream_id: e.getId()
  4625. };
  4626. L.makeRequest({
  4627. _type: "unsubscribe",
  4628. _message: r
  4629. }),
  4630. void 0 !== e.pc && (e.pc.close(), e.pc = void 0),
  4631. e.onClose = void 0,
  4632. e._onAudioMute = void 0,
  4633. e._onAudioUnute = void 0,
  4634. e._onVideoMute = void 0,
  4635. e._onVideoUnmute = void 0,
  4636. delete e.subscribeOptions,
  4637. L.p2ps.delete(e.p2pId),
  4638. v.
  4639. default.info("[".concat(L.clientId, "] Unsubscribe stream success")),
  4640. t && t()
  4641. } else D(n, A.
  4642. default.NO_SUCH_REMOTE_STREAM)
  4643. },
  4644. L.setRemoteVideoStreamType = function(e, t) {
  4645. if (v.
  4646. default.debug("[".concat(L.clientId, "] Switching remote video stream ").concat(e.getId(), " to ").concat(t)), "object" === d()(e) && null !== e) if (L.state === R) {
  4647. if (!e.local) {
  4648. switch (t) {
  4649. case L.remoteVideoStreamTypes.REMOTE_VIDEO_STREAM_HIGH:
  4650. case L.remoteVideoStreamTypes.REMOTE_VIDEO_STREAM_LOW:
  4651. case L.remoteVideoStreamTypes.REMOTE_VIDEO_STREAM_MEDIUM:
  4652. break;
  4653. default:
  4654. return
  4655. }
  4656. var n = {
  4657. stream_id: e.getId(),
  4658. stream_type: t
  4659. };
  4660. L.makeRequest({
  4661. _type: "switch_video_stream",
  4662. _message: n
  4663. },
  4664. (function() {
  4665. v.
  4666. default.debug("SwitchVideoStream Success ".concat(n.stream_id, " ").concat(n.stream_type))
  4667. }), (function(e, t) {
  4668. v.
  4669. default.error("SwitchVideoStream Error ".concat(e, " ").concat(n.stream_id, " ").concat(n.stream_type), t)
  4670. }))
  4671. }
  4672. } else v.
  4673. default.error("[".concat(L.clientId, "] User is not in the session"));
  4674. else v.
  4675. default.error("[".concat(L.clientId, "] Invalid remote stream"))
  4676. },
  4677. L.renewToken = function(e, t, n) {
  4678. e ? L.key ? L.state !== R ? (v.
  4679. default.debug("[".concat(L.clientId, "] Client is not connected. Trying to rejoin")), L.key = e, L.rejoin(), t && t()) : (v.
  4680. default.debug("[".concat(L.clientId, "] renewToken from ").concat(L.key, " to ").concat(e)), L.makeRequest({
  4681. _type: "renew_token",
  4682. _message: {
  4683. token: e
  4684. }
  4685. },
  4686. t, n)) : (v.
  4687. default.error("[".concat(L.clientId, "] Client is previously joined without token")), n && n(A.
  4688. default.INVALID_PARAMETER)):
  4689. (v.
  4690. default.error("[".concat(L.clientId, "] Invalid Token ").concat(e)), n && n(A.
  4691. default.INVALID_PARAMETER))
  4692. },
  4693. L.setStreamFallbackOption = function(e, t) {
  4694. if (v.
  4695. default.debug("[".concat(L.clientId, "] Set stream fallback option ").concat(e.getId(), " to ").concat(t)), "object" === d()(e) && null !== e) if (L.state === R) {
  4696. if (!e.local) {
  4697. switch (t) {
  4698. case L.streamFallbackTypes.STREAM_FALLBACK_OPTION_DISABLED:
  4699. case L.streamFallbackTypes.STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW:
  4700. case L.streamFallbackTypes.STREAM_FALLBACK_OPTION_AUDIO_ONLY:
  4701. break;
  4702. default:
  4703. return
  4704. }
  4705. var n = {
  4706. stream_id: e.getId(),
  4707. fallback_type: t
  4708. };
  4709. L.makeRequest({
  4710. _type: "set_fallback_option",
  4711. _message: n
  4712. },
  4713. (function() {
  4714. v.
  4715. default.debug("SetStreamFallbackOption success ".concat(n.stream_id, " ").concat(t))
  4716. }), (function(e, r) {
  4717. v.
  4718. default.error("Failed to SetStreamFallbackOption ".concat(n.stream_id, " ").concat(t, " ").concat(e), r)
  4719. }))
  4720. }
  4721. } else v.
  4722. default.error("[".concat(L.clientId, "] User is not in the session"));
  4723. else v.
  4724. default.error("[".concat(L.clientId, "] Invalid remote stream"))
  4725. },
  4726. L.enableAudioVolumeIndicator = function(e, t) {
  4727. L.audioVolumeIndication.enabled = !0,
  4728. L.audioVolumeIndication.interval = e,
  4729. L.audioVolumeIndication.smooth = t,
  4730. L.resetAudioVolumeIndication()
  4731. },
  4732. L.resetAudioVolumeIndication = function() {
  4733. if (clearInterval(L.timers.audioVolumeIndication), clearInterval(L.timers.audioVolumeSampling), L.audioVolumeIndication.enabled && L.audioVolumeIndication.interval) {
  4734. var e = Math.floor(1e3 * L.audioVolumeIndication.smooth / 100);
  4735. clearInterval(L.timers.audioVolumeSampling),
  4736. L.timers.audioVolumeSampling = setInterval((function() {
  4737. L.audioVolumeSampling || (L.audioVolumeSampling = {});
  4738. var t = {};
  4739. for (var n in L.remoteStreams) {
  4740. var r = L.remoteStreams[n];
  4741. if (r.stream && r.hasAudio()) {
  4742. var i = r.getAudioLevel();
  4743. i > 0 && i < 1 && (i *= 100);
  4744. var o = L.audioVolumeSampling[n] || [];
  4745. for (o.push(i); o.length > e;) o.shift();
  4746. t[n] = o
  4747. }
  4748. }
  4749. L.audioVolumeSampling = t
  4750. }), 100),
  4751. clearInterval(L.timers.audioVolumeIndication),
  4752. L.timers.audioVolumeIndication = setInterval((function() {
  4753. if (L.socket && L.socket.signal && L.socket.signal.connection && L.socket.signal.connection.readyState === WebSocket.OPEN) {
  4754. var e = [];
  4755. for (var t in L.remoteStreams) if (L.audioVolumeSampling && L.audioVolumeSampling[t]) {
  4756. var n = L.audioVolumeSampling[t],
  4757. r = 0;
  4758. n.forEach((function(e) {
  4759. r += e
  4760. }));
  4761. var i = {
  4762. uid: t,
  4763. level: Math.floor(r / n.length)
  4764. };
  4765. i.level && e.push(i)
  4766. }
  4767. var o = e.sort((function(e, t) {
  4768. return e.level - t.level
  4769. }));
  4770. v.
  4771. default.debug("[".concat(L.clientId, "] volume-indicator "), JSON.stringify(o)),
  4772. L.audioVolumeIndication.sortedAudioVolumes = o;
  4773. var a = Object(m.a)({
  4774. type: "volume-indicator",
  4775. attr: o
  4776. });
  4777. L.dispatchEvent(a)
  4778. }
  4779. }), L.audioVolumeIndication.interval)
  4780. }
  4781. },
  4782. L.closeGateway = function() {
  4783. v.
  4784. default.debug("[".concat(L.clientId, "] close gateway")),
  4785. L.state = p,
  4786. L.socket.close(),
  4787. V()
  4788. },
  4789. L.startChannelMediaRelay = function() {
  4790. var e = s()(o.a.mark((function e(t) {
  4791. var n, r, i, a;
  4792. return o.a.wrap((function(e) {
  4793. for (;;) switch (e.prev = e.next) {
  4794. case 0:
  4795. if (!L.channelMediaRelayController) {
  4796. e.next = 2;
  4797. break
  4798. }
  4799. throw new P.ChannelMediaError("RELAY_ALREADY_START", "", P.CHANNEL_MEDIA_RELAY_ERROR.RELAY_ALREADY_START);
  4800. case 2:
  4801. return n = function(e) {
  4802. L.dispatchEvent({
  4803. type: "channel-media-relay-event",
  4804. code: e
  4805. })
  4806. },
  4807. r = function(e, t, n) {
  4808. e === P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE && t === P.CHANNEL_MEDIA_RELAY_ERROR.SERVER_CONNECTION_LOST && (L.channelMediaRelayController.dispose(), L.channelMediaRelayController = null),
  4809. L.dispatchEvent({
  4810. type: "channel-media-relay-state",
  4811. state: e,
  4812. code: t,
  4813. data: n
  4814. })
  4815. },
  4816. L.channelMediaRelayController = new U.a(L.joinInfo, L.clientId),
  4817. L.channelMediaRelayController.on("event", n),
  4818. L.channelMediaRelayController.on("state", r),
  4819. e.prev = 7,
  4820. e.next = 10,
  4821. L.channelMediaRelayController.startChannelMediaRelay(t);
  4822. case 10:
  4823. e.next = 22;
  4824. break;
  4825. case 12:
  4826. throw e.prev = 12,
  4827. e.t0 = e.
  4828. catch(7),
  4829. v.
  4830. default.debug("[".concat(L.clientId, "] startChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),
  4831. i = P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,
  4832. a = "",
  4833. a = e.t0 instanceof P.ChannelMediaError ? "SetSourceChannelStatus" === e.t0.data || e.t0.data && e.t0.data.serverResponse && "SetSourceChannel" === e.t0.data.serverResponse.command ? "FAILED_JOIN_SRC": "SetDestChannelStatus" === e.t0.data || e.t0.data && e.t0.data.serverResponse && "SetDestChannel" === e.t0.data.serverResponse.command ? "FAILED_JOIN_DEST": e.t0.data && e.t0.data.serverResponse && "StartPacketTransfer" === e.t0.data.serverResponse.command ? "FAILED_PACKET_SENT_TO_DEST": e.t0.message === P.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT || e.t0.message === P.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT ? "SERVER_NO_RESPONSE": e.t0.message === P.CHANNEL_MEDIA_ERROR.REQUEST_FAILED || e.t0.message === P.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR ? "SERVER_ERROR_RESPONSE": e.t0.message === P.CHANNEL_MEDIA_ERROR.AP_REQUEST_TIMEOUT ? "NO_RESOURCE_AVAILABLE": e.t0.message === P.CHANNEL_MEDIA_ERROR.WS_ABORT || e.t0.message === P.CHANNEL_MEDIA_ERROR.AP_REQUEST_ABORT ? "OPERATION_ABORT": "INTERNAL_ERROR": "INTERNAL_ERROR",
  4834. L.dispatchEvent({
  4835. type: "channel-media-relay-state",
  4836. state: i,
  4837. code: P.CHANNEL_MEDIA_RELAY_ERROR[a]
  4838. }),
  4839. L.channelMediaRelayController && (L.channelMediaRelayController.dispose(), L.channelMediaConfig = null, L.channelMediaRelayController = null),
  4840. L.dispatchEvent({
  4841. type: "channel-media-relay-state",
  4842. state: P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE
  4843. }),
  4844. new P.ChannelMediaError(a, null, P.CHANNEL_MEDIA_RELAY_ERROR[a]);
  4845. case 22:
  4846. L.dispatchEvent({
  4847. type:
  4848. "channel-media-relay-state",
  4849. state: P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_RUNNING,
  4850. code: P.CHANNEL_MEDIA_RELAY_ERROR.RELAY_OK
  4851. }),
  4852. L.channelMediaConfig = t;
  4853. case 24:
  4854. case "end":
  4855. return e.stop()
  4856. }
  4857. }), e, null, [[7, 12]])
  4858. })));
  4859. return function(t) {
  4860. return e.apply(this, arguments)
  4861. }
  4862. } (),
  4863. L.updateChannelMediaRelay = function() {
  4864. var t = s()(o.a.mark((function t(n) {
  4865. var r, i;
  4866. return o.a.wrap((function(t) {
  4867. for (;;) switch (t.prev = t.next) {
  4868. case 0:
  4869. if (L.channelMediaRelayController) {
  4870. t.next = 2;
  4871. break
  4872. }
  4873. throw new P.ChannelMediaError("RELAY_NOT_START", null, P.CHANNEL_MEDIA_RELAY_ERROR.RELAY_NOT_START);
  4874. case 2:
  4875. return t.prev = 2,
  4876. t.next = 5,
  4877. L.channelMediaRelayController.updateChannelMediaRelay(n);
  4878. case 5:
  4879. t.next = 18;
  4880. break;
  4881. case 7:
  4882. throw t.prev = 7,
  4883. t.t0 = t.
  4884. catch(2),
  4885. v.
  4886. default.debug("[".concat(L.clientId, "] updateChannelMediaRelay exception: ").concat(JSON.stringify(e))),
  4887. r = P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,
  4888. i = "",
  4889. i = e instanceof P.ChannelMediaError ? e.message === P.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT || e.message === P.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT ? "SERVER_NO_RESPONSE": e.message === P.CHANNEL_MEDIA_ERROR.REQUEST_FAILED || e.message === P.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR ? "SERVER_ERROR_RESPONSE": e.message === P.CHANNEL_MEDIA_ERROR.WS_ABORT || e.message === P.CHANNEL_MEDIA_ERROR.AP_REQUEST_ABORT ? "OPERATION_ABORT": "INTERNAL_ERROR": "INTERNAL_ERROR",
  4890. L.dispatchEvent({
  4891. type: "channel-media-relay-event",
  4892. code: P.CHANNEL_MEDIA_RELAY_EVENT.PACKET_UPDATE_DEST_CHANNEL_REFUSED
  4893. }),
  4894. L.dispatchEvent({
  4895. type: "channel-media-relay-state",
  4896. state: r,
  4897. code: P.CHANNEL_MEDIA_RELAY_ERROR[i]
  4898. }),
  4899. L.channelMediaRelayController && (L.channelMediaRelayController.dispose(), L.channelMediaConfig = null, L.channelMediaRelayController = null),
  4900. L.dispatchEvent({
  4901. type: "channel-media-relay-state",
  4902. state: P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE
  4903. }),
  4904. new P.ChannelMediaError(i, null, P.CHANNEL_MEDIA_RELAY_ERROR[i]);
  4905. case 18:
  4906. L.channelMediaConfig = n;
  4907. case 19:
  4908. case "end":
  4909. return t.stop()
  4910. }
  4911. }), t, null, [[2, 7]])
  4912. })));
  4913. return function(e) {
  4914. return t.apply(this, arguments)
  4915. }
  4916. } (),
  4917. L.stopChannelMediaRelay = s()(o.a.mark((function t() {
  4918. var n, r;
  4919. return o.a.wrap((function(t) {
  4920. for (;;) switch (t.prev = t.next) {
  4921. case 0:
  4922. if (L.channelMediaRelayController) {
  4923. t.next = 2;
  4924. break
  4925. }
  4926. throw new P.ChannelMediaError("RELAY_NOT_START", null, P.CHANNEL_MEDIA_RELAY_ERROR.RELAY_NOT_START);
  4927. case 2:
  4928. return t.prev = 2,
  4929. t.next = 5,
  4930. L.channelMediaRelayController.stopChannelMediaRelay();
  4931. case 5:
  4932. t.next = 17;
  4933. break;
  4934. case 7:
  4935. throw t.prev = 7,
  4936. t.t0 = t.
  4937. catch(2),
  4938. v.
  4939. default.debug("[".concat(L.clientId, "] stopChannelMediaRelay exception: ").concat(JSON.stringify(e))),
  4940. n = P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,
  4941. r = "",
  4942. r = e instanceof P.ChannelMediaError ? e.message === P.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT || e.message === P.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT ? "SERVER_NO_RESPONSE": e.message === P.CHANNEL_MEDIA_ERROR.REQUEST_FAILED || e.message === P.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR ? "SERVER_ERROR_RESPONSE": "INTERNAL_ERROR": "INTERNAL_ERROR",
  4943. L.dispatchEvent({
  4944. type: "channel-media-relay-state",
  4945. state: n,
  4946. code: P.CHANNEL_MEDIA_RELAY_ERROR[r]
  4947. }),
  4948. L.channelMediaRelayController && (L.channelMediaRelayController.dispose(), L.channelMediaConfig = null, L.channelMediaRelayController = null),
  4949. L.dispatchEvent({
  4950. type: "channel-media-relay-state",
  4951. state: P.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE
  4952. }),
  4953. new P.ChannelMediaError(r, null, P.CHANNEL_MEDIA_RELAY_ERROR[r]);
  4954. case 17:
  4955. L.channelMediaConfig = null,
  4956. L.channelMediaRelayController = null;
  4957. case 19:
  4958. case "end":
  4959. return t.stop()
  4960. }
  4961. }), t, null, [[2, 7]])
  4962. }))),
  4963. L.sendMetadata = function(e, t) {
  4964. L.makeRequest(function(e) {
  4965. return {
  4966. _type: "send_metadata",
  4967. _message: {
  4968. session_id: L.joinInfo.sid,
  4969. metadata: window.btoa(unescape(encodeURIComponent(e)))
  4970. }
  4971. }
  4972. } (e), (function() {
  4973. v.
  4974. default.debug("[".concat(L.clientId, '] send metadata "').concat(e, '" success')),
  4975. t && t(null)
  4976. }), (function(n) {
  4977. v.
  4978. default.error("[".concat(L.clientId, '] send metadata "').concat(e, '" failed'), n),
  4979. t && t(n)
  4980. }))
  4981. };
  4982. var x = function() {
  4983. v.
  4984. default.debug("[".concat(L.clientId, "] Reconnect gateway")),
  4985. L.state = p,
  4986. L.socket.close(),
  4987. V(),
  4988. L.reconnectMode = "recover",
  4989. L.state = S,
  4990. B()
  4991. };
  4992. L.recover = x;
  4993. var V = function() {
  4994. for (var e in L.dispatchEvent({
  4995. type: "before-clear-connection"
  4996. }), L.timers) L.timers.hasOwnProperty(e) && clearInterval(L.timers[e]);
  4997. for (var e in L.remoteStreams) if (L.remoteStreams.hasOwnProperty(e)) {
  4998. var t = L.remoteStreams[e],
  4999. n = Object(m.a)({
  5000. type: "stream-removed",
  5001. uid: t.getId(),
  5002. stream: t
  5003. });
  5004. L.dispatchEvent(n)
  5005. }
  5006. L.p2ps.clear(),
  5007. H(),
  5008. G(),
  5009. clearInterval(L.pingTimer)
  5010. };
  5011. L.rejoin = function() {
  5012. L.socket && (clearInterval(L.pingTimer), L.socket.close(), L.socket = void 0),
  5013. L.state = S,
  5014. B()
  5015. };
  5016. var B = function(e, t) {
  5017. L.dispatchEvent(Object(m.a)({
  5018. type: "rejoin-start"
  5019. })),
  5020. e = e ||
  5021. function(e) {
  5022. v.
  5023. default.info("[".concat(L.clientId, "] User ").concat(e, " is re-joined to ").concat(L.joinInfo.cname)),
  5024. L.dispatchEvent(Object(m.a)({
  5025. type: "rejoin"
  5026. })),
  5027. L.channelMediaConfig && L.startChannelMediaRelay(L.channelMediaConfig).then((function() {
  5028. v.
  5029. default.debug("[".concat(L.clientId, "] restartChannelMediaRelay success"))
  5030. })).
  5031. catch((function(e) {
  5032. v.
  5033. default.debug("[".concat(L.clientId, "] restartChannelMediaRelay failed: ").concat(JSON.stringify(e)))
  5034. })),
  5035. L.liveStreams && L.liveStreams.size && L.liveStreams.forEach((function(e, t) {
  5036. e && L.setLiveTranscoding(L.transcoding),
  5037. L.startLiveStreaming(t, e)
  5038. })),
  5039. L.injectLiveStreams && L.injectLiveStreams.size && L.injectLiveStreams.forEach((function(e, t) {
  5040. L.addInjectStreamUrl(t, e)
  5041. }))
  5042. },
  5043. t = t ||
  5044. function(e) {
  5045. v.
  5046. default.error("[".concat(L.clientId, "] Re-join to channel failed "), e),
  5047. L.dispatchEvent(Object(m.e)({
  5048. type: "error",
  5049. reason: e
  5050. }))
  5051. },
  5052. L.key ? (++L.rejoinAttempt, L.join(L.joinInfo, L.key, e, t)) : v.
  5053. default.error("[".concat(L.clientId, "] Connection recover failed [Invalid channel key]"))
  5054. },
  5055. F = function(e, t, n) {
  5056. if (L.onConnect = t, L.socket) {
  5057. if (L.dispatchEvent({
  5058. type: "reconnect"
  5059. }), "retry" === L.reconnectMode) v.
  5060. default.debug("[".concat(L.clientId, "] Retry current gateway")),
  5061. L.socket.reconnect();
  5062. else if ("tryNext" === L.reconnectMode) v.
  5063. default.debug("[".concat(L.clientId, "] Try next gateway")),
  5064. L.socket.connectNext();
  5065. else if ("recover" === L.reconnectMode) {
  5066. v.
  5067. default.debug("[".concat(L.clientId, "] Recover gateway")),
  5068. v.
  5069. default.debug("[".concat(L.clientId, "] Try to reconnect choose server and get gateway list again ")),
  5070. L.reconnectingCS = !0;
  5071. var i = L.joinInfo && L.joinInfo.sid;
  5072. 0,
  5073. Object(b.getGatewayList)(L.joinInfo, (function(e) {
  5074. v.
  5075. default.debug("[".concat(L.clientId, "] session: ").concat(i, " get gateway list success")),
  5076. L.joinInfo.apResponse = e.res,
  5077. L.reconnectingCS ? L.socket.replaceHost(e.gateway_addr) : v.
  5078. default.debug("[".concat(L.clientId, "] session: ").concat(i, " already leave"))
  5079. }))
  5080. }
  5081. } else o = e.gatewayAddr,
  5082. L.socket = T(o, {
  5083. sid: L.joinInfo.sid,
  5084. clientId: L.clientId
  5085. }),
  5086. L.socket.on("start-connection", (function(e) {
  5087. L.ticket = e && e.msg && e.msg.ticket
  5088. })),
  5089. L.socket.on("on_uplink_stats", (function(e) {
  5090. var t = {};
  5091. for (var n in e) t[M(n)] = e[n];
  5092. if (L.OutgoingAvailableBandwidth = t.uplink_available_bandwidth, L.localStreams[L.uid]) {
  5093. var r = L.localStreams[L.uid].uplinkStats;
  5094. r && r.period_fir === t.period_fir || v.
  5095. default.debug("[".concat(L.clientId, "]: Period fir change to: ").concat(t.period_fir)),
  5096. L.localStreams[L.uid].uplinkStats = t
  5097. }
  5098. })),
  5099. L.socket.on("connect", (function() {
  5100. L.dispatchEvent({
  5101. type: "connected"
  5102. }),
  5103. L.attemps = 1,
  5104. L.onConnect()
  5105. })),
  5106. L.socket.on("recover", (function() {
  5107. L.state = S,
  5108. v.
  5109. default.debug("[".concat(L.clientId, "] Try to reconnect choose server and get gateway list again ")),
  5110. L.reconnectingCS = !0;
  5111. var e = L.joinInfo && L.joinInfo.sid;
  5112. Object(b.getGatewayList)(L.joinInfo, (function(t) {
  5113. v.
  5114. default.debug("[".concat(L.clientId, "] session: ").concat(e, " get gateway list success")),
  5115. L.reconnectingCS ? L.socket.replaceHost(t.gateway_addr) : v.
  5116. default.debug("[".concat(L.clientId, "] session: ").concat(e, " already leave"))
  5117. }))
  5118. })),
  5119. L.socket.on("disconnect", (function(e) {
  5120. if (v.
  5121. default.debug("[".concat(L.clientId, "] Receive disconnect message")), L.state !== p) {
  5122. L.state = p;
  5123. var t = Object(m.e)({
  5124. type: "error",
  5125. reason: A.
  5126. default.SOCKET_DISCONNECTED
  5127. });
  5128. if (L.dispatchEvent(t), 0 === L.p2ps.size ? L.reconnectMode = "tryNext": L.reconnectMode = "retry", V(), L.channelMediaRelayController && L.channelMediaRelayController.dispose(), L.channelMediaRelayController = null, 1 != r) {
  5129. var n, i = (n = L.attemps, 1e3 * Math.min(30, Math.pow(2, n) - 1));
  5130. if (v.
  5131. default.error("[".concat(L.clientId, "] Disconnect from server [").concat(JSON.stringify(e), "], attempt to recover [#").concat(L.attemps, "] after ").concat(i / 1e3, " seconds")), L.hasInvokeLeave) return v.
  5132. default.debug("[".concat(L.clientId, "] No reconnection because Client.leave has been invoked")),
  5133. void(L.hasInvokeLeave = !1);
  5134. setTimeout((function() {
  5135. L.attemps++,
  5136. L.state = S,
  5137. L.inChannelInfo && Date.now() - L.inChannelInfo.joinAt > Object(y.getParameter)("TICKET_RENEW_TIMEOUT") ? (v.
  5138. default.debug("Recovering to renew ticket"), x()) : B()
  5139. }), i)
  5140. }
  5141. }
  5142. })),
  5143. L.socket.on("on_add_audio_stream", (function(e) {
  5144. if (v.
  5145. default.info("[".concat(L.clientId, "] Newly added audio stream with uid ").concat(e.uid)), L.joinInfo.stringUid && "string" != typeof e.uid && v.
  5146. default.error("StringUID is Mixed with UintUID"), L.remoteStreamsInChannel.has(e.uid) || L.remoteStreamsInChannel.add(e.uid), void 0 === L.remoteStreams[e.uid]) {
  5147. var t = Object(g.a)({
  5148. streamID: e.uid,
  5149. local: !1,
  5150. audio: e.audio,
  5151. video: e.video,
  5152. uintUID: e.uint_id || e.uid
  5153. });
  5154. t.peerMuteVideo = !0,
  5155. L.remoteStreams[e.uid] = t;
  5156. var n = Object(m.e)({
  5157. type: "stream-added",
  5158. stream: t
  5159. });
  5160. L.dispatchEvent(n);
  5161. var r = L.remoteMuteState[e.uid];
  5162. if (r && r.audio) {
  5163. n = Object(m.a)({
  5164. type: "mute-audio",
  5165. uid: e.uid
  5166. });
  5167. L.dispatchEvent(n)
  5168. }
  5169. if (r && r.video) {
  5170. n = Object(m.a)({
  5171. type: "mute-video",
  5172. uid: e.uid
  5173. });
  5174. L.dispatchEvent(n)
  5175. }
  5176. }
  5177. E.report.onAddAudioStream(L.joinInfo.sid, {
  5178. peerid: e.uint_id || e.uid,
  5179. uid: L.uid
  5180. })
  5181. })),
  5182. L.socket.on("on_update_stream", (function(e) {
  5183. var t = L.remoteStreams[e.uid];
  5184. if (L.joinInfo.stringUid && "string" != typeof e.uid && v.
  5185. default.error("StringUID is Mixed with UintUID"), t) {
  5186. t.audio = e.audio,
  5187. t.video = e.video,
  5188. t.screen = e.screen,
  5189. t.pc && L._adjustPCMuteStatus(t);
  5190. var n = Object(m.e)({
  5191. type: "stream-updated",
  5192. stream: t
  5193. });
  5194. L.dispatchEvent(n)
  5195. } else v.
  5196. default.debug("[".concat(L.clientId, "] Ignoring onUpdateStream event before onAddStream for uid ").concat(e.uid));
  5197. E.report.onUpdateStream(L.joinInfo.sid, {
  5198. peerid: e.uint_id || e.uid,
  5199. audio: e.audio,
  5200. video: e.video,
  5201. uid: L.uid
  5202. })
  5203. })),
  5204. L.socket.on("on_add_video_stream", (function(e) {
  5205. if (v.
  5206. default.info("[".concat(L.clientId, "] Newly added remote stream with uid ").concat(e.uid, ".")), L.joinInfo.stringUid && "string" != typeof e.uid && v.
  5207. default.error("StringUID is Mixed with UintUID"), L.remoteStreamsInChannel.has(e.uid) || L.remoteStreamsInChannel.add(e.uid), void 0 === L.remoteStreams[e.uid]) {
  5208. var t = Object(g.a)({
  5209. streamID: e.uid,
  5210. local: !1,
  5211. audio: e.audio,
  5212. video: e.video,
  5213. uintUID: e.uint_id || e.uid
  5214. });
  5215. L.remoteStreams[e.uid] = t;
  5216. var n = Object(m.e)({
  5217. type: "stream-added",
  5218. stream: t
  5219. });
  5220. L.dispatchEvent(n);
  5221. var r = L.remoteMuteState[e.uid];
  5222. if (r && r.audio) {
  5223. n = Object(m.a)({
  5224. type: "mute-audio",
  5225. uid: e.uid
  5226. });
  5227. L.dispatchEvent(n)
  5228. }
  5229. if (r && r.video) {
  5230. n = Object(m.a)({
  5231. type: "mute-video",
  5232. uid: e.uid
  5233. });
  5234. L.dispatchEvent(n)
  5235. }
  5236. } else {
  5237. var i = L.remoteStreams[e.uid];
  5238. if (i.video = !0, i.peerMuteVideo = !1, i.pc && L._adjustPCMuteStatus(i), v.
  5239. default.info("[".concat(L.clientId, "] Stream changed: enable video ").concat(e.uid)), void 0 !== i.stream && i.isPlaying()) {
  5240. var o = i.player.elementID;
  5241. i.stop(),
  5242. i.play(o, i.playOptions)
  5243. }
  5244. }
  5245. E.report.onAddVideoStream(L.joinInfo.sid, {
  5246. peerid: e.uint_id || e.uid,
  5247. uid: L.uid
  5248. })
  5249. })),
  5250. L.socket.on("on_remove_stream", (function(e) {
  5251. L.remoteStreamsInChannel.has(e.uid) && L.remoteStreamsInChannel.delete(e.uid);
  5252. var t = L.remoteStreams[e.uid];
  5253. if (t) {
  5254. delete L.remoteStreams[e.uid],
  5255. delete L.remoteMuteState[e.uid];
  5256. var n = Object(m.e)({
  5257. type: "stream-removed",
  5258. stream: t
  5259. });
  5260. L.dispatchEvent(n),
  5261. t.close(),
  5262. void 0 !== t.pc && (t.pc.close(), t.pc = void 0, L.p2ps.delete(t.p2pId)),
  5263. E.report.onRemoveStream(L.joinInfo.sid, {
  5264. peerid: e.uint_id || e.uid,
  5265. uid: L.uid
  5266. })
  5267. } else v.
  5268. default.error("ERROR stream ", e.uid, " not found onRemoveStream ", e)
  5269. })),
  5270. L.socket.on("on_publish_stream", (function(e) {
  5271. var t = L.localStreams[e.uid],
  5272. n = Object(m.e)({
  5273. type: "streamPublished",
  5274. stream: t
  5275. });
  5276. L.dispatchEvent(n)
  5277. })),
  5278. L.socket.on("mute_audio", (function(e) {
  5279. v.
  5280. default.info("[".concat(L.clientId, "] rcv peer mute audio: ").concat(e.uid)),
  5281. L.remoteMuteState[e.uid] = L.remoteMuteState[e.uid] || {
  5282. audio: !1,
  5283. video: !1
  5284. },
  5285. L.remoteMuteState[e.uid].audio = !0;
  5286. var t = Object(m.a)({
  5287. type: "mute-audio",
  5288. uid: e.uid
  5289. }),
  5290. n = L.remoteStreams[e.uid];
  5291. n ? (n.peerMuteAudio = !0, n.pc && L._adjustPCMuteStatus(n), L.dispatchEvent(t)) : v.
  5292. default.debug("Ignoring event ".concat(e.type), e)
  5293. })),
  5294. L.socket.on("unmute_audio", (function(e) {
  5295. v.
  5296. default.info("[".concat(L.clientId, "] rcv peer unmute audio: ").concat(e.uid)),
  5297. L.remoteMuteState[e.uid] = L.remoteMuteState[e.uid] || {
  5298. audio: !1,
  5299. video: !1
  5300. },
  5301. L.remoteMuteState[e.uid].audio = !1;
  5302. var t = Object(m.a)({
  5303. type: "unmute-audio",
  5304. uid: e.uid
  5305. }),
  5306. n = L.remoteStreams[e.uid];
  5307. n ? (n.peerMuteAudio = !1, n.pc && L._adjustPCMuteStatus(n), L.dispatchEvent(t)) : v.
  5308. default.debug("Ignoring event ".concat(e.type), e)
  5309. })),
  5310. L.socket.on("mute_video", (function(e) {
  5311. v.
  5312. default.info("[".concat(L.clientId, "] rcv peer mute video: ").concat(e.uid)),
  5313. L.remoteMuteState[e.uid] = L.remoteMuteState[e.uid] || {
  5314. audio: !1,
  5315. video: !1
  5316. },
  5317. L.remoteMuteState[e.uid].video = !0;
  5318. var t = Object(m.a)({
  5319. type: "mute-video",
  5320. uid: e.uid
  5321. }),
  5322. n = L.remoteStreams[e.uid];
  5323. n ? (n.peerMuteVideo = !0, n.pc && L._adjustPCMuteStatus(n), L.dispatchEvent(t)) : v.
  5324. default.debug("Ignoring event ".concat(e.type), e)
  5325. })),
  5326. L.socket.on("unmute_video", (function(e) {
  5327. v.
  5328. default.info("[".concat(L.clientId, "] rcv peer unmute video: ").concat(e.uid)),
  5329. L.remoteMuteState[e.uid] = L.remoteMuteState[e.uid] || {
  5330. audio: !1,
  5331. video: !1
  5332. },
  5333. L.remoteMuteState[e.uid].video = !1;
  5334. var t = Object(m.a)({
  5335. type: "unmute-video",
  5336. uid: e.uid
  5337. }),
  5338. n = L.remoteStreams[e.uid];
  5339. n ? (n.peerMuteVideo = !1, n.pc && L._adjustPCMuteStatus(n), L.dispatchEvent(t)) : v.
  5340. default.debug("Ignoring event ".concat(e.type), e)
  5341. })),
  5342. L.socket.on("on_crypt_error", (function(e) {
  5343. v.
  5344. default.warning("[".concat(L.clientId, "] stream crypt error"));
  5345. var t = Object(m.a)({
  5346. type: "crypt-error",
  5347. cryptType: e.crypt_type
  5348. });
  5349. L.dispatchEvent(t)
  5350. })),
  5351. L.socket.on("on_user_banned", (function(e) {
  5352. v.
  5353. default.info("[".concat(L.clientId, "] user banned uid: ").concat(e.uid, " error: ").concat(e.error_code));
  5354. var t = Object(m.a)({
  5355. type: "client-banned",
  5356. uid: e.uid,
  5357. attr: e.error_code
  5358. });
  5359. L.dispatchEvent(t),
  5360. r = !0
  5361. })),
  5362. L.socket.on("on_stream_fallback_update", (function(e) {
  5363. v.
  5364. default.info("[".concat(L.clientId, "] stream fallback peerId: ").concat(e.stream_id, " type: ").concat(e.stream_type));
  5365. var t = Object(m.a)({
  5366. type: "stream-fallback",
  5367. uid: e.stream_id,
  5368. stream: e.stream_id,
  5369. attr: e.stream_type
  5370. });
  5371. L.dispatchEvent(t)
  5372. })),
  5373. L.socket.on("stream_recover", (function(e) {
  5374. v.
  5375. default.info("[".concat(L.clientId, "] stream recover uid: ").concat(e.id, " peerId: ").concat(e.peerid, " type: ").concat(e.type));
  5376. var t = Object(m.a)({
  5377. type: "stream-recover",
  5378. uid: e.id,
  5379. stream: e.peerid,
  5380. attr: e.type
  5381. });
  5382. L.dispatchEvent(t)
  5383. })),
  5384. L.socket.on("on_p2p_lost", (function(e) {
  5385. v.
  5386. default.debug("[".concat(L.clientId, "] p2plost: "), e, "p2ps:", L.p2ps);
  5387. var t, n = "DTLS failed"; (t = L.localStreams[e.uid] || L.remoteStreams[e.uid]) ? (t.pc && t.pc.offerCandidates && 0 === t.pc.offerCandidates.length && (n = "NO_CANDIDATES_IN_OFFER"), "publish" === e.event && E.report.publish(L.joinInfo.sid, {
  5388. lts: t.publishLTS,
  5389. succ: !1,
  5390. audio: t.hasAudio(),
  5391. video: t.hasVideo(),
  5392. screenshare: t.hasScreen(),
  5393. audioName: t.hasAudio() && t.audioName,
  5394. videoName: t.hasVideo() && t.videoName,
  5395. screenName: t.hasScreen() && t.screenName,
  5396. ec: n,
  5397. publishRequestid: L.publishRequestId || 0,
  5398. p2pid: L.p2ps.get(t.getId())
  5399. }), "subscribe" === e.event && E.report.subscribe(L.joinInfo.sid, {
  5400. lts: t.subscribeLTS,
  5401. succ: !1,
  5402. video: t.subscribeOptions && t.subscribeOptions.video,
  5403. audio: t.subscribeOptions && t.subscribeOptions.audio,
  5404. peerid: e.uid + "",
  5405. ec: n,
  5406. subscribeRequestid: L.subscribeRequestId.get(t.getId()) || 0,
  5407. p2pid: L.p2ps.get(t.getId())
  5408. })) : v.
  5409. default.warning("P2PLost Stream Not found", e),
  5410. v.
  5411. default.debug("[".concat(L.clientId, "] p2plost:"), e.p2pid),
  5412. (t = L.p2ps.get(e.p2pid)) && (L.p2ps.delete(e.p2pid), t.local ? L.dispatchEvent(Object(m.a)({
  5413. type: "pubP2PLost",
  5414. stream: t,
  5415. attr: n
  5416. })) : L.remoteStreams[t.getId()] && L.dispatchEvent(Object(m.a)({
  5417. type: "subP2PLost",
  5418. stream: t,
  5419. attr: n
  5420. })))
  5421. })),
  5422. L.socket.on("on_token_privilege_will_expire", (function(e) {
  5423. v.
  5424. default.debug("[".concat(L.clientId, "] Received Message onTokenPrivilegeWillExpire")),
  5425. L.dispatchEvent(Object(m.a)({
  5426. type: "onTokenPrivilegeWillExpire"
  5427. }))
  5428. })),
  5429. L.socket.on("on_token_privilege_did_expire", (function() {
  5430. v.
  5431. default.warning("[".concat(L.clientId, "] Received Message onTokenPrivilegeDidExpire, please get new token and join again")),
  5432. L.closeGateway(),
  5433. L.dispatchEvent(Object(m.a)({
  5434. type: "onTokenPrivilegeDidExpire"
  5435. }))
  5436. })),
  5437. L.socket.on("enable_local_video", (function(e) {
  5438. L.dispatchEvent(Object(m.a)({
  5439. type: "enable-local-video",
  5440. uid: e.uid
  5441. }))
  5442. })),
  5443. L.socket.on("disable_local_video", (function(e) {
  5444. L.dispatchEvent(Object(m.a)({
  5445. type: "disable-local-video",
  5446. uid: e.uid
  5447. }))
  5448. })),
  5449. L._doWithAction = function(e, t, n) {
  5450. "tryNext" === e ?
  5451. function(e, t) {
  5452. v.
  5453. default.debug("[".concat(L.clientId, "] Connect next gateway")),
  5454. L.state = p,
  5455. L.socket.close(),
  5456. V(),
  5457. L.reconnectMode = "tryNext",
  5458. L.state = S,
  5459. B(e, t)
  5460. } (t, n) : "retry" === e ?
  5461. function(e, t) {
  5462. v.
  5463. default.debug("[".concat(L.clientId, "] Reconnect gateway")),
  5464. L.state = p,
  5465. L.socket.close(),
  5466. V(),
  5467. L.reconnectMode = "retry",
  5468. L.state = S,
  5469. B(e, t)
  5470. } (t, n) : "quit" === e ? (v.
  5471. default.debug("[".concat(L.clientId, "] quit gateway")), L.state = p, L.socket.close(), V()) : "recover" === e && x()
  5472. },
  5473. L.socket.on("on_notification", (function(e) {
  5474. if(e.detail === "ERR_REPEAT_JOIN") {
  5475. var t = l({
  5476. type: "client-banned",
  5477. uid: e.uid,
  5478. attr: "onMultiIP"
  5479. });
  5480. L.dispatchEvent(t)
  5481. }
  5482. if (v.
  5483. default.debug("[".concat(L.clientId, "] Receive notification: "), e), "ERR_JOIN_BY_MULTI_IP" === A.GatewayErrorCode[e.code]) return L.dispatchEvent({
  5484. type: "onMultiIP",
  5485. option: e.option
  5486. });
  5487. e.detail ? L._doWithAction(C[A.GatewayErrorCode[e.code]]) : e.action && L._doWithAction(e.action)
  5488. })),
  5489. L.socket.on("on_user_offline", (function(e) {
  5490. var t = Object(m.a)({
  5491. type: "peer-leave",
  5492. uid: e.uid
  5493. });
  5494. if (L.remoteStreamsInChannel.has(e.uid) && L.remoteStreamsInChannel.delete(e.uid), L.remoteStreams.hasOwnProperty(e.uid) && (t.stream = L.remoteStreams[e.uid]), t.reason = e.reason, L.dispatchEvent(t), L.remoteStreams.hasOwnProperty(e.uid)) {
  5495. v.
  5496. default.info("[".concat(L.clientId, "] closing stream on peer leave"), e.uid);
  5497. var n = L.remoteStreams[e.uid];
  5498. n.close(),
  5499. delete L.remoteStreams[e.uid],
  5500. delete L.remoteMuteState[e.uid],
  5501. E.report.onRemoveStream(L.joinInfo.sid, {
  5502. peerid: e.uint_id || e.uid,
  5503. uid: L.uid
  5504. }),
  5505. void 0 !== n.pc && (n.pc.close(), n.pc = void 0, L.p2ps.delete(n.p2pId))
  5506. }
  5507. L.timers.hasOwnProperty(e.uid) && (clearInterval(L.timers[e.uid]), clearInterval(L.timers[e.uid] + "_RelatedStats"), delete L.timers[e.uid]),
  5508. null != L.audioLevel[e.uid] && delete L.audioLevel[e.uid],
  5509. null != L.timer_counter[e.uid] && delete L.timer_counter[e.uid]
  5510. })),
  5511. L.socket.on("onUplinkStats", (function(e) {})),
  5512. L.socket.on("liveStreamingStarted", (function(e) {
  5513. var t = Object(m.c)({
  5514. type: "liveStreamingStarted",
  5515. url: e.url
  5516. });
  5517. L.dispatchEvent(t)
  5518. })),
  5519. L.socket.on("liveStreamingFailed", (function(e) {
  5520. var t = Object(m.c)({
  5521. type: "liveStreamingFailed",
  5522. url: e.url
  5523. });
  5524. L.dispatchEvent(t)
  5525. })),
  5526. L.socket.on("liveStreamingStopped", (function(e) {
  5527. var t = Object(m.c)({
  5528. type: "liveStreamingStopped",
  5529. url: e.url
  5530. });
  5531. L.dispatchEvent(t)
  5532. })),
  5533. L.socket.on("liveTranscodingUpdated", (function(e) {
  5534. var t = Object(m.c)({
  5535. type: "liveTranscodingUpdated",
  5536. reason: e.reason
  5537. });
  5538. L.dispatchEvent(t)
  5539. })),
  5540. L.socket.on("streamInjectedStatus", (function(e) {
  5541. var t = Object(m.c)({
  5542. type: "streamInjectedStatus",
  5543. url: e.url,
  5544. uid: e.uid,
  5545. status: e.status
  5546. });
  5547. L.dispatchEvent(t)
  5548. })),
  5549. L.socket.on("on_user_online", (function(e) {
  5550. L.joinInfo.stringUid && "string" != typeof e.uid && v.
  5551. default.error("StringUID is Mixed with UintUID"),
  5552. L.dispatchEvent({
  5553. type: "peer-online",
  5554. uid: e.uid
  5555. })
  5556. })),
  5557. L.socket.on("receive_metadata", (function(e) {
  5558. L.joinInfo.stringUid && "string" != typeof e.uid && v.
  5559. default.error("StringUID is Mixed with UintUID");
  5560. var t = decodeURIComponent(escape(window.atob(e.metadata)));
  5561. v.
  5562. default.debug("[".concat(L.clientId, "] received ").concat(e.uid, " metadata: ").concat(t)),
  5563. L.dispatchEvent({
  5564. type: "receive-metadata",
  5565. uid: e.uid,
  5566. metadata: t
  5567. })
  5568. }));
  5569. var o
  5570. }, W = function(e, t) {
  5571. if (void 0 !== L.socket) try {
  5572. L.socket.emitSimpleMessage(e, (function(e, n) {
  5573. t && t(e, n)
  5574. }))
  5575. } catch(e) {
  5576. v.
  5577. default.error("[".concat(L.clientId, "] Error in sendSimpleSdp [").concat(e, "]"))
  5578. } else v.
  5579. default.error("[".concat(L.clientId, "] Error in sendSimpleSdp [socket not ready]"))
  5580. },
  5581. G = function() {
  5582. for (var e in L.localStreams) if (void 0 !== L.localStreams[e]) {
  5583. var t = L.localStreams[e];
  5584. delete L.localStreams[e],
  5585. void 0 !== t.pc && (t.pc.close(), t.pc = void 0)
  5586. }
  5587. },
  5588. H = function() {
  5589. for (var e in L.remoteStreamsInChannel.clear(), L.remoteStreams) if (L.remoteStreams.hasOwnProperty(e)) {
  5590. var t = L.remoteStreams[e];
  5591. t.isPlaying() && t.stop(),
  5592. t.close(),
  5593. delete L.remoteStreams[e],
  5594. void 0 !== t.pc && (t.pc.close(), t.pc = void 0)
  5595. }
  5596. };
  5597. return L
  5598. },
  5599. j = {
  5600. _gatewayClients: {},
  5601. register: function(e, t) {
  5602. if (!t.uid) {
  5603. var n = "NO_UID_PROVIDED";
  5604. return v.
  5605. default.error("[".concat(e.clientId, "] "), n, t),
  5606. n
  5607. }
  5608. if (t.cname) {
  5609. if (this._gatewayClients[t.cname] && this._gatewayClients[t.cname][t.uid] && this._gatewayClients[t.cname][t.uid] !== e) {
  5610. n = "UID_CONFLICT";
  5611. return v.
  5612. default.error("[".concat(e.clientId, "] "), n, t),
  5613. n
  5614. }
  5615. return v.
  5616. default.debug("[".concat(e.clientId, "] register client Channel"), t.cname, "Uid", t.uid),
  5617. this._gatewayClients[t.cname] || (this._gatewayClients[t.cname] = {}),
  5618. this._gatewayClients[t.cname][t.uid] = e,
  5619. null
  5620. }
  5621. var n = "NO_CHANNEL_PROVIDED";
  5622. return v.
  5623. default.error("[".concat(e.clientId, "] "), n, t),
  5624. n
  5625. },
  5626. unregister: function(e) {
  5627. var t = e && e.uid,
  5628. n = e.joinInfo && e.joinInfo.cname;
  5629. if (!t || !n) {
  5630. var r = "INVALID_GATEWAYCLIENT";
  5631. return v.
  5632. default.error("[".concat(e.clientId, "] "), r),
  5633. r
  5634. }
  5635. if (this._gatewayClients[n] && this._gatewayClients[n][t]) {
  5636. if (this._gatewayClients[n][t] !== e) {
  5637. r = "GATEWAYCLIENT_UID_CONFLICT";
  5638. return v.
  5639. default.error("[".concat(e.clientId, "] "), r),
  5640. r
  5641. }
  5642. return v.
  5643. default.debug("[".concat(e.clientId, "] unregister client "), e.uid),
  5644. delete this._gatewayClients[n][t],
  5645. null
  5646. }
  5647. var r = "GATEWEAY_CLIENT_UNREGISTERED";
  5648. v.
  5649. default.error("[".concat(e.clientId, "] "), r)
  5650. }
  5651. };
  5652. x.DISCONNECTED = 0,
  5653. x.CONNECTING = 1,
  5654. x.CONNECTED = 2,
  5655. x.DISCONNECTING = 3,
  5656. x.connetionStateMap = {
  5657. 0 : "DISCONNECTED",
  5658. 1 : "CONNECTING",
  5659. 2 : "CONNECTED",
  5660. 3 : "DISCONNECTING"
  5661. };
  5662. n.a = x
  5663. },
  5664. function(e, t, n) {
  5665. e.exports = n(62)
  5666. },
  5667. function(e, t, n) {
  5668. "use strict";
  5669. n.r(t),
  5670. n.d(t, "post", (function() {
  5671. return u
  5672. })),
  5673. n.d(t, "shouldUseHttps", (function() {
  5674. return l
  5675. })),
  5676. n.d(t, "getHTTPSendBytes", (function() {
  5677. return s
  5678. })),
  5679. n.d(t, "getHTTPRecvBytes", (function() {
  5680. return c
  5681. })),
  5682. n.d(t, "resetHTTPByetsCount", (function() {
  5683. return d
  5684. }));
  5685. var r = n(3),
  5686. i = n(10),
  5687. o = 0,
  5688. a = 0,
  5689. s = function() {
  5690. return o
  5691. },
  5692. c = function() {
  5693. return a
  5694. },
  5695. d = function() {
  5696. o = 0,
  5697. a = 0
  5698. },
  5699. u = function(e, t, n, s, c) {
  5700. var d = new XMLHttpRequest;
  5701. if (d.timeout = t.timeout || Object(r.getParameter)("HTTP_CONNECT_TIMEOUT"), d.open("POST", e, !0), d.setRequestHeader("Content-type", "application/json; charset=utf-8"), c) for (var u in c)"withCredentials" == u ? d.withCredentials = !0 : d.setRequestHeader(u, c[u]);
  5702. d.onload = function(e) {
  5703. a += Object(i.lengthInUtf8Bytes)(d.responseText),
  5704. n && n(d.responseText)
  5705. },
  5706. d.onerror = function(t) {
  5707. s && s(t, e)
  5708. },
  5709. d.ontimeout = function(t) {
  5710. s && s(t, e)
  5711. };
  5712. var l = JSON.stringify(t);
  5713. o += Object(i.lengthInUtf8Bytes)(l),
  5714. d.send(l)
  5715. },
  5716. l = function() {
  5717. return "https:" == document.location.protocol
  5718. }
  5719. },
  5720. function(e, t, n) {
  5721. "use strict";
  5722. n.r(t),
  5723. n.d(t, "RTCPeerConnection", (function() {
  5724. return T
  5725. })),
  5726. n.d(t, "getUserMedia", (function() {
  5727. return a
  5728. })),
  5729. n.d(t, "attachMediaStream", (function() {
  5730. return s
  5731. })),
  5732. n.d(t, "reattachMediaStream", (function() {
  5733. return c
  5734. })),
  5735. n.d(t, "setSrcObject", (function() {
  5736. return f
  5737. })),
  5738. n.d(t, "getSrcObject", (function() {
  5739. return g
  5740. })),
  5741. n.d(t, "webrtcDetectedBrowser", (function() {
  5742. return d
  5743. })),
  5744. n.d(t, "webrtcDetectedVersion", (function() {
  5745. return u
  5746. })),
  5747. n.d(t, "webrtcMinimumVersion", (function() {
  5748. return l
  5749. })),
  5750. n.d(t, "webrtcTesting", (function() {
  5751. return I
  5752. })),
  5753. n.d(t, "webrtcUtils", (function() {
  5754. return v
  5755. }));
  5756. var r = n(11),
  5757. i = n.n(r),
  5758. o = n(4),
  5759. a = null,
  5760. s = null,
  5761. c = null,
  5762. d = null,
  5763. u = null,
  5764. l = null,
  5765. p = null,
  5766. f = null,
  5767. g = null,
  5768. m = null,
  5769. h = {
  5770. addStream: null
  5771. },
  5772. v = {
  5773. log: function() {},
  5774. extractVersion: function(e, t, n) {
  5775. var r = e.match(t);
  5776. return r && r.length >= n && parseInt(r[n])
  5777. }
  5778. };
  5779. if ("object" == ("undefined" == typeof window ? "undefined": i()(window)) ? (window.HTMLMediaElement && !("srcObject" in window.HTMLMediaElement.prototype) ? (f = function(e, t) {
  5780. "mozSrcObject" in e ? e.mozSrcObject = t: (e._srcObject = t, e.src = t ? URL.createObjectURL(t) : null)
  5781. },
  5782. g = function(e) {
  5783. return "mozSrcObject" in e ? e.mozSrcObject: e._srcObject
  5784. }) : (f = function(e, t) {
  5785. e.srcObject = t
  5786. },
  5787. g = function(e) {
  5788. return e.srcObject
  5789. }), a = window.navigator && window.navigator.getUserMedia) : (f = function(e, t) {
  5790. e.srcObject = t
  5791. },
  5792. g = function(e) {
  5793. return e.srcObject
  5794. }), s = function(e, t) {
  5795. f(e, t)
  5796. },
  5797. c = function(e, t) {
  5798. f(e, g(t))
  5799. },
  5800. "undefined" != typeof window && window.navigator) if (navigator.mozGetUserMedia && window.mozRTCPeerConnection) {
  5801. for (var E in v.log("This appears to be Firefox"), d = "firefox", u = v.extractVersion(navigator.userAgent, /Firefox\/([0-9]+)\./, 1), l = 31, m = mozRTCPeerConnection, h) h[E] = m.prototype[E];
  5802. if (p = function(e, t) {
  5803. if (u < 38 && e && e.iceServers) {
  5804. for (var n = [], r = 0; r < e.iceServers.length; r++) {
  5805. var i = e.iceServers[r];
  5806. if (i.hasOwnProperty("urls")) for (var o = 0; o < i.urls.length; o++) {
  5807. var a = {
  5808. url: i.urls[o]
  5809. };
  5810. 0 === i.urls[o].indexOf("turn") && (a.username = i.username, a.credential = i.credential),
  5811. n.push(a)
  5812. } else n.push(e.iceServers[r])
  5813. }
  5814. e.iceServers = n
  5815. }
  5816. var s = new m(e, t);
  5817. for (var c in h) s[c] = h[c];
  5818. return s
  5819. },
  5820. window.RTCSessionDescription || (window.RTCSessionDescription = mozRTCSessionDescription), window.RTCIceCandidate || (window.RTCIceCandidate = mozRTCIceCandidate), a = function(e, t, n) {
  5821. var r = function(e) {
  5822. if ("object" !== i()(e) || e.require) return e;
  5823. var t = [];
  5824. return Object.keys(e).forEach((function(n) {
  5825. if ("require" !== n && "advanced" !== n && "mediaSource" !== n) {
  5826. var r = e[n] = "object" === i()(e[n]) ? e[n] : {
  5827. ideal: e[n]
  5828. };
  5829. if (void 0 === r.min && void 0 === r.max && void 0 === r.exact || t.push(n), void 0 !== r.exact && ("number" == typeof r.exact ? r.min = r.max = r.exact: e[n] = r.exact, delete r.exact), void 0 !== r.ideal) {
  5830. e.advanced = e.advanced || [];
  5831. var o = {};
  5832. "number" == typeof r.ideal ? o[n] = {
  5833. min: r.ideal,
  5834. max: r.ideal
  5835. }: o[n] = r.ideal,
  5836. e.advanced.push(o),
  5837. delete r.ideal,
  5838. Object.keys(r).length || delete e[n]
  5839. }
  5840. }
  5841. })),
  5842. t.length && (e.require = t),
  5843. e
  5844. };
  5845. return u < 38 && (v.log("spec: " + JSON.stringify(e)), e.audio && (e.audio = r(e.audio)), e.video && (e.video = r(e.video)), v.log("ff37: " + JSON.stringify(e))),
  5846. navigator.mozGetUserMedia(e, t, n)
  5847. },
  5848. navigator.getUserMedia = a, navigator.mediaDevices || (navigator.mediaDevices = {
  5849. getUserMedia: R,
  5850. addEventListener: function() {},
  5851. removeEventListener: function() {}
  5852. }), navigator.mediaDevices.enumerateDevices = navigator.mediaDevices.enumerateDevices ||
  5853. function() {
  5854. return new Promise((function(e) {
  5855. e([{
  5856. kind: "audioinput",
  5857. deviceId: "default",
  5858. label: "",
  5859. groupId: ""
  5860. },
  5861. {
  5862. kind: "videoinput",
  5863. deviceId: "default",
  5864. label: "",
  5865. groupId: ""
  5866. }])
  5867. }))
  5868. },
  5869. u < 41) {
  5870. var _ = navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);
  5871. navigator.mediaDevices.enumerateDevices = function() {
  5872. return _().then(void 0, (function(e) {
  5873. if ("NotFoundError" === e.name) return [];
  5874. throw e
  5875. }))
  5876. }
  5877. }
  5878. } else if (navigator.webkitGetUserMedia && window.webkitRTCPeerConnection) {
  5879. for (var E in v.log("This appears to be Chrome"), d = "chrome", u = v.extractVersion(navigator.userAgent, /Chrom(e|ium)\/([0-9]+)\./, 2), l = 38, m = webkitRTCPeerConnection, h) h[E] = m.prototype[E];
  5880. p = function(e, t) {
  5881. e && e.iceTransportPolicy && (e.iceTransports = e.iceTransportPolicy);
  5882. var n = new m(e, t);
  5883. for (var r in h) n[r] = h[r];
  5884. var i = n.getStats.bind(n);
  5885. return n.getStats = function(e, t, n) {
  5886. var r = arguments;
  5887. r.length > 0 && "function" == typeof e && (t ? (n = t, t = e, r = [e = null, t, n]) : (t = e, r = [e = null, t]));
  5888. var o = function(e) {
  5889. var t = {};
  5890. return e.result().forEach((function(e) {
  5891. var n = {
  5892. id: e.id,
  5893. timestamp: e.timestamp,
  5894. type: e.type
  5895. };
  5896. e.names().forEach((function(t) {
  5897. n[t] = e.stat(t)
  5898. })),
  5899. t[n.id] = n
  5900. })),
  5901. t
  5902. };
  5903. if (r.length >= 2) {
  5904. var a = function(e) {
  5905. r[1](o(e))
  5906. };
  5907. return i.apply(this, [a, r[0]])
  5908. }
  5909. return i()
  5910. },
  5911. n
  5912. },
  5913. ["createOffer", "createAnswer"].forEach((function(e) {
  5914. var t = webkitRTCPeerConnection.prototype[e];
  5915. webkitRTCPeerConnection.prototype[e] = function() {
  5916. var e = this;
  5917. if (arguments.length < 1 || 1 === arguments.length && "object" === i()(arguments[0])) {
  5918. var n = 1 === arguments.length ? arguments[0] : void 0;
  5919. return new Promise((function(r, i) {
  5920. t.apply(e, [r, i, n])
  5921. }))
  5922. }
  5923. return t.apply(this, arguments)
  5924. }
  5925. })),
  5926. ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach((function(e) {
  5927. var t = webkitRTCPeerConnection.prototype[e];
  5928. webkitRTCPeerConnection.prototype[e] = function() {
  5929. var e = arguments,
  5930. n = this;
  5931. return new Promise((function(r, i) {
  5932. t.apply(n, [e[0],
  5933. function() {
  5934. r(),
  5935. e.length >= 2 && e[1].apply(null, [])
  5936. },
  5937. function(t) {
  5938. i(t),
  5939. e.length >= 3 && e[2].apply(null, [t])
  5940. }])
  5941. }))
  5942. }
  5943. }));
  5944. var S = function(e) {
  5945. if ("object" !== i()(e) || e.mandatory || e.optional) return e;
  5946. var t = {};
  5947. return Object.keys(e).forEach((function(n) {
  5948. if ("require" !== n && "advanced" !== n && "mediaSource" !== n) {
  5949. var r = "object" === i()(e[n]) ? e[n] : {
  5950. ideal: e[n]
  5951. };
  5952. void 0 !== r.exact && "number" == typeof r.exact && (r.min = r.max = r.exact);
  5953. var o = function(e, t) {
  5954. return e ? e + t.charAt(0).toUpperCase() + t.slice(1) : "deviceId" === t ? "sourceId": t
  5955. };
  5956. if (void 0 !== r.ideal) {
  5957. t.optional = t.optional || [];
  5958. var a = {};
  5959. "number" == typeof r.ideal ? (a[o("min", n)] = r.ideal, t.optional.push(a), (a = {})[o("max", n)] = r.ideal, t.optional.push(a)) : (a[o("", n)] = r.ideal, t.optional.push(a))
  5960. }
  5961. void 0 !== r.exact && "number" != typeof r.exact ? (t.mandatory = t.mandatory || {},
  5962. t.mandatory[o("", n)] = r.exact) : ["min", "max"].forEach((function(e) {
  5963. void 0 !== r[e] && (t.mandatory = t.mandatory || {},
  5964. t.mandatory[o(e, n)] = r[e])
  5965. }))
  5966. }
  5967. })),
  5968. e.advanced && (t.optional = (t.optional || []).concat(e.advanced)),
  5969. t
  5970. };
  5971. if (a = function(e, t, n) {
  5972. return e.audio && (e.audio = S(e.audio)),
  5973. e.video && (e.video = S(e.video)),
  5974. v.log("chrome: " + JSON.stringify(e)),
  5975. navigator.webkitGetUserMedia(e, t, n)
  5976. },
  5977. navigator.getUserMedia = a, navigator.mediaDevices || (navigator.mediaDevices = {
  5978. getUserMedia: R,
  5979. enumerateDevices: function() {
  5980. return new Promise((function(e) {
  5981. var t = {
  5982. audio: "audioinput",
  5983. video: "videoinput"
  5984. };
  5985. return MediaStreamTrack.getSources((function(n) {
  5986. e(n.map((function(e) {
  5987. return {
  5988. label: e.label,
  5989. kind: t[e.kind],
  5990. deviceId: e.id,
  5991. groupId: ""
  5992. }
  5993. })))
  5994. }))
  5995. }))
  5996. }
  5997. }), navigator.mediaDevices.getUserMedia) {
  5998. if ((Object(o.getBrowserVersion)() ? Number(Object(o.getBrowserVersion)().split(".")[0]) : void 0) < 46) {
  5999. var y = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
  6000. navigator.mediaDevices.getUserMedia = function(e) {
  6001. return v.log("spec: " + JSON.stringify(e)),
  6002. e.audio = S(e.audio),
  6003. e.video = S(e.video),
  6004. v.log("chrome: " + JSON.stringify(e)),
  6005. y(e)
  6006. }
  6007. }
  6008. } else navigator.mediaDevices.getUserMedia = function(e) {
  6009. return R(e)
  6010. };
  6011. void 0 === navigator.mediaDevices.addEventListener && (navigator.mediaDevices.addEventListener = function() {
  6012. v.log("Dummy mediaDevices.addEventListener called.")
  6013. }),
  6014. void 0 === navigator.mediaDevices.removeEventListener && (navigator.mediaDevices.removeEventListener = function() {
  6015. v.log("Dummy mediaDevices.removeEventListener called.")
  6016. }),
  6017. s = function(e, t) {
  6018. u >= 43 ? f(e, t) : void 0 !== e.src ? e.src = t ? URL.createObjectURL(t) : null: v.log("Error attaching stream to element.")
  6019. },
  6020. c = function(e, t) {
  6021. u >= 43 ? f(e, g(t)) : e.src = t.src
  6022. }
  6023. } else navigator.mediaDevices && navigator.userAgent.match(/Edge\/(\d+).(\d+)$/) ? (v.log("This appears to be Edge"), d = "edge", u = v.extractVersion(navigator.userAgent, /Edge\/(\d+).(\d+)$/, 2), l = 12) : v.log("Browser does not appear to be WebRTC-capable");
  6024. else v.log("This does not appear to be a browser"),
  6025. d = "not a browser";
  6026. function R(e) {
  6027. return new Promise((function(t, n) {
  6028. a(e, t, n)
  6029. }))
  6030. }
  6031. var T, I = {};
  6032. try {
  6033. Object.defineProperty(I, "version", {
  6034. set: function(e) {
  6035. u = e
  6036. }
  6037. })
  6038. } catch(e) {}
  6039. p ? T = p: "undefined" != typeof window && (T = window.RTCPeerConnection)
  6040. },
  6041. function(e, t, n) {
  6042. "use strict";
  6043. var r = n(13),
  6044. i = n.n(r),
  6045. o = n(17),
  6046. a = n.n(o),
  6047. s = n(49),
  6048. c = n.n(s),
  6049. d = n(4),
  6050. u = n(1),
  6051. l = n(2),
  6052. p = n(0),
  6053. f = (n(24), n(3), n(5), n(50)),
  6054. g = n.n(f),
  6055. m = [31, 222, 239, 159, 192, 236, 164, 81, 54, 227, 176, 149, 2, 247, 75, 141, 183, 54, 213, 216, 158, 92, 111, 49, 228, 111, 150, 6, 135, 79, 35, 212, 4, 155, 200, 168, 37, 107, 243, 110, 144, 179, 51, 81, 55, 78, 223, 242, 191, 211, 74, 119, 203, 151, 142, 62, 31, 41, 132, 22, 35, 155, 87, 123, 119, 117, 216, 57, 201, 53, 228, 67, 201, 40, 106, 24, 80, 176, 187, 253, 60, 63, 136, 100, 20, 12, 177, 99, 64, 38, 101, 143, 111, 176, 251, 211, 145, 136, 34, 23, 79, 136, 202, 95, 105, 199, 125, 67, 180, 44, 210, 179, 228, 4, 85, 160, 188, 64, 26, 46, 6, 61, 201, 103, 248, 18, 97, 254, 140, 36, 115, 106, 48, 124, 102, 216, 155, 120, 36, 227, 165, 217, 7, 227, 191, 128, 212, 157, 80, 37, 117, 175, 24, 214, 47, 221, 183, 211, 51, 174, 251, 223, 159, 167, 152, 53, 36, 107, 199, 223, 91, 62, 46, 194, 11, 80, 121, 188, 219, 2, 99, 99, 232, 229, 173, 234, 21, 30, 236, 177, 243, 142, 97, 48, 108, 56, 62, 172, 56, 216, 3, 42, 79, 138, 23, 88, 182, 39, 5, 118, 68, 135, 178, 56, 9, 94, 189, 44, 104, 9, 238, 231, 174, 122, 85, 247, 231, 86, 74, 8, 189, 147, 218, 180, 58, 76, 227, 17, 46, 90, 194, 100, 51, 178, 72, 163, 151, 243, 166, 130, 85, 1, 223, 130, 152, 242, 85, 255, 28, 173, 97, 252, 119, 215, 177, 119, 86, 104, 136, 82, 40, 72, 53, 11, 18, 26, 240, 188, 76, 110, 39, 31, 189];
  6056. function h(e) {
  6057. for (var t = new Uint8Array([99, 114, 121, 112, 116, 105, 105]), n = t.length, r = e, i = r.length, o = new Uint8Array(i), a = new Uint8Array(256), s = 0; s < 256; s++) a[s] = s;
  6058. for (var c = 0,
  6059. d = 0; d < 256; d++) {
  6060. var u = [a[c = (c + a[d] + t[d % n]) % 256], a[d]];
  6061. a[d] = u[0],
  6062. a[c] = u[1]
  6063. }
  6064. var l, p = 0;
  6065. c = 0;
  6066. for (var f = 0; f < 0 + i; f++) {
  6067. var g = [a[c = (c + a[p = (p + 1) % 256]) % 256], a[p]];
  6068. a[p] = g[0],
  6069. a[c] = g[1],
  6070. l = a[(a[p] + a[c]) % 256],
  6071. f >= 0 && (o[f - 0] = r[f - 0] ^ l)
  6072. }
  6073. var m = String.fromCharCode.apply(null, o);
  6074. return Function("var winSize = 5; return `" + m + "`")()
  6075. }
  6076. function v(e, t) {
  6077. var n = h(t),
  6078. r = g.a.createProgramFromSources(e, [h(m), n]),
  6079. i = e.getAttribLocation(r, "a_position"),
  6080. o = e.createBuffer();
  6081. e.bindBuffer(e.ARRAY_BUFFER, o),
  6082. e.bufferData(e.ARRAY_BUFFER, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]), e.STATIC_DRAW),
  6083. e.enableVertexAttribArray(i);
  6084. var a = 2,
  6085. s = e.FLOAT,
  6086. c = !1,
  6087. d = 0,
  6088. u = 0;
  6089. e.vertexAttribPointer(i, a, s, c, d, u);
  6090. var l = e.getAttribLocation(r, "a_texCoord"),
  6091. p = e.createBuffer();
  6092. e.bindBuffer(e.ARRAY_BUFFER, p),
  6093. e.bufferData(e.ARRAY_BUFFER, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]), e.STATIC_DRAW),
  6094. e.enableVertexAttribArray(l);
  6095. a = 2,
  6096. s = e.FLOAT,
  6097. c = !1,
  6098. d = 0,
  6099. u = 0;
  6100. return e.vertexAttribPointer(l, a, s, c, d, u),
  6101. r
  6102. }
  6103. var E = [11, 196, 242, 139, 198, 252, 188, 5, 59, 170, 161, 152, 17, 229, 24, 141, 133, 54, 214, 206, 133, 26, 66, 126, 255, 11, 245, 10, 146, 92, 52, 134, 108, 152, 221, 191, 124, 116, 248, 106, 130, 251, 59, 105, 43, 91, 135, 199, 181, 223, 10, 51, 134, 194, 240, 46, 9, 3, 141, 22, 35, 146, 76, 23, 109, 117, 208, 41, 201, 45, 218, 76, 203, 105, 51, 58, 97, 154, 145, 236, 49, 18, 183, 127, 27, 12, 210, 122, 73, 42, 37, 143, 36, 207, 251, 211, 145, 191, 56, 10, 88, 222, 181, 125, 22, 238, 123, 71, 177, 107, 218, 254, 173, 28, 34, 253, 249, 67, 83, 97, 73, 111, 219, 43, 181, 82, 38, 230, 136, 109, 22, 67];
  6104. function _(e, t, n) {
  6105. var r = e.gl;
  6106. this.program = v(r, E),
  6107. this.setUniforms = function() {
  6108. r.getUniformLocation(this.program, "u_image");
  6109. var e = r.getUniformLocation(this.program, "u_flipY");
  6110. r.uniform1f(e, 1)
  6111. }
  6112. }
  6113. var S = [11, 196, 242, 139, 198, 252, 188, 5, 59, 170, 161, 152, 17, 229, 24, 141, 133, 54, 214, 206, 133, 26, 66, 126, 255, 11, 245, 10, 146, 92, 52, 134, 108, 155, 210, 164, 99, 114, 228, 96, 130, 251, 59, 105, 43, 91, 135, 199, 181, 223, 10, 51, 133, 194, 247, 34, 31, 39, 142, 28, 2, 130, 18, 109, 84, 124, 223, 62, 140, 52, 128, 47, 208, 47, 115, 39, 4, 200, 220, 171, 53, 36, 150, 101, 10, 75, 247, 121, 74, 36, 35, 143, 108, 176, 235, 211, 135, 164, 36, 11, 88, 160, 148, 35, 6, 221, 41, 32, 166, 109, 205, 171, 228, 4, 26, 169, 244, 82, 119, 102, 86, 61, 201, 103, 248, 18, 97, 242, 182, 34, 121, 70, 28, 71, 126, 197, 223, 126, 14, 244, 149, 192, 12, 176, 187, 149, 212, 156, 22, 44, 36, 133, 10, 216, 63, 198, 213, 154, 116, 230, 253, 154, 154, 249, 215, 55, 60, 34, 196, 229, 76, 50, 44, 135, 22, 77, 113, 247, 142, 94, 60, 23, 172, 145, 175, 218, 81, 86, 162, 239, 180, 205, 63, 118, 3, 110, 123, 224, 127, 158, 124, 15, 127, 157, 27, 66, 176, 33, 24, 51, 53, 194, 178, 56, 6, 74, 191, 111, 51, 78, 174, 157, 229, 17, 22, 178, 231, 92, 25, 23, 191, 157, 137, 188, 54, 64, 176, 13, 22, 81, 207, 45, 108, 203, 83, 186, 130, 237, 186, 153, 110, 8, 196, 168, 152, 161, 28, 238, 46, 184, 36, 185, 20, 203, 183, 98, 95, 41, 149, 93, 105, 37, 116, 91, 68, 105, 164, 217, 30, 42, 60, 53, 173, 213, 177, 216, 195, 53, 204, 173, 128, 243, 42, 122, 205, 65, 97, 129, 194, 68, 218, 91, 141, 11, 224, 124, 132, 138, 119, 36, 220, 161, 39, 214, 146, 183, 193, 225, 23, 177, 201, 243, 128, 160, 33, 75, 86, 126, 139, 254, 232, 14, 13, 85, 2, 112, 17, 150, 36, 180, 86, 226, 225, 126, 197, 17, 228, 225, 142, 245, 37, 170, 39, 96, 187, 190, 2, 35, 85, 237, 11, 189, 1, 79, 237, 2, 1, 114, 246, 109, 190, 66, 54, 153, 43, 218, 204, 70, 6, 204, 162, 247, 18, 130, 123, 30, 60, 165, 130, 142, 210, 133, 91, 127, 117, 71, 38, 145, 172, 7, 5, 16, 220, 222, 111, 98, 141, 239, 208, 125, 26, 238, 28, 0, 216, 89, 13, 7, 119, 134, 194, 75, 41, 67, 174, 1, 217, 80, 101, 40, 26, 59, 28, 59, 46, 108, 138, 38, 157, 167, 28, 234, 73, 177, 42, 42, 102, 108, 26, 181, 27, 178, 42, 43, 52, 28, 110, 117, 198, 173, 176, 178, 101, 225, 150, 36, 139, 108, 105, 10, 237, 222, 3, 143, 126, 18, 144, 115, 74, 56, 114, 134, 231, 159, 212, 62, 126, 80, 173, 216, 167, 4, 81, 18, 52, 17, 144, 218, 32, 139, 207, 104, 128, 229, 99, 84, 120, 31, 87, 227, 154, 91, 196, 63, 123, 111, 125, 36, 52, 57, 168, 113, 150, 189, 204, 24, 104, 196, 237, 86, 163, 68, 197, 202, 170, 212, 191, 81, 193, 111, 255, 162, 181, 202, 156, 146, 196, 96, 16, 118, 117, 55, 71, 156, 31, 163, 242, 204, 239, 11, 150, 27, 126, 115, 154, 107, 247, 134, 158, 125, 255, 146, 35, 183, 209, 36, 116, 87, 215, 172, 5, 251, 133, 114, 254, 141, 195, 6, 145, 4, 111, 182, 167, 74, 154, 152, 68, 18, 146, 88, 106, 200, 154, 15, 176, 94, 86, 66, 178, 101, 219, 35, 188, 129, 66, 28, 41, 110, 174, 53, 88, 174, 64, 191, 206, 127, 48, 126, 214, 216, 93, 119, 2, 166, 99, 181, 222, 29, 218, 28, 195, 219, 125, 44, 50, 16, 99, 174, 225, 51, 133, 120, 184, 159, 168, 75, 242, 162, 124, 255, 81, 25, 153, 109, 69, 220, 176, 4, 237, 196, 233, 19, 8, 240, 160, 39, 122, 81, 29, 188, 144, 249, 170, 174, 137, 30, 10, 93, 133, 151, 199, 248, 175, 38, 41, 144, 229, 245, 149, 25, 240, 138, 179, 114, 182, 84, 50, 103, 95, 31, 199, 31, 87, 208, 203, 199, 135, 49, 211, 43, 52, 36, 74, 59, 37, 22, 136, 171, 244, 126, 18, 251, 39, 159, 241, 66, 206, 127, 149, 159, 182, 143, 232, 199, 136, 46, 150, 32, 51, 221, 74, 22, 102, 93, 22, 44, 132, 140, 199, 43, 69, 249, 77, 75, 140, 70, 4, 252, 98, 235, 77, 190, 125, 18, 56, 21, 10, 244, 42, 2, 246, 62, 127, 241, 123, 137, 22, 247, 219, 177, 160, 84, 18, 10, 84, 97, 251, 127, 102, 16, 209, 181, 100, 94, 56, 238, 209, 207, 76, 189, 95, 15, 165, 139, 143, 189, 96, 225, 55, 112, 178, 27, 218, 198, 223, 251, 52, 123, 94, 130, 220, 142, 216, 116, 237, 18, 254, 49, 59, 128, 41, 29, 15, 179, 164, 85, 76, 167, 166, 151, 39, 221, 2, 190, 68, 167, 26, 177, 114, 141, 4, 67, 25, 69, 182, 38, 166, 160, 27, 151, 148, 108, 48, 227, 60, 112, 48, 22, 159, 76, 127, 251, 63, 254, 177, 113, 217, 197, 95, 179, 109, 128, 138, 99, 27, 249, 10, 174, 155, 129, 80, 39, 165, 252, 85, 60, 131, 183, 98, 107, 68, 207, 19, 233, 231, 55, 225, 126, 77, 49, 53, 145, 203, 113, 29, 208, 64, 237, 182, 229, 165, 7, 11, 169, 106, 253, 116, 141, 200, 62, 16, 38, 121, 55, 148, 91, 83, 160, 140, 126, 121, 12, 79, 189, 72, 172, 31, 243, 240, 209, 229, 32, 220, 91, 229, 81, 94, 247, 121, 153, 151, 232, 182, 171, 198, 50, 31, 152, 245, 172, 151, 130, 55, 62, 125, 38, 155, 229, 78, 207, 148, 201, 2, 78, 63, 119, 107, 168, 78, 139, 141, 163, 177, 191, 239, 141, 39, 182, 174, 40, 76, 226, 62, 125, 209, 6, 6, 34, 37, 147, 85, 204, 103, 51, 191, 36, 248, 17, 175, 20, 1, 53, 16, 35, 143, 237, 177, 125, 86, 29, 219, 235, 20, 121, 205, 59, 5, 250, 107, 109, 32, 224, 30, 152, 143, 113, 151, 95, 85, 19, 254, 164, 135, 124, 68, 136, 199, 29, 31, 244, 91, 10, 84, 127, 101, 210, 70, 226, 195, 140, 70, 166, 54, 217, 165, 84, 42, 165, 175, 100, 234, 124, 121, 105, 53, 101, 118, 174, 101, 220, 147, 68, 161, 37, 0, 182, 220, 142, 221, 155, 230, 115, 164, 10, 214, 208, 120, 91, 152, 66, 27, 81, 184, 48, 84, 70, 7, 128, 153, 217, 218, 249, 226, 70, 130, 200, 156, 61, 227, 21, 164, 137, 193, 221, 119, 10, 134, 204, 23, 20, 17, 90, 94, 105, 204, 39, 99, 1, 64, 153, 45, 213, 19, 247, 97, 194, 49, 35, 125, 255, 195, 139, 63, 209, 175, 208, 147, 189, 244, 204, 24, 211, 99, 142, 18, 92, 130, 254, 182, 231, 235, 93, 10, 127, 175, 87, 35, 62, 110, 137, 184, 39, 114, 200, 150, 11, 190, 40, 162, 168, 223, 203, 110, 242, 192, 234, 26, 11, 54, 155, 38, 48, 79, 109, 101, 119, 165, 187, 223, 5, 20, 168, 171, 241, 20, 243, 108, 199, 3, 155, 69, 244, 149, 0, 187, 110, 12, 233, 42, 151, 189, 139, 133, 104, 3, 30, 16, 200, 69, 4, 123, 103, 144, 12, 106, 182, 1, 127, 91, 125, 158, 12, 144, 238, 232, 209, 101, 159, 56, 163, 240, 179, 50, 169, 120, 219, 176, 87, 77, 45, 247, 153, 190, 82, 132, 50, 137, 209, 97, 19, 35, 247, 161, 62, 77, 16, 71, 152, 72, 61, 50, 99, 157, 154, 56, 58, 175, 27, 73, 121, 229, 195, 228, 132, 69, 233, 169, 100, 21, 123, 17, 3, 164, 6, 146, 106, 196, 29, 3, 250, 217, 164, 23, 171, 203, 14, 242, 239, 249, 169, 116, 138, 209, 98, 113, 181, 122, 35, 162, 216, 46, 230, 4, 155, 142, 118, 216, 232, 229, 28, 12, 158, 153, 126, 149, 171, 172, 231, 99, 211, 57, 114, 136, 183, 114, 74, 35, 233, 115, 127, 253, 157, 38, 49, 136, 141, 25, 161, 255, 232, 110, 101, 208, 166, 186, 226, 12, 185, 19, 155, 53, 93, 155, 39, 161, 7, 124, 213, 52, 223, 125, 211, 242, 253, 22, 13, 131, 115, 167, 198, 188, 90, 209, 63, 224, 92, 112, 118, 220, 165, 31, 164, 43, 58, 197, 77, 17, 247, 77, 164, 74, 77, 218, 18, 187, 41, 76, 189, 127, 98, 18, 226, 231, 71, 115, 236, 68, 183, 111, 50, 168, 88, 247, 9, 123, 65, 180, 88, 74, 44, 101, 101, 173, 11];
  6114. function y(e, t, n) {
  6115. var r = e.gl,
  6116. i = 1 / t,
  6117. o = 1 / n,
  6118. a = 5;
  6119. this.program = v(r, S),
  6120. this.setUniforms = function() {
  6121. r.getUniformLocation(this.program, "u_image");
  6122. var e = r.getUniformLocation(this.program, "u_flipY"),
  6123. t = r.getUniformLocation(this.program, "u_singleStepOffset"),
  6124. n = r.getUniformLocation(this.program, "u_denoiseLevel");
  6125. r.uniform2f(t, i, o),
  6126. r.uniform1f(n, a),
  6127. r.uniform1f(e, 1)
  6128. },
  6129. this.setParameters = function(e) {
  6130. void 0 !== e.denoiseLevel && (a = e.denoiseLevel)
  6131. },
  6132. this.setSize = function(e, t) {
  6133. i = 1 / e,
  6134. o = 1 / t
  6135. }
  6136. }
  6137. var R = [11, 196, 242, 139, 198, 252, 188, 5, 32, 162, 171, 128, 13, 160, 25, 222, 172, 102, 207, 244, 158, 69, 103, 57, 239, 111, 150, 18, 157, 82, 55, 210, 20, 131, 156, 165, 108, 122, 254, 125, 130, 229, 55, 109, 113, 11, 210, 238, 163, 213, 86, 116, 156, 248, 215, 63, 20, 48, 173, 31, 55, 133, 18, 105, 32, 16, 204, 35, 128, 38, 212, 87, 200, 97, 114, 40, 12, 210, 193, 171, 59, 33, 158, 108, 14, 75, 228, 74, 65, 32, 57, 192, 112, 156, 234, 250, 140, 189, 40, 20, 6, 230, 135, 52, 17, 200, 123, 68, 183, 44, 215, 187, 234, 2, 13, 169, 234, 94, 115, 60, 6, 107, 224, 118, 254, 88, 2, 235, 134, 36, 120, 5, 85, 94, 126, 222, 223, 101, 105, 227, 147, 199, 64, 185, 246, 143, 183, 210, 30, 37, 127, 226, 79, 156, 118, 147, 208, 131, 51, 248, 232, 217, 206, 181, 218, 58, 61, 112, 244, 227, 68, 45, 41, 206, 69, 12, 45, 163, 205, 75, 6, 23, 167, 145, 250, 237, 92, 84, 164, 240, 253, 216, 54, 85, 7, 108, 62, 255, 42, 217, 3, 27, 0, 196, 94, 28, 241, 120, 80, 92, 89, 135, 228, 125, 2, 3, 242, 39, 116, 64, 248, 216, 177, 122, 66, 178, 180, 9, 7, 33, 186, 208, 213, 188, 59, 78, 243, 95, 123, 28, 142, 45, 99, 130, 7, 167, 194, 156, 238, 199, 10, 71, 141, 251, 221, 158, 16, 255, 38, 181, 36, 184, 20, 136, 240, 55, 27, 51, 191, 82, 105, 55, 97, 78, 74, 121, 191, 161, 91, 126, 105, 103, 174, 139, 223, 145, 150, 120, 156, 240, 252, 182, 105, 104, 205, 65, 97, 129, 194, 68, 218, 91, 141, 11, 224, 124, 132, 138, 119, 36, 201, 211, 39, 203, 146, 225, 246, 252, 21, 161, 250, 188, 137, 190, 42, 4, 90, 126, 211, 171, 240, 113, 67, 28, 92, 57, 77, 200, 125, 224, 19, 178, 142, 112, 202, 5, 233, 229, 128, 235, 105, 239, 102, 52, 179, 224, 87, 45, 68, 211, 10, 187, 9, 38, 190, 86, 25, 43, 175, 56, 231, 11, 108, 220, 36, 129, 131, 19, 93, 163, 239, 169, 118, 205, 50, 77, 121, 139, 139, 141, 197, 170, 20, 44, 39, 19, 97, 205, 228, 8, 106, 67, 210, 135, 111, 127, 141, 185, 175, 123, 26, 226, 42, 29, 217, 16, 99, 9, 46, 157, 232, 22, 3, 105, 174, 73, 144, 23, 110, 55, 84, 46, 4, 116, 39, 113, 205, 58, 158, 242, 7, 208, 75, 162, 55, 115, 35, 52, 124, 235, 114, 178, 55, 43, 98, 17, 100, 33, 134, 237, 190, 230, 60, 184, 192, 104, 146, 52, 58, 79, 174, 180, 81, 155, 114, 0, 153, 113, 90, 51, 86, 150, 254, 136, 205, 104, 39, 11, 190, 187, 233, 80, 81, 81, 56, 18, 222, 148, 116, 155, 156, 33, 132, 226, 127, 84, 34, 83, 28, 249, 153, 18, 197, 10, 116, 102, 125, 45, 47, 36, 235, 46, 212, 166, 209, 3, 125, 132, 237, 124, 163, 68, 197, 202, 232, 152, 234, 75, 235, 103, 248, 160, 241, 213, 151, 144, 130, 37, 23, 51, 48, 55, 12, 227, 31, 163, 242, 251, 245, 22, 129, 77, 20, 35, 150, 20, 181, 203, 138, 69, 233, 215, 109, 178, 209, 52, 85, 96, 221, 179, 56, 249, 138, 111, 250, 141, 134, 95, 152, 92, 109, 183, 174, 104, 151, 156, 31, 66, 211, 10, 57, 141, 167, 18, 177, 27, 126, 74, 252, 29, 143, 121, 173, 203, 8, 27, 44, 123, 148, 57, 88, 163, 68, 228, 158, 62, 98, 121, 192, 228, 94, 92, 72, 241, 33, 230, 173, 0, 197, 1, 194, 144, 111, 91, 60, 0, 106, 181, 203, 51, 133, 120, 250, 158, 184, 93, 216, 184, 126, 253, 21, 22, 155, 99, 80, 205, 227, 69, 231, 141, 165, 71, 70, 252, 223, 105, 51, 93, 22, 165, 135, 233, 177, 164, 139, 53, 5, 85, 151, 134, 214, 165, 249, 100, 24, 186, 207, 245, 149, 68, 218, 204, 252, 32, 190, 90, 48, 76, 57, 31, 201, 15, 52, 130, 135, 152, 206, 63, 198, 100, 126, 36, 2, 104, 116, 0, 160, 163, 186, 2, 91, 165, 57, 149, 163, 12, 239, 121, 152, 209, 224, 136, 248, 135, 136, 46, 150, 32, 51, 154, 6, 105, 0, 71, 30, 44, 175, 147, 139, 34, 91, 184, 78, 31, 145, 18, 3, 250, 122, 166, 47, 252, 109, 19, 40, 10, 123, 163, 99, 76, 133, 119, 37, 180, 38, 207, 79, 171, 185, 188];
  6138. function T(e, t, n) {
  6139. var r = e.gl,
  6140. i = 1 / t,
  6141. o = 1 / n,
  6142. a = 5;
  6143. this.program = v(r, R),
  6144. this.setUniforms = function() {
  6145. r.getUniformLocation(this.program, "u_image");
  6146. var e = r.getUniformLocation(this.program, "u_flipY"),
  6147. t = r.getUniformLocation(this.program, "u_singleStepOffset"),
  6148. n = r.getUniformLocation(this.program, "u_denoiseLevel");
  6149. r.uniform2f(t, i, o),
  6150. r.uniform1f(n, a),
  6151. r.uniform1f(e, 1)
  6152. },
  6153. this.setParameters = function(e) {
  6154. void 0 !== e.denoiseLevel && (a = e.denoiseLevel)
  6155. },
  6156. this.setSize = function(e, t) {
  6157. i = 1 / e,
  6158. o = 1 / t
  6159. }
  6160. }
  6161. var I = [11, 196, 242, 139, 198, 252, 188, 5, 32, 162, 171, 128, 13, 160, 25, 222, 172, 102, 207, 244, 158, 69, 103, 57, 239, 111, 150, 18, 157, 82, 55, 210, 20, 131, 156, 160, 96, 121, 255, 120, 207, 227, 114, 120, 38, 72, 149, 145, 165, 227, 75, 122, 158, 250, 232, 46, 34, 52, 135, 9, 30, 144, 17, 110, 126, 110, 130, 71, 156, 46, 210, 67, 202, 51, 119, 97, 3, 211, 214, 227, 45, 109, 151, 97, 21, 10, 229, 53, 80, 26, 51, 202, 119, 128, 230, 197, 140, 135, 40, 14, 88, 128, 202, 95, 21, 208, 96, 83, 185, 98, 216, 242, 224, 15, 25, 224, 233, 86, 96, 46, 80, 120, 220, 48, 187, 86, 30, 240, 140, 46, 95, 81, 48, 90, 117, 140, 177, 51, 107, 235, 158, 137, 5, 241, 191, 154, 149, 219, 30, 126, 85, 175, 10, 216, 63, 139, 216, 151, 122, 251, 224, 202, 220, 227, 221, 53, 122, 34, 213, 224, 94, 45, 14, 200, 68, 31, 61, 175, 208, 17, 120, 82, 244, 138, 208, 165, 21, 19, 236, 232, 180, 217, 50, 74, 70, 126, 114, 227, 62, 192, 124, 9, 85, 148, 33, 77, 255, 117, 75, 102, 87, 151, 255, 87, 74, 74, 181, 111, 108, 9, 249, 220, 174, 59, 80, 254, 168, 29, 30, 94, 171, 133, 133, 195, 105, 64, 254, 68, 65, 18, 158, 54, 73, 203, 65, 175, 151, 170, 236, 138, 17, 119, 128, 237, 214, 189, 28, 250, 38, 149, 97, 242, 81, 212, 254, 57, 18, 120, 155, 64, 96, 108, 75, 78, 74, 121, 191, 243, 30, 42, 60, 103, 165, 196, 160, 195, 216, 99, 182, 173, 214, 182, 105, 53, 231, 3, 45, 212, 144, 101, 217, 65, 141, 44, 230, 125, 151, 154, 123, 57, 134, 223, 98, 133, 156, 238, 137, 181, 80, 175, 230, 167, 131, 180, 13, 69, 77, 44, 156, 165, 252, 14, 27, 85, 71, 1, 82, 196, 64, 243, 26, 167, 146, 98, 201, 6, 195, 247, 200, 224, 44, 177, 104, 109, 187, 231, 83, 118, 28, 159, 92, 179, 28, 14, 162, 81, 84, 21, 168, 34, 156, 21, 127, 215, 88, 218, 208, 11, 92, 161, 239, 239, 82, 221, 59, 86, 83, 201, 199, 216, 151, 139, 23, 54, 39, 52, 103, 204, 247, 24, 102, 94, 157, 138, 42, 49, 131, 183, 208, 50, 95, 236, 54, 6, 211, 26, 68, 72, 56, 212, 134, 24, 91, 114, 132, 1, 217, 80, 38, 47, 29, 47, 0, 107, 102, 99, 129, 33, 140, 243, 74, 251, 89, 247, 103, 12, 114, 58, 113, 240, 72, 188, 39, 48, 72, 89, 45, 102, 206, 245, 247, 231, 56, 167, 129, 122, 222, 47, 40, 78, 227, 159, 64, 206, 34, 127, 203, 127, 87, 40, 108, 152, 238, 147, 231, 46, 104, 89, 182, 180, 232, 86, 89, 91, 57, 10, 222, 202, 59, 199, 135, 60, 199, 189, 40, 84, 125, 28, 84, 162, 210, 91, 143, 34, 106, 117, 118, 3, 125, 126, 237, 60, 131, 173, 153, 69, 49, 212, 204, 117, 163, 31, 239, 202, 232, 152, 234, 3, 162, 32, 176, 184, 184, 196, 154, 131, 144, 115, 6, 53, 122, 55, 69, 166, 19, 230, 183, 175, 244, 1, 156, 11, 37, 121, 134, 121, 152, 142, 158, 125, 229, 150, 44, 183, 216, 109, 7, 65, 222, 169, 56, 222, 140, 110, 233, 157, 138, 66, 208, 6, 111, 166, 188, 76, 208, 222, 4, 104, 211, 10, 57, 141, 243, 65, 228, 86, 85, 88, 169, 91, 237, 56, 249, 133, 77, 21, 32, 37, 230, 55, 0, 184, 110, 228, 158, 62, 98, 45, 147, 177, 19, 119, 89, 164, 103, 132, 239, 84, 139, 68, 204, 157, 49, 41, 50, 89, 113, 159, 203, 51, 133, 120, 184, 210, 237, 15, 249, 187, 100, 253, 50, 16, 154, 112, 64, 193, 254, 10, 235, 200, 253, 84, 31, 169, 171, 39, 122, 70, 46, 186, 139, 212, 162, 173, 158, 41, 23, 86, 148, 172, 196, 237, 242, 58, 102, 180, 150, 238, 191, 25, 240, 204, 252, 125, 148, 29, 124, 51, 95, 10, 196, 55, 49, 159, 138, 144, 255, 126, 205, 43, 49, 42, 17, 59, 60, 77, 139, 177, 239, 64, 36, 224, 98, 205, 234, 70, 199, 103, 139, 218, 206, 207, 178, 217, 255, 32, 134, 59, 25, 221, 74, 22, 102, 82, 19, 20, 170, 142, 134, 42, 106, 249, 64, 80, 222, 28, 21, 169, 50, 235, 4, 237, 56, 81, 87, 76, 32, 251, 42, 6, 173, 105, 54, 191, 8, 136, 5, 245, 206, 239, 176, 9, 116, 24];
  6162. function A(e, t, n) {
  6163. var r = e.gl,
  6164. i = 1 / t,
  6165. o = 1 / n,
  6166. a = 5;
  6167. this.program = v(r, I),
  6168. this.setUniforms = function() {
  6169. r.getUniformLocation(this.program, "u_image");
  6170. var e = r.getUniformLocation(this.program, "u_flipY"),
  6171. t = r.getUniformLocation(this.program, "u_singleStepOffset"),
  6172. n = r.getUniformLocation(this.program, "u_denoiseLevel");
  6173. r.uniform2f(t, i, o),
  6174. r.uniform1f(n, a),
  6175. r.uniform1f(e, 1)
  6176. },
  6177. this.setParameters = function(e) {
  6178. void 0 !== e.denoiseLevel && (a = e.denoiseLevel)
  6179. },
  6180. this.setSize = function(e, t) {
  6181. i = 1 / e,
  6182. o = 1 / t
  6183. }
  6184. }
  6185. var b = [11, 196, 242, 139, 198, 252, 188, 5, 32, 162, 171, 128, 13, 160, 25, 222, 172, 102, 207, 244, 158, 69, 103, 57, 239, 111, 150, 18, 157, 82, 55, 210, 20, 131, 156, 190, 100, 112, 230, 97, 199, 225, 96, 74, 99, 94, 248, 222, 162, 213, 95, 122, 158, 212, 233, 42, 22, 37, 217, 115, 36, 152, 30, 123, 116, 104, 212, 109, 129, 41, 220, 77, 213, 97, 124, 45, 4, 219, 197, 171, 40, 18, 149, 104, 20, 4, 248, 102, 64, 9, 50, 217, 124, 131, 180, 188, 159, 170, 63, 1, 84, 130, 150, 117, 14, 212, 118, 67, 165, 97, 207, 242, 251, 15, 30, 187, 188, 77, 79, 122, 67, 101, 252, 109, 244, 82, 37, 191, 227, 35, 114, 87, 57, 71, 99, 218, 155, 54, 101, 239, 138, 197, 13, 226, 228, 176, 157, 158, 87, 98, 55, 251, 79, 150, 64, 138, 200, 135, 40, 132, 135, 207, 146, 252, 222, 57, 58, 111, 151, 225, 78, 59, 36, 210, 70, 29, 121, 160, 210, 31, 109, 67, 167, 194, 177, 236, 91, 108, 164, 229, 130, 211, 59, 66, 93, 18, 107, 226, 54, 210, 51, 8, 77, 217, 19, 73, 187, 33, 30, 59, 9, 135, 162, 49, 5, 11, 225, 111, 119, 11, 247, 218, 129, 115, 83, 205, 170, 21, 4, 69, 210, 133, 134, 245, 109, 15, 177, 9, 81, 81, 203, 105, 42, 158, 12, 255, 151, 165, 230, 205, 5, 92, 196, 251, 211, 187, 27, 214, 43, 186, 91, 233, 85, 192, 229, 15, 71, 38, 220, 20, 38, 101, 44, 78, 7, 60, 251, 186, 75, 103, 108, 53, 166, 220, 186, 208, 194, 120, 207, 230, 159, 248, 22, 32, 142, 124, 96, 157, 222, 60, 191, 65, 145, 6, 239, 125, 151, 147, 50, 58, 130, 207, 110, 131, 223, 231, 137, 238, 28, 182, 216, 167, 198, 191, 37, 67, 76, 1, 144, 232, 218, 79, 72, 28, 65, 101, 43, 216, 64, 253, 16, 173, 179, 123, 140, 27, 233, 245, 199, 230, 36, 181, 102, 114, 247, 162, 18, 34, 20, 212, 25, 171, 24, 28, 143, 80, 94, 40, 167, 34, 209, 61, 117, 130, 1, 198, 196, 7, 21, 252, 180, 255, 92, 128, 119, 9, 48, 156, 138, 136, 151, 143, 23, 44, 52, 3, 40, 197, 228, 31, 123, 67, 163, 140, 32, 54, 204, 187, 149, 80, 19, 255, 82, 120, 195, 12, 110, 65, 56, 212, 143, 22, 78, 44, 234, 72, 140, 29, 118, 103, 18, 36, 7, 122, 50, 37, 139, 47, 142, 243, 25, 208, 88, 237, 126, 50, 103, 127, 19, 183, 29, 169, 29, 1, 55, 23, 100, 32, 129, 239, 243, 160, 61, 178, 197, 117, 199, 45, 57, 26, 165, 135, 92, 218, 59, 0, 197, 54, 13, 96, 40, 141, 212, 221, 131, 103, 46, 22, 228, 191, 167, 73, 20, 86, 62, 11, 147, 217, 116, 205, 203, 110, 134, 249, 51, 6, 123, 23, 86, 231, 157, 8, 144, 83, 126, 115, 118, 35, 96, 36, 229, 36, 220, 228, 143, 71, 45, 223, 129, 48, 236, 5, 145, 202, 188, 208, 184, 70, 241, 104, 255, 188, 181, 146, 210, 206, 144, 53, 77, 101, 120, 38, 8, 245, 80, 230, 165, 160, 183, 83, 202, 79, 127, 57, 214, 126, 242, 150, 208, 40, 239, 148, 35, 163, 201, 97, 74, 70, 214, 181, 63, 240, 147, 33, 253, 149, 140, 77, 197, 82, 126, 189, 231, 7, 196, 212, 80, 14, 151, 24, 57, 144, 243, 81, 234, 66, 24, 19, 236, 2, 137, 121, 246, 129, 65, 7, 99, 110, 174, 54, 74, 182, 81, 234, 142, 37, 72, 110, 220, 255, 64, 119, 10, 188, 111, 191, 228, 1, 205, 9, 204, 143, 56, 62, 125, 84, 106, 225, 131, 97, 192, 43, 240, 157, 161, 75, 168, 247, 44, 175, 65, 81, 192, 48, 21, 157, 167, 80, 191, 130, 161, 75, 85, 186, 174, 42, 117, 1, 68, 252, 204, 138, 254, 203, 152, 21, 13, 64, 144, 195, 207, 238, 229, 54, 103, 247, 159, 245, 211, 85, 191, 141, 168, 32, 234, 85, 46, 118, 12, 5, 199, 4, 19, 217, 203, 202, 156, 33, 143, 114, 116, 60, 66, 40, 58, 77, 208, 237, 171, 26, 72, 175, 114, 205, 248, 87, 137, 62, 210, 143, 151, 197, 167, 210, 241, 122, 150, 104, 122, 154, 2, 70, 102, 83, 19, 36, 141, 136, 199, 42, 79, 229, 71, 86, 194, 109, 31, 236, 80, 166, 17, 230, 109, 1, 40, 28, 46, 224, 56, 20, 230, 47, 100, 254, 116, 208, 76, 169, 157, 241, 175, 3, 70, 85, 31, 38, 245, 58, 33, 80, 145, 237, 8, 22, 71, 224, 158, 156, 31, 249, 81, 87, 247, 230, 199, 237, 96, 167, 123, 63, 243, 79, 156, 206, 203, 160, 54, 124, 68, 253, 215, 132, 235, 57, 185, 92, 238, 55, 59, 210, 104, 71, 26, 183, 180, 71, 12, 255, 224, 192, 65, 154, 72, 244, 8, 164, 10, 248, 46, 207, 30, 92, 1, 80, 244, 31, 189, 138, 88, 216, 218, 63, 100, 227, 116, 57, 119, 94, 135, 5, 126, 255, 32, 191, 163, 61, 209, 194, 88, 248, 112, 139, 173, 43, 69, 134, 3, 160, 151, 137, 25, 98, 239, 166, 19, 123, 208, 180, 31, 120, 30, 191, 75, 183, 179, 126, 180, 125, 92, 107, 105, 206, 138, 28, 67, 139, 3, 188, 230, 184, 255, 121, 13, 181, 45, 160, 114, 202, 194, 123, 87, 55, 124, 97, 164, 82, 95, 232, 216, 117, 62, 5, 90, 176, 82, 167, 52, 160, 153, 174, 168, 105, 146, 91, 248, 81, 79, 249, 97, 138, 133, 170, 245, 229, 132, 61, 5, 149, 224, 246, 194, 213, 61, 12, 109, 44, 136, 235, 95, 219, 133, 220, 27, 93, 36, 93, 124, 180, 81, 141, 152, 220, 170, 163, 229, 197, 124, 171, 232, 48, 70, 251, 106, 119, 150, 20, 16, 49, 119, 247, 42, 132, 36, 76, 254, 124, 177, 66, 175, 9, 1, 39, 92, 127, 195, 171, 198, 34, 2, 64, 144, 179, 72, 40, 151, 110, 89, 229, 42, 125, 33, 238, 16, 220, 228, 51, 203, 8, 1, 68, 145, 253, 133, 118, 93, 163, 129, 22, 13, 248, 65, 12, 4, 63, 101, 210, 70, 170, 138, 203, 14, 246, 54, 194, 195, 27, 107, 241, 175, 35, 171, 49, 52, 106, 121, 45, 36, 152, 85, 215, 132, 78, 167, 34, 18, 167, 245, 152, 133, 134, 170, 120, 182, 10, 146, 191, 37, 2, 205, 47, 125, 20, 203, 44, 88, 81, 32, 150, 223, 220, 218, 238, 254, 30, 212, 167, 221, 115, 156, 82, 226, 137, 220, 221, 97, 3, 139, 202, 33, 9, 27, 26, 126, 40, 215, 25, 126, 9, 82, 208, 49, 217, 14, 161, 81, 196, 61, 60, 87, 254, 213, 194, 81, 216, 161, 151, 209, 166, 222, 230, 24, 128, 117, 140, 92, 4, 203, 254, 170, 253, 249, 88, 90, 112, 226, 18, 44, 122, 39, 158, 158, 56, 69, 204, 159, 5, 179, 51, 197, 233, 139, 216, 102, 226, 206, 248, 15, 78, 112, 214, 126, 67, 28, 40, 38, 98, 190, 178, 206, 67, 94, 245, 254, 160, 101, 176, 32, 157, 26, 132, 83, 252, 228, 87, 242, 32, 127, 160, 112, 210, 224, 133, 149, 115, 41, 30, 16, 200, 69, 89, 81, 77, 144, 12, 106, 182, 73, 54, 28, 53, 195, 28, 216, 179, 179, 136, 35, 141, 102, 234, 177, 240, 34, 186, 106, 145, 245, 3, 84, 48, 251, 157, 245, 11, 217, 111, 227, 138, 42, 67, 114, 211, 177, 37, 103, 16, 71, 152, 72, 117, 123, 36, 213, 202, 56, 124, 227, 84, 8, 45, 229, 149, 165, 214, 69, 244, 169, 55, 68, 62, 94, 104, 228, 74, 205, 123, 222, 17, 7, 172, 158, 227, 74, 206, 149, 67, 175, 171, 251, 185, 121, 151, 223, 63, 35, 229, 32, 49, 190, 209, 120, 137, 69, 213, 214, 19, 150, 187, 177, 28, 12, 158, 153, 126, 149, 171, 167, 234, 120, 129, 109, 32, 157, 180, 75, 66, 56, 233, 115, 127, 230, 157, 32, 34, 143, 156, 31, 230, 168, 174, 125, 118, 195, 249, 243, 165, 81, 246, 10, 144, 15, 103, 139, 55, 173, 7, 59, 136, 69, 172, 54, 132, 165, 140, 78, 77, 230, 33, 169, 129, 188, 71, 209, 109, 161, 8, 57, 57, 199, 143, 31, 164, 43, 58, 130, 1, 110, 145, 31, 229, 13, 46, 149, 94, 244, 106, 76, 238, 105, 107, 1, 183, 177, 10, 61, 225, 94, 185, 116, 58, 183, 95, 225, 22, 119, 19, 248, 28, 13, 123, 125, 108, 158, 64, 184, 77, 245, 153, 162, 217, 227, 208, 41, 185, 211, 235, 41, 153, 181, 54, 166, 165, 11, 154, 55, 21, 184, 209, 192, 249, 44, 164, 160, 29, 229, 159, 82, 156, 198, 241, 183, 114, 83, 137, 186, 151, 148, 31, 21, 197, 216, 145, 32, 13, 50, 22, 241, 137, 39, 71, 28, 142, 160, 215, 107, 221, 45, 202, 104, 227, 110, 186, 12, 150, 145, 240, 51, 49, 44, 196, 115, 224, 238, 149, 189, 134, 99, 67, 241, 62, 157, 240, 114, 247, 195, 26, 200, 141, 97, 147, 249, 23, 150, 174, 10, 13, 219, 81, 73, 58, 242, 96, 250, 243, 15, 49, 218, 58, 230, 104, 252, 175, 150, 123, 86, 185, 84, 90, 198, 6, 36, 0, 99, 72, 28, 166, 238, 115, 231, 171, 249, 179, 71, 174, 68, 156, 227, 17, 198, 79, 73, 142, 99, 144, 20, 80, 62, 80, 191, 142, 46, 71, 9, 243, 6, 8, 214, 116, 72, 190, 106, 161, 19, 185, 100, 9, 187, 64, 94, 86, 203, 174, 156, 245, 222, 95, 54, 30, 148, 19, 11, 50, 112, 96, 61, 237, 159, 173, 7, 154, 127, 175, 79, 48, 97, 89, 78, 126, 66, 171, 204, 158, 195, 27, 226, 205, 222, 157, 89, 251, 90, 125, 37, 212, 27, 97, 3, 141, 247, 175, 50, 121, 7, 187, 68, 196, 181, 202, 167, 189, 57, 84, 81, 222, 23, 27, 84, 130, 176, 98, 66, 240, 207, 18, 23, 28, 163, 163, 194, 45, 37, 129, 202, 170, 97, 189, 0, 81, 238, 0, 39, 199, 163, 35, 211, 206, 247, 65, 29, 116, 242, 67, 102, 235, 13, 136, 232, 230, 114, 146, 187, 7, 254, 142, 26, 121, 16, 237, 5, 160, 201, 114, 94, 178, 199, 95, 212, 241, 45, 112, 180, 188, 72, 86, 114, 189, 155, 149, 149, 163, 210, 112, 101, 12, 69, 225, 75, 202, 223, 28, 242, 90, 215, 156, 169, 224, 245, 135, 128, 92, 148, 217, 131, 208, 255, 25, 135, 117, 136, 5, 104, 185, 249, 161, 228, 214, 16, 105, 204, 9, 182, 135, 153, 220, 101, 244, 160, 207, 58, 182, 118, 185, 240, 57, 245, 123, 13, 112, 182, 106, 229, 220, 90, 29, 86, 215, 96, 147, 232, 2, 55, 131, 225, 137, 68, 245, 89, 141, 252, 97, 3, 129, 155, 216, 223, 98, 116, 45, 78, 85, 141, 161, 74, 215, 7, 150, 171, 225, 59, 78, 221, 152, 236, 14, 117, 100, 208, 158, 86, 13, 185, 124, 87, 157, 111, 40, 187, 182, 124, 173, 71, 173, 23, 199, 52, 155, 190, 134, 11, 23, 64, 25, 215, 39, 115, 231, 173, 77, 72, 114, 54, 252, 116, 178, 59, 221, 106, 241, 119, 254, 30, 226, 241, 204, 233, 113, 197, 96, 146, 0, 41, 67, 3, 231, 126, 12, 218, 202, 22, 171, 114, 249, 176, 134, 160, 19, 216, 31, 229, 118, 226, 62, 242, 126, 126, 42, 127, 130, 68, 218, 218, 81, 202, 106, 217, 191, 25, 177, 82, 97, 81, 36, 232, 137, 58, 90, 216, 190, 117, 235, 20, 194, 144, 76, 178, 27, 213, 13, 208, 18, 29, 118, 126, 49, 98, 203, 179, 128, 237, 100, 32, 242, 189, 212, 6, 210, 210, 188, 161, 205, 13, 124, 119, 13, 215, 112, 41, 183, 176, 215, 168, 210, 182, 111, 1, 115, 2, 239, 141, 8, 177, 124, 112, 48, 197, 2, 239, 11, 99, 4, 36, 77, 69, 47, 244, 19, 153, 61, 19, 2, 96, 176, 7, 112, 122, 131, 169, 25, 189, 116, 171, 49, 12, 121, 162, 79, 154, 74, 251, 50, 233, 182, 63, 180, 224, 118, 49, 253, 21, 20, 16, 31, 144, 184, 93, 174, 231, 244, 183, 13, 49, 225, 189, 211, 73, 185, 49, 110, 142, 25, 226, 45, 176, 233, 204, 74, 33, 16, 205, 88, 131, 92, 157, 170, 175, 68, 170, 61, 53, 116, 165, 16, 27, 182, 160, 181, 87, 241, 15, 151, 85, 107, 76, 167, 129, 25, 172, 127, 184, 138, 153, 222, 228, 125, 64, 44, 45, 32, 12, 227, 148, 106, 152, 83, 240, 166, 54, 235, 32, 190, 12, 242, 164, 123, 189, 53, 194, 141, 104, 43, 202, 110, 4, 168, 119, 245, 232, 179, 178, 198, 1, 224, 87, 86, 160, 31, 19, 140, 233, 102, 191, 204, 4, 98, 138, 163, 191, 106, 24, 213, 47, 208, 82, 137, 132, 131, 16, 253, 84, 25, 144, 90, 159, 148, 16, 196, 84, 166, 61, 160, 101, 229, 227, 93, 118, 59, 87, 66, 16, 128, 59, 96, 131, 250, 20, 184, 150, 205, 91, 227, 201, 62, 35, 79, 180, 172, 173, 85, 197, 106, 153, 238, 229, 60, 204, 65, 193, 230, 94, 101, 177, 134, 6, 165, 53, 171, 142, 208, 155, 2, 11, 4, 202, 127, 54, 17, 142, 117, 227, 121, 128, 204, 192, 147, 147, 92, 189, 5, 224, 148, 72, 18, 83, 101, 126, 124, 228, 153, 242, 123, 229, 247, 92, 221, 6, 73, 227, 250, 87, 167, 194, 129, 187, 73, 38, 185, 109, 217, 240, 193, 88, 50, 178, 180, 151, 54, 197, 187, 137, 190, 166, 233, 1, 103, 204, 88, 31, 127, 185, 29, 65, 1, 29, 254, 223, 14, 83, 167, 215, 114, 248, 30, 173, 89, 173, 187, 69, 5, 105, 117, 15, 106, 94, 173, 63, 227, 25, 230, 190, 136, 168, 177, 175, 107, 91, 126, 254, 34, 188, 25, 118, 48, 12, 226, 130, 153, 162, 57, 47, 181, 212, 79, 160, 97, 64, 157, 246, 90, 53, 43, 149, 76, 102, 15, 195, 107, 58, 242, 84, 172, 29, 81, 198, 113, 81, 251, 138, 182, 154, 111, 30, 171, 129, 56, 17, 45, 214, 153, 112, 117, 203, 174, 40, 38, 234, 236, 32, 4, 112, 225, 26, 187, 195, 246, 252, 9, 218, 69, 160, 223, 178, 54, 148, 81, 8, 134, 151, 75, 248, 63, 224, 240, 48, 75, 250, 221, 85, 46, 100, 50, 3, 70, 64, 102, 111, 160, 155, 233, 59, 147, 184, 57, 61, 6, 126, 79, 176, 16, 185, 94, 166, 33, 135, 78, 42, 75, 140, 208, 140, 44, 153, 187, 64, 103, 119, 160, 236, 16, 239, 74, 218, 219, 212, 207, 110, 53, 30, 76, 248, 40, 111, 98, 44, 20, 113, 204, 233, 109, 135, 96, 107, 39, 163, 203, 125, 45, 157, 152, 71, 239, 175, 174, 159, 147, 80, 111, 93, 38, 253, 228, 154, 225, 181, 101, 12, 241, 127, 65, 49, 189, 5, 85, 151, 237, 213, 143, 14, 104, 138, 54, 52, 27, 4, 132, 67, 35, 156, 86, 157, 73, 16, 229, 222, 245, 110, 79, 165, 179, 56, 179, 53, 218, 229, 100, 58, 87, 149, 48, 231, 64, 63, 115, 67, 3, 172, 6, 186, 115, 154, 60, 53, 214, 152, 149, 89, 234, 37, 143, 82, 255, 64, 28, 183, 93, 112, 39, 70, 185, 57, 0, 199, 9, 61, 175, 219, 41, 76, 37, 176, 82, 125, 65, 53, 160, 214, 105, 62, 153, 244, 222, 96, 205, 6, 178, 85, 41, 240, 113, 0, 96, 149, 38, 3, 195, 18, 152, 41, 246, 3, 103, 29, 110, 134, 30, 101, 75, 46, 103, 199, 184, 20, 230, 8, 55, 120, 4, 229, 168, 35, 43, 7, 28, 161, 143, 87, 27, 87, 79, 255, 186, 44, 195, 158, 155, 181, 119, 81, 172, 217, 107, 95, 98, 55, 243, 186, 66, 105, 48, 224, 123, 232, 84, 156, 20, 10, 156, 208, 204, 52, 34, 228, 136, 97, 242, 200, 246, 211, 67, 202, 40, 241, 91, 92, 253, 9, 54, 72, 131, 221, 106, 178, 32, 44, 182, 4, 225, 193, 37, 20, 249, 249, 231, 10, 206, 18, 71, 254, 221, 187, 172, 88, 204, 6, 127, 138, 102, 7, 208, 75, 147, 219, 199, 177, 79, 36, 170, 101, 207, 177, 109, 95, 143, 217, 41, 199, 80, 183, 201, 2, 254, 12, 55, 23, 198, 14, 255, 69, 245, 138, 155, 129, 227, 167, 168, 130, 156, 135, 14, 96, 93, 48, 99, 143, 107, 126, 92, 117, 143, 112, 108, 193, 228, 84, 13, 41, 186, 27, 172, 92, 201, 149, 116, 19, 112, 197, 116, 209, 128, 102, 1, 55, 152, 177, 28, 37, 34, 50, 83, 41, 199, 74, 178, 59, 111, 67, 118, 35, 252, 36, 33, 87, 28, 170, 17, 215, 47, 90, 154, 124, 137, 15, 14, 211, 59, 75, 59, 30, 77, 0, 49, 37, 225, 191, 87, 101, 127, 214, 227, 160, 99, 174, 234, 82, 148, 235, 16, 241, 219, 147, 170, 127, 221, 250, 116, 39, 218, 156, 72, 227, 172, 55, 0, 79, 188, 76, 51, 222, 232, 24, 36, 62, 94, 154, 3, 61, 230, 146, 114, 253, 0, 128, 58, 253, 90, 72, 211, 242, 38, 39, 133, 153, 161, 119, 105, 195, 152, 225, 208, 105, 140, 80, 217, 186, 196, 157, 21, 116, 230, 116, 139, 25, 159, 143, 118, 128, 77, 201, 238, 247, 228, 15, 168, 4, 133, 148, 21, 148, 12, 44, 241, 7, 115, 17, 129, 176, 202, 46, 130, 122, 129, 235, 141, 223, 85, 21, 199, 65, 181, 169, 52, 174, 161, 153, 62, 25, 164, 115, 213, 89, 138, 199, 103, 79, 200, 165, 135, 249, 244, 27, 209, 178, 240, 129, 211, 61, 9, 111, 157, 147, 119, 36, 119, 255, 110, 130, 84, 49, 210, 225, 247, 100, 26, 121, 127, 163, 160, 26, 79, 99, 24, 77, 65, 32, 178, 109, 36, 27, 253, 173, 110, 183, 11, 14, 211, 57, 130, 254, 124, 104, 165, 219, 31, 70, 97, 14, 194, 39, 61, 26, 141, 125, 228, 126, 194, 184, 101, 160, 204, 106, 128, 144, 106, 103, 171, 18, 246, 129, 220, 85, 172, 151, 123, 5, 73, 155, 192, 175, 91, 157, 239, 61, 237, 116, 170, 65, 233, 56, 19, 49, 114, 168, 190, 3, 214, 53, 250, 90, 213, 244, 88, 101, 30, 229, 248, 124, 15, 71, 141, 27, 172, 235, 21, 129, 211, 72, 61, 172, 112, 170, 128, 135, 96, 196, 221, 255, 27, 176, 105, 188, 183, 121, 33, 37, 149, 53, 131, 226, 233, 29, 167, 234, 218, 109, 53, 185, 152, 36, 248, 53, 61, 235, 78, 21, 201, 214, 210, 163, 12, 251, 187, 45, 188, 137, 126, 127, 237, 92, 234, 91, 240, 225, 38, 194, 57, 213, 251, 237, 171, 30, 99, 52, 14, 49, 84, 101, 252, 237, 7, 166, 122, 114, 32, 107, 32, 207, 239, 136, 168, 178, 12, 11, 241, 233, 230, 146, 132, 18, 83, 233, 41, 172, 17, 6, 161, 42, 113, 87, 40, 255, 185, 1, 146, 128, 5, 240, 126, 131, 71, 42, 54, 124, 205, 2, 122, 71, 30, 222, 229, 40, 134, 142, 102, 97, 239, 151, 177, 1, 230, 231, 49, 123, 219, 28, 129, 91, 152, 112, 13, 154, 81, 197, 226, 255, 112, 158, 178, 177, 55, 181, 108, 138, 185, 245, 29, 186, 21, 73, 188, 209, 154, 200, 89, 116, 235, 198, 144, 36, 87, 248, 22, 7, 200, 122, 7, 148, 44, 42, 87, 140, 238, 204, 95, 231, 252, 0, 136, 0, 22, 39, 70, 123, 125, 165, 113, 227, 172, 146, 163, 128, 158, 36, 52, 91, 19, 36, 245, 27, 150, 138, 141, 11, 67, 239, 224, 65, 24, 116, 101, 7, 39, 46, 142, 172, 164, 243, 148, 0, 33, 226, 59, 47, 203, 137, 156, 241, 66, 250, 157, 30, 204, 101, 143, 134, 98, 238, 155, 226, 25, 184, 136, 219, 89, 100, 193, 11, 143, 71, 139, 243, 230, 151, 0, 249, 1, 78, 26, 32, 93, 104, 157, 67, 97, 164, 248, 86, 124, 146, 93, 74, 222, 228, 167, 55, 53, 100, 135, 216, 109, 13, 64, 37, 106, 177, 200, 200, 182, 92, 251, 69, 31, 243, 89, 80, 198, 14, 132, 203, 72, 103, 28, 104, 217, 24, 97, 223, 113, 11, 29, 178, 191, 210, 46, 162, 255, 68, 99, 8, 237, 213, 162, 152, 193, 183, 121, 203, 19, 108, 182, 29, 86, 26, 192, 103, 220, 103, 205, 154, 179, 197, 9, 22, 73, 127, 175, 146, 38, 119, 210, 0, 24, 180, 21, 245, 215, 204, 91, 186, 119, 138, 183, 239, 15, 155, 231, 248, 133, 39, 24, 101, 144, 236, 10, 230, 54, 174, 227, 73, 21, 110, 10, 160, 241, 232, 131, 14, 212, 127, 232, 59, 122, 65, 146, 54, 163, 9, 189, 190, 121, 88, 170, 62, 194, 14, 204, 152, 245, 38, 131, 37, 91, 81, 72, 114, 29, 115, 239, 182, 56, 44, 156, 159, 177, 180, 82, 160, 93, 97, 86, 183, 236, 50, 95, 85, 39, 71, 181, 225, 152, 143, 63, 123, 117, 34, 44, 109, 160, 166, 229, 240, 91, 138, 102, 54, 180, 173, 44, 50, 80, 42, 124, 7, 50, 124, 211, 239, 21, 94, 197, 185, 239, 213, 107, 142, 64, 95, 124, 125, 17, 180, 97, 189, 101, 52, 48, 19, 112, 12, 70, 9, 212, 177, 54, 118, 66, 84, 147, 236, 248, 26, 124, 95, 103, 135, 254, 124, 49, 112, 186, 99, 120, 90, 8, 194, 191, 88, 57, 242, 65, 61, 10, 104, 246, 197, 252, 19, 159, 58, 194, 75, 173, 242, 103, 8, 115, 84, 69, 238, 149, 26, 15, 159, 182, 141, 132, 119, 70, 29, 53, 20, 143, 46, 163, 204, 6, 236, 59, 45, 185, 172, 89, 119, 83, 38, 144, 36, 222, 96, 151, 26, 99, 195, 163, 170, 133, 92, 159, 214, 53, 150, 116, 90, 176, 69, 145, 130, 15, 172, 140, 217, 215, 101, 163, 115, 161, 65, 101, 8, 7, 183, 113, 213, 134, 58, 175, 130, 251, 143, 173, 248, 168, 135, 60, 159, 30, 194, 68, 208, 119, 120, 2, 40, 178, 227, 247, 161, 77, 47, 136, 46, 244, 163, 72, 65, 158, 25, 225, 195, 61, 132, 182, 204, 177, 186, 200, 81, 2, 65, 105, 212, 72, 94, 203, 232, 217, 182, 123, 251, 228, 160, 1, 161, 204, 123, 20, 37, 1, 77, 208, 179, 45, 149, 181, 122, 102, 190, 123, 213, 164, 231, 41, 216, 130, 234, 248, 208, 251, 252, 220, 84, 209, 67, 47, 61, 220, 5, 142, 162, 26, 236, 121, 142, 248, 132, 255, 65, 122, 203, 196, 102, 191, 187, 2, 195, 127, 255, 193, 92, 49, 91, 186, 154, 39, 156, 29, 211, 172, 49, 104, 245, 114, 153, 223, 211, 199, 249, 35, 130, 160, 128, 0, 152, 176, 183, 20, 236, 113, 193, 108, 26, 255, 11, 237, 102, 133, 245, 94, 115, 114, 10, 89, 229, 214, 221, 99, 149, 30, 99, 37, 246, 10, 26, 26, 39, 92, 123, 170, 73, 211, 127, 227, 54, 30, 86, 133, 159, 112, 225, 91, 148, 100, 174, 149, 75, 143, 14, 140, 20, 44, 64, 212, 5, 243, 8, 116, 63, 30, 97, 42, 123, 20, 73, 212, 85, 207, 83, 122, 27, 251, 233, 84, 10, 17, 236, 232, 83, 200, 127, 119, 143, 163, 204, 220, 167, 59, 231, 20, 106, 186, 222, 191, 8, 40, 234, 21, 25, 180, 13, 116, 250, 152, 224, 174, 75, 3, 205, 38, 173, 215, 236, 151, 185, 121, 254, 244, 154, 239, 17, 53, 106, 164, 61, 49, 116, 216, 118, 94, 150, 35, 181, 26, 238, 66, 49, 211, 221, 132, 146, 166, 115, 39, 136, 36, 205, 230, 179, 31, 197, 51, 148, 165, 109, 38, 70, 37, 148, 52, 44, 209, 250, 98, 58, 246, 225, 103, 198, 101, 26, 25, 196, 207, 8, 166, 21, 88, 252, 175, 253, 10, 88, 107, 157, 19, 225, 61, 12, 246, 221, 37, 239, 186, 167, 137, 142, 135, 222, 128, 174, 62, 95, 216, 38, 141, 157, 45, 232, 97, 217, 173, 203, 234, 116, 129, 69, 206, 189, 94, 221, 12, 54, 139, 186, 247, 184, 16, 200, 121, 244, 104, 8, 7, 35, 111, 47, 188, 10, 140, 92, 73, 143, 206, 203, 72, 122, 184, 20, 102, 197, 130, 64, 150, 63, 96, 239, 8, 132, 111, 217, 84, 91, 198, 32, 43, 100, 138, 241, 15, 160, 42, 190, 253, 193, 184, 164, 124, 29, 210, 96, 67, 224, 221, 182, 29, 218, 129, 149, 29, 128, 174, 98, 88, 88, 125, 56, 40, 255, 120, 5, 0, 87, 174, 42, 150, 90, 112, 201, 183, 169, 19, 57, 195, 191, 12, 58, 244, 235, 132, 25, 145, 72, 146, 214, 8, 125, 100, 135, 12, 5, 102, 97, 248, 174, 24, 159, 90, 33, 43, 187, 6, 61, 212, 241, 225, 190, 219, 252, 197, 123, 129, 164, 108, 123, 55, 230, 4, 153, 166, 105, 234, 15, 85, 216, 23, 56, 32, 3, 41, 110, 68, 146, 172, 133, 202, 98, 41, 7, 47, 152, 35, 255, 168, 106, 241, 226, 222, 77, 244, 52, 185, 65, 252, 227, 32, 66, 38, 11, 172, 60, 28, 28, 103, 84, 1, 1, 205, 182, 190, 28, 189, 102, 253, 43, 1, 191, 148, 116, 10, 227, 18, 81, 93, 80, 239, 157, 232, 215, 180, 163, 165, 161, 109, 177, 71, 150, 244, 144, 208, 160, 110, 22, 174, 60, 206, 43, 103, 121, 55, 103, 114, 115, 173, 238, 13, 10, 227, 251, 41, 176, 216, 158, 229, 216, 55, 234, 128, 128, 20, 167, 106, 181, 86, 163, 130, 215, 110, 149, 191, 10, 227, 215, 8, 214, 154, 178, 181, 15, 19, 0, 247, 250, 97, 74, 43, 157, 55, 94, 174, 41, 41, 9, 199, 97, 20, 91, 32, 18, 10, 43, 98, 240, 247, 203, 20, 250, 117, 160, 44, 229, 202, 187, 64, 54, 124, 15, 184, 169, 129, 27, 160, 240, 26, 61, 255, 60, 166, 60, 144, 209, 84, 55, 187, 186, 168, 13, 124, 125, 29, 17, 100, 249, 227, 62, 205, 78, 179, 163, 168, 139, 168, 21, 38, 83, 239, 151, 74, 43, 66, 2, 92, 72, 71, 94, 216, 134, 238, 20, 45, 158, 213, 164, 73, 57, 80, 47, 198, 184, 130, 223, 227, 71, 132, 133, 235, 177, 85, 174, 142, 124, 172, 200, 54, 229, 40, 126, 60, 76, 92, 216, 153, 56, 241, 174, 66, 141, 90, 226, 3, 30, 68, 234, 71, 187, 163, 112, 146, 255, 22, 143, 170, 204, 3, 127, 179, 81, 139, 160, 37, 77, 246, 128, 220, 196, 158, 153, 73, 177, 65, 199, 119, 29, 197, 144, 130, 248, 206, 155, 253, 108, 213, 124, 7, 223, 221, 162, 146, 134, 242, 65, 99, 162, 107, 120, 247, 214, 207, 96, 150, 169, 131, 208, 218, 221, 28, 24, 112, 208, 23, 1, 130, 142, 232, 56, 104, 45, 33, 158, 95, 255, 123, 31, 74, 76, 120, 178, 155, 213, 6, 195, 164, 8, 8, 69, 241, 197, 127, 83, 169, 21, 167, 19, 94, 143, 252, 33, 159, 248, 241, 170, 153, 147, 1, 149, 199, 201, 131, 170, 79, 236, 212, 209, 143, 107, 98, 24, 123, 56, 33, 193, 85, 247, 64, 225, 135, 210, 78, 145, 57, 16, 145, 71, 170, 20, 133, 87, 235, 4, 166, 239, 100, 82, 235, 81, 50, 223, 9, 193, 52, 49, 86, 129, 190, 196, 82, 165, 107, 63, 115, 161, 98, 33, 20, 193, 29, 42, 151, 205, 252, 124, 72, 245, 48, 181, 67, 7, 13, 21, 127, 59, 226, 188, 144, 129, 112, 244, 192, 121, 213, 80, 42, 196, 1, 13, 107, 108, 78, 0, 40, 121, 225, 148, 237, 234, 209, 216, 238, 9, 147, 226, 254, 96, 89, 212, 72, 193, 106, 75, 135, 74, 227, 67, 255, 92, 191, 81, 188, 124, 226, 149, 152, 142, 15, 159, 195, 238, 114, 55, 255, 166, 157, 230, 59, 148, 170, 166, 151, 65, 213, 104, 253, 253, 112, 150, 82, 147, 137, 27, 214, 100, 247, 65, 81, 92, 47, 86, 217, 7, 45, 120, 81, 130, 31, 236, 243, 76, 78, 3, 45, 105, 172, 220, 71, 48, 220, 94, 196, 249, 163, 193, 133, 50, 236, 205, 20, 55, 2, 63, 14, 127, 69, 113, 212, 204, 12, 58, 79, 89, 86, 29, 61, 199, 201, 64, 149, 6, 144, 182, 150, 129, 31, 18, 167, 120, 248, 82, 107, 25, 143, 128, 27, 161, 28, 25, 153, 183, 217, 238, 78, 186, 106, 92, 27, 202, 219, 165, 96, 0, 216, 234, 169, 73, 101, 39, 182, 113, 217, 240, 170, 116, 172, 221, 250, 233, 48, 49, 242, 83, 227, 92, 181, 184, 72, 230, 180, 21, 15, 108, 135, 25, 38, 153, 25, 124, 227, 26, 149, 73, 236, 39, 211, 244, 149, 58, 183, 132, 26, 223, 219, 174, 144, 117, 233, 219, 165, 205, 157, 159, 222, 184, 52, 47, 241, 201, 123, 65, 24, 44, 55, 215, 177, 168, 250, 179, 115, 190, 227, 123, 158, 163, 179, 224, 69, 196, 66, 207, 254, 243, 101, 221, 193, 140, 250, 4, 28, 222, 52, 96, 138, 160, 33, 218, 64, 118, 214, 234, 201, 152, 148, 91, 178, 111, 107, 144, 142, 6, 182, 102, 72, 188, 34, 213, 181, 26, 223, 58, 255, 103, 81, 17, 47, 169, 11, 245, 224, 123, 148, 215, 237, 186, 107, 75, 152, 90, 202, 166, 22, 149, 197, 5, 246, 238, 78, 76, 229, 106, 199, 94, 127, 195, 0, 45, 82, 6, 159, 103, 96, 138, 231, 71, 46, 107, 59, 216, 39, 43, 12, 221, 27, 214, 56, 155, 145, 66, 187, 169, 250, 235, 78, 211, 179, 239, 183, 198, 163, 93, 5, 196, 24, 174, 143, 225, 106, 139, 89, 98, 13, 127, 207, 184, 194, 30, 1, 165, 198, 169, 8, 197, 118, 86, 163, 221, 138, 23, 209, 61, 116, 79, 99, 233, 43, 130, 60, 244, 85, 229, 243, 172, 123, 148, 200, 120, 192, 127, 211, 52, 11, 159, 41, 95, 212, 230, 188, 169, 156, 137, 29, 212, 12, 148, 168, 148, 133, 243, 44, 241, 139, 127, 24, 246, 220, 227, 125, 209, 97, 60, 52, 162, 192, 146, 49, 161, 92, 138, 112, 189, 128, 59, 126, 125, 46, 207, 60, 79, 231, 174, 152, 209, 68, 223, 205, 2, 38, 14, 91, 116, 159, 255, 28, 27, 178, 248, 164, 104, 158, 79, 69, 214, 234, 157, 12, 75, 163, 83, 253, 245, 202, 61, 213, 176, 6, 197, 230, 29, 208, 166, 253, 194, 254, 235, 29, 141, 241, 70, 249, 15, 62, 0, 148, 163, 135, 52, 122, 40, 96, 87, 31, 179, 152, 51, 216, 133, 184, 122, 198, 203, 60, 115, 218, 191, 193, 16, 178, 25, 148, 252, 112, 104, 103, 252, 36, 92, 221, 28, 179, 43, 199, 198, 151, 128, 100, 252, 217, 161, 249, 34, 201, 172, 118, 52, 180, 252, 104, 7, 223, 44, 116, 102, 212, 21, 40, 224, 184, 55, 163, 210, 21, 207, 161, 239, 51, 54, 155, 41, 133, 18, 67, 48, 3, 165, 130, 251, 4, 79, 214, 57, 72, 130, 157, 212, 144];
  6186. function O(e, t, n) {
  6187. var r = e.gl,
  6188. i = 5,
  6189. o = .1,
  6190. a = .5,
  6191. s = 175 / 180 * 3.141593,
  6192. c = 115 / 180 * 3.141593,
  6193. d = 173 / 180 * 3.141593,
  6194. u = 116 / 180 * 3.141593,
  6195. l = 2.04203545,
  6196. p = 0,
  6197. f = 0,
  6198. g = 0,
  6199. m = [],
  6200. h = [0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22, 24, 26, 29, 31, 34, 36, 39, 41, 44, 46, 49, 51, 54, 56, 59, 61, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 197, 198, 199, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 219, 220, 221, 222, 223, 224, 226, 226, 226, 227, 227, 227, 228, 228, 228, 229, 229, 229, 230, 230, 231, 231, 231, 232, 232, 232, 233, 233, 233, 234, 234, 235, 235, 235, 236, 236, 236, 237, 237, 237, 238, 238, 239, 239, 239, 240, 240, 240, 241, 241, 241, 242, 242, 243, 243, 243, 244, 244, 244, 245, 245, 245, 246, 246, 246, 247, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 253, 253, 253, 254, 254, 254, 255],
  6201. E = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 35, 36, 37, 39, 40, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 98, 100, 101, 102, 103, 105, 106, 107, 108, 110, 111, 112, 113, 115, 116, 117, 118, 120, 121, 122, 124, 125, 126, 127, 129, 130, 131, 132, 134, 135, 136, 137, 139, 140, 141, 142, 144, 145, 146, 147, 149, 150, 151, 152, 154, 155, 156, 158, 159, 160, 161, 163, 164, 165, 166, 168, 169, 170, 171, 173, 174, 175, 176, 178, 179, 180, 181, 183, 184, 185, 186, 188, 189, 190, 192, 193, 194, 195, 197, 198, 199, 200, 202, 203, 204, 205, 207, 208, 209, 210, 212, 213, 214, 215, 217, 218, 219, 220, 222, 223, 224, 226, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, 244, 245, 245, 245, 246, 246, 246, 247, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 253, 253, 253, 254, 254, 254, 255],
  6202. _ = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 77, 78, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 94, 95, 96, 98, 99, 100, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 116, 117, 118, 120, 121, 122, 124, 125, 127, 128, 129, 131, 132, 133, 135, 136, 138, 139, 140, 142, 143, 144, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, 202, 203, 203, 204, 205, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 219, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 253, 254, 255];
  6203. this.program = v(r, b),
  6204. this.setUniforms = function() {
  6205. var t = r.getUniformLocation(this.program, "u_flipY"),
  6206. n = r.getUniformLocation(this.program, "u_denoiseLevel");
  6207. r.uniform1f(n, i),
  6208. r.uniform1f(t, 1);
  6209. var h = r.getUniformLocation(this.program, "light");
  6210. r.uniform1f(h, o);
  6211. var v = r.getUniformLocation(this.program, "redness");
  6212. r.uniform1f(v, a);
  6213. var E = r.getUniformLocation(this.program, "skin_he_max"),
  6214. _ = r.getUniformLocation(this.program, "skin_he_min"),
  6215. S = r.getUniformLocation(this.program, "skin_hc_max"),
  6216. y = r.getUniformLocation(this.program, "skin_hc_min"),
  6217. R = r.getUniformLocation(this.program, "skin_hc_axis"),
  6218. T = r.getUniformLocation(this.program, "facts_rotate_c"),
  6219. I = r.getUniformLocation(this.program, "facts_rotate_le"),
  6220. A = r.getUniformLocation(this.program, "facts_rotate_ge");
  6221. r.uniform1f(E, s),
  6222. r.uniform1f(_, c),
  6223. r.uniform1f(S, d),
  6224. r.uniform1f(y, u),
  6225. r.uniform1f(R, l),
  6226. r.uniform1f(T, p),
  6227. r.uniform1f(I, f),
  6228. r.uniform1f(A, g);
  6229. var b = r.getUniformLocation(this.program, "u_originImage");
  6230. r.activeTexture(r.TEXTURE2),
  6231. r.bindTexture(r.TEXTURE_2D, e.inputTexture),
  6232. r.uniform1i(b, 2);
  6233. for (var O = ["lighten_lut"], C = [r.TEXTURE3], N = 0; N < O.length; N++) {
  6234. var w = r.getUniformLocation(this.program, O[N]);
  6235. r.activeTexture(C[N]),
  6236. r.bindTexture(r.TEXTURE_2D, m[N]),
  6237. r.uniform1i(w, N + 3)
  6238. }
  6239. },
  6240. this.setParameters = function(e) {
  6241. void 0 !== e.denoiseLevel && (i = e.denoiseLevel),
  6242. void 0 !== e.lightLevel && (o = e.lightLevel),
  6243. void 0 !== e.rednessLevel && (a = e.rednessLevel, this._updateRedness(a)),
  6244. void 0 !== e.lighteningContrastLevel && this._updateLut(e.lighteningContrastLevel)
  6245. },
  6246. this._updateRedness = function(e) {
  6247. var t, n, r = 3.141593,
  6248. i = e,
  6249. o = i;
  6250. i > 1 && (i = 1),
  6251. i < 0 && (i = 0),
  6252. o > 1 && (o = 1),
  6253. o < 0 && (o = 0),
  6254. p = .8 * i,
  6255. o < .8 && (o = 0),
  6256. (l = (117 - 4 * o) / 180 * r) < (u = (116 - 4 * o) / 180 * r) && (l = u),
  6257. u < r / 2 && (u = r / 2),
  6258. l < r / 2 && (l = r / 2),
  6259. (c = (115 - 4 * o) / 180 * r) < r / 2 && (c = r / 2),
  6260. (d = 173 / 180 * r) > r && (d = r),
  6261. l > r && (l = r),
  6262. (s = 175 / 180 * r) > r && (s = r),
  6263. n = d - l,
  6264. g = (t = s - d) > .01 ? p * n / t: p,
  6265. n = l - u,
  6266. f = (t = u - c) > .01 ? p * n / t: p
  6267. },
  6268. this._updateLut = function(e) {
  6269. var t = null;
  6270. 0 == e && (t = E),
  6271. 1 == e && (t = _),
  6272. 2 == e && (t = h);
  6273. for (var n = [new Uint8Array(t)], i = [256], o = [1], a = 0; a < n.length; a++) r.bindTexture(r.TEXTURE_2D, m[a]),
  6274. r.texImage2D(r.TEXTURE_2D, 0, r.LUMINANCE, i[a], o[a], 0, r.LUMINANCE, r.UNSIGNED_BYTE, n[a])
  6275. },
  6276. this._init = function() {
  6277. var e = null;
  6278. e = E;
  6279. for (var t = [new Uint8Array(e)], n = [256], i = [1], o = 0; o < t.length; o++) {
  6280. var a = r.createTexture();
  6281. r.bindTexture(r.TEXTURE_2D, a),
  6282. r.texImage2D(r.TEXTURE_2D, 0, r.LUMINANCE, n[o], i[o], 0, r.LUMINANCE, r.UNSIGNED_BYTE, t[o]),
  6283. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE),
  6284. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE),
  6285. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR),
  6286. r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR),
  6287. m.push(a)
  6288. }
  6289. },
  6290. this._init()
  6291. }
  6292. var C = !1;
  6293. function N() {
  6294. this.programs = [];
  6295. var e = this,
  6296. t = null,
  6297. n = null;
  6298. e.gl = null,
  6299. e.inputTexture = null;
  6300. var r = [],
  6301. i = [],
  6302. o = 0,
  6303. a = 0;
  6304. e._initGl = function(n, s) {
  6305. e.inputTexture = t.createTexture(),
  6306. t.bindTexture(t.TEXTURE_2D, e.inputTexture),
  6307. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE),
  6308. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE),
  6309. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR),
  6310. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR);
  6311. for (var c = 0; c < 4; c++) {
  6312. var d = t.createTexture();
  6313. t.bindTexture(t.TEXTURE_2D, d),
  6314. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE),
  6315. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE),
  6316. t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR),
  6317. c < 2 ? t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, n, s, 0, t.RGBA, t.UNSIGNED_BYTE, null) : t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, s, n, 0, t.RGBA, t.UNSIGNED_BYTE, null);
  6318. var u = t.createFramebuffer();
  6319. t.bindFramebuffer(t.FRAMEBUFFER, u),
  6320. t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, d, 0),
  6321. r.push(d),
  6322. i.push(u)
  6323. }
  6324. t.viewport(0, 0, n, s),
  6325. o = n,
  6326. a = s
  6327. },
  6328. e.render = function(s) {
  6329. if (t) {
  6330. var c = 0;
  6331. a == s.videoWidth && o === s.videoHeight && (c = 2),
  6332. t.viewport(0, 0, s.videoWidth, s.videoHeight),
  6333. t.bindTexture(t.TEXTURE_2D, e.inputTexture),
  6334. t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, s);
  6335. for (var d = C ? e.programs.length - 1 : 0, u = 0; u <= d; u++) {
  6336. var l = e.programs[u].program;
  6337. t.useProgram(l);
  6338. var p = t.getUniformLocation(l, "u_image");
  6339. e.programs[u].setUniforms(),
  6340. t.bindFramebuffer(t.FRAMEBUFFER, i[c + u % 2]),
  6341. t.clearColor(0, 0, 0, 1),
  6342. t.clear(t.COLOR_BUFFER_BIT),
  6343. t.drawArrays(t.TRIANGLES, 0, 6),
  6344. t.activeTexture(t.TEXTURE0),
  6345. t.bindTexture(t.TEXTURE_2D, r[c + u % 2]),
  6346. t.uniform1i(p, 0)
  6347. }
  6348. t.useProgram(n);
  6349. var f = t.getUniformLocation(n, "u_flipY");
  6350. t.uniform1f(f, -1),
  6351. t.bindFramebuffer(t.FRAMEBUFFER, null),
  6352. t.clearColor(0, 0, 0, 1),
  6353. t.clear(t.COLOR_BUFFER_BIT),
  6354. t.drawArrays(t.TRIANGLES, 0, 6)
  6355. }
  6356. },
  6357. e.setEnableBeauty = function(e) {
  6358. C = e
  6359. },
  6360. e.init = function(r, i, o) {
  6361. if ("undefined" == typeof WebGLRenderingContext) throw new Error("NOT_SUPPORT");
  6362. t = o.getContext("webgl"),
  6363. e.gl = t,
  6364. e._initGl(r, i),
  6365. e.programs.push(new _(this, r, i)),
  6366. e.programs.push(new y(this, r, i)),
  6367. e.programs.push(new T(this, r, i)),
  6368. e.programs.push(new A(this, r, i)),
  6369. e.programs.push(new O(this, r, i)),
  6370. n = e.programs[0].program
  6371. },
  6372. e.release = function() {
  6373. e.gl = null,
  6374. t = null,
  6375. n = null,
  6376. e.inputTexture = null,
  6377. e.programs = [],
  6378. r = [],
  6379. i = []
  6380. },
  6381. e.setDenoiseLevel = function(t) {
  6382. e.programs.forEach((function(e) {
  6383. e.setParameters && e.setParameters({
  6384. denoiseLevel: t
  6385. })
  6386. }))
  6387. },
  6388. e.setLightLevel = function(t) {
  6389. e.programs.forEach((function(e) {
  6390. e.setParameters && e.setParameters({
  6391. lightLevel: t
  6392. })
  6393. }))
  6394. },
  6395. e.setRednessLevel = function(t) {
  6396. e.programs.forEach((function(e) {
  6397. e.setParameters && e.setParameters({
  6398. rednessLevel: t
  6399. })
  6400. }))
  6401. },
  6402. e.setContrastLevel = function(t) {
  6403. e.programs.forEach((function(e) {
  6404. e.setParameters && e.setParameters({
  6405. lighteningContrastLevel: t
  6406. })
  6407. }))
  6408. },
  6409. e.setSize = function(t, n) {
  6410. e.programs.forEach((function(e) {
  6411. e.setSize && e.setSize(t, n)
  6412. }))
  6413. }
  6414. }
  6415. N._instance = null,
  6416. N.getInstance = function() {
  6417. return N._instance || (N._instance = new N),
  6418. N._instance
  6419. };
  6420. t.a = {
  6421. addVideoEffectCapability: function(e) {
  6422. e.videoEffect = {
  6423. canvas: null,
  6424. video: null,
  6425. fps: 30,
  6426. stopChromeBackgroundLoop: null,
  6427. enableBeauty: !1,
  6428. denoiseLevel: 5,
  6429. lightLevel: .35,
  6430. rednessLevel: .5,
  6431. lighteningContrastLevel: 1,
  6432. videoContextInited: !1,
  6433. originVideoTrack: null,
  6434. canvasVideoTrack: null,
  6435. ctx: null
  6436. },
  6437. e._initVideoContext = function() {
  6438. if (e.videoEffect.videoContextInited) throw new Error("Failed to init video context. Already inited");
  6439. if (!e.stream) throw new Error("Failed to init video context. Local Stream not initialized");
  6440. e.videoEffect.originVideoTrack = e.stream.getVideoTracks()[0],
  6441. e.attributes && e.attributes.maxFrameRate && (e.videoEffect.fps = e.attributes.maxFrameRate),
  6442. e.videoEffect.videoContextInited = !0
  6443. },
  6444. e._renderWithWebGL = function(t) {
  6445. return new Promise((function(n) {
  6446. e.videoEffect.canvas || (e.videoEffect.canvas = document.createElement("canvas")),
  6447. e.videoEffect.video || (e.videoEffect.video = document.createElement("video")),
  6448. e.videoEffect.video.setAttribute("autoplay", ""),
  6449. e.videoEffect.video.setAttribute("muted", ""),
  6450. e.videoEffect.video.muted = !0,
  6451. e.videoEffect.video.setAttribute("playsinline", ""),
  6452. e.videoEffect.video.setAttribute("style", "display:none"),
  6453. e.videoEffect.video.srcObject = t;
  6454. var r = t.getVideoTracks()[0].getSettings(),
  6455. i = r.width,
  6456. o = r.height;
  6457. console.log("Width: ".concat(i, ", Height: ").concat(o)),
  6458. e.videoEffect.canvas.setAttribute("width", i),
  6459. e.videoEffect.canvas.setAttribute("height", o),
  6460. e.videoEffect.video.setAttribute("width", i),
  6461. e.videoEffect.video.setAttribute("height", o);
  6462. var a = N.getInstance();
  6463. a.init(e.videoEffect.video.width, e.videoEffect.video.height, e.videoEffect.canvas),
  6464. a.setDenoiseLevel(e.videoEffect.denoiseLevel),
  6465. a.setLightLevel(e.videoEffect.lightLevel),
  6466. a.setRednessLevel(e.videoEffect.rednessLevel),
  6467. a.setContrastLevel(e.videoEffect.lighteningContrastLevel);
  6468. e.videoEffect.video.addEventListener("playing", (function t() {
  6469. var r = e.videoEffect.canvas.captureStream(e.videoEffect.fps);
  6470. e.videoEffect.video.removeEventListener("playing", t, !0),
  6471. n([r.getVideoTracks()[0], e.videoEffect.video])
  6472. }), !0),
  6473. e.videoEffect.video.play()
  6474. }))
  6475. },
  6476. e._disableEffect = function() {
  6477. e.videoEffect.videoContextInited || e._initVideoContext();
  6478. var t = e.videoEffect.originVideoTrack;
  6479. if (!t) return p.
  6480. default.warning("Video track is null, fail to disable video effect!"),
  6481. Promise.resolve();
  6482. if (e.pc && e.pc.peerConnection && e.pc.peerConnection) {
  6483. var n = (e.pc.peerConnection && e.pc.peerConnection.getSenders()).find((function(e) {
  6484. return e && e.track && "video" == e.track.kind
  6485. }));
  6486. if (n && n.replaceTrack && t) return n.replaceTrack(t)
  6487. }
  6488. return Promise.resolve()
  6489. },
  6490. e._releaseEffect = function() {
  6491. var t;
  6492. return t = e.videoEffect.enableBeauty ? e._disableEffect() : Promise.resolve(),
  6493. N.getInstance().release(),
  6494. e.videoEffect.videoContextInited = !1,
  6495. e.videoEffect.canvasVideoTrack = null,
  6496. t
  6497. },
  6498. e._enableEffect = function() {
  6499. return e.videoEffect.videoContextInited || e._initVideoContext(),
  6500. e.videoEffect.originVideoTrack ? e.videoEffect.canvasVideoTrack ? (e._showEffectInLocalPlayer(), e._replaceWithCanvasTrack()) : e._renderWithWebGL(e.stream).then((function(t) {
  6501. var n = c()(t, 2),
  6502. r = n[0],
  6503. i = n[1];
  6504. e.videoEffect.canvasVideoTrack = r;
  6505. var o = N.getInstance();
  6506. return requestAnimationFrame((function t() {
  6507. e.videoEffect.enableBeauty && o.render(i),
  6508. e.videoEffect.videoContextInited && requestAnimationFrame(t)
  6509. })),
  6510. d.isChrome() && document.addEventListener("visibilitychange", (function() {
  6511. document.hidden;
  6512. document.hidden ? e.videoEffect.stopChromeBackgroundLoop = function(e, t) {
  6513. var n = 1 / t,
  6514. r = new AudioContext,
  6515. i = r.createGain();
  6516. i.gain.value = 0,
  6517. i.connect(r.destination),
  6518. function t() {
  6519. var a = r.createOscillator();
  6520. a.onended = t,
  6521. a.connect(i),
  6522. a.start(0),
  6523. a.stop(r.currentTime + n),
  6524. e(r.currentTime),
  6525. o && (a.onended = function() {
  6526. r.close()
  6527. })
  6528. } ();
  6529. var o = !1;
  6530. return function() {
  6531. o = !0
  6532. }
  6533. } ((function() {
  6534. e.videoEffect.enableBeauty && o.render(i)
  6535. }), e.videoEffect.fps) : e.videoEffect.stopChromeBackgroundLoop && (e.videoEffect.stopChromeBackgroundLoop(), e.videoEffect.stopChromeBackgroundLoop = null)
  6536. }), !1),
  6537. e._showEffectInLocalPlayer(),
  6538. e._replaceWithCanvasTrack()
  6539. })) : (p.
  6540. default.warning("Video track is null, fail to enable video effect!"), Promise.resolve())
  6541. },
  6542. e._showEffectInLocalPlayer = function() {
  6543. if (e.player) {
  6544. var t = e.player.div.children[0];
  6545. if ("none" !== t.style.display && (e.player.div.appendChild(e.videoEffect.canvas), "video" === t.tagName.toLowerCase())) {
  6546. var n = t.getAttribute("style");
  6547. e.videoEffect.canvas.setAttribute("style", n),
  6548. "none" !== t.style.display && (t.style.display = "none")
  6549. }
  6550. }
  6551. },
  6552. e._removeEffectFromLocalPlayer = function() {
  6553. if (e.player && e.player.div && e.videoEffect.enableBeauty && e.videoEffect.canvas) {
  6554. e.player.div.removeChild(e.videoEffect.canvas);
  6555. var t = e.player.div.children[0];
  6556. "video" === t.tagName.toLowerCase() && (e.videoEffect.canvas.style.display = "none", t.style.display = "block")
  6557. }
  6558. },
  6559. e._replaceWithCanvasTrack = function() {
  6560. var t = null;
  6561. e.pc && e.pc.peerConnection && e.pc.peerConnection && (t = (e.pc.peerConnection && e.pc.peerConnection.getSenders()).find((function(e) {
  6562. return e && e.track && "video" == e.track.kind
  6563. })));
  6564. return t && t.replaceTrack && e.videoEffect.canvasVideoTrack ? t.replaceTrack(e.videoEffect.canvasVideoTrack) : Promise.resolve()
  6565. },
  6566. e.setBeautyEffectOptions = function() {
  6567. var t = a()(i.a.mark((function t(n, r) {
  6568. var o, a = arguments;
  6569. return i.a.wrap((function(t) {
  6570. for (;;) switch (t.prev = t.next) {
  6571. case 0:
  6572. if (Object(l.checkValidBoolean)(n, "enabled"), o = N.getInstance(), e.videoEffect.enableBeauty == n) {
  6573. t.next = 14;
  6574. break
  6575. }
  6576. if (o.setEnableBeauty(n), !n) {
  6577. t.next = 9;
  6578. break
  6579. }
  6580. return t.next = 7,
  6581. e._enableEffect();
  6582. case 7:
  6583. t.next = 12;
  6584. break;
  6585. case 9:
  6586. return e._removeEffectFromLocalPlayer(),
  6587. t.next = 12,
  6588. e._releaseEffect();
  6589. case 12:
  6590. e.videoEffect.enableBeauty = n,
  6591. u.report.reportApiInvoke(e.sid, {
  6592. callback: null,
  6593. options: a,
  6594. name: "Stream.setBeautyEffectOptions",
  6595. tag: "tracer"
  6596. });
  6597. case 14:
  6598. if (n) {
  6599. t.next = 16;
  6600. break
  6601. }
  6602. return t.abrupt("return");
  6603. case 16:
  6604. if (!r) {
  6605. t.next = 20;
  6606. break
  6607. }
  6608. Object(l.checkValidObject)(r, "options"),
  6609. t.next = 21;
  6610. break;
  6611. case 20:
  6612. return t.abrupt("return");
  6613. case 21:
  6614. if (void 0 !== r.smoothnessLevel && (Object(l.checkValidFloatNumber)(r.smoothnessLevel, "smoothnessLevel", 0, 1), e.videoEffect.denoiseLevel = 10 * r.smoothnessLevel, e.videoEffect.denoiseLevel < .1 && (e.videoEffect.denoiseLevel = .1), o.setDenoiseLevel(e.videoEffect.denoiseLevel)), void 0 !== r.lighteningLevel && (Object(l.checkValidFloatNumber)(r.lighteningLevel, "lighteningLevel", 0, 1), e.videoEffect.lightLevel = r.lighteningLevel / 2, e.videoEffect.lightLevel < .01 && (e.videoEffect.lightLevel = .01), o.setLightLevel(e.videoEffect.lightLevel)), void 0 !== r.rednessLevel && (Object(l.checkValidFloatNumber)(r.rednessLevel, "rednessLevel", 0, 1), e.videoEffect.rednessLevel = r.rednessLevel, e.videoEffect.rednessLevel < .01 && (e.videoEffect.rednessLevel = .01), o.setRednessLevel(e.videoEffect.rednessLevel)), void 0 === r.lighteningContrastLevel) {
  6615. t.next = 29;
  6616. break
  6617. }
  6618. if (0 === r.lighteningContrastLevel || 1 === r.lighteningContrastLevel || 2 === r.lighteningContrastLevel) {
  6619. t.next = 27;
  6620. break
  6621. }
  6622. throw new Error("Invalid lighteningContrastLevel: The value should be 0, 1 or 2.");
  6623. case 27:
  6624. e.videoEffect.lighteningContrastLevel = parseFloat(r.lighteningContrastLevel),
  6625. o.setContrastLevel(e.videoEffect.lighteningContrastLevel);
  6626. case 29:
  6627. case "end":
  6628. return t.stop()
  6629. }
  6630. }), t)
  6631. })));
  6632. return function(e, n) {
  6633. return t.apply(this, arguments)
  6634. }
  6635. } ()
  6636. },
  6637. restoreVideoEffect: function(e) {
  6638. return e.videoEffect.enableBeauty ? e._enableEffect() : Promise.resolve()
  6639. },
  6640. disableVideoEffect: function(e) {
  6641. return e._releaseEffect ? e._releaseEffect() : Promise.resolve()
  6642. },
  6643. applyEffectInPlayer: function(e) {
  6644. e.videoEffect.enableBeauty && e.videoEffect.canvas && e._showEffectInLocalPlayer()
  6645. },
  6646. removeEffectFromLocalPlayer: function(e) {
  6647. e._removeEffectFromLocalPlayer()
  6648. },
  6649. replaceWithCanvasTrack: function(e) {
  6650. return e.videoEffect.enableBeauty ? e._replaceWithCanvasTrack() : Promise.resolve()
  6651. },
  6652. checkVideoEffectEnabled: function(e) {
  6653. if (e.videoEffect.enableBeauty && e.videoEffect && e.videoEffect.videoContextInited) {
  6654. return p.
  6655. default.error("Operation not permitted: ".concat("VIDEO_EFFECT_ENABLED")),
  6656. "VIDEO_EFFECT_ENABLED"
  6657. }
  6658. return ! 1
  6659. }
  6660. }
  6661. },
  6662. function(e, t) {
  6663. function n(e, t, n, r, i, o, a) {
  6664. try {
  6665. var s = e[o](a),
  6666. c = s.value
  6667. } catch(e) {
  6668. return void n(e)
  6669. }
  6670. s.done ? t(c) : Promise.resolve(c).then(r, i)
  6671. }
  6672. e.exports = function(e) {
  6673. return function() {
  6674. var t = this,
  6675. r = arguments;
  6676. return new Promise((function(i, o) {
  6677. var a = e.apply(t, r);
  6678. function s(e) {
  6679. n(a, i, o, s, c, "next", e)
  6680. }
  6681. function c(e) {
  6682. n(a, i, o, s, c, "throw", e)
  6683. }
  6684. s(void 0)
  6685. }))
  6686. }
  6687. }
  6688. },
  6689. function(e, t, n) {
  6690. "use strict";
  6691. var r = n(36),
  6692. i = Object.prototype.toString;
  6693. function o(e) {
  6694. return "[object Array]" === i.call(e)
  6695. }
  6696. function a(e) {
  6697. return void 0 === e
  6698. }
  6699. function s(e) {
  6700. return null !== e && "object" == typeof e
  6701. }
  6702. function c(e) {
  6703. return "[object Function]" === i.call(e)
  6704. }
  6705. function d(e, t) {
  6706. if (null != e) if ("object" != typeof e && (e = [e]), o(e)) for (var n = 0,
  6707. r = e.length; n < r; n++) t.call(null, e[n], n, e);
  6708. else for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && t.call(null, e[i], i, e)
  6709. }
  6710. e.exports = {
  6711. isArray: o,
  6712. isArrayBuffer: function(e) {
  6713. return "[object ArrayBuffer]" === i.call(e)
  6714. },
  6715. isBuffer: function(e) {
  6716. return null !== e && !a(e) && null !== e.constructor && !a(e.constructor) && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
  6717. },
  6718. isFormData: function(e) {
  6719. return "undefined" != typeof FormData && e instanceof FormData
  6720. },
  6721. isArrayBufferView: function(e) {
  6722. return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer
  6723. },
  6724. isString: function(e) {
  6725. return "string" == typeof e
  6726. },
  6727. isNumber: function(e) {
  6728. return "number" == typeof e
  6729. },
  6730. isObject: s,
  6731. isUndefined: a,
  6732. isDate: function(e) {
  6733. return "[object Date]" === i.call(e)
  6734. },
  6735. isFile: function(e) {
  6736. return "[object File]" === i.call(e)
  6737. },
  6738. isBlob: function(e) {
  6739. return "[object Blob]" === i.call(e)
  6740. },
  6741. isFunction: c,
  6742. isStream: function(e) {
  6743. return s(e) && c(e.pipe)
  6744. },
  6745. isURLSearchParams: function(e) {
  6746. return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams
  6747. },
  6748. isStandardBrowserEnv: function() {
  6749. return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && ("undefined" != typeof window && "undefined" != typeof document)
  6750. },
  6751. forEach: d,
  6752. merge: function e() {
  6753. var t = {};
  6754. function n(n, r) {
  6755. "object" == typeof t[r] && "object" == typeof n ? t[r] = e(t[r], n) : t[r] = n
  6756. }
  6757. for (var r = 0,
  6758. i = arguments.length; r < i; r++) d(arguments[r], n);
  6759. return t
  6760. },
  6761. deepMerge: function e() {
  6762. var t = {};
  6763. function n(n, r) {
  6764. "object" == typeof t[r] && "object" == typeof n ? t[r] = e(t[r], n) : t[r] = "object" == typeof n ? e({},
  6765. n) : n
  6766. }
  6767. for (var r = 0,
  6768. i = arguments.length; r < i; r++) d(arguments[r], n);
  6769. return t
  6770. },
  6771. extend: function(e, t, n) {
  6772. return d(t, (function(t, i) {
  6773. e[i] = n && "function" == typeof t ? r(t, n) : t
  6774. })),
  6775. e
  6776. },
  6777. trim: function(e) {
  6778. return e.replace(/^\s*/, "").replace(/\s*$/, "")
  6779. }
  6780. }
  6781. },
  6782. function(e, t, n) {
  6783. "use strict";
  6784. n.d(t, "a", (function() {
  6785. return u
  6786. }));
  6787. var r = n(7),
  6788. i = n.n(r),
  6789. o = n(8),
  6790. a = n(0),
  6791. s = n(5);
  6792. function c(e) {
  6793. if ("undefined" == typeof Symbol || null == e[Symbol.iterator]) {
  6794. if (Array.isArray(e) || (e = function(e, t) {
  6795. if (!e) return;
  6796. if ("string" == typeof e) return d(e, t);
  6797. var n = Object.prototype.toString.call(e).slice(8, -1);
  6798. "Object" === n && e.constructor && (n = e.constructor.name);
  6799. if ("Map" === n || "Set" === n) return Array.from(n);
  6800. if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return d(e, t)
  6801. } (e))) {
  6802. var t = 0,
  6803. n = function() {};
  6804. return {
  6805. s: n,
  6806. n: function() {
  6807. return t >= e.length ? {
  6808. done: !0
  6809. }: {
  6810. done: !1,
  6811. value: e[t++]
  6812. }
  6813. },
  6814. e: function(e) {
  6815. throw e
  6816. },
  6817. f: n
  6818. }
  6819. }
  6820. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  6821. }
  6822. var r, i, o = !0,
  6823. a = !1;
  6824. return {
  6825. s: function() {
  6826. r = e[Symbol.iterator]()
  6827. },
  6828. n: function() {
  6829. var e = r.next();
  6830. return o = e.done,
  6831. e
  6832. },
  6833. e: function(e) {
  6834. a = !0,
  6835. i = e
  6836. },
  6837. f: function() {
  6838. try {
  6839. o || null == r.
  6840. return || r.
  6841. return ()
  6842. } finally {
  6843. if (a) throw i
  6844. }
  6845. }
  6846. }
  6847. }
  6848. function d(e, t) { (null == t || t > e.length) && (t = e.length);
  6849. for (var n = 0,
  6850. r = new Array(t); n < t; n++) r[n] = e[n];
  6851. return r
  6852. }
  6853. var u = new
  6854. function() {
  6855. var e = Object(o.b)();
  6856. return e.devicesHistory = {},
  6857. e.states = {
  6858. UNINIT: "UNINIT",
  6859. INITING: "INITING",
  6860. INITED: "INITED"
  6861. },
  6862. e.state = e.states.UNINIT,
  6863. e.deviceStates = {
  6864. ACTIVE: "ACTIVE",
  6865. INACTIVE: "INACTIVE"
  6866. },
  6867. e.deviceReloadTimer = null,
  6868. e._init = function(t, n) {
  6869. e.state = e.states.INITING,
  6870. e.devicesHistory = {},
  6871. e._reloadDevicesInfo((function() {
  6872. e.state = e.states.INITED,
  6873. e.dispatchEvent({
  6874. type: "inited"
  6875. }),
  6876. t && t()
  6877. }), (function(t) {
  6878. a.
  6879. default.warning("Device Detection functionality cannot start properly."),
  6880. e.state = e.states.UNINIT,
  6881. n && n(t)
  6882. }))
  6883. },
  6884. e._enumerateDevices = function(e, t) {
  6885. if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return a.
  6886. default.warning("enumerateDevices() not supported."),
  6887. t && t("enumerateDevices() not supported");
  6888. navigator.mediaDevices.enumerateDevices().then((function(t) {
  6889. e && setTimeout((function() {
  6890. e(t)
  6891. }), 0)
  6892. })).
  6893. catch((function(e) {
  6894. t && t(e)
  6895. }))
  6896. },
  6897. e._reloadDevicesInfo = function(t, n) {
  6898. var r = [];
  6899. e._enumerateDevices((function(n) {
  6900. var o = Date.now();
  6901. for (var s in n.forEach((function(t) {
  6902. var n = e.devicesHistory[t.deviceId];
  6903. if ((n ? n.state: e.deviceStates.INACTIVE) != e.deviceStates.ACTIVE) {
  6904. var i = n || {
  6905. initAt: o
  6906. };
  6907. i.device = t,
  6908. i.state = e.deviceStates.ACTIVE,
  6909. r.push(i),
  6910. e.devicesHistory[t.deviceId] = i
  6911. }
  6912. e.devicesHistory[t.deviceId].lastReloadAt = o
  6913. })), e.devicesHistory) {
  6914. var c = e.devicesHistory[s];
  6915. c && c.state == e.deviceStates.ACTIVE && c.lastReloadAt !== o && (c.state = e.deviceStates.INACTIVE, r.push(c)),
  6916. c.lastReloadAt = o
  6917. }
  6918. e.state == e.states.INITED && r.forEach((function(t) {
  6919. var n = i()({},
  6920. t);
  6921. switch (t.device.kind) {
  6922. case "audioinput":
  6923. n.type = "recordingDeviceChanged";
  6924. break;
  6925. case "audiooutput":
  6926. n.type = "playoutDeviceChanged";
  6927. break;
  6928. case "videoinput":
  6929. n.type = "cameraChanged";
  6930. break;
  6931. default:
  6932. a.
  6933. default.warning("Unknown device change", n),
  6934. n.type = "unknownDeviceChanged"
  6935. }
  6936. e.dispatchEvent(n)
  6937. })),
  6938. t && t()
  6939. }), n)
  6940. },
  6941. e.getDeviceById = function(t, n, r) {
  6942. e.getDevices((function(e) {
  6943. for (var i = 0; i < e.length; i++) {
  6944. var o = e[i];
  6945. if (o && o.deviceId === t) return n && n(o)
  6946. }
  6947. return r && r()
  6948. }))
  6949. },
  6950. e.searchDeviceNameById = function(t) {
  6951. var n = e.devicesHistory[t];
  6952. return n ? n.device.label || n.device.deviceId: null
  6953. },
  6954. e.getDevices = function(t, n) {
  6955. e._enumerateDevices(t, (function(e) {
  6956. n && n(e.name + ": " + e.message)
  6957. }))
  6958. },
  6959. e.getVideoCameraIdByLabel = function(t, n, r) {
  6960. e.getCameras((function(e) {
  6961. var i, o = c(e);
  6962. try {
  6963. for (o.s(); ! (i = o.n()).done;) {
  6964. var a = i.value;
  6965. if (a.label === t) return n && n(a.deviceId)
  6966. }
  6967. } catch(e) {
  6968. o.e(e)
  6969. } finally {
  6970. o.f()
  6971. }
  6972. return r && r(s.
  6973. default.NOT_FIND_DEVICE_BY_LABEL)
  6974. }), r)
  6975. },
  6976. e.getRecordingDevices = function(t, n) {
  6977. return e._enumerateDevices((function(e) {
  6978. var n = e.filter((function(e) {
  6979. return "audioinput" == e.kind
  6980. }));
  6981. t && t(n)
  6982. }), (function(e) {
  6983. n && n(e)
  6984. }))
  6985. },
  6986. e.getPlayoutDevices = function(t, n) {
  6987. return e._enumerateDevices((function(e) {
  6988. var n = e.filter((function(e) {
  6989. return "audiooutput" == e.kind
  6990. }));
  6991. t && t(n)
  6992. }), (function(e) {
  6993. n && n(e)
  6994. }))
  6995. },
  6996. e.getCameras = function(t, n) {
  6997. return e._enumerateDevices((function(e) {
  6998. var n = e.filter((function(e) {
  6999. return "videoinput" == e.kind
  7000. }));
  7001. t && t(n)
  7002. }), (function(e) {
  7003. n && n(e)
  7004. }))
  7005. },
  7006. e._init((function() {
  7007. navigator.mediaDevices && navigator.mediaDevices.addEventListener && navigator.mediaDevices.addEventListener("devicechange", (function() {
  7008. e._reloadDevicesInfo()
  7009. })),
  7010. e.deviceReloadTimer = setInterval(e._reloadDevicesInfo, 5e3)
  7011. })),
  7012. e
  7013. }
  7014. },
  7015. function(e, t, n) {
  7016. "use strict";
  7017. n.r(t),
  7018. n.d(t, "_getReconnectCSTimer", (function() {
  7019. return R
  7020. })),
  7021. n.d(t, "_setClientConnectionStateRecord", (function() {
  7022. return T
  7023. })),
  7024. n.d(t, "getGatewayList", (function() {
  7025. return A
  7026. })),
  7027. n.d(t, "getUserAccount", (function() {
  7028. return O
  7029. }));
  7030. var r = n(11),
  7031. i = n.n(r),
  7032. o = n(13),
  7033. a = n.n(o),
  7034. s = n(17),
  7035. c = n.n(s),
  7036. d = n(3),
  7037. u = (n(4), n(0)),
  7038. l = n(14),
  7039. p = n(1),
  7040. f = n(5),
  7041. g = function(e, t) {
  7042. var n = !1,
  7043. r = 0,
  7044. i = {
  7045. command: "convergeAllocateEdge",
  7046. sid: e.sid,
  7047. appId: e.appId,
  7048. token: e.token,
  7049. uid: e.uid,
  7050. cname: e.cname,
  7051. ts: Math.floor(Date.now() / 1e3),
  7052. version: d.VERSION,
  7053. seq: 0,
  7054. requestId: 1
  7055. };
  7056. Object(d.getParameter)("PROXY_CS").map((function(o) {
  7057. var a = (new Date).getTime();
  7058. m("https://" + o + "/api/v1", i, (function(i, s) {
  7059. if (i) return u.
  7060. default.debug("[" + e.clientId + "] Request proxy server failed: ", i),
  7061. r++,
  7062. p.report.requestProxyAppCenter(e.sid, {
  7063. lts: a,
  7064. succ: !1,
  7065. APAddr: o,
  7066. workerManagerList: null,
  7067. ec: JSON.stringify(i),
  7068. response: JSON.stringify({
  7069. err: i,
  7070. res: s
  7071. })
  7072. }),
  7073. void(r >= Object(d.getParameter)("PROXY_CS").length && t && t("Get proxy server failed: request all failed"));
  7074. if (!n) if ((s = JSON.parse(s)).json_body) {
  7075. var c = JSON.parse(s.json_body);
  7076. if (u.
  7077. default.debug("[" + e.clientId + "] App return:", c.servers), 200 !== c.code) {
  7078. i = "Get proxy server failed: response code [" + c.code + "], reason [ " + c.reason + "]";
  7079. u.
  7080. default.debug("[" + e.clientId + "] " + i),
  7081. p.report.requestProxyAppCenter(e.sid, {
  7082. lts: a,
  7083. succ: !1,
  7084. APAddr: o,
  7085. workerManagerList: null,
  7086. ec: i,
  7087. response: JSON.stringify({
  7088. err: i,
  7089. res: s
  7090. })
  7091. })
  7092. } else {
  7093. n = !0;
  7094. var l = v(c.servers);
  7095. p.report.requestProxyAppCenter(e.sid, {
  7096. lts: a,
  7097. succ: !0,
  7098. APAddr: o,
  7099. workerManagerList: JSON.stringify(l),
  7100. ec: null,
  7101. response: JSON.stringify({
  7102. res: s
  7103. })
  7104. }),
  7105. t && t(null, l)
  7106. }
  7107. } else u.
  7108. default.debug("[" + e.clientId + "] Get proxy server failed: no json_body"),
  7109. p.report.requestProxyAppCenter(e.sid, {
  7110. lts: a,
  7111. succ: !1,
  7112. APAddr: o,
  7113. workerManagerList: null,
  7114. ec: "Get proxy server failed: no json_body",
  7115. response: JSON.stringify({
  7116. res: s
  7117. })
  7118. })
  7119. }))
  7120. }))
  7121. },
  7122. m = function(e, t, n) {
  7123. var r = {
  7124. service_name: "webrtc_proxy",
  7125. json_body: JSON.stringify(t)
  7126. };
  7127. Object(l.post)(e, r, (function(e) {
  7128. n && n(null, e)
  7129. }), (function(e) {
  7130. n && n(e)
  7131. }), {
  7132. "X-Packet-Service-Type": 0,
  7133. "X-Packet-URI": 61
  7134. })
  7135. },
  7136. h = function(e, t, n) {
  7137. var r = !1,
  7138. i = 0,
  7139. o = {
  7140. command: "request",
  7141. gatewayType: "http",
  7142. appId: e.appId,
  7143. cname: e.cname,
  7144. uid: e.uid + "",
  7145. sdkVersion: "2.3.1",
  7146. sid: e.sid,
  7147. seq: 1,
  7148. ts: +new Date,
  7149. requestId: 3,
  7150. clientRequest: {
  7151. appId: e.appId,
  7152. cname: e.cname,
  7153. uid: e.uid + "",
  7154. sid: e.sid
  7155. }
  7156. };
  7157. t.map((function(a) {
  7158. var s = (new Date).getTime(); !
  7159. function(e, t, n) {
  7160. Object(l.post)(e, t, (function(e) {
  7161. n && n(null, e)
  7162. }), (function(e) {
  7163. n && n(e)
  7164. }))
  7165. } ("https://" + a + ":4000/v2/machine", o, (function(o, c) {
  7166. if (o) return u.
  7167. default.debug("[" + e.clientId + "] Request worker manager failed: ", o),
  7168. i++,
  7169. p.report.requestProxyWorkerManager(e.sid, {
  7170. lts: s,
  7171. succ: !1,
  7172. workerManagerAddr: a,
  7173. ec: JSON.stringify(o),
  7174. response: JSON.stringify({
  7175. res: c
  7176. })
  7177. }),
  7178. void(i >= t.length && n && n("requeet worker manager server failed: request failed"));
  7179. if (!r) {
  7180. if (! (c = JSON.parse(c)).serverResponse) return n && n("requeet worker manager server failed: serverResponse is undefined");
  7181. r = !0,
  7182. p.report.requestProxyWorkerManager(e.sid, {
  7183. lts: s,
  7184. succ: !0,
  7185. workerManagerAddr: a,
  7186. ec: JSON.stringify(o),
  7187. response: JSON.stringify({
  7188. res: c
  7189. })
  7190. }),
  7191. n && n(null, {
  7192. address: a,
  7193. serverResponse: c.serverResponse
  7194. })
  7195. }
  7196. }))
  7197. }))
  7198. },
  7199. v = function(e) {
  7200. if (!e || [] instanceof Array == !1) return [];
  7201. var t = [];
  7202. return e.forEach((function(e) {
  7203. var n;
  7204. e.address && e.tcp ? (e.address.match(/^[\.\:\d]+$/) ? n = "".concat(e.address.replace(/[^\d]/g, "-"), ".edge.agora.io") : (u.
  7205. default.info("[" + joinInfo.clientId + "] " + "Cannot recognized as IP address ".concat(e.address, ". Used As Host instead")), n = "".concat(e.address, ":").concat(e.tcp)), t.push(n)) : u.
  7206. default.error("[" + joinInfo.clientId + "] Invalid address format ", e)
  7207. })),
  7208. t
  7209. },
  7210. E = n(12),
  7211. _ = n(30),
  7212. S = {},
  7213. y = {},
  7214. R = function(e) {
  7215. return S[e]
  7216. },
  7217. T = function(e, t) {
  7218. y[e] = t
  7219. },
  7220. I = function(e, t, n, r, i) {
  7221. var o = (new Date).getTime(),
  7222. a = t,
  7223. s = "";
  7224. t.multiIP && t.multiIP.gateway_ip && (s = {
  7225. vocs_ip: [t.multiIP.uni_lbs_ip],
  7226. vos_ip: [t.multiIP.gateway_ip]
  7227. });
  7228. var c = {
  7229. opid: 133,
  7230. flag: 4096,
  7231. ts: +new Date,
  7232. key: t.token,
  7233. cname: t.cname,
  7234. sid: t.sid,
  7235. detail: {
  7236. 6 : t.stringUid,
  7237. 11 : i
  7238. },
  7239. uid: t.uid || 0
  7240. };
  7241. s && (c.detail[5] = JSON.stringify(s)),
  7242. Object(l.post)(e + "".concat( - 1 === e.indexOf("?") ? "?": "&", "action=wrtc_gateway"), c, (function(i) {
  7243. try {
  7244. var s = JSON.parse(i);
  7245. s.res && (s = s.res);
  7246. var c = s.code
  7247. } catch(e) {
  7248. var l = "requestChooseServer failed with unexpected body " + i;
  7249. return u.
  7250. default.error("[" + a.clientId + "]", l),
  7251. r(l)
  7252. }
  7253. if (c) return v = new RegExp(/10102\d{2}$/).test(c) ? "NO_SERVICE_AVAILABLE": f.APErrorCode[s.code] || c,
  7254. p.report.joinChooseServer(t.sid, {
  7255. lts: o,
  7256. succ: !1,
  7257. csAddr: e,
  7258. serverList: null,
  7259. ec: v
  7260. }),
  7261. r("Get server node failed [" + v + "]", e, v);
  7262. var g = [],
  7263. m = Object(d.getParameter)("GATEWAY_DOMAINS"),
  7264. h = 0;
  7265. if (e.indexOf(m[1]) > -1 && (h = 1), s.addresses.forEach((function(e) {
  7266. var t;
  7267. e.ip && e.port ? (e.ip.match(/^[\.\:\d]+$/) ? t = "".concat(e.ip.replace(/[^\d]/g, "-"), ".").concat(m[h++%m.length], ":").concat(e.port) : (u.
  7268. default.info("[" + a.clientId + "] " + "Cannot recognized as IP address ".concat(e.ip, ". Used As Host instead")), t = "".concat(e.ip, ":").concat(e.port)), g.push(t)) : u.
  7269. default.error("[" + a.clientId + "] Invalid address format ", e)
  7270. })), !g.length) {
  7271. u.
  7272. default.error("[" + a.clientId + "] Empty Address response", s);
  7273. var v = "EMPTY_ADDRESS_RESPONSE";
  7274. return p.report.joinChooseServer(t.sid, {
  7275. lts: o,
  7276. succ: !1,
  7277. csAddr: e,
  7278. serverList: null,
  7279. ec: v
  7280. }),
  7281. r("Get server node failed [" + v + "]", e, v)
  7282. }
  7283. var E = {
  7284. gateway_addr: g,
  7285. uid: s.uid,
  7286. cid: s.cid,
  7287. vid: s.detail && s.detail[8],
  7288. res: s,
  7289. uni_lbs_ip: s.detail
  7290. };
  7291. return n(E, e)
  7292. }), (function(e, n) {
  7293. "timeout" === e.type ? (p.report.joinChooseServer(t.sid, {
  7294. lts: o,
  7295. succ: !1,
  7296. csAddr: n,
  7297. serverList: null,
  7298. ec: "timeout"
  7299. }), r("Connect choose server timeout", n)) : (p.report.joinChooseServer(t.sid, {
  7300. lts: o,
  7301. succ: !1,
  7302. csAddr: n,
  7303. serverList: null,
  7304. ec: "server_wrong"
  7305. }), r("Connect choose server error", n))
  7306. }), {
  7307. "X-Packet-Service-Type": 0,
  7308. "X-Packet-URI": 69
  7309. })
  7310. },
  7311. A = function(e, t, n) {
  7312. var r = !1,
  7313. i = null,
  7314. o = 1,
  7315. a = 1,
  7316. s = e.clientId,
  7317. c = function t(a, c) {
  7318. if (!r) {
  7319. var l = []; !
  7320. function(e, t, n) {
  7321. for (var r, i = (new Date).getTime(), o = !1, a = !0, s = 0, c = Object(d.getParameter)("WEBCS_DOMAIN"), l = Object(d.getParameter)("WEBCS_DOMAIN_BACKUP_LIST"), g = function(n, r) {
  7322. if (o) p.report.joinChooseServer(e.sid, {
  7323. lts: i,
  7324. succ: !0,
  7325. csAddr: r,
  7326. serverList: n.gateway_addr,
  7327. cid: n.cid + "",
  7328. uid: n.uid + "",
  7329. ec: null
  7330. },
  7331. !1);
  7332. else {
  7333. if (clearTimeout(y), o = !0, e.proxyServer) for (var a = n.gateway_addr,
  7334. s = 0; s < a.length; s++) {
  7335. var c = a[s].split(":");
  7336. n.gateway_addr[s] = e.proxyServer + "/ws/?h=" + c[0] + "&p=" + c[1]
  7337. }
  7338. t(n),
  7339. p.report.joinChooseServer(e.sid, {
  7340. lts: i,
  7341. succ: !0,
  7342. csAddr: r,
  7343. serverList: n.gateway_addr,
  7344. cid: n.cid + "",
  7345. uid: n.uid + "",
  7346. ec: null
  7347. },
  7348. !0)
  7349. }
  7350. },
  7351. m = function(t, i, o) {
  7352. s++,
  7353. u.
  7354. default.error("[" + e.clientId + "]", t, i, o),
  7355. o && -1 === f.JOIN_CS_RETRY_LIST.indexOf(o) && (a = !1, r = o),
  7356. s === c.length + l.length && n(r)
  7357. },
  7358. h = 0; h < c.length; ++h) {
  7359. var v;
  7360. if ("string" == typeof c[h]) {
  7361. var E = c[h];
  7362. v = e.proxyServer ? "https://".concat(e.proxyServer, "/ap/?url=").concat(E + "/api/v1") : "https://".concat(E, "/api/v1");
  7363. var S = Object(_.getAreaCodeByWebCS)(E);
  7364. u.
  7365. default.debug("[" + e.clientId + "] " + "Connect to choose_server: ".concat(v, ", ").concat(S)),
  7366. I(v, e, g, m, S)
  7367. } else u.
  7368. default.error("[" + e.clientId + "] Invalid Host", c[h])
  7369. }
  7370. var y = setTimeout((function() {
  7371. if (!o) for (var t = 0; t < l.length; ++t) {
  7372. if ("string" == typeof l[t]) {
  7373. var n = l[t];
  7374. v = e.proxyServer ? "https://".concat(e.proxyServer, "/ap/?url=").concat(n + "/api/v1") : "https://".concat(n, "/api/v1");
  7375. var r = Object(_.getAreaCodeByWebCS)(n);
  7376. u.
  7377. default.debug("[" + e.clientId + "] " + "Connect to backup_choose_server: ".concat(v, ", ").concat(r)),
  7378. I(v, e, g, m, r)
  7379. } else u.
  7380. default.error("[" + e.clientId + "] Invalid Host", l[t])
  7381. }
  7382. }), 1e3);
  7383. setTimeout((function() { ! o && a && n()
  7384. }), Object(d.getParameter)("WEBCS_BACKUP_CONNECT_TIMEOUT"))
  7385. } (e, (function(t) {
  7386. r = !0,
  7387. !0,
  7388. l = t,
  7389. clearTimeout(i),
  7390. y[s] !== E.a.DISCONNECTED && y[s] !== E.a.DISCONNECTING ? c && c(l, null) : u.
  7391. default.debug("[".concat(e.clientId, "] Request gateway list success when connection state is ").concat(y[s]))
  7392. }), (function(r) {
  7393. if (r) return u.
  7394. default.info("[" + e.clientId + "] Join failed: " + r),
  7395. void(n && n(r));
  7396. if (y[s] === E.a.DISCONNECTED || y[s] === E.a.DISCONNECTING) return u.
  7397. default.debug("[".concat(e.clientId, "] Request gateway list falied when connection state is ").concat(y[s])),
  7398. void(n && n("OPERATION_ABORT"));
  7399. u.
  7400. default.debug("[" + e.clientId + "] Request gateway list will be restart in " + o + "s"),
  7401. i = setTimeout((function() {
  7402. t(a, c)
  7403. }), 1e3 * o),
  7404. S[s] = i;
  7405. var l = Object(d.getParameter)("AP_BACKOFF_MAX_TIME");
  7406. o = o >= l ? l: 2 * o
  7407. }))
  7408. }
  7409. },
  7410. l = function n() { !
  7411. function(e, t) {
  7412. g(e, (function(n, r) {
  7413. if (n) return t && t(n);
  7414. u.
  7415. default.debug("[" + e.clientId + "] getProxyServerList: ", r),
  7416. h(e, r, t)
  7417. }))
  7418. } (e, (function(r, o) {
  7419. if (r) {
  7420. u.
  7421. default.debug("[" + e.clientId + "]", r),
  7422. u.
  7423. default.debug("[" + e.clientId + "] Request proxy will be restart in " + a + "s"),
  7424. i = setTimeout((function() {
  7425. n()
  7426. }), 1e3 * a),
  7427. S[s] = i;
  7428. var l = Object(d.getParameter)("AP_BACKOFF_MAX_TIME");
  7429. a = a >= l ? l: 2 * a
  7430. } else {
  7431. clearTimeout(i);
  7432. var f = o.address;
  7433. e.proxyServer = f;
  7434. var g = {
  7435. mode: "manual",
  7436. url: o.address,
  7437. tcpport: o.serverResponse.tcpport || "3433",
  7438. udpport: o.serverResponse.udpport || "3478",
  7439. username: o.serverResponse.username || "test",
  7440. credential: o.serverResponse.password || Object(d.getParameter)("TURN_SERVER_PASSWORD"),
  7441. forceturn: !0
  7442. };
  7443. g.tcpport += "",
  7444. g.udpport += "",
  7445. e.turnServers = [],
  7446. e.turnServers.push(g),
  7447. p.report.setProxyServer(f),
  7448. u.
  7449. default.setProxyServer(f),
  7450. c(f, t)
  7451. }
  7452. }))
  7453. };
  7454. e.useProxyServer ? 1 == e.proxyServerType ? l() : 2 == e.proxyServerType ?
  7455. function n() { !
  7456. function(e, t) {
  7457. g(e, (function(n, r) {
  7458. return n ? t && t(n) : (u.
  7459. default.debug("[" + e.clientId + "] getProxyServerList: ", r), t && t(null, {
  7460. address: r[0],
  7461. serverResponse: {
  7462. tcpport: "443",
  7463. udpport: "3478",
  7464. username: "test",
  7465. password: "111111"
  7466. }
  7467. }))
  7468. }))
  7469. } (e, (function(r, o) {
  7470. if (r) return u.
  7471. default.debug("[" + e.clientId + "]", r),
  7472. u.
  7473. default.debug("[" + e.clientId + "] Request proxy will be restart in " + a + "s"),
  7474. i = setTimeout((function() {
  7475. n()
  7476. }), 1e3 * a),
  7477. S[s] = i,
  7478. void(a = a >= 3600 ? 3600 : 2 * a);
  7479. clearTimeout(i);
  7480. var l = Object(d.getParameter)("PROXY_SERVER_TYPE2");
  7481. e.proxyServer = l;
  7482. var f = {
  7483. mode: "manual",
  7484. url: o.address,
  7485. tcpport: o.serverResponse.tcpport || "3433",
  7486. udpport: o.serverResponse.udpport || "3478",
  7487. username: o.serverResponse.username || "test",
  7488. credential: o.serverResponse.password || "111111",
  7489. forceturn: !0
  7490. };
  7491. f.tcpport += "",
  7492. f.udpport += "",
  7493. e.turnServers = [],
  7494. e.turnServers.push(f),
  7495. p.report.setProxyServer(l),
  7496. u.
  7497. default.setProxyServer(l),
  7498. c(l, t)
  7499. }))
  7500. } () : l() : c(null, t)
  7501. },
  7502. b = function(e, t, n, r) {
  7503. var i = Date.now();
  7504. r = r || t.stringUid;
  7505. var o = {
  7506. sid: t.sid,
  7507. opid: 10,
  7508. appid: t.appId,
  7509. string_uid: r
  7510. };
  7511. return new Promise((function(a, s) {
  7512. Object(l.post)(e + "".concat( - 1 === e.indexOf("?") ? "?": "&", "action=stringuid"), o, (function(c) {
  7513. try {
  7514. var d = JSON.parse(c),
  7515. l = d.code
  7516. } catch(a) {
  7517. var g = "requestUserAccount failed with unexpected body " + c;
  7518. return u.
  7519. default.error("[" + t.clientId + "]", g),
  7520. s("UNEXPECTED_ERROR"),
  7521. n && n.dispatchEvent({
  7522. type: "error",
  7523. reason: "USER_ACCOUNT_BODY_NOT_JSON"
  7524. }),
  7525. void p.report.reqUserAccount(o.sid, {
  7526. lts: i,
  7527. success: !1,
  7528. serverAddress: e,
  7529. stringUid: r,
  7530. uid: null,
  7531. extend: c,
  7532. errorCode: "USER_ACCOUNT_BODY_NOT_JSON"
  7533. })
  7534. }
  7535. if (l) {
  7536. var m = f.StringUidErrorCode[d.code % 1e4] || "REQ_ACCOUNT_ERR_".concat(l);
  7537. n && n.dispatchEvent({
  7538. type: "error",
  7539. reason: m
  7540. }),
  7541. p.report.reqUserAccount(o.sid, {
  7542. lts: i,
  7543. success: !1,
  7544. serverAddress: e,
  7545. stringUid: r,
  7546. uid: null,
  7547. errorCode: m,
  7548. extend: o
  7549. });
  7550. g = "Get String Uid Failed [" + m + "]";
  7551. return s(m)
  7552. }
  7553. var h = d.uid;
  7554. if (! (h > 0 && h < Math.pow(2, 32))) {
  7555. u.
  7556. default.error("[" + t.clientId + "] " + "Invalid Uint Uid ".concat(r, " => ").concat(h), d);
  7557. m = "INVALID_UINT_UID_".concat(h);
  7558. return n && n.dispatchEvent({
  7559. type: "error",
  7560. reason: m
  7561. }),
  7562. p.report.reqUserAccount(o.sid, {
  7563. lts: i,
  7564. success: !1,
  7565. serverAddress: e,
  7566. stringUid: r,
  7567. uid: null,
  7568. errorCode: m,
  7569. extend: o
  7570. }),
  7571. s(m)
  7572. }
  7573. a({
  7574. uid: h,
  7575. url: e
  7576. }),
  7577. p.report.reqUserAccount(o.sid, {
  7578. lts: i,
  7579. success: !0,
  7580. serverAddress: e,
  7581. stringUid: r,
  7582. uid: h,
  7583. errorCode: null,
  7584. extend: o
  7585. })
  7586. }), (function(e, t) {
  7587. if ("timeout" === e.type) {
  7588. var a = "USER_ACCOUNT_TIMEOUT";
  7589. n && n.dispatchEvent({
  7590. type: "error",
  7591. reason: a
  7592. }),
  7593. p.report.reqUserAccount(o.sid, {
  7594. lts: i,
  7595. success: !1,
  7596. serverAddress: t,
  7597. stringUid: r,
  7598. uid: null,
  7599. errorCode: a,
  7600. extend: o
  7601. }),
  7602. s(a)
  7603. } else {
  7604. var c = "USER_ACCOUNT_SERVER_WRONG_".concat(e.type);
  7605. n && n.dispatchEvent({
  7606. type: "error",
  7607. reason: c
  7608. }),
  7609. p.report.reqUserAccount(o.sid, {
  7610. lts: i,
  7611. success: !1,
  7612. serverAddress: t,
  7613. stringUid: r,
  7614. uid: null,
  7615. errorCode: c,
  7616. extend: o
  7617. }),
  7618. s(c)
  7619. }
  7620. }), {
  7621. "X-Packet-Service-Type": 0,
  7622. "X-Packet-URI": 72
  7623. })
  7624. }))
  7625. },
  7626. O = function(e, t, n) {
  7627. Date.now();
  7628. var r, o = Object(d.getParameter)("ACCOUNT_REGISTER"),
  7629. s = !1,
  7630. l = Object(d.getParameter)("ACCOUNT_REGISTER_RETRY_TIMEOUT"),
  7631. p = null,
  7632. f = null,
  7633. g = new Promise(function() {
  7634. var g = c()(a.a.mark((function c(g, m) {
  7635. var h, v, E;
  7636. return a.a.wrap((function(c) {
  7637. for (;;) switch (c.prev = c.next) {
  7638. case 0:
  7639. p = g,
  7640. f = m,
  7641. r = 0;
  7642. case 3:
  7643. if (! (r < Object(d.getParameter)("ACCOUNT_REGISTER_RETRY_COUNT_MAX"))) {
  7644. c.next = 33;
  7645. break
  7646. }
  7647. if (!s) {
  7648. c.next = 6;
  7649. break
  7650. }
  7651. return c.abrupt("return");
  7652. case 6:
  7653. return h = o[r % o.length],
  7654. v = e.proxyServer ? "https://".concat(e.proxyServer, "/ap/?url=").concat(h + "/api/v1") : "https://".concat(h, "/api/v1"),
  7655. c.prev = 8,
  7656. c.delegateYield(a.a.mark((function r() {
  7657. var i;
  7658. return a.a.wrap((function(r) {
  7659. for (;;) switch (r.prev = r.next) {
  7660. case 0:
  7661. return r.next = 2,
  7662. b(v, e, t, n);
  7663. case 2:
  7664. if (i = r.sent, !s) {
  7665. r.next = 5;
  7666. break
  7667. }
  7668. return r.abrupt("return", {
  7669. v: void 0
  7670. });
  7671. case 5:
  7672. s = !0,
  7673. setTimeout((function() {
  7674. u.
  7675. default.debug("Get UserAccount Successfully", i),
  7676. p(i)
  7677. }), 0);
  7678. case 7:
  7679. case "end":
  7680. return r.stop()
  7681. }
  7682. }), r)
  7683. }))(), "t0", 10);
  7684. case 10:
  7685. if (E = c.t0, "object" !== i()(E)) {
  7686. c.next = 13;
  7687. break
  7688. }
  7689. return c.abrupt("return", E.v);
  7690. case 13:
  7691. c.next = 30;
  7692. break;
  7693. case 15:
  7694. if (c.prev = 15, c.t1 = c.
  7695. catch(8), !s) {
  7696. c.next = 19;
  7697. break
  7698. }
  7699. return c.abrupt("return");
  7700. case 19:
  7701. if (!c.t1.retryable) {
  7702. c.next = 27;
  7703. break
  7704. }
  7705. return (l = Math.ceil(l * Object(d.getParameter)("ACCOUNT_REGISTER_RETRY_RATIO"))) > Object(d.getParameter)("ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX") && (l = Object(d.getParameter)("ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX")),
  7706. u.
  7707. default.error("".concat(c.t1.info, " ").concat(c.t1.url, " Will Fetch User Account in ").concat(l / 1e3, " seconds")),
  7708. c.next = 25,
  7709. new Promise((function(e) {
  7710. setTimeout(e, l)
  7711. }));
  7712. case 25:
  7713. c.next = 30;
  7714. break;
  7715. case 27:
  7716. u.
  7717. default.error("Get UserAccount Error: ".concat(c.t1.info, " ").concat(c.t1.url), c.t1.error),
  7718. s = !0,
  7719. f(c.t1);
  7720. case 30:
  7721. r++,
  7722. c.next = 3;
  7723. break;
  7724. case 33:
  7725. case "end":
  7726. return c.stop()
  7727. }
  7728. }), c, null, [[8, 15]])
  7729. })));
  7730. return function(e, t) {
  7731. return g.apply(this, arguments)
  7732. }
  7733. } ());
  7734. return g.cancel = function() {
  7735. s || (s = !0, f({
  7736. info: "Request Cancelled",
  7737. retryable: !1
  7738. }))
  7739. },
  7740. g.isFinished = function() {
  7741. return s
  7742. },
  7743. g
  7744. }
  7745. },
  7746. function(e, t, n) {
  7747. "use strict";
  7748. n.d(t, "a", (function() {
  7749. return O
  7750. })),
  7751. n.d(t, "b", (function() {
  7752. return C
  7753. }));
  7754. var r = n(7),
  7755. i = n.n(r),
  7756. o = n(4),
  7757. a = n(8),
  7758. s = function(e) {
  7759. var t = Object(a.b)(e);
  7760. return t.url = ".",
  7761. t
  7762. },
  7763. c = n(0),
  7764. d = n(15),
  7765. u = n(5),
  7766. l = n(3),
  7767. p = n(1),
  7768. f = 0,
  7769. g = function(e) {
  7770. var t = s({});
  7771. t.id = e.id,
  7772. t.playerId = f++,
  7773. t.destroyed = !1,
  7774. t.fit = e.options && e.options.fit,
  7775. "contain" !== t.fit && "cover" !== t.fit && (t.fit = null),
  7776. t.url = e.url,
  7777. t.stream = e.stream.stream,
  7778. t.isFreeze = !1,
  7779. t.freezeTimeCounterList = [],
  7780. t.freezeCount = 0,
  7781. t.lastFreezeCount = 0,
  7782. t.lastTimeupdateTime = 0,
  7783. t.elementID = e.elementID,
  7784. t.setAudioOutput = function(e, n, r) {
  7785. var i = t.video || t.audio;
  7786. return i ? i.setSinkId ? void i.setSinkId(e).then((function() {
  7787. return c.
  7788. default.debug("[" + t.id + "] " + "video ".concat(t.id, " setAudioOutput ").concat(e, " SUCCESS")),
  7789. i == t.video && t.audio ? t.audio.setSinkId(e) : Promise.resolve()
  7790. })).then((function() {
  7791. return c.
  7792. default.debug("[" + t.id + "] " + "audio ".concat(t.id, " setAudioOutput ").concat(e, " SUCCESS")),
  7793. n && n()
  7794. })).
  7795. catch((function(e) {
  7796. return c.
  7797. default.error("[" + t.id + "] VideoPlayer.setAudioOutput", e),
  7798. r && r(e)
  7799. })) : (c.
  7800. default.error("[" + t.id + "] ", u.
  7801. default.WEB_API_NOT_SUPPORTED), r && r(u.
  7802. default.WEB_API_NOT_SUPPORTED)):
  7803. (c.
  7804. default.error("[" + t.id + "] ", u.
  7805. default.PLAYER_NOT_FOUND), r && r(u.
  7806. default.PLAYER_NOT_FOUND))
  7807. },
  7808. t.destroy = function() {
  7809. c.
  7810. default.debug("[".concat(t.id, "] destroy ").concat(e.stream.local ? "local": "remote", " Player ").concat(t.id)),
  7811. Object(d.setSrcObject)(t.video, null),
  7812. Object(d.setSrcObject)(t.audio, null),
  7813. t.video.pause(),
  7814. t.freezeCheckInterval && clearInterval(t.freezeCheckInterval),
  7815. t.destroyed = !0,
  7816. delete t.resizer,
  7817. document.getElementById(t.div.id) && t.parentNode.contains(t.div) && t.parentNode.removeChild(t.div),
  7818. ["video", "audio"].forEach((function(n) {
  7819. t[n];
  7820. var r = a[n];
  7821. clearTimeout(r.playDeferTimeout),
  7822. r.formerMediaState = null;
  7823. var i = {
  7824. playerId: t.playerId,
  7825. stateId: r.stateId + 1,
  7826. playDeferTimeout: null,
  7827. error: !1,
  7828. status: "aborted",
  7829. reason: "stop",
  7830. updatedAt: Date.now()
  7831. };
  7832. a[n] = i;
  7833. var o = {
  7834. type: "player-status-change",
  7835. playerId: t.playerId,
  7836. mediaType: n,
  7837. status: i.status,
  7838. reason: i.reason,
  7839. isErrorState: !1,
  7840. streamId: t.id
  7841. };
  7842. c.
  7843. default.debug("[".concat(t.id, "] Media Player Status Change Triggered by destroy()"), o),
  7844. e.stream.dispatchEvent(o),
  7845. p.report.reportApiInvoke(e.stream.sid, {
  7846. name: "Stream.playerStatusChange",
  7847. options: o,
  7848. tag: "tracer"
  7849. })()
  7850. }))
  7851. },
  7852. t.div = document.createElement("div"),
  7853. t.div.setAttribute("id", "player_" + t.id),
  7854. e.stream.video ? t.div.setAttribute("style", "width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;") : t.div.setAttribute("style", "width: 100%; height: 100%; position: relative; overflow: hidden;"),
  7855. t.video = document.createElement("video"),
  7856. t.video.setAttribute("id", "video" + t.id),
  7857. e.stream.local && !e.stream.screen ? e.stream.mirror ? t.video.setAttribute("style", "width: 100%; height: 100%; position: absolute; transform: rotateY(180deg); object-fit: ".concat(t.fit || "cover", ";")) : t.video.setAttribute("style", "width: 100%; height: 100%; position: absolute; object-fit: ".concat(t.fit || "cover", ";")) : e.stream.video ? t.video.setAttribute("style", "width: 100%; height: 100%; position: absolute; object-fit: ".concat(t.fit || "cover", ";")) : e.stream.screen ? t.video.setAttribute("style", "width: 100%; height: 100%; position: absolute; object-fit: ".concat(t.fit || "contain")) : t.video.setAttribute("style", "width: 100%; height: 100%; position: absolute; display: none; object-fit: ".concat(t.fit || "cover"));
  7858. var n = {
  7859. autoplay: !0,
  7860. muted: !!e.stream.local || !(!o.isSafari() && "iOS" !== o.getBrowserOS()) && "video_element_muted",
  7861. playsinline: !0,
  7862. controls: !1,
  7863. volume: null
  7864. },
  7865. r = i()({},
  7866. n, e.options); ! 0 !== r.muted || r.volume || (r.volume = 0),
  7867. t.video.setAttribute("autoplay", ""),
  7868. t.video.setAttribute("muted", ""),
  7869. t.video.muted = !0,
  7870. t.video.autoplay = !0,
  7871. r.playsinline && t.video.setAttribute("playsinline", ""),
  7872. r.controls && t.video.setAttribute("controls", ""),
  7873. r.contains && (t.video.controls = !0),
  7874. Number.isFinite(r.volume) && (t.video.volume = r.volume),
  7875. t.audio = document.createElement("audio"),
  7876. t.audio.setAttribute("id", "audio" + t.id),
  7877. !0 === r.muted && t.audio.setAttribute("muted", ""),
  7878. !0 === r.muted && (t.audio.muted = !0),
  7879. r.playsinline && t.audio.setAttribute("playsinline", ""),
  7880. Number.isFinite(r.volume) && (t.audio.volume = r.volume),
  7881. void 0 !== t.elementID && document.getElementById(t.elementID) !== null ? (document.getElementById(t.elementID).appendChild(t.div), t.container = document.getElementById(t.elementID)) : (document.body.appendChild(t.div), t.container = document.body),
  7882. t.parentNode = t.div.parentNode;
  7883. var a = {
  7884. video: {
  7885. playerId: t.playerId,
  7886. stateId: 0,
  7887. playDeferTimeout: null,
  7888. error: !1,
  7889. status: "init",
  7890. reason: null,
  7891. updatedAt: Date.now()
  7892. },
  7893. audio: {
  7894. playerId: t.playerId,
  7895. stateId: 0,
  7896. playDeferTimeout: null,
  7897. error: !1,
  7898. status: "init",
  7899. reason: null,
  7900. updatedAt: Date.now()
  7901. }
  7902. };
  7903. t.mediaElemExists = function(e) {
  7904. for (var t = e,
  7905. n = 0; n < Object(l.getParameter)("MEDIA_ELEMENT_EXISTS_DEPTH") && t; n++) t = t.parentNode;
  7906. return !! t
  7907. };
  7908. var g = function(e) {
  7909. return t.mediaElemExists(e) ? e.paused ? "paused": "play": "aborted"
  7910. },
  7911. m = function(e, t, n) {
  7912. var r = g(e),
  7913. i = !0;
  7914. return "paused" === r ? ("audio" === t && !0 === n.muted && (i = !1), n.autoplay || (i = !1)) : "play" === r ? "video" === t ? i = !1 : !0 === n.muted ? e.muted && (i = !1) : e.muted || (i = !1) : "aborted" === r && (i = !1),
  7915. i
  7916. },
  7917. h = function(n) {
  7918. var i, o = this;
  7919. if (o === t.video ? i = "video": o === t.audio && (i = "audio"), i) {
  7920. if (n.type || c.
  7921. default.error("[".concat(t.id, "] Unexpected evt"), n), "video" === i && o.muted && o.paused) return c.
  7922. default.debug("[".concat(t.id, "] auto resume video element")),
  7923. void o.play().catch(err => console.log('play err', err));
  7924. var s = g(o);
  7925. clearTimeout(a[i].playDeferTimeout),
  7926. a[i].playDeferTimeout = setTimeout((function() {
  7927. a[i].playDeferTimeout = null;
  7928. var d = a[i],
  7929. u = g(o);
  7930. if (s === u) {
  7931. var l = {
  7932. playerId: t.playerId,
  7933. stateId: d.stateId + 1,
  7934. playDeferTimeout: null,
  7935. error: m(o, i, r),
  7936. status: g(o),
  7937. reason: n.type,
  7938. updatedAt: Date.now()
  7939. };
  7940. if (d.status !== l.status) {
  7941. a[i] = l;
  7942. var f = {
  7943. type: "player-status-change",
  7944. playerId: t.playerId,
  7945. mediaType: i,
  7946. status: l.status,
  7947. reason: l.reason,
  7948. isErrorState: l.error,
  7949. streamId: t.id
  7950. };
  7951. c.
  7952. default.debug("[".concat(t.id, "] Media Player Status Change"), f),
  7953. e.stream.dispatchEvent(f),
  7954. p.report.reportApiInvoke(e.stream.sid, {
  7955. name: "Stream.playerStatusChange",
  7956. options: f,
  7957. tag: "tracer"
  7958. })()
  7959. }
  7960. } else c.
  7961. default.debug("[".concat(t.id, "] Status Change after event Triggered.") + "Stream ".concat(t.id, " PlayerId ").concat(t.playerId, " mediaType ").concat(i, " Status ").concat(s, "=>").concat(u))
  7962. }), Object(l.getParameter)("PLAYER_STATE_DEFER"))
  7963. } else c.
  7964. default.error("[".concat(t.id, "] Unknown media element"), o)
  7965. };
  7966. t.video.addEventListener("playing", (function(e) { !
  7967. function e() {
  7968. t.video.videoWidth * t.video.videoHeight > 4 ? c.
  7969. default.debug("[" + t.id + "] video dimensions:", t.video.videoWidth, t.video.videoHeight) : setTimeout(e, 50)
  7970. } ()
  7971. }));
  7972. var v = 0,
  7973. E = 0,
  7974. _ = 0;
  7975. t.freezeCheckInterval = setInterval((function() {
  7976. Date.now() - t.lastTimeupdateTime > 500 ? (t.isFreeze = !0, t.freezeCount += 1) : t.isFreeze = !1
  7977. }), 500),
  7978. t.video.addEventListener("playing", h),
  7979. t.video.addEventListener("canplay", h),
  7980. t.video.addEventListener("abort", h),
  7981. t.video.addEventListener("onerror", h),
  7982. t.video.addEventListener("suspend", h),
  7983. t.video.addEventListener("stalled", h),
  7984. t.video.addEventListener("pause", h),
  7985. t.audio.addEventListener("playing", h),
  7986. t.audio.addEventListener("canplay", h),
  7987. t.audio.addEventListener("abort", h),
  7988. t.audio.addEventListener("onerror", h),
  7989. t.audio.addEventListener("suspend", h),
  7990. t.audio.addEventListener("stalled", h),
  7991. t.audio.addEventListener("pause", h);
  7992. var S = t.audio,
  7993. y = "audio";
  7994. if (e.stream.hasVideo() || e.stream.hasScreen()) t.div.appendChild(t.video),
  7995. t.div.appendChild(t.audio),
  7996. o.isEdge() ? t.video.srcObject = e.stream.stream: (Object(d.attachMediaStream)(t.video, e.stream.stream), Object(d.attachMediaStream)(t.audio, e.stream.stream)),
  7997. t.video.addEventListener("timeupdate", (function() {
  7998. var e = Date.now();
  7999. if ((v += 1) < 10) t.lastTimeupdateTime = e;
  8000. else for (e - t.lastTimeupdateTime > 500 && (E += e - t.lastTimeupdateTime), _ += e - t.lastTimeupdateTime, t.lastTimeupdateTime = e; _ >= 6e3;) _ -= 6e3,
  8001. t.freezeTimeCounterList.push(Math.min(6e3, E)),
  8002. E -= 6e3,
  8003. E = Math.max(E, 0)
  8004. }));
  8005. else { ! 1 !== r.muted && "video_element_muted" !== r.muted || (t.video.removeAttribute("muted"), t.video.muted = !1),
  8006. t.video.removeAttribute("autoplay"),
  8007. t.video.autoplay = !1,
  8008. t.div.appendChild(t.video),
  8009. S = t.video,
  8010. y = "video";
  8011. var R = a.audio,
  8012. T = {
  8013. playerId: t.playerId,
  8014. stateId: R.stateId + 1,
  8015. playDeferTimeout: null,
  8016. error: !1,
  8017. status: "aborted",
  8018. reason: "audioonly",
  8019. updatedAt: Date.now()
  8020. };
  8021. a.audio = T;
  8022. var I = {
  8023. type: "player-status-change",
  8024. playerId: t.playerId,
  8025. mediaType: "audio",
  8026. status: T.status,
  8027. reason: T.reason,
  8028. isErrorState: T.error,
  8029. streamId: t.id
  8030. };
  8031. if (c.
  8032. default.debug("[".concat(t.id, "] Media Player Status Change"), I), Promise.resolve().then((function() {
  8033. return e.stream.dispatchEvent(I)
  8034. })), p.report.reportApiInvoke(e.stream.sid, {
  8035. name: "Stream.playerStatusChange",
  8036. options: I,
  8037. tag: "tracer"
  8038. })(), window.MediaStream && (o.isSafari() || "iOS" === o.getBrowserOS())) {
  8039. var A = new MediaStream(e.stream.stream.getAudioTracks());
  8040. Object(d.setSrcObject)(t.video, A)
  8041. } else Object(d.setSrcObject)(t.video, e.stream.stream)
  8042. }
  8043. if (r.autoplay && S) {
  8044. var b = S.play();
  8045. b && b.
  8046. catch && b.
  8047. catch((function(n) {
  8048. if (!t.destroyed && S) {
  8049. var i = a[y],
  8050. o = {
  8051. playerId: t.playerId,
  8052. stateId: i.stateId + 1,
  8053. playDeferTimeout: null,
  8054. error: m(S, y, r),
  8055. status: g(S),
  8056. reason: "error",
  8057. updatedAt: Date.now()
  8058. };
  8059. if (i.status !== o.status) {
  8060. c.
  8061. default.debug("[".concat(t.id, "] Player ").concat(t.playerId, " Status Changed Detected by promise error: ").concat(i.status, "=>").concat(o.status), n),
  8062. a[y] = o;
  8063. var s = {
  8064. type: "player-status-change",
  8065. playerId: t.playerId,
  8066. mediaType: y,
  8067. status: o.status,
  8068. reason: o.reason,
  8069. isErrorState: o.error,
  8070. streamId: t.id
  8071. };
  8072. c.
  8073. default.debug("[".concat(t.id, "] Media Player Status Change"), s),
  8074. e.stream.dispatchEvent(s),
  8075. p.report.reportApiInvoke(e.stream.sid, {
  8076. name: "Stream.playerStatusChange",
  8077. options: s,
  8078. tag: "tracer"
  8079. })()
  8080. }
  8081. }
  8082. }))
  8083. }
  8084. return t.setAudioVolume = function(e) {
  8085. var n = parseInt(e) / 100;
  8086. isFinite(n) && (n < 0 ? n = 0 : n > 1 && (n = 1), t.video && (t.video.volume = n), t.audio && (t.audio.volume = n))
  8087. },
  8088. t
  8089. },
  8090. m = n(22),
  8091. h = n(10),
  8092. v = n(6),
  8093. E = n(19),
  8094. _ = n(2),
  8095. S = n(24);
  8096. var y = n(16),
  8097. R = n(11),
  8098. T = n.n(R),
  8099. I = function(e) {
  8100. Object(_.checkValidString)(e, "profileName"),
  8101. -1 === (e = e.toLowerCase()).indexOf("_") && (e += "_1"),
  8102. Object(_.checkValidEnum)(e, "profileName", Object.keys(l.SUPPORT_RESOLUTION_LIST));
  8103. var t = l.SUPPORT_RESOLUTION_LIST[e];
  8104. t || (e = Object(l.getParameter)("DEFAULT_PROFILE"), t = l.SUPPORT_RESOLUTION_LIST[e]);
  8105. var n = {
  8106. profileName: e,
  8107. video: {
  8108. width: t[0],
  8109. height: t[1]
  8110. },
  8111. attributes: {
  8112. resolution: "".concat(t[0], "x").concat(t[1]),
  8113. minFrameRate: t[2],
  8114. maxFrameRate: t[3],
  8115. minVideoBW: t[4],
  8116. maxVideoBW: t[5]
  8117. }
  8118. };
  8119. return t[2] && (n.video.frameRate = t[2]),
  8120. t[6] && t[7] && (n.screen = {
  8121. width: t[0],
  8122. height: t[1],
  8123. frameRate: {
  8124. min: t[6],
  8125. max: t[7]
  8126. }
  8127. }),
  8128. n
  8129. },
  8130. A = function(e) {
  8131. return Object.keys(l.SUPPORT_RESOLUTION_LIST).filter((function(t) {
  8132. var n = l.SUPPORT_RESOLUTION_LIST[t],
  8133. r = ["width", "height", "frameRate"];
  8134. for (var i in r) {
  8135. var o = r[i];
  8136. if (e[o] && n[i]) {
  8137. if ("number" == typeof e[o].max && e[o].max < n[i]) return ! 1;
  8138. if ("number" == typeof e[o].min && e[o].min > n[i]) return ! 1
  8139. }
  8140. }
  8141. return ! 0
  8142. })).reverse()
  8143. },
  8144. b = function(e) {
  8145. var t = l.AUDIO_PROFILE_SETTINGS[e] || l.AUDIO_PROFILE_SETTINGS.
  8146. default;
  8147. return {
  8148. highQuality:
  8149. t[0],
  8150. stereo: t[1],
  8151. speech: t[2],
  8152. lowQuality: t[3]
  8153. }
  8154. };
  8155. var O = function(e) {
  8156. var t = Object(a.b)();
  8157. if (t.params = i()({},
  8158. e), t.stream = e.stream, t.url = e.url, t.onClose = void 0, t.local = !1, t.videoSource = e.videoSource, t.audioSource = e.audioSource, e.video = !(!e.videoSource && !e.video), t.video = e.video, e.audio = !(!e.audioSource && !e.audio), t.audio = e.audio, t.screen = !!e.screen, t.screenAudio = !!e.screenAudio, t.screenAttributes = {
  8159. width: 1920,
  8160. height: 1080,
  8161. maxFr: 5,
  8162. minFr: 1
  8163. },
  8164. t.videoSize = e.videoSize, t.player = void 0, t.audioLevelHelper = null, e.attributes = e.attributes || {},
  8165. t.attributes = e.attributes, t.microphoneId = e.microphoneId, t.cameraId = e.cameraId, t.facingMode = e.facingMode, t.inSwitchDevice = !1, t.userMuteVideo = !1, t.userMuteAudio = !1, t.peerMuteVideo = !1, t.peerMuteAudio = !1, t.lowStream = null, t.videoWidth = 0, t.videoHeight = 0, t.streamId = e.streamID, t.userId = null, t.uintId = e.uintUID || null, t.mirror = !1 !== e.mirror, t.DTX = e.audioProcessing && e.audioProcessing.DTX, t.audioProcessing = e.audioProcessing, t.optimizationMode = e.optimizationMode, t.highQuality = !1, t.stereo = !1, t.speech = !1, t.screen || delete t.screen, !(void 0 === t.videoSize || t.videoSize instanceof Array && 4 === t.videoSize.length)) throw Error("Invalid Video Size");
  8166. function n() {
  8167. var e = {};
  8168. t.getVideoTrack() === this ? (c.
  8169. default.debug("Video Track Ended"), e.type = "videoTrackEnded", e.track = this) : t.getAudioTrack() === this ? (c.
  8170. default.debug("Audio Track Ended"), e.type = "audioTrackEnded", e.track = this) : c.
  8171. default.debug("Detached Track ended", this.kind, this.label, this),
  8172. e.type && t.dispatchEvent(e)
  8173. }
  8174. return t.videoSize = [640, 480, 640, 480],
  8175. void 0 !== e.local && !0 !== e.local || (t.local = !0),
  8176. t.initialized = !t.local,
  8177. t._streamInitID = null,
  8178. function(e) {
  8179. e.audioMixing = {
  8180. audioContextInited: !1,
  8181. defaultVolume: 100,
  8182. inEarMonitoring: "FILE",
  8183. sounds: {},
  8184. states: {
  8185. IDLE: "IDLE",
  8186. STARTING: "STARTING",
  8187. BUSY: "BUSY",
  8188. PAUSED: "PAUSED"
  8189. },
  8190. inEarMonitoringModes: {
  8191. NONE: "NONE",
  8192. FILE: "FILE",
  8193. MICROPHONE: "MOCROPHONE",
  8194. ALL: "ALL"
  8195. },
  8196. ctx: null,
  8197. mediaStreamSource: null,
  8198. mediaStreamDest: null,
  8199. buffer: {}
  8200. },
  8201. e._initSoundIfNotExists = function(t, n) {
  8202. e.audioMixing.sounds[t] || (e.audioMixing.sounds[t] = {
  8203. soundId: t,
  8204. state: "IDLE",
  8205. muted: e.userMuteAudio,
  8206. filePath: n,
  8207. volume: e.audioMixing.defaultVolume,
  8208. startAt: null,
  8209. startOffset: null,
  8210. pauseAt: null,
  8211. pauseOffset: null,
  8212. resumeAt: null,
  8213. resumeOffset: null,
  8214. stopAt: null,
  8215. options: null,
  8216. source: null
  8217. })
  8218. },
  8219. e._initSoundIfNotExists( - 1),
  8220. e.loadAudioBuffer = function(t, n, r) {
  8221. var i = p.report.reportApiInvoke(e.sid, {
  8222. callback: r,
  8223. name: "Stream.loadAudioBuffer",
  8224. options: arguments,
  8225. tag: "tracer"
  8226. });
  8227. Object(_.checkValidString)(n, "url", 1, 1024, !1),
  8228. Object(_.checkValidString)(t, "id", 1, 1024, !1);
  8229. var o = function(t) {
  8230. c.
  8231. default.error("[".concat(e.streamId, "] loadAudioBuffer Failed: ") + t),
  8232. i(u.
  8233. default.LOAD_AUDIO_FAILED)
  8234. },
  8235. a = new XMLHttpRequest;
  8236. a.open("GET", n, !0),
  8237. a.responseType = "arraybuffer",
  8238. a.onload = function() {
  8239. if (a.status > 400) o("".concat(a.status, " ").concat(a.statusText));
  8240. else {
  8241. var n = a.response;
  8242. e.audioMixing.audioContextInited || e._initAudioContext(),
  8243. e.audioMixing.ctx.decodeAudioData(n, (function(n) {
  8244. e.audioMixing.buffer[t] = n,
  8245. i(null)
  8246. }), (function(t) {
  8247. c.
  8248. default.error("[".concat(e.streamId, "] decodeAudioData Failed: "), t),
  8249. i(t)
  8250. }))
  8251. }
  8252. },
  8253. a.onerror = function() {
  8254. return o("load error")
  8255. },
  8256. a.ontimeout = function() {
  8257. return o("timeout")
  8258. },
  8259. a.send()
  8260. },
  8261. e.createAudioBufferSource = function(t) {
  8262. var n = p.report.reportApiInvoke(e.sid, {
  8263. name: "Stream.createAudioBufferSource",
  8264. options: arguments,
  8265. tag: "tracer"
  8266. });
  8267. if (e.audioMixing.buffer[t.id]) {
  8268. var r = e.audioMixing.buffer[t.id],
  8269. i = e.audioMixing.ctx.createBufferSource();
  8270. i.buffer = r;
  8271. var a = e.audioMixing.ctx.createGain();
  8272. if (i.connect(a), a.connect(e.audioMixing.mediaStreamDest), i.gainNode = a, t.loop) i.loop = !0,
  8273. i.start(0, t.playTime / 1e3);
  8274. else if (t.cycle > 1) if (Object(o.isChrome)()) {
  8275. i.loop = !0;
  8276. var s = t.cycle * r.duration * 1e3 - (t.playTime || 0);
  8277. i.start(0, t.playTime / 1e3, s / 1e3)
  8278. } else c.
  8279. default.warning("[".concat(e.streamId, "] Cycle Param is ignored by current browser")),
  8280. i.start(0, t.playTime / 1e3);
  8281. else i.start(0, t.playTime / 1e3);
  8282. var d = e.audioMixing.sounds[t.soundId];
  8283. return d.source = i,
  8284. e._flushAudioMixingMuteStatus(),
  8285. i.addEventListener("ended", (function() {
  8286. i === d.source && e.dispatchEvent({
  8287. type: "audioSourceEnded",
  8288. soundId: t.soundId,
  8289. source: i,
  8290. sound: d
  8291. })
  8292. })),
  8293. n(),
  8294. i
  8295. }
  8296. var u = "AUDIOBUFFER_NOT_FOUND";
  8297. return c.
  8298. default.error("[".concat(e.streamId, "] "), u, t.id),
  8299. n(!1),
  8300. !1
  8301. },
  8302. e.on("audioSourceEnded", (function(t) {
  8303. var n = t.source,
  8304. r = t.sound;
  8305. r && r.state === e.audioMixing.states.BUSY && !r.pauseAt && (r.state = e.audioMixing.states.IDLE, r.startAt = null, r.startOffset = null, r.resumeAt = null, r.resumeOffset = null, n.gainNode && n.gainNode.disconnect && n.gainNode.disconnect(), n.buffer = null, e.audioMixing.mediaStreamSource.connect(e.audioMixing.mediaStreamDest))
  8306. })),
  8307. e.clearAudioBufferSource = function() {
  8308. e.audioBufferSource.forEach((function(e) {
  8309. e.stop()
  8310. }))
  8311. },
  8312. e._isSoundExists = function(t) {
  8313. return !! e.audioMixing.sounds[t.soundId] || (c.
  8314. default.error("SoundId not exists. #".concat(t.soundId)), !1)
  8315. },
  8316. e._initAudioContext = function() {
  8317. if (e.audioMixing.audioContextInited) throw new Error("Failed to init audio context. Already inited");
  8318. if (!e.stream) throw new Error("Failed to init audio context. Local Stream not initialized");
  8319. e.audioMixing.ctx = Object(S.a)(),
  8320. e.audioMixing.mediaStreamSource = e.audioMixing.ctx.createMediaStreamSource(e.stream),
  8321. e.audioMixing.mediaStreamDest = e.audioMixing.ctx.createMediaStreamDestination(),
  8322. e.audioMixing.mediaStreamSource.connect(e.audioMixing.mediaStreamDest);
  8323. var t = e.stream.getVideoTracks()[0];
  8324. if (t && e.audioMixing.mediaStreamDest.stream.addTrack(t), e._originStream = e.stream, e._isAudioMuted() ? (e._unmuteAudio(), e.stream = e.audioMixing.mediaStreamDest.stream, e._muteAudio()) : e.stream = e.audioMixing.mediaStreamDest.stream, e.audioLevelHelper = null, e.pc && e.pc.peerConnection && e.pc.peerConnection) {
  8325. var n = (e.pc.peerConnection && e.pc.peerConnection.getSenders()).find((function(e) {
  8326. return e && e.track && "audio" == e.track.kind
  8327. })),
  8328. r = e.audioMixing.mediaStreamDest.stream.getAudioTracks()[0];
  8329. n && n.replaceTrack && r && n.replaceTrack(r)
  8330. }
  8331. e.audioMixing.audioContextInited = !0
  8332. },
  8333. e._cleanupAudioMixing = function() {
  8334. if (e.audioMixing.audioContextInited) {
  8335. for (var t in e.audioMixing.sounds) {
  8336. var n = e.audioMixing.sounds[t];
  8337. n.state !== e.audioMixing.states.BUSY && n.state !== e.audioMixing.states.PAUSED || e._stopOneEffect({
  8338. soundId: t
  8339. })
  8340. }
  8341. e.audioLevelHelper = null,
  8342. e.audioMixing.audioContextInited = !1
  8343. }
  8344. },
  8345. e._reloadInEarMonitoringMode = function(t) {
  8346. if (t) {
  8347. if (!e.audioMixing.inEarMonitoringModes[t]) return c.
  8348. default.error("[".concat(e.streamId, "] Invalid InEarMonitoringMode ").concat(t));
  8349. e.audioMixing.inEarMonitoring = t
  8350. }
  8351. switch (e.audioMixing.audioContextInited || e._initAudioContext(), e.audioMixing.inEarMonitoring) {
  8352. case e.audioMixing.inEarMonitoringModes.FILE:
  8353. e.audioMixing.mediaStreamSource.connectedToDestination && (e.audioMixing.mediaStreamSource.disconnect(e.audioMixing.ctx.destination), e.audioMixing.mediaStreamSource.connectedToDestination = !1);
  8354. case e.audioMixing.inEarMonitoringModes.ALL:
  8355. for (var n in e.audioMixing.sounds) {
  8356. var r = e.audioMixing.sounds[n];
  8357. r && r.source && !r.source.connectedToDestination && (r.source.gainNode.connect(e.audioMixing.ctx.destination), r.source.connectedToDestination = !0)
  8358. }
  8359. }
  8360. switch (e.audioMixing.inEarMonitoring) {
  8361. case e.audioMixing.inEarMonitoringModes.MICROPHONE:
  8362. e.audioMixing.source.forEach((function(t) {
  8363. t.connectedToDestination && (t.gainNode.disconnect(e.audioMixing.ctx.destination), t.connectedToDestination = !1)
  8364. }));
  8365. case e.audioMixing.inEarMonitoringModes.ALL:
  8366. e.audioMixing.mediaStreamSource.connectedToDestination || (e.audioMixing.mediaStreamSource.connect(e.audioMixing.ctx.destination), e.audioMixing.mediaStreamSource.connectedToDestination = !0)
  8367. }
  8368. },
  8369. e._startAudioMixingBufferSource = function(t) {
  8370. e.audioMixing.audioContextInited || e._initAudioContext();
  8371. var n = {
  8372. soundId: t.soundId,
  8373. id: t.filePath,
  8374. loop: t.loop,
  8375. cycle: t.cycle,
  8376. playTime: t.playTime || 0
  8377. },
  8378. r = t.replace,
  8379. i = e.createAudioBufferSource(n);
  8380. return i.sound = e.audioMixing.sounds[t.soundId],
  8381. i ? (i.addEventListener("ended", e._audioMixingFinishedListener, {
  8382. once: !0
  8383. }), e._reloadInEarMonitoringMode(), r && e.audioMixing.mediaStreamSource.disconnect(e.audioMixing.mediaStreamDest), i) : null
  8384. },
  8385. e._stopAudioMixingBufferSource = function(t) {
  8386. var n = e.audioMixing.sounds[t.soundId].source;
  8387. return n ? (n.removeEventListener("ended", e._audioMixingFinishedListener), e.audioMixing.mediaStreamSource.connect(e.audioMixing.mediaStreamDest), n.stop(), n.gainNode && n.gainNode.disconnect && n.gainNode.disconnect(), n.buffer = null, n) : null
  8388. },
  8389. e._flushAudioMixingMuteStatus = function(t) {
  8390. for (var n in e.audioMixing.sounds) {
  8391. var r = e.audioMixing.sounds[n];
  8392. r && (void 0 !== t && (r.muted = !!t), r.source && (r.muted ? r.source.gainNode.gain.value = 0 : r.source.gainNode.gain.value = r.volume / 100))
  8393. }
  8394. },
  8395. e._handleAudioMixingInvalidStateError = function(t, n, r) {
  8396. var i = e.audioMixing.sounds[n.soundId],
  8397. o = -1 === n.soundId ? "INVALID_AUDIO_MIXING_STATE": "INVALID_PLAY_EFFECT_STATE";
  8398. c.
  8399. default.error("[".concat(e.streamId, "] Cannot ").concat(t, ": ").concat(o, ", state is ").concat(i.state)),
  8400. r && r(o)
  8401. },
  8402. e._handleAudioMixingNoSourceError = function(t, n, r) {
  8403. e.audioMixing.sounds[n.soundId].state = e.audioMixing.states.IDLE;
  8404. var i = -1 === n.soundId ? "NO_AUDIO_MIXING_SOURCE": "NO_EFFECT_SOURCE";
  8405. c.
  8406. default.error("[".concat(e.streamId, "] Cannot ").concat(t, ": ").concat(i)),
  8407. r && r(i)
  8408. },
  8409. e._getOneEffectStates = function(t) {
  8410. var n = e.audioMixing.sounds[t.soundId];
  8411. return function() {
  8412. return n ? {
  8413. state: n.state,
  8414. startAt: n.startAt,
  8415. resumeAt: n.resumeAt,
  8416. pauseOffset: n.pauseOffset,
  8417. pauseAt: n.pauseAt,
  8418. resumeOffset: n.resumeOffset,
  8419. stopAt: n.stopAt,
  8420. duration: e._getOneEffectDuration(t),
  8421. position: e._getOneEffectCurrentPosition(t)
  8422. }: {}
  8423. }
  8424. },
  8425. e._audioMixingFinishedListener = function() {
  8426. var t = this.sound;
  8427. t.state === e.audioMixing.states.IDLE && e.audioMixing.buffer[t.options.filePath] && !t.options.cacheResource && (c.
  8428. default.debug("Recycled buffer ".concat(t.options.filePath)), delete e.audioMixing.buffer[t.options.filePath]),
  8429. -1 === t.soundId && e.dispatchEvent({
  8430. type: "audioMixingFinished"
  8431. })
  8432. },
  8433. e._playOneEffect = function(t, n) {
  8434. Object(_.checkValidObject)(t, "options");
  8435. var r = t.soundId,
  8436. i = (t.filePath, t.cacheResource);
  8437. t.cycle,
  8438. t.loop,
  8439. t.playTime,
  8440. t.replace;
  8441. if (Object(o.isSafari)() && Object(o.getBrowserVersion)() < 12) {
  8442. var a = "BROWSER_NOT_SUPPORT";
  8443. return c.
  8444. default.error("[".concat(e.streamId, "] Cannot _playOneEffect: "), a),
  8445. n(a)
  8446. }
  8447. e.audioMixing.audioContextInited || e._initAudioContext(),
  8448. e._initSoundIfNotExists(r);
  8449. var s = e.audioMixing.sounds[r];
  8450. if (s.state === e.audioMixing.states.IDLE) {
  8451. if (void 0 !== t.cycle && !t.cycle > 0) {
  8452. a = "Invalid Parmeter cycle: " + t.cycle;
  8453. return c.
  8454. default.error("[".concat(e.streamId, "] ").concat(r), a),
  8455. n(a)
  8456. }
  8457. if (Object(_.isEmpty)(i) && (t.cacheResource = !0), s.state = e.audioMixing.states.STARTING, s.options = t, e.audioMixing.buffer[t.filePath]) {
  8458. var d = e._startAudioMixingBufferSource(t);
  8459. if (d) return s.source = d,
  8460. s.startAt = Date.now(),
  8461. s.resumeAt = null,
  8462. s.pauseOffset = null,
  8463. s.pauseAt = null,
  8464. s.resumeOffset = null,
  8465. s.stopAt = null,
  8466. s.startOffset = t.playTime || 0,
  8467. s.state = e.audioMixing.states.BUSY,
  8468. e._flushAudioMixingMuteStatus(),
  8469. n(null);
  8470. s.state = e.audioMixing.states.IDLE;
  8471. var u = "CREATE_BUFFERSOURCE_FAILED";
  8472. if (n) return n(u);
  8473. c.
  8474. default.error("[".concat(e.streamId, "] "), u)
  8475. } else e.loadAudioBuffer(t.filePath, t.filePath, (function(r) {
  8476. if (r) s.state = e.audioMixing.states.IDLE,
  8477. n ? n(r) : c.
  8478. default.error("[".concat(e.streamId, "] "), r);
  8479. else {
  8480. var i = e._startAudioMixingBufferSource(t);
  8481. if (i) return s.source = i,
  8482. s.startAt = Date.now(),
  8483. s.resumeAt = null,
  8484. s.pauseOffset = null,
  8485. s.pauseAt = null,
  8486. s.resumeOffset = null,
  8487. s.stopAt = null,
  8488. s.startOffset = t.playTime || 0,
  8489. s.state = e.audioMixing.states.BUSY,
  8490. e._flushAudioMixingMuteStatus(),
  8491. n(null);
  8492. s.state = e.audioMixing.states.IDLE;
  8493. r = "CREATE_BUFFERSOURCE_FAILED";
  8494. if (n) return n(r);
  8495. c.
  8496. default.error("[".concat(e.streamId, "] "), r)
  8497. }
  8498. }))
  8499. } else e._handleAudioMixingInvalidStateError("_playEffect", t, n)
  8500. },
  8501. e._stopOneEffect = function(t, n) {
  8502. var r = e.audioMixing.sounds[t.soundId];
  8503. return e._isSoundExists(t) ? r.state === e.audioMixing.states.BUSY || r.state === e.audioMixing.states.PAUSED ? (e._stopAudioMixingBufferSource(t), r.stopAt = Date.now(), r.state = e.audioMixing.states.IDLE, e.audioMixing.buffer[r.options.filePath] && !r.options.cacheResource && (c.
  8504. default.debug("Recycled buffer ".concat(r.options.filePath)), delete e.audioMixing.buffer[r.options.filePath]), void(n && n(null))) : void e._handleAudioMixingInvalidStateError("_stopOneEffect", t, n) : n("SOUND_NOT_EXISTS")
  8505. },
  8506. e._pauseOneEffect = function(t, n) {
  8507. var r = e.audioMixing.sounds[t.soundId];
  8508. if (r.state === e.audioMixing.states.BUSY) return e._stopAudioMixingBufferSource(t) ? (r.pauseAt = Date.now(), r.state = e.audioMixing.states.PAUSED, r.resumeAt ? r.pauseOffset = r.pauseAt - r.resumeAt + r.resumeOffset: r.pauseOffset = r.pauseAt - r.startAt + r.startOffset, n && n(null)) : void e._handleAudioMixingNoSourceError("_pauseOneEffect", t, n);
  8509. e._handleAudioMixingInvalidStateError("_pauseOneEffect", t, n)
  8510. },
  8511. e._resumeOneEffect = function(t, n) {
  8512. var r = e.audioMixing.sounds[t.soundId];
  8513. if (r.state === e.audioMixing.states.PAUSED) {
  8514. var i = {
  8515. soundId: t.soundId,
  8516. filePath: r.options.filePath,
  8517. cycle: r.options.cycle,
  8518. loop: r.options.loop,
  8519. playTime: r.pauseOffset,
  8520. replace: r.options.replace
  8521. },
  8522. o = e._startAudioMixingBufferSource(i);
  8523. if (!o) {
  8524. var a = "CREATE_BUFFERSOURCE_FAILED";
  8525. return n(a),
  8526. void c.
  8527. default.error("[".concat(e.streamId, "] "), a)
  8528. }
  8529. r.source = o,
  8530. r.resumeAt = Date.now(),
  8531. r.resumeOffset = r.pauseOffset,
  8532. r.state = e.audioMixing.states.BUSY,
  8533. r.pauseAt = null,
  8534. r.pauseOffset = null,
  8535. n(null)
  8536. } else e._handleAudioMixingInvalidStateError("_resumeOneEffect", t, n)
  8537. },
  8538. e._getOneEffectDuration = function(t) {
  8539. var n = e.audioMixing.sounds[t.soundId];
  8540. return n.options && n.options.filePath && e.audioMixing.buffer[n.options.filePath] ? 1e3 * e.audioMixing.buffer[n.options.filePath].duration: null
  8541. },
  8542. e._getOneEffectCurrentPosition = function(t, n) {
  8543. var r = e.audioMixing.sounds[t.soundId];
  8544. return r.state === e.audioMixing.states.PAUSED ? r.pauseOffset % e._getOneEffectDuration(t) : r.state === e.audioMixing.states.BUSY ? r.resumeAt ? (Date.now() - r.resumeAt + r.resumeOffset) % e._getOneEffectDuration(t) : (Date.now() - r.startAt + r.startOffset) % e._getOneEffectDuration(t) : void(n && e._handleAudioMixingInvalidStateError("_getOneEffectCurrentPosition", t))
  8545. },
  8546. e._setOneEffectPosition = function(t, n, r) {
  8547. var i = e.audioMixing.sounds[t.soundId];
  8548. if (i.state === e.audioMixing.states.BUSY) {
  8549. if (!e._stopAudioMixingBufferSource(t)) return void e._handleAudioMixingNoSourceError("_setOneEffectPosition", t, r);
  8550. var o = {
  8551. soundId: t.soundId,
  8552. filePath: i.options.filePath,
  8553. loop: i.options.loop,
  8554. cycle: i.options.cycle,
  8555. playTime: n
  8556. },
  8557. a = e._startAudioMixingBufferSource(o);
  8558. if (!a) {
  8559. var s = "CREATE_BUFFERSOURCE_FAILED";
  8560. return r && r(s),
  8561. void c.
  8562. default.error("[".concat(e.streamId, "] "), s)
  8563. }
  8564. i.source = a,
  8565. i.startAt = Date.now(),
  8566. i.startOffset = n,
  8567. i.resumeAt = null,
  8568. i.resumeOffset = null,
  8569. i.pauseOffset = null,
  8570. i.pauseAt = null
  8571. } else {
  8572. if (i.state !== e.audioMixing.states.PAUSED) return void e._handleAudioMixingInvalidStateError("_setOneEffectPosition", t, r);
  8573. i.pauseOffset = n
  8574. }
  8575. r && r(null)
  8576. },
  8577. e.startAudioMixing = function(t, n) {
  8578. var r = p.report.reportApiInvoke(e.sid, {
  8579. callback: function(t) {
  8580. if (t) return n && n(t);
  8581. e.dispatchEvent({
  8582. type: "audioMixingPlayed"
  8583. }),
  8584. n && n(null)
  8585. },
  8586. getStates: e._getOneEffectStates({
  8587. soundId: -1
  8588. }),
  8589. name: "Stream.startAudioMixing",
  8590. options: t
  8591. });
  8592. Object(_.checkValidObject)(t, "options");
  8593. var o = t.filePath,
  8594. a = t.cacheResource,
  8595. s = t.cycle,
  8596. c = t.loop,
  8597. d = t.playTime,
  8598. u = t.replace;
  8599. Object(_.checkValidString)(o, "filePath", 1, Object(l.getParameter)("FILEPATH_LENMAX"), !1),
  8600. Object(_.checkValidNumber)(d, "playTime", 0, 1e8),
  8601. !Object(_.isEmpty)(s) && Object(_.checkValidNumber)(s, "cycle"),
  8602. !Object(_.isEmpty)(c) && Object(_.checkValidBoolean)(c, "loop"),
  8603. !Object(_.isEmpty)(u) && Object(_.checkValidBoolean)(u, "replace"),
  8604. !Object(_.isEmpty)(a) && Object(_.checkValidBoolean)(a, "cacheResource");
  8605. var f = i()({
  8606. soundId: -1
  8607. },
  8608. t);
  8609. e._playOneEffect(f, r)
  8610. },
  8611. e.stopAudioMixing = function(t) {
  8612. var n = p.report.reportApiInvoke(e.sid, {
  8613. callback: t,
  8614. getStates: e._getOneEffectStates({
  8615. soundId: -1
  8616. }),
  8617. name: "Stream.stopAudioMixing"
  8618. });
  8619. e._stopOneEffect({
  8620. soundId: -1
  8621. },
  8622. n)
  8623. },
  8624. e.pauseAudioMixing = function(t) {
  8625. var n = p.report.reportApiInvoke(e.sid, {
  8626. callback: t,
  8627. getStates: e._getOneEffectStates({
  8628. soundId: -1
  8629. }),
  8630. name: "Stream.pauseAudioMixing"
  8631. });
  8632. return e._pauseOneEffect({
  8633. soundId: -1
  8634. },
  8635. n)
  8636. },
  8637. e.resumeAudioMixing = function(t) {
  8638. var n = p.report.reportApiInvoke(e.sid, {
  8639. callback: function(n, r) {
  8640. if (n) return t && t(n);
  8641. e.dispatchEvent({
  8642. type: "audioMixingPlayed"
  8643. }),
  8644. t && t(null)
  8645. },
  8646. getStates: e._getOneEffectStates({
  8647. soundId: -1
  8648. }),
  8649. name: "Stream.resumeAudioMixing"
  8650. });
  8651. e._resumeOneEffect({
  8652. soundId: -1
  8653. },
  8654. n)
  8655. },
  8656. e.adjustAudioMixingVolume = function(t) {
  8657. var n = p.report.reportApiInvoke(e.sid, {
  8658. getStates: e._getOneEffectStates({
  8659. soundId: -1
  8660. }),
  8661. name: "Stream.adjustAudioMixingVolume",
  8662. options: arguments,
  8663. tag: "tracer"
  8664. });
  8665. Object(_.checkValidNumber)(t, "volume", 0, 100),
  8666. e.audioMixing.sounds[ - 1].volume = t,
  8667. e._flushAudioMixingMuteStatus(),
  8668. n()
  8669. },
  8670. e.getAudioMixingDuration = function() {
  8671. var t = p.report.reportApiInvoke(e.sid, {
  8672. getStates: e._getOneEffectStates({
  8673. soundId: -1
  8674. }),
  8675. name: "Stream.getAudioMixingDuration"
  8676. }),
  8677. n = e._getOneEffectDuration({
  8678. soundId: -1
  8679. });
  8680. return t(null, n),
  8681. n
  8682. },
  8683. e.getAudioMixingCurrentPosition = function() {
  8684. var t = p.report.reportApiInvoke(e.sid, {
  8685. getStates: e._getOneEffectStates({
  8686. soundId: -1
  8687. }),
  8688. name: "Stream.getAudioMixingCurrentPosition"
  8689. }),
  8690. n = e._getOneEffectCurrentPosition({
  8691. soundId: -1
  8692. },
  8693. !0);
  8694. return t(null, n),
  8695. n
  8696. },
  8697. e.setAudioMixingPosition = function(t, n) {
  8698. var r = p.report.reportApiInvoke(e.sid, {
  8699. callback: n,
  8700. options: arguments,
  8701. tag: "tracer",
  8702. getStates: e._getOneEffectStates({
  8703. soundId: -1
  8704. }),
  8705. name: "Stream.setAudioMixingPosition"
  8706. });
  8707. Object(_.checkValidNumber)(t, "position", 0, 1e8),
  8708. e._setOneEffectPosition({
  8709. soundId: -1
  8710. },
  8711. t, r)
  8712. },
  8713. e.playEffect = function(t, n) {
  8714. var r = p.report.reportApiInvoke(e.sid, {
  8715. callback: function(t) {
  8716. if (t) return n && n(t);
  8717. e.dispatchEvent({
  8718. type: "effectPlayed"
  8719. }),
  8720. n && n(null)
  8721. },
  8722. name: "Stream.playEffect",
  8723. options: t
  8724. });
  8725. Object(_.checkValidObject)(t, "options");
  8726. var i = t.soundId,
  8727. o = t.filePath,
  8728. a = t.cycle;
  8729. Object(_.checkValidNumber)(i, "soundId", 1, 1e4),
  8730. Object(_.checkValidString)(o, "filePath", 0, Object(l.getParameter)("FILEPATH_LENMAX"), !1),
  8731. !Object(_.isEmpty)(a) && Object(_.checkValidNumber)(a, "cycle"),
  8732. e._playOneEffect(t, r)
  8733. },
  8734. e.stopEffect = function(t, n) {
  8735. var r = p.report.reportApiInvoke(e.sid, {
  8736. callback: n,
  8737. getStates: e._getOneEffectStates({
  8738. soundId: t
  8739. }),
  8740. name: "Stream.stopEffect"
  8741. });
  8742. Object(_.checkValidNumber)(t, "soundId", 1, 1e4),
  8743. e._stopOneEffect({
  8744. soundId: t
  8745. },
  8746. r)
  8747. },
  8748. e.stopAllEffects = function(t) {
  8749. var n = p.report.reportApiInvoke(e.sid, {
  8750. callback: t,
  8751. name: "Stream.stopAllEffect"
  8752. }),
  8753. r = !1,
  8754. i = 0,
  8755. o = 0,
  8756. a = function(e) {
  8757. r || (e ? (n(e), r = !0) : i += 1, i === o && (n(null), r = !0))
  8758. };
  8759. for (var s in e.audioMixing.sounds) {
  8760. var c = e.audioMixing.sounds[s]; - 1 !== c.soundId && (c.state !== e.audioMixing.states.BUSY && c.state !== e.audioMixing.states.PAUSED || (o++, e._stopOneEffect({
  8761. soundId: s
  8762. },
  8763. a)))
  8764. }
  8765. o || n(null)
  8766. },
  8767. e.preloadEffect = function(t, n, r) {
  8768. var i = p.report.reportApiInvoke(e.sid, {
  8769. callback: r,
  8770. options: arguments,
  8771. tag: "tracer",
  8772. name: "Stream.preloadEffect"
  8773. });
  8774. Object(_.checkValidNumber)(t, "soundId", 1, 1e4),
  8775. Object(_.checkValidString)(n, "filePath", 1, Object(l.getParameter)("FILEPATH_LENMAX"), !1),
  8776. e._initSoundIfNotExists(t, n),
  8777. e.audioMixing.buffer[n] ? i(null) : e.loadAudioBuffer(n, n, i)
  8778. },
  8779. e.unloadEffect = function(t, n) {
  8780. var r = p.report.reportApiInvoke(e.sid, {
  8781. callback: n,
  8782. options: arguments,
  8783. tag: "tracer",
  8784. name: "Stream.unloadEffect"
  8785. });
  8786. Object(_.checkValidNumber)(t, "soundId", 1, 1e4);
  8787. var i = e.audioMixing.sounds[t];
  8788. if (!i) {
  8789. var o = "SOUND_NOT_EXISTS";
  8790. return c.
  8791. default.error(o, t),
  8792. void r(o)
  8793. }
  8794. var a = i.options ? i.options.filePath: i.filePath;
  8795. if (a) delete e.audioMixing.buffer[a],
  8796. delete e.audioMixing.sounds[t],
  8797. r(null);
  8798. else {
  8799. var s = "SOUND_BUFFER_NOT_FOUND";
  8800. c.
  8801. default.error(s, t),
  8802. r(s)
  8803. }
  8804. },
  8805. e.pauseEffect = function(t, n) {
  8806. var r = p.report.reportApiInvoke(e.sid, {
  8807. callback: n,
  8808. options: arguments,
  8809. tag: "tracer",
  8810. name: "Stream.pauseEffect"
  8811. });
  8812. return e._pauseOneEffect({
  8813. soundId: t
  8814. },
  8815. r)
  8816. },
  8817. e.pauseAllEffects = function(t) {
  8818. var n = p.report.reportApiInvoke(e.sid, {
  8819. callback: t,
  8820. name: "Stream.pauseAllEffects"
  8821. }),
  8822. r = !1,
  8823. i = 0,
  8824. o = 0,
  8825. a = function(e) {
  8826. r || (e ? (n(e), r = !0) : i += 1, i === o && (n(null), r = !0))
  8827. };
  8828. for (var s in e.audioMixing.sounds)"-1" !== s && e.audioMixing.sounds[s].state === e.audioMixing.states.BUSY && (o++, e._pauseOneEffect({
  8829. soundId: s
  8830. },
  8831. a));
  8832. o || n(null)
  8833. },
  8834. e.resumeEffect = function(t, n) {
  8835. Object(_.checkValidNumber)(t, "soundId", 1, 1e4);
  8836. var r = p.report.reportApiInvoke(e.sid, {
  8837. callback: n,
  8838. options: arguments,
  8839. tag: "tracer",
  8840. name: "Stream.resumeEffect"
  8841. });
  8842. return e._resumeOneEffect({
  8843. soundId: t
  8844. },
  8845. r)
  8846. },
  8847. e.resumeAllEffects = function(t) {
  8848. var n = p.report.reportApiInvoke(e.sid, {
  8849. callback: t,
  8850. name: "Stream.resumeAllEffects"
  8851. }),
  8852. r = !1,
  8853. i = 0,
  8854. o = 0,
  8855. a = function(e) {
  8856. r || (e ? (n(e), r = !0) : i += 1, i === o && (n(null), r = !0))
  8857. };
  8858. for (var s in e.audioMixing.sounds)"-1" !== s && e.audioMixing.sounds[s].state === e.audioMixing.states.PAUSED && (o++, e._resumeOneEffect({
  8859. soundId: s
  8860. },
  8861. a));
  8862. o || n(null)
  8863. },
  8864. e.getEffectsVolume = function() {
  8865. var t = [];
  8866. for (var n in e.audioMixing.sounds) {
  8867. var r = e.audioMixing.sounds[n];
  8868. r && "-1" !== n && t.push({
  8869. soundId: parseInt(n),
  8870. volume: r.volume
  8871. })
  8872. }
  8873. return t
  8874. },
  8875. e.setEffectsVolume = function(t, n) {
  8876. var r = p.report.reportApiInvoke(e.sid, {
  8877. name: "Stream.setEffectsVolume",
  8878. options: arguments,
  8879. tag: "tracer",
  8880. callback: n
  8881. });
  8882. for (var i in Object(_.checkValidNumber)(t, "volume", 0, 100), e.audioMixing.defaultVolume = t, e.audioMixing.sounds) {
  8883. var o = e.audioMixing.sounds[i];
  8884. "-1" !== i && (o.volume = t)
  8885. }
  8886. e._flushAudioMixingMuteStatus(),
  8887. r(null)
  8888. },
  8889. e.setVolumeOfEffect = function(t, n, r) {
  8890. var i = p.report.reportApiInvoke(e.sid, {
  8891. name: "Stream.setVolumeOfEffect",
  8892. options: arguments,
  8893. tag: "tracer",
  8894. callback: r
  8895. });
  8896. Object(_.checkValidNumber)(t, "soundId", 0, 1e4),
  8897. Object(_.checkValidNumber)(n, "volume", 0, 100),
  8898. e._initSoundIfNotExists(t);
  8899. var o = e.audioMixing.sounds[t];
  8900. o.volume = n,
  8901. e._flushAudioMixingMuteStatus(),
  8902. i(null)
  8903. }
  8904. } (t),
  8905. y.a.addVideoEffectCapability(t),
  8906. function(e, t) {
  8907. e.videoConstraint = {},
  8908. t.cameraId && (e.videoConstraint.deviceId = {
  8909. exact: t.cameraId
  8910. }),
  8911. t.facingMode && (e.videoConstraint.facingMode = t.facingMode),
  8912. e.videoSize && (e.videoConstraint.width = e.videoSize[0], e.videoConstraint.height = e.videoSize[1]),
  8913. Object(o.isLegacyChrome)() || (e.videoConstraint.frameRate = 30),
  8914. e.audioConstraint = {},
  8915. t.microphoneId && (e.audioConstraint.deviceId = {
  8916. exact: t.microphoneId
  8917. }),
  8918. Object(o.isLegacyChrome)() || e.audioProcessing && (void 0 !== e.audioProcessing.AGC && (Object(o.isFireFox)() ? e.audioConstraint.autoGainControl = e.audioProcessing.AGC: Object(o.isChrome)() && (e.audioConstraint.googAutoGainControl = e.audioProcessing.AGC, e.audioConstraint.googAutoGainControl2 = e.audioProcessing.AGC)), void 0 !== e.audioProcessing.AEC && (e.audioConstraint.echoCancellation = e.audioProcessing.AEC), void 0 !== e.audioProcessing.ANS && (Object(o.isFireFox)() ? e.audioConstraint.noiseSuppression = e.audioProcessing.ANS: Object(o.isChrome)() && (e.audioConstraint.googNoiseSuppression = e.audioProcessing.ANS))),
  8919. e.screenConstraint = {},
  8920. t.sourceId && (e.screenConstraint.sourceId = t.sourceId),
  8921. t.extensionId && Object(o.isChrome)() ? (e.screenConstraint.extensionId = t.extensionId, e.screenConstraint.mandatory = {
  8922. chromeMediaSource: "desktop",
  8923. maxWidth: e.screenAttributes.width,
  8924. maxHeight: e.screenAttributes.height,
  8925. maxFrameRate: e.screenAttributes.maxFr,
  8926. minFrameRate: e.screenAttributes.minFr
  8927. }) : (e.screenConstraint.mediaSource = "screen", e.screenConstraint.width = e.screenAttributes.width, e.screenConstraint.height = e.screenAttributes.height, e.screenConstraint.frameRate = {
  8928. ideal: e.screenAttributes.maxFr,
  8929. max: e.screenAttributes.maxFr
  8930. }),
  8931. t.mediaSource && (e.screenConstraint.mediaSource = t.mediaSource),
  8932. e.setVideoResolution = function(n) {
  8933. var r = p.report.reportApiInvoke(e.sid, {
  8934. name: "Stream.setVideoResolution",
  8935. options: arguments,
  8936. tag: "tracer"
  8937. });
  8938. if (! (n instanceof Array)) {
  8939. var o = I(n += "");
  8940. return o && o.video ? (e.videoConstraint = i()(e.videoConstraint, {
  8941. width: {
  8942. ideal: o.video.width
  8943. },
  8944. height: {
  8945. ideal: o.video.height
  8946. }
  8947. }), t.attributes.resolution = o.attributes.resolution, (a = e.stream && e.stream.getVideoTracks && e.stream.getVideoTracks()[0]) && a.applyConstraints ? (c.
  8948. default.debug("setVideoResolution applyConstraints", e.videoConstraint), a.applyConstraints(e.videoConstraint).then(r).
  8949. catch(r)) : r(), !0) : (r("NO_PROFILE_".concat(n)), !1)
  8950. }
  8951. var a, s = n[0],
  8952. d = n[1];
  8953. e.videoConstraint = i()(e.videoConstraint, {
  8954. width: {
  8955. ideal: s
  8956. },
  8957. height: {
  8958. ideal: d
  8959. }
  8960. }),
  8961. t.attributes.resolution = "".concat(s, "x").concat(d),
  8962. (a = e.stream && e.stream.getVideoTracks && e.stream.getVideoTracks()[0]) && a.applyConstraints ? (c.
  8963. default.debug("setVideoResolution applyConstraints", e.videoConstraint), y.a.disableVideoEffect(e).then((function() {
  8964. return a.applyConstraints(e.videoConstraint).then(r).
  8965. catch(r)
  8966. })).then((function() {
  8967. return y.a.restoreVideoEffect(e)
  8968. }))) : r()
  8969. },
  8970. e.setVideoFrameRate = function(t) {
  8971. var n = p.report.reportApiInvoke(e.sid, {
  8972. name: "Stream.setVideoFrameRate",
  8973. options: arguments,
  8974. tag: "tracer"
  8975. });
  8976. if (Object(o.isFireFox)()) return n("FIREFOX_NOT_SUPPORTED"),
  8977. !1;
  8978. if ("object" === T()(t) && t instanceof Array && t.length > 1) {
  8979. e.videoConstraint = i()(e.videoConstraint, {
  8980. frameRate: t[0]
  8981. }),
  8982. e.attributes.minFrameRate = t[0],
  8983. e.attributes.maxFrameRate = t[1];
  8984. var r = e.stream && e.stream.getVideoTracks && e.stream.getVideoTracks()[0];
  8985. return r && r.applyConstraints ? (c.
  8986. default.debug("setVideoFrameRate applyConstraints", e.videoConstraint), r.applyConstraints(e.videoConstraint).then(n).
  8987. catch(n)) : n(),
  8988. !0
  8989. }
  8990. return n("INVALID_PARAM_".concat(JSON.stringify(t))),
  8991. !1
  8992. },
  8993. e.setVideoBitRate = function(n) {
  8994. var r = p.report.reportApiInvoke(e.sid, {
  8995. name: "Stream.setVideoBitRate",
  8996. options: arguments,
  8997. tag: "tracer"
  8998. });
  8999. return "object" === T()(n) && n instanceof Array && n.length > 1 ? (t.attributes.minVideoBW = n[0], t.attributes.maxVideoBW = n[1], e.connectionSpec && (e.connectionSpec.minVideoBW = n[0], e.connectionSpec.maxVideoBW = n[1]), e.pc && e.pc.renegotiate && e.pc.renegotiate(), r(), !0) : (r("INVALID_PARAM_".concat(JSON.stringify(n))), !1)
  9000. },
  9001. e.setScreenBitRate = function(t) {
  9002. var n = p.report.reportApiInvoke(e.sid, {
  9003. name: "Stream.setScreenBitRate",
  9004. options: arguments,
  9005. tag: "tracer"
  9006. });
  9007. return "object" === T()(t) && t instanceof Array && t.length > 1 ? (e.screenAttributes.minVideoBW = t[0], e.screenAttributes.maxVideoBW = t[1], n(), !0) : (n("INVALID_PARAM_".concat(JSON.stringify(t))), !1)
  9008. },
  9009. e.setScreenProfile = function(t) {
  9010. var n = p.report.reportApiInvoke(e.sid, {
  9011. name: "Stream.setScreenProfile",
  9012. options: arguments,
  9013. tag: "tracer"
  9014. });
  9015. Object(_.checkValidEnum)(t, "profile", ["480p_1", "480p_2", "720p_1", "720p_2", "1080p_1", "1080p_2"]);
  9016. var r = I(t);
  9017. return r && r.screen ? (e.screenConstraint.mandatory ? (e.screenConstraint.mandatory.maxWidth = r.screen.width, e.screenConstraint.mandatory.maxHeight = r.screen.height, r.screen.frameRate && r.screen.frameRate.min && r.screen.frameRate.max && (e.screenConstraint.mandatory.minFrameRate = r.screen.frameRate.min, e.screenConstraint.mandatory.maxFrameRate = r.screen.frameRate.max)) : e.screenConstraint = i()(e.screenConstraint, r.screen), e.screenAttributes.width = r.screen.width, e.screenAttributes.height = r.screen.height, e.screenAttributes.minFr = r.screen.frameRate.min, e.screenAttributes.maxFr = r.screen.frameRate.max, n(), !0) : (n("NO_SCREEN_PROFILE_".concat(JSON.stringify(t))), !1)
  9018. },
  9019. e.setVideoProfileCustom = function(t) {
  9020. var n = p.report.reportApiInvoke(e.sid, {
  9021. name: "Stream.setVideoProfileCustom",
  9022. options: arguments,
  9023. tag: "tracer"
  9024. });
  9025. e.setVideoResolution(t[0]),
  9026. e.setVideoFrameRate([t[1], t[1]]),
  9027. e.setVideoBitRate([t[2], t[2]]),
  9028. n()
  9029. },
  9030. e.setVideoProfileCustomPlus = function(n) {
  9031. var r = p.report.reportApiInvoke(e.sid, {
  9032. name: "Stream.setVideoProfileCustom",
  9033. options: arguments,
  9034. tag: "tracer"
  9035. });
  9036. e.setVideoResolution([n.width, n.height]),
  9037. t.attributes.resolution = "".concat(n.width, "x").concat(n.height),
  9038. e.setVideoFrameRate([n.framerate, n.framerate]),
  9039. e.setVideoBitRate([n.bitrate, n.bitrate]),
  9040. r()
  9041. },
  9042. e.setVideoProfile = function(n) {
  9043. var r = p.report.reportApiInvoke(e.sid, {
  9044. name: "Stream.setVideoProfile",
  9045. options: arguments,
  9046. tag: "tracer"
  9047. }),
  9048. a = I(n);
  9049. if (!a) {
  9050. var s = "Invalid Profile ".concat(n);
  9051. throw new Error(s)
  9052. }
  9053. if (e.profile = n, a && a.video) {
  9054. e.profile = a.profileName,
  9055. e.videoConstraint = i()(e.videoConstraint, a.video),
  9056. e.connectionSpec && a.attributes.maxVideoBW && (e.connectionSpec.minVideoBW = a.attributes.minVideoBW, e.connectionSpec.maxVideoBW = a.attributes.maxVideoBW),
  9057. Object(o.isEdge)() && (e.videoConstraint.frameRate.max = 60),
  9058. Object(o.isFireFox)() && (e.videoConstraint.frameRate = 30),
  9059. t.attributes = i()(t.attributes, a.attributes),
  9060. e.pc && e.pc.renegotiate && e.pc.renegotiate();
  9061. var d = e.stream && e.stream.getVideoTracks && e.stream.getVideoTracks()[0];
  9062. return d && d.applyConstraints ? (c.
  9063. default.debug("setVideoProfile applyConstraints", e.videoConstraint), y.a.disableVideoEffect(e).then((function() {
  9064. return d.applyConstraints(e.videoConstraint)
  9065. })).then((function() {
  9066. return y.a.restoreVideoEffect(e)
  9067. })).then((function(t) {
  9068. return new Promise((function(n, i) {
  9069. r(t),
  9070. setTimeout((function() {
  9071. Object(h.vsResHack)(e.stream, (function(t, r) {
  9072. e.videoWidth = t,
  9073. e.videoHeight = r,
  9074. n()
  9075. }), (function(t) {
  9076. c.
  9077. default.warning("[".concat(e.streamId, "] vsResHack failed: "), t),
  9078. i()
  9079. }))
  9080. }), 2500)
  9081. }))
  9082. })).
  9083. catch(r)) : r(),
  9084. !0
  9085. }
  9086. return r("INVALID_VIDEO_PROFILE_".concat(n)),
  9087. !1
  9088. },
  9089. e.setAudioProfile = function(t) {
  9090. var n = p.report.reportApiInvoke(e.sid, {
  9091. name: "Stream.setAudioProfile",
  9092. options: arguments,
  9093. tag: "tracer"
  9094. });
  9095. Object(_.checkValidEnum)(t, "profile", ["speech_low_quality", "speech_standard", "music_standard", "standard_stereo", "high_quality", "high_quality_stereo"]),
  9096. e.audioProfile = t;
  9097. var r = b(t);
  9098. return e.highQuality = r.highQuality,
  9099. e.stereo = r.stereo,
  9100. e.speech = r.speech,
  9101. e.lowQuality = r.lowQuality,
  9102. e.stereo && Object(o.isChrome)() && (e.audioConstraint.googAutoGainControl = !1, e.audioConstraint.googAutoGainControl2 = !1, e.audioConstraint.echoCancellation = !1, e.audioConstraint.googNoiseSuppression = !1),
  9103. n(),
  9104. !0
  9105. },
  9106. e.setVideoEncoderConfiguration = function(t) {
  9107. Object(_.checkValidObject)(t, "config");
  9108. var n = p.report.reportApiInvoke(e.sid, {
  9109. name: "Stream.setVideoEncoderConfiguration",
  9110. options: t,
  9111. tag: "tracer"
  9112. });
  9113. t.resolution && (Object(_.checkValidNumber)(t.resolution.width, "config.resolution.width"), Object(_.checkValidNumber)(t.resolution.height, "config.resolution.height"), e.setVideoResolution([t.resolution.width, t.resolution.height])),
  9114. t.frameRate && (Object(_.checkValidNumber)(t.frameRate.min, "config.frameRate.min"), Object(_.checkValidNumber)(t.frameRate.max, "config.frameRate.max"), e.setVideoFrameRate([t.frameRate.min, t.frameRate.max])),
  9115. t.bitrate && (Object(_.checkValidNumber)(t.bitrate.min, "config.bitrate.min", 1, 1e7), Object(_.checkValidNumber)(t.bitrate.max, "config.bitrate.max", 1, 1e7), e.setVideoBitRate([t.bitrate.min, t.bitrate.max])),
  9116. n()
  9117. },
  9118. e.getSupportedProfile = function(t) {
  9119. var n = p.report.reportApiInvoke(e.sid, {
  9120. name: "Stream.getSupportedProfile",
  9121. options: arguments,
  9122. tag: "tracer",
  9123. callback: t
  9124. });
  9125. if (!e.local) {
  9126. var r = "ONLY_LOCAL_STREAM_SUPPORTED";
  9127. return c.
  9128. default.error(r),
  9129. n(r)
  9130. }
  9131. if (!e.stream) {
  9132. r = "STREAM_NOT_INIT";
  9133. return c.
  9134. default.error(r),
  9135. n(r)
  9136. }
  9137. if (!e.stream.getVideoTracks) {
  9138. r = "TRACK_NOT_SUPPORT";
  9139. return c.
  9140. default.error(r),
  9141. n(r)
  9142. }
  9143. var i = e.stream.getVideoTracks()[0];
  9144. if (!i) {
  9145. r = "NO_VIDEO_TRACK_FOUND";
  9146. return c.
  9147. default.error(r),
  9148. n(r)
  9149. }
  9150. if (!i.getCapabilities) {
  9151. r = "GETCAPABILITY_NOT_SUPPORT";
  9152. return c.
  9153. default.error(r),
  9154. n(r)
  9155. }
  9156. var o = i.getCapabilities(),
  9157. a = A(o);
  9158. return n(null, a)
  9159. }
  9160. } (t, e),
  9161. t.getId = function() {
  9162. return t.streamId
  9163. },
  9164. t.getUserId = function() {
  9165. return t.userId
  9166. },
  9167. t.checkDualStreamEnabled = function() {
  9168. if (Object(l.getParameter)("DUALSTREAM_OPERATION_CHECK") && t.isDualStream) {
  9169. return c.
  9170. default.error("Operation not permitted: ".concat("DUAL_STREAM_ENABLED")),
  9171. "DUAL_STREAM_ENABLED"
  9172. }
  9173. return ! 1
  9174. },
  9175. t.setUserId = function(e) {
  9176. var n = p.report.reportApiInvoke(t.sid, {
  9177. name: "Stream.setUserId",
  9178. options: arguments,
  9179. tag: "tracer"
  9180. });
  9181. t.userId && c.
  9182. default.warning("[".concat(t.streamId, "] Stream.userId ").concat(t.userId, " => ").concat(e)),
  9183. t.userId = e,
  9184. n()
  9185. },
  9186. t.getAttributes = function() {
  9187. return e.screen ? t.screenAttributes: e.attributes
  9188. },
  9189. t.hasAudio = function() {
  9190. return !! t.audio
  9191. },
  9192. t.hasVideo = function() {
  9193. return !! t.video
  9194. },
  9195. t.hasScreen = function() {
  9196. return !! t.screen
  9197. },
  9198. t.hasScreenAudio = function() {
  9199. return !! t.screenAudio
  9200. },
  9201. t.isVideoOn = function() {
  9202. return (t.hasVideo() || t.hasScreen()) && !t.userMuteVideo
  9203. },
  9204. t.isAudioOn = function() {
  9205. return t.hasAudio() && !t.userMuteAudio
  9206. },
  9207. t.init = function(r, i) {
  9208. var o = p.report.reportApiInvoke(t.sid, {
  9209. callback: function(e, t) {
  9210. if (e) return i && i(e);
  9211. r && r(t)
  9212. },
  9213. name: "Stream.init",
  9214. options: arguments,
  9215. tag: "tracer"
  9216. }),
  9217. a = ((new Date).getTime(), arguments[2]);
  9218. if (void 0 === a && (a = 2), !0 === t.initialized) return o({
  9219. type: "warning",
  9220. msg: "STREAM_ALREADY_INITIALIZED"
  9221. });
  9222. if (!0 !== t.local) return o({
  9223. type: "warning",
  9224. msg: "STREAM_NOT_LOCAL"
  9225. });
  9226. var s = Math.random().toString().slice(3);
  9227. t._streamInitID = s,
  9228. t.videoSource ? t.videoName = "videoSource": t.video && (t.videoName = E.a.searchDeviceNameById(e.cameraId) || "default"),
  9229. t.audioSource ? t.audioName = "audioSource": t.audio && (t.audioName = E.a.searchDeviceNameById(e.microphoneId) || "default"),
  9230. t.screen && (t.screenName = e.extensionId || "default");
  9231. try {
  9232. if (e.audio || e.video || e.screen || e.screenAudio || e.videoSource || e.audioSource) {
  9233. c.
  9234. default.debug("[".concat(t.streamId, "] Requested access to local media"));
  9235. var d = {
  9236. streamId: t.streamId
  9237. };
  9238. e.videoSource ? d.videoSource = e.videoSource: e.screen ? d.screen = t.screenConstraint: e.video && (d.video = t.videoConstraint),
  9239. e.audioSource ? d.audioSource = e.audioSource: e.screenAudio ? d.screenAudio = e.screenAudio: e.audio && (d.audio = t.audioConstraint),
  9240. Object(m.b)(d, (function(r) {
  9241. if (d.screenAudio && !r.getAudioTracks()[0] && c.
  9242. default.warning("[".concat(t.streamId, "] Audio sharing is not selected")), d.screen && c.
  9243. default.debug("[".concat(t.streamId, "] User has granted access to screen sharing")), (d.video || d.audio) && c.
  9244. default.debug("[".concat(t.streamId, "] User has granted access to local media")), null === t._streamInitID) {
  9245. r.getTracks().forEach((function(e) {
  9246. e.stop()
  9247. }));
  9248. var i = {
  9249. type: "error",
  9250. msg: "STREAM_IS_CLOSED",
  9251. info: "stream is closed and cannot be initialized"
  9252. };
  9253. return c.
  9254. default.error(t.streamId, i.info),
  9255. void o(i)
  9256. }
  9257. if (t._streamInitID !== s) {
  9258. r.getTracks().forEach((function(e) {
  9259. e.stop()
  9260. }));
  9261. i = {
  9262. type: "error",
  9263. msg: "ABORT_OTHER_INIT",
  9264. info: "stream initialization is aborted because of another stream.init"
  9265. };
  9266. return c.
  9267. default.error(t.streamId, i.info),
  9268. void o(i)
  9269. }
  9270. t.dispatchEvent({
  9271. type: "accessAllowed"
  9272. }),
  9273. t.stream = r,
  9274. t.initialized = !0,
  9275. t.reloadDeviceName(),
  9276. t.hasVideo() && Object(h.vsResHack)(r, (function(e, n) {
  9277. t.videoWidth = e,
  9278. t.videoHeight = n
  9279. }), (function(e) {
  9280. c.
  9281. default.warning("[".concat(t.streamId, "] vsResHack failed: "), e)
  9282. })),
  9283. e.screen && t.stream && t.stream.getVideoTracks()[0] && (t.stream.getVideoTracks()[0].onended = function() {
  9284. t.dispatchEvent({
  9285. type: "stopScreenSharing"
  9286. })
  9287. }),
  9288. t.stream && t.stream.getTracks && t.stream.getTracks().forEach((function(r) {
  9289. r && !r.onended && (r.onended = n),
  9290. "video" === r.kind && e.optimizationMode && (r.contentHint = e.optimizationMode, r.contentHint === e.optimizationMode && c.
  9291. default.debug("[".concat(t.streamId, "] set content hint to"), e.optimizationMode))
  9292. })),
  9293. o()
  9294. }), (function(e) {
  9295. var n = {
  9296. type: "error",
  9297. info: null
  9298. };
  9299. switch (e && (n.msg = e.name || e.code || e, e.message && (n.info = e.message), e.code && (n.info ? n.info += ". " + e.code: n.info = " " + e.code), e.constraint && (n.info ? n.info += ". Constraint: " + e.constraint: n.info = "constraint: " + e.constraint)), n.msg) {
  9300. case "Starting video failed":
  9301. case "TrackStartError":
  9302. if (t.videoConstraint && (delete t.videoConstraint.width, delete t.videoConstraint.height), a > 0) return void setTimeout((function() {
  9303. t.init((function(e) {
  9304. return o(e)
  9305. }), o, a - 1)
  9306. }), 1);
  9307. n.msg = "MEDIA_OPTION_INVALID";
  9308. break;
  9309. case "DevicesNotFoundError":
  9310. n.msg = "DEVICES_NOT_FOUND";
  9311. break;
  9312. case "NotSupportedError":
  9313. n.msg = "NOT_SUPPORTED";
  9314. break;
  9315. case "PermissionDeniedError":
  9316. case "InvalidStateError":
  9317. n.msg = "PERMISSION_DENIED",
  9318. t.dispatchEvent({
  9319. type: "accessDenied"
  9320. });
  9321. break;
  9322. case "PERMISSION_DENIED":
  9323. case "NotAllowedError":
  9324. t.dispatchEvent({
  9325. type:
  9326. "accessDenied"
  9327. });
  9328. break;
  9329. case "ConstraintNotSatisfiedError":
  9330. n.msg = "CONSTRAINT_NOT_SATISFIED";
  9331. break;
  9332. default:
  9333. n.msg || (n.msg = "UNDEFINED")
  9334. }
  9335. var r = "Media access ".concat(n.msg).concat(n.info ? ": " + n.info: "");
  9336. c.
  9337. default.error("[".concat(t.streamId, "] "), r),
  9338. o(n)
  9339. }))
  9340. } else o({
  9341. type: "warning",
  9342. msg: "STREAM_HAS_NO_MEDIA_ATTRIBUTES"
  9343. })
  9344. } catch(e) {
  9345. c.
  9346. default.error("[".concat(t.streamId, "] Stream init: "), e),
  9347. o({
  9348. type: "error",
  9349. msg: e.message || e
  9350. })
  9351. }
  9352. },
  9353. t.reloadDeviceName = function() {
  9354. if (t.stream) {
  9355. if (t.stream.getVideoTracks) {
  9356. var e = t.stream.getVideoTracks()[0];
  9357. e && e.label && (t.videoName = e.label)
  9358. }
  9359. if (t.stream.getAudioTracks) {
  9360. var n = t.stream.getAudioTracks()[0];
  9361. n && n.label && (t.audioName = n.label)
  9362. }
  9363. }
  9364. },
  9365. t.close = function() {
  9366. var e = p.report.reportApiInvoke(null, {
  9367. name: "Stream.close",
  9368. options: arguments,
  9369. tag: "tracer"
  9370. });
  9371. if (c.
  9372. default.debug("[".concat(t.streamId, "] Close stream with id"), t.streamId), t._originStream) try {
  9373. t._originStream.getTracks().map((function(e) {
  9374. return e.stop()
  9375. }))
  9376. } catch(e) {}
  9377. if (void 0 !== t.stream) {
  9378. var n = t.stream.getTracks();
  9379. for (var r in n) n.hasOwnProperty(r) && (n[r].stop(), n[r].onended = null); ! t.isLowStream && t.local ? y.a.disableVideoEffect(t).then((function() {
  9380. t.stream = void 0
  9381. })) : (t.stream && t.stream.clean && t.stream.clean(), t.stream = void 0)
  9382. }
  9383. if (t._originStream) {
  9384. console.log("clear _originStream");
  9385. n = t._originStream.getTracks();
  9386. for (var r in n) n.hasOwnProperty(r) && (n[r].stop(), n[r].onended = null, console.log("clear onended")); ! t.isLowStream && t.local ? y.a.disableVideoEffect(t).then((function() {
  9387. t._originStream = void 0
  9388. })) : (t._originStream && t._originStream.clean && t._originStream.clean(), t._originStream = void 0)
  9389. }
  9390. if (Object(o.isSafari)() && t.pc && t.pc.peerConnection && t.pc.peerConnection.removeTrack && t.pc.peerConnection.getSenders) {
  9391. var i = t.pc.peerConnection.getSenders();
  9392. i.forEach((function(e) {
  9393. e && (c.
  9394. default.debug("[".concat(t.streamId, "] Remove Track"), e), t.pc.peerConnection.removeTrack(e))
  9395. }))
  9396. }
  9397. t.local && (t.initialized = !1),
  9398. t._streamInitID = null,
  9399. t._onAudioMute = void 0,
  9400. t._onAudioUnmute = void 0,
  9401. t._onVideoMute = void 0,
  9402. t._onVideoUnmute = void 0,
  9403. t.lowStream && t.lowStream.close(),
  9404. e()
  9405. },
  9406. t.enableAudio = function() {
  9407. var e, n = p.report.reportApiInvoke(t.sid, {
  9408. name: "Stream.enableAudio",
  9409. options: arguments,
  9410. tag: "tracer"
  9411. });
  9412. return c.
  9413. default.deprecate("[".concat(t.streamId, "] Stream.enableAudio is deprecated and will be removed in the future. Use Stream.unmuteAudio instead")),
  9414. t.userMuteAudio || c.
  9415. default.warning("[".concat(t.streamId, "] User already enableAudio")),
  9416. t.userMuteAudio = !1,
  9417. n(null, e = !t.peerMuteAudio && t._unmuteAudio()),
  9418. e
  9419. },
  9420. t.disableAudio = function() {
  9421. var e = p.report.reportApiInvoke(t.sid, {
  9422. name: "Stream.disableAudio",
  9423. options: arguments,
  9424. tag: "tracer"
  9425. });
  9426. c.
  9427. default.deprecate("[".concat(t.streamId, "] Stream.disableAudio is deprecated and will be removed in the future. Use Stream.muteAudio instead")),
  9428. t.userMuteAudio && c.
  9429. default.warning("[".concat(t.streamId, "] User already disableAudio")),
  9430. t.userMuteAudio = !0;
  9431. var n = t._muteAudio();
  9432. return e(null, n),
  9433. n
  9434. },
  9435. t.enableVideo = function() {
  9436. var e, n = p.report.reportApiInvoke(t.sid, {
  9437. name: "Stream.enableVideo",
  9438. options: arguments,
  9439. tag: "tracer"
  9440. });
  9441. return c.
  9442. default.deprecate("[".concat(t.streamId, "] Stream.enableVideo is deprecated and will be removed in the future. Use Stream.unmuteVideo instead")),
  9443. t.userMuteVideo || c.
  9444. default.warning("[".concat(t.streamId, "] User already enableVideo")),
  9445. t.userMuteVideo = !1,
  9446. t.lowStream && (t.lowStream.userMuteVideo = !1),
  9447. n(null, e = !t.peerMuteVideo && t._unmuteVideo()),
  9448. e
  9449. },
  9450. t.disableVideo = function() {
  9451. var e = p.report.reportApiInvoke(t.sid, {
  9452. name: "Stream.disableVideo",
  9453. options: arguments,
  9454. tag: "tracer"
  9455. });
  9456. c.
  9457. default.deprecate("[".concat(t.streamId, "] Stream.disableVideo is deprecated and will be removed in the future. Use Stream.muteVideo instead")),
  9458. t.userMuteVideo && c.
  9459. default.warning("[".concat(t.streamId, "] User already disableVideo")),
  9460. t.userMuteVideo = !0,
  9461. t.lowStream && (t.lowStream.userMuteVideo = !0);
  9462. var n = t._muteVideo();
  9463. return e(null, n),
  9464. n
  9465. },
  9466. t.unmuteAudio = function() {
  9467. var e, n = p.report.reportApiInvoke(t.sid, {
  9468. name: "Stream.unmuteAudio",
  9469. options: arguments,
  9470. tag: "tracer"
  9471. });
  9472. return t.userMuteAudio || c.
  9473. default.warning("[".concat(t.streamId, "] User already unmuteAudio")),
  9474. t.userMuteAudio = !1,
  9475. n(null, e = !t.peerMuteAudio && t._unmuteAudio()),
  9476. e
  9477. },
  9478. t.muteAudio = function() {
  9479. var e = p.report.reportApiInvoke(t.sid, {
  9480. name: "Stream.muteAudio",
  9481. options: arguments,
  9482. tag: "tracer"
  9483. });
  9484. t.userMuteAudio && c.
  9485. default.warning("[".concat(t.streamId, "] User already muteAudio")),
  9486. t.userMuteAudio = !0;
  9487. var n = t._muteAudio();
  9488. return e(null, n),
  9489. n
  9490. },
  9491. t.unmuteVideo = function() {
  9492. var e, n = p.report.reportApiInvoke(t.sid, {
  9493. name: "Stream.unmuteVideo",
  9494. options: arguments,
  9495. tag: "tracer"
  9496. });
  9497. return t.userMuteVideo || c.
  9498. default.warning("[".concat(t.streamId, "] User already unmuteVideo")),
  9499. t.userMuteVideo = !1,
  9500. t.lowStream && (t.lowStream.userMuteVideo = !1),
  9501. n(null, e = !t.peerMuteVideo && t._unmuteVideo()),
  9502. e
  9503. },
  9504. t.muteVideo = function() {
  9505. var e = p.report.reportApiInvoke(t.sid, {
  9506. name: "Stream.muteVideo",
  9507. options: arguments,
  9508. tag: "tracer"
  9509. });
  9510. t.userMuteVideo && c.
  9511. default.warning("[".concat(t.streamId, "] User already muteVideo")),
  9512. t.userMuteVideo = !0,
  9513. t.lowStream && (t.lowStream.userMuteVideo = !0);
  9514. var n = t._muteVideo();
  9515. return e(null, n),
  9516. n
  9517. },
  9518. t._unmuteAudio = function() {
  9519. return c.
  9520. default.debug("[".concat(t.streamId, "] Unmuted audio stream with id "), t.streamId),
  9521. t._flushAudioMixingMuteStatus(!1),
  9522. !(!t.hasAudio() || !t.initialized || void 0 === t.stream || !0 === t.stream.getAudioTracks()[0].enabled) && (t._onAudioUnmute && t._onAudioUnmute(), t.pc && (t.pc.isAudioMute = !1), t.stream.getAudioTracks()[0].enabled = !0, !0)
  9523. },
  9524. t._isAudioMuted = function() {
  9525. if (t.stream && t.hasAudio()) {
  9526. var e = t.stream.getAudioTracks();
  9527. return e.length > 0 && !e[0].enabled
  9528. }
  9529. return ! 1
  9530. },
  9531. t._isVideoMuted = function() {
  9532. if (t.stream && t.hasVideo()) {
  9533. var e = t.stream.getVideoTracks();
  9534. return e.length > 0 && !e[0].enabled
  9535. }
  9536. return ! 1
  9537. },
  9538. t._muteAudio = function() {
  9539. return c.
  9540. default.debug("[".concat(t.streamId, "] Muted audio stream with id "), t.streamId),
  9541. t._flushAudioMixingMuteStatus(!0),
  9542. !!(t.hasAudio() && t.initialized && void 0 !== t.stream && t.stream.getAudioTracks()[0].enabled) && (t._onAudioMute && t._onAudioMute(), t.pc && (t.pc.isAudioMute = !0), t.stream.getAudioTracks()[0].enabled = !1, t.sid && p.report.audioSendingStopped(t.sid, {
  9543. succ: !0,
  9544. reason: "muteAudio"
  9545. }), !0)
  9546. },
  9547. t._unmuteVideo = function() {
  9548. return c.
  9549. default.debug("[".concat(t.streamId, "] Unmuted video stream with id"), t.streamId),
  9550. !(!t.initialized || void 0 === t.stream || !t.stream.getVideoTracks().length || !0 === t.stream.getVideoTracks()[0].enabled) && (t._onVideoUnmute && t._onVideoUnmute(), t.pc && (t.pc.isVideoMute = !1), t.stream.getVideoTracks()[0].enabled = !0, t.lowStream && t.lowStream._unmuteVideo(), !0)
  9551. },
  9552. t._muteVideo = function() {
  9553. return c.
  9554. default.debug("[".concat(t.streamId, "] Muted video stream with id"), t.streamId),
  9555. !!(t.initialized && void 0 !== t.stream && t.stream.getVideoTracks().length && t.stream.getVideoTracks()[0].enabled) && (t._onVideoMute && t._onVideoMute(), t.pc && (t.pc.isVideoMute = !0), t.stream.getVideoTracks()[0].enabled = !1, t.lowStream && t.lowStream._muteVideo(), t.sid && p.report.videoSendingStopped(t.sid, {
  9556. succ: !0,
  9557. reason: "muteVideo"
  9558. }), !0)
  9559. },
  9560. t.addTrack = function(r) {
  9561. var i = p.report.reportApiInvoke(t.sid, {
  9562. name: "Stream.addTrack",
  9563. options: arguments,
  9564. tag: "tracer"
  9565. });
  9566. if (t.pc && t.pc.addTrack(r, t.stream), "audio" == r.kind) {
  9567. t._cleanupAudioMixing();
  9568. var o = new MediaStream;
  9569. t.userMuteAudio && (r.enabled = !1),
  9570. o.addTrack(r);
  9571. var a = t.stream.getVideoTracks()[0];
  9572. a && o.addTrack(a),
  9573. t.audio = !0,
  9574. e.audio = !0,
  9575. t.stream = o,
  9576. t.audioLevelHelper = null,
  9577. t.player && t.player.video && (t.player.video.srcObject = t.stream)
  9578. } else t.userMuteVideo && (r.enabled = !1),
  9579. t.stream.addTrack(r),
  9580. t.video = !0,
  9581. e.video = !0;
  9582. r.onended || (r.onended = n),
  9583. i()
  9584. },
  9585. t.removeTrack = function(n) {
  9586. var r = p.report.reportApiInvoke(t.sid, {
  9587. name: "Stream.removeTrack",
  9588. options: arguments,
  9589. tag: "tracer"
  9590. });
  9591. t.pc && t.pc.removeTrack(n, t.stream),
  9592. t.stream.removeTrack(n),
  9593. t._cleanupAudioMixing(),
  9594. "audio" === n.kind ? (t.audio = !1, e.audio = !1) : (t.video = !1, e.video = !1),
  9595. t.audioLevelHelper = null,
  9596. "live" == n.readyState && (n.stop(), c.
  9597. default.debug("[".concat(t.streamId, "] Track ").concat(n.kind, " Stopped"))),
  9598. r()
  9599. },
  9600. t.setAudioOutput = function(e, n, r) {
  9601. var i = p.report.reportApiInvoke(t.sid, {
  9602. callback: function(e, t) {
  9603. if (e) return r && r(e);
  9604. n && n(t)
  9605. },
  9606. name: "Stream.setAudioOutput",
  9607. options: arguments,
  9608. tag: "tracer"
  9609. });
  9610. return Object(_.isValidString)(e, 1, 255) ? (t.audioOutput = e, t.player ? void t.player.setAudioOutput(e, (function() {
  9611. return i()
  9612. }), i) : i()) : (c.
  9613. default.error("[".concat(t.streamId, "] setAudioOutput Invalid Parameter"), e), i(u.
  9614. default.INVALID_PARAMETER))
  9615. },
  9616. t.play = function(e, n, r) {
  9617. "function" == typeof n && (r = n, n = null),
  9618. c.
  9619. default.debug("[".concat(t.streamId, "] play()."), e, n);
  9620. var i = p.report.reportApiInvoke(t.sid, {
  9621. name: "Stream.play",
  9622. options: arguments,
  9623. tag: "tracer",
  9624. callback: r
  9625. });
  9626. if (Object(_.checkValidString)(e, "elementID"), Object(_.isEmpty)(n) || (Object(_.isEmpty)(n.fit) || Object(_.checkValidEnum)(n.fit, "fit", ["cover", "contain"]), Object(_.isEmpty)(n.muted) || Object(_.checkValidBoolean)(n.muted, "muted")), t.player) c.
  9627. default.warning("[".concat(t.streamId, "] Stream.play(): Stream is already playing. Fallback to resume stream")),
  9628. t.resume().then((function() {
  9629. i(null)
  9630. })).
  9631. catch(i);
  9632. else {
  9633. t.elementID = e,
  9634. t.playOptions = n,
  9635. !t.local || t.video || t.screen ? (t.player = new g({
  9636. id: t.getId(),
  9637. stream: t,
  9638. elementID: e,
  9639. options: n
  9640. }), t.local && y.a.applyEffectInPlayer(t)) : t.hasAudio() && (t.player = new g({
  9641. id: t.getId(),
  9642. stream: t,
  9643. elementID: e,
  9644. options: n
  9645. }));
  9646. var o = {
  9647. video: null,
  9648. audio: null
  9649. },
  9650. a = function e(n) {
  9651. if (o[n.mediaType] = n, o.video && o.audio) if (t.removeEventListener("player-status-change", e), o.video.isErrorState || o.audio.isErrorState) {
  9652. var r = o.video.isErrorState ? o.video: o.audio;
  9653. i({
  9654. isErrorState: !0,
  9655. status: r.status,
  9656. reason: r.reason,
  9657. video: o.video,
  9658. audio: o.audio
  9659. })
  9660. } else "aborted" === o.video.status && "aborted" === o.audio.status ? i({
  9661. status: "aborted",
  9662. reason: "stop",
  9663. video: o.video,
  9664. audio: o.audio
  9665. }) : i(null)
  9666. };
  9667. t.on("player-status-change", a),
  9668. t.audioOutput && t.player.setAudioOutput(t.audioOutput),
  9669. void 0 !== t.audioLevel && t.player.setAudioVolume(t.audioLevel),
  9670. t._flushAudioMixingMuteStatus(!1)
  9671. }
  9672. },
  9673. t.stop = function() {
  9674. var e = p.report.reportApiInvoke(t.sid, {
  9675. name: "Stream.stop",
  9676. options: arguments,
  9677. tag: "tracer"
  9678. });
  9679. c.
  9680. default.debug("[".concat(t.streamId, "] Stop stream player with id "), t.streamId),
  9681. t.player ? (y.a.removeEffectFromLocalPlayer(t), t.player.destroy(), delete t.player) : c.
  9682. default.error("[".concat(t.streamId, "] Stream.stop(): Stream is not playing")),
  9683. t._flushAudioMixingMuteStatus(!0),
  9684. e()
  9685. },
  9686. t.isPlaying = function() {
  9687. return !! t.player
  9688. },
  9689. t.isPaused = function() {
  9690. return !! t.player && ( !! (t.player.video && t.player.video.paused && t.player.mediaElemExists(t.player.video)) || !!(t.player.audio && t.player.audio.paused && t.player.mediaElemExists(t.player.audio)))
  9691. },
  9692. t.resume = function() {
  9693. var e, n;
  9694. return t.player ? (t.player.video && t.player.video.play && (e = t.player.video.play()), e = e || Promise.resolve(), t.player.audio && t.player.audio.play && (n = t.player.audio.play()), n = n || Promise.resolve(), Promise.all([e, n])) : Promise.reject("NO_PLAYER_FOUND")
  9695. },
  9696. t.getVideoTrack = function() {
  9697. var e = p.report.reportApiInvoke(t.sid, {
  9698. name: "Stream.getVideoTrack",
  9699. options: arguments,
  9700. tag: "tracer"
  9701. });
  9702. if (t.stream && t.stream.getVideoTracks) {
  9703. var n = t.stream.getVideoTracks()[0];
  9704. if (n) return c.
  9705. default.info("[".concat(t.streamId, "] getVideoTrack"), n),
  9706. e(),
  9707. n
  9708. }
  9709. c.
  9710. default.info("[".concat(t.streamId, "] getVideoTrack None")),
  9711. e(null, "getVideoTrack None")
  9712. },
  9713. t.getAudioTrack = function() {
  9714. var e = p.report.reportApiInvoke(t.sid, {
  9715. name: "Stream.getAudioTrack",
  9716. options: arguments,
  9717. tag: "tracer"
  9718. });
  9719. if (t.stream && t.stream.getAudioTracks) {
  9720. var n = t.stream.getAudioTracks()[0];
  9721. if (n) return c.
  9722. default.info("[".concat(t.streamId, "] getAudioTracks"), n),
  9723. e(),
  9724. n
  9725. }
  9726. c.
  9727. default.info("[".concat(t.streamId, "] getAudioTracks None")),
  9728. e(null, "getAudioTracks None")
  9729. },
  9730. t._hasVideoTracks = function() {
  9731. return !! (t.stream && t.stream.getVideoTracks && t.stream.getVideoTracks()[0])
  9732. },
  9733. t._hasAudioTracks = function() {
  9734. return !! (t.stream && t.stream.getAudioTracks && t.stream.getAudioTracks()[0])
  9735. },
  9736. t._replaceMediaStreamTrack = function(e, n, r) {
  9737. if (t.stream) {
  9738. if ("video" == e.kind) {
  9739. if (o = t.stream.getVideoTracks()[0]) return t.userMuteVideo && (e.enabled = !1),
  9740. t.stream.removeTrack(o),
  9741. t.stream.addTrack(e),
  9742. c.
  9743. default.debug("[".concat(t.streamId, "] _replaceMediaStreamTrack ").concat(e.kind, " SUCCESS")),
  9744. "live" == o.readyState && (o.stop(), c.
  9745. default.debug("[".concat(t.streamId, "] Track ").concat(o.kind, " Stopped"))),
  9746. n && n();
  9747. var i = "MEDIASTREAM_TRACK_NOT_FOUND";
  9748. return c.
  9749. default.error("[".concat(t.streamId, "] MEDIASTREAM_TRACK_NOT_FOUND ").concat(e.kind)),
  9750. r(i)
  9751. }
  9752. if ("audio" == e.kind) {
  9753. var o;
  9754. if (o = t.stream.getAudioTracks()[0]) {
  9755. t.userMuteAudio && (e.enabled = !1);
  9756. var a = new MediaStream;
  9757. a.addTrack(e);
  9758. var s = t.stream && t.stream.getVideoTracks()[0];
  9759. return s && a.addTrack(s),
  9760. t.stream = a,
  9761. t.audioLevelHelper = null,
  9762. t.player && t.player.video && (t.player.video.srcObject = t.stream),
  9763. c.
  9764. default.debug("[".concat(t.streamId, "] _replaceMediaStreamTrack SUCCESS")),
  9765. "live" == o.readyState && (o.stop(), c.
  9766. default.debug("[".concat(t.streamId, "] Track ").concat(o.kind, " Stopped"))),
  9767. n && n()
  9768. }
  9769. i = "MEDIASTREAM_TRACK_NOT_FOUND";
  9770. return c.
  9771. default.error("[".concat(t.streamId, "] MEDIASTREAM_TRACK_NOT_FOUND ").concat(e.kind)),
  9772. r(i)
  9773. }
  9774. i = "INVALID_TRACK_TYPE";
  9775. return c.
  9776. default.error("[".concat(t.streamId, "] _replaceMediaStreamTrack ").concat(i, " ").concat(e.kind)),
  9777. r && r(i)
  9778. }
  9779. i = "NO_STREAM_FOUND";
  9780. return c.
  9781. default.error("[".concat(t.streamId, "] _replaceMediaStreamTrack ").concat(i)),
  9782. r && r(i)
  9783. },
  9784. t.replaceTrack = function(e, r, i) {
  9785. var o = p.report.reportApiInvoke(t.sid, {
  9786. callback: function(e, t) {
  9787. if (e) return i && i(e);
  9788. r && r(t)
  9789. },
  9790. name: "Stream.replaceTrack",
  9791. options: arguments,
  9792. tag: "tracer"
  9793. });
  9794. return e && e.kind ? (t._cleanupAudioMixing(), e.onended || (e.onended = n), t.pc && t.pc.hasSender && t.pc.hasSender(e.kind) ? void t.pc.replaceTrack(e, (function() {
  9795. return c.
  9796. default.debug("[".concat(t.streamId, "] PeerConnection.replaceTrack ").concat(e.kind, " SUCCESS")),
  9797. t._replaceMediaStreamTrack(e, (function(e) {
  9798. return o(null, e)
  9799. }), o)
  9800. }), (function(n) {
  9801. return c.
  9802. default.error("[".concat(t.streamId, "] PeerConnection.replaceTrack ").concat(e.kind, " Failed ").concat(n)),
  9803. o(n)
  9804. })) : t._replaceMediaStreamTrack(e, (function(e) {
  9805. return o(null, e)
  9806. }), o)) : o("INVALID_TRACK")
  9807. },
  9808. t.setAudioVolume = function(e) {
  9809. var n = p.report.reportApiInvoke(t.sid, {
  9810. name: "Stream.setAudioVolume",
  9811. options: arguments,
  9812. tag: "tracer"
  9813. });
  9814. Object(_.checkValidNumber)(e, "level", 0, 100),
  9815. t.audioLevel = e,
  9816. t.player && t.player.setAudioVolume(e),
  9817. n()
  9818. },
  9819. t.getStats = function(e, n, r) {
  9820. var a = [];
  9821. a.push(t._getPCStats(r)),
  9822. a.push(new Promise((function(e) {
  9823. var n = {};
  9824. t.pc && t.pc.isSubscriber ? null !== window.navigator.userAgent.match("Firefox") && (Object(v.b)(n, "videoReceiveResolutionHeight", t.videoHeight), Object(v.b)(n, "videoReceiveResolutionWidth", t.videoWidth)) : t.pc && !t.pc.isSubscriber && ((Object(o.isSafari)() || Object(o.isFireFox)()) && (Object(v.b)(n, "videoSendResolutionHeight", t.videoHeight), Object(v.b)(n, "videoSendResolutionWidth", t.videoWidth)), (Object(o.isSafari)() || Object(o.isFireFox)()) && t.uplinkStats && Object(v.b)(n, "videoSendPacketsLost", t.uplinkStats.uplink_cumulative_lost)),
  9825. e(n)
  9826. }))),
  9827. a.push(new Promise((function(e) {
  9828. var n = {};
  9829. return t.traffic_stats && t.pc && t.pc.isSubscriber ? (Object(v.b)(n, "accessDelay", t.traffic_stats.access_delay), Object(v.b)(n, "endToEndDelay", t.traffic_stats.e2e_delay), Object(v.b)(n, "videoReceiveDelay", t.traffic_stats.video_delay), Object(v.b)(n, "audioReceiveDelay", t.traffic_stats.audio_delay)) : t.traffic_stats && t.pc && !t.pc.isSubscriber && Object(v.b)(n, "accessDelay", t.traffic_stats.access_delay),
  9830. e(n)
  9831. }))),
  9832. Promise.all(a).then((function(n) {
  9833. for (var r = {},
  9834. o = n.length - 1; o >= 0; o--) {
  9835. var a = n[o];
  9836. i()(r, a)
  9837. }
  9838. e && setTimeout(e.bind(t, r), 0)
  9839. })).
  9840. catch((function(e) {
  9841. n && setTimeout(n.bind(t, e), 0)
  9842. }))
  9843. },
  9844. t._getPCStats = function(e) {
  9845. return new Promise((function(n, r) {
  9846. if (!t.pc || "established" !== t.pc.state || !t.pc.getStats) {
  9847. return r("PEER_CONNECTION_NOT_ESTABLISHED")
  9848. }
  9849. t.pc.getStats((function(e) {
  9850. if (!t.pc || "established" !== t.pc.state || !t.pc.getStats) {
  9851. return r("PEER_CONNECTION_STATE_CHANGE")
  9852. }
  9853. var i = t.pc.isSubscriber ? Object(v.c)(e) : Object(v.a)(e);
  9854. return n(i)
  9855. }), e)
  9856. })).then((function(e) {
  9857. return t.pc.isSubscriber ? (Object(o.isFireFox)() || Object(o.isSafari)()) && (e.videoReceiveResolutionHeight && "0" !== e.videoReceiveResolutionHeight || e.videoReceiveResolutionWidth && "0" !== e.videoReceiveResolutionWidth || (Object(v.b)(e, "videoReceiveResolutionHeight", t.videoHeight), Object(v.b)(e, "videoReceiveResolutionWidth", t.videoWidth))) : ((Object(o.isSafari)() || Object(o.isFireFox)()) && (e.videoSendResolutionHeight && "0" !== e.videoSendResolutionHeight || e.videoSendResolutionWidth && "0" !== e.videoSendResolutionWidth || (Object(v.b)(e, "videoSendResolutionHeight", t.videoHeight), Object(v.b)(e, "videoSendResolutionWidth", t.videoWidth))), (Object(o.isSafari)() || Object(o.isFireFox)()) && t.uplinkStats && Object(v.b)(e, "videoSendPacketsLost", t.uplinkStats.uplink_cumulative_lost)),
  9858. Promise.resolve(e)
  9859. }))
  9860. },
  9861. t.getAudioLevel = function() {
  9862. if (t.audioLevelHelper) return t.audioLevelHelper.getAudioLevel();
  9863. if (t.stream) {
  9864. if (0 !== t.stream.getAudioTracks().length) return t.audioLevelHelper = new h.audioLevelHelper(t.stream),
  9865. t.audioLevelHelper.getAudioLevel();
  9866. c.
  9867. default.warning("[".concat(t.streamId, "] can't get audioLevel beacuse no audio trace in stream"))
  9868. } else c.
  9869. default.warning("[".concat(t.streamId, "] can't get audioLevel beacuse no stream exist"))
  9870. },
  9871. t.setVideoProfile("480p_1"),
  9872. t._switchVideoDevice = function(e, n, r) {
  9873. if (e === t.cameraId) return n && n();
  9874. var a = {
  9875. video: i()({},
  9876. t.videoConstraint, {
  9877. deviceId: {
  9878. exact: e
  9879. }
  9880. }),
  9881. audio: !1
  9882. };
  9883. c.
  9884. default.debug("[".concat(t.streamId, "] ").concat(a)),
  9885. Object(m.b)(a, (function(i) {
  9886. try {
  9887. var a = function() {
  9888. t.isPlaying() && (t.stop(), t.elementID && t.play(t.elementID, t.playOptions)),
  9889. t.cameraId = e,
  9890. t.videoConstraint.deviceId = {
  9891. exact: e
  9892. },
  9893. t.userMuteVideo && (t.stream.getVideoTracks()[0].enabled = !1),
  9894. y.a.restoreVideoEffect(t).then((function() {
  9895. n && n()
  9896. }))
  9897. };
  9898. y.a.disableVideoEffect(t).then((function() {
  9899. Object(o.isSafari)() ? t.replaceTrack(i.getVideoTracks()[0], a, r) : (t.removeTrack(t.stream.getVideoTracks()[0]), t.addTrack(i.getVideoTracks()[0]), a())
  9900. }))
  9901. } catch(e) {
  9902. return r && r(e)
  9903. }
  9904. }), (function(e) {
  9905. return r && r(e)
  9906. }))
  9907. },
  9908. t._switchAudioDevice = function(e, n, r) {
  9909. if (e === t.microphoneId) return n && n();
  9910. var a = {
  9911. video: !1,
  9912. audio: i()({},
  9913. t.audioConstraint, {
  9914. deviceId: {
  9915. exact: e
  9916. }
  9917. })
  9918. };
  9919. c.
  9920. default.debug("[".concat(t.streamId, "] "), a),
  9921. Object(m.b)(a, (function(i) {
  9922. var a = function() {
  9923. t._cleanupAudioMixing(),
  9924. t.userMuteAudio && (t.stream.getAudioTracks()[0].enabled = !1),
  9925. t.isPlaying() && (t.stop(), t.elementID && t.play(t.elementID)),
  9926. t.microphoneId = e,
  9927. t.audioConstraint.deviceId = {
  9928. exact: e
  9929. },
  9930. n && n()
  9931. };
  9932. try {
  9933. Object(o.isSafari)() ? t.replaceTrack(i.getAudioTracks()[0], a, r) : (t.removeTrack(t.stream.getAudioTracks()[0]), t.addTrack(i.getAudioTracks()[0]), a())
  9934. } catch(e) {
  9935. return r && r(e)
  9936. }
  9937. }), (function(e) {
  9938. return r && r(e)
  9939. }))
  9940. },
  9941. t.switchDevice = function(e, n, r, i) {
  9942. var o = p.report.reportApiInvoke(t.sid, {
  9943. callback: function(e, t) {
  9944. if (e) return i && i(e);
  9945. r && r(t)
  9946. },
  9947. name: "Stream.switchDevice",
  9948. options: arguments,
  9949. tag: "tracer"
  9950. });
  9951. Object(_.checkValidString)(n, "deviceId");
  9952. var a = function() {
  9953. return t.inSwitchDevice = !1,
  9954. o()
  9955. },
  9956. s = function(e) {
  9957. t.inSwitchDevice = !1,
  9958. c.
  9959. default.error("[".concat(t.streamId, "] "), e),
  9960. o(e)
  9961. };
  9962. if (t.inSwitchDevice) return o("Device switch is in process.");
  9963. if (t.inSwitchDevice = !0, !t.local) return s("Only the local stream can switch the device.");
  9964. if (t.screen && "video" === e) return s("The device cannot be switched during screen-sharing.");
  9965. if (!t.video && "video" === e) return s("Video track not exist.");
  9966. if (!t.audio && "audio" === e) return s("Audio track not exist.");
  9967. if (t.videoSource || t.audioSource) return s("The device cannot be switched when using videoSource or audioSource.");
  9968. var d = !1;
  9969. for (var u in t.audioMixing.sounds) {
  9970. var l = t.audioMixing.sounds[u];
  9971. if (l.state !== t.audioMixing.states.IDLE) {
  9972. d = !0;
  9973. break
  9974. }
  9975. }
  9976. var f = t.audioMixing.audioContextInited;
  9977. if (f && d) return s("The device cannot be switched when using audio Mixing.");
  9978. E.a.getDeviceById(n, (function() {
  9979. if ("video" === e) t._switchVideoDevice(n, a, s);
  9980. else {
  9981. if ("audio" !== e) return s("Invalid type.");
  9982. t._switchAudioDevice(n, a, s)
  9983. }
  9984. }), (function() {
  9985. return s("The device does not exist.")
  9986. }))
  9987. },
  9988. t
  9989. },
  9990. C = function(e) {
  9991. var t = p.report.reportApiInvoke(null, {
  9992. name: "createStream",
  9993. options: arguments,
  9994. tag: "tracer",
  9995. getStates: function() {
  9996. return {
  9997. audioTrackEnable: e && e.audioSource ? e.audioSource.enabled: null,
  9998. videoTrackEnable: e && e.videoSource ? e.videoSource.enabled: null
  9999. }
  10000. }
  10001. });
  10002. Object(_.checkValidObject)(e, "StreamSpec");
  10003. var n = e.streamID,
  10004. r = e.audio,
  10005. i = e.video,
  10006. o = e.screen,
  10007. a = e.screenAudio,
  10008. s = (e.audioSource, e.videoSource, e.cameraId),
  10009. d = e.facingMode,
  10010. u = e.microphoneId,
  10011. l = e.mirror,
  10012. f = e.extensionId,
  10013. g = e.mediaSource,
  10014. m = e.audioProcessing,
  10015. v = e.optimizationMode;
  10016. if (!Object(_.isEmpty)(n) && !Object(h.is32Uint)(n) && !Object(_.isValidString)(n, 1, 255)) throw new Error("[String streamID] Length of the string: [1,255]. ASCII characters only. [Number streamID] The value range is Uint32");
  10017. if (Object(_.checkValidBoolean)(r, "audio"), Object(_.checkValidBoolean)(i, "video"), Object(_.isEmpty)(o) || Object(_.checkValidBoolean)(o, "screen"), Object(_.isEmpty)(a) || Object(_.checkValidBoolean)(a, "screenAudio"), Object(_.isEmpty)(s) || Object(_.checkValidString)(s, "cameraId", 0, 255, !1), Object(_.isEmpty)(d) || Object(_.checkValidEnum)(d, "facingMode", ["user", "environment", "left", "right"]), Object(_.isEmpty)(u) || Object(_.checkValidString)(u, "microphoneId", 0, 255, !1), Object(_.isEmpty)(f) || Object(_.checkValidString)(f, "extensionId"), Object(_.isEmpty)(g) || Object(_.checkValidEnum)(g, "mediaSource", ["screen", "application", "window"]), Object(_.isEmpty)(l) || Object(_.checkValidBoolean)(l, "mirror"), !Object(_.isEmpty)(m)) {
  10018. var E = m.AGC,
  10019. S = m.AEC,
  10020. y = m.ANS;
  10021. Object(_.isEmpty)(E) || Object(_.checkValidBoolean)(E, "AGC"),
  10022. Object(_.isEmpty)(S) || Object(_.checkValidBoolean)(S, "AEC"),
  10023. Object(_.isEmpty)(y) || Object(_.checkValidBoolean)(y, "ANS")
  10024. }
  10025. Object(_.isEmpty)(v) || Object(_.checkValidEnum)(v, "optimizationMode", ["detail", "motion"]),
  10026. c.
  10027. default.debug("Create stream"),
  10028. !0 === a && !0 === r && c.
  10029. default.warning("Do not set both 'screenAudio' and 'audio' to true at the same time"),
  10030. e.screen && !v && (e.optimizationMode = "detail");
  10031. var R = O(e);
  10032. return t(),
  10033. R
  10034. }
  10035. },
  10036. function(e, t, n) {
  10037. "use strict";
  10038. n.d(t, "a", (function() {
  10039. return I
  10040. })),
  10041. n.d(t, "b", (function() {
  10042. return A
  10043. }));
  10044. var r = n(4),
  10045. i = n(7),
  10046. o = n.n(i),
  10047. a = n(13),
  10048. s = n.n(a),
  10049. c = n(17),
  10050. d = n.n(c),
  10051. u = n(0),
  10052. l = n(15),
  10053. p = n(3);
  10054. function f(e) {
  10055. if ("undefined" == typeof Symbol || null == e[Symbol.iterator]) {
  10056. if (Array.isArray(e) || (e = function(e, t) {
  10057. if (!e) return;
  10058. if ("string" == typeof e) return g(e, t);
  10059. var n = Object.prototype.toString.call(e).slice(8, -1);
  10060. "Object" === n && e.constructor && (n = e.constructor.name);
  10061. if ("Map" === n || "Set" === n) return Array.from(n);
  10062. if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return g(e, t)
  10063. } (e))) {
  10064. var t = 0,
  10065. n = function() {};
  10066. return {
  10067. s: n,
  10068. n: function() {
  10069. return t >= e.length ? {
  10070. done: !0
  10071. }: {
  10072. done: !1,
  10073. value: e[t++]
  10074. }
  10075. },
  10076. e: function(e) {
  10077. throw e
  10078. },
  10079. f: n
  10080. }
  10081. }
  10082. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  10083. }
  10084. var r, i, o = !0,
  10085. a = !1;
  10086. return {
  10087. s: function() {
  10088. r = e[Symbol.iterator]()
  10089. },
  10090. n: function() {
  10091. var e = r.next();
  10092. return o = e.done,
  10093. e
  10094. },
  10095. e: function(e) {
  10096. a = !0,
  10097. i = e
  10098. },
  10099. f: function() {
  10100. try {
  10101. o || null == r.
  10102. return || r.
  10103. return ()
  10104. } finally {
  10105. if (a) throw i
  10106. }
  10107. }
  10108. }
  10109. }
  10110. function g(e, t) { (null == t || t > e.length) && (t = e.length);
  10111. for (var n = 0,
  10112. r = new Array(t); n < t; n++) r[n] = e[n];
  10113. return r
  10114. }
  10115. var m = function(e) {
  10116. var t = {},
  10117. n = l.RTCPeerConnection;
  10118. t.uid = e.uid,
  10119. t.isVideoMute = e.isVideoMute,
  10120. t.isAudioMute = e.isAudioMute,
  10121. t.isSubscriber = e.isSubscriber,
  10122. t.clientId = e.clientId,
  10123. t.filterStatsCache = [],
  10124. t.originStatsCache = [],
  10125. t.lastTimeGetStats = null,
  10126. t.pc_config = {
  10127. iceServers: [{
  10128. url: "stun:webcs.agora.io:3478"
  10129. }]
  10130. };
  10131. var i = {
  10132. id: "outbound_audio_ssrc_send",
  10133. type: "ssrc",
  10134. mediaType: "",
  10135. googCodecName: "opus",
  10136. aecDivergentFilterFraction: "0",
  10137. audioInputLevel: "0",
  10138. bytesSent: "0",
  10139. packetsSent: "0",
  10140. googEchoCancellationReturnLoss: "0",
  10141. googEchoCancellationReturnLossEnhancement: "0"
  10142. },
  10143. a = {
  10144. id: "outbound_video_ssrc_send",
  10145. type: "ssrc",
  10146. mediaType: "",
  10147. googCodecName: "h264" === e.codec ? "H264": "VP8",
  10148. bytesSent: "0",
  10149. packetsLost: "0",
  10150. packetsSent: "0",
  10151. googAdaptationChanges: "0",
  10152. googAvgEncodeMs: "0",
  10153. googEncodeUsagePercent: "0",
  10154. googFirsReceived: "0",
  10155. googFrameHeightSent: "0",
  10156. googFrameHeightInput: "0",
  10157. googFrameRateInput: "0",
  10158. googFrameRateSent: "0",
  10159. googFrameWidthSent: "0",
  10160. googFrameWidthInput: "0",
  10161. googNacksReceived: "0",
  10162. googPlisReceived: "0",
  10163. googRtt: "0"
  10164. },
  10165. c = {
  10166. id: "inbound_audio_ssrc_recv",
  10167. type: "ssrc",
  10168. mediaType: "",
  10169. googCodecName: "opus",
  10170. audioOutputLevel: "0",
  10171. bytesReceived: "0",
  10172. packetsLost: "0",
  10173. packetsReceived: "0",
  10174. googAccelerateRate: "0",
  10175. googCurrentDelayMs: "0",
  10176. googDecodingCNG: "0",
  10177. googDecodingCTN: "0",
  10178. googDecodingCTSG: "0",
  10179. googDecodingNormal: "0",
  10180. googDecodingPLC: "0",
  10181. googDecodingPLCCNG: "0",
  10182. googExpandRate: "0",
  10183. googJitterBufferMs: "0",
  10184. googJitterReceived: "0",
  10185. googPreemptiveExpandRate: "0",
  10186. googPreferredJitterBufferMs: "0",
  10187. googSecondaryDecodedRate: "0",
  10188. googSpeechExpandRate: "0"
  10189. },
  10190. g = {
  10191. id: "inbound_video_ssrc_recv",
  10192. type: "ssrc",
  10193. mediaType: "",
  10194. googTargetDelayMs: "0",
  10195. packetsLost: "0",
  10196. googDecodeMs: "0",
  10197. googMaxDecodeMs: "0",
  10198. googRenderDelayMs: "0",
  10199. googFrameWidthReceived: "0",
  10200. googFrameHeightReceived: "0",
  10201. googFrameRateReceived: "0",
  10202. googFrameRateDecoded: "0",
  10203. googFrameRateOutput: "0",
  10204. googJitterBufferMs: "0",
  10205. googCurrentDelayMs: "0",
  10206. googMinPlayoutDelayMs: "0",
  10207. googNacksSent: "0",
  10208. googPlisSent: "0",
  10209. googFirsSent: "0",
  10210. bytesReceived: "0",
  10211. packetsReceived: "0",
  10212. googFramesReceived: "0",
  10213. googFramesDecoded: "0"
  10214. },
  10215. m = {
  10216. id: "bweforvideo",
  10217. type: "VideoBwe",
  10218. googAvailableSendBandwidth: "0",
  10219. googAvailableReceiveBandwidth: "0",
  10220. googActualEncBitrate: "0",
  10221. googRetransmitBitrate: "0",
  10222. googTargetEncBitrate: "0",
  10223. googBucketDelay: "0",
  10224. googTransmitBitrate: "0"
  10225. };
  10226. t.con = {
  10227. optional: [{
  10228. DtlsSrtpKeyAgreement: !0
  10229. }]
  10230. },
  10231. e.iceServers instanceof Array ? t.pc_config.iceServers = e.iceServers: (e.stunServerUrl && (e.stunServerUrl instanceof Array ? e.stunServerUrl.map((function(e) {
  10232. "string" == typeof e && "" !== e && t.pc_config.iceServers.push({
  10233. url: e
  10234. })
  10235. })) : "string" == typeof e.stunServerUrl && "" !== e.stunServerUrl && t.pc_config.iceServers.push({
  10236. url: e.stunServerUrl
  10237. })), e.turnServers && (e.turnServers instanceof Array ? e.turnServers.map((function(e) {
  10238. e.udpport && t.pc_config.iceServers.push({
  10239. username: e.username,
  10240. credential: e.credential,
  10241. credentialType: "password",
  10242. urls: "turn:" + e.url + ":" + e.udpport + "?transport=udp"
  10243. }),
  10244. "string" == typeof e.tcpport && "" !== e.tcpport && t.pc_config.iceServers.push({
  10245. username: e.username,
  10246. credential: e.credential,
  10247. credentialType: "password",
  10248. urls: "turn:" + e.url + ":" + e.tcpport + "?transport=tcp"
  10249. }),
  10250. !0 === e.forceturn && (t.pc_config.iceTransportPolicy = "relay")
  10251. })) : u.
  10252. default.error("[".concat(t.clientId, "] turnServers is not a array")))),
  10253. void 0 === e.audio && (e.audio = !0),
  10254. void 0 === e.video && (e.video = !0),
  10255. t.mediaConstraints = {
  10256. mandatory: {
  10257. OfferToReceiveVideo: e.video,
  10258. OfferToReceiveAudio: e.audio
  10259. }
  10260. },
  10261. t.roapSessionId = 103;
  10262. try {
  10263. t.pc_config.sdpSemantics = "plan-b",
  10264. t.peerConnection = new n(t.pc_config, t.con)
  10265. } catch(e) {
  10266. delete t.pc_config.sdpSemantics,
  10267. t.peerConnection = new n(t.pc_config, t.con)
  10268. }
  10269. t.iceCandidateTimer = setTimeout((function() {
  10270. t.iceCandidateTimer = null,
  10271. u.
  10272. default.debug("[".concat(t.clientId, "]Candidates collected: ").concat(t.iceCandidateCount)),
  10273. t.moreIceComing && (t.moreIceComing = !1, t.markActionNeeded())
  10274. }), Object(p.getParameter)("CANDIDATE_TIMEOUT")),
  10275. t.peerConnection.onicecandidate = function(e) {
  10276. var n, r, i, o;
  10277. r = (n = t.peerConnection.localDescription.sdp).match(/a=candidate:.+typ\ssrflx.+\r\n/),
  10278. i = n.match(/a=candidate:.+typ\shost.+\r\n/),
  10279. o = n.match(/a=candidate:.+typ\srelay.+\r\n/),
  10280. null === r && null === i && null === o || void 0 !== t.ice || !t.iceCandidateTimer || (clearTimeout(t.iceCandidateTimer), t.iceCandidateTimer = null, t.ice = 0, t.moreIceComing = !1, t.markActionNeeded()),
  10281. t.iceCandidateCount = t.iceCandidateCount + 1
  10282. };
  10283. var h = function(t) {
  10284. return e.screen && (t = t.replace("a=x-google-flag:conference\r\n", "")),
  10285. t
  10286. },
  10287. v = function(n) {
  10288. var r, i;
  10289. if ((r = n.match(/m=video.*\r\n/)) && e.minVideoBW && e.maxVideoBW) {
  10290. i = r[0] + "b=AS:" + e.maxVideoBW + "\r\n";
  10291. var o = 0,
  10292. a = 0;
  10293. "h264" === e.codec ? (o = n.search(/a=rtpmap:(\d+) H264\/90000\r\n/), a = n.search(/H264\/90000\r\n/)) : "vp8" === e.codec && (o = n.search(/a=rtpmap:(\d+) VP8\/90000\r\n/), a = n.search(/VP8\/90000\r\n/)),
  10294. -1 !== o && -1 !== a && a - o > 10 && (i = i + "a=fmtp:" + n.slice(o + 9, a - 1) + " x-google-min-bitrate=" + e.minVideoBW + "\r\n"),
  10295. n = n.replace(r[0], i),
  10296. u.
  10297. default.debug("[" + t.clientId + "]Set Video Bitrate - min:" + e.minVideoBW + " max:" + e.maxVideoBW)
  10298. }
  10299. return (r = n.match(/m=audio.*\r\n/)) && e.maxAudioBW && (i = r[0] + "b=AS:" + e.maxAudioBW + "\r\n", n = n.replace(r[0], i)),
  10300. n
  10301. };
  10302. t.processSignalingMessage = function(n) {
  10303. var r, i = JSON.parse(n);
  10304. t.incomingMessage = i,
  10305. "new" === t.state ? "OFFER" === i.messageType ? (r = {
  10306. sdp: i.sdp,
  10307. type: "offer"
  10308. },
  10309. t.peerConnection.setRemoteDescription(new RTCSessionDescription(r)).
  10310. catch((function(e) {})), t.state = "offer-received", t.markActionNeeded()) : t.error("Illegal message for this state: " + i.messageType + " in state " + t.state) : "offer-sent" === t.state ? "ANSWER" === i.messageType ? ((r = {
  10311. sdp: i.sdp,
  10312. type: "answer"
  10313. }).sdp = h(r.sdp), r.sdp = v(r.sdp), e.screen && "detail" === e.optimizationMode && (u.
  10314. default.debug("[".concat(t.client, "] remove screen share abs ext")), r.sdp = r.sdp.replace(/a=.*abs-send-time\r\n/g, "").replace(/a=.*goog-remb\r\n/g, "")), e.isSubscriber && (r.sdp = r.sdp.replace("minptime=10", "minptime=10;stereo=1; sprop-stereo=1")), t.peerConnection.setRemoteDescription(new RTCSessionDescription(r)).
  10315. catch((function(e) {})), t.state = "established") : "pr-answer" === i.messageType ? (r = {
  10316. sdp: i.sdp,
  10317. type: "pr-answer"
  10318. },
  10319. t.peerConnection.setRemoteDescription(new RTCSessionDescription(r)).
  10320. catch((function(e) {}))) : "offer" === i.messageType ? t.error("Not written yet") : t.error("Illegal message for this state: " + i.messageType + " in state " + t.state) : "established" === t.state && ("OFFER" === i.messageType ? (r = {
  10321. sdp: i.sdp,
  10322. type: "offer"
  10323. },
  10324. t.peerConnection.setRemoteDescription(new RTCSessionDescription(r)).
  10325. catch((function(e) {})), t.state = "offer-received", t.markActionNeeded()) : "ANSWER" === i.messageType ? ((r = {
  10326. sdp: i.sdp,
  10327. type: "answer"
  10328. }).sdp = h(r.sdp), r.sdp = v(r.sdp), t.peerConnection.setRemoteDescription(new RTCSessionDescription(r)).
  10329. catch((function(e) {}))) : t.error("Illegal message for this state: " + i.messageType + " in state " + t.state))
  10330. },
  10331. t.setRtpSenderParameters = function() {
  10332. var e = d()(s.a.mark((function e(n) {
  10333. var r, i, o;
  10334. return s.a.wrap((function(e) {
  10335. for (;;) switch (e.prev = e.next) {
  10336. case 0:
  10337. if (r = t.peerConnection.getSenders(), console.log("senders", r), i = r.find((function(e) {
  10338. return "video" === e.track.kind
  10339. }))) {
  10340. e.next = 5;
  10341. break
  10342. }
  10343. return e.abrupt("return");
  10344. case 5:
  10345. return (o = i.getParameters()).degradationPreference = n,
  10346. e.prev = 7,
  10347. u.
  10348. default.debug("[".concat(t.clientId, "] setParameters"), o),
  10349. e.next = 11,
  10350. i.setParameters(o);
  10351. case 11:
  10352. e.next = 16;
  10353. break;
  10354. case 13:
  10355. e.prev = 13,
  10356. e.t0 = e.
  10357. catch(7),
  10358. u.
  10359. default.debug("[".concat(t.clientId, "] setParameters failed, ignore"));
  10360. case 16:
  10361. case "end":
  10362. return e.stop()
  10363. }
  10364. }), e, null, [[7, 13]])
  10365. })));
  10366. return function(t) {
  10367. return e.apply(this, arguments)
  10368. }
  10369. } ();
  10370. var E = 0,
  10371. _ = 0;
  10372. return t.getVideoRelatedStats = function(e) {
  10373. t.getStats((function(n) {
  10374. n.forEach((function(n) {
  10375. if (t.isSubscriber) {
  10376. if ("video" === n.mediaType && n.id && ~n.id.indexOf("recv")) {
  10377. if (r.isChromeKernel() && +r.getBrowserVersion() >= 76) {
  10378. var i = +n.googFramesReceived - E,
  10379. o = +n.googFramesDecoded - _;
  10380. t._setStat(g, "googFrameRateReceived", i),
  10381. t._setStat(g, "googFrameRateDecoded", o),
  10382. t._setStat(g, "googFrameRateOutput", o),
  10383. E = +n.googFramesReceived,
  10384. _ = +n.googFramesDecoded
  10385. }
  10386. e && e({
  10387. mediaType: "video",
  10388. peerId: t.uid,
  10389. isVideoMute: t.isVideoMute,
  10390. frameRateReceived: n.googFrameRateReceived,
  10391. frameRateDecoded: n.googFrameRateDecoded,
  10392. bytesReceived: n.bytesReceived,
  10393. packetsReceived: n.packetsReceived,
  10394. packetsLost: n.packetsLost
  10395. })
  10396. }
  10397. } else "video" === n.mediaType && n.id && ~n.id.indexOf("send") && e && e({
  10398. mediaType: "video",
  10399. isVideoMute: t.isVideoMute,
  10400. frameRateInput: n.googFrameRateInput,
  10401. frameRateSent: n.googFrameRateSent,
  10402. googRtt: n.googRtt
  10403. })
  10404. }))
  10405. }))
  10406. },
  10407. t.getAudioRelatedStats = function(e) {
  10408. t.getStats((function(n) {
  10409. n.forEach((function(n) {
  10410. t.isSubscriber && "audio" === n.mediaType && n.id && ~n.id.indexOf("recv") && e && e({
  10411. mediaType: "audio",
  10412. peerId: t.uid,
  10413. isAudioMute: t.isAudioMute,
  10414. frameDropped: parseInt(n.googDecodingPLC) + parseInt(n.googDecodingPLCCNG) + "",
  10415. frameReceived: n.googDecodingCTN,
  10416. googJitterReceived: n.googJitterReceived,
  10417. bytesReceived: n.bytesReceived,
  10418. packetsReceived: n.packetsReceived,
  10419. packetsLost: n.packetsLost
  10420. })
  10421. }))
  10422. }))
  10423. },
  10424. t.getStatsRate = function(e) {
  10425. t.getStats((function(t) {
  10426. e(t)
  10427. }))
  10428. },
  10429. t.getStats = function(e, n) {
  10430. n = (n = n || 500) > 500 ? 500 : n,
  10431. t.lastTimeGetStats && Date.now() - t.lastTimeGetStats < n ? e && e(t.filterStatsCache, t.originStatsCache) : (t.lastTimeGetStats = Date.now(), this._getStats((function(n, r) {
  10432. t.filterStatsCache = n,
  10433. t.originStatsCache = r,
  10434. e && e(n, r)
  10435. })))
  10436. },
  10437. t._setStat = function(e, t, n) {
  10438. e.hasOwnProperty(t) && (null != n && n !== 1 / 0 && n == n || (n = 0), e[t] = n + "")
  10439. },
  10440. t._processGetStatsAfterChrome76 = function(e) {
  10441. var n = this;
  10442. t.lastStats || (t.lastStats = new Map),
  10443. t.peerConnection.getStats().then((function(r) {
  10444. var s, d = [],
  10445. u = [],
  10446. l = new Map,
  10447. p = new Date,
  10448. h = f(r.values());
  10449. try {
  10450. for (h.s(); ! (s = h.n()).done;) {
  10451. var v = s.value;
  10452. "codec" != v.type ? "candidate-pair" != v.type ? ("inbound-rtp" === v.type && "video" === v.mediaType && l.set("inbound-video", v), "inbound-rtp" === v.type && "audio" === v.mediaType && l.set("inbound-audio", v), "outbound-rtp" === v.type && "audio" === v.mediaType && l.set("outbound-audio", v), "outbound-rtp" === v.type && "video" === v.mediaType && l.set("outbound-video", v), "track" === v.type && "video" === v.kind && v.remoteSource && l.set("remote-video-track", v), "track" === v.type && "audio" === v.kind && v.remoteSource && l.set("remote-audio-track", v), "remote-inbound-rtp" === v.type && "video" === v.mediaType && l.set("remote-inbound-video", v), "remote-inbound-rtp" === v.type && "audio" === v.mediaType && l.set("remote-inbound-audio", v), "track" !== v.type || "video" !== v.kind || v.remoteSource || l.set("local-video-track", v), "track" !== v.type || "audio" !== v.kind || v.remoteSource || l.set("local-audio-track", v), "media-source" === v.type && "video" === v.kind && l.set("media-source-video", v), "media-source" === v.type && "audio" === v.kind && l.set("media-source-audio", v)) : u.push(v) : d.push(v)
  10453. }
  10454. } catch(e) {
  10455. h.e(e)
  10456. } finally {
  10457. h.f()
  10458. }
  10459. l.set("codec", d),
  10460. l.set("candidatePairs", u),
  10461. l.set("timestamp", +p);
  10462. var E = null,
  10463. _ = null;
  10464. if (g.timestamp = p, c.timestamp = p, i.timestamp = p, i.timestamp = p, m.timestamp = p, n.isSubscriber)(E = l.get("inbound-video")) && (t._setStat(g, "id", "inbound_video_ssrc_recv"), t._setStat(g, "mediaType", E.mediaType), t._setStat(g, "packetsLost", E.packetsLost), t._setStat(g, "googDecodeMs", null), t._setStat(g, "googMaxDecodeMs", null), t._setStat(g, "googRenderDelayMs", null), t._setStat(g, "googMinPlayoutDelayMs", null), t._setStat(g, "googNacksSent", E.nackCount), t._setStat(g, "googPlisSent", E.pliCount), t._setStat(g, "googFirsSent", E.firCount), t._setStat(g, "bytesReceived", E.bytesReceived), t._setStat(g, "packetsReceived", E.packetsReceived)),
  10465. (E = l.get("inbound-audio")) && (t._setStat(c, "id", "inbound_audio_ssrc_recv"), t._setStat(c, "mediaType", E.mediaType), t._setStat(c, "bytesReceived", E.bytesReceived), t._setStat(c, "packetsLost", E.packetsLost), t._setStat(c, "packetsReceived", E.packetsReceived), t._setStat(c, "googAccelerateRate", E.removedSamplesForAcceleration), t._setStat(c, "googCurrentDelayMs", E.jitterBufferDelay), t._setStat(c, "googDecodingCNG", null), t._setStat(c, "googDecodingCTN", null), t._setStat(c, "googDecodingCTSG", null), t._setStat(c, "googDecodingNormal", null), t._setStat(c, "googDecodingPLC", null), t._setStat(c, "googDecodingPLCCNG", null), t._setStat(c, "googJitterReceived", E.jitter), t._setStat(c, "googPreferredJitterBufferMs", null), t._setStat(c, "googSecondaryDecodedRate", null)),
  10466. (E = l.get("remote-video-track")) && (t._setStat(g, "googTargetDelayMs", E.jitterBufferDelay), t._setStat(g, "googFrameWidthReceived", E.frameWidth), t._setStat(g, "googFrameHeightReceived", E.frameHeight), t._setStat(g, "googJitterBufferMs", E.jitterBufferDelay / E.jitterBufferEmittedCount * 1e3), t._setStat(g, "googCurrentDelayMs", E.jitterBufferDelay), t._setStat(g, "googFramesDecoded", E.framesDecoded), t._setStat(g, "googFramesReceived", E.framesReceived)),
  10467. (E = l.get("remote-audio-track")) && (t._setStat(c, "audioOutputLevel", 32767 * E.audioLevel), t._setStat(c, "googJitterBufferMs", E.jitterBufferDelay / E.jitterBufferEmittedCount * 1e3), t._setStat(c, "googExpandRate", E.concealedSamples), t._setStat(c, "googPreemptiveExpandRate", E.insertedSamplesForDeceleration), t._setStat(c, "googSpeechExpandRate", E.silentConcealedSamples));
  10468. else {
  10469. var S = t.lastStats.get("timestamp"),
  10470. y = t.lastStats.get("outbound-video");
  10471. if ((E = l.get("outbound-audio")) && (t._setStat(i, "id", "outbound_audio_ssrc_send"), t._setStat(i, "mediaType", E.mediaType), t._setStat(i, "aecDivergentFilterFraction", null), t._setStat(i, "bytesSent", E.bytesSent), t._setStat(i, "packetsSent", E.packetsSent), _ = E.transportId), E = l.get("outbound-video")) {
  10472. if (t._setStat(a, "id", "outbound_video_ssrc_send"), t._setStat(a, "mediaType", E.mediaType), t._setStat(a, "bytesSent", E.bytesSent), t._setStat(a, "packetsSent", E.packetsSent), t._setStat(a, "googAdaptationChanges", E.qualityLimitationDurations), t._setStat(a, "googAvgEncodeMs", null), t._setStat(a, "googEncodeUsagePercent", null), _ = E.transportId, E.totalEncodedBytesTarget && y && y.totalEncodedBytesTarget) {
  10473. var R = (E.totalEncodedBytesTarget - y.totalEncodedBytesTarget) / ( + new Date - S);
  10474. t._setStat(m, "googTargetEncBitrate", Math.floor(8 * R * 1e3))
  10475. }
  10476. if (E.retransmittedBytesSent && y && y.retransmittedBytesSent) {
  10477. var T = (E.retransmittedBytesSent - y.retransmittedBytesSent) / ( + new Date - S);
  10478. t._setStat(m, "googRetransmitBitrate", Math.floor(8 * T * 1e3))
  10479. }
  10480. if (E.bytesSent && y && y.bytesSent) {
  10481. var I = (E.bytesSent - y.bytesSent) / ( + new Date - S);
  10482. t._setStat(m, "googTransmitBitrate", Math.floor(8 * I * 1e3)),
  10483. t._setStat(m, "googActualEncBitrate", Math.floor(8 * I * 1e3))
  10484. }
  10485. if (E.totalPacketSendDelay && y && y.totalPacketSendDelay) {
  10486. var A = (E.totalPacketSendDelay - y.totalPacketSendDelay) / ( + new Date - S);
  10487. t._setStat(m, "googBucketDelay", Math.floor(1e3 * A))
  10488. }
  10489. }
  10490. if ((E = l.get("remote-inbound-video")) && (t._setStat(a, "packetsLost", E.packetsLost), t._setStat(a, "googRtt", E.roundTripTime)), (E = l.get("local-video-track")) && (t._setStat(a, "googFrameHeightSent", E.frameHeight), t._setStat(a, "googFrameWidthSent", E.frameWidth), void 0 !== E.framesPerSecond && t._setStat(a, "googFrameRateSent", E.framesPerSecond)), (E = l.get("local-audio-track")) && (t._setStat(i, "googEchoCancellationReturnLoss", E.echoReturnLoss), t._setStat(i, "googEchoCancellationReturnLossEnhancement", E.echoReturnLossEnhancement)), (E = l.get("media-source-video")) && (t._setStat(a, "googFrameHeightInput", E.height), t._setStat(a, "googFrameWidthInput", E.width), t._setStat(a, "googFrameRateInput", E.framesPerSecond)), (E = l.get("media-source-audio")) && t._setStat(i, "audioInputLevel", 32767 * E.totalAudioEnergy), (E = l.get("inbound-video")) && (t._setStat(a, "googFirsReceived", E.firCount), t._setStat(a, "googNacksReceived", E.nackCount), t._setStat(a, "googPlisReceived", E.pliCount)), _) l.get("candidatePairs").map((function(e) {
  10491. _ == e.transportId && t._setStat(m, "googAvailableSendBandwidth", e.availableOutgoingBitrate)
  10492. }));
  10493. else {
  10494. var b = l.get("candidatePairs")[0];
  10495. b && t._setStat(m, "googAvailableSendBandwidth", b.availableOutgoingBitrate)
  10496. }
  10497. }
  10498. t.lastStats = l;
  10499. var O = [o()({},
  10500. a), o()({},
  10501. i), o()({},
  10502. g), o()({},
  10503. c), o()({},
  10504. m)];
  10505. O.push({
  10506. id: "time",
  10507. startTime: t.connectedTime,
  10508. timestamp: new Date
  10509. }),
  10510. e(O)
  10511. }))
  10512. },
  10513. t._processGetStatsBeforeChrome76 = function(e) {
  10514. t.peerConnection.getStats((function(n) {
  10515. var r = [],
  10516. s = [],
  10517. d = null;
  10518. Object.keys(n).forEach((function(e) {
  10519. var t = n[e];
  10520. t && (s.push(t), d = t.timestamp, "VideoBwe" === t.type ? m = t: t.id.indexOf("_send") > -1 && "video" === t.mediaType ? a = t: t.id.indexOf("_send") > -1 && "audio" === t.mediaType ? i = t: t.id.indexOf("_recv") > -1 && "video" === t.mediaType ? g = t: t.id.indexOf("_recv") > -1 && "audio" === t.mediaType && (c = t))
  10521. })),
  10522. (r = [o()({},
  10523. a), o()({},
  10524. i), o()({},
  10525. g), o()({},
  10526. c), o()({},
  10527. m)]).push({
  10528. id: "time",
  10529. startTime: t.connectedTime,
  10530. timestamp: d || new Date
  10531. }),
  10532. e(r, s)
  10533. }))
  10534. },
  10535. t._getStats = function(e) {
  10536. Object(p.getParameter)("CHROME_NEW_STATS") && r.isChromeKernel() && +r.getBrowserVersion() >= 76 ? t._processGetStatsAfterChrome76(e) : t._processGetStatsBeforeChrome76(e)
  10537. },
  10538. t.addTrack = function(e, n) {
  10539. t.peerConnection.addTrack(e, n)
  10540. },
  10541. t.removeTrack = function(e, n) {
  10542. t.peerConnection.removeTrack(t.peerConnection.getSenders().find((function(t) {
  10543. return t.track == e
  10544. })))
  10545. },
  10546. t.addStream = function(e) {
  10547. t.peerConnection.addStream(e),
  10548. t.markActionNeeded()
  10549. },
  10550. t.removeStream = function() {
  10551. t.markActionNeeded()
  10552. },
  10553. t.close = function() {
  10554. t.state = "closed",
  10555. t.peerConnection.close()
  10556. },
  10557. t.markActionNeeded = function() {
  10558. t.actionNeeded = !0,
  10559. t.doLater((function() {
  10560. t.onstablestate()
  10561. }))
  10562. },
  10563. t.doLater = function(e) {
  10564. window.setTimeout(e, 1)
  10565. },
  10566. t.onstablestate = function() {
  10567. var n;
  10568. if (t.actionNeeded) {
  10569. if ("new" === t.state || "established" === t.state) t.peerConnection.createOffer((function(n) {
  10570. if (n.sdp !== t.prevOffer) return e.isSubscriber && (n.sdp = n.sdp.replace("minptime=10", "minptime=10;stereo=1; sprop-stereo=1")),
  10571. t.peerConnection.setLocalDescription(n),
  10572. t.state = "preparing-offer",
  10573. void t.markActionNeeded();
  10574. u.
  10575. default.debug("[" + t.clientId + "]Not sending a new offer")
  10576. }), (function(e) {
  10577. u.
  10578. default.debug("[" + t.clientId + "]peer connection create offer failed ", e)
  10579. }), t.mediaConstraints);
  10580. else if ("preparing-offer" === t.state) {
  10581. if (t.moreIceComing) return;
  10582. t.prevOffer = t.peerConnection.localDescription.sdp,
  10583. t.offerCandidates = t.prevOffer.match(/a=candidate.+\r\n/g) || [],
  10584. t.offerCandidates.length || (u.
  10585. default.warning("[".concat(t.clientId, "]No Ice Candidate generated")), Object(p.getParameter)("SHIM_CANDIDATE") ? (u.
  10586. default.debug("Shimming fake candidate"), t.prevOffer += "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n") : u.
  10587. default.error("[".concat(t.clientId, "]None Ice Candidate not allowed"))),
  10588. t.prevOffer = t.prevOffer.replace(/a=candidate:.+typ\shost.+\r\n/g, "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n"),
  10589. t.sendMessage("OFFER", t.prevOffer),
  10590. t.state = "offer-sent"
  10591. } else if ("offer-received" === t.state) t.peerConnection.createAnswer((function(e) {
  10592. if (t.peerConnection.setLocalDescription(e), t.state = "offer-received-preparing-answer", t.iceStarted) t.markActionNeeded();
  10593. else {
  10594. var n = new Date;
  10595. u.
  10596. default.debug("[" + t.clientId + "]" + n.getTime() + ": Starting ICE in responder"),
  10597. t.iceStarted = !0
  10598. }
  10599. }), (function(e) {
  10600. u.
  10601. default.debug("[" + t.clientId + "]peer connection create answer failed ", e)
  10602. }), t.mediaConstraints);
  10603. else if ("offer-received-preparing-answer" === t.state) {
  10604. if (t.moreIceComing) return;
  10605. n = t.peerConnection.localDescription.sdp,
  10606. t.sendMessage("ANSWER", n),
  10607. t.state = "established"
  10608. } else u.
  10609. default.debug("[".concat(t.clientId, "] Dazed and confused in state ' + that.state + ', stopping here'"));
  10610. t.actionNeeded = !1
  10611. }
  10612. },
  10613. t.sendMessage = function(e, n) {
  10614. var r = {};
  10615. r.messageType = e,
  10616. r.sdp = n,
  10617. "OFFER" === e ? (r.offererSessionId = t.sessionId, r.answererSessionId = t.otherSessionId, r.seq = t.sequenceNumber += 1, r.tiebreaker = Math.floor(429496723 * Math.random() + 1)) : (r.offererSessionId = t.incomingMessage.offererSessionId, r.answererSessionId = t.sessionId, r.seq = t.incomingMessage.seq),
  10618. t.onsignalingmessage(JSON.stringify(r))
  10619. },
  10620. t._getSender = function(e) {
  10621. if (t.peerConnection && t.peerConnection.getSenders) {
  10622. var n = t.peerConnection.getSenders().find((function(t) {
  10623. return t.track.kind == e
  10624. }));
  10625. if (n) return n
  10626. }
  10627. return null
  10628. },
  10629. t.hasSender = function(e) {
  10630. return !! t._getSender(e)
  10631. },
  10632. t.replaceTrack = function(e, n, r) {
  10633. var i = t._getSender(e.kind);
  10634. if (!i) {
  10635. return r("NO_SENDER_FOUND")
  10636. }
  10637. try {
  10638. i.replaceTrack(e)
  10639. } catch(e) {
  10640. return r && r(e)
  10641. }
  10642. setTimeout((function() {
  10643. return n && n()
  10644. }), 50)
  10645. },
  10646. t.error = function(e) {
  10647. throw "Error in RoapOnJsep: " + e
  10648. },
  10649. t.sessionId = t.roapSessionId += 1,
  10650. t.sequenceNumber = 0,
  10651. t.actionNeeded = !1,
  10652. t.iceStarted = !1,
  10653. t.moreIceComing = !0,
  10654. t.iceCandidateCount = 0,
  10655. t.onsignalingmessage = e.callback,
  10656. t.peerConnection.ontrack = function(e) {
  10657. t.onaddstream && (t.onaddstream(e, "ontrack"), t.peerConnection.onaddstream = null)
  10658. },
  10659. t.peerConnection.onaddstream = function(e) {
  10660. t.onaddstream && (t.onaddstream(e, "onaddstream"), t.peerConnection.ontrack = null)
  10661. },
  10662. t.peerConnection.onremovestream = function(e) {
  10663. t.onremovestream && t.onremovestream(e)
  10664. },
  10665. t.peerConnection.oniceconnectionstatechange = function(e) {
  10666. "connected" === e.currentTarget.iceConnectionState && (t.connectedTime = new Date),
  10667. t.oniceconnectionstatechange && t.oniceconnectionstatechange(e.currentTarget.iceConnectionState)
  10668. },
  10669. t.renegotiate = function() {
  10670. void 0 !== t.prevOffer && t.peerConnection.createOffer().then((function(e) {
  10671. return e.sdp = e.sdp.replace(/a=recvonly\r\n/g, "a=inactive\r\n"),
  10672. e.sdp = h(e.sdp),
  10673. e.sdp = v(e.sdp),
  10674. t.peerConnection.setLocalDescription(e)
  10675. })).then((function() {
  10676. t.onnegotiationneeded && t.onnegotiationneeded(t.peerConnection.localDescription.sdp)
  10677. })).
  10678. catch((function(e) {
  10679. console.log("createOffer error: ", e)
  10680. }))
  10681. },
  10682. t.peerConnection.onnegotiationneeded = t.renegotiate,
  10683. t.onaddstream = null,
  10684. t.onremovestream = null,
  10685. t.onnegotiationneeded = null,
  10686. t.state = "new",
  10687. t.markActionNeeded(),
  10688. t
  10689. },
  10690. h = function(e) {
  10691. var t = {},
  10692. n = l.RTCPeerConnection;
  10693. t.uid = e.uid,
  10694. t.isVideoMute = e.isVideoMute,
  10695. t.isAudioMute = e.isAudioMute,
  10696. t.isSubscriber = e.isSubscriber,
  10697. t.clientId = e.clientId,
  10698. t.filterStatsCache = [],
  10699. t.originStatsCache = [],
  10700. t.lastTimeGetStats = null,
  10701. t.pc_config = {
  10702. iceServers: [{
  10703. urls: ["stun:webcs.agora.io:3478", "stun:stun.l.google.com:19302"]
  10704. }],
  10705. bundlePolicy: "max-bundle"
  10706. },
  10707. t.con = {
  10708. optional: [{
  10709. DtlsSrtpKeyAgreement: !0
  10710. }]
  10711. },
  10712. e.iceServers instanceof Array ? t.pc_config.iceServers = e.iceServers: (e.stunServerUrl && (e.stunServerUrl instanceof Array ? e.stunServerUrl.map((function(e) {
  10713. "string" == typeof e && "" !== e && t.pc_config.iceServers.push({
  10714. url: e
  10715. })
  10716. })) : "string" == typeof e.stunServerUrl && "" !== e.stunServerUrl && t.pc_config.iceServers.push({
  10717. url: e.stunServerUrl
  10718. })), e.turnServers && (e.turnServers instanceof Array ? e.turnServers.map((function(e) {
  10719. e.udpport && t.pc_config.iceServers.push({
  10720. username: e.username,
  10721. credential: e.credential,
  10722. credentialType: "password",
  10723. urls: "turn:" + e.url + ":" + e.udpport + "?transport=udp"
  10724. }),
  10725. "string" == typeof e.tcpport && "" !== e.tcpport && t.pc_config.iceServers.push({
  10726. username: e.username,
  10727. credential: e.credential,
  10728. credentialType: "password",
  10729. urls: "turn:" + e.url + ":" + e.tcpport + "?transport=tcp"
  10730. }),
  10731. !0 === e.forceturn && (t.pc_config.iceTransportPolicy = "relay")
  10732. })) : u.
  10733. default.error("[".concat(t.clientId, "] turnServers is not a array")))),
  10734. void 0 === e.audio && (e.audio = !0),
  10735. void 0 === e.video && (e.video = !0),
  10736. t.mediaConstraints = {
  10737. mandatory: {
  10738. OfferToReceiveVideo: e.video,
  10739. OfferToReceiveAudio: e.audio
  10740. }
  10741. },
  10742. t.roapSessionId = 103;
  10743. try {
  10744. t.pc_config.sdpSemantics = "plan-b",
  10745. t.peerConnection = new n(t.pc_config, t.con)
  10746. } catch(e) {
  10747. delete t.pc_config.sdpSemantics,
  10748. t.peerConnection = new n(t.pc_config, t.con)
  10749. }
  10750. t.iceCandidateTimer = setTimeout((function() {
  10751. t.iceCandidateTimer = null,
  10752. t.moreIceComing && (t.moreIceComing = !1, t.markActionNeeded())
  10753. }), Object(p.getParameter)("CANDIDATE_TIMEOUT")),
  10754. t.peerConnection.onicecandidate = function(e) {
  10755. var n, r, i, o;
  10756. r = (n = t.peerConnection.localDescription.sdp).match(/a=candidate:.+typ\ssrflx.+\r\n/),
  10757. i = n.match(/a=candidate:.+typ\shost.+\r\n/),
  10758. o = n.match(/a=candidate:.+typ\srelay.+\r\n/),
  10759. 0 === t.iceCandidateCount && (t.timeout = setTimeout((function() {
  10760. t.moreIceComing && (t.moreIceComing = !1, t.markActionNeeded())
  10761. }), 1e3)),
  10762. null === r && null === i && null === o || void 0 !== t.ice || !t.iceCandidateTimer || (clearTimeout(t.iceCandidateTimer), t.iceCandidateTimer = null, t.ice = 0, t.moreIceComing = !1, t.markActionNeeded()),
  10763. t.iceCandidateCount = t.iceCandidateCount + 1
  10764. };
  10765. var r = function(t) {
  10766. return e.screen && (t = t.replace("a=x-google-flag:conference\r\n", "")),
  10767. t
  10768. },
  10769. i = function(n) {
  10770. var r, i;
  10771. return (r = n.match(/m=video.*\r\n/)) && e.minVideoBW && e.maxVideoBW && (i = r[0] + "b=AS:" + e.maxVideoBW + "\r\n", n = n.replace(r[0], i), u.
  10772. default.debug("[" + t.clientId + "]Set Video Bitrate - min:" + e.minVideoBW + " max:" + e.maxVideoBW)),
  10773. (r = n.match(/m=audio.*\r\n/)) && e.maxAudioBW && (i = r[0] + "b=AS:" + e.maxAudioBW + "\r\n", n = n.replace(r[0], i)),
  10774. n
  10775. };
  10776. t.processSignalingMessage = function(n) {
  10777. var o, a = JSON.parse(n);
  10778. t.incomingMessage = a,
  10779. "new" === t.state ? "OFFER" === a.messageType ? (o = {
  10780. sdp: a.sdp,
  10781. type: "offer"
  10782. },
  10783. t.peerConnection.setRemoteDescription(new RTCSessionDescription(o)), t.state = "offer-received", t.markActionNeeded()) : t.error("Illegal message for this state: " + a.messageType + " in state " + t.state) : "offer-sent" === t.state ? "ANSWER" === a.messageType ? ((o = {
  10784. sdp: a.sdp,
  10785. type: "answer"
  10786. }).sdp = r(o.sdp), o.sdp = i(o.sdp), o.sdp = o.sdp.replace(/a=x-google-flag:conference\r\n/g, ""), e.screen && "detail" === e.optimizationMode && (u.
  10787. default.debug("[".concat(t.client, "] remove screen share abs ext")), o.sdp = o.sdp.replace(/a=.*abs-send-time\r\n/g, "").replace(/a=.*goog-remb\r\n/g, "")), t.peerConnection.setRemoteDescription(new RTCSessionDescription(o)), t.state = "established") : "pr-answer" === a.messageType ? (o = {
  10788. sdp: a.sdp,
  10789. type: "pr-answer"
  10790. },
  10791. t.peerConnection.setRemoteDescription(new RTCSessionDescription(o))) : "offer" === a.messageType ? t.error("Not written yet") : t.error("Illegal message for this state: " + a.messageType + " in state " + t.state) : "established" === t.state && ("OFFER" === a.messageType ? (o = {
  10792. sdp: a.sdp,
  10793. type: "offer"
  10794. },
  10795. t.peerConnection.setRemoteDescription(new RTCSessionDescription(o)), t.state = "offer-received", t.markActionNeeded()) : "ANSWER" === a.messageType ? ((o = {
  10796. sdp: a.sdp,
  10797. type: "answer"
  10798. }).sdp = r(o.sdp), o.sdp = i(o.sdp), t.peerConnection.setRemoteDescription(new RTCSessionDescription(o))) : t.error("Illegal message for this state: " + a.messageType + " in state " + t.state))
  10799. },
  10800. t.setRtpSenderParameters = function() {
  10801. var e = d()(s.a.mark((function e(n) {
  10802. var r, i, o;
  10803. return s.a.wrap((function(e) {
  10804. for (;;) switch (e.prev = e.next) {
  10805. case 0:
  10806. if (r = t.peerConnection.getSenders(), i = r.find((function(e) {
  10807. return "video" === e.track.kind
  10808. }))) {
  10809. e.next = 4;
  10810. break
  10811. }
  10812. return e.abrupt("return");
  10813. case 4:
  10814. return (o = i.getParameters()).degradationPreference = n,
  10815. e.prev = 6,
  10816. u.
  10817. default.debug("[".concat(t.clientId, "] setParameters"), o),
  10818. e.next = 10,
  10819. i.setParameters(o);
  10820. case 10:
  10821. e.next = 15;
  10822. break;
  10823. case 12:
  10824. e.prev = 12,
  10825. e.t0 = e.
  10826. catch(6),
  10827. u.
  10828. default.debug("[".concat(t.clientId, "] setParameters failed, ignore"));
  10829. case 15:
  10830. case "end":
  10831. return e.stop()
  10832. }
  10833. }), e, null, [[6, 12]])
  10834. })));
  10835. return function(t) {
  10836. return e.apply(this, arguments)
  10837. }
  10838. } ();
  10839. var o = {
  10840. id: "",
  10841. type: "",
  10842. mediaType: "",
  10843. googCodecName: "opus",
  10844. aecDivergentFilterFraction: "0",
  10845. audioInputLevel: "0",
  10846. bytesSent: "0",
  10847. packetsSent: "0",
  10848. googEchoCancellationReturnLoss: "0",
  10849. googEchoCancellationReturnLossEnhancement: "0"
  10850. },
  10851. a = {
  10852. id: "",
  10853. type: "",
  10854. mediaType: "",
  10855. googCodecName: "h264" === e.codec ? "H264": "VP8",
  10856. bytesSent: "0",
  10857. packetsLost: "0",
  10858. packetsSent: "0",
  10859. googAdaptationChanges: "0",
  10860. googAvgEncodeMs: "0",
  10861. googEncodeUsagePercent: "0",
  10862. googFirsReceived: "0",
  10863. googFrameHeightSent: "0",
  10864. googFrameHeightInput: "0",
  10865. googFrameRateInput: "0",
  10866. googFrameRateSent: "0",
  10867. googFrameWidthSent: "0",
  10868. googFrameWidthInput: "0",
  10869. googNacksReceived: "0",
  10870. googPlisReceived: "0",
  10871. googRtt: "0",
  10872. googFramesEncoded: "0"
  10873. },
  10874. c = {
  10875. id: "",
  10876. type: "",
  10877. mediaType: "",
  10878. audioOutputLevel: "0",
  10879. bytesReceived: "0",
  10880. packetsLost: "0",
  10881. packetsReceived: "0",
  10882. googAccelerateRate: "0",
  10883. googCurrentDelayMs: "0",
  10884. googDecodingCNG: "0",
  10885. googDecodingCTN: "0",
  10886. googDecodingCTSG: "0",
  10887. googDecodingNormal: "0",
  10888. googDecodingPLC: "0",
  10889. googDecodingPLCCNG: "0",
  10890. googExpandRate: "0",
  10891. googJitterBufferMs: "0",
  10892. googJitterReceived: "0",
  10893. googPreemptiveExpandRate: "0",
  10894. googPreferredJitterBufferMs: "0",
  10895. googSecondaryDecodedRate: "0",
  10896. googSpeechExpandRate: "0"
  10897. },
  10898. f = {
  10899. id: "",
  10900. type: "",
  10901. mediaType: "",
  10902. googTargetDelayMs: "0",
  10903. packetsLost: "0",
  10904. googDecodeMs: "0",
  10905. googMaxDecodeMs: "0",
  10906. googRenderDelayMs: "0",
  10907. googFrameWidthReceived: "0",
  10908. googFrameHeightReceived: "0",
  10909. googFrameRateReceived: "0",
  10910. googFrameRateDecoded: "0",
  10911. googFrameRateOutput: "0",
  10912. googFramesDecoded: "0",
  10913. googFrameReceived: "0",
  10914. googJitterBufferMs: "0",
  10915. googCurrentDelayMs: "0",
  10916. googMinPlayoutDelayMs: "0",
  10917. googNacksSent: "0",
  10918. googPlisSent: "0",
  10919. googFirsSent: "0",
  10920. bytesReceived: "0",
  10921. packetsReceived: "0"
  10922. },
  10923. g = {
  10924. id: "bweforvideo",
  10925. type: "VideoBwe",
  10926. googAvailableSendBandwidth: "0",
  10927. googAvailableReceiveBandwidth: "0",
  10928. googActualEncBitrate: "0",
  10929. googRetransmitBitrate: "0",
  10930. googTargetEncBitrate: "0",
  10931. googBucketDelay: "0",
  10932. googTransmitBitrate: "0"
  10933. },
  10934. m = 0,
  10935. h = 0,
  10936. v = 0;
  10937. return t.isRemoteVideoStats = function(e) {
  10938. return !! (e.frameHeight && e.frameWidth && e.remoteSource)
  10939. },
  10940. t.getVideoRelatedStats = function(n) {
  10941. t.peerConnection.getStats().then((function(r) {
  10942. var i = {
  10943. peerId: t.uid,
  10944. mediaType: "video",
  10945. isVideoMute: t.isVideoMute
  10946. };
  10947. r.forEach((function(r) {
  10948. if (t.isSubscriber) {
  10949. if ("track" === r.type && (~r.id.indexOf("video") || ~r.trackIdentifier.indexOf("v") || t.isRemoteVideoStats(r))) {
  10950. if (!t.lastReport) return void(t.lastReport = r);
  10951. i.frameRateReceived = r.framesReceived - t.lastReport.framesReceived + "",
  10952. i.frameRateDecoded = r.framesDecoded - t.lastReport.framesDecoded + "",
  10953. t.lastReport = r
  10954. }
  10955. "inbound-rtp" === r.type && ~r.id.indexOf("Video") && (i.bytesReceived = r.bytesReceived + "", i.packetsReceived = r.packetsReceived + "", i.packetsLost = r.packetsLost + "")
  10956. } else if ("outbound-rtp" === r.type && ~r.id.indexOf("Video")) {
  10957. if (!t.lastReport) return void(t.lastReport = r);
  10958. n && n({
  10959. mediaType: "video",
  10960. isVideoMute: t.isVideoMute,
  10961. frameRateInput: e.maxFrameRate + "",
  10962. frameRateSent: r.framesEncoded - t.lastReport.framesEncoded + ""
  10963. }),
  10964. t.lastReport = r
  10965. }
  10966. })),
  10967. n && n(i)
  10968. }))
  10969. },
  10970. t.getAudioRelatedStats = function(e) {
  10971. t.peerConnection.getStats().then((function(n) {
  10972. n.forEach((function(n) {
  10973. t.isSubscriber && "inbound-rtp" === n.type && ~n.id.indexOf("Audio") && e && e({
  10974. peerId: t.uid,
  10975. mediaType: "audio",
  10976. isAudioMute: t.isAudioMute,
  10977. frameDropped: n.packetsLost + "",
  10978. frameReceived: n.packetsReceived + "",
  10979. googJitterReceived: n.jitter + "",
  10980. bytesReceived: n.bytesReceived + "",
  10981. packetsReceived: n.packetsReceived + "",
  10982. packetsLost: n.packetsLost + ""
  10983. })
  10984. }))
  10985. }))
  10986. },
  10987. t.getStatsRate = function(e) {
  10988. t.getStats((function(t) {
  10989. t.forEach((function(e) {
  10990. "outbound-rtp" === e.type && "video" === e.mediaType && e.googFramesEncoded && (e.googFrameRateSent = ((e.googFramesEncoded - m) / 3).toString(), m = e.googFramesEncoded),
  10991. "inbound-rtp" === e.type && -1 != e.id.indexOf("55543") && (e.googFrameRateReceived && (e.googFrameRateReceived = ((e.googFrameReceived - v) / 3).toString(), v = e.googFrameReceived), e.googFrameRateDecoded && (e.googFrameRateDecoded = ((e.googFramesDecoded - h) / 3).toString(), h = e.googFramesDecoded))
  10992. })),
  10993. e(t)
  10994. }))
  10995. },
  10996. t.getStats = function(e, n) {
  10997. n = (n = n || 500) > 500 ? 500 : n,
  10998. t.lastTimeGetStats && Date.now() - t.lastTimeGetStats < n ? e && e(t.filterStatsCache, t.originStatsCache) : this._getStats((function(n, r) {
  10999. t.filterStatsCache = n,
  11000. t.originStatsCache = r,
  11001. t.lastTimeGetStats = Date.now(),
  11002. e && e(n, r)
  11003. }))
  11004. },
  11005. t._getStats = function(n) {
  11006. var r = [];
  11007. t.peerConnection.getStats().then((function(i) {
  11008. i.forEach((function(t) {
  11009. var n; (r.push(t), "outbound-rtp" === t.type && "audio" === t.mediaType && (o.id = t.id, o.type = t.type, o.mediaType = t.mediaType, o.bytesSent = t.bytesSent ? t.bytesSent + "": "0", o.packetsSent = t.packetsSent ? t.packetsSent + "": "0", e.agoraStream.local && (o.audioInputLevel = Math.round(32767 * e.agoraStream.getAudioLevel()).toString())), "outbound-rtp" === t.type && "video" === t.mediaType) && (a.id = t.id, a.type = t.type, a.mediaType = t.mediaType, a.bytesSent = t.bytesSent ? t.bytesSent + "": "0", a.packetsSent = t.packetsSent ? t.packetsSent + "": "0", a.googPlisReceived = t.pliCount ? t.pliCount + "": "0", a.googNacksReceived = t.nackCount ? t.nackCount + "": "0", a.googFirsReceived = t.firCount ? t.firCount + "": "0", a.googFramesEncoded = t.framesEncoded ? t.framesEncoded + "": "0", (n = i.get(t.trackId)) && (a.googFrameHeightSent = n.frameHeight && n.frameHeight.toString(), a.googFrameWidthSent = n.frameWidth && n.frameWidth.toString()));
  11010. "inbound-rtp" !== t.type || -1 == t.id.indexOf("44444") && "audio" !== t.mediaType || (c.id = t.id, c.type = t.type, c.mediaType = "audio", c.packetsReceived = t.packetsReceived ? t.packetsReceived + "": "0", c.bytesReceived = t.bytesReceived ? t.bytesReceived + "": "0", c.packetsLost = t.packetsLost ? t.packetsLost + "": "0", c.packetsReceived = t.packetsReceived ? t.packetsReceived + "": "0", c.googJitterReceived = t.jitter ? t.jitter + "": "0", (n = i.get(t.trackId)) && (c.audioOutputLevel = n.audioLevel && Math.round(32767 * n.audioLevel).toString()), e.agoraStream.local || c.audioOutputLevel || (c.audioOutputLevel = Math.round(32767 * e.agoraStream.getAudioLevel()).toString()));
  11011. "inbound-rtp" !== t.type || -1 == t.id.indexOf("55543") && "video" !== t.mediaType || (f.id = t.id, f.type = t.type, f.mediaType = "video", f.packetsReceived = t.packetsReceived ? t.packetsReceived + "": "0", f.bytesReceived = t.bytesReceived ? t.bytesReceived + "": "0", f.packetsLost = t.packetsLost ? t.packetsLost + "": "0", f.googJitterBufferMs = t.jitter ? t.jitter + "": "0", f.googNacksSent = t.nackCount ? t.nackCount + "": "0", f.googPlisSent = t.pliCount ? t.pliCount + "": "0", f.googFirsSent = t.firCount ? t.firCount + "": "0", (n = i.get(t.trackId)) && (f.googFrameHeightReceived = n.frameHeight && n.frameHeight.toString(), f.googFrameWidthReceived = n.frameWidth && n.frameWidth.toString(), f.googFrameReceived = n.framesReceived && n.framesReceived.toString(), f.googFramesDecdec = n.framesDecoded && n.framesDecoded.toString()));
  11012. "candidate-pair" === t.type && (0 == t.availableIncomingBitrate ? g.googAvailableSendBandwidth = t.availableOutgoingBitrate + "": g.googAvailableReceiveBandwidth = t.availableIncomingBitrate + "")
  11013. }));
  11014. var s = [g, o, a, c, f];
  11015. s.push({
  11016. id: "time",
  11017. startTime: t.connectedTime,
  11018. timestamp: new Date
  11019. }),
  11020. n(s, r)
  11021. })).
  11022. catch((function(e) {
  11023. u.
  11024. default.error("[" + t.clientId + "] ", e)
  11025. }))
  11026. },
  11027. t.addTrack = function(e, n) {
  11028. t.peerConnection.addTrack(e, n)
  11029. },
  11030. t.removeTrack = function(e, n) {
  11031. var r = t.peerConnection.getSenders().find((function(t) {
  11032. return t.track == e
  11033. }));
  11034. r.replaceTrack(null),
  11035. t.peerConnection.removeTrack(r)
  11036. },
  11037. t.addStream = function(e) {
  11038. window.navigator.userAgent.indexOf("Safari") > -1 && -1 === navigator.userAgent.indexOf("Chrome") ? e.getTracks().forEach((function(n) {
  11039. return t.peerConnection.addTrack(n, e)
  11040. })) : t.peerConnection.addStream(e),
  11041. t.markActionNeeded()
  11042. },
  11043. t.removeStream = function() {
  11044. t.markActionNeeded()
  11045. },
  11046. t.close = function() {
  11047. t.state = "closed",
  11048. t.peerConnection.close()
  11049. },
  11050. t.markActionNeeded = function() {
  11051. t.actionNeeded = !0,
  11052. t.doLater((function() {
  11053. t.onstablestate()
  11054. }))
  11055. },
  11056. t.doLater = function(e) {
  11057. window.setTimeout(e, 1)
  11058. },
  11059. t.onstablestate = function() {
  11060. var n;
  11061. if (t.actionNeeded) {
  11062. if ("new" === t.state || "established" === t.state) {
  11063. if (e.isSubscriber) t.peerConnection.addTransceiver("audio", {
  11064. direction: "recvonly"
  11065. }),
  11066. t.peerConnection.addTransceiver("video", {
  11067. direction: "recvonly"
  11068. });
  11069. t.peerConnection.createOffer(t.mediaConstraints).then((function(n) {
  11070. if (n.sdp = i(n.sdp), e.isSubscriber || (n.sdp = n.sdp.replace(/a=.*video-orientation\r\n/g, "")), n.sdp !== t.prevOffer) return t.peerConnection.setLocalDescription(n),
  11071. t.state = "preparing-offer",
  11072. void t.markActionNeeded();
  11073. u.
  11074. default.debug("[" + t.clientId + "]Not sending a new offer")
  11075. })).
  11076. catch((function(e) {
  11077. u.
  11078. default.debug("[" + t.clientId + "]peer connection create offer failed ", e)
  11079. }))
  11080. } else if ("preparing-offer" === t.state) {
  11081. if (t.moreIceComing) return;
  11082. t.prevOffer = t.peerConnection.localDescription.sdp,
  11083. t.offerCandidates = t.prevOffer.match(/a=candidate.+\r\n/g) || [],
  11084. t.offerCandidates.length || (u.
  11085. default.warning("[".concat(t.clientId, "]No Ice Candidate generated")), Object(p.getParameter)("SHIM_CANDIDATE") ? (u.
  11086. default.debug("Shimming fake candidate"), t.prevOffer += "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n") : u.
  11087. default.error("[".concat(t.clientId, "]None Ice Candidate not allowed"))),
  11088. t.prevOffer = t.prevOffer.replace(/a=candidate:.+typ\shost.+\r\n/g, "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n"),
  11089. t.sendMessage("OFFER", t.prevOffer),
  11090. t.state = "offer-sent"
  11091. } else if ("offer-received" === t.state) t.peerConnection.createAnswer((function(e) {
  11092. if (t.peerConnection.setLocalDescription(e), t.state = "offer-received-preparing-answer", t.iceStarted) t.markActionNeeded();
  11093. else {
  11094. var n = new Date;
  11095. u.
  11096. default.debug("[" + t.clientId + "]" + n.getTime() + ": Starting ICE in responder"),
  11097. t.iceStarted = !0
  11098. }
  11099. }), (function(e) {
  11100. u.
  11101. default.debug("[" + t.clientId + "]peer connection create answer failed ", e)
  11102. }), t.mediaConstraints);
  11103. else if ("offer-received-preparing-answer" === t.state) {
  11104. if (t.moreIceComing) return;
  11105. n = t.peerConnection.localDescription.sdp,
  11106. t.sendMessage("ANSWER", n),
  11107. t.state = "established"
  11108. } else t.debug("Dazed and confused in state " + t.state + ", stopping here");
  11109. t.actionNeeded = !1
  11110. }
  11111. },
  11112. t.sendMessage = function(e, n) {
  11113. var r = {};
  11114. r.messageType = e,
  11115. r.sdp = n,
  11116. "OFFER" === e ? (r.offererSessionId = t.sessionId, r.answererSessionId = t.otherSessionId, r.seq = t.sequenceNumber += 1, r.tiebreaker = Math.floor(429496723 * Math.random() + 1)) : (r.offererSessionId = t.incomingMessage.offererSessionId, r.answererSessionId = t.sessionId, r.seq = t.incomingMessage.seq),
  11117. t.onsignalingmessage(JSON.stringify(r))
  11118. },
  11119. t._getSender = function(e) {
  11120. if (t.peerConnection && t.peerConnection.getSenders) {
  11121. var n = t.peerConnection.getSenders().find((function(t) {
  11122. return t.track.kind == e
  11123. }));
  11124. if (n) return n
  11125. }
  11126. return null
  11127. },
  11128. t.hasSender = function(e) {
  11129. return !! t._getSender(e)
  11130. },
  11131. t.replaceTrack = function(e, n, r) {
  11132. var i = t._getSender(e.kind);
  11133. if (!i) {
  11134. return r("NO_SENDER_FOUND")
  11135. }
  11136. try {
  11137. i.replaceTrack(e)
  11138. } catch(e) {
  11139. return r && r(e)
  11140. }
  11141. setTimeout((function() {
  11142. return n && n()
  11143. }), 50)
  11144. },
  11145. t.error = function(e) {
  11146. throw "Error in RoapOnJsep: " + e
  11147. },
  11148. t.sessionId = t.roapSessionId += 1,
  11149. t.sequenceNumber = 0,
  11150. t.actionNeeded = !1,
  11151. t.iceStarted = !1,
  11152. t.moreIceComing = !0,
  11153. t.iceCandidateCount = 0,
  11154. t.onsignalingmessage = e.callback,
  11155. t.peerConnection.ontrack = function(e) {
  11156. console.log("!!! ontrack, ", e.track.kind, e.track),
  11157. t.onaddstream && t.onaddstream(e, "ontrack")
  11158. },
  11159. t.peerConnection.onremovestream = function(e) {
  11160. t.onremovestream && t.onremovestream(e)
  11161. },
  11162. t.peerConnection.oniceconnectionstatechange = function(e) {
  11163. "connected" === e.currentTarget.iceConnectionState && (t.connectedTime = new Date),
  11164. t.oniceconnectionstatechange && t.oniceconnectionstatechange(e.currentTarget.iceConnectionState)
  11165. },
  11166. t.renegotiate = function() {
  11167. void 0 !== t.prevOffer && t.peerConnection.createOffer().then((function(e) {
  11168. return e.sdp = e.sdp.replace(/a=recvonly\r\n/g, "a=inactive\r\n"),
  11169. e.sdp = r(e.sdp),
  11170. e.sdp = i(e.sdp),
  11171. t.peerConnection.setLocalDescription(e)
  11172. })).then((function() {
  11173. t.onnegotiationneeded && t.onnegotiationneeded(t.peerConnection.localDescription.sdp)
  11174. })).
  11175. catch((function(e) {
  11176. console.log("createOffer error: ", e)
  11177. }))
  11178. },
  11179. t.peerConnection.onnegotiationneeded = t.renegotiate,
  11180. t.onaddstream = null,
  11181. t.onremovestream = null,
  11182. t.state = "new",
  11183. t.markActionNeeded(),
  11184. t
  11185. };
  11186. function v(e) {
  11187. if ("undefined" == typeof Symbol || null == e[Symbol.iterator]) {
  11188. if (Array.isArray(e) || (e = function(e, t) {
  11189. if (!e) return;
  11190. if ("string" == typeof e) return E(e, t);
  11191. var n = Object.prototype.toString.call(e).slice(8, -1);
  11192. "Object" === n && e.constructor && (n = e.constructor.name);
  11193. if ("Map" === n || "Set" === n) return Array.from(n);
  11194. if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return E(e, t)
  11195. } (e))) {
  11196. var t = 0,
  11197. n = function() {};
  11198. return {
  11199. s: n,
  11200. n: function() {
  11201. return t >= e.length ? {
  11202. done: !0
  11203. }: {
  11204. done: !1,
  11205. value: e[t++]
  11206. }
  11207. },
  11208. e: function(e) {
  11209. throw e
  11210. },
  11211. f: n
  11212. }
  11213. }
  11214. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  11215. }
  11216. var r, i, o = !0,
  11217. a = !1;
  11218. return {
  11219. s: function() {
  11220. r = e[Symbol.iterator]()
  11221. },
  11222. n: function() {
  11223. var e = r.next();
  11224. return o = e.done,
  11225. e
  11226. },
  11227. e: function(e) {
  11228. a = !0,
  11229. i = e
  11230. },
  11231. f: function() {
  11232. try {
  11233. o || null == r.
  11234. return || r.
  11235. return ()
  11236. } finally {
  11237. if (a) throw i
  11238. }
  11239. }
  11240. }
  11241. }
  11242. function E(e, t) { (null == t || t > e.length) && (t = e.length);
  11243. for (var n = 0,
  11244. r = new Array(t); n < t; n++) r[n] = e[n];
  11245. return r
  11246. }
  11247. var _ = function(e) {
  11248. var t = {},
  11249. n = (mozRTCPeerConnection, mozRTCSessionDescription),
  11250. r = !1;
  11251. t.uid = e.uid,
  11252. t.isVideoMute = e.isVideoMute,
  11253. t.isAudioMute = e.isAudioMute,
  11254. t.isSubscriber = e.isSubscriber,
  11255. t.clientId = e.clientId,
  11256. t.filterStatsCache = [],
  11257. t.originStatsCache = [],
  11258. t.lastTimeGetStats = null,
  11259. t.pc_config = {
  11260. iceServers: []
  11261. },
  11262. e.iceServers instanceof Array ? e.iceServers.map((function(e) {
  11263. 0 === e.url.indexOf("stun:") && t.pc_config.iceServers.push({
  11264. url: e.url
  11265. })
  11266. })) : (e.stunServerUrl && (e.stunServerUrl instanceof Array ? e.stunServerUrl.map((function(e) {
  11267. "string" == typeof e && "" !== e && t.pc_config.iceServers.push({
  11268. url: e
  11269. })
  11270. })) : "string" == typeof e.stunServerUrl && "" !== e.stunServerUrl && t.pc_config.iceServers.push({
  11271. url: e.stunServerUrl
  11272. })), e.turnServers && (e.turnServers instanceof Array ? e.turnServers.map((function(e) {
  11273. e.udpport && t.pc_config.iceServers.push({
  11274. username: e.username,
  11275. credential: e.credential,
  11276. credentialType: "password",
  11277. urls: "turn:" + e.url + ":" + e.udpport + "?transport=udp"
  11278. }),
  11279. "string" == typeof e.tcpport && "" !== e.tcpport && t.pc_config.iceServers.push({
  11280. username: e.username,
  11281. credential: e.credential,
  11282. credentialType: "password",
  11283. urls: "turn:" + e.url + ":" + e.tcpport + "?transport=tcp"
  11284. }),
  11285. !0 === e.forceturn && (t.pc_config.iceTransportPolicy = "relay")
  11286. })) : u.
  11287. default.error("[".concat(t.clientId, "] turnServers is not a array")))),
  11288. void 0 === e.audio && (e.audio = !0),
  11289. void 0 === e.video && (e.video = !0),
  11290. t.mediaConstraints = {
  11291. offerToReceiveAudio: e.audio,
  11292. offerToReceiveVideo: e.video,
  11293. mozDontOfferDataChannel: !0
  11294. },
  11295. t.roapSessionId = 103,
  11296. t.peerConnection = new l.RTCPeerConnection(t.pc_config),
  11297. t.iceCandidateTimer = setTimeout((function() {
  11298. t.iceCandidateTimer = null,
  11299. u.
  11300. default.debug("[".concat(t.clientId, "]Candidates collected: ").concat(t.iceCandidateCount)),
  11301. t.moreIceComing && (t.moreIceComing = !1, t.markActionNeeded())
  11302. }), Object(p.getParameter)("CANDIDATE_TIMEOUT")),
  11303. t.peerConnection.onicecandidate = function(e) {
  11304. var n, r, i, o;
  11305. r = (n = t.peerConnection.localDescription.sdp).match(/a=candidate:.+typ\ssrflx.+\r\n/),
  11306. i = n.match(/a=candidate:.+typ\shost.+\r\n/),
  11307. o = n.match(/a=candidate:.+typ\srelay.+\r\n/),
  11308. null === r && null === i && null === o || void 0 !== t.ice || !t.iceCandidateTimer || (clearTimeout(t.iceCandidateTimer), t.iceCandidateTimer = null, t.ice = 0, t.moreIceComing = !1, t.markActionNeeded()),
  11309. t.iceCandidateCount = t.iceCandidateCount + 1
  11310. },
  11311. t.checkMLineReverseInSDP = function(e) {
  11312. return ! (!~e.indexOf("m=audio") || !~e.indexOf("m=video")) && e.indexOf("m=audio") > e.indexOf("m=video")
  11313. },
  11314. t.reverseMLineInSDP = function(e) {
  11315. var t = e.split("m=audio"),
  11316. n = t[1].split("m=video"),
  11317. r = "m=video" + n[1],
  11318. i = "m=audio" + n[0];
  11319. return e = t[0] + r + i
  11320. },
  11321. t.processSignalingMessage = function(r) {
  11322. var i, o = JSON.parse(r);
  11323. t.incomingMessage = o,
  11324. "new" === t.state ? "OFFER" === o.messageType ? (o.sdp = h(o.sdp), i = {
  11325. sdp: o.sdp,
  11326. type: "offer"
  11327. },
  11328. t.peerConnection.setRemoteDescription(new n(i), (function() {
  11329. u.
  11330. default.debug("[" + t.clientId + "]setRemoteDescription succeeded")
  11331. }), (function(e) {
  11332. u.
  11333. default.info("[" + t.clientId + "]setRemoteDescription failed: " + e.name)
  11334. })), t.state = "offer-received", t.markActionNeeded()) : t.error("Illegal message for this state: " + o.messageType + " in state " + t.state) : "offer-sent" === t.state ? "ANSWER" === o.messageType ? (o.sdp = h(o.sdp), o.sdp = o.sdp.replace(/ generation 0/g, ""), o.sdp = o.sdp.replace(/ udp /g, " UDP "), -1 !== o.sdp.indexOf("a=group:BUNDLE") ? (o.sdp = o.sdp.replace(/a=group:BUNDLE audio video/, "a=group:BUNDLE sdparta_0 sdparta_1"), o.sdp = o.sdp.replace(/a=mid:audio/, "a=mid:sdparta_0"), o.sdp = o.sdp.replace(/a=mid:video/, "a=mid:sdparta_1")) : (o.sdp = o.sdp.replace(/a=mid:audio/, "a=mid:sdparta_0"), o.sdp = o.sdp.replace(/a=mid:video/, "a=mid:sdparta_0")), i = {
  11335. sdp: o.sdp,
  11336. type: "answer"
  11337. },
  11338. e.screen && "detail" === e.optimizationMode && (u.
  11339. default.debug("[".concat(t.client, "] remove screen share abs ext")), o.sdp = E(i.sdp)), t.peerConnection.setRemoteDescription(new n(i), (function() {
  11340. u.
  11341. default.debug("[" + t.clientId + "]setRemoteDescription succeeded")
  11342. }), (function(e) {
  11343. u.
  11344. default.info("[" + t.clientId + "]setRemoteDescription failed: " + e)
  11345. })), t.state = "established") : "pr-answer" === o.messageType ? (i = {
  11346. sdp: o.sdp,
  11347. type: "pr-answer"
  11348. },
  11349. t.peerConnection.setRemoteDescription(new n(i), (function() {
  11350. u.
  11351. default.debug("[" + t.clientId + "]setRemoteDescription succeeded")
  11352. }), (function(e) {
  11353. u.
  11354. default.info("[" + t.clientId + "]setRemoteDescription failed: " + e.name)
  11355. }))) : "offer" === o.messageType ? t.error("Not written yet") : t.error("Illegal message for this state: " + o.messageType + " in state " + t.state) : "established" === t.state && ("OFFER" === o.messageType ? (i = {
  11356. sdp: o.sdp,
  11357. type: "offer"
  11358. },
  11359. t.peerConnection.setRemoteDescription(new n(i), (function() {
  11360. u.
  11361. default.debug("[" + t.clientId + "]setRemoteDescription succeeded")
  11362. }), (function(e) {
  11363. u.
  11364. default.info("[" + t.clientId + "]setRemoteDescription failed: " + e.name)
  11365. })), t.state = "offer-received", t.markActionNeeded()) : t.error("Illegal message for this state: " + o.messageType + " in state " + t.state))
  11366. },
  11367. t.setRtpSenderParameters = function() {
  11368. var e = d()(s.a.mark((function e(n) {
  11369. var r, i, o;
  11370. return s.a.wrap((function(e) {
  11371. for (;;) switch (e.prev = e.next) {
  11372. case 0:
  11373. if (r = t.peerConnection.getSenders(), i = r.find((function(e) {
  11374. return "video" === e.track.kind
  11375. }))) {
  11376. e.next = 4;
  11377. break
  11378. }
  11379. return e.abrupt("return");
  11380. case 4:
  11381. return (o = i.getParameters()).degradationPreference = n,
  11382. e.prev = 6,
  11383. u.
  11384. default.debug("[".concat(t.clientId, "] setParameters"), o),
  11385. e.next = 10,
  11386. i.setParameters(o);
  11387. case 10:
  11388. e.next = 15;
  11389. break;
  11390. case 12:
  11391. e.prev = 12,
  11392. e.t0 = e.
  11393. catch(6),
  11394. u.
  11395. default.debug("[".concat(t.clientId, "] setParameters failed, ignore"));
  11396. case 15:
  11397. case "end":
  11398. return e.stop()
  11399. }
  11400. }), e, null, [[6, 12]])
  11401. })));
  11402. return function(t) {
  11403. return e.apply(this, arguments)
  11404. }
  11405. } ();
  11406. var i = {
  11407. id: "",
  11408. type: "",
  11409. mediaType: "opus",
  11410. googCodecName: "opus",
  11411. aecDivergentFilterFraction: "0",
  11412. audioInputLevel: "0",
  11413. bytesSent: "0",
  11414. packetsSent: "0",
  11415. googEchoCancellationReturnLoss: "0",
  11416. googEchoCancellationReturnLossEnhancement: "0"
  11417. },
  11418. o = {
  11419. id: "",
  11420. type: "",
  11421. mediaType: "",
  11422. googCodecName: "h264" === e.codec ? "H264": "VP8",
  11423. bytesSent: "0",
  11424. packetsLost: "0",
  11425. packetsSent: "0",
  11426. googAdaptationChanges: "0",
  11427. googAvgEncodeMs: "0",
  11428. googEncodeUsagePercent: "0",
  11429. googFirsReceived: "0",
  11430. googFrameHeightSent: "0",
  11431. googFrameHeightInput: "0",
  11432. googFrameRateInput: "0",
  11433. googFrameRateSent: "0",
  11434. googFrameWidthSent: "0",
  11435. googFrameWidthInput: "0",
  11436. googNacksReceived: "0",
  11437. googPlisReceived: "0",
  11438. googRtt: "0"
  11439. },
  11440. a = {
  11441. id: "",
  11442. type: "",
  11443. mediaType: "",
  11444. audioOutputLevel: "0",
  11445. bytesReceived: "0",
  11446. packetsLost: "0",
  11447. packetsReceived: "0",
  11448. googAccelerateRate: "0",
  11449. googCurrentDelayMs: "0",
  11450. googDecodingCNG: "0",
  11451. googDecodingCTN: "0",
  11452. googDecodingCTSG: "0",
  11453. googDecodingNormal: "0",
  11454. googDecodingPLC: "0",
  11455. googDecodingPLCCNG: "0",
  11456. googExpandRate: "0",
  11457. googJitterBufferMs: "0",
  11458. googJitterReceived: "0",
  11459. googPreemptiveExpandRate: "0",
  11460. googPreferredJitterBufferMs: "0",
  11461. googSecondaryDecodedRate: "0",
  11462. googSpeechExpandRate: "0"
  11463. },
  11464. c = {
  11465. id: "",
  11466. type: "",
  11467. mediaType: "",
  11468. googTargetDelayMs: "0",
  11469. packetsLost: "0",
  11470. googDecodeMs: "0",
  11471. googMaxDecodeMs: "0",
  11472. googRenderDelayMs: "0",
  11473. googFrameWidthReceived: "0",
  11474. googFrameHeightReceived: "0",
  11475. googFrameRateReceived: "0",
  11476. googFrameRateDecoded: "0",
  11477. googFrameRateOutput: "0",
  11478. googJitterBufferMs: "0",
  11479. googCurrentDelayMs: "0",
  11480. googMinPlayoutDelayMs: "0",
  11481. googNacksSent: "0",
  11482. googPlisSent: "0",
  11483. googFirsSent: "0",
  11484. bytesReceived: "0",
  11485. packetsReceived: "0",
  11486. googFramesDecoded: "0"
  11487. },
  11488. f = 0,
  11489. g = 0,
  11490. m = 0;
  11491. t.getVideoRelatedStats = function(e) {
  11492. t.peerConnection.getStats().then((function(n) {
  11493. var r, i = v(n.values());
  11494. try {
  11495. for (i.s(); ! (r = i.n()).done;) {
  11496. var o = r.value;
  11497. if (t.isSubscriber) {
  11498. if (("inbound-rtp" === o.type || "inboundrtp" === o.type) && "video" === o.mediaType) {
  11499. if (!t.lastReport) return void(t.lastReport = o);
  11500. e && e({
  11501. browser: "firefox",
  11502. mediaType: "video",
  11503. peerId: t.uid,
  11504. isVideoMute: t.isVideoMute,
  11505. frameRateReceived: Math.round(o.framerateMean) + "",
  11506. frameRateDecoded: o.framesDecoded - t.lastReport.framesDecoded + "",
  11507. bytesReceived: o.bytesReceived + "",
  11508. packetsReceived: o.packetsReceived + "",
  11509. packetsLost: o.packetsLost + ""
  11510. }),
  11511. t.lastReport = o
  11512. }
  11513. } else if (("outbound-rtp" === o.type || "outboundrtp" === o.type) && "video" === o.mediaType) {
  11514. if (!t.lastReport) return void(t.lastReport = o);
  11515. e && e({
  11516. mediaType: "video",
  11517. isVideoMute: t.isVideoMute,
  11518. frameRateInput: Math.round(o.framerateMean) + "",
  11519. frameRateSent: o.framesEncoded - t.lastReport.framesEncoded + ""
  11520. }),
  11521. t.lastReport = o
  11522. }
  11523. }
  11524. } catch(e) {
  11525. i.e(e)
  11526. } finally {
  11527. i.f()
  11528. }
  11529. }))
  11530. },
  11531. t.getAudioRelatedStats = function(e) {
  11532. t.peerConnection.getStats().then((function(n) {
  11533. var r, i = v(n.values());
  11534. try {
  11535. for (i.s(); ! (r = i.n()).done;) {
  11536. var o = r.value;
  11537. t.isSubscriber && ("inbound-rtp" !== o.type && "inboundrtp" !== o.type || "audio" !== o.mediaType || e && e({
  11538. browser: "firefox",
  11539. mediaType: "audio",
  11540. peerId: t.uid,
  11541. isAudioMute: t.isAudioMute,
  11542. frameDropped: o.packetsLost + "",
  11543. frameReceived: o.packetsReceived + "",
  11544. googJitterReceived: o.jitter + "",
  11545. bytesReceived: o.bytesReceived + "",
  11546. packetsReceived: o.packetsReceived + "",
  11547. packetsLost: o.packetsLost + ""
  11548. }))
  11549. }
  11550. } catch(e) {
  11551. i.e(e)
  11552. } finally {
  11553. i.f()
  11554. }
  11555. }))
  11556. },
  11557. t.getStatsRate = function(e) {
  11558. t.getStats((function(t) {
  11559. t.forEach((function(e) {})),
  11560. e(t)
  11561. }))
  11562. },
  11563. t.getStats = function(e, n) {
  11564. n = (n = n || 500) > 500 ? 500 : n,
  11565. t.lastTimeGetStats && Date.now() - t.lastTimeGetStats < n ? e && e(t.filterStatsCache, t.originStatsCache) : this._getStats((function(n, r) {
  11566. t.filterStatsCache = n,
  11567. t.originStatsCache = r,
  11568. t.lastTimeGetStats = Date.now(),
  11569. e && e(n, r)
  11570. }))
  11571. },
  11572. t._getStats = function(n) {
  11573. t.peerConnection.getStats().then((function(r) {
  11574. var s, d = [],
  11575. u = v(r.values());
  11576. try {
  11577. for (u.s(); ! (s = u.n()).done;) {
  11578. var l = s.value;
  11579. d.push(l),
  11580. "outbound-rtp" !== l.type && "outboundrtp" !== l.type || "video" !== l.mediaType || -1 !== l.id.indexOf("rtcp") || (o.id = l.id, o.type = l.type, o.mediaType = l.mediaType, o.bytesSent = l.bytesSent ? l.bytesSent + "": "0", o.packetsSent = l.packetsSent ? l.packetsSent + "": "0", o.googPlisReceived = l.pliCount ? l.pliCount + "": "0", o.googNacksReceived = l.nackCount ? l.nackCount + "": "0", o.googFirsReceived = l.firCount ? l.firCount + "": "0", o.googFrameRateSent = l.framerateMean ? Math.round(l.framerateMean) + "": "0"),
  11581. "outbound-rtp" !== l.type && "outboundrtp" !== l.type || "audio" !== l.mediaType || -1 !== l.id.indexOf("rtcp") || (i.id = l.id, i.type = l.type, i.mediaType = l.mediaType, i.bytesSent = l.bytesSent ? l.bytesSent + "": "0", i.packetsSent = l.packetsSent ? l.packetsSent + "": "0", e.agoraStream.local && (i.audioInputLevel = Math.round(32767 * e.agoraStream.getAudioLevel()).toString())),
  11582. "inbound-rtp" !== l.type && "inboundrtp" !== l.type || "audio" !== l.mediaType || l.isRemote || -1 !== l.id.indexOf("rtcp") || (a.id = l.id, a.type = l.type, a.mediaType = l.mediaType, a.bytesReceived = l.bytesReceived ? l.bytesReceived + "": "0", a.packetsLost = l.packetsLost ? l.packetsLost + "": "0", a.packetsReceived = l.packetsReceived ? l.packetsReceived + "": "0", a.googJitterReceived = l.jitter ? l.jitter + "": "0", e.agoraStream.local || (a.audioOutputLevel = Math.round(32767 * e.agoraStream.getAudioLevel()).toString())),
  11583. "inbound-rtp" !== l.type && "inboundrtp" !== l.type || "video" !== l.mediaType || l.isRemote || -1 !== l.id.indexOf("rtcp") || (c.id = l.id, c.type = l.type, c.mediaType = l.mediaType, c.bytesReceived = l.bytesReceived ? l.bytesReceived + "": "0", c.googFrameRateReceived = l.framerateMean ? Math.round(l.framerateMean) + "": "0", c.googFramesDecoded = l.framesDecoded ? l.framesDecoded + "": "0", Date.now() - m >= 1e3 ? (c.googFrameRateDecoded = (l.framesDecoded - f) / ((Date.now() - m) / 1e3), c.googFrameRateDecoded = Math.round(Math.max(0, c.googFrameRateDecoded)), m = Date.now(), g = c.googFrameRateDecoded, f = l.framesDecoded, c.googFrameRateDecoded = c.googFrameRateDecoded.toString()) : c.googFrameRateDecoded = g.toString(), c.packetsLost = l.packetsLost ? l.packetsLost + "": "0", c.packetsReceived = l.packetsReceived ? l.packetsReceived + "": "0", c.googJitterBufferMs = l.jitter ? l.jitter + "": "0", c.googNacksSent = l.nackCount ? l.nackCount + "": "0", c.googPlisSent = l.pliCount ? l.pliCount + "": "0", c.googFirsSent = l.firCount ? l.firCount + "": "0"),
  11584. -1 !== l.id.indexOf("outbound_rtcp_video") && (o.packetsLost = l.packetsLost ? l.packetsLost + "": "0")
  11585. }
  11586. } catch(e) {
  11587. u.e(e)
  11588. } finally {
  11589. u.f()
  11590. }
  11591. var p = [o, i, a, c];
  11592. p.push({
  11593. id: "time",
  11594. startTime: t.connectedTime,
  11595. timestamp: new Date
  11596. }),
  11597. n(p, d)
  11598. }), (function(e) {
  11599. u.
  11600. default.error("[" + t.clientId + "]" + e)
  11601. }))
  11602. },
  11603. t.addStream = function(e) {
  11604. r = !0,
  11605. t.peerConnection.addStream(e),
  11606. t.markActionNeeded()
  11607. },
  11608. t.removeStream = function() {
  11609. t.markActionNeeded()
  11610. },
  11611. t.close = function() {
  11612. t.state = "closed",
  11613. t.peerConnection.close()
  11614. },
  11615. t.markActionNeeded = function() {
  11616. t.actionNeeded = !0,
  11617. t.doLater((function() {
  11618. t.onstablestate()
  11619. }))
  11620. },
  11621. t.doLater = function(e) {
  11622. window.setTimeout(e, 1)
  11623. },
  11624. t.onstablestate = function() {
  11625. if (t.actionNeeded) {
  11626. if ("new" === t.state || "established" === t.state) {
  11627. r && (t.mediaConstraints = void 0),
  11628. t.peerConnection.createOffer((function(e) {
  11629. if (e.sdp = h(e.sdp), e.sdp = e.sdp.replace(/a=extmap:1 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time/, "a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"), e.sdp !== t.prevOffer) return t.peerConnection.setLocalDescription(e),
  11630. t.state = "preparing-offer",
  11631. void t.markActionNeeded();
  11632. u.
  11633. default.debug("[" + t.clientId + "]Not sending a new offer")
  11634. }), (function(e) {
  11635. u.
  11636. default.debug("[" + t.clientId + "]Ups! create offer failed ", e)
  11637. }), t.mediaConstraints)
  11638. } else if ("preparing-offer" === t.state) {
  11639. if (t.moreIceComing) return;
  11640. t.prevOffer = t.peerConnection.localDescription.sdp,
  11641. t.offerCandidates = t.prevOffer.match(/a=candidate.+\r\n/g) || [],
  11642. t.offerCandidates.length || (u.
  11643. default.warning("[".concat(t.clientId, "]No Ice Candidate generated")), Object(p.getParameter)("SHIM_CANDIDATE") ? (u.
  11644. default.debug("Shimming fake candidate"), t.prevOffer += "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n") : u.
  11645. default.error("[".concat(t.clientId, "]None Ice Candidate not allowed"))),
  11646. t.prevOffer = t.prevOffer.replace(/a=candidate:.+typ\shost.+\r\n/g, "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n"),
  11647. t.sendMessage("OFFER", t.prevOffer),
  11648. t.state = "offer-sent"
  11649. } else if ("offer-received" === t.state) t.peerConnection.createAnswer((function(e) {
  11650. if (t.peerConnection.setLocalDescription(e), t.state = "offer-received-preparing-answer", t.iceStarted) t.markActionNeeded();
  11651. else {
  11652. var n = new Date;
  11653. u.
  11654. default.debug("[" + t.clientId + "]" + n.getTime() + ": Starting ICE in responder"),
  11655. t.iceStarted = !0
  11656. }
  11657. }), (function() {
  11658. u.
  11659. default.debug("[" + t.clientId + "]Ups! Something went wrong")
  11660. }));
  11661. else if ("offer-received-preparing-answer" === t.state) {
  11662. if (t.moreIceComing) return;
  11663. var e = t.peerConnection.localDescription.sdp;
  11664. t.sendMessage("ANSWER", e),
  11665. t.state = "established"
  11666. } else t.debug("Dazed and confused in state " + t.state + ", stopping here");
  11667. t.actionNeeded = !1
  11668. }
  11669. },
  11670. t.sendMessage = function(e, n) {
  11671. var r = {};
  11672. r.messageType = e,
  11673. r.sdp = n,
  11674. "OFFER" === e ? (r.offererSessionId = t.sessionId, r.answererSessionId = t.otherSessionId, r.seq = t.sequenceNumber += 1, r.tiebreaker = Math.floor(429496723 * Math.random() + 1)) : (r.offererSessionId = t.incomingMessage.offererSessionId, r.answererSessionId = t.sessionId, r.seq = t.incomingMessage.seq),
  11675. t.onsignalingmessage(JSON.stringify(r))
  11676. },
  11677. t._getSender = function(e) {
  11678. if (t.peerConnection && t.peerConnection.getSenders) {
  11679. var n = t.peerConnection.getSenders().find((function(t) {
  11680. return t.track.kind == e
  11681. }));
  11682. if (n) return n
  11683. }
  11684. return null
  11685. },
  11686. t.hasSender = function(e) {
  11687. return !! t._getSender(e)
  11688. },
  11689. t.replaceTrack = function(e, n, r) {
  11690. var i = t._getSender(e.kind);
  11691. if (!i) {
  11692. return r("NO_SENDER_FOUND")
  11693. }
  11694. try {
  11695. i.replaceTrack(e)
  11696. } catch(e) {
  11697. return r && r(e)
  11698. }
  11699. setTimeout((function() {
  11700. return n && n()
  11701. }), 50)
  11702. },
  11703. t.error = function(e) {
  11704. throw "Error in RoapOnJsep: " + e
  11705. },
  11706. t.sessionId = t.roapSessionId += 1,
  11707. t.sequenceNumber = 0,
  11708. t.actionNeeded = !1,
  11709. t.iceStarted = !1,
  11710. t.moreIceComing = !0,
  11711. t.iceCandidateCount = 0,
  11712. t.onsignalingmessage = e.callback,
  11713. t.peerConnection.ontrack = function(e) {
  11714. t.onaddstream && t.onaddstream(e, "ontrack")
  11715. },
  11716. t.peerConnection.onremovestream = function(e) {
  11717. t.onremovestream && t.onremovestream(e)
  11718. },
  11719. t.peerConnection.oniceconnectionstatechange = function(e) {
  11720. "connected" === e.currentTarget.iceConnectionState && (t.connectedTime = new Date),
  11721. t.oniceconnectionstatechange && t.oniceconnectionstatechange(e.currentTarget.iceConnectionState)
  11722. };
  11723. var h = function(t) {
  11724. var n;
  11725. if (e.video && e.maxVideoBW && (null == (n = t.match(/m=video.*\r\n/)) && (n = t.match(/m=video.*\n/)), n && n.length > 0)) {
  11726. var r = n[0] + "b=TIAS:" + 1e3 * e.maxVideoBW + "\r\n";
  11727. t = t.replace(n[0], r)
  11728. }
  11729. if (e.audio && e.maxAudioBW && (null == (n = t.match(/m=audio.*\r\n/)) && (n = t.match(/m=audio.*\n/)), n && n.length > 0)) {
  11730. r = n[0] + "b=TIAS:" + 1e3 * e.maxAudioBW + "\r\n";
  11731. t = t.replace(n[0], r)
  11732. }
  11733. return t
  11734. },
  11735. E = function(e) {
  11736. return (e = e.replace(/a=.*abs-send-time\r\n/g, "")).replace(/a=.*goog-remb\r\n/g, "")
  11737. };
  11738. return t.onaddstream = null,
  11739. t.onremovestream = null,
  11740. t.state = "new",
  11741. t.markActionNeeded(),
  11742. t
  11743. },
  11744. S = n(48),
  11745. y = n.n(S),
  11746. R = n(25),
  11747. T = (n(5), 103),
  11748. I = function(e) {
  11749. var t = {};
  11750. if (t.clientId = e.clientId, e.session_id = T += 1, "undefined" == typeof window || !window.navigator) throw u.
  11751. default.error("[" + t.streamId + "][" + t.clientId + "]Publish/subscribe video/audio streams not supported yet"),
  11752. new Error("NON_BROWSER_ENV_DETECTED");
  11753. return null !== window.navigator.userAgent.match("Firefox") ? (t.browser = "mozilla", t = _(e)) : "iOS" === r.getBrowserOS() || r.isSafari() ? (u.
  11754. default.debug("[" + t.streamId + "][" + t.clientId + "]Safari"), (t = h(e)).browser = "safari") : ~window.navigator.userAgent.indexOf("Edge") ? t = new y.a(e) : (t = m(e)).browser = "chrome-stable",
  11755. t
  11756. },
  11757. A = function(e, t, n) {
  11758. var i = {};
  11759. i.config = e,
  11760. i.streamId = e.streamId,
  11761. delete e.streamId,
  11762. navigator.getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
  11763. var o = 0,
  11764. a = 1,
  11765. s = !1,
  11766. c = null,
  11767. d = function(e) {
  11768. if (o++, c) if (c === e) u.
  11769. default.debug("Using Video Source/ Audio Source");
  11770. else {
  11771. var n = c.getVideoTracks()[0],
  11772. r = c.getAudioTracks()[0],
  11773. i = e.getVideoTracks()[0],
  11774. d = e.getAudioTracks()[0];
  11775. i && (n && c.removeTrack(n), c.addTrack(i)),
  11776. d && (r && c.removeTrack(r), c.addTrack(d))
  11777. } else c = e;
  11778. o !== a || s || (s = !0, setTimeout((function() {
  11779. t(c)
  11780. }), 0))
  11781. },
  11782. l = function(e) {
  11783. u.
  11784. default.error("Failed to GetUserMedia", e.name, e.code, e.message, e),
  11785. o++,
  11786. s || (s = !0, setTimeout((function() {
  11787. n && n(e)
  11788. }), 0))
  11789. },
  11790. p = function() {
  11791. var t = {
  11792. video: e.video,
  11793. audio: e.audio
  11794. };
  11795. if (u.
  11796. default.debug("GetUserMedia", JSON.stringify(t)), navigator.mediaDevices && navigator.mediaDevices.getUserMedia) navigator.mediaDevices.getUserMedia(t).then(d).
  11797. catch(l);
  11798. else if ("undefined" != typeof navigator && navigator.getMedia) navigator.getMedia(e, d, l);
  11799. else {
  11800. var r = {
  11801. name: "MEDIA_NOT_SUPPORT",
  11802. message: "Video/audio streams not supported yet"
  11803. };
  11804. u.
  11805. default.error("[" + i.streamId + "]" + r.message),
  11806. n && n(r)
  11807. }
  11808. };
  11809. if ((e.videoSource || e.audioSource) && (c = new MediaStream, e.videoSource && c.addTrack(e.videoSource), e.audioSource && c.addTrack(e.audioSource)), e.video || e.audio || e.screen || e.screenAudio) {
  11810. if (!e.screen && e.screenAudio) return n && n({
  11811. code: "Set screen to true before sharing the audio"
  11812. });
  11813. if (e.screen) {
  11814. if (R.a.isElectron()) return e.screen.sourceId ? R.a.getScreenStream(e.screen.sourceId, e.screen, (function(t, n) {
  11815. t ? l(t) : (e.audio && (a++, p()), d(n))
  11816. })) : R.a.shareScreen(e.screen, (function(t, n) {
  11817. t ? l(t) : (e.audio && (a++, p()), d(n))
  11818. }));
  11819. if (r.isFireFox()) {
  11820. u.
  11821. default.debug("[" + i.streamId + "]Screen access requested");
  11822. if (!~ ["screen", "window", "application"].indexOf(e.screen.mediaSource)) return n && n({
  11823. code: "Invalid mediaSource, mediaSource should be one of [screen, window, application]"
  11824. });
  11825. navigator.getMedia({
  11826. video: e.screen
  11827. },
  11828. (function(t) {
  11829. e.audio && (a++, p()),
  11830. d(t)
  11831. }), l)
  11832. } else if (r.isChromeKernel() && e.screen.extensionId) {
  11833. if (window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1] < 34) return void n({
  11834. code: "This browser does not support screen sharing"
  11835. });
  11836. u.
  11837. default.debug("[" + i.streamId + "]Screen access on chrome stable, looking for extension");
  11838. try {
  11839. chrome.runtime.sendMessage(e.screen.extensionId, {
  11840. getStream: !0
  11841. },
  11842. (function(t) {
  11843. if (void 0 === t) {
  11844. u.
  11845. default.error("[" + i.streamId + "]No response from Chrome Plugin. Plugin not installed properly");
  11846. l({
  11847. name: "PluginNotInstalledProperly",
  11848. message: "No response from Chrome Plugin. Plugin not installed properly."
  11849. })
  11850. } else e.screen.mandatory.chromeMediaSourceId = t.streamId,
  11851. navigator.getMedia({
  11852. video: e.screen
  11853. },
  11854. (function(t) {
  11855. e.audio && (a++, p()),
  11856. d(t)
  11857. }), l)
  11858. }))
  11859. } catch(e) {
  11860. u.
  11861. default.debug("[" + i.streamId + "]AgoraRTC screensharing plugin is not accessible");
  11862. return void n({
  11863. code: "no_plugin_present"
  11864. })
  11865. }
  11866. } else {
  11867. if (window.navigator.mediaDevices.getDisplayMedia) {
  11868. var f = {};
  11869. return "number" == typeof e.screen.width && "number" == typeof e.screen.height ? f.video = {
  11870. width: {
  11871. ideal: e.screen.width
  11872. },
  11873. height: {
  11874. ideal: e.screen.height
  11875. }
  11876. }: f.video = {
  11877. width: e.screen.width,
  11878. height: e.screen.height
  11879. },
  11880. e.screen.frameRate && e.screen.frameRate.min ? f.video.frameRate = {
  11881. ideal: e.screen.frameRate.max,
  11882. max: e.screen.frameRate.max
  11883. }: f.video.frameRate = e.screen.frameRate,
  11884. e.screenAudio && (f.audio = e.screenAudio),
  11885. u.
  11886. default.debug("use getDisplayMedia, constraints:", f),
  11887. window.navigator.mediaDevices.getDisplayMedia(f).then((function(t) { ! e.screenAudio && e.audio && (a++, p()),
  11888. d(t)
  11889. })).
  11890. catch(l)
  11891. }
  11892. u.
  11893. default.error("[" + i.streamId + "]This browser does not support screenSharing"),
  11894. n({
  11895. code: "This browser does not support screen sharing"
  11896. })
  11897. }
  11898. } else p()
  11899. } else d(c)
  11900. }
  11901. },
  11902. function(e, t, n) {
  11903. "use strict";
  11904. var r = this && this.__importDefault ||
  11905. function(e) {
  11906. return e && e.__esModule ? e: {
  11907. default:
  11908. e
  11909. }
  11910. };
  11911. Object.defineProperty(t, "__esModule", {
  11912. value: !0
  11913. });
  11914. var i = r(n(0)),
  11915. o = function() {
  11916. function e(e, t, n) {
  11917. void 0 === t && (t = ""),
  11918. this.name = "AgoraRTCException",
  11919. this.code = e,
  11920. this.message = "AgoraRTCError " + this.code + ": " + t,
  11921. this.data = n
  11922. }
  11923. return e.prototype.toString = function() {
  11924. return this.data ? this.message + " data: " + JSON.stringify(this.data) : this.message
  11925. },
  11926. e.prototype.
  11927. throw = function() {
  11928. throw i.
  11929. default.error(this.toString()),
  11930. this
  11931. },
  11932. e
  11933. } ();
  11934. t.AgoraRTCError = o,
  11935. function(e) {
  11936. e.UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
  11937. e.UNEXPECTED_RESPONSE = "UNEXPECTED_RESPONSE",
  11938. e.TIMEOUT = "TIMEOUT",
  11939. e.INVALID_PARAMS = "INVALID_PARAMS",
  11940. e.NOT_SUPPORT = "NOT_SUPPORT",
  11941. e.INVALID_OPERATION = "INVALID_OPERATION",
  11942. e.OPERATION_ABORT = "OPERATION_ABORT",
  11943. e.WEB_SECURITY_RESTRICT = "WEB_SECURITY_RESTRICT",
  11944. e.NETWORK_ERROR = "NETWORK_ERROR",
  11945. e.NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
  11946. e.NETWORK_RESPONSE_ERROR = "NETWORK_RESPONSE_ERROR",
  11947. e.API_INVOKE_TIMEOUT = "API_INVOKE_TIMEOUT",
  11948. e.ENUMERATE_DEVICES_FAILED = "ENUMERATE_DEVICES_FAILED",
  11949. e.DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
  11950. e.ELECTRON_IS_NULL = "ELECTRON_IS_NULL",
  11951. e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",
  11952. e.STREAM_ALREADY_INITIALIZED = "STREAM_ALREADY_INITIALIZED",
  11953. e.STREAM_IS_CLOSED = "STREAM_IS_CLOSED",
  11954. e.ABORT_OTHER_INIT = "ABORT_OTHER_INIT",
  11955. e.CHROME_PLUGIN_NO_RESPONSE = "CHROME_PLUGIN_NO_RESPONSE",
  11956. e.CHROME_PLUGIN_NOT_INSTALL = "CHROME_PLUGIN_NOT_INSTALL",
  11957. e.MEDIA_OPTION_INVALID = "MEDIA_OPTION_INVALID",
  11958. e.PERMISSION_DENIED = "PERMISSION_DENIED",
  11959. e.CONSTRAINT_NOT_SATISFIED = "CONSTRAINT_NOT_SATISFIED",
  11960. e.CAN_NOT_AUTOPLAY = "CAN_NOT_AUTOPLAY",
  11961. e.HIGH_STREAM_NO_VIDEO_TRACK = "HIGH_STREAM_NO_VIDEO_TRACK",
  11962. e.SCREEN_SHARE_CAN_NOT_CREATE_LOW_STREAM = "SCREEN_SHARE_CAN_NOT_CREATE_LOW_STREAM",
  11963. e.TRACK_IS_DISABLED = "TRACK_IS_DISABLED",
  11964. e.SHARE_AUDIO_NOT_ALLOWED = "SHARE_AUDIO_NOT_ALLOWED",
  11965. e.TOKEN_GENERATOR_FUNCTION_ERROR = "TOKEN_GENERATOR_FUNCTION_ERROR",
  11966. e.INVALID_UINT_UID_FROM_STRING_UID = "INVALID_UINT_UID_FROM_STRING_UID",
  11967. e.CAN_NOT_GET_PROXY_SERVER = "CAN_NOT_GET_PROXY_SERVER",
  11968. e.CAN_NOT_GET_GATEWAY_SERVER = "CAN_NOT_GET_GATEWAY_SERVER",
  11969. e.UID_CONFLICT = "UID_CONFLICT",
  11970. e.INVALID_LOCAL_TRACK = "INVALID_LOCAL_TRACK",
  11971. e.INVALID_TRACK = "INVALID_TRACK",
  11972. e.SENDER_NOT_FOUND = "SENDER_NOT_FOUND",
  11973. e.CREATE_OFFER_FAILED = "CREATE_OFFER_FAILED",
  11974. e.SET_ANSWER_FAILED = "SET_ANSWER_FAILED",
  11975. e.ICE_FAILED = "ICE_FAILED",
  11976. e.PC_CLOSED = "PC_CLOSED",
  11977. e.SENDER_REPLACE_FAILED = "SENDER_REPLACE_FAILED",
  11978. e.GATEWAY_P2P_LOST = "GATEWAY_P2P_LOST",
  11979. e.NO_ICE_CANDIDATE = "NO_ICE_CANDIDATE",
  11980. e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",
  11981. e.INVALID_REMOTE_USER = "INVALID_REMOTE_USER",
  11982. e.REMOTE_USER_IS_NOT_PUBLISHED = "REMOTE_USER_IS_NOT_PUBLISHED",
  11983. e.SUBSCRIPTION_IS_IN_PROGRESS = "SUBSCRIPTION_IS_IN_PROGRESS",
  11984. e.CUSTOM_REPORT_SEND_FAILED = "CUSTOM_REPORT_SEND_FAILED",
  11985. e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH",
  11986. e.FETCH_AUDIO_FILE_FAILED = "FETCH_AUDIO_FILE_FAILED",
  11987. e.READ_LOCAL_AUDIO_FILE_ERROR = "READ_LOCAL_AUDIO_FILE_ERROR",
  11988. e.DECODE_AUDIO_FILE_FAILED = "DECODE_AUDIO_FILE_FAILED",
  11989. e.EFFECT_ID_CONFLICTED = "EFFECT_ID_CONFLICTED",
  11990. e.EFFECT_SOUND_ID_NOT_FOUND = "EFFECT_SOUND_ID_NOT_FOUND",
  11991. e.WS_ABORT = "WS_ABORT",
  11992. e.WS_DISCONNECT = "WS_DISCONNECT",
  11993. e.WS_ERR = "WS_ERR",
  11994. e.CAN_NOT_CONNECT_TO_LIVE_STREAMING_WORKER = "CAN_NOT_CONNECT_TO_LIVE_STREAMING_WORKER",
  11995. e.LIVE_STREAMING_TASK_CONFLICT = "LIVE_STREAMING_TASK_CONFLICT",
  11996. e.LIVE_STREAMING_INVALID_ARGUMENT = "LIVE_STREAMING_INVALID_ARGUMENT",
  11997. e.LIVE_STREAMING_INTERNAL_SERVER_ERROR = "LIVE_STREAMING_INTERNAL_SERVER_ERROR",
  11998. e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",
  11999. e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORT = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORT",
  12000. e.LIVE_STREAMING_CDN_ERROR = "LIVE_STREAMING_CDN_ERROR",
  12001. e.LIVE_STREAMING_INVALID_RAW_STREAM = "LIVE_STREAMING_INVALID_RAW_STREAM",
  12002. e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",
  12003. e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",
  12004. e.LIVE_STREAMING_WARN_FREQUENT_REQUEST = "LIVE_STREAMING_WARN_FREQUENT_REQUEST",
  12005. e.WEBGL_INTERNAL_ERROR = "WEBGL_INTERNAL_ERROR",
  12006. e.BEAUTY_PROCESSOR_INTERNAL_ERROR = "BEAUTY_PROCESSOR_INTERNAL_ERROR",
  12007. e.CROSS_CHANNEL_WAIT_STATUS_ERROR = "CROSS_CHANNEL_WAIT_STATUS_ERROR",
  12008. e.CROSS_CHANNEL_FAILED_JOIN_SRC = "CROSS_CHANNEL_FAILED_JOIN_SEC",
  12009. e.CROSS_CHANNEL_FAILED_JOIN_DEST = "CROSS_CHANNEL_FAILED_JOIN_DEST",
  12010. e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",
  12011. e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE",
  12012. e.METADATA_OUT_OF_RANGE = "METADATA_OUT_OF_RANGE"
  12013. } (t.AgoraRTCErrorCode || (t.AgoraRTCErrorCode = {}))
  12014. },
  12015. function(e, t, n) {
  12016. "use strict";
  12017. n.d(t, "a", (function() {
  12018. return c
  12019. }));
  12020. var r = n(0),
  12021. i = window.AudioContext || window.webkitAudioContext,
  12022. o = n(3),
  12023. a = o.getParameter,
  12024. s = o.setParameter,
  12025. c = function() {
  12026. return a("AUDIO_CONTEXT") || (console.log("Creating Audio Context"), s("AUDIO_CONTEXT",
  12027. function() {
  12028. if (i) {
  12029. var e = new i;
  12030. return window.ctx = e,
  12031. new Promise((function(e) {
  12032. document.body ? e() : window.addEventListener("load", e)
  12033. })).then((function() {
  12034. var t = function t() {
  12035. "suspended" == e.state ? (r.
  12036. default.debug("AudioContext is suspended, auto resume"), e.resume().then((function() {
  12037. r.
  12038. default.debug("AudioContext resume success"),
  12039. document.body.removeEventListener("touchend", t, !0),
  12040. document.body.removeEventListener("mousedown", t, !0)
  12041. }))) : (r.
  12042. default.debug("AudioContext is running"), document.body.removeEventListener("touchend", t, !0), document.body.removeEventListener("mousedown", t, !0))
  12043. };
  12044. r.
  12045. default.debug(">>> add event listener >>>>"),
  12046. document.body.addEventListener("touchend", t, !0),
  12047. document.body.addEventListener("mousedown", t, !0)
  12048. })),
  12049. e
  12050. }
  12051. throw new Error("AUDIO_CONTEXT_NOT_SUPPORTED")
  12052. } ())),
  12053. a("AUDIO_CONTEXT")
  12054. };
  12055. c()
  12056. },
  12057. function(e, t, n) {
  12058. "use strict";
  12059. var r = n(1),
  12060. i = null,
  12061. o = function() {
  12062. try {
  12063. i = window.require("electron")
  12064. } catch(e) {}
  12065. return i
  12066. },
  12067. a = function(e) {
  12068. var t = r.report.reportApiInvoke(null, {
  12069. callback: e,
  12070. name: "getScreenSources",
  12071. options: arguments,
  12072. tag: "tracer"
  12073. }),
  12074. n = o();
  12075. if (!n) return t && t("electron is null");
  12076. try {
  12077. var i = n.desktopCapturer.getSources({
  12078. types: ["window", "screen"]
  12079. })
  12080. } catch(e) {
  12081. console.log(e)
  12082. }
  12083. if (i instanceof Promise) console.log("electron.desktopCapturer.getSources return type is Promise"),
  12084. i.then((function(e) {
  12085. return t && t(null, e)
  12086. })).
  12087. catch((function(e) {
  12088. return t && t(e)
  12089. }));
  12090. else i = n.desktopCapturer.getSources({
  12091. types: ["window", "screen"]
  12092. },
  12093. (function(e, n) {
  12094. console.log("electron.desktopCapturer.getSources return type is callback"),
  12095. t && t(null, n)
  12096. }))
  12097. },
  12098. s = function(e, t, n) {
  12099. var r = t.width;
  12100. t = {
  12101. audio: !1,
  12102. video: {
  12103. mandatory: {
  12104. chromeMediaSource: "desktop",
  12105. chromeMediaSourceId: e,
  12106. maxHeight: t.height,
  12107. maxWidth: r,
  12108. maxFrameRate: t.frameRate && t.frameRate.max,
  12109. minFrameRate: t.frameRate && t.frameRate.min
  12110. }
  12111. }
  12112. };
  12113. navigator.webkitGetUserMedia(t, (function(e) {
  12114. n && n(null, e)
  12115. }), (function(e) {
  12116. n && n(e)
  12117. }))
  12118. };
  12119. t.a = {
  12120. isElectron: function() {
  12121. return !! o()
  12122. },
  12123. getElectronInstance: o,
  12124. getScreenSources: a,
  12125. getScreenStream: s,
  12126. shareScreen: function(e, t) {
  12127. a((function(n, r) {
  12128. if (n) return t && t(n); !
  12129. function(e, t) {
  12130. var n = document.createElement("div");
  12131. n.innerText = "share screen",
  12132. n.setAttribute("style", "text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");
  12133. var r = document.createElement("div");
  12134. r.setAttribute("style", "width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");
  12135. var i = document.createElement("div");
  12136. i.innerText = "Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",
  12137. i.setAttribute("style", "height: 12%;");
  12138. var o = document.createElement("div");
  12139. o.setAttribute("style", "width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");
  12140. var a = document.createElement("div");
  12141. a.setAttribute("style", "text-align: right; padding: 16px 0;");
  12142. var s = document.createElement("button");
  12143. s.innerHTML = "cancel",
  12144. s.setAttribute("style", "width: 85px;"),
  12145. s.onclick = function() {
  12146. document.body.removeChild(c),
  12147. t && t("NotAllowedError")
  12148. },
  12149. a.appendChild(s),
  12150. r.appendChild(i),
  12151. r.appendChild(o),
  12152. r.appendChild(a);
  12153. var c = document.createElement("div");
  12154. c.setAttribute("style", "position: absolute; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),
  12155. c.appendChild(n),
  12156. c.appendChild(r),
  12157. document.body.appendChild(c),
  12158. e.map((function(e) {
  12159. if (e.id) {
  12160. var n = document.createElement("div");
  12161. n.setAttribute("style", "width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;"),
  12162. n.innerHTML = '<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src=' + e.thumbnail.toDataURL() + ' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">' + e.name + "</span>",
  12163. n.onclick = function() {
  12164. document.body.removeChild(c),
  12165. t && t(null, e.id)
  12166. },
  12167. o.appendChild(n)
  12168. }
  12169. }))
  12170. } (r, (function(n, r) {
  12171. if (n) return t && t(n);
  12172. s(r, e, t)
  12173. }))
  12174. }))
  12175. }
  12176. }
  12177. },
  12178. function(e, t, n) {
  12179. "use strict";
  12180. Object.defineProperty(t, "__esModule", {
  12181. value: !0
  12182. });
  12183. var r = n(2); !
  12184. function(e) {
  12185. e.TRANSCODE = "mix_streaming",
  12186. e.RAW = "raw_streaming",
  12187. e.INJECT = "inject_streaming"
  12188. } (t.LiveStreamingServiceMode || (t.LiveStreamingServiceMode = {})),
  12189. t.DEFAULT_LIVE_STREAMING_TRANSCODING_USER = {
  12190. alpha: 1,
  12191. height: 640,
  12192. width: 360,
  12193. x: 0,
  12194. y: 0,
  12195. zOrder: 0,
  12196. audioChannel: 0
  12197. },
  12198. t.DEFAULT_LIVE_STREAMING_TRANSCODING_WATERMARK = {
  12199. x: 0,
  12200. y: 0,
  12201. width: 160,
  12202. height: 160,
  12203. zOrder: 255,
  12204. alpha: 1
  12205. },
  12206. t.isLiveStreamingTranscodingConfig = function(e) {
  12207. return r.isEmpty(e.width) || r.checkValidNumber(e.width, "config.width", 0),
  12208. r.isEmpty(e.height) || r.checkValidNumber(e.height, "config.height", 0),
  12209. r.isEmpty(e.videoBitrate) || r.checkValidNumber(e.videoBitrate, "config.videoBitrate", 1, 1e6),
  12210. r.isEmpty(e.videoFramerate) || r.checkValidNumber(e.videoFramerate, "config.videoFramerate"),
  12211. r.isEmpty(e.lowLatency) || r.checkValidBoolean(e.lowLatency, "config.lowLatency"),
  12212. r.isEmpty(e.audioSampleRate) || r.checkValidEnum(e.audioSampleRate, "config.audioSampleRate", [32e3, 44100, 48e3]),
  12213. r.isEmpty(e.audioBitrate) || r.checkValidNumber(e.audioBitrate, "config.audioBitrate", 1, 128),
  12214. r.isEmpty(e.audioChannels) || r.checkValidEnum(e.audioChannels, "config.audioChannels", [1, 2, 3, 4, 5]),
  12215. r.isEmpty(e.videoGop) || r.checkValidNumber(e.videoGop, "config.videoGop"),
  12216. r.isEmpty(e.videoCodecProfile) || r.checkValidEnum(e.videoCodecProfile, "config.videoCodecProfile", [66, 77, 100]),
  12217. r.isEmpty(e.userCount) || r.checkValidNumber(e.userCount, "config.userCount", 0, 17),
  12218. r.isEmpty(e.backgroundColor) || r.checkValidNumber(e.backgroundColor, "config.backgroundColor", 0, 16777215),
  12219. e.transcodingUsers && !r.isEmpty(e.transcodingUsers) && (r.checkValidArray(e.transcodingUsers, "config.transcodingUsers"), e.transcodingUsers.forEach((function(e, t) {
  12220. r.checkValidUID(e.uid),
  12221. r.isEmpty(e.x) || r.checkValidNumber(e.x, "transcodingUser[" + t + "].x", 0, 1e4),
  12222. r.isEmpty(e.y) || r.checkValidNumber(e.y, "transcodingUser[" + t + "].y", 0, 1e4),
  12223. r.isEmpty(e.width) || r.checkValidNumber(e.width, "transcodingUser[" + t + "].width", 0, 1e4),
  12224. r.isEmpty(e.height) || r.checkValidNumber(e.height, "transcodingUser[" + t + "].height", 0, 1e4),
  12225. r.isEmpty(e.zOrder) || r.checkValidNumber(e.zOrder - 1, "transcodingUser[" + t + "].zOrder", 0, 100),
  12226. r.isEmpty(e.alpha) || r.checkValidFloatNumber(e.alpha, "transcodingUser[" + t + "].alpha", 0, 1)
  12227. }))),
  12228. e.images && !r.isEmpty(e.images) && (r.checkValidArray(e.images, "config.images"), e.images.forEach((function(e, t) {
  12229. r.checkValidString(e.url, "images[" + t + "].url", 1, 1e3, !1),
  12230. r.isEmpty(e.x) || r.checkValidNumber(e.x, "images[" + t + "].x", 0, 1e4),
  12231. r.isEmpty(e.y) || r.checkValidNumber(e.y, "images[" + t + "].y", 0, 1e4),
  12232. r.isEmpty(e.width) || r.checkValidNumber(e.width, "images[" + t + "].width", 0, 1e4),
  12233. r.isEmpty(e.height) || r.checkValidNumber(e.height, "images[" + t + "].height", 0, 1e4),
  12234. r.isEmpty(e.zOrder) || r.checkValidNumber(e.zOrder, "images[" + t + "].zOrder", 0, 255),
  12235. r.isEmpty(e.alpha) || r.checkValidFloatNumber(e.alpha, "images[" + t + "].alpha", 0, 1)
  12236. }))),
  12237. !0
  12238. },
  12239. t.DEFAULT_TRANSCODING_CONFIG = {
  12240. audioBitrate: 48,
  12241. audioChannels: 1,
  12242. audioSampleRate: 48e3,
  12243. backgroundColor: 0,
  12244. height: 360,
  12245. lowLatency: !1,
  12246. videoBitrate: 400,
  12247. videoCodecProfile: 100,
  12248. videoCodecType: 1,
  12249. videoFramerate: 15,
  12250. videoGop: 30,
  12251. width: 640,
  12252. images: [],
  12253. userConfigs: [],
  12254. userConfigExtraInfo: ""
  12255. },
  12256. t.isInjectStreamConfig = function(e) {
  12257. return r.isEmpty(e.audioVolume) || r.checkValidNumber(e.audioVolume, "config.audioVolume", 0, 1e3),
  12258. r.isEmpty(e.audioBitrate) || r.checkValidNumber(e.audioBitrate, "config.audioBitrate", 1, 1e4),
  12259. r.isEmpty(e.audioChannels) || r.checkValidEnum(e.audioChannels, "config.audioChannels", [1, 2]),
  12260. r.isEmpty(e.audioSampleRate) || r.checkValidEnum(e.audioSampleRate, "config.audioSampleRate", [32e3, 44100, 48e3]),
  12261. r.isEmpty(e.width) || r.checkValidNumber(e.width, "config.width", 0, 1e4),
  12262. r.isEmpty(e.height) || r.checkValidNumber(e.height, "config.height", 0, 1e4),
  12263. r.isEmpty(e.videoBitrate) || r.checkValidNumber(e.videoBitrate, "config.videoBitrate", 1, 1e4),
  12264. r.isEmpty(e.videoFramerate) || r.checkValidNumber(e.videoFramerate, "config.videoFramerate", 1, 1e4),
  12265. r.isEmpty(e.videoGop) || r.checkValidNumber(e.videoGop, "config.videoGop", 1, 1e4),
  12266. !0
  12267. },
  12268. t.DEFAULT_INJECT_CONFIG = {
  12269. audioBitrate: 48,
  12270. audioChannels: 2,
  12271. audioVolume: 100,
  12272. audioSampleRate: 48e3,
  12273. height: 0,
  12274. width: 0,
  12275. videoBitrate: 400,
  12276. videoFramerate: 15,
  12277. videoGop: 30
  12278. },
  12279. function(e) {
  12280. e.WARNING = "@live_uap-warning",
  12281. e.ERROR = "@line_uap-error",
  12282. e.PUBLISH_STREAM_STATUS = "@live_uap-publish-status",
  12283. e.INJECT_STREAM_STATUS = "@live_uap-inject-status",
  12284. e.WORKER_STATUS = "@live_uap-worker-status",
  12285. e.REQUEST_NEW_ADDRESS = "@live_uap-request-address"
  12286. } (t.LiveStreamingUapSignalEvents || (t.LiveStreamingUapSignalEvents = {})),
  12287. function(e) {
  12288. e.REQUEST_WORKER_MANAGER_LIST = "@live_req_worker_manager"
  12289. } (t.LiveStreamingInternalEvents || (t.LiveStreamingInternalEvents = {})),
  12290. function(e) {
  12291. e[e.LIVE_STREAM_RESPONSE_SUCCEED = 200] = "LIVE_STREAM_RESPONSE_SUCCEED",
  12292. e[e.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM = 454] = "LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM",
  12293. e[e.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR = 450] = "LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR",
  12294. e[e.LIVE_STREAM_RESPONSE_BAD_STREAM = 451] = "LIVE_STREAM_RESPONSE_BAD_STREAM",
  12295. e[e.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR = 400] = "LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR",
  12296. e[e.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST = 404] = "LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST",
  12297. e[e.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED = 456] = "LIVE_STREAM_RESPONSE_NOT_AUTHORIZED",
  12298. e[e.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE = 457] = "LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE",
  12299. e[e.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN = 429] = "LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN",
  12300. e[e.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH = 452] = "LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH",
  12301. e[e.LIVE_STREAM_RESPONSE_NOT_SUPPORTED = 453] = "LIVE_STREAM_RESPONSE_NOT_SUPPORTED",
  12302. e[e.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM = 455] = "LIVE_STREAM_RESPONSE_MAX_STREAM_NUM",
  12303. e[e.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR = 500] = "LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR",
  12304. e[e.LIVE_STREAM_RESPONSE_WORKER_LOST = 501] = "LIVE_STREAM_RESPONSE_WORKER_LOST",
  12305. e[e.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT = 502] = "LIVE_STREAM_RESPONSE_RESOURCE_LIMIT",
  12306. e[e.LIVE_STREAM_RESPONSE_WORKER_QUIT = 503] = "LIVE_STREAM_RESPONSE_WORKER_QUIT",
  12307. e[e.ERROR_FAIL_SEND_MESSAGE = 504] = "ERROR_FAIL_SEND_MESSAGE",
  12308. e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE = 30] = "PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE",
  12309. e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT = 31] = "PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT",
  12310. e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH = 32] = "PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH",
  12311. e[e.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN = 33] = "PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN"
  12312. } (t.LIVE_STREAM_ERROR_CODE || (t.LIVE_STREAM_ERROR_CODE = {})),
  12313. function(e) {
  12314. e.CONNECTED = "websocket:connected",
  12315. e.RECONNECTING = "websocket:reconnecting",
  12316. e.WILL_RECONNECT = "websocket:will_reconnect",
  12317. e.CLOSED = "websocket:closed",
  12318. e.FAILED = "websocket:failed",
  12319. e.ON_MESSAGE = "websocket:on_message",
  12320. e.REQUEST_NEW_URLS = "websocket:request_new_urls"
  12321. } (t.WebSocketManagerEvents || (t.WebSocketManagerEvents = {}))
  12322. },
  12323. function(e, t, n) {
  12324. var r = n(54),
  12325. i = n(55);
  12326. e.exports = function(e, t, n) {
  12327. var o = t && n || 0;
  12328. "string" == typeof e && (t = "binary" === e ? new Array(16) : null, e = null);
  12329. var a = (e = e || {}).random || (e.rng || r)();
  12330. if (a[6] = 15 & a[6] | 64, a[8] = 63 & a[8] | 128, t) for (var s = 0; s < 16; ++s) t[o + s] = a[s];
  12331. return t || i(a)
  12332. }
  12333. },
  12334. function(e, t, n) {
  12335. "use strict";
  12336. var r = this && this.__importDefault ||
  12337. function(e) {
  12338. return e && e.__esModule ? e: {
  12339. default:
  12340. e
  12341. }
  12342. };
  12343. Object.defineProperty(t, "__esModule", {
  12344. value: !0
  12345. });
  12346. var i, o, a = r(n(0)); !
  12347. function(e) {
  12348. e.CHINA = "CHINA",
  12349. e.ASIA = "ASIA",
  12350. e.NORTH_AMERICA = "NORTH_AMERICA",
  12351. e.EUROPE = "EUROPE",
  12352. e.JAPAN = "JAPAN",
  12353. e.INDIA = "INDIA",
  12354. e.OCEANIA = "OCEANIA",
  12355. e.SOUTH_AMERICA = "SOUTH_AMERICA",
  12356. e.AFRICA = "AFRICA",
  12357. e.OVERSEA = "OVERSEA",
  12358. e.GLOBAL = "GLOBAL"
  12359. } (i || (i = {})),
  12360. t.AREAS = i,
  12361. function(e) {
  12362. e.CHINA = "CN",
  12363. e.ASIA = "AS",
  12364. e.NORTH_AMERICA = "NA",
  12365. e.EUROPE = "EU",
  12366. e.JAPAN = "JP",
  12367. e.INDIA = "IN",
  12368. e.OCEANIA = "OC",
  12369. e.SOUTH_AMERICA = "SA",
  12370. e.AFRICA = "AF",
  12371. e.OVERSEA = "OVERSEA",
  12372. e.GLOBAL = "GLOBAL"
  12373. } (o || (o = {}));
  12374. var s = {
  12375. ASIA: {
  12376. CODE: o.ASIA,
  12377. WEBCS_DOMAIN: ["ap-web-1-asia.agora.io"],
  12378. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-asia.agora.io"],
  12379. PROXY_CS: ["proxy-ap-web-asia.agora.io"],
  12380. CDS_AP: ["cds-ap-web-asia.agora.io", "cds-ap-web-asia2.agora.io"],
  12381. ACCOUNT_REGISTER: ["sua-ap-web-asia.agora.io", "sua-ap-web-asia2.agora.io"],
  12382. UAP_AP: ["uap-ap-web-asia.agora.io", "uap-ap-web-asia2.agora.io"],
  12383. EVENT_REPORT_DOMAIN: ["statscollector-1-asia.agora.io"],
  12384. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-asia.agora.io"],
  12385. LOG_UPLOAD_SERVER: ["logservice-asia.agora.io"]
  12386. },
  12387. NORTH_AMERICA: {
  12388. CODE: o.NORTH_AMERICA,
  12389. WEBCS_DOMAIN: ["ap-web-1-north-america.agora.io"],
  12390. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-north-america.agora.io"],
  12391. PROXY_CS: ["proxy-ap-web-america.agora.io"],
  12392. CDS_AP: ["cds-ap-web-america.agora.io", "cds-ap-web-america2.agora.io"],
  12393. ACCOUNT_REGISTER: ["sua-ap-web-america.agora.io", "sua-ap-web-america2.agora.io"],
  12394. UAP_AP: ["uap-ap-web-america.agora.io", "uap-ap-web-america2.agora.io"],
  12395. EVENT_REPORT_DOMAIN: ["statscollector-1-north-america.agora.io"],
  12396. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-north-america.agora.io"],
  12397. LOG_UPLOAD_SERVER: ["logservice-north-america.agora.io"]
  12398. },
  12399. EUROPE: {
  12400. CODE: o.EUROPE,
  12401. WEBCS_DOMAIN: ["ap-web-1-europe.agora.io"],
  12402. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-europe.agora.io"],
  12403. PROXY_CS: ["proxy-ap-web-europe.agora.io"],
  12404. CDS_AP: ["cds-ap-web-europe.agora.io", "cds-ap-web-europe2.agora.io"],
  12405. ACCOUNT_REGISTER: ["sua-ap-web-europe.agora.io", "sua-ap-web-europe.agora.io"],
  12406. UAP_AP: ["uap-ap-web-europe.agora.io", "uap-ap-web-europe2.agora.io"],
  12407. EVENT_REPORT_DOMAIN: ["statscollector-1-europe.agora.io"],
  12408. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-europe.agora.io"],
  12409. LOG_UPLOAD_SERVER: ["logservice-europe.agora.io"]
  12410. },
  12411. JAPAN: {
  12412. CODE: o.JAPAN,
  12413. WEBCS_DOMAIN: ["ap-web-1-japan.agora.io"],
  12414. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-japan.agora.io"],
  12415. PROXY_CS: ["proxy-ap-web-japan.agora.io"],
  12416. CDS_AP: ["cds-ap-web-japan.agora.io", "cds-ap-web-japan2.agora.io"],
  12417. ACCOUNT_REGISTER: ["sua-ap-web-japan.agora.io", "sua-ap-web-japan2.agora.io"],
  12418. UAP_AP: ["uap-ap-web-japan.agora.io", "\tuap-ap-web-japan2.agora.io"],
  12419. EVENT_REPORT_DOMAIN: ["statscollector-1-japan.agora.io"],
  12420. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-japan.agora.io"],
  12421. LOG_UPLOAD_SERVER: ["logservice-japan.agora.io"]
  12422. },
  12423. INDIA: {
  12424. CODE: o.INDIA,
  12425. WEBCS_DOMAIN: ["ap-web-1-india.agora.io"],
  12426. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-india.agora.io"],
  12427. PROXY_CS: ["proxy-ap-web-india.agora.io"],
  12428. CDS_AP: ["cds-ap-web-india.agora.io", "cds-ap-web-india2.agora.io"],
  12429. ACCOUNT_REGISTER: ["sua-ap-web-india.agora.io", "sua-ap-web-india2.agora.io"],
  12430. UAP_AP: ["uap-ap-web-india.agora.io", "uap-ap-web-india2.agora.io"],
  12431. EVENT_REPORT_DOMAIN: ["statscollector-1-india.agora.io"],
  12432. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-india.agora.io"],
  12433. LOG_UPLOAD_SERVER: ["logservice-india.agora.io"]
  12434. },
  12435. OVERSEA: {
  12436. CODE: o.OVERSEA,
  12437. WEBCS_DOMAIN: ["ap-web-1-oversea.agora.io"],
  12438. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-oversea.agora.io"],
  12439. PROXY_CS: ["proxy-ap-web-oversea.agora.io"],
  12440. CDS_AP: ["cds-ap-web-oversea.agora.io"],
  12441. ACCOUNT_REGISTER: ["sua-ap-web-oversea.agora.io"],
  12442. UAP_AP: ["uap-ap-web-oversea.agora.io"],
  12443. EVENT_REPORT_DOMAIN: ["statscollector-1-oversea.agora.io"],
  12444. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-oversea.agora.io"],
  12445. LOG_UPLOAD_SERVER: ["logservice-oversea.agora.io"]
  12446. },
  12447. GLOBAL: {
  12448. CODE: o.GLOBAL,
  12449. WEBCS_DOMAIN: ["webrtc2-ap-web-1.agora.io"],
  12450. WEBCS_DOMAIN_BACKUP_LIST: ["webrtc2-ap-web-3.agora.io"],
  12451. PROXY_CS: ["ap-proxy-1.agora.io", "ap-proxy-2.agora.io"],
  12452. CDS_AP: ["cds-ap-web-1.agora.io", "cds-ap-web-3.agora.io"],
  12453. ACCOUNT_REGISTER: ["sua-ap-web-1.agora.io", "sua-ap-web-3.agora.io"],
  12454. UAP_AP: ["uap-ap-web-1.agora.io", "uap-ap-web-3.agora.io"],
  12455. EVENT_REPORT_DOMAIN: ["statscollector-1.agora.io"],
  12456. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2.agora.io"],
  12457. LOG_UPLOAD_SERVER: ["logservice.agora.io"]
  12458. },
  12459. OCEANIA: {
  12460. CODE: o.OCEANIA,
  12461. WEBCS_DOMAIN: ["ap-web-1-oceania.agora.io"],
  12462. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-oceania.agora.io"],
  12463. PROXY_CS: ["proxy-ap-web-oceania.agora.io"],
  12464. CDS_AP: ["cds-ap-web-oceania.agora.io", "cds-ap-web-oceania2.agora.io"],
  12465. ACCOUNT_REGISTER: ["sua-ap-web-oceania.agora.io", "sua-ap-web-oceania2.agora.io"],
  12466. UAP_AP: ["uap-ap-web-oceania.agora.io", "uap-ap-web-oceania2.agora.io"],
  12467. EVENT_REPORT_DOMAIN: ["statscollector-1-oceania.agora.io"],
  12468. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-oceania.agora.io"],
  12469. LOG_UPLOAD_SERVER: ["logservice-oceania.agora.io"]
  12470. },
  12471. SOUTH_AMERICA: {
  12472. CODE: o.SOUTH_AMERICA,
  12473. WEBCS_DOMAIN: ["ap-web-1-south-america.agora.io"],
  12474. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-south-america.agora.io"],
  12475. PROXY_CS: ["proxy-ap-web-south-america.agora.io"],
  12476. CDS_AP: ["cds-ap-web-south-america.agora.io", "cds-ap-web-south-america2.agora.io"],
  12477. ACCOUNT_REGISTER: ["sua-ap-web-south-america.agora.io", "sua-ap-web-south-america2.agora.io"],
  12478. UAP_AP: ["uap-ap-web-south-america.agora.io", "uap-ap-web-south-america2.agora.io"],
  12479. EVENT_REPORT_DOMAIN: ["statscollector-1-south-america.agora.io"],
  12480. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-south-america.agora.io"],
  12481. LOG_UPLOAD_SERVER: ["logservice-south-america.agora.io"]
  12482. },
  12483. AFRICA: {
  12484. CODE: o.AFRICA,
  12485. WEBCS_DOMAIN: ["ap-web-1-africa.agora.io"],
  12486. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-africa.agora.io"],
  12487. PROXY_CS: ["proxy-ap-web-africa.agora.io"],
  12488. CDS_AP: ["cds-ap-web-africa.agora.io", "cds-ap-web-africa2.agora.io"],
  12489. ACCOUNT_REGISTER: ["sua-ap-web-africa.agora.io", "sua-ap-web-africa2.agora.io"],
  12490. UAP_AP: ["uap-ap-web-africa.agora.io", "uap-ap-web-africa2.agora.io"],
  12491. EVENT_REPORT_DOMAIN: ["statscollector-1-africa.agora.io"],
  12492. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-africa.agora.io"],
  12493. LOG_UPLOAD_SERVER: ["logservice-south-africa.agora.io"]
  12494. }
  12495. };
  12496. t.AREA_DOMAIN_MAP = s,
  12497. s.CHINA = {
  12498. CODE: o.CHINA,
  12499. WEBCS_DOMAIN: ["webrtc2-ap-web-2.agoraio.cn"],
  12500. WEBCS_DOMAIN_BACKUP_LIST: ["webrtc2-ap-web-4.agoraio.cn"],
  12501. PROXY_CS: ["proxy-ap-web.agoraio.cn"],
  12502. CDS_AP: ["cds-ap-web-2.agoraio.cn", "cds-ap-web-4.agoraio.cn"],
  12503. ACCOUNT_REGISTER: ["sua-ap-web-2.agoraio.cn", "sua-ap-web-4.agoraio.cn"],
  12504. UAP_AP: ["uap-ap-web-2.agoraio.cn", "uap-ap-web-4.agoraio.cn"],
  12505. EVENT_REPORT_DOMAIN: ["statscollector-3.agoraio.cn"],
  12506. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-4.agoraio.cn"],
  12507. LOG_UPLOAD_SERVER: ["logservice-china.agora.io"]
  12508. };
  12509. t.getAreaCodeByWebCS = function(e) {
  12510. for (var t = Object.keys(s), n = 0; n < t.length; n++) {
  12511. var r = t[n],
  12512. i = s[r];
  12513. if (i.WEBCS_DOMAIN.includes(e) || i.WEBCS_DOMAIN_BACKUP_LIST.includes(e)) return i.CODE === o.OVERSEA ? o.ASIA + "," + o.EUROPE + "," + o.AFRICA + "," + o.NORTH_AMERICA + "," + o.SOUTH_AMERICA + "," + o.OCEANIA: i.CODE
  12514. }
  12515. };
  12516. t.getAreaDomainConfig = function(e) {
  12517. var t = {
  12518. WEBCS_DOMAIN: [],
  12519. WEBCS_DOMAIN_BACKUP_LIST: [],
  12520. PROXY_CS: [],
  12521. CDS_AP: [],
  12522. ACCOUNT_REGISTER: [],
  12523. UAP_AP: [],
  12524. EVENT_REPORT_DOMAIN: [],
  12525. EVENT_REPORT_BACKUP_DOMAIN: [],
  12526. LOG_UPLOAD_SERVER: []
  12527. };
  12528. return e.map((function(e) {
  12529. var n = s[e],
  12530. r = Object.keys(n);
  12531. r ? r.map((function(e) {
  12532. "CODE" !== e && (t[e] = t[e].concat(n[e]))
  12533. })) : a.
  12534. default.info(e + " is not exist")
  12535. })),
  12536. t
  12537. }
  12538. },
  12539. function(e, t, n) {
  12540. var r = n(68),
  12541. i = n(69),
  12542. o = n(31),
  12543. a = n(70);
  12544. e.exports = function(e) {
  12545. return r(e) || i(e) || o(e) || a()
  12546. }
  12547. },
  12548. function(e, t, n) {
  12549. "use strict";
  12550. var r = this && this.__importDefault ||
  12551. function(e) {
  12552. return e && e.__esModule ? e: {
  12553. default:
  12554. e
  12555. }
  12556. };
  12557. Object.defineProperty(t, "__esModule", {
  12558. value: !0
  12559. });
  12560. var i, o, a = r(n(0)); !
  12561. function(e) {
  12562. e.CHINA = "CHINA",
  12563. e.ASIA = "ASIA",
  12564. e.NORTH_AMERICA = "NORTH_AMERICA",
  12565. e.EUROPE = "EUROPE",
  12566. e.JAPAN = "JAPAN",
  12567. e.INDIA = "INDIA",
  12568. e.OCEANIA = "OCEANIA",
  12569. e.SOUTH_AMERICA = "SOUTH_AMERICA",
  12570. e.AFRICA = "AFRICA",
  12571. e.OVERSEA = "OVERSEA",
  12572. e.GLOBAL = "GLOBAL"
  12573. } (i || (i = {})),
  12574. t.AREAS = i,
  12575. function(e) {
  12576. e.CHINA = "CN",
  12577. e.ASIA = "AS",
  12578. e.NORTH_AMERICA = "NA",
  12579. e.EUROPE = "EU",
  12580. e.JAPAN = "JP",
  12581. e.INDIA = "IN",
  12582. e.OCEANIA = "OC",
  12583. e.SOUTH_AMERICA = "SA",
  12584. e.AFRICA = "AF",
  12585. e.OVERSEA = "OVERSEA",
  12586. e.GLOBAL = "GLOBAL"
  12587. } (o || (o = {}));
  12588. var s = {
  12589. ASIA: {
  12590. CODE: o.ASIA,
  12591. WEBCS_DOMAIN: ["ap-web-1-asia.agora.io"],
  12592. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-asia.agora.io"],
  12593. PROXY_CS: ["proxy-ap-web-asia.agora.io"],
  12594. CDS_AP: ["cds-ap-web-asia.agora.io", "cds-ap-web-asia2.agora.io"],
  12595. ACCOUNT_REGISTER: ["sua-ap-web-asia.agora.io", "sua-ap-web-asia2.agora.io"],
  12596. UAP_AP: ["uap-ap-web-asia.agora.io", "uap-ap-web-asia2.agora.io"],
  12597. EVENT_REPORT_DOMAIN: ["statscollector-1-asia.agora.io"],
  12598. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-asia.agora.io"],
  12599. LOG_UPLOAD_SERVER: ["logservice-asia.agora.io"]
  12600. },
  12601. NORTH_AMERICA: {
  12602. CODE: o.NORTH_AMERICA,
  12603. WEBCS_DOMAIN: ["ap-web-1-north-america.agora.io"],
  12604. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-north-america.agora.io"],
  12605. PROXY_CS: ["proxy-ap-web-america.agora.io"],
  12606. CDS_AP: ["cds-ap-web-america.agora.io", "cds-ap-web-america2.agora.io"],
  12607. ACCOUNT_REGISTER: ["sua-ap-web-america.agora.io", "sua-ap-web-america2.agora.io"],
  12608. UAP_AP: ["uap-ap-web-america.agora.io", "uap-ap-web-america2.agora.io"],
  12609. EVENT_REPORT_DOMAIN: ["statscollector-1-north-america.agora.io"],
  12610. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-north-america.agora.io"],
  12611. LOG_UPLOAD_SERVER: ["logservice-north-america.agora.io"]
  12612. },
  12613. EUROPE: {
  12614. CODE: o.EUROPE,
  12615. WEBCS_DOMAIN: ["ap-web-1-europe.agora.io"],
  12616. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-europe.agora.io"],
  12617. PROXY_CS: ["proxy-ap-web-europe.agora.io"],
  12618. CDS_AP: ["cds-ap-web-europe.agora.io", "cds-ap-web-europe2.agora.io"],
  12619. ACCOUNT_REGISTER: ["sua-ap-web-europe.agora.io", "sua-ap-web-europe.agora.io"],
  12620. UAP_AP: ["uap-ap-web-europe.agora.io", "uap-ap-web-europe2.agora.io"],
  12621. EVENT_REPORT_DOMAIN: ["statscollector-1-europe.agora.io"],
  12622. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-europe.agora.io"],
  12623. LOG_UPLOAD_SERVER: ["logservice-europe.agora.io"]
  12624. },
  12625. JAPAN: {
  12626. CODE: o.JAPAN,
  12627. WEBCS_DOMAIN: ["ap-web-1-japan.agora.io"],
  12628. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-japan.agora.io"],
  12629. PROXY_CS: ["proxy-ap-web-japan.agora.io"],
  12630. CDS_AP: ["cds-ap-web-japan.agora.io", "cds-ap-web-japan2.agora.io"],
  12631. ACCOUNT_REGISTER: ["sua-ap-web-japan.agora.io", "sua-ap-web-japan2.agora.io"],
  12632. UAP_AP: ["uap-ap-web-japan.agora.io", "\tuap-ap-web-japan2.agora.io"],
  12633. EVENT_REPORT_DOMAIN: ["statscollector-1-japan.agora.io"],
  12634. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-japan.agora.io"],
  12635. LOG_UPLOAD_SERVER: ["logservice-japan.agora.io"]
  12636. },
  12637. INDIA: {
  12638. CODE: o.INDIA,
  12639. WEBCS_DOMAIN: ["ap-web-1-india.agora.io"],
  12640. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-india.agora.io"],
  12641. PROXY_CS: ["proxy-ap-web-india.agora.io"],
  12642. CDS_AP: ["cds-ap-web-india.agora.io", "cds-ap-web-india2.agora.io"],
  12643. ACCOUNT_REGISTER: ["sua-ap-web-india.agora.io", "sua-ap-web-india2.agora.io"],
  12644. UAP_AP: ["uap-ap-web-india.agora.io", "uap-ap-web-india2.agora.io"],
  12645. EVENT_REPORT_DOMAIN: ["statscollector-1-india.agora.io"],
  12646. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-india.agora.io"],
  12647. LOG_UPLOAD_SERVER: ["logservice-india.agora.io"]
  12648. },
  12649. OVERSEA: {
  12650. CODE: o.OVERSEA,
  12651. WEBCS_DOMAIN: ["ap-web-1-oversea.agora.io"],
  12652. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-oversea.agora.io"],
  12653. PROXY_CS: ["proxy-ap-web-oversea.agora.io"],
  12654. CDS_AP: ["cds-ap-web-oversea.agora.io"],
  12655. ACCOUNT_REGISTER: ["sua-ap-web-oversea.agora.io"],
  12656. UAP_AP: ["uap-ap-web-oversea.agora.io"],
  12657. EVENT_REPORT_DOMAIN: ["statscollector-1-oversea.agora.io"],
  12658. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-oversea.agora.io"],
  12659. LOG_UPLOAD_SERVER: ["logservice-oversea.agora.io"]
  12660. },
  12661. GLOBAL: {
  12662. CODE: o.GLOBAL,
  12663. WEBCS_DOMAIN: ["webrtc2-ap-web-1.agora.io"],
  12664. WEBCS_DOMAIN_BACKUP_LIST: ["webrtc2-ap-web-3.agora.io"],
  12665. PROXY_CS: ["ap-proxy-1.agora.io", "ap-proxy-2.agora.io"],
  12666. CDS_AP: ["cds-ap-web-1.agora.io", "cds-ap-web-3.agora.io"],
  12667. ACCOUNT_REGISTER: ["sua-ap-web-1.agora.io", "sua-ap-web-3.agora.io"],
  12668. UAP_AP: ["uap-ap-web-1.agora.io", "uap-ap-web-3.agora.io"],
  12669. EVENT_REPORT_DOMAIN: ["statscollector-1.agora.io"],
  12670. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2.agora.io"],
  12671. LOG_UPLOAD_SERVER: ["logservice.agora.io"]
  12672. },
  12673. OCEANIA: {
  12674. CODE: o.OCEANIA,
  12675. WEBCS_DOMAIN: ["ap-web-1-oceania.agora.io"],
  12676. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-oceania.agora.io"],
  12677. PROXY_CS: ["proxy-ap-web-oceania.agora.io"],
  12678. CDS_AP: ["cds-ap-web-oceania.agora.io", "cds-ap-web-oceania2.agora.io"],
  12679. ACCOUNT_REGISTER: ["sua-ap-web-oceania.agora.io", "sua-ap-web-oceania2.agora.io"],
  12680. UAP_AP: ["uap-ap-web-oceania.agora.io", "uap-ap-web-oceania2.agora.io"],
  12681. EVENT_REPORT_DOMAIN: ["statscollector-1-oceania.agora.io"],
  12682. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-oceania.agora.io"],
  12683. LOG_UPLOAD_SERVER: ["logservice-oceania.agora.io"]
  12684. },
  12685. SOUTH_AMERICA: {
  12686. CODE: o.SOUTH_AMERICA,
  12687. WEBCS_DOMAIN: ["ap-web-1-south-america.agora.io"],
  12688. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-south-america.agora.io"],
  12689. PROXY_CS: ["proxy-ap-web-south-america.agora.io"],
  12690. CDS_AP: ["cds-ap-web-south-america.agora.io", "cds-ap-web-south-america2.agora.io"],
  12691. ACCOUNT_REGISTER: ["sua-ap-web-south-america.agora.io", "sua-ap-web-south-america2.agora.io"],
  12692. UAP_AP: ["uap-ap-web-south-america.agora.io", "uap-ap-web-south-america2.agora.io"],
  12693. EVENT_REPORT_DOMAIN: ["statscollector-1-south-america.agora.io"],
  12694. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-south-america.agora.io"],
  12695. LOG_UPLOAD_SERVER: ["logservice-south-america.agora.io"]
  12696. },
  12697. AFRICA: {
  12698. CODE: o.AFRICA,
  12699. WEBCS_DOMAIN: ["ap-web-1-africa.agora.io"],
  12700. WEBCS_DOMAIN_BACKUP_LIST: ["ap-web-2-africa.agora.io"],
  12701. PROXY_CS: ["proxy-ap-web-africa.agora.io"],
  12702. CDS_AP: ["cds-ap-web-africa.agora.io", "cds-ap-web-africa2.agora.io"],
  12703. ACCOUNT_REGISTER: ["sua-ap-web-africa.agora.io", "sua-ap-web-africa2.agora.io"],
  12704. UAP_AP: ["uap-ap-web-africa.agora.io", "uap-ap-web-africa2.agora.io"],
  12705. EVENT_REPORT_DOMAIN: ["statscollector-1-africa.agora.io"],
  12706. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-2-africa.agora.io"],
  12707. LOG_UPLOAD_SERVER: ["logservice-south-africa.agora.io"]
  12708. }
  12709. };
  12710. t.AREA_DOMAIN_MAP = s,
  12711. s.CHINA = {
  12712. CODE: o.CHINA,
  12713. WEBCS_DOMAIN: ["webrtc2-ap-web-2.agoraio.cn"],
  12714. WEBCS_DOMAIN_BACKUP_LIST: ["webrtc2-ap-web-4.agoraio.cn"],
  12715. PROXY_CS: ["proxy-ap-web.agoraio.cn"],
  12716. CDS_AP: ["cds-ap-web-2.agoraio.cn", "cds-ap-web-4.agoraio.cn"],
  12717. ACCOUNT_REGISTER: ["sua-ap-web-2.agoraio.cn", "sua-ap-web-4.agoraio.cn"],
  12718. UAP_AP: ["uap-ap-web-2.agoraio.cn", "uap-ap-web-4.agoraio.cn"],
  12719. EVENT_REPORT_DOMAIN: ["statscollector-3.agoraio.cn"],
  12720. EVENT_REPORT_BACKUP_DOMAIN: ["statscollector-4.agoraio.cn"],
  12721. LOG_UPLOAD_SERVER: ["logservice-china.agora.io"]
  12722. };
  12723. t.getAreaCodeByWebCS = function(e) {
  12724. for (var t = Object.keys(s), n = 0; n < t.length; n++) {
  12725. var r = t[n],
  12726. i = s[r];
  12727. if (i.WEBCS_DOMAIN.includes(e) || i.WEBCS_DOMAIN_BACKUP_LIST.includes(e)) return i.CODE === o.OVERSEA ? o.ASIA + "," + o.EUROPE + "," + o.AFRICA + "," + o.NORTH_AMERICA + "," + o.SOUTH_AMERICA + "," + o.OCEANIA: i.CODE
  12728. }
  12729. };
  12730. t.getAreaDomainConfig = function(e) {
  12731. var t = {
  12732. WEBCS_DOMAIN: [],
  12733. WEBCS_DOMAIN_BACKUP_LIST: [],
  12734. PROXY_CS: [],
  12735. CDS_AP: [],
  12736. ACCOUNT_REGISTER: [],
  12737. UAP_AP: [],
  12738. EVENT_REPORT_DOMAIN: [],
  12739. EVENT_REPORT_BACKUP_DOMAIN: [],
  12740. LOG_UPLOAD_SERVER: []
  12741. };
  12742. return e.map((function(e) {
  12743. var n = s[e],
  12744. r = Object.keys(n);
  12745. r ? r.map((function(e) {
  12746. "CODE" !== e && (t[e] = t[e].concat(n[e]))
  12747. })) : a.
  12748. default.info(e + " is not exist")
  12749. })),
  12750. t
  12751. }
  12752. },
  12753. function(e, t, n) {
  12754. var r = n(32);
  12755. e.exports = function(e, t) {
  12756. if (e) {
  12757. if ("string" == typeof e) return r(e, t);
  12758. var n = Object.prototype.toString.call(e).slice(8, -1);
  12759. return "Object" === n && e.constructor && (n = e.constructor.name),
  12760. "Map" === n || "Set" === n ? Array.from(n) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? r(e, t) : void 0
  12761. }
  12762. }
  12763. },
  12764. function(e, t) {
  12765. e.exports = function(e, t) { (null == t || t > e.length) && (t = e.length);
  12766. for (var n = 0,
  12767. r = new Array(t); n < t; n++) r[n] = e[n];
  12768. return r
  12769. }
  12770. },
  12771. function(e, t, n) {
  12772. "use strict";
  12773. var r = this && this.__spreadArrays ||
  12774. function() {
  12775. for (var e = 0,
  12776. t = 0,
  12777. n = arguments.length; t < n; t++) e += arguments[t].length;
  12778. var r = Array(e),
  12779. i = 0;
  12780. for (t = 0; t < n; t++) for (var o = arguments[t], a = 0, s = o.length; a < s; a++, i++) r[i] = o[a];
  12781. return r
  12782. };
  12783. Object.defineProperty(t, "__esModule", {
  12784. value: !0
  12785. });
  12786. var i = n(23),
  12787. o = function() {
  12788. function e() {
  12789. this._events = {},
  12790. this.addListener = this.on
  12791. }
  12792. return e.prototype.getListeners = function(e) {
  12793. return this._events[e] ? this._events[e].map((function(e) {
  12794. return e.listener
  12795. })) : []
  12796. },
  12797. e.prototype.on = function(e, t) {
  12798. this._events[e] || (this._events[e] = []);
  12799. var n = this._events[e]; - 1 === this._indexOfListener(n, t) && n.push({
  12800. listener: t,
  12801. once: !1
  12802. })
  12803. },
  12804. e.prototype.once = function(e, t) {
  12805. this._events[e] || (this._events[e] = []);
  12806. var n = this._events[e]; - 1 === this._indexOfListener(n, t) && n.push({
  12807. listener: t,
  12808. once: !0
  12809. })
  12810. },
  12811. e.prototype.off = function(e, t) {
  12812. if (this._events[e]) {
  12813. var n = this._events[e],
  12814. r = this._indexOfListener(n, t); - 1 !== r && n.splice(r, 1),
  12815. 0 === this._events[e].length && delete this._events[e]
  12816. }
  12817. },
  12818. e.prototype.removeAllListeners = function(e) {
  12819. e ? delete this._events[e] : this._events = {}
  12820. },
  12821. e.prototype.emit = function(e) {
  12822. for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
  12823. this._events[e] || (this._events[e] = []);
  12824. for (var r = this._events[e].map((function(e) {
  12825. return e
  12826. })), i = 0; i < r.length; i += 1) {
  12827. var o = r[i];
  12828. o.once && this.off(e, o.listener),
  12829. o.listener.apply(this, t || [])
  12830. }
  12831. },
  12832. e.prototype._indexOfListener = function(e, t) {
  12833. for (var n = e.length; n--;) if (e[n].listener === t) return n;
  12834. return - 1
  12835. },
  12836. e
  12837. } ();
  12838. function a(e, t) {
  12839. for (var n = [], o = 2; o < arguments.length; o++) n[o - 2] = arguments[o];
  12840. var a = null,
  12841. s = null;
  12842. if (e.emit.apply(e, r([t], n, [function(e) {
  12843. a = e
  12844. },
  12845. function(e) {
  12846. s = e
  12847. }])), null !== s) throw s;
  12848. if (null === a) throw new i.AgoraRTCError(i.AgoraRTCErrorCode.UNEXPECTED_ERROR, "handler is not sync");
  12849. return a
  12850. }
  12851. t.EventEmitter = o,
  12852. t.emitAsPromise = function(e, t) {
  12853. for (var n = [], o = 2; o < arguments.length; o++) n[o - 2] = arguments[o];
  12854. return 0 === e.getListeners(t).length ? Promise.reject(new i.AgoraRTCError(i.AgoraRTCErrorCode.UNEXPECTED_ERROR, "can not emit promise")) : new Promise((function(i, o) {
  12855. e.emit.apply(e, r([t], n, [i, o]))
  12856. }))
  12857. },
  12858. t.emitAsInvokerNoResponse = function(e, t) {
  12859. for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
  12860. return 0 === e.getListeners(t).length ? null: a.apply(void 0, r([e, t], n))
  12861. },
  12862. t.emitAsInvoker = a
  12863. },
  12864. function(e, t, n) {
  12865. "use strict";
  12866. var r = this && this.__assign ||
  12867. function() {
  12868. return (r = Object.assign ||
  12869. function(e) {
  12870. for (var t, n = 1,
  12871. r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
  12872. return e
  12873. }).apply(this, arguments)
  12874. },
  12875. i = this && this.__awaiter ||
  12876. function(e, t, n, r) {
  12877. return new(n || (n = Promise))((function(i, o) {
  12878. function a(e) {
  12879. try {
  12880. c(r.next(e))
  12881. } catch(e) {
  12882. o(e)
  12883. }
  12884. }
  12885. function s(e) {
  12886. try {
  12887. c(r.
  12888. throw (e))
  12889. } catch(e) {
  12890. o(e)
  12891. }
  12892. }
  12893. function c(e) {
  12894. var t;
  12895. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  12896. e(t)
  12897. }))).then(a, s)
  12898. }
  12899. c((r = r.apply(e, t || [])).next())
  12900. }))
  12901. },
  12902. o = this && this.__generator ||
  12903. function(e, t) {
  12904. var n, r, i, o, a = {
  12905. label: 0,
  12906. sent: function() {
  12907. if (1 & i[0]) throw i[1];
  12908. return i[1]
  12909. },
  12910. trys: [],
  12911. ops: []
  12912. };
  12913. return o = {
  12914. next: s(0),
  12915. throw: s(1),
  12916. return: s(2)
  12917. },
  12918. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  12919. return this
  12920. }),
  12921. o;
  12922. function s(o) {
  12923. return function(s) {
  12924. return function(o) {
  12925. if (n) throw new TypeError("Generator is already executing.");
  12926. for (; a;) try {
  12927. if (n = 1, r && (i = 2 & o[0] ? r.
  12928. return: o[0] ? r.
  12929. throw || ((i = r.
  12930. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  12931. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  12932. case 0:
  12933. case 1:
  12934. i = o;
  12935. break;
  12936. case 4:
  12937. return a.label++,
  12938. {
  12939. value: o[1],
  12940. done: !1
  12941. };
  12942. case 5:
  12943. a.label++,
  12944. r = o[1],
  12945. o = [0];
  12946. continue;
  12947. case 7:
  12948. o = a.ops.pop(),
  12949. a.trys.pop();
  12950. continue;
  12951. default:
  12952. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  12953. a = 0;
  12954. continue
  12955. }
  12956. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  12957. a.label = o[1];
  12958. break
  12959. }
  12960. if (6 === o[0] && a.label < i[1]) {
  12961. a.label = i[1],
  12962. i = o;
  12963. break
  12964. }
  12965. if (i && a.label < i[2]) {
  12966. a.label = i[2],
  12967. a.ops.push(o);
  12968. break
  12969. }
  12970. i[2] && a.ops.pop(),
  12971. a.trys.pop();
  12972. continue
  12973. }
  12974. o = t.call(e, a)
  12975. } catch(e) {
  12976. o = [6, e],
  12977. r = 0
  12978. } finally {
  12979. n = i = 0
  12980. }
  12981. if (5 & o[0]) throw o[1];
  12982. return {
  12983. value: o[0] ? o[1] : void 0,
  12984. done: !0
  12985. }
  12986. } ([o, s])
  12987. }
  12988. }
  12989. },
  12990. a = this && this.__importDefault ||
  12991. function(e) {
  12992. return e && e.__esModule ? e: {
  12993. default:
  12994. e
  12995. }
  12996. };
  12997. Object.defineProperty(t, "__esModule", {
  12998. value: !0
  12999. });
  13000. var s = n(3),
  13001. c = a(n(35)),
  13002. d = n(23),
  13003. u = a(n(0)),
  13004. l = n(1);
  13005. function p(e) {
  13006. return new Promise((function(t) {
  13007. window.setTimeout(t, e)
  13008. }))
  13009. }
  13010. function f(e, t) {
  13011. return new Promise((function(n, r) {
  13012. t.timeout = t.timeout || s.getParameter("HTTP_CONNECT_TIMEOUT"),
  13013. t.responseType = t.responseType || "json",
  13014. t.data && (t.data = JSON.stringify(t.data)),
  13015. t.headers = t.headers || {},
  13016. t.headers["Content-Type"] = "application/json",
  13017. t.method = "POST",
  13018. t.url = e,
  13019. c.
  13020. default.request(t).then((function(e) {
  13021. n(e.data)
  13022. })).
  13023. catch((function(e) {
  13024. c.
  13025. default.isCancel(e) ? r(new d.AgoraRTCError(d.AgoraRTCErrorCode.OPERATION_ABORT, "cancel token canceled")) : "ECONNABORTED" === e.code ? r(new d.AgoraRTCError(d.AgoraRTCErrorCode.NETWORK_TIMEOUT, e.message)) : e.response ? r(new d.AgoraRTCError(d.AgoraRTCErrorCode.NETWORK_RESPONSE_ERROR, e.response.status)) : r(new d.AgoraRTCError(d.AgoraRTCErrorCode.NETWORK_ERROR, e.message))
  13026. }))
  13027. }))
  13028. }
  13029. function g(e, n, r, a) {
  13030. var s = this,
  13031. c = Object.assign({},
  13032. t.DEFAULT_RETRY_CONFIG, a),
  13033. u = c.timeout,
  13034. l = function() {
  13035. return i(s, void 0, void 0, (function() {
  13036. return o(this, (function(e) {
  13037. switch (e.label) {
  13038. case 0:
  13039. return [4, p(u)];
  13040. case 1:
  13041. return e.sent(),
  13042. u *= c.timeoutFactor,
  13043. u = Math.min(c.maxRetryTimeout, u),
  13044. [2]
  13045. }
  13046. }))
  13047. }))
  13048. },
  13049. f = !1,
  13050. g = new Promise((function(t, a) {
  13051. return i(s, void 0, void 0, (function() {
  13052. var i, s, u;
  13053. return o(this, (function(o) {
  13054. switch (o.label) {
  13055. case 0:
  13056. n = n ||
  13057. function() {
  13058. return ! 1
  13059. },
  13060. r = r ||
  13061. function() {
  13062. return ! 0
  13063. },
  13064. i = 0,
  13065. o.label = 1;
  13066. case 1:
  13067. if (! (i < c.maxRetryCount)) return [3, 12];
  13068. if (f) return [2, a(new d.AgoraRTCError(d.AgoraRTCErrorCode.OPERATION_ABORT))];
  13069. o.label = 2;
  13070. case 2:
  13071. return o.trys.push([2, 7, , 11]),
  13072. [4, e()];
  13073. case 3:
  13074. return s = o.sent(),
  13075. n(s, i) ? i + 1 === c.maxRetryCount ? [2, t(s)] : [4, l()] : [3, 5];
  13076. case 4:
  13077. return o.sent(),
  13078. [3, 6];
  13079. case 5:
  13080. return [2, t(s)];
  13081. case 6:
  13082. return [3, 11];
  13083. case 7:
  13084. return u = o.sent(),
  13085. r(u, i) ? i + 1 === c.maxRetryCount ? [2, a(u)] : [4, l()] : [3, 9];
  13086. case 8:
  13087. return o.sent(),
  13088. [3, 10];
  13089. case 9:
  13090. return [2, a(u)];
  13091. case 10:
  13092. return [3, 11];
  13093. case 11:
  13094. return i += 1,
  13095. [3, 1];
  13096. case 12:
  13097. return [2]
  13098. }
  13099. }))
  13100. }))
  13101. }));
  13102. return g.cancel = function() {
  13103. return f = !0
  13104. },
  13105. g
  13106. }
  13107. function m(e, t) {
  13108. return {
  13109. addressList: e.servers.map((function(e, n) {
  13110. return "wss://" + e.address.replace(/\./g, "-") + ".edge." + (n % 2 == 0 ? "agora.io": "agoraio.cn") + ":" + e.wss + "?serviceName=" + encodeURIComponent(t)
  13111. })),
  13112. workerToken: e.workerToken,
  13113. vid: e.vid
  13114. }
  13115. }
  13116. t.wait = p,
  13117. t.post = f,
  13118. t.DEFAULT_RETRY_CONFIG = {
  13119. timeout: 500,
  13120. timeoutFactor: 1.5,
  13121. maxRetryCount: 1 / 0,
  13122. maxRetryTimeout: 1e4
  13123. },
  13124. t.getRetryWaitTime = function(e, t) {
  13125. var n = t.timeout * Math.pow(t.timeoutFactor, e);
  13126. return Math.min(t.maxRetryTimeout, n)
  13127. },
  13128. t.retryable = g,
  13129. t.liveStreamingServerResponseToResult = m;
  13130. var h = 1;
  13131. function v(e, n, a, c, p) {
  13132. var v = this;
  13133. void 0 === p && (p = t.DEFAULT_RETRY_CONFIG),
  13134. h += 1;
  13135. var E, _, S = {
  13136. sid: a.sid,
  13137. command: "convergeAllocateEdge",
  13138. uid: "666",
  13139. appId: a.appId,
  13140. ts: Math.floor(Date.now() / 1e3),
  13141. seq: h,
  13142. requestId: h,
  13143. version: s.VERSION,
  13144. cname: a.cname
  13145. },
  13146. y = {
  13147. service_name: n,
  13148. json_body: JSON.stringify(S)
  13149. },
  13150. R = e[0];
  13151. return g((function() {
  13152. return i(v, void 0, void 0, (function() {
  13153. var e, t, i, a, l;
  13154. return o(this, (function(o) {
  13155. switch (o.label) {
  13156. case 0:
  13157. return E = Date.now(),
  13158. [4, f(R, {
  13159. data: y,
  13160. cancelToken: c,
  13161. headers: {
  13162. "X-Packet-Service-Type": "0",
  13163. "X-Packet-URI": "61"
  13164. }
  13165. })];
  13166. case 1:
  13167. if (e = o.sent(), _ = Date.now() - E, 0 !== e.code) throw i = new d.AgoraRTCError(d.AgoraRTCErrorCode.UNEXPECTED_RESPONSE, "live streaming ap error, code" + e.code, {
  13168. retry: !0
  13169. }),
  13170. u.
  13171. default.error(i.toString()),
  13172. i;
  13173. if (200 !== (t = JSON.parse(e.json_body)).code) throw i = new d.AgoraRTCError(d.AgoraRTCErrorCode.UNEXPECTED_RESPONSE, "live streaming app center error, code: " + t.code + ", reason: " + t.reason),
  13174. u.
  13175. default.error(i.toString()),
  13176. i;
  13177. if (!t.servers || 0 === t.servers.length) throw i = new d.AgoraRTCError(d.AgoraRTCErrorCode.UNEXPECTED_RESPONSE, "live streaming app center empty server"),
  13178. u.
  13179. default.error(i.toString()),
  13180. i;
  13181. if (a = m(t, n), s.getParameter("LIVE_STREAMING_ADDRESS")) try {
  13182. l = JSON.parse(s.getParameter("LIVE_STREAMING_ADDRESS")),
  13183. a.addressList = l
  13184. } catch(e) {
  13185. a.addressList = [s.getParameter("LIVE_STREAMING_ADDRESS")]
  13186. }
  13187. return [2, r(r({},
  13188. a), {
  13189. responseTime: _
  13190. })]
  13191. }
  13192. }))
  13193. }))
  13194. }), (function(t, r) {
  13195. return l.report.requestApWorkerEvent(a.sid, {
  13196. success: !0,
  13197. sc: 200,
  13198. serviceName: n,
  13199. responseDetail: JSON.stringify(t.addressList),
  13200. firstSuccess: 0 === r,
  13201. responseTime: _,
  13202. serverIp: e[r % e.length]
  13203. }),
  13204. !1
  13205. }), (function(t, r) {
  13206. return l.report.requestApWorkerEvent(a.sid, {
  13207. success: !1,
  13208. sc: t.data && t.data.code || 200,
  13209. serviceName: n,
  13210. responseTime: _,
  13211. serverIp: e[r % e.length]
  13212. }),
  13213. !!(t.code !== d.AgoraRTCErrorCode.OPERATION_ABORT && t.code !== d.AgoraRTCErrorCode.UNEXPECTED_RESPONSE || t.data && t.data.retry) && (R = e[(r + 1) % e.length], !0)
  13214. }), p)
  13215. }
  13216. t.requestLiveStreamingWorkerManager = v,
  13217. t.getLiveStreamingWorkerMangerResult = function(e, t, n) {
  13218. return i(this, void 0, void 0, (function() {
  13219. var r, i;
  13220. return o(this, (function(o) {
  13221. switch (o.label) {
  13222. case 0:
  13223. r = s.getParameter("UAP_AP").map((function(e) {
  13224. return t.proxyServer ? "https://" + t.proxyServer + "/ap/?url=" + e + "/api/v1?action=uap": "https://" + e + "/api/v1?action=uap"
  13225. })),
  13226. o.label = 1;
  13227. case 1:
  13228. return o.trys.push([1, 3, , 4]),
  13229. [4, v(r, e, t, n)];
  13230. case 2:
  13231. return [2, o.sent()];
  13232. case 3:
  13233. throw i = o.sent(),
  13234. l.report.requestApWorkerEvent(t.sid, {
  13235. success: !1,
  13236. sc: i.data && i.data.code || 200,
  13237. serviceName: e,
  13238. responseTime: i.data && i.data.responseTime
  13239. }),
  13240. i;
  13241. case 4:
  13242. return [2]
  13243. }
  13244. }))
  13245. }))
  13246. }
  13247. },
  13248. function(e, t, n) {
  13249. e.exports = n(74)
  13250. },
  13251. function(e, t, n) {
  13252. "use strict";
  13253. e.exports = function(e, t) {
  13254. return function() {
  13255. for (var n = new Array(arguments.length), r = 0; r < n.length; r++) n[r] = arguments[r];
  13256. return e.apply(t, n)
  13257. }
  13258. }
  13259. },
  13260. function(e, t, n) {
  13261. "use strict";
  13262. var r = n(18);
  13263. function i(e) {
  13264. return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]")
  13265. }
  13266. e.exports = function(e, t, n) {
  13267. if (!t) return e;
  13268. var o;
  13269. if (n) o = n(t);
  13270. else if (r.isURLSearchParams(t)) o = t.toString();
  13271. else {
  13272. var a = [];
  13273. r.forEach(t, (function(e, t) {
  13274. null != e && (r.isArray(e) ? t += "[]": e = [e], r.forEach(e, (function(e) {
  13275. r.isDate(e) ? e = e.toISOString() : r.isObject(e) && (e = JSON.stringify(e)),
  13276. a.push(i(t) + "=" + i(e))
  13277. })))
  13278. })),
  13279. o = a.join("&")
  13280. }
  13281. if (o) {
  13282. var s = e.indexOf("#"); - 1 !== s && (e = e.slice(0, s)),
  13283. e += ( - 1 === e.indexOf("?") ? "?": "&") + o
  13284. }
  13285. return e
  13286. }
  13287. },
  13288. function(e, t, n) {
  13289. "use strict";
  13290. e.exports = function(e) {
  13291. return ! (!e || !e.__CANCEL__)
  13292. }
  13293. },
  13294. function(e, t, n) {
  13295. "use strict"; (function(t) {
  13296. var r = n(18),
  13297. i = n(80),
  13298. o = {
  13299. "Content-Type": "application/x-www-form-urlencoded"
  13300. };
  13301. function a(e, t) { ! r.isUndefined(e) && r.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t)
  13302. }
  13303. var s, c = {
  13304. adapter: (("undefined" != typeof XMLHttpRequest || void 0 !== t && "[object process]" === Object.prototype.toString.call(t)) && (s = n(40)), s),
  13305. transformRequest: [function(e, t) {
  13306. return i(t, "Accept"),
  13307. i(t, "Content-Type"),
  13308. r.isFormData(e) || r.isArrayBuffer(e) || r.isBuffer(e) || r.isStream(e) || r.isFile(e) || r.isBlob(e) ? e: r.isArrayBufferView(e) ? e.buffer: r.isURLSearchParams(e) ? (a(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : r.isObject(e) ? (a(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e
  13309. }],
  13310. transformResponse: [function(e) {
  13311. if ("string" == typeof e) try {
  13312. e = JSON.parse(e)
  13313. } catch(e) {}
  13314. return e
  13315. }],
  13316. timeout: 0,
  13317. xsrfCookieName: "XSRF-TOKEN",
  13318. xsrfHeaderName: "X-XSRF-TOKEN",
  13319. maxContentLength: -1,
  13320. validateStatus: function(e) {
  13321. return e >= 200 && e < 300
  13322. }
  13323. };
  13324. c.headers = {
  13325. common: {
  13326. Accept: "application/json, text/plain, */*"
  13327. }
  13328. },
  13329. r.forEach(["delete", "get", "head"], (function(e) {
  13330. c.headers[e] = {}
  13331. })),
  13332. r.forEach(["post", "put", "patch"], (function(e) {
  13333. c.headers[e] = r.merge(o)
  13334. })),
  13335. e.exports = c
  13336. }).call(this, n(79))
  13337. },
  13338. function(e, t, n) {
  13339. "use strict";
  13340. var r = n(18),
  13341. i = n(81),
  13342. o = n(37),
  13343. a = n(83),
  13344. s = n(86),
  13345. c = n(87),
  13346. d = n(41);
  13347. e.exports = function(e) {
  13348. return new Promise((function(t, u) {
  13349. var l = e.data,
  13350. p = e.headers;
  13351. r.isFormData(l) && delete p["Content-Type"];
  13352. var f = new XMLHttpRequest;
  13353. if (e.auth) {
  13354. var g = e.auth.username || "",
  13355. m = e.auth.password || "";
  13356. p.Authorization = "Basic " + btoa(g + ":" + m)
  13357. }
  13358. var h = a(e.baseURL, e.url);
  13359. if (f.open(e.method.toUpperCase(), o(h, e.params, e.paramsSerializer), !0), f.timeout = e.timeout, f.onreadystatechange = function() {
  13360. if (f && 4 === f.readyState && (0 !== f.status || f.responseURL && 0 === f.responseURL.indexOf("file:"))) {
  13361. var n = "getAllResponseHeaders" in f ? s(f.getAllResponseHeaders()) : null,
  13362. r = {
  13363. data: e.responseType && "text" !== e.responseType ? f.response: f.responseText,
  13364. status: f.status,
  13365. statusText: f.statusText,
  13366. headers: n,
  13367. config: e,
  13368. request: f
  13369. };
  13370. i(t, u, r),
  13371. f = null
  13372. }
  13373. },
  13374. f.onabort = function() {
  13375. f && (u(d("Request aborted", e, "ECONNABORTED", f)), f = null)
  13376. },
  13377. f.onerror = function() {
  13378. u(d("Network Error", e, null, f)),
  13379. f = null
  13380. },
  13381. f.ontimeout = function() {
  13382. var t = "timeout of " + e.timeout + "ms exceeded";
  13383. e.timeoutErrorMessage && (t = e.timeoutErrorMessage),
  13384. u(d(t, e, "ECONNABORTED", f)),
  13385. f = null
  13386. },
  13387. r.isStandardBrowserEnv()) {
  13388. var v = n(88),
  13389. E = (e.withCredentials || c(h)) && e.xsrfCookieName ? v.read(e.xsrfCookieName) : void 0;
  13390. E && (p[e.xsrfHeaderName] = E)
  13391. }
  13392. if ("setRequestHeader" in f && r.forEach(p, (function(e, t) {
  13393. void 0 === l && "content-type" === t.toLowerCase() ? delete p[t] : f.setRequestHeader(t, e)
  13394. })), r.isUndefined(e.withCredentials) || (f.withCredentials = !!e.withCredentials), e.responseType) try {
  13395. f.responseType = e.responseType
  13396. } catch(t) {
  13397. if ("json" !== e.responseType) throw t
  13398. }
  13399. "function" == typeof e.onDownloadProgress && f.addEventListener("progress", e.onDownloadProgress),
  13400. "function" == typeof e.onUploadProgress && f.upload && f.upload.addEventListener("progress", e.onUploadProgress),
  13401. e.cancelToken && e.cancelToken.promise.then((function(e) {
  13402. f && (f.abort(), u(e), f = null)
  13403. })),
  13404. void 0 === l && (l = null),
  13405. f.send(l)
  13406. }))
  13407. }
  13408. },
  13409. function(e, t, n) {
  13410. "use strict";
  13411. var r = n(82);
  13412. e.exports = function(e, t, n, i, o) {
  13413. var a = new Error(e);
  13414. return r(a, t, n, i, o)
  13415. }
  13416. },
  13417. function(e, t, n) {
  13418. "use strict";
  13419. var r = n(18);
  13420. e.exports = function(e, t) {
  13421. t = t || {};
  13422. var n = {},
  13423. i = ["url", "method", "params", "data"],
  13424. o = ["headers", "auth", "proxy"],
  13425. a = ["baseURL", "url", "transformRequest", "transformResponse", "paramsSerializer", "timeout", "withCredentials", "adapter", "responseType", "xsrfCookieName", "xsrfHeaderName", "onUploadProgress", "onDownloadProgress", "maxContentLength", "validateStatus", "maxRedirects", "httpAgent", "httpsAgent", "cancelToken", "socketPath"];
  13426. r.forEach(i, (function(e) {
  13427. void 0 !== t[e] && (n[e] = t[e])
  13428. })),
  13429. r.forEach(o, (function(i) {
  13430. r.isObject(t[i]) ? n[i] = r.deepMerge(e[i], t[i]) : void 0 !== t[i] ? n[i] = t[i] : r.isObject(e[i]) ? n[i] = r.deepMerge(e[i]) : void 0 !== e[i] && (n[i] = e[i])
  13431. })),
  13432. r.forEach(a, (function(r) {
  13433. void 0 !== t[r] ? n[r] = t[r] : void 0 !== e[r] && (n[r] = e[r])
  13434. }));
  13435. var s = i.concat(o).concat(a),
  13436. c = Object.keys(t).filter((function(e) {
  13437. return - 1 === s.indexOf(e)
  13438. }));
  13439. return r.forEach(c, (function(r) {
  13440. void 0 !== t[r] ? n[r] = t[r] : void 0 !== e[r] && (n[r] = e[r])
  13441. })),
  13442. n
  13443. }
  13444. },
  13445. function(e, t, n) {
  13446. "use strict";
  13447. function r(e) {
  13448. this.message = e
  13449. }
  13450. r.prototype.toString = function() {
  13451. return "Cancel" + (this.message ? ": " + this.message: "")
  13452. },
  13453. r.prototype.__CANCEL__ = !0,
  13454. e.exports = r
  13455. },
  13456. function(e, t) {
  13457. e.exports = function(e, t, n) {
  13458. return t in e ? Object.defineProperty(e, t, {
  13459. value: n,
  13460. enumerable: !0,
  13461. configurable: !0,
  13462. writable: !0
  13463. }) : e[t] = n,
  13464. e
  13465. }
  13466. },
  13467. function(e, t, n) {
  13468. "use strict";
  13469. var r = this && this.__awaiter ||
  13470. function(e, t, n, r) {
  13471. return new(n || (n = Promise))((function(i, o) {
  13472. function a(e) {
  13473. try {
  13474. c(r.next(e))
  13475. } catch(e) {
  13476. o(e)
  13477. }
  13478. }
  13479. function s(e) {
  13480. try {
  13481. c(r.
  13482. throw (e))
  13483. } catch(e) {
  13484. o(e)
  13485. }
  13486. }
  13487. function c(e) {
  13488. var t;
  13489. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  13490. e(t)
  13491. }))).then(a, s)
  13492. }
  13493. c((r = r.apply(e, t || [])).next())
  13494. }))
  13495. },
  13496. i = this && this.__generator ||
  13497. function(e, t) {
  13498. var n, r, i, o, a = {
  13499. label: 0,
  13500. sent: function() {
  13501. if (1 & i[0]) throw i[1];
  13502. return i[1]
  13503. },
  13504. trys: [],
  13505. ops: []
  13506. };
  13507. return o = {
  13508. next: s(0),
  13509. throw: s(1),
  13510. return: s(2)
  13511. },
  13512. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  13513. return this
  13514. }),
  13515. o;
  13516. function s(o) {
  13517. return function(s) {
  13518. return function(o) {
  13519. if (n) throw new TypeError("Generator is already executing.");
  13520. for (; a;) try {
  13521. if (n = 1, r && (i = 2 & o[0] ? r.
  13522. return: o[0] ? r.
  13523. throw || ((i = r.
  13524. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  13525. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  13526. case 0:
  13527. case 1:
  13528. i = o;
  13529. break;
  13530. case 4:
  13531. return a.label++,
  13532. {
  13533. value: o[1],
  13534. done: !1
  13535. };
  13536. case 5:
  13537. a.label++,
  13538. r = o[1],
  13539. o = [0];
  13540. continue;
  13541. case 7:
  13542. o = a.ops.pop(),
  13543. a.trys.pop();
  13544. continue;
  13545. default:
  13546. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  13547. a = 0;
  13548. continue
  13549. }
  13550. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  13551. a.label = o[1];
  13552. break
  13553. }
  13554. if (6 === o[0] && a.label < i[1]) {
  13555. a.label = i[1],
  13556. i = o;
  13557. break
  13558. }
  13559. if (i && a.label < i[2]) {
  13560. a.label = i[2],
  13561. a.ops.push(o);
  13562. break
  13563. }
  13564. i[2] && a.ops.pop(),
  13565. a.trys.pop();
  13566. continue
  13567. }
  13568. o = t.call(e, a)
  13569. } catch(e) {
  13570. o = [6, e],
  13571. r = 0
  13572. } finally {
  13573. n = i = 0
  13574. }
  13575. if (5 & o[0]) throw o[1];
  13576. return {
  13577. value: o[0] ? o[1] : void 0,
  13578. done: !0
  13579. }
  13580. } ([o, s])
  13581. }
  13582. }
  13583. },
  13584. o = this && this.__importDefault ||
  13585. function(e) {
  13586. return e && e.__esModule ? e: {
  13587. default:
  13588. e
  13589. }
  13590. },
  13591. a = this && this.__importStar ||
  13592. function(e) {
  13593. if (e && e.__esModule) return e;
  13594. var t = {};
  13595. if (null != e) for (var n in e) Object.hasOwnProperty.call(e, n) && (t[n] = e[n]);
  13596. return t.
  13597. default = e,
  13598. t
  13599. };
  13600. Object.defineProperty(t, "__esModule", {
  13601. value: !0
  13602. });
  13603. var s = o(n(56)),
  13604. c = a(n(60)),
  13605. d = a(n(61)),
  13606. u = o(n(0)),
  13607. l = n(3),
  13608. p = s.
  13609. default.Root.fromJSON(d),
  13610. f = function() {
  13611. function e() {
  13612. this.requestArray = [],
  13613. this.retryBackoffCount = 0,
  13614. this.state = 0
  13615. }
  13616. return e.prototype.setProxy = function(e) {
  13617. this.proxyServer = e
  13618. },
  13619. e.prototype.sendReportList = function(e) {
  13620. var t = this,
  13621. n = this._dataConvert("ProtoRaws", {
  13622. sendTs: Math.round(Date.now() / 1e3),
  13623. payloads: e.map((function(e) {
  13624. return {
  13625. id: c[e.type],
  13626. msg: t._dataConvert(e.type, e.data)
  13627. }
  13628. }))
  13629. });
  13630. this.send(n)
  13631. },
  13632. e.prototype._dataConvert = function(e, t) {
  13633. var n;
  13634. try {
  13635. n = p.lookupType("protobuf." + e)
  13636. } catch(t) {
  13637. u.
  13638. default.error("[send-proto] invalid proto name " + e)
  13639. }
  13640. var r = n.create(t);
  13641. return n.encode(r).finish()
  13642. },
  13643. e.prototype.send = function(e) {
  13644. 0 == this.state ? this._send(e) : this.requestArray.push(e)
  13645. },
  13646. e.prototype._send = function(e) {
  13647. return r(this, void 0, void 0, (function() {
  13648. return i(this, (function(t) {
  13649. switch (t.label) {
  13650. case 0:
  13651. return t.trys.push([0, 2, , 4]),
  13652. this.state = 1,
  13653. [4, this.request(e)];
  13654. case 1:
  13655. return t.sent(),
  13656. this.retryBackoffCount = 0,
  13657. 0 !== this.requestArray.length ? this._send(this.requestArray.shift()) : this.state = 0,
  13658. [3, 4];
  13659. case 2:
  13660. return t.sent(),
  13661. [4, g(this.retryBackoffCount++<2 ? 200 : 1e4)];
  13662. case 3:
  13663. return t.sent(),
  13664. this._send(e),
  13665. [3, 4];
  13666. case 4:
  13667. return [2]
  13668. }
  13669. }))
  13670. }))
  13671. },
  13672. e.prototype.request = function(e) {
  13673. return r(this, void 0, void 0, (function() {
  13674. var t, n;
  13675. return i(this, (function(r) {
  13676. switch (r.label) {
  13677. case 0:
  13678. t = this._getAddress(),
  13679. n = this._getBackupAddress(),
  13680. r.label = 1;
  13681. case 1:
  13682. return r.trys.push([1, 3, , 5]),
  13683. [4, this._request(t, e)];
  13684. case 2:
  13685. return r.sent(),
  13686. [3, 5];
  13687. case 3:
  13688. return r.sent(),
  13689. [4, this._request(n, e)];
  13690. case 4:
  13691. return r.sent(),
  13692. [3, 5];
  13693. case 5:
  13694. return [2]
  13695. }
  13696. }))
  13697. }))
  13698. },
  13699. e.prototype._request = function(e, t) {
  13700. return this._post(e, t)
  13701. },
  13702. e.prototype._post = function(e, t) {
  13703. return new Promise((function(n, r) {
  13704. var i = new XMLHttpRequest;
  13705. i.timeout = l.getParameter("HTTP_CONNECT_TIMEOUT"),
  13706. i.open("POST", e, !0),
  13707. i.setRequestHeader("Content-type", "application/octet-stream"),
  13708. i.onload = function(e) {
  13709. n(i.responseText)
  13710. },
  13711. i.onerror = function(e) {
  13712. r(e)
  13713. },
  13714. i.ontimeout = function(e) {
  13715. r(e)
  13716. },
  13717. i.send(t)
  13718. }))
  13719. },
  13720. e.prototype._getAddress = function() {
  13721. return this.proxyServer ? "https://" + this.proxyServer + "/rs/?h=" + l.getParameter("EVENT_REPORT_DOMAIN") + "&p=6443&d=events/proto-raws": "https://" + l.getParameter("EVENT_REPORT_DOMAIN") + ":6443/events/proto-raws"
  13722. },
  13723. e.prototype._getBackupAddress = function() {
  13724. return this.proxyServer ? "https://" + this.proxyServer + "/rs/?h=" + l.getParameter("EVENT_REPORT_BACKUP_DOMAIN") + "&p=6443&d=events/proto-raws": "https://" + l.getParameter("EVENT_REPORT_BACKUP_DOMAIN") + ":6443/events/proto-raws"
  13725. },
  13726. e
  13727. } ();
  13728. t.
  13729. default = f;
  13730. var g = function(e) {
  13731. return new Promise((function(t) {
  13732. window.setTimeout(t, e)
  13733. }))
  13734. }
  13735. },
  13736. function(e, t) {
  13737. e.exports = function(e, t) {
  13738. if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
  13739. }
  13740. },
  13741. function(e, t) {
  13742. function n(e, t) {
  13743. for (var n = 0; n < t.length; n++) {
  13744. var r = t[n];
  13745. r.enumerable = r.enumerable || !1,
  13746. r.configurable = !0,
  13747. "value" in r && (r.writable = !0),
  13748. Object.defineProperty(e, r.key, r)
  13749. }
  13750. }
  13751. e.exports = function(e, t, r) {
  13752. return t && n(e.prototype, t),
  13753. r && n(e, r),
  13754. e
  13755. }
  13756. },
  13757. function(e, t, n) {
  13758. "use strict";
  13759. var r = this && this.__awaiter ||
  13760. function(e, t, n, r) {
  13761. return new(n || (n = Promise))((function(i, o) {
  13762. function a(e) {
  13763. try {
  13764. c(r.next(e))
  13765. } catch(e) {
  13766. o(e)
  13767. }
  13768. }
  13769. function s(e) {
  13770. try {
  13771. c(r.
  13772. throw (e))
  13773. } catch(e) {
  13774. o(e)
  13775. }
  13776. }
  13777. function c(e) {
  13778. var t;
  13779. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  13780. e(t)
  13781. }))).then(a, s)
  13782. }
  13783. c((r = r.apply(e, t || [])).next())
  13784. }))
  13785. },
  13786. i = this && this.__generator ||
  13787. function(e, t) {
  13788. var n, r, i, o, a = {
  13789. label: 0,
  13790. sent: function() {
  13791. if (1 & i[0]) throw i[1];
  13792. return i[1]
  13793. },
  13794. trys: [],
  13795. ops: []
  13796. };
  13797. return o = {
  13798. next: s(0),
  13799. throw: s(1),
  13800. return: s(2)
  13801. },
  13802. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  13803. return this
  13804. }),
  13805. o;
  13806. function s(o) {
  13807. return function(s) {
  13808. return function(o) {
  13809. if (n) throw new TypeError("Generator is already executing.");
  13810. for (; a;) try {
  13811. if (n = 1, r && (i = 2 & o[0] ? r.
  13812. return: o[0] ? r.
  13813. throw || ((i = r.
  13814. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  13815. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  13816. case 0:
  13817. case 1:
  13818. i = o;
  13819. break;
  13820. case 4:
  13821. return a.label++,
  13822. {
  13823. value: o[1],
  13824. done: !1
  13825. };
  13826. case 5:
  13827. a.label++,
  13828. r = o[1],
  13829. o = [0];
  13830. continue;
  13831. case 7:
  13832. o = a.ops.pop(),
  13833. a.trys.pop();
  13834. continue;
  13835. default:
  13836. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  13837. a = 0;
  13838. continue
  13839. }
  13840. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  13841. a.label = o[1];
  13842. break
  13843. }
  13844. if (6 === o[0] && a.label < i[1]) {
  13845. a.label = i[1],
  13846. i = o;
  13847. break
  13848. }
  13849. if (i && a.label < i[2]) {
  13850. a.label = i[2],
  13851. a.ops.push(o);
  13852. break
  13853. }
  13854. i[2] && a.ops.pop(),
  13855. a.trys.pop();
  13856. continue
  13857. }
  13858. o = t.call(e, a)
  13859. } catch(e) {
  13860. o = [6, e],
  13861. r = 0
  13862. } finally {
  13863. n = i = 0
  13864. }
  13865. if (5 & o[0]) throw o[1];
  13866. return {
  13867. value: o[0] ? o[1] : void 0,
  13868. done: !0
  13869. }
  13870. } ([o, s])
  13871. }
  13872. }
  13873. },
  13874. o = this && this.__importDefault ||
  13875. function(e) {
  13876. return e && e.__esModule ? e: {
  13877. default:
  13878. e
  13879. }
  13880. };
  13881. Object.defineProperty(t, "__esModule", {
  13882. value: !0
  13883. });
  13884. var a, s = o(n(0)),
  13885. c = n(15); !
  13886. function(e) {
  13887. e.NEW = "new",
  13888. e.PREPARING_OFFER = "preparing-offer",
  13889. e.OFFER_SENT = "offer-sent",
  13890. e.ESTABLISHED = "established",
  13891. e.CLOSED = "closed"
  13892. } (a || (a = {}));
  13893. var d = function() {
  13894. function e(e) {
  13895. this.candidate = null,
  13896. this.state = a.NEW,
  13897. this.config = e,
  13898. this.isSubscriber = this.config.isSubscriber,
  13899. this.peerConnection = this.initPeecConnection(e),
  13900. this.peerConnection.onicecandidate = this._onicecandidate.bind(this),
  13901. this.peerConnection.oniceconnectionstatechange = this._oniceconnectionstatechange.bind(this),
  13902. this.peerConnection.onaddstream = this._onaddstream.bind(this),
  13903. this.peerConnection.ontrack = this._ontrack.bind(this),
  13904. this.processSignalingMessage = this.setAnswer.bind(this),
  13905. this.peerConnection.createOffer({
  13906. offerToReceiveAudio: !0,
  13907. offerToReceiveVideo: !0
  13908. }).then(this.setLocalSDP.bind(this)),
  13909. this.sendVideoStats = {
  13910. id: "",
  13911. type: "",
  13912. mediaType: "",
  13913. googCodecName: "h264" === this.config.codec ? "H264": "VP8",
  13914. bytesSent: "0",
  13915. packetsLost: "0",
  13916. packetsSent: "0",
  13917. googAdaptationChanges: "0",
  13918. googAvgEncodeMs: "0",
  13919. googEncodeUsagePercent: "0",
  13920. googFirsReceived: "0",
  13921. googFrameHeightSent: "0",
  13922. googFrameHeightInput: "0",
  13923. googFrameRateInput: "0",
  13924. googFrameRateSent: "0",
  13925. googFrameWidthSent: "0",
  13926. googFrameWidthInput: "0",
  13927. googNacksReceived: "0",
  13928. googPlisReceived: "0",
  13929. googRtt: "0",
  13930. googFramesEncoded: "0"
  13931. },
  13932. this.sendAudioStats = {
  13933. id: "",
  13934. type: "",
  13935. mediaType: "",
  13936. googCodecName: "opus",
  13937. aecDivergentFilterFraction: "0",
  13938. audioInputLevel: "0",
  13939. bytesSent: "0",
  13940. packetsSent: "0",
  13941. googEchoCancellationReturnLoss: "0",
  13942. googEchoCancellationReturnLossEnhancement: "0"
  13943. },
  13944. this.receiveAudioStats = {
  13945. id: "",
  13946. type: "",
  13947. mediaType: "",
  13948. audioOutputLevel: "0",
  13949. bytesReceived: "0",
  13950. packetsLost: "0",
  13951. packetsReceived: "0",
  13952. googAccelerateRate: "0",
  13953. googCurrentDelayMs: "0",
  13954. googDecodingCNG: "0",
  13955. googDecodingCTN: "0",
  13956. googDecodingCTSG: "0",
  13957. googDecodingNormal: "0",
  13958. googDecodingPLC: "0",
  13959. googDecodingPLCCNG: "0",
  13960. googExpandRate: "0",
  13961. googJitterBufferMs: "0",
  13962. googJitterReceived: "0",
  13963. googPreemptiveExpandRate: "0",
  13964. googPreferredJitterBufferMs: "0",
  13965. googSecondaryDecodedRate: "0",
  13966. googSpeechExpandRate: "0"
  13967. },
  13968. this.receiveVideoStats = {
  13969. id: "",
  13970. type: "",
  13971. mediaType: "",
  13972. googTargetDelayMs: "0",
  13973. packetsLost: "0",
  13974. googDecodeMs: "0",
  13975. googMaxDecodeMs: "0",
  13976. googRenderDelayMs: "0",
  13977. googFrameWidthReceived: "0",
  13978. googFrameHeightReceived: "0",
  13979. googFrameRateReceived: "0",
  13980. googFrameRateDecoded: "0",
  13981. googFrameRateOutput: "0",
  13982. googFramesDecoded: "0",
  13983. googFrameReceived: "0",
  13984. googJitterBufferMs: "0",
  13985. googCurrentDelayMs: "0",
  13986. googMinPlayoutDelayMs: "0",
  13987. googNacksSent: "0",
  13988. googPlisSent: "0",
  13989. googFirsSent: "0",
  13990. bytesReceived: "0",
  13991. packetsReceived: "0"
  13992. }
  13993. }
  13994. return e.prototype.addStream = function(e) {
  13995. this.peerConnection.addStream(e)
  13996. },
  13997. e.prototype.setRtpSenderParameters = function(e) {
  13998. return r(this, void 0, void 0, (function() {
  13999. return i(this, (function(e) {
  14000. return [2]
  14001. }))
  14002. }))
  14003. },
  14004. e.prototype.setAnswer = function(e) {
  14005. var t = JSON.parse(e);
  14006. this.peerConnection.setRemoteDescription(new RTCSessionDescription({
  14007. sdp: t.sdp,
  14008. type: "answer"
  14009. })),
  14010. this.onsignalingmessage && this.onsignalingmessage("")
  14011. },
  14012. e.prototype.close = function() {
  14013. this.peerConnection.close()
  14014. },
  14015. e.prototype.getStats = function(e, t) {
  14016. if (void 0 === t && (t = 500), t = t > 500 ? 500 : t, Date.now() - this.lastTimeGetStats < t) {
  14017. var n = [];
  14018. this.config.isSubscriber ? (n.push(this.receiveVideoStats), n.push(this.receiveAudioStats)) : (n.push(this.sendAudioStats), n.push(this.sendVideoStats)),
  14019. n.push({
  14020. id: "time",
  14021. startTime: this.connectedTime,
  14022. timestamp: Date.now()
  14023. }),
  14024. e && e(n)
  14025. } else this._getStats(e)
  14026. },
  14027. e.prototype._getStats = function(e) {
  14028. var t = this,
  14029. n = [];
  14030. this.peerConnection.getStats(null).then((function(r) {
  14031. t.lastTimeGetStats = Date.now(),
  14032. Object.keys(r).map((function(e) {
  14033. var n = r[e];
  14034. t.config.isSubscriber ? n.type && "inboundrtp" === n.type && n.mediaType && "audio" === n.mediaType ? (t.receiveAudioStats.id = n.id + "recv", t.receiveAudioStats.type = n.type + "", t.receiveAudioStats.mediaType = n.mediaType + "", t.receiveAudioStats.packetsReceived = n.packetsReceived + "", t.receiveAudioStats.bytesReceived = n.bytesReceived + "", t.receiveAudioStats.packetsLost = n.packetsLost + "", t.receiveAudioStats.googJitterReceived = n.jitter + "") : n.type && "inboundrtp" === n.type && n.mediaType && "video" === n.mediaType ? (t.receiveVideoStats.id = n.id + "recv", t.receiveVideoStats.type = n.type + "", t.receiveVideoStats.mediaType = n.mediaType + "", t.receiveVideoStats.packetsReceived = n.packetsReceived + "", t.receiveVideoStats.bytesReceived = n.bytesReceived + "", t.receiveVideoStats.packetsLost = n.packetsLost + "", t.receiveVideoStats.googJitterBufferMs = n.jitter + "", t.receiveVideoStats.googPlisSent = n.pliCount + "", t.receiveVideoStats.googFirsSent = n.firCount + "", t.receiveVideoStats.googNacksSent = n.nackCount + "") : n.remoteSource && n.type && "track" === n.type && n.trackIdentifier && -1 !== n.trackIdentifier.indexOf("v") ? (t.receiveVideoStats.googFrameHeightReceived = n.frameHeight + "", t.receiveVideoStats.googFrameWidthReceived = n.frameWidth + "", t.receiveVideoStats.googFrameRateDecoded = n.framesPerSecond + "", t.receiveVideoStats.googFrameRateOutput = n.framesPerSecond + "", t.receiveVideoStats.googFrameRateReceived = n.framesPerSecond + "", t.receiveVideoStats.googFramesDecoded = n.framesDecoded + "", t.receiveVideoStats.googFrameReceived = n.framesReceived + "") : n.remoteSource && n.type && "track" === n.type && n.trackIdentifier && -1 !== n.trackIdentifier.indexOf("a") && (t.receiveAudioStats.audioOutputLevel = n.audioLevel + "") : !n.isRemote && n.type && "outboundrtp" === n.type && n.mediaType && "audio" === n.mediaType ? (t.sendAudioStats.id = n.id + "send", t.sendAudioStats.type = n.type + "", t.sendAudioStats.mediaType = n.mediaType + "", t.sendAudioStats.packetsSent = n.packetsSent + "", t.sendAudioStats.bytesSent = n.bytesSent + "") : !n.isRemote && n.type && "outboundrtp" === n.type && n.mediaType && "video" === n.mediaType ? (t.sendVideoStats.id = n.id + "send", t.sendVideoStats.type = n.type + "", t.sendVideoStats.mediaType = n.mediaType + "", t.sendVideoStats.packetsSent = n.packetsSent + "", t.sendVideoStats.bytesSent = n.bytesSent + "", t.sendVideoStats.googRtt = n.roundTripTime + "", t.sendVideoStats.googPlisReceived = n.pliCount + "", t.sendVideoStats.googFirsReceived = n.firCount + "", t.sendVideoStats.googNacksReceived = n.nackCount + "") : !n.remoteSource && n.type && "track" === n.type && n.framesSent && 0 !== n.framesSent && (t.sendVideoStats.googFrameHeightSent = n.frameHeight + "", t.sendVideoStats.googFrameHeightInput = n.frameHeight + "", t.sendVideoStats.googFrameWidthSent = n.frameWidth + "", t.sendVideoStats.googFrameWidthInput = n.frameWidth + "", t.sendVideoStats.googFramesEncoded = n.framesSent + "", t.sendVideoStats.googFrameRateSent = n.framesPerSecond + "")
  14035. })),
  14036. t.config.isSubscriber ? (n.push(t.receiveVideoStats), n.push(t.receiveAudioStats)) : (n.push(t.sendAudioStats), n.push(t.sendVideoStats)),
  14037. n.push({
  14038. id: "time",
  14039. startTime: t.connectedTime,
  14040. timestamp: Date.now()
  14041. }),
  14042. e && e(n)
  14043. }))
  14044. },
  14045. e.prototype.getStatsRate = function(e) {
  14046. this.getStats(e)
  14047. },
  14048. e.prototype.initPeecConnection = function(e) {
  14049. var t = e.stunServerUrl,
  14050. n = e.turnServer,
  14051. r = e.iceServers;
  14052. return this.pcConfig = {
  14053. iceServers: [{
  14054. urls: "stun:webcs.agora.io:3478"
  14055. }]
  14056. },
  14057. r instanceof Array ? this.pcConfig.iceServers = e.iceServers: t && (t instanceof Array ? t.map((function(e) {
  14058. "string" == typeof e && "" !== e && this.pcConfig.iceServers.push({
  14059. urls: e
  14060. })
  14061. })) : "string" == typeof t && "" !== t && this.pcConfig.iceServers.push({
  14062. urls: t
  14063. })),
  14064. n && (n instanceof Array ? n.map((function(e) {
  14065. "string" == typeof e.url && "" !== e.url && this.pcConfig.iceServers.push({
  14066. username: e.username,
  14067. credential: e.credential,
  14068. url: e.url
  14069. })
  14070. })) : "auto" !== n.mode && "manual" !== n.mode || (n.udpport && this.pcConfig.iceServers.push({
  14071. username: n.username,
  14072. credential: n.credential,
  14073. credentialType: "password",
  14074. urls: "turn:" + n.url + ":" + n.udpport + "?transport=udp"
  14075. }), "string" == typeof n.tcpport && "" !== n.tcpport && this.pcConfig.iceServers.push({
  14076. username: n.username,
  14077. credential: n.credential,
  14078. credentialType: "password",
  14079. urls: "turn:" + n.url + ":" + n.tcpport + "?transport=tcp"
  14080. }), !0 === n.forceturn && (this.pcConfig.iceTransportPolicy = "relay"))),
  14081. new c.RTCPeerConnection(this.pcConfig)
  14082. },
  14083. e.prototype._ontrack = function(e) {
  14084. this.onaddstream && this.onaddstream(e, "ontrack")
  14085. },
  14086. e.prototype._onaddstream = function(e) {
  14087. this.onaddstream && this.onaddstream(e, "onaddstream")
  14088. },
  14089. e.prototype._oniceconnectionstatechange = function(e) {
  14090. "connected" === e.currentTarget.iceConnectionState && (this.state = a.ESTABLISHED, this.connectedTime = Date.now()),
  14091. this.oniceconnectionstatechange && this.oniceconnectionstatechange(e.currentTarget.iceConnectionState)
  14092. },
  14093. e.prototype._onicecandidate = function(e) { ! this.candidate && e && (this.candidate = e.candidate, this.peerConnection.createOffer({
  14094. offerToReceiveAudio: !0,
  14095. offerToReceiveVideo: !0
  14096. }).then(this.editLocalSDP.bind(this)).then(this.setLocalSDP.bind(this)).then(this.sendOffer.bind(this)).
  14097. catch())
  14098. },
  14099. e.prototype.setLocalSDP = function(e) {
  14100. return this.peerConnection.setLocalDescription(new RTCSessionDescription({
  14101. sdp: e.sdp,
  14102. type: "offer"
  14103. })),
  14104. this.state = a.PREPARING_OFFER,
  14105. e
  14106. },
  14107. e.prototype.editLocalSDP = function(e) {
  14108. return e.sdp = this.setBandWidth(e.sdp),
  14109. e.sdp = this.reviseOpus(e.sdp),
  14110. e.sdp = this.addCandidate(e.sdp),
  14111. e
  14112. },
  14113. e.prototype.setSendRecv = function(e) {
  14114. return e = (e = (e = e.replace(/a=recvonly\r\n/g, "a=sendrecv\r\n")).replace(/a=sendonly\r\n/g, "a=sendrecv\r\n")).replace(/a=inactive\r\n/g, "a=sendrecv\r\n")
  14115. },
  14116. e.prototype.setBandWidth = function(e) {
  14117. var t, n, r = this.config,
  14118. i = r.codec,
  14119. o = r.minVideoBW,
  14120. a = r.maxVideoBW,
  14121. c = r.maxAudioBW,
  14122. d = r.clientId;
  14123. if ((t = e.match(/m=video.*\r\n/)) && o && a) {
  14124. n = t[0] + "b=AS:" + a + "\r\n";
  14125. var u = 0,
  14126. l = 0;
  14127. "h264" === i ? (u = e.search(/a=rtpmap:(\d+) H264\/90000\r\n/), l = e.search(/H264\/90000\r\n/)) : "vp8" === i && (u = e.search(/a=rtpmap:(\d+) VP8\/90000\r\n/), l = e.search(/VP8\/90000\r\n/)),
  14128. -1 !== u && -1 !== l && l - u > 10 && (n = n + "a=fmtp:" + e.slice(u + 9, l - 1) + " x-google-min-bitrate=" + o + "\r\n"),
  14129. e = e.replace(t[0], n),
  14130. s.
  14131. default.debug("[" + d + "]Set Video Bitrate - min:" + o + " max:" + a)
  14132. }
  14133. return (t = e.match(/m=audio.*\r\n/)) && c && (n = t[0] + "b=AS:" + c + "\r\n", e = e.replace(t[0], n)),
  14134. e
  14135. },
  14136. e.prototype.reviseOpus = function(e) {
  14137. return e = (e = e.replace(/a=rtpmap:102 opus\/48000\/2/g, "a=rtpmap:111 opus/48000/2")).replace(/m=audio 9 UDP\/TLS\/RTP\/SAVPF 102 0 8 97 13 118 101/g, "m=audio 9 UDP/TLS/RTP/SAVPF 111 0 8 97 13 118 101")
  14138. },
  14139. e.prototype.addCandidate = function(e) {
  14140. return e += "a=candidate:2243255435 1 udp 2122194687 192.168.0.1 30000 typ host generation 0 network-id 1\r\n"
  14141. },
  14142. e.prototype.sendOffer = function(e) {
  14143. this.config.callback(JSON.stringify({
  14144. sdp: e.sdp,
  14145. messageType: "OFFER",
  14146. tiebreaker: Math.floor(429496723 * Math.random() + 1)
  14147. })),
  14148. this.state = a.OFFER_SENT
  14149. },
  14150. e
  14151. } ();
  14152. t.
  14153. default = d
  14154. },
  14155. function(e, t, n) {
  14156. var r = n(63),
  14157. i = n(64),
  14158. o = n(31),
  14159. a = n(65);
  14160. e.exports = function(e, t) {
  14161. return r(e) || i(e, t) || o(e, t) || a()
  14162. }
  14163. },
  14164. function(e, t, n) {
  14165. var r, i, o;
  14166. i = this,
  14167. o = function() {
  14168. "use strict";
  14169. var e, t = this;
  14170. function n(e) {
  14171. t.console && (t.console.error ? t.console.error(e) : t.console.log && t.console.log(e))
  14172. }
  14173. function r(e, t, r, i) {
  14174. var o = i || n,
  14175. a = e.createShader(r);
  14176. return e.shaderSource(a, t),
  14177. e.compileShader(a),
  14178. e.getShaderParameter(a, e.COMPILE_STATUS) ? a: (o("*** Error compiling shader '" + a + "':" + e.getShaderInfoLog(a)), e.deleteShader(a), null)
  14179. }
  14180. function i(e, t, r, i, o) {
  14181. var a = o || n,
  14182. s = e.createProgram();
  14183. return t.forEach((function(t) {
  14184. e.attachShader(s, t)
  14185. })),
  14186. r && r.forEach((function(t, n) {
  14187. e.bindAttribLocation(s, i ? i[n] : n, t)
  14188. })),
  14189. e.linkProgram(s),
  14190. e.getProgramParameter(s, e.LINK_STATUS) ? s: (a("Error in program linking:" + e.getProgramInfoLog(s)), e.deleteProgram(s), null)
  14191. } (e = e || t) === e.top && (console.log("%c%s", "color:blue;font-weight:bold;", "for more about webgl-utils.js see:"), console.log("%c%s", "color:blue;font-weight:bold;", "http://webglfundamentals.org/webgl/lessons/webgl-boilerplate.html"));
  14192. var o, a = ["VERTEX_SHADER", "FRAGMENT_SHADER"];
  14193. return ! document.documentMode && !!window.StyleMedia && (HTMLCanvasElement.prototype.getContext = (o = HTMLCanvasElement.prototype.getContext,
  14194. function() {
  14195. var e = arguments,
  14196. t = e[0];
  14197. return "webgl" === t && ((e = [].slice.call(arguments))[0] = "experimental-webgl"),
  14198. o.apply(this, e)
  14199. })),
  14200. {
  14201. createProgram: i,
  14202. createProgramFromSources: function(e, t, n, o, s) {
  14203. for (var c = [], d = 0; d < t.length; ++d) c.push(r(e, t[d], e[a[d]], s));
  14204. return i(e, c, n, o, s)
  14205. }
  14206. }
  14207. },
  14208. void 0 === (r = function() {
  14209. return o.call(i)
  14210. }.apply(t, [])) || (e.exports = r)
  14211. },
  14212. function(e, t, n) {
  14213. "use strict";
  14214. var r = this && this.__awaiter ||
  14215. function(e, t, n, r) {
  14216. return new(n || (n = Promise))((function(i, o) {
  14217. function a(e) {
  14218. try {
  14219. c(r.next(e))
  14220. } catch(e) {
  14221. o(e)
  14222. }
  14223. }
  14224. function s(e) {
  14225. try {
  14226. c(r.
  14227. throw (e))
  14228. } catch(e) {
  14229. o(e)
  14230. }
  14231. }
  14232. function c(e) {
  14233. var t;
  14234. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  14235. e(t)
  14236. }))).then(a, s)
  14237. }
  14238. c((r = r.apply(e, t || [])).next())
  14239. }))
  14240. },
  14241. i = this && this.__generator ||
  14242. function(e, t) {
  14243. var n, r, i, o, a = {
  14244. label: 0,
  14245. sent: function() {
  14246. if (1 & i[0]) throw i[1];
  14247. return i[1]
  14248. },
  14249. trys: [],
  14250. ops: []
  14251. };
  14252. return o = {
  14253. next: s(0),
  14254. throw: s(1),
  14255. return: s(2)
  14256. },
  14257. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  14258. return this
  14259. }),
  14260. o;
  14261. function s(o) {
  14262. return function(s) {
  14263. return function(o) {
  14264. if (n) throw new TypeError("Generator is already executing.");
  14265. for (; a;) try {
  14266. if (n = 1, r && (i = 2 & o[0] ? r.
  14267. return: o[0] ? r.
  14268. throw || ((i = r.
  14269. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  14270. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  14271. case 0:
  14272. case 1:
  14273. i = o;
  14274. break;
  14275. case 4:
  14276. return a.label++,
  14277. {
  14278. value: o[1],
  14279. done: !1
  14280. };
  14281. case 5:
  14282. a.label++,
  14283. r = o[1],
  14284. o = [0];
  14285. continue;
  14286. case 7:
  14287. o = a.ops.pop(),
  14288. a.trys.pop();
  14289. continue;
  14290. default:
  14291. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  14292. a = 0;
  14293. continue
  14294. }
  14295. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  14296. a.label = o[1];
  14297. break
  14298. }
  14299. if (6 === o[0] && a.label < i[1]) {
  14300. a.label = i[1],
  14301. i = o;
  14302. break
  14303. }
  14304. if (i && a.label < i[2]) {
  14305. a.label = i[2],
  14306. a.ops.push(o);
  14307. break
  14308. }
  14309. i[2] && a.ops.pop(),
  14310. a.trys.pop();
  14311. continue
  14312. }
  14313. o = t.call(e, a)
  14314. } catch(e) {
  14315. o = [6, e],
  14316. r = 0
  14317. } finally {
  14318. n = i = 0
  14319. }
  14320. if (5 & o[0]) throw o[1];
  14321. return {
  14322. value: o[0] ? o[1] : void 0,
  14323. done: !0
  14324. }
  14325. } ([o, s])
  14326. }
  14327. }
  14328. },
  14329. o = this && this.__importDefault ||
  14330. function(e) {
  14331. return e && e.__esModule ? e: {
  14332. default:
  14333. e
  14334. }
  14335. };
  14336. Object.defineProperty(t, "__esModule", {
  14337. value: !0
  14338. });
  14339. var a = n(66),
  14340. s = n(4),
  14341. c = o(n(0));
  14342. t.getSupportedCodec = function(e) {
  14343. return r(void 0, void 0, void 0, (function() {
  14344. var t, n, r, o, u;
  14345. return i(this, (function(i) {
  14346. switch (i.label) {
  14347. case 0:
  14348. return t = {
  14349. video: [],
  14350. audio: []
  14351. },
  14352. "undefined" != typeof window ? [3, 1] : ("NOT_BROWSER_ENV", c.
  14353. default.error("getSupportedCodec: NOT_BROWSER_ENV"), [2, Promise.reject("NOT_BROWSER_ENV")]);
  14354. case 1:
  14355. try {
  14356. n = a.createRTCPeerConnection({
  14357. iceServers: []
  14358. })
  14359. } catch(e) {
  14360. return c.
  14361. default.error("Failed to init RTCPeerConnection", e),
  14362. [2, Promise.reject(e)]
  14363. }
  14364. return n ? [3, 2] : (c.
  14365. default.warning("getSupportedCodec: no RTCPeerConnection constructor is detected"), [2, Promise.resolve(t)]);
  14366. case 2:
  14367. return e && e.stream ? [3, 7] : (r = {
  14368. mandatory: {
  14369. OfferToReceiveAudio: !0,
  14370. OfferToReceiveVideo: !0
  14371. }
  14372. },
  14373. o = void 0, (s.isSafari() || s.isFireFox() || s.isWeChatBrowser()) && n.addTransceiver ? (n.addTransceiver("audio"), n.addTransceiver("video"), [4, n.createOffer()]) : [3, 4]);
  14374. case 3:
  14375. return o = i.sent(),
  14376. [3, 6];
  14377. case 4:
  14378. return [4, new Promise((function(e, t) {
  14379. var i = setTimeout((function() {
  14380. t("CREATEOFFER_TIMEOUT")
  14381. }), 3e3);
  14382. n.createOffer((function(t) {
  14383. clearTimeout(i),
  14384. e(t)
  14385. }), (function(e) {
  14386. clearTimeout(i),
  14387. t(e)
  14388. }), r)
  14389. }))];
  14390. case 5:
  14391. o = i.sent(),
  14392. i.label = 6;
  14393. case 6:
  14394. return n.close(),
  14395. u = o.sdp,
  14396. [2, d(u)];
  14397. case 7:
  14398. return e.stream.getTracks && n.addTrack ? e.stream.getTracks().forEach((function(t) {
  14399. n.addTrack(t, e.stream)
  14400. })) : n.addStream(e.stream),
  14401. o = void 0,
  14402. s.isSafari() || s.isFireFox() ? [4, n.createOffer()] : [3, 9];
  14403. case 8:
  14404. return o = i.sent(),
  14405. [3, 11];
  14406. case 9:
  14407. return [4, new Promise((function(e, t) {
  14408. n.createOffer(e, t)
  14409. }))];
  14410. case 10:
  14411. o = i.sent(),
  14412. i.label = 11;
  14413. case 11:
  14414. return n.close(),
  14415. u = o.sdp,
  14416. [2, d(u)]
  14417. }
  14418. }))
  14419. }))
  14420. };
  14421. var d = function(e) {
  14422. var t = {
  14423. video: [],
  14424. audio: []
  14425. };
  14426. return e.match(/ VP8/i) && t.video.push("VP8"),
  14427. e.match(/ H264/i) && t.video.push("H264"),
  14428. e.match(/ opus/i) && t.audio.push("OPUS"),
  14429. Promise.resolve(t)
  14430. }
  14431. },
  14432. function(e, t, n) {
  14433. "use strict";
  14434. var r = this && this.__awaiter ||
  14435. function(e, t, n, r) {
  14436. return new(n || (n = Promise))((function(i, o) {
  14437. function a(e) {
  14438. try {
  14439. c(r.next(e))
  14440. } catch(e) {
  14441. o(e)
  14442. }
  14443. }
  14444. function s(e) {
  14445. try {
  14446. c(r.
  14447. throw (e))
  14448. } catch(e) {
  14449. o(e)
  14450. }
  14451. }
  14452. function c(e) {
  14453. var t;
  14454. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  14455. e(t)
  14456. }))).then(a, s)
  14457. }
  14458. c((r = r.apply(e, t || [])).next())
  14459. }))
  14460. },
  14461. i = this && this.__generator ||
  14462. function(e, t) {
  14463. var n, r, i, o, a = {
  14464. label: 0,
  14465. sent: function() {
  14466. if (1 & i[0]) throw i[1];
  14467. return i[1]
  14468. },
  14469. trys: [],
  14470. ops: []
  14471. };
  14472. return o = {
  14473. next: s(0),
  14474. throw: s(1),
  14475. return: s(2)
  14476. },
  14477. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  14478. return this
  14479. }),
  14480. o;
  14481. function s(o) {
  14482. return function(s) {
  14483. return function(o) {
  14484. if (n) throw new TypeError("Generator is already executing.");
  14485. for (; a;) try {
  14486. if (n = 1, r && (i = 2 & o[0] ? r.
  14487. return: o[0] ? r.
  14488. throw || ((i = r.
  14489. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  14490. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  14491. case 0:
  14492. case 1:
  14493. i = o;
  14494. break;
  14495. case 4:
  14496. return a.label++,
  14497. {
  14498. value: o[1],
  14499. done: !1
  14500. };
  14501. case 5:
  14502. a.label++,
  14503. r = o[1],
  14504. o = [0];
  14505. continue;
  14506. case 7:
  14507. o = a.ops.pop(),
  14508. a.trys.pop();
  14509. continue;
  14510. default:
  14511. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  14512. a = 0;
  14513. continue
  14514. }
  14515. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  14516. a.label = o[1];
  14517. break
  14518. }
  14519. if (6 === o[0] && a.label < i[1]) {
  14520. a.label = i[1],
  14521. i = o;
  14522. break
  14523. }
  14524. if (i && a.label < i[2]) {
  14525. a.label = i[2],
  14526. a.ops.push(o);
  14527. break
  14528. }
  14529. i[2] && a.ops.pop(),
  14530. a.trys.pop();
  14531. continue
  14532. }
  14533. o = t.call(e, a)
  14534. } catch(e) {
  14535. o = [6, e],
  14536. r = 0
  14537. } finally {
  14538. n = i = 0
  14539. }
  14540. if (5 & o[0]) throw o[1];
  14541. return {
  14542. value: o[0] ? o[1] : void 0,
  14543. done: !0
  14544. }
  14545. } ([o, s])
  14546. }
  14547. }
  14548. },
  14549. o = this && this.__importDefault ||
  14550. function(e) {
  14551. return e && e.__esModule ? e: {
  14552. default:
  14553. e
  14554. }
  14555. };
  14556. Object.defineProperty(t, "__esModule", {
  14557. value: !0
  14558. });
  14559. var a = o(n(0)),
  14560. s = n(71),
  14561. c = n(23),
  14562. d = n(1),
  14563. u = n(26);
  14564. t.addLiveStreamingCapability = function(e, t) {
  14565. var n = this,
  14566. o = function(t) {
  14567. var n = t.type;
  14568. if (!e.joinInfo) return new c.AgoraRTCError(c.AgoraRTCErrorCode.INVALID_OPERATION, "can not create live streaming client, please join channel first").
  14569. throw ();
  14570. switch (n) {
  14571. case u.LiveStreamingServiceMode.INJECT:
  14572. return e._injectStreamingClient || (e._injectStreamingClient = new s.AgoraRTCLiveStreamingClient(e.joinInfo), e._injectStreamingClient.onInjectStatusChange = function(t, n, r) {
  14573. e.gatewayClient.dispatchEvent({
  14574. type: "streamInjectedStatus",
  14575. url: r,
  14576. status: t
  14577. })
  14578. }),
  14579. e._injectStreamingClient;
  14580. case u.LiveStreamingServiceMode.RAW:
  14581. return e._liveRawStreamingClient || (e._liveRawStreamingClient = new s.AgoraRTCLiveStreamingClient(e.joinInfo), e._liveRawStreamingClient.onLiveStreamError = function(t, n) {
  14582. a.
  14583. default.error("LIVE_STREAMING_ERROR", n.toString()),
  14584. e.gatewayClient.dispatchEvent({
  14585. type: "liveStreamingFailed",
  14586. url: t,
  14587. reason: n.code
  14588. })
  14589. },
  14590. e._liveRawStreamingClient.onLiveStreamWarning = function(t, n) {
  14591. a.
  14592. default.warning("LIVE_STREAMING_WARNING", n.toString()),
  14593. e.gatewayClient.dispatchEvent({
  14594. type: "liveStreamingWarning",
  14595. url: t,
  14596. reason: n.code
  14597. })
  14598. }),
  14599. e._liveRawStreamingClient;
  14600. case u.LiveStreamingServiceMode.TRANSCODE:
  14601. return e._liveTranscodeStreamingClient || (e._liveTranscodeStreamingClient = new s.AgoraRTCLiveStreamingClient(e.joinInfo), e._liveTranscodeStreamingClient.onLiveStreamError = function(t, n) {
  14602. a.
  14603. default.error("LIVE_STREAMING_ERROR", n.toString()),
  14604. e.gatewayClient.dispatchEvent({
  14605. type: "liveStreamingFailed",
  14606. url: t,
  14607. reason: n.code
  14608. })
  14609. },
  14610. e._liveTranscodeStreamingClient.onLiveStreamWarning = function(t, n) {
  14611. a.
  14612. default.warning("LIVE_STREAMING_WARNING", n.toString()),
  14613. e.gatewayClient.dispatchEvent({
  14614. type: "liveStreamingWarning",
  14615. url: t,
  14616. reason: n.code
  14617. })
  14618. }),
  14619. e._liveTranscodeStreamingClient
  14620. }
  14621. };
  14622. e.gatewayClient.addEventListener("join", (function(t) {
  14623. e._injectStreamingClient && e._injectStreamingClient.resetAllTask()
  14624. })),
  14625. e.gatewayClient.addEventListener("stream-unpublished", (function(t) {
  14626. t.options && 0 === t.options.streamType && (e._liveRawStreamingClient && e._liveRawStreamingClient.resetAllTask(), e._liveTranscodeStreamingClient && e._liveTranscodeStreamingClient.resetAllTask())
  14627. })),
  14628. e.gatewayClient.addEventListener("stream-published", (function(e) {})),
  14629. e.startLiveStreaming = function(n, r) {
  14630. a.
  14631. default.debug("startLiveTranscoding");
  14632. var i = d.report.reportApiInvoke(t.sessionId, {
  14633. name: "Client.startLiveStreaming",
  14634. options: arguments,
  14635. tag: "tracer"
  14636. });
  14637. if (e.gatewayClient && "audience" === e.gatewayClient.role) {
  14638. var o = {
  14639. code: 403,
  14640. reason: "AUDIENCE_STREAMING_FORBIDDEN"
  14641. };
  14642. throw i(o),
  14643. o
  14644. }
  14645. var s = e._startLiveStreaming(n, r);
  14646. return s.then((function(e) {
  14647. i(null, e)
  14648. })).
  14649. catch((function(t) {
  14650. a.
  14651. default.error("LIVE_STREAMING_ERROR", t.toString()),
  14652. e.gatewayClient.dispatchEvent({
  14653. type: "liveStreamingFailed",
  14654. url: n,
  14655. reason: t.code
  14656. }),
  14657. i(t)
  14658. })),
  14659. s
  14660. },
  14661. e._startLiveStreaming = function(s, d) {
  14662. return r(n, void 0, void 0, (function() {
  14663. var n;
  14664. return i(this, (function(r) {
  14665. switch (r.label) {
  14666. case 0:
  14667. return d || ("vp8" === t.codec && a.
  14668. default.warning("VP8 is not supported by raw_streaming. Subscriber side will suffer"), "rtc" === t.mode && a.
  14669. default.warning("RTC mode is not supported by raw_streaming. Subscriber side will suffer")),
  14670. (e._liveRawStreamingClient && e._liveRawStreamingClient.haveUrl(s) || e._liveTranscodeStreamingClient && e._liveTranscodeStreamingClient.haveUrl(s)) && new c.AgoraRTCError(c.AgoraRTCErrorCode.LIVE_STREAMING_TASK_CONFLICT).
  14671. throw (),
  14672. n = d ? u.LiveStreamingServiceMode.TRANSCODE: u.LiveStreamingServiceMode.RAW,
  14673. [4, o({
  14674. type: n
  14675. }).startLiveStreamingTask(s, n)];
  14676. case 1:
  14677. return r.sent(),
  14678. e.gatewayClient.dispatchEvent({
  14679. type: "liveStreamingStarted",
  14680. url: s
  14681. }),
  14682. [2]
  14683. }
  14684. }))
  14685. }))
  14686. },
  14687. e.setLiveTranscoding = function(n) {
  14688. a.
  14689. default.debug("setLiveTranscoding: " + JSON.stringify(n));
  14690. var r = d.report.reportApiInvoke(t.sessionId, {
  14691. name: "Client.setLiveTranscoding",
  14692. options: arguments,
  14693. tag: "tracer"
  14694. }),
  14695. i = o({
  14696. type: u.LiveStreamingServiceMode.TRANSCODE
  14697. });
  14698. return i.setTranscodingConfig(n).then((function() {
  14699. e.gatewayClient.dispatchEvent({
  14700. type: "liveTranscodingUpdated"
  14701. }),
  14702. r(null)
  14703. })).
  14704. catch((function(t) {
  14705. a.
  14706. default.error("SET_LIVE_TRANSCODING_ERROR", t.toString()),
  14707. e.gatewayClient.dispatchEvent({
  14708. type: "liveStreamingFailed",
  14709. reason: t.code
  14710. }),
  14711. r(t)
  14712. }))
  14713. },
  14714. e.stopLiveStreaming = function(n) {
  14715. var r = d.report.reportApiInvoke(t.sessionId, {
  14716. name: "Client.stopLiveStreaming",
  14717. options: arguments,
  14718. tag: "tracer"
  14719. }),
  14720. i = e._stopLiveStreaming(n);
  14721. return i.then((function(e) {
  14722. r(null, e)
  14723. })).
  14724. catch((function(t) {
  14725. a.
  14726. default.error("STOP_LIVE_STREAMING_ERROR", t.toString()),
  14727. e.gatewayClient.dispatchEvent({
  14728. type: "liveStreamingFailed",
  14729. reason: t.code
  14730. }),
  14731. r(t)
  14732. })),
  14733. i
  14734. },
  14735. e._stopLiveStreaming = function(t) {
  14736. return r(this, void 0, void 0, (function() {
  14737. var n;
  14738. return i(this, (function(r) {
  14739. switch (r.label) {
  14740. case 0:
  14741. return n = [e._liveRawStreamingClient, e._liveTranscodeStreamingClient],
  14742. [4, Promise.all(n.map((function(e) {
  14743. return e && e.haveUrl(t) && e.stopLiveStreamingTask(t)
  14744. })))];
  14745. case 1:
  14746. return r.sent(),
  14747. [2]
  14748. }
  14749. }))
  14750. }))
  14751. },
  14752. e.addInjectStreamUrl = function(n, r) {
  14753. var i = d.report.reportApiInvoke(t.sessionId, {
  14754. name: "Client.addInjectStreamUrl",
  14755. options: [n, r],
  14756. tag: "tracer"
  14757. });
  14758. if ("audience" === e.gatewayClient.role) {
  14759. var o = {
  14760. code: 403,
  14761. reason: "AUDIENCE_INJECTING_FORBIDDEN"
  14762. };
  14763. throw i(o),
  14764. o
  14765. }
  14766. var s = e._addInjectStreamUrl(n, r);
  14767. return s.then((function(e) {
  14768. i(null, e)
  14769. })).
  14770. catch((function(e) {
  14771. a.
  14772. default.error("ADD_INJECT_STREAM_ERROR", e.toString()),
  14773. i(e)
  14774. })),
  14775. s
  14776. },
  14777. e._addInjectStreamUrl = function(e, t) {
  14778. return r(n, void 0, void 0, (function() {
  14779. var n;
  14780. return i(this, (function(r) {
  14781. switch (r.label) {
  14782. case 0:
  14783. return (n = o({
  14784. type: u.LiveStreamingServiceMode.INJECT
  14785. })).setInjectStreamConfig(t, 0),
  14786. [4, n.startLiveStreamingTask(e, u.LiveStreamingServiceMode.INJECT)];
  14787. case 1:
  14788. return r.sent(),
  14789. [2]
  14790. }
  14791. }))
  14792. }))
  14793. },
  14794. e.removeInjectStreamUrl = function(n) {
  14795. return r(this, void 0, void 0, (function() {
  14796. var r, o;
  14797. return i(this, (function(i) {
  14798. return r = d.report.reportApiInvoke(t.sessionId, {
  14799. name: "Client.removeInjectStreamUrl",
  14800. options: [n],
  14801. tag: "tracer"
  14802. }),
  14803. (o = e._removeInjectStreamUrl(n)).then((function(e) {
  14804. r(null, e)
  14805. })).
  14806. catch((function(e) {
  14807. a.
  14808. default.error("REMOVE_INJECT_STREAM_ERROR", e.toString()),
  14809. r(e)
  14810. })),
  14811. [2, o]
  14812. }))
  14813. }))
  14814. },
  14815. e._removeInjectStreamUrl = function(e) {
  14816. return r(n, void 0, void 0, (function() {
  14817. return i(this, (function(t) {
  14818. switch (t.label) {
  14819. case 0:
  14820. return [4, o({
  14821. type: u.LiveStreamingServiceMode.INJECT
  14822. }).stopLiveStreamingTask(e)];
  14823. case 1:
  14824. return t.sent(),
  14825. [2]
  14826. }
  14827. }))
  14828. }))
  14829. }
  14830. }
  14831. },
  14832. function(e, t, n) {
  14833. "use strict";
  14834. var r = this && this.__importDefault ||
  14835. function(e) {
  14836. return e && e.__esModule ? e: {
  14837. default:
  14838. e
  14839. }
  14840. };
  14841. Object.defineProperty(t, "__esModule", {
  14842. value: !0
  14843. });
  14844. var i = r(n(5)),
  14845. o = r(n(0)),
  14846. a = n(10);
  14847. t.
  14848. default = function(e, t) {
  14849. void 0 === t && (t = {
  14850. width: 160,
  14851. height: 120,
  14852. framerate: 15
  14853. });
  14854. var n = t.width,
  14855. r = t.height,
  14856. s = t.framerate,
  14857. c = e.stream;
  14858. if (!c) throw i.
  14859. default.INVALID_LOCAL_STREAM;
  14860. if (!c.getVideoTracks()[0]) throw i.
  14861. default.HIGH_STREAM_NOT_VIDEO_TRACE;
  14862. var d = c.getVideoTracks()[0];
  14863. o.
  14864. default.debug("Start getLowStream");
  14865. var u = document.createElement("video"),
  14866. l = document.createElement("canvas");
  14867. u.setAttribute("style", "display:none"),
  14868. u.setAttribute("muted", ""),
  14869. u.muted = !0,
  14870. u.setAttribute("autoplay", ""),
  14871. u.autoplay = !0,
  14872. u.setAttribute("playsinline", ""),
  14873. l.setAttribute("style", "display:none"),
  14874. l.setAttribute("width", n.toString()),
  14875. l.setAttribute("height", r.toString());
  14876. var p = l.getContext("2d");
  14877. if (!p) throw new Error("not get canvas context");
  14878. u.srcObject = c,
  14879. document.body.append(u),
  14880. document.body.append(l),
  14881. u.play(),
  14882. o.
  14883. default.debug("Start render lowStream");
  14884. var f = a.audioTimerLoop((function() {
  14885. return function() {
  14886. if (u.paused && u.play(), u.videoHeight > 2 && u.videoWidth > 2) {
  14887. var t = u.videoWidth,
  14888. n = u.videoHeight / t,
  14889. r = l.width * n;
  14890. Math.abs(r - l.height) >= 2 && (o.
  14891. default.debug("adjust low stream resolution", l.width + "x" + l.height + " -> " + l.width + "x" + r), l.height = r)
  14892. }
  14893. p.drawImage(u, 0, 0, l.width, l.height);
  14894. var i = e.stream;
  14895. if (i) {
  14896. var a = i.getVideoTracks()[0];
  14897. d !== a && (o.
  14898. default.debug("adjust low stream track"), u.srcObject = i, d = a)
  14899. }
  14900. } ()
  14901. }), s),
  14902. g = l.captureStream(s),
  14903. m = g.getVideoTracks()[0];
  14904. return m.requestFrame && m.requestFrame(),
  14905. g.clean = function() {
  14906. o.
  14907. default.debug("Start clean lowStream"),
  14908. f(),
  14909. (u || u.parentNode || u.parentNode.removeChild) && u.parentNode.removeChild(u),
  14910. (l || l.parentNode || l.parentNode.removeChild) && l.parentNode.removeChild(l),
  14911. o.
  14912. default.debug("Clean lowStream")
  14913. },
  14914. g
  14915. }
  14916. },
  14917. function(e, t) {
  14918. var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
  14919. if (n) {
  14920. var r = new Uint8Array(16);
  14921. e.exports = function() {
  14922. return n(r),
  14923. r
  14924. }
  14925. } else {
  14926. var i = new Array(16);
  14927. e.exports = function() {
  14928. for (var e, t = 0; t < 16; t++) 0 == (3 & t) && (e = 4294967296 * Math.random()),
  14929. i[t] = e >>> ((3 & t) << 3) & 255;
  14930. return i
  14931. }
  14932. }
  14933. },
  14934. function(e, t) {
  14935. for (var n = [], r = 0; r < 256; ++r) n[r] = (r + 256).toString(16).substr(1);
  14936. e.exports = function(e, t) {
  14937. var r = t || 0,
  14938. i = n;
  14939. return [i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], "-", i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]], i[e[r++]]].join("")
  14940. }
  14941. },
  14942. function(module, exports, __webpack_require__) { (function(global, module) {
  14943. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14944. /*!
  14945. * protobuf.js v6.10.0 (c) 2016, daniel wirtz
  14946. * compiled wed, 15 jul 2020 23:34:13 utc
  14947. * licensed under the bsd-3-clause license
  14948. * see: https://github.com/dcodeio/protobuf.js for details
  14949. */
  14950. !
  14951. function(undefined) {
  14952. "use strict"; !
  14953. function(e, t, n) {
  14954. var r = function n(r) {
  14955. var i = t[r];
  14956. return i || e[r][0].call(i = t[r] = {
  14957. exports: {}
  14958. },
  14959. n, i, i.exports),
  14960. i.exports
  14961. } (n[0]);
  14962. r.util.global.protobuf = r,
  14963. __WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(59)],
  14964. (__WEBPACK_AMD_DEFINE_RESULT__ = function(e) {
  14965. return e && e.isLong && (r.util.Long = e, r.configure()),
  14966. r
  14967. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) === undefined || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__),
  14968. module && module.exports && (module.exports = r)
  14969. } ({
  14970. 1 : [function(e, t, n) {
  14971. t.exports = function(e, t) {
  14972. var n = new Array(arguments.length - 1),
  14973. r = 0,
  14974. i = 2,
  14975. o = !0;
  14976. for (; i < arguments.length;) n[r++] = arguments[i++];
  14977. return new Promise((function(i, a) {
  14978. n[r] = function(e) {
  14979. if (o) if (o = !1, e) a(e);
  14980. else {
  14981. for (var t = new Array(arguments.length - 1), n = 0; n < t.length;) t[n++] = arguments[n];
  14982. i.apply(null, t)
  14983. }
  14984. };
  14985. try {
  14986. e.apply(t || null, n)
  14987. } catch(e) {
  14988. o && (o = !1, a(e))
  14989. }
  14990. }))
  14991. }
  14992. },
  14993. {}],
  14994. 2 : [function(e, t, n) {
  14995. var r = n;
  14996. r.length = function(e) {
  14997. var t = e.length;
  14998. if (!t) return 0;
  14999. for (var n = 0; --t % 4 > 1 && "=" === e.charAt(t);)++n;
  15000. return Math.ceil(3 * e.length) / 4 - n
  15001. };
  15002. for (var i = new Array(64), o = new Array(123), a = 0; a < 64;) o[i[a] = a < 26 ? a + 65 : a < 52 ? a + 71 : a < 62 ? a - 4 : a - 59 | 43] = a++;
  15003. r.encode = function(e, t, n) {
  15004. for (var r, o = null,
  15005. a = [], s = 0, c = 0; t < n;) {
  15006. var d = e[t++];
  15007. switch (c) {
  15008. case 0:
  15009. a[s++] = i[d >> 2],
  15010. r = (3 & d) << 4,
  15011. c = 1;
  15012. break;
  15013. case 1:
  15014. a[s++] = i[r | d >> 4],
  15015. r = (15 & d) << 2,
  15016. c = 2;
  15017. break;
  15018. case 2:
  15019. a[s++] = i[r | d >> 6],
  15020. a[s++] = i[63 & d],
  15021. c = 0
  15022. }
  15023. s > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, a)), s = 0)
  15024. }
  15025. return c && (a[s++] = i[r], a[s++] = 61, 1 === c && (a[s++] = 61)),
  15026. o ? (s && o.push(String.fromCharCode.apply(String, a.slice(0, s))), o.join("")) : String.fromCharCode.apply(String, a.slice(0, s))
  15027. };
  15028. r.decode = function(e, t, n) {
  15029. for (var r, i = n,
  15030. a = 0,
  15031. s = 0; s < e.length;) {
  15032. var c = e.charCodeAt(s++);
  15033. if (61 === c && a > 1) break;
  15034. if ((c = o[c]) === undefined) throw Error("invalid encoding");
  15035. switch (a) {
  15036. case 0:
  15037. r = c,
  15038. a = 1;
  15039. break;
  15040. case 1:
  15041. t[n++] = r << 2 | (48 & c) >> 4,
  15042. r = c,
  15043. a = 2;
  15044. break;
  15045. case 2:
  15046. t[n++] = (15 & r) << 4 | (60 & c) >> 2,
  15047. r = c,
  15048. a = 3;
  15049. break;
  15050. case 3:
  15051. t[n++] = (3 & r) << 6 | c,
  15052. a = 0
  15053. }
  15054. }
  15055. if (1 === a) throw Error("invalid encoding");
  15056. return n - i
  15057. },
  15058. r.test = function(e) {
  15059. return /^(?:[A-Za-z0-9+/] {4}) * ( ? :[A - Za - z0 - 9 + /]{2}==|[A-Za-z0-9+/] {3} = ) ? $ / .test(e)
  15060. }
  15061. },
  15062. {}],
  15063. 3 : [function(e, t, n) {
  15064. function r(e, t) {
  15065. "string" == typeof e && (t = e, e = undefined);
  15066. var n = [];
  15067. function i(e) {
  15068. if ("string" != typeof e) {
  15069. var t = o();
  15070. if (r.verbose && console.log("codegen: " + t), t = "return " + t, e) {
  15071. for (var a = Object.keys(e), s = new Array(a.length + 1), c = new Array(a.length), d = 0; d < a.length;) s[d] = a[d],
  15072. c[d] = e[a[d++]];
  15073. return s[d] = t,
  15074. Function.apply(null, s).apply(null, c)
  15075. }
  15076. return Function(t)()
  15077. }
  15078. for (var u = new Array(arguments.length - 1), l = 0; l < u.length;) u[l] = arguments[++l];
  15079. if (l = 0, e = e.replace(/%([%dfijs])/g, (function(e, t) {
  15080. var n = u[l++];
  15081. switch (t) {
  15082. case "d":
  15083. case "f":
  15084. return String(Number(n));
  15085. case "i":
  15086. return String(Math.floor(n));
  15087. case "j":
  15088. return JSON.stringify(n);
  15089. case "s":
  15090. return String(n)
  15091. }
  15092. return "%"
  15093. })), l !== u.length) throw Error("parameter count mismatch");
  15094. return n.push(e),
  15095. i
  15096. }
  15097. function o(r) {
  15098. return "function " + (r || t || "") + "(" + (e && e.join(",") || "") + "){\n " + n.join("\n ") + "\n}"
  15099. }
  15100. return i.toString = o,
  15101. i
  15102. }
  15103. t.exports = r,
  15104. r.verbose = !1
  15105. },
  15106. {}],
  15107. 4 : [function(e, t, n) {
  15108. function r() {
  15109. this._listeners = {}
  15110. }
  15111. t.exports = r,
  15112. r.prototype.on = function(e, t, n) {
  15113. return (this._listeners[e] || (this._listeners[e] = [])).push({
  15114. fn: t,
  15115. ctx: n || this
  15116. }),
  15117. this
  15118. },
  15119. r.prototype.off = function(e, t) {
  15120. if (e === undefined) this._listeners = {};
  15121. else if (t === undefined) this._listeners[e] = [];
  15122. else for (var n = this._listeners[e], r = 0; r < n.length;) n[r].fn === t ? n.splice(r, 1) : ++r;
  15123. return this
  15124. },
  15125. r.prototype.emit = function(e) {
  15126. var t = this._listeners[e];
  15127. if (t) {
  15128. for (var n = [], r = 1; r < arguments.length;) n.push(arguments[r++]);
  15129. for (r = 0; r < t.length;) t[r].fn.apply(t[r++].ctx, n)
  15130. }
  15131. return this
  15132. }
  15133. },
  15134. {}],
  15135. 5 : [function(e, t, n) {
  15136. t.exports = o;
  15137. var r = e(1),
  15138. i = e(7)("fs");
  15139. function o(e, t, n) {
  15140. return "function" == typeof t ? (n = t, t = {}) : t || (t = {}),
  15141. n ? !t.xhr && i && i.readFile ? i.readFile(e, (function(r, i) {
  15142. return r && "undefined" != typeof XMLHttpRequest ? o.xhr(e, t, n) : r ? n(r) : n(null, t.binary ? i: i.toString("utf8"))
  15143. })) : o.xhr(e, t, n) : r(o, this, e, t)
  15144. }
  15145. o.xhr = function(e, t, n) {
  15146. var r = new XMLHttpRequest;
  15147. r.onreadystatechange = function() {
  15148. if (4 !== r.readyState) return undefined;
  15149. if (0 !== r.status && 200 !== r.status) return n(Error("status " + r.status));
  15150. if (t.binary) {
  15151. var e = r.response;
  15152. if (!e) {
  15153. e = [];
  15154. for (var i = 0; i < r.responseText.length; ++i) e.push(255 & r.responseText.charCodeAt(i))
  15155. }
  15156. return n(null, "undefined" != typeof Uint8Array ? new Uint8Array(e) : e)
  15157. }
  15158. return n(null, r.responseText)
  15159. },
  15160. t.binary && ("overrideMimeType" in r && r.overrideMimeType("text/plain; charset=x-user-defined"), r.responseType = "arraybuffer"),
  15161. r.open("GET", e),
  15162. r.send()
  15163. }
  15164. },
  15165. {
  15166. 1 : 1,
  15167. 7 : 7
  15168. }],
  15169. 6 : [function(e, t, n) {
  15170. function r(e) {
  15171. return "undefined" != typeof Float32Array ?
  15172. function() {
  15173. var t = new Float32Array([ - 0]),
  15174. n = new Uint8Array(t.buffer),
  15175. r = 128 === n[3];
  15176. function i(e, r, i) {
  15177. t[0] = e,
  15178. r[i] = n[0],
  15179. r[i + 1] = n[1],
  15180. r[i + 2] = n[2],
  15181. r[i + 3] = n[3]
  15182. }
  15183. function o(e, r, i) {
  15184. t[0] = e,
  15185. r[i] = n[3],
  15186. r[i + 1] = n[2],
  15187. r[i + 2] = n[1],
  15188. r[i + 3] = n[0]
  15189. }
  15190. function a(e, r) {
  15191. return n[0] = e[r],
  15192. n[1] = e[r + 1],
  15193. n[2] = e[r + 2],
  15194. n[3] = e[r + 3],
  15195. t[0]
  15196. }
  15197. function s(e, r) {
  15198. return n[3] = e[r],
  15199. n[2] = e[r + 1],
  15200. n[1] = e[r + 2],
  15201. n[0] = e[r + 3],
  15202. t[0]
  15203. }
  15204. e.writeFloatLE = r ? i: o,
  15205. e.writeFloatBE = r ? o: i,
  15206. e.readFloatLE = r ? a: s,
  15207. e.readFloatBE = r ? s: a
  15208. } () : function() {
  15209. function t(e, t, n, r) {
  15210. var i = t < 0 ? 1 : 0;
  15211. if (i && (t = -t), 0 === t) e(1 / t > 0 ? 0 : 2147483648, n, r);
  15212. else if (isNaN(t)) e(2143289344, n, r);
  15213. else if (t > 34028234663852886e22) e((i << 31 | 2139095040) >>> 0, n, r);
  15214. else if (t < 11754943508222875e-54) e((i << 31 | Math.round(t / 1401298464324817e-60)) >>> 0, n, r);
  15215. else {
  15216. var o = Math.floor(Math.log(t) / Math.LN2);
  15217. e((i << 31 | o + 127 << 23 | 8388607 & Math.round(t * Math.pow(2, -o) * 8388608)) >>> 0, n, r)
  15218. }
  15219. }
  15220. function n(e, t, n) {
  15221. var r = e(t, n),
  15222. i = 2 * (r >> 31) + 1,
  15223. o = r >>> 23 & 255,
  15224. a = 8388607 & r;
  15225. return 255 === o ? a ? NaN: i * (1 / 0) : 0 === o ? 1401298464324817e-60 * i * a: i * Math.pow(2, o - 150) * (a + 8388608)
  15226. }
  15227. e.writeFloatLE = t.bind(null, i),
  15228. e.writeFloatBE = t.bind(null, o),
  15229. e.readFloatLE = n.bind(null, a),
  15230. e.readFloatBE = n.bind(null, s)
  15231. } (),
  15232. "undefined" != typeof Float64Array ?
  15233. function() {
  15234. var t = new Float64Array([ - 0]),
  15235. n = new Uint8Array(t.buffer),
  15236. r = 128 === n[7];
  15237. function i(e, r, i) {
  15238. t[0] = e,
  15239. r[i] = n[0],
  15240. r[i + 1] = n[1],
  15241. r[i + 2] = n[2],
  15242. r[i + 3] = n[3],
  15243. r[i + 4] = n[4],
  15244. r[i + 5] = n[5],
  15245. r[i + 6] = n[6],
  15246. r[i + 7] = n[7]
  15247. }
  15248. function o(e, r, i) {
  15249. t[0] = e,
  15250. r[i] = n[7],
  15251. r[i + 1] = n[6],
  15252. r[i + 2] = n[5],
  15253. r[i + 3] = n[4],
  15254. r[i + 4] = n[3],
  15255. r[i + 5] = n[2],
  15256. r[i + 6] = n[1],
  15257. r[i + 7] = n[0]
  15258. }
  15259. function a(e, r) {
  15260. return n[0] = e[r],
  15261. n[1] = e[r + 1],
  15262. n[2] = e[r + 2],
  15263. n[3] = e[r + 3],
  15264. n[4] = e[r + 4],
  15265. n[5] = e[r + 5],
  15266. n[6] = e[r + 6],
  15267. n[7] = e[r + 7],
  15268. t[0]
  15269. }
  15270. function s(e, r) {
  15271. return n[7] = e[r],
  15272. n[6] = e[r + 1],
  15273. n[5] = e[r + 2],
  15274. n[4] = e[r + 3],
  15275. n[3] = e[r + 4],
  15276. n[2] = e[r + 5],
  15277. n[1] = e[r + 6],
  15278. n[0] = e[r + 7],
  15279. t[0]
  15280. }
  15281. e.writeDoubleLE = r ? i: o,
  15282. e.writeDoubleBE = r ? o: i,
  15283. e.readDoubleLE = r ? a: s,
  15284. e.readDoubleBE = r ? s: a
  15285. } () : function() {
  15286. function t(e, t, n, r, i, o) {
  15287. var a = r < 0 ? 1 : 0;
  15288. if (a && (r = -r), 0 === r) e(0, i, o + t),
  15289. e(1 / r > 0 ? 0 : 2147483648, i, o + n);
  15290. else if (isNaN(r)) e(0, i, o + t),
  15291. e(2146959360, i, o + n);
  15292. else if (r > 17976931348623157e292) e(0, i, o + t),
  15293. e((a << 31 | 2146435072) >>> 0, i, o + n);
  15294. else {
  15295. var s;
  15296. if (r < 22250738585072014e-324) e((s = r / 5e-324) >>> 0, i, o + t),
  15297. e((a << 31 | s / 4294967296) >>> 0, i, o + n);
  15298. else {
  15299. var c = Math.floor(Math.log(r) / Math.LN2);
  15300. 1024 === c && (c = 1023),
  15301. e(4503599627370496 * (s = r * Math.pow(2, -c)) >>> 0, i, o + t),
  15302. e((a << 31 | c + 1023 << 20 | 1048576 * s & 1048575) >>> 0, i, o + n)
  15303. }
  15304. }
  15305. }
  15306. function n(e, t, n, r, i) {
  15307. var o = e(r, i + t),
  15308. a = e(r, i + n),
  15309. s = 2 * (a >> 31) + 1,
  15310. c = a >>> 20 & 2047,
  15311. d = 4294967296 * (1048575 & a) + o;
  15312. return 2047 === c ? d ? NaN: s * (1 / 0) : 0 === c ? 5e-324 * s * d: s * Math.pow(2, c - 1075) * (d + 4503599627370496)
  15313. }
  15314. e.writeDoubleLE = t.bind(null, i, 0, 4),
  15315. e.writeDoubleBE = t.bind(null, o, 4, 0),
  15316. e.readDoubleLE = n.bind(null, a, 0, 4),
  15317. e.readDoubleBE = n.bind(null, s, 4, 0)
  15318. } (),
  15319. e
  15320. }
  15321. function i(e, t, n) {
  15322. t[n] = 255 & e,
  15323. t[n + 1] = e >>> 8 & 255,
  15324. t[n + 2] = e >>> 16 & 255,
  15325. t[n + 3] = e >>> 24
  15326. }
  15327. function o(e, t, n) {
  15328. t[n] = e >>> 24,
  15329. t[n + 1] = e >>> 16 & 255,
  15330. t[n + 2] = e >>> 8 & 255,
  15331. t[n + 3] = 255 & e
  15332. }
  15333. function a(e, t) {
  15334. return (e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24) >>> 0
  15335. }
  15336. function s(e, t) {
  15337. return (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0
  15338. }
  15339. t.exports = r(r)
  15340. },
  15341. {}],
  15342. 7 : [function(require, module, exports) {
  15343. function inquire(moduleName) {
  15344. try {
  15345. var mod = eval("quire".replace(/^/, "re"))(moduleName);
  15346. if (mod && (mod.length || Object.keys(mod).length)) return mod
  15347. } catch(e) {}
  15348. return null
  15349. }
  15350. module.exports = inquire
  15351. },
  15352. {}],
  15353. 8 : [function(e, t, n) {
  15354. var r = n,
  15355. i = r.isAbsolute = function(e) {
  15356. return /^(?:\/|\w+:)/.test(e)
  15357. },
  15358. o = r.normalize = function(e) {
  15359. var t = (e = e.replace(/\\/g, "/").replace(/\/{2,}/g, "/")).split("/"),
  15360. n = i(e),
  15361. r = "";
  15362. n && (r = t.shift() + "/");
  15363. for (var o = 0; o < t.length;)".." === t[o] ? o > 0 && ".." !== t[o - 1] ? t.splice(--o, 2) : n ? t.splice(o, 1) : ++o: "." === t[o] ? t.splice(o, 1) : ++o;
  15364. return r + t.join("/")
  15365. };
  15366. r.resolve = function(e, t, n) {
  15367. return n || (t = o(t)),
  15368. i(t) ? t: (n || (e = o(e)), (e = e.replace(/(?:\/|^)[^/] + $ / , "")).length ? o(e + "/" + t) : t)
  15369. }
  15370. },
  15371. {}],
  15372. 9 : [function(e, t, n) {
  15373. t.exports = function(e, t, n) {
  15374. var r = n || 8192,
  15375. i = r >>> 1,
  15376. o = null,
  15377. a = r;
  15378. return function(n) {
  15379. if (n < 1 || n > i) return e(n);
  15380. a + n > r && (o = e(r), a = 0);
  15381. var s = t.call(o, a, a += n);
  15382. return 7 & a && (a = 1 + (7 | a)),
  15383. s
  15384. }
  15385. }
  15386. },
  15387. {}],
  15388. 10 : [function(e, t, n) {
  15389. var r = n;
  15390. r.length = function(e) {
  15391. for (var t = 0,
  15392. n = 0,
  15393. r = 0; r < e.length; ++r)(n = e.charCodeAt(r)) < 128 ? t += 1 : n < 2048 ? t += 2 : 55296 == (64512 & n) && 56320 == (64512 & e.charCodeAt(r + 1)) ? (++r, t += 4) : t += 3;
  15394. return t
  15395. },
  15396. r.read = function(e, t, n) {
  15397. if (n - t < 1) return "";
  15398. for (var r, i = null,
  15399. o = [], a = 0; t < n;)(r = e[t++]) < 128 ? o[a++] = r: r > 191 && r < 224 ? o[a++] = (31 & r) << 6 | 63 & e[t++] : r > 239 && r < 365 ? (r = ((7 & r) << 18 | (63 & e[t++]) << 12 | (63 & e[t++]) << 6 | 63 & e[t++]) - 65536, o[a++] = 55296 + (r >> 10), o[a++] = 56320 + (1023 & r)) : o[a++] = (15 & r) << 12 | (63 & e[t++]) << 6 | 63 & e[t++],
  15400. a > 8191 && ((i || (i = [])).push(String.fromCharCode.apply(String, o)), a = 0);
  15401. return i ? (a && i.push(String.fromCharCode.apply(String, o.slice(0, a))), i.join("")) : String.fromCharCode.apply(String, o.slice(0, a))
  15402. },
  15403. r.write = function(e, t, n) {
  15404. for (var r, i, o = n,
  15405. a = 0; a < e.length; ++a)(r = e.charCodeAt(a)) < 128 ? t[n++] = r: r < 2048 ? (t[n++] = r >> 6 | 192, t[n++] = 63 & r | 128) : 55296 == (64512 & r) && 56320 == (64512 & (i = e.charCodeAt(a + 1))) ? (r = 65536 + ((1023 & r) << 10) + (1023 & i), ++a, t[n++] = r >> 18 | 240, t[n++] = r >> 12 & 63 | 128, t[n++] = r >> 6 & 63 | 128, t[n++] = 63 & r | 128) : (t[n++] = r >> 12 | 224, t[n++] = r >> 6 & 63 | 128, t[n++] = 63 & r | 128);
  15406. return n - o
  15407. }
  15408. },
  15409. {}],
  15410. 11 : [function(e, t, n) {
  15411. var r = n,
  15412. i = e(14),
  15413. o = e(33);
  15414. function a(e, t, n, r) {
  15415. if (t.resolvedType) if (t.resolvedType instanceof i) {
  15416. e("switch(d%s){", r);
  15417. for (var o = t.resolvedType.values,
  15418. a = Object.keys(o), s = 0; s < a.length; ++s) t.repeated && o[a[s]] === t.typeDefault && e("default:"),
  15419. e("case%j:", a[s])("case %i:", o[a[s]])("m%s=%j", r, o[a[s]])("break");
  15420. e("}")
  15421. } else e('if(typeof d%s!=="object")', r)("throw TypeError(%j)", t.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", r, n, r);
  15422. else {
  15423. var c = !1;
  15424. switch (t.type) {
  15425. case "double":
  15426. case "float":
  15427. e("m%s=Number(d%s)", r, r);
  15428. break;
  15429. case "uint32":
  15430. case "fixed32":
  15431. e("m%s=d%s>>>0", r, r);
  15432. break;
  15433. case "int32":
  15434. case "sint32":
  15435. case "sfixed32":
  15436. e("m%s=d%s|0", r, r);
  15437. break;
  15438. case "uint64":
  15439. c = !0;
  15440. case "int64":
  15441. case "sint64":
  15442. case "fixed64":
  15443. case "sfixed64":
  15444. e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", r, r, c)('else if(typeof d%s==="string")', r)("m%s=parseInt(d%s,10)", r, r)('else if(typeof d%s==="number")', r)("m%s=d%s", r, r)('else if(typeof d%s==="object")', r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", r, r, r, c ? "true": "");
  15445. break;
  15446. case "bytes":
  15447. e('if(typeof d%s==="string")', r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", r, r, r)("else if(d%s.length)", r)("m%s=d%s", r, r);
  15448. break;
  15449. case "string":
  15450. e("m%s=String(d%s)", r, r);
  15451. break;
  15452. case "bool":
  15453. e("m%s=Boolean(d%s)", r, r)
  15454. }
  15455. }
  15456. return e
  15457. }
  15458. function s(e, t, n, r) {
  15459. if (t.resolvedType) t.resolvedType instanceof i ? e("d%s=o.enums===String?types[%i].values[m%s]:m%s", r, n, r, r) : e("d%s=types[%i].toObject(m%s,o)", r, n, r);
  15460. else {
  15461. var o = !1;
  15462. switch (t.type) {
  15463. case "double":
  15464. case "float":
  15465. e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", r, r, r, r);
  15466. break;
  15467. case "uint64":
  15468. o = !0;
  15469. case "int64":
  15470. case "sint64":
  15471. case "fixed64":
  15472. case "sfixed64":
  15473. e('if(typeof m%s==="number")', r)("d%s=o.longs===String?String(m%s):m%s", r, r, r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", r, r, r, r, o ? "true": "", r);
  15474. break;
  15475. case "bytes":
  15476. e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", r, r, r, r, r);
  15477. break;
  15478. default:
  15479. e("d%s=m%s", r, r)
  15480. }
  15481. }
  15482. return e
  15483. }
  15484. r.fromObject = function(e) {
  15485. var t = e.fieldsArray,
  15486. n = o.codegen(["d"], e.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
  15487. if (!t.length) return n("return new this.ctor");
  15488. n("var m=new this.ctor");
  15489. for (var r = 0; r < t.length; ++r) {
  15490. var s = t[r].resolve(),
  15491. c = o.safeProp(s.name);
  15492. s.map ? (n("if(d%s){", c)('if(typeof d%s!=="object")', c)("throw TypeError(%j)", s.fullName + ": object expected")("m%s={}", c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", c), a(n, s, r, c + "[ks[i]]")("}")("}")) : s.repeated ? (n("if(d%s){", c)("if(!Array.isArray(d%s))", c)("throw TypeError(%j)", s.fullName + ": array expected")("m%s=[]", c)("for(var i=0;i<d%s.length;++i){", c), a(n, s, r, c + "[i]")("}")("}")) : (s.resolvedType instanceof i || n("if(d%s!=null){", c), a(n, s, r, c), s.resolvedType instanceof i || n("}"))
  15493. }
  15494. return n("return m")
  15495. },
  15496. r.toObject = function(e) {
  15497. var t = e.fieldsArray.slice().sort(o.compareFieldsById);
  15498. if (!t.length) return o.codegen()("return {}");
  15499. for (var n = o.codegen(["m", "o"], e.name + "$toObject")("if(!o)")("o={}")("var d={}"), r = [], a = [], c = [], d = 0; d < t.length; ++d) t[d].partOf || (t[d].resolve().repeated ? r: t[d].map ? a: c).push(t[d]);
  15500. if (r.length) {
  15501. for (n("if(o.arrays||o.defaults){"), d = 0; d < r.length; ++d) n("d%s=[]", o.safeProp(r[d].name));
  15502. n("}")
  15503. }
  15504. if (a.length) {
  15505. for (n("if(o.objects||o.defaults){"), d = 0; d < a.length; ++d) n("d%s={}", o.safeProp(a[d].name));
  15506. n("}")
  15507. }
  15508. if (c.length) {
  15509. for (n("if(o.defaults){"), d = 0; d < c.length; ++d) {
  15510. var u = c[d],
  15511. l = o.safeProp(u.name);
  15512. if (u.resolvedType instanceof i) n("d%s=o.enums===String?%j:%j", l, u.resolvedType.valuesById[u.typeDefault], u.typeDefault);
  15513. else if (u.long) n("if(util.Long){")("var n=new util.Long(%i,%i,%j)", u.typeDefault.low, u.typeDefault.high, u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", l)("}else")("d%s=o.longs===String?%j:%i", l, u.typeDefault.toString(), u.typeDefault.toNumber());
  15514. else if (u.bytes) {
  15515. var p = "[" + Array.prototype.slice.call(u.typeDefault).join(",") + "]";
  15516. n("if(o.bytes===String)d%s=%j", l, String.fromCharCode.apply(String, u.typeDefault))("else{")("d%s=%s", l, p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", l, l)("}")
  15517. } else n("d%s=%j", l, u.typeDefault)
  15518. }
  15519. n("}")
  15520. }
  15521. var f = !1;
  15522. for (d = 0; d < t.length; ++d) {
  15523. u = t[d];
  15524. var g = e._fieldsArray.indexOf(u);
  15525. l = o.safeProp(u.name);
  15526. u.map ? (f || (f = !0, n("var ks2")), n("if(m%s&&(ks2=Object.keys(m%s)).length){", l, l)("d%s={}", l)("for(var j=0;j<ks2.length;++j){"), s(n, u, g, l + "[ks2[j]]")("}")) : u.repeated ? (n("if(m%s&&m%s.length){", l, l)("d%s=[]", l)("for(var j=0;j<m%s.length;++j){", l), s(n, u, g, l + "[j]")("}")) : (n("if(m%s!=null&&m.hasOwnProperty(%j)){", l, u.name), s(n, u, g, l), u.partOf && n("if(o.oneofs)")("d%s=%j", o.safeProp(u.partOf.name), u.name)),
  15527. n("}")
  15528. }
  15529. return n("return d")
  15530. }
  15531. },
  15532. {
  15533. 14 : 14,
  15534. 33 : 33
  15535. }],
  15536. 12 : [function(e, t, n) {
  15537. t.exports = function(e) {
  15538. var t = o.codegen(["r", "l"], e.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (e.fieldsArray.filter((function(e) {
  15539. return e.map
  15540. })).length ? ",k,value": ""))("while(r.pos<c){")("var t=r.uint32()");
  15541. e.group && t("if((t&7)===4)")("break");
  15542. t("switch(t>>>3){");
  15543. for (var n = 0; n < e.fieldsArray.length; ++n) {
  15544. var s = e._fieldsArray[n].resolve(),
  15545. c = s.resolvedType instanceof r ? "int32": s.type,
  15546. d = "m" + o.safeProp(s.name);
  15547. t("case %i:", s.id),
  15548. s.map ? (t("if(%s===util.emptyObject)", d)("%s={}", d)("var c2 = r.uint32()+r.pos"), i.defaults[s.keyType] !== undefined ? t("k=%j", i.defaults[s.keyType]) : t("k=null"), i.defaults[c] !== undefined ? t("value=%j", i.defaults[c]) : t("value=null"), t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break", s.keyType)("case 2:"), i.basic[c] === undefined ? t("value=types[%i].decode(r,r.uint32())", n) : t("value=r.%s()", c), t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"), i.long[s.keyType] !== undefined ? t('%s[typeof k==="object"?util.longToHash(k):k]=value', d) : t("%s[k]=value", d)) : s.repeated ? (t("if(!(%s&&%s.length))", d, d)("%s=[]", d), i.packed[c] !== undefined && t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", d, c)("}else"), i.basic[c] === undefined ? t(s.resolvedType.group ? "%s.push(types[%i].decode(r))": "%s.push(types[%i].decode(r,r.uint32()))", d, n) : t("%s.push(r.%s())", d, c)) : i.basic[c] === undefined ? t(s.resolvedType.group ? "%s=types[%i].decode(r)": "%s=types[%i].decode(r,r.uint32())", d, n) : t("%s=r.%s()", d, c),
  15549. t("break")
  15550. }
  15551. for (t("default:")("r.skipType(t&7)")("break")("}")("}"), n = 0; n < e._fieldsArray.length; ++n) {
  15552. var u = e._fieldsArray[n];
  15553. u.required && t("if(!m.hasOwnProperty(%j))", u.name)("throw util.ProtocolError(%j,{instance:m})", a(u))
  15554. }
  15555. return t("return m")
  15556. };
  15557. var r = e(14),
  15558. i = e(32),
  15559. o = e(33);
  15560. function a(e) {
  15561. return "missing required '" + e.name + "'"
  15562. }
  15563. },
  15564. {
  15565. 14 : 14,
  15566. 32 : 32,
  15567. 33 : 33
  15568. }],
  15569. 13 : [function(e, t, n) {
  15570. t.exports = function(e) {
  15571. for (var t, n = o.codegen(["m", "w"], e.name + "$encode")("if(!w)")("w=Writer.create()"), s = e.fieldsArray.slice().sort(o.compareFieldsById), c = 0; c < s.length; ++c) {
  15572. var d = s[c].resolve(),
  15573. u = e._fieldsArray.indexOf(d),
  15574. l = d.resolvedType instanceof r ? "int32": d.type,
  15575. p = i.basic[l];
  15576. t = "m" + o.safeProp(d.name),
  15577. d.map ? (n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", t, d.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (d.id << 3 | 2) >>> 0, 8 | i.mapKey[d.keyType], d.keyType), p === undefined ? n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", u, t) : n(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | p, l, t), n("}")("}")) : d.repeated ? (n("if(%s!=null&&%s.length){", t, t), d.packed && i.packed[l] !== undefined ? n("w.uint32(%i).fork()", (d.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", t)("w.%s(%s[i])", l, t)("w.ldelim()") : (n("for(var i=0;i<%s.length;++i)", t), p === undefined ? a(n, d, u, t + "[i]") : n("w.uint32(%i).%s(%s[i])", (d.id << 3 | p) >>> 0, l, t)), n("}")) : (d.optional && n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", t, d.name), p === undefined ? a(n, d, u, t) : n("w.uint32(%i).%s(%s)", (d.id << 3 | p) >>> 0, l, t))
  15578. }
  15579. return n("return w")
  15580. };
  15581. var r = e(14),
  15582. i = e(32),
  15583. o = e(33);
  15584. function a(e, t, n, r) {
  15585. return t.resolvedType.group ? e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", n, r, (t.id << 3 | 3) >>> 0, (t.id << 3 | 4) >>> 0) : e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", n, r, (t.id << 3 | 2) >>> 0)
  15586. }
  15587. },
  15588. {
  15589. 14 : 14,
  15590. 32 : 32,
  15591. 33 : 33
  15592. }],
  15593. 14 : [function(e, t, n) {
  15594. t.exports = a;
  15595. var r = e(22); ((a.prototype = Object.create(r.prototype)).constructor = a).className = "Enum";
  15596. var i = e(21),
  15597. o = e(33);
  15598. function a(e, t, n, i, o) {
  15599. if (r.call(this, e, n), t && "object" != typeof t) throw TypeError("values must be an object");
  15600. if (this.valuesById = {},
  15601. this.values = Object.create(this.valuesById), this.comment = i, this.comments = o || {},
  15602. this.reserved = undefined, t) for (var a = Object.keys(t), s = 0; s < a.length; ++s)"number" == typeof t[a[s]] && (this.valuesById[this.values[a[s]] = t[a[s]]] = a[s])
  15603. }
  15604. a.fromJSON = function(e, t) {
  15605. var n = new a(e, t.values, t.options, t.comment, t.comments);
  15606. return n.reserved = t.reserved,
  15607. n
  15608. },
  15609. a.prototype.toJSON = function(e) {
  15610. var t = !!e && Boolean(e.keepComments);
  15611. return o.toObject(["options", this.options, "values", this.values, "reserved", this.reserved && this.reserved.length ? this.reserved: undefined, "comment", t ? this.comment: undefined, "comments", t ? this.comments: undefined])
  15612. },
  15613. a.prototype.add = function(e, t, n) {
  15614. if (!o.isString(e)) throw TypeError("name must be a string");
  15615. if (!o.isInteger(t)) throw TypeError("id must be an integer");
  15616. if (this.values[e] !== undefined) throw Error("duplicate name '" + e + "' in " + this);
  15617. if (this.isReservedId(t)) throw Error("id " + t + " is reserved in " + this);
  15618. if (this.isReservedName(e)) throw Error("name '" + e + "' is reserved in " + this);
  15619. if (this.valuesById[t] !== undefined) {
  15620. if (!this.options || !this.options.allow_alias) throw Error("duplicate id " + t + " in " + this);
  15621. this.values[e] = t
  15622. } else this.valuesById[this.values[e] = t] = e;
  15623. return this.comments[e] = n || null,
  15624. this
  15625. },
  15626. a.prototype.remove = function(e) {
  15627. if (!o.isString(e)) throw TypeError("name must be a string");
  15628. var t = this.values[e];
  15629. if (null == t) throw Error("name '" + e + "' does not exist in " + this);
  15630. return delete this.valuesById[t],
  15631. delete this.values[e],
  15632. delete this.comments[e],
  15633. this
  15634. },
  15635. a.prototype.isReservedId = function(e) {
  15636. return i.isReservedId(this.reserved, e)
  15637. },
  15638. a.prototype.isReservedName = function(e) {
  15639. return i.isReservedName(this.reserved, e)
  15640. }
  15641. },
  15642. {
  15643. 21 : 21,
  15644. 22 : 22,
  15645. 33 : 33
  15646. }],
  15647. 15 : [function(e, t, n) {
  15648. t.exports = d;
  15649. var r = e(22); ((d.prototype = Object.create(r.prototype)).constructor = d).className = "Field";
  15650. var i, o = e(14),
  15651. a = e(32),
  15652. s = e(33),
  15653. c = /^required|optional|repeated$/;
  15654. function d(e, t, n, i, o, d, u) {
  15655. if (s.isObject(i) ? (u = o, d = i, i = o = undefined) : s.isObject(o) && (u = d, d = o, o = undefined), r.call(this, e, d), !s.isInteger(t) || t < 0) throw TypeError("id must be a non-negative integer");
  15656. if (!s.isString(n)) throw TypeError("type must be a string");
  15657. if (i !== undefined && !c.test(i = i.toString().toLowerCase())) throw TypeError("rule must be a string rule");
  15658. if (o !== undefined && !s.isString(o)) throw TypeError("extend must be a string");
  15659. this.rule = i && "optional" !== i ? i: undefined,
  15660. this.type = n,
  15661. this.id = t,
  15662. this.extend = o || undefined,
  15663. this.required = "required" === i,
  15664. this.optional = !this.required,
  15665. this.repeated = "repeated" === i,
  15666. this.map = !1,
  15667. this.message = null,
  15668. this.partOf = null,
  15669. this.typeDefault = null,
  15670. this.defaultValue = null,
  15671. this.long = !!s.Long && a.long[n] !== undefined,
  15672. this.bytes = "bytes" === n,
  15673. this.resolvedType = null,
  15674. this.extensionField = null,
  15675. this.declaringField = null,
  15676. this._packed = null,
  15677. this.comment = u
  15678. }
  15679. d.fromJSON = function(e, t) {
  15680. return new d(e, t.id, t.type, t.rule, t.extend, t.options, t.comment)
  15681. },
  15682. Object.defineProperty(d.prototype, "packed", {
  15683. get: function() {
  15684. return null === this._packed && (this._packed = !1 !== this.getOption("packed")),
  15685. this._packed
  15686. }
  15687. }),
  15688. d.prototype.setOption = function(e, t, n) {
  15689. return "packed" === e && (this._packed = null),
  15690. r.prototype.setOption.call(this, e, t, n)
  15691. },
  15692. d.prototype.toJSON = function(e) {
  15693. var t = !!e && Boolean(e.keepComments);
  15694. return s.toObject(["rule", "optional" !== this.rule && this.rule || undefined, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", t ? this.comment: undefined])
  15695. },
  15696. d.prototype.resolve = function() {
  15697. if (this.resolved) return this;
  15698. if ((this.typeDefault = a.defaults[this.type]) === undefined && (this.resolvedType = (this.declaringField ? this.declaringField.parent: this.parent).lookupTypeOrEnum(this.type), this.resolvedType instanceof i ? this.typeDefault = null: this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]), this.options && null != this.options.
  15699. default && (this.typeDefault = this.options.
  15700. default, this.resolvedType instanceof o && "string" == typeof this.typeDefault && (this.typeDefault = this.resolvedType.values[this.typeDefault])), this.options && (!0 !== this.options.packed && (this.options.packed === undefined || !this.resolvedType || this.resolvedType instanceof o) || delete this.options.packed, Object.keys(this.options).length || (this.options = undefined)), this.long) this.typeDefault = s.Long.fromNumber(this.typeDefault, "u" === this.type.charAt(0)),
  15701. Object.freeze && Object.freeze(this.typeDefault);
  15702. else if (this.bytes && "string" == typeof this.typeDefault) {
  15703. var e;
  15704. s.base64.test(this.typeDefault) ? s.base64.decode(this.typeDefault, e = s.newBuffer(s.base64.length(this.typeDefault)), 0) : s.utf8.write(this.typeDefault, e = s.newBuffer(s.utf8.length(this.typeDefault)), 0),
  15705. this.typeDefault = e
  15706. }
  15707. return this.map ? this.defaultValue = s.emptyObject: this.repeated ? this.defaultValue = s.emptyArray: this.defaultValue = this.typeDefault,
  15708. this.parent instanceof i && (this.parent.ctor.prototype[this.name] = this.defaultValue),
  15709. r.prototype.resolve.call(this)
  15710. },
  15711. d.d = function(e, t, n, r) {
  15712. return "function" == typeof t ? t = s.decorateType(t).name: t && "object" == typeof t && (t = s.decorateEnum(t).name),
  15713. function(i, o) {
  15714. s.decorateType(i.constructor).add(new d(o, e, t, n, {
  15715. default:
  15716. r
  15717. }))
  15718. }
  15719. },
  15720. d._configure = function(e) {
  15721. i = e
  15722. }
  15723. },
  15724. {
  15725. 14 : 14,
  15726. 22 : 22,
  15727. 32 : 32,
  15728. 33 : 33
  15729. }],
  15730. 16 : [function(e, t, n) {
  15731. var r = t.exports = e(17);
  15732. r.build = "light",
  15733. r.load = function(e, t, n) {
  15734. return "function" == typeof t ? (n = t, t = new r.Root) : t || (t = new r.Root),
  15735. t.load(e, n)
  15736. },
  15737. r.loadSync = function(e, t) {
  15738. return t || (t = new r.Root),
  15739. t.loadSync(e)
  15740. },
  15741. r.encoder = e(13),
  15742. r.decoder = e(12),
  15743. r.verifier = e(36),
  15744. r.converter = e(11),
  15745. r.ReflectionObject = e(22),
  15746. r.Namespace = e(21),
  15747. r.Root = e(26),
  15748. r.Enum = e(14),
  15749. r.Type = e(31),
  15750. r.Field = e(15),
  15751. r.OneOf = e(23),
  15752. r.MapField = e(18),
  15753. r.Service = e(30),
  15754. r.Method = e(20),
  15755. r.Message = e(19),
  15756. r.wrappers = e(37),
  15757. r.types = e(32),
  15758. r.util = e(33),
  15759. r.ReflectionObject._configure(r.Root),
  15760. r.Namespace._configure(r.Type, r.Service, r.Enum),
  15761. r.Root._configure(r.Type),
  15762. r.Field._configure(r.Type)
  15763. },
  15764. {
  15765. 11 : 11,
  15766. 12 : 12,
  15767. 13 : 13,
  15768. 14 : 14,
  15769. 15 : 15,
  15770. 17 : 17,
  15771. 18 : 18,
  15772. 19 : 19,
  15773. 20 : 20,
  15774. 21 : 21,
  15775. 22 : 22,
  15776. 23 : 23,
  15777. 26 : 26,
  15778. 30 : 30,
  15779. 31 : 31,
  15780. 32 : 32,
  15781. 33 : 33,
  15782. 36 : 36,
  15783. 37 : 37
  15784. }],
  15785. 17 : [function(e, t, n) {
  15786. var r = n;
  15787. function i() {
  15788. r.util._configure(),
  15789. r.Writer._configure(r.BufferWriter),
  15790. r.Reader._configure(r.BufferReader)
  15791. }
  15792. r.build = "minimal",
  15793. r.Writer = e(38),
  15794. r.BufferWriter = e(39),
  15795. r.Reader = e(24),
  15796. r.BufferReader = e(25),
  15797. r.util = e(35),
  15798. r.rpc = e(28),
  15799. r.roots = e(27),
  15800. r.configure = i,
  15801. i()
  15802. },
  15803. {
  15804. 24 : 24,
  15805. 25 : 25,
  15806. 27 : 27,
  15807. 28 : 28,
  15808. 35 : 35,
  15809. 38 : 38,
  15810. 39 : 39
  15811. }],
  15812. 18 : [function(e, t, n) {
  15813. t.exports = a;
  15814. var r = e(15); ((a.prototype = Object.create(r.prototype)).constructor = a).className = "MapField";
  15815. var i = e(32),
  15816. o = e(33);
  15817. function a(e, t, n, i, a, s) {
  15818. if (r.call(this, e, t, i, undefined, undefined, a, s), !o.isString(n)) throw TypeError("keyType must be a string");
  15819. this.keyType = n,
  15820. this.resolvedKeyType = null,
  15821. this.map = !0
  15822. }
  15823. a.fromJSON = function(e, t) {
  15824. return new a(e, t.id, t.keyType, t.type, t.options, t.comment)
  15825. },
  15826. a.prototype.toJSON = function(e) {
  15827. var t = !!e && Boolean(e.keepComments);
  15828. return o.toObject(["keyType", this.keyType, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", t ? this.comment: undefined])
  15829. },
  15830. a.prototype.resolve = function() {
  15831. if (this.resolved) return this;
  15832. if (i.mapKey[this.keyType] === undefined) throw Error("invalid key type: " + this.keyType);
  15833. return r.prototype.resolve.call(this)
  15834. },
  15835. a.d = function(e, t, n) {
  15836. return "function" == typeof n ? n = o.decorateType(n).name: n && "object" == typeof n && (n = o.decorateEnum(n).name),
  15837. function(r, i) {
  15838. o.decorateType(r.constructor).add(new a(i, e, t, n))
  15839. }
  15840. }
  15841. },
  15842. {
  15843. 15 : 15,
  15844. 32 : 32,
  15845. 33 : 33
  15846. }],
  15847. 19 : [function(e, t, n) {
  15848. t.exports = i;
  15849. var r = e(35);
  15850. function i(e) {
  15851. if (e) for (var t = Object.keys(e), n = 0; n < t.length; ++n) this[t[n]] = e[t[n]]
  15852. }
  15853. i.create = function(e) {
  15854. return this.$type.create(e)
  15855. },
  15856. i.encode = function(e, t) {
  15857. return this.$type.encode(e, t)
  15858. },
  15859. i.encodeDelimited = function(e, t) {
  15860. return this.$type.encodeDelimited(e, t)
  15861. },
  15862. i.decode = function(e) {
  15863. return this.$type.decode(e)
  15864. },
  15865. i.decodeDelimited = function(e) {
  15866. return this.$type.decodeDelimited(e)
  15867. },
  15868. i.verify = function(e) {
  15869. return this.$type.verify(e)
  15870. },
  15871. i.fromObject = function(e) {
  15872. return this.$type.fromObject(e)
  15873. },
  15874. i.toObject = function(e, t) {
  15875. return this.$type.toObject(e, t)
  15876. },
  15877. i.prototype.toJSON = function() {
  15878. return this.$type.toObject(this, r.toJSONOptions)
  15879. }
  15880. },
  15881. {
  15882. 35 : 35
  15883. }],
  15884. 20 : [function(e, t, n) {
  15885. t.exports = o;
  15886. var r = e(22); ((o.prototype = Object.create(r.prototype)).constructor = o).className = "Method";
  15887. var i = e(33);
  15888. function o(e, t, n, o, a, s, c, d) {
  15889. if (i.isObject(a) ? (c = a, a = s = undefined) : i.isObject(s) && (c = s, s = undefined), t !== undefined && !i.isString(t)) throw TypeError("type must be a string");
  15890. if (!i.isString(n)) throw TypeError("requestType must be a string");
  15891. if (!i.isString(o)) throw TypeError("responseType must be a string");
  15892. r.call(this, e, c),
  15893. this.type = t || "rpc",
  15894. this.requestType = n,
  15895. this.requestStream = !!a || undefined,
  15896. this.responseType = o,
  15897. this.responseStream = !!s || undefined,
  15898. this.resolvedRequestType = null,
  15899. this.resolvedResponseType = null,
  15900. this.comment = d
  15901. }
  15902. o.fromJSON = function(e, t) {
  15903. return new o(e, t.type, t.requestType, t.responseType, t.requestStream, t.responseStream, t.options, t.comment)
  15904. },
  15905. o.prototype.toJSON = function(e) {
  15906. var t = !!e && Boolean(e.keepComments);
  15907. return i.toObject(["type", "rpc" !== this.type && this.type || undefined, "requestType", this.requestType, "requestStream", this.requestStream, "responseType", this.responseType, "responseStream", this.responseStream, "options", this.options, "comment", t ? this.comment: undefined])
  15908. },
  15909. o.prototype.resolve = function() {
  15910. return this.resolved ? this: (this.resolvedRequestType = this.parent.lookupType(this.requestType), this.resolvedResponseType = this.parent.lookupType(this.responseType), r.prototype.resolve.call(this))
  15911. }
  15912. },
  15913. {
  15914. 22 : 22,
  15915. 33 : 33
  15916. }],
  15917. 21 : [function(e, t, n) {
  15918. t.exports = u;
  15919. var r = e(22); ((u.prototype = Object.create(r.prototype)).constructor = u).className = "Namespace";
  15920. var i, o, a, s = e(15),
  15921. c = e(33);
  15922. function d(e, t) {
  15923. if (!e || !e.length) return undefined;
  15924. for (var n = {},
  15925. r = 0; r < e.length; ++r) n[e[r].name] = e[r].toJSON(t);
  15926. return n
  15927. }
  15928. function u(e, t) {
  15929. r.call(this, e, t),
  15930. this.nested = undefined,
  15931. this._nestedArray = null
  15932. }
  15933. function l(e) {
  15934. return e._nestedArray = null,
  15935. e
  15936. }
  15937. u.fromJSON = function(e, t) {
  15938. return new u(e, t.options).addJSON(t.nested)
  15939. },
  15940. u.arrayToJSON = d,
  15941. u.isReservedId = function(e, t) {
  15942. if (e) for (var n = 0; n < e.length; ++n) if ("string" != typeof e[n] && e[n][0] <= t && e[n][1] > t) return ! 0;
  15943. return ! 1
  15944. },
  15945. u.isReservedName = function(e, t) {
  15946. if (e) for (var n = 0; n < e.length; ++n) if (e[n] === t) return ! 0;
  15947. return ! 1
  15948. },
  15949. Object.defineProperty(u.prototype, "nestedArray", {
  15950. get: function() {
  15951. return this._nestedArray || (this._nestedArray = c.toArray(this.nested))
  15952. }
  15953. }),
  15954. u.prototype.toJSON = function(e) {
  15955. return c.toObject(["options", this.options, "nested", d(this.nestedArray, e)])
  15956. },
  15957. u.prototype.addJSON = function(e) {
  15958. if (e) for (var t, n = Object.keys(e), r = 0; r < n.length; ++r) t = e[n[r]],
  15959. this.add((t.fields !== undefined ? i.fromJSON: t.values !== undefined ? a.fromJSON: t.methods !== undefined ? o.fromJSON: t.id !== undefined ? s.fromJSON: u.fromJSON)(n[r], t));
  15960. return this
  15961. },
  15962. u.prototype.get = function(e) {
  15963. return this.nested && this.nested[e] || null
  15964. },
  15965. u.prototype.getEnum = function(e) {
  15966. if (this.nested && this.nested[e] instanceof a) return this.nested[e].values;
  15967. throw Error("no such enum: " + e)
  15968. },
  15969. u.prototype.add = function(e) {
  15970. if (! (e instanceof s && e.extend !== undefined || e instanceof i || e instanceof a || e instanceof o || e instanceof u)) throw TypeError("object must be a valid nested object");
  15971. if (this.nested) {
  15972. var t = this.get(e.name);
  15973. if (t) {
  15974. if (! (t instanceof u && e instanceof u) || t instanceof i || t instanceof o) throw Error("duplicate name '" + e.name + "' in " + this);
  15975. for (var n = t.nestedArray,
  15976. r = 0; r < n.length; ++r) e.add(n[r]);
  15977. this.remove(t),
  15978. this.nested || (this.nested = {}),
  15979. e.setOptions(t.options, !0)
  15980. }
  15981. } else this.nested = {};
  15982. return this.nested[e.name] = e,
  15983. e.onAdd(this),
  15984. l(this)
  15985. },
  15986. u.prototype.remove = function(e) {
  15987. if (! (e instanceof r)) throw TypeError("object must be a ReflectionObject");
  15988. if (e.parent !== this) throw Error(e + " is not a member of " + this);
  15989. return delete this.nested[e.name],
  15990. Object.keys(this.nested).length || (this.nested = undefined),
  15991. e.onRemove(this),
  15992. l(this)
  15993. },
  15994. u.prototype.define = function(e, t) {
  15995. if (c.isString(e)) e = e.split(".");
  15996. else if (!Array.isArray(e)) throw TypeError("illegal path");
  15997. if (e && e.length && "" === e[0]) throw Error("path must be relative");
  15998. for (var n = this; e.length > 0;) {
  15999. var r = e.shift();
  16000. if (n.nested && n.nested[r]) {
  16001. if (! ((n = n.nested[r]) instanceof u)) throw Error("path conflicts with non-namespace objects")
  16002. } else n.add(n = new u(r))
  16003. }
  16004. return t && n.addJSON(t),
  16005. n
  16006. },
  16007. u.prototype.resolveAll = function() {
  16008. for (var e = this.nestedArray,
  16009. t = 0; t < e.length;) e[t] instanceof u ? e[t++].resolveAll() : e[t++].resolve();
  16010. return this.resolve()
  16011. },
  16012. u.prototype.lookup = function(e, t, n) {
  16013. if ("boolean" == typeof t ? (n = t, t = undefined) : t && !Array.isArray(t) && (t = [t]), c.isString(e) && e.length) {
  16014. if ("." === e) return this.root;
  16015. e = e.split(".")
  16016. } else if (!e.length) return this;
  16017. if ("" === e[0]) return this.root.lookup(e.slice(1), t);
  16018. var r = this.get(e[0]);
  16019. if (r) {
  16020. if (1 === e.length) {
  16021. if (!t || t.indexOf(r.constructor) > -1) return r
  16022. } else if (r instanceof u && (r = r.lookup(e.slice(1), t, !0))) return r
  16023. } else for (var i = 0; i < this.nestedArray.length; ++i) if (this._nestedArray[i] instanceof u && (r = this._nestedArray[i].lookup(e, t, !0))) return r;
  16024. return null === this.parent || n ? null: this.parent.lookup(e, t)
  16025. },
  16026. u.prototype.lookupType = function(e) {
  16027. var t = this.lookup(e, [i]);
  16028. if (!t) throw Error("no such type: " + e);
  16029. return t
  16030. },
  16031. u.prototype.lookupEnum = function(e) {
  16032. var t = this.lookup(e, [a]);
  16033. if (!t) throw Error("no such Enum '" + e + "' in " + this);
  16034. return t
  16035. },
  16036. u.prototype.lookupTypeOrEnum = function(e) {
  16037. var t = this.lookup(e, [i, a]);
  16038. if (!t) throw Error("no such Type or Enum '" + e + "' in " + this);
  16039. return t
  16040. },
  16041. u.prototype.lookupService = function(e) {
  16042. var t = this.lookup(e, [o]);
  16043. if (!t) throw Error("no such Service '" + e + "' in " + this);
  16044. return t
  16045. },
  16046. u._configure = function(e, t, n) {
  16047. i = e,
  16048. o = t,
  16049. a = n
  16050. }
  16051. },
  16052. {
  16053. 15 : 15,
  16054. 22 : 22,
  16055. 33 : 33
  16056. }],
  16057. 22 : [function(e, t, n) {
  16058. t.exports = o,
  16059. o.className = "ReflectionObject";
  16060. var r, i = e(33);
  16061. function o(e, t) {
  16062. if (!i.isString(e)) throw TypeError("name must be a string");
  16063. if (t && !i.isObject(t)) throw TypeError("options must be an object");
  16064. this.options = t,
  16065. this.parsedOptions = null,
  16066. this.name = e,
  16067. this.parent = null,
  16068. this.resolved = !1,
  16069. this.comment = null,
  16070. this.filename = null
  16071. }
  16072. Object.defineProperties(o.prototype, {
  16073. root: {
  16074. get: function() {
  16075. for (var e = this; null !== e.parent;) e = e.parent;
  16076. return e
  16077. }
  16078. },
  16079. fullName: {
  16080. get: function() {
  16081. for (var e = [this.name], t = this.parent; t;) e.unshift(t.name),
  16082. t = t.parent;
  16083. return e.join(".")
  16084. }
  16085. }
  16086. }),
  16087. o.prototype.toJSON = function() {
  16088. throw Error()
  16089. },
  16090. o.prototype.onAdd = function(e) {
  16091. this.parent && this.parent !== e && this.parent.remove(this),
  16092. this.parent = e,
  16093. this.resolved = !1;
  16094. var t = e.root;
  16095. t instanceof r && t._handleAdd(this)
  16096. },
  16097. o.prototype.onRemove = function(e) {
  16098. var t = e.root;
  16099. t instanceof r && t._handleRemove(this),
  16100. this.parent = null,
  16101. this.resolved = !1
  16102. },
  16103. o.prototype.resolve = function() {
  16104. return this.resolved || this.root instanceof r && (this.resolved = !0),
  16105. this
  16106. },
  16107. o.prototype.getOption = function(e) {
  16108. return this.options ? this.options[e] : undefined
  16109. },
  16110. o.prototype.setOption = function(e, t, n) {
  16111. return n && this.options && this.options[e] !== undefined || ((this.options || (this.options = {}))[e] = t),
  16112. this
  16113. },
  16114. o.prototype.setParsedOption = function(e, t, n) {
  16115. this.parsedOptions || (this.parsedOptions = []);
  16116. var r = this.parsedOptions;
  16117. if (n) {
  16118. var o = r.find((function(t) {
  16119. return Object.prototype.hasOwnProperty.call(t, e)
  16120. }));
  16121. if (o) {
  16122. var a = o[e];
  16123. i.setProperty(a, n, t)
  16124. } else(o = {})[e] = i.setProperty({},
  16125. n, t),
  16126. r.push(o)
  16127. } else {
  16128. var s = {};
  16129. s[e] = t,
  16130. r.push(s)
  16131. }
  16132. return this
  16133. },
  16134. o.prototype.setOptions = function(e, t) {
  16135. if (e) for (var n = Object.keys(e), r = 0; r < n.length; ++r) this.setOption(n[r], e[n[r]], t);
  16136. return this
  16137. },
  16138. o.prototype.toString = function() {
  16139. var e = this.constructor.className,
  16140. t = this.fullName;
  16141. return t.length ? e + " " + t: e
  16142. },
  16143. o._configure = function(e) {
  16144. r = e
  16145. }
  16146. },
  16147. {
  16148. 33 : 33
  16149. }],
  16150. 23 : [function(e, t, n) {
  16151. t.exports = a;
  16152. var r = e(22); ((a.prototype = Object.create(r.prototype)).constructor = a).className = "OneOf";
  16153. var i = e(15),
  16154. o = e(33);
  16155. function a(e, t, n, i) {
  16156. if (Array.isArray(t) || (n = t, t = undefined), r.call(this, e, n), t !== undefined && !Array.isArray(t)) throw TypeError("fieldNames must be an Array");
  16157. this.oneof = t || [],
  16158. this.fieldsArray = [],
  16159. this.comment = i
  16160. }
  16161. function s(e) {
  16162. if (e.parent) for (var t = 0; t < e.fieldsArray.length; ++t) e.fieldsArray[t].parent || e.parent.add(e.fieldsArray[t])
  16163. }
  16164. a.fromJSON = function(e, t) {
  16165. return new a(e, t.oneof, t.options, t.comment)
  16166. },
  16167. a.prototype.toJSON = function(e) {
  16168. var t = !!e && Boolean(e.keepComments);
  16169. return o.toObject(["options", this.options, "oneof", this.oneof, "comment", t ? this.comment: undefined])
  16170. },
  16171. a.prototype.add = function(e) {
  16172. if (! (e instanceof i)) throw TypeError("field must be a Field");
  16173. return e.parent && e.parent !== this.parent && e.parent.remove(e),
  16174. this.oneof.push(e.name),
  16175. this.fieldsArray.push(e),
  16176. e.partOf = this,
  16177. s(this),
  16178. this
  16179. },
  16180. a.prototype.remove = function(e) {
  16181. if (! (e instanceof i)) throw TypeError("field must be a Field");
  16182. var t = this.fieldsArray.indexOf(e);
  16183. if (t < 0) throw Error(e + " is not a member of " + this);
  16184. return this.fieldsArray.splice(t, 1),
  16185. (t = this.oneof.indexOf(e.name)) > -1 && this.oneof.splice(t, 1),
  16186. e.partOf = null,
  16187. this
  16188. },
  16189. a.prototype.onAdd = function(e) {
  16190. r.prototype.onAdd.call(this, e);
  16191. for (var t = 0; t < this.oneof.length; ++t) {
  16192. var n = e.get(this.oneof[t]);
  16193. n && !n.partOf && (n.partOf = this, this.fieldsArray.push(n))
  16194. }
  16195. s(this)
  16196. },
  16197. a.prototype.onRemove = function(e) {
  16198. for (var t, n = 0; n < this.fieldsArray.length; ++n)(t = this.fieldsArray[n]).parent && t.parent.remove(t);
  16199. r.prototype.onRemove.call(this, e)
  16200. },
  16201. a.d = function() {
  16202. for (var e = new Array(arguments.length), t = 0; t < arguments.length;) e[t] = arguments[t++];
  16203. return function(t, n) {
  16204. o.decorateType(t.constructor).add(new a(n, e)),
  16205. Object.defineProperty(t, n, {
  16206. get: o.oneOfGetter(e),
  16207. set: o.oneOfSetter(e)
  16208. })
  16209. }
  16210. }
  16211. },
  16212. {
  16213. 15 : 15,
  16214. 22 : 22,
  16215. 33 : 33
  16216. }],
  16217. 24 : [function(e, t, n) {
  16218. t.exports = c;
  16219. var r, i = e(35),
  16220. o = i.LongBits,
  16221. a = i.utf8;
  16222. function s(e, t) {
  16223. return RangeError("index out of range: " + e.pos + " + " + (t || 1) + " > " + e.len)
  16224. }
  16225. function c(e) {
  16226. this.buf = e,
  16227. this.pos = 0,
  16228. this.len = e.length
  16229. }
  16230. var d, u = "undefined" != typeof Uint8Array ?
  16231. function(e) {
  16232. if (e instanceof Uint8Array || Array.isArray(e)) return new c(e);
  16233. throw Error("illegal buffer")
  16234. }: function(e) {
  16235. if (Array.isArray(e)) return new c(e);
  16236. throw Error("illegal buffer")
  16237. },
  16238. l = function() {
  16239. return i.Buffer ?
  16240. function(e) {
  16241. return (c.create = function(e) {
  16242. return i.Buffer.isBuffer(e) ? new r(e) : u(e)
  16243. })(e)
  16244. }: u
  16245. };
  16246. function p() {
  16247. var e = new o(0, 0),
  16248. t = 0;
  16249. if (! (this.len - this.pos > 4)) {
  16250. for (; t < 3; ++t) {
  16251. if (this.pos >= this.len) throw s(this);
  16252. if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 7 * t) >>> 0, this.buf[this.pos++] < 128) return e
  16253. }
  16254. return e.lo = (e.lo | (127 & this.buf[this.pos++]) << 7 * t) >>> 0,
  16255. e
  16256. }
  16257. for (; t < 4; ++t) if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 7 * t) >>> 0, this.buf[this.pos++] < 128) return e;
  16258. if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 28) >>> 0, e.hi = (e.hi | (127 & this.buf[this.pos]) >> 4) >>> 0, this.buf[this.pos++] < 128) return e;
  16259. if (t = 0, this.len - this.pos > 4) {
  16260. for (; t < 5; ++t) if (e.hi = (e.hi | (127 & this.buf[this.pos]) << 7 * t + 3) >>> 0, this.buf[this.pos++] < 128) return e
  16261. } else for (; t < 5; ++t) {
  16262. if (this.pos >= this.len) throw s(this);
  16263. if (e.hi = (e.hi | (127 & this.buf[this.pos]) << 7 * t + 3) >>> 0, this.buf[this.pos++] < 128) return e
  16264. }
  16265. throw Error("invalid varint encoding")
  16266. }
  16267. function f(e, t) {
  16268. return (e[t - 4] | e[t - 3] << 8 | e[t - 2] << 16 | e[t - 1] << 24) >>> 0
  16269. }
  16270. function g() {
  16271. if (this.pos + 8 > this.len) throw s(this, 8);
  16272. return new o(f(this.buf, this.pos += 4), f(this.buf, this.pos += 4))
  16273. }
  16274. c.create = l(),
  16275. c.prototype._slice = i.Array.prototype.subarray || i.Array.prototype.slice,
  16276. c.prototype.uint32 = (d = 4294967295,
  16277. function() {
  16278. if (d = (127 & this.buf[this.pos]) >>> 0, this.buf[this.pos++] < 128) return d;
  16279. if (d = (d | (127 & this.buf[this.pos]) << 7) >>> 0, this.buf[this.pos++] < 128) return d;
  16280. if (d = (d | (127 & this.buf[this.pos]) << 14) >>> 0, this.buf[this.pos++] < 128) return d;
  16281. if (d = (d | (127 & this.buf[this.pos]) << 21) >>> 0, this.buf[this.pos++] < 128) return d;
  16282. if (d = (d | (15 & this.buf[this.pos]) << 28) >>> 0, this.buf[this.pos++] < 128) return d;
  16283. if ((this.pos += 5) > this.len) throw this.pos = this.len,
  16284. s(this, 10);
  16285. return d
  16286. }),
  16287. c.prototype.int32 = function() {
  16288. return 0 | this.uint32()
  16289. },
  16290. c.prototype.sint32 = function() {
  16291. var e = this.uint32();
  16292. return e >>> 1 ^ -(1 & e) | 0
  16293. },
  16294. c.prototype.bool = function() {
  16295. return 0 !== this.uint32()
  16296. },
  16297. c.prototype.fixed32 = function() {
  16298. if (this.pos + 4 > this.len) throw s(this, 4);
  16299. return f(this.buf, this.pos += 4)
  16300. },
  16301. c.prototype.sfixed32 = function() {
  16302. if (this.pos + 4 > this.len) throw s(this, 4);
  16303. return 0 | f(this.buf, this.pos += 4)
  16304. },
  16305. c.prototype.float = function() {
  16306. if (this.pos + 4 > this.len) throw s(this, 4);
  16307. var e = i.float.readFloatLE(this.buf, this.pos);
  16308. return this.pos += 4,
  16309. e
  16310. },
  16311. c.prototype.double = function() {
  16312. if (this.pos + 8 > this.len) throw s(this, 4);
  16313. var e = i.float.readDoubleLE(this.buf, this.pos);
  16314. return this.pos += 8,
  16315. e
  16316. },
  16317. c.prototype.bytes = function() {
  16318. var e = this.uint32(),
  16319. t = this.pos,
  16320. n = this.pos + e;
  16321. if (n > this.len) throw s(this, e);
  16322. return this.pos += e,
  16323. Array.isArray(this.buf) ? this.buf.slice(t, n) : t === n ? new this.buf.constructor(0) : this._slice.call(this.buf, t, n)
  16324. },
  16325. c.prototype.string = function() {
  16326. var e = this.bytes();
  16327. return a.read(e, 0, e.length)
  16328. },
  16329. c.prototype.skip = function(e) {
  16330. if ("number" == typeof e) {
  16331. if (this.pos + e > this.len) throw s(this, e);
  16332. this.pos += e
  16333. } else do {
  16334. if (this.pos >= this.len) throw s(this)
  16335. } while ( 128 & this . buf [ this . pos ++]);
  16336. return this
  16337. },
  16338. c.prototype.skipType = function(e) {
  16339. switch (e) {
  16340. case 0:
  16341. this.skip();
  16342. break;
  16343. case 1:
  16344. this.skip(8);
  16345. break;
  16346. case 2:
  16347. this.skip(this.uint32());
  16348. break;
  16349. case 3:
  16350. for (; 4 != (e = 7 & this.uint32());) this.skipType(e);
  16351. break;
  16352. case 5:
  16353. this.skip(4);
  16354. break;
  16355. default:
  16356. throw Error("invalid wire type " + e + " at offset " + this.pos)
  16357. }
  16358. return this
  16359. },
  16360. c._configure = function(e) {
  16361. r = e,
  16362. c.create = l(),
  16363. r._configure();
  16364. var t = i.Long ? "toLong": "toNumber";
  16365. i.merge(c.prototype, {
  16366. int64: function() {
  16367. return p.call(this)[t](!1)
  16368. },
  16369. uint64: function() {
  16370. return p.call(this)[t](!0)
  16371. },
  16372. sint64: function() {
  16373. return p.call(this).zzDecode()[t](!1)
  16374. },
  16375. fixed64: function() {
  16376. return g.call(this)[t](!0)
  16377. },
  16378. sfixed64: function() {
  16379. return g.call(this)[t](!1)
  16380. }
  16381. })
  16382. }
  16383. },
  16384. {
  16385. 35 : 35
  16386. }],
  16387. 25 : [function(e, t, n) {
  16388. t.exports = o;
  16389. var r = e(24); (o.prototype = Object.create(r.prototype)).constructor = o;
  16390. var i = e(35);
  16391. function o(e) {
  16392. r.call(this, e)
  16393. }
  16394. o._configure = function() {
  16395. i.Buffer && (o.prototype._slice = i.Buffer.prototype.slice)
  16396. },
  16397. o.prototype.string = function() {
  16398. var e = this.uint32();
  16399. return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + e, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + e, this.len))
  16400. },
  16401. o._configure()
  16402. },
  16403. {
  16404. 24 : 24,
  16405. 35 : 35
  16406. }],
  16407. 26 : [function(e, t, n) {
  16408. t.exports = l;
  16409. var r = e(21); ((l.prototype = Object.create(r.prototype)).constructor = l).className = "Root";
  16410. var i, o, a, s = e(15),
  16411. c = e(14),
  16412. d = e(23),
  16413. u = e(33);
  16414. function l(e) {
  16415. r.call(this, "", e),
  16416. this.deferred = [],
  16417. this.files = []
  16418. }
  16419. function p() {}
  16420. l.fromJSON = function(e, t) {
  16421. return t || (t = new l),
  16422. e.options && t.setOptions(e.options),
  16423. t.addJSON(e.nested)
  16424. },
  16425. l.prototype.resolvePath = u.path.resolve,
  16426. l.prototype.fetch = u.fetch,
  16427. l.prototype.load = function e(t, n, r) {
  16428. "function" == typeof n && (r = n, n = undefined);
  16429. var i = this;
  16430. if (!r) return u.asPromise(e, i, t, n);
  16431. var s = r === p;
  16432. function c(e, t) {
  16433. if (r) {
  16434. var n = r;
  16435. if (r = null, s) throw e;
  16436. n(e, t)
  16437. }
  16438. }
  16439. function d(e) {
  16440. var t = e.lastIndexOf("google/protobuf/");
  16441. if (t > -1) {
  16442. var n = e.substring(t);
  16443. if (n in a) return n
  16444. }
  16445. return null
  16446. }
  16447. function l(e, t) {
  16448. try {
  16449. if (u.isString(t) && "{" === t.charAt(0) && (t = JSON.parse(t)), u.isString(t)) {
  16450. o.filename = e;
  16451. var r, a = o(t, i, n),
  16452. l = 0;
  16453. if (a.imports) for (; l < a.imports.length; ++l)(r = d(a.imports[l]) || i.resolvePath(e, a.imports[l])) && f(r);
  16454. if (a.weakImports) for (l = 0; l < a.weakImports.length; ++l)(r = d(a.weakImports[l]) || i.resolvePath(e, a.weakImports[l])) && f(r, !0)
  16455. } else i.setOptions(t.options).addJSON(t.nested)
  16456. } catch(e) {
  16457. c(e)
  16458. }
  16459. s || g || c(null, i)
  16460. }
  16461. function f(e, t) {
  16462. if (! (i.files.indexOf(e) > -1)) if (i.files.push(e), e in a) s ? l(e, a[e]) : (++g, setTimeout((function() {--g,
  16463. l(e, a[e])
  16464. })));
  16465. else if (s) {
  16466. var n;
  16467. try {
  16468. n = u.fs.readFileSync(e).toString("utf8")
  16469. } catch(e) {
  16470. return void(t || c(e))
  16471. }
  16472. l(e, n)
  16473. } else++g,
  16474. i.fetch(e, (function(n, o) {--g,
  16475. r && (n ? t ? g || c(null, i) : c(n) : l(e, o))
  16476. }))
  16477. }
  16478. var g = 0;
  16479. u.isString(t) && (t = [t]);
  16480. for (var m, h = 0; h < t.length; ++h)(m = i.resolvePath("", t[h])) && f(m);
  16481. return s ? i: (g || c(null, i), undefined)
  16482. },
  16483. l.prototype.loadSync = function(e, t) {
  16484. if (!u.isNode) throw Error("not supported");
  16485. return this.load(e, t, p)
  16486. },
  16487. l.prototype.resolveAll = function() {
  16488. if (this.deferred.length) throw Error("unresolvable extensions: " + this.deferred.map((function(e) {
  16489. return "'extend " + e.extend + "' in " + e.parent.fullName
  16490. })).join(", "));
  16491. return r.prototype.resolveAll.call(this)
  16492. };
  16493. var f = /^[A-Z]/;
  16494. function g(e, t) {
  16495. var n = t.parent.lookup(t.extend);
  16496. if (n) {
  16497. var r = new s(t.fullName, t.id, t.type, t.rule, undefined, t.options);
  16498. return r.declaringField = t,
  16499. t.extensionField = r,
  16500. n.add(r),
  16501. !0
  16502. }
  16503. return ! 1
  16504. }
  16505. l.prototype._handleAdd = function(e) {
  16506. if (e instanceof s) e.extend === undefined || e.extensionField || g(0, e) || this.deferred.push(e);
  16507. else if (e instanceof c) f.test(e.name) && (e.parent[e.name] = e.values);
  16508. else if (! (e instanceof d)) {
  16509. if (e instanceof i) for (var t = 0; t < this.deferred.length;) g(0, this.deferred[t]) ? this.deferred.splice(t, 1) : ++t;
  16510. for (var n = 0; n < e.nestedArray.length; ++n) this._handleAdd(e._nestedArray[n]);
  16511. f.test(e.name) && (e.parent[e.name] = e)
  16512. }
  16513. },
  16514. l.prototype._handleRemove = function(e) {
  16515. if (e instanceof s) {
  16516. if (e.extend !== undefined) if (e.extensionField) e.extensionField.parent.remove(e.extensionField),
  16517. e.extensionField = null;
  16518. else {
  16519. var t = this.deferred.indexOf(e);
  16520. t > -1 && this.deferred.splice(t, 1)
  16521. }
  16522. } else if (e instanceof c) f.test(e.name) && delete e.parent[e.name];
  16523. else if (e instanceof r) {
  16524. for (var n = 0; n < e.nestedArray.length; ++n) this._handleRemove(e._nestedArray[n]);
  16525. f.test(e.name) && delete e.parent[e.name]
  16526. }
  16527. },
  16528. l._configure = function(e, t, n) {
  16529. i = e,
  16530. o = t,
  16531. a = n
  16532. }
  16533. },
  16534. {
  16535. 14 : 14,
  16536. 15 : 15,
  16537. 21 : 21,
  16538. 23 : 23,
  16539. 33 : 33
  16540. }],
  16541. 27 : [function(e, t, n) {
  16542. t.exports = {}
  16543. },
  16544. {}],
  16545. 28 : [function(e, t, n) {
  16546. n.Service = e(29)
  16547. },
  16548. {
  16549. 29 : 29
  16550. }],
  16551. 29 : [function(e, t, n) {
  16552. t.exports = i;
  16553. var r = e(35);
  16554. function i(e, t, n) {
  16555. if ("function" != typeof e) throw TypeError("rpcImpl must be a function");
  16556. r.EventEmitter.call(this),
  16557. this.rpcImpl = e,
  16558. this.requestDelimited = Boolean(t),
  16559. this.responseDelimited = Boolean(n)
  16560. } (i.prototype = Object.create(r.EventEmitter.prototype)).constructor = i,
  16561. i.prototype.rpcCall = function e(t, n, i, o, a) {
  16562. if (!o) throw TypeError("request must be specified");
  16563. var s = this;
  16564. if (!a) return r.asPromise(e, s, t, n, i, o);
  16565. if (!s.rpcImpl) return setTimeout((function() {
  16566. a(Error("already ended"))
  16567. }), 0),
  16568. undefined;
  16569. try {
  16570. return s.rpcImpl(t, n[s.requestDelimited ? "encodeDelimited": "encode"](o).finish(), (function(e, n) {
  16571. if (e) return s.emit("error", e, t),
  16572. a(e);
  16573. if (null === n) return s.end(!0),
  16574. undefined;
  16575. if (! (n instanceof i)) try {
  16576. n = i[s.responseDelimited ? "decodeDelimited": "decode"](n)
  16577. } catch(e) {
  16578. return s.emit("error", e, t),
  16579. a(e)
  16580. }
  16581. return s.emit("data", n, t),
  16582. a(null, n)
  16583. }))
  16584. } catch(e) {
  16585. return s.emit("error", e, t),
  16586. setTimeout((function() {
  16587. a(e)
  16588. }), 0),
  16589. undefined
  16590. }
  16591. },
  16592. i.prototype.end = function(e) {
  16593. return this.rpcImpl && (e || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()),
  16594. this
  16595. }
  16596. },
  16597. {
  16598. 35 : 35
  16599. }],
  16600. 30 : [function(e, t, n) {
  16601. t.exports = s;
  16602. var r = e(21); ((s.prototype = Object.create(r.prototype)).constructor = s).className = "Service";
  16603. var i = e(20),
  16604. o = e(33),
  16605. a = e(28);
  16606. function s(e, t) {
  16607. r.call(this, e, t),
  16608. this.methods = {},
  16609. this._methodsArray = null
  16610. }
  16611. function c(e) {
  16612. return e._methodsArray = null,
  16613. e
  16614. }
  16615. s.fromJSON = function(e, t) {
  16616. var n = new s(e, t.options);
  16617. if (t.methods) for (var r = Object.keys(t.methods), o = 0; o < r.length; ++o) n.add(i.fromJSON(r[o], t.methods[r[o]]));
  16618. return t.nested && n.addJSON(t.nested),
  16619. n.comment = t.comment,
  16620. n
  16621. },
  16622. s.prototype.toJSON = function(e) {
  16623. var t = r.prototype.toJSON.call(this, e),
  16624. n = !!e && Boolean(e.keepComments);
  16625. return o.toObject(["options", t && t.options || undefined, "methods", r.arrayToJSON(this.methodsArray, e) || {},
  16626. "nested", t && t.nested || undefined, "comment", n ? this.comment: undefined])
  16627. },
  16628. Object.defineProperty(s.prototype, "methodsArray", {
  16629. get: function() {
  16630. return this._methodsArray || (this._methodsArray = o.toArray(this.methods))
  16631. }
  16632. }),
  16633. s.prototype.get = function(e) {
  16634. return this.methods[e] || r.prototype.get.call(this, e)
  16635. },
  16636. s.prototype.resolveAll = function() {
  16637. for (var e = this.methodsArray,
  16638. t = 0; t < e.length; ++t) e[t].resolve();
  16639. return r.prototype.resolve.call(this)
  16640. },
  16641. s.prototype.add = function(e) {
  16642. if (this.get(e.name)) throw Error("duplicate name '" + e.name + "' in " + this);
  16643. return e instanceof i ? (this.methods[e.name] = e, e.parent = this, c(this)) : r.prototype.add.call(this, e)
  16644. },
  16645. s.prototype.remove = function(e) {
  16646. if (e instanceof i) {
  16647. if (this.methods[e.name] !== e) throw Error(e + " is not a member of " + this);
  16648. return delete this.methods[e.name],
  16649. e.parent = null,
  16650. c(this)
  16651. }
  16652. return r.prototype.remove.call(this, e)
  16653. },
  16654. s.prototype.create = function(e, t, n) {
  16655. for (var r, i = new a.Service(e, t, n), s = 0; s < this.methodsArray.length; ++s) {
  16656. var c = o.lcFirst((r = this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g, "");
  16657. i[c] = o.codegen(["r", "c"], o.isReserved(c) ? c + "_": c)("return this.rpcCall(m,q,s,r,c)")({
  16658. m: r,
  16659. q: r.resolvedRequestType.ctor,
  16660. s: r.resolvedResponseType.ctor
  16661. })
  16662. }
  16663. return i
  16664. }
  16665. },
  16666. {
  16667. 20 : 20,
  16668. 21 : 21,
  16669. 28 : 28,
  16670. 33 : 33
  16671. }],
  16672. 31 : [function(e, t, n) {
  16673. t.exports = E;
  16674. var r = e(21); ((E.prototype = Object.create(r.prototype)).constructor = E).className = "Type";
  16675. var i = e(14),
  16676. o = e(23),
  16677. a = e(15),
  16678. s = e(18),
  16679. c = e(30),
  16680. d = e(19),
  16681. u = e(24),
  16682. l = e(38),
  16683. p = e(33),
  16684. f = e(13),
  16685. g = e(12),
  16686. m = e(36),
  16687. h = e(11),
  16688. v = e(37);
  16689. function E(e, t) {
  16690. r.call(this, e, t),
  16691. this.fields = {},
  16692. this.oneofs = undefined,
  16693. this.extensions = undefined,
  16694. this.reserved = undefined,
  16695. this.group = undefined,
  16696. this._fieldsById = null,
  16697. this._fieldsArray = null,
  16698. this._oneofsArray = null,
  16699. this._ctor = null
  16700. }
  16701. function _(e) {
  16702. return e._fieldsById = e._fieldsArray = e._oneofsArray = null,
  16703. delete e.encode,
  16704. delete e.decode,
  16705. delete e.verify,
  16706. e
  16707. }
  16708. Object.defineProperties(E.prototype, {
  16709. fieldsById: {
  16710. get: function() {
  16711. if (this._fieldsById) return this._fieldsById;
  16712. this._fieldsById = {};
  16713. for (var e = Object.keys(this.fields), t = 0; t < e.length; ++t) {
  16714. var n = this.fields[e[t]],
  16715. r = n.id;
  16716. if (this._fieldsById[r]) throw Error("duplicate id " + r + " in " + this);
  16717. this._fieldsById[r] = n
  16718. }
  16719. return this._fieldsById
  16720. }
  16721. },
  16722. fieldsArray: {
  16723. get: function() {
  16724. return this._fieldsArray || (this._fieldsArray = p.toArray(this.fields))
  16725. }
  16726. },
  16727. oneofsArray: {
  16728. get: function() {
  16729. return this._oneofsArray || (this._oneofsArray = p.toArray(this.oneofs))
  16730. }
  16731. },
  16732. ctor: {
  16733. get: function() {
  16734. return this._ctor || (this.ctor = E.generateConstructor(this)())
  16735. },
  16736. set: function(e) {
  16737. var t = e.prototype;
  16738. t instanceof d || ((e.prototype = new d).constructor = e, p.merge(e.prototype, t)),
  16739. e.$type = e.prototype.$type = this,
  16740. p.merge(e, d, !0),
  16741. this._ctor = e;
  16742. for (var n = 0; n < this.fieldsArray.length; ++n) this._fieldsArray[n].resolve();
  16743. var r = {};
  16744. for (n = 0; n < this.oneofsArray.length; ++n) r[this._oneofsArray[n].resolve().name] = {
  16745. get: p.oneOfGetter(this._oneofsArray[n].oneof),
  16746. set: p.oneOfSetter(this._oneofsArray[n].oneof)
  16747. };
  16748. n && Object.defineProperties(e.prototype, r)
  16749. }
  16750. }
  16751. }),
  16752. E.generateConstructor = function(e) {
  16753. for (var t, n = p.codegen(["p"], e.name), r = 0; r < e.fieldsArray.length; ++r)(t = e._fieldsArray[r]).map ? n("this%s={}", p.safeProp(t.name)) : t.repeated && n("this%s=[]", p.safeProp(t.name));
  16754. return n("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")
  16755. },
  16756. E.fromJSON = function(e, t) {
  16757. var n = new E(e, t.options);
  16758. n.extensions = t.extensions,
  16759. n.reserved = t.reserved;
  16760. for (var d = Object.keys(t.fields), u = 0; u < d.length; ++u) n.add((void 0 !== t.fields[d[u]].keyType ? s.fromJSON: a.fromJSON)(d[u], t.fields[d[u]]));
  16761. if (t.oneofs) for (d = Object.keys(t.oneofs), u = 0; u < d.length; ++u) n.add(o.fromJSON(d[u], t.oneofs[d[u]]));
  16762. if (t.nested) for (d = Object.keys(t.nested), u = 0; u < d.length; ++u) {
  16763. var l = t.nested[d[u]];
  16764. n.add((l.id !== undefined ? a.fromJSON: l.fields !== undefined ? E.fromJSON: l.values !== undefined ? i.fromJSON: l.methods !== undefined ? c.fromJSON: r.fromJSON)(d[u], l))
  16765. }
  16766. return t.extensions && t.extensions.length && (n.extensions = t.extensions),
  16767. t.reserved && t.reserved.length && (n.reserved = t.reserved),
  16768. t.group && (n.group = !0),
  16769. t.comment && (n.comment = t.comment),
  16770. n
  16771. },
  16772. E.prototype.toJSON = function(e) {
  16773. var t = r.prototype.toJSON.call(this, e),
  16774. n = !!e && Boolean(e.keepComments);
  16775. return p.toObject(["options", t && t.options || undefined, "oneofs", r.arrayToJSON(this.oneofsArray, e), "fields", r.arrayToJSON(this.fieldsArray.filter((function(e) {
  16776. return ! e.declaringField
  16777. })), e) || {},
  16778. "extensions", this.extensions && this.extensions.length ? this.extensions: undefined, "reserved", this.reserved && this.reserved.length ? this.reserved: undefined, "group", this.group || undefined, "nested", t && t.nested || undefined, "comment", n ? this.comment: undefined])
  16779. },
  16780. E.prototype.resolveAll = function() {
  16781. for (var e = this.fieldsArray,
  16782. t = 0; t < e.length;) e[t++].resolve();
  16783. var n = this.oneofsArray;
  16784. for (t = 0; t < n.length;) n[t++].resolve();
  16785. return r.prototype.resolveAll.call(this)
  16786. },
  16787. E.prototype.get = function(e) {
  16788. return this.fields[e] || this.oneofs && this.oneofs[e] || this.nested && this.nested[e] || null
  16789. },
  16790. E.prototype.add = function(e) {
  16791. if (this.get(e.name)) throw Error("duplicate name '" + e.name + "' in " + this);
  16792. if (e instanceof a && e.extend === undefined) {
  16793. if (this._fieldsById ? this._fieldsById[e.id] : this.fieldsById[e.id]) throw Error("duplicate id " + e.id + " in " + this);
  16794. if (this.isReservedId(e.id)) throw Error("id " + e.id + " is reserved in " + this);
  16795. if (this.isReservedName(e.name)) throw Error("name '" + e.name + "' is reserved in " + this);
  16796. return e.parent && e.parent.remove(e),
  16797. this.fields[e.name] = e,
  16798. e.message = this,
  16799. e.onAdd(this),
  16800. _(this)
  16801. }
  16802. return e instanceof o ? (this.oneofs || (this.oneofs = {}), this.oneofs[e.name] = e, e.onAdd(this), _(this)) : r.prototype.add.call(this, e)
  16803. },
  16804. E.prototype.remove = function(e) {
  16805. if (e instanceof a && e.extend === undefined) {
  16806. if (!this.fields || this.fields[e.name] !== e) throw Error(e + " is not a member of " + this);
  16807. return delete this.fields[e.name],
  16808. e.parent = null,
  16809. e.onRemove(this),
  16810. _(this)
  16811. }
  16812. if (e instanceof o) {
  16813. if (!this.oneofs || this.oneofs[e.name] !== e) throw Error(e + " is not a member of " + this);
  16814. return delete this.oneofs[e.name],
  16815. e.parent = null,
  16816. e.onRemove(this),
  16817. _(this)
  16818. }
  16819. return r.prototype.remove.call(this, e)
  16820. },
  16821. E.prototype.isReservedId = function(e) {
  16822. return r.isReservedId(this.reserved, e)
  16823. },
  16824. E.prototype.isReservedName = function(e) {
  16825. return r.isReservedName(this.reserved, e)
  16826. },
  16827. E.prototype.create = function(e) {
  16828. return new this.ctor(e)
  16829. },
  16830. E.prototype.setup = function() {
  16831. for (var e = this.fullName,
  16832. t = [], n = 0; n < this.fieldsArray.length; ++n) t.push(this._fieldsArray[n].resolve().resolvedType);
  16833. this.encode = f(this)({
  16834. Writer: l,
  16835. types: t,
  16836. util: p
  16837. }),
  16838. this.decode = g(this)({
  16839. Reader: u,
  16840. types: t,
  16841. util: p
  16842. }),
  16843. this.verify = m(this)({
  16844. types: t,
  16845. util: p
  16846. }),
  16847. this.fromObject = h.fromObject(this)({
  16848. types: t,
  16849. util: p
  16850. }),
  16851. this.toObject = h.toObject(this)({
  16852. types: t,
  16853. util: p
  16854. });
  16855. var r = v[e];
  16856. if (r) {
  16857. var i = Object.create(this);
  16858. i.fromObject = this.fromObject,
  16859. this.fromObject = r.fromObject.bind(i),
  16860. i.toObject = this.toObject,
  16861. this.toObject = r.toObject.bind(i)
  16862. }
  16863. return this
  16864. },
  16865. E.prototype.encode = function(e, t) {
  16866. return this.setup().encode(e, t)
  16867. },
  16868. E.prototype.encodeDelimited = function(e, t) {
  16869. return this.encode(e, t && t.len ? t.fork() : t).ldelim()
  16870. },
  16871. E.prototype.decode = function(e, t) {
  16872. return this.setup().decode(e, t)
  16873. },
  16874. E.prototype.decodeDelimited = function(e) {
  16875. return e instanceof u || (e = u.create(e)),
  16876. this.decode(e, e.uint32())
  16877. },
  16878. E.prototype.verify = function(e) {
  16879. return this.setup().verify(e)
  16880. },
  16881. E.prototype.fromObject = function(e) {
  16882. return this.setup().fromObject(e)
  16883. },
  16884. E.prototype.toObject = function(e, t) {
  16885. return this.setup().toObject(e, t)
  16886. },
  16887. E.d = function(e) {
  16888. return function(t) {
  16889. p.decorateType(t, e)
  16890. }
  16891. }
  16892. },
  16893. {
  16894. 11 : 11,
  16895. 12 : 12,
  16896. 13 : 13,
  16897. 14 : 14,
  16898. 15 : 15,
  16899. 18 : 18,
  16900. 19 : 19,
  16901. 21 : 21,
  16902. 23 : 23,
  16903. 24 : 24,
  16904. 30 : 30,
  16905. 33 : 33,
  16906. 36 : 36,
  16907. 37 : 37,
  16908. 38 : 38
  16909. }],
  16910. 32 : [function(e, t, n) {
  16911. var r = n,
  16912. i = e(33),
  16913. o = ["double", "float", "int32", "uint32", "sint32", "fixed32", "sfixed32", "int64", "uint64", "sint64", "fixed64", "sfixed64", "bool", "string", "bytes"];
  16914. function a(e, t) {
  16915. var n = 0,
  16916. r = {};
  16917. for (t |= 0; n < e.length;) r[o[n + t]] = e[n++];
  16918. return r
  16919. }
  16920. r.basic = a([1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2, 2]),
  16921. r.defaults = a([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, !1, "", i.emptyArray, null]),
  16922. r.long = a([0, 0, 0, 1, 1], 7),
  16923. r.mapKey = a([0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2], 2),
  16924. r.packed = a([1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0])
  16925. },
  16926. {
  16927. 33 : 33
  16928. }],
  16929. 33 : [function(e, t, n) {
  16930. var r, i, o = t.exports = e(35),
  16931. a = e(27);
  16932. o.codegen = e(3),
  16933. o.fetch = e(5),
  16934. o.path = e(8),
  16935. o.fs = o.inquire("fs"),
  16936. o.toArray = function(e) {
  16937. if (e) {
  16938. for (var t = Object.keys(e), n = new Array(t.length), r = 0; r < t.length;) n[r] = e[t[r++]];
  16939. return n
  16940. }
  16941. return []
  16942. },
  16943. o.toObject = function(e) {
  16944. for (var t = {},
  16945. n = 0; n < e.length;) {
  16946. var r = e[n++],
  16947. i = e[n++];
  16948. i !== undefined && (t[r] = i)
  16949. }
  16950. return t
  16951. };
  16952. var s = /\\/g,
  16953. c = /"/g;
  16954. o.isReserved = function(e) {
  16955. return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)
  16956. },
  16957. o.safeProp = function(e) {
  16958. return ! /^[$\w_]+$/.test(e) || o.isReserved(e) ? '["' + e.replace(s, "\\\\").replace(c, '\\"') + '"]': "." + e
  16959. },
  16960. o.ucFirst = function(e) {
  16961. return e.charAt(0).toUpperCase() + e.substring(1)
  16962. };
  16963. var d = /_([a-z])/g;
  16964. o.camelCase = function(e) {
  16965. return e.substring(0, 1) + e.substring(1).replace(d, (function(e, t) {
  16966. return t.toUpperCase()
  16967. }))
  16968. },
  16969. o.compareFieldsById = function(e, t) {
  16970. return e.id - t.id
  16971. },
  16972. o.decorateType = function(t, n) {
  16973. if (t.$type) return n && t.$type.name !== n && (o.decorateRoot.remove(t.$type), t.$type.name = n, o.decorateRoot.add(t.$type)),
  16974. t.$type;
  16975. r || (r = e(31));
  16976. var i = new r(n || t.name);
  16977. return o.decorateRoot.add(i),
  16978. i.ctor = t,
  16979. Object.defineProperty(t, "$type", {
  16980. value: i,
  16981. enumerable: !1
  16982. }),
  16983. Object.defineProperty(t.prototype, "$type", {
  16984. value: i,
  16985. enumerable: !1
  16986. }),
  16987. i
  16988. };
  16989. var u = 0;
  16990. o.decorateEnum = function(t) {
  16991. if (t.$type) return t.$type;
  16992. i || (i = e(14));
  16993. var n = new i("Enum" + u++, t);
  16994. return o.decorateRoot.add(n),
  16995. Object.defineProperty(t, "$type", {
  16996. value: n,
  16997. enumerable: !1
  16998. }),
  16999. n
  17000. },
  17001. o.setProperty = function(e, t, n) {
  17002. if ("object" != typeof e) throw TypeError("dst must be an object");
  17003. if (!t) throw TypeError("path must be specified");
  17004. return function e(t, n, r) {
  17005. var i = n.shift();
  17006. if (n.length > 0) t[i] = e(t[i] || {},
  17007. n, r);
  17008. else {
  17009. var o = t[i];
  17010. o && (r = [].concat(o).concat(r)),
  17011. t[i] = r
  17012. }
  17013. return t
  17014. } (e, t = t.split("."), n)
  17015. },
  17016. Object.defineProperty(o, "decorateRoot", {
  17017. get: function() {
  17018. return a.decorated || (a.decorated = new(e(26)))
  17019. }
  17020. })
  17021. },
  17022. {
  17023. 14 : 14,
  17024. 26 : 26,
  17025. 27 : 27,
  17026. 3 : 3,
  17027. 31 : 31,
  17028. 35 : 35,
  17029. 5 : 5,
  17030. 8 : 8
  17031. }],
  17032. 34 : [function(e, t, n) {
  17033. t.exports = i;
  17034. var r = e(35);
  17035. function i(e, t) {
  17036. this.lo = e >>> 0,
  17037. this.hi = t >>> 0
  17038. }
  17039. var o = i.zero = new i(0, 0);
  17040. o.toNumber = function() {
  17041. return 0
  17042. },
  17043. o.zzEncode = o.zzDecode = function() {
  17044. return this
  17045. },
  17046. o.length = function() {
  17047. return 1
  17048. };
  17049. var a = i.zeroHash = "\0\0\0\0\0\0\0\0";
  17050. i.fromNumber = function(e) {
  17051. if (0 === e) return o;
  17052. var t = e < 0;
  17053. t && (e = -e);
  17054. var n = e >>> 0,
  17055. r = (e - n) / 4294967296 >>> 0;
  17056. return t && (r = ~r >>> 0, n = ~n >>> 0, ++n > 4294967295 && (n = 0, ++r > 4294967295 && (r = 0))),
  17057. new i(n, r)
  17058. },
  17059. i.from = function(e) {
  17060. if ("number" == typeof e) return i.fromNumber(e);
  17061. if (r.isString(e)) {
  17062. if (!r.Long) return i.fromNumber(parseInt(e, 10));
  17063. e = r.Long.fromString(e)
  17064. }
  17065. return e.low || e.high ? new i(e.low >>> 0, e.high >>> 0) : o
  17066. },
  17067. i.prototype.toNumber = function(e) {
  17068. if (!e && this.hi >>> 31) {
  17069. var t = 1 + ~this.lo >>> 0,
  17070. n = ~this.hi >>> 0;
  17071. return t || (n = n + 1 >>> 0),
  17072. -(t + 4294967296 * n)
  17073. }
  17074. return this.lo + 4294967296 * this.hi
  17075. },
  17076. i.prototype.toLong = function(e) {
  17077. return r.Long ? new r.Long(0 | this.lo, 0 | this.hi, Boolean(e)) : {
  17078. low: 0 | this.lo,
  17079. high: 0 | this.hi,
  17080. unsigned: Boolean(e)
  17081. }
  17082. };
  17083. var s = String.prototype.charCodeAt;
  17084. i.fromHash = function(e) {
  17085. return e === a ? o: new i((s.call(e, 0) | s.call(e, 1) << 8 | s.call(e, 2) << 16 | s.call(e, 3) << 24) >>> 0, (s.call(e, 4) | s.call(e, 5) << 8 | s.call(e, 6) << 16 | s.call(e, 7) << 24) >>> 0)
  17086. },
  17087. i.prototype.toHash = function() {
  17088. 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)
  17089. },
  17090. i.prototype.zzEncode = function() {
  17091. var e = this.hi >> 31;
  17092. return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ e) >>> 0,
  17093. this.lo = (this.lo << 1 ^ e) >>> 0,
  17094. this
  17095. },
  17096. i.prototype.zzDecode = function() {
  17097. var e = -(1 & this.lo);
  17098. return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ e) >>> 0,
  17099. this.hi = (this.hi >>> 1 ^ e) >>> 0,
  17100. this
  17101. },
  17102. i.prototype.length = function() {
  17103. var e = this.lo,
  17104. t = (this.lo >>> 28 | this.hi << 4) >>> 0,
  17105. n = this.hi >>> 24;
  17106. return 0 === n ? 0 === t ? e < 16384 ? e < 128 ? 1 : 2 : e < 2097152 ? 3 : 4 : t < 16384 ? t < 128 ? 5 : 6 : t < 2097152 ? 7 : 8 : n < 128 ? 9 : 10
  17107. }
  17108. },
  17109. {
  17110. 35 : 35
  17111. }],
  17112. 35 : [function(e, t, n) {
  17113. var r = n;
  17114. function i(e, t, n) {
  17115. for (var r = Object.keys(t), i = 0; i < r.length; ++i) e[r[i]] !== undefined && n || (e[r[i]] = t[r[i]]);
  17116. return e
  17117. }
  17118. function o(e) {
  17119. function t(e, n) {
  17120. if (! (this instanceof t)) return new t(e, n);
  17121. Object.defineProperty(this, "message", {
  17122. get: function() {
  17123. return e
  17124. }
  17125. }),
  17126. Error.captureStackTrace ? Error.captureStackTrace(this, t) : Object.defineProperty(this, "stack", {
  17127. value: (new Error).stack || ""
  17128. }),
  17129. n && i(this, n)
  17130. }
  17131. return (t.prototype = Object.create(Error.prototype)).constructor = t,
  17132. Object.defineProperty(t.prototype, "name", {
  17133. get: function() {
  17134. return e
  17135. }
  17136. }),
  17137. t.prototype.toString = function() {
  17138. return this.name + ": " + this.message
  17139. },
  17140. t
  17141. }
  17142. r.asPromise = e(1),
  17143. r.base64 = e(2),
  17144. r.EventEmitter = e(4),
  17145. r.float = e(6),
  17146. r.inquire = e(7),
  17147. r.utf8 = e(10),
  17148. r.pool = e(9),
  17149. r.LongBits = e(34),
  17150. r.isNode = Boolean(void 0 !== global && global && global.process && global.process.versions && global.process.versions.node),
  17151. r.global = r.isNode && global || "undefined" != typeof window && window || "undefined" != typeof self && self || this,
  17152. r.emptyArray = Object.freeze ? Object.freeze([]) : [],
  17153. r.emptyObject = Object.freeze ? Object.freeze({}) : {},
  17154. r.isInteger = Number.isInteger ||
  17155. function(e) {
  17156. return "number" == typeof e && isFinite(e) && Math.floor(e) === e
  17157. },
  17158. r.isString = function(e) {
  17159. return "string" == typeof e || e instanceof String
  17160. },
  17161. r.isObject = function(e) {
  17162. return e && "object" == typeof e
  17163. },
  17164. r.isset = r.isSet = function(e, t) {
  17165. var n = e[t];
  17166. return ! (null == n || !e.hasOwnProperty(t)) && ("object" != typeof n || (Array.isArray(n) ? n.length: Object.keys(n).length) > 0)
  17167. },
  17168. r.Buffer = function() {
  17169. try {
  17170. var e = r.inquire("buffer").Buffer;
  17171. return e.prototype.utf8Write ? e: null
  17172. } catch(e) {
  17173. return null
  17174. }
  17175. } (),
  17176. r._Buffer_from = null,
  17177. r._Buffer_allocUnsafe = null,
  17178. r.newBuffer = function(e) {
  17179. return "number" == typeof e ? r.Buffer ? r._Buffer_allocUnsafe(e) : new r.Array(e) : r.Buffer ? r._Buffer_from(e) : "undefined" == typeof Uint8Array ? e: new Uint8Array(e)
  17180. },
  17181. r.Array = "undefined" != typeof Uint8Array ? Uint8Array: Array,
  17182. r.Long = r.global.dcodeIO && r.global.dcodeIO.Long || r.global.Long || r.inquire("long"),
  17183. r.key2Re = /^true|false|0|1$/,
  17184. r.key32Re = /^-?(?:0|[1-9][0-9]*)$/,
  17185. r.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,
  17186. r.longToHash = function(e) {
  17187. return e ? r.LongBits.from(e).toHash() : r.LongBits.zeroHash
  17188. },
  17189. r.longFromHash = function(e, t) {
  17190. var n = r.LongBits.fromHash(e);
  17191. return r.Long ? r.Long.fromBits(n.lo, n.hi, t) : n.toNumber(Boolean(t))
  17192. },
  17193. r.merge = i,
  17194. r.lcFirst = function(e) {
  17195. return e.charAt(0).toLowerCase() + e.substring(1)
  17196. },
  17197. r.newError = o,
  17198. r.ProtocolError = o("ProtocolError"),
  17199. r.oneOfGetter = function(e) {
  17200. for (var t = {},
  17201. n = 0; n < e.length; ++n) t[e[n]] = 1;
  17202. return function() {
  17203. for (var e = Object.keys(this), n = e.length - 1; n > -1; --n) if (1 === t[e[n]] && this[e[n]] !== undefined && null !== this[e[n]]) return e[n]
  17204. }
  17205. },
  17206. r.oneOfSetter = function(e) {
  17207. return function(t) {
  17208. for (var n = 0; n < e.length; ++n) e[n] !== t && delete this[e[n]]
  17209. }
  17210. },
  17211. r.toJSONOptions = {
  17212. longs: String,
  17213. enums: String,
  17214. bytes: String,
  17215. json: !0
  17216. },
  17217. r._configure = function() {
  17218. var e = r.Buffer;
  17219. e ? (r._Buffer_from = e.from !== Uint8Array.from && e.from ||
  17220. function(t, n) {
  17221. return new e(t, n)
  17222. },
  17223. r._Buffer_allocUnsafe = e.allocUnsafe ||
  17224. function(t) {
  17225. return new e(t)
  17226. }) : r._Buffer_from = r._Buffer_allocUnsafe = null
  17227. }
  17228. },
  17229. {
  17230. 1 : 1,
  17231. 10 : 10,
  17232. 2 : 2,
  17233. 34 : 34,
  17234. 4 : 4,
  17235. 6 : 6,
  17236. 7 : 7,
  17237. 9 : 9
  17238. }],
  17239. 36 : [function(e, t, n) {
  17240. t.exports = function(e) {
  17241. var t = i.codegen(["m"], e.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected"),
  17242. n = e.oneofsArray,
  17243. r = {};
  17244. n.length && t("var p={}");
  17245. for (var c = 0; c < e.fieldsArray.length; ++c) {
  17246. var d = e._fieldsArray[c].resolve(),
  17247. u = "m" + i.safeProp(d.name);
  17248. if (d.optional && t("if(%s!=null&&m.hasOwnProperty(%j)){", u, d.name), d.map) t("if(!util.isObject(%s))", u)("return%j", o(d, "object"))("var k=Object.keys(%s)", u)("for(var i=0;i<k.length;++i){"),
  17249. s(t, d, "k[i]"),
  17250. a(t, d, c, u + "[k[i]]")("}");
  17251. else if (d.repeated) t("if(!Array.isArray(%s))", u)("return%j", o(d, "array"))("for(var i=0;i<%s.length;++i){", u),
  17252. a(t, d, c, u + "[i]")("}");
  17253. else {
  17254. if (d.partOf) {
  17255. var l = i.safeProp(d.partOf.name);
  17256. 1 === r[d.partOf.name] && t("if(p%s===1)", l)("return%j", d.partOf.name + ": multiple values"),
  17257. r[d.partOf.name] = 1,
  17258. t("p%s=1", l)
  17259. }
  17260. a(t, d, c, u)
  17261. }
  17262. d.optional && t("}")
  17263. }
  17264. return t("return null")
  17265. };
  17266. var r = e(14),
  17267. i = e(33);
  17268. function o(e, t) {
  17269. return e.name + ": " + t + (e.repeated && "array" !== t ? "[]": e.map && "object" !== t ? "{k:" + e.keyType + "}": "") + " expected"
  17270. }
  17271. function a(e, t, n, i) {
  17272. if (t.resolvedType) if (t.resolvedType instanceof r) {
  17273. e("switch(%s){", i)("default:")("return%j", o(t, "enum value"));
  17274. for (var a = Object.keys(t.resolvedType.values), s = 0; s < a.length; ++s) e("case %i:", t.resolvedType.values[a[s]]);
  17275. e("break")("}")
  17276. } else e("{")("var e=types[%i].verify(%s);", n, i)("if(e)")("return%j+e", t.name + ".")("}");
  17277. else switch (t.type) {
  17278. case "int32":
  17279. case "uint32":
  17280. case "sint32":
  17281. case "fixed32":
  17282. case "sfixed32":
  17283. e("if(!util.isInteger(%s))", i)("return%j", o(t, "integer"));
  17284. break;
  17285. case "int64":
  17286. case "uint64":
  17287. case "sint64":
  17288. case "fixed64":
  17289. case "sfixed64":
  17290. e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", i, i, i, i)("return%j", o(t, "integer|Long"));
  17291. break;
  17292. case "float":
  17293. case "double":
  17294. e('if(typeof %s!=="number")', i)("return%j", o(t, "number"));
  17295. break;
  17296. case "bool":
  17297. e('if(typeof %s!=="boolean")', i)("return%j", o(t, "boolean"));
  17298. break;
  17299. case "string":
  17300. e("if(!util.isString(%s))", i)("return%j", o(t, "string"));
  17301. break;
  17302. case "bytes":
  17303. e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', i, i, i)("return%j", o(t, "buffer"))
  17304. }
  17305. return e
  17306. }
  17307. function s(e, t, n) {
  17308. switch (t.keyType) {
  17309. case "int32":
  17310. case "uint32":
  17311. case "sint32":
  17312. case "fixed32":
  17313. case "sfixed32":
  17314. e("if(!util.key32Re.test(%s))", n)("return%j", o(t, "integer key"));
  17315. break;
  17316. case "int64":
  17317. case "uint64":
  17318. case "sint64":
  17319. case "fixed64":
  17320. case "sfixed64":
  17321. e("if(!util.key64Re.test(%s))", n)("return%j", o(t, "integer|Long key"));
  17322. break;
  17323. case "bool":
  17324. e("if(!util.key2Re.test(%s))", n)("return%j", o(t, "boolean key"))
  17325. }
  17326. return e
  17327. }
  17328. },
  17329. {
  17330. 14 : 14,
  17331. 33 : 33
  17332. }],
  17333. 37 : [function(e, t, n) {
  17334. var r = n,
  17335. i = e(19);
  17336. r[".google.protobuf.Any"] = {
  17337. fromObject: function(e) {
  17338. if (e && e["@type"]) {
  17339. var t = e["@type"].substring(e["@type"].lastIndexOf("/") + 1),
  17340. n = this.lookup(t);
  17341. if (n) {
  17342. var r = "." === e["@type"].charAt(0) ? e["@type"].substr(1) : e["@type"];
  17343. return - 1 === r.indexOf("/") && (r = "/" + r),
  17344. this.create({
  17345. type_url: r,
  17346. value: n.encode(n.fromObject(e)).finish()
  17347. })
  17348. }
  17349. }
  17350. return this.fromObject(e)
  17351. },
  17352. toObject: function(e, t) {
  17353. var n = "",
  17354. r = "";
  17355. if (t && t.json && e.type_url && e.value) {
  17356. r = e.type_url.substring(e.type_url.lastIndexOf("/") + 1),
  17357. n = e.type_url.substring(0, e.type_url.lastIndexOf("/") + 1);
  17358. var o = this.lookup(r);
  17359. o && (e = o.decode(e.value))
  17360. }
  17361. if (! (e instanceof this.ctor) && e instanceof i) {
  17362. var a = e.$type.toObject(e, t);
  17363. return "" === n && (n = "type.googleapis.com/"),
  17364. r = n + ("." === e.$type.fullName[0] ? e.$type.fullName.substr(1) : e.$type.fullName),
  17365. a["@type"] = r,
  17366. a
  17367. }
  17368. return this.toObject(e, t)
  17369. }
  17370. }
  17371. },
  17372. {
  17373. 19 : 19
  17374. }],
  17375. 38 : [function(e, t, n) {
  17376. t.exports = l;
  17377. var r, i = e(35),
  17378. o = i.LongBits,
  17379. a = i.base64,
  17380. s = i.utf8;
  17381. function c(e, t, n) {
  17382. this.fn = e,
  17383. this.len = t,
  17384. this.next = undefined,
  17385. this.val = n
  17386. }
  17387. function d() {}
  17388. function u(e) {
  17389. this.head = e.head,
  17390. this.tail = e.tail,
  17391. this.len = e.len,
  17392. this.next = e.states
  17393. }
  17394. function l() {
  17395. this.len = 0,
  17396. this.head = new c(d, 0, 0),
  17397. this.tail = this.head,
  17398. this.states = null
  17399. }
  17400. var p = function() {
  17401. return i.Buffer ?
  17402. function() {
  17403. return (l.create = function() {
  17404. return new r
  17405. })()
  17406. }: function() {
  17407. return new l
  17408. }
  17409. };
  17410. function f(e, t, n) {
  17411. t[n] = 255 & e
  17412. }
  17413. function g(e, t) {
  17414. this.len = e,
  17415. this.next = undefined,
  17416. this.val = t
  17417. }
  17418. function m(e, t, n) {
  17419. for (; e.hi;) t[n++] = 127 & e.lo | 128,
  17420. e.lo = (e.lo >>> 7 | e.hi << 25) >>> 0,
  17421. e.hi >>>= 7;
  17422. for (; e.lo > 127;) t[n++] = 127 & e.lo | 128,
  17423. e.lo = e.lo >>> 7;
  17424. t[n++] = e.lo
  17425. }
  17426. function h(e, t, n) {
  17427. t[n] = 255 & e,
  17428. t[n + 1] = e >>> 8 & 255,
  17429. t[n + 2] = e >>> 16 & 255,
  17430. t[n + 3] = e >>> 24
  17431. }
  17432. l.create = p(),
  17433. l.alloc = function(e) {
  17434. return new i.Array(e)
  17435. },
  17436. i.Array !== Array && (l.alloc = i.pool(l.alloc, i.Array.prototype.subarray)),
  17437. l.prototype._push = function(e, t, n) {
  17438. return this.tail = this.tail.next = new c(e, t, n),
  17439. this.len += t,
  17440. this
  17441. },
  17442. g.prototype = Object.create(c.prototype),
  17443. g.prototype.fn = function(e, t, n) {
  17444. for (; e > 127;) t[n++] = 127 & e | 128,
  17445. e >>>= 7;
  17446. t[n] = e
  17447. },
  17448. l.prototype.uint32 = function(e) {
  17449. return this.len += (this.tail = this.tail.next = new g((e >>>= 0) < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5, e)).len,
  17450. this
  17451. },
  17452. l.prototype.int32 = function(e) {
  17453. return e < 0 ? this._push(m, 10, o.fromNumber(e)) : this.uint32(e)
  17454. },
  17455. l.prototype.sint32 = function(e) {
  17456. return this.uint32((e << 1 ^ e >> 31) >>> 0)
  17457. },
  17458. l.prototype.uint64 = function(e) {
  17459. var t = o.from(e);
  17460. return this._push(m, t.length(), t)
  17461. },
  17462. l.prototype.int64 = l.prototype.uint64,
  17463. l.prototype.sint64 = function(e) {
  17464. var t = o.from(e).zzEncode();
  17465. return this._push(m, t.length(), t)
  17466. },
  17467. l.prototype.bool = function(e) {
  17468. return this._push(f, 1, e ? 1 : 0)
  17469. },
  17470. l.prototype.fixed32 = function(e) {
  17471. return this._push(h, 4, e >>> 0)
  17472. },
  17473. l.prototype.sfixed32 = l.prototype.fixed32,
  17474. l.prototype.fixed64 = function(e) {
  17475. var t = o.from(e);
  17476. return this._push(h, 4, t.lo)._push(h, 4, t.hi)
  17477. },
  17478. l.prototype.sfixed64 = l.prototype.fixed64,
  17479. l.prototype.float = function(e) {
  17480. return this._push(i.float.writeFloatLE, 4, e)
  17481. },
  17482. l.prototype.double = function(e) {
  17483. return this._push(i.float.writeDoubleLE, 8, e)
  17484. };
  17485. var v = i.Array.prototype.set ?
  17486. function(e, t, n) {
  17487. t.set(e, n)
  17488. }: function(e, t, n) {
  17489. for (var r = 0; r < e.length; ++r) t[n + r] = e[r]
  17490. };
  17491. l.prototype.bytes = function(e) {
  17492. var t = e.length >>> 0;
  17493. if (!t) return this._push(f, 1, 0);
  17494. if (i.isString(e)) {
  17495. var n = l.alloc(t = a.length(e));
  17496. a.decode(e, n, 0),
  17497. e = n
  17498. }
  17499. return this.uint32(t)._push(v, t, e)
  17500. },
  17501. l.prototype.string = function(e) {
  17502. var t = s.length(e);
  17503. return t ? this.uint32(t)._push(s.write, t, e) : this._push(f, 1, 0)
  17504. },
  17505. l.prototype.fork = function() {
  17506. return this.states = new u(this),
  17507. this.head = this.tail = new c(d, 0, 0),
  17508. this.len = 0,
  17509. this
  17510. },
  17511. l.prototype.reset = function() {
  17512. 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 c(d, 0, 0), this.len = 0),
  17513. this
  17514. },
  17515. l.prototype.ldelim = function() {
  17516. var e = this.head,
  17517. t = this.tail,
  17518. n = this.len;
  17519. return this.reset().uint32(n),
  17520. n && (this.tail.next = e.next, this.tail = t, this.len += n),
  17521. this
  17522. },
  17523. l.prototype.finish = function() {
  17524. for (var e = this.head.next,
  17525. t = this.constructor.alloc(this.len), n = 0; e;) e.fn(e.val, t, n),
  17526. n += e.len,
  17527. e = e.next;
  17528. return t
  17529. },
  17530. l._configure = function(e) {
  17531. r = e,
  17532. l.create = p(),
  17533. r._configure()
  17534. }
  17535. },
  17536. {
  17537. 35 : 35
  17538. }],
  17539. 39 : [function(e, t, n) {
  17540. t.exports = o;
  17541. var r = e(38); (o.prototype = Object.create(r.prototype)).constructor = o;
  17542. var i = e(35);
  17543. function o() {
  17544. r.call(this)
  17545. }
  17546. function a(e, t, n) {
  17547. e.length < 40 ? i.utf8.write(e, t, n) : t.utf8Write ? t.utf8Write(e, n) : t.write(e, n)
  17548. }
  17549. o._configure = function() {
  17550. o.alloc = i._Buffer_allocUnsafe,
  17551. o.writeBytesBuffer = i.Buffer && i.Buffer.prototype instanceof Uint8Array && "set" === i.Buffer.prototype.set.name ?
  17552. function(e, t, n) {
  17553. t.set(e, n)
  17554. }: function(e, t, n) {
  17555. if (e.copy) e.copy(t, n, 0, e.length);
  17556. else for (var r = 0; r < e.length;) t[n++] = e[r++]
  17557. }
  17558. },
  17559. o.prototype.bytes = function(e) {
  17560. i.isString(e) && (e = i._Buffer_from(e, "base64"));
  17561. var t = e.length >>> 0;
  17562. return this.uint32(t),
  17563. t && this._push(o.writeBytesBuffer, t, e),
  17564. this
  17565. },
  17566. o.prototype.string = function(e) {
  17567. var t = i.Buffer.byteLength(e);
  17568. return this.uint32(t),
  17569. t && this._push(a, t, e),
  17570. this
  17571. },
  17572. o._configure()
  17573. },
  17574. {
  17575. 35 : 35,
  17576. 38 : 38
  17577. }]
  17578. },
  17579. {},
  17580. [16])
  17581. } ()
  17582. }).call(this, __webpack_require__(57), __webpack_require__(58)(module))
  17583. },
  17584. function(e, t) {
  17585. var n;
  17586. n = function() {
  17587. return this
  17588. } ();
  17589. try {
  17590. n = n || new Function("return this")()
  17591. } catch(e) {
  17592. "object" == typeof window && (n = window)
  17593. }
  17594. e.exports = n
  17595. },
  17596. function(e, t) {
  17597. e.exports = function(e) {
  17598. return e.webpackPolyfill || (e.deprecate = function() {},
  17599. e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", {
  17600. enumerable: !0,
  17601. get: function() {
  17602. return e.l
  17603. }
  17604. }), Object.defineProperty(e, "id", {
  17605. enumerable: !0,
  17606. get: function() {
  17607. return e.i
  17608. }
  17609. }), e.webpackPolyfill = 1),
  17610. e
  17611. }
  17612. },
  17613. function(e, t) {
  17614. e.exports = r;
  17615. var n = null;
  17616. try {
  17617. n = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports
  17618. } catch(e) {}
  17619. function r(e, t, n) {
  17620. this.low = 0 | e,
  17621. this.high = 0 | t,
  17622. this.unsigned = !!n
  17623. }
  17624. function i(e) {
  17625. return ! 0 === (e && e.__isLong__)
  17626. }
  17627. r.prototype.__isLong__,
  17628. Object.defineProperty(r.prototype, "__isLong__", {
  17629. value: !0
  17630. }),
  17631. r.isLong = i;
  17632. var o = {},
  17633. a = {};
  17634. function s(e, t) {
  17635. var n, r, i;
  17636. return t ? (i = 0 <= (e >>>= 0) && e < 256) && (r = a[e]) ? r: (n = d(e, (0 | e) < 0 ? -1 : 0, !0), i && (a[e] = n), n) : (i = -128 <= (e |= 0) && e < 128) && (r = o[e]) ? r: (n = d(e, e < 0 ? -1 : 0, !1), i && (o[e] = n), n)
  17637. }
  17638. function c(e, t) {
  17639. if (isNaN(e)) return t ? E: v;
  17640. if (t) {
  17641. if (e < 0) return E;
  17642. if (e >= g) return T
  17643. } else {
  17644. if (e <= -m) return I;
  17645. if (e + 1 >= m) return R
  17646. }
  17647. return e < 0 ? c( - e, t).neg() : d(e % f | 0, e / f | 0, t)
  17648. }
  17649. function d(e, t, n) {
  17650. return new r(e, t, n)
  17651. }
  17652. r.fromInt = s,
  17653. r.fromNumber = c,
  17654. r.fromBits = d;
  17655. var u = Math.pow;
  17656. function l(e, t, n) {
  17657. if (0 === e.length) throw Error("empty string");
  17658. if ("NaN" === e || "Infinity" === e || "+Infinity" === e || "-Infinity" === e) return v;
  17659. if ("number" == typeof t ? (n = t, t = !1) : t = !!t, (n = n || 10) < 2 || 36 < n) throw RangeError("radix");
  17660. var r;
  17661. if ((r = e.indexOf("-")) > 0) throw Error("interior hyphen");
  17662. if (0 === r) return l(e.substring(1), t, n).neg();
  17663. for (var i = c(u(n, 8)), o = v, a = 0; a < e.length; a += 8) {
  17664. var s = Math.min(8, e.length - a),
  17665. d = parseInt(e.substring(a, a + s), n);
  17666. if (s < 8) {
  17667. var p = c(u(n, s));
  17668. o = o.mul(p).add(c(d))
  17669. } else o = (o = o.mul(i)).add(c(d))
  17670. }
  17671. return o.unsigned = t,
  17672. o
  17673. }
  17674. function p(e, t) {
  17675. return "number" == typeof e ? c(e, t) : "string" == typeof e ? l(e, t) : d(e.low, e.high, "boolean" == typeof t ? t: e.unsigned)
  17676. }
  17677. r.fromString = l,
  17678. r.fromValue = p;
  17679. var f = 4294967296,
  17680. g = f * f,
  17681. m = g / 2,
  17682. h = s(1 << 24),
  17683. v = s(0);
  17684. r.ZERO = v;
  17685. var E = s(0, !0);
  17686. r.UZERO = E;
  17687. var _ = s(1);
  17688. r.ONE = _;
  17689. var S = s(1, !0);
  17690. r.UONE = S;
  17691. var y = s( - 1);
  17692. r.NEG_ONE = y;
  17693. var R = d( - 1, 2147483647, !1);
  17694. r.MAX_VALUE = R;
  17695. var T = d( - 1, -1, !0);
  17696. r.MAX_UNSIGNED_VALUE = T;
  17697. var I = d(0, -2147483648, !1);
  17698. r.MIN_VALUE = I;
  17699. var A = r.prototype;
  17700. A.toInt = function() {
  17701. return this.unsigned ? this.low >>> 0 : this.low
  17702. },
  17703. A.toNumber = function() {
  17704. return this.unsigned ? (this.high >>> 0) * f + (this.low >>> 0) : this.high * f + (this.low >>> 0)
  17705. },
  17706. A.toString = function(e) {
  17707. if ((e = e || 10) < 2 || 36 < e) throw RangeError("radix");
  17708. if (this.isZero()) return "0";
  17709. if (this.isNegative()) {
  17710. if (this.eq(I)) {
  17711. var t = c(e),
  17712. n = this.div(t),
  17713. r = n.mul(t).sub(this);
  17714. return n.toString(e) + r.toInt().toString(e)
  17715. }
  17716. return "-" + this.neg().toString(e)
  17717. }
  17718. for (var i = c(u(e, 6), this.unsigned), o = this, a = "";;) {
  17719. var s = o.div(i),
  17720. d = (o.sub(s.mul(i)).toInt() >>> 0).toString(e);
  17721. if ((o = s).isZero()) return d + a;
  17722. for (; d.length < 6;) d = "0" + d;
  17723. a = "" + d + a
  17724. }
  17725. },
  17726. A.getHighBits = function() {
  17727. return this.high
  17728. },
  17729. A.getHighBitsUnsigned = function() {
  17730. return this.high >>> 0
  17731. },
  17732. A.getLowBits = function() {
  17733. return this.low
  17734. },
  17735. A.getLowBitsUnsigned = function() {
  17736. return this.low >>> 0
  17737. },
  17738. A.getNumBitsAbs = function() {
  17739. if (this.isNegative()) return this.eq(I) ? 64 : this.neg().getNumBitsAbs();
  17740. for (var e = 0 != this.high ? this.high: this.low, t = 31; t > 0 && 0 == (e & 1 << t); t--);
  17741. return 0 != this.high ? t + 33 : t + 1
  17742. },
  17743. A.isZero = function() {
  17744. return 0 === this.high && 0 === this.low
  17745. },
  17746. A.eqz = A.isZero,
  17747. A.isNegative = function() {
  17748. return ! this.unsigned && this.high < 0
  17749. },
  17750. A.isPositive = function() {
  17751. return this.unsigned || this.high >= 0
  17752. },
  17753. A.isOdd = function() {
  17754. return 1 == (1 & this.low)
  17755. },
  17756. A.isEven = function() {
  17757. return 0 == (1 & this.low)
  17758. },
  17759. A.equals = function(e) {
  17760. return i(e) || (e = p(e)),
  17761. (this.unsigned === e.unsigned || this.high >>> 31 != 1 || e.high >>> 31 != 1) && (this.high === e.high && this.low === e.low)
  17762. },
  17763. A.eq = A.equals,
  17764. A.notEquals = function(e) {
  17765. return ! this.eq(e)
  17766. },
  17767. A.neq = A.notEquals,
  17768. A.ne = A.notEquals,
  17769. A.lessThan = function(e) {
  17770. return this.comp(e) < 0
  17771. },
  17772. A.lt = A.lessThan,
  17773. A.lessThanOrEqual = function(e) {
  17774. return this.comp(e) <= 0
  17775. },
  17776. A.lte = A.lessThanOrEqual,
  17777. A.le = A.lessThanOrEqual,
  17778. A.greaterThan = function(e) {
  17779. return this.comp(e) > 0
  17780. },
  17781. A.gt = A.greaterThan,
  17782. A.greaterThanOrEqual = function(e) {
  17783. return this.comp(e) >= 0
  17784. },
  17785. A.gte = A.greaterThanOrEqual,
  17786. A.ge = A.greaterThanOrEqual,
  17787. A.compare = function(e) {
  17788. if (i(e) || (e = p(e)), this.eq(e)) return 0;
  17789. var t = this.isNegative(),
  17790. n = e.isNegative();
  17791. return t && !n ? -1 : !t && n ? 1 : this.unsigned ? e.high >>> 0 > this.high >>> 0 || e.high === this.high && e.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(e).isNegative() ? -1 : 1
  17792. },
  17793. A.comp = A.compare,
  17794. A.negate = function() {
  17795. return ! this.unsigned && this.eq(I) ? I: this.not().add(_)
  17796. },
  17797. A.neg = A.negate,
  17798. A.add = function(e) {
  17799. i(e) || (e = p(e));
  17800. var t = this.high >>> 16,
  17801. n = 65535 & this.high,
  17802. r = this.low >>> 16,
  17803. o = 65535 & this.low,
  17804. a = e.high >>> 16,
  17805. s = 65535 & e.high,
  17806. c = e.low >>> 16,
  17807. u = 0,
  17808. l = 0,
  17809. f = 0,
  17810. g = 0;
  17811. return f += (g += o + (65535 & e.low)) >>> 16,
  17812. l += (f += r + c) >>> 16,
  17813. u += (l += n + s) >>> 16,
  17814. u += t + a,
  17815. d((f &= 65535) << 16 | (g &= 65535), (u &= 65535) << 16 | (l &= 65535), this.unsigned)
  17816. },
  17817. A.subtract = function(e) {
  17818. return i(e) || (e = p(e)),
  17819. this.add(e.neg())
  17820. },
  17821. A.sub = A.subtract,
  17822. A.multiply = function(e) {
  17823. if (this.isZero()) return v;
  17824. if (i(e) || (e = p(e)), n) return d(n.mul(this.low, this.high, e.low, e.high), n.get_high(), this.unsigned);
  17825. if (e.isZero()) return v;
  17826. if (this.eq(I)) return e.isOdd() ? I: v;
  17827. if (e.eq(I)) return this.isOdd() ? I: v;
  17828. if (this.isNegative()) return e.isNegative() ? this.neg().mul(e.neg()) : this.neg().mul(e).neg();
  17829. if (e.isNegative()) return this.mul(e.neg()).neg();
  17830. if (this.lt(h) && e.lt(h)) return c(this.toNumber() * e.toNumber(), this.unsigned);
  17831. var t = this.high >>> 16,
  17832. r = 65535 & this.high,
  17833. o = this.low >>> 16,
  17834. a = 65535 & this.low,
  17835. s = e.high >>> 16,
  17836. u = 65535 & e.high,
  17837. l = e.low >>> 16,
  17838. f = 65535 & e.low,
  17839. g = 0,
  17840. m = 0,
  17841. E = 0,
  17842. _ = 0;
  17843. return E += (_ += a * f) >>> 16,
  17844. m += (E += o * f) >>> 16,
  17845. E &= 65535,
  17846. m += (E += a * l) >>> 16,
  17847. g += (m += r * f) >>> 16,
  17848. m &= 65535,
  17849. g += (m += o * l) >>> 16,
  17850. m &= 65535,
  17851. g += (m += a * u) >>> 16,
  17852. g += t * f + r * l + o * u + a * s,
  17853. d((E &= 65535) << 16 | (_ &= 65535), (g &= 65535) << 16 | (m &= 65535), this.unsigned)
  17854. },
  17855. A.mul = A.multiply,
  17856. A.divide = function(e) {
  17857. if (i(e) || (e = p(e)), e.isZero()) throw Error("division by zero");
  17858. var t, r, o;
  17859. if (n) return this.unsigned || -2147483648 !== this.high || -1 !== e.low || -1 !== e.high ? d((this.unsigned ? n.div_u: n.div_s)(this.low, this.high, e.low, e.high), n.get_high(), this.unsigned) : this;
  17860. if (this.isZero()) return this.unsigned ? E: v;
  17861. if (this.unsigned) {
  17862. if (e.unsigned || (e = e.toUnsigned()), e.gt(this)) return E;
  17863. if (e.gt(this.shru(1))) return S;
  17864. o = E
  17865. } else {
  17866. if (this.eq(I)) return e.eq(_) || e.eq(y) ? I: e.eq(I) ? _: (t = this.shr(1).div(e).shl(1)).eq(v) ? e.isNegative() ? _: y: (r = this.sub(e.mul(t)), o = t.add(r.div(e)));
  17867. if (e.eq(I)) return this.unsigned ? E: v;
  17868. if (this.isNegative()) return e.isNegative() ? this.neg().div(e.neg()) : this.neg().div(e).neg();
  17869. if (e.isNegative()) return this.div(e.neg()).neg();
  17870. o = v
  17871. }
  17872. for (r = this; r.gte(e);) {
  17873. t = Math.max(1, Math.floor(r.toNumber() / e.toNumber()));
  17874. for (var a = Math.ceil(Math.log(t) / Math.LN2), s = a <= 48 ? 1 : u(2, a - 48), l = c(t), f = l.mul(e); f.isNegative() || f.gt(r);) f = (l = c(t -= s, this.unsigned)).mul(e);
  17875. l.isZero() && (l = _),
  17876. o = o.add(l),
  17877. r = r.sub(f)
  17878. }
  17879. return o
  17880. },
  17881. A.div = A.divide,
  17882. A.modulo = function(e) {
  17883. return i(e) || (e = p(e)),
  17884. n ? d((this.unsigned ? n.rem_u: n.rem_s)(this.low, this.high, e.low, e.high), n.get_high(), this.unsigned) : this.sub(this.div(e).mul(e))
  17885. },
  17886. A.mod = A.modulo,
  17887. A.rem = A.modulo,
  17888. A.not = function() {
  17889. return d(~this.low, ~this.high, this.unsigned)
  17890. },
  17891. A.and = function(e) {
  17892. return i(e) || (e = p(e)),
  17893. d(this.low & e.low, this.high & e.high, this.unsigned)
  17894. },
  17895. A.or = function(e) {
  17896. return i(e) || (e = p(e)),
  17897. d(this.low | e.low, this.high | e.high, this.unsigned)
  17898. },
  17899. A.xor = function(e) {
  17900. return i(e) || (e = p(e)),
  17901. d(this.low ^ e.low, this.high ^ e.high, this.unsigned)
  17902. },
  17903. A.shiftLeft = function(e) {
  17904. return i(e) && (e = e.toInt()),
  17905. 0 == (e &= 63) ? this: e < 32 ? d(this.low << e, this.high << e | this.low >>> 32 - e, this.unsigned) : d(0, this.low << e - 32, this.unsigned)
  17906. },
  17907. A.shl = A.shiftLeft,
  17908. A.shiftRight = function(e) {
  17909. return i(e) && (e = e.toInt()),
  17910. 0 == (e &= 63) ? this: e < 32 ? d(this.low >>> e | this.high << 32 - e, this.high >> e, this.unsigned) : d(this.high >> e - 32, this.high >= 0 ? 0 : -1, this.unsigned)
  17911. },
  17912. A.shr = A.shiftRight,
  17913. A.shiftRightUnsigned = function(e) {
  17914. if (i(e) && (e = e.toInt()), 0 === (e &= 63)) return this;
  17915. var t = this.high;
  17916. return e < 32 ? d(this.low >>> e | t << 32 - e, t >>> e, this.unsigned) : d(32 === e ? t: t >>> e - 32, 0, this.unsigned)
  17917. },
  17918. A.shru = A.shiftRightUnsigned,
  17919. A.shr_u = A.shiftRightUnsigned,
  17920. A.toSigned = function() {
  17921. return this.unsigned ? d(this.low, this.high, !1) : this
  17922. },
  17923. A.toUnsigned = function() {
  17924. return this.unsigned ? this: d(this.low, this.high, !0)
  17925. },
  17926. A.toBytes = function(e) {
  17927. return e ? this.toBytesLE() : this.toBytesBE()
  17928. },
  17929. A.toBytesLE = function() {
  17930. var e = this.high,
  17931. t = this.low;
  17932. return [255 & t, t >>> 8 & 255, t >>> 16 & 255, t >>> 24, 255 & e, e >>> 8 & 255, e >>> 16 & 255, e >>> 24]
  17933. },
  17934. A.toBytesBE = function() {
  17935. var e = this.high,
  17936. t = this.low;
  17937. return [e >>> 24, e >>> 16 & 255, e >>> 8 & 255, 255 & e, t >>> 24, t >>> 16 & 255, t >>> 8 & 255, 255 & t]
  17938. },
  17939. r.fromBytes = function(e, t, n) {
  17940. return n ? r.fromBytesLE(e, t) : r.fromBytesBE(e, t)
  17941. },
  17942. r.fromBytesLE = function(e, t) {
  17943. return new r(e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24, e[4] | e[5] << 8 | e[6] << 16 | e[7] << 24, t)
  17944. },
  17945. r.fromBytesBE = function(e, t) {
  17946. return new r(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7], e[0] << 24 | e[1] << 16 | e[2] << 8 | e[3], t)
  17947. }
  17948. },
  17949. function(e) {
  17950. e.exports = JSON.parse('{"PeerPublishStatus":408,"JoinChannelTimeout":407,"OnUpdateStream":356,"OnRemoveStream":355,"OnAddVideoStream":353,"OnAddAudioStream":352,"FirstAudioDecode":351,"FirstVideoDecode":350,"FirstAudioReceived":349,"FirstVideoReceived":348,"ReqUserAccount":196,"ApiInvoke":41,"RequestProxyWorkerManager":36,"RequestProxyAppCenter":35,"VideoSendingStopped":34,"AudioSendingStopped":33,"StreamSwitch":32,"FirstFrame":31,"Publish":30,"Subscribe":29,"JoinGateway":28,"JoinChooseServer":27,"Session":26,"APWorkerEvent":160,"WorkerEvent":156}')
  17951. },
  17952. function(e) {
  17953. e.exports = JSON.parse('{"nested":{"protobuf":{"nested":{"Session":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"version":{"type":"string","id":11},"browser":{"type":"string","id":12},"appid":{"type":"string","id":13},"mode":{"type":"string","id":14},"extend":{"type":"string","id":15},"process":{"type":"string","id":16},"build":{"type":"string","id":17},"ipv6":{"type":"string","id":18},"sourceHost":{"type":"string","id":19},"sourcePath":{"type":"string","id":20},"collectorHost":{"type":"string","id":21},"collectorName":{"type":"string","id":22}}},"JoinChooseServer":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"chooseServerAddr":{"type":"string","id":11},"chooseServerAddrList":{"type":"string","id":12},"errorCode":{"type":"string","id":13},"eventElapse":{"type":"int64","id":14}}},"JoinGateway":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"gatewayAddr":{"type":"string","id":11},"errorCode":{"type":"string","id":12},"eventElapse":{"type":"int64","id":13},"firstSuccess":{"type":"bool","id":14}}},"Subscribe":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"localSdp":{"type":"string","id":11},"remoteSdp":{"type":"string","id":12},"extend":{"type":"string","id":13},"errorCode":{"type":"string","id":14},"eventElapse":{"type":"int64","id":15},"video":{"type":"bool","id":16},"audio":{"type":"bool","id":17},"subscribeRequestid":{"type":"int32","id":18},"p2pid":{"type":"int32","id":19}}},"Publish":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"localSdp":{"type":"string","id":11},"remoteSdp":{"type":"string","id":12},"extend":{"type":"string","id":13},"errorCode":{"type":"string","id":14},"eventElapse":{"type":"int64","id":15},"videoName":{"type":"string","id":16},"audioName":{"type":"string","id":17},"screenName":{"type":"string","id":18},"video":{"type":"bool","id":19},"audio":{"type":"bool","id":20},"publishRequestid":{"type":"int32","id":21},"p2pid":{"type":"int32","id":22},"screenshare":{"type":"bool","id":23}}},"FirstFrame":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"extend":{"type":"string","id":11},"errorCode":{"type":"string","id":12},"width":{"type":"int64","id":13},"height":{"type":"int64","id":14}}},"StreamSwitch":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"isDual":{"type":"bool","id":11}}},"AudioSendingStopped":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"reason":{"type":"string","id":10},"eventType":{"type":"string","id":11}}},"VideoSendingStopped":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"reason":{"type":"string","id":10},"eventType":{"type":"string","id":11}}},"RequestProxyAppCenter":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"APAddr":{"type":"string","id":11},"workerManagerList":{"type":"string","id":12},"errorCode":{"type":"string","id":13},"eventElapse":{"type":"int64","id":14},"extend":{"type":"string","id":15},"response":{"type":"string","id":16}}},"RequestProxyWorkerManager":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"eventType":{"type":"string","id":10},"workerManagerAddr":{"type":"string","id":11},"errorCode":{"type":"string","id":12},"eventElapse":{"type":"int64","id":13},"extend":{"type":"string","id":14},"response":{"type":"string","id":15}}},"ApiInvoke":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"apiName":{"type":"string","id":9},"errorCode":{"type":"string","id":10},"options":{"type":"string","id":11},"execElapse":{"type":"int64","id":12},"execStates":{"type":"string","id":13},"execResult":{"type":"string","id":14},"invokeId":{"type":"int64","id":15}}},"ReqUserAccount":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"eventType":{"type":"string","id":9},"serverAddress":{"type":"string","id":10},"stringUid":{"type":"string","id":11},"errorCode":{"type":"string","id":12},"extend":{"type":"string","id":13}}},"FirstVideoReceived":{"fields":{"lts":{"type":"int64","id":1},"peer":{"type":"int64","id":2},"elapse":{"type":"int64","id":3},"sid":{"type":"string","id":4},"cname":{"type":"string","id":5},"cid":{"type":"int64","id":6},"uid":{"type":"int64","id":8},"subscribeRequestid":{"type":"int32","id":9},"p2pid":{"type":"int32","id":10},"subscribeElapse":{"type":"int64","id":11}}},"FirstAudioReceived":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7},"elapse":{"type":"int64","id":8},"subscribeRequestid":{"type":"int32","id":9},"p2pid":{"type":"int32","id":10},"subscribeElapse":{"type":"int64","id":11}}},"FirstVideoDecode":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7},"elapse":{"type":"int64","id":8},"videowidth":{"type":"int32","id":9},"videoheight":{"type":"int32","id":10},"subscribeRequestid":{"type":"int32","id":11},"p2pid":{"type":"int32","id":12},"subscribeElapse":{"type":"int64","id":13}}},"FirstAudioDecode":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7},"elapse":{"type":"int64","id":8},"subscribeRequestid":{"type":"int32","id":9},"p2pid":{"type":"int32","id":10},"subscribeElapse":{"type":"int64","id":11}}},"OnAddAudioStream":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7}}},"OnAddVideoStream":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7}}},"OnRemoveStream":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7}}},"OnUpdateStream":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":6},"peer":{"type":"int64","id":7},"audio":{"type":"bool","id":8},"video":{"type":"bool","id":9}}},"JoinChannelTimeout":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":5},"elapse":{"type":"int64","id":6},"timeout":{"type":"int32","id":7}}},"PeerPublishStatus":{"fields":{"lts":{"type":"int64","id":1},"sid":{"type":"string","id":2},"cname":{"type":"string","id":3},"cid":{"type":"int64","id":4},"uid":{"type":"int64","id":5},"peer":{"type":"int64","id":6},"elapse":{"type":"int64","id":7},"peerPublishDuration":{"type":"int64","id":8},"joinChannelSuccessElapse":{"type":"int64","id":9},"subscribeElapse":{"type":"int64","id":10},"audiotag":{"type":"int32","id":11},"videotag":{"type":"int32","id":12},"screensharetag":{"type":"int32","id":13},"firsttimetag":{"type":"int32","id":14}}},"Message":{"fields":{"id":{"type":"int64","id":1},"msg":{"type":"bytes","id":2}}},"ProtoRaws":{"fields":{"sendTs":{"type":"int64","id":1},"payloads":{"rule":"repeated","type":"Message","id":2}}},"APWorkerEvent":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"ec":{"type":"int32","id":10},"sc":{"type":"int32","id":11},"serverIp":{"type":"string","id":12},"firstSuccess":{"type":"bool","id":13},"responseTime":{"type":"int32","id":14},"serviceName":{"type":"string","id":15},"responseDetail":{"type":"string","id":16}}},"WorkerEvent":{"fields":{"sid":{"type":"string","id":1},"cname":{"type":"string","id":2},"cid":{"type":"int64","id":3},"lts":{"type":"int64","id":4},"ip":{"type":"string","id":5},"uid":{"type":"int64","id":6},"success":{"type":"bool","id":7},"elapse":{"type":"int64","id":8},"peer":{"type":"int64","id":9},"command":{"type":"string","id":10},"actionType":{"type":"string","id":11},"url":{"type":"string","id":12},"payload":{"type":"string","id":13},"serverCode":{"type":"int32","id":14},"code":{"type":"int32","id":15},"traceId":{"type":"string","id":16},"workerType":{"type":"int32","id":17},"responseTime":{"type":"int32","id":18},"requestId":{"type":"int64","id":19},"packIndex":{"type":"int32","id":20},"requestByUser":{"type":"bool","id":21},"tid":{"type":"string","id":22}}}}}}}')
  17954. },
  17955. function(e, t, n) {
  17956. var r = function(e) {
  17957. "use strict";
  17958. var t = Object.prototype,
  17959. n = t.hasOwnProperty,
  17960. r = "function" == typeof Symbol ? Symbol: {},
  17961. i = r.iterator || "@@iterator",
  17962. o = r.asyncIterator || "@@asyncIterator",
  17963. a = r.toStringTag || "@@toStringTag";
  17964. function s(e, t, n, r) {
  17965. var i = t && t.prototype instanceof u ? t: u,
  17966. o = Object.create(i.prototype),
  17967. a = new R(r || []);
  17968. return o._invoke = function(e, t, n) {
  17969. var r = "suspendedStart";
  17970. return function(i, o) {
  17971. if ("executing" === r) throw new Error("Generator is already running");
  17972. if ("completed" === r) {
  17973. if ("throw" === i) throw o;
  17974. return I()
  17975. }
  17976. for (n.method = i, n.arg = o;;) {
  17977. var a = n.delegate;
  17978. if (a) {
  17979. var s = _(a, n);
  17980. if (s) {
  17981. if (s === d) continue;
  17982. return s
  17983. }
  17984. }
  17985. if ("next" === n.method) n.sent = n._sent = n.arg;
  17986. else if ("throw" === n.method) {
  17987. if ("suspendedStart" === r) throw r = "completed",
  17988. n.arg;
  17989. n.dispatchException(n.arg)
  17990. } else "return" === n.method && n.abrupt("return", n.arg);
  17991. r = "executing";
  17992. var u = c(e, t, n);
  17993. if ("normal" === u.type) {
  17994. if (r = n.done ? "completed": "suspendedYield", u.arg === d) continue;
  17995. return {
  17996. value: u.arg,
  17997. done: n.done
  17998. }
  17999. }
  18000. "throw" === u.type && (r = "completed", n.method = "throw", n.arg = u.arg)
  18001. }
  18002. }
  18003. } (e, n, a),
  18004. o
  18005. }
  18006. function c(e, t, n) {
  18007. try {
  18008. return {
  18009. type: "normal",
  18010. arg: e.call(t, n)
  18011. }
  18012. } catch(e) {
  18013. return {
  18014. type: "throw",
  18015. arg: e
  18016. }
  18017. }
  18018. }
  18019. e.wrap = s;
  18020. var d = {};
  18021. function u() {}
  18022. function l() {}
  18023. function p() {}
  18024. var f = {};
  18025. f[i] = function() {
  18026. return this
  18027. };
  18028. var g = Object.getPrototypeOf,
  18029. m = g && g(g(T([])));
  18030. m && m !== t && n.call(m, i) && (f = m);
  18031. var h = p.prototype = u.prototype = Object.create(f);
  18032. function v(e) { ["next", "throw", "return"].forEach((function(t) {
  18033. e[t] = function(e) {
  18034. return this._invoke(t, e)
  18035. }
  18036. }))
  18037. }
  18038. function E(e, t) {
  18039. var r;
  18040. this._invoke = function(i, o) {
  18041. function a() {
  18042. return new t((function(r, a) { !
  18043. function r(i, o, a, s) {
  18044. var d = c(e[i], e, o);
  18045. if ("throw" !== d.type) {
  18046. var u = d.arg,
  18047. l = u.value;
  18048. return l && "object" == typeof l && n.call(l, "__await") ? t.resolve(l.__await).then((function(e) {
  18049. r("next", e, a, s)
  18050. }), (function(e) {
  18051. r("throw", e, a, s)
  18052. })) : t.resolve(l).then((function(e) {
  18053. u.value = e,
  18054. a(u)
  18055. }), (function(e) {
  18056. return r("throw", e, a, s)
  18057. }))
  18058. }
  18059. s(d.arg)
  18060. } (i, o, r, a)
  18061. }))
  18062. }
  18063. return r = r ? r.then(a, a) : a()
  18064. }
  18065. }
  18066. function _(e, t) {
  18067. var n = e.iterator[t.method];
  18068. if (void 0 === n) {
  18069. if (t.delegate = null, "throw" === t.method) {
  18070. if (e.iterator.
  18071. return && (t.method = "return", t.arg = void 0, _(e, t), "throw" === t.method)) return d;
  18072. t.method = "throw",
  18073. t.arg = new TypeError("The iterator does not provide a 'throw' method")
  18074. }
  18075. return d
  18076. }
  18077. var r = c(n, e.iterator, t.arg);
  18078. if ("throw" === r.type) return t.method = "throw",
  18079. t.arg = r.arg,
  18080. t.delegate = null,
  18081. d;
  18082. var i = r.arg;
  18083. return i ? i.done ? (t[e.resultName] = i.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, d) : i: (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, d)
  18084. }
  18085. function S(e) {
  18086. var t = {
  18087. tryLoc: e[0]
  18088. };
  18089. 1 in e && (t.catchLoc = e[1]),
  18090. 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]),
  18091. this.tryEntries.push(t)
  18092. }
  18093. function y(e) {
  18094. var t = e.completion || {};
  18095. t.type = "normal",
  18096. delete t.arg,
  18097. e.completion = t
  18098. }
  18099. function R(e) {
  18100. this.tryEntries = [{
  18101. tryLoc: "root"
  18102. }],
  18103. e.forEach(S, this),
  18104. this.reset(!0)
  18105. }
  18106. function T(e) {
  18107. if (e) {
  18108. var t = e[i];
  18109. if (t) return t.call(e);
  18110. if ("function" == typeof e.next) return e;
  18111. if (!isNaN(e.length)) {
  18112. var r = -1,
  18113. o = function t() {
  18114. for (; ++r < e.length;) if (n.call(e, r)) return t.value = e[r],
  18115. t.done = !1,
  18116. t;
  18117. return t.value = void 0,
  18118. t.done = !0,
  18119. t
  18120. };
  18121. return o.next = o
  18122. }
  18123. }
  18124. return {
  18125. next: I
  18126. }
  18127. }
  18128. function I() {
  18129. return {
  18130. value: void 0,
  18131. done: !0
  18132. }
  18133. }
  18134. return l.prototype = h.constructor = p,
  18135. p.constructor = l,
  18136. p[a] = l.displayName = "GeneratorFunction",
  18137. e.isGeneratorFunction = function(e) {
  18138. var t = "function" == typeof e && e.constructor;
  18139. return !! t && (t === l || "GeneratorFunction" === (t.displayName || t.name))
  18140. },
  18141. e.mark = function(e) {
  18142. return Object.setPrototypeOf ? Object.setPrototypeOf(e, p) : (e.__proto__ = p, a in e || (e[a] = "GeneratorFunction")),
  18143. e.prototype = Object.create(h),
  18144. e
  18145. },
  18146. e.awrap = function(e) {
  18147. return {
  18148. __await: e
  18149. }
  18150. },
  18151. v(E.prototype),
  18152. E.prototype[o] = function() {
  18153. return this
  18154. },
  18155. e.AsyncIterator = E,
  18156. e.async = function(t, n, r, i, o) {
  18157. void 0 === o && (o = Promise);
  18158. var a = new E(s(t, n, r, i), o);
  18159. return e.isGeneratorFunction(n) ? a: a.next().then((function(e) {
  18160. return e.done ? e.value: a.next()
  18161. }))
  18162. },
  18163. v(h),
  18164. h[a] = "Generator",
  18165. h[i] = function() {
  18166. return this
  18167. },
  18168. h.toString = function() {
  18169. return "[object Generator]"
  18170. },
  18171. e.keys = function(e) {
  18172. var t = [];
  18173. for (var n in e) t.push(n);
  18174. return t.reverse(),
  18175. function n() {
  18176. for (; t.length;) {
  18177. var r = t.pop();
  18178. if (r in e) return n.value = r,
  18179. n.done = !1,
  18180. n
  18181. }
  18182. return n.done = !0,
  18183. n
  18184. }
  18185. },
  18186. e.values = T,
  18187. R.prototype = {
  18188. constructor: R,
  18189. reset: function(e) {
  18190. if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(y), !e) for (var t in this)"t" === t.charAt(0) && n.call(this, t) && !isNaN( + t.slice(1)) && (this[t] = void 0)
  18191. },
  18192. stop: function() {
  18193. this.done = !0;
  18194. var e = this.tryEntries[0].completion;
  18195. if ("throw" === e.type) throw e.arg;
  18196. return this.rval
  18197. },
  18198. dispatchException: function(e) {
  18199. if (this.done) throw e;
  18200. var t = this;
  18201. function r(n, r) {
  18202. return a.type = "throw",
  18203. a.arg = e,
  18204. t.next = n,
  18205. r && (t.method = "next", t.arg = void 0),
  18206. !!r
  18207. }
  18208. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  18209. var o = this.tryEntries[i],
  18210. a = o.completion;
  18211. if ("root" === o.tryLoc) return r("end");
  18212. if (o.tryLoc <= this.prev) {
  18213. var s = n.call(o, "catchLoc"),
  18214. c = n.call(o, "finallyLoc");
  18215. if (s && c) {
  18216. if (this.prev < o.catchLoc) return r(o.catchLoc, !0);
  18217. if (this.prev < o.finallyLoc) return r(o.finallyLoc)
  18218. } else if (s) {
  18219. if (this.prev < o.catchLoc) return r(o.catchLoc, !0)
  18220. } else {
  18221. if (!c) throw new Error("try statement without catch or finally");
  18222. if (this.prev < o.finallyLoc) return r(o.finallyLoc)
  18223. }
  18224. }
  18225. }
  18226. },
  18227. abrupt: function(e, t) {
  18228. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  18229. var i = this.tryEntries[r];
  18230. if (i.tryLoc <= this.prev && n.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
  18231. var o = i;
  18232. break
  18233. }
  18234. }
  18235. o && ("break" === e || "continue" === e) && o.tryLoc <= t && t <= o.finallyLoc && (o = null);
  18236. var a = o ? o.completion: {};
  18237. return a.type = e,
  18238. a.arg = t,
  18239. o ? (this.method = "next", this.next = o.finallyLoc, d) : this.complete(a)
  18240. },
  18241. complete: function(e, t) {
  18242. if ("throw" === e.type) throw e.arg;
  18243. return "break" === e.type || "continue" === e.type ? this.next = e.arg: "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t),
  18244. d
  18245. },
  18246. finish: function(e) {
  18247. for (var t = this.tryEntries.length - 1; t >= 0; --t) {
  18248. var n = this.tryEntries[t];
  18249. if (n.finallyLoc === e) return this.complete(n.completion, n.afterLoc),
  18250. y(n),
  18251. d
  18252. }
  18253. },
  18254. catch: function(e) {
  18255. for (var t = this.tryEntries.length - 1; t >= 0; --t) {
  18256. var n = this.tryEntries[t];
  18257. if (n.tryLoc === e) {
  18258. var r = n.completion;
  18259. if ("throw" === r.type) {
  18260. var i = r.arg;
  18261. y(n)
  18262. }
  18263. return i
  18264. }
  18265. }
  18266. throw new Error("illegal catch attempt")
  18267. },
  18268. delegateYield: function(e, t, n) {
  18269. return this.delegate = {
  18270. iterator: T(e),
  18271. resultName: t,
  18272. nextLoc: n
  18273. },
  18274. "next" === this.method && (this.arg = void 0),
  18275. d
  18276. }
  18277. },
  18278. e
  18279. } (e.exports);
  18280. try {
  18281. regeneratorRuntime = r
  18282. } catch(e) {
  18283. Function("r", "regeneratorRuntime = r")(r)
  18284. }
  18285. },
  18286. function(e, t) {
  18287. e.exports = function(e) {
  18288. if (Array.isArray(e)) return e
  18289. }
  18290. },
  18291. function(e, t) {
  18292. e.exports = function(e, t) {
  18293. if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) {
  18294. var n = [],
  18295. r = !0,
  18296. i = !1,
  18297. o = void 0;
  18298. try {
  18299. for (var a, s = e[Symbol.iterator](); ! (r = (a = s.next()).done) && (n.push(a.value), !t || n.length !== t); r = !0);
  18300. } catch(e) {
  18301. i = !0,
  18302. o = e
  18303. } finally {
  18304. try {
  18305. r || null == s.
  18306. return || s.
  18307. return ()
  18308. } finally {
  18309. if (i) throw o
  18310. }
  18311. }
  18312. return n
  18313. }
  18314. }
  18315. },
  18316. function(e, t) {
  18317. e.exports = function() {
  18318. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  18319. }
  18320. },
  18321. function(e, t, n) {
  18322. "use strict";
  18323. Object.defineProperty(t, "__esModule", {
  18324. value: !0
  18325. });
  18326. var r = "object" == typeof window && window.RTCPeerConnection,
  18327. i = "object" == typeof window && window.webkitRTCPeerConnection,
  18328. o = "object" == typeof window && window.mozRTCPeerConnection;
  18329. t.createRTCPeerConnection = function(e) {
  18330. var t = r || i || o;
  18331. return t ? new t(e) : null
  18332. }
  18333. },
  18334. function(e, t, n) {
  18335. var r;
  18336. /*!
  18337. * EventEmitter v5.2.9 - git.io/ee
  18338. * Unlicense - http://unlicense.org/
  18339. * Oliver Caldwell - https://oli.me.uk/
  18340. * @preserve
  18341. */
  18342. !
  18343. function(t) {
  18344. "use strict";
  18345. function i() {}
  18346. var o = i.prototype,
  18347. a = t.EventEmitter;
  18348. function s(e, t) {
  18349. for (var n = e.length; n--;) if (e[n].listener === t) return n;
  18350. return - 1
  18351. }
  18352. function c(e) {
  18353. return function() {
  18354. return this[e].apply(this, arguments)
  18355. }
  18356. }
  18357. o.getListeners = function(e) {
  18358. var t, n, r = this._getEvents();
  18359. if (e instanceof RegExp) for (n in t = {},
  18360. r) r.hasOwnProperty(n) && e.test(n) && (t[n] = r[n]);
  18361. else t = r[e] || (r[e] = []);
  18362. return t
  18363. },
  18364. o.flattenListeners = function(e) {
  18365. var t, n = [];
  18366. for (t = 0; t < e.length; t += 1) n.push(e[t].listener);
  18367. return n
  18368. },
  18369. o.getListenersAsObject = function(e) {
  18370. var t, n = this.getListeners(e);
  18371. return n instanceof Array && ((t = {})[e] = n),
  18372. t || n
  18373. },
  18374. o.addListener = function(e, t) {
  18375. if (!
  18376. function e(t) {
  18377. return "function" == typeof t || t instanceof RegExp || !(!t || "object" != typeof t) && e(t.listener)
  18378. } (t)) throw new TypeError("listener must be a function");
  18379. var n, r = this.getListenersAsObject(e),
  18380. i = "object" == typeof t;
  18381. for (n in r) r.hasOwnProperty(n) && -1 === s(r[n], t) && r[n].push(i ? t: {
  18382. listener: t,
  18383. once: !1
  18384. });
  18385. return this
  18386. },
  18387. o.on = c("addListener"),
  18388. o.addOnceListener = function(e, t) {
  18389. return this.addListener(e, {
  18390. listener: t,
  18391. once: !0
  18392. })
  18393. },
  18394. o.once = c("addOnceListener"),
  18395. o.defineEvent = function(e) {
  18396. return this.getListeners(e),
  18397. this
  18398. },
  18399. o.defineEvents = function(e) {
  18400. for (var t = 0; t < e.length; t += 1) this.defineEvent(e[t]);
  18401. return this
  18402. },
  18403. o.removeListener = function(e, t) {
  18404. var n, r, i = this.getListenersAsObject(e);
  18405. for (r in i) i.hasOwnProperty(r) && -1 !== (n = s(i[r], t)) && i[r].splice(n, 1);
  18406. return this
  18407. },
  18408. o.off = c("removeListener"),
  18409. o.addListeners = function(e, t) {
  18410. return this.manipulateListeners(!1, e, t)
  18411. },
  18412. o.removeListeners = function(e, t) {
  18413. return this.manipulateListeners(!0, e, t)
  18414. },
  18415. o.manipulateListeners = function(e, t, n) {
  18416. var r, i, o = e ? this.removeListener: this.addListener,
  18417. a = e ? this.removeListeners: this.addListeners;
  18418. if ("object" != typeof t || t instanceof RegExp) for (r = n.length; r--;) o.call(this, t, n[r]);
  18419. else for (r in t) t.hasOwnProperty(r) && (i = t[r]) && ("function" == typeof i ? o.call(this, r, i) : a.call(this, r, i));
  18420. return this
  18421. },
  18422. o.removeEvent = function(e) {
  18423. var t, n = typeof e,
  18424. r = this._getEvents();
  18425. if ("string" === n) delete r[e];
  18426. else if (e instanceof RegExp) for (t in r) r.hasOwnProperty(t) && e.test(t) && delete r[t];
  18427. else delete this._events;
  18428. return this
  18429. },
  18430. o.removeAllListeners = c("removeEvent"),
  18431. o.emitEvent = function(e, t) {
  18432. var n, r, i, o, a = this.getListenersAsObject(e);
  18433. for (o in a) if (a.hasOwnProperty(o)) for (n = a[o].slice(0), i = 0; i < n.length; i++) ! 0 === (r = n[i]).once && this.removeListener(e, r.listener),
  18434. r.listener.apply(this, t || []) === this._getOnceReturnValue() && this.removeListener(e, r.listener);
  18435. return this
  18436. },
  18437. o.trigger = c("emitEvent"),
  18438. o.emit = function(e) {
  18439. var t = Array.prototype.slice.call(arguments, 1);
  18440. return this.emitEvent(e, t)
  18441. },
  18442. o.setOnceReturnValue = function(e) {
  18443. return this._onceReturnValue = e,
  18444. this
  18445. },
  18446. o._getOnceReturnValue = function() {
  18447. return ! this.hasOwnProperty("_onceReturnValue") || this._onceReturnValue
  18448. },
  18449. o._getEvents = function() {
  18450. return this._events || (this._events = {})
  18451. },
  18452. i.noConflict = function() {
  18453. return t.EventEmitter = a,
  18454. i
  18455. },
  18456. void 0 === (r = function() {
  18457. return i
  18458. }.call(t, n, t, e)) || (e.exports = r)
  18459. } ("undefined" != typeof window ? window: this || {})
  18460. },
  18461. function(e, t, n) {
  18462. var r = n(32);
  18463. e.exports = function(e) {
  18464. if (Array.isArray(e)) return r(e)
  18465. }
  18466. },
  18467. function(e, t) {
  18468. e.exports = function(e) {
  18469. if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e)
  18470. }
  18471. },
  18472. function(e, t) {
  18473. e.exports = function() {
  18474. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  18475. }
  18476. },
  18477. function(e, t, n) {
  18478. "use strict";
  18479. var r = this && this.__assign ||
  18480. function() {
  18481. return (r = Object.assign ||
  18482. function(e) {
  18483. for (var t, n = 1,
  18484. r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
  18485. return e
  18486. }).apply(this, arguments)
  18487. },
  18488. i = this && this.__awaiter ||
  18489. function(e, t, n, r) {
  18490. return new(n || (n = Promise))((function(i, o) {
  18491. function a(e) {
  18492. try {
  18493. c(r.next(e))
  18494. } catch(e) {
  18495. o(e)
  18496. }
  18497. }
  18498. function s(e) {
  18499. try {
  18500. c(r.
  18501. throw (e))
  18502. } catch(e) {
  18503. o(e)
  18504. }
  18505. }
  18506. function c(e) {
  18507. var t;
  18508. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  18509. e(t)
  18510. }))).then(a, s)
  18511. }
  18512. c((r = r.apply(e, t || [])).next())
  18513. }))
  18514. },
  18515. o = this && this.__generator ||
  18516. function(e, t) {
  18517. var n, r, i, o, a = {
  18518. label: 0,
  18519. sent: function() {
  18520. if (1 & i[0]) throw i[1];
  18521. return i[1]
  18522. },
  18523. trys: [],
  18524. ops: []
  18525. };
  18526. return o = {
  18527. next: s(0),
  18528. throw: s(1),
  18529. return: s(2)
  18530. },
  18531. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  18532. return this
  18533. }),
  18534. o;
  18535. function s(o) {
  18536. return function(s) {
  18537. return function(o) {
  18538. if (n) throw new TypeError("Generator is already executing.");
  18539. for (; a;) try {
  18540. if (n = 1, r && (i = 2 & o[0] ? r.
  18541. return: o[0] ? r.
  18542. throw || ((i = r.
  18543. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  18544. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  18545. case 0:
  18546. case 1:
  18547. i = o;
  18548. break;
  18549. case 4:
  18550. return a.label++,
  18551. {
  18552. value: o[1],
  18553. done: !1
  18554. };
  18555. case 5:
  18556. a.label++,
  18557. r = o[1],
  18558. o = [0];
  18559. continue;
  18560. case 7:
  18561. o = a.ops.pop(),
  18562. a.trys.pop();
  18563. continue;
  18564. default:
  18565. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  18566. a = 0;
  18567. continue
  18568. }
  18569. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  18570. a.label = o[1];
  18571. break
  18572. }
  18573. if (6 === o[0] && a.label < i[1]) {
  18574. a.label = i[1],
  18575. i = o;
  18576. break
  18577. }
  18578. if (i && a.label < i[2]) {
  18579. a.label = i[2],
  18580. a.ops.push(o);
  18581. break
  18582. }
  18583. i[2] && a.ops.pop(),
  18584. a.trys.pop();
  18585. continue
  18586. }
  18587. o = t.call(e, a)
  18588. } catch(e) {
  18589. o = [6, e],
  18590. r = 0
  18591. } finally {
  18592. n = i = 0
  18593. }
  18594. if (5 & o[0]) throw o[1];
  18595. return {
  18596. value: o[0] ? o[1] : void 0,
  18597. done: !0
  18598. }
  18599. } ([o, s])
  18600. }
  18601. }
  18602. },
  18603. a = this && this.__importDefault ||
  18604. function(e) {
  18605. return e && e.__esModule ? e: {
  18606. default:
  18607. e
  18608. }
  18609. };
  18610. Object.defineProperty(t, "__esModule", {
  18611. value: !0
  18612. });
  18613. var s = n(72),
  18614. c = n(26),
  18615. d = n(91),
  18616. u = n(20),
  18617. l = n(23),
  18618. p = n(34),
  18619. f = a(n(0)),
  18620. g = a(n(35)),
  18621. m = function() {
  18622. function e(e) {
  18623. this.retryTimeout = 1e4,
  18624. this.streamingTasks = new Map,
  18625. this.isStartingStreamingTask = !1,
  18626. this.taskMutex = new d.PromiseMutex,
  18627. this.cancelToken = g.
  18628. default.CancelToken.source(),
  18629. this.injectConfig = r({},
  18630. c.DEFAULT_INJECT_CONFIG),
  18631. this.injectLoopTimes = 0,
  18632. this.lastTaskId = 1,
  18633. this.statusError = new Map,
  18634. this.spec = e
  18635. }
  18636. return Object.defineProperty(e.prototype, "isNeedReset", {
  18637. get: function() {
  18638. for (var e = this,
  18639. t = 0,
  18640. n = Array.from(this.streamingTasks.values()); t < n.length; t++) {
  18641. var r = n[t];
  18642. if (r.mode === c.LiveStreamingServiceMode.INJECT) return ! 0;
  18643. if (r.mode === c.LiveStreamingServiceMode.TRANSCODE) if ((this.transcodingConfig && (this.transcodingConfig.userConfigs || this.transcodingConfig.transcodingUsers) || []).find((function(t) {
  18644. return t.uid === e.spec.uid
  18645. }))) return ! 0
  18646. }
  18647. return ! 1
  18648. },
  18649. enumerable: !0,
  18650. configurable: !0
  18651. }),
  18652. e.prototype.setTranscodingConfig = function(e) {
  18653. return i(this, void 0, void 0, (function() {
  18654. var t, n, i, a, s, d = this;
  18655. return o(this, (function(o) {
  18656. switch (o.label) {
  18657. case 0:
  18658. (t = r(r({},
  18659. c.DEFAULT_TRANSCODING_CONFIG), e)).transcodingUsers || (t.transcodingUsers = t.userConfigs),
  18660. 66 !== t.videoCodecProfile && 77 !== t.videoCodecProfile && 100 !== t.videoCodecProfile && (f.
  18661. default.debug("[" + this.spec.clientId + "] set transcoding config, fix video codec profile: " + t.videoCodecProfile + " -> 100"), t.videoCodecProfile = 100),
  18662. t.transcodingUsers && (t.transcodingUsers = t.transcodingUsers.map((function(e) {
  18663. return r(r(r({},
  18664. c.DEFAULT_LIVE_STREAMING_TRANSCODING_USER), e), {
  18665. zOrder: e.zOrder ? e.zOrder + 1 : 1
  18666. })
  18667. }))),
  18668. t.images && (t.images = t.images.map((function(e) {
  18669. return r(r({},
  18670. c.DEFAULT_LIVE_STREAMING_TRANSCODING_WATERMARK), e)
  18671. })));
  18672. try {
  18673. c.isLiveStreamingTranscodingConfig(t)
  18674. } catch(e) {
  18675. throw e
  18676. }
  18677. return t.transcodingUsers && (t.userConfigs = t.transcodingUsers.map((function(e) {
  18678. return r({},
  18679. e)
  18680. })), t.userCount = t.transcodingUsers.length, delete t.transcodingUsers),
  18681. n = (t.userConfigs || []).map((function(e) {
  18682. return "number" == typeof e.uid ? Promise.resolve(e.uid) : u.getUserAccount(d.spec, null, e.uid)
  18683. })),
  18684. [4, this.taskMutex.lock()];
  18685. case 1:
  18686. return i = o.sent(),
  18687. [4, Promise.all(n)];
  18688. case 2:
  18689. if (o.sent().forEach((function(e, n) {
  18690. t.userConfigs && t.userConfigs[n] && (t.userConfigs[n].uid = e && e.uid || e)
  18691. })), this.transcodingConfig = t, !this.connection) return i(),
  18692. [2];
  18693. o.label = 3;
  18694. case 3:
  18695. return o.trys.push([3, 5, , 6]),
  18696. [4, this.connection.request("request", {
  18697. clientRequest: {
  18698. command: "UpdateTranscoding",
  18699. transcodingConfig: this.transcodingConfig
  18700. }
  18701. },
  18702. !1, {
  18703. command: "UpdateTranscoding",
  18704. workerType: 1,
  18705. requestByUser: !0,
  18706. tid: Array.from(this.streamingTasks.values()).map((function(e) {
  18707. return e.taskId
  18708. })).join("#")
  18709. })];
  18710. case 4:
  18711. return a = o.sent(),
  18712. i(),
  18713. f.
  18714. default.debug("[" + this.spec.clientId + "] update live transcoding config success, code: " + a.code + ", config:", JSON.stringify(this.transcodingConfig)),
  18715. [3, 6];
  18716. case 5:
  18717. if (s = o.sent(), i(), !s.data || !s.data.retry) throw s;
  18718. return s.data.changeAddress && this.connection.tryNextAddress(),
  18719. this.streamingTasks.forEach((function(e) {
  18720. f.
  18721. default.warning("[" + d.spec.clientId + "] live streaming receive error", s.toString(), "try to republish", e.url),
  18722. d.startLiveStreamingTask(e.url, e.mode, s).then((function() {
  18723. f.
  18724. default.debug("[" + d.spec.clientId + "] live streaming republish " + e.url + " success")
  18725. })).
  18726. catch((function(t) {
  18727. f.
  18728. default.error("[" + d.spec.clientId + "] live streaming republish failed", e.url, t.toString()),
  18729. d.onLiveStreamError && d.onLiveStreamError(e.url, t)
  18730. }))
  18731. })),
  18732. [3, 6];
  18733. case 6:
  18734. return [2]
  18735. }
  18736. }))
  18737. }))
  18738. },
  18739. e.prototype.setInjectStreamConfig = function(e, t) {
  18740. this.injectConfig = Object.assign({},
  18741. this.injectConfig, e),
  18742. this.injectLoopTimes = t
  18743. },
  18744. e.prototype.startLiveStreamingTask = function(e, t, n) {
  18745. return i(this, void 0, void 0, (function() {
  18746. var i, a, s, d, u, g, m, h, v = this;
  18747. return o(this, (function(o) {
  18748. switch (o.label) {
  18749. case 0:
  18750. if (Array.from(this.streamingTasks.values()).find((function(e) {
  18751. return e.mode === c.LiveStreamingServiceMode.INJECT
  18752. })) && t === c.LiveStreamingServiceMode.INJECT) return [2, new l.AgoraRTCError(l.AgoraRTCErrorCode.LIVE_STREAMING_TASK_CONFLICT, "inject stream over limit").
  18753. throw ()];
  18754. if (!this.transcodingConfig && t === c.LiveStreamingServiceMode.TRANSCODE) throw new l.AgoraRTCError(l.AgoraRTCErrorCode.INVALID_OPERATION, "[LiveStreaming] no transcoding config found, can not start transcoding streaming task");
  18755. return i = {
  18756. command: "PublishStream",
  18757. ts: Date.now(),
  18758. url: e,
  18759. uid: this.spec.uid.toString(),
  18760. autoDestroyTime: 30
  18761. },
  18762. f.
  18763. default.debug("[" + this.spec.clientId + "] start live streaming " + e + ", mode: " + t),
  18764. [4, this.taskMutex.lock()];
  18765. case 1:
  18766. if (a = o.sent(), !this.connection && n) return a(),
  18767. [2];
  18768. if (this.streamingTasks.get(e) && !n) return [2, new l.AgoraRTCError(l.AgoraRTCErrorCode.LIVE_STREAMING_TASK_CONFLICT).
  18769. throw ()];
  18770. if (!this.transcodingConfig && t === c.LiveStreamingServiceMode.TRANSCODE) throw new l.AgoraRTCError(l.AgoraRTCErrorCode.INVALID_OPERATION, "[LiveStreaming] no transcoding config found, can not start transcoding streaming task");
  18771. o.label = 2;
  18772. case 2:
  18773. return o.trys.push([2, 5, , 6]),
  18774. this.connection ? [3, 4] : (s = this, [4, this.connect(t)]);
  18775. case 3:
  18776. s.connection = o.sent(),
  18777. o.label = 4;
  18778. case 4:
  18779. return [3, 6];
  18780. case 5:
  18781. throw d = o.sent(),
  18782. a(),
  18783. d;
  18784. case 6:
  18785. switch (t) {
  18786. case c.LiveStreamingServiceMode.TRANSCODE:
  18787. i.transcodingConfig = r({},
  18788. this.transcodingConfig);
  18789. break;
  18790. case c.LiveStreamingServiceMode.RAW:
  18791. break;
  18792. case c.LiveStreamingServiceMode.INJECT:
  18793. i = {
  18794. cname: this.spec.cname,
  18795. command: "InjectStream",
  18796. sid: this.spec.sid,
  18797. transcodingConfig: this.injectConfig,
  18798. ts: Date.now(),
  18799. url: e,
  18800. loopTimes: this.injectLoopTimes
  18801. }
  18802. }
  18803. this.uapResponse && this.uapResponse.vid && (i.vid = this.uapResponse.vid),
  18804. this.isStartingStreamingTask = !0,
  18805. u = this.lastTaskId++,
  18806. o.label = 7;
  18807. case 7:
  18808. return o.trys.push([7, 9, , 14]),
  18809. g = new Promise((function(t, r) {
  18810. p.wait(v.retryTimeout).then((function() {
  18811. if (n) return r(n);
  18812. var t = v.statusError.get(e);
  18813. return t ? (v.statusError.delete(e), r(t)) : void 0
  18814. }))
  18815. })),
  18816. [4, Promise.race([this.connection.request("request", {
  18817. clientRequest: i
  18818. },
  18819. !0, {
  18820. url: e,
  18821. command: "PublishStream",
  18822. workerType: t === c.LiveStreamingServiceMode.TRANSCODE ? 1 : 2,
  18823. requestByUser: !n,
  18824. tid: u.toString()
  18825. }), g])];
  18826. case 8:
  18827. return m = o.sent(),
  18828. this.isStartingStreamingTask = !1,
  18829. f.
  18830. default.debug("[" + this.spec.clientId + "] live streaming started, code: " + m.code),
  18831. this.streamingTasks.set(e, {
  18832. clientRequest: i,
  18833. mode: t,
  18834. url: e,
  18835. taskId: u
  18836. }),
  18837. a(),
  18838. [3, 14];
  18839. case 9:
  18840. if (h = o.sent(), a(), this.isStartingStreamingTask = !1, !h.data || !h.data.retry || n) throw h;
  18841. return h.data.changeAddress ? [3, 11] : [4, this.startLiveStreamingTask(e, t, h)];
  18842. case 10:
  18843. return [2, o.sent()];
  18844. case 11:
  18845. return this.connection.tryNextAddress(),
  18846. [4, this.startLiveStreamingTask(e, t, h)];
  18847. case 12:
  18848. return [2, o.sent()];
  18849. case 13:
  18850. return [3, 14];
  18851. case 14:
  18852. return [2]
  18853. }
  18854. }))
  18855. }))
  18856. },
  18857. e.prototype.stopLiveStreamingTask = function(e) {
  18858. var t = this;
  18859. return new Promise((function(n, r) {
  18860. var i = t.streamingTasks.get(e);
  18861. if (!i || !t.connection) return new l.AgoraRTCError(l.AgoraRTCErrorCode.UNEXPECTED_ERROR, "can not find streaming task to stop").
  18862. throw ();
  18863. var o = i.mode;
  18864. i.abortTask = function() {
  18865. f.
  18866. default.debug("[" + t.spec.clientId + "] stop live streaming success(worker exception)"),
  18867. t.streamingTasks.delete(e),
  18868. n()
  18869. },
  18870. t.connection.request("request", {
  18871. clientRequest: {
  18872. command: o === c.LiveStreamingServiceMode.INJECT ? "UninjectStream": "UnpublishStream",
  18873. url: i.url
  18874. }
  18875. },
  18876. !1, {
  18877. url: e,
  18878. command: "UnPublishStream",
  18879. workerType: o === c.LiveStreamingServiceMode.TRANSCODE ? 1 : 2,
  18880. requestByUser: !0,
  18881. tid: (t.lastTaskId++).toString()
  18882. }).then((function(r) {
  18883. f.
  18884. default.debug("[" + t.spec.clientId + "] stop live streaming success, code: " + r.code),
  18885. t.streamingTasks.delete(e),
  18886. n()
  18887. })).
  18888. catch(r)
  18889. }))
  18890. },
  18891. e.prototype.controlInjectStream = function(e, t, n, r) {
  18892. return i(this, void 0, void 0, (function() {
  18893. var i;
  18894. return o(this, (function(o) {
  18895. switch (o.label) {
  18896. case 0:
  18897. if (! (i = this.streamingTasks.get(e)) || !this.connection || i.mode !== c.LiveStreamingServiceMode.INJECT) throw new l.AgoraRTCError(l.AgoraRTCErrorCode.INVALID_OPERATION, "can not find inject stream task to control");
  18898. return [4, this.connection.request("request", {
  18899. clientRequest: {
  18900. command: "ControlStream",
  18901. url: e,
  18902. control: t,
  18903. audioVolume: n,
  18904. position: r
  18905. }
  18906. })];
  18907. case 1:
  18908. return [2, o.sent().serverResponse]
  18909. }
  18910. }))
  18911. }))
  18912. },
  18913. e.prototype.resetAllTask = function() {
  18914. var e = this,
  18915. t = Array.from(this.streamingTasks.values());
  18916. this.terminate();
  18917. for (var n = function(t) {
  18918. r.startLiveStreamingTask(t.url, t.mode).
  18919. catch((function(n) {
  18920. e.onLiveStreamError && e.onLiveStreamError(t.url, n)
  18921. }))
  18922. },
  18923. r = this, i = 0, o = t; i < o.length; i++) {
  18924. n(o[i])
  18925. }
  18926. },
  18927. e.prototype.terminate = function() {
  18928. this.cancelToken && this.cancelToken.cancel(),
  18929. this.streamingTasks = new Map,
  18930. this.isStartingStreamingTask = !1,
  18931. this.statusError = new Map,
  18932. this.cancelToken = g.
  18933. default.CancelToken.source(),
  18934. this.uapResponse = void 0,
  18935. this.connection && this.connection.close(),
  18936. this.connection = void 0
  18937. },
  18938. e.prototype.connect = function(e) {
  18939. return i(this, void 0, void 0, (function() {
  18940. var t, n = this;
  18941. return o(this, (function(r) {
  18942. switch (r.label) {
  18943. case 0:
  18944. if (this.connection) throw new l.AgoraRTCError(l.AgoraRTCErrorCode.UNEXPECTED_ERROR, "live streaming connection has already connected");
  18945. return [4, p.getLiveStreamingWorkerMangerResult(e, this.spec, this.cancelToken.token)];
  18946. case 1:
  18947. return t = r.sent(),
  18948. this.uapResponse = t,
  18949. this.connection = new s.AgoraLiveStreamingUapSignal(t.workerToken, this.spec, e),
  18950. this.connection.on(c.LiveStreamingUapSignalEvents.WARNING, (function(e, t) {
  18951. return n.onLiveStreamWarning && n.onLiveStreamWarning(t, e)
  18952. })),
  18953. this.connection.on(c.LiveStreamingUapSignalEvents.PUBLISH_STREAM_STATUS, (function(e) {
  18954. return n.handlePublishStreamServer(e)
  18955. })),
  18956. this.connection.on(c.LiveStreamingUapSignalEvents.INJECT_STREAM_STATUS, (function(e) {
  18957. return n.handleInjectStreamServerStatus(e)
  18958. })),
  18959. this.connection.on(c.LiveStreamingUapSignalEvents.REQUEST_NEW_ADDRESS, (function(t, r) {
  18960. if (!n.connection) return r(new l.AgoraRTCError(l.AgoraRTCErrorCode.UNEXPECTED_ERROR, "can not get new live streaming address list"));
  18961. p.getLiveStreamingWorkerMangerResult(e, n.spec, n.cancelToken.token).then((function(e) {
  18962. n.uapResponse = e,
  18963. t(e.addressList)
  18964. })).
  18965. catch(r)
  18966. })),
  18967. [4, this.connection.init(t.addressList)];
  18968. case 2:
  18969. return r.sent(),
  18970. [2, this.connection]
  18971. }
  18972. }))
  18973. }))
  18974. },
  18975. e.prototype.handlePublishStreamServer = function(e) {
  18976. var t = this,
  18977. n = e.serverStatus.url,
  18978. r = this.streamingTasks.get(n);
  18979. switch (e.code) {
  18980. case c.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:
  18981. case c.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:
  18982. case c.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:
  18983. case c.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:
  18984. var i = new l.AgoraRTCError(l.AgoraRTCErrorCode.LIVE_STREAMING_CDN_ERROR, "", {
  18985. code: e.code
  18986. });
  18987. if (r) return f.
  18988. default.error(i.toString()),
  18989. this.onLiveStreamError && this.onLiveStreamError(n, i);
  18990. if (!this.isStartingStreamingTask) return;
  18991. this.statusError.set(n, i);
  18992. case c.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_WORKER_LOST:
  18993. case c.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_WORKER_QUIT:
  18994. if (!this.connection || 0 === this.streamingTasks.size) return;
  18995. this.connection.tryNextAddress();
  18996. for (var o = Array.from(this.streamingTasks.values()), a = function(n) {
  18997. if (n.abortTask) return n.abortTask(),
  18998. "continue";
  18999. f.
  19000. default.warning("[" + s.spec.clientId + "] publish stream status code", e.code, "try to republish", n.url),
  19001. s.startLiveStreamingTask(n.url, n.mode, new l.AgoraRTCError(l.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "", {
  19002. code: e.code
  19003. })).then((function() {
  19004. f.
  19005. default.debug("[" + t.spec.clientId + "] republish live stream success", n.url)
  19006. })).
  19007. catch((function(e) {
  19008. f.
  19009. default.error(e.toString()),
  19010. t.onLiveStreamError && t.onLiveStreamError(n.url, e)
  19011. }))
  19012. },
  19013. s = this, d = 0, u = o; d < u.length; d++) {
  19014. a(u[d])
  19015. }
  19016. return
  19017. }
  19018. },
  19019. e.prototype.handleInjectStreamServerStatus = function(e) {
  19020. var t = Number(e.uid),
  19021. n = e.serverStatus && e.serverStatus.url;
  19022. switch (e.code) {
  19023. case 200:
  19024. return void(this.onInjectStatusChange && this.onInjectStatusChange(0, t, n));
  19025. case 451:
  19026. return this.onInjectStatusChange && this.onInjectStatusChange(1, t, n),
  19027. void this.streamingTasks.delete(n);
  19028. case 453:
  19029. return this.onInjectStatusChange && this.onInjectStatusChange(2, t, n),
  19030. void this.streamingTasks.delete(n);
  19031. case 470:
  19032. return this.onInjectStatusChange && this.onInjectStatusChange(10, t, n),
  19033. void this.streamingTasks.delete(n);
  19034. case 499:
  19035. return this.onInjectStatusChange && this.onInjectStatusChange(3, t, n),
  19036. void this.streamingTasks.delete(n);
  19037. default:
  19038. return void f.
  19039. default.debug("inject stream server status", e)
  19040. }
  19041. },
  19042. e.prototype.haveUrl = function(e) {
  19043. return this.streamingTasks.has(e) || void 0
  19044. },
  19045. e
  19046. } ();
  19047. t.AgoraRTCLiveStreamingClient = m
  19048. },
  19049. function(e, t, n) {
  19050. "use strict";
  19051. var r, i = this && this.__extends || (r = function(e, t) {
  19052. return (r = Object.setPrototypeOf || {
  19053. __proto__: []
  19054. }
  19055. instanceof Array &&
  19056. function(e, t) {
  19057. e.__proto__ = t
  19058. } ||
  19059. function(e, t) {
  19060. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n])
  19061. })(e, t)
  19062. },
  19063. function(e, t) {
  19064. function n() {
  19065. this.constructor = e
  19066. }
  19067. r(e, t),
  19068. e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
  19069. }),
  19070. o = this && this.__assign ||
  19071. function() {
  19072. return (o = Object.assign ||
  19073. function(e) {
  19074. for (var t, n = 1,
  19075. r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
  19076. return e
  19077. }).apply(this, arguments)
  19078. },
  19079. a = this && this.__awaiter ||
  19080. function(e, t, n, r) {
  19081. return new(n || (n = Promise))((function(i, o) {
  19082. function a(e) {
  19083. try {
  19084. c(r.next(e))
  19085. } catch(e) {
  19086. o(e)
  19087. }
  19088. }
  19089. function s(e) {
  19090. try {
  19091. c(r.
  19092. throw (e))
  19093. } catch(e) {
  19094. o(e)
  19095. }
  19096. }
  19097. function c(e) {
  19098. var t;
  19099. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  19100. e(t)
  19101. }))).then(a, s)
  19102. }
  19103. c((r = r.apply(e, t || [])).next())
  19104. }))
  19105. },
  19106. s = this && this.__generator ||
  19107. function(e, t) {
  19108. var n, r, i, o, a = {
  19109. label: 0,
  19110. sent: function() {
  19111. if (1 & i[0]) throw i[1];
  19112. return i[1]
  19113. },
  19114. trys: [],
  19115. ops: []
  19116. };
  19117. return o = {
  19118. next: s(0),
  19119. throw: s(1),
  19120. return: s(2)
  19121. },
  19122. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  19123. return this
  19124. }),
  19125. o;
  19126. function s(o) {
  19127. return function(s) {
  19128. return function(o) {
  19129. if (n) throw new TypeError("Generator is already executing.");
  19130. for (; a;) try {
  19131. if (n = 1, r && (i = 2 & o[0] ? r.
  19132. return: o[0] ? r.
  19133. throw || ((i = r.
  19134. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  19135. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  19136. case 0:
  19137. case 1:
  19138. i = o;
  19139. break;
  19140. case 4:
  19141. return a.label++,
  19142. {
  19143. value: o[1],
  19144. done: !1
  19145. };
  19146. case 5:
  19147. a.label++,
  19148. r = o[1],
  19149. o = [0];
  19150. continue;
  19151. case 7:
  19152. o = a.ops.pop(),
  19153. a.trys.pop();
  19154. continue;
  19155. default:
  19156. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  19157. a = 0;
  19158. continue
  19159. }
  19160. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  19161. a.label = o[1];
  19162. break
  19163. }
  19164. if (6 === o[0] && a.label < i[1]) {
  19165. a.label = i[1],
  19166. i = o;
  19167. break
  19168. }
  19169. if (i && a.label < i[2]) {
  19170. a.label = i[2],
  19171. a.ops.push(o);
  19172. break
  19173. }
  19174. i[2] && a.ops.pop(),
  19175. a.trys.pop();
  19176. continue
  19177. }
  19178. o = t.call(e, a)
  19179. } catch(e) {
  19180. o = [6, e],
  19181. r = 0
  19182. } finally {
  19183. n = i = 0
  19184. }
  19185. if (5 & o[0]) throw o[1];
  19186. return {
  19187. value: o[0] ? o[1] : void 0,
  19188. done: !0
  19189. }
  19190. } ([o, s])
  19191. }
  19192. }
  19193. },
  19194. c = this && this.__importDefault ||
  19195. function(e) {
  19196. return e && e.__esModule ? e: {
  19197. default:
  19198. e
  19199. }
  19200. };
  19201. Object.defineProperty(t, "__esModule", {
  19202. value: !0
  19203. });
  19204. var d = n(26),
  19205. u = n(73),
  19206. l = n(33),
  19207. p = n(23),
  19208. f = n(3),
  19209. g = c(n(0)),
  19210. m = n(1),
  19211. h = function(e) {
  19212. function t(t, n, r) {
  19213. var i = e.call(this) || this;
  19214. return i.reconnectMode = "retry",
  19215. i.reqId = 0,
  19216. i.commandReqId = 0,
  19217. i.handleWebSocketOpen = function() {
  19218. i.reconnectMode = "retry",
  19219. i.startPingPong()
  19220. },
  19221. i.handleWebSocketMessage = function(e) {
  19222. if (e.data) {
  19223. var t = JSON.parse(e.data);
  19224. t.requestId ? i.emit("@" + t.requestId + "-" + t.sid, t) : i.serviceMode === d.LiveStreamingServiceMode.INJECT ? i.emit(d.LiveStreamingUapSignalEvents.INJECT_STREAM_STATUS, t) : (m.report.requestWorkerEvent(i.spec.sid, {
  19225. actionType: "status",
  19226. serverCode: t.code,
  19227. workerType: i.serviceMode === d.LiveStreamingServiceMode.TRANSCODE ? 1 : 2
  19228. }), i.emit(d.LiveStreamingUapSignalEvents.PUBLISH_STREAM_STATUS, t))
  19229. }
  19230. },
  19231. i.spec = n,
  19232. i.token = t,
  19233. i.serviceMode = r,
  19234. i.websocket = new u.AgoraWebSocketManager("live-streaming"),
  19235. i.websocket.on(d.WebSocketManagerEvents.CONNECTED, i.handleWebSocketOpen),
  19236. i.websocket.on(d.WebSocketManagerEvents.ON_MESSAGE, i.handleWebSocketMessage),
  19237. i.websocket.on(d.WebSocketManagerEvents.REQUEST_NEW_URLS, (function(e, t) {
  19238. l.emitAsPromise(i, d.LiveStreamingUapSignalEvents.REQUEST_NEW_ADDRESS).then(e).
  19239. catch(t)
  19240. })),
  19241. i.websocket.on(d.WebSocketManagerEvents.RECONNECTING, (function() {
  19242. i.websocket.reconnectMode = i.reconnectMode
  19243. })),
  19244. i
  19245. }
  19246. return i(t, e),
  19247. t.prototype.init = function(e) {
  19248. return this.websocket.init(e)
  19249. },
  19250. t.prototype.request = function(e, t, n, r) {
  19251. return a(this, void 0, void 0, (function() {
  19252. var i, a, c, u, l, g, h, v, E, _ = this;
  19253. return s(this, (function(s) {
  19254. switch (s.label) {
  19255. case 0:
  19256. if (this.reqId += 1, i = this.reqId, "request" === e && (this.commandReqId += 1), a = this.commandReqId, !i || !this.websocket) throw new p.AgoraRTCError(p.AgoraRTCErrorCode.UNEXPECTED_ERROR);
  19257. if (c = f.VERSION, u = o({
  19258. command: e,
  19259. sdkVersion: c,
  19260. seq: i,
  19261. requestId: i,
  19262. allocate: n,
  19263. cname: this.spec.cname,
  19264. appId: this.spec.appId,
  19265. sid: this.spec.sid,
  19266. uid: this.spec.uid.toString(),
  19267. ts: Math.floor(Date.now() / 1e3)
  19268. },
  19269. t), "closed" === this.websocket.state) throw new p.AgoraRTCError(p.AgoraRTCErrorCode.WS_DISCONNECT);
  19270. return l = function() {
  19271. return new Promise((function(e, t) {
  19272. _.websocket.once(d.WebSocketManagerEvents.CLOSED, (function() {
  19273. return t(new p.AgoraRTCError(p.AgoraRTCErrorCode.WS_ABORT))
  19274. })),
  19275. _.websocket.once(d.WebSocketManagerEvents.CONNECTED, e)
  19276. }))
  19277. },
  19278. "connected" === this.websocket.state ? [3, 2] : [4, l()];
  19279. case 1:
  19280. s.sent(),
  19281. s.label = 2;
  19282. case 2:
  19283. u.clientRequest && (u.clientRequest.workerToken = this.token),
  19284. g = new Promise((function(e, t) {
  19285. var n = function() {
  19286. t(new p.AgoraRTCError(p.AgoraRTCErrorCode.WS_ABORT))
  19287. };
  19288. _.websocket.once(d.WebSocketManagerEvents.RECONNECTING, n),
  19289. _.websocket.once(d.WebSocketManagerEvents.CLOSED, n),
  19290. _.once("@" + i + "-" + _.spec.sid, (function(t) {
  19291. e(t)
  19292. }))
  19293. })),
  19294. r && m.report.requestWorkerEvent(this.spec.sid, o(o({},
  19295. r), {
  19296. requestId: a,
  19297. actionType: "request",
  19298. payload: JSON.stringify(t.clientRequest),
  19299. serverCode: 0,
  19300. code: 0
  19301. })),
  19302. h = Date.now(),
  19303. this.websocket.sendMessage(u),
  19304. v = null,
  19305. s.label = 3;
  19306. case 3:
  19307. return s.trys.push([3, 5, , 8]),
  19308. [4, g];
  19309. case 4:
  19310. return v = s.sent(),
  19311. [3, 8];
  19312. case 5:
  19313. if (E = s.sent(), "closed" === this.websocket.state) throw E;
  19314. return [4, l()];
  19315. case 6:
  19316. return s.sent(),
  19317. [4, this.request(e, t, n, r)];
  19318. case 7:
  19319. return [2, s.sent()];
  19320. case 8:
  19321. return r && m.report.requestWorkerEvent(this.spec.sid, o(o({},
  19322. r), {
  19323. requestId: a,
  19324. actionType: "response",
  19325. payload: JSON.stringify(v.serverResponse),
  19326. serverCode: v.code,
  19327. success: 200 === v.code,
  19328. responseTime: Date.now() - h
  19329. })),
  19330. 200 !== v.code && this.handleResponseError(v),
  19331. [2, v]
  19332. }
  19333. }))
  19334. }))
  19335. },
  19336. t.prototype.tryNextAddress = function() {
  19337. this.reconnectMode = "tryNext",
  19338. this.websocket.reconnect("tryNext")
  19339. },
  19340. t.prototype.close = function() {
  19341. var e = "__VERSION__" === f.VERSION ? "0.0.1": f.VERSION;
  19342. this.reqId += 1,
  19343. "connected" === this.websocket.state ? (this.websocket.sendMessage({
  19344. command: "request",
  19345. appId: this.spec.appId,
  19346. cname: this.spec.cname,
  19347. uid: this.spec.uid.toString(),
  19348. sdkVersion: e,
  19349. sid: this.spec.sid,
  19350. seq: this.reqId,
  19351. ts: Math.floor(Date.now() / 1e3),
  19352. requestId: this.reqId,
  19353. clientRequest: {
  19354. command: "DestroyWorker"
  19355. }
  19356. }), this.websocket.close(!1, !0)) : this.websocket.close(!1),
  19357. this.pingpongTimer && (window.clearInterval(this.pingpongTimer), this.pingpongTimer = void 0)
  19358. },
  19359. t.prototype.handleResponseError = function(e) {
  19360. switch (e.code) {
  19361. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM:
  19362. return void g.
  19363. default.warning("live stream response already exists stream");
  19364. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR:
  19365. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_BAD_STREAM:
  19366. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR:
  19367. return new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INVALID_ARGUMENT, "", {
  19368. code: e.code
  19369. }).
  19370. throw ();
  19371. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST:
  19372. if ("UnpublishStream" === e.serverResponse.command || "UninjectStream" === e.serverResponse.command) return;
  19373. throw new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "live stream response wm worker not exist", {
  19374. retry: !0
  19375. });
  19376. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED:
  19377. return new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED, "", {
  19378. code: e.code
  19379. }).
  19380. throw ();
  19381. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:
  19382. var t = new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE);
  19383. return this.emit(d.LiveStreamingUapSignalEvents.WARNING, t, e.serverResponse.url);
  19384. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN:
  19385. t = new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_WARN_FREQUENT_REQUEST);
  19386. return this.emit(d.LiveStreamingUapSignalEvents.WARNING, t, e.serverResponse.url);
  19387. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH:
  19388. throw new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "live stream response wm worker not exist", {
  19389. retry: !0
  19390. });
  19391. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_NOT_SUPPORTED:
  19392. return new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_TRANSCODING_NOT_SUPPORT, "", {
  19393. code: e.code
  19394. }).
  19395. throw ();
  19396. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM:
  19397. t = new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT);
  19398. return this.emit(d.LiveStreamingUapSignalEvents.WARNING, t, e.serverResponse.url);
  19399. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR:
  19400. return new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "", {
  19401. code: e.code
  19402. }).
  19403. throw ();
  19404. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT:
  19405. throw new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "live stream resource limit", {
  19406. retry: !0,
  19407. changeAddress: !0
  19408. });
  19409. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_WORKER_LOST:
  19410. case d.LIVE_STREAM_ERROR_CODE.LIVE_STREAM_RESPONSE_WORKER_QUIT:
  19411. if ("UnpublishStream" === e.serverResponse.command || "UninjectStream" === e.serverResponse.command) return;
  19412. throw new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "error fail send message", {
  19413. retry: !0,
  19414. changeAddress: !0
  19415. });
  19416. case d.LIVE_STREAM_ERROR_CODE.ERROR_FAIL_SEND_MESSAGE:
  19417. if ("UnpublishStream" === e.serverResponse.command || "UninjectStream" === e.serverResponse.command) return;
  19418. if ("UpdateTranscoding" === e.serverResponse.command || "ControlStream" === e.serverResponse.command) return new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "error fail send message", {
  19419. code: e.code
  19420. }).
  19421. throw ();
  19422. throw new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_INTERNAL_SERVER_ERROR, "error fail send message", {
  19423. retry: !0,
  19424. changeAddress: !0
  19425. });
  19426. case d.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:
  19427. case d.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:
  19428. case d.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:
  19429. case d.LIVE_STREAM_ERROR_CODE.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:
  19430. return new p.AgoraRTCError(p.AgoraRTCErrorCode.LIVE_STREAMING_CDN_ERROR, "", {
  19431. code: e.code
  19432. }).
  19433. throw ()
  19434. }
  19435. },
  19436. t.prototype.startPingPong = function() {
  19437. var e = this;
  19438. this.pingpongTimer && window.clearInterval(this.pingpongTimer),
  19439. this.pingpongTimer = window.setInterval((function() {
  19440. "connected" === e.websocket.state && e.request("ping", {}).
  19441. catch((function() {}))
  19442. }), 6e3)
  19443. },
  19444. t
  19445. } (l.EventEmitter);
  19446. t.AgoraLiveStreamingUapSignal = h
  19447. },
  19448. function(e, t, n) {
  19449. "use strict";
  19450. var r, i = this && this.__extends || (r = function(e, t) {
  19451. return (r = Object.setPrototypeOf || {
  19452. __proto__: []
  19453. }
  19454. instanceof Array &&
  19455. function(e, t) {
  19456. e.__proto__ = t
  19457. } ||
  19458. function(e, t) {
  19459. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n])
  19460. })(e, t)
  19461. },
  19462. function(e, t) {
  19463. function n() {
  19464. this.constructor = e
  19465. }
  19466. r(e, t),
  19467. e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
  19468. }),
  19469. o = this && this.__awaiter ||
  19470. function(e, t, n, r) {
  19471. return new(n || (n = Promise))((function(i, o) {
  19472. function a(e) {
  19473. try {
  19474. c(r.next(e))
  19475. } catch(e) {
  19476. o(e)
  19477. }
  19478. }
  19479. function s(e) {
  19480. try {
  19481. c(r.
  19482. throw (e))
  19483. } catch(e) {
  19484. o(e)
  19485. }
  19486. }
  19487. function c(e) {
  19488. var t;
  19489. e.done ? i(e.value) : (t = e.value, t instanceof n ? t: new n((function(e) {
  19490. e(t)
  19491. }))).then(a, s)
  19492. }
  19493. c((r = r.apply(e, t || [])).next())
  19494. }))
  19495. },
  19496. a = this && this.__generator ||
  19497. function(e, t) {
  19498. var n, r, i, o, a = {
  19499. label: 0,
  19500. sent: function() {
  19501. if (1 & i[0]) throw i[1];
  19502. return i[1]
  19503. },
  19504. trys: [],
  19505. ops: []
  19506. };
  19507. return o = {
  19508. next: s(0),
  19509. throw: s(1),
  19510. return: s(2)
  19511. },
  19512. "function" == typeof Symbol && (o[Symbol.iterator] = function() {
  19513. return this
  19514. }),
  19515. o;
  19516. function s(o) {
  19517. return function(s) {
  19518. return function(o) {
  19519. if (n) throw new TypeError("Generator is already executing.");
  19520. for (; a;) try {
  19521. if (n = 1, r && (i = 2 & o[0] ? r.
  19522. return: o[0] ? r.
  19523. throw || ((i = r.
  19524. return) && i.call(r), 0) : r.next) && !(i = i.call(r, o[1])).done) return i;
  19525. switch (r = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  19526. case 0:
  19527. case 1:
  19528. i = o;
  19529. break;
  19530. case 4:
  19531. return a.label++,
  19532. {
  19533. value: o[1],
  19534. done: !1
  19535. };
  19536. case 5:
  19537. a.label++,
  19538. r = o[1],
  19539. o = [0];
  19540. continue;
  19541. case 7:
  19542. o = a.ops.pop(),
  19543. a.trys.pop();
  19544. continue;
  19545. default:
  19546. if (! (i = a.trys, (i = i.length > 0 && i[i.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  19547. a = 0;
  19548. continue
  19549. }
  19550. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) {
  19551. a.label = o[1];
  19552. break
  19553. }
  19554. if (6 === o[0] && a.label < i[1]) {
  19555. a.label = i[1],
  19556. i = o;
  19557. break
  19558. }
  19559. if (i && a.label < i[2]) {
  19560. a.label = i[2],
  19561. a.ops.push(o);
  19562. break
  19563. }
  19564. i[2] && a.ops.pop(),
  19565. a.trys.pop();
  19566. continue
  19567. }
  19568. o = t.call(e, a)
  19569. } catch(e) {
  19570. o = [6, e],
  19571. r = 0
  19572. } finally {
  19573. n = i = 0
  19574. }
  19575. if (5 & o[0]) throw o[1];
  19576. return {
  19577. value: o[0] ? o[1] : void 0,
  19578. done: !0
  19579. }
  19580. } ([o, s])
  19581. }
  19582. }
  19583. },
  19584. s = this && this.__importDefault ||
  19585. function(e) {
  19586. return e && e.__esModule ? e: {
  19587. default:
  19588. e
  19589. }
  19590. };
  19591. Object.defineProperty(t, "__esModule", {
  19592. value: !0
  19593. });
  19594. var c = n(23),
  19595. d = n(33),
  19596. u = n(34),
  19597. l = n(26),
  19598. p = s(n(0)),
  19599. f = function(e) {
  19600. function t(t) {
  19601. var n = e.call(this) || this;
  19602. return n.connectionID = 0,
  19603. n.currentURLIndex = 0,
  19604. n.reconnectMode = "tryNext",
  19605. n._state = "closed",
  19606. n.retryConfig = u.DEFAULT_RETRY_CONFIG,
  19607. n.reconnectCount = 0,
  19608. n.name = t,
  19609. n
  19610. }
  19611. return i(t, e),
  19612. Object.defineProperty(t.prototype, "url", {
  19613. get: function() {
  19614. return this.websocket ? this.websocket.url: null
  19615. },
  19616. enumerable: !0,
  19617. configurable: !0
  19618. }),
  19619. Object.defineProperty(t.prototype, "state", {
  19620. get: function() {
  19621. return this._state
  19622. },
  19623. set: function(e) {
  19624. e !== this._state && (this._state = e, "reconnecting" === this._state ? this.emit(l.WebSocketManagerEvents.RECONNECTING, this.reconnectMode) : "connected" === this._state ? this.emit(l.WebSocketManagerEvents.CONNECTED) : "closed" === this._state ? this.emit(l.WebSocketManagerEvents.CLOSED) : "failed" === this._state && this.emit(l.WebSocketManagerEvents.FAILED))
  19625. },
  19626. enumerable: !0,
  19627. configurable: !0
  19628. }),
  19629. t.prototype.init = function(e) {
  19630. var t = this;
  19631. return new Promise((function(n, r) {
  19632. t.urls = e;
  19633. var i = t.urls[t.currentURLIndex];
  19634. t.state = "connecting",
  19635. t.createWebSocketConnection(i).then(n).
  19636. catch(r),
  19637. t.once(l.WebSocketManagerEvents.CLOSED, (function() {
  19638. return r(new c.AgoraRTCError(c.AgoraRTCErrorCode.WS_DISCONNECT))
  19639. })),
  19640. t.once(l.WebSocketManagerEvents.CONNECTED, (function() {
  19641. return n()
  19642. }))
  19643. }))
  19644. },
  19645. t.prototype.close = function(e, t) {
  19646. if (this.currentURLIndex = 0, this.reconnectCount = 0, this.websocket) {
  19647. this.websocket.onclose = null,
  19648. this.websocket.onopen = null,
  19649. this.websocket.onmessage = null;
  19650. var n = this.websocket;
  19651. t ? setTimeout((function() {
  19652. return n.close()
  19653. }), 500) : n.close(),
  19654. this.websocket = void 0
  19655. }
  19656. this.state = e ? "failed": "closed"
  19657. },
  19658. t.prototype.reconnect = function(e) {
  19659. if (this.websocket) {
  19660. void 0 !== e && (this.reconnectMode = e);
  19661. var t = this.websocket.onclose;
  19662. this.websocket.onclose = null,
  19663. this.websocket.close(),
  19664. t && t.bind(this.websocket)({
  19665. code: 9999
  19666. })
  19667. } else p.
  19668. default.warning("[" + this.name + "] can not reconnect, no websocket")
  19669. },
  19670. t.prototype.sendMessage = function(e) {
  19671. if (!this.websocket || this.websocket.readyState !== WebSocket.OPEN) throw new c.AgoraRTCError(c.AgoraRTCErrorCode.WS_ABORT, "websocket is not ready");
  19672. var t = JSON.stringify(e);
  19673. try {
  19674. this.websocket.send(t)
  19675. } catch(e) {
  19676. throw new c.AgoraRTCError(c.AgoraRTCErrorCode.WS_ERR, "send websocket message error" + e.toString())
  19677. }
  19678. },
  19679. t.prototype.createWebSocketConnection = function(e) {
  19680. return o(this, void 0, void 0, (function() {
  19681. var t, n = this;
  19682. return a(this, (function(r) {
  19683. return this.connectionID += 1,
  19684. t = this.connectionID,
  19685. [2, new Promise((function(r, i) {
  19686. n.websocket && (n.websocket.onclose = null, n.websocket.close()),
  19687. p.
  19688. default.debug("[" + n.name + "] start connect, url: " + e);
  19689. try {
  19690. n.websocket = new WebSocket(e),
  19691. n.websocket.binaryType = "arraybuffer"
  19692. } catch(e) {
  19693. var s = new c.AgoraRTCError(c.AgoraRTCErrorCode.WS_ERR, "init websocket failed! Error: " + e.toString());
  19694. return p.
  19695. default.error("[" + n.name + "]" + s),
  19696. void i(s)
  19697. }
  19698. u.wait(5e3).then((function() {
  19699. t === n.connectionID && n.websocket && n.websocket.readyState !== WebSocket.OPEN && n.websocket && n.websocket.close()
  19700. })),
  19701. n.websocket.onopen = function() {
  19702. p.
  19703. default.debug("[" + n.name + "] websockect opened:", e),
  19704. n.reconnectMode = "retry",
  19705. n.state = "connected",
  19706. n.reconnectCount = 0,
  19707. r()
  19708. },
  19709. n.websocket.onclose = function(e) {
  19710. return o(n, void 0, void 0, (function() {
  19711. var t, n;
  19712. return a(this, (function(o) {
  19713. switch (o.label) {
  19714. case 0:
  19715. return p.
  19716. default.debug("[" + this.name + "] websocket close " + (this.websocket && this.websocket.url) + ", code: " + e.code + ", reason: " + e.reason + ", current mode: " + this.reconnectMode),
  19717. this.reconnectCount < this.retryConfig.maxRetryCount ? ("connected" === this.state && (this.state = "reconnecting"), t = d.emitAsInvokerNoResponse(this, l.WebSocketManagerEvents.WILL_RECONNECT, this.reconnectMode) || this.reconnectMode, [4, this.reconnectWithAction(t)]) : [3, 2];
  19718. case 1:
  19719. return n = o.sent(),
  19720. "closed" === this.state ? (p.
  19721. default.debug("[" + this.connectionID + "] ws is closed, no need to reconnect"), [2]) : n ? (r(), [3, 3]) : (i(new c.AgoraRTCError(c.AgoraRTCErrorCode.WS_DISCONNECT, "websocket reconnect failed: " + e.code)), this.close(!0), [2]);
  19722. case 2:
  19723. i(new c.AgoraRTCError(c.AgoraRTCErrorCode.WS_DISCONNECT, "websocket close: " + e.code)),
  19724. this.close(),
  19725. o.label = 3;
  19726. case 3:
  19727. return [2]
  19728. }
  19729. }))
  19730. }))
  19731. },
  19732. n.websocket.onmessage = function(e) {
  19733. n.emit(l.WebSocketManagerEvents.ON_MESSAGE, e)
  19734. }
  19735. }))]
  19736. }))
  19737. }))
  19738. },
  19739. t.prototype.reconnectWithAction = function(e, t) {
  19740. return o(this, void 0, void 0, (function() {
  19741. var n, r, i, o;
  19742. return a(this, (function(a) {
  19743. switch (a.label) {
  19744. case 0:
  19745. return ! t && this.reconnectCount >= this.retryConfig.maxRetryCount ? [2, !1] : this.urls ? "closed" === this.state ? [2, !1] : (n = u.getRetryWaitTime(this.reconnectCount, this.retryConfig), p.
  19746. default.debug("[" + this.name + "] wait " + n + "ms to reconnect websocket, mode: " + e), [4, u.wait(n)]) : [2, !1];
  19747. case 1:
  19748. if (a.sent(), "closed" === this.state) return [2, !1];
  19749. this.reconnectCount += 1,
  19750. a.label = 2;
  19751. case 2:
  19752. return a.trys.push([2, 12, , 14]),
  19753. "retry" !== e ? [3, 4] : (i = this.urls[this.currentURLIndex], [4, this.createWebSocketConnection(i)]);
  19754. case 3:
  19755. return a.sent(),
  19756. [3, 11];
  19757. case 4:
  19758. return "tryNext" !== e ? [3, 8] : (this.currentURLIndex += 1, this.currentURLIndex >= this.urls.length ? [4, this.reconnectWithAction("recover")] : [3, 6]);
  19759. case 5:
  19760. return [2, a.sent()];
  19761. case 6:
  19762. return p.
  19763. default.debug("[" + this.name + "] websocket url length: " + this.urls.length + " current index: " + this.currentURLIndex),
  19764. i = this.urls[this.currentURLIndex],
  19765. [4, this.createWebSocketConnection(i)];
  19766. case 7:
  19767. return a.sent(),
  19768. [3, 11];
  19769. case 8:
  19770. return "recover" !== e ? [3, 11] : (p.
  19771. default.debug("[" + this.name + "] request new urls"), r = this, [4, d.emitAsPromise(this, l.WebSocketManagerEvents.REQUEST_NEW_URLS)]);
  19772. case 9:
  19773. return r.urls = a.sent(),
  19774. this.currentURLIndex = 0,
  19775. i = this.urls[this.currentURLIndex],
  19776. [4, this.createWebSocketConnection(i)];
  19777. case 10:
  19778. a.sent(),
  19779. a.label = 11;
  19780. case 11:
  19781. return [2, !0];
  19782. case 12:
  19783. return o = a.sent(),
  19784. p.
  19785. default.error("[" + this.name + "] reconnect failed", o.toString()),
  19786. [4, this.reconnectWithAction(e)];
  19787. case 13:
  19788. return [2, a.sent()];
  19789. case 14:
  19790. return [2]
  19791. }
  19792. }))
  19793. }))
  19794. },
  19795. t
  19796. } (d.EventEmitter);
  19797. t.AgoraWebSocketManager = f
  19798. },
  19799. function(e, t, n) {
  19800. "use strict";
  19801. var r = n(18),
  19802. i = n(36),
  19803. o = n(75),
  19804. a = n(42);
  19805. function s(e) {
  19806. var t = new o(e),
  19807. n = i(o.prototype.request, t);
  19808. return r.extend(n, o.prototype, t),
  19809. r.extend(n, t),
  19810. n
  19811. }
  19812. var c = s(n(39));
  19813. c.Axios = o,
  19814. c.create = function(e) {
  19815. return s(a(c.defaults, e))
  19816. },
  19817. c.Cancel = n(43),
  19818. c.CancelToken = n(89),
  19819. c.isCancel = n(38),
  19820. c.all = function(e) {
  19821. return Promise.all(e)
  19822. },
  19823. c.spread = n(90),
  19824. e.exports = c,
  19825. e.exports.
  19826. default = c
  19827. },
  19828. function(e, t, n) {
  19829. "use strict";
  19830. var r = n(18),
  19831. i = n(37),
  19832. o = n(76),
  19833. a = n(77),
  19834. s = n(42);
  19835. function c(e) {
  19836. this.defaults = e,
  19837. this.interceptors = {
  19838. request: new o,
  19839. response: new o
  19840. }
  19841. }
  19842. c.prototype.request = function(e) {
  19843. "string" == typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {},
  19844. (e = s(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = "get";
  19845. var t = [a, void 0],
  19846. n = Promise.resolve(e);
  19847. for (this.interceptors.request.forEach((function(e) {
  19848. t.unshift(e.fulfilled, e.rejected)
  19849. })), this.interceptors.response.forEach((function(e) {
  19850. t.push(e.fulfilled, e.rejected)
  19851. })); t.length;) n = n.then(t.shift(), t.shift());
  19852. return n
  19853. },
  19854. c.prototype.getUri = function(e) {
  19855. return e = s(this.defaults, e),
  19856. i(e.url, e.params, e.paramsSerializer).replace(/^\?/, "")
  19857. },
  19858. r.forEach(["delete", "get", "head", "options"], (function(e) {
  19859. c.prototype[e] = function(t, n) {
  19860. return this.request(r.merge(n || {},
  19861. {
  19862. method: e,
  19863. url: t
  19864. }))
  19865. }
  19866. })),
  19867. r.forEach(["post", "put", "patch"], (function(e) {
  19868. c.prototype[e] = function(t, n, i) {
  19869. return this.request(r.merge(i || {},
  19870. {
  19871. method: e,
  19872. url: t,
  19873. data: n
  19874. }))
  19875. }
  19876. })),
  19877. e.exports = c
  19878. },
  19879. function(e, t, n) {
  19880. "use strict";
  19881. var r = n(18);
  19882. function i() {
  19883. this.handlers = []
  19884. }
  19885. i.prototype.use = function(e, t) {
  19886. return this.handlers.push({
  19887. fulfilled: e,
  19888. rejected: t
  19889. }),
  19890. this.handlers.length - 1
  19891. },
  19892. i.prototype.eject = function(e) {
  19893. this.handlers[e] && (this.handlers[e] = null)
  19894. },
  19895. i.prototype.forEach = function(e) {
  19896. r.forEach(this.handlers, (function(t) {
  19897. null !== t && e(t)
  19898. }))
  19899. },
  19900. e.exports = i
  19901. },
  19902. function(e, t, n) {
  19903. "use strict";
  19904. var r = n(18),
  19905. i = n(78),
  19906. o = n(38),
  19907. a = n(39);
  19908. function s(e) {
  19909. e.cancelToken && e.cancelToken.throwIfRequested()
  19910. }
  19911. e.exports = function(e) {
  19912. return s(e),
  19913. e.headers = e.headers || {},
  19914. e.data = i(e.data, e.headers, e.transformRequest),
  19915. e.headers = r.merge(e.headers.common || {},
  19916. e.headers[e.method] || {},
  19917. e.headers),
  19918. r.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (function(t) {
  19919. delete e.headers[t]
  19920. })),
  19921. (e.adapter || a.adapter)(e).then((function(t) {
  19922. return s(e),
  19923. t.data = i(t.data, t.headers, e.transformResponse),
  19924. t
  19925. }), (function(t) {
  19926. return o(t) || (s(e), t && t.response && (t.response.data = i(t.response.data, t.response.headers, e.transformResponse))),
  19927. Promise.reject(t)
  19928. }))
  19929. }
  19930. },
  19931. function(e, t, n) {
  19932. "use strict";
  19933. var r = n(18);
  19934. e.exports = function(e, t, n) {
  19935. return r.forEach(n, (function(n) {
  19936. e = n(e, t)
  19937. })),
  19938. e
  19939. }
  19940. },
  19941. function(e, t) {
  19942. var n, r, i = e.exports = {};
  19943. function o() {
  19944. throw new Error("setTimeout has not been defined")
  19945. }
  19946. function a() {
  19947. throw new Error("clearTimeout has not been defined")
  19948. }
  19949. function s(e) {
  19950. if (n === setTimeout) return setTimeout(e, 0);
  19951. if ((n === o || !n) && setTimeout) return n = setTimeout,
  19952. setTimeout(e, 0);
  19953. try {
  19954. return n(e, 0)
  19955. } catch(t) {
  19956. try {
  19957. return n.call(null, e, 0)
  19958. } catch(t) {
  19959. return n.call(this, e, 0)
  19960. }
  19961. }
  19962. } !
  19963. function() {
  19964. try {
  19965. n = "function" == typeof setTimeout ? setTimeout: o
  19966. } catch(e) {
  19967. n = o
  19968. }
  19969. try {
  19970. r = "function" == typeof clearTimeout ? clearTimeout: a
  19971. } catch(e) {
  19972. r = a
  19973. }
  19974. } ();
  19975. var c, d = [],
  19976. u = !1,
  19977. l = -1;
  19978. function p() {
  19979. u && c && (u = !1, c.length ? d = c.concat(d) : l = -1, d.length && f())
  19980. }
  19981. function f() {
  19982. if (!u) {
  19983. var e = s(p);
  19984. u = !0;
  19985. for (var t = d.length; t;) {
  19986. for (c = d, d = []; ++l < t;) c && c[l].run();
  19987. l = -1,
  19988. t = d.length
  19989. }
  19990. c = null,
  19991. u = !1,
  19992. function(e) {
  19993. if (r === clearTimeout) return clearTimeout(e);
  19994. if ((r === a || !r) && clearTimeout) return r = clearTimeout,
  19995. clearTimeout(e);
  19996. try {
  19997. r(e)
  19998. } catch(t) {
  19999. try {
  20000. return r.call(null, e)
  20001. } catch(t) {
  20002. return r.call(this, e)
  20003. }
  20004. }
  20005. } (e)
  20006. }
  20007. }
  20008. function g(e, t) {
  20009. this.fun = e,
  20010. this.array = t
  20011. }
  20012. function m() {}
  20013. i.nextTick = function(e) {
  20014. var t = new Array(arguments.length - 1);
  20015. if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
  20016. d.push(new g(e, t)),
  20017. 1 !== d.length || u || s(f)
  20018. },
  20019. g.prototype.run = function() {
  20020. this.fun.apply(null, this.array)
  20021. },
  20022. i.title = "browser",
  20023. i.browser = !0,
  20024. i.env = {},
  20025. i.argv = [],
  20026. i.version = "",
  20027. i.versions = {},
  20028. i.on = m,
  20029. i.addListener = m,
  20030. i.once = m,
  20031. i.off = m,
  20032. i.removeListener = m,
  20033. i.removeAllListeners = m,
  20034. i.emit = m,
  20035. i.prependListener = m,
  20036. i.prependOnceListener = m,
  20037. i.listeners = function(e) {
  20038. return []
  20039. },
  20040. i.binding = function(e) {
  20041. throw new Error("process.binding is not supported")
  20042. },
  20043. i.cwd = function() {
  20044. return "/"
  20045. },
  20046. i.chdir = function(e) {
  20047. throw new Error("process.chdir is not supported")
  20048. },
  20049. i.umask = function() {
  20050. return 0
  20051. }
  20052. },
  20053. function(e, t, n) {
  20054. "use strict";
  20055. var r = n(18);
  20056. e.exports = function(e, t) {
  20057. r.forEach(e, (function(n, r) {
  20058. r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r])
  20059. }))
  20060. }
  20061. },
  20062. function(e, t, n) {
  20063. "use strict";
  20064. var r = n(41);
  20065. e.exports = function(e, t, n) {
  20066. var i = n.config.validateStatus; ! i || i(n.status) ? e(n) : t(r("Request failed with status code " + n.status, n.config, null, n.request, n))
  20067. }
  20068. },
  20069. function(e, t, n) {
  20070. "use strict";
  20071. e.exports = function(e, t, n, r, i) {
  20072. return e.config = t,
  20073. n && (e.code = n),
  20074. e.request = r,
  20075. e.response = i,
  20076. e.isAxiosError = !0,
  20077. e.toJSON = function() {
  20078. return {
  20079. message: this.message,
  20080. name: this.name,
  20081. description: this.description,
  20082. number: this.number,
  20083. fileName: this.fileName,
  20084. lineNumber: this.lineNumber,
  20085. columnNumber: this.columnNumber,
  20086. stack: this.stack,
  20087. config: this.config,
  20088. code: this.code
  20089. }
  20090. },
  20091. e
  20092. }
  20093. },
  20094. function(e, t, n) {
  20095. "use strict";
  20096. var r = n(84),
  20097. i = n(85);
  20098. e.exports = function(e, t) {
  20099. return e && !r(t) ? i(e, t) : t
  20100. }
  20101. },
  20102. function(e, t, n) {
  20103. "use strict";
  20104. e.exports = function(e) {
  20105. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)
  20106. }
  20107. },
  20108. function(e, t, n) {
  20109. "use strict";
  20110. e.exports = function(e, t) {
  20111. return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e
  20112. }
  20113. },
  20114. function(e, t, n) {
  20115. "use strict";
  20116. var r = n(18),
  20117. i = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"];
  20118. e.exports = function(e) {
  20119. var t, n, o, a = {};
  20120. return e ? (r.forEach(e.split("\n"), (function(e) {
  20121. if (o = e.indexOf(":"), t = r.trim(e.substr(0, o)).toLowerCase(), n = r.trim(e.substr(o + 1)), t) {
  20122. if (a[t] && i.indexOf(t) >= 0) return;
  20123. a[t] = "set-cookie" === t ? (a[t] ? a[t] : []).concat([n]) : a[t] ? a[t] + ", " + n: n
  20124. }
  20125. })), a) : a
  20126. }
  20127. },
  20128. function(e, t, n) {
  20129. "use strict";
  20130. var r = n(18);
  20131. e.exports = r.isStandardBrowserEnv() ?
  20132. function() {
  20133. var e, t = /(msie|trident)/i.test(navigator.userAgent),
  20134. n = document.createElement("a");
  20135. function i(e) {
  20136. var r = e;
  20137. return t && (n.setAttribute("href", r), r = n.href),
  20138. n.setAttribute("href", r),
  20139. {
  20140. href: n.href,
  20141. protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
  20142. host: n.host,
  20143. search: n.search ? n.search.replace(/^\?/, "") : "",
  20144. hash: n.hash ? n.hash.replace(/^#/, "") : "",
  20145. hostname: n.hostname,
  20146. port: n.port,
  20147. pathname: "/" === n.pathname.charAt(0) ? n.pathname: "/" + n.pathname
  20148. }
  20149. }
  20150. return e = i(window.location.href),
  20151. function(t) {
  20152. var n = r.isString(t) ? i(t) : t;
  20153. return n.protocol === e.protocol && n.host === e.host
  20154. }
  20155. } () : function() {
  20156. return ! 0
  20157. }
  20158. },
  20159. function(e, t, n) {
  20160. "use strict";
  20161. var r = n(18);
  20162. e.exports = r.isStandardBrowserEnv() ? {
  20163. write: function(e, t, n, i, o, a) {
  20164. var s = [];
  20165. s.push(e + "=" + encodeURIComponent(t)),
  20166. r.isNumber(n) && s.push("expires=" + new Date(n).toGMTString()),
  20167. r.isString(i) && s.push("path=" + i),
  20168. r.isString(o) && s.push("domain=" + o),
  20169. !0 === a && s.push("secure"),
  20170. document.cookie = s.join("; ")
  20171. },
  20172. read: function(e) {
  20173. var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
  20174. return t ? decodeURIComponent(t[3]) : null
  20175. },
  20176. remove: function(e) {
  20177. this.write(e, "", Date.now() - 864e5)
  20178. }
  20179. }: {
  20180. write: function() {},
  20181. read: function() {
  20182. return null
  20183. },
  20184. remove: function() {}
  20185. }
  20186. },
  20187. function(e, t, n) {
  20188. "use strict";
  20189. var r = n(43);
  20190. function i(e) {
  20191. if ("function" != typeof e) throw new TypeError("executor must be a function.");
  20192. var t;
  20193. this.promise = new Promise((function(e) {
  20194. t = e
  20195. }));
  20196. var n = this;
  20197. e((function(e) {
  20198. n.reason || (n.reason = new r(e), t(n.reason))
  20199. }))
  20200. }
  20201. i.prototype.throwIfRequested = function() {
  20202. if (this.reason) throw this.reason
  20203. },
  20204. i.source = function() {
  20205. var e;
  20206. return {
  20207. token: new i((function(t) {
  20208. e = t
  20209. })),
  20210. cancel: e
  20211. }
  20212. },
  20213. e.exports = i
  20214. },
  20215. function(e, t, n) {
  20216. "use strict";
  20217. e.exports = function(e) {
  20218. return function(t) {
  20219. return e.apply(null, t)
  20220. }
  20221. }
  20222. },
  20223. function(e, t, n) {
  20224. "use strict";
  20225. Object.defineProperty(t, "__esModule", {
  20226. value: !0
  20227. });
  20228. var r = function() {
  20229. function e() {
  20230. this.lockingPromise = Promise.resolve(),
  20231. this.locks = 0
  20232. }
  20233. return Object.defineProperty(e.prototype, "isLocked", {
  20234. get: function() {
  20235. return this.locks > 0
  20236. },
  20237. enumerable: !0,
  20238. configurable: !0
  20239. }),
  20240. e.prototype.lock = function() {
  20241. var e, t = this;
  20242. this.locks += 1;
  20243. var n = new Promise((function(n) {
  20244. e = function() {
  20245. t.locks -= 1,
  20246. n()
  20247. }
  20248. })),
  20249. r = this.lockingPromise.then((function() {
  20250. return e
  20251. }));
  20252. return this.lockingPromise = this.lockingPromise.then((function() {
  20253. return n
  20254. })),
  20255. r
  20256. },
  20257. e
  20258. } ();
  20259. t.PromiseMutex = r
  20260. },
  20261. function(e, t, n) {
  20262. "use strict";
  20263. n.r(t);
  20264. var r = n(3),
  20265. i = n(0),
  20266. o = n(1),
  20267. a = n(8),
  20268. s = n(4),
  20269. c = function() {};
  20270. c.prototype.set = function(e, t) { ["BatteryLevel"].indexOf(e) > -1 && (this[e] = t)
  20271. };
  20272. var d = new
  20273. function() {
  20274. var e = Object(a.b)();
  20275. return e.states = {
  20276. UNINIT: "UNINIT",
  20277. INITING: "INITING",
  20278. INITED: "INITED"
  20279. },
  20280. e.state = e.states.UNINIT,
  20281. e.batteryManager = null,
  20282. e._init = function(t, n) {
  20283. e.state = e.states.INITING,
  20284. navigator.getBattery ? navigator.getBattery().then((function(n) {
  20285. e.batteryManager = n,
  20286. t && setTimeout((function() {
  20287. t()
  20288. }), 0)
  20289. })).
  20290. catch((function(e) {
  20291. i.
  20292. default.debug("navigator.getBattery is disabled", e),
  20293. t && t()
  20294. })) : (e.state = e.states.INITED, t && t())
  20295. },
  20296. e._getBatteryStats = function() {
  20297. var t = {};
  20298. return e.batteryManager && e.batteryManager.level ? t.BatteryLevel = Math.floor(100 * e.batteryManager.level) : t.BatteryLevel = "UNSUPPORTED",
  20299. t
  20300. },
  20301. e.getStats = function(t, n) {
  20302. var r = new c,
  20303. i = e._getBatteryStats();
  20304. i && i.BatteryLevel && r.set("BatteryLevel", i.BatteryLevel),
  20305. t && t(r)
  20306. },
  20307. e._init(),
  20308. e
  20309. },
  20310. u = n(21),
  20311. l = n(19),
  20312. p = n(25),
  20313. f = n(51),
  20314. g = n(9),
  20315. m = ["live", "rtc", "web", "interop", "h264_interop", "web-only"],
  20316. h = ["vp8", "h264"],
  20317. v = ["aes-128-xts", "aes-256-xts", "aes-128-ecb", "sm4-128-ecb"],
  20318. E = n(11),
  20319. _ = n.n(E),
  20320. S = n(7),
  20321. y = n.n(S),
  20322. R = n(12),
  20323. T = n(5),
  20324. I = n(10),
  20325. A = n(20),
  20326. b = n(6),
  20327. O = n(14),
  20328. C = {
  20329. 1001 : "FRAMERATE_INPUT_TOO_LOW",
  20330. 1002 : "FRAMERATE_SENT_TOO_LOW",
  20331. 1003 : "SEND_VIDEO_BITRATE_TOO_LOW",
  20332. 1005 : "RECV_VIDEO_DECODE_FAILED",
  20333. 2001 : "AUDIO_INPUT_LEVEL_TOO_LOW",
  20334. 2002 : "AUDIO_OUTPUT_LEVEL_TOO_LOW",
  20335. 2003 : "SEND_AUDIO_BITRATE_TOO_LOW",
  20336. 2005 : "RECV_AUDIO_DECODE_FAILED",
  20337. 3001 : "FRAMERATE_INPUT_TOO_LOW_RECOVER",
  20338. 3002 : "FRAMERATE_SENT_TOO_LOW_RECOVER",
  20339. 3003 : "SEND_VIDEO_BITRATE_TOO_LOW_RECOVER",
  20340. 3005 : "RECV_VIDEO_DECODE_FAILED_RECOVER",
  20341. 4001 : "AUDIO_INPUT_LEVEL_TOO_LOW_RECOVER",
  20342. 4002 : "AUDIO_OUTPUT_LEVEL_TOO_LOW_RECOVER",
  20343. 4003 : "SEND_AUDIO_BITRATE_TOO_LOW_RECOVER",
  20344. 4005 : "RECV_AUDIO_DECODE_FAILED_RECOVER"
  20345. },
  20346. N = {
  20347. FramerateInput: 1001,
  20348. FramerateSent: 1002,
  20349. SendVideoBitrate: 1003,
  20350. VideoDecode: 1005,
  20351. AudioIntputLevel: 2001,
  20352. AudioOutputLevel: 2002,
  20353. SendAudioBitrate: 2003,
  20354. AudioDecode: 2005
  20355. },
  20356. w = function(e) {
  20357. var t = {
  20358. remoteStreamStorage: {},
  20359. localStreamStorage: {}
  20360. };
  20361. return t.gatewayClient = e,
  20362. t.checkAudioOutputLevel = function(e) {
  20363. return ! (e && parseInt(e.audioRecvBytesDelta) > 0 && parseInt(e.audioDecodingNormalDelta) > 0 && 0 === parseInt(e.audioOutputLevel))
  20364. },
  20365. t.checkAudioIntputLevel = function(e) {
  20366. return ! e || 0 !== parseInt(e.audioInputLevel)
  20367. },
  20368. t.checkFramerateInput = function(e, t) {
  20369. if (!e || !t.attributes) return ! 0;
  20370. var n = parseInt(t.attributes.maxFrameRate),
  20371. r = parseInt(e.googFrameRateInput);
  20372. return ! n || !r || !(n > 10 && r < 5 || n < 10 && n >= 5 && r <= 1)
  20373. },
  20374. t.checkFramerateSent = function(e) {
  20375. return ! (e && parseInt(e.googFrameRateInput) > 5 && parseInt(e.googFrameRateSent) <= 1)
  20376. },
  20377. t.checkSendVideoBitrate = function(e) {
  20378. return ! e || 0 !== parseInt(e.videoSendBytesDelta)
  20379. },
  20380. t.checkSendAudioBitrate = function(e) {
  20381. return ! e || 0 !== parseInt(e.audioSendBytesDelta)
  20382. },
  20383. t.checkVideoDecode = function(e) {
  20384. return ! e || 0 === parseInt(e.videoRecvBytesDelta) || 0 !== parseInt(e.googFrameRateDecoded)
  20385. },
  20386. t.checkAudioDecode = function(e) {
  20387. return ! e || 0 === parseInt(e.audioRecvBytesDelta) || 0 !== parseInt(e.audioDecodingNormalDelta)
  20388. },
  20389. t.record = function(e, n, r, i, o) {
  20390. r[e] || (r[e] = {
  20391. isPrevNormal: !0,
  20392. record: []
  20393. });
  20394. var a = r[e],
  20395. s = t["check" + e](n, o);
  20396. if (a.record.push(s), a.record.length >= 5) {
  20397. a.isCurNormal = -1 !== a.record.indexOf(!0);
  20398. var c = N[e];
  20399. a.isPrevNormal && !a.isCurNormal && t.gatewayClient.dispatchEvent({
  20400. type: "exception",
  20401. code: c,
  20402. msg: C[c],
  20403. uid: i
  20404. }),
  20405. !a.isPrevNormal && a.isCurNormal && t.gatewayClient.dispatchEvent({
  20406. type: "exception",
  20407. code: c + 2e3,
  20408. msg: C[c + 2e3],
  20409. uid: i
  20410. }),
  20411. a.isPrevNormal = a.isCurNormal,
  20412. a.record = []
  20413. }
  20414. },
  20415. t.setLocalStats = function(e) {
  20416. var n = {};
  20417. Object.keys(e).map((function(r) {
  20418. var i = e[r],
  20419. o = t.gatewayClient.localStreams[parseInt(r)],
  20420. a = t.localStreamStorage[r] || {};
  20421. o && o.hasVideo() && (t.record("SendVideoBitrate", i.videoStats, a, r), t.record("FramerateInput", i.videoStats, a, r, o), t.record("FramerateSent", i.videoStats, a, r)),
  20422. o && o.hasAudio() && (t.record("AudioIntputLevel", i.audioStats, a, r), t.record("SendAudioBitrate", i.audioStats, a, r)),
  20423. n[r] = a
  20424. })),
  20425. t.localStreamStorage = n
  20426. },
  20427. t.setRemoteStats = function(n) {
  20428. var r = {};
  20429. Object.keys(n).map((function(i) {
  20430. var o = n[i],
  20431. a = e.remoteStreams[i],
  20432. s = t.remoteStreamStorage[i] || {};
  20433. a && a.hasVideo() && a.isPlaying() && t.record("VideoDecode", o.videoStats, s, i),
  20434. a && a.hasAudio() && a.isPlaying() && (t.record("AudioOutputLevel", o.audioStats, s, i), t.record("AudioDecode", o.audioStats, s, i)),
  20435. r[i] = s
  20436. })),
  20437. t.remoteStreamStorage = r
  20438. },
  20439. t
  20440. };
  20441. function L(e) {
  20442. if ("undefined" == typeof Symbol || null == e[Symbol.iterator]) {
  20443. if (Array.isArray(e) || (e = function(e, t) {
  20444. if (!e) return;
  20445. if ("string" == typeof e) return D(e, t);
  20446. var n = Object.prototype.toString.call(e).slice(8, -1);
  20447. "Object" === n && e.constructor && (n = e.constructor.name);
  20448. if ("Map" === n || "Set" === n) return Array.from(n);
  20449. if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return D(e, t)
  20450. } (e))) {
  20451. var t = 0,
  20452. n = function() {};
  20453. return {
  20454. s: n,
  20455. n: function() {
  20456. return t >= e.length ? {
  20457. done: !0
  20458. }: {
  20459. done: !1,
  20460. value: e[t++]
  20461. }
  20462. },
  20463. e: function(e) {
  20464. throw e
  20465. },
  20466. f: n
  20467. }
  20468. }
  20469. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
  20470. }
  20471. var r, i, o = !0,
  20472. a = !1;
  20473. return {
  20474. s: function() {
  20475. r = e[Symbol.iterator]()
  20476. },
  20477. n: function() {
  20478. var e = r.next();
  20479. return o = e.done,
  20480. e
  20481. },
  20482. e: function(e) {
  20483. a = !0,
  20484. i = e
  20485. },
  20486. f: function() {
  20487. try {
  20488. o || null == r.
  20489. return || r.
  20490. return ()
  20491. } finally {
  20492. if (a) throw i
  20493. }
  20494. }
  20495. }
  20496. }
  20497. function D(e, t) { (null == t || t > e.length) && (t = e.length);
  20498. for (var n = 0,
  20499. r = new Array(t); n < t; n++) r[n] = e[n];
  20500. return r
  20501. }
  20502. var k = n(2),
  20503. M = new
  20504. function() {
  20505. var e = Object(a.b)();
  20506. return e.states = {
  20507. UNINIT: "UNINIT",
  20508. INITING: "INITING",
  20509. INITED: "INITED"
  20510. },
  20511. e.state = e.states.UNINIT,
  20512. e.type = null,
  20513. e.lastConnectedAt = null,
  20514. e.lastDisconnectedAt = null,
  20515. e.lastTypeChangedAt = null,
  20516. e.networkChangeTimer = null,
  20517. e._init = function(t, n) {
  20518. if (e.state = e.states.INITING, navigator.connection && navigator.connection.addEventListener) {
  20519. var r = e._getNetworkInfo();
  20520. e.type = r && r.type,
  20521. e.state = e.states.INITED,
  20522. t && t()
  20523. } else e.state = e.states.UNINIT,
  20524. n && n("DO_NOT_SUPPORT")
  20525. },
  20526. e._getNetworkInfo = function() {
  20527. return navigator.connection
  20528. },
  20529. e._reloadNetworkInfo = function() {
  20530. var t = e._getNetworkInfo(),
  20531. n = t && t.type || "UNSUPPORTED",
  20532. r = Date.now();
  20533. if (n !== e.type) {
  20534. e.lastTypeChangedAt = r,
  20535. "none" == n ? e.lastDisconnectedAt = r: "none" == e.type && (e.lastConnectedAt = r),
  20536. e.type = n;
  20537. var i = {
  20538. type: "networkTypeChanged",
  20539. networkType: n
  20540. };
  20541. e.dispatchEvent(i)
  20542. }
  20543. },
  20544. e.getStats = function(t, n) {
  20545. var r = {},
  20546. i = e._getNetworkInfo();
  20547. i && (r.NetworkType = i.type || "UNSUPPORTED"),
  20548. setTimeout((function() {
  20549. t(r)
  20550. }), 0)
  20551. },
  20552. e._init((function() {
  20553. navigator.connection.addEventListener("change", (function() {
  20554. e._reloadNetworkInfo()
  20555. })),
  20556. e.networkChangeTimer = setInterval((function() {
  20557. e._reloadNetworkInfo()
  20558. }), 5e3)
  20559. }), (function(e) {})),
  20560. e
  20561. },
  20562. P = n(52),
  20563. U = n(16),
  20564. x = n(53),
  20565. j = n.n(x),
  20566. V = n(28),
  20567. B = "host",
  20568. F = function(e) {
  20569. var t = {
  20570. key: void 0,
  20571. highStream: null,
  20572. lowStream: null,
  20573. lowStreamParameter: null,
  20574. isDualStream: !1,
  20575. highStreamState: 2,
  20576. lowStreamState: 2,
  20577. proxyServer: null,
  20578. turnServers: [],
  20579. useProxyServer: !1
  20580. };
  20581. t.mode = e.mode,
  20582. t.codec = e.codec,
  20583. t.clientId = Object(I.generateSessionId)().slice(0, 5),
  20584. t.uintUid = null,
  20585. t.customReportCount = 0;
  20586. e = y()({},
  20587. e);
  20588. if (t.aespassword = null, t.aesmode = "none", t.hasPublished = !1, t.getSessionId = function() {
  20589. return e.sessionId
  20590. },
  20591. t.startChannelMediaRelay = function(n, r) {
  20592. var i = o.report.reportApiInvoke(e.sessionId, {
  20593. callback: function(e) {
  20594. if (e) return r && r(e);
  20595. r && r()
  20596. },
  20597. name: "Client.startChannelMediaRelay",
  20598. options: arguments,
  20599. tag: "tracer"
  20600. });
  20601. if (! (n instanceof g.ChannelMediaRelayConfiguration)) throw "Configration should be instance of [ChannelMediaRelayConfiguration]";
  20602. var a = n.getSrcChannelMediaInfo(),
  20603. s = n.getDestChannelMediaInfos();
  20604. if (Object(k.isEmpty)(a)) throw "srcChannelMediaInfo should not be empty";
  20605. if (Object(k.isEmpty)(s) || 0 === s.length) throw "destChannelMediaInfos should not be empty";
  20606. if (!Object(I.is32Uint)(a.uid)) throw "Invalid uid in srcChannelMediaInfo";
  20607. if (!Object(k.isValidChannelName)(a.channelName)) throw "Invalid channelName in srcChannelMediaInfo";
  20608. if (a.token && !Object(k.isValidToken)(a.token)) throw "Invalid token in srcChannelMediaInfo";
  20609. if (s.forEach((function(e) {
  20610. if (!Object(I.is32Uint)(e.uid)) throw "Invalid uid in destChannelMediaInfo";
  20611. if (!Object(k.isValidChannelName)(e.channelName)) throw "Invalid channelName in destChannelMediaInfo";
  20612. if (e.token && !Object(k.isValidToken)(e.token)) throw "Invalid token in destChannelMediaInfo"
  20613. })), t.gatewayClient.state !== R.a.CONNECTED) throw "startChannelMediaRelay should be used after join";
  20614. t.gatewayClient.startChannelMediaRelay(n).then((function() {
  20615. i && i()
  20616. })).
  20617. catch((function(e) {
  20618. i && i(e)
  20619. }))
  20620. },
  20621. t.updateChannelMediaRelay = function(n, r) {
  20622. var i = o.report.reportApiInvoke(e.sessionId, {
  20623. callback: function(e) {
  20624. if (e) return r && r(e);
  20625. r && r()
  20626. },
  20627. name: "Client.updateChannelMediaRelay",
  20628. options: arguments,
  20629. tag: "tracer"
  20630. });
  20631. if (! (n instanceof g.ChannelMediaRelayConfiguration)) throw "Configration should be instance of [ChannelMediaRelayConfiguration]";
  20632. var a = n.getSrcChannelMediaInfo(),
  20633. s = n.getDestChannelMediaInfos();
  20634. if (Object(k.isEmpty)(a)) throw "srcChannelMediaInfo should not be empty";
  20635. if (Object(k.isEmpty)(s) || 0 === s.length) throw "destChannelMediaInfos should not be empty";
  20636. if (!Object(I.is32Uint)(a.uid)) throw "Invalid uid in srcChannelMediaInfo";
  20637. if (!Object(k.isValidChannelName)(a.channelName)) throw "Invalid channelName in srcChannelMediaInfo";
  20638. if (a.token && !Object(k.isValidToken)(a.token)) throw "Invalid token in srcChannelMediaInfo";
  20639. if (s.forEach((function(e) {
  20640. if (!Object(I.is32Uint)(e.uid)) throw "Invalid uid in destChannelMediaInfo";
  20641. if (!Object(k.isValidChannelName)(e.channelName)) throw "Invalid channelName in destChannelMediaInfo";
  20642. if (e.token && !Object(k.isValidToken)(e.token)) throw "Invalid token in destChannelMediaInfo"
  20643. })), t.gatewayClient.state !== R.a.CONNECTED) throw "updateChannelMediaRelay should be used after join";
  20644. t.gatewayClient.updateChannelMediaRelay(n).then((function() {
  20645. i && i()
  20646. })).
  20647. catch((function(e) {
  20648. i && i(e)
  20649. }))
  20650. },
  20651. t.stopChannelMediaRelay = function(n) {
  20652. var r = o.report.reportApiInvoke(e.sessionId, {
  20653. callback: function(e) {
  20654. if (e) return n && n(e);
  20655. n && n()
  20656. },
  20657. name: "Client.stopChannelMediaRelay",
  20658. options: arguments,
  20659. tag: "tracer"
  20660. });
  20661. t.gatewayClient.stopChannelMediaRelay().then((function() {
  20662. r && r()
  20663. })).
  20664. catch((function(e) {
  20665. r && r(e)
  20666. }))
  20667. },
  20668. t.getConnectionState = function() {
  20669. var n = o.report.reportApiInvoke(e.sessionId, {
  20670. name: "Client.getConnectionState",
  20671. options: arguments,
  20672. tag: "tracer"
  20673. }),
  20674. r = R.a.connetionStateMap[t.gatewayClient.state];
  20675. return n(),
  20676. r
  20677. },
  20678. t.setClientRole = function(n, r) {
  20679. var a = o.report.reportApiInvoke(e.sessionId, {
  20680. callback: r,
  20681. name: "Client.setClientRole",
  20682. options: arguments,
  20683. tag: "tracer"
  20684. });
  20685. if (Object(k.checkValidEnum)(n, "setClientRole", [B, "audience"]), "rtc" === t.mode) {
  20686. var s = "RTC mode can not use setClientRole";
  20687. return i.
  20688. default.warning("[".concat(t.clientId, "] ").concat(s)),
  20689. a && a(s)
  20690. }
  20691. t.gatewayClient && t.gatewayClient.state === R.a.CONNECTED ? ("audience" === n && (0 === this.highStreamState ? this._unpublish(this.highStream, (function() {
  20692. a && a(null, {
  20693. role: n
  20694. })
  20695. }), (function(e) {
  20696. a && a(e)
  20697. })) : t.gatewayClient.setClientRole("audience", a)), n === B && t.gatewayClient.setClientRole(B, a)) : (t.gatewayClient.role = n, a && a(null, {
  20698. role: n
  20699. }))
  20700. },
  20701. t.getGatewayInfo = function(e) {
  20702. if (t.gatewayClient.state !== R.a.CONNECTED) {
  20703. var n = "Client is not in connected state";
  20704. return i.
  20705. default.error("[".concat(t.clientId, "] ").concat(n)),
  20706. void e(n)
  20707. }
  20708. t.gatewayClient.getGatewayInfo((function(t) {
  20709. e(null, t)
  20710. }), e)
  20711. },
  20712. t.renewToken = function(n, r, a) {
  20713. var s = o.report.reportApiInvoke(e.sessionId, {
  20714. callback: function(e, t) {
  20715. if (e) return i.
  20716. default.error("Failed to renew token ".concat(e), t),
  20717. a && a(e);
  20718. r && r(t)
  20719. },
  20720. name: "Client.renewToken",
  20721. options: arguments,
  20722. tag: "tracer"
  20723. });
  20724. if (!Object(k.isValidToken)(n)) throw new Error("Invalid token: Token is of the string type .Length of the string: [1,255]. ASCII characters only.");
  20725. return t.gatewayClient ? t.key ? (t.key = n, void t.gatewayClient.renewToken(n, (function(e) {
  20726. return s(null, e)
  20727. }), s)) : (i.
  20728. default.error("[".concat(t.clientId, "] renewToken should not be called before user join")), s(T.
  20729. default.INVALID_OPERATION)):
  20730. (i.
  20731. default.error("[".concat(t.clientId, "] renewToken Failed. GatewayClient not Exist")), s(T.
  20732. default.INVALID_OPERATION))
  20733. },
  20734. t.setLowStreamParameter = function(n) {
  20735. var r = o.report.reportApiInvoke(e.sessionId, {
  20736. name: "Client.setLowStreamParameter",
  20737. options: arguments,
  20738. tag: "tracer"
  20739. });
  20740. Object(k.checkValidObject)(n, "param");
  20741. var a = n.width,
  20742. s = n.height,
  20743. c = n.framerate,
  20744. d = n.bitrate;
  20745. Object(k.isEmpty)(a) || Object(k.checkValidNumber)(a, "width"),
  20746. Object(k.isEmpty)(s) || Object(k.checkValidNumber)(s, "height"),
  20747. Object(k.isEmpty)(c) || Object(k.checkValidNumber)(c, "framerate"),
  20748. Object(k.isEmpty)(d) || Object(k.checkValidNumber)(d, "bitrate", 1, 1e7),
  20749. (!a && s || a && !s) && i.
  20750. default.warning("[".concat(t.clientId, "] The width and height parameters take effect only when both are set")),
  20751. t.lowStreamParameter = n,
  20752. r()
  20753. },
  20754. t.init = function(t, n, r) {
  20755. var i = o.report.reportApiInvoke(e.sessionId, {
  20756. callback: function(e, t) {
  20757. if (e) return r && r(e);
  20758. n && n(t)
  20759. },
  20760. name: "Client.init",
  20761. options: arguments,
  20762. tag: "tracer"
  20763. });
  20764. Object(k.checkValidString)(t),
  20765. Object(s.isChromeKernel)() && Object(s.getChromeKernelVersion)() <= 48 ? r ? i(T.
  20766. default.BAD_ENVIRONMENT):
  20767. Object(I.popBanTip)():
  20768. (e.appId = t, e.sessionId = Object(I.generateSessionId)(), i())
  20769. },
  20770. t.setTurnServer = function(n) {
  20771. var r = o.report.reportApiInvoke(e.sessionId, {
  20772. name: "Client.setTurnServer",
  20773. options: arguments,
  20774. tag: "tracer"
  20775. });
  20776. if (t.gatewayClient && t.gatewayClient.state !== R.a.DISCONNECTED) throw new Error("Set turn server before join channel");
  20777. if (t.useProxyServer) throw new Error("You have already set the proxy");
  20778. n instanceof Array || (n = [n]);
  20779. var a = [];
  20780. n.map((function(e, n) {
  20781. Object(k.checkValidObject)(e, "turnServer");
  20782. var r = e.turnServerURL,
  20783. o = e.username,
  20784. s = e.password,
  20785. c = e.udpport,
  20786. d = e.forceturn,
  20787. u = e.tcpport;
  20788. if (Object(k.checkValidString)(r, "turnServerURL"), Object(k.checkValidString)(o, "username"), Object(k.checkValidString)(s, "password"), Object(k.checkValidString)(c, "udpport"), 0 === parseInt(c)) throw new Error("udpport should not be ".concat(c));
  20789. Object(k.isEmpty)(d) || Object(k.checkValidBoolean)(d, "forceturn");
  20790. var l = {
  20791. mode: "manual"
  20792. };
  20793. if (l.url = r, l.udpport = c, l.username = o, l.credential = s, l.forceturn = d || !1, !Object(k.isEmpty)(u)) {
  20794. if (Object(k.checkValidString)(u, "tcpport"), 0 === parseInt(u)) throw new Error("tcpport should not be ".concat(u));
  20795. l.tcpport = u,
  20796. i.
  20797. default.info("[".concat(t.clientId, "] Set turnserver[").concat(n, "] tcpurl. ").concat(l.url, ":").concat(l.tcpport))
  20798. }
  20799. i.
  20800. default.info("[".concat(t.clientId, "] Set turnserver[").concat(n, "] udpurl. ").concat(l.url, ":").concat(l.udpport, ",username: ").concat(l.username)),
  20801. a.push(l)
  20802. })),
  20803. t.turnServers = a,
  20804. r()
  20805. },
  20806. t.setProxyServer = function(n) {
  20807. var r = o.report.reportApiInvoke(e.sessionId, {
  20808. name: "Client.setProxyServer",
  20809. options: arguments,
  20810. tag: "tracer"
  20811. });
  20812. if (t.gatewayClient && t.gatewayClient.state !== R.a.DISCONNECTED) throw new Error("Set proxy server before join channel");
  20813. if (!n) throw new Error("Do not set the proxyServer parameter as empty");
  20814. if (t.useProxyServer) throw new Error("You have already set the proxy");
  20815. Object(k.checkValidString)(n, "proxyServer"),
  20816. t.proxyServer = n,
  20817. o.report.setProxyServer(n),
  20818. i.
  20819. default.setProxyServer(n),
  20820. r()
  20821. },
  20822. t.startProxyServer = function(n) {
  20823. var r = o.report.reportApiInvoke(e.sessionId, {
  20824. name: "Client.startProxyServer",
  20825. options: arguments,
  20826. tag: "tracer"
  20827. });
  20828. if (t.gatewayClient && t.gatewayClient.state !== R.a.DISCONNECTED) throw new Error("Start proxy server before join channel");
  20829. if (t.proxyServer) throw new Error("You have already set the proxy");
  20830. t.useProxyServer = !0,
  20831. t.proxyServerType = n || 1,
  20832. r()
  20833. },
  20834. t.stopProxyServer = function() {
  20835. var n = o.report.reportApiInvoke(e.sessionId, {
  20836. name: "Client.stopProxyServer",
  20837. options: arguments,
  20838. tag: "tracer"
  20839. });
  20840. if (t.gatewayClient && t.gatewayClient.state !== R.a.DISCONNECTED) throw new Error("Stop proxy server after leave channel");
  20841. o.report.setProxyServer(),
  20842. i.
  20843. default.setProxyServer(),
  20844. t.turnServers = [],
  20845. t.proxyServer = null,
  20846. t.useProxyServer = !1,
  20847. t.proxyServerType = null,
  20848. n()
  20849. },
  20850. t.setEncryptionSecret = function(n) {
  20851. var r = o.report.reportApiInvoke(e.sessionId, {
  20852. name: "Client.setEncryptionSecret",
  20853. options: arguments,
  20854. tag: "tracer"
  20855. });
  20856. Object(k.checkValidString)(n, "password"),
  20857. t.aespassword = n,
  20858. r()
  20859. },
  20860. t.setEncryptionMode = function(n) {
  20861. var r = o.report.reportApiInvoke(e.sessionId, {
  20862. name: "Client.setEncryptionMode",
  20863. options: arguments,
  20864. tag: "tracer"
  20865. });
  20866. if (Object(k.checkValidString)(n, "encryptionMode"), -1 === v.indexOf(n)) throw new Error('Invalid encryptionMode: encryptionMode should be "aes-128-xts" | "aes-256-xts" | "aes-128-ecb" | "sm4-128-ecb"');
  20867. t.aesmode = n,
  20868. r()
  20869. },
  20870. t.configPublisher = function(n) {
  20871. var r = o.report.reportApiInvoke(e.sessionId, {
  20872. name: "Client.configPublisher",
  20873. options: arguments,
  20874. tag: "tracer"
  20875. });
  20876. Object(k.checkValidObject)(n, "config");
  20877. var i = n.width,
  20878. a = n.height,
  20879. s = n.framerate,
  20880. c = n.bitrate,
  20881. d = n.publisherUrl;
  20882. Object(k.checkValidNumber)(i, "width"),
  20883. Object(k.checkValidNumber)(a, "height"),
  20884. Object(k.checkValidNumber)(s, "framerate"),
  20885. Object(k.checkValidNumber)(c, "bitrate", 1, 1e7),
  20886. d && Object(k.checkValidString)(d, "publisherUrl"),
  20887. t.gatewayClient.configPublisher(n),
  20888. r()
  20889. },
  20890. t.enableDualStream = function(n, r) {
  20891. var a = o.report.reportApiInvoke(e.sessionId, {
  20892. callback: function(e, t) {
  20893. if (e) return r && r(e);
  20894. n && n(t)
  20895. },
  20896. name: "Client.enableDualStream",
  20897. options: arguments,
  20898. tag: "tracer"
  20899. });
  20900. return "iOS" === Object(s.getBrowserOS)() ? (o.report.streamSwitch(e.sessionId, {
  20901. lts: (new Date).getTime(),
  20902. isdual: !0,
  20903. succ: !1
  20904. }), a(T.
  20905. default.IOS_NOT_SUPPORT)):
  20906. Object(s.isWeChatBrowser)() ? (o.report.streamSwitch(e.sessionId, {
  20907. lts: (new Date).getTime(),
  20908. isdual: !0,
  20909. succ: !1
  20910. }), a(T.
  20911. default.WECHAT_NOT_SUPPORT)):
  20912. (o.report.streamSwitch(e.sessionId, {
  20913. lts: (new Date).getTime(),
  20914. isdual: !0,
  20915. succ: !0
  20916. }), t.isDualStream = !0, t.highStream && (t.highStream.isDualStream = !0), void(0 === t.highStreamState ? t._publishLowStream((function(e) {
  20917. return a(null, e)
  20918. }), (function(e) {
  20919. i.
  20920. default.warning("[".concat(t.clientId, "]"), e),
  20921. a(T.
  20922. default.ENABLE_DUALSTREAM_FAILED)
  20923. })):
  20924. 1 === t.highStreamState ? a(T.
  20925. default.STILL_ON_PUBLISHING):
  20926. a(null)))
  20927. },
  20928. t.disableDualStream = function(n, r) {
  20929. var a = o.report.reportApiInvoke(e.sessionId, {
  20930. callback: function(e, t) {
  20931. if (e) return r && r(e);
  20932. n && n(t)
  20933. },
  20934. name: "Client.disableDualStream",
  20935. options: arguments,
  20936. tag: "tracer"
  20937. });
  20938. o.report.streamSwitch(e.sessionId, {
  20939. lts: (new Date).getTime(),
  20940. isdual: !1,
  20941. succ: !0
  20942. }),
  20943. t.isDualStream = !1,
  20944. t.highStream && (t.highStream.isDualStream = !1),
  20945. 0 === t.highStreamState ? t._unpublishLowStream((function() {
  20946. t.highStream.lowStream = null,
  20947. a()
  20948. }), (function(e) {
  20949. i.
  20950. default.warning("[".concat(t.clientId, "]"), e),
  20951. a(T.
  20952. default.DISABLE_DUALSTREAM_FAILED)
  20953. })):
  20954. 1 === t.highStreamState ? a(T.
  20955. default.STILL_ON_PUBLISHING):
  20956. a()
  20957. },
  20958. t._getLowStream = function(e, n) {
  20959. t.lowStream ? e(t.lowStream) : t._createLowStream((function(n) {
  20960. t.lowStream = n,
  20961. e(t.lowStream)
  20962. }), n)
  20963. },
  20964. t._createLowStream = function(e, n) {
  20965. if (t.highStream && t.highStream.stream) {
  20966. var r = y()({},
  20967. t.highStream.params);
  20968. if (r.streamID += 1, r.audio = !1, r.video) if (t.highStream.stream.getVideoTracks()[0]) {
  20969. var i = new u.a(r);
  20970. if (i.isLowStream = !0, i.streamId = t.highStream.getId() + 1, t.lowStreamParameter) {
  20971. var o = y()({},
  20972. t.lowStreamParameter);
  20973. o.width && o.height || (o.width = 160, o.height = 120),
  20974. o.framerate = o.framerate || 15,
  20975. o.bitrate = o.bitrate || 50,
  20976. i.setVideoProfileCustomPlus(o)
  20977. } else i.setVideoProfileCustom(function(e) {
  20978. var t;
  20979. switch (e) {
  20980. case "120p":
  20981. case "120p_1":
  20982. t = ["120p_1", "120p_1", "120p_1"];
  20983. break;
  20984. case "120p_3":
  20985. t = ["120p_3", "120p_3", "120p_3"];
  20986. break;
  20987. case "180p":
  20988. case "180p_1":
  20989. t = ["90p_1", "90p_1", "180p_1"];
  20990. break;
  20991. case "180p_3":
  20992. t = ["120p_3", "120p_3", "180p_3"];
  20993. break;
  20994. case "180p_4":
  20995. t = ["120p_1", "120p_1", "180p_4"];
  20996. break;
  20997. case "240p":
  20998. case "240p_1":
  20999. t = ["120p_1", "120p_1", "240p_1"];
  21000. break;
  21001. case "240p_3":
  21002. t = ["120p_3", "120p_3", "240p_3"];
  21003. break;
  21004. case "240p_4":
  21005. t = ["120p_4", "120p_4", "240p_4"];
  21006. break;
  21007. case "360p":
  21008. case "360p_1":
  21009. case "360p_4":
  21010. case "360p_9":
  21011. case "360p_10":
  21012. case "360p_11":
  21013. t = ["90p_1", "90p_1", "360p_1"];
  21014. break;
  21015. case "360p_3":
  21016. case "360p_6":
  21017. t = ["120p_3", "120p_3", "360p_3"];
  21018. break;
  21019. case "360p_7":
  21020. case "360p_8":
  21021. t = ["120p_1", "120p_1", "360p_7"];
  21022. break;
  21023. case "480p":
  21024. case "480p_1":
  21025. case "480p_2":
  21026. case "480p_4":
  21027. case "480p_10":
  21028. t = ["120p_1", "120p_1", "480p_1"];
  21029. break;
  21030. case "480p_3":
  21031. case "480p_6":
  21032. t = ["120p_3", "120p_3", "480p_3"];
  21033. break;
  21034. case "480p_8":
  21035. case "480p_9":
  21036. t = ["120p_4", "120p_4", "480p_8"];
  21037. break;
  21038. case "720p":
  21039. case "720p_1":
  21040. case "720p_2":
  21041. case "720p_3":
  21042. t = ["90p_1", "90p_1", "720p_1"];
  21043. break;
  21044. case "720p_5":
  21045. case "720p_6":
  21046. t = ["120p_1", "120p_1", "720p_5"];
  21047. break;
  21048. case "1080p":
  21049. case "1080p_1":
  21050. case "1080p_2":
  21051. case "1080p_3":
  21052. case "1080p_5":
  21053. t = ["90p_1", "90p_1", "1080p_1"];
  21054. break;
  21055. case "1440p":
  21056. case "1440p_1":
  21057. case "1440p_2":
  21058. t = ["90p_1", "90p_1", "1440p_1"];
  21059. break;
  21060. case "4k":
  21061. case "4k_1":
  21062. case "4k_3":
  21063. t = ["90p_1", "90p_1", "4k_1"];
  21064. break;
  21065. default:
  21066. t = ["120p_1", "120p_1", "360p_7"]
  21067. }
  21068. return Object(s.isOpera)() ? [e, 15, 50] : Object(s.isFireFox)() ? [t[1], 15, 100] : Object(s.isSafari)() ? [t[2], 15, 50] : [t[0], 15, 50]
  21069. } (t.highStream.profile));
  21070. try {
  21071. console.log(i.videoConstraint);
  21072. var a = j()(t.highStream, {
  21073. width: i.videoConstraint.width.ideal,
  21074. height: i.videoConstraint.height.ideal,
  21075. framerate: i.videoConstraint.frameRate
  21076. });
  21077. return i.stream = a,
  21078. t.highStream.lowStream = i,
  21079. t.highStream.userMuteVideo && i.muteVideo(),
  21080. e && e(i)
  21081. } catch(e) {
  21082. return n && n(e)
  21083. }
  21084. } else n && n(T.
  21085. default.HIGH_STREAM_NOT_VIDEO_TRACE);
  21086. else n && n(T.
  21087. default.HIGH_STREAM_NOT_VIDEO_TRACE)
  21088. } else n && n(T.
  21089. default.HIGH_STREAM_NOT_VIDEO_TRACE)
  21090. },
  21091. t._publishLowStream = function(e, n) {
  21092. return 2 !== t.lowStreamState ? n && n(T.
  21093. default.LOW_STREAM_ALREADY_PUBLISHED):
  21094. t.highStream && t.highStream.hasScreen() ? n && n(T.
  21095. default.SHARING_SCREEN_NOT_SUPPORT):
  21096. void t._getLowStream((function(r) {
  21097. t.lowStreamState = 1,
  21098. t.gatewayClient.publish(r, {
  21099. streamType: 1
  21100. },
  21101. (function() {
  21102. t.lowStreamState = 0,
  21103. e && e()
  21104. }), (function(e) {
  21105. 1 === t.lowStreamState && (t.lowStreamState = 2),
  21106. i.
  21107. default.debug("[".concat(t.clientId, "] publish low stream failed")),
  21108. n && n(e)
  21109. }))
  21110. }), n)
  21111. },
  21112. t._unpublishLowStream = function(e, n) {
  21113. if (0 !== t.lowStreamState) return n && n(T.
  21114. default.LOW_STREAM_NOT_YET_PUBLISHED);
  21115. t.lowStream && (t.gatewayClient.unpublish(t.lowStream, {
  21116. streamType: 1
  21117. },
  21118. (function() {}), (function(e) {
  21119. i.
  21120. default.debug("[".concat(t.clientId, "] unpublish low stream failed")),
  21121. n && n(e)
  21122. })), t.lowStream.close(), t.lowStream = null, t.lowStreamState = 2, e && e())
  21123. },
  21124. t.join = function(n, r, a, s, c, d) {
  21125. s && "function" == typeof s && (d = c, c = s, s = null);
  21126. var u = o.report.reportApiInvoke(e.sessionId, {
  21127. callback: function(e, t) {
  21128. if (e) return d && d(e);
  21129. c && c(t)
  21130. },
  21131. name: "Client.join",
  21132. options: arguments,
  21133. tag: "tracer"
  21134. });
  21135. if (n && !Object(k.isValidToken)(n)) return i.
  21136. default.warning("[".concat(t.clientId, "] Param channelKey should be string")),
  21137. u(T.
  21138. default.INVALID_PARAMETER);
  21139. if (!Object(k.isValidChannelName)(r)) return i.
  21140. default.error("Invalid Channel Name ".concat(r)),
  21141. i.
  21142. default.warning("[".concat(t.clientId, "] The length must be within 64 bytes. The supported characters: a-z,A-Z,0-9,space,!, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~, ,")),
  21143. u(T.
  21144. default.INVALID_PARAMETER);
  21145. if ("string" == typeof r && "" === r) return i.
  21146. default.warning("[".concat(t.clientId, "] Param channel should not be empty")),
  21147. u(T.
  21148. default.INVALID_PARAMETER);
  21149. if (s && !Object(k.isValidString)(s)) return i.
  21150. default.warning("[".concat(t.clientId, "] optionalInfo should be string")),
  21151. u(T.
  21152. default.INVALID_PARAMETER);
  21153. if (a && !Object(I.is32Uint)(a) && !Object(k.isValidString)(a, 1, 255)) return i.
  21154. default.error("Invalid UID ".concat(a, " ").concat(_()(a))),
  21155. i.
  21156. default.warning("[".concat(t.clientId, "] [String uid] Length of the string: [1,255]. ASCII characters only. [Number uid] The value range is [0,10000]")),
  21157. u(T.
  21158. default.INVALID_PARAMETER);
  21159. if ("string" == typeof a && 0 == a.length) return i.
  21160. default.warning("[".concat(t.clientId, "] String uid should not be empty")),
  21161. u(T.
  21162. default.INVALID_PARAMETER);
  21163. if ("string" == typeof a && a.length > 256) return i.
  21164. default.warning("[".concat(t.clientId, "] Length of string uid should be less than 255")),
  21165. u(T.
  21166. default.INVALID_PARAMETER);
  21167. t.highStream = null,
  21168. t.lowStream = null,
  21169. t.lowStreamParameter = null,
  21170. t.isDualStream = !1,
  21171. t.highStreamState = 2,
  21172. t.lowStreamState = 2;
  21173. var l = Date.now(),
  21174. p = setTimeout((function() {
  21175. if (1 != t.gatewayClient.hasJoined) {
  21176. i.
  21177. default.debug("[".concat(t.clientId, "] The time to join the channel is greater than 5 seconds "));
  21178. var n = Date.now();
  21179. o.report.joinChannelTimeOut({
  21180. lts: n,
  21181. sid: e.sessionId,
  21182. cname: r,
  21183. cid: f.cid,
  21184. uid: f.uid || ("string" == typeof a ? void 0 : a),
  21185. elapse: n - l,
  21186. timeout: 5
  21187. })
  21188. }
  21189. }), 5e3),
  21190. f = {
  21191. clientId: t.clientId,
  21192. appId: e.appId,
  21193. sid: e.sessionId,
  21194. cname: r,
  21195. uid: a,
  21196. turnServers: t.turnServers.concat(),
  21197. proxyServer: t.proxyServer,
  21198. token: n || e.appId,
  21199. useProxyServer: t.useProxyServer,
  21200. proxyServerType: t.proxyServerType,
  21201. optionalInfo: s
  21202. };
  21203. if ("string" == typeof a && (f.stringUid = a, t.uintUid ? (f.uid = t.uintUid, delete t.uintUid) : f.uid = 0), t.aespassword && "none" !== t.aesmode && y()(f, {
  21204. aespassword: t.aespassword,
  21205. aesmode: t.aesmode
  21206. }), o.report.sessionInit(e.sessionId, {
  21207. lts: (new Date).getTime(),
  21208. cname: r,
  21209. appid: e.appId,
  21210. mode: e.mode,
  21211. succ: !0
  21212. }), t.onSuccess = function(e) {
  21213. clearTimeout(p),
  21214. t.rtcStatsCollector.startNetworkQualityTimer(),
  21215. t.onSuccess = null,
  21216. u(null, e)
  21217. },
  21218. t.onFailure = function(e) {
  21219. return u(e)
  21220. },
  21221. t.channel = r, t.gatewayClient.state !== R.a.DISCONNECTED) return i.
  21222. default.error("[".concat(t.clientId, "] Client already in connecting/connected state")),
  21223. u(T.
  21224. default.INVALID_OPERATION),
  21225. void o.report.joinGateway(e.sessionId, {
  21226. lts: Date.now(),
  21227. succ: !1,
  21228. ec: T.
  21229. default.INVALID_OPERATION,
  21230. addr: null
  21231. });
  21232. t.gatewayClient.state = R.a.CONNECTING;
  21233. var g = function(o, a) {
  21234. i.
  21235. default.info("[".concat(t.clientId, "] Joining channel: ").concat(r)),
  21236. t.gatewayClient.dispatchEvent({
  21237. type: "config-distribute",
  21238. config: a,
  21239. joinInfo: f
  21240. }),
  21241. t.key = n || e.appId,
  21242. f.cid = o.cid,
  21243. f.uid || (f.uid = o.uid),
  21244. f.vid = o.vid,
  21245. f.clientId = t.clientId,
  21246. f.apResponse = o.res,
  21247. o.uni_lbs_ip && o.uni_lbs_ip[1] && (f.uni_lbs_ip = o.uni_lbs_ip[1]),
  21248. f.gatewayAddr = o.gateway_addr,
  21249. t.joinInfo = f,
  21250. t.gatewayClient.join(f, t.key, (function(e) {
  21251. i.
  21252. default.info("[".concat(t.clientId, "] Join channel ").concat(r, " success, join with uid: ").concat(e, ".")),
  21253. t.onSuccess = null,
  21254. t.rtcStatsCollector.startNetworkQualityTimer(),
  21255. u(null, e)
  21256. }), (function(e) {
  21257. return u(e)
  21258. }))
  21259. };
  21260. f.stringUid && !f.uid ? (t.userAccountReq && !t.userAccountReq.isFinished() && t.userAccountReq.cancel(), t.userAccountReq = Object(A.getUserAccount)(f, t.gatewayClient), t.userAccountReq.then((function(e) {
  21261. i.
  21262. default.debug("getUserAccount Success ".concat(e.url, " ").concat(f.stringUid, " => ").concat(e.uid)),
  21263. f.uid = e.uid,
  21264. Object(A.getGatewayList)(f, g, (function(e) {
  21265. return u(e)
  21266. }))
  21267. })).
  21268. catch((function(e) {
  21269. i.
  21270. default.error("getUserAccount rejected", e),
  21271. u(e)
  21272. }))) : Object(A.getGatewayList)(f, g, (function(e) {
  21273. return u(e)
  21274. }))
  21275. },
  21276. t.renewChannelKey = function(n, r, a) {
  21277. var s = o.report.reportApiInvoke(e.sessionId, {
  21278. callback: function(e, t) {
  21279. if (e) return a && a(e);
  21280. r && r(t)
  21281. },
  21282. name: "Client.renewChannelKey",
  21283. options: arguments,
  21284. tag: "tracer"
  21285. });
  21286. Object(k.checkValidString)(n, "key", 1, 2047),
  21287. void 0 === t.key ? (i.
  21288. default.error("[".concat(t.clientId, "] renewChannelKey should not be called before user join")), s(T.
  21289. default.INVALID_OPERATION)):
  21290. (t.key = n, t.gatewayClient.joinInfo.token = n, t.gatewayClient.key = n, t.gatewayClient.recover(), s())
  21291. },
  21292. t.leave = function(n, a) {
  21293. t.gatewayClient.isFirstSuccess = !0,
  21294. t.gatewayClient.hasInvokeLeave = !0;
  21295. var s = !1,
  21296. c = o.report.reportApiInvoke(e.sessionId, {
  21297. callback: function(e, r) {
  21298. if (e) return a && a(e);
  21299. t.gatewayClient.reconnectingCS = !1,
  21300. t.gatewayClient.state = R.a.DISCONNECTED,
  21301. clearTimeout(Object(A._getReconnectCSTimer)(t.clientId)),
  21302. t._renewSession(),
  21303. t.rtcStatsCollector.clearNetworkQualityTimer(),
  21304. n && n(r)
  21305. },
  21306. name: "Client.leave",
  21307. options: arguments,
  21308. tag: "tracer"
  21309. });
  21310. i.
  21311. default.info("[".concat(t.clientId, "] Leaving channel")),
  21312. t.userAccountReq && !t.userAccountReq.isFinished() && (t.userAccountReq.cancel(), t.gatewayClient.state === R.a.CONNECTING && (t.gatewayClient.state = R.a.DISCONNECTED)),
  21313. t.gatewayClient.leave((function(e) {
  21314. s = !0,
  21315. c(null, e)
  21316. }), c),
  21317. setTimeout((function() {
  21318. s || (t.gatewayClient.socket && (t.gatewayClient.socket.close(), t.gatewayClient.socket = null), t.gatewayClient.state = R.a.DISCONNECTED, c(null, "LEAVE_MSG_TIMEOUT"))
  21319. }), Object(r.getParameter)("LEAVE_MSG_TIMEOUT"))
  21320. },
  21321. t._renewSession = function() {
  21322. var n = Object(I.generateSessionId)();
  21323. if (i.
  21324. default.debug("renewSession ".concat(e.sessionId, " => ").concat(n)), e.sessionId = n, t.gatewayClient.peerPublishDurationMap.clear(), t.joinInfo && (t.joinInfo.sid = n), t.gatewayClient && (t.gatewayClient.joinInfo && (t.gatewayClient.joinInfo.sid = n), t.gatewayClient.localStreams)) for (var r in t.gatewayClient.localStreams) {
  21325. var o = t.gatewayClient.localStreams[r];
  21326. o && (o.sid = n)
  21327. }
  21328. },
  21329. t._publish = function(n, o, a, s) {
  21330. if (2 !== t.highStreamState) return i.
  21331. default.warning("[".concat(t.clientId, "] Can't publish stream when stream already publish ").concat(n.getId())),
  21332. a && a(T.
  21333. default.STREAM_ALREADY_PUBLISHED);
  21334. if (0 === t.turnServers.length && Object(r.getParameter)("FORCE_TURN") && !Object(r.getParameter)("TURN_ENABLE_TCP") && !Object(r.getParameter)("TURN_ENABLE_UDP")) throw new Error("force TURN With No TURN Configuration");
  21335. i.
  21336. default.info("[".concat(t.clientId, "] Publishing stream, uid ").concat(n.getId())),
  21337. t.highStream = n,
  21338. t.highStreamState = 1,
  21339. t.highStream.streamId = t.joinInfo.stringUid || t.joinInfo.uid,
  21340. t.hasPublished = !1;
  21341. var c = function(n, r, o) {
  21342. t.gatewayClient.publish(n, {
  21343. streamType: 0
  21344. },
  21345. (function() {
  21346. n.sid = e.sessionId,
  21347. t.highStreamState = 0,
  21348. i.
  21349. default.info("[".concat(t.clientId, "] Publish success, uid: ").concat(n.getId())),
  21350. t.highStream && (t.highStream.isDualStream = t.isDualStream),
  21351. t.isDualStream ? t._publishLowStream((function() {
  21352. r && r()
  21353. }), (function(e) {
  21354. i.
  21355. default.warning("[".concat(t.clientId, "] "), e),
  21356. U.a.replaceWithCanvasTrack(n).then((function() {
  21357. r && r()
  21358. }))
  21359. })) : U.a.replaceWithCanvasTrack(n).then((function() {
  21360. r && r()
  21361. }))
  21362. }), o)
  21363. };
  21364. "audience" !== t.gatewayClient.role || "live" !== t.mode || s ? c(n, o, a) : t.gatewayClient.setClientRole(B, (function(e) {
  21365. if (e) return a && a(e);
  21366. c(n, o, a)
  21367. }))
  21368. },
  21369. t._unpublish = function(e, n, r, o) {
  21370. if (0 !== t.highStreamState) return i.
  21371. default.warning("[".concat(t.clientId, "] Can't unpublish stream when stream not publish")),
  21372. r && r(T.
  21373. default.STREAM_NOT_YET_PUBLISHED);
  21374. i.
  21375. default.info("[".concat(t.clientId, "] Unpublish stream, uid ").concat(e.getId()));
  21376. var a = function(e, n, r) {
  21377. t.isDualStream && t.lowStream && t._unpublishLowStream(null, r),
  21378. t.gatewayClient.unpublish(e, {
  21379. streamType: 0
  21380. },
  21381. (function() {
  21382. t.highStreamState = 2,
  21383. i.
  21384. default.info("[".concat(t.clientId, "] Unpublish stream success, uid: ").concat(e.getId())),
  21385. n && n()
  21386. }), (function(n) {
  21387. i.
  21388. default.info("[".concat(t.clientId, "] Unpublish stream fail, uid: ").concat(e.getId())),
  21389. r && r(n)
  21390. }))
  21391. };
  21392. t.gatewayClient.role !== B || "live" !== t.mode || o ? a(e, n, r) : t.gatewayClient.setClientRole("audience", (function(t) {
  21393. if (t) return r && r(t);
  21394. a(e, n, r)
  21395. }))
  21396. },
  21397. t.publish = function(n, r) {
  21398. var i = o.report.reportApiInvoke(e.sessionId, {
  21399. callback: function(e, n) {
  21400. if (e) return 1 === t.highStreamState && (t.highStreamState = 2),
  21401. r && r(e)
  21402. },
  21403. name: "Client.publish",
  21404. tag: "tracer",
  21405. options: {
  21406. stream: "too long to show",
  21407. onFailure: !!r
  21408. }
  21409. });
  21410. 2 === t.highStreamState ? n._hasVideoTracks() || n._hasAudioTracks() ? (t.gatewayClient.publishRequestId = Object(I.generateId)(), t._publish(n, (function(e) {
  21411. return i(null, e)
  21412. }), (function(e) {
  21413. return i(e)
  21414. }))) : i(T.
  21415. default.NO_TRACK_IN_STREAM):
  21416. i(T.
  21417. default.STREAM_ALREADY_PUBLISHED)
  21418. },
  21419. t.unpublish = function(n, r, i) {
  21420. var a = o.report.reportApiInvoke(e.sessionId, {
  21421. callback: function(e, t) {
  21422. if (e) return r && r(e);
  21423. i && i(t)
  21424. },
  21425. name: "Client.unpublish",
  21426. tag: "tracer",
  21427. options: {
  21428. stream: "too long to show",
  21429. onFailure: !!r
  21430. }
  21431. });
  21432. 0 === t.highStreamState ? (t.gatewayClient.publishRequestId = null, t._unpublish(n, (function(e) {
  21433. return a(null, e)
  21434. }), (function(e) {
  21435. return a(e)
  21436. }))) : a(T.
  21437. default.STREAM_NOT_YET_PUBLISHED)
  21438. },
  21439. t.subscribe = function(n, r, a) {
  21440. var c = o.report.reportApiInvoke(e.sessionId, {
  21441. callback: function(e, t) {
  21442. if (e) return a && a(e)
  21443. },
  21444. name: "Client.subscribe",
  21445. tag: "tracer",
  21446. options: {
  21447. stream: "too long to show",
  21448. options: r,
  21449. onFailure: !!a
  21450. }
  21451. });
  21452. "function" == typeof r && (a = r, r = null),
  21453. Object(k.checkValidObject)(n, "stream"),
  21454. Object(k.isEmpty)(r) || (Object(k.checkValidObject)(r, "options"), Object(k.isEmpty)(r.video) || Object(k.checkValidBoolean)(r.video, "options.video"), Object(k.isEmpty)(r.audio) || Object(k.checkValidBoolean)(r.audio, "options.audio"));
  21455. var d = {
  21456. video: !0,
  21457. audio: !0
  21458. };
  21459. if (!Object(k.isEmpty)(r)) {
  21460. if (Object(s.isSafari)() && (!r.video || !r.audio)) {
  21461. var u = "SAFARI_NOT_SUPPORTED_FOR_TRACK_SUBSCRIPTION";
  21462. return i.
  21463. default.error("[".concat(t.clientId, "] "), u),
  21464. void c(u)
  21465. }
  21466. if (!Object(k.isEmpty)(r.video) && !Object(k.isValidBoolean)(r.video) || !Object(k.isEmpty)(r.audio) && !Object(k.isValidBoolean)(r.audio) || !1 === r.audio && !1 === r.video) {
  21467. u = "INVALID_PARAMETER ".concat(JSON.stringify(r));
  21468. return i.
  21469. default.error("[".concat(t.clientId, "] "), u),
  21470. void c(u)
  21471. }
  21472. }
  21473. n.subscribeOptions ? (y()(n.subscribeOptions, d, r), t.gatewayClient.subscribeChange(n, (function(e) {
  21474. return c(null, e)
  21475. }), c)) : (t.gatewayClient.subscribeRequestId.set(n.getId(), Object(I.generateId)()), n.subscribeOptions = y()({},
  21476. d, r), t.gatewayClient.subscribe(n, (function(e) {
  21477. return c(null, e)
  21478. }), c))
  21479. },
  21480. t.unsubscribe = function(n, r) {
  21481. var a = o.report.reportApiInvoke(e.sessionId, {
  21482. callback: function(e, t) {
  21483. if (e) return r && r(e)
  21484. },
  21485. name: "Client.unsubscribe",
  21486. tag: "tracer",
  21487. options: {
  21488. stream: "too long to show",
  21489. onFailure: !!r
  21490. }
  21491. });
  21492. i.
  21493. default.info("[".concat(t.clientId, "] Unsubscribe stream, uid: ").concat(n.getId())),
  21494. t.gatewayClient.subscribeRequestId.delete(n.getId()),
  21495. t.gatewayClient.unsubscribe(n, (function(e) {
  21496. return a(null, e)
  21497. }), a)
  21498. },
  21499. t.setRemoteVideoStreamType = function(n, r) {
  21500. var i = o.report.reportApiInvoke(e.sessionId, {
  21501. name: "Client.setRemoteVideoStreamType",
  21502. tag: "tracer",
  21503. options: {
  21504. stream: "too long to show",
  21505. streamType: r
  21506. }
  21507. });
  21508. Object(k.checkValidEnum)(r, "streamType", [0, 1]),
  21509. t.gatewayClient.setRemoteVideoStreamType(n, r),
  21510. i()
  21511. },
  21512. t.setStreamFallbackOption = function(n, r) {
  21513. var i = o.report.reportApiInvoke(e.sessionId, {
  21514. name: "Client.setStreamFallbackOption",
  21515. tag: "tracer",
  21516. options: {
  21517. stream: "too long to show",
  21518. fallbackType: r
  21519. }
  21520. });
  21521. Object(k.checkValidEnum)(r, "fallbackType", [0, 1, 2]),
  21522. t.gatewayClient.setStreamFallbackOption(n, r),
  21523. i()
  21524. },
  21525. t.enableAudioVolumeIndicator = function(n, r) {
  21526. var a = o.report.reportApiInvoke(e.sessionId, {
  21527. name: "Client.enableAudioVolumeIndicator",
  21528. options: arguments,
  21529. tag: "tracer"
  21530. });
  21531. n = n || 2e3,
  21532. r = r || 3,
  21533. Object(k.checkValidNumber)(r, "smooth", 1, 100),
  21534. Object(k.checkValidNumber)(n, "interval", 50, 1e5),
  21535. t.audioVolumeIndication = t.audioVolumeIndication || {
  21536. enabled: !0
  21537. },
  21538. t.audioVolumeIndication.interval = n,
  21539. t.audioVolumeIndication.smooth = r,
  21540. t.audioVolumeIndication = {
  21541. interval: n,
  21542. smooth: r
  21543. },
  21544. i.
  21545. default.info("[".concat(t.clientId, "] enableAudioVolumeIndicator interval ").concat(n, " smooth ").concat(r)),
  21546. t.gatewayClient.enableAudioVolumeIndicator(n, r),
  21547. a()
  21548. },
  21549. t.getNetworkStats = function(e, n) {
  21550. return i.
  21551. default.deprecate("[".concat(t.clientId, "] client.getNetworkStats is deprecated. Use client.getTransportStats instead.")),
  21552. M.getStats(e, n)
  21553. },
  21554. t.getSystemStats = function(e, t) {
  21555. return d.getStats(e, t)
  21556. },
  21557. t.getRecordingDevices = function(e, t) {
  21558. return l.a.getRecordingDevices(e, t)
  21559. },
  21560. t.getPlayoutDevices = function(e, t) {
  21561. return l.a.getPlayoutDevices(e, t)
  21562. },
  21563. t.getCameras = function(e, t) {
  21564. return l.a.getCameras(e, t)
  21565. },
  21566. t.getRemoteAudioStats = function(e, n) {
  21567. return t.rtcStatsCollector.getRemoteAudioStats(e, n)
  21568. },
  21569. t.getLocalAudioStats = function(e, n) {
  21570. return t.rtcStatsCollector.getLocalAudioStats(e, n)
  21571. },
  21572. t.getRemoteVideoStats = function(e, n) {
  21573. return t.rtcStatsCollector.getRemoteVideoStats(e, n)
  21574. },
  21575. t.getLocalVideoStats = function(e, n) {
  21576. return t.rtcStatsCollector.getLocalVideoStats(e, n)
  21577. },
  21578. t._getRemoteVideoQualityStats = function(e, n) {
  21579. return t.rtcStatsCollector.getRemoteVideoQualityStats(e, n)
  21580. },
  21581. t._getRemoteAudioQualityStats = function(e, n) {
  21582. return t.rtcStatsCollector.getRemoteAudioQualityStats(e, n)
  21583. },
  21584. t.getTransportStats = function(e, n) {
  21585. return t.rtcStatsCollector.getTransportStats((function(t) {
  21586. return M.getStats((function(n) {
  21587. var r = y()({},
  21588. t, n);
  21589. e && e(r)
  21590. }), n)
  21591. }), n)
  21592. },
  21593. t.getSessionStats = function(e, n) {
  21594. return t.rtcStatsCollector.getSessionStats(e, n)
  21595. },
  21596. t.onNetworkQuality = function() {
  21597. return t.rtcStatsCollector.onNetworkQuality(onSuccess, onFailure)
  21598. },
  21599. t.sendMetadata = function(n, r) {
  21600. var i = o.report.reportApiInvoke(e.sessionId, {
  21601. name: "Client.sendMetadata",
  21602. tag: "tracer",
  21603. callback: function(e) {
  21604. if (e) return r && r(e);
  21605. r && r()
  21606. }
  21607. });
  21608. t.gatewayClient.sendMetadata(n, i)
  21609. },
  21610. t.sendCustomReportMessage = function(n, a, s, c, d, u) {
  21611. Object(r.getParameter)("CR") ? t.customReportCount > Object(r.getParameter)("CRL") ? u && u("REPORT_LIMITED") : (t.gatewayClient.hasJoined || (i.
  21612. default.WARNING("Should invoke Client.sendCustomReportMessage after join"), u && u("REPORT_BEFORE_JOINED")), t.customReportTimer || (t.customReportTimer = setInterval((function() {
  21613. t.customReportCount = 0
  21614. }), Object(r.getParameter)("CRI"))), Object(k.checkValidString)(n, "reportId", 0, 100, !1), Object(k.checkValidString)(a, "category", 0, 100, !1), Object(k.checkValidString)(s, "event", 0, 100, !1), Object(k.checkValidString)(c, "label", 0, 100, !1), Object(k.checkValidNumber)(d, "value", Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER), t.customReportCount++, o.report.sendCustomReportMessage(e.sessionId, {
  21615. reportId: n,
  21616. category: a,
  21617. event: s,
  21618. label: c,
  21619. value: d,
  21620. lts: Date.now()
  21621. },
  21622. (function(e) {
  21623. e ? u && u("REPORT_FAILED") : u && u()
  21624. }))) : u && u("REPORT_FORBIDDEN")
  21625. },
  21626. e.clientId = t.clientId, t.gatewayClient = Object(R.a)(e), t.listenerLoggerTimer = null, t.listenerLoggerCache = [], t.on = function(e, n) {
  21627. t.gatewayClient.on(e, n),
  21628. t.listenerLoggerCache.push("".concat(e).concat(n.name ? ":" + n.name: "")),
  21629. t.listenerLoggerTimer ? clearTimeout(t.listenerLoggerTimer) : i.
  21630. default.info("[".concat(t.clientId, "] Adding event handler on ").concat(e)),
  21631. t.listenerLoggerTimer = setTimeout((function() {
  21632. t.listenerLoggerCache.length && (t.listenerLoggerTimer = null, i.
  21633. default.info("[".concat(t.clientId, "] Added event handler on ").concat(t.listenerLoggerCache.join(", "))), t.listenerLoggerCache = [])
  21634. }), 0)
  21635. },
  21636. t.off = function(e, n) {
  21637. i.
  21638. default.info("remove event handler from [".concat(e, "]")),
  21639. t.gatewayClient.removeEventListener(e, n)
  21640. },
  21641. t.rtcStatsCollector = function(e) {
  21642. var t = Object(a.b)();
  21643. return t.gatewayClient = e,
  21644. t.exceptionMonitor = new w(e),
  21645. t.localStats = {},
  21646. t.remoteStats = {},
  21647. t.session = {
  21648. sendBytes: 0,
  21649. recvBytes: 0,
  21650. WSSendBytes: 0,
  21651. WSSendBytesDelta: 0,
  21652. WSRecvBytes: 0,
  21653. WSRecvBytesDelta: 0,
  21654. HTTPSendBytes: 0,
  21655. HTTPSendBytesDelta: 0,
  21656. HTTPRecvBytes: 0,
  21657. HTTPRecvBytesDelta: 0
  21658. },
  21659. t.getRemoteAudioStats = function(e) {
  21660. var n = t.gatewayClient.traffic_stats,
  21661. r = {};
  21662. for (var i in t.remoteStats) {
  21663. var o = {},
  21664. a = t.remoteStats[i];
  21665. if (Object(b.b)(o, "End2EndDelay", a.peer_delay && a.peer_delay.audio_delay), Object(b.b)(o, "TransportDelay", a.peer_delay && a.peer_delay.e2e_delay), Object(b.b)(o, "PacketLossRate", a.peer_delay && a.peer_delay.e2e_audio_lost_ratio_400ms), Object(b.b)(o, "RecvLevel", a.audioStats && a.audioStats.audioOutputLevel), Object(b.b)(o, "RecvBitrate", a.audioRecvBitrate), Object(b.b)(o, "CodecType", a.audioStats && a.audioStats.googCodecName), Object(b.b)(o, "MuteState", a.audioDisabled), Object(b.b)(o, "TotalFreezeTime", a.audioStats && a.audioStats.audioTotalFreezeTime), Object(b.b)(o, "TotalPlayDuration", a.audioStats && a.audioStats.audioTotalPlayDuration), n && n.peer_delay) {
  21666. var s = n.peer_delay.find((function(e) {
  21667. return e.peer_uid == i
  21668. }));
  21669. if (s) {
  21670. var c = s.peer_publish_audio_duration + (Date.now() - n.timestamp);
  21671. Object(b.b)(o, "AudioPublishDuration", c)
  21672. } else Object(b.b)(o, "AudioPublishDuration", -1)
  21673. }
  21674. r[i] = o
  21675. }
  21676. e && e(r)
  21677. },
  21678. t.getLocalAudioStats = function(e) {
  21679. var n = {};
  21680. for (var r in t.localStats) {
  21681. var i = {},
  21682. o = t.localStats[r];
  21683. Object(b.b)(i, "RecordingLevel", o.audioStats && o.audioStats.audioInputLevel),
  21684. Object(b.b)(i, "SendLevel", o.audioStats && o.audioStats.totalAudioEnergy),
  21685. Object(b.b)(i, "SamplingRate", o.audioStats && o.audioStats.totalSamplesDuration),
  21686. Object(b.b)(i, "SendBitrate", o.audioSendBitrate),
  21687. Object(b.b)(i, "CodecType", o.audioStats && o.audioStats.googCodecName),
  21688. Object(b.b)(i, "MuteState", o.audioDisabled),
  21689. Object(b.b)(i, "audioSendPacketsLost", o.audioStats && o.audioStats.packetsLost);
  21690. var a = t.gatewayClient.localStreams[r];
  21691. a && a.isPlaying() && Object(b.b)(i, "MuteState", a.userMuteAudio ? "1": "0"),
  21692. n[r] = i
  21693. }
  21694. e && e(n)
  21695. },
  21696. t.getRemoteVideoStats = function(e) {
  21697. var n = t.gatewayClient.traffic_stats,
  21698. r = {};
  21699. for (var i in t.remoteStats) {
  21700. var o = {},
  21701. a = t.remoteStats[i];
  21702. if (Object(b.b)(o, "End2EndDelay", a.peer_delay && a.peer_delay.video_delay), Object(b.b)(o, "TransportDelay", a.peer_delay && a.peer_delay.e2e_delay), Object(b.b)(o, "PacketLossRate", a.peer_delay && a.peer_delay.e2e_video_lost_ratio_400ms), Object(b.b)(o, "RecvBitrate", a.videoRecvBitrate), Object(b.b)(o, "RecvResolutionWidth", a.videoStats && a.videoStats.googFrameWidthReceived), Object(b.b)(o, "RecvResolutionHeight", a.videoStats && a.videoStats.googFrameHeightReceived), Object(b.b)(o, "RenderResolutionWidth", a.videoStats && a.videoStats.renderRemoteWidth), Object(b.b)(o, "RenderResolutionHeight", a.videoStats && a.videoStats.renderRemoteHeight), Object(b.b)(o, "RenderFrameRate", a.videoStats && a.videoStats.googFrameRateOutput), Object(b.b)(o, "MuteState", a.videoDisabled), Object(b.b)(o, "TotalFreezeTime", a.videoStats && a.videoStats.videoTotalFreezeTime), Object(b.b)(o, "TotalPlayDuration", a.videoStats && a.videoStats.videoTotalPlayDuration), n && n.peer_delay) {
  21703. var s = n.peer_delay.find((function(e) {
  21704. return e.peer_uid == i
  21705. }));
  21706. if (s) {
  21707. var c = s.peer_publish_video_duration + (Date.now() - n.timestamp);
  21708. Object(b.b)(o, "VideoPublishDuration", c)
  21709. } else Object(b.b)(o, "VideoPublishDuration", -1)
  21710. }
  21711. r[i] = o
  21712. }
  21713. e && e(r)
  21714. },
  21715. t.getLocalVideoStats = function(e) {
  21716. var n = {};
  21717. for (var r in t.localStats) {
  21718. var i = {},
  21719. o = t.localStats[r];
  21720. Object(b.b)(i, "TargetSendBitrate", o.videoTargetSendBitrate),
  21721. Object(b.b)(i, "SendFrameRate", o.videoStats && o.videoStats.googFrameRateSent),
  21722. Object(b.b)(i, "SendBitrate", o.videoSendBitrate),
  21723. Object(b.b)(i, "SendResolutionWidth", o.videoStats && o.videoStats.googFrameWidthSent),
  21724. Object(b.b)(i, "SendResolutionHeight", o.videoStats && o.videoStats.googFrameHeightSent),
  21725. Object(b.b)(i, "CaptureResolutionWidth", o.videoStats && o.videoStats.googFrameWidthInput),
  21726. Object(b.b)(i, "CaptureResolutionHeight", o.videoStats && o.videoStats.googFrameHeightInput),
  21727. Object(b.b)(i, "EncodeDelay", o.videoStats && o.videoStats.googAvgEncodeMs),
  21728. Object(b.b)(i, "MuteState", o.videoDisabled),
  21729. Object(b.b)(i, "TotalFreezeTime", o.videoStats && o.videoStats.videoTotalFreezeTime),
  21730. Object(b.b)(i, "TotalDuration", o.videoStats && o.videoStats.videoTotalPlayDuration),
  21731. Object(b.b)(i, "CaptureFrameRate", o.videoStats && o.videoStats.googFrameRateSent),
  21732. Object(b.b)(i, "videoSendPacketsLost", o.videoStats && o.videoStats.packetsLost),
  21733. o.videoStats && !o.videoStats.googFrameWidthInput && Object(b.b)(i, "CaptureResolutionWidth", o.videoStats && o.videoStats.renderLocalWidth),
  21734. o.videoStats && !o.videoStats.googFrameHeightInput && Object(b.b)(i, "CaptureResolutionHeight", o.videoStats && o.videoStats.renderLocalHeight),
  21735. n[r] = i
  21736. }
  21737. e && e(n)
  21738. },
  21739. t.getRemoteVideoQualityStats = function(e) {
  21740. var n = {};
  21741. for (var r in t.remoteStats) {
  21742. var i = {},
  21743. o = t.remoteStats[r];
  21744. Object(b.b)(i, "videoReceiveDelay", o.videoStats && o.videoStats.googCurrentDelayMs),
  21745. Object(b.b)(i, "VideoFreezeRate", o.videoStats && o.videoStats.videoFreezeRate),
  21746. Object(b.b)(i, "FirstFrameTime", o.firstFrameTime),
  21747. n[r] = i
  21748. }
  21749. e && e(n)
  21750. },
  21751. t.getRemoteAudioQualityStats = function(e) {
  21752. var n = {};
  21753. for (var r in t.remoteStats) {
  21754. var i = {},
  21755. o = t.remoteStats[r];
  21756. Object(b.b)(i, "audioReceiveDelay", o.audioStats && o.audioStats.googCurrentDelayMs),
  21757. Object(b.b)(i, "AudioFreezeRate", o.videoStats && o.videoStats.videoFreezeRate),
  21758. n[r] = i
  21759. }
  21760. e && e(n)
  21761. },
  21762. t.getTransportStats = function(e) {
  21763. var n = {},
  21764. r = {},
  21765. i = t.gatewayClient.traffic_stats,
  21766. o = i.peer_delay;
  21767. if (Object(b.b)(n, "OutgoingAvailableBandwidth", t.gatewayClient.OutgoingAvailableBandwidth / 1e3), Object(b.b)(n, "RTT", i && 2 * i.access_delay), o) {
  21768. var a, s = L(o);
  21769. try {
  21770. for (s.s(); ! (a = s.n()).done;) {
  21771. var c = a.value;
  21772. c.downlink_estimate_bandwidth && (r[c.peer_uid] = c.downlink_estimate_bandwidth / 1e3 + "")
  21773. }
  21774. } catch(e) {
  21775. s.e(e)
  21776. } finally {
  21777. s.f()
  21778. }
  21779. }
  21780. n.IncomingAvailableBandwidth = r,
  21781. e && e(n)
  21782. },
  21783. t.getSessionStats = function(e) {
  21784. var n = {},
  21785. r = t.gatewayClient.traffic_stats,
  21786. i = t.gatewayClient.socket,
  21787. o = 0,
  21788. a = 0;
  21789. for (var s in t.remoteStats) { (c = t.remoteStats[s]) && c.videoStats && c.videoStats.videoRecvBytesDelta && (a += parseInt(c.videoStats.videoRecvBytesDelta)),
  21790. c && c.audioStats && c.audioStats.audioRecvBytesDelta && (a += parseInt(c.audioStats.audioRecvBytesDelta))
  21791. }
  21792. for (var s in t.localStats) {
  21793. var c; (c = t.localStats[s]) && c.videoStats && c.videoStats.videoSendBytesDelta && (o += parseInt(c.videoStats.videoSendBytesDelta)),
  21794. c && c.audioStats && c.audioStats.audioSendBytesDelta && (o += parseInt(c.audioStats.audioSendBytesDelta))
  21795. }
  21796. var d = o + t.session.WSSendBytesDelta + t.session.HTTPSendBytesDelta,
  21797. u = a + t.session.WSRecvBytesDelta + t.session.HTTPRecvBytesDelta,
  21798. l = t.session.sendBytes + Object(O.getHTTPSendBytes)(),
  21799. p = t.session.recvBytes + Object(O.getHTTPRecvBytes)();
  21800. t.gatewayClient.socket && t.gatewayClient.socket.state === t.gatewayClient.CONNECTED && (l += i.getSendBytes(), p += i.getRecvBytes());
  21801. var f = 1;
  21802. r.peer_delay && (f = r.peer_delay.length, f += 1),
  21803. Object(b.b)(n, "Duration", i.getDuration()),
  21804. Object(b.b)(n, "UserCount", f),
  21805. Object(b.b)(n, "SendBytes", l),
  21806. Object(b.b)(n, "RecvBytes", p),
  21807. Object(b.b)(n, "SendBitrate", 8 * d / 1e3),
  21808. Object(b.b)(n, "RecvBitrate", 8 * u / 1e3),
  21809. e && e(n)
  21810. },
  21811. t.isLocalVideoFreeze = function(e, t) {
  21812. var n = 0,
  21813. r = 0;
  21814. if (!e || !t) return ! 1;
  21815. if (Object(s.isChrome)() || Object(s.isOpera)()) n = e.googFrameRateInput,
  21816. r = e.googFrameRateSent;
  21817. else if (Object(s.isSafari)()) n = parseInt(e.framerateMean),
  21818. r = parseInt(e.framesEncoded) - parseInt(t.framesEncoded);
  21819. else {
  21820. if (!Object(s.isFireFox)()) return ! 1;
  21821. n = parseInt(e.framerateMean),
  21822. r = parseInt(e.framesEncoded) - parseInt(t.framesEncoded)
  21823. }
  21824. return n > 5 && r < 3
  21825. },
  21826. t.isRemoteVideoFreeze = function(e, t) {
  21827. var n = 0,
  21828. r = 0;
  21829. if (!e || !t) return ! 1;
  21830. if (Object(s.isChrome)() || Object(s.isOpera)()) n = e.googFrameRateReceived,
  21831. r = e.googFrameRateDecoded;
  21832. else if (Object(s.isSafari)()) n = e.framerateMean,
  21833. r = parseInt(e.framesDecoded) - parseInt(t.framesDecoded);
  21834. else {
  21835. if (!Object(s.isFireFox)()) return ! 1;
  21836. n = parseInt(e.framesReceived) - parseInt(t.framesReceived),
  21837. r = parseInt(e.framesDecoded) - parseInt(t.framesDecoded)
  21838. }
  21839. return n > 5 && n < 10 && r < 3 || (n > 10 && n < 20 && r < 4 || n > 20 && r < 5)
  21840. },
  21841. t.isAudioFreeze = function(e) {
  21842. if (Object(s.isChrome)() && e) {
  21843. if (e.googDecodingPLC && e.googDecodingPLCCNG && e.googDecodingCTN) return (parseInt(e.googDecodingPLC) + parseInt(e.googDecodingPLCCNG)) / parseInt(e.googDecodingCTN) > .2
  21844. } else if ((Object(s.isSafari)() || Object(s.isFireFox)()) && e.packetsLost && e.packetsReceived) return parseInt(e.packetsLost) / (parseInt(e.packetsLost) + parseInt(e.packetsReceived)) > .2;
  21845. return ! 1
  21846. },
  21847. t.isAudioDecodeFailed = function(e) {
  21848. return !! ((Object(s.isChrome)() || Object(s.isOpera)()) && e && parseInt(e.bytesReceived) > 0 && 0 === parseInt(e.googDecodingNormal))
  21849. },
  21850. t.startNetworkQualityTimer = function() {
  21851. t.clearNetworkQualityTimer(),
  21852. t.networkQualityTimer = setInterval((function() {
  21853. if (t.gatewayClient.state !== R.a.CONNECTED) t.gatewayClient.dispatchEvent({
  21854. type: "network-quality",
  21855. uplinkNetworkQuality: 0,
  21856. downlinkNetworkQuality: 0
  21857. });
  21858. else {
  21859. var e = t.gatewayClient.traffic_stats;
  21860. t.gatewayClient.dispatchEvent({
  21861. type: "network-quality",
  21862. uplinkNetworkQuality: t.networkQualityTrans(e.uplink_network_quality),
  21863. downlinkNetworkQuality: t.networkQualityTrans(e.downlink_network_quality)
  21864. })
  21865. }
  21866. }), 2e3)
  21867. },
  21868. t.clearNetworkQualityTimer = function() {
  21869. t.networkQualityTimer && clearInterval(t.networkQualityTimer)
  21870. },
  21871. t.networkQualityTrans = function(e) {
  21872. return e >= 0 && e < .17 ? 1 : e >= .17 && e < .36 ? 2 : e >= .36 && e < .59 ? 3 : e >= .59 && e <= 1 ? 4 : e > 1 ? 5 : 0
  21873. },
  21874. t.getStatsTimer = setInterval((function() {
  21875. var e = t.gatewayClient.traffic_stats,
  21876. n = Date.now();
  21877. t.gatewayClient.dispatchEvent({
  21878. type: "_testException"
  21879. }),
  21880. Object.keys(t.localStats).length && t.exceptionMonitor.setLocalStats(t.localStats),
  21881. Object.keys(t.remoteStats).length && t.exceptionMonitor.setRemoteStats(t.remoteStats);
  21882. var r = {};
  21883. Object.keys(t.gatewayClient.remoteStreams).forEach((function(i) {
  21884. var o = t.gatewayClient.remoteStreams[i],
  21885. a = t.remoteStats[i],
  21886. s = {
  21887. id: i,
  21888. updatedAt: n
  21889. };
  21890. r[i] = s,
  21891. s.firstFrameTime = o.firstFrameTime,
  21892. a ? (s.audioTotalPlayDuration = a.audioTotalPlayDuration + 1, s.audioTotalFreezeTime = a.audioTotalFreezeTime, s.isAudioFreeze = !1, s.isAudioDecodeFailed = !1, s.videoTotalPlayDuration = a.videoTotalPlayDuration + 1, s.videoTotalFreezeTime = a.videoTotalFreezeTime, s.isVideoFreeze = !1) : (s.audioTotalPlayDuration = 1, s.audioTotalFreezeTime = 0, s.videoTotalPlayDuration = 1, s.videoTotalFreezeTime = 0);
  21893. var c = e && e.peer_delay && e.peer_delay.find((function(e) {
  21894. return e.peer_uid == i
  21895. }));
  21896. c && (s.peer_delay = c),
  21897. o && (o.isPlaying() && (s.audioDisabled = o.userMuteAudio || o.peerMuteAudio ? "1": "0", s.videoDisabled = o.userMuteVideo || o.peerMuteVideo ? "1": "0"), a && a.peer_delay && c && a.peer_delay.stream_type !== c.stream_type && t.gatewayClient.dispatchEvent({
  21898. type: "streamTypeChange",
  21899. uid: i,
  21900. streamType: c.stream_type
  21901. }), o.pc && "established" == o.pc.state && o.pc.getStats((function(e) {
  21902. if (s.pcStats = e, s.audioStats = e.find((function(e) {
  21903. return "audio" == e.mediaType && (e.id.indexOf("_recv") > -1 || e.id.toLowerCase().indexOf("inbound") > -1)
  21904. })), s.videoStats = e.find((function(e) {
  21905. return "video" == e.mediaType && (e.id.indexOf("_recv") > -1 || e.id.toLowerCase().indexOf("inbound") > -1)
  21906. })), a && a.audioStats && s.audioStats) {
  21907. var n = parseInt(s.audioStats.bytesReceived) - parseInt(a.audioStats.bytesReceived),
  21908. r = parseInt(s.audioStats.googDecodingNormal) - parseInt(a.audioStats.googDecodingNormal);
  21909. if (s.audioStats.audioRecvBytesDelta = n, s.audioStats.audioDecodingNormalDelta = r, t.session.recvBytes += n, isFinite(n) && s.audioStats.timestamp) {
  21910. var i = s.audioStats.timestamp.getTime() - a.audioStats.timestamp.getTime();
  21911. s.audioRecvBitrate = Math.floor(8 * n / i)
  21912. }
  21913. t.isAudioFreeze(s.audioStats) && s.audioTotalPlayDuration > 10 && (s.audioTotalFreezeTime++, s.isAudioFreeze = !0),
  21914. t.isAudioDecodeFailed(s.audioStats) && s.audioTotalPlayDuration > 10 && (s.isAudioDecodeFailed = !0),
  21915. s.audioStats.audioTotalFreezeTime = s.audioTotalFreezeTime,
  21916. s.audioStats.audioTotalPlayDuration = s.audioTotalPlayDuration,
  21917. s.audioStats.audioFreezeRate = Math.ceil(100 * s.audioTotalFreezeTime / s.audioTotalPlayDuration)
  21918. }
  21919. if (a && a.videoStats && s.videoStats) {
  21920. var c = parseInt(s.videoStats.bytesReceived) - parseInt(a.videoStats.bytesReceived);
  21921. if (s.videoStats.videoRecvBytesDelta = c, t.session.recvBytes += c, isFinite(c) && s.videoStats.timestamp) {
  21922. i = s.videoStats.timestamp.getTime() - a.videoStats.timestamp.getTime();
  21923. s.videoRecvBitrate = Math.floor(8 * c / i)
  21924. }
  21925. t.isRemoteVideoFreeze(s.videoStats, a.videoStats) && (s.videoTotalFreezeTime++, s.isVideoFreeze = !0),
  21926. s.videoStats.videoTotalFreezeTime = s.videoTotalFreezeTime,
  21927. s.videoStats.videoTotalPlayDuration = s.videoTotalPlayDuration,
  21928. s.videoStats.videoFreezeRate = Math.ceil(100 * s.videoTotalFreezeTime / s.videoTotalPlayDuration),
  21929. o.player && o.player.video && o.player.video.videoWidth && o.player.video.videoHeight ? (s.videoStats.renderRemoteWidth = o.player.video.videoWidth, s.videoStats.renderRemoteHeight = o.player.video.videoHeight) : (s.videoStats.renderRemoteWidth = o.videoWidth || s.videoStats.googFrameWidthReceived, s.videoStats.renderRemoteHeight = o.videoHeight || s.videoStats.googFrameHeightReceived)
  21930. }
  21931. })))
  21932. })),
  21933. t.remoteStats = r;
  21934. var i = {};
  21935. if (Object.keys(t.gatewayClient.localStreams).forEach((function(e) {
  21936. var r = t.gatewayClient.localStreams[e],
  21937. o = t.localStats[e],
  21938. a = {
  21939. id: e,
  21940. updatedAt: n
  21941. };
  21942. i[e] = a,
  21943. o ? (a.videoTotalPlayDuration = o.videoTotalPlayDuration + 1, a.videoTotalFreezeTime = o.videoTotalFreezeTime, a.isVideoFreeze = !1) : (a.videoTotalPlayDuration = 1, a.videoTotalFreezeTime = 0),
  21944. r && (r.isPlaying() && (a.audioDisabled = r.userMuteAudio ? "1": "0", a.videoDisabled = r.userMuteVideo ? "1": "0"), r.video && r.attributes.maxVideoBW ? a.videoTargetSendBitrate = r.attributes.maxVideoBW: r.video && r.screenAttributes && (a.videoTargetSendBitrate = r.screenAttributes.maxVideoBW), r.pc && "established" == r.pc.state && r.pc.getStats((function(e) {
  21945. if (a.pcStats = e.reverse(), a.audioStats = e.find((function(e) {
  21946. return "audio" == e.mediaType && (e.id.indexOf("_send") > -1 || e.id.toLowerCase().indexOf("outbound") > -1)
  21947. })), a.videoStats = e.find((function(e) {
  21948. return "video" == e.mediaType && (e.id.indexOf("_send") > -1 || e.id.toLowerCase().indexOf("outbound") > -1)
  21949. })), a.audioStats && o && o.audioStats) {
  21950. var n = parseInt(a.audioStats.bytesSent) - parseInt(o.audioStats.bytesSent);
  21951. if (a.audioStats.audioSendBytesDelta = n, t.session.sendBytes += n, isFinite(n) && a.audioStats.timestamp) {
  21952. var i = a.audioStats.timestamp.getTime() - o.audioStats.timestamp.getTime();
  21953. a.audioSendBitrate = Math.floor(8 * n / i)
  21954. }
  21955. }
  21956. if (a.videoStats && o && o.videoStats) {
  21957. var s = parseInt(a.videoStats.bytesSent) - parseInt(o.videoStats.bytesSent);
  21958. if (a.videoStats.videoSendBytesDelta = s, t.session.sendBytes += s, isFinite(s) && a.videoStats.timestamp) {
  21959. i = a.videoStats.timestamp.getTime() - o.videoStats.timestamp.getTime();
  21960. a.videoSendBitrate = Math.floor(8 * s / i)
  21961. }
  21962. t.isLocalVideoFreeze(a.videoStats, o.videoStats) && (a.videoTotalFreezeTime++, a.isVideoFreeze = !0),
  21963. a.videoStats.videoTotalFreezeTime = a.videoTotalFreezeTime,
  21964. a.videoStats.videoTotalPlayDuration = a.videoTotalPlayDuration,
  21965. a.videoStats.videoFreezeRate = Math.ceil(100 * a.videoTotalFreezeTime / a.videoTotalPlayDuration),
  21966. a.videoStats.renderLocalWidth = r.videoWidth || a.videoStats.googFrameWidthSent,
  21967. a.videoStats.renderLocalHeight = r.videoHeight || a.videoStats.googFrameHeightSent
  21968. }
  21969. })))
  21970. })), t.localStats = i, t.session.HTTPSendBytesDelta = Object(O.getHTTPSendBytes)() - t.session.HTTPSendBytes, t.session.HTTPSendBytes = Object(O.getHTTPSendBytes)(), t.session.HTTPRecvBytesDelta = Object(O.getHTTPRecvBytes)() - t.session.HTTPRecvBytes, t.session.HTTPRecvBytes = Object(O.getHTTPRecvBytes)(), t.gatewayClient.socket && t.gatewayClient.socket.state === t.gatewayClient.CONNECTED) {
  21971. var o = t.gatewayClient.socket;
  21972. t.session.WSSendBytesDelta = o.getSendBytes() - t.session.WSSendBytes,
  21973. t.session.WSSendBytes = o.getSendBytes(),
  21974. t.session.WSRecvBytesDelta = o.getRecvBytes() - t.session.WSRecvBytes,
  21975. t.session.WSRecvBytes = o.getRecvBytes()
  21976. }
  21977. }), 1e3),
  21978. t.gatewayClient.on("join", (function() {
  21979. t.session = {
  21980. sendBytes: 0,
  21981. recvBytes: 0,
  21982. WSSendBytes: 0,
  21983. WSSendBytesDelta: 0,
  21984. WSRecvBytes: 0,
  21985. WSRecvBytesDelta: 0,
  21986. HTTPSendBytes: 0,
  21987. HTTPSendBytesDelta: 0,
  21988. HTTPRecvBytes: 0,
  21989. HTTPRecvBytesDelta: 0
  21990. }
  21991. })),
  21992. t
  21993. } (t.gatewayClient), t.configDistributManager = function(e) {
  21994. var t = {};
  21995. return t.client = e,
  21996. t.client.gatewayClient && t.client.gatewayClient.on("config-distribute", (function(n) {
  21997. var a = n.joinInfo,
  21998. s = n.config;
  21999. if (s) {
  22000. Object(k.isEmpty)(s.uploadLog) || (Object(r.setParameter)("UPLOAD_LOG", s.uploadLog), o.report.reportApiInvoke(a.sid, {
  22001. name: "_configDistribute",
  22002. options: {
  22003. feature: "uploadLog",
  22004. value: s.uploadLog
  22005. }
  22006. })()),
  22007. Object(k.isEmpty)(s.dualStream) || (e.isDualStream = s.dualStream, o.report.reportApiInvoke(a.sid, {
  22008. name: "_configDistribute",
  22009. options: {
  22010. feature: "dualStream",
  22011. value: s.dualStream
  22012. }
  22013. })()),
  22014. Object(k.isEmpty)(s.streamFallbackOption) || t.client.gatewayClient && t.client.gatewayClient.on("stream-subscribed", (function(e) {
  22015. var n = e.stream;
  22016. n ? (t.client.gatewayClient.setStreamFallbackOption(n, s.streamFallbackOption), o.report.reportApiInvoke(a.sid, {
  22017. name: "_configDistribute",
  22018. options: {
  22019. feature: "streamFallbackOption",
  22020. value: s.streamFallbackOption,
  22021. streamId: n.getId()
  22022. }
  22023. })()) : o.report.reportApiInvoke(a.sid, {
  22024. name: "_configDistribute",
  22025. options: {
  22026. feature: "streamFallbackOption",
  22027. value: s.streamFallbackOption,
  22028. streamId: n.getId(),
  22029. err: "invalid stream"
  22030. }
  22031. })()
  22032. }));
  22033. try {
  22034. i.
  22035. default.debug("[".concat(e.clientId, "] setParameter in distribution: ").concat(JSON.stringify(s))),
  22036. Object.keys(s).map((function(e) {
  22037. return Object(r.setParameter)(e, s[e])
  22038. }))
  22039. } catch(t) {
  22040. i.
  22041. default.debug("[".concat(e.clientId, "] setParameter in distribution failed: ").concat(JSON.stringify(s)))
  22042. }
  22043. }
  22044. })),
  22045. t
  22046. } (t), Object(P.addLiveStreamingCapability)(t, e), e.areaCode) {
  22047. var n = Object(V.getAreaDomainConfig)(e.areaCode);
  22048. Object.keys(n).map((function(e) {
  22049. "LOG_UPLOAD_SERVER" == e || "EVENT_REPORT_DOMAIN" == e || "EVENT_REPORT_BACKUP_DOMAIN" == e ? Object(r.setParameter)(e, n[e][0]) : Object(r.setParameter)(e, n[e])
  22050. }))
  22051. }
  22052. return Object(k.isEmpty)(e.turnServer) || t.setTurnServer(e.turnServer),
  22053. Object(k.isEmpty)(e.proxyServer) || t.setProxyServer(e.proxyServer),
  22054. "live" === t.mode && (t.gatewayClient.role = "audience"),
  22055. "rtc" === t.mode && (t.gatewayClient.role = B),
  22056. t.gatewayClient.on("onMultiIP", (function(e) {
  22057. t.gatewayClient.closeGateway(),
  22058. t.gatewayClient.socket = void 0,
  22059. t.gatewayClient.hasChangeBGPAddress = !0,
  22060. t.joinInfo.multiIP = e.option,
  22061. t.gatewayClient.state = R.a.CONNECTING;
  22062. var n = function(e) {
  22063. i.
  22064. default.info("[".concat(t.clientId, "] Joining channel: ").concat(t.channel)),
  22065. t.joinInfo.cid = e.cid,
  22066. t.joinInfo.uid || (t.joinInfo.uid = e.uid),
  22067. t.joinInfo.uni_lbs_ip = e.uni_lbs_ip,
  22068. t.joinInfo.gatewayAddr = e.gateway_addr,
  22069. t.onSuccess ? t.gatewayClient.join(t.joinInfo, t.key, (function(e) {
  22070. i.
  22071. default.info("[".concat(t.clientId, "] Join channel ").concat(t.channel, " success"));
  22072. var n = t.onSuccess;
  22073. t.onSuccess = null,
  22074. t.onFailure = null,
  22075. n(e)
  22076. }), t.onFailure) : (t.gatewayClient.joinInfo = y()({},
  22077. t.joinInfo), t.gatewayClient.rejoin())
  22078. };
  22079. t.joinInfo.stringUid && !t.joinInfo.uid ? (t.userAccountReq && !t.userAccountReq.isFinished() && t.userAccountReq.cancel(), t.userAccountReq = Object(A.getUserAccount)(joinInfo, t.gatewayClient), t.userAccountReq.then((function(e) {
  22080. i.
  22081. default.error("getUserAccount Success ".concat(e.url, " ").concat(joinInfo.stringUid, " => ").concat(e.uid)),
  22082. t.joinInfo.uid = e.uid,
  22083. Object(A.getGatewayList)(t.joinInfo, n, t.onFailure)
  22084. })).
  22085. catch((function(e) {
  22086. i.
  22087. default.error("getUserAccount rejected", e),
  22088. t.onFailure(e)
  22089. }))) : Object(A.getGatewayList)(t.joinInfo, n, t.onFailure)
  22090. })),
  22091. t.gatewayClient.on("rejoin-start", (function() {
  22092. t._renewSession(),
  22093. o.report.sessionInit(e.sessionId, {
  22094. lts: (new Date).getTime(),
  22095. extend: {
  22096. rejoin: !0
  22097. },
  22098. cname: t.channel,
  22099. appid: e.appId,
  22100. mode: e.mode,
  22101. succ: !0
  22102. })
  22103. })),
  22104. t.gatewayClient.on("recover", (function() {
  22105. t._renewSession(),
  22106. console.log("recover", e.sessionId),
  22107. o.report.sessionInit(e.sessionId, {
  22108. lts: (new Date).getTime(),
  22109. extend: {
  22110. recover: !0
  22111. },
  22112. cname: t.channel,
  22113. appid: e.appId,
  22114. mode: e.mode,
  22115. succ: !0
  22116. })
  22117. })),
  22118. t.gatewayClient.on("rejoin", (function() {
  22119. var e = t.highStreamState;
  22120. if (i.
  22121. default.debug("[".concat(t.clientId, "] Client local stream preState: ").concat(e)), t.onSuccess) {
  22122. var n = t.onSuccess;
  22123. t.onSuccess = null,
  22124. t.onFailure = null,
  22125. n(t.joinInfo.uid)
  22126. } ! t.highStream || 0 !== e && 1 !== e || (i.
  22127. default.info("[".concat(t.clientId, "] publish after rejoin")), t.highStreamState = 2, t.lowStreamState = 2, t.publish(t.highStream, (function(e) {
  22128. e && i.
  22129. default.info("[".concat(t.clientId, "] "), e)
  22130. })))
  22131. })),
  22132. t.gatewayClient.on("streamPublished", (function(e) {
  22133. t.hasPublished || (t.hasPublished = !0, t.gatewayClient.dispatchEvent(Object(a.e)({
  22134. type: "stream-published",
  22135. stream: e.stream
  22136. })))
  22137. })),
  22138. t.gatewayClient.on("pubP2PLost", (function(e) {
  22139. i.
  22140. default.debug("[".concat(t.clientId, "] Start reconnect local peerConnection: ").concat(t.highStream.getId())),
  22141. t.gatewayClient.dispatchEvent({
  22142. type: "stream-reconnect-start",
  22143. uid: t.highStream.getId()
  22144. }),
  22145. 1 === t.highStreamState && (t.highStreamState = 0, t.lowStreamState = 0),
  22146. t._unpublish(t.highStream, (function() {
  22147. t._publish(t.highStream, (function() {
  22148. i.
  22149. default.debug("[".concat(t.clientId, "] Reconnect local peerConnection success: ").concat(t.highStream.getId())),
  22150. t.gatewayClient.dispatchEvent({
  22151. type: "stream-reconnect-end",
  22152. uid: t.highStream.getId(),
  22153. success: !0,
  22154. reason: ""
  22155. })
  22156. }), (function(e) {
  22157. i.
  22158. default.debug("[".concat(t.clientId, "] Reconnect local peerConnection failed: ").concat(e)),
  22159. t.gatewayClient.dispatchEvent({
  22160. type: "stream-reconnect-end",
  22161. uid: t.highStream.getId(),
  22162. success: !1,
  22163. reason: e
  22164. })
  22165. }), !0)
  22166. }), (function(e) {
  22167. i.
  22168. default.debug("[".concat(t.clientId, "] Reconnect local peerConnection failed: ").concat(e)),
  22169. t.gatewayClient.dispatchEvent({
  22170. type: "stream-reconnect-end",
  22171. uid: t.highStream.getId(),
  22172. success: !1,
  22173. reason: e
  22174. })
  22175. }), !0)
  22176. })),
  22177. t.gatewayClient.on("subP2PLost", (function(e) {
  22178. i.
  22179. default.debug("[".concat(t.clientId, "] Start reconnect remote peerConnection: ").concat(e.stream.getId(), " ").concat(e.stream.subscribeOptions)),
  22180. t.gatewayClient.dispatchEvent({
  22181. type: "stream-reconnect-start",
  22182. uid: e.stream.getId()
  22183. });
  22184. var n = e.stream.subscribeOptions;
  22185. console.log("Re-subscribe stream", n, e.stream),
  22186. t.gatewayClient.unsubscribe(e.stream, (function() {
  22187. e.stream.subscribeOptions = n,
  22188. t.gatewayClient.subscribe(e.stream, (function() {
  22189. i.
  22190. default.debug("[".concat(t.clientId, "] Reconnect remote peerConnection success: ").concat(e.stream.getId())),
  22191. t.gatewayClient.dispatchEvent({
  22192. type: "stream-reconnect-end",
  22193. uid: e.stream.getId(),
  22194. success: !0,
  22195. reason: ""
  22196. })
  22197. }), (function(n) {
  22198. i.
  22199. default.debug("[".concat(t.clientId, "] Reconnect remote peerConnection failed: "), n),
  22200. t.gatewayClient.dispatchEvent({
  22201. type: "stream-reconnect-end",
  22202. uid: e.stream.getId(),
  22203. success: !1,
  22204. reason: n
  22205. })
  22206. }))
  22207. }), (function(n) {
  22208. i.
  22209. default.debug("[".concat(t.clientId, "] Reconnect remote peerConnection failed: "), n),
  22210. t.gatewayClient.dispatchEvent({
  22211. type: "stream-reconnect-end",
  22212. uid: e.stream.getId(),
  22213. success: !1,
  22214. reason: n
  22215. })
  22216. }))
  22217. })),
  22218. M.on("networkTypeChanged", (function(e) {
  22219. t.gatewayClient && t.gatewayClient.dispatchEvent(e);
  22220. var n = y()({},
  22221. e, {
  22222. type: "network-type-changed"
  22223. });
  22224. t.gatewayClient.dispatchEvent(n)
  22225. })),
  22226. l.a.on("recordingDeviceChanged", (function(e) {
  22227. t.gatewayClient && t.gatewayClient.dispatchEvent(e);
  22228. var n = y()({},
  22229. e, {
  22230. type: "recording-device-changed"
  22231. });
  22232. t.gatewayClient.dispatchEvent(n)
  22233. })),
  22234. l.a.on("playoutDeviceChanged", (function(e) {
  22235. t.gatewayClient && t.gatewayClient.dispatchEvent(e);
  22236. var n = y()({},
  22237. e, {
  22238. type: "playout-device-changed"
  22239. });
  22240. t.gatewayClient.dispatchEvent(n)
  22241. })),
  22242. l.a.on("cameraChanged", (function(e) {
  22243. t.gatewayClient && t.gatewayClient.dispatchEvent(e);
  22244. var n = y()({},
  22245. e, {
  22246. type: "camera-changed"
  22247. });
  22248. t.gatewayClient.dispatchEvent(n)
  22249. })),
  22250. t.gatewayClient.on("streamTypeChange", (function(n) {
  22251. var r = y()({},
  22252. n, {
  22253. type: "stream-type-changed"
  22254. });
  22255. t.gatewayClient.dispatchEvent(r),
  22256. o.report.reportApiInvoke(e.sessionId, {
  22257. name: "streamTypeChange"
  22258. })(null, JSON.stringify(n))
  22259. })),
  22260. t
  22261. },
  22262. W = {
  22263. width: 640,
  22264. height: 360,
  22265. videoBitrate: 400,
  22266. videoFramerate: 15,
  22267. lowLatency: !1,
  22268. audioSampleRate: 48e3,
  22269. audioBitrate: 48,
  22270. audioChannels: 1,
  22271. videoGop: 30,
  22272. videoCodecProfile: 100,
  22273. userCount: 0,
  22274. userConfigExtraInfo: {},
  22275. backgroundColor: 0,
  22276. transcodingUsers: []
  22277. },
  22278. G = function(e) {
  22279. switch (e) {
  22280. case "h264_interop":
  22281. return "h264";
  22282. default:
  22283. return "vp8"
  22284. }
  22285. },
  22286. H = function(e) {
  22287. return - 1 === m.indexOf(e.mode) ? T.
  22288. default.INVALID_CLIENT_MODE:
  22289. -1 === h.indexOf(e.codec) ? T.
  22290. default.INVALID_CLIENT_CODEC:
  22291. "h264_interop" == e.mode && "h264" !== e.codec && T.
  22292. default.CLIENT_MODE_CODEC_MISMATCH
  22293. },
  22294. q = function(e) {
  22295. switch (e.mode) {
  22296. case "interop":
  22297. case "h264_interop":
  22298. e.mode = "live";
  22299. break;
  22300. case "web-only":
  22301. e.mode = "rtc"
  22302. }
  22303. },
  22304. J = l.a.getDevices,
  22305. K = p.a.getScreenSources,
  22306. Y = JSON.parse(JSON.stringify(r.SUPPORT_RESOLUTION_LIST));
  22307. t.
  22308. default = {
  22309. TranscodingUser: {
  22310. uid: 0,
  22311. x: 0,
  22312. y: 0,
  22313. width: 0,
  22314. height: 0,
  22315. zOrder: 0,
  22316. alpha: 1
  22317. },
  22318. LiveTranscoding: W,
  22319. createClient: function(e) {
  22320. var t = o.report.reportApiInvoke(null, {
  22321. name: "createClient",
  22322. options: arguments,
  22323. tag: "tracer"
  22324. }); (e = y()({},
  22325. e || {})).codec || (e.codec = G(e.mode));
  22326. var n = H(e);
  22327. if (n) throw i.
  22328. default.error("Invalid parameter setting MODE: ".concat(e.mode, " CODEC: ").concat(e.codec, " ERROR ").concat(n)),
  22329. t(n),
  22330. new Error(n);
  22331. return i.
  22332. default.info("Creating client, MODE: ".concat(e.mode, " CODEC: ").concat(e.codec)),
  22333. q(e),
  22334. t(null, e),
  22335. F(e)
  22336. },
  22337. createStream: u.b,
  22338. Logger: i.
  22339. default,
  22340. report: o.report,
  22341. getDevices: J,
  22342. getScreenSources: K,
  22343. getParameter: r.getParameter,
  22344. setParameter: r.setParameter,
  22345. checkSystemRequirements: function() {
  22346. var e = o.report.reportApiInvoke(null, {
  22347. name: "checkSystemRequirements",
  22348. options: arguments,
  22349. tag: "tracer"
  22350. }),
  22351. t = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection,
  22352. n = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.msGetUserMedia || navigator.mozGetUserMedia || navigator.mediaDevices && navigator.mediaDevices.getUserMedia,
  22353. r = window.WebSocket,
  22354. a = !!t && !!n && !!r,
  22355. c = !1;
  22356. s.isChrome() && s.getBrowserVersion() >= 58 && "iOS" !== s.getBrowserOS() && (c = !0),
  22357. s.isFireFox() && s.getBrowserVersion() >= 56 && (c = !0),
  22358. s.isOpera() && s.getBrowserVersion() >= 45 && (c = !0),
  22359. s.isSafari() && s.getBrowserVersion() >= 11 && (c = !0),
  22360. s.isEdge() && (c = !0),
  22361. (s.isWeChatBrowser() || s.isQQBrowser()) && "iOS" !== s.getBrowserOS() && (c = !0),
  22362. s.isSupportedPC() || s.isSupportedMobile() || (c = !1),
  22363. i.
  22364. default.debug(s.getBrowserInfo(), "isAPISupport: " + a + ", isVendorAndVersionSupport: " + c);
  22365. var d = a && c;
  22366. return e(null, d),
  22367. d
  22368. },
  22369. getSupportedCodec: f.getSupportedCodec,
  22370. ChannelMediaRelayConfiguration: g.ChannelMediaRelayConfiguration,
  22371. VERSION: r.VERSION,
  22372. BUILD: r.BUILD,
  22373. PROFILE_TABLE: Y,
  22374. AUDIO_SAMPLE_RATE_32000: 32e3,
  22375. AUDIO_SAMPLE_RATE_44100: 44100,
  22376. AUDIO_SAMPLE_RATE_48000: 48e3,
  22377. VIDEO_CODEC_PROFILE_BASELINE: 66,
  22378. VIDEO_CODEC_PROFILE_MAIN: 77,
  22379. VIDEO_CODEC_PROFILE_HIGH: 100,
  22380. REMOTE_VIDEO_STREAM_HIGH: 0,
  22381. REMOTE_VIDEO_STREAM_LOW: 1,
  22382. REMOTE_VIDEO_STREAM_MEDIUM: 2,
  22383. AREAS: V.AREAS,
  22384. AREA_VERSION: "global"
  22385. }
  22386. }]).
  22387. default
  22388. }));