1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042 |
- var ku=Object.defineProperty,xu=Object.defineProperties;var Vu=Object.getOwnPropertyDescriptors;var Yn=Object.getOwnPropertySymbols;var Ms=Object.prototype.hasOwnProperty,As=Object.prototype.propertyIsEnumerable;var bs=(n,t,e)=>t in n?ku(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,oe=(n,t)=>{for(var e in t||(t={}))Ms.call(t,e)&&bs(n,e,t[e]);if(Yn)for(var e of Yn(t))As.call(t,e)&&bs(n,e,t[e]);return n},Ve=(n,t)=>xu(n,Vu(t));var ws=(n,t)=>{var e={};for(var r in n)Ms.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&Yn)for(var r of Yn(n))t.indexOf(r)<0&&As.call(n,r)&&(e[r]=n[r]);return e};import{d as Ya,q as Se,c as Ls,w as Us,u as Ds,E as Bu,r as Fu,o as ks,a as wi,b as Hu,z as $u,e as Gu,f as Ku,m as ju,g as qu,h as za,i as Yu,j as zu,k as Ja,l as ve,n as Ju,s as Wu,p as Zu}from"./vendor.65bdc0e9.js";function Xh(){import("data:text/javascript,")}const Qu=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function e(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=e(i);fetch(i.href,o)}};Qu();if(typeof window!="undefined"){let n=function(){var t=document.body,e=document.getElementById("__svg__icons__dom__");e||(e=document.createElementNS("http://www.w3.org/2000/svg","svg"),e.style.position="absolute",e.style.width="0",e.style.height="0",e.id="__svg__icons__dom__",e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),e.innerHTML='<symbol viewBox="0 0 74 68" id="icon-camera-status"><g fill="none" fill-rule="evenodd"><path d="M0 0h74v68H0z" /><g fill-rule="nonzero"><path d="M35 51c-9.968 0-18.625 5.672-23 14h46c-4.376-8.328-13.033-14-23-14Z" fill="#DCE1EB" /><path d="M36.016 51H36v14h23c-4.372-8.328-13.023-14-22.983-14Z" fill="#CDD2E1" /><path d="M9 31.5C9 46.136 20.864 58 35.5 58S62 46.136 62 31.5 50.136 5 35.5 5 9 16.864 9 31.5Z" fill="#FFF" /><path d="M35.5 58C50.136 58 62 46.136 62 31.5S50.136 5 35.5 5v53Z" fill="#E9EDF5" /><path d="M23 32c0 7.18 5.82 13 13 13s13-5.82 13-13-5.82-13-13-13-13 5.82-13 13Z" fill="#9196AA" /><path d="M36 45c7.18 0 13-5.82 13-13s-5.82-13-13-13v26Z" fill="#7E8596" /><path d="M27 31.5a8.5 8.5 0 1 0 17 0 8.5 8.5 0 0 0-17 0Z" fill="#555A66" /><path d="M35.5 40a8.5 8.5 0 1 0 0-17v17Z" fill="#333940" /><path d="M30 34a2 2 0 1 0 4 0 2 2 0 0 0-4 0Z" fill="#DCE1EB" /><path d="m4.381 12.098-4.2-.462a.203.203 0 0 1-.068-.385l3.79-1.87.461-4.2a.203.203 0 0 1 .385-.068l1.87 3.79 4.2.461a.203.203 0 0 1 .068.385l-3.789 1.87-.462 4.2a.203.203 0 0 1-.385.068l-1.87-3.789Z" fill="#E9EDF5" /><path d="m62.286 52.066-2.21-1.622a.186.186 0 0 1 .122-.336l2.735.178 1.622-2.211a.186.186 0 0 1 .336.122l-.177 2.737 2.21 1.622a.186.186 0 0 1-.123.336l-2.735-.178-1.623 2.211a.186.186 0 0 1-.335-.122l.177-2.737h.001Z" fill="#FEFEFF" /></g></g></symbol><symbol viewBox="0 0 18 18" id="icon-bar-arrow-down"><g fill="none" fill-rule="evenodd"><g fill="#888" fill-rule="nonzero"><path d="M5.124 8.652a.357.357 0 0 1-.002-.54c.164-.149.43-.15.596-.001l3.58 3.237c.165.149.165.39.001.54a.452.452 0 0 1-.595.001l-3.58-3.237Z" /><path d="M12.282 8.111a.452.452 0 0 1 .596.001c.163.15.163.391-.002.54l-3.58 3.237a.452.452 0 0 1-.595-.001.357.357 0 0 1 .001-.54l3.58-3.237Z" /></g><path d="M0 18V0h18v18z" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-beauty-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M2.52 17.094c-.1.8-.725 1.43-1.52 1.532 0 0 1.318.158 1.52 1.374 0 0 .306-1.32 1.371-1.374.05 0-1.218-.315-1.371-1.532ZM12.498 0c-.099.8-.724 1.43-1.52 1.532 0 0 1.318.157 1.52 1.374 0 0 .306-1.32 1.372-1.374.05 0-1.219-.316-1.372-1.532Zm5.54 1.906A2.484 2.484 0 0 1 15.87 4.06s1.858.216 2.168 1.997c0 0 .413-1.835 1.962-1.997 0 0-1.81-.415-1.962-2.154Zm-7.951 1.66c-4.562 0-8.26 3.717-8.26 8.302 0 4.585 3.698 8.302 8.26 8.302 4.562 0 8.26-3.717 8.26-8.302-.013-4.58-3.703-8.288-8.26-8.302Zm-3.51 9.132c-.6 0-1.034-.635-1.034-1.428 0-.793.488-1.478 1.033-1.478.545 0 1.033.636 1.033 1.478 0 .843-.438 1.428-1.033 1.428Zm6.306 2.906s-.582 1.245-2.552 1.245a3.581 3.581 0 0 1-2.557-1.112s-.636-1.246.586-.905a2.599 2.599 0 0 0 1.917 1.062 2.302 2.302 0 0 0 1.875-1.012s1.173-.32.744.743l-.013-.021Zm.74-2.906c-.583 0-1.058-.647-1.058-1.453 0-.805.475-1.453 1.058-1.453.582 0 1.007.648 1.007 1.453 0 .806-.475 1.453-1.007 1.453Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-beauty"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M2.52 17.094c-.1.8-.725 1.43-1.52 1.532 0 0 1.318.158 1.52 1.374 0 0 .306-1.32 1.371-1.374.05 0-1.218-.315-1.371-1.532ZM12.498 0c-.099.8-.724 1.43-1.52 1.532 0 0 1.318.157 1.52 1.374 0 0 .306-1.32 1.372-1.374.05 0-1.219-.316-1.372-1.532Zm5.54 1.906A2.484 2.484 0 0 1 15.87 4.06s1.858.216 2.168 1.997c0 0 .413-1.835 1.962-1.997 0 0-1.81-.415-1.962-2.154Zm-7.951 1.66c-4.562 0-8.26 3.717-8.26 8.302 0 4.585 3.698 8.302 8.26 8.302 4.562 0 8.26-3.717 8.26-8.302-.013-4.58-3.703-8.288-8.26-8.302Zm-3.51 9.132c-.6 0-1.034-.635-1.034-1.428 0-.793.488-1.478 1.033-1.478.545 0 1.033.636 1.033 1.478 0 .843-.438 1.428-1.033 1.428Zm6.306 2.906s-.582 1.245-2.552 1.245a3.581 3.581 0 0 1-2.557-1.112s-.636-1.246.586-.905a2.599 2.599 0 0 0 1.917 1.062 2.302 2.302 0 0 0 1.875-1.012s1.173-.32.744.743l-.013-.021Zm.74-2.906c-.583 0-1.058-.647-1.058-1.453 0-.805.475-1.453 1.058-1.453.582 0 1.007.648 1.007 1.453 0 .806-.475 1.453-1.007 1.453Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-camera-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><g transform="translate(3 2)"><path d="M15.829 7.667c0 2.887-1.553 5.405-3.843 6.717l-.232.128 1.365 2.436a.713.713 0 0 1 0 .697.676.676 0 0 1-.481.34l-.102.008L4.401 18a.671.671 0 0 1-.583-.348.713.713 0 0 1-.045-.602l.045-.095 1.337-2.402a7.408 7.408 0 0 1-1.236-.794l2.98-2.98c.456.238.971.373 1.516.373 1.857 0 3.37-1.565 3.37-3.485a3.56 3.56 0 0 0-.312-1.462l2.98-2.981a7.803 7.803 0 0 1 1.376 4.443ZM8.415 0c1.78 0 3.416.653 4.696 1.739l-2.95 2.95a3.266 3.266 0 0 0-1.746-.507c-1.857 0-3.37 1.565-3.37 3.485 0 .62.157 1.202.432 1.706l-2.948 2.95A7.796 7.796 0 0 1 1 7.667C1 3.44 4.326 0 8.415 0Zm2.022 7.667c0 1.155-.906 2.091-2.022 2.091-.153 0-.302-.018-.445-.05l2.432-2.43c.023.126.035.256.035.389ZM8.415 5.576c.254 0 .497.048.721.137L6.502 8.348a2.153 2.153 0 0 1-.11-.681c0-1.155.906-2.091 2.023-2.091Zm0-3.196a.686.686 0 0 0-.675.697c0 .384.304.697.675.697.37 0 .674-.313.674-.697a.688.688 0 0 0-.674-.697Z" fill="#FFF" fill-rule="nonzero" /><rect fill="#FF3D00" transform="rotate(45 8.485 9.778)" x="7.485" y="-1.222" width="2" height="22" rx="1" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-camera"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M11.415 2c4.088 0 7.414 3.44 7.414 7.667 0 2.983-1.658 5.572-4.075 6.845l1.365 2.436a.713.713 0 0 1 0 .697.671.671 0 0 1-.583.348L7.401 20a.671.671 0 0 1-.583-.348.713.713 0 0 1 0-.697l1.337-2.402C5.7 15.303 4 12.685 4 9.667 4 5.44 7.326 2 11.415 2Zm0 4.182c-1.857 0-3.37 1.565-3.37 3.485s1.513 3.485 3.37 3.485c1.857 0 3.37-1.565 3.37-3.485s-1.513-3.485-3.37-3.485Zm0 1.394c1.116 0 2.022.936 2.022 2.091 0 1.155-.906 2.091-2.022 2.091-1.117 0-2.023-.936-2.023-2.091 0-1.155.906-2.091 2.023-2.091Zm0-3.196a.686.686 0 0 0-.675.697c0 .384.304.697.675.697.37 0 .674-.313.674-.697a.688.688 0 0 0-.674-.697Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-mike-disabled"><defs><path d="M16.142 4.707 2.707 18.142a1 1 0 0 0 1.414 1.415L17.556 6.12a.999.999 0 0 0 0-1.414 1 1 0 0 0-1.414 0Z" id="icon-bar-mike-disabled_a" /></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><g transform="translate(2 1)"><path d="M16.06 8.915c.522 0 .943.419.94.935 0 4.252-3.212 7.776-7.366 8.327v.703A1.13 1.13 0 0 1 8.5 20a1.13 1.13 0 0 1-1.133-1.12v-.703a8.511 8.511 0 0 1-2.921-.945l1.4-1.401a6.625 6.625 0 0 0 2.656.555c3.646 0 6.612-2.931 6.612-6.536a.94.94 0 0 1 .945-.935Zm-15.114 0a.94.94 0 0 1 .945.934c0 1.942.865 3.683 2.228 4.881L2.79 16.06C1.08 14.521 0 12.31 0 9.85c0-.517.424-.936.946-.936Zm12.587-.77v1.194c-.004 2.768-2.23 5.012-4.979 5.014a4.86 4.86 0 0 1-1.098-.133l6.077-6.075ZM8.555 0c2.748.001 4.975 2.246 4.978 5.015v.301l-7.988 7.989A5.008 5.008 0 0 1 3.58 9.338V5.015C3.582 2.247 5.81.003 8.555 0Zm0 1.614c-1.86 0-3.374 1.525-3.374 3.401v.718h6.75v-.718c-.002-1.878-1.513-3.399-3.376-3.401Z" fill="#FFF" /><use fill="#FF3D00" xlink:href="#icon-bar-mike-disabled_a" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-mike"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M19 10.85c0 4.252-3.214 7.776-7.368 8.327v.703c0 .616-.51 1.12-1.132 1.12a1.13 1.13 0 0 1-1.133-1.12v-.703C5.213 18.626 2 15.105 2 10.85a.94.94 0 0 1 .945-.935c.522 0 .946.419.946.935 0 3.605 2.965 6.536 6.611 6.536s6.611-2.931 6.611-6.536c0-.516.424-.935.946-.935s.943.419.941.935ZM5.579 6.015v4.324c.002 2.768 2.228 5.012 4.975 5.015 2.748-.002 4.975-2.246 4.979-5.015V6.015C15.53 3.246 13.302 1.002 10.554 1c-2.747.004-4.973 2.247-4.975 5.015Zm8.352 0v.719H7.18v-.719c0-1.875 1.514-3.401 3.374-3.401 1.864.002 3.374 1.523 3.377 3.401Z" fill="#FFF" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-screen-share-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M3.8 4c-.477 0-.935.188-1.273.523C2.19 4.858 2 5.313 2 5.786v8.928c0 .474.19.928.527 1.263.338.335.796.523 1.273.523h14.4c.477 0 .935-.188 1.273-.523.337-.335.527-.79.527-1.263V5.786c0-.474-.19-.928-.527-1.263A1.807 1.807 0 0 0 18.2 4H3.8Zm3.6 14.42c0-.154.062-.302.171-.41a.587.587 0 0 1 .414-.17h6.03c.323 0 .585.26.585.58 0 .32-.262.58-.585.58h-6.03a.587.587 0 0 1-.414-.17.578.578 0 0 1-.171-.41Zm3.754-11.258a.518.518 0 0 1 .32-.472.548.548 0 0 1 .575.093l2.377 2.108a.51.51 0 0 1-.027.788l-2.398 1.86a.548.548 0 0 1-.567.061.517.517 0 0 1-.301-.469l.007-1.418c-1.475.002-2.67 1.162-2.67 2.592 0 .286-.24.519-.535.519a.527.527 0 0 1-.535-.519c0-.962.394-1.886 1.096-2.566a3.804 3.804 0 0 1 2.647-1.063h.002l.009-1.514Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 21 17" id="icon-bar-screen-share-disabled2"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v17H0z" /><g transform="translate(1 .536)"><path d="M12.015 14.304c.323 0 .585.26.585.58 0 .32-.262.58-.585.58h-6.03a.587.587 0 0 1-.414-.17.578.578 0 0 1 .414-.99h6.03Zm3.37-13.84-3.983 3.983-1.353-1.2a.547.547 0 0 0-.49-.12l-.084.028a.518.518 0 0 0-.321.472L9.145 5.14c-.994 0-1.947.383-2.649 1.063A3.574 3.574 0 0 0 5.4 8.77c0 .286.24.518.535.518a.527.527 0 0 0 .535-.518c0-1.43 1.195-2.591 2.67-2.593l-.003.534-6.253 6.253H1.8c-.418 0-.82-.144-1.14-.404l-.133-.119A1.779 1.779 0 0 1 0 11.18V2.25c0-.473.19-.928.527-1.263A1.807 1.807 0 0 1 1.8.464h13.585Zm2.19.635c.274.32.425.728.425 1.151v8.929c0 .473-.19.928-.527 1.262a1.807 1.807 0 0 1-1.273.523H5.713L17.556 1.121Z" fill="#FFF" fill-rule="nonzero" /><rect fill="#FF3D00" transform="rotate(45 11.132 8.132)" x="10.132" y="-2.368" width="2" height="21" rx="1" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-screen-share"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M3.8 4c-.477 0-.935.188-1.273.523C2.19 4.858 2 5.313 2 5.786v8.928c0 .474.19.928.527 1.263.338.335.796.523 1.273.523h14.4c.477 0 .935-.188 1.273-.523.337-.335.527-.79.527-1.263V5.786c0-.474-.19-.928-.527-1.263A1.807 1.807 0 0 0 18.2 4H3.8Zm3.6 14.42c0-.154.062-.302.171-.41a.587.587 0 0 1 .414-.17h6.03c.323 0 .585.26.585.58 0 .32-.262.58-.585.58h-6.03a.587.587 0 0 1-.414-.17.578.578 0 0 1-.171-.41Zm3.754-11.258a.518.518 0 0 1 .32-.472.548.548 0 0 1 .575.093l2.377 2.108a.51.51 0 0 1-.027.788l-2.398 1.86a.548.548 0 0 1-.567.061.517.517 0 0 1-.301-.469l.007-1.418c-1.475.002-2.67 1.162-2.67 2.592 0 .286-.24.519-.535.519a.527.527 0 0 1-.535-.519c0-.962.394-1.886 1.096-2.566a3.804 3.804 0 0 1 2.647-1.063h.002l.009-1.514Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-share-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M18.055 10.556a.945.945 0 0 0-.944.944 6.619 6.619 0 0 1-6.611 6.611A6.618 6.618 0 0 1 3.889 11.5 6.619 6.619 0 0 1 10.5 4.889.945.945 0 0 0 10.5 3C5.813 3 2 6.813 2 11.5c0 4.687 3.813 8.5 8.5 8.5 4.687 0 8.5-3.813 8.5-8.5a.945.945 0 0 0-.945-.944Z" fill="#FFF" fill-rule="nonzero" /><path d="m14.034 4.991 1.579-.007-5.324 5.32A.994.994 0 0 0 10.991 12a.99.99 0 0 0 .701-.294l5.323-5.32-.007 1.577a1 1 0 0 0 .996.995A1 1 0 0 0 19 7.963V3.995a.98.98 0 0 0-.077-.371c-.021-.05-.035-.091-.07-.126a.846.846 0 0 0-.35-.35.323.323 0 0 0-.127-.07.98.98 0 0 0-.372-.078h-3.97a1 1 0 0 0-.995.995 1 1 0 0 0 .995.996Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-share"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M18.055 10.556a.945.945 0 0 0-.944.944 6.619 6.619 0 0 1-6.611 6.611A6.618 6.618 0 0 1 3.889 11.5 6.619 6.619 0 0 1 10.5 4.889.945.945 0 0 0 10.5 3C5.813 3 2 6.813 2 11.5c0 4.687 3.813 8.5 8.5 8.5 4.687 0 8.5-3.813 8.5-8.5a.945.945 0 0 0-.945-.944Z" fill="#FFF" fill-rule="nonzero" /><path d="m14.034 4.991 1.579-.007-5.324 5.32A.994.994 0 0 0 10.991 12a.99.99 0 0 0 .701-.294l5.323-5.32-.007 1.577a1 1 0 0 0 .996.995A1 1 0 0 0 19 7.963V3.995a.98.98 0 0 0-.077-.371c-.021-.05-.035-.091-.07-.126a.846.846 0 0 0-.35-.35.323.323 0 0 0-.127-.07.98.98 0 0 0-.372-.078h-3.97a1 1 0 0 0-.995.995 1 1 0 0 0 .995.996Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-volume-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><g transform="translate(1 3.536)"><path d="m10.27 8.406.001 6.335c0 .678-.615.966-1.334.483l-3.243-2.242 4.576-4.576Zm6.242-6.243c.23.026.454.12.639.28A7.291 7.291 0 0 1 20 8.204a7.28 7.28 0 0 1-2.85 5.763 1.166 1.166 0 0 1-1.539 0 .802.802 0 0 1-.306-.629c0-.244.112-.475.306-.629a5.677 5.677 0 0 0 2.236-4.5 5.677 5.677 0 0 0-2.236-4.501.808.808 0 0 1-.266-.377ZM9.032.705c.615-.484 1.234-.195 1.239.483L10.27 5.58l-6.453 6.452-2.377.001-.066.002a1.392 1.392 0 0 1-.973-.4A1.338 1.338 0 0 1 0 10.678V5.194a1.34 1.34 0 0 1 .442-.94c.27-.244.626-.372.992-.357H4.41Zm4.863 4.077c.1.046.194.107.28.183a4.112 4.112 0 0 1 1.537 3.192 4.1 4.1 0 0 1-1.538 3.195 1.169 1.169 0 0 1-1.542 0 .802.802 0 0 1-.308-.63c0-.246.114-.477.308-.63a2.5 2.5 0 0 0 .924-1.935 2.5 2.5 0 0 0-.924-1.935.817.817 0 0 1-.091-.084Z" fill="#FFF" fill-rule="nonzero" /><rect fill="#FF3D00" transform="rotate(45 11.132 8.132)" x="10.132" y="-2.368" width="2" height="21" rx="1" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-volume"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M5.41 7.432H2.434a1.393 1.393 0 0 0-.992.357 1.34 1.34 0 0 0-.442.94v5.484c-.001.358.143.703.4.957.258.255.609.398.974.4l.066-.002h2.878l4.619 3.192c.72.483 1.334.194 1.334-.484V4.724c-.005-.678-.624-.967-1.239-.484L5.41 7.432Zm8.222 6.195a.802.802 0 0 0-.308.63c0 .245.114.477.308.63a1.169 1.169 0 0 0 1.542 0 4.1 4.1 0 0 0 1.538-3.195A4.101 4.101 0 0 0 15.169 8.5h.005a1.169 1.169 0 0 0-1.542 0 .802.802 0 0 0-.306.63c0 .243.112.475.306.628a2.5 2.5 0 0 1 .924 1.934 2.5 2.5 0 0 1-.924 1.935Zm2.98-7.645a.802.802 0 0 0-.309.63c0 .245.113.477.308.63a5.677 5.677 0 0 1 2.236 4.501 5.677 5.677 0 0 1-2.236 4.5.802.802 0 0 0-.306.63c0 .244.112.475.306.629a1.166 1.166 0 0 0 1.54 0A7.28 7.28 0 0 0 21 11.739a7.281 7.281 0 0 0-2.854-5.76h.005a1.169 1.169 0 0 0-1.54.003Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 16 13" id="icon-message-activeVoice"><path d="M3.594 2.995v7.007H1.197C.536 10.002 0 9.474 0 8.844V4.151c0-.638.53-1.156 1.197-1.156h2.397ZM7.426.192c.53-.387.959-.169.959.47v11.673c0 .646-.425.86-.958.47l-3.832-2.803V2.995L7.427.192Zm5.354 11.221c-.333-.32-.333-.745 0-1.065 2.11-2.024 2.11-5.22 0-7.243-.333-.32-.333-.747 0-1.066.333-.32.777-.32 1.11 0C15.223 3.318 16 4.915 16 6.62c0 1.705-.777 3.409-2.11 4.58a.868.868 0 0 1-.554.213c-.223.213-.445.107-.556 0Zm-2.22-1.171a.868.868 0 0 1-.556-.213c-.333-.32-.333-.746 0-1.066 1.332-1.278 1.332-3.195 0-4.474-.333-.32-.333-.745 0-1.065.333-.32.777-.32 1.11 0 1.999 1.81 1.999 4.688 0 6.498-.221.214-.333.32-.555.32Z" fill="currentColor" fill-rule="nonzero" /></symbol><symbol viewBox="0 0 20 20" id="icon-message-evenEtc"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v20H0z" /><path d="M11.475 16.852c.017.09.025.184.025.28v.236c0 .583-.334 1.122-.875 1.413a1.86 1.86 0 0 1-1.75 0C8.333 18.49 8 17.951 8 17.368v-.237c0-.135.017-.266.051-.392C5.141 15.941 3 13.402 3 10.37c0-.48.382-.869.854-.869s.855.389.855.868c0 2.686 2.354 4.895 5.291 4.895 2.937 0 5.291-2.208 5.291-4.895 0-.48.383-.868.854-.868.473 0 .855.389.855.868 0 3.195-2.376 5.844-5.525 6.484ZM9.949 1h.102C13.017 1 14.5 2.49 14.5 5.468v4.063C14.5 12.51 13.017 14 10.051 14h-.102C6.983 14 5.5 12.51 5.5 9.53V5.468C5.5 2.49 6.983 1 9.949 1Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 20 20" id="icon-message-giveUp"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v20H0z" /><path d="M5.941 7.478c.69 0 1.25.572 1.25 1.278v6.966c0 .706-.56 1.278-1.25 1.278H5.25C4.56 17 4 16.428 4 15.722V8.756c0-.706.56-1.278 1.25-1.278h.691Zm3.81-3.428c.14-1.47 1.564-.967 1.564-.967 2.246 1.398.651 4.761.513 5.121l.499.003v-.002h2.55c.029 0 .058.01.086.024l.607.007a.633.633 0 0 1 .43.607l-.563 7.477c0 .353-.281.64-.626.64l-7.124.025V7.822c1.984-.74 1.95-2.588 2.064-3.772Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 20 20" id="icon-message-look"><g fill="none" fill-rule="evenodd"><path d="M18.97 6.139c0-1.007-.672-1.421-1.492-.918l-1.873 1.125v-.888c0-1.333-1.083-2.458-2.43-2.458H3.43C2.112 3 1 4.096 1 5.458v8.084C1 14.875 2.083 16 3.43 16h9.746c1.317 0 2.429-1.096 2.429-2.458v-.947l1.932 1.184c.82.503 1.463.089 1.463-.918l-.03-6.722Zm-7.638 3.76L7.38 12.507c-.087.059-.175.059-.263.059a.516.516 0 0 1-.497-.503V6.879c0-.089.029-.177.058-.266.146-.237.44-.326.673-.178l3.951 2.606a.5.5 0 0 1 .176.178.46.46 0 0 1-.146.68Z" fill="currentColor" fill-rule="nonzero" /><path d="M0 0h20v20H0z" /></g></symbol><symbol viewBox="0 0 20 20" id="icon-message-message"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v20H0z" /><path d="M17.55 9.161c.8 0 1.45.64 1.45 1.43v3.894c0 .789-.65 1.43-1.45 1.43h-1.025v.617c.008.252-.15.511-.449.462l-.13-.04-.175-.093-1.43-.947h-2.856c-.8 0-1.45-.64-1.45-1.43V10.59c0-.789.65-1.429 1.45-1.429h6.065ZM14.54 3c1.335 0 2.418 1.067 2.418 2.385V7.92h-5.706c-1.336 0-2.419 1.067-2.419 2.384v4.585l-1.447.958-.291.156-.216.066c-.498.082-.763-.351-.751-.77l.001-1.032H4.42C3.083 14.267 2 13.2 2 11.882V5.385C2 4.067 3.083 3 4.419 3h10.12Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-message-refresh"><defs><style>@font-face{font-family:feedback-iconfont;src:url(//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944) format("woff2"),url(//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944) format("woff"),url(//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944) format("truetype")}</style></defs><path d="m87.552 225.646 59.319 46.665C223.305 159.232 375.66 74.094 511.854 74.094c165.668 0 336.75 122.075 401.042 264.045-50.25 18.871-140.288 95.452-140.288 95.452L1023.634 614.4V511.854C1023.707 229.669 794.04 0 511.854 0A511.269 511.269 0 0 0 87.552 225.646zm31.159 454.948c50.249-19.163 132.315-90.331 132.315-90.331L0 409.453v102.4c0 282.186 229.669 511.854 511.854 511.854a511.269 511.269 0 0 0 424.375-225.645L877.64 754.03c-76.434 113.005-229.449 197.924-365.787 197.924-165.669 0-328.85-129.463-393.143-271.36z" /></symbol><symbol viewBox="0 0 16 13" id="icon-message-voice"><path d="M3.594 2.995v7.007H1.197C.536 10.002 0 9.474 0 8.844V4.151c0-.638.53-1.156 1.197-1.156h2.397ZM7.426.192c.53-.387.959-.169.959.47v11.673c0 .646-.425.86-.958.47l-3.832-2.803V2.995L7.427.192Zm5.354 11.221c-.333-.32-.333-.745 0-1.065 2.11-2.024 2.11-5.22 0-7.243-.333-.32-.333-.747 0-1.066.333-.32.777-.32 1.11 0C15.223 3.318 16 4.915 16 6.62c0 1.705-.777 3.409-2.11 4.58a.868.868 0 0 1-.554.213c-.223.213-.445.107-.556 0Zm-2.22-1.171a.868.868 0 0 1-.556-.213c-.333-.32-.333-.746 0-1.066 1.332-1.278 1.332-3.195 0-4.474-.333-.32-.333-.745 0-1.065.333-.32.777-.32 1.11 0 1.999 1.81 1.999 4.688 0 6.498-.221.214-.333.32-.555.32Z" fill="currentColor" fill-rule="nonzero" /></symbol><symbol viewBox="0 0 126 89" id="icon-noData-no-join"><g fill="none" fill-rule="evenodd"><path d="M0 0h126v89H0z" /><path d="M62.304 59.08c-19.39 6.948-29.728 6.37-31.012-1.734-1.925-12.157 16.025-11.174 14.034-.562C44 63.86 39.508 68.724 31.854 71.38" stroke="currentColor" stroke-width="2" stroke-linecap="round" /><g fill-rule="nonzero"><path d="M76.577 44.006c0 6.243-5.01 11.304-11.19 11.304h-3.849c-6.18 0-11.19-5.06-11.19-11.304V27.304a11.359 11.359 0 0 1 3.277-7.994A11.13 11.13 0 0 1 61.538 16h3.848c6.18 0 11.19 5.061 11.19 11.304v16.702Z" fill="#979FCB" /><path d="M78.394 37.62v6.965c0 6.96-5.701 12.603-12.738 12.603h-4.382c-7.038 0-12.743-5.643-12.743-12.603v-6.964h-2.069v8.256c0 7.924 6.497 14.347 14.504 14.347h4.99c8.014 0 14.506-6.423 14.506-14.347v-8.256h-2.068Z" fill="#394B97" /><path fill="#394B97" d="M61.034 58.259h5.828v10.81h-5.828z" /><path d="M79.491 73v-.835c0-2.796-2.574-5.062-5.76-5.062H54.165c-3.178 0-5.76 2.27-5.76 5.062V73h31.086Z" fill="#394B97" /><path d="M65.033 25.828h11.544v2.601H65.033v-2.601Zm-14.685 0h11.543v2.601H50.348v-2.601Zm14.685 4.58h11.544v2.602H65.033v-2.602Zm-14.685 0h11.543v2.602H50.348v-2.602Zm14.685 4.94h11.544v2.606H65.033v-2.606Zm-14.685 0h11.543v2.606H50.348v-2.606Zm14.685 4.589h11.544v2.597H65.033v-2.597Zm-14.685 0h11.543v2.597H50.348v-2.597Z" fill="#5161A4" /></g><path d="M94.607 58.464a1 1 0 0 1 0 1.415l-2.122 2.12 2.122 2.122a1 1 0 1 1-1.415 1.415l-2.122-2.122-2.12 2.122a1 1 0 1 1-1.414-1.415L89.656 62l-2.12-2.12a1 1 0 0 1 1.414-1.415l2.12 2.121 2.122-2.12a1 1 0 0 1 1.415 0Z" fill="#FFF" /></g></symbol><symbol viewBox="0 0 126 89" id="icon-noData-no-message"><g fill="none" fill-rule="evenodd"><path d="M0 0h126v89H0z" /><g transform="translate(27 22)"><g fill-rule="nonzero"><path d="M47.821 0c2.484.003 4.497 2.028 4.5 4.526v4.527h-18C30.6 9.053 28 12.256 28 16v11h-2l-6.08 6.8a1.12 1.12 0 0 1-1.226.246A1.132 1.132 0 0 1 18 33v-6h-3c-2.484-.003-4.926-1.87-4.929-4.369V4.526c.003-2.498 2.016-4.523 4.5-4.526ZM23.932 11.488a2.24 2.24 0 0 0-2.452.49 2.273 2.273 0 0 0-.488 2.467 2.25 2.25 0 0 0 2.08 1.397 2.257 2.257 0 0 0 2.25-2.263c0-.915-.55-1.74-1.39-2.091Z" fill="#5161A4" /><path d="M65.365 11H34.777a4.715 4.715 0 0 0-4.706 4.714v18.857a4.715 4.715 0 0 0 4.706 4.715h11.278l4.36 4.369a1.175 1.175 0 0 0 1.665 0l4.36-4.37h8.925a4.715 4.715 0 0 0 4.706-4.714V15.714A4.715 4.715 0 0 0 65.365 11Z" fill="#979FCB" /><path d="M41.836 27.5a2.355 2.355 0 0 1-2.353-2.357 2.355 2.355 0 0 1 2.353-2.357c1.3 0 2.353 1.055 2.353 2.357a2.355 2.355 0 0 1-2.353 2.357ZM51.248 27.5c-.952 0-1.81-.574-2.174-1.455a2.36 2.36 0 0 1 .51-2.569 2.35 2.35 0 0 1 2.564-.51 2.357 2.357 0 0 1 1.452 2.177 2.355 2.355 0 0 1-2.352 2.357ZM60.66 27.5a2.355 2.355 0 0 1-2.354-2.357 2.355 2.355 0 0 1 2.353-2.357c1.3 0 2.353 1.055 2.353 2.357A2.355 2.355 0 0 1 60.66 27.5Z" fill="#FFF" /></g><circle fill="#FFF" cx="68.071" cy="12" r="4" /><path d="M10.607 33.464a1 1 0 0 1 0 1.415l-2.122 2.12 2.122 2.122a1 1 0 1 1-1.415 1.415L7.07 38.414l-2.12 2.122a1 1 0 0 1-1.414-1.415L5.656 37l-2.12-2.12a1 1 0 0 1 1.414-1.415l2.12 2.121 2.122-2.12a1 1 0 0 1 1.415 0Z" fill="#FFF" /></g></g></symbol><symbol viewBox="0 0 126 89" id="icon-noData-no-user"><defs><ellipse id="icon-noData-no-user_a" cx="11.241" cy="11.244" rx="11.241" ry="11.244" /></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h126v89H0z" /><g transform="translate(32 27)"><rect fill="#979FCB" x="3.91" y="5.867" width="58.09" height="38.133" rx="3.911" /><path d="M48.739 0c.54 0 .977.438.977.977v2.934h2.932a.978.978 0 1 1 0 1.956l-2.933-.001.001 2.934a.977.977 0 0 1-1.955 0V5.866h-2.932a.978.978 0 0 1 0-1.955h2.931l.001-2.934c0-.54.438-.977.978-.977Z" fill="#FFF" /><g transform="translate(0 .978)"><mask id="icon-noData-no-user_b" fill="#fff"><use xlink:href="#icon-noData-no-user_a" /></mask><use fill="#FFF" xlink:href="#icon-noData-no-user_a" /><path d="M9.775-1.956c7.82 0 8.797 2.934 8.797 2.934s-.977 5.866-6.842 6.844v-3.91C9.123 9.125 4.887 10.755-.977 8.8-1.955 4.889 1.955-1.956 9.775-1.956Z" fill="#5161A4" mask="url(#icon-noData-no-user_b)" /></g><path d="M30.334 32.19V18.654a2.933 2.933 0 0 1 4.582-2.426l9.956 6.768a2.933 2.933 0 0 1 0 4.852l-9.956 6.768a2.933 2.933 0 0 1-4.582-2.426Z" fill="#5161A4" /><path d="M3.91 27.378h20.527c1.303 0 1.955-.652 1.955-1.956v-5.868a3.91 3.91 0 1 1 7.82 0V26.4c.326 5.867-3.177 8.8-10.508 8.8l1.1 8.8H7.82a3.911 3.911 0 0 1-3.911-3.911V27.378Z" fill="#FFF" /><path fill="#5161A4" d="M5.865 27.378H15.7l-4.422 7.782z" /><path d="M11.241 19.644c1.89 0 3.421-1.22 3.421-3.11H7.82c0 1.89 1.532 3.11 3.421 3.11Z" fill="#979FCB" /></g></g></symbol><symbol viewBox="0 0 128 100" id="icon-svg-dashboard"><path d="M27.429 63.638c0-2.508-.893-4.65-2.679-6.424-1.786-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.465 2.662-1.785 1.774-2.678 3.916-2.678 6.424 0 2.508.893 4.65 2.678 6.424 1.786 1.775 3.94 2.662 6.465 2.662 2.524 0 4.678-.887 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm13.714-31.801c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM71.714 65.98l7.215-27.116c.285-1.23.107-2.378-.536-3.443-.643-1.064-1.56-1.762-2.75-2.094-1.19-.33-2.333-.177-3.429.462-1.095.639-1.81 1.573-2.143 2.804l-7.214 27.116c-2.857.237-5.405 1.266-7.643 3.088-2.238 1.822-3.738 4.152-4.5 6.992-.952 3.644-.476 7.098 1.429 10.364 1.905 3.265 4.69 5.37 8.357 6.317 3.667.947 7.143.474 10.429-1.42 3.285-1.892 5.404-4.66 6.357-8.305.762-2.84.619-5.607-.429-8.305-1.047-2.697-2.762-4.85-5.143-6.46zm47.143-2.342c0-2.508-.893-4.65-2.678-6.424-1.786-1.775-3.94-2.662-6.465-2.662-2.524 0-4.678.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.786 1.775 3.94 2.662 6.464 2.662 2.524 0 4.679-.887 6.465-2.662 1.785-1.775 2.678-3.916 2.678-6.424zm-45.714-45.43c0-2.509-.893-4.65-2.679-6.425C68.68 10.01 66.524 9.122 64 9.122c-2.524 0-4.679.887-6.464 2.661-1.786 1.775-2.679 3.916-2.679 6.425 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm32 13.629c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM128 63.638c0 12.351-3.357 23.78-10.071 34.286-.905 1.372-2.19 2.058-3.858 2.058H13.93c-1.667 0-2.953-.686-3.858-2.058C3.357 87.465 0 76.037 0 63.638c0-8.613 1.69-16.847 5.071-24.703C8.452 31.08 13 24.312 18.714 18.634c5.715-5.68 12.524-10.199 20.429-13.559C47.048 1.715 55.333.035 64 .035c8.667 0 16.952 1.68 24.857 5.04 7.905 3.36 14.714 7.88 20.429 13.559 5.714 5.678 10.262 12.446 13.643 20.301 3.38 7.856 5.071 16.09 5.071 24.703z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-example"><path d="M96.258 57.462h31.421C124.794 27.323 100.426 2.956 70.287.07v31.422a32.856 32.856 0 0 1 25.971 25.97zm-38.796-25.97V.07C27.323 2.956 2.956 27.323.07 57.462h31.422a32.856 32.856 0 0 1 25.97-25.97zm12.825 64.766v31.421c30.46-2.885 54.507-27.253 57.713-57.712H96.579c-2.886 13.466-13.146 23.726-26.292 26.291zM31.492 70.287H.07c2.886 30.46 27.253 54.507 57.713 57.713V96.579c-13.466-2.886-23.726-13.146-26.291-26.292z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-svg-eye-open"><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085zm0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334zm0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333zm0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z" /></symbol><symbol viewBox="0 0 128 64" id="icon-svg-eye"><path d="M127.072 7.994c1.37-2.208.914-5.152-.914-6.87-2.056-1.717-4.797-1.226-6.396.982-.229.245-25.586 32.382-55.74 32.382-29.24 0-55.74-32.382-55.968-32.627-1.6-1.963-4.57-2.208-6.397-.49C-.17 3.086-.399 6.275 1.2 8.238c.457.736 5.94 7.36 14.62 14.72L4.17 35.96c-1.828 1.963-1.6 5.152.228 6.87.457.98 1.6 1.471 2.742 1.471s2.284-.49 3.198-1.472l12.564-13.983c5.94 4.416 13.021 8.587 20.788 11.53l-4.797 17.418c-.685 2.699.686 5.397 3.198 6.133h1.37c2.057 0 3.884-1.472 4.341-3.68L52.6 42.83c3.655.736 7.538 1.227 11.422 1.227 3.883 0 7.767-.49 11.422-1.227l4.797 17.173c.457 2.208 2.513 3.68 4.34 3.68.457 0 .914 0 1.143-.246 2.513-.736 3.883-3.434 3.198-6.133l-4.797-17.172c7.767-2.944 14.848-7.114 20.788-11.53l12.336 13.738c.913.981 2.056 1.472 3.198 1.472s2.284-.49 3.198-1.472c1.828-1.963 1.828-4.906.228-6.87l-11.65-13.001c9.366-7.36 14.849-14.474 14.849-14.474z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-form"><path d="M84.068 23.784c-1.02 0-1.877-.32-2.572-.96a8.588 8.588 0 0 1-1.738-2.237 11.524 11.524 0 0 1-1.042-2.621c-.232-.895-.348-1.641-.348-2.238V0h.278c.834 0 1.622.085 2.363.256.742.17 1.645.575 2.711 1.214 1.066.64 2.363 1.535 3.892 2.686 1.53 1.15 3.453 2.664 5.77 4.54 2.502 2.045 4.494 3.771 5.977 5.178 1.483 1.406 2.618 2.6 3.406 3.58.787.98 1.274 1.812 1.46 2.494.185.682.277 1.278.277 1.79v2.046H84.068zM127.3 84.01c.278.682.464 1.535.556 2.558.093 1.023-.37 2.003-1.39 2.94-.463.427-.88.832-1.25 1.215-.372.384-.696.704-.974.96a6.69 6.69 0 0 1-.973.767l-11.816-10.741a44.331 44.331 0 0 0 1.877-1.535 31.028 31.028 0 0 1 1.737-1.406c1.112-.938 2.317-1.343 3.615-1.215 1.297.128 2.363.405 3.197.83.927.427 1.923 1.173 2.989 2.239 1.065 1.065 1.876 2.195 2.432 3.388zM78.23 95.902c2.038 0 3.752-.511 5.143-1.534l-26.969 25.83H18.037c-1.761 0-3.684-.47-5.77-1.407a24.549 24.549 0 0 1-5.838-3.709 21.373 21.373 0 0 1-4.518-5.306c-1.204-2.003-1.807-4.07-1.807-6.202V16.495c0-1.79.44-3.665 1.32-5.626A18.41 18.41 0 0 1 5.04 5.562a21.798 21.798 0 0 1 5.213-3.964C12.198.533 14.237 0 16.37 0h53.24v15.984c0 1.62.278 3.367.834 5.242a16.704 16.704 0 0 0 2.572 5.179c1.159 1.577 2.665 2.898 4.518 3.964 1.853 1.066 4.078 1.598 6.673 1.598h20.295v42.325L85.458 92.45c1.02-1.364 1.529-2.856 1.529-4.476 0-2.216-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1c-2.409 0-4.448.789-6.116 2.366-1.668 1.577-2.502 3.474-2.502 5.69 0 2.217.834 4.092 2.502 5.626 1.668 1.535 3.707 2.302 6.117 2.302h52.13zM26.1 47.951c-2.41 0-4.449.789-6.117 2.366-1.668 1.577-2.502 3.473-2.502 5.69 0 2.216.834 4.092 2.502 5.626 1.668 1.534 3.707 2.302 6.117 2.302h52.13c2.409 0 4.47-.768 6.185-2.302 1.715-1.534 2.572-3.41 2.572-5.626 0-2.217-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1zm52.407 64.063 1.807-1.663 3.476-3.196a479.75 479.75 0 0 0 4.587-4.284 500.757 500.757 0 0 1 5.004-4.667c3.985-3.666 8.48-7.758 13.485-12.276l11.677 10.741-13.485 12.404-5.004 4.603-4.587 4.22a179.46 179.46 0 0 0-3.267 3.068c-.88.853-1.367 1.322-1.46 1.407-.463.341-.973.703-1.529 1.087-.556.383-1.112.703-1.668.959-.556.256-1.413.575-2.572.959a83.5 83.5 0 0 1-3.545 1.087 72.2 72.2 0 0 1-3.475.895c-1.112.256-1.946.426-2.502.511-1.112.17-1.854.043-2.224-.383-.371-.426-.464-1.151-.278-2.174.092-.511.278-1.279.556-2.302.278-1.023.602-2.067.973-3.132l1.042-3.005c.325-.938.58-1.577.765-1.918a10.157 10.157 0 0 1 2.224-2.941z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-link"><path d="M115.625 127.937H.063V12.375h57.781v12.374H12.438v90.813h90.813V70.156h12.374z" /><path d="m116.426 2.821 8.753 8.753-56.734 56.734-8.753-8.745z" /><path d="M127.893 37.982h-12.375V12.375H88.706V0h39.187z" /></symbol><symbol viewBox="0 0 33 52" id="icon-svg-loading"><path d="M11.522 33.8c-.608 1.65-.357 3.564.83 4.99 1.766 2.13 4.931 2.383 7.083.557 2.143-1.826 2.452-5.03.686-7.159-1.506-1.816-4.025-2.266-6.07-1.23a3.02 3.02 0 0 1 2.923 1.025c1.081 1.309.898 3.272-.424 4.385-1.313 1.114-3.253.967-4.333-.342a3.036 3.036 0 0 1-.695-2.226Zm4.713 10.83c-5.003 0-9.059-4.096-9.059-9.14 0-5.045 4.056-9.141 9.059-9.141 5.003 0 9.059 4.096 9.059 9.14 0 5.055-4.056 9.141-9.06 9.141Zm5.62-24.83c6.126 2.337 10.484 8.372 10.484 15.453 0 9.099-7.208 16.487-16.104 16.487C7.339 51.74.13 44.362.13 35.253c0-7.839 5.342-14.397 12.5-16.067V2.935c0-1.096.865-1.978 1.937-1.978 5.897 0 10.693 4.867 10.693 10.882a11.015 11.015 0 0 1-3.405 7.962Zm-5.62 27.877c6.674 0 12.078-5.687 12.078-12.695 0-7.009-5.404-12.696-12.078-12.696-6.674 0-12.078 5.687-12.078 12.696 0 7.008 5.404 12.695 12.078 12.695Zm0-29.454c2.915-.838 5.032-3.482 5.032-6.601 0-3.12-2.117-5.754-5.032-6.602v13.203Z" fill="#01C1B5" fill-rule="evenodd" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-nested"><path d="M.002 9.2c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-5.043-3.58-9.132-7.997-9.132S.002 4.157.002 9.2zM31.997.066h95.981V18.33H31.997V.066zm0 45.669c0 5.044 3.58 9.132 7.998 9.132 4.417 0 7.997-4.088 7.997-9.132 0-3.263-1.524-6.278-3.998-7.91-2.475-1.63-5.524-1.63-7.998 0-2.475 1.632-4 4.647-4 7.91zM63.992 36.6h63.986v18.265H63.992V36.6zm-31.995 82.2c0 5.043 3.58 9.132 7.998 9.132 4.417 0 7.997-4.089 7.997-9.132 0-5.044-3.58-9.133-7.997-9.133s-7.998 4.089-7.998 9.133zm31.995-9.131h63.986v18.265H63.992V109.67zm0-27.404c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-3.263-1.524-6.277-3.998-7.909-2.475-1.631-5.524-1.631-7.998 0-2.475 1.632-4 4.646-4 7.91zm31.995-9.13h31.991V91.4H95.987V73.135z" /></symbol><symbol fill="curentColor" viewBox="0 0 128 128" id="icon-svg-password"><path d="M108.8 44.322H89.6v-5.36c0-9.04-3.308-24.163-25.6-24.163-23.145 0-25.6 16.881-25.6 24.162v5.361H19.2v-5.36C19.2 15.281 36.798 0 64 0c27.202 0 44.8 15.281 44.8 38.961v5.361zm-32 39.356c0-5.44-5.763-9.832-12.8-9.832-7.037 0-12.8 4.392-12.8 9.832 0 3.682 2.567 6.808 6.407 8.477v11.205c0 2.718 2.875 4.962 6.4 4.962 3.524 0 6.4-2.244 6.4-4.962V92.155c3.833-1.669 6.393-4.795 6.393-8.477zM128 64v49.201c0 8.158-8.645 14.799-19.2 14.799H19.2C8.651 128 0 121.359 0 113.201V64c0-8.153 8.645-14.799 19.2-14.799h89.6c10.555 0 19.2 6.646 19.2 14.799z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-table"><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z" /><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-tree"><path d="M126.713 90.023c.858.985 1.287 2.134 1.287 3.447v29.553c0 1.423-.429 2.6-1.287 3.53-.858.93-1.907 1.395-3.146 1.395H97.824c-1.145 0-2.146-.465-3.004-1.395-.858-.93-1.287-2.107-1.287-3.53V93.47c0-.875.19-1.696.572-2.462.382-.766.906-1.368 1.573-1.806a3.84 3.84 0 0 1 2.146-.657h9.725V69.007a3.84 3.84 0 0 0-.43-1.806 3.569 3.569 0 0 0-1.143-1.313 2.714 2.714 0 0 0-1.573-.492h-36.47v23.149h9.725c1.144 0 2.145.492 3.004 1.478.858.985 1.287 2.134 1.287 3.447v29.553c0 .876-.191 1.696-.573 2.463-.38.766-.905 1.368-1.573 1.806a3.84 3.84 0 0 1-2.145.656H51.915a3.84 3.84 0 0 1-2.145-.656c-.668-.438-1.216-1.04-1.645-1.806a4.96 4.96 0 0 1-.644-2.463V93.47c0-1.313.43-2.462 1.288-3.447.858-.986 1.907-1.478 3.146-1.478h9.582v-23.15h-37.9c-.953 0-1.74.356-2.359 1.068-.62.711-.93 1.56-.93 2.544v19.538h9.726c1.239 0 2.264.492 3.074 1.478.81.985 1.216 2.134 1.216 3.447v29.553c0 1.423-.405 2.6-1.216 3.53-.81.93-1.835 1.395-3.074 1.395H4.29c-.476 0-.93-.082-1.358-.246a4.1 4.1 0 0 1-1.144-.657 4.658 4.658 0 0 1-.93-1.067 5.186 5.186 0 0 1-.643-1.395 5.566 5.566 0 0 1-.215-1.56V93.47c0-.437.048-.875.143-1.313a3.95 3.95 0 0 1 .429-1.15c.19-.328.429-.656.715-.984.286-.329.572-.602.858-.821.286-.22.62-.383 1.001-.493.382-.11.763-.164 1.144-.164h9.726V61.619c0-.985.31-1.833.93-2.544.619-.712 1.358-1.068 2.216-1.068h44.335V39.62h-9.582c-1.24 0-2.288-.492-3.146-1.477a5.09 5.09 0 0 1-1.287-3.448V5.14c0-1.423.429-2.627 1.287-3.612.858-.985 1.907-1.477 3.146-1.477h25.743c.763 0 1.478.246 2.145.739a5.17 5.17 0 0 1 1.573 1.888c.382.766.573 1.587.573 2.462v29.553c0 1.313-.43 2.463-1.287 3.448-.859.985-1.86 1.477-3.004 1.477h-9.725v18.389h42.762c.954 0 1.74.355 2.36 1.067.62.711.93 1.56.93 2.545v26.925h9.582c1.239 0 2.288.492 3.146 1.478z" /></symbol><symbol fill="curentColor" viewBox="0 0 130 130" id="icon-svg-user"><path d="M63.444 64.996c20.633 0 37.359-14.308 37.359-31.953 0-17.649-16.726-31.952-37.359-31.952-20.631 0-37.36 14.303-37.358 31.952 0 17.645 16.727 31.953 37.359 31.953zM80.57 75.65H49.434c-26.652 0-48.26 18.477-48.26 41.27v2.664c0 9.316 21.608 9.325 48.26 9.325H80.57c26.649 0 48.256-.344 48.256-9.325v-2.663c0-22.794-21.605-41.271-48.256-41.271z" stroke="currentColor" /></symbol>',t.insertBefore(e,t.lastChild)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n):n()}const Xu=Ya({setup(n){const t=Se.parse(location.search),e=location.href.split("#/")[1],r=Se.parse(e.split("?")[1]),i=t.roomUid||r.roomUid||"";return i&&sessionStorage.setItem("roomUid",i),(o,s)=>{const c=Fu("router-view");return ks(),Ls(Ds(Bu),{locale:Ds($u),message:{max:1}},{default:Us(()=>[wi(c,null,{default:Us(({Component:d})=>[(ks(),Ls(Hu(d)))]),_:1})]),_:1},8,["locale"])}}}),td="modulepreload",xs={},ed="./",hi=function(t,e){return!e||e.length===0?t():Promise.all(e.map(r=>{if(r=`${ed}${r}`,r in xs)return;xs[r]=!0;const i=r.endsWith(".css"),o=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${o}`))return;const s=document.createElement("link");if(s.rel=i?"stylesheet":td,i||(s.as="script",s.crossOrigin=""),s.href=r,document.head.appendChild(s),i)return new Promise((c,d)=>{s.addEventListener("load",c),s.addEventListener("error",d)})})).then(()=>t())};function nd(n){switch(n){case"../src/pages/404/index.tsx":return hi(()=>import("./index.11b3d4cf.js"),["assets/index.11b3d4cf.js","assets/index.49150f4c.css","assets/vendor.65bdc0e9.js"]);case"../src/pages/home/index.tsx":return hi(()=>import("./index.a2d0e865.js"),["assets/index.a2d0e865.js","assets/index.b94cb86f.css","assets/vendor.65bdc0e9.js"]);case"../src/pages/login/index.tsx":return hi(()=>import("./index.27a8ba53.js"),["assets/index.27a8ba53.js","assets/index.526ec19c.css","assets/vendor.65bdc0e9.js"]);default:return new Promise(function(t,e){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(e.bind(null,new Error("Unknown variable dynamic import: "+n)))})}}const zn=n=>async()=>{let t=Promise.resolve(null);try{t=await nd(`../src/pages/${n}/index.tsx`)}catch{t=Promise.reject()}return t};var rd=[{path:"/",component:zn("home")},{path:"/home",component:zn("home")},{path:"/login",component:zn("login")},{path:"/:pathMatch(.*)*",component:zn("404"),meta:{title:"404 Not Fund"}}],Gr=Gu({history:Ku(),routes:rd}),id=Ya({name:"SvgIcon",props:{prefix:{type:String,default:"icon"},name:{type:String,required:!0},color:{type:String,default:"#333"},onClick:{type:Function,default:()=>{}}},render(){const{name:n,prefix:t,color:e}=this,r=`#${t}-${n}`;return wi("svg",ju(this.$attrs,{onClick:this.onClick,"aria-hidden":"true",style:{color:e}}),[wi("use",{href:r,fill:e},null)])}}),od={install(n){n.component("SvgIcon",id)}};const vo="live_admin_token",Wa=()=>sessionStorage.getItem(vo);function ep(n){return sessionStorage.setItem(vo,n)}function Za(){return sessionStorage.removeItem(vo)}let In=0,Qa;const sd=n=>{if(In===0){const t=Object.assign({lock:!0,text:"\u52A0\u8F7D\u4E2D...",background:"rgba(0, 0, 0, 0.7)"},n);Qa=qu.service(oe({},t))}In++},ad=()=>{In<=0||(In--,In===0&&Qa.close())};var Pi;(function(n){n[n.READ=1]="READ",n[n.LISTENED=2]="LISTENED",n[n.DOWNLOADED=4]="DOWNLOADED",n[n.RETRIEVED=8]="RETRIEVED",n[n.UNREAD=0]="UNREAD"})(Pi||(Pi={}));var me,pi,Un=Pi,cd=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],ud=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],dd=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],Vs={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"RC:FileMsg":{isCounted:!0,isPersited:!0},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},ld=["RC:TypSts","RC:InterceptMsg"];(function(n){n.WEBSOCKET="websocket",n.COMET="comet"})(me||(me={}));var Kr=function(n){return pi||(pi={set:function(t,e){n.localStorage.setItem(t,JSON.stringify(e))},get:function(t){var e;try{e=JSON.parse(n.localStorage.getItem(t))}catch{e=null}return e},remove:function(t){return n.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var e in n.localStorage)t.push(e);return t}}),pi},hd=function(){function n(t){this._caches={},t&&(this._caches=t)}return n.prototype.set=function(t,e){this._caches[t]=e},n.prototype.remove=function(t){var e=this.get(t);return delete this._caches[t],e},n.prototype.get=function(t){return this._caches[t]},n.prototype.getKeys=function(){var t=[];for(var e in this._caches)t.push(e);return t},n}(),Li=function(){function n(t,e){var r,i=e?"".concat("RCV4-").concat(e):"RCV4-";this._rootStorage=Kr(t);var o=this._rootStorage.get(i)||{};this._cache=new hd(((r={})[i]=o,r)),this._storageKey=i}return n.prototype._get=function(){var t=this._storageKey;return this._cache.get(t)||{}},n.prototype._set=function(t){var e=this._storageKey;t=t||{},this._cache.set(e,t),this._rootStorage.set(e,t)},n.prototype.set=function(t,e){var r=this._get();r[t]=e,this._set(r)},n.prototype.remove=function(t){var e=this._get();delete e[t],this._set(e)},n.prototype.clear=function(){var t=this._storageKey;this._rootStorage.remove(t),this._cache.remove(t)},n.prototype.get=function(t){return this._get()[t]},n.prototype.getKeys=function(){var t=this._get(),e=[];for(var r in t)e.push(r);return e},n.prototype.getValues=function(){return this._get()||{}},n}(),Ui=function(n,t){return Ui=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},Ui(n,t)};function It(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=n}Ui(n,t),n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var pt=function(){return pt=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},pt.apply(this,arguments)};function V(n,t,e,r){return new(e||(e=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function c(l){try{d(r.throw(l))}catch(h){o(h)}}function d(l){var h;l.done?i(l.value):(h=l.value,h instanceof e?h:new e(function(a){a(h)})).then(s,c)}d((r=r.apply(n,t||[])).next())})}function B(n,t){var e,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(d){return function(l){return function(h){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,r&&(i=2&h[0]?r.return:h[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,h[1])).done)return i;switch(r=0,i&&(h=[2&h[0],i.value]),h[0]){case 0:case 1:i=h;break;case 4:return s.label++,{value:h[1],done:!1};case 5:s.label++,r=h[1],h=[0];continue;case 7:h=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||h[0]!==6&&h[0]!==2)){s=0;continue}if(h[0]===3&&(!i||h[1]>i[0]&&h[1]<i[3])){s.label=h[1];break}if(h[0]===6&&s.label<i[1]){s.label=i[1],i=h;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(h);break}i[2]&&s.ops.pop(),s.trys.pop();continue}h=t.call(n,s)}catch(a){h=[6,a],r=0}finally{e=i=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([d,l])}}}function Pe(n,t,e){if(e||arguments.length===2)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return n.concat(r||Array.prototype.slice.call(t))}(function(n){function t(e){return n.call(this,"TODO => ".concat(e))||this}return It(t,n),t})(Error);var Bs=function(n,t,e){if(t===void 0||e===void 0)return n.toUpperCase();var r=n.slice(t,e);return n=n.replace(r,function(i){return i.toUpperCase()})},Xa=function(n,t){t===void 0&&(t="utf-8");var e,r=0;if(t==="utf-16")for(var i=0,o=n.length;i<o;i++)r+=(e=n.charCodeAt(i))<=65535?2:4;else for(i=0,o=n.length;i<o;i++)r+=(e=n.charCodeAt(i))<127?1:e<=2047?2:e<=65535?3:4;return r},jr=function(n,t){if(n=n.replace(/\?$/,""),!t)return n;var e=Object.keys(t).map(function(r){return"".concat(r,"=").concat(t[r])}).filter(function(r){return!!r});return e.length?[n,e.join("&")].join("?"):n},To=function(n){return n.match(/\d+(\.\d+){2}/)[0]},Fs=function(n){if(n.tag!=="browser")return{type:n.tag,version:"UnKonw"};var t,e,r=navigator.userAgent,i={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){e=o,t=s[1]||s[2];break}}return{type:e||"UnKonw",version:t||"UnKonw"}},tc=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0;return(n==="x"?t:3&t|8).toString(16)})},ec=function(){var n=tc();if(n=n.replace(/-/g,"")+"a",(n=function(r){var i="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),o=i.length+1,s=+r,c=[];do{var d=s%o;s=(s-d)/o,c.unshift(i[d])}while(s);return c.join("")}(n=parseInt(n,16))).length>22&&(n=n.slice(0,22)),n.length<22)for(var t=22-n.length,e=0;e<t;e++)n+="0";return n},Di=function(n){var t="RCDeviceId",e=Kr(n),r="",i=e.get(t);return i?r=i:(r=ec(),e.set(t,r)),r},We="RC_Logs";function pd(n){var t=n.target.result;n.oldVersion===1&&t.deleteObjectStore(We),function(e,r,i){var o;if(!e.objectStoreNames.contains(r)){var s=pt({},i.objectStoreParams);o=e.createObjectStore(r,s),i.indexs&&i.indexs.length>0&&i.indexs.forEach(function(c){o.createIndex(c.indexName,c.key,{unique:c.unique})})}}(t,We,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var Nt,Ye,$t,yr,ki,yo=function(){function n(){}return n.init=function(){if(typeof window!="undefined"&&window&&window.indexedDB){var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(e){console.warn("open indexDB request failed "+e.target.error)},t.onsuccess=function(e){n._db=e.target.result,n._db&&(n._db.onclose=function(r){var i;console.warn("The database ".concat((i=n._db)===null||i===void 0?void 0:i.name," has unexpectedly closed."),r),n._db=null,n._instance=null},n._db.onerror=function(r){var i;console.warn("The database ".concat((i=n._db)===null||i===void 0?void 0:i.name," has opening error."),r),n._db=null,n._instance=null},n._db.onabort=function(r){var i;console.warn("The database ".concat((i=n._db)===null||i===void 0?void 0:i.name," has opening aborted."),r),n._db=null,n._instance=null}),n._instance=new n},t.onupgradeneeded=function(e){n._db=e.target.result,pd(e)}}else console.debug("IndexDB is not currently supported in the environment!")},n.getInstance=function(){return n._instance},n.prototype.addList=function(t,e){return new Promise(function(r){if(n._db){var i=n._db.transaction([t],"readwrite"),o=i.objectStore(t);e.forEach(function(s){o==null||o.add(s)}),i.oncomplete=function(s){r(!0)},i.onerror=function(s){r(!1)}}else r(!1)})},n.prototype.getRangeData=function(t,e,r,i){return new Promise(function(o){if(n._db){var s=n._db.transaction([t],"readwrite").objectStore(t),c=IDBKeyRange.bound(r,i),d=s.index(e),l=[],h=d.openCursor(c);h.onsuccess=function(a){var u=a.target.result;u?(l.push(u.value),u.continue()):o(l)},h.onerror=function(a){console.error(a),o([])}}else o([])})},n.prototype.getCount=function(t,e){return new Promise(function(r){if(n._db){var i=n._db.transaction([t],"readonly").objectStore(t).count();i.onsuccess=function(){r(i.result)},i.onerror=function(o){console.error(o),r(0)}}else r(0)})},n.prototype.removeFirstData=function(t,e,r){return new Promise(function(i){if(n._db){var o=n._db.transaction([t],"readwrite").objectStore(t),s=o.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var c=s.result;c.length>0&&(o.delete(IDBKeyRange.bound(c[0],c[c.length-1])).onsuccess=function(){i(!0)})}}else i(!1)})},n._db=null,n}(),Hs=function(){function n(){}return n.compress=function(t){for(var e=this,r={},i=0;i<t.length-1;i++){var o=t.charAt(i)+t.charAt(i+1);r.hasOwnProperty(o)?r[o].push(i):r[o]=[i]}for(var s=[],c=[],d=function(){if(c.length>0){var _=c.join("");if(c=[],_.length>26){var v=e.numberEncode(_.length),T=String.fromCharCode(e.dataType.NormalExt|v.length);s.push(T+v)}else{var y=String.fromCharCode(e.dataType.Normal|_.length);s.push(y)}s.push(_)}},l=0;l<t.length;){var h=e.indexOf(r,t,l);if(h.length<2)c.push(t.charAt(l++));else if(h.length<4)c.push(t.substr(l,h.length)),l+=h.length;else{var a=e.numberEncode(l-h.offset),u=e.numberEncode(h.length);if(a.length+u.length>=h.length)c.push(t.substr(l,h.length)),l+=h.length;else{d();var p=String.fromCharCode(e.dataType.Compressed|a.length<<2|u.length);s.push(p+a+u),l+=h.length}}}d();var f=e.numberEncode(t.length),m=String.fromCharCode(e.dataType.Tail|f.length);return s.push(m+f),s.join("")},n.uncompress=function(t){var e=this,r=0,i="";t:do{var o=t.charCodeAt(r++),s=o&e.dataType.Mark,c=15&o,d=void 0;switch(s){case e.dataType.Compressed:var l=c>>2,h=3&c;if(l===0||h===0)throw new Error("Data parsing error,at "+r);var a=e.numberDecode(t.substr(r,l)),u=e.numberDecode(t.substr(r+=l,h));if((a=i.length-a)+u>i.length)throw new Error("Data parsing error,at "+r);r+=h,i+=i.substr(a,u);break;case e.dataType.Tail:if((d=e.numberDecode(t.substr(r,c)))!==i.length)throw console.log(i.length),console.log(d),new Error("Data parsing error,at "+r);r+=c;break t;case e.dataType.NormalExt:d=e.numberDecode(t.substr(r,c)),i+=t.substr(r+=c,d),r+=d;break;case e.dataType.Normal:i+=t.substr(r,c),r+=c;break;case e.dataType.Mark:if(c>10)throw new Error("Data parsing error,at "+r);i+=t.substr(r,16+c),r+=16+c;break;default:throw new Error("Data parsing error,at "+r+" header:"+s)}}while(r<t.length);return i},n.indexOf=function(t,e,r){var i={length:0,offset:-1};if(e.length,r>=e.length-1)return i;var o=t[e.charAt(r)+e.charAt(r+1)];if(o[0]===r)return i;for(var s=e.length-r,c=0,d=o.length;c<d;c++){var l=o[c],h=r-l;if(!(h>this.max)){var a=Math.min(s,h);if(a<=i.length)break;if(!(i.length>2&&e.charAt(l+i.length-1)!==e.charAt(r+i.length-1))){for(var u=2,p=u;p<a&&e.charAt(l+p)===e.charAt(r+p);p++)u++;u>=i.length&&(i.length=u,i.offset=l)}}}return i},n.numberEncode=function(t){var e=this,r=[],i=0;do i=t%e.scale,r.push(e.chars.charAt(i)),t=(t-i)/e.scale;while(t>0);return r.join("")},n.numberDecode=function(t){for(var e=0,r=0,i=t.length-1;i>=0;i--){if((r=this.chars.indexOf(t.charAt(i)))===-1)throw new Error('decode number error, data is "'+t+'"');e=e*this.scale+r}return e},n.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},n.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n.scale=n.chars.length,n.max=238327,n}(),_e=function(){function n(t){this.info=t,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=t.logPolicy.url||this.logUrl,this.level=t.logPolicy.level||this.level,this.itv=t.logPolicy.itv||this.itv,this.times=t.logPolicy.times||this.times,this.deviceId=Di(t.runtime),this.logSwitch=t.logSwitch;var e=Fs(t.runtime);this.deviceInfo="".concat(e.type,"|").concat(e.version,"|").concat(t==null?void 0:t.sessionId)}return n.prototype.updateUploadLogAttr=function(t){var e=t.logPolicy,r=t.logSwitch,i=t.runtime,o=t.sessionId,s=o===void 0?"":o,c=t.userId;if(e){var d=e.url,l=e.level,h=e.itv,a=e.times;this.logUrl=d||this.logUrl,this.level=l||this.level,this.itv=h||this.itv,this.times=a||this.times}if(r&&(this.logSwitch=r),i){this.deviceId=Di(i);var u=Fs(i);this.deviceInfo="".concat(u.type,"|").concat(u.version,"|").concat(s)}c&&(this.info.userId=c)},n.init=function(t){return n.reportSwitch=!0,n._instance||(n._instance=new n(t)),n._instance},n.getInstance=function(){return n._instance},n.prototype.reportRealtimeLog=function(t){var e=this;if(t.length===0||!this.logUrl)return Promise.resolve();var r=Hs.compress(t.map(function(s){return s.content}).join("")),i=Ue(this.logUrl)?"":"https://",o="".concat(i).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");return this.info.runtime.httpReq({method:"POST",url:o,body:r}).then(function(s){var c=s.data;c&&(c=JSON.parse(c),e.itv=c.nextTime,e.level=c.level,e.logSwitch=c.logSwitch,n.currentRTTimes=1)})},n.prototype.reportFullLog=function(t){return V(this,void 0,void 0,function(){var e,r,i,o,s,c,d,l,h,a,u=this;return B(this,function(p){switch(p.label){case 0:return e=t.startTime,r=t.endTime,i=t.platform,o=t.logId,s=t.uri,c=yo.getInstance(),i.toLowerCase()==="web"&&c?e>r?[2]:[4,c.getRangeData(We,"time",e,r)]:[2];case 1:return d=(d=p.sent()).filter(function(f){return!f.userId||f.userId===u.info.userId}),l=Hs.compress(d.map(function(f){return f.content}).join("")||"no data"),h=1,[2,(a=function(){if(h>3||!n.reportSwitch)return Promise.resolve();var f=s||u.logUrl,m=Ue(f)?"":"https://",_="".concat(m).concat(f,"?version=").concat(u.info.version,"&appkey=").concat(u.info.appkey,"&userId=").concat(u.info.userId,"&logId=").concat(o,"&deviceId=").concat(u.deviceId,"&deviceInfo=").concat(u.deviceInfo,"&platform=Web"),v=5e3*(h-1);return h++,new Promise(function(T,y){setTimeout(function(){n.reportSwitch&&u.info.runtime.httpReq({url:_,method:"POST",body:l}).then(function(){T()}).catch(function(w){y(w),a()})},v)})})()]}})})},n.prototype.distroy=function(){n.currentRTTimes=1,n.reportSwitch=!1},n.currentRTTimes=1,n.reportSwitch=!1,n}();(function(n){n[n.LOG=0]="LOG",n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.FATAL=4]="FATAL",n[n.STATISTICS=6]="STATISTICS",n[n.NONE=1e3]="NONE"})(Nt||(Nt={})),function(n){n.IM="IM",n.RTC="RTC"}(Ye||(Ye={})),function(n){n[n.PRIVATE=1]="PRIVATE",n[n.OPEN=0]="OPEN"}($t||($t={})),function(n){n[n.NAVI=1]="NAVI",n[n.TCP=2]="TCP",n[n.WS=3]="WS"}(yr||(yr={})),function(n){n[n.NONE=0]="NONE",n[n.PRIVATE=1]="PRIVATE",n[n.DISCUSSION=2]="DISCUSSION",n[n.GROUP=3]="GROUP",n[n.CHATROOM=4]="CHATROOM",n[n.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",n[n.SYSTEM=6]="SYSTEM",n[n.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",n[n.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",n[n.ULTRA_GROUP=10]="ULTRA_GROUP",n[n.RTC_ROOM=12]="RTC_ROOM"}(ki||(ki={}));var xi,Y=ki;(function(n){n[n.IMAGE=1]="IMAGE",n[n.AUDIO=2]="AUDIO",n[n.VIDEO=3]="VIDEO",n[n.FILE=4]="FILE",n[n.SIGHT=5]="SIGHT",n[n.COMBINE_HTML=6]="COMBINE_HTML"})(xi||(xi={}));var Be,wt=xi,Bt=function(n){return typeof n=="string"},Er=function(n){return typeof n=="boolean"},mt=function(n){return typeof n=="number"&&!isNaN(n)},Ht=function(n){return Object.prototype.toString.call(n).indexOf("Array")!==-1},nc=function(n){return Object.prototype.toString.call(n)==="[object ArrayBuffer]"},Ft=function(n){return Bt(n)&&n.length>0},Rt=function(n){return Object.prototype.toString.call(n)==="[object Object]"},Cr=function(n){return Object.prototype.toString.call(n)==="[object Function]"},ct=function(n){return n===void 0||Object.prototype.toString.call(n)==="[object Undefined]"},$s=function(n){return Object.prototype.toString.call(n)==="[object Null]"},Ue=function(n){return Bt(n)&&/https?:\/\//.test(n)},Ze=function(n){for(var t in n)return!0;return!1},fd=function(n){return mt(n)&&Object.prototype.hasOwnProperty.call(wt,n)},fi=function(n){var t=!1,e=!1,r=!1;if(Rt(n)){var i=Object.keys(n).length;for(var o in t=i>20,n)if(e||(e=Bt(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!r){var s=n[o];r=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:e,isExKeyOrValLengthExceedLimit:r}},pr={};console&&((Be={})[Nt.DEBUG]=console.debug.bind(console),Be[Nt.INFO]=console.info.bind(console),Be[Nt.WARN]=console.warn.bind(console),Be[Nt.ERROR]=console.error.bind(console),Be[Nt.FATAL]=console.log.bind(console),pr=Be);var Vi,Gs=function(n){return Bt(n)||mt(n)||ct(n)||Er(n)?n:n instanceof Error?JSON.stringify({name:n.name,message:n.message,stack:n.stack}):JSON.stringify(n)},Le=function(){function n(t,e,r){this.tag=t,this.type=e,this.initiator=r,this._outLevel=Nt.WARN,this.debug=this.log.bind(this,Nt.DEBUG),this.info=this.log.bind(this,Nt.INFO),this.warn=this.log.bind(this,Nt.WARN),this.error=this.log.bind(this,Nt.ERROR),this.fatal=this.log.bind(this,Nt.FATAL),this.statisticsCaches={},this.baseStatisData={sdkPrivate:$t.OPEN,serverPrivate:$t.OPEN,bundleId:"lib-next"}}return n.init=function(t){n.userId=t},n.reset=function(){n.userId=""},n.prototype._defaultStdout=function(t,e){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];pr[t]&&pr[t].apply(pr,Pe(["".concat(e,":")],r,!1))},n.prototype.__pushLocalLog=function(t,e,r){var i;i=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?Ye.RTC:Ye.IM;var o=Date.now();Xa(e)>=1e3&&(e=function(l,h,a){if(a===void 0&&(a="utf-8"),!l||!h)return"";var u=a==="utf-8"?3:2,p=0,f=0,m="";for(f=0;f<l.length;f++){if(l.charCodeAt(f)>255?p+=u:p++,p>h)return m;m+=l.charAt(f)}return l}(e,1e3));var s=JSON.stringify({message:e,userId:n.userId}).replace(/"/g,'""'),c=/^[\w]+-[\w]+-[\w]+?/.test(r)?r:"".concat(this.initiator||"L","-").concat(r,"-O"),d={sessionId:n.sessionId,time:o,level:4-t,content:"".concat(n.sessionId,",").concat(Date.now(),",").concat(i,",").concat(4-t,",").concat(c,',"').concat(s,`"
- `),userId:n.userId};n.databaseLogList.push(d),(n.databaseLogList.length>=100||t===Nt.FATAL)&&this.__insertLogIntoDatabase()},n.prototype.__insertLogIntoDatabase=function(){return V(this,void 0,void 0,function(){var t,e,r;return B(this,function(i){switch(i.label){case 0:return t=Pe([],n.databaseLogList,!0),n.databaseLogList=[],(e=yo.getInstance())?[4,e.addList(We,t)]:[3,3];case 1:return r=i.sent(),[4,e.getCount(We,"time")];case 2:return i.sent()>1e5&&e.removeFirstData(We,"time",2e3),[2,r];case 3:return[2,!1]}})})},n.prototype.setLogLevel=function(t){this._outLevel=typeof t!="number"?Nt.WARN:t},n.prototype.setLogStdout=function(t){this._logStdout=t},n.prototype.log=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t>Nt.DEBUG&&this.__pushLocalLog(t,e.map(Gs).join(" "),this.tag),!(t<this._outLevel)){var i="".concat(new Date().toISOString(),"[").concat(this.tag,"][").concat(Nt[t],"]"),o="".concat(i," - ").concat(e.map(Gs).join(" "));this._logStdout?this._logStdout(t,o):this._stdout?this._stdout(t,o):this._defaultStdout.apply(this,Pe([t,i],e,!1))}},n.prototype.reportLog=function(t,e,r){this.__pushLocalLog(4-t,r,e);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'.concat(i,'"');var o={level:t,content:[n.sessionId,Date.now(),this.type,t,e,i].join()+`
- `};n.realTimeLogList.push(o),n.realTimeLogList.length>=600&&(n.realTimeLogList=n.realTimeLogList.slice(-500))},n.prototype.set=function(t,e){this.warn("logger.set has being deprecated!")},n.prototype.setStdout=function(t){this._stdout=t},n.prototype.__clearRealTimeLog=function(){n.realTimeLogList=[]},n.prototype.initReportLog=function(t){n._reportLog=_e.init(pt(pt({},t),{sessionId:n.sessionId})),this.startReport()},n.prototype.updateUploadLogAttr=function(t){n._reportLog&&n._reportLog.updateUploadLogAttr(t)},n.prototype.startReport=function(){var t=this;if(n._reportLog&&n._reportLog.logSwitch&&_e.reportSwitch){var e=n._reportLog.itv*Math.pow(2,_e.currentRTTimes-1);_e.currentRTTimes<n._reportLog.times&&_e.currentRTTimes++,setTimeout(function(){var r=n.realTimeLogList.filter(function(i){return i.level<=n._reportLog.level});r.length===0?t.startReport():n._reportLog.reportRealtimeLog(r).then(function(){t.__clearRealTimeLog(),t.debug("report\xA0real-time\xA0log\xA0success"),t.startReport()}).catch(function(i){t.debug("report real-time log error -> "+i),t.startReport()})},1e3*e)}},n.prototype.reportStatisticsLog=function(t,e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d=this;return B(this,function(l){return t&&n._reportLog?(e=Rt(e)?JSON.stringify(e):e,r=4-Nt.STATISTICS,this.__pushLocalLog(r,String(e),t),i=JSON.stringify({message:e}).replace(/"/g,'""'),i='"'.concat(i,'"'),o=this.type,this.type||(o=["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?Ye.RTC:Ye.IM),s={level:r,content:[n.sessionId,Date.now(),o,r,t,i].join()+`
- `},n.realTimeLogList.push(s),c=n.realTimeLogList.filter(function(h){return h.level<=n._reportLog.level}),this.__clearRealTimeLog(),n._reportLog.reportRealtimeLog(c).then(function(){d.debug("report\xA0real-time\xA0log\xA0success")}).catch(function(h){d.debug("report real-time log error -> "+h)}),[2]):[2]})})},n.prototype.updateStatisticsBaseData=function(t){this.baseStatisData.sdkPrivate=t.sdkPrivate===$t.PRIVATE?$t.PRIVATE:$t.OPEN,this.baseStatisData.serverPrivate=t.serverPrivate===$t.PRIVATE?$t.PRIVATE:$t.OPEN,t.bundleId&&(this.baseStatisData.bundleId=t.bundleId)},n.prototype.getStatisticsBaseData=function(){return this.baseStatisData},n.prototype.setStatisticsData=function(t,e,r){e===void 0&&(e={}),r===void 0&&(r=!1),Rt(e)&&t&&(this.statisticsCaches[t]&&!r||(this.statisticsCaches[t]={}),this.statisticsCaches[t]=pt(pt({},this.statisticsCaches[t]),e))},n.prototype.getStatisticsData=function(t){return this.statisticsCaches[t]||{}},n.databaseLogList=[],n.realTimeLogList=[],n.sessionId=ec(),n.userId="",n}(),H=new Le("RCLog"),Fn=function(){function n(){this._map={}}return n.prototype.on=function(t,e,r){var i=this._map[t]||(this._map[t]=[]);i.some(function(o){return o.listener===e&&o.target===r})||i.push({listener:e,target:r})},n.prototype.once=function(t,e,r){var i=this._map[t]||(this._map[t]=[]);i.some(function(o){return o.listener===e&&o.target===r})||i.push({listener:e,target:r,once:!0})},n.prototype.off=function(t,e,r){var i=this._map[t];i&&((i=i.filter(function(o){return o.listener!==e||o.target!==r})).length?this._map[t]=i:delete this._map[t])},n.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=this._map[t];if(i)for(var o=i.length-1;o>=0;o-=1){var s=i[o],c=s.target,d=s.once,l=s.listener;d&&i.splice(o,1);try{l.call.apply(l,Pe([c],e,!1))}catch(h){H.error(h)}}},n.prototype.removeAll=function(t){delete this._map[t]},n.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},n}();(function(n){n[n.SEND=1]="SEND",n[n.RECEIVE=2]="RECEIVE"})(Vi||(Vi={}));var Bi,zt=Vi;(function(n){n[n.TIMEOUT=-1]="TIMEOUT",n[n.UNKNOWN=-2]="UNKNOWN",n[n.PARAMETER_ERROR=-3]="PARAMETER_ERROR",n[n.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",n[n.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",n[n.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",n[n.SUCCESS=0]="SUCCESS",n[n.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",n[n.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",n[n.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",n[n.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",n[n.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",n[n.RECALL_MESSAGE=25101]="RECALL_MESSAGE",n[n.NOT_IN_GROUP=22406]="NOT_IN_GROUP",n[n.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",n[n.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",n[n.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",n[n.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",n[n.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",n[n.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",n[n.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",n[n.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",n[n.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",n[n.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",n[n.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",n[n.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",n[n.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",n[n.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",n[n.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",n[n.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",n[n.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",n[n.INVITE_DICUSSION=21409]="INVITE_DICUSSION",n[n.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",n[n.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",n[n.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",n[n.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",n[n.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",n[n.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",n[n.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",n[n.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",n[n.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",n[n.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",n[n.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",n[n.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",n[n.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",n[n.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",n[n.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",n[n.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",n[n.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",n[n.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",n[n.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",n[n.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",n[n.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",n[n.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",n[n.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",n[n.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",n[n.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",n[n.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",n[n.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",n[n.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",n[n.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",n[n.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",n[n.RC_OTP_USED=31027]="RC_OTP_USED",n[n.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",n[n.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",n[n.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",n[n.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",n[n.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",n[n.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",n[n.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",n[n.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",n[n.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",n[n.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",n[n.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",n[n.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",n[n.TAG_EXISTS=33101]="TAG_EXISTS",n[n.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",n[n.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",n[n.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",n[n.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",n[n.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",n[n.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",n[n.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",n[n.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",n[n.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",n[n.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",n[n.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",n[n.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",n[n.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",n[n.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",n[n.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",n[n.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",n[n.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",n[n.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",n[n.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",n[n.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",n[n.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",n[n.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",n[n.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",n[n.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",n[n.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",n[n.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",n[n.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",n[n.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",n[n.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",n[n.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",n[n.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",n[n.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",n[n.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",n[n.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",n[n.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",n[n.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",n[n.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",n[n.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",n[n.NOT_SUPPORT=39002]="NOT_SUPPORT",n[n.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",n[n.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",n[n.COOKIE_ENABLE=51001]="COOKIE_ENABLE",n[n.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",n[n.HAVNODEVICEID=24001]="HAVNODEVICEID",n[n.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",n[n.FEILD=24009]="FEILD",n[n.VOIPISNULL=24013]="VOIPISNULL",n[n.NOENGINETYPE=24010]="NOENGINETYPE",n[n.NULLCHANNELNAME=24011]="NULLCHANNELNAME",n[n.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",n[n.NOVOIP=24014]="NOVOIP",n[n.INTERNALERRROR=24015]="INTERNALERRROR",n[n.VOIPCLOSE=24016]="VOIPCLOSE",n[n.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",n[n.ALREADY_IN_USE=51002]="ALREADY_IN_USE",n[n.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",n[n.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",n[n.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",n[n.CANCEL=1]="CANCEL",n[n.REJECT=2]="REJECT",n[n.HANGUP=3]="HANGUP",n[n.BUSYLINE=4]="BUSYLINE",n[n.NO_RESPONSE=5]="NO_RESPONSE",n[n.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",n[n.NETWORK_ERROR=7]="NETWORK_ERROR",n[n.REMOTE_CANCEL=11]="REMOTE_CANCEL",n[n.REMOTE_REJECT=12]="REMOTE_REJECT",n[n.REMOTE_HANGUP=13]="REMOTE_HANGUP",n[n.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",n[n.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",n[n.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",n[n.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",n[n.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",n[n.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",n[n.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"})(Bi||(Bi={}));var Fi,R=Bi;(function(n){n[n.CONNECTED=0]="CONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.DISCONNECTED=2]="DISCONNECTED",n[n.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",n[n.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",n[n.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",n[n.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",n[n.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",n[n.BLOCKED=9]="BLOCKED",n[n.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",n[n.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",n[n.REDIRECT=14]="REDIRECT",n[n.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",n[n.ULTRALIMIT=1101]="ULTRALIMIT",n[n.REQUEST_NAVI=201]="REQUEST_NAVI",n[n.RESPONSE_NAVI=202]="RESPONSE_NAVI",n[n.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",n[n.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT"})(Fi||(Fi={}));var Hi,Z=Fi,Mt={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};(function(n){n.TextMessage="RC:TxtMsg",n.VOICE="RC:VcMsg",n.HQ_VOICE="RC:HQVCMsg",n.IMAGE="RC:ImgMsg",n.GIF="RC:GIFMsg",n.RICH_CONTENT="RC:ImgTextMsg",n.LOCATION="RC:LBSMsg",n.FILE="RC:FileMsg",n.SIGHT="RC:SightMsg",n.COMBINE="RC:CombineMsg",n.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",n.LOG_COMMAND="RC:LogCmdMsg",n.EXPANSION_NOTIFY="RC:MsgExMsg",n.REFERENCE="RC:ReferenceMsg",n.RECALL="RC:RcCmd",n.READ_RECEIPT="RC:ReadNtf",n.READ_RECEIPT_REQUEST="RC:RRReqMsg",n.READ_RECEIPT_RESPONSE="RC:RRRspMsg",n.SYNC_READ_STATUS="RC:SRSMsg",n.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",n.CHATROOM_JOIN="RC:ChrmJoinNtf",n.CHATROOM_LEFT="RC:ChrmQuitNtf",n.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",n.TYPING_STATUS="RC:TypSts",n.INTERCEPT="RC:InterceptMsg"})(Hi||(Hi={}));var $i,Ut=Hi;(function(n){n[n.OPEN=1]="OPEN",n[n.CLOSE=2]="CLOSE"})($i||($i={}));var Gi,Yt=$i;(function(n){n[n.ALL_MESSAGE=-1]="ALL_MESSAGE",n[n.NOT_SET=0]="NOT_SET",n[n.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",n[n.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",n[n.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",n[n.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"})(Gi||(Gi={}));var Ki,ce=Gi;(function(n){n[n.ALL=1]="ALL",n[n.SINGAL=2]="SINGAL"})(Ki||(Ki={}));var ji,qr=Ki;(function(n){n[n.QINIU=1]="QINIU",n[n.ALI=2]="ALI",n[n.AWS=3]="AWS",n[n.STC=4]="STC"})(ji||(ji={}));var qi,Kt=ji;(function(n){n[n.UPDATE=1]="UPDATE",n[n.DELETE=2]="DELETE"})(qi||(qi={}));var Yi,Gt=qi;(function(n){n[n.QUIT=0]="QUIT",n[n.JOIN=1]="JOIN"})(Yi||(Yi={}));var Ks,js=Yi;(function(n){/*!
- 全局敏感词:命中了融云内置的全局敏感词
- */n[n.GLOBAL=1]="GLOBAL",n[n.CUSTOM=2]="CUSTOM",n[n.THIRD_PARTY=3]="THIRD_PARTY"})(Ks||(Ks={}));var qs;(function(n){n[n.typing=0]="typing"})(qs||(qs={}));var Vt,Ys,zs;(function(n){n[n.RTC=0]="RTC",n[n.LIVE=2]="LIVE"})(Vt||(Vt={})),function(n){n[n.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",n[n.AUDIO=1]="AUDIO"}(Ys||(Ys={})),function(n){n[n.ANCHOR=1]="ANCHOR",n[n.AUDIENCE=2]="AUDIENCE"}(zs||(zs={}));var ae,Rr,zi,gd={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};(function(n){n[n.ROOM=1]="ROOM",n[n.PERSON=2]="PERSON"})(ae||(ae={})),function(n){n[n.AnchorToViewer=1]="AnchorToViewer",n[n.ViewerToAnchor=2]="ViewerToAnchor"}(Rr||(Rr={})),function(n){n[n.KICK=0]="KICK",n[n.REFUSE=1]="REFUSE",n[n.COEXIST=2]="COEXIST"}(zi||(zi={}));var fr=typeof window!="undefined"&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};fr.engine="5.3.1";var se,ut,Sn=function(){function n(){}return n.add=function(t,e){fr[t]=e},n.validEngine=function(t){var e=t.match(/\d+\.\d+\.\d+/);if(!e)return H.warn("The validation engine version '".concat(t,"' is invalid!")),!1;var r=e[0].split(".").map(function(i){return i.padStart(3,"0")}).join("");return fr.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map(function(i){return i.padStart(3,"0")}).join("")>=r},n.getInfo=function(){return fr},n}();(function(n){n[n.STRING=0]="STRING",n[n.ONLY_STRING=1]="ONLY_STRING",n[n.NUMBER=2]="NUMBER",n[n.BOOLEAN=3]="BOOLEAN",n[n.OBJECT=4]="OBJECT",n[n.ARRAY=5]="ARRAY",n[n.CALLBACK=6]="CALLBACK",n[n.CHANNEL_ID=7]="CHANNEL_ID"})(ut||(ut={}));var At,xt,jt,De,Me,md=((se={})[ut.STRING]=Ft,se[ut.ONLY_STRING]=Bt,se[ut.NUMBER]=mt,se[ut.BOOLEAN]=function(n){return typeof n=="boolean"},se[ut.OBJECT]=Rt,se[ut.ARRAY]=Ht,se[ut.CALLBACK]=function(n){var t=!0;return Rt(n)||(t=!1),(n=n||{}).onSuccess&&!Cr(n.onSuccess)&&(t=!1),n.onError&&!Cr(n.onError)&&(t=!1),t},se[ut.CHANNEL_ID]=function(n){var t=!1;return Bt(n)&&!/_/g.test(n)&&n.length<=20&&(t=!0),t},se),_d=function(n){function t(e){var r=n.call(this,e)||this;return r.name="RCAssertError",r}return It(t,n),t}(Error),dt=function(n,t,e,r){if(r===void 0&&(r=!1),!_t(n,t,e,r))throw new _d("'".concat(n,"' is invalid: ").concat(JSON.stringify(t)))},_t=function(n,t,e,r){r===void 0&&(r=!1),e=md[e]||e;var i=r&&!e(t)||!r&&!(ct(t)||t===null||e(t));return i&&H.error("'".concat(n,"' is invalid: ").concat(JSON.stringify(t))),!i},St=function(n){if(!Rt(n)||n.low===void 0||n.high===void 0)return n;var t=n.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(n.high.toString(16)+"00000000".replace(new RegExp("0{"+t.length+"}$"),t),16)},vd=function(n,t){var e=Math.floor(1e3*Math.random()%1e4),r=tc(),i=function(d){d=d||"-";var l=new Date,h=l.getFullYear(),a=l.getMonth()+1,u=l.getDate();return"".concat(h).concat(d).concat(a).concat(d).concat(u)}(),o=new Date().getTime(),s="";if(t){var c=t.split(".");s="."+c[c.length-1]}return"".concat(n,"__RC-").concat(i,"_").concat(e,"_").concat(o).concat(r).concat(s)},Td=function(n,t){n===void 0&&(n={}),t===void 0&&(t={});var e=n.threadId,r=n.apnsCollapseId,i=n.category,o=n.richMediaUri,s=t.channelIdMi,c=t.channelIdHW,d=t.channelIdOPPO,l=t.typeVivo,h=t.googleConfig,a={};a["thread-id"]=e||"",a["apns-collapse-id"]=r||"",a.category=i||"",a.richMediaUri=o||"";var u={};u.collapse_key=h==null?void 0:h.collapseKey,u.imageUrl=h==null?void 0:h.imageUrl;var p=h==null?void 0:h.priority;p&&!["high","normal"].includes(p)&&(p="normal"),u.priority=p;var f=[{HW:{channelId:c||""}},{MI:{channelId:s||""}},{OPPO:{channelId:d||""}},{VIVO:{classification:l||""}},{APNS:a},{FCM:u}];return JSON.stringify(f)},Js=function(n,t){var e={},r={notificationId:t||""};if(!n)return{iOSConfig:e,androidConfig:r};try{var i=JSON.parse(n);i==null||i.forEach(function(o){var s,c,d,l,h=Object.keys(o);if(h.length!==0){var a=h[0];switch(a){case"HW":return void(r.channelIdHW=(s=o[a])===null||s===void 0?void 0:s.channelId);case"MI":return void(r.channelIdMi=(c=o[a])===null||c===void 0?void 0:c.channelId);case"OPPO":return void(r.channelIdOPPO=(d=o[a])===null||d===void 0?void 0:d.channelId);case"VIVO":return void(r.typeVivo=(l=o[a])===null||l===void 0?void 0:l.classification);case"APNS":return e.threadId=o[a]["thread-id"],e.apnsCollapseId=o[a]["apns-collapse-id"],e.category=o[a].category,void(e.richMediaUri=o[a].richMediaUri);case"FCM":r.googleConfig={collapseKey:o[a].collapse_key||"",imageUrl:o[a].imageUrl||"",priority:o[a].priority||""}}}})}catch{H.error("Wrong format for pushConfigs field! content: "+n)}return{iOSConfig:e,androidConfig:r}},Fe=function(n){var t=/^[A-Za-z0-9_=+-]+$/.test(n),e=n.length;return t&&e<=128&&e>=1},gi=function(n){var t=n.length;return t<=4096&&t>=1},Ot=function(n,t,e){t=t||function(){};var r=(e=e||{}).isReverse;Rt(n)&&function(){for(var i in n)t(n[i],i,n)}(),(Ht(n)||Bt(n))&&function(){if(r)for(var i=n.length-1;i>=0;i--)t(n[i],i);else for(var o=0,s=n.length;o<s;o++)t(n[o],o)}()},Jn=function(n,t){return Ot(n,function(e,r){n[r]=t(e,r)}),n},yd=function(n,t){if(n.indexOf)return n.indexOf(t);var e=-1;return Ot(n,function(r,i){t===r&&(e=i)}),e},Ed=function(n,t){var e=[];return Ot(n,function(r){e.push(r)}),yd(e,t)!==-1},On=function(n){return JSON.parse(JSON.stringify(n))},Ws=function(){return typeof RCCppEngine!="undefined"},Ir=function(n){switch(n){case Mt.SERVER_UNAVAILABLE:return R.SERVER_UNAVAILABLE;case Mt.TOKEN_INCORRECT:return R.RC_CONN_USER_OR_PASSWD_ERROR;case Mt.REDIRECT:return R.RC_CONN_REDIRECTED;case Mt.APP_BLOCK_OR_DELETE:return R.RC_CONN_APP_BLOCKED_OR_DELETED;case Mt.BLOCK:return R.RC_CONN_USER_BLOCKED;case Mt.TOKEN_EXPIRE:return R.RC_CONN_USER_OR_PASSWD_ERROR;case Mt.HOSTNAME_ERROR:return R.HOSTNAME_ERROR;case Mt.HASOHTERSAMECLIENTONLINE:return R.HAS_OHTER_SAME_CLIENT_ON_LINE;case Mt.APP_AUTH_NOT_PASS:return R.RC_APP_AUTH_NOT_PASS;case Mt.OTP_USED:return R.RC_OTP_USED;case Mt.PLATFORM_ERROR:return R.RC_PLATFORM_ERROR;default:return R.RC_NET_UNAVAILABLE}},Ji=function(n){var t;if(typeof n=="object")if(Array.isArray(n))for(var e in t=[],n)t.push(Ji(n[e]));else for(var e in t={},n)t[e]=Ji(n[e]);else t=n;return t},He=function(n){var t;try{t=Ji(n)}catch(e){H.error("clone err:",e),t=JSON.parse(JSON.stringify(n))}return t},Zs=function(n){var t={},e=JSON.parse(n);return Ot(e,function(r,i){t[i]=r.v}),t},ze={_delayTime:0,setTime:function(n){var t=new Date().getTime();ze._delayTime=t-n},getTime:function(){var n=ze._delayTime;return new Date().getTime()-n}},Qs=function(n,t){var e=0;return n.isAutoDelete&&(e|=1),n.isOverwrite&&(e|=2),t===2&&(e|=4),e};(function(n){n[n.AT_MOST_ONCE=0]="AT_MOST_ONCE",n[n.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",n[n.EXACTLY_ONCE=2]="EXACTLY_ONCE",n[n.DEFAULT=3]="DEFAULT"})(At||(At={})),function(n){n[n.SYMMETRIC=0]="SYMMETRIC",n[n.CONNECT=1]="CONNECT",n[n.CONN_ACK=2]="CONN_ACK",n[n.PUBLISH=3]="PUBLISH",n[n.PUB_ACK=4]="PUB_ACK",n[n.QUERY=5]="QUERY",n[n.QUERY_ACK=6]="QUERY_ACK",n[n.QUERY_CONFIRM=7]="QUERY_CONFIRM",n[n.SUBSCRIBE=8]="SUBSCRIBE",n[n.SUB_ACK=9]="SUB_ACK",n[n.UNSUBSCRIBE=10]="UNSUBSCRIBE",n[n.UNSUB_ACK=11]="UNSUB_ACK",n[n.PING_REQ=12]="PING_REQ",n[n.PING_RESP=13]="PING_RESP",n[n.DISCONNECT=14]="DISCONNECT",n[n.RESERVER2=15]="RESERVER2"}(xt||(xt={})),function(n){n.CONN_ACK="ConnAckMessage",n.DISCONNECT="DisconnectMessage",n.PING_REQ="PingReqMessage",n.PING_RESP="PingRespMessage",n.PUBLISH="PublishMessage",n.PUB_ACK="PubAckMessage",n.QUERY="QueryMessage",n.QUERY_CON="QueryConMessage",n.QUERY_ACK="QueryAckMessage"}(jt||(jt={})),function(n){n.PUB="pub",n.QUERY="qry"}(De||(De={})),function(n){n[n.V4=4]="V4",n[n.V3=3]="V3"}(Me||(Me={}));var K,Eo=function(){function n(t,e,r,i){e===void 0&&(e=!1),r===void 0&&(r=At.AT_LEAST_ONCE),i===void 0&&(i=!1),this._retain=!1,this.qos=At.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var o=t>0;t&&o&&arguments.length===1?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=(8&t)==8):(this.type=t,this._retain=e,this.qos=r,this._dup=i)}return n.prototype.encode=function(){var t=this.type<<4;return t|=this._retain?1:0,t|=this.qos<<1,t|=this._dup?8:0},n}(),Hn=function(){function n(){}return n.writeUTF=function(t,e){var r=[],i=0;if(Bt(t))for(var o=0,s=t.length;o<s;o++){var c=t.charCodeAt(o);c>=0&&c<=127?(i+=1,r.push(c)):c>=128&&c<=2047?(i+=2,r.push(192|31&c>>6),r.push(128|63&c)):c>=2048&&c<=65535&&(i+=3,r.push(224|15&c>>12),r.push(128|63&c>>6),r.push(128|63&c))}for(o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return e?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},n.readUTF=function(t){for(var e,r,i=[],o=-1,s=t,c="";++o<s.length;){var d=Number(s[o]);if(d===(127&d)||((240&d)==240?d=(d=(d=(d^=240)<<6|128^s[++o])<<6|128^s[++o])<<6|128^s[++o]:(224&d)==224?d=(d=(d^=224)<<6|128^s[++o])<<6|128^s[++o]:(192&d)==192&&(d=(d^=192)<<6|128^s[++o])),!isFinite(d)||d<0||d>1114111||Math.floor(d)!==d)throw RangeError("Invalid code point: "+d);d<=65535?i.push(d):(e=(d-=65536)>>10|55296,r=d%1024|56320,i.push(e,r)),(o+1===s.length||i.length>16384)&&(c+=String.fromCharCode.apply(null,i),i.length=0)}return c},n}(),Cd=function(){function n(t){this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return n.prototype.check=function(){return this._position>=this._pool.length},n.prototype.read2Byte=function(){var t=this;if(t.check())return-1;for(var e="",r=0;r<2;r++){var i=t._pool[t._position++].toString(16);i.length===1&&(i="0"+i),e+=i.toString()}return parseInt(e,16)},n.prototype.readInt=function(){var t=this;if(t.check())return-1;for(var e="",r=0;r<4;r++){var i=t._pool[t._position++].toString(16);i.length===1&&(i="0"+i),e+=i.toString()}return parseInt(e,16)},n.prototype.readLong=function(){var t=this;if(t.check())return-1;for(var e="",r=0;r<8;r++){var i=t._pool[t._position++].toString(16);i.length===1&&(i="0"+i),e+=i}return parseInt(e,16)},n.prototype.readByte=function(){if(this.check())return-1;var t=this._pool[this._position++];return t>255&&(t&=255),t},n.prototype.readUTF=function(){if(this.check())return"";var t=this.readByte()<<8|this.readByte(),e=this._pool.subarray(this._position,this._position+=t);return Hn.readUTF(e)},n.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},n}(),Rd=function(){function n(){this._pool=[],this._position=0,this._writen=0}return n.prototype.write=function(t){return Object.prototype.toString.call(t).indexOf("Array")!==-1?this._pool=this._pool.concat(t):t>=0&&(t>255&&(t&=255),this._pool.push(t),this._writen++),t},n.prototype.writeArr=function(t){return this._pool=this._pool.concat(t),t},n.prototype.writeUTF=function(t){var e=Hn.writeUTF(t);this._pool=this._pool.concat(e),this._writen+=e.length},n.prototype.getBytesArray=function(){return this._pool},n}(),Dn="UpStreamMessage",Co="PushExtra",Yr="DownStreamMessage",Qe="DownStreamMessages",Ro="SessionsAttQryInput",rc="SessionsAttOutput",Io="SyncRequestMsg",So="ChrmPullMsg",Sr="NotifyMsg",Oo="HistoryMsgInput",Xe="HistoryMsgOuput",Or="RelationQryInput",tn="RelationsOutput",No="DeleteSessionsInput",bo="SessionInfo",ic="DeleteSessionsOutput",Mo="RelationsInput",Ao="DeleteMsgInput",wo="CleanHisMsgInput",zr="SessionMsgReadInput",Po="ChrmInput",kn="ChrmOutput",Lo="QueryChatRoomInfoInput",Jr="QueryChatRoomInfoOutput",Nr="RtcInput",Ae="RtcUserListOutput",Uo="SetUserStatusInput",Do="RtcSetDataInput",br="RtcUserSetDataInput",Mr="RtcDataInput",ko="RtcSetOutDataInput",xo="MCFollowInput",Wr="RtcTokenOutput",Zr="RtcQryOutput",Vo="RtcQryUserOutDataInput",oc="RtcUserOutDataOutput",Bo="RtcQueryListInput",sc="RtcRoomInfoOutput",Lt="RtcValueInfo",Fo="RtcKeyDeleteInput",Ho="GetQNupTokenInput",$o="GetQNupTokenOutput",Go="GetQNdownloadUrlInput",Ko="GetDownloadUrlInput",jo="GetQNdownloadUrlOutput",qo="GetDownloadUrlOutput",Id="ChrmKVEntity",Yo="SetChrmKV",zo="SetChrmKVS",ac="DeleteChrmKVS",en="ChrmKVOutput",Jo="ChrmKVSOutput",Sd="ChrmKVSVersionEntity",cc="ChrmKVSOutputEntity",Wo="QueryChrmKV",uc="SetUserSettingInput",nn="SetUserSettingOutput",Zo="PullUserSettingInput",Qr="PullUserSettingOutput",Xr="UserSettingNotification",Qo="SessionReq",ti="SessionStates",Ar="SessionState",wr="SessionStateItem",Pr="SessionStateModifyReq",Xo="SessionStateModifyResp",ts="GroupUnpushQuery",es="GroupUnpushSet",ns="GroupUnpushResult",Lr="GrpReadReceiptMsg",dc="GrpReadReceiptQryReq",ei="GrpReadReceiptQryResp",lc="GrpMsgReadUser",rs="SessionTagAddInput",Nn="SessionTagItem",is="SessionTagDelInput",os="SessionDisTagReq",ss="ReportSDKInput",hc="ReportSDKOutput",as="UltraGrpPullSes",cs="UltraGrpPullMsg",Ur="MsgChangeReq",us="QueryMsgChange",Od="MsgChange",ni="MsgChangeList",ds="MsgQuery",Nd="MessageQueryInfo",xn="MsgQueryAck",ls="OperateStatus",ri="OperateStatusNotify",pc="OperateInfo",fc="OperateSummary",hs="RtcNotifyMsg",ps="RtcPullKV",ii="RtcKVOutput",fs="RtcQueryUserJoinedInput",oi="RtcQueryUserJoinedOutput",gc="RtcViewerJoinedOutput",gs="RtcInviteInput",ms="RtcCancelInviteInput",_s="RtcInviteAnswerInput",vs="RtcEndInviteInput",Ts="SetRtcRoomIdInput",mc="SetRtcRoomIdOutput",_c=((K={})[Dn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],K[Qe]=["list","syncTime","finished","broadcastSyncTime"],K[Yr]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],K[Co]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],K[Ro]=["nothing"],K[rc]=["inboxTime","sendboxTime","totalUnreadCount"],K[Io]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],K[So]=["syncTime","count"],K[Sr]=["type","time","chrmId"],K[Oo]=["targetId","time","count","order","busChannel"],K[Xe]=["list","syncTime","hasMsg"],K[Or]=["type","count","startTime","order"],K[tn]=["info","isFinished"],K[No]=["sessions"],K[bo]=["type","channelId","busChannel"],K[ic]=["nothing"],K[Mo]=["type","msg","count","busChannel","startTime","endTime"],K[Ao]=["type","conversationId","msgs","busChannel"],K[wo]=["targetId","dataTime","conversationType","busChannel"],K[zr]=["type","msgTime","channelId","busChannel"],K[Po]=["nothing"],K[kn]=["nothing","sessionId","joinTime"],K[Lo]=["count","order"],K[Jr]=["userTotalNums","userInfos"],K[Ho]=["type","key","httpMethod","queryString"],K[Go]=["type","key","fileName"],K[Ko]=["type","key","fileName"],K[$o]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],K[jo]=["downloadUrl"],K[qo]=["downloadUrl"],K[Id]=["key","value","status","timestamp","uid","version"],K[Yo]=["entry","bNotify","notification","type"],K[zo]=["entry","bNotify","notification","type"],K[ac]=["entry","bNotify","notification","type"],K[en]=["entries","bFullUpdate","syncTime"],K[Jo]=["timestamp","errorKeys","keysVersion"],K[Sd]=["version","key"],K[cc]=["key","errorCode"],K[Wo]=["timestamp"],K[uc]=["version","value"],K[nn]=["version","reserve"],K[Zo]=["version","reserve"],K[Qr]=["items","version"],K.UserSettingItem=["targetId","type","key","value","version","status","tags"],K[Qo]=["time"],K[ti]=["version","state"],K[Ar]=["type","channelId","time","stateItem","busChannel"],K[wr]=["sessionStateType","value","tags"],K[Pr]=["version","state"],K[Xo]=["version"],K[es]=["busChannel","unpushLevel"],K[ts]=["busChannel"],K[ns]=["groupId","busChannel","unpushLevel"],K[Lr]=["msgId","busChannel"],K[dc]=["msgId","busChannel"],K[ei]=["totalMemberNum","list"],K[lc]=["readTime","userId"],K[rs]=["version","tags"],K[Nn]=["tagId","name","createdTime","isTop"],K[is]=["version","tags"],K[os]=["tagId"],K[Xr]=["version","reserve"],K[ss]=["sdkInfo"],K[hc]=["nothing"],K[as]=["syncTime","isEraseMsgContent"],K[cs]=["syncTime"],K[Ur]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],K[us]=["syncTime"],K[ni]=["list","syncTime","hasNext"],K[Od]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId"],K[ds]=["targetId","type","query"],K[Nd]=["msgTime","msgUID","busChannel"],K[xn]=["list"],K[ls]=["targetId","type","opType","busChannel"],K[ri]=["type","notifyType","info","summary"],K[pc]=["targetId","busChannel","userId","opType","optime"],K[fc]=["targetId","busChannel","count","opType"],K[Nr]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],K[Ae]=["users","token","sessionId","roomInfo"],K[Uo]=["status"],K[Do]=["interior","target","key","value","objectName","content"],K[br]=["valueInfo","objectName","content"],K[Mr]=["interior","target","key","objectName","content"],K[ko]=["target","valueInfo","objectName","content"],K[xo]=["state"],K[Wr]=["rtcToken"],K[Zr]=["outInfo"],K[Vo]=["userId"],K[oc]=["user"],K[Bo]=["order"],K[sc]=["roomId","roomData","userCount","list"],K[Lt]=["key","value"],K[Fo]=["key"],K[hs]=["type","time","roomId"],K[ps]=["timestamp","roomId"],K[ii]=["entries","bFullUpdate","syncTime"],K[fs]=["userId"],K[oi]=["info"],K[gs]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],K[ms]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],K[_s]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],K[vs]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],K[Ts]=["rtcRoomId"],K[mc]=["nothing"],K),Vn={},bd=function(n){var t=_c[n];Vn[n]=function(){for(var e={},r={getArrayData:function(){return e}},i=function(s){var c=t[s],d="set".concat(Bs(c,0,1));r[d]=function(l){e[c]=l}},o=0;o<t.length;o++)i(o);return r},Vn[n].decode=function(e){var r={};Bt(e)&&(e=JSON.parse(e));var i=function(s){var c="get".concat(Bs(s,0,1));r[s]=e[s],r[c]=function(){return e[s]}};for(var o in e)i(o);return r}};for(var Md in _c)bd(Md);Vn.getModule=function(n){return Vn[n]()};var Ad=`
- package Modules;
- message probuf {
- message `.concat(Uo,`
- {
- optional int32 status=1;
- }
- message SetUserStatusOutput
- {
- optional int32 nothing=1;
- }
- message GetUserStatusInput
- {
- optional int32 nothing=1;
- }
- message GetUserStatusOutput
- {
- optional string status=1;
- optional string subUserId=2;
- }
- message SubUserStatusInput
- {
- repeated string userid =1;
- }
- message SubUserStatusOutput
- {
- optional int32 nothing=1;
- }
- message VoipDynamicInput
- {
- required int32 engineType = 1;
- required string channelName = 2;
- optional string channelExtra = 3;
- }
- message VoipDynamicOutput
- {
- required string dynamicKey=1;
- }
- message `).concat(Sr,` {
- required int32 type = 1;
- optional int64 time = 2;
- optional string chrmId=3;
- }
- message `).concat(Io,` {
- required int64 syncTime = 1;
- required bool ispolling = 2;
- optional bool isweb=3;
- optional bool isPullSend=4;
- optional bool isKeeping=5;
- optional int64 sendBoxSyncTime=6;
- optional int64 broadcastSyncTime=7;
- }
- message `).concat(Dn,` {
- required int32 sessionId = 1;
- required string classname = 2;
- required bytes content = 3;
- optional string pushText = 4;
- optional string appData = 5;
- repeated string userId = 6;
- optional int64 delMsgTime = 7;
- optional string delMsgId = 8;
- optional int32 configFlag = 9;
- optional int64 clientUniqueId = 10;
- optional string extraContent = 11;
- optional PushExtra pushExt = 12;
- optional string busChannel = 13; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
- }
- message `).concat(Co,` {
- optional string title = 1;
- optional int32 templateIdNoUse= 2;
- optional string pushId = 3;
- optional string pushConfigs = 4;
- optional string templateId = 5;
- }
- message `).concat(Qe,` {
- repeated DownStreamMessage list = 1;
- required int64 syncTime = 2;
- optional bool finished = 3;
- optional int64 broadcastSyncTime = 4;
- }
- message `).concat(Yr,` {
- required string fromUserId = 1;
- required ChannelType type = 2;
- optional string groupId = 3;
- required string classname = 4;
- required bytes content = 5;
- required int64 dataTime = 6;
- required int64 status = 7;
- optional int64 extra = 8;
- optional string msgId = 9;
- optional int32 direction = 10;
- optional int32 plantform =11;
- optional int32 isRemoved = 12;
- optional string source = 13;
- optional int64 clientUniqueId = 14;
- optional string extraContent = 15;
- optional string pushContent = 16;
- optional int32 configFlag = 17;
- optional PushExtra pushExt = 18;
- optional string busChannel = 19; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
- optional int64 extStatus = 20; // \u6D88\u606F\u7684\u6269\u5C55\u6807\u8BB0 \u7B2C0\u4F4D,\u8868\u793A\u9001\u8FBE\u72B6\u6001: 0x01 \u8868\u793A\u5DF2\u9001\u8FBE;\u65AD\u6863: 0x02 \u8868\u793A\u662F\u5426\u9700\u8981\u6267\u884C\u65AD\u6863\u7B56\u7565; \u6D88\u606F\u4FEE\u6539: 0x04 \u62C9\u53D6\u5386\u53F2\u6D88\u606F\u65F6\u8868\u793A\u8BE5\u6D88\u606F\u662F\u5426\u4FEE\u6539\u8FC7
- repeated string toUserId = 21; //\u6307\u5B9A\u63A5\u6536\u8005\uFF08\u9650\u5B9A\u7FA4\u548C\u8BA8\u8BBA\u7EC4\uFF09//\u589E\u52A0\u804A\u5929\u5BA4\u5B9A\u5411\u6210\u5458
- optional int32 groupUnpush = 22; //\u7FA4\u804A\u9ED8\u8BA4\u514D\u6253\u6270\u7EA7\u522B
- }
- enum ChannelType {
- PERSON = 1;
- PERSONS = 2;
- GROUP = 3;
- TEMPGROUP = 4;
- CUSTOMERSERVICE = 5;
- NOTIFY = 6;
- MC=7;
- MP=8;
- ULTRAGROUP = 10;
- }
- message CreateDiscussionInput {
- optional string name = 1;
- }
- message CreateDiscussionOutput {
- required string id = 1;
- }
- message ChannelInvitationInput {
- repeated string users = 1;
- }
- message LeaveChannelInput {
- required int32 nothing = 1;
- }
- message ChannelEvictionInput {
- required string user = 1;
- }
- message RenameChannelInput {
- required string name = 1;
- }
- message ChannelInfoInput {
- required int32 nothing = 1;
- }
- message ChannelInfoOutput {
- required ChannelType type = 1;
- required string channelId = 2;
- required string channelName = 3;
- required string adminUserId = 4;
- repeated string firstTenUserIds = 5;
- required int32 openStatus = 6;
- }
- message ChannelInfosInput {
- required int32 page = 1;
- optional int32 number = 2;
- }
- message ChannelInfosOutput {
- repeated ChannelInfoOutput channels = 1;
- required int32 total = 2;
- }
- message MemberInfo {
- required string userId = 1;
- required string userName = 2;
- required string userPortrait = 3;
- required string extension = 4;
- }
- message GroupMembersInput {
- required int32 page = 1;
- optional int32 number = 2;
- }
- message GroupMembersOutput {
- repeated MemberInfo members = 1;
- required int32 total = 2;
- }
- message GetUserInfoInput {
- required int32 nothing = 1;
- }
- message GetUserInfoOutput {
- required string userId = 1;
- required string userName = 2;
- required string userPortrait = 3;
- }
- message GetSessionIdInput {
- required int32 nothing = 1;
- }
- message GetSessionIdOutput {
- required int32 sessionId = 1;
- }
- enum FileType {
- image = `).concat(wt.IMAGE,`;
- audio = `).concat(wt.AUDIO,`;
- video = `).concat(wt.VIDEO,`;
- file = `).concat(wt.FILE,`;
- }
- message `).concat(Ho,` {
- required FileType type = 1;
- optional string key = 2;
- optional string httpMethod = 3;
- optional string queryString = 4;
- }
- message `).concat(Go,` {
- required FileType type = 1;
- required string key = 2;
- optional string fileName = 3;
- }
- message `).concat(Ko,` {
- required FileType type = 1;
- required string key = 2;
- optional string fileName = 3;
- }
- message `).concat($o,` {
- required int64 deadline = 1;
- required string token = 2;
- optional string bosToken = 3;
- optional string bosDate = 4;
- optional string path = 5;
- optional string osskeyId = 6;
- optional string ossPolicy = 7;
- optional string ossSign = 8;
- optional string ossBucketName = 9;
- optional string s3Credential = 10;
- optional string s3Algorithm = 11;
- optional string s3Date = 12;
- optional string s3Policy = 13;
- optional string s3Signature = 14;
- optional string s3BucketName = 15;
- optional string stcAuthorization = 16;
- optional string stcContentSha256 = 17;
- optional string stcDate = 18;
- optional string stcBucketName = 19;
- }
- message `).concat(jo,` {
- required string downloadUrl = 1;
- }
- message `).concat(qo,` {
- required string downloadUrl = 1;
- }
- message Add2BlackListInput {
- required string userId = 1;
- }
- message RemoveFromBlackListInput {
- required string userId = 1;
- }
- message QueryBlackListInput {
- required int32 nothing = 1;
- }
- message QueryBlackListOutput {
- repeated string userIds = 1;
- }
- message BlackListStatusInput {
- required string userId = 1;
- }
- message BlockPushInput {
- required string blockeeId = 1;
- }
- message ModifyPermissionInput {
- required int32 openStatus = 1;
- }
- message GroupInput {
- repeated GroupInfo groupInfo = 1;
- }
- message GroupOutput {
- required int32 nothing = 1;
- }
- message GroupInfo {
- required string id = 1;
- required string name = 2;
- }
- message GroupHashInput {
- required string userId = 1;
- required string groupHashCode = 2;
- }
- message GroupHashOutput {
- required GroupHashType result = 1;
- }
- enum GroupHashType {
- group_success = 0x00;
- group_failure = 0x01;
- }
- message `).concat(Po,` {
- required int32 nothing = 1;
- }
- message `).concat(kn,` {
- required int32 nothing = 1;
- optional string sessionId = 2;
- optional int64 joinTime = 3;
- }
- message `).concat(So,` {
- required int64 syncTime = 1;
- required int32 count = 2;
- }
- message ChrmPullMsgNew
- {
- required int32 count = 1;
- required int64 syncTime = 2;
- optional string chrmId=3;
- }
- message `).concat(Or,`
- {
- optional ChannelType type = 1;
- optional int32 count = 2;
- optional int64 startTime = 3;
- optional int32 order = 4;
- }
- message `).concat(Mo,`
- {
- required ChannelType type = 1;
- optional DownStreamMessage msg =2;
- optional int32 count = 3;
- repeated string busChannel = 4;
- optional int64 startTime = 5;
- optional int64 endTime = 6;
- }
- message `).concat(tn,`
- {
- repeated RelationInfo info = 1;
- optional bool isFinished = 2;//\u662F\u5426\u7ED3\u675F
- }
- message RelationInfo
- {
- required ChannelType type = 1;
- required string userId = 2;
- optional DownStreamMessage msg =3;
- optional int64 readMsgTime= 4;
- optional int64 unreadCount= 5;
- optional string busChannel = 6;//\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
- optional int64 versionTime = 7;//\u4F1A\u8BDD\u9879\u53D8\u66F4\u65F6\u95F4\u6233\uFF0C\u6CE8\u610F:\u975E\u6392\u5E8F\u65F6\u95F4\u6233
- optional int64 remindCount = 8;//\u88AB@\u7684\u672A\u8BFB\u6570
- }
- message RelationInfoReadTime
- {
- required ChannelType type = 1;
- required int64 readMsgTime= 2;
- required string targetId = 3;
- }
- message `).concat(wo,`
- {
- required string targetId = 1;
- required int64 dataTime = 2;
- optional int32 conversationType= 3;
- optional string busChannel = 4; //\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
- }
- message HistoryMessageInput
- {
- required string targetId = 1;
- required int64 dataTime =2;
- required int32 size = 3;
- }
- message HistoryMessagesOuput
- {
- repeated DownStreamMessage list = 1;
- required int64 syncTime = 2;
- required int32 hasMsg = 3;
- }
- message `).concat(Lo,`
- {
- required int32 count= 1;
- optional int32 order= 2;
- }
- message `).concat(Jr,`
- {
- optional int32 userTotalNums = 1;
- repeated ChrmMember userInfos = 2;
- }
- message ChrmMember
- {
- required int64 time = 1;
- required string id = 2;
- }
- message MPFollowInput
- {
- required string id = 1;
- }
- message MPFollowOutput
- {
- required int32 nothing = 1;
- optional MpInfo info =2;
- }
- message `).concat(xo,`
- {
- required string state = 1;
- }
- message MCFollowOutput
- {
- required int32 nothing = 1;
- optional MpInfo info =2;
- }
- message MpInfo
- {
- required string mpid=1;
- required string name = 2;
- required string type = 3;
- required int64 time=4;
- optional string portraitUrl=5;
- optional string extra =6;
- }
- message SearchMpInput
- {
- required int32 type=1;
- required string id=2;
- }
- message SearchMpOutput
- {
- required int32 nothing=1;
- repeated MpInfo info = 2;
- }
- message PullMpInput
- {
- required int64 time=1;
- required string mpid=2;
- }
- message PullMpOutput
- {
- required int32 status=1;
- repeated MpInfo info = 2;
- }
- message `).concat(Oo,`
- {
- optional string targetId = 1;
- optional int64 time = 2;
- optional int32 count = 3;
- optional int32 order = 4;
- optional string busChannel = 5; //\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
- }
- message `).concat(Xe,`
- {
- repeated DownStreamMessage list=1;
- required int64 syncTime=2;
- required int32 hasMsg=3;
- }
- message `).concat(Bo,`{
- optional int32 order=1;
- }
- message `).concat(Fo,`{
- repeated string key=1;
- }
- message `).concat(Lt,`{
- required string key=1;
- required string value=2;
- }
- message RtcUserInfo{
- required string userId=1;
- repeated `).concat(Lt,` userData=2; //\u7528\u6237\u8D44\u6E90\u4FE1\u606F
- }
- message `).concat(Ae,`{
- repeated RtcUserInfo users=1;
- optional string token=2;
- optional string sessionId=3;
- repeated RtcValueInfo roomInfo = 4; //\u623F\u95F4key value
- repeated RtcKVEntity entries = 5;//\u76F4\u64ADKV\u5C5E\u6027\u5BF9\u8C61\u96C6\u5408
- optional int64 syncTime = 6;//\u6240\u6709\u5C5E\u6027\u7684\u6700\u5927\u65F6\u95F4\u6233\uFF08\u4E0B\u6B21\u62C9\u53D6KV\u65F6\u7528\uFF09\u3002
- optional int32 offlineKickTime = 7;//server\u8D85\u65F6\u8E22\u4EBA\u65F6\u95F4\uFF0C\u9ED8\u8BA460s
- }
- message RtcRoomInfoOutput{
- optional string roomId = 1;
- repeated `).concat(Lt,` roomData = 2;
- optional int32 userCount = 3;
- repeated RtcUserInfo list=4;
- }
- message `).concat(Nr,`{
- required int32 roomType=1;
- optional int32 broadcastType=2;
- optional RtcValueInfo extraInnerData = 3;
- optional bool needSysChatroom = 4; //\u662F\u5426\u9700\u8981\u540C\u6B65\u804A\u5929\u5BA4
- optional IdentityChangeType identityChangeType = 5; //\u8EAB\u4EFD\u53D8\u66F4\u7C7B\u578B
- optional JoinType joinType = 6; // \u52A0\u5165\u623F\u95F4\u7C7B\u578B
- repeated `).concat(Lt,` innerDatas = 7; //\u7528\u6237\u5185\u90E8inner\u6570\u636E\uFF0C\u89D2\u8272\u6216\u8005\u8FDE\u9EA6\u4FE1\u606F\u7B49
- repeated `).concat(Lt,` outerDatas = 8; //\u7528\u6237\u5185\u90E8outer\u6570\u636E\uFF0C\u81EA\u5B9A\u4E49\u6570\u636E\u7ED3\u6784RtcInput\u3002
- }
- enum JoinType {
- KICK = 0; //\u8E22\u524D\u4E00\u4E2A\u8BBE\u5907
- REFUSE = 1; //\u5F53\u524D\u52A0\u5165\u62D2\u7EDD
- COEXIST = 2; //\u4E24\u4E2A\u8BBE\u5907\u5171\u5B58
- }
- message RtcQryInput{
- required bool isInterior=1;
- required targetType target=2;
- repeated string key=3;
- }
- message `).concat(Zr,`{
- repeated `).concat(Lt,` outInfo=1;
- }
- message RtcDelDataInput{
- repeated string key=1;
- required bool isInterior=2;
- required targetType target=3;
- }
- message `).concat(Mr,`{
- required bool interior=1;
- required targetType target=2;
- repeated string key=3;
- optional string objectName=4;
- optional string content=5;
- }
- message `).concat(Do,`{
- required bool interior=1;
- required targetType target=2;
- required string key=3;
- required string value=4;
- optional string objectName=5;
- optional string content=6;
- }
- message `).concat(br,` {
- repeated `).concat(Lt,` valueInfo = 1;
- required string objectName = 2;
- repeated `).concat(Lt,` content = 3;
- }
- message RtcOutput
- {
- optional int32 nothing=1;
- }
- message `).concat(Wr,`{
- required string rtcToken=1;
- }
- enum targetType {
- ROOM =1 ;
- PERSON = 2;
- }
- message `).concat(ko,`{
- required targetType target=1;
- repeated `).concat(Lt,` valueInfo=2;
- optional string objectName=3;
- optional string content=4;
- }
- message `).concat(Vo,`{
- repeated string userId = 1;
- }
- message `).concat(oc,`{
- repeated RtcUserInfo user = 1;
- }
- message `).concat(Ro,`{
- required int32 nothing = 1;
- }
- message `).concat(rc,`{
- required int64 inboxTime = 1;
- required int64 sendboxTime = 2;
- required int64 totalUnreadCount = 3;
- }
- message `).concat(zr,`
- {
- required ChannelType type = 1;
- required int64 msgTime = 2;
- required string channelId = 3;
- optional string busChannel = 4;//\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
- }
- message SessionMsgReadOutput
- {
- optional int32 nothing=1;
- }
- message `).concat(No,`
- {
- repeated SessionInfo sessions = 1;
- }
- message `).concat(bo,`
- {
- required ChannelType type = 1;
- required string channelId = 2;
- optional string busChannel = 3;//\u6240\u5C5E\u4F1A\u8BDD\u4E1A\u52A1\u6807\u8BC6
- }
- message `).concat(ic,`
- {
- optional int32 nothing=1;
- }
- message `).concat(Ao,`
- {
- optional ChannelType type = 1;
- optional string conversationId = 2;
- repeated DeleteMsg msgs = 3;
- optional string busChannel = 4; //\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
- }
- message DeleteMsg
- {
- optional string msgId = 1;
- optional int64 msgDataTime = 2;
- optional int32 direct = 3;
- }
- message ChrmKVEntity {
- required string key = 1;
- required string value = 2;
- optional int32 status = 3;
- optional int64 timestamp = 4;
- optional string uid = 5;
- optional int64 version = 6;
- }
- message `).concat(Yo,` {
- required ChrmKVEntity entry = 1;
- optional bool bNotify = 2;
- optional UpStreamMessage notification = 3;
- optional ChannelType type = 4;
- }
- message `).concat(zo,` {
- repeated ChrmKVEntity entry = 1;
- optional bool bNotify = 2;
- optional UpStreamMessage notification = 3;
- optional ChannelType type = 4;
- }
- message `).concat(ac,` {
- repeated ChrmKVEntity entry = 1;
- optional bool bNotify = 2;
- optional UpStreamMessage notification = 3;
- optional ChannelType type = 4;
- }
- message `).concat(en,` {
- repeated ChrmKVEntity entries = 1;
- optional bool bFullUpdate = 2;
- optional int64 syncTime = 3;
- }
- message ChrmKVSVersionEntity {
- optional int64 version = 1;
- optional string key = 2;
- }
- message `).concat(Jo,` {
- repeated ChrmKVSOutputEntity errorKeys = 1;
- repeated ChrmKVSVersionEntity keysVersion = 2;
- }
- message `).concat(cc,`
- {
- optional string key = 1;
- optional int32 errorCode = 2;
- }
- message `).concat(Wo,` {
- required int64 timestamp = 1;
- }
- message `).concat(uc,` {
- required int64 version=1;
- required string value=2;
- }
- message `).concat(nn,` {
- required int64 version=1;
- required bool reserve=2;
- }
- message `).concat(Zo,` {
- required int64 version=1;
- optional bool reserve=2;
- }
- message `).concat(Qr,` {
- repeated UserSettingItem items = 1;
- required int64 version=2;
- }
- message UserSettingItem {
- required string targetId= 1;
- required ChannelType type = 2;
- required string key = 4;
- required bytes value = 5;
- required int64 version=6;
- required int32 status=7;
- repeated SessionTagItem tags= 8;
- }
- message `).concat(Qo,` {
- required int64 time = 1;
- }
- message `).concat(ti,` {
- required int64 version=1;
- repeated SessionState state= 2;
- }
- message `).concat(Ar,` {
- required ChannelType type = 1;
- required string channelId = 2;
- optional int64 time = 3;
- repeated SessionStateItem stateItem = 4;
- optional string busChannel = 5;//\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
- }
- message `).concat(wr,` {
- required SessionStateType sessionStateType = 1;
- required string value = 2;
- repeated SessionTagItem tags = 3;
- }
- enum SessionStateType {
- IsSilent = 1;
- IsTop = 2;
- Tags = 3;
- }
- message `).concat(Pr,` {
- required int64 version=1;
- repeated SessionState state= 2;
- }
- message `).concat(ts,` {
- optional string busChannel = 1;
- }
- message `).concat(es,`{
- optional string busChannel = 1;
- required int32 unpushLevel = 2;
- }
- message `).concat(ns,` {
- required string groupId = 1;
- optional string busChannel = 2;
- required int32 unpushLevel = 3;
- }
- message `).concat(Xo,` {
- required int64 version=1;
- }
- message `).concat(Lr,` {
- repeated string msgId=1; //\u5DF2\u8BFB\u6D88\u606FID
- optional string channelId = 2; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
- }
- message `).concat(dc,` {
- repeated string msgId=1; //\u5DF2\u8BFB\u6D88\u606FID
- optional string channelId = 2; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
- }
- message `).concat(ei,` {
- required int32 totalMemberNum = 1;//\u7FA4\u5185\u603B\u4EBA\u6570
- repeated GrpMsgReadUser list = 2;//\u5DF2\u8BFB\u7528\u6237\u5217\u8868\uFF08list\u590D\u7C7B\u578B\uFF09
- }
- message `).concat(lc,` {
- required int64 readTime = 1;//\u5DF2\u8BFB\u65F6\u95F4
- required string userId = 2;//\u5DF2\u8BFB\u7528\u6237id
- }
- message `).concat(rs,` {
- required int64 version=1;
- repeated SessionTagItem tags=2;
- }
- message `).concat(Nn,` {
- required string tagId=1;
- optional string name=2;
- optional int64 createdTime=3;
- optional bool isTop=4;
- }
- message `).concat(is,` {
- required int64 version=1;
- repeated SessionTagItem tags=2;
- }
- message `).concat(os,` {
- repeated string tagId=1;
- }
- message `).concat(Xr,` {
- required int64 version=1;
- required bool reserve=2;
- }
- message `).concat(ss,` {
- required string sdkInfo=1; // \u7528\u6237\u96C6\u6210\u7684 sdk \u4FE1\u606F,json \u683C\u5F0F {"web-rtc": "4.0.3.7"}
- }
- message `).concat(hc,`
- {
- optional int32 nothing=1; //\u5360\u4F4D
- }
- message `).concat(hs,`
- {
- required int32 type= 1; //(\u901A\u77E5\u7C7B\u578B 1:rtc\u623F\u95F4\u72B6\u6001KV\u53D8\u66F4\u901A\u77E5)
- optional int64 time= 2; //\u6D88\u606F\u4EA7\u751F\u65F6\u95F4
- optional string roomId=3; //\u4E3B\u64AD\u623F\u95F4id
- }
- message `).concat(ps,`
- {
- required int64 timestamp = 1;
- required string roomId = 2;
- }
- message `).concat(ii,`
- {
- repeated RtcKVEntity entries = 1;
- optional bool bFullUpdate = 2;
- optional int64 syncTime = 3;
- }
- message RtcKVEntity
- {
- required string key = 1;
- required string value = 2;
- optional int32 status = 3;
- optional int64 timestamp = 4;
- optional string uid = 5;
- }
- enum IdentityChangeType
- {
- AnchorToViewer = 1; //1\u4E3A\u4E3B\u64AD\u53D8\u89C2\u4F17
- ViewerToAnchor = 2; //2\u4E3A\u89C2\u4F17\u53D8\u4E3B\u64AD
- }
- message `).concat(fs,`
- {
- required string userId = 1;
- }
- message `).concat(oi,`
- {
- repeated RtcJoinedInfo info = 1;
- }
- message RtcJoinedInfo
- {
- required string deviceId = 1; //\u8BBE\u5907ID
- required string roomId = 2; //\u52A0\u5165\u7684\u623F\u95F4ID
- optional int64 joinTime = 3; //\u52A0\u5165\u7684\u65F6\u95F4
- }
- message `).concat(gc,`
- {
- required string rtcToken=1;
- repeated RtcKVEntity entries = 2;//KV\u5C5E\u6027\u5BF9\u8C61\u96C6\u5408
- optional int64 syncTime = 3;//\u6240\u6709\u5C5E\u6027\u7684\u6700\u5927\u65F6\u95F4\u6233\uFF08\u4E0B\u6B21\u62C9\u53D6KV\u65F6\u7528\uFF09\u3002
- }
- message `).concat(gs,`
- {
- required string invitedUserId=1; //\u88AB\u9080\u8BF7\u7684\u4EBA\u7684uid
- optional int32 timeoutTime=2; //\u9080\u8BF7\u8D85\u65F6\u65F6\u95F4(\u79D2),\u9ED8\u8BA4\u4E09\u5341\u79D2
- required string invitedRoomId=3; //\u88AB\u9080\u8BF7\u7684\u623F\u95F4
- required string inviteInfo=4; //\u9080\u8BF7\u7684\u4FE1\u606F(\u5305\u542B\u9080\u8BF7\u4EBA,\u88AB\u9080\u8BF7\u4EBA,\u5404\u81EAuserid)\u5BA2\u6237\u7AEF\u5B9A\u4E49\u597D.\u534F\u8BAE\u6808\u548Cserver\u900F\u4F20
- required string inviteSessionId= 5; //\u5BA2\u6237\u7AEF\u4FDD\u8BC1\u552F\u4E00\u6027(\u5EFA\u8BAEroomid_userid_\u65F6\u95F4\u6233_\u968F\u673A\u6570)
- }
- message `).concat(ms,`
- {
- required string invitedUserId=1; //\u88AB\u9080\u8BF7\u7684\u4EBA\u7684uid
- required string invitedRoomId=2; //\u88AB\u9080\u8BF7\u7684\u623F\u95F4
- required string inviteInfo=3; //\u53D6\u6D88\u9080\u8BF7\u7684\u4FE1\u606F(\u5305\u542B\u9080\u8BF7\u4EBA,\u88AB\u9080\u8BF7\u4EBA,\u5404\u81EAuserid)\u5BA2\u6237\u7AEF\u5B9A\u4E49\u597D.\u534F\u8BAE\u6808\u548Cserver\u900F\u4F20
- required string inviteSessionId=4; //\u9080\u8BF7\u7684sessionId,\u5BA2\u6237\u7AEF\u53D1\u8D77\u9080\u8BF7\u65F6\u4EA7\u751F
- }
- message `).concat(_s,`
- {
- required string inviteUserId=1; //\u9080\u8BF7\u7684\u4EBA\u7684uid
- required int32 answerCode=2; //\u662F\u5426\u63A5\u53D7\u8FDE\u9EA6\u9080\u8BF7.0\u4E3A\u62D2\u7EDD,1\u4E3A\u63A5\u53D7
- required string inviteRoomId=3; //\u9080\u8BF7\u7684\u623F\u95F4
- required string inviteSessionId=4; //\u9080\u8BF7\u7684sessionId
- required string content=5; //\u9700\u8981\u8F6C\u53D1\u7684content
- optional string key=6; //\u5982\u679C\u63A5\u53D7\u7684\u8BDD,\u9700\u8981\u52A0\u8FD9\u4E2A\u5B57\u6BB5,\u653E\u5728room\u7EA7\u522B\u7684k\u548Cv,\u65B0\u52A0\u5165\u623F\u95F4\u7684\u80FD\u62C9\u53D6\u5230
- optional string value=7; //\u5982\u679C\u63A5\u53D7\u7684\u8BDD,\u9700\u8981\u52A0\u8FD9\u4E2A\u5B57\u6BB5,\u653E\u5728room\u7EA7\u522B\u7684k\u548Cv,\u65B0\u52A0\u5165\u623F\u95F4\u7684\u80FD\u62C9\u53D6\u5230
- }
- message `).concat(vs,`
- {
- required string inviteRoomId=1; //\u9080\u8BF7\u7684\u623F\u95F4
- required string inviteSessionId=2; //\u9080\u8BF7\u7684sessionId
- required string inviteContent=3; //\u7ED3\u675F\u8FDE\u9EA6\u7684\u4FE1\u606F(\u9700\u8981\u900F\u4F20\u7ED9\u623F\u95F4\u5185\u5176\u4ED6\u4EBA)
- repeated string inviteRoomKeys=4; //\u9700\u8981\u5220\u9664\u8FDE\u9EA6\u7684\u4FE1\u606F\u7684key
- }
- message `).concat(as,`
- {
- required int64 syncTime = 1;//\u540C\u6B65\u65F6\u95F4\u6233
- optional bool isEraseMsgContent = 2;//\u62C9\u53D6\u4F1A\u8BDD\u65F6\uFF0C\u662F\u5426\u5C4F\u853D\u6389\u6D88\u606F\u5185\u5BB9
- }
- message `).concat(cs,`
- {
- required int64 syncTime = 1;//\u540C\u6B65\u65F6\u95F4\u6233
- }
- message `).concat(Ur,`
- {
- required string fromUserId = 1;//\uFF08\u8C01\u53D1\u7684\uFF09
- required string targetId = 2;// \u76EE\u6807Id(\u8D85\u7EA7\u7FA4Id)
- required ChannelType type = 3;//\u53D1\u9001\u7C7B\u578B\u5982\uFF1A\uFF08P2P,GROUP,ULTRAGROUP\uFF09
- required string msgUID = 4; // \u6269\u5C55\u6D88\u606F\u7684\u5185\u5BB9\u4F53
- required int64 msgTime = 5; //\u539F\u59CB\u6D88\u606F\u65F6\u95F4
- optional string busChannel = 6; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
- optional string content = 7; // \u5373extraContent\u6D88\u606F\u6269\u5C55\u5185\u5BB9,\u4E0B\u8868\u683C\u8BF4\u660E
- }
- message `).concat(us,` //\u67E5\u8BE2\u5165\u53C2
- {
- required int64 syncTime = 1;//\u540C\u6B65\u65F6\u95F4\u6233
- }
- message `).concat(ni,` //\u5E94\u7B54\u7ED3\u679C
- {
- repeated MsgChange list = 1; //\u53D8\u66F4
- required int64 syncTime = 2; //\u540C\u6B65\u65F6\u95F4(\u7528\u4E8E\u4E0B\u6B21\u540C\u6B65\u5165\u53C2)
- optional bool hasNext = 3 ;
- }
- message MsgChange //\u53D8\u66F4\u8BE6\u60C5
- {
- required string targetId = 1; // \u76EE\u6807Id(\u8D85\u7EA7\u7FA4Id)
- required ChannelType type = 2; // \u4F1A\u8BDD\u7C7B\u578B
- required int64 time = 3; // \u53D8\u66F4\u65F6\u95F4
- required int32 changeType = 4; // \u6D88\u606F\u53D8\u66F4\u7C7B\u578B\uFF081:\u6269\u5C55,2:\u4FEE\u6539,3:\u64A4\u56DE)
- required string msgUID = 5; // \u6D88\u606FID
- required int64 msgTime = 6; // \u6D88\u606F\u65F6\u95F4
- optional string busChannel = 7; // \u9891\u9053ID
- optional bool isAdmin = 8; //\u662F\u5426\u4E3A\u7BA1\u7406\u5458\uFF0C\u9ED8\u8BA4\u4E3A 0\uFF0C\u8BBE\u4E3A 1 \u65F6\uFF0CIMKit \u6536\u5230\u6B64\u6761\u6D88\u606F\u540E\uFF0C\u5C0F\u7070\u6761\u9ED8\u8BA4\u663E\u793A\u4E3A\u201C\u7BA1\u7406\u5458 \u64A4\u56DE\u4E86\u4E00\u6761\u6D88\u606F\u201D\u3002
- optional bool isDel = 9; //\u9ED8\u8BA4\u4E3A 0 \u64A4\u56DE\u8BE5\u6761\u6D88\u606F\u540C\u65F6\uFF0C\u7528\u6237\u7AEF\u5C06\u8BE5\u6761\u6D88\u606F\u5220\u9664\u5E76\u66FF\u6362\u4E3A\u4E00\u6761\u5C0F\u7070\u6761\u64A4\u56DE\u63D0\u793A\u6D88\u606F\uFF1B\u4E3A 1 \u65F6\uFF0C\u8BE5\u6761\u6D88\u606F\u5220\u9664\u540E\uFF0C\u4E0D\u66FF\u6362\u4E3A\u5C0F\u7070\u6761\u63D0\u793A\u6D88\u606F\u3002
- optional string operatorId = 10; // \u65B0\u52A0 - \u6D88\u606F\u53D8\u66F4\u7684\u64CD\u4F5C\u4EBAId
- }
- message `).concat(ds,` //\u8BF7\u6C42
- {
- required string targetId = 1; // \u76EE\u6807Id(\u8D85\u7EA7\u7FA4Id)
- required ChannelType type = 2; // \u4F1A\u8BDD\u7C7B\u578B
- repeated MessageQueryInfo query = 3; //
- }
- message MessageQueryInfo
- {
- required int64 msgTime = 1; // \u6D88\u606F\u65F6\u95F4
- required string msgUID = 2; // \u6D88\u606FID
- optional string busChannel = 3; // \u9891\u9053ID
- }
- message `).concat(xn,` //\u5E94\u7B54
- {
- repeated DownStreamMessage list = 1;//\u6D88\u606F
- }
- message `).concat(ls,` //\u5BA2\u6237\u7AEF\u53D1\u9001
- {
- optional string targetId = 1;// targetId
- optional ChannelType type = 2;//\u53D1\u9001\u4F1A\u8BDD\u7C7B\u578B\u5982\uFF1A\uFF08P2P,GROUP\uFF09
- optional int32 opType = 3; //0 , \u6B63\u5728\u8F93\u5165, 1 \u6B63\u5728XXX
- optional string busChannel = 4; // \u9891\u9053(channelId,\u53EF\u4EE5\u4E3A\u7A7A)
- }
- message `).concat(ri,` //\u670D\u52A1\u7AEF\u53D1\u9001
- {
- optional ChannelType type = 1;//\u53D1\u9001\u4F1A\u8BDD\u7C7B\u578B\u5982\uFF08P2P,GROUP\uFF09
- optional int64 notifyType = 2; //0x1 \u8868\u793A\u660E\u7EC6, 0x2 \u8868\u793A\u6C47\u603B 0x3 \u8868\u793A\u660E\u7EC6+\u6C47\u603B
- repeated OperateInfo info = 3 ; //\u660E\u7EC6\u5217\u8868 \u5F53notifyType \u4E3A 1\u548C3\u65F6,\u6709\u6548
- repeated OperateSummary summary = 4 ; //\u6C47\u603B\u5217\u8868, \u5F53notifyType \u4E3A2\u548C3 \u65F6,\u6709\u6548
- }
- message `).concat(pc,` {
- // XX \u6B63\u5728\u505A\u4EC0\u4E48
- optional string targetId = 1; // \u8D85\u7EA7\u7FA4Id \u4F1A\u8BDDid
- optional string busChannel = 2; // \u9891\u9053(channelId,\u53EF\u4EE5\u4E3A\u7A7A)
- optional string userId = 3; // userId
- optional int32 opType = 4; //0 , \u6B63\u5728\u8F93\u5165, 1 \u6B63\u5728XX
- optional int64 optime = 5; //\u670D\u52A1\u7AEF\u6536\u5230\u7528\u6237\u64CD\u4F5C\u7684\u4E0A\u884C\u65F6\u95F4.
- }
-
- message `).concat(fc,` {
- // \u51E0\u4E2A\u4EBA \u6B63\u5728\u5E72\u4EC0\u4E48
- optional string targetId = 1; // \u8D85\u7EA7\u7FA4Id \u4F1A\u8BDDid
- optional string busChannel = 2; // \u9891\u9053(channelId,\u53EF\u4EE5\u4E3A\u7A7A)
- optional int32 count = 3; // \u64CD\u4F5C\u4EBA\u6570
- optional int32 opType = 4; //0, \u6B63\u5728\u8F93\u5165, 1 \u6B63\u5728XX
- }
- message `).concat(Ts,`
- {
- required string rtcRoomId= 1; //rtc\u623F\u95F4ID;
- }
- message `).concat(mc,`
- {
- required int32 nothing = 1; //\u7528\u4E8E\u5360\u4F4D
- }
- }
- `),Xs,mi,ta,ea,mn,$e,Ge,Wi=(Xs=Ad,mi=function(){function n(C,A,F){this.low=0|C,this.high=0|A,this.unsigned=!!F}function t(C){return(C&&C.__isLong__)===!0}function e(C,A){var F,G,E;return A?(E=(C>>>=0)>=0&&C<256)&&(G=d[C])?G:(F=i(C,(0|C)<0?-1:0,!0),E&&(d[C]=F),F):(E=(C|=0)>=-128&&C<128)&&(G=c[C])?G:(F=i(C,C<0?-1:0,!1),E&&(c[C]=F),F)}function r(C,A){if(isNaN(C)||!isFinite(C))return A?m:f;if(A){if(C<0)return m;if(C>=a)return w}else{if(-u>=C)return L;if(C+1>=u)return y}return C<0?r(-C,A).neg():i(0|C%h,0|C/h,A)}function i(C,A,F){return new n(C,A,F)}function o(C,A,F){var G,E,S,I,N,b,k;if(C.length===0)throw Error("empty string");if(C==="NaN"||C==="Infinity"||C==="+Infinity"||C==="-Infinity")return f;if(typeof A=="number"?(F=A,A=!1):A=!!A,(F=F||10)<2||F>36)throw RangeError("radix");if((G=C.indexOf("-"))>0)throw Error("interior hyphen");if(G===0)return o(C.substring(1),A,F).neg();for(E=r(l(F,8)),S=f,I=0;I<C.length;I+=8)N=Math.min(8,C.length-I),b=parseInt(C.substring(I,I+N),F),N<8?(k=r(l(F,N)),S=S.mul(k).add(r(b))):S=(S=S.mul(E)).add(r(b));return S.unsigned=A,S}function s(C){return C instanceof n?C:typeof C=="number"?r(C):typeof C=="string"?o(C):i(C.low,C.high,C.unsigned)}var c,d,l,h,a,u,p,f,m,_,v,T,y,w,L,M;return n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),n.isLong=t,c={},d={},n.fromInt=e,n.fromNumber=r,n.fromBits=i,l=Math.pow,n.fromString=o,n.fromValue=s,u=(a=(h=4294967296)*h)/2,p=e(16777216),f=e(0),n.ZERO=f,m=e(0,!0),n.UZERO=m,_=e(1),n.ONE=_,v=e(1,!0),n.UONE=v,T=e(-1),n.NEG_ONE=T,y=i(-1,2147483647,!1),n.MAX_VALUE=y,w=i(-1,-1,!0),n.MAX_UNSIGNED_VALUE=w,L=i(0,-2147483648,!1),n.MIN_VALUE=L,(M=n.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},M.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},M.toString=function(C){var A,F,G,E,S,I,N,b;if((C=C||10)<2||C>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(L)?(A=r(C),G=(F=this.div(A)).mul(A).sub(this),F.toString(C)+G.toInt().toString(C)):"-"+this.neg().toString(C);for(E=r(l(C,6),this.unsigned),S=this,I="";;){if(N=S.div(E),b=(S.sub(N.mul(E)).toInt()>>>0).toString(C),(S=N).isZero())return b+I;for(;b.length<6;)b="0"+b;I=""+b+I}},M.getHighBits=function(){return this.high},M.getHighBitsUnsigned=function(){return this.high>>>0},M.getLowBits=function(){return this.low},M.getLowBitsUnsigned=function(){return this.low>>>0},M.getNumBitsAbs=function(){var C,A;if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(C=this.high!=0?this.high:this.low,A=31;A>0&&(C&1<<A)==0;A--);return this.high!=0?A+33:A+1},M.isZero=function(){return this.high===0&&this.low===0},M.isNegative=function(){return!this.unsigned&&this.high<0},M.isPositive=function(){return this.unsigned||this.high>=0},M.isOdd=function(){return(1&this.low)==1},M.isEven=function(){return(1&this.low)==0},M.equals=function(C){return t(C)||(C=s(C)),(this.unsigned===C.unsigned||this.high>>>31!=1||C.high>>>31!=1)&&this.high===C.high&&this.low===C.low},M.eq=M.equals,M.notEquals=function(C){return!this.eq(C)},M.neq=M.notEquals,M.lessThan=function(C){return this.comp(C)<0},M.lt=M.lessThan,M.lessThanOrEqual=function(C){return this.comp(C)<=0},M.lte=M.lessThanOrEqual,M.greaterThan=function(C){return this.comp(C)>0},M.gt=M.greaterThan,M.greaterThanOrEqual=function(C){return this.comp(C)>=0},M.gte=M.greaterThanOrEqual,M.compare=function(C){if(t(C)||(C=s(C)),this.eq(C))return 0;var A=this.isNegative(),F=C.isNegative();return A&&!F?-1:!A&&F?1:this.unsigned?C.high>>>0>this.high>>>0||C.high===this.high&&C.low>>>0>this.low>>>0?-1:1:this.sub(C).isNegative()?-1:1},M.comp=M.compare,M.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(_)},M.neg=M.negate,M.add=function(C){var A,F,G,E,S,I,N,b,k,U,$;return t(C)||(C=s(C)),A=this.high>>>16,F=65535&this.high,G=this.low>>>16,E=65535&this.low,S=C.high>>>16,I=65535&C.high,N=C.low>>>16,b=0,k=0,U=0,$=0,U+=($+=E+(65535&C.low))>>>16,k+=(U+=G+N)>>>16,b+=(k+=F+I)>>>16,b+=A+S,i((U&=65535)<<16|($&=65535),(b&=65535)<<16|(k&=65535),this.unsigned)},M.subtract=function(C){return t(C)||(C=s(C)),this.add(C.neg())},M.sub=M.subtract,M.multiply=function(C){var A,F,G,E,S,I,N,b,k,U,$,q;return this.isZero()?f:(t(C)||(C=s(C)),C.isZero()?f:this.eq(L)?C.isOdd()?L:f:C.eq(L)?this.isOdd()?L:f:this.isNegative()?C.isNegative()?this.neg().mul(C.neg()):this.neg().mul(C).neg():C.isNegative()?this.mul(C.neg()).neg():this.lt(p)&&C.lt(p)?r(this.toNumber()*C.toNumber(),this.unsigned):(A=this.high>>>16,F=65535&this.high,G=this.low>>>16,E=65535&this.low,S=C.high>>>16,I=65535&C.high,N=C.low>>>16,k=0,U=0,$=0,q=0,$+=(q+=E*(b=65535&C.low))>>>16,U+=($+=G*b)>>>16,$&=65535,U+=($+=E*N)>>>16,k+=(U+=F*b)>>>16,U&=65535,k+=(U+=G*N)>>>16,U&=65535,k+=(U+=E*I)>>>16,k+=A*b+F*N+G*I+E*S,i(($&=65535)<<16|(q&=65535),(k&=65535)<<16|(U&=65535),this.unsigned)))},M.mul=M.multiply,M.divide=function(C){var A,F,G,E,S,I,N;if(t(C)||(C=s(C)),C.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;if(this.unsigned){if(C.unsigned||(C=C.toUnsigned()),C.gt(this))return m;if(C.gt(this.shru(1)))return v;G=m}else{if(this.eq(L))return C.eq(_)||C.eq(T)?L:C.eq(L)?_:(A=this.shr(1).div(C).shl(1)).eq(f)?C.isNegative()?_:T:(F=this.sub(C.mul(A)),G=A.add(F.div(C)));if(C.eq(L))return this.unsigned?m:f;if(this.isNegative())return C.isNegative()?this.neg().div(C.neg()):this.neg().div(C).neg();if(C.isNegative())return this.div(C.neg()).neg();G=f}for(F=this;F.gte(C);){for(A=Math.max(1,Math.floor(F.toNumber()/C.toNumber())),S=(E=Math.ceil(Math.log(A)/Math.LN2))<=48?1:l(2,E-48),N=(I=r(A)).mul(C);N.isNegative()||N.gt(F);)N=(I=r(A-=S,this.unsigned)).mul(C);I.isZero()&&(I=_),G=G.add(I),F=F.sub(N)}return G},M.div=M.divide,M.modulo=function(C){return t(C)||(C=s(C)),this.sub(this.div(C).mul(C))},M.mod=M.modulo,M.not=function(){return i(~this.low,~this.high,this.unsigned)},M.and=function(C){return t(C)||(C=s(C)),i(this.low&C.low,this.high&C.high,this.unsigned)},M.or=function(C){return t(C)||(C=s(C)),i(this.low|C.low,this.high|C.high,this.unsigned)},M.xor=function(C){return t(C)||(C=s(C)),i(this.low^C.low,this.high^C.high,this.unsigned)},M.shiftLeft=function(C){return t(C)&&(C=C.toInt()),(C&=63)==0?this:C<32?i(this.low<<C,this.high<<C|this.low>>>32-C,this.unsigned):i(0,this.low<<C-32,this.unsigned)},M.shl=M.shiftLeft,M.shiftRight=function(C){return t(C)&&(C=C.toInt()),(C&=63)==0?this:C<32?i(this.low>>>C|this.high<<32-C,this.high>>C,this.unsigned):i(this.high>>C-32,this.high>=0?0:-1,this.unsigned)},M.shr=M.shiftRight,M.shiftRightUnsigned=function(C){var A;return t(C)&&(C=C.toInt()),(C&=63)==0?this:(A=this.high,C<32?i(this.low>>>C|A<<32-C,A>>>C,this.unsigned):i(C===32?A:A>>>C-32,0,this.unsigned))},M.shru=M.shiftRightUnsigned,M.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},M.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},M.toBytes=function(C){return C?this.toBytesLE():this.toBytesBE()},M.toBytesLE=function(){var C=this.high,A=this.low;return[255&A,255&A>>>8,255&A>>>16,255&A>>>24,255&C,255&C>>>8,255&C>>>16,255&C>>>24]},M.toBytesBE=function(){var C=this.high,A=this.low;return[255&C>>>24,255&C>>>16,255&C>>>8,255&C,255&A>>>24,255&A>>>16,255&A>>>8,255&A]},n}(),ta=function(n){function t(a){var u=0;return function(){return u<a.length?a.charCodeAt(u++):null}}function e(){var a=[],u=[];return function(){return arguments.length===0?u.join("")+c.apply(String,a):(a.length+arguments.length>1024&&(u.push(c.apply(String,a)),a.length=0),void Array.prototype.push.apply(a,arguments))}}function r(a,u,p,f,m){var _,v,T=8*m-f-1,y=(1<<T)-1,w=y>>1,L=-7,M=p?m-1:0,C=p?-1:1,A=a[u+M];for(M+=C,_=A&(1<<-L)-1,A>>=-L,L+=T;L>0;_=256*_+a[u+M],M+=C,L-=8);for(v=_&(1<<-L)-1,_>>=-L,L+=f;L>0;v=256*v+a[u+M],M+=C,L-=8);if(_===0)_=1-w;else{if(_===y)return v?NaN:1/0*(A?-1:1);v+=Math.pow(2,f),_-=w}return(A?-1:1)*v*Math.pow(2,_-f)}function i(a,u,p,f,m,_){var v,T,y,w=8*_-m-1,L=(1<<w)-1,M=L>>1,C=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=f?0:_-1,F=f?1:-1,G=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||1/0===u?(T=isNaN(u)?1:0,v=L):(v=Math.floor(Math.log(u)/Math.LN2),u*(y=Math.pow(2,-v))<1&&(v--,y*=2),(u+=v+M>=1?C/y:C*Math.pow(2,1-M))*y>=2&&(v++,y/=2),v+M>=L?(T=0,v=L):v+M>=1?(T=(u*y-1)*Math.pow(2,m),v+=M):(T=u*Math.pow(2,M-1)*Math.pow(2,m),v=0));m>=8;a[p+A]=255&T,A+=F,T/=256,m-=8);for(v=v<<m|T,w+=m;w>0;a[p+A]=255&v,A+=F,v/=256,w-=8);a[p+A-F]|=128*G}var o,s,c,d,l,h=function(a,u,p){if(a===void 0&&(a=h.DEFAULT_CAPACITY),u===void 0&&(u=h.DEFAULT_ENDIAN),p===void 0&&(p=h.DEFAULT_NOASSERT),!p){if((a|=0)<0)throw RangeError("Illegal capacity");u=!!u,p=!!p}this.buffer=a===0?s:new ArrayBuffer(a),this.view=a===0?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=a,this.littleEndian=u,this.noAssert=p};return h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=n||null,(o=h.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),c=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(a,u,p){return new h(a,u,p)},h.concat=function(a,u,p,f){var m,_,v,T,y,w;for((typeof u=="boolean"||typeof u!="string")&&(f=p,p=u,u=void 0),m=0,v=0,T=a.length;T>v;++v)h.isByteBuffer(a[v])||(a[v]=h.wrap(a[v],u)),(_=a[v].limit-a[v].offset)>0&&(m+=_);if(m===0)return new h(0,p,f);for(w=new h(m,p,f),v=0;T>v;)(_=(y=a[v++]).limit-y.offset)<=0||(w.view.set(y.view.subarray(y.offset,y.limit),w.offset),w.offset+=_);return w.limit=w.offset,w.offset=0,w},h.isByteBuffer=function(a){return(a&&a.__isByteBuffer__)===!0},h.type=function(){return ArrayBuffer},h.wrap=function(a,u,p,f){var m,_;if(typeof u!="string"&&(f=p,p=u,u=void 0),typeof a=="string")switch(u===void 0&&(u="utf8"),u){case"base64":return h.fromBase64(a,p);case"hex":return h.fromHex(a,p);case"binary":return h.fromBinary(a,p);case"utf8":return h.fromUTF8(a,p);case"debug":return h.fromDebug(a,p);default:throw Error("Unsupported encoding: "+u)}if(a===null||typeof a!="object")throw TypeError("Illegal buffer");if(h.isByteBuffer(a))return(m=o.clone.call(a)).markedOffset=-1,m;if(a instanceof Uint8Array)m=new h(0,p,f),a.length>0&&(m.buffer=a.buffer,m.offset=a.byteOffset,m.limit=a.byteOffset+a.byteLength,m.view=new Uint8Array(a.buffer));else if(a instanceof ArrayBuffer)m=new h(0,p,f),a.byteLength>0&&(m.buffer=a,m.offset=0,m.limit=a.byteLength,m.view=a.byteLength>0?new Uint8Array(a):null);else{if(Object.prototype.toString.call(a)!=="[object Array]")throw TypeError("Illegal buffer");for((m=new h(a.length,p,f)).limit=a.length,_=0;_<a.length;++_)m.view[_]=a[_]}return m},o.writeBitSet=function(a,u){var p,f,m,_,v,T,y=u===void 0;if(y&&(u=this.offset),!this.noAssert){if(!(a instanceof Array))throw TypeError("Illegal BitSet: Not an array");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}for(f=u,_=(m=a.length)>>3,v=0,u+=this.writeVarint32(m,u);_--;)p=1&!!a[v++]|(1&!!a[v++])<<1|(1&!!a[v++])<<2|(1&!!a[v++])<<3|(1&!!a[v++])<<4|(1&!!a[v++])<<5|(1&!!a[v++])<<6|(1&!!a[v++])<<7,this.writeByte(p,u++);if(m>v){for(T=0,p=0;m>v;)p|=(1&!!a[v++])<<T++;this.writeByte(p,u++)}return y?(this.offset=u,this):u-f},o.readBitSet=function(a){var u,p,f,m,_,v,T,y=a===void 0;for(y&&(a=this.offset),m=(f=(p=this.readVarint32(a)).value)>>3,_=0,v=[],a+=p.length;m--;)u=this.readByte(a++),v[_++]=!!(1&u),v[_++]=!!(2&u),v[_++]=!!(4&u),v[_++]=!!(8&u),v[_++]=!!(16&u),v[_++]=!!(32&u),v[_++]=!!(64&u),v[_++]=!!(128&u);if(f>_)for(T=0,u=this.readByte(a++);f>_;)v[_++]=!!(1&u>>T++);return y&&(this.offset=a),v},o.readBytes=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+"+a+") <= "+this.buffer.byteLength)}return p=this.slice(u,u+a),f&&(this.offset+=a),p},o.writeBytes=o.append,o.writeInt8=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=1)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=1,this.view[u]=a,f&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return(128&(u=this.view[a]))==128&&(u=-(255-u+1)),p&&(this.offset+=1),u},o.readByte=o.readInt8,o.writeUint8=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=1)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=1,this.view[u]=a,f&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return u=this.view[a],p&&(this.offset+=1),u},o.readUInt8=o.readUint8,o.writeInt16=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=2)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=2,this.littleEndian?(this.view[u+1]=(65280&a)>>>8,this.view[u]=255&a):(this.view[u]=(65280&a)>>>8,this.view[u+1]=255&a),f&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength)}return u=0,this.littleEndian?(u=this.view[a],u|=this.view[a+1]<<8):(u=this.view[a]<<8,u|=this.view[a+1]),(32768&u)==32768&&(u=-(65535-u+1)),p&&(this.offset+=2),u},o.readShort=o.readInt16,o.writeUint16=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=2)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=2,this.littleEndian?(this.view[u+1]=(65280&a)>>>8,this.view[u]=255&a):(this.view[u]=(65280&a)>>>8,this.view[u+1]=255&a),f&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength)}return u=0,this.littleEndian?(u=this.view[a],u|=this.view[a+1]<<8):(u=this.view[a]<<8,u|=this.view[a+1]),p&&(this.offset+=2),u},o.readUInt16=o.readUint16,o.writeInt32=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=4,this.littleEndian?(this.view[u+3]=255&a>>>24,this.view[u+2]=255&a>>>16,this.view[u+1]=255&a>>>8,this.view[u]=255&a):(this.view[u]=255&a>>>24,this.view[u+1]=255&a>>>16,this.view[u+2]=255&a>>>8,this.view[u+3]=255&a),f&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return u=0,this.littleEndian?(u=this.view[a+2]<<16,u|=this.view[a+1]<<8,u|=this.view[a],u+=this.view[a+3]<<24>>>0):(u=this.view[a+1]<<16,u|=this.view[a+2]<<8,u|=this.view[a+3],u+=this.view[a]<<24>>>0),u|=0,p&&(this.offset+=4),u},o.readInt=o.readInt32,o.writeUint32=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=4,this.littleEndian?(this.view[u+3]=255&a>>>24,this.view[u+2]=255&a>>>16,this.view[u+1]=255&a>>>8,this.view[u]=255&a):(this.view[u]=255&a>>>24,this.view[u+1]=255&a>>>16,this.view[u+2]=255&a>>>8,this.view[u+3]=255&a),f&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return u=0,this.littleEndian?(u=this.view[a+2]<<16,u|=this.view[a+1]<<8,u|=this.view[a],u+=this.view[a+3]<<24>>>0):(u=this.view[a+1]<<16,u|=this.view[a+2]<<8,u|=this.view[a+3],u+=this.view[a]<<24>>>0),p&&(this.offset+=4),u},o.readUInt32=o.readUint32,n&&(o.writeInt64=function(a,u){var p,f,m,_=u===void 0;if(_&&(u=this.offset),!this.noAssert){if(typeof a=="number")a=n.fromNumber(a);else if(typeof a=="string")a=n.fromString(a);else if(!(a&&a instanceof n))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a)),(u+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=8,f=a.low,m=a.high,this.littleEndian?(this.view[u+3]=255&f>>>24,this.view[u+2]=255&f>>>16,this.view[u+1]=255&f>>>8,this.view[u]=255&f,u+=4,this.view[u+3]=255&m>>>24,this.view[u+2]=255&m>>>16,this.view[u+1]=255&m>>>8,this.view[u]=255&m):(this.view[u]=255&m>>>24,this.view[u+1]=255&m>>>16,this.view[u+2]=255&m>>>8,this.view[u+3]=255&m,u+=4,this.view[u]=255&f>>>24,this.view[u+1]=255&f>>>16,this.view[u+2]=255&f>>>8,this.view[u+3]=255&f),_&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(a){var u,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength)}return u=0,p=0,this.littleEndian?(u=this.view[a+2]<<16,u|=this.view[a+1]<<8,u|=this.view[a],u+=this.view[a+3]<<24>>>0,a+=4,p=this.view[a+2]<<16,p|=this.view[a+1]<<8,p|=this.view[a],p+=this.view[a+3]<<24>>>0):(p=this.view[a+1]<<16,p|=this.view[a+2]<<8,p|=this.view[a+3],p+=this.view[a]<<24>>>0,a+=4,u=this.view[a+1]<<16,u|=this.view[a+2]<<8,u|=this.view[a+3],u+=this.view[a]<<24>>>0),f=new n(u,p,!1),m&&(this.offset+=8),f},o.readLong=o.readInt64,o.writeUint64=function(a,u){var p,f,m,_=u===void 0;if(_&&(u=this.offset),!this.noAssert){if(typeof a=="number")a=n.fromNumber(a);else if(typeof a=="string")a=n.fromString(a);else if(!(a&&a instanceof n))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a)),(u+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=8,f=a.low,m=a.high,this.littleEndian?(this.view[u+3]=255&f>>>24,this.view[u+2]=255&f>>>16,this.view[u+1]=255&f>>>8,this.view[u]=255&f,u+=4,this.view[u+3]=255&m>>>24,this.view[u+2]=255&m>>>16,this.view[u+1]=255&m>>>8,this.view[u]=255&m):(this.view[u]=255&m>>>24,this.view[u+1]=255&m>>>16,this.view[u+2]=255&m>>>8,this.view[u+3]=255&m,u+=4,this.view[u]=255&f>>>24,this.view[u+1]=255&f>>>16,this.view[u+2]=255&f>>>8,this.view[u+3]=255&f),_&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(a){var u,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength)}return u=0,p=0,this.littleEndian?(u=this.view[a+2]<<16,u|=this.view[a+1]<<8,u|=this.view[a],u+=this.view[a+3]<<24>>>0,a+=4,p=this.view[a+2]<<16,p|=this.view[a+1]<<8,p|=this.view[a],p+=this.view[a+3]<<24>>>0):(p=this.view[a+1]<<16,p|=this.view[a+2]<<8,p|=this.view[a+3],p+=this.view[a]<<24>>>0,a+=4,u=this.view[a+1]<<16,u|=this.view[a+2]<<8,u|=this.view[a+3],u+=this.view[a]<<24>>>0),f=new n(u,p,!0),m&&(this.offset+=8),f},o.readUInt64=o.readUint64),o.writeFloat32=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number")throw TypeError("Illegal value: "+a+" (not a number)");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=4,i(this.view,a,u,this.littleEndian,23,4),f&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return u=r(this.view,a,this.littleEndian,23,4),p&&(this.offset+=4),u},o.readFloat=o.readFloat32,o.writeFloat64=function(a,u){var p,f=u===void 0;if(f&&(u=this.offset),!this.noAssert){if(typeof a!="number")throw TypeError("Illegal value: "+a+" (not a number)");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return(u+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>u?p:u),u-=8,i(this.view,a,u,this.littleEndian,52,8),f&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(a){var u,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength)}return u=r(this.view,a,this.littleEndian,52,8),p&&(this.offset+=8),u},o.readDouble=o.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(a){return(a>>>=0)<128?1:a<16384?2:1<<21>a?3:1<<28>a?4:5},h.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0},h.zigZagDecode32=function(a){return 0|a>>>1^-(1&a)},o.writeVarint32=function(a,u){var p,f,m,_=u===void 0;if(_&&(u=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}for((u+=f=h.calculateVarint32(a))>(m=this.buffer.byteLength)&&this.resize((m*=2)>u?m:u),u-=f,a>>>=0;a>=128;)p=128|127&a,this.view[u++]=p,a>>>=7;return this.view[u++]=a,_?(this.offset=u,this):f},o.writeVarint32ZigZag=function(a,u){return this.writeVarint32(h.zigZagEncode32(a),u)},o.readVarint32=function(a){var u,p,f,m,_=a===void 0;if(_&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}p=0,f=0;do{if(!this.noAssert&&a>this.limit)throw(m=Error("Truncated")).truncated=!0,m;u=this.view[a++],p<5&&(f|=(127&u)<<7*p),++p}while((128&u)!=0);return f|=0,_?(this.offset=a,f):{value:f,length:p}},o.readVarint32ZigZag=function(a){var u=this.readVarint32(a);return typeof u=="object"?u.value=h.zigZagDecode32(u.value):u=h.zigZagDecode32(u),u},n&&(h.MAX_VARINT64_BYTES=10,h.calculateVarint64=function(a){typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a));var u=a.toInt()>>>0,p=a.shiftRightUnsigned(28).toInt()>>>0,f=a.shiftRightUnsigned(56).toInt()>>>0;return f==0?p==0?u<16384?u<128?1:2:1<<21>u?3:4:p<16384?p<128?5:6:1<<21>p?7:8:f<128?9:10},h.zigZagEncode64=function(a){return typeof a=="number"?a=n.fromNumber(a,!1):typeof a=="string"?a=n.fromString(a,!1):a.unsigned!==!1&&(a=a.toSigned()),a.shiftLeft(1).xor(a.shiftRight(63)).toUnsigned()},h.zigZagDecode64=function(a){return typeof a=="number"?a=n.fromNumber(a,!1):typeof a=="string"?a=n.fromString(a,!1):a.unsigned!==!1&&(a=a.toSigned()),a.shiftRightUnsigned(1).xor(a.and(n.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(a,u){var p,f,m,_,v,T=u===void 0;if(T&&(u=this.offset),!this.noAssert){if(typeof a=="number")a=n.fromNumber(a);else if(typeof a=="string")a=n.fromString(a);else if(!(a&&a instanceof n))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}switch(typeof a=="number"?a=n.fromNumber(a,!1):typeof a=="string"?a=n.fromString(a,!1):a.unsigned!==!1&&(a=a.toSigned()),p=h.calculateVarint64(a),f=a.toInt()>>>0,m=a.shiftRightUnsigned(28).toInt()>>>0,_=a.shiftRightUnsigned(56).toInt()>>>0,(u+=p)>(v=this.buffer.byteLength)&&this.resize((v*=2)>u?v:u),u-=p,p){case 10:this.view[u+9]=1&_>>>7;case 9:this.view[u+8]=p!==9?128|_:127&_;case 8:this.view[u+7]=p!==8?128|m>>>21:127&m>>>21;case 7:this.view[u+6]=p!==7?128|m>>>14:127&m>>>14;case 6:this.view[u+5]=p!==6?128|m>>>7:127&m>>>7;case 5:this.view[u+4]=p!==5?128|m:127&m;case 4:this.view[u+3]=p!==4?128|f>>>21:127&f>>>21;case 3:this.view[u+2]=p!==3?128|f>>>14:127&f>>>14;case 2:this.view[u+1]=p!==2?128|f>>>7:127&f>>>7;case 1:this.view[u]=p!==1?128|f:127&f}return T?(this.offset+=p,this):p},o.writeVarint64ZigZag=function(a,u){return this.writeVarint64(h.zigZagEncode64(a),u)},o.readVarint64=function(a){var u,p,f,m,_,v,T=a===void 0;if(T&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}if(u=a,p=0,f=0,m=0,_=0,p=127&(_=this.view[a++]),128&_&&(p|=(127&(_=this.view[a++]))<<7,(128&_||this.noAssert&&_===void 0)&&(p|=(127&(_=this.view[a++]))<<14,(128&_||this.noAssert&&_===void 0)&&(p|=(127&(_=this.view[a++]))<<21,(128&_||this.noAssert&&_===void 0)&&(f=127&(_=this.view[a++]),(128&_||this.noAssert&&_===void 0)&&(f|=(127&(_=this.view[a++]))<<7,(128&_||this.noAssert&&_===void 0)&&(f|=(127&(_=this.view[a++]))<<14,(128&_||this.noAssert&&_===void 0)&&(f|=(127&(_=this.view[a++]))<<21,(128&_||this.noAssert&&_===void 0)&&(m=127&(_=this.view[a++]),(128&_||this.noAssert&&_===void 0)&&(m|=(127&(_=this.view[a++]))<<7,128&_||this.noAssert&&_===void 0))))))))))throw Error("Buffer overrun");return v=n.fromBits(p|f<<28,f>>>4|m<<24,!1),T?(this.offset=a,v):{value:v,length:a-u}},o.readVarint64ZigZag=function(a){var u=this.readVarint64(a);return u&&u.value instanceof n?u.value=h.zigZagDecode64(u.value):u=h.zigZagDecode64(u),u}),o.writeCString=function(a,u){var p,f,m,_=u===void 0;if(_&&(u=this.offset),f=a.length,!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");for(p=0;f>p;++p)if(a.charCodeAt(p)===0)throw RangeError("Illegal str: Contains NULL-characters");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return f=l.calculateUTF16asUTF8(t(a))[1],u+=f+1,m=this.buffer.byteLength,u>m&&this.resize((m*=2)>u?m:u),u-=f+1,l.encodeUTF16toUTF8(t(a),function(v){this.view[u++]=v}.bind(this)),this.view[u++]=0,_?(this.offset=u,this):f},o.readCString=function(a){var u,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return u=a,f=-1,l.decodeUTF8toUTF16(function(){if(f===0)return null;if(a>=this.limit)throw RangeError("Illegal range: Truncated data, "+a+" < "+this.limit);return(f=this.view[a++])===0?null:f}.bind(this),p=e(),!0),m?(this.offset=a,p()):{string:p(),length:a-u}},o.writeIString=function(a,u){var p,f,m,_=u===void 0;if(_&&(u=this.offset),!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}if(f=u,p=l.calculateUTF16asUTF8(t(a),this.noAssert)[1],u+=4+p,m=this.buffer.byteLength,u>m&&this.resize((m*=2)>u?m:u),u-=4+p,this.littleEndian?(this.view[u+3]=255&p>>>24,this.view[u+2]=255&p>>>16,this.view[u+1]=255&p>>>8,this.view[u]=255&p):(this.view[u]=255&p>>>24,this.view[u+1]=255&p>>>16,this.view[u+2]=255&p>>>8,this.view[u+3]=255&p),u+=4,l.encodeUTF16toUTF8(t(a),function(v){this.view[u++]=v}.bind(this)),u!==f+4+p)throw RangeError("Illegal range: Truncated data, "+u+" == "+(u+4+p));return _?(this.offset=u,this):u-f},o.readIString=function(a){var u,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return u=a,p=this.readUint32(a),f=this.readUTF8String(p,h.METRICS_BYTES,a+=4),a+=f.length,m?(this.offset=a,f.string):{string:f.string,length:a-u}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",o.writeUTF8String=function(a,u){var p,f,m,_=u===void 0;if(_&&(u=this.offset),!this.noAssert){if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}return f=u,p=l.calculateUTF16asUTF8(t(a))[1],u+=p,m=this.buffer.byteLength,u>m&&this.resize((m*=2)>u?m:u),u-=p,l.encodeUTF16toUTF8(t(a),function(v){this.view[u++]=v}.bind(this)),_?(this.offset=u,this):u-f},o.writeString=o.writeUTF8String,h.calculateUTF8Chars=function(a){return l.calculateUTF16asUTF8(t(a))[0]},h.calculateUTF8Bytes=function(a){return l.calculateUTF16asUTF8(t(a))[1]},h.calculateString=h.calculateUTF8Bytes,o.readUTF8String=function(a,u,p){var f,m,_,v,T;if(typeof u=="number"&&(p=u,u=void 0),(f=p===void 0)&&(p=this.offset),u===void 0&&(u=h.METRICS_CHARS),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal length: "+a+" (not an integer)");if(a|=0,typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+0) <= "+this.buffer.byteLength)}if(_=0,v=p,u===h.METRICS_CHARS){if(m=e(),l.decodeUTF8(function(){return a>_&&p<this.limit?this.view[p++]:null}.bind(this),function(y){++_,l.UTF8toUTF16(y,m)}),_!==a)throw RangeError("Illegal range: Truncated data, "+_+" == "+a);return f?(this.offset=p,m()):{string:m(),length:p-v}}if(u===h.METRICS_BYTES){if(!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+"+a+") <= "+this.buffer.byteLength)}if(T=p+a,l.decodeUTF8toUTF16(function(){return T>p?this.view[p++]:null}.bind(this),m=e(),this.noAssert),p!==T)throw RangeError("Illegal range: Truncated data, "+p+" == "+T);return f?(this.offset=p,m()):{string:m(),length:p-v}}throw TypeError("Unsupported metrics: "+u)},o.readString=o.readUTF8String,o.writeVString=function(a,u){var p,f,m,_,v=u===void 0;if(v&&(u=this.offset),!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(typeof u!="number"||u%1!=0)throw TypeError("Illegal offset: "+u+" (not an integer)");if((u>>>=0)<0||u+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+u+" (+0) <= "+this.buffer.byteLength)}if(m=u,p=l.calculateUTF16asUTF8(t(a),this.noAssert)[1],f=h.calculateVarint32(p),u+=f+p,_=this.buffer.byteLength,u>_&&this.resize((_*=2)>u?_:u),u-=f+p,u+=this.writeVarint32(p,u),l.encodeUTF16toUTF8(t(a),function(T){this.view[u++]=T}.bind(this)),u!==m+p+f)throw RangeError("Illegal range: Truncated data, "+u+" == "+(u+p+f));return v?(this.offset=u,this):u-m},o.readVString=function(a){var u,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return u=a,p=this.readVarint32(a),f=this.readUTF8String(p.value,h.METRICS_BYTES,a+=p.length),a+=f.length,m?(this.offset=a,f.string):{string:f.string,length:a-u}},o.append=function(a,u,p){var f,m,_;if((typeof u=="number"||typeof u!="string")&&(p=u,u=void 0),(f=p===void 0)&&(p=this.offset),!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+0) <= "+this.buffer.byteLength)}return a instanceof h||(a=h.wrap(a,u)),(m=a.limit-a.offset)<=0||((p+=m)>(_=this.buffer.byteLength)&&this.resize((_*=2)>p?_:p),p-=m,this.view.set(a.view.subarray(a.offset,a.limit),p),a.offset+=m,f&&(this.offset+=m)),this},o.appendTo=function(a,u){return a.append(this,u),this},o.assert=function(a){return this.noAssert=!a,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(a){var u=new h(0,this.littleEndian,this.noAssert);return a?(u.buffer=new ArrayBuffer(this.buffer.byteLength),u.view=new Uint8Array(u.buffer)):(u.buffer=this.buffer,u.view=this.view),u.offset=this.offset,u.markedOffset=this.markedOffset,u.limit=this.limit,u},o.compact=function(a,u){var p,f,m;if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal end: Not an integer");if(u>>>=0,a<0||a>u||u>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+u+" <= "+this.buffer.byteLength)}return a===0&&u===this.buffer.byteLength?this:(p=u-a)==0?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=a),this.offset=0,this.limit=0,this):(f=new ArrayBuffer(p),(m=new Uint8Array(f)).set(this.view.subarray(a,u)),this.buffer=f,this.view=m,this.markedOffset>=0&&(this.markedOffset-=a),this.offset=0,this.limit=p,this)},o.copy=function(a,u){if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal end: Not an integer");if(u>>>=0,a<0||a>u||u>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+u+" <= "+this.buffer.byteLength)}if(a===u)return new h(0,this.littleEndian,this.noAssert);var p=u-a,f=new h(p,this.littleEndian,this.noAssert);return f.offset=0,f.limit=p,f.markedOffset>=0&&(f.markedOffset-=a),this.copyTo(f,0,a,u),f},o.copyTo=function(a,u,p,f){var m,_,v;if(!this.noAssert&&!h.isByteBuffer(a))throw TypeError("Illegal target: Not a ByteBuffer");if(u=(_=u===void 0)?a.offset:0|u,p=(m=p===void 0)?this.offset:0|p,f=f===void 0?this.limit:0|f,u<0||u>a.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+u+" <= "+a.buffer.byteLength);if(p<0||f>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+p+" <= "+this.buffer.byteLength);return(v=f-p)==0?a:(a.ensureCapacity(u+v),a.view.set(this.view.subarray(p,f),u),m&&(this.offset+=v),_&&(a.offset+=v),this)},o.ensureCapacity=function(a){var u=this.buffer.byteLength;return a>u?this.resize((u*=2)>a?u:a):this},o.fill=function(a,u,p){var f=u===void 0;if(f&&(u=this.offset),typeof a=="string"&&a.length>0&&(a=a.charCodeAt(0)),u===void 0&&(u=this.offset),p===void 0&&(p=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal begin: Not an integer");if(u>>>=0,typeof p!="number"||p%1!=0)throw TypeError("Illegal end: Not an integer");if(p>>>=0,u<0||u>p||p>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+u+" <= "+p+" <= "+this.buffer.byteLength)}if(u>=p)return this;for(;p>u;)this.view[u++]=a;return f&&(this.offset=u),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(a){if(a=a===void 0?this.offset:a,!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=a,this},o.order=function(a){if(!this.noAssert&&typeof a!="boolean")throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!a,this},o.LE=function(a){return this.littleEndian=a===void 0||!!a,this},o.BE=function(a){return this.littleEndian=a!==void 0&&!a,this},o.prepend=function(a,u,p){var f,m,_,v,T;if((typeof u=="number"||typeof u!="string")&&(p=u,u=void 0),(f=p===void 0)&&(p=this.offset),!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+0) <= "+this.buffer.byteLength)}return a instanceof h||(a=h.wrap(a,u)),(m=a.limit-a.offset)<=0||((_=m-p)>0?(v=new ArrayBuffer(this.buffer.byteLength+_),(T=new Uint8Array(v)).set(this.view.subarray(p,this.buffer.byteLength),m),this.buffer=v,this.view=T,this.offset+=_,this.markedOffset>=0&&(this.markedOffset+=_),this.limit+=_,p+=_):new Uint8Array(this.buffer),this.view.set(a.view.subarray(a.offset,a.limit),p-m),a.offset=a.limit,f&&(this.offset-=m)),this},o.prependTo=function(a,u){return a.prepend(this,u),this},o.printDebug=function(a){typeof a!="function"&&(a=console.log.bind(console)),a(this.toString()+`
- -------------------------------------------------------------------
- `+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(a){var u,p;if(!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal capacity: "+a+" (not an integer)");if((a|=0)<0)throw RangeError("Illegal capacity: 0 <= "+a)}return this.buffer.byteLength<a&&(u=new ArrayBuffer(a),(p=new Uint8Array(u)).set(this.view),this.buffer=u,this.view=p),this},o.reverse=function(a,u){if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal end: Not an integer");if(u>>>=0,a<0||a>u||u>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+u+" <= "+this.buffer.byteLength)}return a===u||Array.prototype.reverse.call(this.view.subarray(a,u)),this},o.skip=function(a){if(!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0}var u=this.offset+a;if(!this.noAssert&&(u<0||u>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+a+" <= "+this.buffer.byteLength);return this.offset=u,this},o.slice=function(a,u){if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal end: Not an integer");if(u>>>=0,a<0||a>u||u>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+u+" <= "+this.buffer.byteLength)}var p=this.clone();return p.offset=a,p.limit=u,p},o.toBuffer=function(a){var u,p=this.offset,f=this.limit;if(!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: Not an integer");if(p>>>=0,typeof f!="number"||f%1!=0)throw TypeError("Illegal limit: Not an integer");if(f>>>=0,p<0||p>f||f>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+p+" <= "+f+" <= "+this.buffer.byteLength)}return a||p!==0||f!==this.buffer.byteLength?p===f?s:(u=new ArrayBuffer(f-p),new Uint8Array(u).set(new Uint8Array(this.buffer).subarray(p,f),0),u):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(a,u,p){if(a===void 0)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch(typeof a=="number"&&(p=u=a="utf8"),a){case"utf8":return this.toUTF8(u,p);case"base64":return this.toBase64(u,p);case"hex":return this.toHex(u,p);case"binary":return this.toBinary(u,p);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+a)}},d=function(){var a,u,p={},f=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],m=[];for(a=0,u=f.length;u>a;++a)m[f[a]]=a;return p.encode=function(_,v){for(var T,y;(T=_())!==null;)v(f[63&T>>2]),y=(3&T)<<4,(T=_())!==null?(v(f[63&((y|=15&T>>4)|15&T>>4)]),y=(15&T)<<2,(T=_())!==null?(v(f[63&(y|3&T>>6)]),v(f[63&T])):(v(f[63&y]),v(61))):(v(f[63&y]),v(61),v(61))},p.decode=function(_,v){function T(M){throw Error("Illegal character code: "+M)}for(var y,w,L;(y=_())!==null;)if((w=m[y])===void 0&&T(y),(y=_())!==null&&((L=m[y])===void 0&&T(y),v(w<<2>>>0|(48&L)>>4),(y=_())!==null)){if((w=m[y])===void 0){if(y===61)break;T(y)}if(v((15&L)<<4>>>0|(60&w)>>2),(y=_())!==null){if((L=m[y])===void 0){if(y===61)break;T(y)}v((3&w)<<6>>>0|L)}}},p.test=function(_){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(_)},p}(),o.toBase64=function(a,u){if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),u|=0,(a|=0)<0||u>this.capacity||a>u)throw RangeError("begin, end");var p;return d.encode(function(){return u>a?this.view[a++]:null}.bind(this),p=e()),p()},h.fromBase64=function(a,u){if(typeof a!="string")throw TypeError("str");var p=new h(a.length/4*3,u),f=0;return d.decode(t(a),function(m){p.view[f++]=m}),p.limit=f,p},h.btoa=function(a){return h.fromBinary(a).toBase64()},h.atob=function(a){return h.fromBase64(a).toBinary()},o.toBinary=function(a,u){if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),u|=0,(a|=0)<0||u>this.capacity()||a>u)throw RangeError("begin, end");if(a===u)return"";for(var p=[],f=[];u>a;)p.push(this.view[a++]),p.length>=1024&&(f.push(String.fromCharCode.apply(String,p)),p=[]);return f.join("")+String.fromCharCode.apply(String,p)},h.fromBinary=function(a,u){if(typeof a!="string")throw TypeError("str");for(var p,f=0,m=a.length,_=new h(m,u);m>f;){if((p=a.charCodeAt(f))>255)throw RangeError("illegal char code: "+p);_.view[f++]=p}return _.limit=m,_},o.toDebug=function(a){for(var u,p=-1,f=this.buffer.byteLength,m="",_="",v="";f>p;){if(p!==-1&&(m+=(u=this.view[p])<16?"0"+u.toString(16).toUpperCase():u.toString(16).toUpperCase(),a&&(_+=u>32&&u<127?String.fromCharCode(u):".")),++p,a&&p>0&&p%16==0&&p!==f){for(;m.length<51;)m+=" ";v+=m+_+`
- `,m=_=""}m+=p===this.offset&&p===this.limit?p===this.markedOffset?"!":"|":p===this.offset?p===this.markedOffset?"[":"<":p===this.limit?p===this.markedOffset?"]":">":p===this.markedOffset?"'":a||p!==0&&p!==f?" ":""}if(a&&m!==" "){for(;m.length<51;)m+=" ";v+=m+_+`
- `}return a?v:m},h.fromDebug=function(a,u,p){for(var f,m,_=a.length,v=new h(0|(_+1)/3,u,p),T=0,y=0,w=!1,L=!1,M=!1,C=!1,A=!1;_>T;){switch(f=a.charAt(T++)){case"!":if(!p){if(L||M||C){A=!0;break}L=M=C=!0}v.offset=v.markedOffset=v.limit=y,w=!1;break;case"|":if(!p){if(L||C){A=!0;break}L=C=!0}v.offset=v.limit=y,w=!1;break;case"[":if(!p){if(L||M){A=!0;break}L=M=!0}v.offset=v.markedOffset=y,w=!1;break;case"<":if(!p){if(L){A=!0;break}L=!0}v.offset=y,w=!1;break;case"]":if(!p){if(C||M){A=!0;break}C=M=!0}v.limit=v.markedOffset=y,w=!1;break;case">":if(!p){if(C){A=!0;break}C=!0}v.limit=y,w=!1;break;case"'":if(!p){if(M){A=!0;break}M=!0}v.markedOffset=y,w=!1;break;case" ":w=!1;break;default:if(!p&&w){A=!0;break}if(m=parseInt(f+a.charAt(T++),16),!p&&(isNaN(m)||m<0||m>255))throw TypeError("Illegal str: Not a debug encoded string");v.view[y++]=m,w=!0}if(A)throw TypeError("Illegal str: Invalid symbol at "+T)}if(!p){if(!L||!C)throw TypeError("Illegal str: Missing offset or limit");if(y<v.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+y+" < "+_)}return v},o.toHex=function(a,u){if(a=a===void 0?this.offset:a,u=u===void 0?this.limit:u,!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal end: Not an integer");if(u>>>=0,a<0||a>u||u>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+u+" <= "+this.buffer.byteLength)}for(var p,f=new Array(u-a);u>a;)(p=this.view[a++])<16?f.push("0",p.toString(16)):f.push(p.toString(16));return f.join("")},h.fromHex=function(a,u,p){var f,m,_,v,T;if(!p){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(a.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(m=a.length,_=new h(0|m/2,u),v=0,T=0;m>v;v+=2){if(f=parseInt(a.substring(v,v+2),16),!p&&(!isFinite(f)||f<0||f>255))throw TypeError("Illegal str: Contains non-hex characters");_.view[T++]=f}return _.limit=T,_},l=function(){var a={MAX_CODEPOINT:1114111,encodeUTF8:function(u,p){var f=null;for(typeof u=="number"&&(f=u,u=function(){return null});f!==null||(f=u())!==null;)f<128?p(127&f):f<2048?(p(192|31&f>>6),p(128|63&f)):f<65536?(p(224|15&f>>12),p(128|63&f>>6),p(128|63&f)):(p(240|7&f>>18),p(128|63&f>>12),p(128|63&f>>6),p(128|63&f)),f=null},decodeUTF8:function(u,p){for(var f,m,_,v,T=function(y){y=y.slice(0,y.indexOf(null));var w=Error(y.toString());throw w.name="TruncatedError",w.bytes=y,w};(f=u())!==null;)if((128&f)==0)p(f);else if((224&f)==192)(m=u())===null&&T([f,m]),p((31&f)<<6|63&m);else if((240&f)==224)((m=u())===null||(_=u())===null)&&T([f,m,_]),p((15&f)<<12|(63&m)<<6|63&_);else{if((248&f)!=240)throw RangeError("Illegal starting byte: "+f);((m=u())===null||(_=u())===null||(v=u())===null)&&T([f,m,_,v]),p((7&f)<<18|(63&m)<<12|(63&_)<<6|63&v)}},UTF16toUTF8:function(u,p){for(var f,m=null;(f=m!==null?m:u())!==null;)f>=55296&&f<=57343&&(m=u())!==null&&m>=56320&&m<=57343?(p(1024*(f-55296)+m-56320+65536),m=null):p(f);m!==null&&p(m)},UTF8toUTF16:function(u,p){var f=null;for(typeof u=="number"&&(f=u,u=function(){return null});f!==null||(f=u())!==null;)f<=65535?p(f):(p(55296+((f-=65536)>>10)),p(f%1024+56320)),f=null},encodeUTF16toUTF8:function(u,p){a.UTF16toUTF8(u,function(f){a.encodeUTF8(f,p)})},decodeUTF8toUTF16:function(u,p){a.decodeUTF8(u,function(f){a.UTF8toUTF16(f,p)})},calculateCodePoint:function(u){return u<128?1:u<2048?2:u<65536?3:4},calculateUTF8:function(u){for(var p,f=0;(p=u())!==null;)f+=p<128?1:p<2048?2:p<65536?3:4;return f},calculateUTF16asUTF8:function(u){var p=0,f=0;return a.UTF16toUTF8(u,function(m){++p,f+=m<128?1:m<2048?2:m<65536?3:4}),[p,f]}};return a}(),o.toUTF8=function(a,u){if(a===void 0&&(a=this.offset),u===void 0&&(u=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof u!="number"||u%1!=0)throw TypeError("Illegal end: Not an integer");if(u>>>=0,a<0||a>u||u>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+u+" <= "+this.buffer.byteLength)}var p;try{l.decodeUTF8toUTF16(function(){return u>a?this.view[a++]:null}.bind(this),p=e())}catch{if(a!==u)throw RangeError("Illegal range: Truncated data, "+a+" != "+u)}return p()},h.fromUTF8=function(a,u,p){if(!p&&typeof a!="string")throw TypeError("Illegal str: Not a string");var f=new h(l.calculateUTF16asUTF8(t(a),!0)[1],u,p),m=0;return l.encodeUTF16toUTF8(t(a),function(_){f.view[m++]=_}),f.limit=m,f},h}(mi),ea=function(n,t){var e,r,i={};return i.ByteBuffer=n,i.c=n,e=n,i.Long=t||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var o={};return o.IS_NODE=!(typeof process!="object"||process+""!="[object process]"||process.browser),o.XHR=function(){var s,c=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],d=null;for(s=0;s<c.length;s++){try{d=c[s]()}catch{continue}break}if(!d)throw Error("XMLHttpRequest is not supported");return d},o.fetch=function(s,c){if(c&&typeof c!="function"&&(c=null),o.IS_NODE)if(c)g.readFile(s,function(l,h){c(l?null:""+h)});else try{return g.readFileSync(s)}catch{return null}else{var d=o.XHR();if(d.open("GET",s,!!c),d.setRequestHeader("Accept","text/plain"),typeof d.overrideMimeType=="function"&&d.overrideMimeType("text/plain"),!c)return d.send(null),d.status==200||d.status==0&&typeof d.responseText=="string"?d.responseText:null;if(d.onreadystatechange=function(){d.readyState==4&&(d.status==200||d.status==0&&typeof d.responseText=="string"?c(d.responseText):c(null))},d.readyState==4)return;d.send(null)}},o.toCamelCase=function(s){return s.replace(/_([a-zA-Z])/g,function(c,d){return d.toUpperCase()})},o}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(o,s){function c(m,_){var v=-1,T=1;if(m.charAt(0)=="-"&&(T=-1,m=m.substring(1)),s.NUMBER_DEC.test(m))v=parseInt(m);else if(s.NUMBER_HEX.test(m))v=parseInt(m.substring(2),16);else{if(!s.NUMBER_OCT.test(m))throw Error("illegal id value: "+(T<0?"-":"")+m);v=parseInt(m.substring(1),8)}if(v=0|T*v,!_&&v<0)throw Error("illegal id value: "+(T<0?"-":"")+m);return v}function d(m){var _=1;if(m.charAt(0)=="-"&&(_=-1,m=m.substring(1)),s.NUMBER_DEC.test(m))return _*parseInt(m,10);if(s.NUMBER_HEX.test(m))return _*parseInt(m.substring(2),16);if(s.NUMBER_OCT.test(m))return _*parseInt(m.substring(1),8);if(m==="inf")return 1/0*_;if(m==="nan")return NaN;if(s.NUMBER_FLT.test(m))return _*parseFloat(m);throw Error("illegal number value: "+(_<0?"-":"")+m)}function l(m,_,v){m[_]===void 0?m[_]=v:(Array.isArray(m[_])||(m[_]=[m[_]]),m[_].push(v))}var h,a,u={},p=function(m){this.source=m+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},f=p.prototype;return f._readString=function(){var m,_=this._stringOpen==='"'?s.STRING_DQ:s.STRING_SQ;if(_.lastIndex=this.index-1,!(m=_.exec(this.source)))throw Error("unterminated string");return this.index=_.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,m[1]},f.next=function(){var m,_,v,T,y;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(this._stringOpen!==null)return this._readString();do{for(m=!1;s.WHITESPACE.test(v=this.source.charAt(this.index));)if(v===`
- `&&++this.line,++this.index===this.source.length)return null;if(this.source.charAt(this.index)==="/")if(++this.index,this.source.charAt(this.index)==="/"){for(;this.source.charAt(++this.index)!==`
- `;)if(this.index==this.source.length)return null;++this.index,++this.line,m=!0}else{if((v=this.source.charAt(this.index))!=="*")return"/";do{if(v===`
- `&&++this.line,++this.index===this.source.length)return null;_=v,v=this.source.charAt(this.index)}while(_!=="*"||v!=="/");++this.index,m=!0}}while(m);if(this.index===this.source.length)return null;if(T=this.index,s.DELIM.lastIndex=0,!s.DELIM.test(this.source.charAt(T++)))for(;T<this.source.length&&!s.DELIM.test(this.source.charAt(T));)++T;return((y=this.source.substring(this.index,this.index=T))==='"'||y==="'")&&(this._stringOpen=y),y},f.peek=function(){if(this.stack.length===0){var m=this.next();if(m===null)return null;this.stack.push(m)}return this.stack[0]},f.skip=function(m){var _=this.next();if(_!==m)throw Error("illegal '"+_+"', '"+m+"' expected")},f.omit=function(m){return this.peek()===m&&(this.next(),!0)},f.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},u.Tokenizer=p,h=function(m){this.tn=new p(m),this.proto3=!1},(a=h.prototype).parse=function(){var m,_={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},v=!0;try{for(;m=this.tn.next();)switch(m){case"package":if(!v||_.package!==null)throw Error("unexpected 'package'");if(m=this.tn.next(),!s.TYPEREF.test(m))throw Error("illegal package name: "+m);this.tn.skip(";"),_.package=m;break;case"import":if(!v)throw Error("unexpected 'import'");(m=this.tn.peek())==="public"&&this.tn.next(),m=this._readString(),this.tn.skip(";"),_.imports.push(m);break;case"syntax":if(!v)throw Error("unexpected 'syntax'");this.tn.skip("="),(_.syntax=this._readString())==="proto3"&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(_,null),v=!1;break;case"enum":this._parseEnum(_),v=!1;break;case"option":this._parseOption(_);break;case"service":this._parseService(_);break;case"extend":this._parseExtend(_);break;default:throw Error("unexpected '"+m+"'")}}catch(T){throw T.message="Parse error at line "+this.tn.line+": "+T.message,T}return delete _.name,_},h.parse=function(m){return new h(m).parse()},a._readString=function(){var m,_,v="";do{if((_=this.tn.next())!=="'"&&_!=='"')throw Error("illegal string delimiter: "+_);v+=this.tn.next(),this.tn.skip(_),m=this.tn.peek()}while(m==='"'||m==='"');return v},a._readValue=function(m){var _=this.tn.peek();if(_==='"'||_==="'")return this._readString();if(this.tn.next(),s.NUMBER.test(_))return d(_);if(s.BOOL.test(_))return _.toLowerCase()==="true";if(m&&s.TYPEREF.test(_))return _;throw Error("illegal value: "+_)},a._parseOption=function(m,_){var v,T=this.tn.next(),y=!1;if(T==="("&&(y=!0,T=this.tn.next()),!s.TYPEREF.test(T))throw Error("illegal option name: "+T);v=T,y&&(this.tn.skip(")"),v="("+v+")",T=this.tn.peek(),s.FQTYPEREF.test(T)&&(v+=T,this.tn.next())),this.tn.skip("="),this._parseOptionValue(m,v),_||this.tn.skip(";")},a._parseOptionValue=function(m,_){var v=this.tn.peek();if(v!=="{")l(m.options,_,this._readValue(!0));else for(this.tn.skip("{");(v=this.tn.next())!=="}";){if(!s.NAME.test(v))throw Error("illegal option name: "+_+"."+v);this.tn.omit(":")?l(m.options,_+"."+v,this._readValue(!0)):this._parseOptionValue(m,_+"."+v)}},a._parseService=function(m){var _,v=this.tn.next();if(!s.NAME.test(v))throw Error("illegal service name at line "+this.tn.line+": "+v);for(_={name:v,rpc:{},options:{}},this.tn.skip("{");(v=this.tn.next())!=="}";)if(v==="option")this._parseOption(_);else{if(v!=="rpc")throw Error("illegal service token: "+v);this._parseServiceRPC(_)}this.tn.omit(";"),m.services.push(_)},a._parseServiceRPC=function(m){var _,v,T="rpc",y=this.tn.next();if(!s.NAME.test(y))throw Error("illegal rpc service method name: "+y);if(_=y,v={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),(y=this.tn.next()).toLowerCase()==="stream"&&(v.request_stream=!0,y=this.tn.next()),!s.TYPEREF.test(y))throw Error("illegal rpc service request type: "+y);if(v.request=y,this.tn.skip(")"),(y=this.tn.next()).toLowerCase()!=="returns")throw Error("illegal rpc service request type delimiter: "+y);if(this.tn.skip("("),(y=this.tn.next()).toLowerCase()==="stream"&&(v.response_stream=!0,y=this.tn.next()),v.response=y,this.tn.skip(")"),(y=this.tn.peek())==="{"){for(this.tn.next();(y=this.tn.next())!=="}";){if(y!=="option")throw Error("illegal rpc service token: "+y);this._parseOption(v)}this.tn.omit(";")}else this.tn.skip(";");m[T]===void 0&&(m[T]={}),m[T][_]=v},a._parseMessage=function(m,_){var v=!!_,T=this.tn.next(),y={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!s.NAME.test(T))throw Error("illegal "+(v?"group":"message")+" name: "+T);for(y.name=T,v&&(this.tn.skip("="),_.id=c(this.tn.next()),y.isGroup=!0),(T=this.tn.peek())==="["&&_&&this._parseFieldOptions(_),this.tn.skip("{");(T=this.tn.next())!=="}";)if(s.RULE.test(T))this._parseMessageField(y,T);else if(T==="oneof")this._parseMessageOneOf(y);else if(T==="enum")this._parseEnum(y);else if(T==="message")this._parseMessage(y);else if(T==="option")this._parseOption(y);else if(T==="service")this._parseService(y);else if(T==="extensions")y.extensions=this._parseExtensionRanges();else if(T==="reserved")this._parseIgnored();else if(T==="extend")this._parseExtend(y);else{if(!s.TYPEREF.test(T))throw Error("illegal message token: "+T);if(!this.proto3)throw Error("illegal field rule: "+T);this._parseMessageField(y,"optional",T)}return this.tn.omit(";"),m.messages.push(y),y},a._parseIgnored=function(){for(;this.tn.peek()!==";";)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(m,_,v){var T,y,w;if(!s.RULE.test(_))throw Error("illegal message field rule: "+_);if(T={rule:_,type:"",name:"",options:{},id:0},_==="map"){if(v)throw Error("illegal type: "+v);if(this.tn.skip("<"),y=this.tn.next(),!s.TYPE.test(y)&&!s.TYPEREF.test(y))throw Error("illegal message field type: "+y);if(T.keytype=y,this.tn.skip(","),y=this.tn.next(),!s.TYPE.test(y)&&!s.TYPEREF.test(y))throw Error("illegal message field: "+y);if(T.type=y,this.tn.skip(">"),y=this.tn.next(),!s.NAME.test(y))throw Error("illegal message field name: "+y);T.name=y,this.tn.skip("="),T.id=c(this.tn.next()),(y=this.tn.peek())==="["&&this._parseFieldOptions(T),this.tn.skip(";")}else if((v=v!==void 0?v:this.tn.next())==="group"){if(w=this._parseMessage(m,T),!/^[A-Z]/.test(w.name))throw Error("illegal group name: "+w.name);T.type=w.name,T.name=w.name.toLowerCase(),this.tn.omit(";")}else{if(!s.TYPE.test(v)&&!s.TYPEREF.test(v))throw Error("illegal message field type: "+v);if(T.type=v,y=this.tn.next(),!s.NAME.test(y))throw Error("illegal message field name: "+y);T.name=y,this.tn.skip("="),T.id=c(this.tn.next()),(y=this.tn.peek())==="["&&this._parseFieldOptions(T),this.tn.skip(";")}return m.fields.push(T),T},a._parseMessageOneOf=function(m){var _,v,T,y=this.tn.next();if(!s.NAME.test(y))throw Error("illegal oneof name: "+y);for(v=y,T=[],this.tn.skip("{");(y=this.tn.next())!=="}";)(_=this._parseMessageField(m,"optional",y)).oneof=v,T.push(_.id);this.tn.omit(";"),m.oneofs[v]=T},a._parseFieldOptions=function(m){this.tn.skip("[");for(var _=!0;this.tn.peek()!=="]";)_||this.tn.skip(","),this._parseOption(m,!0),_=!1;this.tn.next()},a._parseEnum=function(m){var _,v={name:"",values:[],options:{}},T=this.tn.next();if(!s.NAME.test(T))throw Error("illegal name: "+T);for(v.name=T,this.tn.skip("{");(T=this.tn.next())!=="}";)if(T==="option")this._parseOption(v);else{if(!s.NAME.test(T))throw Error("illegal name: "+T);this.tn.skip("="),_={name:T,id:c(this.tn.next(),!0)},(T=this.tn.peek())==="["&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),v.values.push(_)}this.tn.omit(";"),m.enums.push(v)},a._parseExtensionRanges=function(){var m,_,v,T=[];do{for(_=[];;){switch(m=this.tn.next()){case"min":v=o.ID_MIN;break;case"max":v=o.ID_MAX;break;default:v=d(m)}if(_.push(v),_.length===2)break;if(this.tn.peek()!=="to"){_.push(v);break}this.tn.next()}T.push(_)}while(this.tn.omit(","));return this.tn.skip(";"),T},a._parseExtend=function(m){var _,v=this.tn.next();if(!s.TYPEREF.test(v))throw Error("illegal extend reference: "+v);for(_={ref:v,fields:[]},this.tn.skip("{");(v=this.tn.next())!=="}";)if(s.RULE.test(v))this._parseMessageField(_,v);else{if(!s.TYPEREF.test(v))throw Error("illegal extend token: "+v);if(!this.proto3)throw Error("illegal field rule: "+v);this._parseMessageField(_,"optional",v)}return this.tn.omit(";"),m.messages.push(_),_},a.toString=function(){return"Parser at line "+this.tn.line},u.Parser=h,u}(i,i.Lang),i.Reflect=function(o){function s(E,S){if(E&&typeof E.low=="number"&&typeof E.high=="number"&&typeof E.unsigned=="boolean"&&E.low==E.low&&E.high==E.high)return new o.Long(E.low,E.high,S===void 0?E.unsigned:S);if(typeof E=="string")return o.Long.fromString(E,S||!1,10);if(typeof E=="number")return o.Long.fromNumber(E,S||!1);throw Error("not convertible to Long")}function c(E,S){var I=S.readVarint32(),N=7&I,b=I>>>3;switch(N){case o.WIRE_TYPES.VARINT:do I=S.readUint8();while((128&I)==128);break;case o.WIRE_TYPES.BITS64:S.offset+=8;break;case o.WIRE_TYPES.LDELIM:I=S.readVarint32(),S.offset+=I;break;case o.WIRE_TYPES.STARTGROUP:c(b,S);break;case o.WIRE_TYPES.ENDGROUP:if(b===E)return!1;throw Error("Illegal GROUPEND after unknown group: "+b+" ("+E+" expected)");case o.WIRE_TYPES.BITS32:S.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+E+": "+N)}return!0}var d,l,h,a,u,p,f,m,_,v,T,y,w,L,M,C,A={},F=function(E,S,I){this.builder=E,this.parent=S,this.name=I,this.className},G=F.prototype;return G.fqn=function(){for(var E=this.name,S=this;(S=S.parent)!=null;)E=S.name+"."+E;return E},G.toString=function(E){return(E?this.className+" ":"")+this.fqn()},G.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},A.T=F,d=function(E,S,I,N,b){F.call(this,E,S,I),this.className="Namespace",this.children=[],this.options=N||{},this.syntax=b||"proto2"},(l=d.prototype=Object.create(F.prototype)).getChildren=function(E){var S,I,N;if((E=E||null)==null)return this.children.slice();for(S=[],I=0,N=this.children.length;N>I;++I)this.children[I]instanceof E&&S.push(this.children[I]);return S},l.addChild=function(E){var S;if(S=this.getChild(E.name))if(S instanceof u.Field&&S.name!==S.originalName&&this.getChild(S.originalName)===null)S.name=S.originalName;else{if(!(E instanceof u.Field&&E.name!==E.originalName&&this.getChild(E.originalName)===null))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+E.name);E.name=E.originalName}this.children.push(E)},l.getChild=function(E){var S,I,N=typeof E=="number"?"id":"name";for(S=0,I=this.children.length;I>S;++S)if(this.children[S][N]===E)return this.children[S];return null},l.resolve=function(E,S){var I,N=typeof E=="string"?E.split("."):E,b=this,k=0;if(N[k]===""){for(;b.parent!==null;)b=b.parent;k++}do{do{if(!(b instanceof A.Namespace)){b=null;break}if(!((I=b.getChild(N[k]))&&I instanceof A.T&&(!S||I instanceof A.Namespace))){b=null;break}b=I,k++}while(k<N.length);if(b!=null)break;if(this.parent!==null)return this.parent.resolve(E,S)}while(b!=null);return b},l.qn=function(E){var S,I,N=[],b=E;do N.unshift(b.name),b=b.parent;while(b!==null);for(S=1;S<=N.length;S++)if(I=N.slice(N.length-S),E===this.resolve(I,E instanceof A.Namespace))return I.join(".");return E.fqn()},l.build=function(){var E,S,I,N={},b=this.children;for(S=0,I=b.length;I>S;++S)(E=b[S])instanceof d&&(N[E.name]=E.build());return Object.defineProperty&&Object.defineProperty(N,"$options",{value:this.buildOpt()}),N},l.buildOpt=function(){var E,S,I,N,b={},k=Object.keys(this.options);for(E=0,S=k.length;S>E;++E)I=k[E],N=this.options[k[E]],b[I]=N;return b},l.getOption=function(E){return E===void 0?this.options:this.options[E]!==void 0?this.options[E]:null},A.Namespace=d,h=function(E,S,I,N){if(this.type=E,this.resolvedType=S,this.isMapKey=I,this.syntax=N,I&&o.MAP_KEY_TYPES.indexOf(E)<0)throw Error("Invalid map key type: "+E.name)},a=h.prototype,h.defaultFieldValue=function(E){if(typeof E=="string"&&(E=o.TYPES[E]),E.defaultValue===void 0)throw Error("default value for type "+E.name+" is not supported");return E==o.TYPES.bytes?new e(0):E.defaultValue},a.verifyValue=function(E){var S,I,N,b=function(k,U){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+k+" ("+U+")")}.bind(this);switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:return(typeof E!="number"||E==E&&E%1!=0)&&b(typeof E,"not an integer"),E>4294967295?0|E:E;case o.TYPES.uint32:case o.TYPES.fixed32:return(typeof E!="number"||E==E&&E%1!=0)&&b(typeof E,"not an integer"),E<0?E>>>0:E;case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:if(o.Long)try{return s(E,!1)}catch(k){b(typeof E,k.message)}else b(typeof E,"requires Long.js");case o.TYPES.uint64:case o.TYPES.fixed64:if(o.Long)try{return s(E,!0)}catch(k){b(typeof E,k.message)}else b(typeof E,"requires Long.js");case o.TYPES.bool:return typeof E!="boolean"&&b(typeof E,"not a boolean"),E;case o.TYPES.float:case o.TYPES.double:return typeof E!="number"&&b(typeof E,"not a number"),E;case o.TYPES.string:return typeof E=="string"||E&&E instanceof String||b(typeof E,"not a string"),""+E;case o.TYPES.bytes:return n.isByteBuffer(E)?E:n.wrap(E);case o.TYPES.enum:for(S=this.resolvedType.getChildren(o.Reflect.Enum.Value),N=0;N<S.length;N++)if(S[N].name==E||S[N].id==E)return S[N].id;if(this.syntax==="proto3")return(typeof E!="number"||E==E&&E%1!=0)&&b(typeof E,"not an integer"),(E>4294967295||E<0)&&b(typeof E,"not in range for uint32"),E;b(E,"not a valid enum value");case o.TYPES.group:case o.TYPES.message:if(E&&typeof E=="object"||b(typeof E,"object expected"),E instanceof this.resolvedType.clazz)return E;if(E instanceof o.Builder.Message){for(N in I={},E)E.hasOwnProperty(N)&&(I[N]=E[N]);E=I}return new this.resolvedType.clazz(E)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+E+" (undefined type "+this.type+")")},a.calculateLength=function(E,S){if(S===null)return 0;var I;switch(this.type){case o.TYPES.int32:return S<0?e.calculateVarint64(S):e.calculateVarint32(S);case o.TYPES.uint32:return e.calculateVarint32(S);case o.TYPES.sint32:return e.calculateVarint32(e.zigZagEncode32(S));case o.TYPES.fixed32:case o.TYPES.sfixed32:case o.TYPES.float:return 4;case o.TYPES.int64:case o.TYPES.uint64:return e.calculateVarint64(S);case o.TYPES.sint64:return e.calculateVarint64(e.zigZagEncode64(S));case o.TYPES.fixed64:case o.TYPES.sfixed64:return 8;case o.TYPES.bool:return 1;case o.TYPES.enum:return e.calculateVarint32(S);case o.TYPES.double:return 8;case o.TYPES.string:return I=e.calculateUTF8Bytes(S),e.calculateVarint32(I)+I;case o.TYPES.bytes:if(S.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+S.remaining()+" bytes remaining");return e.calculateVarint32(S.remaining())+S.remaining();case o.TYPES.message:return I=this.resolvedType.calculate(S),e.calculateVarint32(I)+I;case o.TYPES.group:return(I=this.resolvedType.calculate(S))+e.calculateVarint32(E<<3|o.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+S+" (unknown type)")},a.encodeValue=function(E,S,I){var N,b;if(S===null)return I;switch(this.type){case o.TYPES.int32:S<0?I.writeVarint64(S):I.writeVarint32(S);break;case o.TYPES.uint32:I.writeVarint32(S);break;case o.TYPES.sint32:I.writeVarint32ZigZag(S);break;case o.TYPES.fixed32:I.writeUint32(S);break;case o.TYPES.sfixed32:I.writeInt32(S);break;case o.TYPES.int64:case o.TYPES.uint64:I.writeVarint64(S);break;case o.TYPES.sint64:I.writeVarint64ZigZag(S);break;case o.TYPES.fixed64:I.writeUint64(S);break;case o.TYPES.sfixed64:I.writeInt64(S);break;case o.TYPES.bool:typeof S=="string"?I.writeVarint32(S.toLowerCase()==="false"?0:!!S):I.writeVarint32(S?1:0);break;case o.TYPES.enum:I.writeVarint32(S);break;case o.TYPES.float:I.writeFloat32(S);break;case o.TYPES.double:I.writeFloat64(S);break;case o.TYPES.string:I.writeVString(S);break;case o.TYPES.bytes:if(S.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+S.remaining()+" bytes remaining");N=S.offset,I.writeVarint32(S.remaining()),I.append(S),S.offset=N;break;case o.TYPES.message:b=new e().LE(),this.resolvedType.encode(S,b),I.writeVarint32(b.offset),I.append(b.flip());break;case o.TYPES.group:this.resolvedType.encode(S,I),I.writeVarint32(E<<3|o.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+S+" (unknown type)")}return I},a.decode=function(E,S,I){if(S!=this.type.wireType)throw Error("Unexpected wire type for element");var N,b;switch(this.type){case o.TYPES.int32:return 0|E.readVarint32();case o.TYPES.uint32:return E.readVarint32()>>>0;case o.TYPES.sint32:return 0|E.readVarint32ZigZag();case o.TYPES.fixed32:return E.readUint32()>>>0;case o.TYPES.sfixed32:return 0|E.readInt32();case o.TYPES.int64:return E.readVarint64();case o.TYPES.uint64:return E.readVarint64().toUnsigned();case o.TYPES.sint64:return E.readVarint64ZigZag();case o.TYPES.fixed64:return E.readUint64();case o.TYPES.sfixed64:return E.readInt64();case o.TYPES.bool:return!!E.readVarint32();case o.TYPES.enum:return E.readVarint32();case o.TYPES.float:return E.readFloat();case o.TYPES.double:return E.readDouble();case o.TYPES.string:return E.readVString();case o.TYPES.bytes:if(b=E.readVarint32(),E.remaining()<b)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+b+" required but got only "+E.remaining());return(N=E.clone()).limit=N.offset+b,E.offset+=b,N;case o.TYPES.message:return b=E.readVarint32(),this.resolvedType.decode(E,b);case o.TYPES.group:return this.resolvedType.decode(E,-1,I)}throw Error("[INTERNAL] Illegal decode type")},a.valueFromString=function(E){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:case o.TYPES.uint32:case o.TYPES.fixed32:return this.verifyValue(parseInt(E));case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:case o.TYPES.uint64:case o.TYPES.fixed64:return this.verifyValue(E);case o.TYPES.bool:return E==="true";case o.TYPES.string:return this.verifyValue(E);case o.TYPES.bytes:return e.fromBinary(E)}},a.valueToString=function(E){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===o.TYPES.bytes?E.toString("binary"):E.toString()},A.Element=h,u=function(E,S,I,N,b,k){d.call(this,E,S,I,N,k),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!b,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(p=u.prototype=Object.create(d.prototype)).build=function(E){var S,I,N,b;if(this.clazz&&!E)return this.clazz;for(S=function(k,U){function $(D,J,W,it){var st,ht,fe,ne,di,li,xe;if(D===null||typeof D!="object")return it&&it instanceof k.Reflect.Enum&&(st=k.Reflect.Enum.getName(it.object,D))!==null?st:D;if(e.isByteBuffer(D))return J?D.toBase64():D.toBuffer();if(k.Long.isLong(D))return W?D.toString():k.Long.fromValue(D);if(Array.isArray(D))return ht=[],D.forEach(function(Uu,Du){ht[Du]=$(Uu,J,W,it)}),ht;if(ht={},D instanceof k.Map){for(ne=(fe=D.entries()).next();!ne.done;ne=fe.next())ht[D.keyElem.valueToString(ne.value[0])]=$(ne.value[1],J,W,D.valueElem.resolvedType);return ht}for(xe in di=D.$type,li=void 0,D)D.hasOwnProperty(xe)&&(ht[xe]=di&&(li=di.getChild(xe))?$(D[xe],J,W,li.resolvedType):$(D[xe],J,W));return ht}var q,X,nt=U.getChildren(k.Reflect.Message.Field),at=U.getChildren(k.Reflect.Message.OneOf),et=function(D){var J,W,it,st;for(k.Builder.Message.call(this),J=0,W=at.length;W>J;++J)this[at[J].name]=null;for(J=0,W=nt.length;W>J;++J)this[(it=nt[J]).name]=it.repeated?[]:it.map?new k.Map(it):null,!it.required&&U.syntax!=="proto3"||it.defaultValue===null||(this[it.name]=it.defaultValue);if(arguments.length>0)if(arguments.length!==1||D===null||typeof D!="object"||!(typeof D.encode!="function"||D instanceof et)||Array.isArray(D)||D instanceof k.Map||e.isByteBuffer(D)||D instanceof ArrayBuffer||k.Long&&D instanceof k.Long)for(J=0,W=arguments.length;W>J;++J)(st=arguments[J])!==void 0&&this.$set(nt[J].name,st);else this.$set(D)},rt=et.prototype=Object.create(k.Builder.Message.prototype);for(rt.add=function(D,J,W){var it=U._fieldsByName[D];if(!W){if(!it)throw Error(this+"#"+D+" is undefined");if(!(it instanceof k.Reflect.Message.Field))throw Error(this+"#"+D+" is not a field: "+it.toString(!0));if(!it.repeated)throw Error(this+"#"+D+" is not a repeated field");J=it.verifyValue(J,!0)}return this[D]===null&&(this[D]=[]),this[D].push(J),this},rt.$add=rt.add,rt.set=function(D,J,W){var it,st,ht;if(D&&typeof D=="object"){for(it in W=J,D)D.hasOwnProperty(it)&&(J=D[it])!==void 0&&this.$set(it,J,W);return this}if(st=U._fieldsByName[D],W)this[D]=J;else{if(!st)throw Error(this+"#"+D+" is not a field: undefined");if(!(st instanceof k.Reflect.Message.Field))throw Error(this+"#"+D+" is not a field: "+st.toString(!0));this[st.name]=J=st.verifyValue(J)}return st&&st.oneof&&(ht=this[st.oneof.name],J!==null?(ht!==null&&ht!==st.name&&(this[ht]=null),this[st.oneof.name]=st.name):ht===D&&(this[st.oneof.name]=null)),this},rt.$set=rt.set,rt.get=function(D,J){if(J)return this[D];var W=U._fieldsByName[D];if(!(W&&W instanceof k.Reflect.Message.Field))throw Error(this+"#"+D+" is not a field: undefined");if(!(W instanceof k.Reflect.Message.Field))throw Error(this+"#"+D+" is not a field: "+W.toString(!0));return this[W.name]},rt.$get=rt.get,q=0;q<nt.length;q++)(X=nt[q])instanceof k.Reflect.Message.ExtensionField||U.builder.options.populateAccessors&&function(D){var J,W,it,st=D.originalName.replace(/(_[a-zA-Z])/g,function(ht){return ht.toUpperCase().replace("_","")});st=st.substring(0,1).toUpperCase()+st.substring(1),J=D.originalName.replace(/([A-Z])/g,function(ht){return"_"+ht}),W=function(ht,fe){return this[D.name]=fe?ht:D.verifyValue(ht),this},it=function(){return this[D.name]},U.getChild("set"+st)===null&&(rt["set"+st]=W),U.getChild("set_"+J)===null&&(rt["set_"+J]=W),U.getChild("get"+st)===null&&(rt["get"+st]=it),U.getChild("get_"+J)===null&&(rt["get_"+J]=it)}(X);return rt.encode=function(D,J){var W,it;typeof D=="boolean"&&(J=D,D=void 0),W=!1,D||(D=new n,W=!0),it=D.littleEndian;try{return U.encode(this,D.LE(),J),(W?D.flip():D).LE(it)}catch(st){throw D.LE(it),st}},et.encode=function(D,J,W){return new et(D).encode(J,W)},rt.calculate=function(){return U.calculate(this)},rt.encodeDelimited=function(D){var J,W=!1;return D||(D=new e,W=!0),J=new e().LE(),U.encode(this,J).flip(),D.writeVarint32(J.remaining()),D.append(J),W?D.flip():D},rt.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(D){throw D.encoded&&(D.encoded=D.encoded.toArrayBuffer()),D}},rt.toArrayBuffer=rt.encodeAB,rt.encodeNB=function(){try{return this.encode().toBuffer()}catch(D){throw D.encoded&&(D.encoded=D.encoded.toBuffer()),D}},rt.toBuffer=rt.encodeNB,rt.encode64=function(){try{return this.encode().toBase64()}catch(D){throw D.encoded&&(D.encoded=D.encoded.toBase64()),D}},rt.toBase64=rt.encode64,rt.encodeHex=function(){try{return this.encode().toHex()}catch(D){throw D.encoded&&(D.encoded=D.encoded.toHex()),D}},rt.toHex=rt.encodeHex,rt.toRaw=function(D,J){return $(this,!!D,!!J,this.$type)},rt.encodeJSON=function(){return JSON.stringify($(this,!0,!0,this.$type))},et.decode=function(D,J){var W,it;typeof D=="string"&&(D=e.wrap(D,J||"base64")),W=(D=e.isByteBuffer(D)?D:e.wrap(D)).littleEndian;try{return it=U.decode(D.LE()),D.LE(W),it}catch(st){throw D.LE(W),st}},et.decodeDelimited=function(D,J){var W,it,st;if(typeof D=="string"&&(D=e.wrap(D,J||"base64")),(D=e.isByteBuffer(D)?D:e.wrap(D)).remaining()<1)return null;if(W=D.offset,it=D.readVarint32(),D.remaining()<it)return D.offset=W,null;try{return st=U.decode(D.slice(D.offset,D.offset+it).LE()),D.offset+=it,st}catch(ht){throw D.offset+=it,ht}},et.decode64=function(D){return et.decode(D,"base64")},et.decodeHex=function(D){return et.decode(D,"hex")},et.decodeJSON=function(D){return new et(JSON.parse(D))},rt.toString=function(){return U.toString()},Object.defineProperty&&(Object.defineProperty(et,"$options",{value:U.buildOpt()}),Object.defineProperty(rt,"$options",{value:et.$options}),Object.defineProperty(et,"$type",{value:U}),Object.defineProperty(rt,"$type",{value:U})),et}(o,this),this._fields=[],this._fieldsById={},this._fieldsByName={},N=0,b=this.children.length;b>N;N++)if((I=this.children[N])instanceof T||I instanceof u||I instanceof L){if(S.hasOwnProperty(I.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+I.toString(!0)+" cannot override static property '"+I.name+"'");S[I.name]=I.build()}else if(I instanceof u.Field)I.build(),this._fields.push(I),this._fieldsById[I.id]=I,this._fieldsByName[I.name]=I;else if(!(I instanceof u.OneOf||I instanceof w))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[N].toString(!0));return this.clazz=S},p.encode=function(E,S,I){var N,b,k,U,$,q=null;for(k=0,U=this._fields.length;U>k;++k)b=E[(N=this._fields[k]).name],N.required&&b===null?q===null&&(q=N):N.encode(I?b:N.verifyValue(b),S,E);if(q!==null)throw($=Error("Missing at least one required field for "+this.toString(!0)+": "+q)).encoded=S,$;return S},p.calculate=function(E){for(var S,I,N=0,b=0,k=this._fields.length;k>b;++b){if(I=E[(S=this._fields[b]).name],S.required&&I===null)throw Error("Missing at least one required field for "+this.toString(!0)+": "+S);N+=S.calculate(I,E)}return N},p.decode=function(E,S,I){var N,b,k,U,$,q,X,nt,at,et,rt,D;for(S=typeof S=="number"?S:-1,$=E.offset,q=new this.clazz;E.offset<$+S||S===-1&&E.remaining()>0;){if(k=(N=E.readVarint32())>>>3,(b=7&N)===o.WIRE_TYPES.ENDGROUP){if(k!==I)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+k+" ("+(I?I+" expected":"not a group")+")");break}if(U=this._fieldsById[k])U.repeated&&!U.options.packed?q[U.name].push(U.decode(b,E)):U.map?(nt=U.decode(b,E),q[U.name].set(nt[0],nt[1])):(q[U.name]=U.decode(b,E),U.oneof&&((at=q[U.oneof.name])!==null&&at!==U.name&&(q[at]=null),q[U.oneof.name]=U.name));else switch(b){case o.WIRE_TYPES.VARINT:E.readVarint32();break;case o.WIRE_TYPES.BITS32:E.offset+=4;break;case o.WIRE_TYPES.BITS64:E.offset+=8;break;case o.WIRE_TYPES.LDELIM:X=E.readVarint32(),E.offset+=X;break;case o.WIRE_TYPES.STARTGROUP:for(;c(k,E););break;default:throw Error("Illegal wire type for unknown field "+k+" in "+this.toString(!0)+"#decode: "+b)}}for(et=0,rt=this._fields.length;rt>et;++et)if(q[(U=this._fields[et]).name]===null)if(this.syntax==="proto3")q[U.name]=U.defaultValue;else{if(U.required)throw(D=Error("Missing at least one required field for "+this.toString(!0)+": "+U.name)).decoded=q,D;o.populateDefaults&&U.defaultValue!==null&&(q[U.name]=U.defaultValue)}return q},A.Message=u,f=function(E,S,I,N,b,k,U,$,q,X){F.call(this,E,S,k),this.className="Message.Field",this.required=I==="required",this.repeated=I==="repeated",this.map=I==="map",this.keyType=N||null,this.type=b,this.resolvedType=null,this.id=U,this.options=$||{},this.defaultValue=null,this.oneof=q||null,this.syntax=X||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=o.Util.toCamelCase(this.name))},(m=f.prototype=Object.create(F.prototype)).build=function(){this.element=new h(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new h(this.keyType,void 0,!0,this.syntax)),this.syntax!=="proto3"||this.repeated||this.map?this.options.default!==void 0&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=h.defaultFieldValue(this.type)},m.verifyValue=function(E,S){var I,N,b;if(S=S||!1,I=function(k,U){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+k+" ("+U+")")}.bind(this),E===null)return this.required&&I(typeof E,"required"),this.syntax==="proto3"&&this.type!==o.TYPES.message&&I(typeof E,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!S){for(Array.isArray(E)||(E=[E]),b=[],N=0;N<E.length;N++)b.push(this.element.verifyValue(E[N]));return b}return this.map&&!S?E instanceof o.Map?E:(E instanceof Object||I(typeof E,"expected ProtoBuf.Map or raw object for map field"),new o.Map(this,E)):(!this.repeated&&Array.isArray(E)&&I(typeof E,"no array expected"),this.element.verifyValue(E))},m.hasWirePresence=function(E,S){if(this.syntax!=="proto3")return E!==null;if(this.oneof&&S[this.oneof.name]===this.name)return!0;switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:case o.TYPES.uint32:case o.TYPES.fixed32:return E!==0;case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:case o.TYPES.uint64:case o.TYPES.fixed64:return E.low!==0||E.high!==0;case o.TYPES.bool:return E;case o.TYPES.float:case o.TYPES.double:return E!==0;case o.TYPES.string:return E.length>0;case o.TYPES.bytes:return E.remaining()>0;case o.TYPES.enum:return E!==0;case o.TYPES.message:return E!==null;default:return!0}},m.encode=function(E,S,I){var N,b,k,U,$;if(this.type===null||typeof this.type!="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(E===null||this.repeated&&E.length==0)return S;try{if(this.repeated)if(this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(S.writeVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),S.ensureCapacity(S.offset+=1),b=S.offset,N=0;N<E.length;N++)this.element.encodeValue(this.id,E[N],S);k=S.offset-b,(U=e.calculateVarint32(k))>1&&($=S.slice(b,S.offset),b+=U-1,S.offset=b,S.append($)),S.writeVarint32(k,b-U)}else for(N=0;N<E.length;N++)S.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,E[N],S);else this.map?E.forEach(function(q,X){var nt=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,X)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,q);S.writeVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),S.writeVarint32(nt),S.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,X,S),S.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,q,S)},this):this.hasWirePresence(E,I)&&(S.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,E,S))}catch(q){throw Error("Illegal value for "+this.toString(!0)+": "+E+" ("+q+")")}return S},m.calculate=function(E,S){var I,N,b;if(E=this.verifyValue(E),this.type===null||typeof this.type!="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(E===null||this.repeated&&E.length==0)return 0;I=0;try{if(this.repeated)if(this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(I+=e.calculateVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),b=0,N=0;N<E.length;N++)b+=this.element.calculateLength(this.id,E[N]);I+=e.calculateVarint32(b),I+=b}else for(N=0;N<E.length;N++)I+=e.calculateVarint32(this.id<<3|this.type.wireType),I+=this.element.calculateLength(this.id,E[N]);else this.map?E.forEach(function(k,U){var $=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,U)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,k);I+=e.calculateVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),I+=e.calculateVarint32($),I+=$},this):this.hasWirePresence(E,S)&&(I+=e.calculateVarint32(this.id<<3|this.type.wireType),I+=this.element.calculateLength(this.id,E))}catch(k){throw Error("Illegal value for "+this.toString(!0)+": "+E+" ("+k+")")}return I},m.decode=function(E,S,I){var N,b,k,U,$,q,X;if(!(!this.map&&E==this.type.wireType||!I&&this.repeated&&this.options.packed&&E==o.WIRE_TYPES.LDELIM||this.map&&E==o.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+E+" ("+this.type.wireType+" expected)");if(E==o.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!I){for(b=S.readVarint32(),b=S.offset+b,k=[];S.offset<b;)k.push(this.decode(this.type.wireType,S,!0));return k}if(this.map){if(U=h.defaultFieldValue(this.keyType),N=h.defaultFieldValue(this.type),b=S.readVarint32(),S.remaining()<b)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+b+" required but got only "+S.remaining());for(($=S.clone()).limit=$.offset+b,S.offset+=b;$.remaining()>0;)if(E=7&(q=$.readVarint32()),(X=q>>>3)==1)U=this.keyElement.decode($,E,X);else{if(X!==2)throw Error("Unexpected tag in map field key/value submessage");N=this.element.decode($,E,X)}return[U,N]}return this.element.decode(S,E,this.id)},A.Message.Field=f,_=function(E,S,I,N,b,k,U){f.call(this,E,S,I,null,N,b,k,U),this.extension},_.prototype=Object.create(f.prototype),A.Message.ExtensionField=_,v=function(E,S,I){F.call(this,E,S,I),this.fields=[]},A.Message.OneOf=v,T=function(E,S,I,N,b){d.call(this,E,S,I,N,b),this.className="Enum",this.object=null},T.getName=function(E,S){var I,N,b=Object.keys(E);for(N=0;N<b.length;++N)if(E[I=b[N]]===S)return I;return null},(T.prototype=Object.create(d.prototype)).build=function(E){var S,I,N,b;if(this.object&&!E)return this.object;for(S=new o.Builder.Enum,N=0,b=(I=this.getChildren(T.Value)).length;b>N;++N)S[I[N].name]=I[N].id;return Object.defineProperty&&Object.defineProperty(S,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=S},A.Enum=T,y=function(E,S,I,N){F.call(this,E,S,I),this.className="Enum.Value",this.id=N},y.prototype=Object.create(F.prototype),A.Enum.Value=y,w=function(E,S,I,N){F.call(this,E,S,I),this.field=N},w.prototype=Object.create(F.prototype),A.Extension=w,L=function(E,S,I,N){d.call(this,E,S,I,N),this.className="Service",this.clazz=null},(L.prototype=Object.create(d.prototype)).build=function(E){return this.clazz&&!E?this.clazz:this.clazz=function(S,I){var N,b=function($){S.Builder.Service.call(this),this.rpcImpl=$||function(q,X,nt){setTimeout(nt.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},k=b.prototype=Object.create(S.Builder.Service.prototype),U=I.getChildren(S.Reflect.Service.RPCMethod);for(N=0;N<U.length;N++)(function($){k[$.name]=function(q,X){try{try{q=$.resolvedRequestType.clazz.decode(e.wrap(q))}catch(nt){if(!(nt instanceof TypeError))throw nt}if(q===null||typeof q!="object")throw Error("Illegal arguments");q instanceof $.resolvedRequestType.clazz||(q=new $.resolvedRequestType.clazz(q)),this.rpcImpl($.fqn(),q,function(nt,at){if(!nt){try{at=$.resolvedResponseType.clazz.decode(at)}catch{}return at&&at instanceof $.resolvedResponseType.clazz?void X(null,at):void X(Error("Illegal response type received in service method "+I.name+"#"+$.name))}X(nt)})}catch(nt){setTimeout(X.bind(this,nt),0)}},b[$.name]=function(q,X,nt){new b(q)[$.name](X,nt)},Object.defineProperty&&(Object.defineProperty(b[$.name],"$options",{value:$.buildOpt()}),Object.defineProperty(k[$.name],"$options",{value:b[$.name].$options}))})(U[N]);return Object.defineProperty&&(Object.defineProperty(b,"$options",{value:I.buildOpt()}),Object.defineProperty(k,"$options",{value:b.$options}),Object.defineProperty(b,"$type",{value:I}),Object.defineProperty(k,"$type",{value:I})),b}(o,this)},A.Service=L,M=function(E,S,I,N){F.call(this,E,S,I),this.className="Service.Method",this.options=N||{}},(M.prototype=Object.create(F.prototype)).buildOpt=l.buildOpt,A.Service.Method=M,C=function(E,S,I,N,b,k,U,$){M.call(this,E,S,I,$),this.className="Service.RPCMethod",this.requestName=N,this.responseName=b,this.requestStream=k,this.responseStream=U,this.resolvedRequestType=null,this.resolvedResponseType=null},C.prototype=Object.create(M.prototype),A.Service.RPCMethod=C,A}(i),i.Builder=function(o,s,c){function d(a){a.messages&&a.messages.forEach(function(u){u.syntax=a.syntax,d(u)}),a.enums&&a.enums.forEach(function(u){u.syntax=a.syntax})}var l=function(a){this.ns=new c.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=a||{}},h=l.prototype;return l.isMessage=function(a){return typeof a.name=="string"&&a.values===void 0&&a.rpc===void 0},l.isMessageField=function(a){return typeof a.rule=="string"&&typeof a.name=="string"&&typeof a.type=="string"&&a.id!==void 0},l.isEnum=function(a){return typeof a.name=="string"&&!(a.values===void 0||!Array.isArray(a.values)||a.values.length===0)},l.isService=function(a){return!(typeof a.name!="string"||typeof a.rpc!="object"||!a.rpc)},l.isExtend=function(a){return typeof a.ref=="string"},h.reset=function(){return this.ptr=this.ns,this},h.define=function(a){if(typeof a!="string"||!s.TYPEREF.test(a))throw Error("illegal namespace: "+a);return a.split(".").forEach(function(u){var p=this.ptr.getChild(u);p===null&&this.ptr.addChild(p=new c.Namespace(this,this.ptr,u)),this.ptr=p},this),this},h.create=function(a){var u,p,f,m,_;if(!a)return this;if(Array.isArray(a)){if(a.length===0)return this;a=a.slice()}else a=[a];for(u=[a];u.length>0;){if(a=u.pop(),!Array.isArray(a))throw Error("not a valid namespace: "+JSON.stringify(a));for(;a.length>0;){if(p=a.shift(),l.isMessage(p)){if(f=new c.Message(this,this.ptr,p.name,p.options,p.isGroup,p.syntax),m={},p.oneofs&&Object.keys(p.oneofs).forEach(function(v){f.addChild(m[v]=new c.Message.OneOf(this,f,v))},this),p.fields&&p.fields.forEach(function(v){if(f.getChild(0|v.id)!==null)throw Error("duplicate or invalid field id in "+f.name+": "+v.id);if(v.options&&typeof v.options!="object")throw Error("illegal field options in "+f.name+"#"+v.name);var T=null;if(typeof v.oneof=="string"&&!(T=m[v.oneof]))throw Error("illegal oneof in "+f.name+"#"+v.name+": "+v.oneof);v=new c.Message.Field(this,f,v.rule,v.keytype,v.type,v.name,v.id,v.options,T,p.syntax),T&&T.fields.push(v),f.addChild(v)},this),_=[],p.enums&&p.enums.forEach(function(v){_.push(v)}),p.messages&&p.messages.forEach(function(v){_.push(v)}),p.services&&p.services.forEach(function(v){_.push(v)}),p.extensions&&(f.extensions=typeof p.extensions[0]=="number"?[p.extensions]:p.extensions),this.ptr.addChild(f),_.length>0){u.push(a),a=_,_=null,this.ptr=f,f=null;continue}_=null}else if(l.isEnum(p))f=new c.Enum(this,this.ptr,p.name,p.options,p.syntax),p.values.forEach(function(v){f.addChild(new c.Enum.Value(this,f,v.name,v.id))},this),this.ptr.addChild(f);else if(l.isService(p))f=new c.Service(this,this.ptr,p.name,p.options),Object.keys(p.rpc).forEach(function(v){var T=p.rpc[v];f.addChild(new c.Service.RPCMethod(this,f,v,T.request,T.response,!!T.request_stream,!!T.response_stream,T.options))},this),this.ptr.addChild(f);else{if(!l.isExtend(p))throw Error("not a valid definition: "+JSON.stringify(p));if(f=this.ptr.resolve(p.ref,!0))p.fields.forEach(function(v){var T,y,w,L;if(f.getChild(0|v.id)!==null)throw Error("duplicate extended field id in "+f.name+": "+v.id);if(f.extensions&&(T=!1,f.extensions.forEach(function(M){v.id>=M[0]&&v.id<=M[1]&&(T=!0)}),!T))throw Error("illegal extended field id in "+f.name+": "+v.id+" (not within valid ranges)");y=v.name,this.options.convertFieldsToCamelCase&&(y=o.Util.toCamelCase(y)),w=new c.Message.ExtensionField(this,f,v.rule,v.type,this.ptr.fqn()+"."+y,v.id,v.options),L=new c.Extension(this,this.ptr,v.name,w),w.extension=L,this.ptr.addChild(L),f.addChild(w)},this);else if(!/\.?google\.protobuf\./.test(p.ref))throw Error("extended message "+p.ref+" is not defined")}p=null,f=null}a=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},h.import=function(a,u){var p,f,m,_,v,T,y,w,L="/";if(typeof u=="string"){if(o.Util.IS_NODE,this.files[u]===!0)return this.reset();this.files[u]=!0}else if(typeof u=="object"){if(p=u.root,o.Util.IS_NODE,(p.indexOf("\\")>=0||u.file.indexOf("\\")>=0)&&(L="\\"),f=p+L+u.file,this.files[f]===!0)return this.reset();this.files[f]=!0}if(a.imports&&a.imports.length>0){for(_=!1,typeof u=="object"?(this.importRoot=u.root,_=!0,m=this.importRoot,u=u.file,(m.indexOf("\\")>=0||u.indexOf("\\")>=0)&&(L="\\")):typeof u=="string"?this.importRoot?m=this.importRoot:u.indexOf("/")>=0?(m=u.replace(/\/[^\/]*$/,""))===""&&(m="/"):u.indexOf("\\")>=0?(m=u.replace(/\\[^\\]*$/,""),L="\\"):m=".":m=null,v=0;v<a.imports.length;v++)if(typeof a.imports[v]=="string"){if(!m)throw Error("cannot determine import root");if((T=a.imports[v])==="google/protobuf/descriptor.proto"||(T=m+L+T,this.files[T]===!0))continue;if(/\.proto$/i.test(T)&&!o.DotProto&&(T=T.replace(/\.proto$/,".json")),(y=o.Util.fetch(T))===null)throw Error("failed to import '"+T+"' in '"+u+"': file not found");/\.json$/i.test(T)?this.import(JSON.parse(y+""),T):this.import(o.DotProto.Parser.parse(y),T)}else u?/\.(\w+)$/.test(u)?this.import(a.imports[v],u.replace(/^(.+)\.(\w+)$/,function(M,C,A){return C+"_import"+v+"."+A})):this.import(a.imports[v],u+"_import"+v):this.import(a.imports[v]);_&&(this.importRoot=null)}return a.package&&this.define(a.package),a.syntax&&d(a),w=this.ptr,a.options&&Object.keys(a.options).forEach(function(M){w.options[M]=a.options[M]}),a.messages&&(this.create(a.messages),this.ptr=w),a.enums&&(this.create(a.enums),this.ptr=w),a.services&&(this.create(a.services),this.ptr=w),a.extends&&this.create(a.extends),this.reset()},h.resolveAll=function(){var a;if(this.ptr==null||typeof this.ptr.type=="object")return this;if(this.ptr instanceof c.Namespace)this.ptr.children.forEach(function(u){this.ptr=u,this.resolveAll()},this);else if(this.ptr instanceof c.Message.Field){if(s.TYPE.test(this.ptr.type))this.ptr.type=o.TYPES[this.ptr.type];else{if(!s.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(a=(this.ptr instanceof c.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=a,a instanceof c.Enum){if(this.ptr.type=o.TYPES.enum,this.ptr.syntax==="proto3"&&a.syntax!=="proto3")throw Error("proto3 message cannot reference proto2 enum")}else{if(!(a instanceof c.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=a.isGroup?o.TYPES.group:o.TYPES.message}}if(this.ptr.map){if(!s.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=o.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof o.Reflect.Service.Method){if(!(this.ptr instanceof o.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((a=this.ptr.parent.resolve(this.ptr.requestName,!0))&&a instanceof o.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=a,!((a=this.ptr.parent.resolve(this.ptr.responseName,!0))&&a instanceof o.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=a}else if(!(this.ptr instanceof o.Reflect.Message.OneOf||this.ptr instanceof o.Reflect.Extension||this.ptr instanceof o.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},h.build=function(a){var u,p,f;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),this.result===null&&(this.result=this.ns.build()),!a)return this.result;for(u=typeof a=="string"?a.split("."):a,p=this.result,f=0;f<u.length;f++){if(!p[u[f]]){p=null;break}p=p[u[f]]}return p},h.lookup=function(a,u){return a?this.ns.resolve(a,u):this.ns},h.toString=function(){return"Builder"},l.Message=function(){},l.Enum=function(){},l.Service=function(){},l}(i,i.Lang,i.Reflect),i.Map=function(o,s){function c(h){var a=0;return{next:function(){return a<h.length?{done:!1,value:h[a++]}:{done:!0}}}}var d=function(h,a){var u,p,f,m;if(!h.map)throw Error("field is not a map");if(this.field=h,this.keyElem=new s.Element(h.keyType,null,!0,h.syntax),this.valueElem=new s.Element(h.type,h.resolvedType,!1,h.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),a)for(u=Object.keys(a),p=0;p<u.length;p++)f=this.keyElem.valueFromString(u[p]),m=this.valueElem.verifyValue(a[u[p]]),this.map[this.keyElem.valueToString(f)]={key:f,value:m}},l=d.prototype;return l.clear=function(){this.map={}},l.delete=function(h){var a=this.keyElem.valueToString(this.keyElem.verifyValue(h)),u=a in this.map;return delete this.map[a],u},l.entries=function(){var h,a,u=[],p=Object.keys(this.map);for(a=0;a<p.length;a++)u.push([(h=this.map[p[a]]).key,h.value]);return c(u)},l.keys=function(){var h,a=[],u=Object.keys(this.map);for(h=0;h<u.length;h++)a.push(this.map[u[h]].key);return c(a)},l.values=function(){var h,a=[],u=Object.keys(this.map);for(h=0;h<u.length;h++)a.push(this.map[u[h]].value);return c(a)},l.forEach=function(h,a){var u,p,f=Object.keys(this.map);for(p=0;p<f.length;p++)h.call(a,(u=this.map[f[p]]).value,u.key,this)},l.set=function(h,a){var u=this.keyElem.verifyValue(h),p=this.valueElem.verifyValue(a);return this.map[this.keyElem.valueToString(u)]={key:u,value:p},this},l.get=function(h){var a=this.keyElem.valueToString(this.keyElem.verifyValue(h));return a in this.map?this.map[a].value:void 0},l.has=function(h){return this.keyElem.valueToString(this.keyElem.verifyValue(h))in this.map},d}(0,i.Reflect),i.loadProto=function(o,s,c){return(typeof s=="string"||s&&typeof s.file=="string"&&typeof s.root=="string")&&(c=s,s=void 0),i.loadJson(i.DotProto.Parser.parse(o),s,c)},i.protoFromString=i.loadProto,i.loadProtoFile=function(o,s,c){if(s&&typeof s=="object"?(c=s,s=null):s&&typeof s=="function"||(s=null),s)return i.Util.fetch(typeof o=="string"?o:o.root+"/"+o.file,function(l){if(l!==null)try{s(null,i.loadProto(l,c,o))}catch(h){s(h)}else s(Error("Failed to fetch file"))});var d=i.Util.fetch(typeof o=="object"?o.root+"/"+o.file:o);return d===null?null:i.loadProto(d,c,o)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(o){return(o=o||{}).convertFieldsToCamelCase===void 0&&(o.convertFieldsToCamelCase=i.convertFieldsToCamelCase),o.populateAccessors===void 0&&(o.populateAccessors=i.populateAccessors),new i.Builder(o)},i.loadJson=function(o,s,c){return(typeof s=="string"||s&&typeof s.file=="string"&&typeof s.root=="string")&&(c=s,s=null),s&&typeof s=="object"||(s=i.newBuilder()),typeof o=="string"&&(o=JSON.parse(o)),s.import(o,c),s.resolveAll(),s},i.loadJsonFile=function(o,s,c){if(s&&typeof s=="object"?(c=s,s=null):s&&typeof s=="function"||(s=null),s)return i.Util.fetch(typeof o=="string"?o:o.root+"/"+o.file,function(l){if(l!==null)try{s(null,i.loadJson(JSON.parse(l),c,o))}catch(h){s(h)}else s(Error("Failed to fetch file"))});var d=i.Util.fetch(typeof o=="object"?o.root+"/"+o.file:o);return d===null?null:i.loadJson(JSON.parse(d),c,o)},r=Xs,i.loadProto(r,void 0,"").build("Modules").probuf}(ta,mi),ea);Wi.getModule=function(n){var t=new Wi[n];return t.getArrayData=function(){var e=t.toArrayBuffer();return e=nc(e)?[].slice.call(new Int8Array(e)):e},t};var re,Zt,wd="pgMsgP",Pd="chatMsg",Ld="pcMsgP",Ud={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Dd="delMsg",kd="joinChrm",xd="joinChrmR",Vd="exitChrm",Bd="setKV",Fd="delKV",Hd="setKVS",$d="delKVS",na="qryRelationR",Gd="delRelation",Kd="setSeAtt",_n={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},vc="qryPMsg",jd="qryGMsg",Tc="qryCHMsg",qd="qryCMsg",Yd="qrySMsg",zd=((mn={}).ppMsgP=Y.PRIVATE,mn[wd]=Y.GROUP,mn[Pd]=Y.CHATROOM,mn[Ld]=Y.CUSTOMER_SERVICE,mn),Jd=(($e={})[Y.PRIVATE]=vc,$e[Y.GROUP]=jd,$e[Y.CHATROOM]=Tc,$e[Y.CUSTOMER_SERVICE]=qd,$e[Y.SYSTEM]=Yd,$e),Wd=((Ge={})[Y.PRIVATE]=_n.PRIVATE,Ge[Y.GROUP]=_n.GROUP,Ge[Y.ULTRA_GROUP]=_n.ULTRA_GROUP,Ge[Y.CUSTOMER_SERVICE]=_n.CUSTOMER_SERVICE,Ge[Y.SYSTEM]=_n.SYSTEM,Ge),_i="1",Zd="0",Wn=1,ra=2,ia=3,Qd=function(){function n(t){this._codec=t==="websocket"?Wi:Vn,this._connectType=t}return n.prototype.decodeByPBName=function(t,e,r){var i,o=this,s=t,c=((i={})[Qe]=o._formatSyncMessages,i[Yr]=o._formatReceivedMessage,i[Dn]=o._formatSentMessage,i[Xe]=o._formatHistoryMessages,i[tn]=o._formatConversationList,i[Jr]=o._formatChatRoomInfos,i[Ae]=o._formatRTCUserList,i[Zr]=o._formatRTCData,i[en]=o._formatChatRoomKVList,i[Qr]=o._formatUserSetting,i[ti]=o._formatConversationStatus,i[ei]=o._formatGrpReadReceiptQryResp,i[nn]=o._formatSetUserSettingOutput,i[Xr]=o._formatUserSettingNotification,i[ni]=o._formatUltraMsgChangeList,i[ri]=o._formatUltraOperateStatusNotifyList,i[xn]=o._formatUltraMsgList,i[kn]=o._formatChrmKVVersion,i[ii]=o._formatRTCRoomKVList,i[Wr]=o._formatRTCAuidenceJoinRoomData,i[oi]=o._formatRTCJoinedUserInfo,i)[e];try{s=t.length>0&&o._codec[e].decode(t),Rt(s)&&(s=function(d){for(var l in d)Rt(d[l])&&(d[l]=St(d[l]));return d}(s)),Cr(c)&&(s=c.call(this,s,r))}catch(d){H.error(`PB parse error
- `,d,t,e)}return s},n.prototype._readBytes=function(t){var e=t.offset,r=t.buffer,i=t.limit;if(e)try{var o=nc(r)?new Uint8Array(r):r;return Hn.readUTF(o.subarray(e,i))}catch(s){H.info(`readBytes error
- `,s)}return t},n.prototype._formatBytes=function(t){if(!t)return t;var e=this._readBytes(t);try{e=JSON.parse(e)}catch(r){H.info(`formatBytes error
- `,r)}return e||t},n.prototype._formatSyncMessages=function(t,e){e=e||{};var r=this,i=t.list,o=t.syncTime,s=t.finished;return(ct(s)||s===null)&&(t.finished=!0),t.syncTime=St(o),t.list=Jn(i,function(c){return r._formatReceivedMessage(c,e)}),t},n.prototype._formatReceivedMessage=function(t,e){if(!t)return t;var r=(e=e||{}).currentUserId,i=e.connectedTime,o=t.content,s=t.fromUserId,c=t.type,d=t.groupId,l=t.status,h=t.dataTime,a=t.classname,u=t.msgId,p=t.extraContent,f=t.pushContent,m=t.pushExt,_=t.configFlag,v=t.extStatus;t.toUserId,t.groupUnpush;var T=(t.direction||zt.RECEIVE)===zt.SEND,y=function(W){var it=Un.READ;return{isPersited:!!(16&W),isCounted:!!(32&W),isMentioned:!!(64&W),disableNotification:!!(512&W),receivedStatus:it=2&W?Un.RETRIEVED:it,canIncludeExpansion:!!(1024&W)}}(l),w=y.isPersited,L=y.isCounted,M=y.isMentioned,C=y.disableNotification,A=y.receivedStatus,F=y.canIncludeExpansion,G=!!(2&(v||0)),E=!!(4&(v||0)),S=[Y.GROUP,Y.CHATROOM,Y.RTC_ROOM,Y.ULTRA_GROUP].indexOf(c)>-1?d:s,I=T?r:s,N=St(h),b=N<i,k=c===Y.CHATROOM,U=this._formatBytes(o),$={};if(m&&($=Js(m.pushConfigs,m.pushId)),U.user){var q=U.user,X=q.portrait,nt=q.portraitUri,at=X||nt;at&&(U.user.portrait=U.user.portraitUri=at)}var et,rt=pt(pt({},$),{pushTitle:m==null?void 0:m.title,pushContent:f,pushData:f,disablePushTitle:!!_&&Boolean(4&_),forceShowDetailContent:!!_&&Boolean(8&_),templateId:m==null?void 0:m.templateId}),D=T?zt.SEND:zt.RECEIVE;k&&s===r&&(D=zt.SEND),p&&(et={},et=Zs(p));var J={conversationType:c,targetId:S,senderUserId:I,messageType:a,messageUId:u,isPersited:w,isCounted:L,isMentioned:M,sentTime:N,messageDirection:D,receivedTime:ze.getTime(),disableNotification:C,receivedStatus:A,canIncludeExpansion:F,content:U,expansion:et,configFlag:_,pushConfig:rt,channelId:t.busChannel||"",isInterrupt:G,isModifyMessage:E};return c!==Y.ULTRA_GROUP&&(J.isOffLineMessage=b),J},n.prototype._formatSentMessage=function(t,e){var r,i=t.content,o=t.classname,s=t.sessionId,c=t.msgId,d=t.extraContent,l=t.pushExt,h=t.pushContent,a=t.configFlag,u=t.extStatus,p=e.signal,f=e.currentUserId,m=p.date,_=p.topic,v=p.targetId,T=!!(2&(u||0)),y=function(N){return{isPersited:!!(1&N),isCounted:!!(2&N),disableNotification:!!(32&N),canIncludeExpansion:!!(64&N)}}(s),w=y.isPersited,L=y.isCounted,M=y.disableNotification,C=y.canIncludeExpansion,A=zd[_]||Y.PRIVATE,F=Ed(Ud,_),G=this._formatBytes(i),E=v;o===Ut.RECALL&&(A=G.conversationType||A,E=G.targetId||v),d&&(r={},r=Zs(d));var S={};l&&(S=Js(l.pushConfigs,l.pushId));var I=pt(pt({},S),{pushTitle:l==null?void 0:l.title,pushContent:h,pushData:h,disablePushTitle:!!a&&Boolean(4&a),forceShowDetailContent:!!a&&Boolean(8&a),templateId:l==null?void 0:l.templateId});return{conversationType:A,targetId:E,messageType:o,messageUId:c,isPersited:w,isCounted:L,isStatusMessage:F,senderUserId:f,content:this._formatBytes(i),sentTime:1e3*m,receivedTime:ze.getTime(),messageDirection:zt.SEND,isOffLineMessage:!1,disableNotification:M,canIncludeExpansion:C,expansion:r,pushConfig:I,channelId:t.busChannel||"",isInterrupt:T}},n.prototype._formatHistoryMessages=function(t,e){var r=this,i=e.conversation||{},o=t.list,s=t.hasMsg,c=i.targetId,d=St(t.syncTime),l=[];return Ot(o,function(h){var a=r._formatReceivedMessage(h,e);i.conversationType===Y.ULTRA_GROUP?a.targetId=h.groupId||i.targetId:a.targetId=c,l.push(a)},{isReverse:!0}),{syncTime:d,list:l,hasMore:!!s}},n.prototype._formatUltraMsgChangeList=function(t){var e=t.list,r=t.syncTime,i=t.hasNext;return{syncTime:r,list:e&&e.map(function(o){var s=o.targetId,c=o.type,d=o.time,l=o.changeType,h=o.msgUID,a=o.msgTime,u=o.busChannel,p=o.isAdmin,f=o.isDel,m=o.operatorId;return{targetId:s,conversationType:c,changeType:l,messageUId:h,changeTime:St(d),sendTime:St(a),channelId:u,isAdmin:p,isDel:f,operatorId:m}}),hasNext:i}},n.prototype._formatUltraOperateStatusNotifyList=function(t){var e=t.type,r=t.notifyType,i=t.info,o=t.summary,s=[],c=[],d=(2&r)==2,l=(1&r)==1;return l&&Array.isArray(i)&&i.forEach(function(h){var a=h.targetId,u=h.busChannel,p=h.userId,f=h.opType,m=h.optime,_=St(m);s.push({targetId:a,channelId:u,userId:p,operationType:f,operationTime:_})}),d&&Array.isArray(o)&&o.forEach(function(h){var a=h.targetId,u=h.busChannel,p=h.count,f=h.opType;c.push({targetId:a,channelId:u,count:p,operationType:f})}),{conversationType:e,info:s,summary:c,hasInfo:l,hasSummary:d}},n.prototype._formatUltraMsgList=function(t,e){var r=this,i=t.list;return{list:i&&i.map(function(o){return r._formatReceivedMessage(o,e)})}},n.prototype._formatConversationList=function(t,e){var r=this,i=t.info,o=e.afterDecode||function(){},s={list:i=Jn(i,function(c){var d=c.msg,l=c.userId,h=c.type,a=c.unreadCount,u=c.busChannel,p=c.versionTime,f=c.remindCount,m=null;d&&((m=r._formatReceivedMessage(d,e)).targetId=l);var _={targetId:l,conversationType:h,unreadMessageCount:St(a)||0,latestMessage:m||{},channelId:u||""};return h===Y.ULTRA_GROUP&&(_.versionTime=St(p)||0,_.unreadMentionedCount=St(f)||0),o(_)||_})};return((e==null?void 0:e.conversationType)||Y.NONE)===Y.ULTRA_GROUP&&(s.isFinished=t.isFinished),s},n.prototype._formatSetUserSettingOutput=function(t){return t},n.prototype._formatChatRoomInfos=function(t){var e=t.userTotalNums,r=t.userInfos;return{userCount:e,userInfos:Jn(r,function(i){var o=i.id,s=i.time;return{id:o,time:St(s)}})}},n.prototype._formatChatRoomKVList=function(t){var e=t.entries,r=t.bFullUpdate,i=t.syncTime;return e=Jn(e=e||[],function(o){var s=o.key,c=o.value,d=o.status,l=o.timestamp,h=o.uid,a=o.version,u=function(p){return{isAutoDelete:!!(1&p),isOverwrite:!!(2&p),type:4&p?Gt.DELETE:Gt.UPDATE}}(d);return{key:s,value:c,isAutoDelete:u.isAutoDelete,isOverwrite:u.isOverwrite,type:u.type,userId:h,timestamp:St(l),version:St(a)}}),{kvEntries:e,isFullUpdate:r,syncTime:i}},n.prototype._formatUserSetting=function(t){var e=this,r=t.items,i=t.version,o={};return Ot(r||[],function(s){var c=s.key,d=s.version,l=s.value;s.version=St(d),s.value=e._readBytes(l),c==="Tag"&&s.tags.forEach(function(h){h.createdTime=St(h.createdTime),h.tagName=h.name}),o[c]=s}),{settings:o,version:i}},n.prototype._formatConversationStatus=function(t){var e=t.state,r=[];return Ot(e,function(i){var o=i.type,s=i.channelId,c=i.time,d=i.stateItem,l=i.busChannel,h=Yt.CLOSE,a=ce.NOT_SET,u=!1,p=[];Ot(d,function(f){var m=f.sessionStateType,_=f.value,v=f.tags;switch(m){case Wn:h=_===_i?Yt.OPEN:Yt.CLOSE,a=Number(_)||ce.NOT_SET;break;case ra:u=_===_i;break;case ia:p=v}}),r.push({conversationType:o,type:o,targetId:s,notificationStatus:h,notificationLevel:a,isTop:u,updatedTime:St(c),tags:p,channelId:l||""})}),r},n.prototype._formatRTCUserList=function(t){var e=t.users,r=t.token,i=t.sessionId,o=t.roomInfo,s=t.entries,c={};return Ot(e,function(d){var l=d.userId,h=d.userData,a={};Ot(h,function(u){var p=u.key,f=u.value;a[p]=f}),c[l]=a}),{users:c,token:r,sessionId:i,roomInfo:o,kvEntries:s}},n.prototype._formatRTCData=function(t){var e=t.outInfo,r={};return Ot(e,function(i){r[i.key]=i.value}),r},n.prototype._formatRTCRoomInfo=function(t){var e=t.roomId,r=t.userCount,i=t.roomData,o={id:e,total:r};return Ot(i,function(s){o[s.key]=s.value}),o},n.prototype._formatGrpReadReceiptQryResp=function(t){var e=t.totalMemberNum,r=t.list;return r.forEach(function(i){i.readTime=St(i.readTime)}),{totalMemberCount:e,list:r}},n.prototype._formatUserSettingNotification=function(t){return t},n.prototype._formatRTCRoomKVList=function(t){var e=t.entries,r=t.bFullUpdate,i=t.syncTime;return{kvEntries:e=(e=e||[]).map(function(o){var s=o.timestamp;return Object.assign(o,{timestamp:St(s)})}),isFullUpdate:r,syncTime:i}},n.prototype._formatChrmKVVersion=function(t){return t},n.prototype._formatRTCAuidenceJoinRoomData=function(t){return t},n.prototype._formatRTCJoinedUserInfo=function(t){return(t.info||[]).map(function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:St(e.joinTime)}})},n.prototype.encodeServerConfParams=function(){var t=this._codec.getModule(Ro);return t.setNothing(1),t.getArrayData()},n.prototype._getUpMsgModule=function(t,e){var r,i,o,s=this._connectType==="comet",c=t.conversationType,d=e.messageType,l=e.isMentioned,h=e.mentionedType,a=e.mentionedUserIdList,u=e.content,p=e.pushContent,f=e.pushData,m=e.directionalUserIdList,_=e.isFilerWhiteBlacklist,v=e.isVoipPush,T=e.canIncludeExpansion,y=e.expansion,w=e.pushConfig,L=e.channelId;[Y.GROUP,Y.ULTRA_GROUP].includes(c);var M=this._codec.getModule(Dn),C=function(et){var rt=et.isStatusMessage,D=et.isPersited,J=et.isCounted;rt&&(D=J=!1);var W=0;return D&&(W|=1),J&&(W|=2),et.isMentioned&&(W|=4),et.disableNotification&&(W|=32),et.canIncludeExpansion&&(W|=64),W}(e),A=w||{},F=A.pushTitle,G=A.pushContent,E=A.pushData,S=A.iOSConfig,I=A.androidConfig,N=A.templateId,b=A.disablePushTitle,k=A.forceShowDetailContent,U=0;M.setSessionId(C),l&&u&&(u.mentionedInfo={userIdList:((r=u.mentionedInfo)===null||r===void 0?void 0:r.userIdList)||a||[],type:((i=u.mentionedInfo)===null||i===void 0?void 0:i.type)||h||qr.ALL,mentionedContent:((o=u.mentionedInfo)===null||o===void 0?void 0:o.mentionedContent)||""});var $=G||p||"",q=E||f||"";if($&&M.setPushText($),q&&M.setAppData(q),m&&M.setUserId(m),U|=v?1:0,U|=_?2:0,U|=b?4:0,U|=k?8:0,M.setConfigFlag(U),M.setClassname(d),u.user&&u.user.portraitUri&&(u.user.portrait=u.user.portraitUri),M.setContent(JSON.stringify(u)),T&&y){var X={};Ot(y,function(et,rt){X[rt]={v:et}}),M.setExtraContent(JSON.stringify(X))}if(w){var nt=this._codec.getModule(Co);if(F&&nt.setTitle(F),S&&I){var at=Td(S,I);nt.setPushConfigs(at)}(I==null?void 0:I.notificationId)&&nt.setPushId(I==null?void 0:I.notificationId),nt.setTemplateId(N||""),M.setPushExt(s?nt.getArrayData():nt)}return ct(L)||M.setBusChannel(L),M},n.prototype.encodeUpMsg=function(t,e){return this._getUpMsgModule(t,e).getArrayData()},n.prototype.encodeSyncMsg=function(t){var e=t.sendboxTime,r=t.inboxTime,i=t.broadcastSyncTime,o=this._codec.getModule(Io);return o.setIspolling(!1),o.setIsPullSend(!0),o.setSendBoxSyncTime(e),o.setSyncTime(r),o.setBroadcastSyncTime(i),o.getArrayData()},n.prototype.encodeChrmSyncMsg=function(t,e){t=t||0,e=e||0;var r=this._codec.getModule(So);return r.setCount(e),r.setSyncTime(t),r.getArrayData()},n.prototype.encodeGetHistoryMsg=function(t,e){var r=e.count,i=e.order,o=e.timestamp,s=e.channelId,c=this._codec.getModule(Oo);return c.setTargetId(t),c.setTime(o),c.setCount(r),c.setOrder(i),c.setBusChannel(s||""),c.getArrayData()},n.prototype.encodeSuperSyncMsg=function(t){var e=this._codec.getModule(cs);return e.setSyncTime(t),e.getArrayData()},n.prototype.encodeGetConversationList=function(t){var e=(t=t||{}).count,r=t.startTime,i=this._codec.getModule(Or);return i.setType(1),i.setCount(e),i.setStartTime(r),i.getArrayData()},n.prototype.encodeOldConversationList=function(t){var e=(t=t||{}).count,r=t.type,i=t.startTime,o=t.order;e=e||0,i=i||0,o=o||0;var s=this._codec.getModule(Or);return s.setType(r),s.setCount(e),s.setStartTime(i),s.setOrder(o),s.getArrayData()},n.prototype.encodeRemoveOldConversationList=function(t){var e=(t=t||{}).conversationType,r=t.channelId,i=this._codec.getModule(Mo);return i.setType(e),r&&i.setBusChannel([r]),i.getArrayData()},n.prototype.encodeRemoveConversationList=function(t){var e=this,r=this._codec.getModule(No),i=[];return Ot(t,function(o){var s=o.conversationType,c=o.targetId,d=e._codec.getModule(bo);d.setType(s),d.setChannelId(c),i.push(d)}),r.setSessions(i),r.getArrayData()},n.prototype.encodeDeleteMessages=function(t,e,r,i){var o=this._codec.getModule(Ao),s=[];return Ot(r,function(c){s.push({msgId:c.messageUId,msgDataTime:c.sentTime,direct:c.messageDirection})}),o.setType(t),o.setConversationId(e),o.setMsgs(s),o.setBusChannel(i),o.getArrayData()},n.prototype.encodeClearMessages=function(t,e,r,i){var o=this._codec.getModule(wo);return e=e||new Date().getTime(),o.setDataTime(e),o.setTargetId(t),o.setBusChannel(r),o.setConversationType(i),o.getArrayData()},n.prototype.encodeClearUnreadCount=function(t,e){var r=t.conversationType,i=t.targetId,o=t.channelId,s=e.timestamp,c=this._codec.getModule(zr);return s=s||+new Date,c.setType(r),c.setChannelId(i),c.setMsgTime(s),c.setBusChannel(o),c.getArrayData()},n.prototype.encodeExpandUltraMessage=function(t,e){var r=t.targetId,i=t.conversationType,o=t.channelId,s=t.messageUId,c=t.sendTime,d=t.keys,l={mid:s,put:t.expansion,del:d,clear:t.removeAll?1:0},h=this._codec.getModule(Ur);return h.setFromUserId(e),h.setTargetId(r),h.setType(i),h.setBusChannel(o||""),h.setMsgUID(s),h.setMsgTime(c),h.setContent(JSON.stringify(l)),h.getArrayData()},n.prototype.encodemodifyMessage=function(t,e){var r=t.targetId,i=t.conversationType,o=t.channelId,s=t.messageUId,c=t.sendTime,d=t.content,l=this._codec.getModule(Ur);return l.setFromUserId(e),l.setTargetId(r),l.setType(i),l.setBusChannel(o||""),l.setMsgUID(s),l.setMsgTime(c),l.setContent(JSON.stringify(d)),l.getArrayData()},n.prototype.encodeQueryMsgChange=function(t){var e=this._codec.getModule(us);return e.setSyncTime(t),e.getArrayData()},n.prototype.encodeMsgQuery=function(t){var e=t.targetId,r=t.conversationType,i=t.messages,o=this._codec.getModule(ds),s=i.map(function(c){return{msgTime:c.sendTime,msgUID:c.messageUId,busChannel:c.channelId}});return o.setTargetId(e),o.setType(r),o.setQuery(s),o.getArrayData()},n.prototype.encodeOperateStatus=function(t,e,r,i){var o=this._codec.getModule(ls);return o.setTargetId(t),o.setType(e),o.setBusChannel(r),o.setOpType(i),o.getArrayData()},n.prototype.encodeJoinOrQuitChatRoom=function(){var t=this._codec.getModule(Po);return t.setNothing(1),t.getArrayData()},n.prototype.encodeGetChatRoomInfo=function(t,e){var r=this._codec.getModule(Lo);return r.setCount(t),r.setOrder(e),r.getArrayData()},n.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(t,e){var r=this._codec.getModule(es);return r.setUnpushLevel(t),r.setBusChannel(e),r.getArrayData()},n.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(t){var e=this._codec.getModule(ts);return e.setBusChannel(t),e.getArrayData()},n.prototype.encodeGetFileToken=function(t,e,r,i){var o=this._codec.getModule(Ho);return o.setType(t),o.setKey(e),o.setHttpMethod(r),o.setQueryString(i),o.getArrayData()},n.prototype.encodeGetFileUrl=function(t,e,r,i){var o=this._codec.getModule(t);return o.setType(e),o.setKey(r),i&&o.setFileName(i),o.getArrayData()},n.prototype.encodeModifyChatRoomKV=function(t,e,r){var i=this._connectType==="comet",o=this._codec.getModule(Yo),s=e.key,c=e.value,d=e.notificationExtra,l=e.isSendNotification,h=e.type,a=e.timestamp,u=h||Gt.UPDATE,p=Qs(e,u),f={key:s,value:c||"",uid:r,version:a};if(ct(p)||(f.status=p),o.setEntry(f),l){var m={conversationType:Y.CHATROOM,targetId:t},_={key:s,value:c,extra:d,type:u},v=this._getUpMsgModule(m,{messageType:Ut.CHRM_KV_NOTIFY,content:_,isPersited:!1,isCounted:!1});i?o.setNotification(v.getArrayData()):o.setNotification(v),o.setBNotify(!0),o.setType(Y.CHATROOM)}return o.getArrayData()},n.prototype.encodeModifyChatRoomKVS=function(t,e,r){this._connectType;var i=this._codec.getModule(zo),o=e.entries,s=e.type||Gt.UPDATE,c=Qs(e,s),d=[];return o.forEach(function(l){var h={key:l.key,value:l.value||"",uid:r,version:l.timestamp};ct(c)||(h.status=c),d.push(h)}),i.setEntry(d),i.getArrayData()},n.prototype.encodePullChatRoomKV=function(t){var e=this._codec.getModule(Wo);return e.setTimestamp(t),e.getArrayData()},n.prototype.encodePullUserSetting=function(t){var e=this._codec.getModule(Zo);return e.setVersion(t),e.getArrayData()},n.prototype.encodeGetConversationStatus=function(t){var e=this._codec.getModule(Qo);return e.setTime(t),e.getArrayData()},n.prototype.encodeSetConversationStatus=function(t){var e=this,r=this._connectType==="comet",i=this._codec.getModule(Pr),o=ze.getTime(),s=[];return Ot(t,function(c){var d=e._codec.getModule(Ar),l=c.conversationType,h=c.targetId,a=c.notificationStatus,u=c.isTop,p=c.channelId,f=c.notificationLevel,m=[];d.setType(l),d.setChannelId(h),d.setTime(o),d.setBusChannel(p);var _=a===Yt.OPEN,v={};ct(a)||(v[Wn]=_),ct(f)||(v[Wn]=f),ct(u)||(v[ra]=u),Ot(v,function(y,w){if(!ct(y)){var L=e._codec.getModule(wr);y=y?_i:Zd,ct(f)||Number(w)!==Wn||(y=String(f)),L.setSessionStateType(Number(w)),L.setValue(y);var M=r?L.getArrayData():L;m.push(M)}}),d.setStateItem(m);var T=r?d.getArrayData():d;s.push(T)}),i.setVersion(o),i.setState(s),i.getArrayData()},n.prototype.encodeReadReceipt=function(t,e){var r=this._codec.getModule(Lr);return r.setMsgId(t),e&&r.setChannelId(e),r.getArrayData()},n.prototype.encodeCreateTag=function(t,e){var r=this,i=this._connectType==="comet",o=this._codec.getModule(rs),s=[];return t.forEach(function(c){var d=r._codec.getModule(Nn);d.setTagId(c.tagId),d.setName(c.tagName),s.push(i?d.getArrayData():d)}),o.setTags(s),o.setVersion(e),o.getArrayData()},n.prototype.encodeMessageReader=function(t,e){var r=this._codec.getModule(Lr);return r.setMsgId(t),e&&r.setChannelId(e),r.getArrayData()},n.prototype.encodeRemoveTag=function(t,e){var r=this,i=this._connectType==="comet",o=this._codec.getModule(is),s=[];return t.forEach(function(c){var d=r._codec.getModule(Nn);d.setTagId(c),s.push(i?d.getArrayData():d)}),o.setTags(s),o.setVersion(e),o.getArrayData()},n.prototype.encodeDisConversationTag=function(t){var e=this._codec.getModule(os);return e.setTagId(t),e.getArrayData()},n.prototype.encodeUpdateConversationTag=function(t,e){var r=this,i=this._connectType==="comet",o=this._codec.getModule(Pr),s=[];return e.forEach(function(c){var d=r._codec.getModule(Ar),l=r._codec.getModule(wr),h=[];t.forEach(function(a){var u=r._codec.getModule(Nn);u.setTagId(a.tagId),ct(a.isTop)||u.setIsTop(a.isTop),h.push(i?u.getArrayData():u)}),l.setSessionStateType(ia),l.setValue(JSON.stringify(h)),l.setTags(h),d.setType(c.conversationType),d.setChannelId(c.targetId),d.setTime(Date.now()),d.setStateItem([i?l.getArrayData():l]),s.push(i?d.getArrayData():d)}),o.setState(s),o.setVersion(ze.getTime()),o.getArrayData()},n.prototype.encodeReportSDKInfo=function(t){var e=this._codec.getModule(ss);return e.setSdkInfo(t),e.getArrayData()},n.prototype.encodeUltraGroup=function(t,e){var r=this._codec.getModule(as);return r.setSyncTime(t),r.setIsEraseMsgContent(e),r.getArrayData()},n.prototype.encodeJoinRTCRoom=function(t,e,r,i,o){var s=this,c=this._connectType==="comet",d=this._codec.getModule(Nr);if(t=t||0,d.setRoomType(t),ct(e)||d.setBroadcastType(e),ct(r)||d.setJoinType(r),i){var l=[],h=this._codec.getModule(Lt);for(var a in i)h.setKey(a),h.setValue(i[a]),c?l.push(h.getArrayData()):l.push(h);d.setInnerDatas(l)}if(o){var u=[];Object.keys(o).forEach(function(p){var f=s._codec.getModule(Lt);f.setKey(p),f.setValue(o[p]),c?u.push(f.getArrayData()):u.push(f)}),d.setOuterDatas(u)}return d.getArrayData()},n.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(Uo).getArrayData()},n.prototype.encodeSetRTCData=function(t,e,r,i,o){var s=this._codec.getModule(Do);if(s.setInterior(r),s.setTarget(i),s.setKey(t),s.setValue(e),o){o.name&&s.setObjectName(o.name);var c=o.content;c&&(Rt(c)&&(c=JSON.stringify(c)),s.setContent(c))}return s.getArrayData()},n.prototype.encodeUserSetRTCData=function(t,e,r,i){var o=this,s=this._connectType==="comet",c=this._codec.getModule(br);c.setObjectName(r);var d=this._codec.getModule(Lt);d.setKey(t.name),d.setValue(t.content),s?c.setContent(d.getArrayData()):c.setContent(d);var l=[];return["uris","mcu_uris"].forEach(function(h){var a=o._codec.getModule(Lt);a.setKey(h);var u=h==="uris"?e:i;a.setValue(u),s?l.push(a.getArrayData()):l.push(a)}),c.setValueInfo(l),c.getArrayData()},n.prototype.encodeUserSetRTCCDNUris=function(t,e){this._connectType;var r=this._codec.getModule(br);r.setObjectName(t);var i=this._codec.getModule(Lt);return i.setKey("cdn_uris"),i.setValue(e),r.setValueInfo(i),r.getArrayData()},n.prototype.encodeGetRTCData=function(t,e,r){var i=this._codec.getModule(Mr);return i.setInterior(e),i.setTarget(r),i.setKey(t),i.getArrayData()},n.prototype.encodeRemoveRTCData=function(t,e,r,i){var o=this._codec.getModule(Mr);o.setInterior(e),o.setTarget(r),o.setKey(t);var s=(i=i||{}).name,c=i.content;return!ct(s)&&o.setObjectName(s),ct(c)||(Rt(c)&&(c=JSON.stringify(c)),o.setContent(c)),o.getArrayData()},n.prototype.encodeSetRTCOutData=function(t,e,r){var i=this._codec.getModule(ko);i.setTarget(e),Ht(t)||(t=[t]),Ot(t,function(c,d){c.key=c.key?c.key.toString():c.key,c.value=c.value?c.value.toString():c.value,t[d]=c}),i.setValueInfo(t);var o=(r=r||{}).name,s=r.content;return!ct(o)&&i.setObjectName(o),ct(s)||(Rt(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},n.prototype.ecnodeGetRTCOutData=function(t){var e=this._codec.getModule(Vo);return e.setUserId(t),e.getArrayData()},n.prototype.encodeSetRTCState=function(t){var e=this._codec.getModule(xo);return e.setState(t),e.getArrayData()},n.prototype.encodeGetRTCRoomInfo=function(){var t=this._codec.getModule(Bo);return t.setOrder(2),t.getArrayData()},n.prototype.encodeSetRTCUserInfo=function(t,e){var r=this._codec.getModule(Lt);return r.setKey(t),r.setValue(e),r.getArrayData()},n.prototype.encodeRemoveRTCUserInfo=function(t){var e=this._codec.getModule(Fo);return e.setKey(t),e.getArrayData()},n.prototype.encodeIdentityChangeInfo=function(t,e,r){r===void 0&&(r=!1);var i=this._codec.getModule(Nr);return i.setRoomType(Vt.LIVE),e&&i.setBroadcastType(e),i.setIdentityChangeType(t),i.setNeedSysChatroom(r),i.getArrayData()},n.prototype.encodePullRTCRoomKV=function(t,e){var r=this._codec.getModule(ps);return r.setTimestamp(e),r.setRoomId(t),r.getArrayData()},n.prototype.encodeQueryUserJoinedInfo=function(t){var e=this._codec.getModule(fs);return e.setUserId(t),e.getArrayData()},n.prototype.encodeRequestRoomPK=function(t){var e=t.invitedRoomId,r=t.invitedUserId,i=t.inviteSessionId,o=t.inviteTimeout,s=t.inviteInfo,c=this._codec.getModule(gs);return c.setInvitedRoomId(e),c.setInvitedUserId(r),c.setInviteSessionId(i),c.setTimeoutTime(o),c.setInviteInfo(s),c.getArrayData()},n.prototype.encodeCancelRoomPK=function(t){var e=t.invitedRoomId,r=t.invitedUserId,i=t.inviteSessionId,o=t.inviteInfo,s=this._codec.getModule(ms);return s.setInvitedRoomId(e),s.setInvitedUserId(r),s.setInviteSessionId(i),s.setInviteInfo(o),s.getArrayData()},n.prototype.encodeResponseRoomPK=function(t){var e=t.inviteUserId,r=t.inviteRoomId,i=t.inviteSessionId,o=t.content,s=t.key,c=t.value,d=t.agree?1:0,l=this._codec.getModule(_s);return l.setInviteUserId(e),l.setInviteRoomId(r),l.setInviteSessionId(i),l.setContent(o),l.setKey(s),l.setValue(c),l.setAnswerCode(d),l.getArrayData()},n.prototype.encodeEndRoomPK=function(t){var e=t.endRoomId,r=t.sessionId,i=t.content,o=t.keys,s=this._codec.getModule(vs);return s.setInviteRoomId(e),s.setInviteSessionId(r),s.setInviteContent(i),s.setInviteRoomKeys(o),s.getArrayData()},n.prototype.encodebindRTCRoomForChatroom=function(t){var e=this._codec.getModule(Ts);return e.setRtcRoomId(t.rtcRoomId),e.getArrayData()},n}(),yc=function(n,t){this._watcher=t,this.codec=new Qd(n)};(function(n){n.GET="GET",n.POST="POST"})(re||(re={})),function(n){n.WIFI="wifi",n.FOUR_G="4g",n.THREE_G="3g",n.TWO_G="2g",n.FIVE_G="2g",n.THREE_GENT="3gnet",n.UNKONWN="unknown"}(Zt||(Zt={}));var Zi,Ec=function(n,t){return n&&t?t+"_"+n:n||Date.now()},$n=function(){function n(t){this.header=t,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return n.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return Ec(t,e)},n.prototype.read=function(t,e,r){this.readMessage(t,e,r)},n.prototype.readMessage=function(t,e,r){return{stream:t,length:e}},n}(),Cc=function(){function n(t){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Eo(t,!1,At.AT_MOST_ONCE,!1)}return n.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return Ec(t,e)},n.prototype.write=function(t){var e=this.getHeaderFlag();t.write(e),this.writeMessage(t)},n.prototype.setHeaderQos=function(t){this._header.qos=t},n.prototype.getHeaderFlag=function(){return this._header.encode()},n.prototype.getLengthSize=function(){return this.lengthSize},n.prototype.getBufferData=function(){var t=new Rd;this.write(t);var e=t.getBytesArray();return new Int8Array(e)},n.prototype.getCometData=function(){var t=this.data||{};return JSON.stringify(t)},n}(),Rc=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e._name=jt.CONN_ACK,e.status=null,e.userId=null,e.timestamp=0,e}return It(t,n),t.prototype.readMessage=function(e,r,i){if(e.readByte(),this.status=+e.readByte(),r<=t.MESSAGE_LENGTH)return{stream:e,length:r};if(i===Me.V4){var o=e.readByte();1&o&&(this.userId=e.readUTF()),2&o&&e.readUTF(),4&o&&(this.timestamp=e.readLong()),8&o&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var s=e.readUTF();H.debug("server sessionId -> "+s),this.timestamp=e.readLong()}return{stream:e,length:r}},t.MESSAGE_LENGTH=2,t}($n),ys=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e._name=jt.DISCONNECT,e.status=0,e}return It(t,n),t.prototype.readMessage=function(e,r){return e.readByte(),this.status=+e.readByte(),{stream:e,length:r}},t.MESSAGE_LENGTH=2,t}($n),Xd=function(n){function t(){var e=n.call(this,xt.PING_REQ)||this;return e._name=jt.PING_REQ,e}return It(t,n),t.prototype.writeMessage=function(e){},t}(Cc),Ic=function(n){function t(e){var r=n.call(this,e)||this;return r._name=jt.PING_RESP,r}return It(t,n),t}($n),Es=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.messageId=0,e}return It(t,n),t.prototype.readMessage=function(e,r){var i=256*e.readByte()+e.readByte();return this.messageId=parseInt(i.toString(),10),{stream:e,length:r}},t}($n),si=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.messageId=0,e}return It(t,n),t.prototype.writeMessage=function(e){var r=this.messageId,i=255&r,o=(65280&r)>>8;e.write(o),e.write(i)},t}(Cc),Bn=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e._name=jt.PUBLISH,e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=De.PUB,e}return It(t,n),t.prototype.readMessage=function(e,r){return this.date=e.readInt(),this.topic=e.readUTF(),this.targetId=e.readUTF(),n.prototype.readMessage.call(this,e,r),this.data=e.readAll(),{stream:e,length:r}},t}(Es),qt=function(n){function t(e,r,i){var o=n.call(this,xt.PUBLISH)||this;return o._name=jt.PUBLISH,o.syncMsg=!1,o.identifier=De.PUB,o.topic=e,o.data=Bt(r)?Hn.writeUTF(r):r,o.targetId=i,o}return It(t,n),t.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),n.prototype.writeMessage.call(this,e),e.write(this.data)},t}(si),Qi=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e._name=jt.PUB_ACK,e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=De.PUB,e.topic="",e.targetId="",e}return It(t,n),t.prototype.readMessage=function(e,r){return n.prototype.readMessage.call(this,e,r),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.millisecond=256*e.readByte()+e.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=e.readUTF(),{stream:e,length:r}},t}(Es),Sc=function(n){function t(e){var r=n.call(this,xt.PUB_ACK)||this;return r._name=jt.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=e,r}return It(t,n),t.prototype.writeMessage=function(e){n.prototype.writeMessage.call(this,e)},t}(si),Q=function(n){function t(e,r,i){var o=n.call(this,xt.QUERY)||this;return o.name=jt.QUERY,o.identifier=De.QUERY,o.topic=e,o.data=Bt(r)?Hn.writeUTF(r):r,o.targetId=i,o}return It(t,n),t.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),n.prototype.writeMessage.call(this,e),e.write(this.data)},t}(si),Oc=function(n){function t(e){var r=n.call(this,xt.QUERY_CONFIRM)||this;return r._name=jt.QUERY_CON,r.messageId=e,r}return It(t,n),t}(si),bn=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e._name=jt.QUERY_ACK,e.status=0,e.identifier=De.QUERY,e.topic="",e.targetId="",e}return It(t,n),t.prototype.readMessage=function(e,r){return n.prototype.readMessage.call(this,e,r),this.date=e.readInt(),this.status=256*e.readByte()+e.readByte(),this.data=e.readAll(),{stream:e,length:r}},t}(Es),Nc=function(n){var t,e=n.type;switch(e){case xt.CONN_ACK:t=new Rc(n);break;case xt.PUBLISH:(t=new Bn(n)).syncMsg=n.syncMsg;break;case xt.PUB_ACK:t=new Qi(n);break;case xt.QUERY_ACK:t=new bn(n);break;case xt.SUB_ACK:case xt.UNSUB_ACK:case xt.PING_RESP:t=new Ic(n);break;case xt.DISCONNECT:t=new ys(n);break;default:t=new $n(n),H.error("No support for deserializing "+e+" messages")}return t};(function(n){n[n.ppMsgP=1]="ppMsgP",n[n.ppMsgN=2]="ppMsgN",n[n.ppMsgS=3]="ppMsgS",n[n.pgMsgP=4]="pgMsgP",n[n.chatMsg=5]="chatMsg",n[n.pcMsgP=6]="pcMsgP",n[n.qryPMsg=7]="qryPMsg",n[n.qryGMsg=8]="qryGMsg",n[n.qryCHMsg=9]="qryCHMsg",n[n.qryCMsg=10]="qryCMsg",n[n.qrySMsg=11]="qrySMsg",n[n.recallMsg=12]="recallMsg",n[n.prMsgS=13]="prMsgS",n[n.rrMsg=14]="rrMsg",n[n.rrList=15]="rrList",n[n.s_ntf=16]="s_ntf",n[n.s_msg=17]="s_msg",n[n.s_stat=18]="s_stat",n[n.s_cmd=19]="s_cmd",n[n.s_us=20]="s_us",n[n.pullUS=21]="pullUS",n[n.pgMsgS=22]="pgMsgS",n[n.chatMsgS=23]="chatMsgS",n[n.qrySessionsAtt=24]="qrySessionsAtt",n[n.pullMsg=25]="pullMsg",n[n.qrySessions=26]="qrySessions",n[n.delSessions=27]="delSessions",n[n.delMsg=28]="delMsg",n[n.updRRTime=29]="updRRTime",n[n.chrmPull=30]="chrmPull",n[n.joinChrm=31]="joinChrm",n[n.joinChrmR=32]="joinChrmR",n[n.exitChrm=33]="exitChrm",n[n.queryChrmI=34]="queryChrmI",n[n.setKV=35]="setKV",n[n.delKV=36]="delKV",n[n.pullKV=37]="pullKV",n[n.qryRelation=38]="qryRelation",n[n.delRelation=39]="delRelation",n[n.pullSeAtts=40]="pullSeAtts",n[n.setSeAtt=41]="setSeAtt",n[n.qnTkn=42]="qnTkn",n[n.qnUrl=43]="qnUrl",n[n.aliUrl=44]="aliUrl",n[n.s3Url=45]="s3Url",n[n.stcUrl=46]="stcUrl",n[n.cleanPMsg=47]="cleanPMsg",n[n.cleanGMsg=48]="cleanGMsg",n[n.cleanCMsg=49]="cleanCMsg",n[n.cleanSMsg=50]="cleanSMsg",n[n.rtcRJoin_data=51]="rtcRJoin_data",n[n.rtcRExit=52]="rtcRExit",n[n.rtcPing=53]="rtcPing",n[n.rtcSetData=54]="rtcSetData",n[n.rtc_ntf=55]="rtc_ntf",n[n.viewerJoinR=56]="viewerJoinR",n[n.viewerExitR=57]="viewerExitR",n[n.rtcPullKv=58]="rtcPullKv",n[n.rtcIdentityChange=59]="rtcIdentityChange",n[n.userSetData=60]="userSetData",n[n.rtcQryData=61]="rtcQryData",n[n.rtcDelData=62]="rtcDelData",n[n.rtcSetOutData=63]="rtcSetOutData",n[n.rtcQryUserOutData=64]="rtcQryUserOutData",n[n.rtcToken=65]="rtcToken",n[n.rtcUserState=66]="rtcUserState",n[n.rtcRInfo=67]="rtcRInfo",n[n.rtcUData=68]="rtcUData",n[n.rtcUPut=69]="rtcUPut",n[n.rtcUDel=70]="rtcUDel",n[n.rtcUList=71]="rtcUList",n[n.rtcQueryJoined=72]="rtcQueryJoined",n[n.rtcInvite=73]="rtcInvite",n[n.rtcCancelInvite=74]="rtcCancelInvite",n[n.rtcInviteAnswer=75]="rtcInviteAnswer",n[n.rtcEndInvite=76]="rtcEndInvite",n[n.addSeTag=77]="addSeTag",n[n.delSeTag=78]="delSeTag",n[n.addTag=79]="addTag",n[n.delTag=80]="delTag",n[n.disTag=81]="disTag",n[n.reportsdk=82]="reportsdk",n[n.pullUgSes=83]="pullUgSes",n[n.pullUgMsg=84]="pullUgMsg",n[n.ugMsg=85]="ugMsg",n[n.qryUgMsg=86]="qryUgMsg",n[n.updUgRTime=87]="updUgRTime",n[n.upMsgEx=88]="upMsgEx",n[n.modifyMsg=89]="modifyMsg",n[n.qryMsgChange=90]="qryMsgChange",n[n.qryMsg=91]="qryMsg",n[n.operate=92]="operate",n[n.s_opNtf=93]="s_opNtf",n[n.ugUnpushQuery=94]="ugUnpushQuery",n[n.ugUnpushSet=95]="ugUnpushSet",n[n.setRtcRoomId=96]="setRtcRoomId"})(Zi||(Zi={}));var Jt,kt,x=Zi,bc=function(n,t,e,r,i,o,s,c){return"".concat(n,"://").concat(t,"/websocket?appId=").concat(e,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(o,"&pid=").concat(s,"&apiVer=").concat(i.isFromUniapp?"uniapp":"normal").concat(i.connectPlatform?"&platform="+i.connectPlatform:"").concat(c?"&protocolVer="+c:"")},Mc=function(n){return[x.ppMsgS,x.pgMsgS,x.chatMsgS].map(function(t){return x[t]}).indexOf(n)>=0};(function(n){n[n.REDIRECT=0]="REDIRECT",n[n.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",n[n.BLOCK=2]="BLOCK",n[n.REMOTE_CLOSE=3]="REMOTE_CLOSE",n[n.LOGOUT=4]="LOGOUT",n[n.BLOCK_NEW=5]="BLOCK_NEW",n[n.REDIRECT_NEW=6]="REDIRECT_NEW"})(Jt||(Jt={})),function(n){n.IM_NAVI="IM-stats_navi-S",n.IM_WEBSOCKET="IM-stats_websocket-S",n.IM_COMET="IM-stats_comet-S",n.IM_CONNECTION_DURATION="IM-stats_con_dur-S"}(kt||(kt={}));var oa=function(n,t){H.info("websocket send -> messageId: ".concat(n.messageId," topic: ").concat(n.topic));var e=n.getBufferData();t.send(e.buffer)},ln=function(n){function t(e,r){var i=n.call(this,"websocket",r)||this;return i._runtime=e,i._socket=null,i._messageIds={},i._syncMessageIds={},i._failedCount=0,i.ALLOW_FAILED_TIMES=2,i._timer=null,i._idCount=0,i._generateMessageId=function(){return i._idCount>=65535&&(i._idCount=0),++i._idCount},i}return It(t,n),t.prototype.connect=function(e,r,i,o,s,c){return V(this,void 0,void 0,function(){var d=this;return B(this,function(l){return[2,new Promise(function(h){var a=i.slice(),u=!1,p=function(){return V(d,void 0,void 0,function(){var f,m,_;return B(this,function(v){switch(v.label){case 0:return a.length===0||u?[2]:(u=!0,f=a.shift(),H.setStatisticsData(kt.IM_WEBSOCKET,{startTime:new Date().getTime(),host:f,protocol:yr.WS}),[4,this._connect(e,r,f,o,s,c)]);case 1:if(m=v.sent(),_=m===R.SUCCESS||m===Mt.REDIRECT?m:Ir(m),H.setStatisticsData(kt.IM_WEBSOCKET,{endTime:new Date().getTime(),code:_}),function(T){V(this,void 0,void 0,function(){var y,w,L,M,C,A,F,G,E,S,I,N,b,k,U;return B(this,function($){switch($.label){case 0:y=kt.IM_WEBSOCKET,w=H.getStatisticsBaseData(),L=w.sdkPrivate,M=w.serverPrivate,C=w.bundleId,A=H.getStatisticsData(y),F=A.protocol,G=A.startTime,E=A.endTime,S=A.code,I=A.host,N=Zt.UNKONWN,$.label=1;case 1:return $.trys.push([1,3,,4]),[4,T.getNetworkType()];case 2:return N=$.sent(),[3,4];case 3:return b=$.sent(),H.info(b.message),[3,4];case 4:return k=0,mt(G)&&mt(E)&&E>G&&G&&(k=E-G),U={spr:L,pr:M,bid:C,ptc:F,dur:k,cod:S,hos:I,net:N},H.reportStatisticsLog(y,U),[2]}})})}(this._runtime),m===R.SUCCESS)this._checkAlive(),h(m);else if(m===Mt.REDIRECT)h(m);else{if(a.length===0)return h(Ir(m)),[2];u=!1,p()}return[2]}})})};s=To(s),d._watcher.status(Z.CONNECTING),p()})]})})},t.prototype._connect=function(e,r,i,o,s,c){return V(this,void 0,void 0,function(){var d,l,h,a,u,p=this;return B(this,function(f){switch(f.label){case 0:return d=o.replace("http","ws"),l=bc(d,i,e,r,this._runtime,s,"",c),H.info("conenct start -> ".concat(l)),this.sendConnectTime=Date.now(),h=this._runtime.createWebSocket(l),a=function(m){p._timer&&(clearTimeout(p._timer),p._timer=null),p._socket===h&&(p._socket=null,p._watcher.status(m))},[4,new Promise(function(m){h.onMessage(function(_){if(Object.prototype.toString.call(_)==="[object ArrayBuffer]"){var v=function(y,w){var L=new Uint8Array(y),M=new Cd(L),C=M.readByte(),A=new Eo(C),F=Nc(A);return F.read(M,L.length-1,w),F}(_,c);if(v instanceof Ic&&p._pingResolve)return p._pingResolve(R.SUCCESS),void(p._pingResolve=void 0);if(v instanceof Rc)return H.info("recv connect ack -> ".concat(v.status)),v.status!==Mt.ACCEPTED?(H.warn("connect failed: ".concat(v.status)),void m(v.status)):(H.info("connect success -> ".concat(l)),p.connectedTime=v.timestamp,p.userId=v.userId||"",p._idCount=v.messageId,void m(R.SUCCESS));if(v instanceof ys){var T=v.status;switch(H.warn("recv disconnect signal -> status: ".concat(T)),T){case Jt.BLOCK_NEW:case Jt.BLOCK:p._watcher.status(Z.BLOCKED);break;case Jt.OTHER_DEVICE_LOGIN:p._watcher.status(Z.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Jt.REDIRECT_NEW:case Jt.REDIRECT:p._watcher.status(Z.REDIRECT);break;default:p._watcher.status(Z.DISCONNECT_BY_SERVER)}}else p._onReceiveSignal(v)}else H.error("Socket received invalid data:",_)}),h.onClose(function(_,v){for(var T in H.warn("websocket closed! code:",_,"reason:",v),a(Z.CONNECTION_CLOSED),p._messageIds){var y=p._messageIds[T];delete p._messageIds[T],y(R.RC_NET_CHANNEL_INVALID)}m(_)}),h.onError(function(_){for(var v in H.error("websocket error!",_==null?void 0:_.stack),a(Z.WEBSOCKET_ERROR),p._messageIds){var T=p._messageIds[v];delete p._messageIds[v],T(R.RC_NET_CHANNEL_INVALID)}m(R.NETWORK_ERROR)}),h.onOpen(function(){return H.info("websocket open =>",l)}),setTimeout(function(){m(R.TIMEOUT)},5e3)})];case 1:return(u=f.sent())===R.SUCCESS?this._socket=h:(H.warn("connect result -> code: ".concat(u,", url: ").concat(l)),h.close()),[2,u]}})})},t.prototype._checkAlive=function(){var e;return V(this,void 0,void 0,function(){var r,i=this;return B(this,function(o){switch(o.label){case 0:return this._socket?(H.info("send ping ->"),this.sendOnly(new Xd),[4,new Promise(function(s){i._pingResolve=s,i._timer&&clearTimeout(i._timer),i._timer=setTimeout(function(){i._pingResolve=void 0,s(R.TIMEOUT)},15e3)})]):[2];case 1:return(r=o.sent())!==R.SUCCESS?(this._failedCount+=1,H.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(r)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,H.warn("ping timeout, close current websocket to reconnect!"),(e=this._socket)===null||e===void 0||e.close(),this._socket=null,this._watcher.status(Z.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(H.info("recv pong <-"),this._failedCount=0,setTimeout(function(){return i._checkAlive()},15e3),[2])}})})},t.prototype._onReceiveSignal=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l=this;return B(this,function(h){switch(h.label){case 0:return r=e.messageId,e.header&&e.header.qos!==At.AT_MOST_ONCE&&(e instanceof Bn&&!e.syncMsg&&(H.info("send pubAck -> ".concat(r," ").concat(e.topic)),this.sendOnly(new Sc(r))),e instanceof bn&&(H.info("send queryCon -> ".concat(r," ").concat(e.topic)),this.sendOnly(new Oc(r)))),r>0&&(e instanceof Qi||e instanceof bn)&&(H.info("recv ack -> messageId: ".concat(r," ").concat(e.topic)),(i=this._messageIds[r])&&(i(e),delete this._messageIds[r]),(o=this._syncMessageIds[r])&&(delete this._syncMessageIds[r],o(e))),e instanceof Bn?(s=e.syncMsg,c=e.topic,H.info("recv PublishReader -> messageId: ".concat(r," ").concat(c)),c===x[x.userSetData]?[2]:!s||Mc(c)?(this._watcher.signal(e),[2]):[4,new Promise(function(a){l._syncMessageIds[r]=a})]):[3,2];case 1:d=h.sent(),delete this._syncMessageIds[r],this._watcher.signal(e,d),h.label=2;case 2:return[2]}})})},t.prototype.sendOnly=function(e){this._socket&&((e instanceof qt||e instanceof Q)&&(e.messageId=this._generateMessageId()),oa(e,this._socket))},t.prototype.send=function(e,r,i,o){return o===void 0&&(o=3e4),V(this,void 0,void 0,function(){var s,c,d,l,h=this;return B(this,function(a){switch(a.label){case 0:return this._socket?(s=this._generateMessageId(),e.messageId=s,oa(e,this._socket),[4,new Promise(function(u){h._messageIds[s]=u,setTimeout(function(){h._messageIds[s]&&delete h._messageIds[s],u()},o)})]):[3,2];case 1:return(c=a.sent())?c instanceof bn||c instanceof Qi?(d=r&&c.data&&[R.SUCCESS,R.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c.status)>=0,l=d?this.codec.decodeByPBName(c.data,r,i):c,c.status!==0?(H.warn("send failed -> message: ".concat(s,", respPBName: ").concat(r,", status: ").concat(c.status)),[2,{code:c.status,data:r&&c.data?l:null}]):[2,{code:R.SUCCESS,data:l}]):[2,{code:c}]:(H.warn("send timeout -> message: ".concat(s,", respPBName: ").concat(r,", timeout: ").concat(o)),[2,{code:R.TIMEOUT}]);case 2:return[2,{code:R.RC_NET_CHANNEL_INVALID}]}})})},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(Z.DISCONNECTED))},t}(yc),hn=function(n){function t(e,r){var i=n.call(this,"comet",r)||this;return i._runtime=e,i._messageIds={},i._syncMessageIds={},i._idCount=0,i._generateMessageId=function(){return++i._idCount},i._pid=encodeURIComponent(new Date().getTime()+Math.random()+""),i}return It(t,n),t.prototype.handleCometRes=function(e){var r=this;if(e.status!==200&&e.status!==202)return!1;var i=Bt(e.data)?JSON.parse(e.data):e.data;return i?!Ht(i)||(Ot(i,function(o){return V(r,void 0,void 0,function(){var s,c,d,l,h,a,u,p,f,m,_,v=this;return B(this,function(T){switch(T.label){case 0:if((s=o.sessionid)&&(this._sessionid=s),c=function(y){var w=y.headerCode,L=new Eo(w),M=Nc(L);for(var C in y)M[C]=y[C];return M}(o),d=c.messageId,l=c._header,h=c.status,a=l&&l.qos!==At.AT_MOST_ONCE,d&&c.getIdentifier&&((u=this._messageIds[d])&&u(c),this._syncMessageIds[d]&&this._syncMessageIds[d](c)),a&&(c instanceof Bn&&!c.syncMsg&&(p=new Sc(d),this.sendOnly(p)),c instanceof bn&&(p=new Oc(d),this.sendOnly(p))),c instanceof ys){switch(h){case Jt.OTHER_DEVICE_LOGIN:this._watcher.status(Z.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Jt.BLOCK:case Jt.BLOCK_NEW:this._watcher.status(Z.BLOCKED);break;case Jt.REDIRECT_NEW:case Jt.REDIRECT:this._watcher.status(Z.REDIRECT);break;default:this._watcher.status(Z.DISCONNECT_BY_SERVER)}return[2]}return c instanceof Bn?(f=c.syncMsg,m=c.topic,!f||Mc(m)?(this._watcher.signal(c),[2,!1]):[4,new Promise(function(y){v._syncMessageIds[d]=y})]):[3,2];case 1:_=T.sent(),delete this._syncMessageIds[d],this._watcher.signal(c,_),T.label=2;case 2:return[2]}})})}),!0):(H.error("received data is not a validJson",i),!1)},t.prototype._startPullSignal=function(e){return V(this,void 0,void 0,function(){var r,i,o,s;return B(this,function(c){switch(c.label){case 0:return r=new Date().getTime(),i="".concat(e,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"×trap=").concat(r,"&pid=").concat(this._pid),[4,this._runtime.httpReq({url:i,body:{pid:this._pid},timeout:45e3})];case 1:return o=c.sent(),s=this.handleCometRes(o),this._isDisconnected||(s?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(Z.NETWORK_UNAVAILABLE))),[2]}})})},t.prototype.connect=function(e,r,i,o,s,c){return V(this,void 0,void 0,function(){var d,l,h=this;return B(this,function(a){return s=To(s),this._protocol=o,this._isDisconnected=!1,this._watcher.status(Z.CONNECTING),d=i.slice(),l=!1,[2,new Promise(function(u){var p=function(){return V(h,void 0,void 0,function(){var f,m,_;return B(this,function(v){switch(v.label){case 0:return d.length===0||l?[2]:(l=!0,f=d.shift(),H.setStatisticsData(kt.IM_COMET,{startTime:new Date().getTime(),host:f,protocol:yr.NAVI}),[4,this._connect(e,r,f,o,s)]);case 1:if(m=v.sent(),_=m===R.SUCCESS||m===Mt.REDIRECT?m:Ir(m),H.setStatisticsData(kt.IM_COMET,{endTime:new Date().getTime(),code:_}),function(T){V(this,void 0,void 0,function(){var y,w,L,M,C,A,F,G,E,S,I,N,b,k,U;return B(this,function($){switch($.label){case 0:y=kt.IM_COMET,w=H.getStatisticsBaseData(),L=w.sdkPrivate,M=w.serverPrivate,C=w.bundleId,A=H.getStatisticsData(y),F=A.protocol,G=A.startTime,E=A.endTime,S=A.code,I=A.host,N=Zt.UNKONWN,$.label=1;case 1:return $.trys.push([1,3,,4]),[4,T.getNetworkType()];case 2:return N=$.sent(),[3,4];case 3:return b=$.sent(),H.info(b.message),[3,4];case 4:return k=0,mt(G)&&mt(E)&&E>G&&G&&(k=E-G),U={spr:L,pr:M,bid:C,ptc:F,dur:k,cod:S,hos:I,net:N},H.reportStatisticsLog(y,U),[2]}})})}(this._runtime),m===R.SUCCESS)this._startPullSignal(o),u(m);else if(m===Mt.REDIRECT)u(m);else{if(d.length===0)return u(Ir(m)),[2];l=!1,p()}return[2]}})})};h._watcher.status(Z.CONNECTING),p()})]})})},t.prototype._connect=function(e,r,i,o,s){return V(this,void 0,void 0,function(){var c,d,l,h;return B(this,function(a){switch(a.label){case 0:return c=function(u){return u.status!==200&&u.status!==202?(H.error("handle comet res -> res: ".concat(JSON.stringify(u||{}))),!1):!!u.data&&(function(p){if(Rt(p))return!0;var f=!1;try{var m=JSON.parse(p);f=JSON.stringify(m)===p}catch{f=!1}return f}(u.data)?Rt(u.data)?u.data:JSON.parse(u.data):(H.error("received data is not a validJson",u.data),!1))},d=bc(o,i,e,r,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),H.info("conenct start -> ".concat(d)),[4,this._runtime.httpReq({url:d,body:{pid:this._pid},timeout:5e3})];case 1:return l=a.sent(),h=c(l),this._domain=i,h&&h.status===0?(this._sessionid=h.sessionid,this.userId=h.userId,this.connectedTime=h.timestamp,H.info("connect success -> userId: ".concat(h.userId,", url: ").concat(d))):H.warn("connect result -> code: ".concat(h==null?void 0:h.status,", url: ").concat(d)),[2,h==null?void 0:h.status]}})})},t.prototype.sendCometData=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u,p;return B(this,function(f){switch(f.label){case 0:return o=(i=this)._domain,s=i._sessionid,c=i._pid,d=e.messageId,l=e.topic,h=e.targetId,a=e.getHeaderFlag(),u=l?"".concat(this._protocol,"://").concat(o,"/websocket?messageid=").concat(d,"&header=").concat(a,"&sessionid=").concat(s,"&topic=").concat(l,"&targetid=").concat(h,"&pid=").concat(c):"".concat(this._protocol,"://").concat(o,"/websocket?messageid=").concat(d,"&header=").concat(a,"&sessionid=").concat(s,"&pid=").concat(c),[4,this._runtime.httpReq({url:u,method:re.POST,body:e.getCometData()})];case 1:return p=f.sent(),this.handleCometRes(p),[2]}})})},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,r,i,o){return o===void 0&&(o=3e4),V(this,void 0,void 0,function(){var s,c,d,l,h=this;return B(this,function(a){switch(a.label){case 0:return s=this._generateMessageId(),e.messageId=s,this.sendCometData(e),[4,new Promise(function(u){h._messageIds[s]=u,setTimeout(function(){delete h._messageIds[s],u()},o)})];case 1:return(c=a.sent())?(d=r&&c.data&&[R.SUCCESS,R.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(c.status)>=0,l=d?this.codec.decodeByPBName(c.data,r,i):c,c.status!==0?[2,{code:c.status,data:r&&c.data?l:null}]:[2,{code:R.SUCCESS,data:l}]):[2,{code:R.TIMEOUT}]}})})},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(Z.DISCONNECTED)},t}(yc),tl=function(n,t,e){this.runtime=n,this._watcher=t,this._options=e,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()},vi=function(n){return["navi",n].join("_")},el=function(){function n(t,e){this._runtime=t,this._options=e,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=To(this._options.apiVersion)}return n.prototype.getInfo=function(t,e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){switch(c.label){case 0:return r&&this._clear(t),o=function(d,l,h){var a,u,p=vi(d);try{var f=h.getItem(p);u=f?JSON.parse(f):[]}catch{u=[]}var m=Date.now();return u.length>0&&(u=u.filter(function(_){return m-_.timestamp<72e5})),u.length===0?h.removeItem(p):h.setItem(p,JSON.stringify(u)),((a=u.find(function(_){return _.token===l}))===null||a===void 0?void 0:a.naviInfo)||null}(this._appkey,t,this._runtime.localStorage),o?(this._naviInfo=o,[2,o]):(s=this._options.navigators.slice(),e.length&&e.forEach(function(d){s.indexOf(d)<0&&s.unshift(d)}),[4,this._reqNavi(s,this._appkey,t,i)]);case 1:return(o=c.sent())?(this._naviInfo=o,this.setNaviInfo2Cache(t,o),[2,o]):[2,o]}})})},n.prototype.setNaviInfo2Cache=function(t,e){this._naviInfo=e,function(r,i,o,s){var c,d=vi(r);try{var l=s.getItem(d);c=l?JSON.parse(l):[]}catch{c=[]}var h=Date.now();c.length>0&&(c=c.filter(function(a){return h-a.timestamp<72e5&&i!==a.token})),c.push({timestamp:h,naviInfo:o,token:i}),s.setItem(d,JSON.stringify(c))}(this._appkey,t,e,this._runtime.localStorage)},n.prototype.getInfoFromCache=function(t){return pt({},this._naviInfo)},n.prototype._clear=function(t){(function(e,r,i){var o,s=vi(e);try{var c=i.getItem(s);o=c?JSON.parse(c):[]}catch{o=[]}var d=Date.now();o.length>0&&(o=o.filter(function(l){return d-l.timestamp<72e5&&r!==l.token})),o.length===0?i.removeItem(s):i.setItem(s,JSON.stringify(o))})(this._appkey,t,this._runtime.localStorage)},n}(),Ke=function(n,t,e){return[n,t,e].join("_")},nl=function(){function n(t,e){this._runtime=t,this._appkey=e,this._users={}}return n.prototype._getMemData=function(t){return this._users[t]||(this._users[t]={inboxTime:0,outboxTime:0,broadcastSyncTime:0})},n.prototype.setInboxTime=function(t,e){var r=this._getMemData(e);if(!(r.inboxTime>t)){r.inboxTime=t;var i=Ke("inbox",this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},n.prototype.getInboxTime=function(t){var e=this._getMemData(t);if(e.inboxTime===0){var r=Ke("inbox",this._appkey,t);e.inboxTime=parseInt(this._runtime.localStorage.getItem(r))||0}return e.inboxTime},n.prototype.setBroadcastSyncTime=function(t,e){var r=this._getMemData(e);if(!(r.broadcastSyncTime>=t||ct(t))){r.broadcastSyncTime=t;var i=Ke("broadcastbox",this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},n.prototype.getBroadcastSyncTime=function(t){var e=this._getMemData(t);if(!e||e.broadcastSyncTime===0){var r=Ke("broadcastbox",this._appkey,t);e.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(r))||1}return e.broadcastSyncTime},n.prototype.setOutboxTime=function(t,e){var r=this._getMemData(e);if(!(r.outboxTime>=t)){r.outboxTime=t;var i=Ke("outbox",this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},n.prototype.getOutboxTime=function(t){var e=this._getMemData(t);if(e.outboxTime===0){var r=Ke("outbox",this._appkey,t);e.outboxTime=parseInt(this._runtime.localStorage.getItem(r))||0}return e.outboxTime},n}(),Ti={_caches:{},set:function(n,t){this._caches[n]=t},get:function(n){return this._caches[n]||0},clear:function(n){this._caches[n]=0}},rl=function(){function n(t,e){this._kvCaches={},this._chatroomId=t,this._currentUserId=e}return n.prototype._add=function(t){var e=t.key;t.isDeleted=!1,this._kvCaches[e]=t},n.prototype._remove=function(t){var e=t.key,r=this._kvCaches[e];r&&(r.isDeleted=!0,this._kvCaches[e]=r)},n.prototype._setEntry=function(t,e){var r=t.key,i=t.type,o=t.isOverwrite,s=t.userId,c=this._getSetUserId(r),d=i===Gt.DELETE,l=c===s,h=!this._isExisted(r),a=d?this._remove:this._add;(e||o||l||h)&&a.call(this,t)},n.prototype.getValue=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.value},n.prototype.getVersion=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.version},n.prototype.getAllValue=function(){var t={};for(var e in this._kvCaches)this._kvCaches[e].isDeleted||(t[e]=this._kvCaches[e].value);return t},n.prototype._getSetUserId=function(t){return(this._kvCaches[t]||{}).userId},n.prototype._isExisted=function(t){var e=this._kvCaches[t]||{},r=e.value,i=e.isDeleted;return r&&!i},n.prototype.setEntries=function(t){var e=this,r=t.kvEntries,i=t.isFullUpdate;r=r||[],(i=i||!1)&&this.clear(),r.forEach(function(o){e._setEntry(o,i)}),H.debug("end setEntries")},n.prototype.clear=function(){this._kvCaches={}},n}(),il=function(){function n(t){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}return n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var t,e,r,i,o,s,c;return B(this,function(d){switch(d.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.chrmId,r=t.timestamp,(i=Ti.get(e))>r?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(e,i)]);case 1:return o=d.sent(),s=o.code,c=o.data,this._isPulling=!1,s===R.SUCCESS?(Ti.set(e,c.syncTime||0),this._startPull()):this._startPull(),[2]}})})},n.prototype.reset=function(t){Ti.clear(t);var e=this._storeCaches[t];e&&e.clear()},n.prototype.pullEntry=function(t,e){this._pullQueue.push({chrmId:t,timestamp:e}),this._startPull()},n.prototype.setLocal=function(t,e,r){var i=this._storeCaches[t];Ze(i)||(i=new rl(t,r)),i.setEntries(e),this._storeCaches[t]=i},n.prototype.getValue=function(t,e){var r=this._storeCaches[t];return r?r.getValue(e):null},n.prototype.getVersion=function(t,e){var r=this._storeCaches[t];return r?r.getVersion(e):null},n.prototype.getAll=function(t){var e=this._storeCaches[t],r={};return e&&(r=e.getAllValue()),r},n}(),ol=function(){function n(t,e,r,i){this._runtime=t,this._appkey=e,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return n.prototype.set=function(t,e){e===void 0&&(e=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[t]=e,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},n.prototype.get=function(){var t,e;try{e=this._runtime.sessionStorage.getItem(this._sessionKey),t=JSON.parse(e||"{}")}catch{H.error("parse rejoined chrm infos error -> ".concat(e)),t={}}return t},n.prototype.remove=function(t){delete this._joinedChrmsInfo[t],Ze(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},n.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},n}(),yi="converStatusChanged",sl=function(){function n(t,e,r){this._eventEmitter=new Fn,this._pullQueue=[],this._isPulling=!1,this._storage=Kr(t.runtime),this._appkey=e,this._currentUserId=r,this._engine=t,this._storagePullTimeKey="con-s-".concat(e,"-").concat(r)}return n.prototype._set=function(t){var e=this;if(!ct(t)&&Array.isArray(t)){var r=this._storage.get(this._storagePullTimeKey)||0,i=t.length;t.forEach(function(o,s){var c=o.updatedTime||0;r=c>r?c:r,o.conversationType=o.type,e._eventEmitter.emit(yi,{statusItem:o,isLastPull:s===i-1})}),this._storage.set(this._storagePullTimeKey,r)}},n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var t,e,r,i;return B(this,function(o){switch(o.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(t)]);case 1:return e=o.sent(),r=e.code,i=e.data,r===R.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}})})},n.prototype.pull=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;(t>e||t===0)&&(this._pullQueue.push(e),this._startPull())},n.prototype.watch=function(t){this._eventEmitter.on(yi,function(e){t(e)})},n.prototype.unwatch=function(){this._eventEmitter.off(yi,function(t){})},n}(),be={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},gr={};for(var sa in be){var al=be[sa].keyName;gr[al]=sa}var cl=function(){function n(t,e,r){this._appkey=e,this._currentUserId=r;var i="con-".concat(e,"-").concat(r);this.storage=new Li(t,i),this._localStore=new Li(t,"CONVER-".concat(e,"-").concat(r))}return n.prototype._getStoreKey=function(t,e,r){return"".concat(r,"_").concat(t,"_").concat(e)},n.prototype._getConOptionByKey=function(t){var e=(t=t||"").split("_");if(e.length>=2){var r=e.shift(),i=e.shift(),o=e.join("_");return{conversationType:Number(i),targetId:o,channelId:r}}return{conversationType:Y.PRIVATE,targetId:"",channelId:""}},n.prototype.updateMentionedData=function(t){var e=this,r=t.conversationType,i=t.targetId,o=t.messageType,s=t.isMentioned,c=t.content,d=t.senderUserId,l=t.channelId,h=this._getStoreKey(r,i,l),a=this._localStore.get(h)||{},u=gr.mentionedInfo,p=gr.hasMentioned,f=a[u]||{},m=f.userIdList||[],_=c.mentionedInfo;if(_){if(s&&r===Y.GROUP&&((_.userIdList||[]).forEach(function(T){T===e._currentUserId&&m.indexOf(d)<0&&m.push(d)}),_.type===qr.ALL&&m.indexOf(d)<0&&m.push(d)),o===Ut.RECALL&&r===Y.GROUP){var v=m.indexOf(d);v>=0&&m.splice(v,1)}_={userIdList:m,type:(_==null?void 0:_.type)||f.type},m.length!==0?(a[u]=_,a[p]=!0):(delete a[u],delete a[p]),Ze(a)?this._localStore.set(h,a):this._localStore.remove(h)}},n.prototype.set=function(t,e,r,i){var o=this._getStoreKey(t,e,i),s=this._localStore.get(o)||{};for(var c in r){var d=gr[c],l=r[c];if(!ct(d)&&!ct(l)&&c!=="hasMentioned"&&c!=="MentionedInfo"){if(l===be[d].defaultVal||c==="tags"&&!Ze(l))delete s[d];else if(c==="tags"){var h=l;for(var a in h)h[a].isTop||delete h[a].isTop;s[d]=l}else s[d]=l;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}Ze(s)?this._localStore.set(o,s):this._localStore.remove(o)},n.prototype.get=function(t,e,r){r===void 0&&(r="");var i=this._getStoreKey(t,e,r),o=this._localStore.get(i)||{},s={};for(var c in be){var d=be[c],l=d.keyName,h=d.defaultVal;s[l]=o[c]||On(h)}return s},n.prototype.getValue=function(t){var e=this._localStore.getValues()||{},r=[];for(var i in e){var o=this._getConOptionByKey(i),s={conversationType:o.conversationType,targetId:o.targetId,channelId:o.channelId},c=e[i];for(var d in c){var l=be[d],h=l.keyName,a=l.defaultVal;s[h]=c[d]||On(a)}s=t?t(s):s,r.push(s)}return r},n.prototype.getValueForTag=function(){var t=this._localStore.getValues()||{},e={};for(var r in t){var i=this._getConOptionByKey(r),o=i.conversationType,s=i.targetId,c={},d=t[r];for(var l in d){var h=be[l],a=h.keyName,u=h.defaultVal;c[a]=d[l]||On(u)}for(var p in c.tags){ct(e[p])&&(e[p]=[]);var f=Object.assign({},c,{conversationType:o,targetId:s});delete f.tags,e[p].push(f)}}return e},n.prototype.adaptOldStore=function(){try{var t=this.storage.getValues();if(Object.keys(t).length===0)return;for(var e in t){var r="_".concat(e);this._localStore.set(r,t[e])}}catch(i){H.error("adaptOldStore error: ".concat(i.message))}},n}(),ul=[Y.PRIVATE,Y.GROUP,Y.SYSTEM,Y.PUBLIC_SERVICE,Y.APP_PUBLIC_SERVICE],aa="conversationChanged",ca="conTagStatusChanged",dl=function(){function n(t,e,r,i,o){var s=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Fn,this._draftMap={},this._appkey=e,this._loginUserId=r,this._store=new cl(t.runtime,e,r),this._statusManager=new sl(t,e,r),this._statusManager.watch(function(c){var d=c.statusItem,l=c.isLastPull;s.addStatus(d,l)}),this._eventEmitter.on(aa,function(c){i(c)}),this._eventEmitter.on(ca,function(){o()})}return n.prototype._calcUnreadCount=function(t,e){var r=t.content,i=t.messageType,o=t.sentTime,s=t.isCounted,c=t.messageDirection,d=t.senderUserId,l=c===zt.SEND&&d===this._loginUserId,h=i===Ut.RECALL,a=Rt(r),u=!1,p={},f=e.lastUnreadTime||0,m=e.unreadMessageCount||0;return f>o||l?{hasChanged:u,localConversation:e,updateItems:p}:(s&&(e.unreadMessageCount=m+1,e.lastUnreadTime=o,u=!0),h&&a&&f>=r.sentTime&&m&&(e.unreadMessageCount=m-1,u=!0),u&&(p.unreadMessageCount={val:e.unreadMessageCount,time:o}),{hasChanged:u,localConversation:e,updateItems:p})},n.prototype._calcMentionedInfo=function(t,e){var r=t.content,i=(t.messageDirection,t.isMentioned),o=t.sentTime;zt.SEND;var s=Rt(r),c=!1,d={};return i&&s&&r.mentionedInfo&&(e.hasMentioned=!0,c=!0,d.hasMentioned={val:!0,time:o},d.mentionedInfo={val:r.mentionedInfo,time:o}),{hasChanged:c,localConversation:e,updateItems:d}},n.prototype._calcMentionedCount=function(t,e){var r=t.content,i=t.messageDirection,o=!1;if(t.isMentioned&&i===zt.RECEIVE&&(r==null?void 0:r.mentionedInfo)){var s=r.mentionedInfo,c=s.type,d=s.userIdList;if(c===qr.ALL||(d||[]).includes(this._loginUserId)){o=!0;var l=e.unreadMentionedCount||0;e.unreadMentionedCount=l+1}}return{hasChanged:o,localConversation:e}},n.prototype._setUpdatedConversation=function(t){if(Rt(t)){var e=t.conversationType,r=t.targetId,i=t.channelId,o="".concat(e,"_").concat(r),s=this._store.get(e,r,i)||{};this._updatedConversations[o]=Object.assign(s,t)}},n.prototype._setConTagStatusChanged=function(t,e,r,i){var o=(this._store.get(t,e,i)||{}).tags||{};if(Object.keys(o).length===Object.keys(r).length){for(var s in o)if(!r[s]||o[s].isTop!==r[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},n.prototype.addStatus=function(t,e){var r=t.conversationType,i=t.targetId,o=t.updatedTime,s=t.notificationStatus,c=t.notificationLevel,d=t.isTop,l=t.tags,h=t.channelId,a={},u={};r!==Y.ULTRA_GROUP&&(ct(s)||(u.notificationStatus={time:o,val:s}),ct(c)||(u.notificationLevel={time:o,val:c}),ct(d)||(u.isTop={time:o,val:d}),ct(l)||(u.tags={time:o,val:l},l==null||l.forEach(function(p){a[p.tagId]={isTop:p.isTop}})),this._setConTagStatusChanged(r,i,a,h),this._store.set(r,i,{notificationStatus:s,notificationLevel:c,isTop:d,tags:a},h),this._setUpdatedConversation({conversationType:r,targetId:i,updatedItems:u,channelId:h}),e&&this._notifyConversationChanged())},n.prototype._notifyConversationChanged=function(){var t=[];for(var e in this._updatedConversations)t.push(this._updatedConversations[e]);t.length!==0&&(this._eventEmitter.emit(aa,t),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ca),this._conTagStatusChanged=!1))},n.prototype.setConversationCacheByMessage=function(t,e){var r=this,i=t.conversationType,o=t.isPersited,s=t.targetId,c=t.channelId;if(ul.indexOf(i)>=0){var d=!1,l=this._store.get(i,s,c),h={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach(function(p){var f=p.call(r,t,l),m=f.hasChanged,_=f.localConversation,v=f.updateItems;d=d||m,h=pt(pt({},h),v),l=On(_)}),d&&this._store.set(i,s,l,c),this._store.updateMentionedData(t),o){var a=this._store.get(i,s,c);a.updatedItems=pt({latestMessage:{time:t.sentTime,val:t}},h),a.latestMessage=t;var u=Object.assign(a,{conversationType:i,targetId:s,channelId:c});this._setUpdatedConversation(u)}(d||o)&&this._notifyConversationChanged()}},n.prototype.get=function(t,e,r){return r===void 0&&(r=""),this._store.get(t,e,r)},n.prototype.getAllUnreadCount=function(t,e,r){var i=this._store.getValue(),o=0;return i.forEach(function(s){var c=s.unreadMessageCount,d=s.notificationStatus,l=s.notificationLevel,h=s.conversationType;c=c||0,(r||d!==1||l===ce.NOT_SET||l===ce.ALL_MESSAGE)&&(e.length>0?e.includes(Number(h))&&(o+=Number(c)):o+=Number(c))}),o},n.prototype.getUnreadCountByTag=function(t,e){var r=this._store.getValueForTag()[t]||[],i=0;return r.forEach(function(o){var s=o.unreadMessageCount,c=o.notificationStatus,d=o.notificationLevel;(e||c!==1||d===-1||d===0)&&(s=s||0,i+=Number(s))}),i},n.prototype.getUnreadCount=function(t,e,r){return this._store.get(t,e,r).unreadMessageCount||0},n.prototype.clearUnreadCount=function(t,e,r,i){i===void 0&&(i=!0);var o=this._store.get(t,e,r),s=o.unreadMessageCount,c=o.hasMentioned,d={};if(s&&(o.unreadMessageCount=0,d.unreadMessageCount={val:0,time:Date.now()}),c&&(o.hasMentioned=!1,o.unreadMentionedCount=0,o.mentionedInfo=void 0,d.hasMentioned={val:!1,time:Date.now()},d.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(t,e,o,r),i&&Object.keys(d).length!==0){var l=Object.assign(o,{conversationType:t,targetId:e,channelId:r,updatedItems:d});this._setUpdatedConversation(l),this._notifyConversationChanged()}},n.prototype.clearAllUnreadCount=function(){var t=this;this._store.getValue().forEach(function(e){e.unreadMessageCount&&(e.unreadMessageCount=0,t._store.set(e.conversationType,e.targetId,e,e.channelId))})},n.prototype.startPullConversationStatus=function(t){this._statusManager.pull(t)},n.prototype.setDraft=function(t,e,r,i){var o="".concat(t,"_").concat(e,"_").concat(i);this._draftMap[o]=r},n.prototype.getDraft=function(t,e,r){var i="".concat(t,"_").concat(e,"_").concat(r);return this._draftMap[i]},n.prototype.clearDraft=function(t,e,r){var i="".concat(t,"_").concat(e,"_").concat(r);delete this._draftMap[i]},n.prototype.addTagStatus=function(t,e,r,i){i===void 0&&(i="");var o=this._store.get(t,e,i).tags;o=Object.assign(o,r),this._store.set(t,e,{tags:o},i)},n.prototype.deleteTagStatus=function(t,e,r,i){i===void 0&&(i="");var o=this._store.get(t,e,i).tags;r.forEach(function(s){delete o[s]}),this._store.set(t,e,{tags:o},i)},n.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},n.prototype.getBlockConversationList=function(){return this._store.getValue().filter(function(t){return t.notificationStatus===Yt.OPEN||t.notificationLevel!==-1&&t.notificationLevel!==0}).map(function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId}})},n.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter(function(t){return t.isTop}).map(function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId}})},n.prototype.adaptOldStore=function(){this._store.adaptOldStore()},n.prototype.getUnreadMentionedCount=function(t,e,r){return t===void 0&&(t=""),this.get(e,r,t).unreadMentionedCount||0},n.prototype.getAllUnreadMentionedCount=function(){var t=this._store.getValue(),e=0;return t.forEach(function(r){var i=r.unreadMentionedCount;i=i||0,e+=Number(i)}),e},n.prototype.getAllConversationState=function(){return this._store.getValue().filter(function(t){return t.unreadMessageCount||t.unreadMentionedCount}).map(function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,unreadCount:t.unreadMessageCount||0,unreadMentionedCount:t.unreadMentionedCount||0}})},n}(),ll=function(){function n(t,e,r,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(e,"-").concat(r),this._storagePullTimeKey="us-s-".concat(e,"-").concat(r),this._storage=Kr(t.runtime),this._engine=t,this._tagWatcherFunc=i}return n.prototype._updateTag=function(t){var e=t.tags,r={};e.forEach(function(i){r[i.tagId]={tagName:i.tagName,createdTime:i.createdTime}}),this._storage.set(this._storageTagKey,r),this._tagWatcherFunc()},n.prototype.addTag=function(t,e){var r=this._storage.get(this._storageTagKey)||{};t.forEach(function(i){var o,s=((o=r[i.tagId])===null||o===void 0?void 0:o.createdTime)||i.createdTime||0;r[i.tagId]={tagName:i.tagName,createdTime:s}}),this._storage.set(this._storageTagKey,r),this._storage.set(this._storagePullTimeKey,e)},n.prototype.deleteTag=function(t,e){var r=this._storage.get(this._storageTagKey)||{};t.forEach(function(i){delete r[i]}),this._storage.set(this._storageTagKey,r),this._storage.set(this._storagePullTimeKey,e)},n.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},n.prototype.getTags=function(){var t=this._storage.get(this._storageTagKey)||{},e=[];for(var r in t)e.push({tagId:r,tagName:t[r].tagName,createdTime:t[r].createdTime,conversationCount:0});return e.sort(function(i,o){return(i.createdTime||0)-(o.createdTime||0)})},n.prototype.getTagById=function(t){var e=this._storage.get(this._storageTagKey)||{};return e[t]?{tagId:t,tagName:e[t].tagName,createdTime:e[t].createdTime,conversationCount:0}:null},n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var t,e,r,i,o,s,c,d;return B(this,function(l){switch(l.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(t)]);case 1:return e=l.sent(),r=e.code,i=e.data,r!==R.SUCCESS||ct(i)?(this._isPulling=!1,this._startPull()):(s=(o=i).settings,c=o.version,d=s.Tag,ct(d)||this._updateTag(d),this._storage.set(this._storagePullTimeKey,c),this._isPulling=!1,this._startPull()),[2]}})})},n.prototype.pullUserSettings=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;(t>e||t===0)&&(this._pullQueue.push(e),this._startPull())},n.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},n}();function Ei(n){return V(this,void 0,void 0,function(){var t,e,r,i,o,s,c,d,l,h,a,u,p,f,m;return B(this,function(_){switch(_.label){case 0:t=kt.IM_NAVI,e=H.getStatisticsBaseData(),r=e.sdkPrivate,i=e.serverPrivate,o=e.bundleId,s=H.getStatisticsData(t),c=s.protocol,d=s.startTime,l=s.endTime,h=s.code,a=s.host,u=Zt.UNKONWN,_.label=1;case 1:return _.trys.push([1,3,,4]),[4,n.getNetworkType()];case 2:return u=_.sent(),[3,4];case 3:return p=_.sent(),H.debug(p.message),[3,4];case 4:return f=0,mt(d)&&mt(l)&&l>d&&d&&(f=l-d),m={spr:r,pr:i,bid:o,ptc:c,dur:f,cod:h,hos:a,net:u},H.reportStatisticsLog(t,m),[2]}})})}var vn,hl=function(n){function t(e,r){var i=n.call(this,e,r)||this;return i._miniConnectUrl="",i._connectType=r.connectionType,i}return It(t,n),t.prototype._formatJSONPUrl=function(e,r,i,o){var s=this._runtime.isSupportSocket()&&this._connectType==="websocket"?"navi":"cometnavi";return"".concat(e,"/").concat(s,".js?appId=").concat(i,"&token=").concat(encodeURIComponent(r),"&callBack=").concat(o,"&v=").concat(this._apiVersion,"&r=").concat(Date.now())},t.prototype.getInfo=function(e,r,i){var o;return V(this,void 0,void 0,function(){var s;return B(this,function(c){return this._runtime.useNavi||(s=void 0,s=this._runtime.isSupportSocket()&&this._connectType==="websocket"?ud.join(","):dd.join(","),this._miniConnectUrl=((o=this._options.miniCMPProxy)===null||o===void 0?void 0:o.length)?this._options.miniCMPProxy.join(","):s||"",r=[]),[2,n.prototype.getInfo.call(this,e,r,i)]})})},t.prototype._reqNavi=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u,p,f,m;return B(this,function(_){switch(_.label){case 0:o="getServerEndpoint",s=0,c=e.length,_.label=1;case 1:return s<c?(d=this._formatJSONPUrl(e[s],i,r,o),H.debug("req navi => ".concat(d)),[4,this._runtime.httpReq({url:d,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(l=_.sent(),h=new Date().getTime(),H.setStatisticsData(kt.IM_NAVI,{endTime:h}),l.status!==200)return a=void 0,l.status===403?(a=R.RC_CONN_USER_OR_PASSWD_ERROR,H.error("request navi error: "+a)):l.status===401&&(a=R.RC_CONN_APP_BLOCKED_OR_DELETED,H.error("request navi error: "+a)),H.setStatisticsData(kt.IM_NAVI,{code:a}),Ei(this._runtime),[3,3];try{return u=l.data.match(/{[\d\D]+}/),(p=u&&u[0]?u[0]:"").indexOf('{\\"code\\":')===0&&(p=JSON.parse('"'+p+'"')),m=JSON.parse(p),f=/^https/.test(d)?"https":"http",m.protocol=f,this._runtime.useNavi||(m.server="",m.backupServer=this._miniConnectUrl,m.logSwitch=0),H.updateStatisticsBaseData({serverPrivate:m.type===$t.PRIVATE?$t.PRIVATE:$t.OPEN}),H.setStatisticsData(kt.IM_NAVI,{code:R.SUCCESS}),m.userId&&(H.updateUploadLogAttr({userId:m.userId}),Le.init(m.userId)),Ei(this._runtime),[2,m]}catch(v){H.error("parse navi err =>",v)}_.label=3;case 3:return s+=1,[3,1];case 4:return this._runtime.useNavi?[2,null]:(m={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl},H.setStatisticsData(kt.IM_NAVI,{code:m.code,startTime:0,endTime:0,host:""}),Ei(this._runtime),[2,m])}})})},t}(el),pl=function(){function n(t){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}return n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var t,e,r,i,o,s,c;return B(this,function(d){switch(d.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.roomId,r=t.timestamp,(i=this._pullTime)>r?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(e,i)]);case 1:return o=d.sent(),s=o.code,c=o.data,s===R.SUCCESS?(this._isPulling=!1,this._pullTime=c.syncTime||0,this._startPull()):this._startPull(),[2]}})})},n.prototype.pullEntry=function(t,e){this._pullQueue.push({roomId:t,timestamp:e}),this._startPull()},n.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},n}(),Ci=function(n,t){return["send_msg",n,t].join("_")},fl=function(){function n(t,e){this._runtime=t,this._appkey=e,this._sendMessageMap={},this._userId=""}return n.prototype.init=function(t){this._userId=t;var e=Ci(this._appkey,t);this._sendMessageMap=this._getLocalInfo(e)},n.prototype._getLocalInfo=function(t){var e=this._runtime.localStorage.getItem(t);try{return e?JSON.parse(e):{}}catch{return{}}},n.prototype.setMessage=function(t,e){this._sendMessageMap[t]=e;var r=Ci(this._appkey,this._userId),i=this._getLocalInfo(r);i[t]=e,this._runtime.localStorage.setItem(r,JSON.stringify(i))},n.prototype.getSendMessageMap=function(){return this._sendMessageMap},n.prototype.removeByUID=function(t){delete this._sendMessageMap[t]},n.prototype.removeByTimestamp=function(t){var e=Ci(this._appkey,this._userId),r=this._getLocalInfo(e);Object.keys(r).forEach(function(i){r[i]<t&&delete r[i]}),this._runtime.localStorage.setItem(e,JSON.stringify(r))},n}();(vn={})[Y.PRIVATE]=x.qryPMsg,vn[Y.GROUP]=x.qryGMsg,vn[Y.CHATROOM]=x.qryCHMsg,vn[Y.CUSTOMER_SERVICE]=x.qryCMsg,vn[Y.SYSTEM]=x.qrySMsg;var gl=[x[x.recallMsg],x[x.ppMsgS],x[x.pgMsgS],x[x.ppMsgP],x[x.pgMsgP],x[x.chatMsg],x[x.pcMsgP],x[x.prMsgS],x[x.updUgRTime]],ml=function(){function n(t,e,r){this.ULTRA_GROUP_CONVERSATION="ultragroupconversation";var i="".concat(this.ULTRA_GROUP_CONVERSATION,"-").concat(e,"-").concat(r);this._localStore=new Li(t,i)}return n.prototype.set=function(t,e,r,i){var o=this._getStoreKey(t,e,i),s=this._localStore.get(o)||{};for(var c in r){var d=Ac[c],l=r[c];!ct(d)&&!ct(l)&&(l===Mn[d].defaultVal?delete s[d]:s[d]=l)}Ze(s)?this._localStore.set(o,s):this._localStore.remove(o)},n.prototype.get=function(t,e,r){r===void 0&&(r="");var i=this._getStoreKey(t,e,r),o=this._localStore.get(i)||{},s={};for(var c in Mn){var d=Mn[c],l=d.keyName,h=d.defaultVal;s[l]=o[c]||On(h)}return s},n.prototype._getStoreKey=function(t,e,r){return"".concat(r,"_").concat(t,"_").concat(e)},n}(),Mn={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Ac={};for(var ua in Mn){var _l=Mn[ua].keyName;Ac[_l]=ua}var vl=function(){function n(t,e,r){this._store=new ml(t.runtime,e,r)}return n.prototype.addUltraGroupStatus=function(t){var e=t.conversationType,r=t.targetId,i=t.notificationStatus,o=t.notificationLevel,s=t.channelId;e===Y.ULTRA_GROUP&&this._store.set(e,r,{notificationStatus:i,notificationLevel:o},s)},n.prototype.get=function(t,e,r){return r===void 0&&(r=""),this._store.get(t,e,r)},n}(),Zn=function(n,t,e,r,i,o){return{conversationType:n,targetId:t,senderUserId:o,messageDirection:zt.SEND,isCounted:!!e.isCounted,isMentioned:!!e.isMentioned,content:e.content,messageType:e.messageType,isOffLineMessage:!1,isPersited:!!e.isPersited,messageUId:r,sentTime:i,receivedTime:0,disableNotification:!!e.disableNotification,isStatusMessage:!!e.isStatusMessage,canIncludeExpansion:!!e.canIncludeExpansion,expansion:e.canIncludeExpansion?e.expansion:null,receivedStatus:Un.UNREAD,pushConfig:e.pushConfig,channelId:e.channelId,isInterrupt:e.isInterrupt}},Qn=function(n){return n.sort(function(t,e){var r,i,o=((r=t.latestMessage)===null||r===void 0?void 0:r.sentTime)||0;return(((i=e.latestMessage)===null||i===void 0?void 0:i.sentTime)||0)-o})},Tl=function(n){function t(e,r,i){var o=n.call(this,e,r,i)||this;return o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o._connectedTime=0,o._localConnectedTime=0,o._status=Z.DISCONNECTED,o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._pullChatroomEntryTimestamp=0,o._lastSyncUltraMsgTimeStamp=0,o._lastSyncUltraMsgLocalTimeStamp=0,o._ultraGroupTimer=-1,o._isUltraPulling=!1,o._ultraGroupTimeQue=[],o._isUltraGroupListExist=!1,o._ultraGroupMap={},o._firstPullUltraGroupTime=0,o._ultraMsgMap={},o._pullUltraChangeMessageQue=[],o._isPullingUltraChangeMessage=!1,o._lastPullingUltraChangeMessageTime=0,o._ultraMsgChangeMap={},o._letterbox=new nl(e,i.appkey),o._sendMessageStore=new fl(e,i.appkey),o._chrmEntryHandler=new il(o),o}return It(t,n),t.prototype._createNavi=function(){return new hl(this.runtime,this._options)},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l=this;return B(this,function(h){switch(h.label){case 0:return i=[],this._naviInfo=r,r.server?i.push(r.server):H.warn("navi.server is invalid"),(o=r.backupServer)&&o.split(",").forEach(function(a){i.indexOf(a)<0&&i.push(a)}),i.length===0?(H.error("navi invaild.",i),[2,R.UNKNOWN]):(s=this.runtime.createDataChannel({status:function(a){l._connectionStatusHandler(a,e,i,r.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),c=Me.V3,r.openAnti===1&&(c=Me.V4),[4,s.connect(this._appkey,e,i,r.protocol,this._apiVer,c)]);case 1:return(d=h.sent())===R.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(Z.CONNECTED),this._status=Z.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new dl(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._ultraGroupManager=new vl(this,this._appkey,this.currentUserId),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new ll(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new pl(this),this._joinedChrmManager=new ol(this.runtime,this._appkey,this.currentUserId,r.joinMChrm),this._startSyncInterval(),r.ugMsg===1&&this._startUltraSyncInterval()):s.close(),[2,d]}})})},t.prototype._connectionStatusHandler=function(e,r,i,o){if(H.warn("connection status changed:",e),this._status=e,e!==Z.CONNECTING)if(e!==Z.CONNECTED){if(this._channel&&e!==Z.DISCONNECTED)return e===Z.BLOCKED||e===Z.KICKED_OFFLINE_BY_OTHER_CLIENT||e===Z.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==Z.REDIRECT?(this._watcher.status(e),this._try2Reconnect(r,i,o)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,r,i){return V(this,void 0,void 0,function(){var o,s=this;return B(this,function(c){switch(c.label){case 0:return this._channel?(o=Me.V3,this._naviInfo.openAnti===1&&(o=Me.V4),[4,this._channel.connect(this._appkey,e,r,i,this._apiVer,o)]):[2];case 1:return c.sent()===R.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(Z.CONNECTED),this._status=Z.CONNECTED,this._naviInfo.ugMsg===1&&this._startUltraSyncInterval(),this._rejoinChrm(),H.__insertLogIntoDatabase(),[2]):(this._watcher.status(Z.WEBSOCKET_UNAVAILABLE),this._status=Z.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout(function(){s._reconnectTimer=-1,s._try2Reconnect(e,r,i)},5e3),[2])}})})},t.prototype._signalHandler=function(e,r){var i=e.syncMsg,o=e.topic;if(i)this._receiveSyncMsg(e,r);else{var s=x[o];if(s)switch(s){case x.s_ntf:H.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case x.s_msg:this._receiveMsg(e);break;case x.s_cmd:this._receiveStateNotify(e);break;case x.s_us:this._receiveSettingNotify(e);break;case x.rtc_ntf:this._receiveRtcKv(e);break;case x.s_opNtf:this._pullOperateStatusNotify(e)}else H.error("unknown topic:",o)}},t.prototype._receiveStateNotify=function(e){var r,i=(r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(e.data,Sr),o=i.time,s=i.type,c=i.chrmId;switch(s){case 2:this._chrmEntryHandler.pullEntry(c,o);break;case 3:this._conversationManager.startPullConversationStatus(o);break;case 4:this._chrmEntryHandler.reset(c),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(o),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(o),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var r,i=((r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(e.data,Xr)).version;this._userSettingManager.pullUserSettings(i)},t.prototype._receiveRtcKv=function(e){var r,i=(r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(e.data,hs),o=i.time,s=i.type,c=i.roomId;s===1&&this._rtcKVManager.pullEntry(c,o)},t.prototype._receiveMessageExpansion=function(e){var r=e.content,i=r.put,o=r.del,s=r.mid;i&&this._watcher.expansion({updatedExpansion:{messageUId:s,expansion:i}}),o&&this._watcher.expansion({deletedExpansion:{messageUId:s,deletedKeys:o}})},t.prototype._receiveSyncMsg=function(e,r){var i,o;if(gl.includes(e.topic)){if(e.topic===x[x.updUgRTime]){var s=(i=this._channel)===null||i===void 0?void 0:i.codec.decodeByPBName(e.data,zr),c=s.channelId,d=s.busChannel,l=this._ultraGroupMap[d+"_"+c];return l&&(l.unreadMessageCount=0,l.unreadMentionedCount=0,l.lastReadTime=r.timestamp,this._watcher.conversation(He([l]))),void(r&&(this._ultraMsgMap[r.messageUId]=r.timestamp))}var h=(o=this._channel)===null||o===void 0?void 0:o.codec.decodeByPBName(e.data,Dn,{currentUserId:this.currentUserId,signal:e});h=this._handleMsgProperties(h),r&&(h.sentTime=r.timestamp,h.messageUId=r.messageUId),this._pullingMsg?this._pullQueue.push((r==null?void 0:r.timestamp)||h.sentTime):(r&&this._sendMessageStore.setMessage(r.messageUId,r.timestamp),h.messageType!==Ut.EXPANSION_NOTIFY?(h.messageType===Ut.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(h.conversationType,h.targetId,h.channelId),this._conversationManager.setConversationCacheByMessage(h,!0),this._watcher.batchMessage([h])):this._receiveMessageExpansion(h))}},t.prototype._pullMsg=function(e){if(this._channel){var r=this._channel.codec.decodeByPBName(e.data,Sr),i=r.type,o=r.chrmId,s=r.time;if(H.info("s_ntf -> type: ".concat(i,", chrmId: ").concat(o,", time: ").concat(s)),i===2){var c=this._chrmsQueue[o];if(!c)return;c.queue.push(s),this._pullChrmMsg(o)}else this._pullQueue.push(s),this._syncMsg()}},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval(),this._intervalTimer=setInterval(function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()},3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){this._intervalTimer!==-1&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncMsg=function(){return V(this,void 0,void 0,function(){var e,r,i,o,s,c,d,l,h,a,u,p,f,m,_,v,T,y=this;return B(this,function(w){switch(w.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),i=this._letterbox.getBroadcastSyncTime(this.currentUserId),H.info("pullMsg -> sendboxTime: ".concat(e,", inboxTime: ").concat(r,", broadcastSyncTime: ").concat(i)),o=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:r,broadcastSyncTime:i}),s=new Q(x[x.pullMsg],o,this.currentUserId),[4,this._channel.send(s,Qe,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return c=w.sent(),d=c.code,l=c.data,this._latestSyncTimestamp=Date.now(),d!==R.SUCCESS||!l||ct(l.finished)||ct(l.list)||ct(l.syncTime)?(H.warn("pullMsg failed -> code:",d,", data: ",l),this._pullingMsg=!1,[2]):(h=l.list,a=l.finished,u=l.syncTime,p=l.broadcastSyncTime,f=p===void 0?1:p,H.info("pullMsg success -> syncTime: ".concat(u,", finished: ").concat(a)),m=0,_=[],h.forEach(function(L){if(L.messageDirection===zt.SEND&&(m=Math.max(L.sentTime,m),y._sendMessageStore.getSendMessageMap()[L.messageUId]))return void y._sendMessageStore.removeByUID(L.messageUId);if(L.messageType!==Ut.EXPANSION_NOTIFY){if(L.messageType===Ut.SYNC_READ_STATUS){if(L.senderUserId!==y.currentUserId)return;y._conversationManager.clearUnreadCount(L.conversationType,L.targetId,L.channelId)}var M=y._handleMsgProperties(L);y._conversationManager.setConversationCacheByMessage(M,!0),_.push(M)}else y._receiveMessageExpansion(L)}),this._watcher.batchMessage(_),this._letterbox.setInboxTime(u,this.currentUserId),this._letterbox.setOutboxTime(m,this.currentUserId),this._letterbox.setBroadcastSyncTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(m),this._pullingMsg=!1,v=this._pullQueue.filter(function(L){return L>u}),this._pullQueue.length=0,(T=this._pullQueue).push.apply(T,v),a&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!a||v.length>0)&&this._syncMsg(),[2])}})})},t.prototype._receiveMsg=function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var r=this._channel.codec.decodeByPBName(e.data,Yr,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});(r=this._handleMsgProperties(r)).senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(r.messageUId,r.sentTime),r.isStatusMessage||r.senderUserId===this.currentUserId||this._letterbox.setInboxTime(r.sentTime,this.currentUserId),r.messageType!==Ut.EXPANSION_NOTIFY?r.messageType===Ut.SYNC_READ_STATUS&&r.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r)}},t.prototype._handleMsgProperties=function(e,r){r===void 0&&(r=!1);var i,o=e.messageType,s=e.isCounted,c=e.isPersited,d=e.isStatusMessage,l=o in Vs,h=o in this._customMessageType;if(i=l?pt(pt({},Vs[o]),{isStatusMessage:ld.includes(o)}):h?this._customMessageType[o]:{isCounted:!$s(s)&&s,isPersited:!$s(c)&&c,isStatusMessage:!1},Object.assign(e,i),r&&!ct(d)&&(e.isStatusMessage=d),!r){var a=e.content.user;if(a){var u=a.portrait,p=a.portraitUri,f=u||p;f&&(a.portrait=a.portraitUri=f)}}return e},t.prototype.getHistoryMessage=function(e,r,i,o,s,c){return c===void 0&&(c=""),V(this,void 0,void 0,function(){var d,l,h,a,u,p,f,m,_;return B(this,function(v){switch(v.label){case 0:return l=(d=this).currentUserId,h=d._channel,a=Jd[e]||vc,u=o===1&&i===0,h?(p=h.codec.encodeGetHistoryMsg(r,{timestamp:i,count:u?2:o,order:s,channelId:c}),[4,h.send(new Q(a,p,l),Xe,{currentUserId:l,connectedTime:h.connectedTime,conversation:{targetId:r}})]):[3,2];case 1:return f=v.sent(),(m=f.code)!==R.SUCCESS?[2,{code:m}]:(_=f.data,u&&_.list.length===2&&(_.hasMore=!0,s===0?_.list.shift():_.list.pop()),[2,{code:m,data:{list:_.list,hasMore:_.hasMore}}]);case 2:return[2,{code:R.RC_NET_CHANNEL_INVALID}]}})})},t.prototype.reportSDKInfo=function(e){var r=this.currentUserId,i=this._channel;if(i){H.info("reportSDKInfo ->",e);var o=i.codec.encodeReportSDKInfo(JSON.stringify(e)),s=new Q(x[x.reportsdk],o,r);i.send(s).then(function(c){var d=c.code;d!==R.SUCCESS&&H.warn("reportSDKInfo failed -> code: ".concat(d))})}},t.prototype.deleteRemoteMessage=function(e,r,i,o){return V(this,void 0,void 0,function(){var s,c,d,l,h,a,u;return B(this,function(p){switch(p.label){case 0:return c=(s=this).currentUserId,(d=s._channel)?(l=d.codec.encodeDeleteMessages(e,r,i,o),h=new Q(Dd,l,c),[4,d.send(h)]):[3,2];case 1:return a=p.sent(),u=a.code,R.SUCCESS,[2,u];case 2:return[2,R.RC_NET_CHANNEL_INVALID]}})})},t.prototype.deleteRemoteMessageByTimestamp=function(e,r,i,o){return V(this,void 0,void 0,function(){var s,c,d,l,h,a,u,p;return B(this,function(f){switch(f.label){case 0:return c=(s=this).currentUserId,(d=s._channel)?(l=d.codec.encodeClearMessages(r,i,o,e),h=Wd[e],a=new Q(h,l,c),[4,d.send(a)]):[3,2];case 1:return u=f.sent(),p=u.code,R.SUCCESS,[2,p];case 2:return[2,R.RC_NET_CHANNEL_INVALID]}})})},t.prototype.getConversationList=function(e,r,i,o,s){return e===void 0&&(e=300),V(this,void 0,void 0,function(){var c,d,l,h,a,u,p,f,m=this;return B(this,function(_){switch(_.label){case 0:return d=(c=this).currentUserId,l=c._channel,r=r||Y.PRIVATE,l?(h=l.codec.encodeOldConversationList({count:e,type:r,startTime:i,order:o}),a=new Q(na,h,d),[4,l.send(a,tn,{currentUserId:d,connectedTime:l.connectedTime,afterDecode:function(v){var T=v.conversationType,y=v.targetId,w=v.channelId,L=m._conversationManager.get(T,y,w);return Object.assign(v,L),v}})]):[3,2];case 1:return u=_.sent(),p=u.code,f=u.data,p!==R.SUCCESS?[2,{code:p}]:[2,{code:p,data:f==null?void 0:f.list}];case 2:return[2,{code:R.RC_NET_CHANNEL_INVALID}]}})})},t.prototype.removeConversation=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return(o=this._channel)?(s=o.codec.encodeRemoveOldConversationList({conversationType:e,channelId:i,targetId:r}),c=new Q(Gd,s,r),[4,o.send(c)]):[3,2];case 1:return d=h.sent(),H.info("RemoveConversation =>",d),l=d.code,R.SUCCESS,[2,l];case 2:return[2,R.RC_NET_CHANNEL_INVALID]}})})},t.prototype.getConversation=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h;return B(this,function(a){switch(a.label){case 0:return e!==Y.ULTRA_GROUP?[3,1]:(o=this._ultraGroupMap[i+"_"+r])?[3,3]:[2,{code:R.CONVER_GET_ERROR}];case 1:return(s=this._conversationManager.get(e,r,i))?[4,this.getHistoryMessage(e,r,0,1,0)]:[2,{code:R.CONVER_GET_ERROR}];case 2:if(c=a.sent(),d=c.code,l=c.data,d!==R.SUCCESS)return[2,{code:R.CONVER_GET_ERROR}];h=(l==null?void 0:l.list[0])||null,o={conversationType:e,targetId:r,channelId:i,unreadMessageCount:s.unreadMessageCount||0,latestMessage:h,notificationStatus:s.notificationStatus||Yt.CLOSE,notificationLevel:s.notificationLevel||ce.NOT_SET,isTop:s.isTop||!1,lastUnreadTime:s.lastUnreadTime||0,unreadMentionedCount:s.unreadMentionedCount||0},a.label=3;case 3:return[2,{code:R.SUCCESS,data:o}]}})})},t.prototype.getAllConversationUnreadCount=function(e,r,i){var o=this._conversationManager.getAllUnreadCount(e,r,i);return Promise.resolve({code:R.SUCCESS,data:o})},t.prototype.getConversationUnreadCount=function(e,r,i){var o,s;return s=e===Y.ULTRA_GROUP?((o=this._ultraGroupMap[i+"_"+r])===null||o===void 0?void 0:o.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,r,i),Promise.resolve({code:R.SUCCESS,data:s})},t.prototype.clearConversationUnreadCount=function(e,r,i){return this._conversationManager.clearUnreadCount(e,r,i,!1),Promise.resolve(R.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(R.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,r){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,r,i,o){return this._conversationManager.setDraft(e,r,i,o),Promise.resolve(R.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,r,i){var o=this._conversationManager.getDraft(e,r,i);return Promise.resolve({code:R.SUCCESS,data:o})},t.prototype.clearConversationMessageDraft=function(e,r,i){return this._conversationManager.clearDraft(e,r,i),Promise.resolve(R.SUCCESS)},t.prototype.pullConversationStatus=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h,a,u=this;return B(this,function(p){switch(p.label){case 0:return i=(r=this)._channel,o=r.currentUserId,i?(s=i.codec.encodeGetConversationStatus(e),c=new Q(x[x.pullSeAtts],s,o),[4,i.send(c,ti)]):[3,2];case 1:return d=p.sent(),l=d.code,h=d.data,l!==R.SUCCESS?[2,{code:l}]:(a=[],Array.isArray(h)&&h.forEach(function(f){var m=f.conversationType,_=f.targetId,v=f.notificationStatus,T=f.channelId,y=f.isTop,w=f.notificationLevel,L=u._ultraGroupMap[T+"_"+_];m===Y.ULTRA_GROUP?L&&(v!==void 0&&(L.notificationStatus=v),w!==void 0&&(L.notificationLevel=w),w===void 0&&v===void 0||u._ultraGroupManager.addUltraGroupStatus(f),typeof y=="boolean"&&(L.isTop=y)):a.push(f)}),[2,{code:l,data:a}]);case 2:return[2,{code:R.RC_NET_CHANNEL_INVALID}]}})})},t.prototype.batchSetConversationStatus=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h,a,u,p,f=this;return B(this,function(m){switch(m.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeSetConversationStatus(e),c=new Q(Kd,s,i),[4,o.send(c,Xo)]):[3,2];case 1:return d=m.sent(),l=d.code,h=d.data,l===R.SUCCESS?(a=h,u=[],e.forEach(function(_){var v=_.conversationType,T=_.targetId,y=_.notificationStatus,w=_.notificationLevel,L=_.channelId,M=_.isTop;if(v===Y.ULTRA_GROUP){var C=f._ultraGroupMap[L+"_"+T];C&&(y!==void 0&&(C.notificationStatus=y),w!==void 0&&(C.notificationLevel=w),w===void 0&&y===void 0||f._ultraGroupManager.addUltraGroupStatus(C),M!==void 0&&(C.isTop=M),u.push(C))}else f._conversationManager.addStatus(pt(pt({},_),{updatedTime:a.version}),!0)}),u.length>0&&(p=He(u),p=Qn(p),this._watcher.conversation(p)),[2,l]):[2,l];case 2:return[2,R.RC_NET_CHANNEL_INVALID]}})})},t.prototype._joinChrm=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h,a;return B(this,function(u){switch(u.label){case 0:return(o=this._channel)?(s=o.codec.encodeJoinOrQuitChatRoom(),c=new Q(i?xd:kd,s,e),[4,o.send(c,kn)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return d=u.sent(),l=d.code,h=d.data,l===R.SUCCESS&&(a=h.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,r,a),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,r)),[2,l]}})})},t.prototype._rejoinChrm=function(){return V(this,void 0,void 0,function(){var e,r,i,o,s,c;return B(this,function(d){switch(d.label){case 0:for(i in e=this._joinedChrmManager.get(),r=[],e)r.push(i);o=0,d.label=1;case 1:return o<r.length?(s=r[o],[4,this._joinChrm(s,e[s]||10,!0)]):[3,4];case 2:(c=d.sent())===R.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:s,count:e[s]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:s,errorCode:c}}),d.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},t.prototype._pullChrmMsg=function(e,r,i){return r===void 0&&(r=10),i===void 0&&(i=0),V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u,p,f,m,_;return B(this,function(v){switch(v.label){case 0:return this._channel?(o=this._chrmsQueue[e],s=o.pulling,c=o.timestamp,s?[2]:(o.pulling=!0,d=this._channel.codec.encodeChrmSyncMsg(c,r),l=new Q(x[x.chrmPull],d,e),[4,this._channel.send(l,Qe,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return h=v.sent(),a=h.code,u=h.data,o.pulling=!1,a===R.SUCCESS&&u?(p=u.list,f=u.syncTime,m=u.finished,o.timestamp=i?Math.max(f,i):f,o.queue=o.queue.filter(function(T){return T>f}),_=[],p.forEach(function(T){T.sentTime<c||_.push(T)}),this._watcher.batchMessage(_),(!m||o.queue.length>0)&&this._pullChrmMsg(e),[2]):(H.warn("pull chatroom msg failed, code:",a,", data:",u),[2])}})})},t.prototype.joinChatroom=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._joinChrm(e,r,!1)]})})},t.prototype.joinExistChatroom=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._joinChrm(e,r,!0)]})})},t.prototype.quitChatroom=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c;return B(this,function(d){switch(d.label){case 0:return(r=this._channel)?(i=r.codec.encodeJoinOrQuitChatRoom(),o=new Q(Vd,i,e),[4,r.send(o)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return s=d.sent(),(c=s.code)===R.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,c]}})})},t.prototype.getChatroomInfo=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h;return B(this,function(a){switch(a.label){case 0:return(o=this._channel)?(s=o.codec.encodeGetChatRoomInfo(r,i),c=new Q(x[x.queryChrmI],s,e),[4,o.send(c,Jr)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return d=a.sent(),l=d.code,h=d.data,l!==R.SUCCESS?[2,{code:l}]:[2,{code:l,data:h}]}})})},t.prototype.getChatroomHistoryMessages=function(e,r,i,o){return V(this,void 0,void 0,function(){var s,c,d,l,h,a;return B(this,function(u){switch(u.label){case 0:return(s=this._channel)?(c=s.codec.encodeGetHistoryMsg(e,{timestamp:r,count:i,order:o}),d=new Q(Tc,c,e),[4,s.send(d,Xe,{conversation:{targetId:e}})]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return l=u.sent(),h=l.code,a=l.data,h!==R.SUCCESS?[2,{code:h}]:[2,{code:h,data:{list:a.list,hasMore:a.hasMore}}]}})})},t.prototype._modifyChatroomKV=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u;return B(this,function(p){switch(p.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(c=this._chrmEntryHandler.getVersion(e,r.key),r.version=c==null?this.getServerTime():c,d=o.codec.encodeModifyChatRoomKV(e,r,s),l=r.type===Gt.UPDATE?Bd:Fd,h=new Q(l,d,e),[4,o.send(h,kn)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return a=p.sent(),(u=a.code)===R.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[r],syncTime:new Date().getTime()},s),[2,u]):[2,u]}})})},t.prototype._modifyChatroomKVS=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u,p,f,m,_=this;return B(this,function(v){switch(v.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(r.entries.forEach(function(T){var y=_._chrmEntryHandler.getVersion(e,T.key);T.version=y==null?_.getServerTime():y}),c=o.codec.encodeModifyChatRoomKVS(e,r,s),d=r.type===Gt.UPDATE?Hd:$d,l=new Q(d,c,e),[4,o.send(l,Jo)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return h=v.sent(),a=h.code,[R.SUCCESS,R.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(a)!==-1&&(p=[],delete(f=Object.assign({},r)).entries,r.entries.forEach(function(T){p.push(Object.assign({},T,f))}),a===R.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(m=h.data,H.warn("\u8BBE\u7F6E\u5931\u8D25\u7684\u5C5E\u6027\uFF1A",m.errorKeys),u=m.errorKeys,m&&Array.isArray(m.errorKeys)&&m.errorKeys.forEach(function(T){var y=p.findIndex(function(w){return T.key===w.key});y!==-1&&p.splice(y,1)})),H.warn("\u8BBE\u7F6E\u6210\u529F\u7684\u5C5E\u6027\uFF1A",p),this._chrmEntryHandler.setLocal(e,{kvEntries:p,syncTime:new Date().getTime()},s)),[2,{code:a,data:u}]}})})},t.prototype.setChatroomEntry=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=Gt.UPDATE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(e,r)]})})},t.prototype.setChatroomEntries=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=Gt.UPDATE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,r)]})})},t.prototype.forceSetChatroomEntry=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=Gt.UPDATE,r.isOverwrite=!0,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(e,r)]})})},t.prototype.removeChatroomEntry=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=Gt.DELETE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(e,r)]})})},t.prototype.removeChatroomEntries=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=Gt.DELETE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,r)]})})},t.prototype.forceRemoveChatroomEntry=function(e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=Gt.DELETE,r.isOverwrite=!0,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(e,r)]})})},t.prototype.getChatroomEntry=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h;return B(this,function(a){switch(a.label){case 0:return(i=this._chrmEntryHandler.getValue(e,r))?[2,Promise.resolve({code:R.SUCCESS,data:i})]:[3,1];case 1:return(o=this._channel)?(s=o.codec.encodePullChatRoomKV(0),c=new Q(x[x.pullKV],s,e),[4,o.send(c,en)]):[2,Promise.reject({code:R.RC_NET_CHANNEL_INVALID})];case 2:return d=a.sent(),(l=d.data||{})&&l.kvEntries&&l.kvEntries.length&&(h=l.kvEntries.find(function(u){return u.key===r}),h!==void 0)?[2,Promise.resolve({code:R.SUCCESS,data:h==null?void 0:h.value})]:[2,Promise.resolve({code:R.CHATROOM_KEY_NOT_EXIST})]}})})},t.prototype.getAllChatroomEntry=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return(r=this._chrmEntryHandler.getAll(e))&&Object.keys(r).length?[2,Promise.resolve({code:R.SUCCESS,data:r})]:[3,1];case 1:return(i=this._channel)?(o={},s=i.codec.encodePullChatRoomKV(0),c=new Q(x[x.pullKV],s,e),[4,i.send(c,en)]):[2,Promise.reject({code:R.RC_NET_CHANNEL_INVALID})];case 2:return d=h.sent(),(l=d.data||{})&&l.kvEntries&&l.kvEntries.length&&l.kvEntries.forEach(function(a){a.key&&(o[a.key]=a.value||"")}),[2,Promise.resolve({code:R.SUCCESS,data:o})]}})})},t.prototype.pullChatroomEntry=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u,p,f,m;return B(this,function(_){switch(_.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(r||(r=this._pullChatroomEntryTimestamp),c=o.codec.encodePullChatRoomKV(r),d=new Q(x[x.pullKV],c,e),[4,o.send(d,en)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return l=_.sent(),h=l.code,a=l.data,h===R.SUCCESS?(H.info("Pull success ChrmKV, "+JSON.stringify(l)),this._chrmEntryHandler.setLocal(e,a,s),H.info("Save into cache success!"),p=(u=a).kvEntries,f=u.syncTime,this._pullChatroomEntryTimestamp=f||0,m=[],p.length>0&&(p.forEach(function(v){var T=v.key,y=v.value,w=v.type,L=v.timestamp;m.push({key:T,value:y,type:w,timestamp:L,chatroomId:e})}),this._watcher.chatroom({updatedEntries:m})),[2,{code:h,data:a}]):[2,{code:h}]}})})},t.prototype.sendMessage=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u,p,f;return B(this,function(m){switch(m.label){case 0:return this._channel?(i=function(_,v){return _.messageType==="RC:SRSMsg"&&Object.assign(_,{directionalUserIdList:[v]}),_}(i,this.currentUserId),i=this._handleMsgProperties(i,!0),o=!![Y.PRIVATE,Y.GROUP].includes(e)&&i.isStatusMessage,s=o?function(_){var v;return(v={},v[Y.PRIVATE]=x.ppMsgS,v[Y.GROUP]=x.pgMsgS,v)[_]}(e):function(_){var v;return(v={},v[Y.PRIVATE]=x.ppMsgP,v[Y.GROUP]=x.pgMsgP,v[Y.CHATROOM]=x.chatMsg,v[Y.CUSTOMER_SERVICE]=x.pcMsgP,v[Y.RTC_ROOM]=x.prMsgS,v)[_]}(e)||x.ppMsgP,o&&(i.isPersited=!1,i.isCounted=!1),c=this._channel.codec.encodeUpMsg({conversationType:e,targetId:r},i),(d=new qt(x[s],c,r)).setHeaderQos(At.AT_LEAST_ONCE),o?(this._channel.sendOnly(d),[2,{code:R.SUCCESS,data:Zn(e,r,pt({},i),"",0,this.currentUserId)}]):(l=Date.now()-this._localConnectedTime+this._connectedTime,h=Zn(e,r,pt({},i),"",l,this.currentUserId),[4,this._channel.send(d)])):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return a=m.sent(),u=a.code,p=a.data,u!==R.SUCCESS?[2,{code:u,data:h}]:(f=p,this._sendMessageStore.setMessage(f.messageUId,f.timestamp),h.sentTime=f.timestamp,h.messageUId=f.messageUId,this._conversationManager.setConversationCacheByMessage(h,!0),[2,{code:R.SUCCESS,data:h}])}})})},t.prototype.recallMsg=function(e,r,i,o,s){var c;return V(this,void 0,void 0,function(){var d,l,h,a,u,p,f,m,_,v,T,y,w;return B(this,function(L){switch(L.label){case 0:return this._channel?(d=s.user,l=s.extra,h=s.isDelete,a={conversationType:e,targetId:r,messageUId:i,sentTime:o,channelId:s.channelId||"",isDelete:h||!1},d&&(a.user=d),l&&(a.extra=l),u={content:a,messageType:"RC:RcCmd",disableNotification:s==null?void 0:s.disableNotification,pushConfig:s==null?void 0:s.pushConfig,pushContent:((c=s.pushConfig)===null||c===void 0?void 0:c.pushContent)||s.pushContent||"",channelId:s.channelId},p=x[x.recallMsg],f=this._channel.codec.encodeUpMsg({conversationType:e,targetId:r},u),(m=new qt(p,f,this.currentUserId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(m)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return _=L.sent(),v=_.code,T=_.data,v!==R.SUCCESS?[2,{code:v}]:(y=T,e===Y.ULTRA_GROUP?(this._ultraMsgMap[y.messageUId]=y.timestamp,[2,{code:R.SUCCESS}]):(this._sendMessageStore.setMessage(y.messageUId,y.timestamp),w=Zn(e,r,pt(pt({},u),{isPersited:!0}),y.messageUId,y.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(w,!0),[2,{code:R.SUCCESS,data:w}]))}})})},t.prototype.sendReadReceiptMessage=function(e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){switch(c.label){case 0:return this._channel?(o=this._channel.codec.encodeReadReceipt(r,i),s=new Q(x[x.rrMsg],o,e),[4,this._channel.send(s)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return[2,c.sent()]}})})},t.prototype.getMessageReader=function(e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){switch(c.label){case 0:return this._channel?(o=this._channel.codec.encodeMessageReader(r,i),s=new Q(x[x.rrList],o,e),[4,this._channel.send(s,ei)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return[2,c.sent()]}})})},t.prototype.pullUserSettings=function(e){return V(this,void 0,void 0,function(){var r,i;return B(this,function(o){return this._channel?(r=this._channel.codec.encodePullUserSetting(e),i=new Q(x[x.pullUS],r,this.currentUserId),[2,this._channel.send(i,Qr)]):[2,{code:R.RC_NET_CHANNEL_INVALID}]})})},t.prototype.getFileToken=function(e,r,i,o){return V(this,void 0,void 0,function(){var s,c,d,l,h,a;return B(this,function(u){switch(u.label){case 0:return this._channel?(s=o&&o!=="uploads"?r||"":vd(e,r),c=this._channel.codec.encodeGetFileToken(e,s,i||"",o||""),d=new Q(x[x.qnTkn],c,this.currentUserId),[4,this._channel.send(d,$o)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return l=u.sent(),h=l.code,a=l.data,a=Object.assign(a,{fileName:s}),h===R.SUCCESS?[2,{code:h,data:a}]:[2,{code:h}]}})})},t.prototype.getFileUrl=function(e,r,i,o){return V(this,void 0,void 0,function(){var s,c,d,l,h,a,u,p,f;return B(this,function(m){switch(m.label){case 0:return this._channel?(s="",c="",d="",r===Kt.QINIU?(c=Go,d=jo):(c=Ko,d=qo),s=r===Kt.QINIU?x[x.qnUrl]:r===Kt.AWS?x[x.s3Url]:r===Kt.STC?x[x.stcUrl]:x[x.aliUrl],l=this._channel.codec.encodeGetFileUrl(c,e,i,o),h=new Q(s,l,this.currentUserId),[4,this._channel.send(h,d)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return a=m.sent(),u=a.code,p=a.data,f=p,u===R.SUCCESS?[2,{code:u,data:f}]:[2,{code:u}]}})})},t.prototype.disconnect=function(){this._reconnectTimer!==-1&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData()},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,r,i,o,s){this._customMessageType[e]={isPersited:r,isCounted:i,isStatusMessage:s}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeCreateTag([e],r),o=new Q(x[x.addSeTag],i,this.currentUserId),[4,this._channel.send(o,nn)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),c=s.code,d=s.data,c!==R.SUCCESS?[2,{code:c}]:(l=d.version,this._userSettingManager.addTag([pt(pt({},e),{createdTime:l})],l),[2,{code:R.SUCCESS,data:d}])}})})},t.prototype.removeTag=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeRemoveTag([e],r),o=new Q(x[x.delSeTag],i,this.currentUserId),[4,this._channel.send(o,nn)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),c=s.code,d=s.data,c!==R.SUCCESS?[2,{code:c}]:(l=d.version,this._userSettingManager.deleteTag([e],l),[2,{code:R.SUCCESS}])}})})},t.prototype.updateTag=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeCreateTag([e],r),o=new Q(x[x.addSeTag],i,this.currentUserId),[4,this._channel.send(o,nn)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),c=s.code,d=s.data,c!==R.SUCCESS?[2,{code:c}]:(l=d.version,this._userSettingManager.addTag([e],l),[2,{code:R.SUCCESS,data:d}])}})})},t.prototype.getTagList=function(){return V(this,void 0,void 0,function(){var e,r;return B(this,function(i){return e=this._userSettingManager.getTags(),r=this._conversationManager.getConversationListForTag(),e.forEach(function(o){o.conversationCount=r[o.tagId]?r[o.tagId].length:0}),[2,{code:R.SUCCESS,data:e}]})})},t.prototype.addTagForConversations=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d=this;return B(this,function(l){switch(l.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(i=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],r),o=new Q(x[x.addTag],i,this.currentUserId),[4,this._channel.send(o)]):[2,{code:R.TAG_NOT_EXIST}]:[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return(s=l.sent().code)!==R.SUCCESS?[2,{code:s}]:((c={})[e]={},r.forEach(function(h){d._conversationManager.addTagStatus(h.conversationType,h.targetId,c,h.channelId)}),[2,{code:R.SUCCESS}])}})})},t.prototype.removeTagForConversations=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c=this;return B(this,function(d){switch(d.label){case 0:return this._channel?(i=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],r),o=new Q(x[x.delTag],i,this.currentUserId),[4,this._channel.send(o)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return(s=d.sent().code)!==R.SUCCESS?[2,{code:s}]:(r.forEach(function(l){c._conversationManager.deleteTagStatus(l.conversationType,l.targetId,[e],l.channelId)}),[2,{code:R.SUCCESS}])}})})},t.prototype.removeTagsForConversation=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h;return B(this,function(a){switch(a.label){case 0:return this._channel?(i=e.conversationType,o=e.targetId,s=e.channelId,c=r.map(function(u){return{tagId:u}}),d=this._channel.codec.encodeUpdateConversationTag(c,[e]),l=new Q(x[x.delTag],d,this.currentUserId),[4,this._channel.send(l)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return(h=a.sent().code)!==R.SUCCESS?[2,{code:h}]:(this._conversationManager.deleteTagStatus(i,o,r,s),[2,{code:R.SUCCESS}])}})})},t.prototype.getConversationListByTag=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u,p;return B(this,function(f){switch(f.label){case 0:return s=(o=this).currentUserId,(c=o._channel)?(d=c.codec.encodeOldConversationList({count:i,type:Y.PRIVATE,startTime:r}),l=new Q(na,d,s),[4,c.send(l,tn,{currentUserId:s,connectedTime:c.connectedTime})]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return h=f.sent(),a=h.code,u=h.data,p=this._conversationHasTagFilter(e,u==null?void 0:u.list),H.info("GetConversationListByTag",p),a!==R.SUCCESS?[2,{code:a}]:[2,{code:a,data:p}]}})})},t.prototype._conversationHasTagFilter=function(e,r){var i=this,o=[],s=[];function c(d,l){return d.latestMessage&&l.latestMessage?d.latestMessage.sentTime-l.latestMessage.sentTime:0}return r.forEach(function(d){var l=d.conversationType,h=d.targetId,a=d.channelId,u=i._conversationManager.get(l,h,a),p=u.hasMentioned,f=u.mentionedInfo,m=u.lastUnreadTime,_=u.notificationStatus,v=u.isTop,T=u.tags,y=u.unreadMessageCount,w=T&&T[e];if(w){var L=pt(pt({},d),{hasMentioned:p,mentionedInfo:f,lastUnreadTime:m,notificationStatus:_,isTop:v,unreadMessageCount:y});w.isTop?o.push(pt(pt({},L),{isTopInTag:!0})):s.push(pt(pt({},L),{isTopInTag:!1}))}}),Pe(Pe([],o.sort(c),!0),s.sort(c),!0)},t.prototype.getUnreadCountByTag=function(e,r){return V(this,void 0,void 0,function(){var i;return B(this,function(o){return this._channel?(i=this._conversationManager.getUnreadCountByTag(e,r),[2,{code:R.SUCCESS,data:i}]):[2,{code:R.RC_NET_CHANNEL_INVALID}]})})},t.prototype.setConversationStatusInTag=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u,p,f;return B(this,function(m){switch(m.label){case 0:return this._channel?(o=r.targetId,s=r.conversationType,c=r.channelId,d=i.isTop,l=[{tagId:e,isTop:d}],(h=this._conversationManager.get(s,o,c)).tags&&Object.hasOwnProperty.call(h.tags,e)?(a=this._channel.codec.encodeUpdateConversationTag(l,[r]),u=new Q(x[x.addTag],a,this.currentUserId),[4,this._channel.send(u)]):[2,{code:R.NO_TAG_IN_CONVER}]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return(p=m.sent().code)!==R.SUCCESS?[2,{code:p}]:((f={})[e]={},d&&(f[e].isTop=!0),this._conversationManager.addTagStatus(s,o,f,c),[2,{code:R.SUCCESS}])}})})},t.prototype.getTagsForConversation=function(e){var r;return V(this,void 0,void 0,function(){var i,o,s,c;return B(this,function(d){if(!this._channel)return[2,{code:R.RC_NET_CHANNEL_INVALID}];if(i=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),o=this._userSettingManager.getTagsInfo(),s=[],i.tags)for(c in i.tags)s.push({tagId:c,tagName:(r=o[c])===null||r===void 0?void 0:r.tagName});return[2,{code:R.SUCCESS,data:s}]})})},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:R.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:R.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var r,i;return i=e.conversationType===Y.ULTRA_GROUP?((r=this._ultraGroupMap[e.channelId+"_"+e.targetId])===null||r===void 0?void 0:r.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId),Promise.resolve({code:R.SUCCESS,data:i})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:R.SUCCESS,data:e})},t.prototype.getUltraGroupList=function(){return V(this,void 0,void 0,function(){var e,r;return B(this,function(i){return this._isUltraGroupListExist?(e=Object.values(this._ultraGroupMap),e=Qn(e),r=He(e),[2,{code:R.SUCCESS,data:r}]):[2,{code:R.METHOD_NOT_AVAILABLE}]})})},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:R.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),r=[];return e.forEach(function(i){i.notificationStatus===Yt.OPEN&&r.push({conversationType:Y.ULTRA_GROUP,targetId:i.targetId,channelId:i.channelId})}),Promise.resolve({code:R.SUCCESS,data:r})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:R.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),r=[];return e.forEach(function(i){i.isTop===!0&&r.push({conversationType:Y.ULTRA_GROUP,targetId:i.targetId,channelId:i.channelId})}),Promise.resolve({code:R.SUCCESS,data:r})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:R.METHOD_NOT_AVAILABLE});var r=0;for(var i in this._ultraGroupMap)i.match(/_.*/g)[0].substring(1)===e&&(r+=this._ultraGroupMap[i].unreadMentionedCount);return Promise.resolve({code:R.SUCCESS,data:r})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e){var r=0;for(var i in this._ultraGroupMap){var o=this._ultraGroupMap[i];o.targetId===e&&(r+=o.unreadMessageCount||0)}return Promise.resolve({code:R.SUCCESS,data:r})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(e===void 0&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:R.METHOD_NOT_AVAILABLE});var r=0;for(var i in this._ultraGroupMap)r+=e?this._ultraGroupMap[i].unreadMentionedCount||0:this._ultraGroupMap[i].unreadMessageCount||0;return Promise.resolve({code:R.SUCCESS,data:r})},t.prototype.clearUltraUnreadcount=function(e,r){return r===void 0&&(r=""),V(this,void 0,void 0,function(){var i,o,s,c,d;return B(this,function(l){switch(l.label){case 0:return this._isUltraGroupListExist?this._channel?this._status!==Z.CONNECTED?[2,R.RC_NET_UNAVAILABLE]:(i=Date.now(),o=this._channel.codec.encodeClearUnreadCount({conversationType:Y.ULTRA_GROUP,targetId:e,channelId:r},{timestamp:i}),(s=new qt(x[x.updUgRTime],o,this.currentUserId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(s)]):[2,R.RC_NET_CHANNEL_INVALID]:[2,Promise.resolve(R.METHOD_NOT_AVAILABLE)];case 1:return(c=l.sent().code)===R.SUCCESS&&(d=this._ultraGroupMap[r+"_"+e])&&(d.unreadMessageCount=0,d.unreadMentionedCount=0,d.lastReadTime=i),[2,c]}})})},t.prototype._getUltraGroupList=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h,a,u,p,f,m,_=this;return B(this,function(v){switch(v.label){case 0:return this._channel&&this._status===Z.CONNECTED?(r=this._channel.codec.encodeUltraGroup(e,!1),i=new Q(x[x.pullUgSes],r,this.currentUserId),[4,this._channel.send(i,tn,{currentUserId:this.currentUserId,conversationType:Y.ULTRA_GROUP})]):[2];case 1:return o=v.sent(),s=o.code,c=o.data,s===R.SUCCESS&&c?(l=(c==null?void 0:c.list)||[],h=c==null?void 0:c.isFinished,l.forEach(function(T){T.notificationStatus=Yt.CLOSE,T.notificationLevel=ce.NOT_SET,T.isTop=!1,_._ultraGroupMap[T.channelId+"_"+T.targetId]=T,_._ultraGroupManager.addUltraGroupStatus(T)}),h!==!1?[3,2]:(a=l.length>0&&l[l.length-1].versionTime||0,this._getUltraGroupList(a),[3,4])):(H.warn("pull super conversation failed, code:",s,", data:",c,"retrying..."),d=setTimeout(function(){_._firstPullUltraGroupTime=e,_._getUltraGroupList(e),clearTimeout(d)},3e3),[2]);case 2:return[4,this.pullConversationStatus(this._firstPullUltraGroupTime)];case 3:u=v.sent(),p=u.code,f=u.data,p!==R.SUCCESS&&H.warn("pullConversationStatus fail code: ".concat(p,", data: ").concat(f)),m=Object.values(this._ultraGroupMap),m=Qn(m),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(He(m)),this._firstPullUltraGroupTime===0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),v.label=4;case 4:return[2]}})})},t.prototype._startUltraSyncInterval=function(){var e=this,r=function(){e._ultraGroupTimer=setTimeout(function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),r()},3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),r()},t.prototype._stopUltraSyncInterval=function(){this._ultraGroupTimer!==-1&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._syncUltraMsg=function(e){var r;return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u,p,f,m,_=this;return B(this,function(v){switch(v.label){case 0:return this._channel&&this._status===Z.CONNECTED?this._isUltraPulling?[2]:(H.info("start pull ultra msg, time: ".concat(e)),this._isUltraPulling=!0,i=this._channel.codec.encodeSuperSyncMsg(e),o=new Q(x[x.pullUgMsg],i,this.currentUserId),[4,this._channel.send(o,Qe,{currentUserId:this.currentUserId,conversation:{conversationType:Y.ULTRA_GROUP}})]):[2];case 1:if(s=v.sent(),c=s.code,d=s.data,H.info("end pull ultra msg, code: ".concat(c,", syncTime: ").concat(d==null?void 0:d.syncTime,", count: ").concat((r=d==null?void 0:d.list)===null||r===void 0?void 0:r.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),c!==R.SUCCESS||!d)return H.warn("sync super message failed, code:",c,", data:",d),this._isUltraPulling=!1,[2];if(this._isUltraPulling=!1,l=d.list,h=d.syncTime,a=d.finished,!this._isUltraGroupListExist)return H.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=h,[2];for(m in u={},p=[],l.forEach(function(T){var y,w,L,M=T.targetId,C=T.content,A=T.messageType,F=T.messageUId,G=T.channelId,E=T.isCounted;if(_._ultraMsgMap[F])delete _._ultraMsgMap[F];else{var S=0;(((y=C==null?void 0:C.mentionedInfo)===null||y===void 0?void 0:y.type)===qr.ALL||((L=(w=C==null?void 0:C.mentionedInfo)===null||w===void 0?void 0:w.userIdList)===null||L===void 0?void 0:L.includes(_.currentUserId)))&&(S=1);var I=_._ultraGroupMap[G+"_"+M];if(I)E&&(A===Ut.RECALL?I.unreadMessageCount>0&&(I.unreadMessageCount-=1):(I.unreadMessageCount+=1,I.unreadMentionedCount+=S)),I.versionTime=h,I.latestMessage=T,u[G+"_"+M]=I,_._ultraGroupManager.addUltraGroupStatus(I);else{var N={conversationType:Y.ULTRA_GROUP,targetId:M,channelId:G,unreadMessageCount:1,unreadMentionedCount:S,versionTime:h,latestMessage:T,notificationStatus:Yt.CLOSE,notificationLevel:ce.NOT_SET,isTop:!1};_._ultraGroupMap[G+"_"+M]=N,u[G+"_"+M]=N,_._ultraGroupManager.addUltraGroupStatus(N)}p.push(T)}}),Object.keys(u).length>0&&(H.info("notice ultragroups"),f=Object.values(u),f=Qn(f),this._watcher.conversation(He(f))),H.info("notice ultragroup message"),this._watcher.batchMessage(p),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter(function(T){return T>h}),this._ultraMsgMap)this._ultraMsgMap[m]<h&&delete this._ultraMsgMap[m];return a===!1?this._syncUltraMsg(h):l&&l.length>0&&(this._lastSyncUltraMsgTimeStamp=h),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),[2]}})})},t.prototype.sendUltraMessage=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u,p;return B(this,function(f){switch(f.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:(r.messageType==="RC:SRSMsg"&&H.warn("ultra group -> direction message convert to message"),r=this._handleMsgProperties(r,!0),i=this._channel.codec.encodeUpMsg({conversationType:Y.ULTRA_GROUP,targetId:e},r),(o=new qt(x[x.ugMsg],i,e)).setHeaderQos(At.AT_LEAST_ONCE),s=Date.now()-this._localConnectedTime+this._connectedTime,c=Zn(Y.ULTRA_GROUP,e,pt({},r),"",s,this.currentUserId),[4,this._channel.send(o)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return d=f.sent(),l=d.code,h=d.data,l!==R.SUCCESS?[2,{code:l,data:c}]:(a=h,c.sentTime=a.timestamp,c.messageUId=a.messageUId,this._ultraMsgMap[a.messageUId]=a.timestamp,u=r.channelId||"",(p=this._ultraGroupMap[u+"_"+e])?p.latestMessage=c:(p={conversationType:Y.ULTRA_GROUP,targetId:e,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:Yt.CLOSE,notificationLevel:ce.NOT_SET,isTop:!1},this._ultraGroupMap[u+"_"+e]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(He([p])),[2,{code:l,data:c}])}})})},t.prototype.sendUltraGroupTypingStatus=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:(i=e.conversationType,o=e.channelId,s=e.targetId,c=this._channel.codec.encodeOperateStatus(s,i,o||"",r||0),(d=new qt(x[x.operate],c,s)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(d)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return(l=h.sent().code)!==R.SUCCESS?[2,{code:l,msg:R[l]}]:[2,{code:l}]}})})},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:R.MSG_LIMIT_ERROR}]:(r={},e.messages.forEach(function(a){r[a.messageUId]=void 0}),i=this._channel.codec.encodeMsgQuery(e),(o=new Q(x[x.qryMsg],i,this.currentUserId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(o,xn)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),c=s.code,d=s.data,c!==R.SUCCESS?[2,{code:c,msg:R[c]}]:(l=(d||{}).list,Array.isArray(l)&&l.forEach(function(a){var u=a.messageUId;r[u]=a}),[2,{code:0,data:r}])}})})},t.prototype._pullOperateStatusNotify=function(e){if(this._channel){var r=this._channel.codec.decodeByPBName(e.data,ri),i=r.conversationType,o=r.info,s=r.summary;H.info("s_opNtf -> type: ".concat(i,", info: ").concat(o,", summary: ").concat(s)),this._watcher.operateStatus(r)}},t.prototype.expandUltraMessage=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d;return B(this,function(l){switch(l.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:(r=this._channel.codec.encodeExpandUltraMessage(e,this.currentUserId),(i=new qt(x[x.upMsgEx],r,e.targetId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(i)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,c=o.data,s!==R.SUCCESS?[2,{code:s,msg:R[s]}]:(d=c,this._ultraMsgMap[d.messageUId]=d.timestamp,[2,{code:s}])}})})},t.prototype.modifyMessage=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d;return B(this,function(l){switch(l.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:(r=this._channel.codec.encodemodifyMessage(e,this.currentUserId),(i=new qt(x[x.modifyMsg],r,e.targetId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(i)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,c=o.data,s!==R.SUCCESS?[2,{code:s,msg:R[s]}]:(d=c,this._ultraMsgMap[d.messageUId]=d.timestamp,[2,{code:s}])}})})},t.prototype._pullUltraChangeMessageList=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h,a,u,p,f,m,_,v,T,y,w=this;return B(this,function(L){switch(L.label){case 0:return this._channel?this._status!==Z.CONNECTED||this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,r=this._channel.codec.encodeQueryMsgChange(e),(i=new qt(x[x.qryMsgChange],r,this.currentUserId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(i,ni)]):[2];case 1:if(o=L.sent(),s=o.code,c=o.data,this._isPullingUltraChangeMessage=!1,s!==R.SUCCESS)return[2];for(_ in l=(d=c||{}).hasNext,h=d.list,a=(c==null?void 0:c.syncTime)||0,u=[],p={},Array.isArray(h)&&h.forEach(function(M){var C=M,A=C.targetId,F=C.conversationType,G=C.sendTime,E=C.messageUId,S=C.changeType,I=C.operatorId,N=M.channelId||"",b=F+"_"+A,k=E+"_"+N+"_"+G,U=p[b];if(U)U.add(k);else{var $=new Set([k]);p[b]=$}S!==3?w._ultraMsgChangeMap[E]=S:u.push({targetId:A,conversationType:F,sendTime:G,messageUId:E,senderUserId:I,channelId:N})}),Array.isArray(u)&&u.length>0&&this._watcher.ultraGroupMessageRecalled(u),f=function(M){var C=M.split("_"),A=C.shift(),F=C.join("_"),G=p[M],E=[];G.forEach(function(I){var N=I.split("_"),b=N[0],k=N[1],U=N[2];E.push({sendTime:Number(U),messageUId:b,channelId:k})});var S={targetId:F,conversationType:Number(A),messages:E};m._pullUltraMessageList(S)},m=this,p)f(_);for(T in v=this._pullUltraChangeMessageQue.filter(function(M){return M>a}),this._pullUltraChangeMessageQue.length=0,(y=this._pullUltraChangeMessageQue).push.apply(y,v),this._ultraMsgMap)this._ultraMsgMap[T]<a&&delete this._ultraMsgMap[T];return l?this._pullUltraChangeMessageList(a):this._lastPullingUltraChangeMessageTime=a,[2]}})})},t.prototype._pullUltraMessageList=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h,a=this;return B(this,function(u){switch(u.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:(r=this._channel.codec.encodeMsgQuery(e),(i=new Q(x[x.qryMsg],r,this.currentUserId)).setHeaderQos(At.AT_LEAST_ONCE),[4,this._channel.send(i,xn)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return o=u.sent(),s=o.code,c=o.data,s!==R.SUCCESS?[2,{code:s,msg:R[s]}]:(d=(c||{}).list,l=[],h=[],Array.isArray(d)&&d.forEach(function(p){var f=p.targetId,m=p.channelId,_=p.messageUId,v=a._ultraGroupMap[m+"_"+f];v&&v.latestMessage.messageUId===p.messageUId&&(v.latestMessage=p);var T=a._ultraMsgChangeMap[_+""];T===1?l.push(p):T===2&&h.push(p)}),l.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(l||[]),h.length>0&&this._watcher.ultraGroupMessageModified(h||[]),[2])}})})},t.prototype.getUltraHistoryMsg=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d;return B(this,function(l){switch(l.label){case 0:return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:(i=this._channel.codec.encodeGetHistoryMsg(e,r),o=new Q(x[x.qryUgMsg],i,this.currentUserId),[4,this._channel.send(o,Xe,{currentUserId:this.currentUserId,conversation:{conversationType:Y.ULTRA_GROUP,targetId:e}})]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return s=l.sent(),c=s.code,d=s.data,c===R.SUCCESS&&d?[2,{code:c,data:d}]:(H.warn("get super history message failed, code:",c,", data:",d),[2,{code:c}])}})})},t.prototype.searchUltraGroupMessages=function(e){return V(this,void 0,void 0,function(){return B(this,function(r){return this._channel?this._status!==Z.CONNECTED?[2,{code:R.RC_NET_UNAVAILABLE}]:[2,{code:R.SUCCESS}]:[2,{code:R.RC_NET_CHANNEL_INVALID}]})})},t.prototype.getAllConversationState=function(){return Promise.resolve({code:R.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.joinRTCRoom=function(e,r,i,o,s,c){return V(this,void 0,void 0,function(){var d,l;return B(this,function(h){return this._channel?(d=this._channel.codec.encodeJoinRTCRoom(r,i,o,s,c),l=new Q(x[x.rtcRJoin_data],d,e),[2,this._channel.send(l,Ae)]):[2,{code:R.RC_NET_CHANNEL_INVALID}]})})},t.prototype.quitRTCRoom=function(e){return V(this,void 0,void 0,function(){var r,i;return B(this,function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeQuitRTCRoom(),i=new Q(x[x.rtcRExit],r,e),[4,this._channel.send(i)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}})})},t.prototype.rtcPing=function(e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){switch(c.label){case 0:return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new Q(x[x.rtcPing],o,e),[4,this._channel.send(s)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}})})},t.prototype.getRTCRoomInfo=function(e){return V(this,void 0,void 0,function(){var r,i;return B(this,function(o){return this._channel?(r=this._channel.codec.encodeGetRTCRoomInfo(),i=new Q(x[x.rtcRInfo],r,e),[2,this._channel.send(i,sc)]):[2,{code:R.RC_NET_CHANNEL_INVALID}]})})},t.prototype.getRTCUserInfoList=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c;return B(this,function(d){switch(d.label){case 0:return this._channel?(r=this._channel.codec.encodeGetRTCRoomInfo(),i=new Q(x[x.rtcUData],r,e),[4,this._channel.send(i,Ae)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return o=d.sent(),s=o.code,c=o.data,[2,{code:s,data:c&&{users:c.users}}]}})})},t.prototype.setRTCUserInfo=function(e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){switch(c.label){case 0:return this._channel?(o=this._channel.codec.encodeSetRTCUserInfo(r,i),s=new Q(x[x.rtcUPut],o,e),[4,this._channel.send(s)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}})})},t.prototype.removeRTCUserInfo=function(e,r){return V(this,void 0,void 0,function(){var i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(i=this._channel.codec.encodeRemoveRTCUserInfo(r),o=new qt(x[x.rtcUDel],i,e),[4,this._channel.send(o)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}})})},t.prototype.setRTCData=function(e,r,i,o,s,c){return V(this,void 0,void 0,function(){var d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(d=this._channel.codec.encodeSetRTCData(r,i,o,s,c),l=new qt(x[x.rtcSetData],d,e),[4,this._channel.send(l)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,h.sent().code]}})})},t.prototype.setRTCTotalRes=function(e,r,i,o,s){return V(this,void 0,void 0,function(){var c,d;return B(this,function(l){switch(l.label){case 0:return this._channel?(c=this._channel.codec.encodeUserSetRTCData(r,i,o,s),d=new Q(x[x.userSetData],c,e),[4,this._channel.send(d)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,l.sent().code]}})})},t.prototype.setRTCCDNUris=function(e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){switch(c.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCCDNUris(r,i),s=new Q(x[x.userSetData],o,e),[4,this._channel.send(s)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}})})},t.prototype.getRTCData=function(e,r,i,o){if(!this._channel)return Promise.resolve({code:R.RC_NET_CHANNEL_INVALID});var s=this._channel.codec.encodeGetRTCData(r,i,o),c=new Q(x[x.rtcQryData],s,e);return this._channel.send(c,Zr)},t.prototype.removeRTCData=function(e,r,i,o,s){return V(this,void 0,void 0,function(){var c,d;return B(this,function(l){switch(l.label){case 0:return this._channel?(c=this._channel.codec.encodeRemoveRTCData(r,i,o,s),d=new qt(x[x.rtcDelData],c,e),[4,this._channel.send(d)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,l.sent().code]}})})},t.prototype.setRTCOutData=function(e,r,i,o){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,r){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(c){return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new Q(x[x.rtcToken],o,e),[2,this._channel.send(s,Wr)]):[2,{code:R.RC_NET_CHANNEL_INVALID}]})})},t.prototype.setRTCState=function(e,r){return V(this,void 0,void 0,function(){var i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(i=this._channel.codec.encodeSetRTCState(r),o=new Q(x[x.rtcUserState],i,e),[4,this._channel.send(o)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}})})},t.prototype.getRTCUserInfo=function(e){return V(this,void 0,void 0,function(){return B(this,function(r){throw new Error("Method not implemented.")})})},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:R.RC_NET_CHANNEL_INVALID});var r=this._channel.codec.encodeGetRTCRoomInfo(),i=new Q(x[x.rtcUList],r,e);return this._channel.send(i,Ae)},t.prototype.joinLivingRoomAsAudience=function(e,r,i){return r===void 0&&(r=Vt.LIVE),V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u;return B(this,function(p){switch(p.label){case 0:return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new Q(x[x.viewerJoinR],o,e),[4,this._channel.send(s,gc)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return c=p.sent(),d=c.code,l=c.data,d!==R.SUCCESS?[2,{code:d}]:(a=(h=l).rtcToken,u=h.entries,[2,{code:d,data:{token:a,kvEntries:u}}])}})})},t.prototype.quitLivingRoomAsAudience=function(e){return V(this,void 0,void 0,function(){var r,i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeQuitRTCRoom(),i=new Q(x[x.viewerExitR],r,e),[4,this._channel.send(i)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},t.prototype.rtcIdentityChange=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(o=this._channel.codec.encodeIdentityChangeInfo(r,i),s=new Q(x[x.rtcIdentityChange],o,e),[4,this._channel.send(s,Ae)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return c=h.sent(),d=c.code,l=c.data,d!==R.SUCCESS?[2,{code:d}]:[2,{code:d,data:l}]}})})},t.prototype.pullRTCRoomEntry=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h,a,u;return B(this,function(p){switch(p.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(H.info("audience in room start pull KV"),c=o.codec.encodePullRTCRoomKV(e,0),d=new Q(x[x.rtcPullKv],c,s),[4,o.send(d,ii)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return l=p.sent(),h=l.code,a=l.data,H.info("audience in room end pull KV, code: ".concat(h,", data: ").concat(JSON.stringify(a||{}))),h===R.SUCCESS?(u=a.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:h,data:a}]):[2,{code:h}]}})})},t.prototype.getRTCJoinedUserInfo=function(e){return V(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h;return B(this,function(a){switch(a.label){case 0:return i=(r=this)._channel,o=r.currentUserId,i?(s=i.codec.encodeQueryUserJoinedInfo(e),c=new Q(x[x.rtcQueryJoined],s,o),[4,i.send(c,oi)]):[2,{code:R.RC_NET_CHANNEL_INVALID}];case 1:return d=a.sent(),l=d.code,h=d.data,l===R.SUCCESS?[2,{code:l,data:h}]:[2,{code:l}]}})})},t.prototype.getDeviceId=function(){return Di(this.runtime)},t.prototype.requestRoomPK=function(e){return V(this,void 0,void 0,function(){var r,i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeRequestRoomPK(e),i=new Q(x[x.rtcInvite],r,e.roomId),[4,this._channel.send(i)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},t.prototype.cancelRoomPK=function(e){return V(this,void 0,void 0,function(){var r,i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeCancelRoomPK(e),i=new Q(x[x.rtcCancelInvite],r,e.roomId),[4,this._channel.send(i)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},t.prototype.responseRoomPK=function(e){return V(this,void 0,void 0,function(){var r,i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeResponseRoomPK(e),i=new Q(x[x.rtcInviteAnswer],r,e.roomId),[4,this._channel.send(i)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},t.prototype.endRoomPK=function(e){return V(this,void 0,void 0,function(){var r,i,o;return B(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeEndRoomPK(e),i=new Q(x[x.rtcEndInvite],r,e.roomId),[4,this._channel.send(i)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},t.prototype.bindRTCRoomForChatroom=function(e){return V(this,void 0,void 0,function(){var r,i,o,s;return B(this,function(c){switch(c.label){case 0:return this._channel?(r=e.chatRoomId,i=this._channel.codec.encodebindRTCRoomForChatroom(e),o=new Q(x[x.setRtcRoomId],i,r),[4,this._channel.send(o)]):[2,R.RC_NET_CHANNEL_INVALID];case 1:return s=c.sent(),[2,s.code]}})})},t.prototype.callExtra=function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return Promise.resolve({code:R.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,r){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,r){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=function(e,r,i){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,r,i,o,s){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,r,i){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,r,i){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,r,i){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,r,i,o){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,r,i,o,s,c){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,r){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,r){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,r){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,r,i,o){throw new Error("Method not implemented.")},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._isUltraGroupListExist?(o=this._channel)?(s=o.codec.encodeSetUltraGroupDefaultNotificationLevel(r,i),c=new Q(x[x.ugUnpushSet],s,e),[4,o.send(c)]):[3,2]:[2,Promise.resolve({code:R.METHOD_NOT_AVAILABLE})];case 1:return d=h.sent(),l=d.code,R.SUCCESS,[2,{code:l}];case 2:return[2,{code:R.RC_NET_CHANNEL_INVALID}]}})})},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,r){return V(this,void 0,void 0,function(){var i,o,s,c,d,l,h;return B(this,function(a){switch(a.label){case 0:return this._isUltraGroupListExist?(i=this._channel)?(o=i.codec.encodeGetUltraGroupDefaultNotificationLevel(r),s=new Q(x[x.ugUnpushQuery],o,e),[4,i.send(s,ns)]):[3,2]:[2,Promise.resolve({code:R.METHOD_NOT_AVAILABLE})];case 1:return c=a.sent(),d=c.code,l=c.data,d===R.SUCCESS&&l?(h=l.unpushLevel,[2,{code:d,data:h}]):[2,{code:d}];case 2:return[2,{code:R.RC_NET_CHANNEL_INVALID}]}})})},t.prototype.getConversationNotificationLevel=function(e,r,i){if(!this._isUltraGroupListExist&&e===Y.ULTRA_GROUP)return Promise.resolve({code:R.METHOD_NOT_AVAILABLE});var o;if(!(o=e===Y.ULTRA_GROUP?this._ultraGroupManager.get(Y.ULTRA_GROUP,r,i):this._conversationManager.get(e,r,i)))return Promise.resolve({code:R.SUCCESS,data:ce.NOT_SET});var s=o.notificationLevel;return ct(o.notificationLevel)&&!ct(o.notificationStatus)&&(s=Yt.OPEN===o.notificationStatus?1:0),Promise.resolve({code:R.SUCCESS,data:s})},t.prototype.getConversationNotificationStatus=function(e,r,i){var o;return(o=e===Y.ULTRA_GROUP?this._ultraGroupManager.get(Y.ULTRA_GROUP,r,i):this._conversationManager.get(e,r,i))?Promise.resolve({code:R.SUCCESS,data:o.notificationStatus}):Promise.resolve({code:R.SUCCESS,data:Yt.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,r,i,o,s,c){return this.getHistoryMessage(e,r,i,o,s,c)},t}(tl),wc=function(){function n(t){this._context=t}return n.prototype.__getContext=function(){return this._context},n.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},n.prototype.getCoreVersion=function(){return this._context.coreVersion},n.prototype.getAPIVersion=function(){return this._context.apiVersion},n.prototype.getAppkey=function(){return this._context.appkey},n.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},n.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},n.prototype.getDeviceId=function(){return this._context.getDeviceId()},n.prototype.sendMessage=function(t,e,r){return this._context.sendMessage(t,e,r)},n.prototype.registerMessageType=function(t,e,r,i){i===void 0&&(i=[]),this._context.registerMessageType(t,e,r,i)},n.prototype.getServerTime=function(){return this._context.getServerTime()},n.prototype.getRTCJoinedUserInfo=function(t){return this._context.getRTCJoinedUserInfo(t)},n}(),yl=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return It(t,n),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,r,i,o,s,c){return this._context.joinRTCRoom(e,r,i,o,s,c)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,r,i){return this._context.rtcPing(e,r,i)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,r,i){return this._context.setRTCUserInfo(e,r,i)},t.prototype.removeRTCUserInfo=function(e,r){return this._context.removeRTCUserInfo(e,r)},t.prototype.setRTCData=function(e,r,i,o,s,c){return this._context.setRTCData(e,r,i,o,s,c)},t.prototype.setRTCTotalRes=function(e,r,i,o,s){return this._context.setRTCTotalRes(e,r,i,o,s)},t.prototype.setRTCCDNUris=function(e,r,i){return this._context.setRTCCDNUris(e,r,i)},t.prototype.getRTCData=function(e,r,i,o){return this._context.getRTCData(e,r,i,o)},t.prototype.removeRTCData=function(e,r,i,o,s){return this._context.removeRTCData(e,r,i,o,s)},t.prototype.setRTCOutData=function(e,r,i,o){return this._context.setRTCOutData(e,r,i,o)},t.prototype.getRTCOutData=function(e,r){return this._context.getRTCOutData(e,r)},t.prototype.getRTCToken=function(e,r,i){return this._context.getRTCToken(e,r,i)},t.prototype.setRTCState=function(e,r){return this._context.setRTCState(e,r)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,r,i){return this._context.joinLivingRoomAsAudience(e,r,i)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,r,i){return this._context.rtcIdentityChange(e,r,i)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(wc);function Xn(n){return Object.assign({},n)}var da,El=function(){function n(t,e){var r;this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.3.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=Z.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},e),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this.apiPKGName=this._options.apiPKGName||"",this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter(function(o){return/^https?:\/\//.test(o)}),this._options.navigators=this._options.navigators.map(function(o){return o.replace(/\/$/g,"")}),this._options.navigators.length===0&&(r=this._options.navigators).push.apply(r,cd),H.updateStatisticsBaseData({bundleId:this.apiPKGName}),H.initReportLog({runtime:this._runtime,logSwitch:1,logPolicy:JSON.parse("{}"),appkey:this.appkey,version:this.apiVersion});var i={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this)};this._engine=Ws()?new RCCppEngine(t,i,this._options):new Tl(t,i,this._options)}return n.init=function(t,e){return H.setLogLevel(e.logLevel),H.setLogStdout(e.logStdout),(e.indexDBSwitch||ct(e.indexDBSwitch))&&yo.init(),H.debug("APIContext.init =>",e.appkey,e.navigators),this._context?(H.error("Repeat initialize!"),this._context):(H.warn("RCEngine Commit:","55870c2344845f2c11a49f895f963e33d57c6123"),this._context=new n(t,e),H.__insertLogIntoDatabase(),this._context)},n.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},n.prototype.install=function(t,e){if(this._pluginInstanseMap[t.tag])return H.warn("Repeat install plugin: ".concat(t.tag)),this._pluginInstanseMap[t.tag];var r=t.tag==="RCRTC"?new yl(this):new wc(this),i=null;try{if(!t.verify(this._runtime))return null;i=t.setup(r,this._runtime,e)}catch(o){H.error(`install plugin error!
- `,o)}return["RCRTC","RCCall"].includes(t.tag)&&t.version&&t.name&&(this._versionInfo[t.name]=t.version),i&&this._pluginContextQueue.push(r),i&&(this._pluginInstanseMap[t.tag]=i),i},n.prototype._handleRedirect=function(){return V(this,void 0,void 0,function(){var t,e=this;return B(this,function(r){switch(r.label){case 0:return H.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return(t=r.sent().code)!==R.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(t),setTimeout(function(){e._handleRedirect()},5e3)),[2]}})})},n.prototype._connectionStatusListener=function(t){var e;return V(this,void 0,void 0,function(){return B(this,function(r){return[Z.REDIRECT,Z.BLOCKED,Z.KICKED_OFFLINE_BY_OTHER_CLIENT,Z.DISCONNECT_BY_SERVER,Z.DISCONNECTED,Z.NETWORK_UNAVAILABLE].includes(t)&&(H.setStatisticsData(kt.IM_CONNECTION_DURATION,{endTime:new Date().getTime(),code:t}),function(i){V(this,void 0,void 0,function(){var o,s,c,d,l,h,a,u,p,f;return B(this,function(m){switch(m.label){case 0:o=kt.IM_CONNECTION_DURATION,s=H.getStatisticsBaseData().bundleId,c=H.getStatisticsData(o),d=c.startTime,l=c.endTime,h=c.code,a=Zt.UNKONWN,m.label=1;case 1:return m.trys.push([1,3,,4]),[4,i.getNetworkType()];case 2:return a=m.sent(),[3,4];case 3:return u=m.sent(),H.debug(u.message),[3,4];case 4:return p=0,mt(d)&&mt(l)&&l>d&&d&&(p=l-d),f={bid:s,cod:h,dur:p,net:a},H.reportStatisticsLog(o,f),[2]}})})}(this._runtime)),t===Z.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(t),this._handleRedirect()):t===Z.BLOCKED||t===Z.KICKED_OFFLINE_BY_OTHER_CLIENT||t===Z.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(t)):t===Z.CONNECTING?this._handleConnecting():t===Z.CONNECTED?this._handleConnected():t===Z.DISCONNECTED?this._handleDisconnect(t):t===Z.NETWORK_UNAVAILABLE&&this._handleSuspend(t),this._connectionStatus=t,((e=this._watcher.rtcInnerWatcher)===null||e===void 0?void 0:e.status)&&this._watcher.rtcInnerWatcher.status(t),this._pluginContextQueue.forEach(function(i){i.onconnectionstatechange&&i.onconnectionstatechange(t)}),this._watcher.connectionState&&this._watcher.connectionState(t),[2]})})},n.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},n.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},n.prototype._handleDisconnect=function(t){this._watcher.onDisconnect&&this._watcher.onDisconnect(t)},n.prototype._handleSuspend=function(t){this._watcher.onSuspend&&this._watcher.onSuspend(t)},n.prototype._messageReceiver=function(t,e,r){var i,o,s;if((t.conversationType===Y.RTC_ROOM||Object.prototype.hasOwnProperty.call(gd,t.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Xn(t));else if(["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(t.messageType)===-1||typeof this._watcher.chatroomState!="function"){if(t.messageType!=="RC:ChrmMemChange"){if(t.messageType!==Ut.TYPING_STATUS||(this._addTypingInfo(Xn(t)),!this._watcher.typingState))if(t.messageType!==Ut.LOG_COMMAND||t.senderUserId!=="rongcloudsystem")if(t.messageType!==Ut.INTERCEPT){if(!this._pluginContextQueue.some(function(v){if(!v.onmessage)return!1;try{return v.onmessage(Xn(t))}catch(T){return H.error("plugin error =>",T),!1}}))if(this._watcher.message&&this._watcher.message(Xn(t),e,r),t.messageType!=="RC:ReadNtf")if(t.messageType!=="RC:RRReqMsg"){if(t.messageType!=="RC:RRRspMsg")return t;var c=(s=t.content)===null||s===void 0?void 0:s.receiptMessageDic;c&&Array.isArray(c[this._engine.currentUserId])&&typeof this._watcher.messageReceiptResponse=="function"&&this._watcher.messageReceiptResponse({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.senderUserId,c[this._engine.currentUserId])}else typeof this._watcher.messageReceiptRequest=="function"&&this._watcher.messageReceiptRequest({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.senderUserId);else typeof this._watcher.readReceiptReceived=="function"&&this._watcher.readReceiptReceived({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId||"",blockType:t.content.interceptType,blockedMessageUId:t.content.msgUId});else{var d=t.content,l=d.startTime,h=d.endTime,a=d.platform,u=d.logId,p=d.uri,f=d.packageName,m={startTime:parseInt(l),endTime:parseInt(h),platform:a,logId:u,uri:p,packageName:f};(o=_e.getInstance())===null||o===void 0||o.reportFullLog(m)}}else if(typeof this._watcher.chatroomState=="function"){var _={};Array.isArray(t.content.userList)&&t.content.userList.forEach(function(v){_[v.userId]=v.status}),this._watcher.chatroomState({userChange:{users:_,chatroomId:t.targetId}})}}else this._watcher.chatroomState({userChange:{users:(i={},i[t.senderUserId]=t.messageType==="RC:ChrmQuitNtf"?js.QUIT:js.JOIN,i),chatroomId:t.targetId}})},n.prototype._batchMessageReceiver=function(t,e,r){var i=this,o=[];t.forEach(function(s){var c=i._messageReceiver(s,e,r);c&&o.push(c)}),o.length&&this._watcher.batchMessage&&this._watcher.batchMessage(o)},n.prototype._chatroomInfoListener=function(t){this._watcher.chatroomState&&this._watcher.chatroomState(t)},n.prototype._conversationInfoListener=function(t){this._watcher.conversationState&&this._watcher.conversationState(t)},n.prototype._expansionInfoListener=function(t){this._watcher.expansion&&this._watcher.expansion(t)},n.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},n.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},n.prototype._typingStatusListener=function(t){this._watcher.typingState&&this._watcher.typingState(t)},n.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},n.prototype._MessageBlockedListener=function(t){this._watcher.messageBlocked&&this._watcher.messageBlocked(t)},n.prototype._ultraGroupEnableListener=function(t){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(t)},n.prototype._operateStatusListener=function(t){this._watcher.operateStatus&&this._watcher.operateStatus(t)},n.prototype._ultraGroupMessageExpansionUpdatedListener=function(t){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(t)},n.prototype._ultraGroupMessageModifiedListener=function(t){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(t)},n.prototype._ultraGroupMessageRecalledListener=function(t){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(t)},n.prototype._rtcDataChange=function(t,e){this._pluginContextQueue.forEach(function(r){r.onrtcdatachange&&r.onrtcdatachange(t,e)})},n.prototype.assignWatcher=function(t){var e=this;Object.keys(this._watcher).forEach(function(r){if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];e._watcher[r]=Cr(i)||Rt(i)?i:void 0}})},n.prototype.resetWatcher=function(){var t=this;Object.keys(this._watcher).forEach(function(e){t._watcher[e]=void 0})},n.prototype._addTypingInfo=function(t){var e=t.senderUserId,r=t.conversationType,i=t.targetId,o=t.content,s=t.channelId,c=o.typingContentType,d=s||"",l="".concat(r,"#").concat(i,"#").concat(d);this._typingInfo[l]||(this._typingInfo[l]=[]);var h=this._typingInfo[l].findIndex(function(a){return a.userId===e});h>=0&&this._typingInfo[l][h].messageType===c?this._typingInfo[l][h].timestamp=Date.now():(h>=0&&this._typingInfo[l].splice(h,1),this._typingInfo[l].push({userId:e,messageType:c,timestamp:Date.now()}),this._typingChangedList.includes(l)||this._typingChangedList.push(l),this._startCheckTypingInfo())},n.prototype._startCheckTypingInfo=function(){var t=this;this._typingInternalTimer===-1&&Object.keys(this._typingInfo).length!==0&&(this._typingInternalTimer=setInterval(function(){for(var e in t._typingInfo){var r=t._typingInfo[e].length;t._typingInfo[e]=t._typingInfo[e].filter(function(o){return Date.now()-o.timestamp<t._typingExpireTime}),t._typingInfo[e].length===r||t._typingChangedList.includes(e)||t._typingChangedList.push(e),t._typingInfo[e].length===0&&delete t._typingInfo[e]}if(t._typingChangedList.length>0){var i=t._typingChangedList.map(function(o){return{conversationType:Number(o.split("#")[0]),targetId:o.split("#")[1],channelId:o.split("#")[2],list:t._typingInfo[o]||[]}});t._typingStatusListener(i),t._typingChangedList=[]}Object.keys(t._typingInfo).length===0&&(clearInterval(t._typingInternalTimer),t._typingInternalTimer=-1)},500))},n.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},n.prototype.getServerTime=function(){return this._engine.getServerTime()},n.prototype.getDeviceId=function(){return this._engine.getDeviceId()},n.prototype.getCurrentUserId=function(){return this._engine.currentUserId},n.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(n.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),n.prototype.connect=function(t,e,r){return e===void 0&&(e=!1),V(this,void 0,void 0,function(){var i,o,s,c,d,l;return B(this,function(h){switch(h.label){case 0:return this._connectionStatus===Z.CONNECTED?[2,{code:R.SUCCESS,userId:this._engine.currentUserId}]:this._connectionStatus===Z.CONNECTING?[2,{code:R.BIZ_ERROR_CONNECTING}]:typeof t!="string"||t.length===0?[2,{code:R.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=t,i=t.split("@"),o=i[1],s=o?o.split(";").map(function(a){return/^https?:/.test(a)?a:"https://".concat(a)}):[],[4,this._engine.navi.getInfo(this._getTokenWithoutNavi(),s,e,this._options.checkCA)]);case 1:return(c=h.sent())?(c==null?void 0:c.type)===1?[2,{code:R.PACKAGE_ENVIRONMENT_ERROR}]:(d=Sn.getInfo(),[4,this._engine.connect(this._getTokenWithoutNavi(),c,r)]):[2,{code:R.RC_NAVI_RESOURCE_ERROR}];case 2:return l=h.sent(),H.__insertLogIntoDatabase(),l!==Mt.REDIRECT?[3,4]:(this._connectionStatus=Z.REDIRECT,[4,this.connect(t,!0)]);case 3:return[2,h.sent()];case 4:return l===R.SUCCESS&&(H.setStatisticsData(kt.IM_CONNECTION_DURATION,{startTime:new Date().getTime()},!0),H.info("connect success, userId: ".concat(this._engine.currentUserId)),(c==null?void 0:c.type)!==1&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(d),H.updateUploadLogAttr({runtime:this._runtime,logSwitch:(c==null?void 0:c.logSwitch)||0,logPolicy:JSON.parse((c==null?void 0:c.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Le.init(this._engine.currentUserId),this._isInternalConnected=!0),l!==R.SUCCESS||Ws()||c.openUS===1&&this._pullUserSettings(),l!==R.SUCCESS&&(this._connectionStatus=Z.CONNECTION_CLOSED),[2,{code:l,userId:this._engine.currentUserId}]}})})},n.prototype._pullUserSettings=function(){return V(this,void 0,void 0,function(){return B(this,function(t){return[2]})})},n.prototype.disconnect=function(){var t;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},(t=_e.getInstance())===null||t===void 0||t.distroy(),H.__insertLogIntoDatabase(),Le.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach(function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(r){H.error("plugin error =>",r)}}),Promise.resolve()},n.prototype.reconnect=function(t){return this._isInternalConnected?Promise.resolve({code:R.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,t)},n.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},n.prototype.getInfoFromCache=function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())},n.prototype.registerMessageType=function(t,e,r,i,o){i===void 0&&(i=[]),o===void 0&&(o=!1),this._engine.registerMessageType(t,e,r,i,o)},n.prototype.sendMessage=function(t,e,r,i){if(t!==Y.ULTRA_GROUP){var o=this.getInfoFromCache();if(((o==null?void 0:o.grpRRVer)||0)===1&&r.messageType===Ut.READ_RECEIPT_RESPONSE)return Promise.resolve({code:R.READ_RECEIPT_ERROR})}var s=r.canIncludeExpansion,c=s!==void 0&&s,d=r.expansion;if(c){var l=fi(d),h=l.isIllgalEx,a=l.isExKeyOrValLengthExceedLimit;if(l.isExceedLimit||a)return Promise.resolve({code:R.EXPANSION_LIMIT_EXCEET});if(h)return Promise.resolve({code:R.BIZ_ERROR_INVALID_PARAMETER})}var u=JSON.stringify(r.content);return Xa(u)>131072?Promise.resolve({code:R.RC_MSG_CONTENT_EXCEED_LIMIT}):t===Y.ULTRA_GROUP?this._engine.sendUltraMessage(e,r):this._engine.sendMessage(t,e,r,i)},n.prototype.sendExpansionMessage=function(t){return V(this,void 0,void 0,function(){var e,r,i,o,s,c,d,l,h,a,u;return B(this,function(p){switch(p.label){case 0:return e=t.channelId,r=t.conversationType,i=t.targetId,o=t.messageUId,s=t.keys,c=t.expansion,d=t.removeAll,t.canIncludeExpansion?(l=fi(c),h=l.isIllgalEx,a=l.isExKeyOrValLengthExceedLimit,l.isExceedLimit||a?[2,Promise.resolve({code:R.EXPANSION_LIMIT_EXCEET})]:h?[2,Promise.resolve({code:R.BIZ_ERROR_INVALID_PARAMETER})]:(u={mid:o},c&&(u.put=c),s&&(u.del=s),d&&(u.removeAll=1),[4,this._engine.sendMessage(r,i,{content:u,messageType:Ut.EXPANSION_NOTIFY,channelId:e})])):[2,{code:R.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:p.sent().code}]}})})},n.prototype.sendReadReceiptMessage=function(t,e,r){return V(this,void 0,void 0,function(){var i;return B(this,function(o){return i=this.getInfoFromCache(),((i==null?void 0:i.grpRRVer)||0)===0?[2,{code:R.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(t,e,r)]})})},n.prototype.getMessageReader=function(t,e,r){return V(this,void 0,void 0,function(){var i;return B(this,function(o){return i=this.getInfoFromCache(),((i==null?void 0:i.grpRRVer)||0)===0?[2,{code:R.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(t,e,r)]})})},n.prototype._destroy=function(){var t;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach(function(e){if(e.ondestroy)try{e.ondestroy()}catch(r){H.error("plugin error =>",r)}}),this._pluginContextQueue.length=0,this._pluginInstanseMap={},(t=_e.getInstance())===null||t===void 0||t.distroy(),Le.reset()},n.prototype.getHistoryMessage=function(t,e,r,i,o,s,c){if(r===void 0&&(r=0),i===void 0&&(i=20),o===void 0&&(o=0),s===void 0&&(s=""),c===void 0&&(c=""),t===Y.ULTRA_GROUP){var d={timestamp:r,count:i,order:o,channelId:s};return this._engine.getUltraHistoryMsg(e,d)}return this._engine.getHistoryMessage(t,e,r,i,o,s,c||"")},n.prototype.getConversationList=function(t,e,r,i,o){if(t===void 0&&(t=300),o===void 0&&(o=""),e===Y.ULTRA_GROUP){var s=R.METHOD_NOT_SUPPORT;return Promise.resolve({code:s,msg:R[s]})}return this._engine.getConversationList(t,e,r,i,o)},n.prototype.getConversation=function(t,e,r){return this._engine.getConversation(t,e,r)},n.prototype.removeConversation=function(t,e,r){return r===void 0&&(r=""),t===Y.ULTRA_GROUP?Promise.resolve(R.METHOD_NOT_SUPPORT):this._engine.removeConversation(t,e,r)},n.prototype.getUltraGroupList=function(){return this._engine.getUltraGroupList()},n.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},n.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},n.prototype.clearUnreadCount=function(t,e,r){return r===void 0&&(r=""),t===Y.ULTRA_GROUP?this._engine.clearUltraUnreadcount(e,r):this._engine.clearConversationUnreadCount(t,e,r)},n.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},n.prototype.getUnreadCount=function(t,e,r){return r===void 0&&(r=""),this._engine.getConversationUnreadCount(t,e,r)},n.prototype.getTotalUnreadCount=function(t,e,r){if(e&&e.includes(Y.ULTRA_GROUP)){var i=R.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:R[i]})}return this._engine.getAllConversationUnreadCount(t,e&&e.length>0?e:[Y.PRIVATE,Y.GROUP,Y.SYSTEM,Y.PUBLIC_SERVICE],!!r)},n.prototype.getFirstUnreadMessage=function(t,e,r){return r===void 0&&(r=""),this._engine.getFirstUnreadMessage(t,e,r)},n.prototype.setConversationNotificationLevel=function(t,e,r,i){return i===void 0&&(i=""),V(this,void 0,void 0,function(){var o;return B(this,function(s){return o=[{conversationType:t,targetId:e,notificationLevel:r,channelId:i}],[2,this._engine.batchSetConversationStatus(o)]})})},n.prototype.setConversationStatus=function(t,e,r,i,o){if(o===void 0&&(o=""),t===Y.ULTRA_GROUP&&r!==void 0)return Promise.resolve(R.METHOD_NOT_SUPPORT);var s=[{conversationType:t,targetId:e,isTop:r,notificationStatus:i,channelId:o}];return this._engine.batchSetConversationStatus(s)},n.prototype.saveConversationMessageDraft=function(t,e,r,i){return i===void 0&&(i=""),this._engine.saveConversationMessageDraft(t,e,r,i)},n.prototype.getConversationMessageDraft=function(t,e,r){return r===void 0&&(r=""),this._engine.getConversationMessageDraft(t,e,r)},n.prototype.clearConversationMessageDraft=function(t,e,r){return r===void 0&&(r=""),this._engine.clearConversationMessageDraft(t,e,r)},n.prototype.recallMessage=function(t,e,r,i,o){return this._engine.recallMsg(t,e,r,i,o)},n.prototype.deleteRemoteMessage=function(t,e,r,i){return i===void 0&&(i=""),t===Y.ULTRA_GROUP?Promise.resolve(R.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(t,e,r,i)},n.prototype.deleteRemoteMessageByTimestamp=function(t,e,r,i){return i===void 0&&(i=""),this._engine.deleteRemoteMessageByTimestamp(t,e,r,i)},n.prototype.joinChatroom=function(t,e){return e===void 0&&(e=10),this._engine.joinChatroom(t,e)},n.prototype.joinExistChatroom=function(t,e){return e===void 0&&(e=10),this._engine.joinExistChatroom(t,e)},n.prototype.quitChatroom=function(t){return this._engine.quitChatroom(t)},n.prototype.getChatroomInfo=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=0),this._engine.getChatroomInfo(t,e,r)},n.prototype.setChatroomEntry=function(t,e){var r=e.key,i=e.value;return Fe(r)&&gi(i)?this._engine.setChatroomEntry(t,e):Promise.resolve(R.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.setChatroomEntries=function(t,e){for(var r=0;r<e.entries.length;r++){var i=e.entries[r],o=i.key,s=i.value;if(!Fe(o)||!gi(s))return Promise.resolve({code:R.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(t,e)},n.prototype.forceSetChatroomEntry=function(t,e){var r=e.key,i=e.value;return Fe(r)&&gi(i)?this._engine.forceSetChatroomEntry(t,e):Promise.resolve(R.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.removeChatroomEntry=function(t,e){var r=e.key;return Fe(r)?this._engine.removeChatroomEntry(t,e):Promise.resolve(R.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.removeChatroomEntries=function(t,e){for(var r=0;r<e.entries.length;r++){var i=e.entries[r].key;if(!Fe(i))return Promise.resolve({code:R.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(t,e)},n.prototype.forceRemoveChatroomEntry=function(t,e){var r=e.key;return Fe(r)?this._engine.forceRemoveChatroomEntry(t,e):Promise.resolve(R.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.getChatroomEntry=function(t,e){return this._engine.getChatroomEntry(t,e)},n.prototype.getAllChatroomEntries=function(t){return this._engine.getAllChatroomEntry(t)},n.prototype.getChatroomHistoryMessages=function(t,e,r,i){return e===void 0&&(e=20),r===void 0&&(r=0),i===void 0&&(i=0),this._engine.getChatroomHistoryMessages(t,i,e,r)},n.prototype.getFileToken=function(t,e,r,i){return V(this,void 0,void 0,function(){var o,s,c,d,l,h,a;return B(this,function(u){switch(u.label){case 0:return o=this.getInfoFromCache(),s=(o==null?void 0:o.bosAddr)||"",c=(o==null?void 0:o.uploadServer)||"",d=(o==null?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(t,e,r,i)];case 1:return l=u.sent(),h=l.code,a=l.data,h===R.SUCCESS?[2,Promise.resolve(Object.assign(a,{bos:s,qiniu:c,ossConfig:d}))]:[2,Promise.reject(h)]}})})},n.prototype.getFileUrl=function(t,e,r,i,o){return o===void 0&&(o=Kt.QINIU),V(this,void 0,void 0,function(){var s,c,d;return B(this,function(l){switch(l.label){case 0:return(i==null?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(t,o,e,r)];case 1:return s=l.sent(),c=s.code,d=s.data,c===R.SUCCESS?[2,Promise.resolve(d)]:[2,Promise.reject(c)]}})})},n.prototype.createTag=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.createTag(t)]})})},n.prototype.removeTag=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.removeTag(t)]})})},n.prototype.updateTag=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.updateTag(t)]})})},n.prototype.getTagList=function(){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.getTagList()]})})},n.prototype.addTagForConversations=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){return e.length>1e3?[2,Promise.reject(R.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(t,e)]})})},n.prototype.removeTagForConversations=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.removeTagForConversations(t,e)]})})},n.prototype.removeTagsForConversation=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.removeTagsForConversation(t,e)]})})},n.prototype.getConversationListByTag=function(t,e,r,i){return V(this,void 0,void 0,function(){return B(this,function(o){return[2,this._engine.getConversationListByTag(t,e,r,i)]})})},n.prototype.getUnreadCountByTag=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.getUnreadCountByTag(t,e)]})})},n.prototype.setConversationStatusInTag=function(t,e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.setConversationStatusInTag(t,e,r)]})})},n.prototype.getTagsForConversation=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.getTagsForConversation(t)]})})},n.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},n.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},n.prototype.getUnreadMentionedCount=function(t){return this._engine.getUnreadMentionedCount(t)},n.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},n.prototype.sendUltraGroupTypingStatus=function(t){if(t.conversationType!==Y.ULTRA_GROUP){var e=R.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:e,msg:R[e]})}return this._engine.sendUltraGroupTypingStatus(t)},n.prototype.getUltraGroupMessageListByMessageUId=function(t){return this._engine.getUltraGroupMessageListByMessageUId(t)},n.prototype.expandUltraMessage=function(t){return V(this,void 0,void 0,function(){var e,r,i,o,s,c,d;return B(this,function(l){switch(l.label){case 0:return e=t.conversationType,r=t.expansion,i=t.canIncludeExpansion,e!==Y.ULTRA_GROUP?[2,{code:o=R.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:R[o]}]:i?(s=fi(r),c=s.isIllgalEx,d=s.isExKeyOrValLengthExceedLimit,s.isExceedLimit||d?[2,{code:R.EXPANSION_LIMIT_EXCEET}]:c?[2,{code:R.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(t)]):[2,{code:R.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}})})},n.prototype.modifyMessage=function(t){return V(this,void 0,void 0,function(){var e;return B(this,function(r){switch(r.label){case 0:return t.conversationType!==Y.ULTRA_GROUP?[2,{code:e=R.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:R[e]}]:[4,this._engine.modifyMessage(t)];case 1:return[2,{code:r.sent().code}]}})})},n.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(t)},n.prototype.getUltraGroupUnreadCountByTargetId=function(t){return this._engine.getUltraGroupUnreadCountByTargetId(t)},n.prototype.getAllUltraGroupUnreadCount=function(t){return t===void 0&&(t=!1),this._engine.getAllUltraGroupUnreadCount(t)},n.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},n.prototype.callExtra=function(t){for(var e,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return(e=this._engine).callExtra.apply(e,Pe([t],r,!1))},n.prototype.clearConversations=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){switch(r.label){case 0:return[4,this._engine.clearConversations(t,e)];case 1:return[2,r.sent()]}})})},n.prototype.setUserStatusListener=function(t,e){return this._engine.setUserStatusListener(t,function(r){try{e(r)}catch(i){H.error(i)}})},n.prototype.addToBlacklist=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.addToBlacklist(t)]})})},n.prototype.removeFromBlacklist=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.removeFromBlacklist(t)]})})},n.prototype.getBlacklist=function(){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.getBlacklist()]})})},n.prototype.getBlacklistStatus=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.getBlacklistStatus(t)]})})},n.prototype.insertMessage=function(t,e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.insertMessage(t,e,r)]})})},n.prototype.deleteMessages=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.deleteMessages(t)]})})},n.prototype.deleteMessagesByTimestamp=function(t,e,r,i,o){return o===void 0&&(o=""),V(this,void 0,void 0,function(){return B(this,function(s){return[2,this._engine.deleteMessagesByTimestamp(t,e,r,i,o)]})})},n.prototype.clearMessages=function(t,e,r){return r===void 0&&(r=""),V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.clearMessages(t,e,r)]})})},n.prototype.getMessage=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.getMessage(t)]})})},n.prototype.setMessageContent=function(t,e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.setMessageContent(t,e,r)]})})},n.prototype.setMessageSearchField=function(t,e,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.setMessageSearchField(t,e,r)]})})},n.prototype.setMessageSentStatus=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.setMessageSentStatus(t,e)]})})},n.prototype.setMessageReceivedStatus=function(t,e){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.setMessageReceivedStatus(t,e)]})})},n.prototype.setUserStatus=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.setUserStatus(t)]})})},n.prototype.subscribeUserStatus=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.subscribeUserStatus(t)]})})},n.prototype.getUserStatus=function(t){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.getUserStatus(t)]})})},n.prototype.searchConversationByContent=function(t,e,r,i){return e===void 0&&(e=[]),r===void 0&&(r=""),V(this,void 0,void 0,function(){return B(this,function(o){return[2,this._engine.searchConversationByContent(t,e,r,i)]})})},n.prototype.searchMessageByContent=function(t,e,r,i,o,s,c){return c===void 0&&(c=""),V(this,void 0,void 0,function(){return B(this,function(d){return[2,this._engine.searchMessageByContent(t,e,r,i,o,s,c)]})})},n.prototype.getUnreadMentionedMessages=function(t,e,r){return r===void 0&&(r=""),this._engine.getUnreadMentionedMessages(t,e,r)},n.prototype.clearUnreadCountByTimestamp=function(t,e,r,i){return i===void 0&&(i=""),this._engine.clearUnreadCountByTimestamp(t,e,r,i)},n.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return e===void 0&&(e=""),this._engine.getUltraGroupDefaultNotificationLevel(t,e)},n.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,r){return r===void 0&&(r=""),this._engine.setUltraGroupDefaultNotificationLevel(t,e,r)},n.prototype.getConversationNotificationLevel=function(t,e,r){return r===void 0&&(r=""),this._engine.getConversationNotificationLevel(t,e,r)},n.prototype.getConversationNotificationStatus=function(t,e,r){return r===void 0&&(r=""),this._engine.getConversationNotificationStatus(t,e,r)},n.prototype.getRemoteHistoryMessages=function(t,e,r,i,o,s){return this._engine.getRemoteHistoryMessages(t,e,r,i,o,s)},n.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},n.prototype.getConversationListWithAllChannelByPage=function(t,e){return this._engine.getConversationListWithAllChannelByPage(t,e)},n.prototype.joinRTCRoom=function(t,e,r,i,o,s){return this._engine.joinRTCRoom(t,e,r,i,o,s)},n.prototype.quitRTCRoom=function(t){return this._engine.quitRTCRoom(t)},n.prototype.rtcPing=function(t,e,r){return this._engine.rtcPing(t,e,r)},n.prototype.getRTCRoomInfo=function(t){return this._engine.getRTCRoomInfo(t)},n.prototype.getRTCUserInfoList=function(t){return this._engine.getRTCUserInfoList(t)},n.prototype.getRTCUserInfo=function(t){return this._engine.getRTCUserInfo(t)},n.prototype.setRTCUserInfo=function(t,e,r){return this._engine.setRTCUserInfo(t,e,r)},n.prototype.removeRTCUserInfo=function(t,e){return this._engine.removeRTCUserInfo(t,e)},n.prototype.setRTCData=function(t,e,r,i,o,s){return this._engine.setRTCData(t,e,r,i,o,s)},n.prototype.setRTCTotalRes=function(t,e,r,i,o){return o===void 0&&(o=""),this._engine.setRTCTotalRes(t,e,r,i,o)},n.prototype.setRTCCDNUris=function(t,e,r){return this._engine.setRTCCDNUris(t,e,r)},n.prototype.getRTCData=function(t,e,r,i){return this._engine.getRTCData(t,e,r,i)},n.prototype.removeRTCData=function(t,e,r,i,o){return this._engine.removeRTCData(t,e,r,i,o)},n.prototype.setRTCOutData=function(t,e,r,i){return this._engine.setRTCOutData(t,e,r,i)},n.prototype.getRTCOutData=function(t,e){return this._engine.getRTCOutData(t,e)},n.prototype.getRTCToken=function(t,e,r){return this._engine.getRTCToken(t,e,r)},n.prototype.setRTCState=function(t,e){return this._engine.setRTCState(t,e)},n.prototype.getRTCUserList=function(t){return this._engine.getRTCUserList(t)},n.prototype.joinLivingRoomAsAudience=function(t,e,r){return this._engine.joinLivingRoomAsAudience(t,e,r)},n.prototype.quitLivingRoomAsAudience=function(t){return this._engine.quitLivingRoomAsAudience(t)},n.prototype.rtcIdentityChange=function(t,e,r){return this._engine.rtcIdentityChange(t,e,r)},n.prototype.getRTCJoinedUserInfo=function(t){return this._engine.getRTCJoinedUserInfo(t)},n.prototype.requestRoomPK=function(t){return this._engine.requestRoomPK(t)},n.prototype.cancelRoomPK=function(t){return this._engine.cancelRoomPK(t)},n.prototype.responseRoomPK=function(t){return this._engine.responseRoomPK(t)},n.prototype.endRoomPK=function(t){return this._engine.endRoomPK(t)},n.prototype.bindRTCRoomForChatroom=function(t){return this._engine.bindRTCRoomForChatroom(t)},n}();(function(n){n[n.add=1]="add",n[n.update=2]="update",n[n.delete=3]="delete"})(da||(da={}));var Xi=function(n,t){return Xi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},Xi(n,t)},to=function(){return to=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},to.apply(this,arguments)};function sn(n,t,e,r){return new(e||(e=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function c(l){try{d(r.throw(l))}catch(h){o(h)}}function d(l){var h;l.done?i(l.value):(h=l.value,h instanceof e?h:new e(function(a){a(h)})).then(s,c)}d((r=r.apply(n,t||[])).next())})}function an(n,t){var e,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(d){return function(l){return function(h){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,r&&(i=2&h[0]?r.return:h[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,h[1])).done)return i;switch(r=0,i&&(h=[2&h[0],i.value]),h[0]){case 0:case 1:i=h;break;case 4:return s.label++,{value:h[1],done:!1};case 5:s.label++,r=h[1],h=[0];continue;case 7:h=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||h[0]!==6&&h[0]!==2)){s=0;continue}if(h[0]===3&&(!i||h[1]>i[0]&&h[1]<i[3])){s.label=h[1];break}if(h[0]===6&&s.label<i[1]){s.label=i[1],i=h;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(h);break}i[2]&&s.ops.pop(),s.trys.pop();continue}h=t.call(n,s)}catch(a){h=[6,a],r=0}finally{e=i=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([d,l])}}}var Ie=new Le("RCIM"),Gn=function(){return!(typeof uni=="undefined"||!function(n){for(var t=["canIUse","getSystemInfo"],e=0,r=t.length;e<r;e++)if(!n[t[e]])return!1;return!0}(uni))},Cl=Gn(),yt,la={tag:"browser",httpReq:function(n){var t=n.method||re.GET,e=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=jr(n.url,i);return new Promise(function(c){var d,l=(d=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest,typeof XMLHttpRequest!="undefined"&&d?new XMLHttpRequest:typeof XDomainRequest!="undefined"?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),h=Object.prototype.toString.call(l)==="[object XDomainRequest]";if(l.open(t,s),r&&l.setRequestHeader)for(var a in r)l.setRequestHeader(a,r[a]);if(h){l.timeout=e,l.onload=function(){c({data:l.responseText,status:l.status||200})},l.onerror=function(){c({status:l.status||0})},l.ontimeout=function(){c({status:l.status||0})};var u=typeof o=="object"?JSON.stringify(o):o;l.send(u)}else l.onreadystatechange=function(){l.readyState===4&&c({data:l.responseText,status:l.status})},l.onerror=function(){c({status:l.status||0})},setTimeout(function(){l.abort(),c({status:l.status||0})},e),l.send(o)})},localStorage:window==null?void 0:window.localStorage,sessionStorage:window==null?void 0:window.sessionStorage,isSupportSocket:function(){var n=typeof WebSocket!="undefined";return n||console.warn("websocket not support"),n},useNavi:!0,connectPlatform:"",isFromUniapp:Cl,createWebSocket:function(n,t){var e=new WebSocket(n,t);return e.binaryType="arraybuffer",{onClose:function(r){e.onclose=function(i){var o=i.code,s=i.reason;r(o,s)}},onError:function(r){e.onerror=r},onMessage:function(r){e.onmessage=function(i){r(i.data)}},onOpen:function(r){e.onopen=r},send:function(r){e.send(r)},close:function(r,i){e.close()}}},createDataChannel:function(n,t){return this.isSupportSocket()&&t==="websocket"?new ln(this,n):new hn(this,n)},getNetworkType:function(){var n=navigator.connection||navigator.mozConnection||navigator.webkitConnection,t=n.type,e=n.effectiveType,r=t||e||Zt.UNKONWN;return new Promise(function(i){i(r)})}},Rl=Gn(),tr=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return wx[n].apply(wx,t)}catch(r){console.error(r)}}},ha={setItem:tr("setStorageSync"),getItem:tr("getStorageSync"),removeItem:tr("removeStorageSync"),clear:tr("clearStorageSync")},pa={tag:"wechat",httpReq:function(n){var t=n.method||re.GET,e=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=jr(n.url,i);return new Promise(function(c){wx.request({url:s,method:t,headers:r,timeout:e,data:o,success:function(d){c({data:d.data,status:d.statusCode})},fail:function(){c({status:R.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:ha,sessionStorage:ha,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Rl,createWebSocket:function(n,t){var e=wx.connectSocket({url:n,protocols:t});return{onClose:function(r){e.onClose(function(i){r(i.code,i.reason)})},onError:function(r){e.onError(function(i){r(i.errMsg)})},onMessage:function(r){e.onMessage(function(i){r(i.data)})},onOpen:function(r){e.onOpen(r)},send:function(r){e.send({data:r})},close:function(r,i){e.close({code:r,reason:i})}}},createDataChannel:function(n,t){return t==="websocket"?new ln(this,n):new hn(this,n)},getNetworkType:function(){return new Promise(function(n){wx.getNetworkType({success:function(t){var e=t.networkType;n(e)},fail:function(){n(Zt.UNKONWN)}})})}},Il=Gn(),er=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return my[n].apply(my,t)}catch(r){console.error(r)}}},fa={setItem:er("setStorageSync"),getItem:er("getStorageSync"),removeItem:er("removeStorageSync"),clear:er("clearStorageSync")},ga={tag:"alipay",httpReq:function(n){var t=n.method||re.GET,e=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=jr(n.url,i),c=n.dataType||"json";return new Promise(function(d){my.request({url:s,method:t,headers:r,timeout:e,data:o,dataType:c,success:function(l){d({data:l.data,status:l.status})},fail:function(){d({status:R.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:fa,sessionStorage:fa,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Il,createDataChannel:function(n,t){return t==="websocket"?new ln(this,n):new hn(this,n)},getNetworkType:function(){return new Promise(function(n){my.getNetworkType({success:function(t){var e=t.networkType;n(e)},fail:function(){n(Zt.UNKONWN)}})})}},Sl=Gn(),nr=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return console.log("tt",tt),tt[n].apply(tt,t)}catch(r){console.error(r)}}},ma={setItem:nr("setStorageSync"),getItem:nr("getStorageSync"),removeItem:nr("removeStorageSync"),clear:nr("clearStorageSync")},_a={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Sl,localStorage:ma,sessionStorage:ma,httpReq:function(n){return new Promise(function(t,e){tt.request({url:n.url,data:n.body,header:n.headers,method:n.method,success:function(r){console.log("\u8C03\u7528\u6210\u529F",r.data);var i=(r==null?void 0:r.data)||{},o={data:JSON.stringify(i),status:r.statusCode};t(o)},fail:function(r){console.log("\u8C03\u7528\u5931\u8D25",r.errMsg),e({data:r.errMsg})}})})},createWebSocket:function(n,t){var e=tt.connectSocket({url:n,protocols:t});return{onOpen:function(r){e.onOpen(r)},onClose:function(r){e.onClose(function(i){return r(i.code,i.reason)})},onError:function(r){e.onError(function(i){return r(i.errMsg)})},onMessage:function(r){e.onMessage(function(i){return r(i.data)})},send:function(r){e.send({data:r})},close:function(r,i){e.close({code:r,reason:i})}}},createDataChannel:function(n,t){return t==="websocket"?new ln(this,n):new hn(this,n)},getNetworkType:function(){return new Promise(function(n){tt.getNetworkType({success:function(t){var e=t.networkType;n(e)},fail:function(){n(Zt.UNKONWN)}})})}},Ol=Gn(),rr=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return console.log("swan",swan),swan[n].apply(swan,t)}catch(r){console.error(r)}}},va={setItem:rr("setStorageSync"),getItem:rr("getStorageSync"),removeItem:rr("removeStorageSync"),clear:rr("clearStorageSync")},Ta={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Ol,localStorage:va,sessionStorage:va,httpReq:function(n){return new Promise(function(t,e){swan.request({url:n.url,data:n.body,header:n.headers,method:n.method,success:function(r){console.log("\u8C03\u7528\u6210\u529F",r.data);var i=(r==null?void 0:r.data)||{},o={data:JSON.stringify(i),status:r.statusCode};t(o)},fail:function(r){console.log("\u8C03\u7528\u5931\u8D25",r.errorCode),e({data:r.errorCode})}})})},createWebSocket:function(n,t){var e=swan.connectSocket({url:n,protocols:t});return{onOpen:function(r){e.onOpen(r)},onClose:function(r){e.onClose(function(i){return r(i.code,i.reason)})},onError:function(r){e.onError(function(i){return r(i.errMsg)})},onMessage:function(r){e.onMessage(function(i){return r(i.data)})},send:function(r){e.send({data:r})},close:function(r,i){e.close({code:r,reason:i})}}},createDataChannel:function(n,t){return t==="websocket"?new ln(this,n):new hn(this,n)},getNetworkType:function(){return sn(this,void 0,void 0,function(){return an(this,function(n){return[2,new Promise(function(t){swan.getNetworkType({success:function(e){var r=e.networkType;t(r)},fail:function(){t(Zt.UNKONWN)}})})]})})}},ir=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return uni[n].apply(uni,t)}catch(r){console.error(r)}}},ya={setItem:ir("setStorageSync"),getItem:ir("getStorageSync"),removeItem:ir("removeStorageSync"),clear:ir("clearStorageSync")},Nl={tag:"uniapp",httpReq:function(n){var t=n.method||re.GET,e=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=jr(n.url,i);return new Promise(function(c){uni.request({url:s,method:t,headers:r,timeout:e,data:o,success:function(d){c({data:d.data,status:d.statusCode})},fail:function(){c({status:R.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:ya,sessionStorage:ya,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(n,t){var e={complete:function(){},url:n,protocols:t},r=uni.connectSocket(e);return{onClose:function(i){r.onClose(function(o){i(o.code,o.reason)})},onError:function(i){r.onError(function(o){i(o.errMsg)})},onMessage:function(i){r.onMessage(function(o){i(o.data)})},onOpen:function(i){r.onOpen(i)},send:function(i){r.send({data:i})},close:function(i,o){r.close({code:i,reason:o})}}},createDataChannel:function(n,t){return t==="websocket"?new ln(this,n):new hn(this,n)},getNetworkType:function(){return new Promise(function(n){uni.getNetworkType({success:function(t){var e=t.networkType;n(e)},fail:function(){n(Zt.UNKONWN)}})})}},Tn=function(n){return n&&n.canIUse&&n.getSystemInfo},bl=typeof uni!="undefined"&&Tn(uni)?function(){switch({}.VUE_APP_PLATFORM){case"app-plus":return Nl;case"mp-baidu":return Ta;case"mp-toutiao":return _a;case"mp-alipay":return ga;case"mp-weixin":return pa;default:return la}}():typeof my!="undefined"&&Tn(my)?ga:typeof tt!="undefined"&&Tn(tt)?_a:typeof swan!="undefined"&&Tn(swan)?Ta:typeof wx!="undefined"&&Tn(wx)?pa:la;function An(n){var t=n.conversationType,e=n.channelId,r=n.messageType,i=n.content,o=n.senderUserId,s=n.targetId,c=n.sentTime,d=n.receivedTime,l=n.messageUId,h=n.messageDirection,a=n.isPersited,u=n.isCounted,p=n.isOffLineMessage,f=n.canIncludeExpansion,m=n.expansion,_=n.receivedStatus,v=n.disableNotification,T=n.isMentioned,y=n.isStatusMessage,w=n.readReceiptInfo,L=n.pushConfig,M=n.messageId,C=n.isInterrupt,A=n.isModifyMessage;_||(_=Un.UNREAD);var F={messageType:r,channelId:e||"",content:i,senderUserId:o,targetId:s,conversationType:t,sentTime:c,receivedTime:d,messageUId:l,messageDirection:h,isPersited:a,isCounted:u,isMentioned:T,disableNotification:v,isStatusMessage:y,canIncludeExpansion:f,expansion:m,receivedStatus:_,readReceiptInfo:w,pushConfig:L,messageId:M,isInterrupt:C,isModifyMessage:A};return t!==Y.ULTRA_GROUP&&(F.isOffLineMessage=p),F}(function(n){n.CONNECTING="CONNECTING",n.CONNECTED="CONNECTED",n.DISCONNECT="DISCONNECT",n.SUSPEND="SUSPEND",n.MESSAGES="MESSAGES",n.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",n.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",n.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",n.CONVERSATION="CONVERSATION",n.CHATROOM="CHATROOM",n.EXPANSION="EXPANSION",n.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",n.TAG="TAG",n.CONVERSATION_TAG="CONVERSATION_TAG",n.TYPING_STATUS="TYPING_STATUS",n.MESSAGE_BLOCKED="MESSAGE_BLOCKED",n.ULTRA_GROUP_ENABLE="ULTRA_GROUP_ENABLE",n.OPERATE_STATUS="OPERATE_STATUS",n.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED="ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED",n.ULTRA_GROUP_MESSAGE_MODIFIED="ULTRA_GROUP_MESSAGE_MODIFIED",n.ULTRA_GROUP_MESSAGE_RECALLED="ULTRA_GROUP_MESSAGE_RECALLED"})(yt||(yt={}));var ke,ee=function(n){function t(e){var r=n.call(this)||this;if(t.imClient)return Ie.error("Please do not repeatedly perform the init method"),t.imClient;dt("options.navigators",e.navigators,function(o){return Ht(o)&&(o.length===0||o.every(Ue))});var i=e==null?void 0:e.connectType;return i?me.WEBSOCKET!==i&&me.COMET!==i&&(Ie.warn("RongIMLib connectionType must be ".concat(me.WEBSOCKET," or ").concat(me.COMET)),i=me.WEBSOCKET):i=me.WEBSOCKET,r._context=El.init(bl,{appkey:e.appkey,apiVersion:"5.3.3",navigators:e.navigators||[],miniCMPProxy:e.customCMP||[],connectionType:i,logLevel:e.logLevel,logStdout:e.logStdout,indexDBSwitch:e.indexDBSwitch,checkCA:e.checkCA}),r.watch(),t.imClient=r,r}return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}Xi(e,r),e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}(t,n),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,r={onConnecting:function(){e.emit(yt.CONNECTING)},onConnected:function(){e.emit(yt.CONNECTED)},onDisconnect:function(i){e.emit(yt.DISCONNECT,i)},onSuspend:function(i){e.emit(yt.SUSPEND,i)},batchMessage:function(i){e.emit(yt.MESSAGES,{messages:i.map(function(o){return An(o)})})},typingState:function(i){e.emit(yt.TYPING_STATUS,{status:i})},readReceiptReceived:function(i,o,s){e.emit(yt.READ_RECEIPT_RECEIVED,{conversation:i,messageUId:o,sentTime:s})},messageReceiptRequest:function(i,o,s){e.emit(yt.MESSAGE_RECEIPT_REQUEST,{conversation:i,messageUId:o,senderUserId:s})},messageReceiptResponse:function(i,o,s){e.emit(yt.MESSAGE_RECEIPT_RESPONSE,{conversation:i,receivedUserId:o,messageUIdList:s})},conversationState:function(i){var o=i.map(function(s){var c=s.conversationType;return c===Y.ULTRA_GROUP?{conversation:{conversationType:c,latestMessage:s.latestMessage?An(s.latestMessage):null,targetId:s.targetId,unreadMessageCount:s.unreadMessageCount,unreadMentionedCount:s.unreadMentionedCount,versionTime:s.versionTime,notificationStatus:s.notificationStatus,notificationLevel:s.notificationLevel,lastUnreadTime:s.lastUnreadTime,channelId:s.channelId}}:{conversation:{conversationType:c,latestMessage:s.latestMessage?An(s.latestMessage):null,targetId:s.targetId,unreadMessageCount:s.unreadMessageCount,hasMentioned:s.hasMentioned,mentionedInfo:s.mentionedInfo,lastUnreadTime:s.lastUnreadTime,notificationStatus:s.notificationStatus,notificationLevel:s.notificationLevel,isTop:s.isTop,channelId:s.channelId,unreadMentionedCount:s.unreadMentionedCount},updatedItems:s.updatedItems}});e.emit(yt.CONVERSATION,{conversationList:o})},chatroomState:function(i){e.emit(yt.CHATROOM,i)},expansion:function(i){e.emit(yt.EXPANSION,i)},pullFinished:function(){e.emit(yt.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(yt.TAG)},conversationTagChanged:function(){e.emit(yt.CONVERSATION_TAG)},messageBlocked:function(i){e.emit(yt.MESSAGE_BLOCKED,i)},ultraGroupEnable:function(i){e.emit(yt.ULTRA_GROUP_ENABLE,i)},operateStatus:function(i){e.emit(yt.OPERATE_STATUS,i)},ultraGroupMessageExpansionUpdated:function(i){e.emit(yt.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED,i)},ultraGroupMessageModified:function(i){e.emit(yt.ULTRA_GROUP_MESSAGE_MODIFIED,i)},ultraGroupMessageRecalled:function(i){e.emit(yt.ULTRA_GROUP_MESSAGE_RECALLED,i)}};this.context.assignWatcher(r)},t}(Fn),Dr={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:R.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},cn={},Ml={};for(var Ea in Dr){var Ca=Dr[Ea],Ra=Ca.code;cn[Ra]=Ea,Ml[Ra]=Ca}Dr.ROAMING_SERVICE_UNAVAILABLE.code;var Al=function(n){ke=ke||new ee(n)};function wl(n,t){return ke==null?void 0:ke.context.install(n,t)}function Pl(n,t){return sn(this,void 0,void 0,function(){var e;return an(this,function(r){switch(r.label){case 0:return dt("token",n,ut.STRING,!0),Ie.warn("RongIMLib Version: ".concat("5.3.3",", Commit: ").concat("925bcb5e5bdb7b280cfecb8939ec6f729242cbcb")),[4,ke.context.connect(n,!1,t)];case 1:return(e=r.sent()).code===R.SUCCESS?[2,{code:e.code,data:{userId:e.userId}}]:[2,{code:e.code,msg:cn[e.code]}]}})})}function Ll(){return ke.context.disconnect()}function Kn(n,t,e){ke.on(n,t,e)}function Ul(n,t){return sn(this,void 0,void 0,function(){var e,r;return an(this,function(i){switch(i.label){case 0:return dt("options.count",t.count,ut.NUMBER,!0),e="id:"+n,Ie.debug("join chatroom ->"+e),[4,ee.imClient.context.joinChatroom(n,t.count)];case 1:return(r=i.sent())!==R.SUCCESS?(Ie.warn("join chatroom fail ->code+:"+cn[r]+","+e),[2,{code:r,msg:cn[r]}]):[2,{code:r}]}})})}var Pc=function(n,t,e,r){e===void 0&&(e=!0),r===void 0&&(r=!0),this.messageType=n,this.content=t,this.isPersited=e,this.isCounted=r};function Qt(n,t,e){return t===void 0&&(t=!0),e===void 0&&(e=!0),function(r){return new Pc(n,r,t,e)}}var Lc,eo,Dl=Qt("RC:ImgMsg"),kl=Qt("RC:HQVCMsg"),xl=Qt("RC:SightMsg"),Vl=Qt("RC:TxtMsg"),Bl=Qt("RC:CombineMsg"),Fl=Qt("RC:FileMsg");Qt("RC:GIFMsg");Qt("RC:VcMsg");Qt("RC:LBSMsg");Qt("RC:ReferenceMsg");Qt("RC:ImgTextMsg");var qe={qiniu:function(n,t,e,r){var i,o="https://"+t.uploadHost.qiniu;i=or()+Tt[0][1]||o,Tt.shift();var s=new XMLHttpRequest;s.upload&&t.support_options&&(s.upload.onprogress=function(c){e.onProgress(c.loaded,c.total)}),s.onreadystatechange=function(){if(s.readyState===4){var c=JSON.parse(s.responseText||"{}");c.filename=t.uniqueValue,c.uploadMethod=Kt?Kt.QINIU:"",s.status===200?e.onCompleted(c):Tt.length?qe[Tt[0][0]](n,t,e,r):e.onError("upload fail")}},t.isChunk&&(i=function(c,d){var l="";return Sa(d,function(h,a){h!=="token"&&(l+=(l?"&":"")+encodeURIComponent(h)+"="+encodeURIComponent(a))}),l&&(c+=(c.indexOf("?")>0?"&":"?")+l),c}(i+="/mkblk/"+n.size,t.multi_parmas)),s.open(t.method,i,!0),e.onOpen(s),t.stream&&s.setRequestHeader("authorization","UpToken "+t.multi_parmas.token),Sa(t.headers,function(c,d){s.setRequestHeader(c,d)}),s.send(n)},baidu:function(n,t,e,r){if(r.size>Ia)throw new Error("the file size is over 5GB!");var i=t||{};t=t||eo;var o=new XMLHttpRequest,s=or();if(!(!i.uploadHost.bos&&!i.bosUploadPath)){var c=s+Tt[0][1]+i.bosUploadPath;Tt.shift();var d=i.bosHeader||{},l={filename:t.uniqueValue||r.uniqueName,name:r.name,downloadUrl:c,isBosRes:!0};o.upload&&t.support_options&&(o.upload.onprogress=function(h){e.onProgress(h.loaded,h.total,!0)}),o.onreadystatechange=function(){o.readyState===4&&(JSON.parse(o.responseText||"{}").filename=t.uniqueValue,o.status===200?e.onCompleted(l,!0):Tt.length?qe[Tt[0][0]](n,t,e,r):e.onError("upload fail"))},o.open(t.method,c,!0),o.setRequestHeader("authorization",d.bosToken),o.setRequestHeader("x-bce-date",d.bosDate),o.send(r)}},aliyun:function(n,t,e,r){if(r.size>Ia)throw new Error("the file size is over 5GB!");var i=new FormData;i.set("file",n.get("file")),i.set("key",n.get("key")),i.set("token",n.get("token"));var o=Tt[0][1];Tt.shift(),n=n||Lc,t=(t=t||{})||eo;var s=new XMLHttpRequest,c=or()+t.ossBucketName+"."+o;s.upload&&t.support_options&&(s.upload.onprogress=function(l){e.onProgress(l.loaded,l.total)}),s.onreadystatechange=function(){if(s.readyState===4){var l=JSON.parse(s.responseText||"{}");l.name=t.uniqueValue,l.filename=t.uploadFileName,l.uploadMethod=Kt?Kt.ALI:"",s.status===200?e.onCompleted(l):Tt.length?qe[Tt[0][0]](i,t,e,r):e.onError("upload fail")}},s.open(t.method,c,!0),console.log("ali:url",c);var d=t.aliHeader||{};n.set("OSSAccessKeyId",d.osskeyId),n.set("policy",d.ossPolicy),n.set("Signature",d.ossSign),n.set("success_action_status",200),n.delete("key"),n.append("key",t.uploadFileName),n.delete("file"),n.append("file",r),s.send(n)},s3:function(n,t,e,r){var i=new FormData,o=new XMLHttpRequest,s=or(),c=t.contentDisposition,d=Tt[0][1],l=s+t.s3BucketName+"."+d;console.log("uploadS3:url",l),Tt.shift(),o.upload&&t.support_options&&(o.upload.onprogress=function(u){e.onProgress(u.loaded,u.total)}),o.onreadystatechange=function(){if(o.readyState===4){var u=JSON.parse(o.responseText||"{}");if(u.name=t.uniqueValue,u.filename=t.uploadFileName,u.uploadMethod=Kt.AWS,o.status===200||o.status===204)e.onCompleted(u);else if(Tt.length){var p=new FormData;p.set("file",n.get("file")),p.set("key",n.get("key")),p.set("token",n.get("token")),qe[Tt[0][0]](p,t,e,r)}else e.onError("upload fail")}},o.open(t.method,l,!0);var h=t?t.s3Header:{},a=r&&r.type;c?i.set("Content-Disposition",c+";"):i.set("Content-Disposition",a==="text/html"?"inline;":"attachment;"),i.set("Content-Type",a),i.set("x-amz-credential",h.s3Credential),i.set("x-amz-algorithm",h.s3Algorithm),i.set("x-amz-date",h.s3Date),i.set("policy",h.s3Policy),i.set("x-amz-signature",h.s3Signature),i.set("key",t.uploadFileName),i.set("file",r),o.send(i)},stc:function(n,t,e,r){var i=new XMLHttpRequest,o=t.contentDisposition,s="https://"+Tt[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;Tt.shift(),i.upload&&t.support_options&&(i.upload.onprogress=function(d){e.onProgress(d.loaded,d.total)}),i.onreadystatechange=function(){if(i.readyState===4){var d=JSON.parse(i.responseText||"{}");if(d.name=t.uniqueValue,d.filename=t.uploadFileName,d.uploadMethod=Kt?Kt.STC:"",i.status===200||i.status===204)e.onCompleted(d);else if(Tt.length){var l=new FormData;l.set("file",n.get("file")),l.set("key",n.get("key")),l.set("token",n.get("token")),qe[Tt[0][0]](l,t,e,r)}else e.onError("upload fail")}},i.open("PUT",s,!0);var c=t?t.stcHeader:{};i.setRequestHeader("Content-Type",r.type),o?i.setRequestHeader("Content-Disposition",o+";"):i.setRequestHeader("Content-Disposition",r.type==="text/html"?"inline;":"attachment;"),i.setRequestHeader("Authorization",c.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",c.stcContentSha256),i.setRequestHeader("x-amz-date",c.stcDate),i.send(r)}},Tt=[],Ia=5368709120;function Sa(n,t){for(var e in n)t(e,n[e])}function or(){var n="https://";return location.protocol!=="http:"&&location.protocol!=="file:"||(n="http://"),n}function Hl(n,t,e){var r,i,o=n&&n.type||"text/plain",s=o.indexOf("image")>-1?1:4,c=t.contentDisposition,d=Math.ceil(n.size/t.stc_chunk_size),l=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(l)||(l=[]);var h=l.find(function(_){return Object.keys(_).includes("stc")}),a="uploads";ee.imClient.context.getFileToken(s,r,"POST",a).then(function(_){r=_.fileName,i="https://"+h.stc+"/"+t.stcBucketName+"/"+r,console.log("uploadStcMultipart:url",i);var v=new XMLHttpRequest;v.open("POST",i+"?"+a,!0),c?v.setRequestHeader("Content-Disposition",c+";"):v.setRequestHeader("Content-Disposition",n.type==="text/html"?"inline;":"attachment;"),v.setRequestHeader("Authorization",_&&_.stcAuthorization),v.setRequestHeader("x-amz-content-sha256",_&&_.stcContentSha256),v.setRequestHeader("x-amz-date",_&&_.stcDate),v.setRequestHeader("Content-Type",o),v.send(),v.onreadystatechange=function(){if(v.readyState===4){var T=v.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",T),v.status===200||v.status===204?function(y){for(var w=[],L=1;L<=d;L++)w.push(m(y,L));f(y,w)}(Array.isArray(T)&&T[1]):e.onError("uploadStcMultipart:did not get uploadId")}}},function(_){e.onError("uploadStcMultipart:"+_)});var u=[],p=new Map;function f(_,v){v&&Array.isArray(v)&&v.length!==0&&Promise.all(v).then(function(){var T="uploadId="+_;if(p.size===d)ee.imClient.context.getFileToken(s,r,"POST",T).then(function(C){console.log("onSuccess",C),console.log("onSuccess:uploadId",_);var A=new XMLHttpRequest;A.open("POST",i+"?"+T,!0),A.setRequestHeader("Authorization",C&&C.stcAuthorization),A.setRequestHeader("x-amz-content-sha256",C&&C.stcContentSha256),A.setRequestHeader("x-amz-date",C&&C.stcDate),A.setRequestHeader("Content-Type",o);var F="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",G=Array.from(p.keys()||[]).sort(function(E,S){return E-S});console.log("keys",G),G.forEach(function(E){F+="<Part><ETag>".concat(p.get(E),"</ETag><PartNumber>").concat(E,"</PartNumber></Part>")}),F+="</CompleteMultipartUpload>",A.send(F),console.log("xml",F),A.onreadystatechange=function(){if(A.readyState===4)if(A.status===200||A.status===204){var E={name:n.name,filename:t.uploadFileName,uploadMethod:Kt.STC};e.onCompleted(E)}else e.onError("uploadStcMultipart:upload does not end")}},function(C){e.onError("uploadStcMultipart:"+C)});else{for(var y=[],w=0,L=u;w<L.length;w++){var M=L[w];y.push(m(_,M))}f(_,y)}},function(T){console.error(T),e.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");for(var y=[],w=0,L=u;w<L.length;w++){var M=L[w];y.push(m(_,M))}f(_,y)})}function m(_,v){return new Promise(function(T,y){var w="partNumber="+v+"&uploadId="+_;ee.imClient.context.getFileToken(s,r,"PUT",w).then(function(L){console.log("signature "+v+" onSuccess",L);var M=n&&n.slice((v-1)*t.stc_chunk_size,v*t.stc_chunk_size);console.log("fileChunk:size",M.size);var C=new XMLHttpRequest;C.open("PUT",i+"?"+w,!0),C.setRequestHeader("Authorization",L&&L.stcAuthorization),C.setRequestHeader("x-amz-content-sha256",L&&L.stcContentSha256),C.setRequestHeader("x-amz-date",L&&L.stcDate),C.setRequestHeader("Content-Type",o),C.send(M),C.onreadystatechange=function(){if(C.readyState===4)if(C.status===200||C.status===204){var A=C.getResponseHeader("etag");console.log("etag:"+v,A),p.set(v,A),T(A)}else u.includes(v)||u.push(v),y(v)}},function(L){console.log("getETags:\u7B7E\u540D\u9A8C\u8BC1\u5931\u8D25"),u.includes(v)||u.push(v),y(v)})})}}var Uc={form:function(n,t){var e=new FormData;if(t.unique_key){var r=n.name.substr(n.name.lastIndexOf(".")),i=no()+r;e.append(t.unique_key,i),t.uniqueValue=i}return e.append(t.file_data_name,n),ro(t.multi_parmas,function(o,s){e.append(o,s)}),e},json:function(n,t){var e={};if(t.unique_key){var r=n.name.substr(n.name.lastIndexOf(".")),i=no()+r;e[t.unique_key]=i,t.uniqueValue=i}return e[t.file_data_name]=n,ro(t.multi_parmas,function(o,s){e[o]=s}),JSON.stringify(e)},data:function(n,t){return n}};function no(){var n=new Date().getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),(t==="x"?e:3&e|8).toString(16)})}function ro(n,t){for(var e in n)t(e,n[e])}var sr,Ri=0,$l=function(){function n(t){this.options=function(e){var r={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:Uc.form,genUId:no};if(!e||!e.domain)throw new Error("domain is null");for(var i in e)r[i]=e[i];return r}(t)}return n.prototype.setOptions=function(t){var e=this;ro(t,function(r,i){e.options[r]=i})},n.prototype.upload=function(t,e){if(t){var r=this;(function(i,o,s){if(Lc=i,eo=o,Tt=[],o.ossConfig){var c,d,l=JSON.parse(o.ossConfig),h="",a=[];l.forEach(function(m){var _=Number(m.p)-1;for(var v in m)v==="aliyun"&&(h=m[v]),v==="s3"&&(c=m[v]),v==="stc"&&(d=m[v]),v!=="p"&&(a[_]=[v,m[v]])}),a.forEach(function(m){m&&Tt.push(m)}),l.length!==Tt.length&&(Tt=[["qiniu",o.domain],["baidu",o.uploadHost.bos],["aliyun",h],["s3",c],["stc",d]])}else Tt=[["qiniu",o.domain],["baidu",o.uploadHost.bos]];var u;if(o.ossConfig){var p=o&&JSON.parse(o.ossConfig);Array.isArray(p)||(p=[]),u=p.find(function(m){return Object.keys(m).includes("stc")})}if(u&&parseInt(u.p)===1&&i.size>=4194304)Hl(i,o,s);else{var f=o.data(i,o);qe[Tt[0][0]](f,o,s,i)}})(t,this.options,{onProgress:function(i,o,s){sr=i,s?sr=Ri+i/o*(o-Ri):Ri=sr,e.onProgress(sr,o)},onCompleted:function(i){e.onCompleted(i)},onError:function(i){e.onError(i)},onOpen:function(i){r.xhr=i}})}else e.onError("upload file is null.")},n.prototype.cancel=function(){this.xhr&&this.xhr.abort()},n}(),Ii,ar,Oa={init:function(n){return new $l(n)},dataType:Uc,resize:function(n,t,e){n.type;var r=document.createElement("canvas"),i=new FileReader;i.readAsDataURL(n),i.onload=function(o){var s=o.target.result,c=new Image;c.src=s;var d=c.width,l=c.height,h=function(u,p){var f=1,m=u.width,_=p.maxWidth||0;_>0&&m>_&&(f=_/m);var v=u.height,T=p.maxHeight||0;if(T>0&&v>T){var y=T/v;f=Math.min(f,y)}var w=p.maxSize||0,L=Math.ceil(u.size/1e3);if(L>w){var M=w/L;f=Math.min(f,M)}return f}({width:d,height:l,size:o.total},t),a=s;h<1&&(a=function(u,p,f){return r.width=p,r.height=f,r.getContext("2d").drawImage(u,0,0,p,f),r.toDataURL("image/jpg")}(c,d*h,l*h)),e(a)}}},Gl=function(n,t,e){var r=document.createElement("canvas"),i=r.getContext("2d"),o=new Image,s=typeof n=="string";o.onload=function(c){var d=function(h,a,u){var p,f,m,_=h<a,v=0,T=0;return(_?a/h:h/a)>u.scale?(_?(f=100,T=((m=a/(p=h/100))-u.maxHeight)/2):(m=100,v=((f=h/(p=a/100))-u.maxWidth)/2),{w:f,h:m,x:-v,y:-T}):(_?(p=a/u.maxHeight,m=u.maxHeight,f=h/p):(p=h/u.maxWidth,f=u.maxWidth,m=a/p),{w:f,h:m,x:-v,y:-T})}(o.width,o.height,t);r.width=d.w>t.maxWidth?t.maxWidth:d.w,r.height=d.h>t.maxHeight?t.maxHeight:d.h,i.drawImage(o,d.x,d.y,d.w,d.h);var l=r.toDataURL(typeof n=="string"?"image/jpg":n.type,t.quality);l=l.replace(/data:image\/[^;]+;base64,/,""),e(l)},o.src=s?"data:image/jpg;base64,"+n:function(c){var d=window.URL||window.webkitURL;return d?d.createObjectURL(c):""}(n)},Kl=function(n,t){var e=n.file,r=n.compress;Gl(e,r,t)},Dc=function(n,t){if(n.getToken)n.getToken(function(r,i){i=i||{},n.multi_parmas||(n.multi_parmas={}),n.multi_parmas.token=r,n.uploadHost||(n.uploadHost={}),n.uploadHost.bos=i.bos,n.ossConfig=i.ossConfig,n.bosHeader||(n.bosHeader={}),n.bosHeader.bosDate=i.bosDate,n.bosHeader.bosToken=i.bosToken,n.bosUploadPath=i.path,n.aliHeader={},n.aliHeader.osskeyId=i.osskeyId,n.aliHeader.ossPolicy=i.ossPolicy,n.aliHeader.ossSign=i.ossSign,n.ossBucketName=i.ossBucketName,n.uploadFileName=i.fileName,n.s3Header={},n.s3Header.s3Credential=i.s3Credential,n.s3Header.s3Algorithm=i.s3Algorithm,n.s3Header.s3Date=i.s3Date,n.s3Header.s3Policy=i.s3Policy,n.s3Header.s3Signature=i.s3Signature,n.s3BucketName=i.s3BucketName,n.stcHeader={},n.stcHeader.stcAuthorization=i.stcAuthorization,n.stcHeader.stcContentSha256=i.stcContentSha256,n.stcHeader.stcDate=i.stcDate,n.stcBucketName=i.stcBucketName,n.headers||(n.headers={}),n.base64&&(n.headers["Content-type"]="application/octet-stream",n.headers.Authorization="UpToken "+r),console.log("data",i);var o=Oa.init(n);t(o)});else{n.headers||(n.headers={}),n.base64&&(n.headers["Content-type"]="application/octet-stream");var e=Oa.init(n);t(e)}},kc=function(n,t,e){t.upload(n.file,{onError:function(r){e.onError(r)},onProgress:function(r,i){e.onProgress(r,i)},onCompleted:function(r){r.filename||(r.filename=r.hash);var i=n.compressThumbnail||Kl;n.compress?i(n,function(o){r.thumbnail=o,e.onCompleted(r)}):e.onCompleted(r)}})},jl=function(){function n(t){this.instance=t}return n.prototype.upload=function(t,e){kc({file:t},this.instance,e)},n.prototype.cancel=function(){this.instance.cancel()},n}(),ql=function(){function n(t,e){this.instance=t,this.cfg=e}return n.prototype.upload=function(t,e){var r={file:t,compress:this.cfg};kc(r,this.instance,e)},n.prototype.cancel=function(){this.instance.cancel()},n}(),Yl=function(n,t){Dc(n,function(e){var r,i,o,s,c={maxHeight:((r=n.thumbnailConfig)===null||r===void 0?void 0:r.maxHeight)||160,maxWidth:((i=n.thumbnailConfig)===null||i===void 0?void 0:i.maxWidth)||160,quality:((o=n.thumbnailConfig)===null||o===void 0?void 0:o.quality)||.5,scale:((s=n.thumbnailConfig)===null||s===void 0?void 0:s.scale)||2.4},d=new ql(e,c);t(d)})},zl=function(n,t){Dc(n,function(e){var r=new jl(e);t(r)})},Jl=Yl;function Na(n){return Ii=Ii||new AudioContext,new Promise(function(t,e){Ii.decodeAudioData(n,function(r){t({duration:r.duration,length:r.length})},e)})}function Wl(n,t,e,r,i){return dt("fileType",n,fd,!0),dt("filename",t,ut.STRING),dt("saveName",e,ut.STRING),dt("serverType",i,ut.NUMBER),new Promise(function(o){ee.imClient.context.getFileUrl(n,t,e,r,i).then(function(s){o({code:R.SUCCESS,data:s})}).catch(function(s){o({code:s})})})}function xc(n,t,e){return sn(this,void 0,void 0,function(){var r,i,o,s,c,d,l,h,a,u;return an(this,function(p){switch(p.label){case 0:return e=e||{},t instanceof Pc?(dt("conversation",n,ut.OBJECT,!0),r=n.conversationType,i=n.targetId,o=n.channelId,dt("conversation.targetId",i,ut.STRING,!0),dt("conversation.conversationType",r,ut.NUMBER),dt("conversation.channelId",o,ut.CHANNEL_ID),dt("options.isStatusMessage",e==null?void 0:e.isStatusMessage,ut.BOOLEAN),dt("options.disableNotification",e==null?void 0:e.disableNotification,ut.BOOLEAN),dt("options.pushContent",e==null?void 0:e.pushContent,ut.STRING),dt("options.pushData",e==null?void 0:e.pushData,ut.STRING),dt("options.isMentioned",e==null?void 0:e.isMentioned,ut.BOOLEAN),dt("options.mentionedType",e==null?void 0:e.mentionedType,ut.NUMBER),dt("options.mentionedUserIdList",e==null?void 0:e.mentionedUserIdList,ut.ARRAY),dt("options.directionalUserIdList",e==null?void 0:e.directionalUserIdList,ut.ARRAY),dt("options.isVoipPush",e==null?void 0:e.isVoipPush,ut.BOOLEAN),dt("options.canIncludeExpansion",e==null?void 0:e.canIncludeExpansion,ut.BOOLEAN),dt("options.expansion",e==null?void 0:e.expansion,ut.OBJECT),dt("options.pushConfig",e==null?void 0:e.pushConfig,ut.OBJECT),s="conversationType:"+r+",targetId:"+i,Ie.debug("send message ->"+s),(c=Object.assign(e,t)).channelId=o||"",[4,ee.imClient.context.sendMessage(r,i,c)]):(Ie.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,Dr.ILLGAL_PARAMS]);case 1:return d=p.sent(),l=d.code,h=d.data,l===R.SUCCESS?(a=An(h),[2,{code:l,data:a}]):(Ie.warn("send message fail ->"+l+":"+cn[l]+","+s),u={isMentioned:!!e.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(e==null?void 0:e.disableNotification),canIncludeExpansion:!!(e==null?void 0:e.canIncludeExpansion),expansion:(e==null?void 0:e.expansion)||null,conversationType:n.conversationType,targetId:n.targetId,channelId:n.channelId,senderUserId:ee.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:zt.SEND,sentTime:(h==null?void 0:h.sentTime)||0,receivedTime:0,isStatusMessage:e.isStatusMessage||!1,receivedStatus:Un.UNREAD,isOffLineMessage:!1},r!==Y.ULTRA_GROUP&&(u.isOffLineMessage=!1),[2,{code:l,msg:cn[l],data:An(u)}])}})})}function jn(n,t){return function(e,r,i,o){dt("sendOptions.contentDisposition",o==null?void 0:o.contentDisposition,function(d){return["inline","attachment"].includes(d)});var s={contentDisposition:o==null?void 0:o.contentDisposition};if(o&&"thumbnailConfig"in o){var c=o==null?void 0:o.thumbnailConfig;dt("sendOptions.maxHeight",c==null?void 0:c.maxHeight,ut.NUMBER),dt("sendOptions.maxWidth",c==null?void 0:c.maxWidth,ut.NUMBER),dt("sendOptions.quality",c==null?void 0:c.quality,ut.NUMBER),dt("sendOptions.scale",c==null?void 0:c.scale,ut.NUMBER),s.thumbnailConfig=c}return new Promise(function(d){(function(l,h,a,u){var p,f=this;if(h===void 0&&(h=wt.FILE),p=h===wt.IMAGE?wt.IMAGE:wt.FILE,!ar){ar="upload.qiniup.com";var m=ee.imClient.context.getInfoFromCache();if(m&&m.ossConfig)try{var _=JSON.parse(m.ossConfig).find(function(T){return T.qiniu!==void 0});_&&(ar=_.qiniu)}catch{}}var v=to({domain:ar,getToken:function(T){ee.imClient.context.getFileToken(p).then(function(y){T(y.token,y)}).catch(function(y){a.onFail(y)})}},u);(p===wt.IMAGE?Jl:zl)(v,function(T){T.upload(l,{onProgress:function(y,w){var L,M=Math.floor(y/w*100);(L=a.onProgress)===null||L===void 0||L.call(a,M)},onCompleted:function(y){return sn(f,void 0,void 0,function(){var w=this;return an(this,function(L){return Wl(p,y.filename,y.name,y,y.uploadMethod).then(function(M){return sn(w,void 0,void 0,function(){var C,A;return an(this,function(F){return M.code!==0?(a.onFail(M),[2]):((C=M.data).type=l.type,C.name=y.name||y.filename,h===wt.AUDIO?(typeof l.arrayBuffer=="function"?l.arrayBuffer().then(Na).then(function(G){Object.assign(C,G),a.onSuccess(C)},function(){a.onSuccess(C)}):((A=new FileReader).onload=function(){A.result?Na(A.result).then(function(G){Object.assign(C,G),a.onSuccess(C)},function(){a.onSuccess(C)}):a.onSuccess(C)},A.onerror=function(){C.duration=0,a.onSuccess(C)},A.readAsArrayBuffer(l)),[2]):(p===wt.IMAGE&&(C.thumbnail=y.thumbnail),a.onSuccess(C),[2]))})})}).catch(function(M){a.onFail(M)}),[2]})})},onError:function(y){a.onFail(y)}})})})(r.file,n,{onProgress:i==null?void 0:i.onProgress,onSuccess:function(l){var h,a=((h=i==null?void 0:i.onComplete)===null||h===void 0?void 0:h.call(i,{url:l.downloadUrl}))||t(l,r);xc(e,a,o).then(d)},onFail:function(l){d({code:R.UPLOAD_FILE_FAILED,msg:l||R[R.UPLOAD_FILE_FAILED]})}},s)})}}jn(wt.FILE,function(n,t){return new Fl({name:n.name,size:t.file.size,type:t.file.type,fileUrl:n.downloadUrl,user:t.user,extra:t.extra})});jn(wt.IMAGE,function(n,t){return new Dl({content:n.thumbnail,imageUri:n.downloadUrl,user:t.user,extra:t.extra})});jn(wt.AUDIO,function(n,t){return new kl({remoteUrl:n.downloadUrl,duration:n.duration,type:n.type,user:t.user,extra:t.extra})});jn(wt.SIGHT,function(n,t){return new xl({sightUrl:n.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||n.size,name:t.name||n.name,user:t.user,extra:t.extra})});function pe(n,t,e,r,i){return dt("messageType",n,ut.STRING,!0),dt("isPersited",t,ut.BOOLEAN,!0),dt("isCounted",e,ut.BOOLEAN,!0),dt("isStatusMessage",i,ut.BOOLEAN,!1),ee.imClient.context.registerMessageType(n,t,e,r,i),Qt(n,t,e)}jn(wt.COMBINE_HTML,function(n,t){return new Bl({remoteUrl:n.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})});Sn.add("imlib-next","5.3.3");/*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */function j(n,t,e,r){return new(e||(e=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function c(l){try{d(r.throw(l))}catch(h){o(h)}}function d(l){var h;l.done?i(l.value):(h=l.value,h instanceof e?h:new e(function(a){a(h)})).then(s,c)}d((r=r.apply(n,t||[])).next())})}const O=new Le("RCRTC");var P,io;(function(n){n[n.SUCCESS=1e4]="SUCCESS",n[n.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",n[n.PARAMS_ERROR=50001]="PARAMS_ERROR",n[n.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",n[n.NOT_IN_ROOM=50003]="NOT_IN_ROOM",n[n.SERVICE_INVALID=50004]="SERVICE_INVALID",n[n.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",n[n.SIGNAL_ERROR=53001]="SIGNAL_ERROR",n[n.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",n[n.REQUEST_FAILED=53004]="REQUEST_FAILED",n[n.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",n[n.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",n[n.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",n[n.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",n[n.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",n[n.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",n[n.PERMISSION_DENIED=53012]="PERMISSION_DENIED",n[n.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",n[n.INVALID_TAGS=53014]="INVALID_TAGS",n[n.INVALID_USER_ID=53015]="INVALID_USER_ID",n[n.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",n[n.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",n[n.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",n[n.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",n[n.TRACK_NOT_READY=53020]="TRACK_NOT_READY",n[n.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",n[n.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",n[n.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",n[n.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",n[n.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",n[n.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",n[n.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",n[n.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",n[n.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",n[n.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM"})(P||(P={})),function(n){n[n.JOIN_REFUSED=40032]="JOIN_REFUSED"}(io||(io={}));class Vc{constructor(){this.queue=[],this.locked=!1}checkToStart(){return j(this,void 0,void 0,function*(){if(this.queue.length===0||this.locked)return;this.locked=!0;const{resolve:t,task:e,reject:r}=this.queue.shift();let i;try{i=yield e(),t(i)}catch(o){r(o)}this.locked=!1,this.checkToStart()})}push(t){const e=new Promise((r,i)=>{this.queue.push({resolve:r,task:t,reject:i})});return this.checkToStart(),e}}const Zl=new Vc,Ct=n=>Zl.push(n);let Bc=!0,Fc=!0;function yn(n,t,e){const r=n.match(t);return r&&r.length>=e&&parseInt(r[e],10)}function pn(n,t,e){if(!n.RTCPeerConnection)return;const r=n.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(s,c){if(s!==t)return i.apply(this,arguments);const d=l=>{const h=e(l);h&&(c.handleEvent?c.handleEvent(h):c(h))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(c,d),i.apply(this,[s,d])};const o=r.removeEventListener;r.removeEventListener=function(s,c){if(s!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(c))return o.apply(this,arguments);const d=this._eventMap[t].get(c);return this._eventMap[t].delete(c),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[s,d])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(s){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),s&&this.addEventListener(t,this["_on"+t]=s)},enumerable:!0,configurable:!0})}function Ql(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(Bc=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Xl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(Fc=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Cs(){if(typeof window=="object"){if(Bc)return;typeof console!="undefined"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function ai(n,t){Fc&&console.warn(n+" is deprecated, please use "+t+" instead.")}function ba(n){return Object.prototype.toString.call(n)==="[object Object]"}function Hc(n){return ba(n)?Object.keys(n).reduce(function(t,e){const r=ba(n[e]),i=r?Hc(n[e]):n[e],o=r&&!Object.keys(i).length;return i===void 0||o?t:Object.assign(t,{[e]:i})},{}):n}function oo(n,t,e){t&&!e.has(t.id)&&(e.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith("Id")?oo(n,n.get(t[r]),e):r.endsWith("Ids")&&t[r].forEach(i=>{oo(n,n.get(i),e)})}))}function Ma(n,t,e){const r=e?"outbound-rtp":"inbound-rtp",i=new Map;if(t===null)return i;const o=[];return n.forEach(s=>{s.type==="track"&&s.trackIdentifier===t.id&&o.push(s)}),o.forEach(s=>{n.forEach(c=>{c.type===r&&c.trackId===s.id&&oo(n,c,i)})}),i}const Aa=Cs;function $c(n,t){const e=n&&n.navigator;if(!e.mediaDevices)return;const r=function(s){if(typeof s!="object"||s.mandatory||s.optional)return s;const c={};return Object.keys(s).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;const l=typeof s[d]=="object"?s[d]:{ideal:s[d]};l.exact!==void 0&&typeof l.exact=="number"&&(l.min=l.max=l.exact);const h=function(a,u){return a?a+u.charAt(0).toUpperCase()+u.slice(1):u==="deviceId"?"sourceId":u};if(l.ideal!==void 0){c.optional=c.optional||[];let a={};typeof l.ideal=="number"?(a[h("min",d)]=l.ideal,c.optional.push(a),a={},a[h("max",d)]=l.ideal,c.optional.push(a)):(a[h("",d)]=l.ideal,c.optional.push(a))}l.exact!==void 0&&typeof l.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[h("",d)]=l.exact):["min","max"].forEach(a=>{l[a]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[h(a,d)]=l[a])})}),s.advanced&&(c.optional=(c.optional||[]).concat(s.advanced)),c},i=function(s,c){if(t.version>=61)return c(s);if((s=JSON.parse(JSON.stringify(s)))&&typeof s.audio=="object"){const d=function(l,h,a){h in l&&!(a in l)&&(l[a]=l[h],delete l[h])};d((s=JSON.parse(JSON.stringify(s))).audio,"autoGainControl","googAutoGainControl"),d(s.audio,"noiseSuppression","googNoiseSuppression"),s.audio=r(s.audio)}if(s&&typeof s.video=="object"){let d=s.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});const l=t.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&(!e.mediaDevices.getSupportedConstraints||!e.mediaDevices.getSupportedConstraints().facingMode||l)){let h;if(delete s.video.facingMode,d.exact==="environment"||d.ideal==="environment"?h=["back","rear"]:d.exact!=="user"&&d.ideal!=="user"||(h=["front"]),h)return e.mediaDevices.enumerateDevices().then(a=>{let u=(a=a.filter(p=>p.kind==="videoinput")).find(p=>h.some(f=>p.label.toLowerCase().includes(f)));return!u&&a.length&&h.includes("back")&&(u=a[a.length-1]),u&&(s.video.deviceId=d.exact?{exact:u.deviceId}:{ideal:u.deviceId}),s.video=r(s.video),Aa("chrome: "+JSON.stringify(s)),c(s)})}s.video=r(s.video)}return Aa("chrome: "+JSON.stringify(s)),c(s)},o=function(s){return t.version>=64?s:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[s.name]||s.name,message:s.message,constraint:s.constraint||s.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(e.getUserMedia=function(s,c,d){i(s,l=>{e.webkitGetUserMedia(l,c,h=>{d&&d(o(h))})})}.bind(e),e.mediaDevices.getUserMedia){const s=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(c){return i(c,d=>s(d).then(l=>{if(d.audio&&!l.getAudioTracks().length||d.video&&!l.getVideoTracks().length)throw l.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return l},l=>Promise.reject(o(l))))}}}function Gc(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function Kc(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",r=>{let i;i=n.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(s=>s.track&&s.track.id===r.track.id):{track:r.track};const o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[e.stream],this.dispatchEvent(o)}),e.stream.getTracks().forEach(r=>{let i;i=n.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(s=>s.track&&s.track.id===r.id):{track:r};const o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[e.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else pn(n,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function jc(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const t=function(i,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=i.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:i}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,c){let d=i.apply(this,arguments);return d||(d=t(this,s),this._senders.push(d)),d};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){o.apply(this,arguments);const c=this._senders.indexOf(s);c!==-1&&this._senders.splice(c,1)}}const e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(i){this._senders=this._senders||[],e.apply(this,[i]),i.getTracks().forEach(o=>{this._senders.push(t(this,o))})};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(i){this._senders=this._senders||[],r.apply(this,[i]),i.getTracks().forEach(o=>{const s=this._senders.find(c=>c.track===o);s&&this._senders.splice(this._senders.indexOf(s),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(r=>r._pc=this),e},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function qc(n){if(!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&typeof e=="function")return t.apply(this,arguments);if(t.length===0&&(arguments.length===0||typeof e!="function"))return t.apply(this,[]);const o=function(c){const d={};return c.result().forEach(l=>{const h={id:l.id,timestamp:l.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[l.type]||l.type};l.names().forEach(a=>{h[a]=l.stat(a)}),d[h.id]=h}),d},s=function(c){return new Map(Object.keys(c).map(d=>[d,c[d]]))};if(arguments.length>=2){const c=function(d){r(s(o(d)))};return t.apply(this,[c,e])}return new Promise((c,d)=>{t.apply(this,[function(l){c(s(o(l)))},d])}).then(r,i)}}function Yc(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;e&&(n.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(o=>o._pc=this),i});const r=n.RTCPeerConnection.prototype.addTrack;r&&(n.RTCPeerConnection.prototype.addTrack=function(){const i=r.apply(this,arguments);return i._pc=this,i}),n.RTCRtpSender.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>Ma(o,i.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const e=n.RTCPeerConnection.prototype.getReceivers;e&&(n.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r}),pn(n,"track",r=>(r.receiver._pc=r.srcElement,r)),n.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(i=>Ma(i,r.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype)||!("getStats"in n.RTCRtpReceiver.prototype))return;const t=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const e=arguments[0];let r,i,o;return this.getSenders().forEach(s=>{s.track===e&&(r?o=!0:r=s)}),this.getReceivers().forEach(s=>(s.track===e&&(i?o=!0:i=s),s.track===e)),o||r&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function zc(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const t=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,s){if(!s)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=t.apply(this,arguments);return this._shimmedLocalStreams[s.id]?this._shimmedLocalStreams[s.id].indexOf(c)===-1&&this._shimmedLocalStreams[s.id].push(c):this._shimmedLocalStreams[s.id]=[s,c],c};const e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(d=>{if(this.getSenders().find(l=>l.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});const s=this.getSenders();e.apply(this,arguments);const c=this.getSenders().filter(d=>s.indexOf(d)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],r.apply(this,arguments)};const i=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(s=>{const c=this._shimmedLocalStreams[s].indexOf(o);c!==-1&&this._shimmedLocalStreams[s].splice(c,1),this._shimmedLocalStreams[s].length===1&&delete this._shimmedLocalStreams[s]}),i.apply(this,arguments)}}function Jc(n,t){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&t.version>=65)return zc(n);const e=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=e.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(h=>this._reverseStreams[h.id])};const r=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(h=>{if(this.getSenders().find(a=>a.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const h=new n.MediaStream(l.getTracks());this._streams[l.id]=h,this._reverseStreams[h.id]=l,l=h}r.apply(this,[l])};const i=n.RTCPeerConnection.prototype.removeStream;function o(l,h){let a=h.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],f=l._streams[p.id];a=a.replace(new RegExp(f.id,"g"),p.id)}),new RTCSessionDescription({type:h.type,sdp:a})}function s(l,h){let a=h.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],f=l._streams[p.id];a=a.replace(new RegExp(p.id,"g"),f.id)}),new RTCSessionDescription({type:h.type,sdp:a})}n.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},n.RTCPeerConnection.prototype.addTrack=function(l,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const a=[].slice.call(arguments,1);if(a.length!==1||!a[0].getTracks().find(f=>f===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(f=>f.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const p=this._streams[h.id];if(p)p.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const f=new n.MediaStream([l]);this._streams[h.id]=f,this._reverseStreams[f.id]=h,this.addStream(f)}return this.getSenders().find(f=>f.track===l)},["createOffer","createAnswer"].forEach(function(l){const h=n.RTCPeerConnection.prototype[l],a={[l](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=o(this,p);u[0].apply(null,[f])},p=>{u[1]&&u[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=a[l]});const c=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),c.apply(this,arguments)):c.apply(this,arguments)};const d=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=d.get.apply(this);return l.type===""?l:o(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(l._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let h;this._streams=this._streams||{},Object.keys(this._streams).forEach(a=>{this._streams[a].getTracks().find(u=>l.track===u)&&(h=this._streams[a])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function so(n,t){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){const r=n.RTCPeerConnection.prototype[e],i={[e](){return arguments[0]=new(e==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};n.RTCPeerConnection.prototype[e]=i[e]})}function Wc(n,t){pn(n,"negotiationneeded",e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")||r.signalingState==="stable")return e})}var wa=Object.freeze({__proto__:null,shimMediaStream:Gc,shimOnTrack:Kc,shimGetSendersWithDtmf:jc,shimGetStats:qc,shimSenderReceiverGetStats:Yc,shimAddTrackRemoveTrackWithNative:zc,shimAddTrackRemoveTrack:Jc,shimPeerConnection:so,fixNegotiationNeeded:Wc,shimGetUserMedia:$c,shimGetDisplayMedia:function(n,t){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(typeof t=="function"?n.navigator.mediaDevices.getDisplayMedia=function(e){return t(e).then(r=>{const i=e.video&&e.video.width,o=e.video&&e.video.height,s=e.video&&e.video.frameRate;return e.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:r,maxFrameRate:s||3}},i&&(e.video.mandatory.maxWidth=i),o&&(e.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(e)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Pa,Si,ot=(Pa=function(n){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split(`
- `).map(function(r){return r.trim()})},t.splitSections=function(e){return e.split(`
- m=`).map(function(r,i){return(i>0?"m="+r:r).trim()+`\r
- `})},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter(function(i){return i.indexOf(r)===0})},t.parseCandidate=function(e){for(var r,i={foundation:(r=e.indexOf("a=candidate:")===0?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(r[1],10),protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]},o=8;o<r.length;o+=2)switch(r[o]){case"raddr":i.relatedAddress=r[o+1];break;case"rport":i.relatedPort=parseInt(r[o+1],10);break;case"tcptype":i.tcpType=r[o+1];break;case"ufrag":i.ufrag=r[o+1],i.usernameFragment=r[o+1];break;default:i[r[o]]=r[o+1]}return i},t.writeCandidate=function(e){var r=[];r.push(e.foundation),r.push(e.component),r.push(e.protocol.toUpperCase()),r.push(e.priority),r.push(e.address||e.ip),r.push(e.port);var i=e.type;return r.push("typ"),r.push(i),i!=="host"&&e.relatedAddress&&e.relatedPort&&(r.push("raddr"),r.push(e.relatedAddress),r.push("rport"),r.push(e.relatedPort)),e.tcpType&&e.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(r.push("ufrag"),r.push(e.usernameFragment||e.ufrag)),"candidate:"+r.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var r=e.substr(9).split(" "),i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=r.length===3?parseInt(r[2],10):1,i.numChannels=i.channels,i},t.writeRtpMap=function(e){var r=e.payloadType;e.preferredPayloadType!==void 0&&(r=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+r+" "+e.name+"/"+e.clockRate+(i!==1?"/"+i:"")+`\r
- `},t.parseExtmap=function(e){var r=e.substr(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&e.direction!=="sendrecv"?"/"+e.direction:"")+" "+e.uri+`\r
- `},t.parseFmtp=function(e){for(var r,i={},o=e.substr(e.indexOf(" ")+1).split(";"),s=0;s<o.length;s++)i[(r=o[s].trim().split("="))[0].trim()]=r[1];return i},t.writeFmtp=function(e){var r="",i=e.payloadType;if(e.preferredPayloadType!==void 0&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var o=[];Object.keys(e.parameters).forEach(function(s){e.parameters[s]?o.push(s+"="+e.parameters[s]):o.push(s)}),r+="a=fmtp:"+i+" "+o.join(";")+`\r
- `}return r},t.parseRtcpFb=function(e){var r=e.substr(e.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},t.writeRtcpFb=function(e){var r="",i=e.payloadType;return e.preferredPayloadType!==void 0&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(o){r+="a=rtcp-fb:"+i+" "+o.type+(o.parameter&&o.parameter.length?" "+o.parameter:"")+`\r
- `}),r},t.parseSsrcMedia=function(e){var r=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,r-7),10)},o=e.indexOf(":",r);return o>-1?(i.attribute=e.substr(r+1,o-r-1),i.value=e.substr(o+1)):i.attribute=e.substr(r+1),i},t.parseSsrcGroup=function(e){var r=e.substr(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(function(i){return parseInt(i,10)})}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var r=e.substr(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,r){var i="a=setup:"+r+`\r
- `;return e.fingerprints.forEach(function(o){i+="a=fingerprint:"+o.algorithm+" "+o.value+`\r
- `}),i},t.parseCryptoLine=function(e){var r=e.substr(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+(typeof e.keyParams=="object"?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+`\r
- `},t.parseCryptoKeyParams=function(e){if(e.indexOf("inline:")!==0)return null;var r=e.substr(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],o=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substr(12),password:o.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+`\r
- a=ice-pwd:`+e.password+`\r
- `},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" "),o=3;o<i.length;o++){var s=i[o],c=t.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(c){var d=t.parseRtpMap(c),l=t.matchPrefix(e,"a=fmtp:"+s+" ");switch(d.parameters=l.length?t.parseFmtp(l[0]):{},d.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(t.parseRtcpFb),r.codecs.push(d),d.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(d.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach(function(h){r.headerExtensions.push(t.parseExtmap(h))}),r},t.writeRtpDescription=function(e,r){var i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map(function(s){return s.preferredPayloadType!==void 0?s.preferredPayloadType:s.payloadType}).join(" ")+`\r
- `,i+=`c=IN IP4 0.0.0.0\r
- `,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
- `,r.codecs.forEach(function(s){i+=t.writeRtpMap(s),i+=t.writeFmtp(s),i+=t.writeRtcpFb(s)});var o=0;return r.codecs.forEach(function(s){s.maxptime>o&&(o=s.maxptime)}),o>0&&(i+="a=maxptime:"+o+`\r
- `),i+=`a=rtcp-mux\r
- `,r.headerExtensions&&r.headerExtensions.forEach(function(s){i+=t.writeExtmap(s)}),i},t.parseRtpEncodingParameters=function(e){var r,i=[],o=t.parseRtpParameters(e),s=o.fecMechanisms.indexOf("RED")!==-1,c=o.fecMechanisms.indexOf("ULPFEC")!==-1,d=t.matchPrefix(e,"a=ssrc:").map(function(u){return t.parseSsrcMedia(u)}).filter(function(u){return u.attribute==="cname"}),l=d.length>0&&d[0].ssrc,h=t.matchPrefix(e,"a=ssrc-group:FID").map(function(u){return u.substr(17).split(" ").map(function(p){return parseInt(p,10)})});h.length>0&&h[0].length>1&&h[0][0]===l&&(r=h[0][1]),o.codecs.forEach(function(u){if(u.name.toUpperCase()==="RTX"&&u.parameters.apt){var p={ssrc:l,codecPayloadType:parseInt(u.parameters.apt,10)};l&&r&&(p.rtx={ssrc:r}),i.push(p),s&&((p=JSON.parse(JSON.stringify(p))).fec={ssrc:l,mechanism:c?"red+ulpfec":"red"},i.push(p))}}),i.length===0&&l&&i.push({ssrc:l});var a=t.matchPrefix(e,"b=");return a.length&&(a=a[0].indexOf("b=TIAS:")===0?parseInt(a[0].substr(7),10):a[0].indexOf("b=AS:")===0?1e3*parseInt(a[0].substr(5),10)*.95-16e3:void 0,i.forEach(function(u){u.maxBitrate=a})),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map(function(c){return t.parseSsrcMedia(c)}).filter(function(c){return c.attribute==="cname"})[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var o=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=o.length>0,r.compound=o.length===0;var s=t.matchPrefix(e,"a=rtcp-mux");return r.mux=s.length>0,r},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(i.length===1)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var o=t.matchPrefix(e,"a=ssrc:").map(function(s){return t.parseSsrcMedia(s)}).filter(function(s){return s.attribute==="msid"});return o.length>0?{stream:(r=o[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,i=t.parseMLine(e),o=t.matchPrefix(e,"a=max-message-size:");o.length>0&&(r=parseInt(o[0].substr(19),10)),isNaN(r)&&(r=65536);var s=t.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substr(12),10),protocol:i.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var c=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(c[0],10),protocol:c[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,r){var i=[];return i=e.protocol!=="DTLS/SCTP"?["m="+e.kind+" 9 "+e.protocol+" "+r.protocol+`\r
- `,`c=IN IP4 0.0.0.0\r
- `,"a=sctp-port:"+r.port+`\r
- `]:["m="+e.kind+" 9 "+e.protocol+" "+r.port+`\r
- `,`c=IN IP4 0.0.0.0\r
- `,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r
- `],r.maxMessageSize!==void 0&&i.push("a=max-message-size:"+r.maxMessageSize+`\r
- `),i.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,i){var o=r!==void 0?r:2;return`v=0\r
- o=`+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+o+` IN IP4 127.0.0.1\r
- s=-\r
- t=0 0\r
- `},t.writeMediaSection=function(e,r,i,o){var s=t.writeRtpDescription(e.kind,r);if(s+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),i==="offer"?"actpass":"active"),s+="a=mid:"+e.mid+`\r
- `,e.direction?s+="a="+e.direction+`\r
- `:e.rtpSender&&e.rtpReceiver?s+=`a=sendrecv\r
- `:e.rtpSender?s+=`a=sendonly\r
- `:e.rtpReceiver?s+=`a=recvonly\r
- `:s+=`a=inactive\r
- `,e.rtpSender){var c="msid:"+o.id+" "+e.rtpSender.track.id+`\r
- `;s+="a="+c,s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+c,e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+c,s+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+`\r
- `)}return s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+`\r
- `,e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+`\r
- `),s},t.getDirection=function(e,r){for(var i=t.splitLines(e),o=0;o<i.length;o++)switch(i[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[o].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return e.split(" ",2)[1]==="0"},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if(typeof e!="string"||e.length===0)return!1;for(var r=t.splitLines(e),i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0},n.exports=t},Pa(Si={exports:{}},Si.exports),Si.exports);function La(n,t,e,r,i){var o=ot.writeRtpDescription(n.kind,t);if(o+=ot.writeIceParameters(n.iceGatherer.getLocalParameters()),o+=ot.writeDtlsParameters(n.dtlsTransport.getLocalParameters(),e==="offer"?"actpass":i||"active"),o+="a=mid:"+n.mid+`\r
- `,n.rtpSender&&n.rtpReceiver?o+=`a=sendrecv\r
- `:n.rtpSender?o+=`a=sendonly\r
- `:n.rtpReceiver?o+=`a=recvonly\r
- `:o+=`a=inactive\r
- `,n.rtpSender){var s=n.rtpSender._initialTrackId||n.rtpSender.track.id;n.rtpSender._initialTrackId=s;var c="msid:"+(r?r.id:"-")+" "+s+`\r
- `;o+="a="+c,o+="a=ssrc:"+n.sendEncodingParameters[0].ssrc+" "+c,n.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+n.sendEncodingParameters[0].rtx.ssrc+" "+c,o+="a=ssrc-group:FID "+n.sendEncodingParameters[0].ssrc+" "+n.sendEncodingParameters[0].rtx.ssrc+`\r
- `)}return o+="a=ssrc:"+n.sendEncodingParameters[0].ssrc+" cname:"+ot.localCName+`\r
- `,n.rtpSender&&n.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+n.sendEncodingParameters[0].rtx.ssrc+" cname:"+ot.localCName+`\r
- `),o}function cr(n,t){var e={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(o,s){o=parseInt(o,10);for(var c=0;c<s.length;c++)if(s[c].payloadType===o||s[c].preferredPayloadType===o)return s[c]},i=function(o,s,c,d){var l=r(o.parameters.apt,c),h=r(s.parameters.apt,d);return l&&h&&l.name.toLowerCase()===h.name.toLowerCase()};return n.codecs.forEach(function(o){for(var s=0;s<t.codecs.length;s++){var c=t.codecs[s];if(o.name.toLowerCase()===c.name.toLowerCase()&&o.clockRate===c.clockRate){if(o.name.toLowerCase()==="rtx"&&o.parameters&&c.parameters.apt&&!i(o,c,n.codecs,t.codecs))continue;(c=JSON.parse(JSON.stringify(c))).numChannels=Math.min(o.numChannels,c.numChannels),e.codecs.push(c),c.rtcpFeedback=c.rtcpFeedback.filter(function(d){for(var l=0;l<o.rtcpFeedback.length;l++)if(o.rtcpFeedback[l].type===d.type&&o.rtcpFeedback[l].parameter===d.parameter)return!0;return!1});break}}}),n.headerExtensions.forEach(function(o){for(var s=0;s<t.headerExtensions.length;s++){var c=t.headerExtensions[s];if(o.uri===c.uri){e.headerExtensions.push(c);break}}}),e}function Ua(n,t,e){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][n].indexOf(e)!==-1}function Oi(n,t){var e=n.getRemoteCandidates().find(function(r){return t.foundation===r.foundation&&t.ip===r.ip&&t.port===r.port&&t.priority===r.priority&&t.protocol===r.protocol&&t.type===r.type});return e||n.addRemoteCandidate(t),!e}function Pt(n,t){var e=new Error(t);return e.name=n,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[n],e}var th=function(n,t){function e(s,c){c.addTrack(s),c.dispatchEvent(new n.MediaStreamTrackEvent("addtrack",{track:s}))}function r(s,c,d,l){var h=new Event("track");h.track=c,h.receiver=d,h.transceiver={receiver:d},h.streams=l,n.setTimeout(function(){s._dispatchEvent("track",h)})}var i=function(s){var c=this,d=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(h){c[h]=d[h].bind(d)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",s=JSON.parse(JSON.stringify(s||{})),this.usingBundle=s.bundlePolicy==="max-bundle",s.rtcpMuxPolicy==="negotiate")throw Pt("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(s.rtcpMuxPolicy||(s.rtcpMuxPolicy="require"),s.iceTransportPolicy){case"all":case"relay":break;default:s.iceTransportPolicy="all"}switch(s.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:s.bundlePolicy="balanced"}if(s.iceServers=function(h,a){var u=!1;return(h=JSON.parse(JSON.stringify(h))).filter(function(p){if(p&&(p.urls||p.url)){var f=p.urls||p.url;p.url&&!p.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var m=typeof f=="string";return m&&(f=[f]),f=f.filter(function(_){return _.indexOf("turn:")!==0||_.indexOf("transport=udp")===-1||_.indexOf("turn:[")!==-1||u?_.indexOf("stun:")===0&&a>=14393&&_.indexOf("?transport=udp")===-1:(u=!0,!0)}),delete p.url,p.urls=m?f[0]:f,!!f.length}})}(s.iceServers||[],t),this._iceGatherers=[],s.iceCandidatePoolSize)for(var l=s.iceCandidatePoolSize;l>0;l--)this._iceGatherers.push(new n.RTCIceGatherer({iceServers:s.iceServers,gatherPolicy:s.iceTransportPolicy}));else s.iceCandidatePoolSize=0;this._config=s,this.transceivers=[],this._sdpSessionId=ot.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(s,c){this._isClosed||(this.dispatchEvent(c),typeof this["on"+s]=="function"&&this["on"+s](c))},i.prototype._emitGatheringStateChange=function(){var s=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",s)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(s,c){var d=this.transceivers.length>0,l={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:s,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&d)l.iceTransport=this.transceivers[0].iceTransport,l.dtlsTransport=this.transceivers[0].dtlsTransport;else{var h=this._createIceAndDtlsTransports();l.iceTransport=h.iceTransport,l.dtlsTransport=h.dtlsTransport}return c||this.transceivers.push(l),l},i.prototype.addTrack=function(s,c){if(this._isClosed)throw Pt("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var d;if(this.transceivers.find(function(h){return h.track===s}))throw Pt("InvalidAccessError","Track already exists.");for(var l=0;l<this.transceivers.length;l++)this.transceivers[l].track||this.transceivers[l].kind!==s.kind||(d=this.transceivers[l]);return d||(d=this._createTransceiver(s.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(c)===-1&&this.localStreams.push(c),d.track=s,d.stream=c,d.rtpSender=new n.RTCRtpSender(s,d.dtlsTransport),d.rtpSender},i.prototype.addStream=function(s){var c=this;if(t>=15025)s.getTracks().forEach(function(l){c.addTrack(l,s)});else{var d=s.clone();s.getTracks().forEach(function(l,h){var a=d.getTracks()[h];l.addEventListener("enabled",function(u){a.enabled=u.enabled})}),d.getTracks().forEach(function(l){c.addTrack(l,d)})}},i.prototype.removeTrack=function(s){if(this._isClosed)throw Pt("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(s instanceof n.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var c=this.transceivers.find(function(l){return l.rtpSender===s});if(!c)throw Pt("InvalidAccessError","Sender was not created by this connection.");var d=c.stream;c.rtpSender.stop(),c.rtpSender=null,c.track=null,c.stream=null,this.transceivers.map(function(l){return l.stream}).indexOf(d)===-1&&this.localStreams.indexOf(d)>-1&&this.localStreams.splice(this.localStreams.indexOf(d),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(s){var c=this;s.getTracks().forEach(function(d){var l=c.getSenders().find(function(h){return h.track===d});l&&c.removeTrack(l)})},i.prototype.getSenders=function(){return this.transceivers.filter(function(s){return!!s.rtpSender}).map(function(s){return s.rtpSender})},i.prototype.getReceivers=function(){return this.transceivers.filter(function(s){return!!s.rtpReceiver}).map(function(s){return s.rtpReceiver})},i.prototype._createIceGatherer=function(s,c){var d=this;if(c&&s>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var l=new n.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(l,"state",{value:"new",writable:!0}),this.transceivers[s].bufferedCandidateEvents=[],this.transceivers[s].bufferCandidates=function(h){var a=!h.candidate||Object.keys(h.candidate).length===0;l.state=a?"completed":"gathering",d.transceivers[s].bufferedCandidateEvents!==null&&d.transceivers[s].bufferedCandidateEvents.push(h)},l.addEventListener("localcandidate",this.transceivers[s].bufferCandidates),l},i.prototype._gather=function(s,c){var d=this,l=this.transceivers[c].iceGatherer;if(!l.onlocalcandidate){var h=this.transceivers[c].bufferedCandidateEvents;this.transceivers[c].bufferedCandidateEvents=null,l.removeEventListener("localcandidate",this.transceivers[c].bufferCandidates),l.onlocalcandidate=function(a){if(!(d.usingBundle&&c>0)){var u=new Event("icecandidate");u.candidate={sdpMid:s,sdpMLineIndex:c};var p=a.candidate,f=!p||Object.keys(p).length===0;if(f)l.state!=="new"&&l.state!=="gathering"||(l.state="completed");else{l.state==="new"&&(l.state="gathering"),p.component=1,p.ufrag=l.getLocalParameters().usernameFragment;var m=ot.writeCandidate(p);u.candidate=Object.assign(u.candidate,ot.parseCandidate(m)),u.candidate.candidate=m,u.candidate.toJSON=function(){return{candidate:u.candidate.candidate,sdpMid:u.candidate.sdpMid,sdpMLineIndex:u.candidate.sdpMLineIndex,usernameFragment:u.candidate.usernameFragment}}}var _=ot.getMediaSections(d._localDescription.sdp);_[u.candidate.sdpMLineIndex]+=f?`a=end-of-candidates\r
- `:"a="+u.candidate.candidate+`\r
- `,d._localDescription.sdp=ot.getDescription(d._localDescription.sdp)+_.join("");var v=d.transceivers.every(function(T){return T.iceGatherer&&T.iceGatherer.state==="completed"});d.iceGatheringState!=="gathering"&&(d.iceGatheringState="gathering",d._emitGatheringStateChange()),f||d._dispatchEvent("icecandidate",u),v&&(d._dispatchEvent("icecandidate",new Event("icecandidate")),d.iceGatheringState="complete",d._emitGatheringStateChange())}},n.setTimeout(function(){h.forEach(function(a){l.onlocalcandidate(a)})},0)}},i.prototype._createIceAndDtlsTransports=function(){var s=this,c=new n.RTCIceTransport(null);c.onicestatechange=function(){s._updateIceConnectionState(),s._updateConnectionState()};var d=new n.RTCDtlsTransport(c);return d.ondtlsstatechange=function(){s._updateConnectionState()},d.onerror=function(){Object.defineProperty(d,"state",{value:"failed",writable:!0}),s._updateConnectionState()},{iceTransport:c,dtlsTransport:d}},i.prototype._disposeIceAndDtlsTransports=function(s){var c=this.transceivers[s].iceGatherer;c&&(delete c.onlocalcandidate,delete this.transceivers[s].iceGatherer);var d=this.transceivers[s].iceTransport;d&&(delete d.onicestatechange,delete this.transceivers[s].iceTransport);var l=this.transceivers[s].dtlsTransport;l&&(delete l.ondtlsstatechange,delete l.onerror,delete this.transceivers[s].dtlsTransport)},i.prototype._transceive=function(s,c,d){var l=cr(s.localCapabilities,s.remoteCapabilities);c&&s.rtpSender&&(l.encodings=s.sendEncodingParameters,l.rtcp={cname:ot.localCName,compound:s.rtcpParameters.compound},s.recvEncodingParameters.length&&(l.rtcp.ssrc=s.recvEncodingParameters[0].ssrc),s.rtpSender.send(l)),d&&s.rtpReceiver&&l.codecs.length>0&&(s.kind==="video"&&s.recvEncodingParameters&&t<15019&&s.recvEncodingParameters.forEach(function(h){delete h.rtx}),s.recvEncodingParameters.length?l.encodings=s.recvEncodingParameters:l.encodings=[{}],l.rtcp={compound:s.rtcpParameters.compound},s.rtcpParameters.cname&&(l.rtcp.cname=s.rtcpParameters.cname),s.sendEncodingParameters.length&&(l.rtcp.ssrc=s.sendEncodingParameters[0].ssrc),s.rtpReceiver.receive(l))},i.prototype.setLocalDescription=function(s){var c,d,l=this;if(["offer","answer"].indexOf(s.type)===-1)return Promise.reject(Pt("TypeError",'Unsupported type "'+s.type+'"'));if(!Ua("setLocalDescription",s.type,l.signalingState)||l._isClosed)return Promise.reject(Pt("InvalidStateError","Can not set local "+s.type+" in state "+l.signalingState));if(s.type==="offer")c=ot.splitSections(s.sdp),d=c.shift(),c.forEach(function(a,u){var p=ot.parseRtpParameters(a);l.transceivers[u].localCapabilities=p}),l.transceivers.forEach(function(a,u){l._gather(a.mid,u)});else if(s.type==="answer"){c=ot.splitSections(l._remoteDescription.sdp),d=c.shift();var h=ot.matchPrefix(d,"a=ice-lite").length>0;c.forEach(function(a,u){var p=l.transceivers[u],f=p.iceGatherer,m=p.iceTransport,_=p.dtlsTransport,v=p.localCapabilities,T=p.remoteCapabilities;if(!(ot.isRejected(a)&&ot.matchPrefix(a,"a=bundle-only").length===0)&&!p.rejected){var y=ot.getIceParameters(a,d),w=ot.getDtlsParameters(a,d);h&&(w.role="server"),l.usingBundle&&u!==0||(l._gather(p.mid,u),m.state==="new"&&m.start(f,y,h?"controlling":"controlled"),_.state==="new"&&_.start(w));var L=cr(v,T);l._transceive(p,L.codecs.length>0,!1)}})}return l._localDescription={type:s.type,sdp:s.sdp},s.type==="offer"?l._updateSignalingState("have-local-offer"):l._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(s){var c=this;if(["offer","answer"].indexOf(s.type)===-1)return Promise.reject(Pt("TypeError",'Unsupported type "'+s.type+'"'));if(!Ua("setRemoteDescription",s.type,c.signalingState)||c._isClosed)return Promise.reject(Pt("InvalidStateError","Can not set remote "+s.type+" in state "+c.signalingState));var d={};c.remoteStreams.forEach(function(m){d[m.id]=m});var l=[],h=ot.splitSections(s.sdp),a=h.shift(),u=ot.matchPrefix(a,"a=ice-lite").length>0,p=ot.matchPrefix(a,"a=group:BUNDLE ").length>0;c.usingBundle=p;var f=ot.matchPrefix(a,"a=ice-options:")[0];return c.canTrickleIceCandidates=!!f&&f.substr(14).split(" ").indexOf("trickle")>=0,h.forEach(function(m,_){var v=ot.splitLines(m),T=ot.getKind(m),y=ot.isRejected(m)&&ot.matchPrefix(m,"a=bundle-only").length===0,w=v[0].substr(2).split(" ")[2],L=ot.getDirection(m,a),M=ot.parseMsid(m),C=ot.getMid(m)||ot.generateIdentifier();if(y||T==="application"&&(w==="DTLS/SCTP"||w==="UDP/DTLS/SCTP"))c.transceivers[_]={mid:C,kind:T,protocol:w,rejected:!0};else{var A,F,G,E,S,I,N,b,k;!y&&c.transceivers[_]&&c.transceivers[_].rejected&&(c.transceivers[_]=c._createTransceiver(T,!0));var U,$,q=ot.parseRtpParameters(m);y||(U=ot.getIceParameters(m,a),($=ot.getDtlsParameters(m,a)).role="client"),N=ot.parseRtpEncodingParameters(m);var X=ot.parseRtcpParameters(m),nt=ot.matchPrefix(m,"a=end-of-candidates",a).length>0,at=ot.matchPrefix(m,"a=candidate:").map(function(D){return ot.parseCandidate(D)}).filter(function(D){return D.component===1});if((s.type==="offer"||s.type==="answer")&&!y&&p&&_>0&&c.transceivers[_]&&(c._disposeIceAndDtlsTransports(_),c.transceivers[_].iceGatherer=c.transceivers[0].iceGatherer,c.transceivers[_].iceTransport=c.transceivers[0].iceTransport,c.transceivers[_].dtlsTransport=c.transceivers[0].dtlsTransport,c.transceivers[_].rtpSender&&c.transceivers[_].rtpSender.setTransport(c.transceivers[0].dtlsTransport),c.transceivers[_].rtpReceiver&&c.transceivers[_].rtpReceiver.setTransport(c.transceivers[0].dtlsTransport)),s.type!=="offer"||y)s.type==="answer"&&!y&&(F=(A=c.transceivers[_]).iceGatherer,G=A.iceTransport,E=A.dtlsTransport,S=A.rtpReceiver,I=A.sendEncodingParameters,b=A.localCapabilities,c.transceivers[_].recvEncodingParameters=N,c.transceivers[_].remoteCapabilities=q,c.transceivers[_].rtcpParameters=X,at.length&&G.state==="new"&&(!u&&!nt||p&&_!==0?at.forEach(function(D){Oi(A.iceTransport,D)}):G.setRemoteCandidates(at)),p&&_!==0||(G.state==="new"&&G.start(F,U,"controlling"),E.state==="new"&&E.start($)),!cr(A.localCapabilities,A.remoteCapabilities).codecs.filter(function(D){return D.name.toLowerCase()==="rtx"}).length&&A.sendEncodingParameters[0].rtx&&delete A.sendEncodingParameters[0].rtx,c._transceive(A,L==="sendrecv"||L==="recvonly",L==="sendrecv"||L==="sendonly"),!S||L!=="sendrecv"&&L!=="sendonly"?delete A.rtpReceiver:(k=S.track,M?(d[M.stream]||(d[M.stream]=new n.MediaStream),e(k,d[M.stream]),l.push([k,S,d[M.stream]])):(d.default||(d.default=new n.MediaStream),e(k,d.default),l.push([k,S,d.default]))));else{(A=c.transceivers[_]||c._createTransceiver(T)).mid=C,A.iceGatherer||(A.iceGatherer=c._createIceGatherer(_,p)),at.length&&A.iceTransport.state==="new"&&(!nt||p&&_!==0?at.forEach(function(D){Oi(A.iceTransport,D)}):A.iceTransport.setRemoteCandidates(at)),b=n.RTCRtpReceiver.getCapabilities(T),t<15019&&(b.codecs=b.codecs.filter(function(D){return D.name!=="rtx"})),I=A.sendEncodingParameters||[{ssrc:1001*(2*_+2)}];var et,rt=!1;L==="sendrecv"||L==="sendonly"?(rt=!A.rtpReceiver,S=A.rtpReceiver||new n.RTCRtpReceiver(A.dtlsTransport,T),rt&&(k=S.track,M&&M.stream==="-"||(M?(d[M.stream]||(d[M.stream]=new n.MediaStream,Object.defineProperty(d[M.stream],"id",{get:function(){return M.stream}})),Object.defineProperty(k,"id",{get:function(){return M.track}}),et=d[M.stream]):(d.default||(d.default=new n.MediaStream),et=d.default)),et&&(e(k,et),A.associatedRemoteMediaStreams.push(et)),l.push([k,S,et]))):A.rtpReceiver&&A.rtpReceiver.track&&(A.associatedRemoteMediaStreams.forEach(function(D){var J=D.getTracks().find(function(W){return W.id===A.rtpReceiver.track.id});J&&function(W,it){it.removeTrack(W),it.dispatchEvent(new n.MediaStreamTrackEvent("removetrack",{track:W}))}(J,D)}),A.associatedRemoteMediaStreams=[]),A.localCapabilities=b,A.remoteCapabilities=q,A.rtpReceiver=S,A.rtcpParameters=X,A.sendEncodingParameters=I,A.recvEncodingParameters=N,c._transceive(c.transceivers[_],!1,rt)}}}),c._dtlsRole===void 0&&(c._dtlsRole=s.type==="offer"?"active":"passive"),c._remoteDescription={type:s.type,sdp:s.sdp},s.type==="offer"?c._updateSignalingState("have-remote-offer"):c._updateSignalingState("stable"),Object.keys(d).forEach(function(m){var _=d[m];if(_.getTracks().length){if(c.remoteStreams.indexOf(_)===-1){c.remoteStreams.push(_);var v=new Event("addstream");v.stream=_,n.setTimeout(function(){c._dispatchEvent("addstream",v)})}l.forEach(function(T){var y=T[0],w=T[1];_.id===T[2].id&&r(c,y,w,[_])})}}),l.forEach(function(m){m[2]||r(c,m[0],m[1],[])}),n.setTimeout(function(){c&&c.transceivers&&c.transceivers.forEach(function(m){m.iceTransport&&m.iceTransport.state==="new"&&m.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),m.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach(function(s){s.iceTransport&&s.iceTransport.stop(),s.dtlsTransport&&s.dtlsTransport.stop(),s.rtpSender&&s.rtpSender.stop(),s.rtpReceiver&&s.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(s){this.signalingState=s;var c=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",c)},i.prototype._maybeFireNegotiationNeeded=function(){var s=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,n.setTimeout(function(){if(s.needNegotiation){s.needNegotiation=!1;var c=new Event("negotiationneeded");s._dispatchEvent("negotiationneeded",c)}},0))},i.prototype._updateIceConnectionState=function(){var s,c={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(l){l.iceTransport&&!l.rejected&&c[l.iceTransport.state]++}),s="new",c.failed>0?s="failed":c.checking>0?s="checking":c.disconnected>0?s="disconnected":c.new>0?s="new":c.connected>0?s="connected":c.completed>0&&(s="completed"),s!==this.iceConnectionState){this.iceConnectionState=s;var d=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",d)}},i.prototype._updateConnectionState=function(){var s,c={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(l){l.iceTransport&&l.dtlsTransport&&!l.rejected&&(c[l.iceTransport.state]++,c[l.dtlsTransport.state]++)}),c.connected+=c.completed,s="new",c.failed>0?s="failed":c.connecting>0?s="connecting":c.disconnected>0?s="disconnected":c.new>0?s="new":c.connected>0&&(s="connected"),s!==this.connectionState){this.connectionState=s;var d=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",d)}},i.prototype.createOffer=function(){var s=this;if(s._isClosed)return Promise.reject(Pt("InvalidStateError","Can not call createOffer after close"));var c=s.transceivers.filter(function(u){return u.kind==="audio"}).length,d=s.transceivers.filter(function(u){return u.kind==="video"}).length,l=arguments[0];if(l){if(l.mandatory||l.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");l.offerToReceiveAudio!==void 0&&(c=l.offerToReceiveAudio===!0?1:l.offerToReceiveAudio===!1?0:l.offerToReceiveAudio),l.offerToReceiveVideo!==void 0&&(d=l.offerToReceiveVideo===!0?1:l.offerToReceiveVideo===!1?0:l.offerToReceiveVideo)}for(s.transceivers.forEach(function(u){u.kind==="audio"?--c<0&&(u.wantReceive=!1):u.kind==="video"&&--d<0&&(u.wantReceive=!1)});c>0||d>0;)c>0&&(s._createTransceiver("audio"),c--),d>0&&(s._createTransceiver("video"),d--);var h=ot.writeSessionBoilerplate(s._sdpSessionId,s._sdpSessionVersion++);s.transceivers.forEach(function(u,p){var f=u.track,m=u.kind,_=u.mid||ot.generateIdentifier();u.mid=_,u.iceGatherer||(u.iceGatherer=s._createIceGatherer(p,s.usingBundle));var v=n.RTCRtpSender.getCapabilities(m);t<15019&&(v.codecs=v.codecs.filter(function(y){return y.name!=="rtx"})),v.codecs.forEach(function(y){y.name==="H264"&&y.parameters["level-asymmetry-allowed"]===void 0&&(y.parameters["level-asymmetry-allowed"]="1"),u.remoteCapabilities&&u.remoteCapabilities.codecs&&u.remoteCapabilities.codecs.forEach(function(w){y.name.toLowerCase()===w.name.toLowerCase()&&y.clockRate===w.clockRate&&(y.preferredPayloadType=w.payloadType)})}),v.headerExtensions.forEach(function(y){(u.remoteCapabilities&&u.remoteCapabilities.headerExtensions||[]).forEach(function(w){y.uri===w.uri&&(y.id=w.id)})});var T=u.sendEncodingParameters||[{ssrc:1001*(2*p+1)}];f&&t>=15019&&m==="video"&&!T[0].rtx&&(T[0].rtx={ssrc:T[0].ssrc+1}),u.wantReceive&&(u.rtpReceiver=new n.RTCRtpReceiver(u.dtlsTransport,m)),u.localCapabilities=v,u.sendEncodingParameters=T}),s._config.bundlePolicy!=="max-compat"&&(h+="a=group:BUNDLE "+s.transceivers.map(function(u){return u.mid}).join(" ")+`\r
- `),h+=`a=ice-options:trickle\r
- `,s.transceivers.forEach(function(u,p){h+=La(u,u.localCapabilities,"offer",u.stream,s._dtlsRole),h+=`a=rtcp-rsize\r
- `,!u.iceGatherer||s.iceGatheringState==="new"||p!==0&&s.usingBundle||(u.iceGatherer.getLocalCandidates().forEach(function(f){f.component=1,h+="a="+ot.writeCandidate(f)+`\r
- `}),u.iceGatherer.state==="completed"&&(h+=`a=end-of-candidates\r
- `))});var a=new n.RTCSessionDescription({type:"offer",sdp:h});return Promise.resolve(a)},i.prototype.createAnswer=function(){var s=this;if(s._isClosed)return Promise.reject(Pt("InvalidStateError","Can not call createAnswer after close"));if(s.signalingState!=="have-remote-offer"&&s.signalingState!=="have-local-pranswer")return Promise.reject(Pt("InvalidStateError","Can not call createAnswer in signalingState "+s.signalingState));var c=ot.writeSessionBoilerplate(s._sdpSessionId,s._sdpSessionVersion++);s.usingBundle&&(c+="a=group:BUNDLE "+s.transceivers.map(function(h){return h.mid}).join(" ")+`\r
- `),c+=`a=ice-options:trickle\r
- `;var d=ot.getMediaSections(s._remoteDescription.sdp).length;s.transceivers.forEach(function(h,a){if(!(a+1>d)){if(h.rejected)return h.kind==="application"?h.protocol==="DTLS/SCTP"?c+=`m=application 0 DTLS/SCTP 5000\r
- `:c+="m=application 0 "+h.protocol+` webrtc-datachannel\r
- `:h.kind==="audio"?c+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
- a=rtpmap:0 PCMU/8000\r
- `:h.kind==="video"&&(c+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
- a=rtpmap:120 VP8/90000\r
- `),void(c+=`c=IN IP4 0.0.0.0\r
- a=inactive\r
- a=mid:`+h.mid+`\r
- `);var u;h.stream&&(h.kind==="audio"?u=h.stream.getAudioTracks()[0]:h.kind==="video"&&(u=h.stream.getVideoTracks()[0]),u&&t>=15019&&h.kind==="video"&&!h.sendEncodingParameters[0].rtx&&(h.sendEncodingParameters[0].rtx={ssrc:h.sendEncodingParameters[0].ssrc+1}));var p=cr(h.localCapabilities,h.remoteCapabilities);!p.codecs.filter(function(f){return f.name.toLowerCase()==="rtx"}).length&&h.sendEncodingParameters[0].rtx&&delete h.sendEncodingParameters[0].rtx,c+=La(h,p,"answer",h.stream,s._dtlsRole),h.rtcpParameters&&h.rtcpParameters.reducedSize&&(c+=`a=rtcp-rsize\r
- `)}});var l=new n.RTCSessionDescription({type:"answer",sdp:c});return Promise.resolve(l)},i.prototype.addIceCandidate=function(s){var c,d=this;return s&&s.sdpMLineIndex===void 0&&!s.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(l,h){if(!d._remoteDescription)return h(Pt("InvalidStateError","Can not add ICE candidate without a remote description"));if(s&&s.candidate!==""){var a=s.sdpMLineIndex;if(s.sdpMid){for(var u=0;u<d.transceivers.length;u++)if(d.transceivers[u].mid===s.sdpMid){a=u;break}}var p=d.transceivers[a];if(!p)return h(Pt("OperationError","Can not add ICE candidate"));if(p.rejected)return l();var f=Object.keys(s.candidate).length>0?ot.parseCandidate(s.candidate):{};if(f.protocol==="tcp"&&(f.port===0||f.port===9)||f.component&&f.component!==1)return l();if((a===0||a>0&&p.iceTransport!==d.transceivers[0].iceTransport)&&!Oi(p.iceTransport,f))return h(Pt("OperationError","Can not add ICE candidate"));var m=s.candidate.trim();m.indexOf("a=")===0&&(m=m.substr(2)),(c=ot.getMediaSections(d._remoteDescription.sdp))[a]+="a="+(f.type?m:"end-of-candidates")+`\r
- `,d._remoteDescription.sdp=ot.getDescription(d._remoteDescription.sdp)+c.join("")}else for(var _=0;_<d.transceivers.length&&(d.transceivers[_].rejected||(d.transceivers[_].iceTransport.addRemoteCandidate({}),(c=ot.getMediaSections(d._remoteDescription.sdp))[_]+=`a=end-of-candidates\r
- `,d._remoteDescription.sdp=ot.getDescription(d._remoteDescription.sdp)+c.join(""),!d.usingBundle));_++);l()})},i.prototype.getStats=function(s){if(s&&s instanceof n.MediaStreamTrack){var c=null;if(this.transceivers.forEach(function(l){l.rtpSender&&l.rtpSender.track===s?c=l.rtpSender:l.rtpReceiver&&l.rtpReceiver.track===s&&(c=l.rtpReceiver)}),!c)throw Pt("InvalidAccessError","Invalid selector.");return c.getStats()}var d=[];return this.transceivers.forEach(function(l){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(h){l[h]&&d.push(l[h].getStats())})}),Promise.all(d).then(function(l){var h=new Map;return l.forEach(function(a){a.forEach(function(u){h.set(u.id,u)})}),h})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(s){var c=n[s];if(c&&c.prototype&&c.prototype.getStats){var d=c.prototype.getStats;c.prototype.getStats=function(){return d.apply(this).then(function(l){var h=new Map;return Object.keys(l).forEach(function(a){var u;l[a].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(u=l[a]).type]||u.type,h.set(a,l[a])}),h})}}});var o=["createOffer","createAnswer"];return o.forEach(function(s){var c=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[0]=="function"||typeof d[1]=="function"?c.apply(this,[arguments[2]]).then(function(l){typeof d[0]=="function"&&d[0].apply(null,[l])},function(l){typeof d[1]=="function"&&d[1].apply(null,[l])}):c.apply(this,arguments)}}),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(s){var c=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[1]=="function"||typeof d[2]=="function"?c.apply(this,arguments).then(function(){typeof d[1]=="function"&&d[1].apply(null)},function(l){typeof d[2]=="function"&&d[2].apply(null,[l])}):c.apply(this,arguments)}}),["getStats"].forEach(function(s){var c=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[1]=="function"?c.apply(this,arguments).then(function(){typeof d[1]=="function"&&d[1].apply(null)}):c.apply(this,arguments)}}),i};function Zc(n){const t=n&&n.navigator,e=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(r){return e(r).catch(i=>Promise.reject(function(o){return{name:{PermissionDeniedError:"NotAllowedError"}[o.name]||o.name,message:o.message,constraint:o.constraint,toString(){return this.name}}}(i)))}}function Qc(n){"getDisplayMedia"in n.navigator&&n.navigator.mediaDevices&&(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||(n.navigator.mediaDevices.getDisplayMedia=n.navigator.getDisplayMedia.bind(n.navigator)))}function ao(n,t){if(n.RTCIceGatherer&&(n.RTCIceCandidate||(n.RTCIceCandidate=function(r){return r}),n.RTCSessionDescription||(n.RTCSessionDescription=function(r){return r}),t.version<15025)){const r=Object.getOwnPropertyDescriptor(n.MediaStreamTrack.prototype,"enabled");Object.defineProperty(n.MediaStreamTrack.prototype,"enabled",{set(i){r.set.call(this,i);const o=new Event("enabled");o.enabled=i,this.dispatchEvent(o)}})}n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)&&Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new n.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),n.RTCDtmfSender&&!n.RTCDTMFSender&&(n.RTCDTMFSender=n.RTCDtmfSender);const e=th(n,t.version);n.RTCPeerConnection=function(r){return r&&r.iceServers&&(r.iceServers=function(i,o){let s=!1;return(i=JSON.parse(JSON.stringify(i))).filter(c=>{if(c&&(c.urls||c.url)){let d=c.urls||c.url;c.url&&!c.urls&&ai("RTCIceServer.url","RTCIceServer.urls");const l=typeof d=="string";return l&&(d=[d]),d=d.filter(h=>{if(h.indexOf("stun:")===0)return!1;const a=h.startsWith("turn")&&!h.startsWith("turn:[")&&h.includes("transport=udp");return a&&!s?(s=!0,!0):a&&!s}),delete c.url,c.urls=l?d[0]:d,!!d.length}})}(r.iceServers,t.version),Cs("ICE servers after filtering:",r.iceServers)),new e(r)},n.RTCPeerConnection.prototype=e.prototype}function Xc(n){n.RTCRtpSender&&!("replaceTrack"in n.RTCRtpSender.prototype)&&(n.RTCRtpSender.prototype.replaceTrack=n.RTCRtpSender.prototype.setTrack)}var Da=Object.freeze({__proto__:null,shimPeerConnection:ao,shimReplaceTrack:Xc,shimGetUserMedia:Zc,shimGetDisplayMedia:Qc});function tu(n,t){const e=n&&n.navigator,r=n&&n.MediaStreamTrack;if(e.getUserMedia=function(i,o,s){ai("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),e.mediaDevices.getUserMedia(i).then(o,s)},!(t.version>55&&"autoGainControl"in e.mediaDevices.getSupportedConstraints())){const i=function(s,c,d){c in s&&!(d in s)&&(s[d]=s[c],delete s[c])},o=e.mediaDevices.getUserMedia.bind(e.mediaDevices);if(e.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),o(s)},r&&r.prototype.getSettings){const s=r.prototype.getSettings;r.prototype.getSettings=function(){const c=s.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(r&&r.prototype.applyConstraints){const s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(c){return this.kind==="audio"&&typeof c=="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[c])}}}}function eu(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function co(n,t){if(typeof n!="object"||!n.RTCPeerConnection&&!n.mozRTCPeerConnection)return;!n.RTCPeerConnection&&n.mozRTCPeerConnection&&(n.RTCPeerConnection=n.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const o=n.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};n.RTCPeerConnection.prototype[i]=s[i]});const e={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[i,o,s]=arguments;return r.apply(this,[i||null]).then(c=>{if(t.version<53&&!o)try{c.forEach(d=>{d.type=e[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;c.forEach((l,h)=>{c.set(h,Object.assign({},l,{type:e[l.type]||l.type}))})}return c}).then(o,s)}}function nu(n){if(typeof n!="object"||!n.RTCPeerConnection||!n.RTCRtpSender||n.RTCRtpSender&&"getStats"in n.RTCRtpSender.prototype)return;const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(i=>i._pc=this),r});const e=n.RTCPeerConnection.prototype.addTrack;e&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=e.apply(this,arguments);return r._pc=this,r}),n.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ru(n){if(typeof n!="object"||!n.RTCPeerConnection||!n.RTCRtpSender||n.RTCRtpSender&&"getStats"in n.RTCRtpReceiver.prototype)return;const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(r=>r._pc=this),e}),pn(n,"track",e=>(e.receiver._pc=e.srcElement,e)),n.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function iu(n){n.RTCPeerConnection&&!("removeStream"in n.RTCPeerConnection.prototype)&&(n.RTCPeerConnection.prototype.removeStream=function(t){ai("removeStream","removeTrack"),this.getSenders().forEach(e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)})})}function ou(n){n.DataChannel&&!n.RTCDataChannel&&(n.RTCDataChannel=n.DataChannel)}function su(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype.addTransceiver;t&&(n.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=t.apply(this,arguments);if(r){const{sender:o}=i,s=o.getParameters();(!("encodings"in s)||s.encodings.length===1&&Object.keys(s.encodings[0]).length===0)&&(s.encodings=e.sendEncodings,o.sendEncodings=e.sendEncodings,this.setParametersPromises.push(o.setParameters(s).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return i})}function au(n){if(typeof n!="object"||!n.RTCRtpSender)return;const t=n.RTCRtpSender.prototype.getParameters;t&&(n.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function cu(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function uu(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype.createAnswer;n.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var ka=Object.freeze({__proto__:null,shimOnTrack:eu,shimPeerConnection:co,shimSenderGetStats:nu,shimReceiverGetStats:ru,shimRemoveStream:iu,shimRTCDataChannel:ou,shimAddTransceiver:su,shimGetParameters:au,shimCreateOffer:cu,shimCreateAnswer:uu,shimGetUserMedia:tu,shimGetDisplayMedia:function(n,t){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(n.navigator.mediaDevices.getDisplayMedia=function(e){if(!e||!e.video){const r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return e.video===!0?e.video={mediaSource:t}:e.video.mediaSource=t,n.navigator.mediaDevices.getUserMedia(e)})}});function du(n){if(typeof n=="object"&&n.RTCPeerConnection){if("getLocalStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in n.RTCPeerConnection.prototype)){const t=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>t.call(this,r,e)),e.getVideoTracks().forEach(r=>t.call(this,r,e))},n.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach(i=>{this._localStreams?this._localStreams.includes(i)||this._localStreams.push(i):this._localStreams=[i]}),t.apply(this,arguments)}}"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(e===-1)return;this._localStreams.splice(e,1);const r=t.getTracks();this.getSenders().forEach(i=>{r.includes(i.track)&&this.removeTrack(i)})})}}function lu(n){if(typeof n=="object"&&n.RTCPeerConnection&&("getRemoteStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in n.RTCPeerConnection.prototype))){Object.defineProperty(n.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,this.dispatchEvent(o)})})}});const t=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(i=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(i)>=0)return;e._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,e.dispatchEvent(o)})}),t.apply(e,arguments)}}}function hu(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype,e=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(d,l){const h=arguments.length>=2?arguments[2]:arguments[0],a=e.apply(this,[h]);return l?(a.then(d,l),Promise.resolve()):a},t.createAnswer=function(d,l){const h=arguments.length>=2?arguments[2]:arguments[0],a=r.apply(this,[h]);return l?(a.then(d,l),Promise.resolve()):a};let c=function(d,l,h){const a=i.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a};t.setLocalDescription=c,c=function(d,l,h){const a=o.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a},t.setRemoteDescription=c,c=function(d,l,h){const a=s.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a},t.addIceCandidate=c}function pu(n){const t=n&&n.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=i=>r(fu(i))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function fu(n){return n&&n.video!==void 0?Object.assign({},n,{video:Hc(n.video)}):n}function gu(n){if(!n.RTCPeerConnection)return;const t=n.RTCPeerConnection;n.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const i=[];for(let o=0;o<e.iceServers.length;o++){let s=e.iceServers[o];!s.hasOwnProperty("urls")&&s.hasOwnProperty("url")?(ai("RTCIceServer.url","RTCIceServer.urls"),s=JSON.parse(JSON.stringify(s)),s.urls=s.url,delete s.url,i.push(s)):i.push(e.iceServers[o])}e.iceServers=i}return new t(e,r)},n.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(n.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function mu(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function _u(n){const t=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(e){if(e){e.offerToReceiveAudio!==void 0&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const r=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");e.offerToReceiveAudio===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):e.offerToReceiveAudio!==!0||r||this.addTransceiver("audio"),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const i=this.getTransceivers().find(o=>o.receiver.track.kind==="video");e.offerToReceiveVideo===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):e.offerToReceiveVideo!==!0||i||this.addTransceiver("video")}return t.apply(this,arguments)}}function vu(n){typeof n!="object"||n.AudioContext||(n.AudioContext=n.webkitAudioContext)}var xa=Object.freeze({__proto__:null,shimLocalStreamsAPI:du,shimRemoteStreamsAPI:lu,shimCallbacksAPI:hu,shimGetUserMedia:pu,shimConstraints:fu,shimRTCIceServerUrls:gu,shimTrackEventTransceiver:mu,shimCreateOfferLegacy:_u,shimAudioContext:vu});function mr(n){if(!n.RTCIceCandidate||n.RTCIceCandidate&&"foundation"in n.RTCIceCandidate.prototype)return;const t=n.RTCIceCandidate;n.RTCIceCandidate=function(e){if(typeof e=="object"&&e.candidate&&e.candidate.indexOf("a=")===0&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),i=ot.parseCandidate(e.candidate),o=Object.assign(r,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},n.RTCIceCandidate.prototype=t.prototype,pn(n,"icecandidate",e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new n.RTCIceCandidate(e.candidate),writable:"false"}),e))}function Cn(n,t){if(!n.RTCPeerConnection)return;"sctp"in n.RTCPeerConnection.prototype||Object.defineProperty(n.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const e=function(c){if(!c||!c.sdp)return!1;const d=ot.splitSections(c.sdp);return d.shift(),d.some(l=>{const h=ot.parseMLine(l);return h&&h.kind==="application"&&h.protocol.indexOf("SCTP")!==-1})},r=function(c){const d=c.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(d===null||d.length<2)return-1;const l=parseInt(d[1],10);return l!=l?-1:l},i=function(c){let d=65536;return t.browser==="firefox"&&(d=t.version<57?c===-1?16384:2147483637:t.version<60?t.version===57?65535:65536:2147483637),d},o=function(c,d){let l=65536;t.browser==="firefox"&&t.version===57&&(l=65535);const h=ot.matchPrefix(c.sdp,"a=max-message-size:");return h.length>0?l=parseInt(h[0].substr(19),10):t.browser==="firefox"&&d!==-1&&(l=2147483637),l},s=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser==="chrome"&&t.version>=76){const{sdpSemantics:c}=this.getConfiguration();c==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(e(arguments[0])){const c=r(arguments[0]),d=i(c),l=o(arguments[0],c);let h;h=d===0&&l===0?Number.POSITIVE_INFINITY:d===0||l===0?Math.max(d,l):Math.min(d,l);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>h}),this._sctp=a}return s.apply(this,arguments)}}function Rn(n){if(!n.RTCPeerConnection||!("createDataChannel"in n.RTCPeerConnection.prototype))return;function t(r,i){const o=r.send;r.send=function(){const s=arguments[0],c=s.length||s.size||s.byteLength;if(r.readyState==="open"&&i.sctp&&c>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(r,arguments)}}const e=n.RTCPeerConnection.prototype.createDataChannel;n.RTCPeerConnection.prototype.createDataChannel=function(){const r=e.apply(this,arguments);return t(r,this),r},pn(n,"datachannel",r=>(t(r.channel,r.target),r))}function uo(n){if(!n.RTCPeerConnection||"connectionState"in n.RTCPeerConnection.prototype)return;const t=n.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const o=i.target;if(o._lastConnectionState!==o.connectionState){o._lastConnectionState=o.connectionState;const s=new Event("connectionstatechange",i);o.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function lo(n,t){if(!n.RTCPeerConnection||t.browser==="chrome"&&t.version>=71||t.browser==="safari"&&t.version>=605)return;const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(r){if(r&&r.sdp&&r.sdp.indexOf(`
- a=extmap-allow-mixed`)!==-1){const i=r.sdp.split(`
- `).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
- `);n.RTCSessionDescription&&r instanceof n.RTCSessionDescription?arguments[0]=new n.RTCSessionDescription({type:r.type,sdp:i}):r.sdp=i}return e.apply(this,arguments)}}function _r(n,t){if(!n.RTCPeerConnection||!n.RTCPeerConnection.prototype)return;const e=n.RTCPeerConnection.prototype.addIceCandidate;e&&e.length!==0&&(n.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var eh=Object.freeze({__proto__:null,shimRTCIceCandidate:mr,shimMaxMessageSize:Cn,shimSendThrowTypeError:Rn,shimConnectionState:uo,removeExtmapAllowMixed:lo,shimAddIceCandidateNullOrEmpty:_r});const nh=function({window:n}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const e=Cs,r=function(o){const s={browser:null,version:null};if(o===void 0||!o.navigator)return s.browser="Not a browser.",s;const{navigator:c}=o;if(c.mozGetUserMedia)s.browser="firefox",s.version=yn(c.userAgent,/Firefox\/(\d+)\./,1);else if(c.webkitGetUserMedia||o.isSecureContext===!1&&o.webkitRTCPeerConnection&&!o.RTCIceGatherer)s.browser="chrome",s.version=yn(c.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(c.mediaDevices&&c.userAgent.match(/Edge\/(\d+).(\d+)$/))s.browser="edge",s.version=yn(c.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!o.RTCPeerConnection||!c.userAgent.match(/AppleWebKit\/(\d+)\./))return s.browser="Not a supported browser.",s;s.browser="safari",s.version=yn(c.userAgent,/AppleWebKit\/(\d+)\./,1),s.supportsUnifiedPlan=o.RTCRtpTransceiver&&"currentDirection"in o.RTCRtpTransceiver.prototype}return s}(n),i={browserDetails:r,commonShim:eh,extractVersion:yn,disableLog:Ql,disableWarnings:Xl};switch(r.browser){case"chrome":if(!wa||!so||!t.shimChrome)return e("Chrome shim is not included in this adapter release."),i;if(r.version===null)return e("Chrome shim can not determine version, not shimming."),i;e("adapter.js shimming chrome."),i.browserShim=wa,_r(n,r),$c(n,r),Gc(n),so(n,r),Kc(n),Jc(n,r),jc(n),qc(n),Yc(n),Wc(n,r),mr(n),uo(n),Cn(n,r),Rn(n),lo(n,r);break;case"firefox":if(!ka||!co||!t.shimFirefox)return e("Firefox shim is not included in this adapter release."),i;e("adapter.js shimming firefox."),i.browserShim=ka,_r(n,r),tu(n,r),co(n,r),eu(n),iu(n),nu(n),ru(n),ou(n),su(n),au(n),cu(n),uu(n),mr(n),uo(n),Cn(n,r),Rn(n);break;case"edge":if(!Da||!ao||!t.shimEdge)return e("MS edge shim is not included in this adapter release."),i;e("adapter.js shimming edge."),i.browserShim=Da,Zc(n),Qc(n),ao(n,r),Xc(n),Cn(n,r),Rn(n);break;case"safari":if(!xa||!t.shimSafari)return e("Safari shim is not included in this adapter release."),i;e("adapter.js shimming safari."),i.browserShim=xa,_r(n,r),gu(n),_u(n),hu(n),du(n),lu(n),mu(n),pu(n),vu(n),mr(n),Cn(n,r),Rn(n),lo(n,r);break;default:e("Unsupported browser!")}return i}({window:typeof window=="undefined"?void 0:window});var ie,Et,vt;(function(n){n.FPS_10="FPS_10",n.FPS_15="FPS_15",n.FPS_24="FPS_24",n.FPS_30="FPS_30"})(ie||(ie={})),function(n){n.W176_H132="W176_H132",n.W176_H144="W176_H144",n.W256_H144="W256_H144",n.W320_H180="W320_H180",n.W240_H240="W240_H240",n.W320_H240="W320_H240",n.W480_H360="W480_H360",n.W640_H360="W640_H360",n.W480_H480="W480_H480",n.W640_H480="W640_H480",n.W720_H480="W720_H480",n.W1280_H720="W1280_H720",n.W1920_H1080="W1920_H1080"}(Et||(Et={})),function(n){n[n.AUDIO_ONLY=0]="AUDIO_ONLY",n[n.VIDEO_ONLY=1]="VIDEO_ONLY",n[n.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(vt||(vt={}));const ur={[Et.W176_H132]:{width:176,height:132,maxBitrate:150,minBitrate:80},[Et.W176_H144]:{width:176,height:144,maxBitrate:160,minBitrate:80},[Et.W256_H144]:{width:256,height:144,maxBitrate:240,minBitrate:120},[Et.W320_H180]:{width:320,height:180,maxBitrate:280,minBitrate:120},[Et.W240_H240]:{width:240,height:240,maxBitrate:280,minBitrate:120},[Et.W320_H240]:{width:320,height:240,maxBitrate:400,minBitrate:120},[Et.W480_H360]:{width:480,height:360,maxBitrate:650,minBitrate:150},[Et.W640_H360]:{width:640,height:360,maxBitrate:800,minBitrate:180},[Et.W480_H480]:{width:480,height:480,maxBitrate:800,minBitrate:180},[Et.W640_H480]:{width:640,height:480,maxBitrate:900,minBitrate:200},[Et.W720_H480]:{width:720,height:480,maxBitrate:1e3,minBitrate:200},[Et.W1280_H720]:{width:1280,height:720,maxBitrate:2200,minBitrate:250},[Et.W1920_H1080]:{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}},Tu=(n,t)=>{const e=ur[`W${n}_H${t}`];if(e)return e;const r=n*t;return Object.keys(ur).map(i=>ur[i]).sort((i,o)=>i.height*i.width-o.width*o.height).filter(i=>i.height*i.width>=r)[0]||ur.W1920_H1080},Va={10:1,15:1,24:1.5,30:1.5},yu=n=>{let t=Number.MAX_VALUE,e=1;for(const r in Va){const i=Math.abs(n-parseInt(r));i<t&&(t=i,e=Va[r])}return e},Rs={getCameras:()=>j(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="videoinput")}),getMicrophones:()=>j(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="audioinput")}),getSpeakers:()=>j(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="audiooutput")})};class Is extends Fn{constructor(t,e,r,i,o){super(),this._tag=t,this._userId=e,this._kind=r,this._isLocalTrack=i,this._roomId=o,this._localMuted=!1,this._remoteMuted=!1,this._streamId=[this._userId||this._roomId,this._tag].join("_"),this._id=[this._streamId,this.isAudioTrack()?0:1].join("_")}getStreamId(){return this._streamId}getTrackId(){return this._id}getUserId(){return this._userId}__innerGetMediaStreamTrack(){return this._msTrack}getTag(){return this._tag}isLocalTrack(){return this._isLocalTrack}isVideoTrack(){return this._kind==="video"}isAudioTrack(){return this._kind==="audio"}isReady(){var t;return((t=this._msTrack)===null||t===void 0?void 0:t.readyState)==="live"}__innerSetMediaStreamTrack(t){this._msTrack=t,this._setLocalMuted(this._localMuted);const e=this._msStream=this._msStream||new MediaStream,r=e.getTracks()[0];r&&e.removeTrack(r),t?e.addTrack(t):this._element&&(this._element.pause(),this._element.srcObject=null)}_setLocalMuted(t){this._msTrack&&(this._msTrack.enabled=!t),this._localMuted=t}mute(){O.info(`set ${this._id} enabled: false`),this._setLocalMuted(!0)}unmute(){O.info(`set ${this._id} enabled: true`),this._setLocalMuted(!1)}isLocalMuted(){return this._localMuted}isMCUTrack(){return Boolean(this._roomId)}isOwnerMuted(){return this._remoteMuted}play(t,e){return j(this,void 0,void 0,function*(){if(!this._msTrack)return O.warn(`the track is not ready to play -> id: ${this._id}`),{code:P.TRACK_NOT_READY};if(this._msTrack.readyState==="ended"&&O.warn(`the track's readyState is 'ended' -> id: ${this._id}`),e==null?void 0:e.volume){if(!mt(e==null?void 0:e.volume))return O.error(`${e==null?void 0:e.volume} is not a number, the valid range of options.volume is 0-100`),{code:P.PARAMS_ERROR};(e==null?void 0:e.volume)<0&&(e.volume=0,O.warn("the valid range of options.volume is 0-100, the value of volume has been set 0")),(e==null?void 0:e.volume)>100&&(e.volume=100,O.warn("the valid range of options.volume is 0-100, the value of volume has been set 100"))}if((e==null?void 0:e.audioDeviceId)&&!(yield Rs.getSpeakers()).map(i=>i.deviceId).includes(e.audioDeviceId))return O.error(`the options.audioDeviceId is invalid --> ${e.audioDeviceId}`),{code:P.PARAMS_ERROR};const r=this.isVideoTrack();if(r&&(!t||!(t instanceof HTMLVideoElement)))return O.error(`the video track need an <video> to play -> id: ${this._id}`),{code:P.VIDEO_TRACK_MISS_MEDIA_ELEMENT};this._element=r?t:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=i=>{var o;O.debug(`HTMLMediaElement onloadstart -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.ondurationchange=i=>{var o;O.debug(`HTMLMediaElement ondurationchange -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onloadedmetadata=i=>{var o;O.debug(`HTMLMediaElement onloadedmetadata -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onloadeddata=i=>{var o;O.debug(`HTMLMediaElement onloadeddata -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onabort=i=>{var o;O.info(`HTMLMediaElement onabort -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.oncanplay=i=>{var o;O.info(`HTMLMediaElement oncanplay -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onvolumechange=i=>{var o;const s=Math.floor(100*((o=i.target)===null||o===void 0?void 0:o.volume));O.info(`HTMLMediaElement onvolumechange -> volume: ${s}, trackId: ${this._id}`)},this._element.srcObject=this._msStream,this._element.autoplay=!0,r&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),r||!(e==null?void 0:e.volume)&&(e==null?void 0:e.volume)!==0||(this._element.volume=(e==null?void 0:e.volume)/100);try{(e==null?void 0:e.audioDeviceId)&&!r?yield this._element.setSinkId(e.audioDeviceId):this._element.play()}catch(i){return i.message==="No permission to use requested device"?(O.error(`setSinkId failed -> ${i.message}`),{code:P.NO_PERMISSION_TO_USE_REQUESTED_DEVICE}):(O.error(i),{code:P.TRACK_PLAY_ERROR})}return{code:P.SUCCESS}})}__innerDestroy(){this.__innerSetMediaStreamTrack(void 0)}__releaseMediaElement(){this._element&&(this._element.remove(),this._element.srcObject=null)}}class gt extends Is{constructor(t,e,r,i){super(t,e,r,!0),this._isPublished=!1,this.__innerSetMediaStreamTrack(i),i.onended=()=>{i.onended=null,this.emit(gt.EVENT_LOCAL_TRACK_END,this),this.removeAll(gt.EVENT_LOCAL_TRACK_END)}}_setLocalMuted(t){const e=this._localMuted!==t;super._setLocalMuted(t),this._remoteMuted=this._localMuted,e&&this.emit(gt.__INNER_EVENT_MUTED_CHANGE__,this)}__innerSetPublished(t){this._isPublished=t}isPublished(){return this._isPublished}destroy(){var t;O.info(`track is destroyed -> trackId: ${this.getTrackId()}`),(t=this._msTrack)===null||t===void 0||t.stop(),super.__innerDestroy(),this.isAudioTrack()&&super.__releaseMediaElement(),this.emit(gt.__INNER_EVENT_DESTROY__,this)}setBitrate(t=0,e=0,r=0){!mt(t)||!mt(e)||!mt(r)||t<=0||e<=0||t<e?O.error("setBitrate params error ->"):this._bitrateInfo={max:t,min:e,start:r}}getBitrate(){var t,e;const{min:r,max:i}=this._msTrack?ah(this._msTrack):{min:0,max:0};return{min:((t=this._bitrateInfo)===null||t===void 0?void 0:t.min)||r,max:((e=this._bitrateInfo)===null||e===void 0?void 0:e.max)||i}}}gt.EVENT_LOCAL_TRACK_END="local-track-end",gt.__INNER_EVENT_MUTED_CHANGE__="inner-muted-change",gt.__INNER_EVENT_DESTROY__="inner-destroy";class ho extends gt{constructor(t,e,r){super(t,e,"audio",r)}setBitrate(t,e,r){O.warn("`setBitrate` invalid for audio track")}getBitrate(){return{start:32,max:32,min:32}}}class un extends gt{constructor(t,e,r,i=!1){super(t,e,"video",r),this._isTiny=i}__isTiny(){return this._isTiny}getStreamId(){const t=super.getStreamId();return this._isTiny?`${t}_tiny`:t}getTrackId(){const t=super.getTrackId();return this._isTiny?`${t}_tiny`:t}}class dn extends gt{static __innerSetMapping(t,e){const r=this._mapping.get(e)||[];r.push(t),this._mapping.set(e,r)}static __innerRemoveMapping(t,e){var r,i;const o=(r=this._mapping.get(e))===null||r===void 0?void 0:r.filter(s=>s!==t);o&&o.length>0?this._mapping.set(e,o):(this._mapping.delete(e),e.pause(),e.src="",(i=e.parentNode)===null||i===void 0||i.removeChild(e))}constructor(t,e,r,i,o){super(t,e,r,i),this._resource=o,dn.__innerSetMapping(this.getTrackId(),o)}destroy(){this.isAudioTrack()&&this.mute(),dn.__innerRemoveMapping(this.getTrackId(),this._resource),super.destroy()}}dn._mapping=new Map;class rh extends dn{constructor(t,e,r,i){super(t,e,"video",r,i)}}class ih extends dn{constructor(t,e,r,i){super(t,e,"audio",r,i)}_setLocalMuted(t){this._resource&&(this._resource.muted=t),super._setLocalMuted(t)}play(){return this._setLocalMuted(!1),Promise.resolve({code:P.SUCCESS})}}class Ba extends ho{}class Fa extends un{}class oh extends un{}class Dt extends Is{constructor(t,e,r,i){super(t,e,r,!1,i),this._isSubscribed=!1}__innerSetRemoteMuted(t){this._remoteMuted=t}__innerSetSubscribed(t){this._isSubscribed=t}isSubscribed(){return this._isSubscribed}}class Te extends Dt{constructor(t,e,r){super(t,e,"audio",r)}}class ye extends Dt{constructor(t,e,r){super(t,e,"video",r)}}const dr=(n,t)=>({name:n,content:JSON.stringify({uris:t,ignore:!0})}),Ne=n=>JSON.stringify(n),ge=n=>/^[a-zA-Z\d-=]+$/g.test(n),sh=location.protocol!=="http:"||["localhost","127.0.0.1"].includes(location.hostname),Ni=n=>{if(n===void 0)return 0;if(mt(n))return n;const t=n;return t.exact||t.ideal||t.max||0},Ss=n=>{const t=n.getSettings(),e=n.getConstraints();return{width:t.width||Ni(e.width),height:t.height||Ni(e.height),frameRate:t.frameRate||Ni(e.frameRate)}},ah=n=>{const{width:t,height:e,frameRate:r}=Ss(n),i=Tu(t||1920,e||1080),o=yu(r);return{min:i.minBitrate*o,max:i.maxBitrate*o}},ft=n=>[n.msid,n.mediaType].join("_"),bt=n=>{const t=n.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},je=(n,t)=>[n,t].join("_"),lr=n=>n.map(t=>Object.assign({},t)),vr=(n,t,e=!1)=>{n=n.slice();const r=[],i=[],o=[];return t.forEach(s=>{const c=ft(s);let d=n.findIndex(h=>ft(h)===c);if(e&&(d=n.findIndex(h=>h.uri===s.uri)),d===-1)return void r.push(s);const l=n[d];l.uri!==s.uri?r.push(s):l.state!==s.state&&o.push(s),n.splice(d,1)}),i.push(...n),{publishedList:r,unpublishedList:i,modifiedList:o}},ch=()=>{let n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=16*Math.random()|0;return(t==="x"?e:3&e|8).toString(16)});return n=n.replace(/-/g,"")+"0",n=parseInt(n,16),n=(t=>{const e="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=e.length+1;let i=+t;const o=[];do{const s=i%r;i=(i-s)/r,o.unshift(e[s])}while(i);return o.join("")})(n),n.length>22&&(n=n.slice(0,22)),n},de=n=>{const[t,e]=n.split("_").map(r=>parseInt(r.replace(/[^\d]/g,"")));return{width:t,height:e}},rn=n=>!!Et[n],po=n=>!!ie[n],le=n=>parseInt(n.replace("FPS_","")),Xt=(()=>{const{browser:n,version:t,supportsUnifiedPlan:e}=nh.browserDetails;return{browser:n,version:t,supportsUnifiedPlan:e!==!1}})();function Eu(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Cu(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}const fo=n=>Object.prototype.toString.call(n)==="[object Null]",Tr=n=>n.type===1,go=(n,t)=>{const e={},r=Object.keys(n.users);return r.length&&r.forEach(i=>{const o=[],s=n.users[i];if(s.extra){const c=JSON.parse(s.extra).roomId;if(t!==c)return}if(s.uris)try{o.push(...JSON.parse(s.uris))}catch{O.warn(`invalid user data -> userId: ${i}, userData: ${s}`)}e[i]=o}),e};var lt,kr;(function(n){n.PUBLISH="RCRTC:PublishResource",n.UNPUBLISH="RCRTC:UnpublishResource",n.MODIFY="RCRTC:ModifyResource",n.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",n.STATE="RCRTC:state",n.ROOM_NOTIFY="RCRTC:RoomNtf",n.USER_NOTIFY="RCRTC:UserNtf",n.KICK="RCRTC:kick",n.PK_INVITE="RCRTC:invite",n.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",n.PK_CANCEL_INVITE="RCRTC:cancelInvite",n.PK_INVITE_ANSWER="RCRTC:answerInvite",n.PK_END="RCRTC:endInvite",n.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline"})(lt||(lt={})),function(n){n.SUCCESS="Success",n.FAIL="Fail"}(kr||(kr={}));class uh{constructor(t,e,r,i=1e4){this._roomId=t,this._roomMode=e,this._context=r,this._gap=i,this._latestTimestamp=Date.now(),this._started=!1,this._timer=null}start(){this._started||(O.info("rtcping start ->"),this._started=!0,this._checkAlive())}_sendPing(){return new Promise(t=>{this._context.rtcPing(this._roomId,this._roomMode).then(t).catch(e=>{O.error(`rtcping receive unknown error -> ${e}`),t(R.UNKNOWN)}),setTimeout(t,1e4,R.TIMEOUT)})}_checkAlive(){var t,e,r;return j(this,void 0,void 0,function*(){O.info("rtcping ->");const i=yield this._sendPing(),o=Date.now();return i===R.SUCCESS?(O.info("rtcping success ->"),this._latestTimestamp=o,(t=this.onPingResult)===null||t===void 0||t.call(this,kr.SUCCESS),void(this._timer=setTimeout(()=>this._checkAlive(),this._gap))):(O.warn(`rtcping failed -> code: ${i}`),(e=this.onPingResult)===null||e===void 0||e.call(this,kr.FAIL),i===40003||o-this._latestTimestamp>6e4?(this.stop(),void((r=this.onFailed)===null||r===void 0||r.call(this,i===40003))):void(this._timer=setTimeout(()=>this._checkAlive(),500)))})}stop(){this._started&&(O.info("rtcping stop ->"),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}var Wt;(function(n){n[n.NORMAL=1]="NORMAL",n[n.TINY=2]="TINY"})(Wt||(Wt={}));const Ha=(n,t)=>Math.round(8*t/n),$a=(n,t=2)=>{const e=10**t;return Math.round(n*e)/e},Ee=(n,t=2)=>{n>1&&(n/=32767);const e=10**t;return Math.ceil(n*e)},hr=(n,t,e,r)=>{if(t===0)return 0;if(!e||!r)return $a(n/t,3);const i=t-r;if(i===0)return 0;const o=n-e;return o<0||i<0?0:$a(o/i,3)},Ru=n=>{const{jitter:t,rtt:e,packetsLostRate:r}=n;return!fo(t)||!fo(e)||r!==0};class Os{constructor(t,e){this._rtcPeerConn=t,this._sdpSemantics=e,this._latestPacketsSent={},this._latestBytesSent={},this._latestBytesRecv={},this._latestPacketsRecv={}}updateBytesSent(t,e,r){let i,o;if(this._latestBytesSent[t]&&e<this._latestBytesSent[t].bytesSent&&this.clearLatestpacketsSent([t]),this._latestBytesSent[t]){const{bytesSent:s,timestamp:c}=this._latestBytesSent[t];i=e-s,o=r-c,this._latestBytesSent[t]={bytesSent:e,timestamp:r}}else i=e,o=1e3,this._latestBytesSent[t]={bytesSent:e,timestamp:r};return Ha(o,i)}updateBytesRecv(t,e,r){let i,o;if(this._latestBytesRecv[t]&&e<this._latestBytesRecv[t].bytesRecv&&this.clearLatestPacketsRecv([t]),this._latestBytesRecv[t]){const{bytesRecv:s,timestamp:c}=this._latestBytesRecv[t];i=e-s,o=r-c,this._latestBytesRecv[t]={bytesRecv:e,timestamp:r}}else i=e,o=1e3,this._latestBytesRecv[t]={bytesRecv:e,timestamp:r};return Ha(o,i)}updateSenderPacketsLost(t,e,r){let i;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[t],"packetsSent")){const{packetsLost:o,packetsSent:s}=this._latestPacketsSent[t];i=hr(e,r,o,s),this._latestPacketsSent[t].packetsLost=e,this._latestPacketsSent[t].packetsSent=o===e?s:r}else i=hr(e,r),this._latestPacketsSent[t].packetsLost=e,this._latestPacketsSent[t].packetsSent=r;return i}updateReceiverPacketsLost(t,e,r){let i;if(this._latestPacketsRecv[t]){const{packetsLost:o,packetsRecv:s}=this._latestPacketsRecv[t];i=hr(e,r+e,o,s+o)}else i=hr(e,r);return this._latestPacketsRecv[t]={packetsLost:e,packetsRecv:r},i}clearLatestpacketsSent(t){t.forEach(e=>{if(parseInt(e.split("_").pop())===vt.VIDEO_ONLY){const r=`${e}_tiny`;delete this._latestPacketsSent[r],delete this._latestBytesSent[r]}delete this._latestPacketsSent[e],delete this._latestBytesSent[e]})}clearLatestPacketsRecv(t){t.forEach(e=>{delete this._latestPacketsRecv[e],delete this._latestBytesRecv[e]})}parseRTCStatsReport(t){const e=t.keys(),r={};let i=e.next();for(;!i.done;){const o=i.value,s=t.get(o);/^RTCCodec_/.test(o)||(r[o]=s),i=e.next()}return r}formatRCRTCStateReport(t){return{senders:[],receivers:[]}}getAudioLevelList(t){return[]}getResourceIdByParseSdp(t){var e,r;const i=t.ssrc,o=t.kind||t.mediaType,s=(e=this._rtcPeerConn.currentLocalDescription)===null||e===void 0?void 0:e.sdp,c=(r=this._rtcPeerConn.currentRemoteDescription)===null||r===void 0?void 0:r.sdp;let d;d=this._sdpSemantics==="unified-plan"?new RegExp("a=msid:(.*?) "):new RegExp(`a=ssrc:${i} msid:(.*?) `);const l=s==null?void 0:s.split(`\r
- m=`),h=l==null?void 0:l.filter(_=>_.includes(`a=ssrc:${i}`))[0],a=h==null?void 0:h.match(d);let u=a?a[1]:"";if(u)return`${u}_${o==="video"?1:0}`;const p=c==null?void 0:c.split(`\r
- m=`),f=p==null?void 0:p.filter(_=>_.includes(`a=ssrc:${i}`))[0],m=f==null?void 0:f.match(d);return u=m?m[1]:"",`${u}_${o==="video"?1:0}`}isValidSender(t){var e;const r=(e=this._rtcPeerConn.currentLocalDescription)===null||e===void 0?void 0:e.sdp,{ssrc:i}=t;return!(r==null?void 0:r.split(`\r
- m=`).some(o=>o.includes(i)&&o.includes("a=inactive")))}isValidReceiver(t){var e;const r=(e=this._rtcPeerConn.currentRemoteDescription)===null||e===void 0?void 0:e.sdp,{ssrc:i}=t;return!(r==null?void 0:r.split(`\r
- m=`).some(o=>o.includes(i)&&o.includes("a=inactive")))}}class dh extends Os{formatRCRTCStateReport(t){const e={senders:[],receivers:[]},r=Math.floor(t.RTCPeerConnection.timestamp);e.timestamp=r;const i=Object.keys(t);let o=0,s=0;i.filter(l=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=t[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(h))return;const{id:a,kind:u,transportId:p,mediaSourceId:f,remoteId:m,packetsSent:_,bytesSent:v,trackId:T,encoderImplementation:y,pliCount:w,nackCount:L,firCount:M}=h;if(!T)return;let{framesPerSecond:C,frameWidth:A,frameHeight:F}=h;u!=="video"||A||F||C||(A=t[T].frameWidth,F=t[T].frameHeight,C=f?t[f].framesPerSecond:null);const G=t[m];let E=null,S=null,I=0;G&&(E=G.jitter,S=G.roundTripTime,I=G.packetsLost),o+=I;const N=this.getResourceIdByParseSdp(h),b=f?t[f].audioLevel:t[T].audioLevel;let k=null;!this._latestPacketsSent[N]&&(this._latestPacketsSent[N]={}),G?k=this.updateSenderPacketsLost(N,I,_):this._latestPacketsSent[N].crtPacketsSent=_;let U=this.updateBytesSent(N,v,r);U<0&&(U=0),s+=U,e.senders.push({id:a,trackId:N,kind:u,packetsLostRate:k,remoteResource:!1,audioLevel:b||b===0?Ee(b):null,frameWidth:A,frameHeight:F,frameRate:C,bitrate:U,jitter:E&&Math.round(1e3*E),rtt:S,encoderImplementation:y,pliCount:w,nackCount:L,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}),i.filter(l=>/RTCRemoteInboundRtp(Video|Audio)Stream_/.test(l)).forEach(l=>{const{localId:h,jitter:a,roundTripTime:u,packetsLost:p}=t[l],f=e.senders.filter(m=>m.id===h)[0];if(f&&!Ru(f)){const m=this.getResourceIdByParseSdp(t[f.id]);f.jitter=Math.round(1e3*a),f.rtt=u;const _=this._latestPacketsSent[m].crtPacketsSent;f.packetsLostRate=this.updateSenderPacketsLost(m,p,_)}});let c=0;i.filter(l=>/^RTCInboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=t[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(h))return;const{trackId:a,packetsLost:u,packetsReceived:p,jitter:f,bytesReceived:m,framesPerSecond:_,kind:v,codecImplementationName:T,nackCount:y,pliCount:w}=h;if(!a)return;let{frameWidth:L,frameHeight:M,audioLevel:C}=h;v==="video"?L||M||(L=t[a].frameWidth,M=t[a].frameHeight):C||(C=t[a].audioLevel),o+=u;const A=this.getResourceIdByParseSdp(h),F=this.updateReceiverPacketsLost(A,u,p);let G=this.updateBytesRecv(A,m,r);G<0&&(G=0),c+=G,e.receivers.push({trackId:A,kind:v,packetsLostRate:F,remoteResource:!0,audioLevel:C||C===0?Ee(C):null,frameWidth:L,frameHeight:M,frameRate:_,bitrate:G,jitter:f?Math.round(1e3*f):0,codecImplementationName:T,nackCount:y,pliCount:w,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})});const d=i.filter(l=>/^RTCTransport_/.test(l))[0];if(d){const l=t[d],{selectedCandidatePairId:h}=l;if(h){const a=t[h],{availableOutgoingBitrate:u,availableIncomingBitrate:p,currentRoundTripTime:f,localCandidateId:m,remoteCandidateId:_}=a,v=t[m],{ip:T,port:y,networkType:w}=v,L=t[_],{ip:M,port:C,protocol:A}=L;e.iceCandidatePair={IP:T,port:y,networkType:w,remoteIP:M,remotePort:C,protocol:A,bitrateRecv:c,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:u,availableIncomingBitrate:p,totalPacketsLost:o},e.receivers.forEach(F=>{F.rtt=f})}}return e}getAudioLevelList(t){const e=[],r=Object.keys(t);return r.filter(i=>/^RTCOutboundRTPAudioStream_/.test(i)).forEach(i=>{var o;const s=t[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(s))return;const{mediaSourceId:c,trackId:d}=s,l=this.getResourceIdByParseSdp(s),h=c&&t[c]?t[c].audioLevel:((o=t[d])===null||o===void 0?void 0:o.audioLevel)||null;e.push({trackId:l,audioLevel:h||h===0?Ee(h):null})}),r.filter(i=>/^RTCInboundRTPAudioStream_/.test(i)).forEach(i=>{const o=t[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(o))return;const{trackId:s}=o,c=o.audioLevel||t[s].audioLevel,d=this.getResourceIdByParseSdp(o);e.push({trackId:d,audioLevel:c||c===0?Ee(c):null})}),e}}class lh extends Os{formatRCRTCStateReport(t){const e=+new Date,r={senders:[],receivers:[],timestamp:e};let i=0,o=0,s=0;for(const c in t){const d=t[c],l=d.type;if(l==="outbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(d))continue;const{id:h,kind:a,bytesSent:u,packetsSent:p,bitrateMean:f,framerateMean:m,nackCount:_,pliCount:v,remoteId:T}=d,{jitter:y,roundTripTime:w,packetsLost:L}=T?t[T]:{jitter:null,roundTripTime:null,packetsLost:0},M=this.getResourceIdByParseSdp(d);i+=L;let C=null;!this._latestPacketsSent[M]&&(this._latestPacketsSent[M]={}),T?C=this.updateSenderPacketsLost(M,L,p):this._latestPacketsSent[M].crtPacketsSent=p;let A=0;a==="video"?f&&(A=Math.floor(f/1e3)):A=this.updateBytesSent(M,u,e),A<0&&(A=0),o+=A,r.senders.push({trackId:M,kind:a,packetsLostRate:C,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(m),bitrate:A,jitter:y?Math.round(1e3*y):null,rtt:w,encoderImplementation:null,pliCount:v,nackCount:_,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}if(l==="remote-inbound-rtp"){const{localId:h}=d,a=this.getResourceIdByParseSdp(t[h]),u=r.senders.filter(p=>p.trackId===a)[0];u&&Ru(u)&&(u.jitter=Math.round(1e3*d.jitter),u.rtt=d.rtt,u.packetsLostRate=this.updateSenderPacketsLost(a,d.packetsLost,this._latestPacketsSent[a].crtPacketsSent))}if(l==="inbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(d))continue;const{id:h,packetsLost:a,bytesReceived:u,packetsReceived:p,jitter:f,framerateMean:m,kind:_,bitrateMean:v,nackCount:T,pliCount:y}=d,w=this.getResourceIdByParseSdp(d);i+=a;const L=this.updateReceiverPacketsLost(w,a,p);let M=0;_==="video"?v&&(M=Math.floor(v/1e3)):M=this.updateBytesRecv(w,u,e),M<0&&(M=0),s+=M,r.receivers.push({trackId:w,kind:_,packetsLostRate:L,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(m),bitrate:M,jitter:f?Math.round(1e3*f):null,codecImplementationName:null,nackCount:T,pliCount:y,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}if(l==="candidate-pair"&&d.state==="succeeded"){const h=t[d.localCandidateId],{address:a,port:u}=h,p=t[d.remoteCandidateId],{address:f,port:m,protocol:_}=p;r.iceCandidatePair={IP:a,port:u,networkType:null,remoteIP:f,remotePort:m,protocol:_,bitrateRecv:s,bitrateSend:o,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:i}}}return r.iceCandidatePair&&(r.iceCandidatePair.bitrateSend=o),r.iceCandidatePair&&(r.iceCandidatePair.bitrateRecv=s),r}getAudioLevelList(t){const e=[];for(const r in t){const i=t[r],o=i.type;if(o==="outbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(i))continue;const{kind:s}=i;if(s==="video")continue;const c=this.getResourceIdByParseSdp(i);e.push({trackId:c,audioLevel:null})}if(o==="inbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(i))continue;const{kind:s}=i;if(s==="video")continue;const c=this.getResourceIdByParseSdp(i);e.push({trackId:c,audioLevel:null})}}return e}}class hh extends Os{formatRCRTCStateReport(t){const e={senders:[],receivers:[]},r=Math.floor(t.RTCPeerConnection.timestamp);e.timestamp=r;const i=Object.keys(t);let o=0,s=0;i.filter(l=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=t[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(h))return;const a=this.getResourceIdByParseSdp(h),{mediaType:u,transportId:p,remoteId:f,packetsSent:m,bytesSent:_,trackId:v,encoderImplementation:T,pliCount:y,nackCount:w,firCount:L}=h;if(!v)return;const{audioLevel:M,frameHeight:C,frameWidth:A}=t[v];let F=this.updateBytesSent(a,_,r);F<0&&(F=0),s+=F,e.senders.push({trackId:a,kind:u,packetsLostRate:null,remoteResource:!1,audioLevel:M||M===0?Ee(M):null,frameWidth:A,frameHeight:C,frameRate:null,bitrate:F,jitter:null,rtt:null,encoderImplementation:T,pliCount:y,nackCount:w,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})});let c=0;i.filter(l=>/^RTCInboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=t[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(h))return;const{trackId:a,packetsLost:u,packetsReceived:p,jitter:f,bytesReceived:m,mediaType:_,nackCount:v,pliCount:T}=h,y=this.getResourceIdByParseSdp(h);if(!a)return;const{frameHeight:w,frameWidth:L,audioLevel:M}=t[a];o+=u;const C=this.updateReceiverPacketsLost(y,u,p);let A=this.updateBytesRecv(y,m,r);A<0&&(A=0),c+=A,e.receivers.push({trackId:y,kind:_,packetsLostRate:C,remoteResource:!0,audioLevel:M||M===0?Ee(M):null,frameWidth:L,frameHeight:w,frameRate:null,bitrate:A,jitter:f,codecImplementationName:null,nackCount:v,pliCount:T,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})});const d=i.filter(l=>/^RTCTransport_/.test(l))[0];if(d){const l=t[d],{selectedCandidatePairId:h}=l;if(h){const a=t[h],{availableOutgoingBitrate:u,availableIncomingBitrate:p,currentRoundTripTime:f,localCandidateId:m,remoteCandidateId:_}=a,v=t[m],{address:T,port:y}=v,w=t[_],{address:L,port:M,protocol:C}=w;e.iceCandidatePair={IP:T||null,port:y,networkType:null,remoteIP:L,remotePort:M,protocol:C,bitrateRecv:c,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:u,availableIncomingBitrate:p,totalPacketsLost:o},e.receivers.forEach(A=>{A.rtt=f})}}return e}getAudioLevelList(t){const e=[],r=Object.keys(t);return r.filter(i=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(i)).forEach(i=>{const o=t[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(o))return;const{trackId:s,mediaType:c}=o;if(c==="video")return;const d=this.getResourceIdByParseSdp(o),l=t[s];e.push({trackId:d,audioLevel:l||l===0?Ee(l):null})}),r.filter(i=>/^RTCInboundRTP(Video|Audio)Stream_/.test(i)).forEach(i=>{const o=t[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(o))return;const{trackId:s,mediaType:c}=o;if(!s||c==="video")return;const{audioLevel:d}=t[s],l=this.getResourceIdByParseSdp(o);e.push({trackId:l,audioLevel:d||d===0?Ee(d):null})}),e}}class fn{static setSdpSemantics(t){const{browser:e,version:r,supportsUnifiedPlan:i}=Xt;i?/chrome/i.test(e)?this._sdpSemantics=r>92?"unified-plan":r<72?"plan-b":t:/firefox/i.test(e)?this._sdpSemantics="unified-plan":/safari/i.test(e)?this._sdpSemantics=r<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan":this._sdpSemantics="plan-b"}static getSdpSemantics(){return fn._sdpSemantics}constructor(t){this._peer=t,this._outboundStreams={}}getOutboundVideoInfo(){const t=[];for(const e in this._outboundStreams){const r=this._outboundStreams[e].getVideoTracks()[0];if(!r)continue;const i=/_tiny$/.test(e),{width:o,height:s}=Ss(r);t.push({trackId:r.id,simulcast:i?Wt.TINY:Wt.NORMAL,resolution:`${o}x${s}`})}return t}setRemoteAnswer(t){return j(this,void 0,void 0,function*(){t=t.replace(/\s+\r\n/g,`\r
- `);try{yield this._peer.setRemoteDescription({type:"answer",sdp:t})}catch(e){return O.error(e),P.SET_REMOTE_DESCRIPTION_FAILED}return P.SUCCESS})}getStatParsr(t,e){return/chrome/i.test(Xt.browser)?new dh(t,e):/Firefox/i.test(Xt.browser)?new lh(t,e):/Safari/i.test(Xt.browser)?new hh(t,e):null}}class ph extends fn{constructor(){super(...arguments),this.senders={},this._localTracks=[]}addLocalTrack(t){this._localTracks.includes(t)||this._localTracks.push(t);const e=t.getStreamId(),r=t.__innerGetMediaStreamTrack(),i=this._outboundStreams[e]||(this._outboundStreams[e]=new MediaStream);i.getTracks().forEach(c=>{c.kind===r.kind&&i.removeTrack(c)}),i.addTrack(r);const o=t.getTrackId(),s=this.senders[o];s?s.replaceTrack(r):this.senders[o]=this._peer.addTrack(r,i)}removeLocalTrack(t){const e=this._localTracks.findIndex(o=>o===t);e>=0&&this._localTracks.splice(e,1);const r=t.getTrackId(),i=this.senders[r];i&&(i.replaceTrack(null),this._peer.removeTrack(i),delete this.senders[r])}updateSubRemoteTracks(t){}updateRecvTransceiverMap(t,e){}setBitrate(t,e,r){this._maxBitrate=t,this._minBitrate=e,this._startBitrate=r||.7*t}createOffer(t){return j(this,void 0,void 0,function*(){const e=yield this._peer.createOffer({iceRestart:t,offerToReceiveAudio:!0,offerToReceiveVideo:!0});for(const r in this._outboundStreams){const i=this._outboundStreams[r].id;e.sdp=e.sdp.replace(new RegExp(i,"g"),r)}return yield this._peer.setLocalDescription(e),{type:"offer",semantics:"plan-b",sdp:e.sdp}})}setRemoteAnswer(t){let e=0,r=0;this._localTracks.forEach(c=>{const{min:d,max:l}=c.getBitrate();r+=d,e+=l}),e=this._maxBitrate&&this._maxBitrate>0?Math.min(e,this._maxBitrate):e,r=this._minBitrate&&this._minBitrate>0?Math.max(r,this._minBitrate):r;const i=this._startBitrate||Math.round(.7*e),o=`b=AS:${e}`;t=t.replace(/[\r\n]+m=video[^\r\n]+/,c=>`${c}\r
- ${o}`);const s=[`;x-google-min-bitrate=${r}`,`;x-google-max-bitrate=${e}`,`;x-google-start-bitrate=${i}`].join("");return t=t.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,c=>c+s),super.setRemoteAnswer(t)}}class fh extends fn{constructor(){super(...arguments),this._sendTransceiver={},this._localTracks={},this._recvAudio=[],this._recvVideo=[],this._recvTransceiver={},this._subedTracks=[]}setBitrate(t,e,r){O.warn("the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}addLocalTrack(t){const e=t.getTrackId(),r=t.getStreamId(),i=t.__innerGetMediaStreamTrack();this._localTracks[e]=t;const o=this._outboundStreams[r]||(this._outboundStreams[r]=new MediaStream);o.getTracks().forEach(c=>{c.kind===i.kind&&o.removeTrack(c)}),o.addTrack(i);const s=this._sendTransceiver[e];s?(s.sender.replaceTrack(i),s.direction="sendonly"):this._sendTransceiver[e]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]})}removeLocalTrack(t){const e=t.getTrackId(),r=t.getStreamId();t.__innerGetMediaStreamTrack(),delete this._localTracks[e];const i=this._sendTransceiver[e];if(!i)return;i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null);const o=this._outboundStreams[r];(t.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach(l=>o.removeTrack(l));const s=this._sendTransceiver[`${e}_tiny`];if(!s||s.direction==="inactive")return;s.direction="inactive";const c=s.sender,d=c.track;this._peer.removeTrack(c),c.replaceTrack(null),this._outboundStreams[`${r}_tiny`].removeTrack(d),d.stop()}updateRecvTransceiverMap(t,e){const{mediaType:r}=bt(t);this._recvTransceiver[t]=e;const i=r===vt.AUDIO_ONLY?this._recvAudio:this._recvVideo,o=i.findIndex(s=>s===e);o>=0&&i.splice(o,1)}updateSubRemoteTracks(t){const e=t.slice(),r=this._subedTracks.slice();this._subedTracks=t.slice();for(let o=e.length-1;o>=0;o-=1){const s=e[o],c=r.findIndex(d=>d===s);c>=0&&(e.splice(o,1),r.splice(c,1))}r.length&&r.forEach(o=>{const s=o.getTrackId();o.__innerSetMediaStreamTrack(void 0);const c=this._recvTransceiver[s];c&&(c.direction="inactive")});const i={audio:0,video:0};e.length&&e.forEach(o=>{const s=o.isAudioTrack()?"audio":"video",c=this._recvTransceiver[o.getTrackId()];c?c.direction="recvonly":i[s]+=1});for(let o=this._recvAudio.length;o<i.audio;o+=1)this._recvAudio.push(this._peer.addTransceiver("audio",{direction:"recvonly"}));for(let o=this._recvVideo.length;o<i.video;o+=1)this._recvVideo.push(this._peer.addTransceiver("video",{direction:"recvonly"}))}createOffer(t){return j(this,void 0,void 0,function*(){const e=yield this._peer.createOffer({iceRestart:t});let r=e.sdp;for(const i in this._outboundStreams){const o=this._outboundStreams[i].id;r=r.replace(new RegExp(o,"g"),i)}return r=(i=>i.split(/\r\n(?=m=)/).map(o=>(s=>/a=(recvonly|inactive)/.test(s)?s.replace(/\r\na=(ssrc|msid)[^\r\n]+/g,""):s)(o)).join(`\r
- `))(r),r=r.replace(/a=ice-options:trickle/g,`a=ice-options:trickle\r
- a=ice-options:renomination`),e.sdp=r,yield this._peer.setLocalDescription(e),{type:"offer",semantics:"unified-plan",sdp:r}})}setRemoteAnswer(t){t=t.split(/\r\n(?=m=)/).map(r=>{var i;const o=r.match(/a=mid:[^\s]+/);if(!o)return r;const s=o[0].replace("a=mid:","");let c="";for(const f in this._sendTransceiver)if(this._sendTransceiver[f].mid===s){c=f;break}if(!c)return r;const d=(i=this._localTracks[c])===null||i===void 0?void 0:i.getBitrate();if(!d)return r;const{max:l,min:h}=d,a=l&&l>0?d.start||.7*l:0,u=[];if(l&&l>0&&u.push(`;x-google-max-bitrate=${l}`),h&&h>0&&u.push(`;x-google-min-bitrate=${h}`),a>0&&u.push(`;x-google-start-bitrate=${a}`),u.length===0)return r;const p=u.join("");return r.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,f=>f+p)}).join(`\r
- `);const e=/[\r\n]+\r\n[\r\n]+/g;return e.test(t)&&(O.warn(`answer sdp invalid -> ${JSON.stringify(t)}`),t=t.replace(e,`\r
- `)),super.setRemoteAnswer(t)}}class he extends Fn{constructor(t,e){super(),this._reTryExchange=t,this._polarisReport=e,this.pubLocalTracks={},this._reTryExchangeTimer=null,this._reportStatsTimer=null,this._reportListener=null;const r=fn.getSdpSemantics(),i=this._rtcPeerConn=new RTCPeerConnection({sdpSemantics:r});this._sdpStrategy=r==="plan-b"?new ph(i):new fh(i),this._rtcPeerConn.oniceconnectionstatechange=this._onICEConnectionStateChange.bind(this),this._rtcPeerConn.onconnectionstatechange=this._onConnectionStateChange.bind(this),this._rtcPeerConn.ontrack=this._onTrackReady.bind(this),this.reportParser=this._sdpStrategy.getStatParsr(this._rtcPeerConn,r)}getLocalTracks(){return Object.values(this.pubLocalTracks)}_onConnectionStateChange(){O.info(`onconnectionstatechange -> ${this._rtcPeerConn.connectionState}`)}_onICEConnectionStateChange(){var t,e;O.info(`oniceconnectionstatechange -> ${this._rtcPeerConn.iceConnectionState}`),this._rtcPeerConn.iceConnectionState==="connected"&&(this._reportStatsTimer&&clearInterval(this._reportStatsTimer),this._reportStatsTimer=setInterval(this._reportHandle.bind(this),1e3)),this._rtcPeerConn.iceConnectionState!=="failed"&&this._rtcPeerConn.iceConnectionState!=="disconnected"||(O.warn("iceconenction state is `failed`, exchange SDP to try again."),this._reTryExchange(),this._reTryExchangeTimer=setInterval(this._reTryExchange,15e3));try{(e=(t=this._reportListener)===null||t===void 0?void 0:t.onICEConnectionStateChange)===null||e===void 0||e.call(t,this._rtcPeerConn.iceConnectionState)}catch(r){O.error("onICEConnectionStateChange error",r)}}_onTrackReady(t){if(!t.streams.length)return;const e=[t.streams[0].id,t.receiver.track.kind==="audio"?vt.AUDIO_ONLY:vt.VIDEO_ONLY].join("_");this._updateRecvTransceiverMap(e,t.transceiver),this.emit(he.__INNER_EVENT_TRACK_READY__,t)}setBitrate(t,e,r){return j(this,void 0,void 0,function*(){this._sdpStrategy.setBitrate(t,e,r)})}createOffer(t){return j(this,void 0,void 0,function*(){const e=yield this._sdpStrategy.createOffer(t);return O.debug(`offer -> ${JSON.stringify(e.sdp)}`),e})}setRemoteAnswer(t){return j(this,void 0,void 0,function*(){return O.debug(`answer -> ${JSON.stringify(t)}`),this._sdpStrategy.setRemoteAnswer(t)})}getLocalTrack(t){return this.pubLocalTracks[t]||null}addLocalTrack(t){this.pubLocalTracks[t.getTrackId()]=t,this._sdpStrategy.addLocalTrack(t),t.off(gt.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.off(gt.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.on(gt.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(gt.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}removeLocalTrackById(t){const e=this.getLocalTrack(t);e&&this.removeLocalTrack(e)}removeAllLocalTrack(){Object.keys(this.pubLocalTracks).forEach(t=>{/_tiny$/.test(t)||this.removeLocalTrackById(t)})}removeLocalTrack(t){const e=t.getTrackId();delete this.pubLocalTracks[e],this._sdpStrategy.removeLocalTrack(t),t.__innerSetPublished(!1),t.off(gt.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.off(gt.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);const r=`${e}_tiny`,i=this.getLocalTrack(r);i&&(this._sdpStrategy.removeLocalTrack(i),delete this.pubLocalTracks[r],i.destroy())}_updateRecvTransceiverMap(t,e){this._sdpStrategy.updateRecvTransceiverMap(t,e)}updateSubRemoteTracks(t){this._sdpStrategy.updateSubRemoteTracks(t)}getOutboundVideoInfo(){return this._sdpStrategy.getOutboundVideoInfo()}_onLocalTrackMuted(t){const e=this.getLocalTrack(`${t.getTrackId()}_tiny`);e&&(e.__innerGetMediaStreamTrack().enabled=!t.isLocalMuted()),this.emit(gt.__INNER_EVENT_MUTED_CHANGE__,t)}_onLocalTrackDestroied(t){this.emit(gt.__INNER_EVENT_DESTROY__,t)}registerReportListener(t){this._reportListener=t}_createRCRTCStateReport(t){const{timestamp:e,iceCandidatePair:r,senders:i,receivers:o}=JSON.parse(JSON.stringify(t));r==null||delete r.totalPacketsLost;for(const s in r)fo(r[s])&&delete r[s];return{timestamp:e,iceCandidatePair:r,senders:i.map(s=>{const c={};return s.trackId&&(c.trackId=s.trackId),s.kind&&(c.kind=s.kind),(s.packetsLostRate||s.packetsLostRate===0)&&(c.packetsLostRate=s.packetsLostRate),c.remoteResource=s.remoteResource,(s.audioLevel||s.audioLevel===0)&&(c.audioLevel=s.audioLevel),s.frameWidth&&(c.frameWidth=s.frameWidth),s.frameHeight&&(c.frameHeight=s.frameHeight),s.frameRate&&(c.frameRate=s.frameRate),(s.bitrate||s.bitrate===0)&&(c.bitrate=s.bitrate),s.jitter&&(c.jitter=s.jitter),c}),receivers:o.map(s=>{const c={};return s.trackId&&(c.trackId=s.trackId),s.kind&&(c.kind=s.kind),(s.packetsLostRate||s.packetsLostRate===0)&&(c.packetsLostRate=s.packetsLostRate),c.remoteResource=s.remoteResource,(s.audioLevel||s.audioLevel===0)&&(c.audioLevel=s.audioLevel),s.frameWidth&&(c.frameWidth=s.frameWidth),s.frameHeight&&(c.frameHeight=s.frameHeight),s.frameRate&&(c.frameRate=s.frameRate),(s.bitrate||s.bitrate===0)&&(c.bitrate=s.bitrate),s.jitter&&(c.jitter=s.jitter),c})}}_getStatsData(){var t,e;return j(this,void 0,void 0,function*(){const r=yield this._rtcPeerConn.getStats(),i=(t=this.reportParser)===null||t===void 0?void 0:t.parseRTCStatsReport(r);return(e=this.reportParser)===null||e===void 0?void 0:e.formatRCRTCStateReport(i)})}getAudioLevelReportData(){var t,e;return j(this,void 0,void 0,function*(){const r=yield this._rtcPeerConn.getStats(),i=(t=this.reportParser)===null||t===void 0?void 0:t.parseRTCStatsReport(r);return i?(e=this.reportParser)===null||e===void 0?void 0:e.getAudioLevelList(i):[]})}_reportHandle(){var t,e,r;return j(this,void 0,void 0,function*(){const i=yield this._getStatsData();if(!i)return;(i.senders.length||i.receivers.length)&&((t=this._polarisReport)===null||t===void 0||t.sendR3R4Data(i));const o=this._createRCRTCStateReport(i);(r=(e=this._reportListener)===null||e===void 0?void 0:e.onStateReport)===null||r===void 0||r.call(e,o)})}getRTCPeerConn(){return this._rtcPeerConn}destroy(){this.clear(),this.clearReTryExchangeTimer(),this._reportStatsTimer&&(clearInterval(this._reportStatsTimer),this._reportStatsTimer=null),this.registerReportListener(null),this._rtcPeerConn.close(),this.reportParser=null}clearReTryExchangeTimer(){clearInterval(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}var Je,xr,Ce,Re,Vr;he.__INNER_EVENT_TRACK_READY__="inner-track-ready",function(n){n[n.DISABLE=0]="DISABLE",n[n.ENABLE=1]="ENABLE"}(Je||(Je={})),function(n){n[n.MeetingOrAnchor=1]="MeetingOrAnchor",n[n.Audience=2]="Audience"}(xr||(xr={}));class Iu{constructor(t,e,r,i,o=xr.MeetingOrAnchor){this._context=t,this._runtime=e,this._roomId=r,this._crtRTCRoom=i,this._userRole=o}_send(t){this._context.getConnectionStatus()===Z.CONNECTED&&this._context.setRTCState(this._roomId,t)}_getClientID(){const t="uuid";let e=this._runtime.localStorage.getItem(t);return e||(e=ch(),this._runtime.localStorage.setItem(t,e)),e}_getRealResourceId(t){let e=t;const r=t.indexOf("_tiny");return r>-1&&(e=t.slice(0,r)),e}_getPolarisTrackId(t){let e="";const r=t.split("_");if(t.includes("_tiny")){const i=r.pop(),o=parseInt(r.pop())===vt.AUDIO_ONLY?"audio":"video",s=r.pop();e=[r.join("_"),s,i,o].join("_")}else{const i=parseInt(r.pop())===vt.AUDIO_ONLY?"audio":"video",o=r.pop();e=[r.join("_"),o,i].join("_")}return e}sendR3R4Data(t){const{iceCandidatePair:e,senders:r,receivers:i}=t,o=(e==null?void 0:e.bitrateSend)||-1,s=(e==null?void 0:e.bitrateRecv)||-1,c=(e==null?void 0:e.networkType)||"unknown",d=(e==null?void 0:e.rtt)||-1,l=`${(e==null?void 0:e.IP)||-1}:${e==null?void 0:e.port}`,h=(e==null||e.remoteIP,e==null||e.remotePort,(e==null?void 0:e.availableIncomingBitrate)||-1),a=(e==null?void 0:e.availableOutgoingBitrate)||-1,u=(e==null?void 0:e.totalPacketsLost)||-1,p=this._context.getCurrentId();let f=`R3 ${o} -1 -1 -1 ${c} ${d} ${l} ${h} ${a} ${u} ${p}\r`,m=`R4 ${s} -1 -1 -1 ${c} ${d} ${l} ${h} ${a} ${u} ${p}\r`;const _=r.map(T=>{var y;const{trackId:w,audioLevel:L,samplingRate:M,bitrate:C,packetsLostRate:A,frameRate:F,frameWidth:G,frameHeight:E,googRenderDelayMs:S,jitter:I,nackCount:N,pliCount:b,rtt:k,googFirsSent:U,encoderImplementation:$}=T,q=this._getPolarisTrackId(w),X=this._getRealResourceId(w);return{trackId:q,googCodecName:$||String(-1),audioLevel:L||L===0?L:-1,bitrate:C||C===0?C:-1,packetsLostRate:A||A===0?A:-1,frameRate:F||-1,resolution:G&&E?`${G} * ${E}`:"-1",jitter:I||-1,nackCount:N||N===0?N:-1,pliCount:b||b===0?b:-1,rtt:k||-1,googFirsSent:U,samplingRate:M,googRenderDelayMs:S,encoderImplementation:$||String(-1),trackState:((y=this._crtRTCRoom.getLocalTrack(X))===null||y===void 0?void 0:y.isLocalMuted())?Je.DISABLE:Je.ENABLE}}),v=i.filter(T=>!!T.trackId).map(T=>{var y;const{trackId:w,audioLevel:L,samplingRate:M,bitrate:C,packetsLostRate:A,frameRate:F,frameWidth:G,frameHeight:E,googRenderDelayMs:S,jitter:I,nackCount:N,pliCount:b,rtt:k,googFirsReceived:U,codecImplementationName:$}=T,q=this._getPolarisTrackId(w),X=this._getRealResourceId(w);return{trackId:q,googCodecName:$||String(-1),audioLevel:L||L===0?L:-1,bitrate:C||C===0?C:-1,packetsLostRate:A||A===0?A:-1,frameRate:F||-1,resolution:G&&E?`${G} * ${E}`:"-1",jitter:I||-1,nackCount:N||N===0?N:-1,pliCount:b||b===0?b:-1,rtt:k||-1,googFirsReceived:U,samplingRate:M,googRenderDelayMs:S,codecImplementationName:$||String(-1),trackState:((y=this._crtRTCRoom.getRemoteTrack(X))===null||y===void 0?void 0:y.isLocalMuted())?Je.DISABLE:Je.ENABLE}});f+=_.map(T=>`${T.trackId} ${T.googCodecName} ${T.audioLevel} ${T.samplingRate} ${T.bitrate} ${T.packetsLostRate} ${T.frameRate} ${T.resolution} ${T.googRenderDelayMs} ${T.jitter} ${T.nackCount} ${T.pliCount} ${T.rtt} ${T.googFirsSent} ${T.encoderImplementation} ${T.trackState}`).join(`
- `),t.senders.length&&this._send(f+`\r${this._userRole}`),m+=v.map(T=>`${T.trackId} ${T.googCodecName} ${T.audioLevel} ${T.samplingRate} ${T.bitrate} ${T.packetsLostRate} ${T.frameRate} ${T.resolution} ${T.googRenderDelayMs} ${T.jitter} ${T.nackCount} ${T.pliCount} ${T.rtt} ${T.googFirsReceived} ${T.codecImplementationName} ${T.trackState}`).join(`
- `),t.receivers.length&&this._send(m+`\r${this._userRole}`)}sendR1(){const t=`R1 5.3.13 ${this._context.getCoreVersion()} web ${navigator.platform} -1 ${Xt.browser} ${Xt.version} ${this._getClientID()} ${this._userRole}`;this._send(t)}sendR2(t,e,r){const i=`R2 ${t} ${e} ${this._getClientID()}\r${r.join(" ")}\r${this._userRole}`;this._send(i)}}(function(n){n.PUBLISH="publish",n.SUBSCRIBE="subscribe"})(Ce||(Ce={})),function(n){n.BEGIN="begin",n.END="end"}(Re||(Re={}));class Su{constructor(t){this._room=t,this._audioLevelChangeHandler=null,this._timer=null,this._pc=this._room.__getPC()}_audioLevelReport(){return j(this,void 0,void 0,function*(){if(this._pc.getRTCPeerConn().iceConnectionState==="new"||!this._audioLevelChangeHandler)return;const t=(yield this._pc.getAudioLevelReportData()).map(e=>{const{userId:r}=Ch.parseTrackId(e.trackId);return{track:this._room.getCrtUserId()===r?this._room.getLocalTrack(e.trackId):this._room.getRemoteTrack(e.trackId),audioLevel:e.audioLevel||0}}).filter(e=>e.track);this._audioLevelChangeHandler(t)})}onAudioLevelChange(t,e){e<300||e>1e3?O.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000'):t?(this._audioLevelChangeHandler=t,this._timer=setInterval(this._audioLevelReport.bind(this),e)):this._audioLevelChangeHandler=null}clearAudioLevelReportTimer(){this._timer&&(clearInterval(this._timer),this._timer=null)}}(function(n){n[n.ANCHOR=1]="ANCHOR",n[n.AUDIENCE=2]="AUDIENCE"})(Vr||(Vr={}));const En=n=>n instanceof Is?n.getTrackId():n.track.getTrackId();class Ou{constructor(t,e,r,i,o,s,c,d,l,h){this._context=t,this._runtime=e,this._roomId=r,this._roomMode=o,this._service=s,this._initOptions=c,this._ntfClearRoomItem=d,this._isMainRoom=h,this._remoteTracks={},this._subscribedList=[],this._destroyed=!1,this.msgTaskQueue=new Vc,this._appListener=null,this._onRecvPKMsg=null,this._token=i.token,this._sessionId=i.sessionId,this._roomResources=l?{}:go(i,this._roomId),this._initRemoteTracks();const a=this._context.getCurrentId(),u=this._roomResources[a]=this._roomResources[a]||[];O.debug(`room data -> ${JSON.stringify(this._roomResources)}`),u.length>0&&Ct(()=>this._unpublishPrev(u)),l&&this._afterChangedRole(i),this._pinger=new uh(r,this._roomMode,t,this._initOptions.pingGap),this._pinger.onFailed=this._kickoff.bind(this),this._pinger.onPingResult=this._handlePingResult.bind(this),this._pinger.start(),this._polarisReport=new Iu(this._context,this._runtime,this._roomId,this),this._polarisReport.sendR1(),this._pc=new he(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(he.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.on(gt.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),this._pc.on(gt.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}_initRemoteTracks(){const t=this._context.getCurrentId();for(const e in this._roomResources){const r=this._roomResources[e];e!==t&&r.length!==0&&r.forEach(i=>{const o=ft(i),{tag:s,userId:c,mediaType:d}=bt(o),l=d===vt.AUDIO_ONLY?new Te(s,c):new ye(s,c);l.__innerSetRemoteMuted(i.state===0),this._remoteTracks[o]=l})}}_handlePingResult(t){this._callAppListener("onPing",t)}setBitrate(t,e,r){O.warn("`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),dt("max",t,i=>mt(i)&&i>Math.max(e||1,200),!0),dt("min",e,i=>mt(i)&&i>=1&&(!mt(t)||i<t),!0),dt("start",r,i=>mt(i)&&i>e&&i<=t),this._pc.setBitrate(t,e,r)}_onTrackReady(t){const e=t.streams[0].id,r=t.receiver.track,i=[e,r.kind==="audio"?vt.AUDIO_ONLY:vt.VIDEO_ONLY].join("_"),o=this._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(r),this._callAppListener("onTrackReady",o)):O.warn(`cannot found remote track ${r.id}`)}_callAppListener(t,...e){var r;t!=="onPing"&&O.info(`${t} callback ->`,...e);const i=(r=this._appListener)===null||r===void 0?void 0:r[t];if(i)try{i(...e)}catch(o){O.error(o)}}_onUserUnpublish(t){return j(this,void 0,void 0,function*(){yield this.unsubscribe(t),t.forEach(e=>{e.__innerDestroy(),delete this._remoteTracks[e.getTrackId()]}),this._onTrackUnpublish(t)})}_onTrackUnpublish(t){this._callAppListener("onTrackUnpublish",t)}_unpublishPrev(t){return j(this,void 0,void 0,function*(){const e=t.slice();t.length=0,O.info(`unpublish uris prev login: ${JSON.stringify(e)}`);const r=yield this._context.setRTCTotalRes(this._roomId,dr(lt.UNPUBLISH,e),Ne([]),lt.TOTAL_CONTENT_RESOURCE,Ne([]));r!==R.SUCCESS?O.error(`unpublish prev uris failed -> code: ${r}`):O.debug("unpublish uris prev login succeed")})}__parseInnerMessage(t){const{targetId:e,conversationType:r}=t;if(r!==Y.RTC_ROOM)return!1;if(e!==this._roomId)return!0;O.info(`recv inner msg -> message: ${JSON.stringify(t)} | roomid: ${this._roomId}`);const i=t.content;switch(t.messageType){case lt.KICK:this._kickoff(!0,i);break;case lt.STATE:this.msgTaskQueue.push(()=>this._stateHandle(i));break;case lt.MODIFY:case lt.PUBLISH:case lt.UNPUBLISH:case lt.TOTAL_CONTENT_RESOURCE:this.msgTaskQueue.push(()=>this._resourceHandle(i,t.messageType,t.senderUserId));break;case lt.ROOM_NOTIFY:this._callAppListener("onRoomAttributeChange",t.messageType,t.content);break;case lt.USER_NOTIFY:O.warn(`TODO: ${lt.USER_NOTIFY}`);break;case lt.PK_INVITE:case lt.PK_CANCEL_INVITE:case lt.PK_INVITE_TIMEOUT:case lt.PK_INVITE_ANSWER:case lt.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(t);break;case lt.OTHER_ROOM_OFFLINE:break;default:this._callAppListener("onMessageReceive",t.messageType,t.content,t.senderUserId,t.messageUId)}return!0}_kickoff(t,e){if(this._destroyed)return;let r;O.warn(`onKickOff -> byServer: ${t}`),this._ntfClearRoomItem(),this._leaveHandle(!t),t&&((e==null?void 0:e.users)||[]).forEach(i=>{i.userId===this._context.getCurrentId()&&(r=i.type)}),this._callAppListener("onKickOff",t,r)}_rtcpeerClosed(){this._ntfClearRoomItem(),this._leaveHandle(!0),this._callAppListener("onRTCPeerConnectionCloseByException")}_resourceHandle(t,e,r){return j(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return void O.warn(`room has been destroyed. -> roomId: ${this._roomId}`);const{uris:i,ignore:o}=t;if(o||!i)return;const s=[],c=[],d=[];let l;const h=this._roomResources[r]||(this._roomResources[r]=[]);switch(e){case lt.MODIFY:d.push(...i);break;case lt.PUBLISH:s.push(...i);break;case lt.UNPUBLISH:c.push(...i);break;case lt.TOTAL_CONTENT_RESOURCE:l=vr(h,i),s.push(...l.publishedList),c.push(...l.unpublishedList),d.push(...l.modifiedList)}if(s.length>0){const a=h.map(ft),u=[],p=[];if(s.forEach(f=>{const m=ft(f),_=a.indexOf(m),{userId:v,tag:T,mediaType:y}=bt(m);_>-1?h[_]=f:h.push(f);let w=this._remoteTracks[m];w?w.isSubscribed()&&u.push(w):(w=y===vt.AUDIO_ONLY?new Te(T,v):new ye(T,v),this._remoteTracks[m]=w,p.push(w)),w.__innerSetRemoteMuted(f.state===0)}),u.length){const f=u.map(_=>_.getTrackId());O.debug(`resub tracks -> ${JSON.stringify(f)}`);const{code:m}=yield Ct(()=>this.__subscribe(u,!0));m!==P.SUCCESS&&O.error(`resub tracks failed -> code: ${m}, ids: ${JSON.stringify(f)}`)}this._onTrackPublish(p)}if(c.length>0){const a=c.map(ft);for(let p=h.length-1;p>=0;p-=1){const f=h[p];a.includes(ft(f))&&h.splice(p,1)}const u=c.map(p=>{const f=ft(p);return this._remoteTracks[f]});yield this._onUserUnpublish(u)}if(d.length>0){const a=h.map(ft);for(let u=0;u<d.length;u+=1){const p=d[u],f=ft(p),m=a.indexOf(f);h[m].state=p.state;const _=this._remoteTracks[f];_.__innerSetRemoteMuted(p.state===0),_.isAudioTrack()?this._onAudioMuteChange(_):this._onVideoMuteChange(_)}}})}_onTrackPublish(t){this._callAppListener("onTrackPublish",t)}_stateHandle(t){var e;return j(this,void 0,void 0,function*(){const{users:r}=t;if(r.length===0)return;for(let h=0;h<r.length;h++){const a=r[h];if(a.extra&&a.extra.roomId!==this._roomId||+a.state==1&&!this.getRemoteUserIds().includes(a.userId))return}const i=[],o=[],s=[],c=[];r.forEach(h=>{+h.state==0?(O.debug(`user joined -> ${h.userId}`),this._roomResources[h.userId]||(h.switchRoleType?s.push(h.userId):i.push(h.userId)),this._roomResources[h.userId]=this._roomResources[h.userId]||[]):(O.debug(`user left -> ${h.userId}`),h.switchRoleType?c.push(h.userId):o.push(h.userId))});const d=[...i,...s],l=[...o,...c];if(l.length){const h=[],a=[];l.forEach(u=>{h.push(...this.getRemoteTracksByUserId(u)),a.push(u)}),h.length&&(yield this.unsubscribe(h),h.forEach(u=>delete this._remoteTracks[u.getTrackId()])),a.length&&a.forEach(u=>delete this._roomResources[u])}if((e=this._appListener)===null||e===void 0?void 0:e.onSwitchRole)return s.length&&s.forEach(h=>this._callAppListener("onSwitchRole",h,Vr.ANCHOR)),c.length&&c.forEach(h=>this._callAppListener("onSwitchRole",h,Vr.AUDIENCE)),i.length&&this._callAppListener("onUserJoin",i),void(o.length&&this._callAppListener("onUserLeave",o));d.length&&this._callAppListener("onUserJoin",d),l.length&&this._callAppListener("onUserLeave",l)})}getRoomId(){return this._roomId}getCrtUserId(){return this._context.getCurrentId()}__getPC(){return this._pc}getRemoteUserIds(){const t=this._context.getCurrentId();return Object.keys(this._roomResources).filter(e=>e!==t)}getRemoteTracks(){const t=[];return this.getRemoteUserIds().forEach(e=>{t.push(...this.getRemoteTracksByUserId(e))}),t}getRemoteTracksByUserId(t){const e=[];for(const r in this._remoteTracks){const i=this._remoteTracks[r];i.getUserId()===t&&e.push(i)}return e}getSessionId(){return this._sessionId}sendMessage(t,e){return j(this,void 0,void 0,function*(){const{code:r}=yield this._context.sendMessage(Y.RTC_ROOM,this._roomId,{messageType:t,content:e,isStatusMessage:!0});return r!==R.SUCCESS?(O.error(`send message failed -> code: ${r}`),{code:P.SIGNAL_ERROR}):{code:P.SUCCESS}})}setRoomAttribute(t,e,r,i=!1){return j(this,void 0,void 0,function*(){const o=yield this._context.setRTCData(this._roomId,t,e,i,ae.ROOM,r);return o!==R.SUCCESS?(O.error(`SetRoomAttributeValue Failed: ${o}`),{code:P.SIGNAL_ERROR}):{code:P.SUCCESS}})}deleteRoomAttributes(t,e,r=!1){return j(this,void 0,void 0,function*(){const i=yield this._context.removeRTCData(this._roomId,t,r,ae.ROOM,e);return i!==R.SUCCESS?(O.error(`DeleteRoomAttribute Failed: ${i}`),{code:P.SIGNAL_ERROR}):{code:P.SUCCESS}})}getRoomAttributes(t=[],e=!1){return j(this,void 0,void 0,function*(){const{code:r,data:i}=yield this._context.getRTCData(this._roomId,t,e,ae.ROOM);return r!==R.SUCCESS?(O.error(`GetRoomAttributes Failed: ${r}`),{code:P.SIGNAL_ERROR}):{code:P.SUCCESS,data:i}})}_setUserAttributeValue(t,e,r){return this._context.setRTCData(this._roomId,t,e,!1,ae.PERSON,r)}_deleteUserAttributes(t,e){return this._context.removeRTCData(this._roomId,t,!1,ae.PERSON,e)}_getUserAttributes(t){return this._context.getRTCData(this._roomId,t,!1,ae.PERSON)}isDestroyed(){return this._destroyed}__destroy(t){return this._leaveHandle(t)}_muteRemoteTracksBeforeQuit(){const t=Object.values(this._remoteTracks);t.length&&t.forEach(e=>e.mute())}_leaveHandle(t){var e;return j(this,void 0,void 0,function*(){this._destroyed||(this._destroyed=!0,this._muteRemoteTracksBeforeQuit(),(e=this._audioLevelReport)===null||e===void 0||e.clearAudioLevelReportTimer(),t&&(yield this._context.quitRTCRoom(this._roomId)),this._isMainRoom&&this._quitAllPKRoom(),this._pc.removeAllLocalTrack(),this._pinger.stop(),yield this._service.exit(this._getRTCReqestHeaders()),this._pc.destroy(),this._polarisReport=null,this._removeRemoteTracks())})}_onLocalTrackDestroied(t){t instanceof un&&t.__isTiny()||this.unpublish([t])}_onLocalTrackMuted(t){return j(this,void 0,void 0,function*(){const e=t.getTrackId(),r=this._context.getCurrentId(),i=[{resourceId:e,enabled:!t.isLocalMuted()}],o=this._roomResources[r]||[],s=[];for(let d=0;d<o.length;d+=1){const l=o[d],h=ft(l),a=i.findIndex(u=>u.resourceId===h);if(a>=0){const{enabled:u}=i[a];l.state=u?1:0,s.push(l);break}}const c=yield Ct(()=>this._context.setRTCTotalRes(this._roomId,dr(lt.MODIFY,s),Ne(o),lt.TOTAL_CONTENT_RESOURCE));c!==R.SUCCESS&&O.error("notice `track.enabled` change failed -> code: "+c)})}_removePubFailedTracks(t){t.forEach(e=>{const r=e instanceof gt?e:e.track;O.debug(`remove pub failed track from peerconnection -> trackId: ${r.getTrackId()}`),this._pc.removeLocalTrackById(r.getTrackId())})}publish(t){return j(this,void 0,void 0,function*(){return Ct(()=>this.__publish(t))})}__publish(t){return j(this,void 0,void 0,function*(){if(!this._isMainRoom&&this instanceof we)return O.error("the `publish` is disabled in PK room"),{code:P.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(this._assertRoomDestroyed())return O.error(`publish failed, room has been destroyed. -> roomId: ${this._roomId}`),{code:P.ROOM_HAS_BEEN_DESTROYED};if(!_t("tracks",t,()=>Ht(t)&&t.length>0&&t.every(y=>y instanceof gt||y.track instanceof gt),!0))return O.error(`publish failed, tracks is invalid -> roomId: ${this._roomId}`),{code:P.PARAMS_ERROR};const e=this._context.getCurrentId();if(this._pc.getLocalTracks().length+(y=>{let w=0;return y.forEach(L=>{L instanceof gt?w++:L.pubTiny&&L.track.isVideoTrack()?w+=2:w++}),w})(t)>10)return O.error(`publish failed, tracks limit exceeded -> roomId: ${this._roomId}`),{code:P.PUBLISH_TRACK_LIMIT_EXCEEDED};O.debug(`publish tracks -> roomId: ${this._roomId}, tracks: ${t.map(En)}`),t.forEach(y=>{const{track:w,pubTiny:L}=y instanceof gt?{pubTiny:!1,track:y}:y;if(this._pc.addLocalTrack(w),w.isVideoTrack()&&L){let M;try{M=w.__innerGetMediaStreamTrack().clone();const C=L.frameRate||ie.FPS_15,A=L.resolution||Et.W176_H144,{width:F,height:G}=de(A),E=le(C);M.applyConstraints({width:F,height:G,frameRate:E})}catch(C){return M==null||M.stop(),void O.warn(`pubTiny failed -> id: ${w.getTrackId()}, msg: ${C.message}`)}this._pc.addLocalTrack(new un(w.getTag(),w.getUserId(),M,!0))}}),this._pc.clearReTryExchangeTimer();const r=yield this._createExchangeParams(this._subscribedList,!1),i=this._getPushOtherRoomsParams();i&&(r.pushOtherRooms=i);const o=yield this._exchangeHandle(r);if(o.code!==P.SUCCESS)return O.error(`publish failed -> roomId: ${this._roomId}, code: ${o.code}`),this._removePubFailedTracks(t),{code:o.code};const{publishList:s,sdp:c,resultCode:d,message:l,urls:h,mcuPublishList:a}=o.data;if(d!==P.SUCCESS)return O.error(`publish failed -> roomId: ${this._roomId}, code: ${d}, msg: ${l}`),this._removePubFailedTracks(t),{code:d};const u=yield this._pc.setRemoteAnswer(c.sdp);if(u!==P.SUCCESS)return{code:u};const p=this._roomResources[e],f=s.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:this._getResourceState(ft(y))},y)),{publishedList:m}=vr(p,f),_=(a==null?void 0:a.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:1},y)))||[],v=yield this._context.setRTCTotalRes(this._roomId,dr(lt.PUBLISH,m),Ne(f),lt.TOTAL_CONTENT_RESOURCE,Ne(_));if(v!==R.SUCCESS)return O.error(`send publish streams notification failed: ${v}`),{code:P.SIGNAL_ERROR};this._roomResources[e]=f;const T=m.map(y=>ft(y));return this._polarisReport&&this._polarisReport.sendR2(Ce.PUBLISH,Re.BEGIN,T),t.forEach(y=>{const{track:w}=y instanceof gt?{track:y}:y;w.__innerSetPublished(!0)}),O.debug(`publish success: ${T.join(",")}`),this._roomMode===Vt.LIVE?{code:P.SUCCESS,liveUrl:h==null?void 0:h.liveUrl}:{code:P.SUCCESS}})}_getPushOtherRoomsParams(){return[]}_reTryExchange(){return j(this,void 0,void 0,function*(){Ct(()=>j(this,void 0,void 0,function*(){const t=yield this._createExchangeParams(this._subscribedList,!0),e=this._getPushOtherRoomsParams();e&&(t.pushOtherRooms=e);const r=yield this._exchangeHandle(t);if(r.code!==P.SUCCESS)return O.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==P.SUCCESS)return O.error(`reTryExchange failed: ${o}`),{code:o};this._pc.clearReTryExchangeTimer();const s=yield this._pc.setRemoteAnswer(i.sdp);return s!==P.SUCCESS?{code:s}:void 0}))})}_exchangeHandle(t){return this._service.exchange(this._getRTCReqestHeaders(),t)}_getRTCReqestHeaders(){return{"App-Key":this._context.getAppkey(),RoomId:this._roomId,Token:this._token,RoomType:this._roomMode,UserId:this._context.getCurrentId()}}_createExchangeParams(t,e){return j(this,void 0,void 0,function*(){return{sdp:yield this._pc.createOffer(e),extend:JSON.stringify({resolutionInfo:this._pc.getOutboundVideoInfo()}),subscribeList:t.filter(r=>{const i=r.track.getTrackId(),{userId:o}=bt(i);return this._roomResources[o]?this._roomResources[o].filter(c=>i===`${c.msid}_${c.mediaType}`).length:!1}).map(r=>({simulcast:r.subTiny?Wt.TINY:Wt.NORMAL,resolution:"",uri:this._getResourceById(r.track.getTrackId()).uri})),switchstream:!1}})}_getResourceState(t){var e;return((e=this.getLocalTrack(t))===null||e===void 0?void 0:e.isLocalMuted())?0:1}unpublish(t){return j(this,void 0,void 0,function*(){return Ct(()=>this.__unpublish(t))})}__unpublish(t){var e;return j(this,void 0,void 0,function*(){if(!this._isMainRoom&&this instanceof we)return O.error("the `unpublish` is disabled in PK room"),{code:P.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(this._assertRoomDestroyed())return O.warn(`room has been destroyed, no need to unpublish tracks -> roomId: ${this._roomId}`),{code:P.SUCCESS};const r=this._context.getCurrentId();if(!_t("tracks",t,()=>t.every(y=>y.getUserId()===r&&y instanceof gt),!0))return O.warn(`unpublish failed, tracks is invalid -> roomId: ${this._roomId}, tracks: ${t.map(En)}`),{code:P.PARAMS_ERROR};const i=t.map(y=>y.getTrackId()),o=i.map(this._getResourceById.bind(this)).filter(y=>!!y);if(o.length===0)return{code:P.SUCCESS};const s=this._roomResources[r].filter(y=>!o.includes(y));i.forEach(y=>this._pc.removeLocalTrackById(y)),(e=this._polarisReport)===null||e===void 0||e.sendR2(Ce.PUBLISH,Re.END,i),this._pc.clearReTryExchangeTimer();const c=yield this._createExchangeParams(this._subscribedList,!1),d=this._getPushOtherRoomsParams();d&&(c.pushOtherRooms=d);const l=yield this._exchangeHandle(c);if(l.code!==P.SUCCESS)return O.error(`exchange failed -> code: ${l.code}`),{code:l.code};const{publishList:h,sdp:a,resultCode:u,message:p,mcuPublishList:f}=l.data;u!==P.SUCCESS&&O.error(`unpublish streams failed -> code: ${u}, msg: ${p}`);const m=f?f.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:1},y)):[],_=yield this._context.setRTCTotalRes(this._roomId,dr(lt.UNPUBLISH,o),Ne(s),lt.TOTAL_CONTENT_RESOURCE,Ne(m));if(_!==R.SUCCESS)return O.error("send unpublish notification failed:",_),{code:P.SIGNAL_ERROR};O.debug(`unpublish success -> tracks: ${i.join(",")}`);const v=yield this._pc.setRemoteAnswer(a.sdp);if(v!==P.SUCCESS)return{code:v};const T=h.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:this._getResourceState(ft(y))},y));return this._roomResources[r]=T,{code:P.SUCCESS}})}_getResourceById(t){const{userId:e}=bt(t);return this._roomResources[e].find(r=>ft(r)===t)}_isValidResourceId(t){var e;const{userId:r}=bt(t);return!!((e=this._roomResources[r])===null||e===void 0?void 0:e.find(i=>ft(i)===t))}subscribe(t){return j(this,void 0,void 0,function*(){return Ct(()=>this.__subscribe(t,!1))})}__subscribe(t,e=!1){var r;return j(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return O.error(`subscribe failed, room has been destroyed -> roomId: ${this._roomId}`),{code:P.ROOM_HAS_BEEN_DESTROYED};if(!_t("tracks",t,()=>Ht(t)&&t.length>0&&t.every(d=>d instanceof Dt||d.track instanceof Dt),!0))return O.error(`subscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:P.PARAMS_ERROR};O.info(`subscribe -> roomId: ${this._roomId}, tracks: ${t.map(En)}`);const i=this._subscribedList.map(d=>Object.assign({},d)),o=t.map(d=>d instanceof Dt?{track:d}:d);let s=!1;const c=[];return o.forEach(d=>{const l=d.track.getTrackId();c.push(l);const h=i.find(a=>a.track.getTrackId()===l);h&&h.subTiny===d.subTiny||(h?h.subTiny=d.subTiny:i.push(d),s=!0)}),s||e?((r=this._polarisReport)===null||r===void 0||r.sendR2(Ce.SUBSCRIBE,Re.BEGIN,c),this._updateSubListHandle(i,!0)):{code:P.SUCCESS}})}unsubscribe(t){return j(this,void 0,void 0,function*(){return Ct(()=>this.__unsubscribe(t))})}__unsubscribe(t){var e;return j(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return O.warn(`room has beed destroyed, no need to unsubscribe tracks -> roomId: ${this._roomId}`),{code:P.SUCCESS};if(!_t("tracks",t,()=>Ht(t)&&t.length>0&&t.every(i=>i instanceof Dt),!0))return O.error(`unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:P.PARAMS_ERROR};O.info(`unsubscribe -> roomId: ${this._roomId}, tracks: ${t.map(En)}`);const r=this._subscribedList.map(i=>Object.assign({},i)).filter(i=>!t.includes(i.track));return(e=this._polarisReport)===null||e===void 0||e.sendR2(Ce.SUBSCRIBE,Re.END,t.map(i=>i.getTrackId())),this._updateSubListHandle(r,!1)})}_assertRoomDestroyed(){if(this._destroyed){const t="This room has been destroyed. Please use `RCRTCClient.joinRTCRoom` or `RCRTCClient.joinLivingRoom` to catch another instance.";return O.warn(t),P.ROOM_HAS_BEEN_DESTROYED}}getLocalTrack(t){return this._pc.getLocalTrack(t)}getLocalTracks(){return this._pc.getLocalTracks()}getRemoteTrack(t){return this._remoteTracks[t]||null}updateSubList(t){return j(this,void 0,void 0,function*(){return Ct(()=>this._updateSubListHandle(t,!1))})}_updateSubListHandle(t,e=!1){return j(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:P.ROOM_HAS_BEEN_DESTROYED};if(!_t("resources",t,()=>Ht(t)&&t.every(T=>T instanceof Dt||T.track instanceof Dt),!0))return O.error(`update sublist failed, tracks is invalid -> roomId: ${this._roomId}`),{code:P.PARAMS_ERROR};O.info(`update subscribe list -> roomId: ${this._roomId}, forceReq: ${e}, tracks: ${t.map(En)}`);let r=t.map(T=>T instanceof Dt?{track:T}:Object.assign({},T));const i={};r=r.filter(T=>{const y=T.track.getTrackId();return this._remoteTracks[y]?!i[y]&&(i[y]=!0):(O.warn(`track cannot found in room -> trackId: ${y}`),!1)}).map(T=>Object.assign({},T));const o=this._subscribedList.map(T=>Object.assign({},T));if(!e){let T=!1;if(r.forEach(y=>{const w=o.findIndex(L=>L.track===y.track);if(w===-1)return void(T=!0);o.splice(w,1)[0].subTiny!==y.subTiny&&(T=!0)}),o.length&&(T=!0),!T)return{code:P.SUCCESS}}this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(r.map(T=>T.track));const s=yield this._createExchangeParams(r,!1),c=this._getPushOtherRoomsParams();c&&(s.pushOtherRooms=c);const d=yield this._exchangeHandle(s),l=r.map(T=>T.track.getTrackId());if(d.code!==P.SUCCESS)return{code:d.code};const{sdp:h,resultCode:a,message:u,subscribedList:p}=d.data;if(a!==P.SUCCESS)return O.error(`change subscribe list failed: ${a}`),{code:a};O.debug(`subscribe success: ${l.join(",")}`);const f=yield this._pc.setRemoteAnswer(h.sdp);if(f!==P.SUCCESS)return{code:f};const m=p==null?void 0:p.map(T=>`${T.msid}_${T.mediaType}`),_=r.filter(T=>m==null?void 0:m.includes(T.track.getTrackId())),v=r.filter(T=>!(m==null?void 0:m.includes(T.track.getTrackId())));for(const T in this._remoteTracks){const y=_.some(w=>w.track.getTrackId()===T);this._remoteTracks[T].__innerSetSubscribed(y)}return this._subscribedList.splice(0,this._subscribedList.length,..._),v.length?{code:P.SUCCESS,failedList:v}:{code:P.SUCCESS}})}registerRoomEventListener(t){this._appListener=t}registerReportListener(t){this._pc.registerReportListener(t)}onAudioLevelChange(t,e){var r;(r=this._audioLevelReport)===null||r===void 0||r.clearAudioLevelReportTimer(),this._audioLevelReport=new Su(this),this._audioLevelReport.onAudioLevelChange(t,e||1e3)}__onReconnected(t){return j(this,void 0,void 0,function*(){if(this._pc.getRTCPeerConn().connectionState==="closed")return O.warn("RTCPeerConnection closed. Please rejoin room to restore services."),void this._rtcpeerClosed();const{code:e,data:r}=yield this._context.joinRTCRoom(this._roomId,this._roomMode,t);if(e!==R.SUCCESS)return void O.error(`RTC __onReconnected getRTCRoomInfo failed: ${e}`);O.debug(`RTC __onReconnected getRTCRoomInfo success: ${JSON.stringify(r)}`);const i=[],o={},s={},c={},d=go(r,this._roomId),l=Object.keys(d),h=Object.keys(this._roomResources);for(let u=l.length-1;u>=0;u-=1){const p=l[u],f=h.indexOf(p);if(f===-1){i.push(p),o[p]=lr(d[p]);continue}const m=this._roomResources[p],_=d[p],{publishedList:v,modifiedList:T,unpublishedList:y}=vr(m,_,!0);o[p]=lr(v),s[p]=lr(y),c[p]=lr(T),h.splice(f,1)}h.length&&h.forEach(u=>{delete this._roomResources[u]}),Object.assign(this._roomResources,d),h.length&&this._callAppListener("onUserLeave",h),i.length&&this._callAppListener("onUserJoin",i);const a=this._context.getCurrentId();for(const u in s){if(u===a)continue;const p=s[u];if(p.length){const f=p.map(m=>this._remoteTracks[ft(m)]);yield this._onUserUnpublish(f)}}return Object.keys(o).forEach(u=>{const p=o[u];if(p.length===0)return;const f=p.map(m=>{const _=ft(m),{userId:v,tag:T,mediaType:y}=bt(_),w=this._remoteTracks[_]=y===vt.AUDIO_ONLY?new Te(T,v):new ye(T,v);return w.__innerSetRemoteMuted(m.state===0),w});this._onTrackPublish(f)}),Object.keys(c).forEach(u=>{c[u].forEach(p=>{const f=ft(p),m=this._remoteTracks[f];m.__innerSetRemoteMuted(p.state===0),m.isAudioTrack()?this._onAudioMuteChange(m):this._onVideoMuteChange(m)})}),{data:r}})}_onAudioMuteChange(t){this._callAppListener("onAudioMuteChange",t)}_onVideoMuteChange(t){this._callAppListener("onVideoMuteChange",t)}_afterChangedRole(t){}_removeRemoteTracks(){const t=Object.values(this._remoteTracks);t.length&&(t.forEach(e=>{e.isAudioTrack()&&e.__releaseMediaElement()}),this._remoteTracks={})}_registerPKMsgListener(t){this._onRecvPKMsg=t}_quitAllPKRoom(){}}var wn,on,Br,Pn;(function(n){n[n.CROP=1]="CROP",n[n.WHOLE=2]="WHOLE"})(wn||(wn={})),function(n){n[n.CUSTOMIZE=1]="CUSTOMIZE",n[n.SUSPENSION=2]="SUSPENSION",n[n.ADAPTATION=3]="ADAPTATION"}(on||(on={})),function(n){n[n.CROP=1]="CROP",n[n.WHOLE=2]="WHOLE"}(Br||(Br={})),function(n){n[n.AUDIO_VIDEO_ALL=0]="AUDIO_VIDEO_ALL",n[n.AUDIO_VIDEO_NO=1]="AUDIO_VIDEO_NO",n[n.AUDIO_ALL_VIDEO_NO=2]="AUDIO_ALL_VIDEO_NO",n[n.AUDIO_NO_VIDEO_ALL=3]="AUDIO_NO_VIDEO_ALL",n[n.AUDIO_VIDEO_INPUT=4]="AUDIO_VIDEO_INPUT",n[n.AUDIO_ALL_VIDEO_INPUT=5]="AUDIO_ALL_VIDEO_INPUT",n[n.AUDIO_NO_VIDEO_INPUT=6]="AUDIO_NO_VIDEO_INPUT",n[n.AUDIO_INPUT_VIDEO_ALL=7]="AUDIO_INPUT_VIDEO_ALL",n[n.AUDIO_INPUT_VIDEO_NO=8]="AUDIO_INPUT_VIDEO_NO",n[n.ROOM_AUDIO_VIDEO_APPEND=9]="ROOM_AUDIO_VIDEO_APPEND",n[n.ROOM_AUDIO_VIDEO_NOT_APPEND=10]="ROOM_AUDIO_VIDEO_NOT_APPEND",n[n.ROOM_AUDIO_APPEND=11]="ROOM_AUDIO_APPEND",n[n.ROOM_AUDIO_NOT_APPEND=12]="ROOM_AUDIO_NOT_APPEND",n[n.ROOM_VIDEO_APPEND=13]="ROOM_VIDEO_APPEND",n[n.ROOM_VIDEO_NOT_APPEND=14]="ROOM_VIDEO_NOT_APPEND"}(Pn||(Pn={}));const bi=()=>({version:1,mode:on.SUSPENSION});class gh{constructor(t,e,r){this._onFlush=t,this._isValidTrackId=e,this._sendCDNInfoSignal=r,this._values=bi()}setHostVideoTrack(t){if(O.info(`setHostVideoTrack -> videoTrackId: ${t}`),!this._isValidTrackId(t))return O.error(`setHostVideoTrack failed -> videoTrackId is invalid: ${t}`),this;const{mediaType:e,tag:r,userId:i}=bt(t);return e!==vt.VIDEO_ONLY?(O.error(`setHostVideoTrack failed -> kind of resource is not 'video' -> ${t}`),this):(this._values.host_stream_id=je(i,r),this)}setMixLayoutMode(t){return O.info(`setMixLayoutMode -> mode: ${t}`),[on.CUSTOMIZE,on.SUSPENSION,on.ADAPTATION].includes(t)?(this._values.mode=t,this):(O.error(`setMixLayoutMode failed -> mode is invalid: ${t}`),this)}_addOutputValue(t,e,r="normal"){const i=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if(t==="cdn")return void(i.cdn=e);if(t==="audio")return void(i.audio={bitrate:e});const o=i.video;if(r!=="normal"&&r!=="tiny")if(r!=="backgroundColor")if(r!=="exparams"){if(r==="backgroundPicture"){const s=o.backgroundPicture||(o.backgroundPicture={fillMode:wn.CROP,picture:[]});Object.assign(s,e)}}else o.exparams={renderMode:e};else o.backgroundColor=e;else{const s=o[r]||(o[r]={});Object.assign(s,e)}}setOutputVideoResolution(t){if(O.info(`setOutputVideoResolution -> resolution: ${t}`),!rn(t))return O.error(`setOutputVideoResolution failed -> resolution is invalid: ${t}`),this;const{width:e,height:r}=de(t);return this._addOutputValue("video",{width:e,height:r},"normal"),this}setOutputVideoFPS(t){if(O.info(`setOutputVideoFPS -> fps: ${t}`),!po(t))return O.error(`setOutputVideoFPS failed -> fps is invalid: ${t}`),this;const e=le(t);return this._addOutputValue("video",{fps:e},"normal"),this}setOutputVideoBitrate(t){return O.info(`setOutputVideoBitrate -> bitrate: ${t}`),!mt(t)||t<=0?O.error(`setOutputVideoBitrate failed -> bitrate is invalid: ${t}`):this._addOutputValue("video",{bitrate:t},"normal"),this}setOutputTinyVideoResolution(t){if(O.info(`setOutputTinyVideoResolution -> resolution: ${t}`),!rn(t))return O.error(`setOutputTinyVideoResolution failed -> resolution is invalid: ${t}`),this;const{width:e,height:r}=de(t);return this._addOutputValue("video",{width:e,height:r},"tiny"),this}setOutputTinyVideoFPS(t){if(O.info(`setOutputTinyVideoFPS -> fps: ${t}`),!po(t))return O.error(`setOutputTinyVideoFPS failed -> fps is invalid: ${t}`),this;const e=le(t);return this._addOutputValue("video",{fps:e},"tiny"),this}setOutputTinyVideoBitrate(t){return O.info(`setOutputTinyVideoBitrate -> bitrate: ${t}`),!mt(t)||t<=0?O.error(`setOutputTinyVideoBitrate failed -> bitrate is invalid: ${t}`):this._addOutputValue("video",{bitrate:t},"tiny"),this}setOutputVideoRenderMode(t){return O.info(`setOutputVideoRenderMode -> renderMode: ${t}`),[Br.CROP,Br.WHOLE].includes(t)?this._addOutputValue("video",t,"exparams"):O.error(`setOutputVideoRenderMode failed -> renderMode is invalid: ${t}`),this}setOutputAudioBitrate(t){return O.info(`setOutputAudioBitrate -> bitrate: ${t}`),mt(t)&&t>0?this._addOutputValue("audio",t):O.error(`setOutputAudioBitrate failed -> bitrate is invalid: ${t}`),this}setOutputBackgroundColor(t){return O.info(`setOutputBackgroundColor -> color: ${t}`),/^0x[a-fA-F0-9]{6}$/.test(t)?this._addOutputValue("video",t,"backgroundColor"):O.error(`setOutputBackgroundColor failed -> color is invalid: ${t}`),this}addOutputBackgroundPicture(t,e,r,i,o){var s,c,d;if(O.info(`addOutputBackgroundPicture -> uri: ${t}, x: ${e}, y: ${r}, w: ${i}, h: ${o}`),!Ue(t))return O.error(`addOutputBackgroundPicture failed -> uri is invalid: ${t}`),this;if([e,r,i,o].some(h=>!mt(h)||h<0||h>1))return O.error(`addOutputBackgroundPicture failed -> some attrs of (x, y, w, h) is invalid: ${e}, ${r}, ${i}, ${o}`),this;const l=((d=(c=(s=this._values.output)===null||s===void 0?void 0:s.video)===null||c===void 0?void 0:c.backgroundPicture)===null||d===void 0?void 0:d.picture)||[];return l.push({uri:t,w:i,h:o,x:e,y:r}),this._addOutputValue("video",{picture:l},"backgroundPicture"),this}removeOutputBackgroundPicture(t){var e,r,i;if(O.info(`removeOutputBackgroundPicture -> uri: ${t}`),!Ue(t))return O.error(`removeOutputBackgroundPicture failed -> uri is invalid: ${t}`),this;let o=(i=(r=(e=this._values.output)===null||e===void 0?void 0:e.video)===null||r===void 0?void 0:r.backgroundPicture)===null||i===void 0?void 0:i.picture;return o&&(o=o.filter(s=>s.uri!==t),this._addOutputValue("video",{pictures:o},"backgroundPicture")),this}clearOutputBackgroundPicture(){return O.info("clearOutputBackgroundPicture ->"),this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this}setOutputBackgroundPictureFillMode(t){return O.info(`setOutputBackgroundPictureFillMode -> fillMode: ${t}`),[wn.CROP,wn.WHOLE].includes(t)?this._addOutputValue("video",{fillMode:t},"backgroundPicture"):O.error(`setOutputBackgroundPictureFillMode failed -> fillMode is invalid: ${t}`),this}addPublishStreamUrls(t){var e,r;O.info(`addPublishStreamUrls -> urls: ${t.join(",")}`);const i=/^rtmp:\/\/.+/;if(!Ht(t)||t.length===0||t.some(c=>!i.test(c)))return O.error(`addPublishStreamUrls failed -> urls is invalid: ${t.join(",")}`),this;const o=((r=(e=this._values.output)===null||e===void 0?void 0:e.cdn)===null||r===void 0?void 0:r.concat())||[];let s=!1;return t.forEach(c=>{o.some(d=>d.pushurl===c)||(s=!0,o.push({pushurl:c}))}),o.length>5?(O.error("addPublishStreamUrls failed -> publish stream urls no more than 5!"),this):(s&&this._addOutputValue("cdn",o),this)}removePublishStreamUrls(t){var e,r;O.info(`removePublishStreamUrls -> urls: ${t.join(",")}`);const i=/^rtmp:\/\/.+/;if(!Ht(t)||t.length===0||t.some(s=>!i.test(s)))return O.error(`removePublishStreamUrls failed -> urls contain invalid items: ${t.join(",")}`),this;const o=((r=(e=this._values.output)===null||e===void 0?void 0:e.cdn)===null||r===void 0?void 0:r.concat())||[];for(let s=o.length-1;s>=0;s-=1){const{pushurl:c}=o[s],d=t.indexOf(c);d>=0&&(t.splice(d,1),o.splice(s,1))}return this._addOutputValue("cdn",o),this}clearPublishStreamUrls(){return O.info("clearPublishStreamUrls ->"),this._addOutputValue("cdn",[]),this}addCustomizeLayoutVideo(t,e,r,i,o){if(O.info(`addCustomizeLayoutVideo -> trackId: ${t}, x: ${e}, y: ${r}, width: ${i}, height: ${o}`),!Ft(t)||!this._isValidTrackId(t))return O.error(`addCustomizeLayoutVideo failed -> trackId is invalid: ${t}`),this;if(!mt(e)||!mt(r))return O.error(`addCustomizeLayoutVideo failed -> some attrs of (x, y) is invalid: ${e}, ${r}`),this;if([i,o].some(u=>!mt(u)||u<0))return O.error(`addCustomizeLayoutVideo failed -> some attrs of (width, height) is invalid: ${i}, ${o}`),this;const{userId:s,tag:c,mediaType:d}=bt(t);if(d!==vt.VIDEO_ONLY)return O.error(`addCustomizeLayoutVideo failed -> kind of trackId is not 'video': ${t}`),this;const l=je(s,c),h=this._values.input||(this._values.input={}),a=h.video||(h.video=[]);return a.some(u=>u.height===o&&u.width===i&&u.stream_id===l&&u.user_id===s&&u.x===e&&u.y===r)||a.push({user_id:s,stream_id:l,x:e,y:r,width:i,height:o}),this}removeCustomizeLayoutVideo(t){if(O.info(`clearCustomizeInputAudio -> trackId: ${t}`),!this._isValidTrackId(t))return O.error(`clearCustomizeInputAudio failed -> trackId is invalid: ${t}`),this;const{userId:e,tag:r,mediaType:i}=bt(t);if(i!==vt.VIDEO_ONLY)return O.error(`clearCustomizeInputAudio failed -> kind of trackId is not 'video': ${t}`),this;const o=je(e,r),s=this._values.input;return(s==null?void 0:s.video)&&s.video.length>0&&(s.video=s.video.filter(c=>c.stream_id===o)),this}clearCustomizeLayoutVideo(){O.info("clearCustomizeLayoutVideo ->");const t=this._values.input;return t==null||delete t.video,this}setCustomizeInputAudio(t){return O.info(`setCustomizeInputAudio -> trackIds: ${t.join(",")}`),t.some(e=>this._isValidTrackId(e))?(O.warn(`setCustomizeInputAudio failed -> trackIds contain invalid items: $${t.join(",")}`),this):((this._values.input||(this._values.input={})).audio=t.map(e=>{const{userId:r,tag:i}=bt(e);return{stream_id:je(r,i),user_id:r}}),this._values.inputFilterMode=Pn.AUDIO_INPUT_VIDEO_ALL,this)}addCustomizeInputAudio(t){if(O.info(`addCustomizeInputAudio -> trackId: ${t}`),!this._isValidTrackId(t))return O.warn(`addCustomizeInputAudio failed -> trackId is invalid: ${t}`),this;const e=this._values.input||(this._values.input={}),r=e.audio||(e.audio=[]),{userId:i,tag:o}=bt(t),s=je(i,o);return r.some(c=>c.stream_id===s&&c.user_id===i)||(r.push({user_id:i,stream_id:s}),this._values.inputFilterMode=Pn.AUDIO_INPUT_VIDEO_ALL),this}removeCustomizeInputAudio(t){if(O.info(`removeCustomizeInputAudio -> trackId: ${t}`),!this._isValidTrackId(t))return O.error(`removeCustomizeInputAudio failed -> trackId is invalid: ${t}`),this;const e=this._values.input;if(!(e==null?void 0:e.audio)||e.audio.length===0)return this;const{userId:r,tag:i}=bt(t),o=je(r,i);return e.audio=e.audio.filter(s=>r!==s.user_id||o!==s.stream_id),this}clearCustomizeInputAudio(){O.info("clearCustomizeInputAudio ->");const t=this._values.input;return(t==null?void 0:t.audio)&&delete t.audio,this._values.inputFilterMode=Pn.AUDIO_VIDEO_ALL,this}reset(){return O.info("MCUConfigBuilder.reset ->"),this._values=bi(),this}flush(t=!0){var e,r,i,o;return j(this,void 0,void 0,function*(){const s=JSON.parse(JSON.stringify(this._values)),{code:c}=yield this._onFlush(s);return c===P.SUCCESS&&(((r=(e=this._values.output)===null||e===void 0?void 0:e.video.normal)===null||r===void 0?void 0:r.width)||((o=(i=this._values.output)===null||i===void 0?void 0:i.video.normal)===null||o===void 0?void 0:o.fps))&&this._sendCDNInfoSignal(),t&&(this._values=bi()),{code:c}})}}var Fr,Hr,$r,ue;(function(n){n[n.OPEN=1]="OPEN",n[n.STOP=2]="STOP"})(Fr||(Fr={})),function(n){n[n.SPREAD=0]="SPREAD",n[n.NO_SPREAD=-1]="NO_SPREAD"}(Hr||(Hr={})),function(n){n[n.AUTOMATIC=0]="AUTOMATIC",n[n.MANUAL=1]="MANUAL"}($r||($r={})),function(n){n[n.VIDEO=0]="VIDEO",n[n.AUDIO=1]="AUDIO"}(ue||(ue={}));const Nu=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const t=16*Math.random()|0;return(n==="x"?t:3&t|8).toString(16)});class mh{constructor(t,e,r,i,o,s,c,d,l){this._PKInfo=t,this._context=e,this._runtime=r,this._service=i,this._initOptions=o,this._mainLivingRoom=s,this._registerPKMsgListener=c,this._onJoinedPKRoom=d,this._onLeavePKRoom=l,this._inviteTimeout=30,this._appListener=null,this._joinedPKRooms={},this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}_callAppListener(t,...e){var r;O.info(`${t} callback ->`,...e);const i=(r=this._appListener)===null||r===void 0?void 0:r[t];if(i)try{i(...e)}catch(o){O.error(o)}}_onInvite(t){const e=t.inviteInfo||{},{inviterRoomId:r,inviterUserId:i,extra:o}=e,s={inviterRoomId:r,inviterUserId:i,extra:o};this._PKInfo[r]=e,this._callAppListener("onRequestJoinOtherRoom",s)}_onCancelInvite(t){const{inviterRoomId:e,inviterUserId:r,extra:i}=t.inviteInfo||{},o={inviterRoomId:e,inviterUserId:r,extra:i};delete this._PKInfo[e],this._callAppListener("onCancelRequestOtherRoom",o)}_onInviteTimeout(t){}_onInviteAnswer(t){const{answerCode:e,inviteContent:r}=t,{inviteSessionId:i,inviterUserId:o,inviterRoomId:s,inviteeUserId:c,inviterUserAutoMix:d,inviteeUserAutoMix:l,inviteeRoomId:h,extra:a}=r,u={agree:e===1,inviterRoomId:s,inviterUserId:o,inviteeRoomId:h,inviteeUserId:c,extra:a};this._PKInfo[h]=this._PKInfo[h]||{inviteSessionId:i,inviterRoomId:s,inviterUserId:o,inviterUserAutoMix:d,inviteeRoomId:h},this._PKInfo[h].inviteeUserAutoMix=l,this._callAppListener("onResponseJoinOtherRoom",u)}_onPKEnd(t){return j(this,void 0,void 0,function*(){const{inviteeRoomId:e,inviterRoomId:r,userId:i}=t.inviteInfo,o=r===this._mainRoomId?e:r,s={endRoomId:o,endUserId:i},c=this._joinedPKRooms[o];c&&(yield Ct(()=>this._leaveOtherRoom(c))),delete this._PKInfo[o],this._callAppListener("onFinishOtherRoom",s)})}_onRecvPKMsg(t){const{targetId:e,content:r,messageType:i}=t;switch(i){case lt.PK_INVITE:this._onInvite(r);break;case lt.PK_CANCEL_INVITE:this._onCancelInvite(r);break;case lt.PK_INVITE_TIMEOUT:this._onInviteTimeout(r);break;case lt.PK_INVITE_ANSWER:this._onInviteAnswer(r);break;case lt.PK_END:this._onPKEnd(r)}}registerRoomPKEventListener(t){this._appListener=t}requestJoinOtherRoom(t,e,r){return j(this,void 0,void 0,function*(){if(!_t("inviteeRoomId",t,Ft,!0)||!_t("inviteeUserId",e,Ft,!0))return{code:P.PARAMS_ERROR};O.info(`requestRoomPK -> inviteeRoomId: ${t}; inviteeUserId: ${e}; options: ${JSON.stringify(r||{})}`);const i=Nu(),o=!Er(r==null?void 0:r.autoMix)||(r==null?void 0:r.autoMix),s={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:t,inviteeUserId:e,inviteeTimeoutTime:this._inviteTimeout,extra:(r==null?void 0:r.extra)||""},c={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:e,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:i};O.info(`requestRoomPK -> params: ${JSON.stringify(c)}`);const d=yield this._context.requestRoomPK(c);return d!==R.SUCCESS?(O.error(`requestRoomPK failed: ${d}`),{code:d}):(O.info("requestRoomPK success"),this._PKInfo[t]={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:t},{code:P.SUCCESS})})}cancelRequestJoinOtherRoom(t,e,r){return j(this,void 0,void 0,function*(){if(!_t("inviteeRoomId",t,Ft,!0)||!_t("inviteeUserId",e,Ft,!0))return{code:P.PARAMS_ERROR};if(!this._PKInfo[t])return O.error(`\u672A\u53D1\u8D77\u8FC7\u4E0E ${t} \u623F\u95F4\u5185 ${e} \u8FDE\u9EA6\u7684\u8BF7\u6C42`),{code:P.PARAMS_ERROR};O.info(`canceRequestJoinPK -> inviteeRoomId: ${t}; inviteeUserId: ${e}; extra: ${r}`);const i={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:t,inviteeUserId:e,extra:r||""},o={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:e,inviteSessionId:this._PKInfo[t].inviteSessionId,inviteInfo:JSON.stringify(i)};O.info(`canceRequestJoinPK -> params: ${JSON.stringify(o)}`);const s=yield this._context.cancelRoomPK(o);return s!==R.SUCCESS?(O.error(`canceRequestJoinPK failed: ${s}`),{code:s}):(O.info("canceRequestJoinPK success"),delete this._PKInfo[t],{code:P.SUCCESS})})}responseJoinOtherRoom(t,e,r,i){return j(this,void 0,void 0,function*(){if(!_t("inviterRoomId",t,Ft,!0)||!_t("inviterUserId",e,Ft,!0))return{code:P.PARAMS_ERROR};if(!this._PKInfo[t])return O.error(`${t} \u623F\u95F4\u5185\u7684 ${e} \u672A\u53D1\u8D77\u8FC7\u8FDE\u9EA6\u8BF7\u6C42`),{code:P.PARAMS_ERROR};O.info(`responseRoomPK -> inviterRoomId: ${t}; inviterUserId: ${e}; agree: ${r}; options: ${JSON.stringify(i||{})}`);const{inviteSessionId:o,inviterUserAutoMix:s}=this._PKInfo[t],c=!Er(i==null?void 0:i.autoMix)||(i==null?void 0:i.autoMix),d={inviteSessionId:o,inviterRoomId:t,inviterUserId:e,inviterUserAutoMix:s,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:c},l=Object.assign(d,{inviterUserAutoMix:s}),h=r?Object.assign(d,{MultiRoomKey:`${t}|${this._mainRoomId}`,MultiRoomValue:JSON.stringify(l)}):d;!ct(i==null?void 0:i.extra)&&Object.assign(h,{extra:i.extra});const a={agree:r,roomId:this._mainRoomId,inviteSessionId:o,inviteRoomId:t,inviteUserId:e,content:JSON.stringify(h),key:`${t}|${this._mainRoomId}`,value:JSON.stringify(d)};O.info(`responseRoomPK -> params: ${JSON.stringify(a)}`);const u=yield this._context.responseRoomPK(a);return u!==R.SUCCESS?(O.error(`responseRoomPK failed: ${u}`),{code:u}):(O.info("responseRoomPK success"),this._PKInfo[t].inviteeUserAutoMix=c,{code:P.SUCCESS})})}_quitRoomPK(t){return j(this,void 0,void 0,function*(){if(!this._PKInfo[t])return;const{inviterRoomId:e,inviteeRoomId:r,inviterUserId:i,inviteSessionId:o}=this._PKInfo[t],s={inviteeRoomId:r,inviterRoomId:e,userId:this._context.getCurrentId()},c={roomId:this._mainRoomId,endRoomId:t,sessionId:o,content:JSON.stringify(s),keys:[`${e}|${i}`]};O.info(`quitRoomPK -> params: ${JSON.stringify(c)}`);const d=yield this._context.endRoomPK(c);return d!==R.SUCCESS?(O.error(`quitRoomPK failed: ${d}`),{code:P.SIGNAL_ERROR}):(O.info("quitRoomPK success"),delete this._PKInfo[t],{code:P.SUCCESS})})}_relaseCrtRoom(){}joinOtherRoom(t){return j(this,void 0,void 0,function*(){if(!_t("roomId",t,Ft,!0))return{code:P.PARAMS_ERROR};if(this._context.getConnectionStatus()!==Z.CONNECTED)return{code:P.SIGNAL_DISCONNECTED};if(O.info(`JoinPKRoom, roomId: ${t}`),this._joinedPKRooms[t])return{code:P.REPERT_JOIN_ROOM};const e=ue.VIDEO,r={extra:`{"roomId": "${this._mainRoomId}"}`},{code:i,data:o}=yield this._context.joinRTCRoom(t,Vt.LIVE,e,void 0,r);if(i!==R.SUCCESS)return O.error(`JoinPKRoom failed -> code: ${i}`),{code:i};O.info(`JoinPKRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${t}, data: ${JSON.stringify(o)}`);const s=new we(this._context,this._runtime,t,o,this._service,this._initOptions,this._relaseCrtRoom.bind(this),e,!1,!1);return this._joinedPKRooms[t]=s,this._onJoinedPKRoom(t,s),{room:s,code:P.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}})}leaveOtherRoom(t,e){return j(this,void 0,void 0,function*(){return Ct(()=>{const r=t.getRoomId();return O.info(`leavePKRoom -> userId: ${this._context.getCurrentId()} , roomId: ${r}`),this._leaveOtherRoom(t,e)})})}_leaveOtherRoom(t,e){return j(this,void 0,void 0,function*(){const r=t.getRoomId();return yield t.__destroy(!0),delete this._joinedPKRooms[r],yield this._onLeavePKRoom(r),e&&this._quitRoomPK(r),{code:P.SUCCESS}})}getPKInfo(t){return this._PKInfo[t]}getAllPKInfo(){return this._PKInfo}getJoinedPKRooms(){return this._joinedPKRooms}}class we extends Ou{constructor(t,e,r,i,o,s,c,d,l=!1,h){var a;if(super(t,e,r,i,Vt.LIVE,o,s,c,l,h),this._livingType=d,this._isMainRoom=h,this._CDNUris=null,this._CDNEnable=!1,this._mcuConfigBuilder=new gh(this._onMCUConfigFlush.bind(this),this._isValidResourceId.bind(this),this._sendCDNInfoSignal.bind(this)),this._isMainRoom){const p=((f,m)=>{const _={};return m.forEach(v=>{const T=JSON.parse(v.value),{inviterRoomId:y,inviteeRoomId:w}=T;_[f===y?w:y]=JSON.parse(v.value)}),_})(this._roomId,i.roomInfo);this._roomPKHandler=new mh(p,t,e,o,s,this,super._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._onLeavePKRoom.bind(this))}const u=(a=i.roomInfo.filter(p=>p.key==="cdn_uris")[0])===null||a===void 0?void 0:a.value;u&&(this._CDNUris=JSON.parse(u)[0])}_isValidResourceId(t){var e;const{userId:r}=bt(t),i=!!((e=this._roomResources[r])===null||e===void 0?void 0:e.find(h=>ft(h)===t));let o=!1;const{code:s,roomPKHandler:c}=this.getRoomPKHandler();if(s!==P.SUCCESS||!c)return i;const d=c.getJoinedPKRooms(),l=[];return Object.values(d).map(h=>{l.push(...h.getRemoteTracks())}),o=l.some(h=>t===h.getTrackId()),i||o}getLivingType(){return this._livingType}getMCUConfigBuilder(){return this._isMainRoom?this._mcuConfigBuilder:(O.error("the `getMCUConfigBuilder` is disabled in PK room"),{code:P.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}_onMCUConfigFlush(t){return j(this,void 0,void 0,function*(){const e={"App-Key":this._context.getAppkey(),Token:this._token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},{code:r,res:i}=yield this._service.setMcuConfig(e,t);return r!==P.SUCCESS?(O.error(`set MCU config failed: ${r}`),{code:r}):(O.info("set MCU config success"),i.pull_url&&(this._CDNUris=JSON.parse(i.pull_url)),{code:r,res:i})})}__onReconnected(){const t=Object.create(null,{__onReconnected:{get:()=>super.__onReconnected}});var e,r;return j(this,void 0,void 0,function*(){const i=yield t.__onReconnected.call(this,this._livingType);if(!i||!i.data)return;const o=i.data.roomInfo,s=(e=o.filter(d=>d.key==="cdn_uris")[0])===null||e===void 0?void 0:e.value;if(!s)return;const c=JSON.parse(s);((r=this._CDNUris)===null||r===void 0?void 0:r.enableInnerCDN)!==c.enableInnerCDN&&this._callAppListener("onCDNEnableChange",c.enableInnerCDN),this._CDNUris=c})}enableInnerCDN(t){return j(this,void 0,void 0,function*(){if(!this._isMainRoom)return O.error("the `enableInnerCDN` is disabled in PK room"),{code:P.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(!Er(t))return O.error("`enable` is invalid"),{code:P.PARAMS_ERROR};this._CDNEnable=t;const e={version:2,output:{inCDNModel:t?Fr.OPEN:Fr.STOP}},{code:r}=yield this._onMCUConfigFlush(e);if(r!==P.SUCCESS)return O.error(`enableInnerCDN failed -> code: ${r}`),{code:P.SIGNAL_ERROR};if(this._CDNUris&&this._CDNUris.broadcast!==Hr.SPREAD)return O.info("enableInnerCDN succeed"),{code:P.SUCCESS};const{code:i}=yield Ct(()=>this._sendCDNInfoSignal());return i===P.SUCCESS?(O.info("enableInnerCDN succeed"),{code:P.SUCCESS}):(O.error(`enableInnerCDN failed -> code: ${i}`),{code:i})})}_sendCDNInfoSignal(){return j(this,void 0,void 0,function*(){return this._CDNUris=Object.assign({},this._CDNUris,{enableInnerCDN:this._CDNEnable}),(yield Promise.all([this._spreadCDNInfo(this._CDNUris),this._setRoomCDNInfo(this._CDNUris)])).every(t=>t.code===P.SUCCESS)?{code:P.SUCCESS}:{code:P.SIGNAL_ERROR}})}_spreadCDNInfo(t){return j(this,void 0,void 0,function*(){const e=yield this._context.setRTCCDNUris(this._roomId,lt.TOTAL_CONTENT_RESOURCE,JSON.stringify([t]));return e!==R.SUCCESS?(O.error(`spreadCDNInfo failed -> code: ${e}`),{code:P.SIGNAL_ERROR}):(O.info("spreadCDNInfo succeed"),{code:P.SUCCESS})})}_setRoomCDNInfo(t){return j(this,void 0,void 0,function*(){const e=yield this._context.setRTCData(this._roomId,"cdn_uris",JSON.stringify([t]),!0,ae.ROOM);return e!==R.SUCCESS?(O.error(`setRoomCDNInfo failed -> code: ${e}`),{code:P.SIGNAL_ERROR}):(O.info("setRoomCDNInfo succeed"),{code:P.SUCCESS})})}_resourceHandle(t,e,r){const i=Object.create(null,{_resourceHandle:{get:()=>super._resourceHandle}});var o;return j(this,void 0,void 0,function*(){i._resourceHandle.call(this,t,e,r),t.cdn_uris&&(((o=this._CDNUris)===null||o===void 0?void 0:o.enableInnerCDN)!==t.cdn_uris[0].enableInnerCDN&&this._callAppListener("onCDNEnableChange",!this.__getCDNEnable()),this._CDNUris=t.cdn_uris[0])})}_exchangeHandle(t){var e,r,i;return j(this,void 0,void 0,function*(){const o=yield this._service.exchange(this._getRTCReqestHeaders(),t),s=(r=(e=o.data)===null||e===void 0?void 0:e.urls)===null||r===void 0?void 0:r.pull_url;return o.code===P.SUCCESS&&s&&(this._CDNUris=JSON.parse(s),((i=this._CDNUris)===null||i===void 0?void 0:i.broadcast)===Hr.SPREAD&&(this._CDNEnable=!0,this._sendCDNInfoSignal())),o})}_afterChangedRole(t){const e=go(t,this._roomId),r=this._context.getCurrentId(),i=Object.keys(e);setTimeout(()=>{var o,s,c;const d=i.filter(l=>l!==r);d.length>0&&this._callAppListener("onUserJoin",d);for(const l in e)l!==r&&this._resourceHandle({uris:e[l]},lt.TOTAL_CONTENT_RESOURCE,l);((o=t.roomInfo.filter(l=>l.key==="cdn_uris")[0])===null||o===void 0?void 0:o.value)&&((s=this._CDNUris)===null||s===void 0?void 0:s.push_mode)===$r.MANUAL&&this._callAppListener("onCDNEnableChange",(c=this._CDNUris)===null||c===void 0?void 0:c.enableInnerCDN)})}__getCDNEnable(){var t;return(t=this._CDNUris)===null||t===void 0?void 0:t.enableInnerCDN}__getCDNPushMode(){var t;return(t=this._CDNUris)===null||t===void 0?void 0:t.push_mode}_onJoinedPKRoom(t,e){Ct(()=>j(this,void 0,void 0,function*(){!this._roomPKHandler||(this._roomPKHandler.getPKInfo(t)?yield this._exchangeWithPushOtherRoom():O.warn(`exchange to update pushOtherRoom cancel, pkInfo lost -> roomId: ${t}`))}))}_onLeavePKRoom(t){if(!!this._roomPKHandler){if(this._roomPKHandler.getPKInfo(t))return this._exchangeWithPushOtherRoom();O.warn(`exchange to update pushOtherRoom cancel, pkInfo lost -> roomId: ${t}`)}}_getPushOtherRoomsParams(){const t=[];if(!this.isMainRoom()||!this._roomPKHandler)return t;const e=this._roomPKHandler.getJoinedPKRooms();for(const r in e){const i=e[r].getSessionId(),o=this._roomPKHandler.getPKInfo(r);if(!o)continue;const{inviterUserAutoMix:s,inviteeUserAutoMix:c,inviterUserId:d}=o,l=this._context.getCurrentId()===d;t.push({roomId:r,sessionId:i,autoMix:l?!!s:!!c})}return t}_exchangeWithPushOtherRoom(){return j(this,void 0,void 0,function*(){if(!this.getLocalTracks().length)return;const t=yield this._createExchangeParams(this._subscribedList,!1),e=this._getPushOtherRoomsParams();e&&(t.pushOtherRooms=e);const r=yield this._exchangeHandle(t);if(r.code!==P.SUCCESS)return O.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==P.SUCCESS)return O.error(`exchange with pushOtherRoom failed: ${o}`),{code:o};const s=yield this._pc.setRemoteAnswer(i.sdp);return s!==P.SUCCESS?{code:s}:void 0})}getRoomPKHandler(){return this._isMainRoom?{code:P.SUCCESS,roomPKHandler:this._roomPKHandler}:(O.error("the `getRoomPKHandler` is disabled in PK room"),{code:P.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}_quitAllPKRoom(){const t=this._roomPKHandler.getJoinedPKRooms();for(const e in t){const r=t[e];this._roomPKHandler.leaveOtherRoom(r)}}isMainRoom(){return this._isMainRoom}}class _h extends Ou{constructor(t,e,r,i,o,s,c){super(t,e,r,i,Vt.RTC,o,s,c,!1)}}const Mi=()=>({"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:`web|${Xt.browser}|${Xt.version}`,ClientVersion:"5.3.13","Client-Session-Id":Nu(),"Request-Id":Date.now().toString()});class Ns{constructor(t,e,r,i=5e3){this._runtime=t,this._context=e,this._msUrl=r,this._timeout=i,this._msInNavi=[],this._failedMs=[],this._rtcFinger=void 0,this._clusterId="",this._configUrl=""}getNaviMS(){return this._msUrl?[this._msUrl]:this._clusterId?[`https://${this._clusterId}`]:(this._msInNavi.length===0&&(this._failedMs.length===0?this._msInNavi.push(...(t=>{var e;if(!t)return[];let r;try{r=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch{return O.warn("parse `voipCallInfo` of navi failed: "+t.voipCallInfo),[]}if(r.strategy===0)return[];const i=(e=r.callEngine)===null||e===void 0?void 0:e.filter(c=>c.engineType===4);if(!i||i.length===0)return[];const o=i[0],s=[];return o.mediaServer&&s.push(o.mediaServer.replace(/^(https?:\/\/)?/,"https://")),o.backupMediaServer&&o.backupMediaServer.forEach(c=>{s.push(c.replace(/^(https?:\/\/)?/,"https://"))}),s})(this._context.getNaviInfo())):(this._msInNavi.push(...this._failedMs),this._failedMs.length=0)),this._msInNavi.map(t=>t.trim()))}_request(t,e,r){return j(this,void 0,void 0,function*(){const i=this.getNaviMS();if(i.length===0)return O.warn(`request '${t}' failed -> have no valid service address.`),{code:P.NOT_OPEN_VIDEO_AUDIO_SERVER};this._rtcFinger&&(r.rtcFinger=this._rtcFinger);for(let o=0;o<i.length;o+=1){const s=`${i[o]}${t}`,c=Mi(),d=Object.assign(Object.assign({},c),e),l=JSON.stringify(r),h=c["Request-Id"];O.info(`request -> Request-Id: ${h}, url: ${s}, headers: ${JSON.stringify(d)}, body: ${l}`);const{status:a,data:u}=yield this._runtime.httpReq({url:s,body:l,headers:d,method:re.POST,timeout:this._timeout});if(a===200){const p=JSON.parse(u);return p.rtcFinger&&(this._rtcFinger=p.rtcFinger),p.clusterId&&(this._clusterId=p.clusterId),O.info(`request success -> Request-Id: ${h}`),{code:P.SUCCESS,data:p}}O.warn(`request failed -> Request-Id: ${h}, status: ${a}, url: ${s}`),this._failedMs.push(...this._msInNavi.splice(o,1))}return{code:P.REQUEST_FAILED}})}exchange(t,e){var r;return j(this,void 0,void 0,function*(){const i=yield this._request("/exchange",t,e);if(i.code===P.SUCCESS&&((r=i.data)===null||r===void 0?void 0:r.resultCode)===P.SUCCESS){const o=i.data.urls;o&&(this._configUrl=o.configUrl)}return i})}exit(t){return j(this,void 0,void 0,function*(){const{code:e}=yield this._request("/exit",t,{});return e})}broadcastSubscribe(t,e){return this._request("/broadcast/subscribe",t,e)}broadcastExit(t){return j(this,void 0,void 0,function*(){const{code:e}=yield this._request("/broadcast/exit",t,{});return{code:e}})}setMcuConfig(t,e){return j(this,void 0,void 0,function*(){if(!this._configUrl)return O.warn("RCMediaService.setMcuConfig failed -> RCRTCCode.MCU_SERVER_NOT_FOUND"),{code:P.MCU_SERVER_NOT_FOUND};const r=`${this._configUrl.replace(/^(https?:\/\/)?/,"https://")}/server/mcu/config`,i=Mi(),o=Object.assign(Object.assign({},i),t),s=JSON.stringify(e),c=i["Request-Id"];O.info(`request -> Request-Id: ${c}, url: ${r}, headers: ${JSON.stringify(o)}, body: ${s}`);const{status:d,data:l}=yield this._runtime.httpReq({url:r,headers:o,body:s,method:re.POST});if(d===200){O.info(`request success -> Request-Id: ${c}`);const h=JSON.parse(l);return{code:h.resultCode,res:h}}return O.warn(`request failed -> Request-Id: ${c}, status: ${d}, url: ${r}`),{code:P.REQUEST_FAILED}})}getCDNResourceInfo(t,e){return j(this,void 0,void 0,function*(){const r=Mi(),i=Object.assign(Object.assign({},r),t),o=r["Request-Id"];O.info(`request -> Request-Id: ${o}, url: ${e}, headers: ${JSON.stringify(i)}`);const{status:s,data:c}=yield this._runtime.httpReq({url:e,headers:i,method:re.GET});if(s===200){O.info(`request success -> Request-Id: ${r["Request-Id"]}`);const d=JSON.parse(c);return{code:d.resultCode,res:d}}return O.warn(`request failed -> Request-Id: ${r["Request-Id"]}, status: ${s}, url: ${e}`),{code:P.REQUEST_FAILED}})}}class vh{constructor(t,e,r){this._context=t,this._rtcToken="",this._liveUrl="",this._subTracks=[],this._livingType=null,this._mediaType=null,this._subTiny=!1,this._fromRetry=!1,this._appListener=null,this._service=new Ns(e,t,r.mediaServer)}_getReqHeaders(t){return j(this,void 0,void 0,function*(){const e=this._context.getCurrentId(),r=e;if(!this._rtcToken){const{code:i,data:o}=yield this._context.getRTCToken(r,Vt.LIVE,t);if(i!==R.SUCCESS)return O.error(`getRTCToken failed: ${i}`),{code:P.SIGNAL_ERROR};this._rtcToken=o.rtcToken}return{code:P.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:e,RoomId:r,RoomType:Vt.LIVE,Token:this._rtcToken}}})}_clearSubscribeInfo(){var t;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,(t=this._pc)===null||t===void 0||t.destroy(),this._pc=null}_reTryExchange(){var t;return j(this,void 0,void 0,function*(){this._fromRetry=!0;const{code:e}=yield this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);e===P.SUCCESS&&((t=this._pc)===null||t===void 0||t.clearReTryExchangeTimer())})}subscribe(t,e,r,i=!1){return j(this,void 0,void 0,function*(){return Ct(()=>this.__subscribe(t,e,r,i))})}__subscribe(t,e,r,i=!1){var o;return j(this,void 0,void 0,function*(){const s=[];if(Tr(this._context.getNaviInfo()))return{code:P.PACKAGE_ENVIRONMENT_ERROR,tracks:s};if(!this._fromRetry&&((o=this._pc)===null||o===void 0||o.clearReTryExchangeTimer()),this._fromRetry=!1,!Bt(t))return O.error(`liveUrl is invalid: ${t}`),{code:P.PARAMS_ERROR,tracks:s};if(![ue.AUDIO,ue.VIDEO].includes(e))return O.error(`livingType is invalid: ${e}`),{code:P.PARAMS_ERROR,tracks:s};if(![vt.AUDIO_ONLY,vt.VIDEO_ONLY,vt.AUDIO_VIDEO].includes(r))return O.error(`mediaType is invalid: ${r}`),{code:P.PARAMS_ERROR,tracks:s};if(this._liveUrl&&this._liveUrl!==t)return{code:P.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s};this._pc||(this._pc=new he(this._reTryExchange.bind(this)),this._pc.on(he.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this.registerReportListener(this._reportListener)),this._liveUrl=t;const{code:c,headers:d}=yield this._getReqHeaders(e);if(c!==P.SUCCESS)return{code:c,tracks:s};const l=`rc_mcu_${Date.now()}`,h="RongCloudRTC";this._subTracks.length===0&&(this._subTracks.push(new Te(h,l),new ye(h,l)),this._pc.updateSubRemoteTracks(this._subTracks.slice()));const a={sdp:yield this._pc.createOffer(!0),liveUrl:t,mediaType:r,simulcast:i?Wt.TINY:Wt.NORMAL,switchstream:!1},u=yield this._service.broadcastSubscribe(d,a);if(u.code!==P.SUCCESS)return O.error(`andience subscribe failed: ${u.code}`),{code:u.code,tracks:s};const p=u.data;if(p.resultCode!==P.SUCCESS)return O.error(`andience subscribe failed! code: ${p.resultCode}; message: ${p.message}`),{code:p.resultCode,tracks:s};O.debug(`andience subscribe success: ${t}`),this._livingType=e,this._mediaType=r,this._subTiny=i;const{sdp:f,subscribedList:m}=p,_=[];return m.forEach(v=>{const{mediaType:T}=v,y=this._subTracks[T];_.push(y),y.__innerSetRemoteMuted(!0)}),this._pc.setRemoteAnswer(f.sdp),{code:P.SUCCESS,tracks:_}})}unsubscribe(){return j(this,void 0,void 0,function*(){return Ct(()=>this.__unsubscribe())})}__unsubscribe(){var t;return j(this,void 0,void 0,function*(){if((t=this._pc)===null||t===void 0||t.clearReTryExchangeTimer(),!this._rtcToken||!this._liveUrl)return{code:P.SUCCESS};const{headers:e}=yield this._getReqHeaders(),{code:r}=yield this._service.broadcastExit(e);return r!==P.SUCCESS?O.error(`broadcast unsubscribe failed: ${r}`):O.debug("broadcast unsubscribe success"),this._clearSubscribeInfo(),{code:r}})}registerReportListener(t){var e;this._reportListener=t,(e=this._pc)===null||e===void 0||e.registerReportListener(t)}registerTrackEventListener(t){this._appListener=t}_onTrackReady(t){var e,r;const i=t.receiver.track,o=i.kind==="audio"?vt.AUDIO_ONLY:vt.VIDEO_ONLY,s=this._subTracks[o];s.__innerSetMediaStreamTrack(i);try{(r=(e=this._appListener)===null||e===void 0?void 0:e.onTrackReady)===null||r===void 0||r.call(e,s)}catch(c){O.error(c)}}}var mo,Ln;(function(n){n.RTMP="rtmp",n.FLV="flv",n.HLS="hls"})(mo||(mo={})),function(n){n[n.NOT_HTTPS=0]="NOT_HTTPS",n[n.HTTPS=1]="HTTPS"}(Ln||(Ln={}));const Th=Object.assign(Object.assign({},de(Et.W176_H144)),{frameRate:le(ie.FPS_15)});class Ga{constructor(t,e,r,i,o,s){this._context=t,this._runtime=e,this._initOptions=r,this._roomId=i,this._joinResData=o,this._livingType=s,this._roomAnchorList=[],this._roomRes={},this._roomAnchorRes={},this._remoteTracks={},this._appListener=null,this._subscribedList=[],this._sessionId="",this._destroyed=!1,this._setInitData(),this._service=new Ns(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout),this._polarisReport=new Iu(this._context,this._runtime,this._roomId,this,xr.Audience),this._polarisReport.sendR1(),this._pc=new he(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(he.__INNER_EVENT_TRACK_READY__,c=>{const d=c.streams[0].id,l=c.receiver.track,h=[d,l.kind==="audio"?vt.AUDIO_ONLY:vt.VIDEO_ONLY].join("_"),a=this._remoteTracks[h];a?(a.__innerSetMediaStreamTrack(l),this._callAppListener("onTrackReady",a)):O.warn("cannot found RCRemoteTrack:",l.id)}),this._context.onrtcdatachange=this.singalDataChange.bind(this)}_setInitData(){const{sessionId:t,remoteUserIds:e,remoteRTCUris:r,remoteMUCUris:i,remoteTracks:o,CDNUris:s}=((c,d)=>{const l=d.filter(T=>T.key==="RC_RTC_SESSIONID")[0],h=l?l.value:"",a=d.filter(T=>T.key==="RC_ANCHOR_LIST").map(T=>JSON.parse(T.value||"[]"))[0],u=d.filter(T=>T.key.includes("RC_RES_")).map(T=>JSON.parse(T.value||"{}")),p=u.length?JSON.parse(u[0].mcu_uris||"[]"):[],f=[];p.forEach(T=>{const{mediaType:y,tag:w}=T,L=y===vt.AUDIO_ONLY?new Te(w,"",c):new ye(w,"",c);f.push(L)});const m=[],_=[];u.forEach(T=>{const y=JSON.parse(T.uris||"[]");m.push(...y),y.forEach(w=>{const{mediaType:L,tag:M,msid:C}=w,A=C.split("_")[0],F=L===vt.AUDIO_ONLY?new Te(M,A):new ye(M,A);_.push(F)})});const v=d.filter(T=>T.key==="RC_CDN").map(T=>{const y=JSON.parse(T.value||"[]");return JSON.parse(y.cdn_uris)[0]})[0];return{sessionId:h,remoteUserIds:a||[],remoteRTCUris:m,remoteMUCUris:p,remoteRTCTracks:_,remoteMCUTracks:f,remoteTracks:[..._,...f],CDNUris:v||{}}})(this._roomId,this._joinResData.kvEntries);this._sessionId=t,this._roomAnchorList=e,o.forEach(c=>{this._remoteTracks[c.getTrackId()]=c}),this._CDNUris=s,r.forEach(c=>{const d=c.msid.split("_")[0];this._roomAnchorRes[d]?this._roomAnchorRes[d].push(c):this._roomAnchorRes[d]=[c]}),i.forEach(c=>{const{mediaType:d,tag:l}=c,h=[this._roomId,l,d].join("_");this._roomRes[h]=c}),r.forEach(c=>{const d=ft(c);this._roomRes[d]=c})}_assertRoomDestroyed(){if(this._destroyed){const t="This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.";return O.warn(t),P.ROOM_HAS_BEEN_DESTROYED}}singalDataChange(t,e){var r;if(e!==this._roomId)return void O.warn(`singalDataChange -> not the current room data: data roomId: ${e}, current roomId: ${this._roomId}`);O.debug("singalDataChange -> singalData:",JSON.stringify(t||{}));const i=[],o=(r=t.filter(s=>s.key==="RC_CDN")[0])===null||r===void 0?void 0:r.value;o&&this._diffCDNUris(JSON.parse(JSON.parse(o).cdn_uris)[0]),t.forEach(s=>{const{key:c,value:d,timestamp:l,uid:h}=s;if(c.indexOf("RC_RES_")!==-1){const a=JSON.parse(d||"{}"),u=JSON.parse(a.mcu_uris||"[]"),p=JSON.parse(a.uris||"[]");return i.push(...u),void this._diffAnchorResource(p,h)}if(c==="RC_ANCHOR_LIST"){const a=JSON.parse(d||"[]"),{joinUserIds:u,leftUserIds:p}=this._diffAnchorList(a);u.length>0&&this._handleNewJoinedAnchor(u),p.length>0&&this._handleLeftedAnchor(p)}}),this._diffRoomResource(i)}_diffAnchorList(t){const e=t.filter(r=>this._roomAnchorList.indexOf(r)<0);return{leftUserIds:this._roomAnchorList.filter(r=>t.indexOf(r)<0),joinUserIds:e}}_handleNewJoinedAnchor(t){this._roomAnchorList.push(...t),this._callAppListener("onAnchorJoin",t)}_handleLeftedAnchor(t){return j(this,void 0,void 0,function*(){this._roomAnchorList=this._roomAnchorList.filter(r=>!(t.indexOf(r)>-1));const e=[];t.forEach(r=>{e.push(...this.getRemoteTracksByUserId(r)),delete this._roomAnchorRes[r]}),e.length&&(yield this.unsubscribe(e),e.forEach(r=>delete this._remoteTracks[r.getTrackId()])),this._callAppListener("onAnchorLeave",t)})}_diffRoomResource(t){return j(this,void 0,void 0,function*(){const e=[],r=[],i=[];t.forEach(o=>{const s=ft(o),{userId:c,tag:d,mediaType:l}=bt(s),h=[this._roomId,d,l].join("_");if(!this._remoteTracks[h]){const a=l===vt.AUDIO_ONLY?new Te(d,"",this._roomId):new ye(d,"",this._roomId);e.push(a),this._remoteTracks[h]=a,this._roomRes[a.getTrackId()]=o}i.push(h)}),Object.keys(this._remoteTracks).forEach(o=>{i.indexOf(o)<0&&this._remoteTracks[o].isMCUTrack()&&r.push(this._remoteTracks[o])}),e.length>0&&this._callAppListener("onTrackPublish",e),r.length>0&&this._onUserUnpublish(r,"onTrackUnpublish")})}_diffAnchorResource(t,e){return j(this,void 0,void 0,function*(){const r=this._roomAnchorRes[e]||(this._roomAnchorRes[e]=[]),{publishedList:i,unpublishedList:o,modifiedList:s}=vr(r,t);if(i.length){const c=r.map(ft),d=[],l=[];if(i.forEach(h=>{const a=ft(h),u=c.indexOf(a),{userId:p,tag:f,mediaType:m}=bt(a);u>-1?r[u]=h:r.push(h);let _=this._remoteTracks[a];this._roomRes[a]=h,_?_.isSubscribed()&&d.push(_):(_=m===vt.AUDIO_ONLY?new Te(f,p):new ye(f,p),this._remoteTracks[a]=_,l.push(_)),_.__innerSetRemoteMuted(h.state===0)}),d.length){const h=d.map(u=>u.getTrackId());O.debug(`resub tracks -> ${JSON.stringify(h)}`);const{code:a}=yield Ct(()=>this._subscribeHandle(d,!0));a!==P.SUCCESS&&O.error(`resub tracks failed -> code: ${a}, ids: ${JSON.stringify(h)}`)}this._callAppListener("onAnchorTrackPublish",l)}if(o.length){const c=o.map(ft);for(let l=r.length-1;l>=0;l-=1){const h=r[l];c.includes(ft(h))&&r.splice(l,1)}const d=o.map(l=>{const h=ft(l);return this._remoteTracks[h]});yield this._onUserUnpublish(d,"onAnchorTrackUnpublish")}if(s.length){const c=r.map(ft);for(let d=0;d<s.length;d++){const l=s[d],h=ft(l),a=c.indexOf(h);r[a].state=l.state;const u=this._remoteTracks[h];u.__innerSetRemoteMuted(l.state===0),u.isAudioTrack()?this._callAppListener("onAudioMuteChange",u):this._callAppListener("onVideoMuteChange",u)}}})}_onUserUnpublish(t,e){return j(this,void 0,void 0,function*(){yield this.unsubscribe(t),t.forEach(r=>{this._subscribedList=this._subscribedList.filter(i=>i.track.getTrackId()!==r.getTrackId()),delete this._roomRes[r.getTrackId()],r.__innerDestroy(),delete this._remoteTracks[r.getTrackId()]}),this._callAppListener(e,t)})}_callAppListener(t,...e){var r;O.info(`${t} callback ->`,...e);const i=(r=this._appListener)===null||r===void 0?void 0:r[t];if(i)try{i(...e)}catch(o){O.error(o)}}_reTryExchange(){return j(this,void 0,void 0,function*(){Ct(()=>j(this,void 0,void 0,function*(){var t;const{reqBody:e}=yield this._createSubscribeParams(this._subscribedList,{},!0),r=yield this._exchangeHandle(e);if(r.code!==P.SUCCESS)return O.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==P.SUCCESS)return O.error(`reTryExchange failed: ${o}`),{code:o};this._pc.clearReTryExchangeTimer();const s=this._subscribedList.filter(d=>d.track.isMCUTrack());if(s.length>0){const d=s[0].track.getTrackId(),l=(t=this._roomRes[d])===null||t===void 0?void 0:t.msid,h=[this._roomId,"RongCloudRTC"].join("_");i.sdp=i.sdp.replace(new RegExp(l,"g"),h)}const c=yield this._pc.setRemoteAnswer(i.sdp);return c!==P.SUCCESS?{code:c}:void 0}))})}_createSubscribeParams(t,e,r){return j(this,void 0,void 0,function*(){const i=yield this._pc.createOffer(r),o={resolutionInfo:[]},s={min:0,max:0};return Object.keys(e).forEach(c=>{const{mediaStream:d,tinyStream:l}=e[c];[d,l].forEach((h,a)=>{var u;const p=a===1?[c,"tiny"].join("_"):c;i.sdp=(u=i.sdp)===null||u===void 0?void 0:u.replace(new RegExp(h.id,"g"),p);const f=h.getVideoTracks()[0];if(!f)return;const m=a===0,{width:_,height:v,frameRate:T}=m?Ss(f):Th;o.resolutionInfo.push({trackId:f.id,simulcast:m?Wt.NORMAL:Wt.TINY,resolution:`${_}x${v}`});const y=Tu(_,v),w=yu(T);s.min+=y.minBitrate*w,s.max+=y.maxBitrate*w})}),{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:t.map(c=>({simulcast:c.subTiny?Wt.TINY:Wt.NORMAL,resolution:"",uri:this._roomRes[c.track.getTrackId()].uri}))},dynamicBitrate:s,offer:i}})}_subscribeHandle(t,e=!1){var r;return j(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:P.ROOM_HAS_BEEN_DESTROYED};if(!_t("tracks",t,()=>Ht(t)&&t.length>0&&t.every(d=>d instanceof Dt||d.track instanceof Dt),!0))return{code:P.PARAMS_ERROR};const i=this._subscribedList.map(d=>Object.assign({},d)),o=t.map(d=>d instanceof Dt?{track:d}:d);let s=!1;const c=[];return o.forEach(d=>{const l=d.track.getTrackId();c.push(l);const h=i.find(a=>a.track.getTrackId()===l);h&&h.subTiny===d.subTiny||(h?h.subTiny=d.subTiny:i.push(d),s=!0)}),s||e?((r=this._polarisReport)===null||r===void 0||r.sendR2(Ce.SUBSCRIBE,Re.BEGIN,c),this._updateSubListHandle(i,!0)):{code:P.SUCCESS}})}_getReqHeaders(){const t=this._context.getCurrentId();return{"App-Key":this._context.getAppkey(),RoomId:t,Token:this._joinResData.token,RoomType:Vt.LIVE,UserId:t,"Session-Id":this._sessionId}}_exchangeHandle(t){return this._service.broadcastSubscribe(this._getReqHeaders(),t)}_updateSubListHandle(t,e=!1){var r;return j(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:P.ROOM_HAS_BEEN_DESTROYED};if(!_t("resources",t,()=>Ht(t)&&t.every(T=>T instanceof Dt||T.track instanceof Dt),!0))return{code:P.PARAMS_ERROR};let i=t.map(T=>T instanceof Dt?{track:T}:Object.assign({},T));const o={};i=i.filter(T=>{const y=T.track.getTrackId();return!o[y]&&(o[y]=!0)}).map(T=>Object.assign({},T));const s=this._subscribedList.map(T=>Object.assign({},T));if(!e){let T=!1;if(i.forEach(y=>{const w=s.findIndex(L=>L.track===y.track);if(w===-1)return void(T=!0);s.splice(w,1)[0].subTiny!==y.subTiny&&(T=!0)}),s.length&&(T=!0),!T)return{code:P.SUCCESS}}this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(i.map(T=>T.track));const{reqBody:c}=yield this._createSubscribeParams(i,{},!1),d=yield this._exchangeHandle(c);if(s.length){const T=[];s.forEach(y=>{T.push(y.track.getTrackId())}),(r=this._pc.reportParser)===null||r===void 0||r.clearLatestPacketsRecv(T)}if(d.code!==P.SUCCESS)return{code:d.code};const{sdp:l,resultCode:h,message:a,subscribedList:u}=d.data;if(h!==P.SUCCESS)return O.error("change subscribe list failed:",a,h),{code:h};i.forEach(T=>{const{track:y}=T;if(y.isMCUTrack()){const w=this._roomRes[y.getTrackId()].msid,{tag:L,userId:M}=bt(y.getTrackId()),C=[M,L].join("_");l.sdp=l.sdp.replace(new RegExp(w,"g"),C)}});const p=yield this._pc.setRemoteAnswer(l.sdp);if(p!==P.SUCCESS)return{code:p};const f=u==null?void 0:u.map(T=>`${T.msid}_${T.mediaType}`),m=i.filter(T=>{if(T.track.isMCUTrack()){const y=this._roomRes[T.track.getTrackId()],w=`${y.msid}_${y.mediaType}`;return f.includes(w)}return f==null?void 0:f.includes(T.track.getTrackId())}),_=m==null?void 0:m.map(T=>`${T.track.getTrackId()}`),v=i.filter(T=>!(_==null?void 0:_.includes(T.track.getTrackId())));for(const T in this._remoteTracks){const y=m.some(w=>w.track.getTrackId()===T);this._remoteTracks[T].__innerSetSubscribed(y)}return this._subscribedList.splice(0,this._subscribedList.length,...m),v.length?{code:P.SUCCESS,failedList:v}:{code:P.SUCCESS}})}_diffCDNUris(t){return j(this,void 0,void 0,function*(){if(this._CDNUris.url&&!t.url)return this._callAppListener("onCDNInfoDisable"),void(this._CDNUris=t);(!this._CDNUris||!this._CDNUris.url&&t.url)&&this._callAppListener("onCDNInfoEnable",{resolution:`W${t.w}_H${t.h}`,fps:`FPS_${t.fps}`});const e=this._CDNUris.w&&t.w&&this._CDNUris.w!==t.w,r=this._CDNUris.h&&t.h&&this._CDNUris.h!==t.h,i=this._CDNUris.fps&&t.fps&&this._CDNUris.fps!==t.fps;(e||r||i)&&this._callAppListener("onCDNInfoChange",{resolution:`W${t.w}_H${t.h}`,fps:`FPS_${t.fps}`}),this._CDNUris=t})}_getCDNPlayUrl(t){return j(this,void 0,void 0,function*(){const{w:e,h:r,fps:i}=t,o=this._initOptions.pullInnerCDNProtocol||mo.FLV,s=this._initOptions.pullInnerCDNUseHttps===Ln.NOT_HTTPS?Ln.NOT_HTTPS:Ln.HTTPS;if(!this._CDNUris.url)return O.error(`cdn_uris url is empty, the anchor need to open or push CDN, code: ${P.CDN_RESOURCE_IS_EMPTY}`),{code:P.CDN_RESOURCE_IS_EMPTY};const c={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},d=[];e&&d.push(`w=${e}`),r&&d.push(`h=${r}`),i&&d.push(`fps=${i}`),d.push(`kind=${o}`),d.push(`is_https=${s}`);const l=d.join("&");let h=`${this._CDNUris.url}?`;l&&(h+=l);const{code:a,res:u}=yield this._service.getCDNResourceInfo(c,h);return a!==P.SUCCESS?(O.error(`getCDNPlayUrl failed: ${a}`),{code:a}):(O.info(`getCDNPlayUrl success: ${u==null?void 0:u.data.pull_url}`),{code:a,CDNPlayUrl:u==null?void 0:u.data.pull_url})})}getCDNPlayUrl(t,e){return j(this,void 0,void 0,function*(){if(t&&!rn(t))return O.error("`resolution` is invalid"),{code:P.PARAMS_ERROR};if(e&&!po(e))return O.error("`fps` is invalid"),{code:P.PARAMS_ERROR};const{width:r,height:i}=t?de(t):{width:null,height:null},o=e?le(e):null,s={};return r&&(s.w=r),i&&(s.h=i),o&&(s.fps=o),this._getCDNPlayUrl(s)})}subscribe(t){return j(this,void 0,void 0,function*(){return Ct(()=>this._subscribeHandle(t,!1))})}__unsubscribe(t){var e;return j(this,void 0,void 0,function*(){if(!_t("tracks",t,()=>Ht(t)&&t.length>0&&t.every(i=>i instanceof Dt),!0))return O.error(`unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:P.PARAMS_ERROR};const r=this._subscribedList.map(i=>Object.assign({},i)).filter(i=>!t.includes(i.track));return(e=this._polarisReport)===null||e===void 0||e.sendR2(Ce.SUBSCRIBE,Re.END,t.map(i=>i.getTrackId())),this._updateSubListHandle(r,!1)})}unsubscribe(t){return j(this,void 0,void 0,function*(){return Ct(()=>this.__unsubscribe(t))})}__destroy(t){var e;return j(this,void 0,void 0,function*(){this._destroyed||(this._destroyed=!0,(e=this._audioLevelReport)===null||e===void 0||e.clearAudioLevelReportTimer(),t&&(yield this._context.quitLivingRoomAsAudience(this._roomId)),yield this._service.broadcastExit(this._getReqHeaders()),this._pc.destroy(),this._polarisReport=null,this._context.onrtcdatachange=()=>{})})}getRemoteTrack(t){return this._remoteTracks[t]}__getPC(){return this._pc}getLocalTrack(t){return{}}__onReconnected(){return j(this,void 0,void 0,function*(){const{code:t}=yield this._context.joinLivingRoomAsAudience(this._roomId,Vt.LIVE);t!==R.SUCCESS&&O.error("join living room error when on reconnected")})}registerRoomEventListener(t){this._appListener=t}onAudioLevelChange(t,e){var r;(r=this._audioLevelReport)===null||r===void 0||r.clearAudioLevelReportTimer(),this._audioLevelReport=new Su(this),this._audioLevelReport.onAudioLevelChange(t,e||1e3)}registerReportListener(t){var e;(e=this._pc)===null||e===void 0||e.registerReportListener(t)}getRoomId(){return this._roomId}getCrtUserId(){return this._context.getCurrentId()}getSessionId(){return this._sessionId}getRemoteUserIds(){return this._roomAnchorList}getRemoteTracksByUserId(t){const e=[];for(const r in this._remoteTracks){const i=this._remoteTracks[r];i.getUserId()===t&&e.push(i)}return e}getRemoteTracks(){const t=[],e=[];for(const r in this._remoteTracks){if(e.length===2)break;const i=this._remoteTracks[r];i.isMCUTrack()&&e.push(i)}return this._roomAnchorList.forEach(r=>{t.push(...this.getRemoteTracksByUserId(r))}),[...e,...t]}getRemoteRTCTracks(){const t=[];for(const e in this._remoteTracks){const r=this._remoteTracks[e];r.isMCUTrack()||t.push(r)}return t}getRemoteMCUTracks(){const t=[];for(const e in this._remoteTracks){const r=this._remoteTracks[e];r.isMCUTrack()&&t.push(r)}return t}getCDNInfo(){return this._CDNUris.w?{resolution:`W${this._CDNUris.w}_H${this._CDNUris.h}`,fps:`FPS_${this._CDNUris.fps}`,CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}}const Ka=(n,t)=>{const e=[];return e[0]=(t==null?void 0:t.withoutAudio)?void 0:n.getAudioTracks()[0],e[1]=(t==null?void 0:t.withoutVideo)?void 0:n.getVideoTracks()[0],e};class yh{constructor(t,e,r){this._context=t,this._runtime=e,this._options=r,this._crtRoom=null,this._audience=null,this._crtAudienceLivingRoom=null,fn.setSdpSemantics(r.sdpSemantics||"plan-b"),this._service=new Ns(this._runtime,this._context,this._options.mediaServer,this._options.timeout),this._context.onconnectionstatechange=this._onIMStatusChange.bind(this),this._context.ondisconnect=this._onIMDisconnect.bind(this),this._context.ondestroy=this._onIMUninit.bind(this),this._context.onmessage=this._handleMessage.bind(this)}_handleMessage(t){var e;return t.conversationType!==Y.RTC_ROOM?!1:(this._crtRoom instanceof we&&this._getJoinedPKRoomList().forEach(r=>{r.__parseInnerMessage(t)}),(e=this._crtRoom)===null||e===void 0||e.__parseInnerMessage(t),!0)}_getJoinedPKRoomList(){const{code:t,roomPKHandler:e}=this._crtRoom.getRoomPKHandler();if(t===P.SUCCESS&&e){const r=e.getJoinedPKRooms()||{};return Object.values(r)}return[]}_getPKRoomIds(){const{code:t,roomPKHandler:e}=this._crtRoom.getRoomPKHandler();if(t===P.SUCCESS&&e){const r=e.getAllPKInfo();return Object.keys(r)}return[]}getCurrentId(){return this._context.getCurrentId()}joinRTCRoom(t,e,r){return Ct(()=>this._joinRTCRoom(t,e,r))}_joinRTCRoom(t,e,r){return j(this,void 0,void 0,function*(){if(Tr(this._context.getNaviInfo()))return{code:P.PACKAGE_ENVIRONMENT_ERROR};if(!_t("roomId",t,Ft,!0))return{code:P.PARAMS_ERROR};if(!_t("outerUserDatas",r,Rt,!1))return{code:P.PARAMS_ERROR};if(r&&!Object.keys(r).every(c=>_t(`outerUserDatas.${c}`,r[c],Bt,!0)))return{code:P.PARAMS_ERROR};if(this._crtRoom)return{code:P.REPERT_JOIN_ROOM};if(this._context.getConnectionStatus()!==Z.CONNECTED)return{code:P.SIGNAL_DISCONNECTED};if(!this._service.getNaviMS().length)return{code:P.NOT_OPEN_VIDEO_AUDIO_SERVER};O.debug(`joinRoom -> roomId: ${t}; joinType: ${e||zi.KICK}`);const{code:i,data:o}=yield this._context.joinRTCRoom(t,Vt.RTC,void 0,e,void 0,r);if(i!==R.SUCCESS)return O.error(`joinRoom failed -> code: ${i}`),{code:i===io.JOIN_REFUSED?P.SIGNAL_JOIN_RTC_ROOM_REFUSED:i};O.debug(`joinRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${t}, data: ${JSON.stringify(o)}`);const s=new _h(this._context,this._runtime,t,o,this._service,this._options,this._releaseCrtRoomObj.bind(this));return this._crtRoom=s,{room:s,code:P.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}})}joinLivingRoom(t,e,r,i){return Ct(()=>this._joinLivingRoom(t,e,r,i))}_joinLivingRoom(t,e,r,i){return j(this,void 0,void 0,function*(){if(Tr(this._context.getNaviInfo()))return{code:P.PACKAGE_ENVIRONMENT_ERROR};if(!_t("roomId",t,Ft,!0)||!_t("livingType",e,l=>l===ue.AUDIO||l===ue.VIDEO))return{code:P.PARAMS_ERROR};if(!_t("outerUserDatas",i,Rt,!1))return{code:P.PARAMS_ERROR};if(i&&!Object.keys(i).every(l=>_t(`outerUserDatas.${l}`,i[l],Bt,!0)))return{code:P.PARAMS_ERROR};if(this._crtRoom)return{code:P.REPERT_JOIN_ROOM};if(this._context.getConnectionStatus()!==Z.CONNECTED)return{code:P.SIGNAL_DISCONNECTED};if(!this._service.getNaviMS().length)return{code:P.NOT_OPEN_VIDEO_AUDIO_SERVER};O.debug(`joinRoom, roomId: ${t}`);const{code:o,data:s}=yield this._context.joinRTCRoom(t,Vt.LIVE,e,r,void 0,i);if(o!==R.SUCCESS)return O.error(`joinRoom failed -> code: ${o}`),{code:o};O.debug(`JoinRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${t}, data: ${JSON.stringify(s)}`);const c=new we(this._context,this._runtime,t,s,this._service,this._options,this._releaseCrtRoomObj.bind(this),e,!1,!0);this._crtRoom=c;const d={room:c,code:P.SUCCESS,userIds:c.getRemoteUserIds(),tracks:c.getRemoteTracks(),PKRoomIds:this._getPKRoomIds()};return c.__getCDNPushMode()===$r.MANUAL&&Object.assign(d,{CDNEnable:c.__getCDNEnable()}),d})}getAudienceClient(){return this._audience||(this._audience=new vh(this._context,this._runtime,this._options)),this._audience}_onIMStatusChange(t){O.debug(`signal server connection state change: ${t}`),t===Z.CONNECTED&&(this._crtRoom instanceof we&&this._getJoinedPKRoomList().forEach(e=>{e.__onReconnected()}),this._crtRoom&&this._crtRoom.__onReconnected())}_onIMDisconnect(){O.debug("TODO -> on IM disconnect")}_onIMUninit(){O.debug("TODO -> on IM client ondestroy")}leaveRoom(t){return Ct(()=>this._leaveRoom(t))}_leaveRoom(t){return j(this,void 0,void 0,function*(){return this._crtRoom?(yield this._crtRoom.__destroy(!0),O.debug(`quitRTCRoom -> userId: ${this._context.getCurrentId()} , roomId: ${this._crtRoom.getRoomId()}`),this._crtRoom=null,{code:P.SUCCESS}):{code:P.SUCCESS}})}_releaseCrtRoomObj(){this._crtRoom=null}_getMediaStream(t,e="getUserMedia"){return j(this,void 0,void 0,function*(){try{const r=yield navigator.mediaDevices[e](t);return{code:P.SUCCESS,stream:r}}catch(r){if(r.message==="Permission denied")return{code:P.PERMISSION_DENIED};O.error(`get user media failed -> ${r.message}`)}return{code:e==="getUserMedia"?P.GET_USER_MEDIA_FAILED:P.GET_DISPLAY_MEDIA_FAILED}})}createMicrophoneAudioTrack(t="RongCloudRTC",e){return j(this,void 0,void 0,function*(){if(!ge(t))return{code:P.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:P.INVALID_USER_ID};const{stream:i,code:o}=yield this._getMediaStream({audio:this._formatAudioProfile(e)});if(o!==P.SUCCESS)return{code:o};const s=i.getAudioTracks()[0];return{code:o,track:new Ba(t,r,s)}})}createCameraVideoTrack(t="RongCloudRTC",e){return j(this,void 0,void 0,function*(){if(!ge(t))return{code:P.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:P.INVALID_USER_ID};const i=rn(e==null?void 0:e.resolution)?e.resolution:Et.W640_H480,{width:o,height:s}=de(i),{stream:c,code:d}=yield this._getMediaStream({video:{deviceId:e==null?void 0:e.cameraId,frameRate:le((e==null?void 0:e.frameRate)||ie.FPS_15),width:o,height:s,facingMode:e==null?void 0:e.faceMode}});if(d!==P.SUCCESS)return{code:d};const l=c.getVideoTracks()[0];return{code:d,track:new Fa(t,r,l)}})}_formatAudioProfile(t){if(!t)return!0;const{micphoneId:e,sampleRate:r,autoGainControl:i,echoCancellation:o,noiseSuppression:s}=t,c={deviceId:e,sampleRate:r},d=navigator.mediaDevices.getSupportedConstraints();return d.noiseSuppression&&(c.noiseSuppression=s),d.echoCancellation&&(c.echoCancellation=o),d.autoGainControl&&(c.autoGainControl=i),c}createMicrophoneAndCameraTracks(t="RongCloudRTC",e){var r,i,o,s;return j(this,void 0,void 0,function*(){const c=[];if(!ge(t))return{code:P.INVALID_TAGS,tracks:c};const d=this._context.getCurrentId();if(!d)return{code:P.INVALID_USER_ID,tracks:c};const l=rn((r=e==null?void 0:e.video)===null||r===void 0?void 0:r.resolution)?e.video.resolution:Et.W640_H480,{width:h,height:a}=de(l),{stream:u,code:p}=yield this._getMediaStream({video:{deviceId:(i=e==null?void 0:e.video)===null||i===void 0?void 0:i.cameraId,frameRate:le(((o=e==null?void 0:e.video)===null||o===void 0?void 0:o.frameRate)||ie.FPS_15),width:h,height:a,facingMode:(s=e==null?void 0:e.video)===null||s===void 0?void 0:s.faceMode},audio:this._formatAudioProfile(e==null?void 0:e.audio)});return p!==P.SUCCESS||u.getTracks().forEach(f=>{f.kind==="video"?c.push(new Fa(t,d,f)):c.unshift(new Ba(t,d,f))}),{code:p,tracks:c}})}createScreenVideoTrack(t="screenshare",e){return j(this,void 0,void 0,function*(){if(!ge(t))return{code:P.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:P.INVALID_USER_ID};if(!Cu())return{code:P.BROWSER_NOT_SUPPORT};const i=/Electron/.test(navigator.userAgent);if(i&&!(e==null?void 0:e.chromeMediaSourceId))return{code:P.PARAMS_ERROR};const o=rn(e==null?void 0:e.resolution)?e.resolution:Et.W1280_H720,{width:s,height:c}=de(o),d=i?{mandatory:{chromeMediaSourceId:e.chromeMediaSourceId,chromeMediaSource:"desktop",minWidth:s,maxWidth:s,minHeight:c,maxHeight:c}}:{frameRate:le((e==null?void 0:e.frameRate)||ie.FPS_15),width:s,height:c},{stream:l,code:h}=yield this._getMediaStream({video:d,audio:!1},i?"getUserMedia":"getDisplayMedia");if(h!==P.SUCCESS)return{code:h};const a=l.getVideoTracks()[0];return{code:h,track:new oh(t,r,a)}})}createLocalAudioTrack(t,e){return j(this,void 0,void 0,function*(){if(!ge(t))return{code:P.INVALID_TAGS};if(!e||e.toString()!=="[object MediaStreamTrack]"||e.kind!=="audio")return{code:P.CREATE_CUSTOM_TRACK_FAILED};const r=this._context.getCurrentId();return r?{code:P.SUCCESS,track:new ho(t,r,e)}:{code:P.INVALID_USER_ID}})}createLocalVideoTrack(t,e){return j(this,void 0,void 0,function*(){if(!ge(t))return{code:P.INVALID_TAGS};if(!e||e.toString()!=="[object MediaStreamTrack]"||e.kind!=="video")return{code:P.CREATE_CUSTOM_TRACK_FAILED};const r=this._context.getCurrentId();return r?{code:P.SUCCESS,track:new un(t,r,e)}:{code:P.INVALID_USER_ID}})}createLocalFileTracks(t,e,r){return j(this,void 0,void 0,function*(){if(!ge(t))return{code:P.INVALID_TAGS,tracks:[]};if(!Eu())return{code:P.BROWSER_NOT_SUPPORT,tracks:[]};const i=e instanceof File?URL.createObjectURL(e):e;if(!Ue(i)&&!/^blob:/.test(i))return O.warn(`createLocalFileTracks failed: params error -> url: ${i}`),{code:P.PARAMS_ERROR,tracks:[]};const o=this._context.getCurrentId();return o?new Promise(s=>{const c=document.createElement("video");(r==null?void 0:r.withoutAudio)&&(c.muted=!0),c.onloadedmetadata=()=>{const d=[];let l;try{const u=c.mozCaptureStream?"mozCaptureStream":"captureStream";l=c[u]()}catch(u){O.error(`create RCLocalFileTrack failed, captureSteam error. -> url: ${i}`),O.error(u),s({code:P.CREATE_FILE_TRACK_FAILED,tracks:d})}const[h,a]=Ka(l,r);h&&d.push(new ih(t,o,h,c)),a&&d.push(new rh(t,o,a,c)),d.length===0&&(c.pause(),c.src=""),c.onerror=null,s({code:P.SUCCESS,tracks:d})},c.onerror=()=>{O.error(`create RCLocalFileTrack failed -> url: ${i}`),s({code:P.CREATE_FILE_TRACK_FAILED,tracks:[]})},c.src=i,c.loop=!0,c.play()}):{code:P.INVALID_USER_ID,tracks:[]}})}createLocalTracks(t,e,r){return j(this,void 0,void 0,function*(){const i=[];if(!ge(t))return{code:P.INVALID_TAGS,tracks:i};if(!(e instanceof MediaStream))return{code:P.PARAMS_ERROR,tracks:i};const o=this._context.getCurrentId();if(!o)return{code:P.INVALID_USER_ID,tracks:i};const[s,c]=Ka(e,r);return s&&i.push(new ho(t,o,s)),c&&i.push(new un(t,o,c)),{code:P.SUCCESS,tracks:i}})}joinLivingRoomAsAudience(t,e){return j(this,void 0,void 0,function*(){if(Tr(this._context.getNaviInfo()))return{code:P.PACKAGE_ENVIRONMENT_ERROR};if(!_t("roomId",t,Ft,!0)||!_t("livingType",e,s=>s===ue.AUDIO||s===ue.VIDEO))return{code:P.PARAMS_ERROR};if(this._crtAudienceLivingRoom)return{code:P.REPERT_JOIN_ROOM};if(!this._service.getNaviMS().length)return{code:P.NOT_OPEN_VIDEO_AUDIO_SERVER};const{code:r,data:i}=yield this._context.joinLivingRoomAsAudience(t,Vt.LIVE,e);if(r!==R.SUCCESS)return O.error("audienceJoinLivingRoomError:",r),{code:P.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED};O.info(`joinLivingRoomAsAudience success, room data: ${JSON.stringify(i)}`);const o=new Ga(this._context,this._runtime,this._options,t,i,e);return this._crtAudienceLivingRoom=o,{room:o,code:P.SUCCESS,userIds:o.getRemoteUserIds(),RTCTracks:o.getRemoteRTCTracks(),MCUTracks:o.getRemoteMCUTracks(),CDNUris:o.getCDNInfo()}})}leaveLivingRoomAsAudience(t){return j(this,void 0,void 0,function*(){return this._crtAudienceLivingRoom?this._crtAudienceLivingRoom!==t?{code:P.PARAMS_ERROR}:(yield this._crtAudienceLivingRoom.__destroy(!0),this._crtAudienceLivingRoom=null,{code:P.SUCCESS}):{code:P.SUCCESS}})}upgradeToAnchorRoom(t){return j(this,void 0,void 0,function*(){if(!_t("room._roomId",t._roomId,Ft,!0))return{code:P.PARAMS_ERROR};if(this._crtRoom)return{code:P.REPERT_JOIN_ROOM};const{code:e,data:r}=yield this._context.rtcIdentityChange(t._roomId,Rr.ViewerToAnchor,t._livingType);if(e!==R.SUCCESS)return O.error("change room identity error",e),{code:P.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED};yield this._crtAudienceLivingRoom.__destroy(!1);const i=new we(this._context,this._runtime,t._roomId,r,this._service,this._options,this._releaseCrtRoomObj.bind(this),t._livingType,!0,!0);return this._crtRoom=i,this._crtAudienceLivingRoom=null,{room:i,code:P.SUCCESS,userIds:t.getRemoteUserIds(),tracks:i.getRemoteTracks()}})}downgradeToAudienceRoom(t){return j(this,void 0,void 0,function*(){if(!t.isMainRoom())return O.error("the `downgradeToAudienceRoom` is disabled in PK room"),{code:P.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(!_t("room._roomId",t._roomId,Ft,!0))return{code:P.PARAMS_ERROR};if(this._crtAudienceLivingRoom)return{code:P.REPERT_JOIN_ROOM};const{code:e,data:r}=yield this._context.rtcIdentityChange(t._roomId,Rr.AnchorToViewer,t.getLivingType());if(e!==R.SUCCESS)return O.error("change room identity error",e),{code:P.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED};O.info(`downgradeToAudienceRoom success, room data: ${JSON.stringify(r)}`);const i=new Ga(this._context,this._runtime,this._options,t._roomId,r,t.getLivingType());return this._crtAudienceLivingRoom=i,this._crtRoom.__destroy(!1),this._crtRoom=null,{room:i,code:P.SUCCESS,userIds:i.getRemoteUserIds(),RTCTracks:i.getRemoteRTCTracks(),MCUTracks:i.getRemoteMCUTracks(),CDNUris:i.getCDNInfo()}})}getJoinedRoomInfo(){return j(this,void 0,void 0,function*(){const{code:t,data:e}=yield this._context.getRTCJoinedUserInfo(this._context.getCurrentId());return t!==R.SUCCESS?(O.error("getJoinedUserInfo error",t),{code:P.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}):{code:P.SUCCESS,data:e}})}}var ja;(function(n){n[n.SERVER_KICK=1]="SERVER_KICK",n[n.OTHER_KICK=2]="OTHER_KICK"})(ja||(ja={}));const Eh={tag:"RCRTC",verify:n=>n.tag!=="browser"?(O.error(`RCRTC Plugin is not support the runtime '${n.tag}'`),!1):sh?(Sn.add("plugin-rtc","5.3.13"),!!Sn.validEngine(">=5.1.4")||(O.error(`The current engine version '${Sn.getInfo().engine}' error, plugin-rtc required engine version at least '>=5.1.4'.`),!1)):(O.error("Please use the https protocol or use `http://localhost` to open the page!"),!1),setup:(n,t,e={})=>(O.setLogLevel(e.logLevel),O.setLogStdout(e.logStdout),O.warn("RCRTC Version: 5.3.13, Commit: 367040ff8de440fde7e136452ae17b1eeea24c97"),O.warn(`browserInfo.browser -> ${Xt.browser}`),O.warn(`browserInfo.supportsUnifiedPlan -> ${Xt.supportsUnifiedPlan}`),O.warn(`browserInfo.version -> ${Xt.version}`),dt("options.mediaServer",e.mediaServer,r=>!(!Ue(r)||location.protocol==="https:"&&!/^https/.test(r))),dt("options.timeout",e.timeout,r=>mt(r)&&r>=5e3&&r<=3e4),dt("options.pingGap",e.pingGap,r=>mt(r)&&r>=3e3&&r<=1e4),new yh(n,t,e))},Ch={transResolution:de,transFrameRate:le,parseTrackId:bt,ifSupportLocalFileTrack:Eu,ifSupportScreenShare:Cu};function Rh(n,t,e){var r=e||{},i=r.noTrailing,o=i===void 0?!1:i,s=r.noLeading,c=s===void 0?!1:s,d=r.debounceMode,l=d===void 0?void 0:d,h,a=!1,u=0;function p(){h&&clearTimeout(h)}function f(_){var v=_||{},T=v.upcomingOnly,y=T===void 0?!1:T;p(),a=!y}function m(){for(var _=arguments.length,v=new Array(_),T=0;T<_;T++)v[T]=arguments[T];var y=this,w=Date.now()-u;if(a)return;function L(){u=Date.now(),t.apply(y,v)}function M(){h=void 0}!c&&l&&!h&&L(),p(),l===void 0&&w>n?c?(u=Date.now(),o||(h=setTimeout(l?M:L,n))):L():o!==!0&&(h=setTimeout(l?M:L,l===void 0?n-w:n))}return m.cancel=f,m}function Ih(n,t,e){var r=e||{},i=r.atBegin,o=i===void 0?!1:i;return Rh(n,t,{debounceMode:o!==!1})}const te=za({user:null});function bu(n){return{all:n=n||new Map,on:function(t,e){var r=n.get(t);r?r.push(e):n.set(t,[e])},off:function(t,e){var r=n.get(t);r&&(e?r.splice(r.indexOf(e)>>>0,1):n.set(t,[]))},emit:function(t,e){var r=n.get(t);r&&r.slice().map(function(i){i(e)}),(r=n.get("*"))&&r.slice().map(function(i){i(t,e)})}}}const qa={"RC:Chatroom:Welcome":"Welcome","RC:TxtMsg":"Text","RC:Chatroom:Barrage":"Barrage","RC:Chatroom:Like":"Like","RC:Chatroom:SeatsCtrl":"SeatsCtrl","RC:Chatroom:ChatBan":"ChatBan","RC:Chatroom:SeatApply":"SeatApply","RC:Chatroom:SeatResponse":"SeatResponse","RM:RTC:TrackUnpublish":"TrackUnpublish","RM:RTC:SwitchRole":"SwitchRole","RM:RTC:UserLeave":"UserLeave","RC:Chatroom:Leave":"Leave","RC:ForcedOffline":"ForcedOffline","RC:LookerLoginOut":"LookerLoginOut","RC:Chatroom:downSeat":"DownSeat","RC:Chatroom:MemberCountUp":"MemberCount"};var Mu=bu(),Au={exports:{}};(function(n,t){(function(e,r){n.exports=r()})(Yu,function(){var e=1e3,r=6e4,i=36e5,o="millisecond",s="second",c="minute",d="hour",l="day",h="week",a="month",u="quarter",p="year",f="date",m="Invalid Date",_=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},y=function(I,N,b){var k=String(I);return!k||k.length>=N?I:""+Array(N+1-k.length).join(b)+I},w={s:y,z:function(I){var N=-I.utcOffset(),b=Math.abs(N),k=Math.floor(b/60),U=b%60;return(N<=0?"+":"-")+y(k,2,"0")+":"+y(U,2,"0")},m:function I(N,b){if(N.date()<b.date())return-I(b,N);var k=12*(b.year()-N.year())+(b.month()-N.month()),U=N.clone().add(k,a),$=b-U<0,q=N.clone().add(k+($?-1:1),a);return+(-(k+(b-U)/($?U-q:q-U))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:a,y:p,w:h,d:l,D:f,h:d,m:c,s,ms:o,Q:u}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},L="en",M={};M[L]=T;var C=function(I){return I instanceof E},A=function(I,N,b){var k;if(!I)return L;if(typeof I=="string")M[I]&&(k=I),N&&(M[I]=N,k=I);else{var U=I.name;M[U]=I,k=U}return!b&&k&&(L=k),k||!b&&L},F=function(I,N){if(C(I))return I.clone();var b=typeof N=="object"?N:{};return b.date=I,b.args=arguments,new E(b)},G=w;G.l=A,G.i=C,G.w=function(I,N){return F(I,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var E=function(){function I(b){this.$L=A(b.locale,null,!0),this.parse(b)}var N=I.prototype;return N.parse=function(b){this.$d=function(k){var U=k.date,$=k.utc;if(U===null)return new Date(NaN);if(G.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var q=U.match(_);if(q){var X=q[2]-1||0,nt=(q[7]||"0").substring(0,3);return $?new Date(Date.UTC(q[1],X,q[3]||1,q[4]||0,q[5]||0,q[6]||0,nt)):new Date(q[1],X,q[3]||1,q[4]||0,q[5]||0,q[6]||0,nt)}}return new Date(U)}(b),this.$x=b.x||{},this.init()},N.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},N.$utils=function(){return G},N.isValid=function(){return this.$d.toString()!==m},N.isSame=function(b,k){var U=F(b);return this.startOf(k)<=U&&U<=this.endOf(k)},N.isAfter=function(b,k){return F(b)<this.startOf(k)},N.isBefore=function(b,k){return this.endOf(k)<F(b)},N.$g=function(b,k,U){return G.u(b)?this[k]:this.set(U,b)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(b,k){var U=this,$=!!G.u(k)||k,q=G.p(b),X=function(it,st){var ht=G.w(U.$u?Date.UTC(U.$y,st,it):new Date(U.$y,st,it),U);return $?ht:ht.endOf(l)},nt=function(it,st){return G.w(U.toDate()[it].apply(U.toDate("s"),($?[0,0,0,0]:[23,59,59,999]).slice(st)),U)},at=this.$W,et=this.$M,rt=this.$D,D="set"+(this.$u?"UTC":"");switch(q){case p:return $?X(1,0):X(31,11);case a:return $?X(1,et):X(0,et+1);case h:var J=this.$locale().weekStart||0,W=(at<J?at+7:at)-J;return X($?rt-W:rt+(6-W),et);case l:case f:return nt(D+"Hours",0);case d:return nt(D+"Minutes",1);case c:return nt(D+"Seconds",2);case s:return nt(D+"Milliseconds",3);default:return this.clone()}},N.endOf=function(b){return this.startOf(b,!1)},N.$set=function(b,k){var U,$=G.p(b),q="set"+(this.$u?"UTC":""),X=(U={},U[l]=q+"Date",U[f]=q+"Date",U[a]=q+"Month",U[p]=q+"FullYear",U[d]=q+"Hours",U[c]=q+"Minutes",U[s]=q+"Seconds",U[o]=q+"Milliseconds",U)[$],nt=$===l?this.$D+(k-this.$W):k;if($===a||$===p){var at=this.clone().set(f,1);at.$d[X](nt),at.init(),this.$d=at.set(f,Math.min(this.$D,at.daysInMonth())).$d}else X&&this.$d[X](nt);return this.init(),this},N.set=function(b,k){return this.clone().$set(b,k)},N.get=function(b){return this[G.p(b)]()},N.add=function(b,k){var U,$=this;b=Number(b);var q=G.p(k),X=function(et){var rt=F($);return G.w(rt.date(rt.date()+Math.round(et*b)),$)};if(q===a)return this.set(a,this.$M+b);if(q===p)return this.set(p,this.$y+b);if(q===l)return X(1);if(q===h)return X(7);var nt=(U={},U[c]=r,U[d]=i,U[s]=e,U)[q]||1,at=this.$d.getTime()+b*nt;return G.w(at,this)},N.subtract=function(b,k){return this.add(-1*b,k)},N.format=function(b){var k=this,U=this.$locale();if(!this.isValid())return U.invalidDate||m;var $=b||"YYYY-MM-DDTHH:mm:ssZ",q=G.z(this),X=this.$H,nt=this.$m,at=this.$M,et=U.weekdays,rt=U.months,D=function(st,ht,fe,ne){return st&&(st[ht]||st(k,$))||fe[ht].substr(0,ne)},J=function(st){return G.s(X%12||12,st,"0")},W=U.meridiem||function(st,ht,fe){var ne=st<12?"AM":"PM";return fe?ne.toLowerCase():ne},it={YY:String(this.$y).slice(-2),YYYY:this.$y,M:at+1,MM:G.s(at+1,2,"0"),MMM:D(U.monthsShort,at,rt,3),MMMM:D(rt,at),D:this.$D,DD:G.s(this.$D,2,"0"),d:String(this.$W),dd:D(U.weekdaysMin,this.$W,et,2),ddd:D(U.weekdaysShort,this.$W,et,3),dddd:et[this.$W],H:String(X),HH:G.s(X,2,"0"),h:J(1),hh:J(2),a:W(X,nt,!0),A:W(X,nt,!1),m:String(nt),mm:G.s(nt,2,"0"),s:String(this.$s),ss:G.s(this.$s,2,"0"),SSS:G.s(this.$ms,3,"0"),Z:q};return $.replace(v,function(st,ht){return ht||it[st]||q.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(b,k,U){var $,q=G.p(k),X=F(b),nt=(X.utcOffset()-this.utcOffset())*r,at=this-X,et=G.m(this,X);return et=($={},$[p]=et/12,$[a]=et,$[u]=et/3,$[h]=(at-nt)/6048e5,$[l]=(at-nt)/864e5,$[d]=at/i,$[c]=at/r,$[s]=at/e,$)[q]||at,U?et:G.a(et)},N.daysInMonth=function(){return this.endOf(a).$D},N.$locale=function(){return M[this.$L]},N.locale=function(b,k){if(!b)return this.$L;var U=this.clone(),$=A(b,k,!0);return $&&(U.$L=$),U},N.clone=function(){return G.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},I}(),S=E.prototype;return F.prototype=S,[["$ms",o],["$s",s],["$m",c],["$H",d],["$W",l],["$M",a],["$y",p],["$D",f]].forEach(function(I){S[I[1]]=function(N){return this.$g(N,I[0],I[1])}}),F.extend=function(I,N){return I.$i||(I(N,E,F),I.$i=!0),F},F.locale=A,F.isDayjs=C,F.unix=function(I){return F(1e3*I)},F.en=M[L],F.Ls=M,F.p={},F})})(Au);var Sh=Au.exports;let Ai=!1;const wu="start-live-time",Pu="start-live-status",Oh="video-deviceId",Nh="audio-deviceId",np="audio-deviceId2",bh="audio-device-volume",z=za({roomUid:sessionStorage.getItem("roomUid")||"",imConnectStatus:"connecting",screenShareStatus:!1,videoRef:zu(null),rtcClient:null,joinedRoom:null,mediaStreamTrack:[],mediaStreams:null,videoStatus:"init",microphones:[],cameras:[],selectedCamera:null,selectedMicrophone:null,selectedMicrophone2:null,likeCount:0,lookCount:0,lastLikeCount:0,activeTracks:{},allowSeatsCtrl:!0,allowChatCtrl:!0,deviceStatus:{microphone:"init",camera:"init",screen:"init"},syncLikeTimer:null}),Mh="c9kqb3rdc451j";Al({appkey:Mh});const Ah=pe("RC:Chatroom:SeatsCtrl",!0,!0),wh=pe("RC:Chatroom:ChatBan",!0,!0),Ph=pe("RC:Chatroom:SeatApply",!0,!0),Lh=pe("RC:Chatroom:SeatResponse",!0,!0),Uh=pe("RC:Chatroom:MemberCount",!0,!0),Dh=pe("RC:Chatroom:SeatMember",!0,!0),kh=pe("RC:Chatroom:LikeCount",!0,!0),xh=pe("RC:Chatroom:Welcome",!0,!0),Vh=pe("RC:Chatroom:PauseLive",!0,!0),Bh=bu(),qn=yt,Ps=qn,{MESSAGES:rp}=Ps,Fh=ws(Ps,["MESSAGES"]);Kn(qn.MESSAGES,n=>{var e;console.log(n,"\u6536\u5230\u6D88\u606F");const{messages:t}=n;for(const r of t)!(r.senderUserId&&Number(r.senderUserId)===((e=te.user)==null?void 0:e.speakerId)&&r.messageType!=="RC:ForcedOffline")&&qa[r.messageType]&&Mu.emit(qa[r.messageType],Ve(oe({},r.content),{$EventMessage:r}))});for(const n of Object.values(Fh))Kn(n,t=>{console.log(n,t),Mu.emit(n,{$EventMessage:null})});Kn(qn.CONNECTING,()=>{console.log("connecting"),z.imConnectStatus="connecting"});Kn(qn.CONNECTED,()=>{console.log("connected"),z.imConnectStatus="connected"});Kn(qn.DISCONNECT,()=>{console.log("disconnect"),z.imConnectStatus="disconnect",Lu(!0,"IM");const n=Se.parse(window.location.search);console.log(n,"disconnect"),window.location.href=window.location.origin+"/live?"+Se.stringify(Ve(oe({},n),{time:new Date().getTime()}))});const ip=async n=>{var t;try{const e=await Pl(n);return z.rtcClient=wl(Eh,{}),console.log("connect success",(t=e.data)==null?void 0:t.userId),e}catch(e){throw e}},op=n=>{localStorage.setItem(bh,n.toString()),z.videoRef&&(z.videoRef.volume=n/100),z.activeTracks.microphone._element&&(z.activeTracks.microphone._element.volume=n/100)},Hh=async()=>{var n;if(z.screenShareStatus){ve.error("\u6B63\u5728\u5C4F\u5E55\u5171\u4EAB\u4E2D\uFF0C\u8BF7\u5148\u5173\u95ED\u5C4F\u5E55\u5171\u4EAB");return}if(z.rtcClient&&!z.screenShareStatus&&z.videoStatus==="liveing"){let t;try{t=await ci("screen")}catch{ve.error("\u5C4F\u5E55\u5206\u4EAB\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6388\u6743")}if(!t)return;const e=z.activeTracks.camera;e&&await((n=z.joinedRoom)==null?void 0:n.unpublish([e])),Oe([t],"screen"),z.videoRef&&(t==null||t.play(z.videoRef),z.screenShareStatus=!0),t==null||t.on(gt.EVENT_LOCAL_TRACK_END,r=>{z.screenShareStatus=!1,r.destroy(),e&&(Oe([e],"camera"),z.videoRef&&e.play(z.videoRef))})}},$h=()=>{document.exitPictureInPicture();const n=z.activeTracks.screen;n&&(n.destroy(),z.screenShareStatus=!1);const t=z.activeTracks.camera;t&&(Oe([t],"camera"),z.videoRef&&t.play(z.videoRef))},Gh=n=>{const t=document.createElement("video");t.style.display="none",document.body.append(t),t.srcObject=n,t.play(),setTimeout(()=>{t.requestPictureInPicture()},1e3)},Kh=async()=>{if(z.screenShareStatus)try{await Ja.confirm("\u662F\u5426\u786E\u8BA4\u53D6\u6D88\u5C4F\u5E55\u5171\u4EAB?"),$h()}catch{}else Hh(),Gh(z.activeTracks.camera._msStream),console.log(z.activeTracks.camera)},sp=async()=>{const n=await Rs.getMicrophones();return z.microphones=n,n},ap=async()=>{const n=await Rs.getCameras();return z.cameras=n,n},cp=async n=>{z.selectedCamera=n,localStorage.setItem(Oh,n.deviceId);const t=z.activeTracks.camera;t&&await ui([t],"camera",t.isPublished());const e=await ci("camera");Oe([e],"camera",z.videoStatus==="liveing")},up=async n=>{z.selectedMicrophone=n,localStorage.setItem(Nh,n.deviceId);const t=z.activeTracks.microphone;t&&await ui([t],"microphone",t.isPublished());const e=await ci("microphone");Oe([e],"microphone",z.videoStatus==="liveing"),Bh.emit("microphoneChange",n)},ci=async n=>{var r,i,o,s,c,d,l;let t,e=null;if(n==="microphone"?t=await((i=z.rtcClient)==null?void 0:i.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:(r=z.selectedMicrophone)==null?void 0:r.deviceId,sampleRate:Number(localStorage.getItem("sampleRate")||"48000")||48e3,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1})):n==="microphone2"?(console.log("microphone2"),t=await((s=z.rtcClient)==null?void 0:s.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:(o=z.selectedMicrophone2)==null?void 0:o.deviceId,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}))):n==="camera"?t=await((d=z.rtcClient)==null?void 0:d.createCameraVideoTrack("RongCloudRTC",{cameraId:(c=z.selectedCamera)==null?void 0:c.deviceId,faceMode:"user",frameRate:ie.FPS_30,resolution:Et.W1280_H720})):t=await((l=z==null?void 0:z.rtcClient)==null?void 0:l.createScreenVideoTrack("screenshare",{frameRate:ie.FPS_30,resolution:Et.W1280_H720})),e=t==null?void 0:t.track,(n==="camera"&&!z.cameras.length||(n==="microphone"||n==="microphone2")&&!z.microphones.length||n==="screen"&&!z.screenShareStatus)&&(z.deviceStatus[n]="none"),t.code===P.PERMISSION_DENIED?z.deviceStatus[n]="denied":z.deviceStatus[n]="granted",t.code===P.GET_DISPLAY_MEDIA_FAILED)throw new Error("\u83B7\u53D6\u5C4F\u5E55\u5171\u4EAB\u5931\u8D25");return e},dp=(n,t)=>{const e=window.AudioContext,r=new e,i=r.createMediaStreamSource(n),o=r.createAnalyser();i.connect(o),o.fftSize=2048,o.minDecibels=-90,o.maxDecibels=-10,o.smoothingTimeConstant=.85;const s=r.createScriptProcessor(4096,1,1);return s.connect(r.destination),i.connect(s),s.onaudioprocess=c=>Ih(200,()=>{var a;const d=c.inputBuffer.getChannelData(0);for(var l=0,h=0;h<d.length;h++)l<d[h]&&(l=d[h]);t(l*100,(a=n.getAudioTracks()[0])==null?void 0:a.label)})(),s},Oe=async(n,t,e=!0)=>{var i,o;const r=n.filter(s=>!!s);for(const s of r)z.activeTracks[t]=s;if(t==="camera"&&z.videoRef&&((i=z.activeTracks[t])==null||i.play(z.videoRef)),e)try{const s=await((o=z.joinedRoom)==null?void 0:o.publish(n.filter(c=>!!c)));console.log(s,"pub"),(s==null?void 0:s.code)!==P.SUCCESS&&!Ai&&(Ai=!0,window.onbeforeunload=null,Ja.alert("\u89C6\u9891\u63A8\u6D41\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u65B0\u5F00\u542F?","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",callback:()=>{Ai=!1,window.location.reload()}}))}catch(s){console.log(s,"err")}},ui=async(n,t,e=!0)=>{var i;const r=n.filter(o=>!!o);e&&await((i=z.joinedRoom)==null?void 0:i.unpublish(r));for(const o of r)o==null||o.destroy(),z.activeTracks[t]=null},jh=async(n,t,e)=>{var i,o;await Ul(n,{count:-1});const r=await((i=z.rtcClient)==null?void 0:i.joinLivingRoom(n,t));if((r==null?void 0:r.code)!=P.SUCCESS)throw Error("\u52A0\u5165\u623F\u95F4\u5931\u8D25");return(o=r.room)==null||o.registerRoomEventListener(e),r},lp=async(n,t,e)=>await jh(n,t,e),hp=async(n=!0)=>{var e;if(z.videoStatus!=="stream"){const r="\u8BF7\u786E\u5B9A\u6444\u50CF\u5934\u5DF2\u7ECF\u5F00\u542F";throw ve.error(r),Error(r)}z.joinedRoom&&(await Oe([z.activeTracks.camera],"camera"),await Oe([z.activeTracks.microphone],"microphone"),await gn.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"1",roomUid:z.roomUid,userId:(e=te.user)==null?void 0:e.speakerId}}),z.videoStatus="liveing"),n&&sessionStorage.setItem(wu,Sh().valueOf().toString()),sessionStorage.setItem(Pu,"liveing")},Lu=async(n=!1,t="Logout")=>{var e,r;try{t==="Logout"&&await gn.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"2",roomUid:z.roomUid,userId:(e=te.user)==null?void 0:e.speakerId}})}catch{}sessionStorage.removeItem(wu),sessionStorage.removeItem(Pu);for(const i in z.activeTracks)if(Object.prototype.hasOwnProperty.call(z.activeTracks,i)){const o=z.activeTracks[i];o&&(await((r=z.joinedRoom)==null?void 0:r.unpublish([o])),n&&await ui([o],i))}z.videoStatus="stream"},qh=async()=>{if(te.user&&z.joinedRoom)try{await gn.get("/api-web/imLiveBroadcastRoom/syncLike",{hideLoading:!0,hideMessage:!0,params:{likeNum:z.likeCount,roomUid:z.roomUid}}),z.lastLikeCount=z.likeCount,zh({count:z.likeCount},"LikeCount")}catch{}z.syncLikeTimer=setTimeout(()=>{qh()},1e3*10)},Yh=()=>{var n,t,e,r;return{id:String((n=te.user)==null?void 0:n.speakerId),name:(t=te.user)==null?void 0:t.speakerName,userId:String((e=te.user)==null?void 0:e.speakerId),userName:(r=te.user)==null?void 0:r.speakerName}},zh=async(n,t="text")=>{var i;let e=null;if(!n)return;const r={conversationType:Y.CHATROOM,targetId:(i=z.joinedRoom)==null?void 0:i.getRoomId()};if(t==="text"?e=new Vl({user:Yh(),content:n}):t==="SeatsCtrl"?e=new Ah(n):t==="ChatBan"?e=new wh(n):t==="SeatApply"?e=new Ph(n):t==="SeatResponse"?e=new Lh(n):t==="MemberCount"?e=new Uh(n):t==="SeatMember"?e=new Dh(n):t==="LikeCount"?e=new kh(n):t==="Welcome"?e=new xh(n):t==="PauseLive"&&(e=new Vh(n)),!!e)return console.log(e),await xc(r,e)},Jh=async(n,t=!0)=>{var e;if((n==="microphone"||n==="microphone2")&&z.activeTracks[n])(e=z.activeTracks[n])==null||e.unmute();else{const r=await ci(n);await Oe([r],n,t),z.videoRef&&(r==null||r.play(z.videoRef))}},_o=async(n,t=!0)=>{const e=z.activeTracks[n];n!=="microphone"&&n!=="microphone2"?await ui([e],n,t):e==null||e.mute()},pp=async n=>{if(z.screenShareStatus){await Kh();return}const t=z.activeTracks[n],e=z.videoStatus==="liveing";t?(n==="camera"&&(z.deviceStatus.camera="closed"),_o(n,e)):(n==="camera"&&(z.deviceStatus.camera="granted"),Jh(n,e))},Wh=async(n="Logout")=>{var t;await Lu(!0,n),z.joinedRoom&&(await((t=z.rtcClient)==null?void 0:t.leaveRoom(z.joinedRoom)),z.joinedRoom=null,await Ll(),z.imConnectStatus="disconnect")},gn=Ju({requestType:"form",timeout:1e4});gn.interceptors.request.use((n,t)=>{t.hideLoading||!1||sd();const r=Wa(),i=localStorage.getItem("tenantId")||"",o=localStorage.getItem("organId")||"",s={};return r&&!["/api-auth/usernameLogin","/api-auth/smsLogin","/api-auth/code/sendSms"].includes(n)&&(s.Authorization=r),i&&(s.tenantId=i),o&&(s.organId=o),{url:n,options:Ve(oe({},t),{params:Wu(t.params),headers:oe(oe({},t.headers),s)})}});gn.interceptors.response.use(async(n,t)=>{setTimeout(()=>{ad()},200);let e=t.hideMessage||!1;if(new URL(n.url),n.status>299||n.status<200){const i="\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u72B6\u6001\u7801"+n.status;throw e||ve.error(i),new Error(i)}const r=await n.clone().json();if(r.code!==200&&r.errCode!==0){const i=r.msg||"\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";if(r.code===401||r.code===403){e||ve.error("\u767B\u5F55\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\uFF01");try{await Wh("IM"),_o("camera"),_o("microphone"),te.user=null}catch{}z.syncLikeTimer&&clearTimeout(z.syncLikeTimer),Za();const o=Se.parse(window.location.search);console.log(o,"disconnect"),window.location.href=window.location.origin+"/live?"+Se.stringify(Ve(oe({},o),{time:new Date().getTime()}))}throw r.code===404&&(e||ve.error("\u8BF7\u6C42\u8D44\u6E90\u4E0D\u5B58\u5728\uFF01"),Gr.push("/404")),r.code===403||r.code===401||e||ve.error(i),new Error(i)}return n});const Zh=["/login"];Gr.beforeEach(async(n,t,e)=>{var i;if(Wa())if(n.path==="/login")e({path:"/"});else if((i=te.user)==null?void 0:i.speakerId)e();else try{const s=sessionStorage.getItem("roomUid"),c=await gn.get("/api-web/imLiveBroadcastRoom/speakerJoinRoom",{params:{roomUid:s}});te.user=c.data,e(Ve(oe({},n),{replace:!0}))}catch(s){s.msg&&ve.error(s.msg),Za(),e(`/login?${Se.stringify(n.query)}`)}else Zh.indexOf(n.path)!==-1?e():e(`/login?${Se.stringify(n.query)}`)});Gr.afterEach(()=>{});Zu(Xu).use(od).use(Gr).mount("#app");export{Nh as A,lp as B,ue as C,Oe as D,bh as E,Yh as F,ep as G,P as I,qa as L,id as S,Oh as V,Xh as __vite_legacy_guard,z as a,Za as b,_o as c,hp as d,Mu as e,Lu as f,zh as g,Bh as h,dp as i,op as j,cp as k,Wh as l,up as m,wu as n,Jh as o,Sh as p,qh as q,gn as r,te as s,pp as t,np as u,Pu as v,ip as w,sp as x,ap as y,ci as z};
|