123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927 |
- var ou=Object.defineProperty,su=Object.defineProperties;var au=Object.getOwnPropertyDescriptors;var kn=Object.getOwnPropertySymbols;var Wo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable;var Jo=(n,e,t)=>e in n?ou(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Xe=(n,e)=>{for(var t in e||(e={}))Wo.call(e,t)&&Jo(n,t,e[t]);if(kn)for(var t of kn(e))Zo.call(e,t)&&Jo(n,t,e[t]);return n},At=(n,e)=>su(n,au(e));var Qo=(n,e)=>{var t={};for(var r in n)Wo.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&kn)for(var r of kn(n))e.indexOf(r)<0&&Zo.call(n,r)&&(t[r]=n[r]);return t};import{d as ma,q as Ct,c as es,w as ts,u as ns,E as cu,r as uu,o as rs,a as ui,b as du,z as lu,e as hu,f as pu,m as fu,g as gu,h as _a,i as mu,j as _u,k as va,l as ht,n as vu,s as Ru,p as Cu}from"./vendor.db8201e1.js";function mh(){import("data:text/javascript,")}const yu=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 t(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=t(i);fetch(i.href,o)}};yu();if(typeof window!="undefined"){let n=function(){var e=document.body,t=document.getElementById("__svg__icons__dom__");t||(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.style.position="absolute",t.style.width="0",t.style.height="0",t.id="__svg__icons__dom__",t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),t.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>',e.insertBefore(t,e.lastChild)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n):n()}const Eu=ma({setup(n){const e=Ct.parse(location.search),t=location.href.split("#/")[1],r=Ct.parse(t.split("?")[1]),i=e.roomUid||r.roomUid||"";return i&&sessionStorage.setItem("roomUid",i),(o,s)=>{const u=uu("router-view");return rs(),es(ns(cu),{locale:ns(lu),message:{max:1}},{default:ts(()=>[ui(u,null,{default:ts(({Component:d})=>[(rs(),es(du(d)))]),_:1})]),_:1},8,["locale"])}}}),Tu="modulepreload",is={},Su="./",qr=function(e,t){return!t||t.length===0?e():Promise.all(t.map(r=>{if(r=`${Su}${r}`,r in is)return;is[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":Tu,i||(s.as="script",s.crossOrigin=""),s.href=r,document.head.appendChild(s),i)return new Promise((u,d)=>{s.addEventListener("load",u),s.addEventListener("error",d)})})).then(()=>e())};function Iu(n){switch(n){case"../src/pages/404/index.tsx":return qr(()=>import("./index.1d1c98c5.js"),["assets/index.1d1c98c5.js","assets/index.49150f4c.css","assets/vendor.db8201e1.js"]);case"../src/pages/home/index.tsx":return qr(()=>import("./index.fd159c49.js"),["assets/index.fd159c49.js","assets/index.b94cb86f.css","assets/vendor.db8201e1.js"]);case"../src/pages/login/index.tsx":return qr(()=>import("./index.8761ed12.js"),["assets/index.8761ed12.js","assets/index.526ec19c.css","assets/vendor.db8201e1.js"]);default:return new Promise(function(e,t){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(t.bind(null,new Error("Unknown variable dynamic import: "+n)))})}}const Dn=n=>async()=>{let e=Promise.resolve(null);try{e=await Iu(`../src/pages/${n}/index.tsx`)}catch{e=Promise.reject()}return e};var bu=[{path:"/",component:Dn("home")},{path:"/home",component:Dn("home")},{path:"/login",component:Dn("login")},{path:"/:pathMatch(.*)*",component:Dn("404"),meta:{title:"404 Not Fund"}}],br=hu({history:pu(),routes:bu}),Ou=ma({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:e,color:t}=this,r=`#${e}-${n}`;return ui("svg",fu(this.$attrs,{onClick:this.onClick,"aria-hidden":"true",style:{color:t}}),[ui("use",{href:r,fill:t},null)])}}),Nu={install(n){n.component("SvgIcon",Ou)}};const Ki="live_admin_token",Ra=()=>sessionStorage.getItem(Ki);function vh(n){return sessionStorage.setItem(Ki,n)}function Ca(){return sessionStorage.removeItem(Ki)}let ln=0,ya;const wu=n=>{if(ln===0){const e=Object.assign({lock:!0,text:"\u52A0\u8F7D\u4E2D...",background:"rgba(0, 0, 0, 0.7)"},n);ya=gu.service(Xe({},e))}ln++},Mu=()=>{ln<=0||(ln--,ln===0&&ya.close())};var di;(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"})(di||(di={}));var lt,Gr,_n=di,Au=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],Pu=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],Lu=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],os={"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}},ku=["RC:TypSts","RC:InterceptMsg"];(function(n){n.WEBSOCKET="websocket",n.COMET="comet"})(lt||(lt={}));var Or=function(n){return Gr||(Gr={set:function(e,t){n.localStorage.setItem(e,JSON.stringify(t))},get:function(e){var t;try{t=JSON.parse(n.localStorage.getItem(e))}catch{t=null}return t},remove:function(e){return n.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var t in n.localStorage)e.push(t);return e}}),Gr},Du=function(){function n(e){this._caches={},e&&(this._caches=e)}return n.prototype.set=function(e,t){this._caches[e]=t},n.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},n.prototype.get=function(e){return this._caches[e]},n.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},n}(),ss=function(){function n(e,t){var r,i=t?"RCV4-"+t:"RCV4-";this._rootStorage=Or(e);var o=this._rootStorage.get(i)||{};this._cache=new Du(((r={})[i]=o,r)),this._storageKey=i}return n.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},n.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},n.prototype.set=function(e,t){var r=this._get();r[e]=t,this._set(r)},n.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},n.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},n.prototype.get=function(e){return this._get()[e]},n.prototype.getKeys=function(){var e=this._get(),t=[];for(var r in e)t.push(r);return t},n.prototype.getValues=function(){return this._get()||{}},n}(),Ea=function(n,e){return(Ea=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])})(n,e)};function Re(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Ea(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var fe=function(){return(fe=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}).apply(this,arguments)};function V(n,e,t,r){return new(t||(t=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function u(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 t?h:new t(function(a){a(h)})).then(s,u)}d((r=r.apply(n,e||[])).next())})}function B(n,e){var t,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(l){return function(h){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=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=e.call(n,s)}catch(a){h=[6,a],r=0}finally{t=i=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([d,l])}}}function bt(n,e){for(var t=0,r=e.length,i=n.length;t<r;t++,i++)n[i]=e[t];return n}var Te,ir;(function(n){function e(t){return n.call(this,"TODO => "+t)||this}return Re(e,n),e})(Error);var as=function(n,e,t){if(e===void 0||t===void 0)return n.toUpperCase();var r=n.slice(e,t);return n=n.replace(r,function(i){return i.toUpperCase()})},Ta=function(n,e){e===void 0&&(e="utf-8");var t,r=0;if(e==="utf-16")for(var i=0,o=n.length;i<o;i++)r+=(t=n.charCodeAt(i))<=65535?2:4;else for(i=0,o=n.length;i<o;i++)r+=(t=n.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return r},Nr=function(n,e){if(n=n.replace(/\?$/,""),!e)return n;var t=Object.keys(e).map(function(r){return r+"="+e[r]}).filter(function(r){return!!r});return t.length?[n,t.join("&")].join("?"):n},qi=function(n){return n.match(/\d+(\.\d+){2}/)[0]};(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.NONE=1e3]="NONE"})(Te||(Te={})),function(n){n.IM="IM",n.RTC="RTC"}(ir||(ir={}));var Bt="RC_Logs";function Uu(n){var e=n.target.result;n.oldVersion===1&&e.deleteObjectStore(Bt),function(t,r,i){var o;if(!t.objectStoreNames.contains(r)){var s=fe({},i.objectStoreParams);o=t.createObjectStore(r,s),i.indexs&&i.indexs.length>0&&i.indexs.forEach(function(u){o.createIndex(u.indexName,u.key,{unique:u.unique})})}}(e,Bt,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var li,Gi=function(){function n(){}return n.init=function(){if(typeof window!="undefined"&&window&&window.indexedDB){var e=window.indexedDB.open("RC_ENGINE_DB",2);e.onerror=function(t){console.warn("open indexDB request failed "+t.target.error)},e.onsuccess=function(t){n._db=t.target.result,n._db&&(n._db.onclose=function(r){var i;console.warn("The database "+((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 "+((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 "+((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},e.onupgradeneeded=function(t){n._db=t.target.result,Uu(t)}}else console.debug("IndexDB is not currently supported in the environment!")},n.getInstance=function(){return n._instance},n.prototype.addList=function(e,t){return new Promise(function(r){if(n._db){var i=n._db.transaction([e],"readwrite"),o=i.objectStore(e);t.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(e,t,r,i){return new Promise(function(o){if(n._db){var s=n._db.transaction([e],"readwrite").objectStore(e),u=IDBKeyRange.bound(r,i),d=s.index(t),l=[],h=d.openCursor(u);h.onsuccess=function(a){var c=a.target.result;c?(l.push(c.value),c.continue()):o(l)},h.onerror=function(a){console.error(a),o([])}}else o([])})},n.prototype.getCount=function(e,t){return new Promise(function(r){if(n._db){var i=n._db.transaction([e],"readonly").objectStore(e).count();i.onsuccess=function(){r(i.result)},i.onerror=function(o){console.error(o),r(0)}}else r(0)})},n.prototype.removeFirstData=function(e,t,r){return new Promise(function(i){if(n._db){var o=n._db.transaction([e],"readwrite").objectStore(e),s=o.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var u=s.result;u.length>0&&(o.delete(IDBKeyRange.bound(u[0],u[u.length-1])).onsuccess=function(){i(!0)})}}else i(!1)})},n._db=null,n}(),Sa=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var e=16*Math.random()|0;return(n==="x"?e:3&e|8).toString(16)})},Ia=function(){var n=Sa();if(n=n.replace(/-/g,"")+"a",(n=function(r){var i="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),o=i.length+1,s=+r,u=[];do{var d=s%o;s=(s-d)/o,u.unshift(i[d])}while(s);return u.join("")}(n=parseInt(n,16))).length>22&&(n=n.slice(0,22)),n.length<22)for(var e=22-n.length,t=0;t<e;t++)n+="0";return n};(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.RTC_ROOM=12]="RTC_ROOM"})(li||(li={}));var hi,ee=li;(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"})(hi||(hi={}));var Pt,pi,Se=hi,Be=function(n){return typeof n=="string"},or=function(n){return typeof n=="boolean"},_e=function(n){return typeof n=="number"&&!isNaN(n)},Ue=function(n){return Object.prototype.toString.call(n).indexOf("Array")!==-1},ba=function(n){return Object.prototype.toString.call(n)==="[object ArrayBuffer]"},Ve=function(n){return Be(n)&&n.length>0},Ne=function(n){return Object.prototype.toString.call(n)==="[object Object]"},sr=function(n){return Object.prototype.toString.call(n)==="[object Function]"},le=function(n){return n===void 0||Object.prototype.toString.call(n)==="[object Undefined]"},cs=function(n){return Object.prototype.toString.call(n)==="[object Null]"},vn=function(n){return Be(n)&&/https?:\/\//.test(n)},hn=function(n){for(var e in n)return!0;return!1},xu=function(n){return _e(n)&&Object.prototype.hasOwnProperty.call(Se,n)},us=((Pt={})[Te.DEBUG]=console.debug.bind(console),Pt[Te.INFO]=console.info.bind(console),Pt[Te.WARN]=console.warn.bind(console),Pt[Te.ERROR]=console.error.bind(console),Pt[Te.FATAL]=console.log.bind(console),Pt),ds=function(n){return Be(n)||_e(n)||le(n)||or(n)?n:n instanceof Error?JSON.stringify({name:n.name,message:n.message,stack:n.stack}):JSON.stringify(n)},Rt=function(){function n(e,t,r){this.tag=e,this.type=t,this.initiator=r,this._outLevel=Te.WARN,this.debug=this.log.bind(this,Te.DEBUG),this.info=this.log.bind(this,Te.INFO),this.warn=this.log.bind(this,Te.WARN),this.error=this.log.bind(this,Te.ERROR),this.fatal=this.log.bind(this,Te.FATAL)}return n.init=function(e){n.userId=e},n.reset=function(){n.userId=""},n.prototype._defaultStdout=function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];us[e].apply(us,bt([t+":"],r))},n.prototype.__pushLocalLog=function(e,t,r){var i;i=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?ir.RTC:ir.IM;var o=Date.now();Ta(t)>=1e3&&(t=function(l,h,a){if(a===void 0&&(a="utf-8"),!l||!h)return"";var c=a==="utf-8"?3:2,p=0,f=0,m="";for(f=0;f<l.length;f++){if(l.charCodeAt(f)>255?p+=c:p++,p>h)return m;m+=l.charAt(f)}return l}(t,1e3));var s=JSON.stringify({message:t,userId:n.userId}).replace(/"/g,'""'),u=/^[\w]+-[\w]+-[\w]+?/.test(r)?r:(this.initiator||"L")+"-"+r+"-O",d={sessionId:n.sessionId,time:o,level:4-e,content:n.sessionId+","+Date.now()+","+i+","+(4-e)+","+u+',"'+s+`"
- `,userId:n.userId};n.databaseLogList.push(d),(n.databaseLogList.length>=100||e===Te.FATAL)&&this.__insertLogIntoDatabase()},n.prototype.__insertLogIntoDatabase=function(){return V(this,void 0,void 0,function(){var e,t,r;return B(this,function(i){switch(i.label){case 0:return e=bt([],n.databaseLogList),n.databaseLogList=[],(t=Gi.getInstance())?[4,t.addList(Bt,e)]:[3,3];case 1:return r=i.sent(),[4,t.getCount(Bt,"time")];case 2:return i.sent()>1e5&&t.removeFirstData(Bt,"time",2e3),[2,r];case 3:return[2,!1]}})})},n.prototype.setLogLevel=function(e){this._outLevel=typeof e!="number"?Te.WARN:e},n.prototype.setLogStdout=function(e){this._logStdout=e},n.prototype.log=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(e>Te.DEBUG&&this.__pushLocalLog(e,t.map(ds).join(" "),this.tag),!(e<this._outLevel)){var i=new Date().toISOString()+"["+this.tag+"]["+Te[e]+"]",o=i+" - "+t.map(ds).join(" ");this._logStdout?this._logStdout(e,o):this._stdout?this._stdout(e,o):this._defaultStdout.apply(this,bt([e,i],t))}},n.prototype.reportLog=function(e,t,r){this.__pushLocalLog(4-e,r,t);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'+i+'"';var o={level:e,content:[n.sessionId,Date.now(),this.type,e,t,i].join()+`
- `};n.realTimeLogList.push(o),n.realTimeLogList.length>=600&&(n.realTimeLogList=n.realTimeLogList.slice(-500))},n.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},n.prototype.setStdout=function(e){this._stdout=e},n.prototype.__clearRealTimeLog=function(){n.realTimeLogList=[]},n.databaseLogList=[],n.realTimeLogList=[],n.sessionId=Ia(),n.userId="",n}(),G=new Rt("RCLog"),On=function(){function n(){this._map={}}return n.prototype.on=function(e,t,r){var i=this._map[e]||(this._map[e]=[]);i.some(function(o){return o.listener===t&&o.target===r})||i.push({listener:t,target:r})},n.prototype.once=function(e,t,r){var i=this._map[e]||(this._map[e]=[]);i.some(function(o){return o.listener===t&&o.target===r})||i.push({listener:t,target:r,once:!0})},n.prototype.off=function(e,t,r){var i=this._map[e];i&&((i=i.filter(function(o){return o.listener!==t||o.target!==r})).length?this._map[e]=i:delete this._map[e])},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i=this._map[e];if(i)for(var o=i.length-1;o>=0;o-=1){var s=i[o],u=s.target,d=s.once,l=s.listener;d&&i.splice(o,1);try{l.call.apply(l,bt([u],t))}catch(h){G.error(h)}}},n.prototype.removeAll=function(e){delete this._map[e]},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"})(pi||(pi={}));var fi,je=pi;(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.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.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"})(fi||(fi={}));var gi,b=fi;(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"})(gi||(gi={}));var mi,se=gi,we={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"})(mi||(mi={}));var _i,Ae=mi;(function(n){n[n.OPEN=1]="OPEN",n[n.CLOSE=2]="CLOSE"})(_i||(_i={}));var vi,Ut=_i;(function(n){n[n.ALL=1]="ALL",n[n.SINGAL=2]="SINGAL"})(vi||(vi={}));var Ri,Yi=vi;(function(n){n[n.QINIU=1]="QINIU",n[n.ALI=2]="ALI",n[n.AWS=3]="AWS",n[n.STC=4]="STC"})(Ri||(Ri={}));var Ci,De=Ri;(function(n){n[n.UPDATE=1]="UPDATE",n[n.DELETE=2]="DELETE"})(Ci||(Ci={}));var yi,xe=Ci;(function(n){n[n.QUIT=0]="QUIT",n[n.JOIN=1]="JOIN"})(yi||(yi={}));var ls,hs=yi;(function(n){/*!
- 全局敏感词:命中了融云内置的全局敏感词
- */n[n.GLOBAL=1]="GLOBAL",n[n.CUSTOM=2]="CUSTOM",n[n.THIRD_PARTY=3]="THIRD_PARTY"})(ls||(ls={}));var Le,ps,fs;(function(n){n[n.RTC=0]="RTC",n[n.LIVE=2]="LIVE"})(Le||(Le={})),function(n){n[n.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",n[n.AUDIO=1]="AUDIO"}(ps||(ps={})),function(n){n[n.ANCHOR=1]="ANCHOR",n[n.AUDIENCE=2]="AUDIENCE"}(fs||(fs={}));var nt,ar,Ei,Vu={"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"})(nt||(nt={})),function(n){n[n.AnchorToViewer=1]="AnchorToViewer",n[n.ViewerToAnchor=2]="ViewerToAnchor"}(ar||(ar={})),function(n){n[n.KICK=0]="KICK",n[n.REFUSE=1]="REFUSE",n[n.COEXIST=2]="COEXIST"}(Ei||(Ei={}));var et,Ee,Yr={engine:"5.1.1"},Ot=function(){function n(){}return n.add=function(e,t){Yr[e]=t},n.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return G.warn("The validation engine version '"+e+"' is invalid!"),!1;var r=t[0].split(".").map(function(i){return i.padStart(3,"0")}).join("");return Yr.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map(function(i){return i.padStart(3,"0")}).join("")>=r},n.getInfo=function(){return Yr},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"})(Ee||(Ee={}));var st,Me,Fe,Nt,St,Bu=((et={})[Ee.STRING]=Ve,et[Ee.ONLY_STRING]=Be,et[Ee.NUMBER]=_e,et[Ee.BOOLEAN]=function(n){return typeof n=="boolean"},et[Ee.OBJECT]=Ne,et[Ee.ARRAY]=Ue,et[Ee.CALLBACK]=function(n){var e=!0;return Ne(n)||(e=!1),(n=n||{}).onSuccess&&!sr(n.onSuccess)&&(e=!1),n.onError&&!sr(n.onError)&&(e=!1),e},et[Ee.CHANNEL_ID]=function(n){var e=!1;return Be(n)&&!/_/g.test(n)&&n.length<=20&&(e=!0),e},et),Fu=function(n){function e(t){var r=n.call(this,t)||this;return r.name="RCAssertError",r}return Re(e,n),e}(Error),Ie=function(n,e,t,r){if(r===void 0&&(r=!1),!me(n,e,t,r))throw new Fu("'"+n+"' is invalid: "+JSON.stringify(e))},me=function(n,e,t,r){r===void 0&&(r=!1),t=Bu[t]||t;var i=r&&!t(e)||!r&&!(le(e)||e===null||t(e));return i&&G.error("'"+n+"' is invalid: "+JSON.stringify(e)),!i},$e=function(n){if(!Ne(n)||n.low===void 0||n.high===void 0)return n;var e=n.low;return e<0&&(e+=4294967296),e=e.toString(16),parseInt(n.high.toString(16)+"00000000".replace(new RegExp("0{"+e.length+"}$"),e),16)},$u=function(n,e){var t=Math.floor(1e3*Math.random()%1e4),r=Sa(),i=function(d){d=d||"-";var l=new Date;return""+l.getFullYear()+d+(l.getMonth()+1)+d+l.getDate()}(),o=new Date().getTime(),s="";if(e){var u=e.split(".");s="."+u[u.length-1]}return n+"__RC-"+i+"_"+t+"_"+o+r+s},Hu=function(n,e){n===void 0&&(n={}),e===void 0&&(e={});var t=n.threadId,r=n.apnsCollapseId,i=n.category,o=n.richMediaUri,s=e.channelIdMi,u=e.channelIdHW,d=e.channelIdOPPO,l=e.typeVivo,h=e.googleConfig,a={};a["thread-id"]=t||"",a["apns-collapse-id"]=r||"",a.category=i||"",a.richMediaUri=o||"";var c={};c.collapse_key=h==null?void 0:h.collapseKey,c.imageUrl=h==null?void 0:h.imageUrl;var p=h==null?void 0:h.priority;p&&!["high","normal"].includes(p)&&(p="normal"),c.priority=p;var f=[{HW:{channelId:u||""}},{MI:{channelId:s||""}},{OPPO:{channelId:d||""}},{VIVO:{classification:l||""}},{APNS:a},{FCM:c}];return JSON.stringify(f)},gs=function(n,e){var t={},r={notificationId:e||""};if(!n)return{iOSConfig:t,androidConfig:r};try{var i=JSON.parse(n);i==null||i.forEach(function(o){var s,u,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=(u=o[a])===null||u===void 0?void 0:u.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 t.threadId=o[a]["thread-id"],t.apnsCollapseId=o[a]["apns-collapse-id"],t.category=o[a].category,void(t.richMediaUri=o[a].richMediaUri);case"FCM":r.googleConfig={collapseKey:o[a].collapse_key||"",imageUrl:o[a].imageUrl||"",priority:o[a].priority||""}}}})}catch{G.error("Wrong format for pushConfigs field! content: "+n)}return{iOSConfig:t,androidConfig:r}},Lt=function(n){var e=/^[A-Za-z0-9_=+-]+$/.test(n),t=n.length;return e&&t<=128&&t>=1},zr=function(n){var e=n.length;return e<=4096&&e>=1},ye=function(n,e,t){e=e||function(){};var r=(t=t||{}).isReverse;Ne(n)&&function(){for(var i in n)e(n[i],i,n)}(),(Ue(n)||Be(n))&&function(){if(r)for(var i=n.length-1;i>=0;i--)e(n[i],i);else for(var o=0,s=n.length;o<s;o++)e(n[o],o)}()},Un=function(n,e){return ye(n,function(t,r){n[r]=e(t,r)}),n},ju=function(n,e){if(n.indexOf)return n.indexOf(e);var t=-1;return ye(n,function(r,i){e===r&&(t=i)}),t},Ku=function(n,e){var t=[];return ye(n,function(r){t.push(r)}),ju(t,e)!==-1},Qn=function(n){return JSON.parse(JSON.stringify(n))},ms=function(){return typeof RCCppEngine!="undefined"},qu=function(n){if(n.tag!=="browser")return{type:n.tag,version:"UnKonw"};var e,t,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){t=o,e=s[1]||s[2];break}}return{type:t||"UnKonw",version:e||"UnKonw"}},Oa=function(n){switch(n){case we.SERVER_UNAVAILABLE:return b.SERVER_UNAVAILABLE;case we.TOKEN_INCORRECT:return b.RC_CONN_USER_OR_PASSWD_ERROR;case we.REDIRECT:return b.RC_CONN_REDIRECTED;case we.APP_BLOCK_OR_DELETE:return b.RC_CONN_APP_BLOCKED_OR_DELETED;case we.BLOCK:return b.RC_CONN_USER_BLOCKED;case we.TOKEN_EXPIRE:return b.RC_CONN_USER_OR_PASSWD_ERROR;case we.HOSTNAME_ERROR:return b.HOSTNAME_ERROR;case we.HASOHTERSAMECLIENTONLINE:return b.HAS_OHTER_SAME_CLIENT_ON_LINE;case we.APP_AUTH_NOT_PASS:return b.RC_APP_AUTH_NOT_PASS;case we.OTP_USED:return b.RC_OTP_USED;case we.PLATFORM_ERROR:return b.RC_PLATFORM_ERROR;default:return b.RC_NET_UNAVAILABLE}},_s=function(n){var e={},t=JSON.parse(n);return ye(t,function(r,i){e[i]=r.v}),e},xt={_delayTime:0,setTime:function(n){var e=new Date().getTime();xt._delayTime=e-n},getTime:function(){var n=xt._delayTime;return new Date().getTime()-n}},vs=function(n,e){var t=0;return n.isAutoDelete&&(t|=1),n.isOverwrite&&(t|=2),e===2&&(t|=4),t};(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"})(st||(st={})),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"}(Me||(Me={})),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"}(Fe||(Fe={})),function(n){n.PUB="pub",n.QUERY="qry"}(Nt||(Nt={})),function(n){n[n.V4=4]="V4",n[n.V3=3]="V3"}(St||(St={}));var Y,zi=function(){function n(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=st.AT_LEAST_ONCE),i===void 0&&(i=!1),this._retain=!1,this.qos=st.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var o=e>0;e&&o&&arguments.length===1?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=(8&e)==8):(this.type=e,this._retain=t,this.qos=r,this._dup=i)}return n.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},n}(),Nn=function(){function n(){}return n.writeUTF=function(e,t){var r=[],i=0;if(Be(e))for(var o=0,s=e.length;o<s;o++){var u=e.charCodeAt(o);u>=0&&u<=127?(i+=1,r.push(u)):u>=128&&u<=2047?(i+=2,r.push(192|31&u>>6),r.push(128|63&u)):u>=2048&&u<=65535&&(i+=3,r.push(224|15&u>>12),r.push(128|63&u>>6),r.push(128|63&u))}for(o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return t?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},n.readUTF=function(e){for(var t,r,i=[],o=-1,s=e,u="";++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):(t=(d-=65536)>>10|55296,r=d%1024|56320,i.push(t,r)),(o+1===s.length||i.length>16384)&&(u+=String.fromCharCode.apply(null,i),i.length=0)}return u},n}(),Gu=function(){function n(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return n.prototype.check=function(){return this._position>=this._pool.length},n.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",r=0;r<2;r++){var i=e._pool[e._position++].toString(16);i.length===1&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},n.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",r=0;r<4;r++){var i=e._pool[e._position++].toString(16);i.length===1&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},n.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",r=0;r<8;r++){var i=e._pool[e._position++].toString(16);i.length===1&&(i="0"+i),t+=i}return parseInt(t,16)},n.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},n.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return Nn.readUTF(t)},n.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},n}(),Yu=function(){function n(){this._pool=[],this._position=0,this._writen=0}return n.prototype.write=function(e){return Object.prototype.toString.call(e).indexOf("Array")!==-1?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},n.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},n.prototype.writeUTF=function(e){var t=Nn.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},n.prototype.getBytesArray=function(){return this._pool},n}(),Rn="UpStreamMessage",Ji="PushExtra",wr="DownStreamMessage",Cn="DownStreamMessages",Wi="SessionsAttQryInput",Na="SessionsAttOutput",Zi="SyncRequestMsg",Qi="ChrmPullMsg",cr="NotifyMsg",Xi="HistoryMsgInput",yn="HistoryMsgOuput",ur="RelationQryInput",En="RelationsOutput",eo="DeleteSessionsInput",to="SessionInfo",wa="DeleteSessionsOutput",no="RelationsInput",ro="DeleteMsgInput",io="CleanHisMsgInput",oo="SessionMsgReadInput",so="ChrmInput",ao="ChrmOutput",co="QueryChatRoomInfoInput",Mr="QueryChatRoomInfoOutput",dr="RtcInput",It="RtcUserListOutput",uo="SetUserStatusInput",lo="RtcSetDataInput",lr="RtcUserSetDataInput",hr="RtcDataInput",ho="RtcSetOutDataInput",po="MCFollowInput",Ar="RtcTokenOutput",Pr="RtcQryOutput",fo="RtcQryUserOutDataInput",Ma="RtcUserOutDataOutput",go="RtcQueryListInput",Aa="RtcRoomInfoOutput",He="RtcValueInfo",mo="RtcKeyDeleteInput",_o="GetQNupTokenInput",vo="GetQNupTokenOutput",Ro="GetQNdownloadUrlInput",Co="GetDownloadUrlInput",yo="GetQNdownloadUrlOutput",Eo="GetDownloadUrlOutput",To="SetChrmKV",So="SetChrmKVS",Pa="DeleteChrmKVS",Ft="ChrmKVOutput",Io="ChrmKVSOutput",La="ChrmKVSOutputEntity",bo="QueryChrmKV",ka="SetUserSettingInput",$t="SetUserSettingOutput",Oo="PullUserSettingInput",Lr="PullUserSettingOutput",kr="UserSettingNotification",No="SessionReq",Dr="SessionStates",pr="SessionState",fr="SessionStateItem",gr="SessionStateModifyReq",wo="SessionStateModifyResp",mr="GrpReadReceiptMsg",Da="GrpReadReceiptQryReq",Ur="GrpReadReceiptQryResp",Ua="GrpMsgReadUser",Mo="SessionTagAddInput",pn="SessionTagItem",Ao="SessionTagDelInput",Po="SessionDisTagReq",Lo="ReportSDKInput",xa="ReportSDKOutput",ko="RtcNotifyMsg",Do="RtcPullKV",xr="RtcKVOutput",Uo="RtcQueryUserJoinedInput",Vr="RtcQueryUserJoinedOutput",Va="RtcViewerJoinedOutput",xo="RtcInviteInput",Vo="RtcCancelInviteInput",Bo="RtcInviteAnswerInput",Fo="RtcEndInviteInput",Ba=((Y={})[Rn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],Y[Cn]=["list","syncTime","finished"],Y[wr]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"],Y[Ji]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Y[Wi]=["nothing"],Y[Na]=["inboxTime","sendboxTime","totalUnreadCount"],Y[Zi]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"],Y[Qi]=["syncTime","count"],Y[cr]=["type","time","chrmId"],Y[Xi]=["targetId","time","count","order","busChannel"],Y[yn]=["list","syncTime","hasMsg"],Y[ur]=["type","count","startTime","order"],Y[En]=["info"],Y[eo]=["sessions"],Y[to]=["type","channelId","busChannel"],Y[wa]=["nothing"],Y[no]=["type","msg","count","busChannel","startTime","endTime"],Y[ro]=["type","conversationId","msgs","busChannel"],Y[io]=["targetId","dataTime","conversationType","busChannel"],Y[oo]=["type","msgTime","channelId"],Y[so]=["nothing"],Y[ao]=["nothing","sessionId","joinTime"],Y[co]=["count","order"],Y[Mr]=["userTotalNums","userInfos"],Y[_o]=["type","key","httpMethod","queryString"],Y[Ro]=["type","key","fileName"],Y[Co]=["type","key","fileName"],Y[vo]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Y[yo]=["downloadUrl"],Y[Eo]=["downloadUrl"],Y[To]=["entry","bNotify","notification","type"],Y[So]=["entry","bNotify","notification","type"],Y[Pa]=["entry","bNotify","notification","type"],Y[Ft]=["entries","bFullUpdate","syncTime"],Y[Io]=["timestamp","errorKeys"],Y[La]=["key","errorCode"],Y[bo]=["timestamp"],Y[ka]=["version","value"],Y[$t]=["version","reserve"],Y[Oo]=["version","reserve"],Y[Lr]=["items","version"],Y.UserSettingItem=["targetId","type","key","value","version","status","tags"],Y[No]=["time"],Y[Dr]=["version","state"],Y[pr]=["type","channelId","time","stateItem","busChannel"],Y[fr]=["sessionStateType","value","tags"],Y[gr]=["version","state"],Y[wo]=["version"],Y[mr]=["msgId","busChannel"],Y[Da]=["msgId","busChannel"],Y[Ur]=["totalMemberNum","list"],Y[Ua]=["readTime","userId"],Y[Mo]=["version","tags"],Y[pn]=["tagId","name","createdTime","isTop"],Y[Ao]=["version","tags"],Y[Po]=["tagId"],Y[kr]=["version","reserve"],Y[Lo]=["sdkInfo"],Y[xa]=["nothing"],Y[dr]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],Y[It]=["users","token","sessionId","roomInfo"],Y[uo]=["status"],Y[lo]=["interior","target","key","value","objectName","content"],Y[lr]=["valueInfo","objectName","content"],Y[hr]=["interior","target","key","objectName","content"],Y[ho]=["target","valueInfo","objectName","content"],Y[po]=["state"],Y[Ar]=["rtcToken"],Y[Pr]=["outInfo"],Y[fo]=["userId"],Y[Ma]=["user"],Y[go]=["order"],Y[Aa]=["roomId","roomData","userCount","list"],Y[He]=["key","value"],Y[mo]=["key"],Y[ko]=["type","time","roomId"],Y[Do]=["timestamp","roomId"],Y[xr]=["entries","bFullUpdate","syncTime"],Y[Uo]=["userId"],Y[Vr]=["info"],Y[xo]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Y[Vo]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Y[Bo]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Y[Fo]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Y),Tn={},zu=function(n){var e=Ba[n];Tn[n]=function(){for(var t={},r={getArrayData:function(){return t}},i=function(s){var u=e[s],d="set"+as(u,0,1);r[d]=function(l){t[u]=l}},o=0;o<e.length;o++)i(o);return r},Tn[n].decode=function(t){var r={};Be(t)&&(t=JSON.parse(t));var i=function(s){var u="get"+as(s,0,1);r[s]=t[s],r[u]=function(){return t[s]}};for(var o in t)i(o);return r}};for(var Ju in Ba)zu(Ju);Tn.getModule=function(n){return Tn[n]()};var Wu=`
- package Modules;
- message probuf {
- message `+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 `+cr+` {
- required int32 type = 1;
- optional int64 time = 2;
- optional string chrmId=3;
- }
- message `+Zi+` {
- required int64 syncTime = 1;
- required bool ispolling = 2;
- optional bool isweb=3;
- optional bool isPullSend=4;
- optional bool isKeeping=5;
- optional int64 sendBoxSyncTime=6;
- }
- message `+Rn+` {
- 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 `+Ji+` {
- optional string title = 1;
- optional int32 templateIdNoUse= 2;
- optional string pushId = 3;
- optional string pushConfigs = 4;
- optional string templateId = 5;
- }
- message `+Cn+` {
- repeated DownStreamMessage list = 1;
- required int64 syncTime = 2;
- optional bool finished = 3;
- }
- message `+wr+` {
- 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
- }
- enum ChannelType {
- PERSON = 1;
- PERSONS = 2;
- GROUP = 3;
- TEMPGROUP = 4;
- CUSTOMERSERVICE = 5;
- NOTIFY = 6;
- MC=7;
- MP=8;
- }
- 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 = `+Se.IMAGE+`;
- audio = `+Se.AUDIO+`;
- video = `+Se.VIDEO+`;
- file = `+Se.FILE+`;
- }
- message `+_o+` {
- required FileType type = 1;
- optional string key = 2;
- optional string httpMethod = 3;
- optional string queryString = 4;
- }
- message `+Ro+` {
- required FileType type = 1;
- required string key = 2;
- optional string fileName = 3;
- }
- message `+Co+` {
- required FileType type = 1;
- required string key = 2;
- optional string fileName = 3;
- }
- message `+vo+` {
- 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 `+yo+` {
- required string downloadUrl = 1;
- }
- message `+Eo+` {
- 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 `+so+` {
- required int32 nothing = 1;
- }
- message `+ao+` {
- required int32 nothing = 1;
- optional string sessionId = 2;
- optional int64 joinTime = 3;
- }
- message `+Qi+` {
- required int64 syncTime = 1;
- required int32 count = 2;
- }
- message ChrmPullMsgNew
- {
- required int32 count = 1;
- required int64 syncTime = 2;
- optional string chrmId=3;
- }
- message `+ur+`
- {
- optional ChannelType type = 1;
- optional int32 count = 2;
- optional int64 startTime = 3;
- optional int32 order = 4;
- }
- message `+no+`
- {
- required ChannelType type = 1;
- optional DownStreamMessage msg =2;
- optional int32 count = 3;
- optional string busChannel = 4;
- optional int64 startTime = 5;
- optional int64 endTime = 6;
- }
- message `+En+`
- {
- repeated RelationInfo info = 1;
- }
- 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
- }
- message RelationInfoReadTime
- {
- required ChannelType type = 1;
- required int64 readMsgTime= 2;
- required string targetId = 3;
- }
- message `+io+`
- {
- 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 `+co+`
- {
- required int32 count= 1;
- optional int32 order= 2;
- }
- message `+Mr+`
- {
- 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 `+po+`
- {
- 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 `+Xi+`
- {
- 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 `+yn+`
- {
- repeated DownStreamMessage list=1;
- required int64 syncTime=2;
- required int32 hasMsg=3;
- }
- message `+go+`{
- optional int32 order=1;
- }
- message `+mo+`{
- repeated string key=1;
- }
- message `+He+`{
- required string key=1;
- required string value=2;
- }
- message RtcUserInfo{
- required string userId=1;
- repeated `+He+` userData=2; //\u7528\u6237\u8D44\u6E90\u4FE1\u606F
- }
- message `+It+`{
- 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 `+He+` roomData = 2;
- optional int32 userCount = 3;
- repeated RtcUserInfo list=4;
- }
- message `+dr+`{
- 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
- }
- 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 `+Pr+`{
- repeated `+He+` outInfo=1;
- }
- message RtcDelDataInput{
- repeated string key=1;
- required bool isInterior=2;
- required targetType target=3;
- }
- message `+hr+`{
- required bool interior=1;
- required targetType target=2;
- repeated string key=3;
- optional string objectName=4;
- optional string content=5;
- }
- message `+lo+`{
- 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 `+lr+` {
- repeated `+He+` valueInfo = 1;
- required string objectName = 2;
- repeated `+He+` content = 3;
- }
- message RtcOutput
- {
- optional int32 nothing=1;
- }
- message `+Ar+`{
- required string rtcToken=1;
- }
- enum targetType {
- ROOM =1 ;
- PERSON = 2;
- }
- message `+ho+`{
- required targetType target=1;
- repeated `+He+` valueInfo=2;
- optional string objectName=3;
- optional string content=4;
- }
- message `+fo+`{
- repeated string userId = 1;
- }
- message `+Ma+`{
- repeated RtcUserInfo user = 1;
- }
- message `+Wi+`{
- required int32 nothing = 1;
- }
- message `+Na+`{
- required int64 inboxTime = 1;
- required int64 sendboxTime = 2;
- required int64 totalUnreadCount = 3;
- }
- message `+oo+`
- {
- required ChannelType type = 1;
- required int64 msgTime = 2;
- required string channelId = 3;
- }
- message SessionMsgReadOutput
- {
- optional int32 nothing=1;
- }
- message `+eo+`
- {
- repeated SessionInfo sessions = 1;
- }
- message `+to+`
- {
- required ChannelType type = 1;
- required string channelId = 2;
- optional string busChannel = 3;//\u6240\u5C5E\u4F1A\u8BDD\u4E1A\u52A1\u6807\u8BC6
- }
- message `+wa+`
- {
- optional int32 nothing=1;
- }
- message `+ro+`
- {
- 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;
- }
- message `+To+` {
- required ChrmKVEntity entry = 1;
- optional bool bNotify = 2;
- optional UpStreamMessage notification = 3;
- optional ChannelType type = 4;
- }
- message `+So+` {
- repeated ChrmKVEntity entry = 1;
- optional bool bNotify = 2;
- optional UpStreamMessage notification = 3;
- optional ChannelType type = 4;
- }
- message `+Pa+` {
- repeated ChrmKVEntity entry = 1;
- optional bool bNotify = 2;
- optional UpStreamMessage notification = 3;
- optional ChannelType type = 4;
- }
- message `+Ft+` {
- repeated ChrmKVEntity entries = 1;
- optional bool bFullUpdate = 2;
- optional int64 syncTime = 3;
- }
- message `+Io+` {
- repeated ChrmKVSOutputEntity errorKeys = 1;
- }
- message `+La+`
- {
- optional string key = 1;
- optional int32 errorCode = 2;
- }
- message `+bo+` {
- required int64 timestamp = 1;
- }
- message `+ka+` {
- required int64 version=1;
- required string value=2;
- }
- message `+$t+` {
- required int64 version=1;
- required bool reserve=2;
- }
- message `+Oo+` {
- required int64 version=1;
- optional bool reserve=2;
- }
- message `+Lr+` {
- 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 `+No+` {
- required int64 time = 1;
- }
- message `+Dr+` {
- required int64 version=1;
- repeated SessionState state= 2;
- }
- message `+pr+` {
- 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 `+fr+` {
- required SessionStateType sessionStateType = 1;
- required string value = 2;
- repeated SessionTagItem tags = 3;
- }
- enum SessionStateType {
- IsSilent = 1;
- IsTop = 2;
- Tags = 3;
- }
- message `+gr+` {
- required int64 version=1;
- repeated SessionState state= 2;
- }
- message `+wo+` {
- required int64 version=1;
- }
- message `+mr+` {
- 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 `+Da+` {
- 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 `+Ur+` {
- 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 `+Ua+` {
- required int64 readTime = 1;//\u5DF2\u8BFB\u65F6\u95F4
- required string userId = 2;//\u5DF2\u8BFB\u7528\u6237id
- }
- message `+Mo+` {
- required int64 version=1;
- repeated SessionTagItem tags=2;
- }
- message `+pn+` {
- required string tagId=1;
- optional string name=2;
- optional int64 createdTime=3;
- optional bool isTop=4;
- }
- message `+Ao+` {
- required int64 version=1;
- repeated SessionTagItem tags=2;
- }
- message `+Po+` {
- repeated string tagId=1;
- }
- message `+kr+` {
- required int64 version=1;
- required bool reserve=2;
- }
- message `+Lo+` {
- required string sdkInfo=1; // \u7528\u6237\u96C6\u6210\u7684 sdk \u4FE1\u606F,json \u683C\u5F0F {"web-rtc": "4.0.3.7"}
- }
- message `+xa+`
- {
- optional int32 nothing=1; //\u5360\u4F4D
- }
- message `+ko+`
- {
- 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 `+Do+`
- {
- required int64 timestamp = 1;
- required string roomId = 2;
- }
- message `+xr+`
- {
- 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 `+Uo+`
- {
- required string userId = 1;
- }
- message `+Vr+`
- {
- 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 `+Va+`
- {
- 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 `+xo+`
- {
- 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 `+Vo+`
- {
- 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 `+Bo+`
- {
- 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 `+Fo+`
- {
- 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
- }
- }
- `,Rs,Cs,Qt,kt,Xt,Ti=(Rs=Wu,function(n,e){var t,r,i={};return i.ByteBuffer=n,i.c=n,t=n,i.Long=e||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,u=[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<u.length;s++){try{d=u[s]()}catch{continue}break}if(!d)throw Error("XMLHttpRequest is not supported");return d},o.fetch=function(s,u){if(u&&typeof u!="function"&&(u=null),o.IS_NODE)if(u)g.readFile(s,function(l,h){u(l?null:""+h)});else try{return g.readFileSync(s)}catch{return null}else{var d=o.XHR();if(d.open("GET",s,!!u),d.setRequestHeader("Accept","text/plain"),typeof d.overrideMimeType=="function"&&d.overrideMimeType("text/plain"),!u)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"?u(d.responseText):u(null))},d.readyState==4)return;d.send(null)}},o.toCamelCase=function(s){return s.replace(/_([a-zA-Z])/g,function(u,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 u(m,_){var v=-1,R=1;if(m.charAt(0)=="-"&&(R=-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: "+(R<0?"-":"")+m);v=parseInt(m.substring(1),8)}if(v=0|R*v,!_&&v<0)throw Error("illegal id value: "+(R<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,c={},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,R,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(R=this.index,s.DELIM.lastIndex=0,!s.DELIM.test(this.source.charAt(R++)))for(;R<this.source.length&&!s.DELIM.test(this.source.charAt(R));)++R;return((y=this.source.substring(this.index,this.index=R))==='"'||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+")"},c.Tokenizer=p,(a=(h=function(m){this.tn=new p(m),this.proto3=!1}).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(R){throw R.message="Parse error at line "+this.tn.line+": "+R.message,R}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,R=this.tn.next(),y=!1;if(R==="("&&(y=!0,R=this.tn.next()),!s.TYPEREF.test(R))throw Error("illegal option name: "+R);v=R,y&&(this.tn.skip(")"),v="("+v+")",R=this.tn.peek(),s.FQTYPEREF.test(R)&&(v+=R,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,R="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[R]===void 0&&(m[R]={}),m[R][_]=v},a._parseMessage=function(m,_){var v=!!_,R=this.tn.next(),y={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!s.NAME.test(R))throw Error("illegal "+(v?"group":"message")+" name: "+R);for(y.name=R,v&&(this.tn.skip("="),_.id=u(this.tn.next()),y.isGroup=!0),(R=this.tn.peek())==="["&&_&&this._parseFieldOptions(_),this.tn.skip("{");(R=this.tn.next())!=="}";)if(s.RULE.test(R))this._parseMessageField(y,R);else if(R==="oneof")this._parseMessageOneOf(y);else if(R==="enum")this._parseEnum(y);else if(R==="message")this._parseMessage(y);else if(R==="option")this._parseOption(y);else if(R==="service")this._parseService(y);else if(R==="extensions")y.extensions=this._parseExtensionRanges();else if(R==="reserved")this._parseIgnored();else if(R==="extend")this._parseExtend(y);else{if(!s.TYPEREF.test(R))throw Error("illegal message token: "+R);if(!this.proto3)throw Error("illegal field rule: "+R);this._parseMessageField(y,"optional",R)}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 R,y,P;if(!s.RULE.test(_))throw Error("illegal message field rule: "+_);if(R={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(R.keytype=y,this.tn.skip(","),y=this.tn.next(),!s.TYPE.test(y)&&!s.TYPEREF.test(y))throw Error("illegal message field: "+y);if(R.type=y,this.tn.skip(">"),y=this.tn.next(),!s.NAME.test(y))throw Error("illegal message field name: "+y);R.name=y,this.tn.skip("="),R.id=u(this.tn.next()),(y=this.tn.peek())==="["&&this._parseFieldOptions(R),this.tn.skip(";")}else if((v=v!==void 0?v:this.tn.next())==="group"){if(P=this._parseMessage(m,R),!/^[A-Z]/.test(P.name))throw Error("illegal group name: "+P.name);R.type=P.name,R.name=P.name.toLowerCase(),this.tn.omit(";")}else{if(!s.TYPE.test(v)&&!s.TYPEREF.test(v))throw Error("illegal message field type: "+v);if(R.type=v,y=this.tn.next(),!s.NAME.test(y))throw Error("illegal message field name: "+y);R.name=y,this.tn.skip("="),R.id=u(this.tn.next()),(y=this.tn.peek())==="["&&this._parseFieldOptions(R),this.tn.skip(";")}return m.fields.push(R),R},a._parseMessageOneOf=function(m){var _,v,R,y=this.tn.next();if(!s.NAME.test(y))throw Error("illegal oneof name: "+y);for(v=y,R=[],this.tn.skip("{");(y=this.tn.next())!=="}";)(_=this._parseMessageField(m,"optional",y)).oneof=v,R.push(_.id);this.tn.omit(";"),m.oneofs[v]=R},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:{}},R=this.tn.next();if(!s.NAME.test(R))throw Error("illegal name: "+R);for(v.name=R,this.tn.skip("{");(R=this.tn.next())!=="}";)if(R==="option")this._parseOption(v);else{if(!s.NAME.test(R))throw Error("illegal name: "+R);this.tn.skip("="),_={name:R,id:u(this.tn.next(),!0)},(R=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,R=[];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()}R.push(_)}while(this.tn.omit(","));return this.tn.skip(";"),R},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},c.Parser=h,c}(i,i.Lang),i.Reflect=function(o){function s(C,T){if(C&&typeof C.low=="number"&&typeof C.high=="number"&&typeof C.unsigned=="boolean"&&C.low==C.low&&C.high==C.high)return new o.Long(C.low,C.high,T===void 0?C.unsigned:T);if(typeof C=="string")return o.Long.fromString(C,T||!1,10);if(typeof C=="number")return o.Long.fromNumber(C,T||!1);throw Error("not convertible to Long")}function u(C,T){var S=T.readVarint32(),O=7&S,I=S>>>3;switch(O){case o.WIRE_TYPES.VARINT:do S=T.readUint8();while((128&S)==128);break;case o.WIRE_TYPES.BITS64:T.offset+=8;break;case o.WIRE_TYPES.LDELIM:S=T.readVarint32(),T.offset+=S;break;case o.WIRE_TYPES.STARTGROUP:u(I,T);break;case o.WIRE_TYPES.ENDGROUP:if(I===C)return!1;throw Error("Illegal GROUPEND after unknown group: "+I+" ("+C+" expected)");case o.WIRE_TYPES.BITS32:T.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+C+": "+O)}return!0}var d,l,h,a,c,p,f,m,_,v,R,y,P,L,N,E,A={},F=function(C,T,S){this.builder=C,this.parent=T,this.name=S,this.className},q=F.prototype;return q.fqn=function(){for(var C=this.name,T=this;(T=T.parent)!=null;)C=T.name+"."+C;return C},q.toString=function(C){return(C?this.className+" ":"")+this.fqn()},q.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},A.T=F,(l=(d=function(C,T,S,O,I){F.call(this,C,T,S),this.className="Namespace",this.children=[],this.options=O||{},this.syntax=I||"proto2"}).prototype=Object.create(F.prototype)).getChildren=function(C){var T,S,O;if((C=C||null)==null)return this.children.slice();for(T=[],S=0,O=this.children.length;O>S;++S)this.children[S]instanceof C&&T.push(this.children[S]);return T},l.addChild=function(C){var T;if(T=this.getChild(C.name))if(T instanceof c.Field&&T.name!==T.originalName&&this.getChild(T.originalName)===null)T.name=T.originalName;else{if(!(C instanceof c.Field&&C.name!==C.originalName&&this.getChild(C.originalName)===null))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+C.name);C.name=C.originalName}this.children.push(C)},l.getChild=function(C){var T,S,O=typeof C=="number"?"id":"name";for(T=0,S=this.children.length;S>T;++T)if(this.children[T][O]===C)return this.children[T];return null},l.resolve=function(C,T){var S,O=typeof C=="string"?C.split("."):C,I=this,U=0;if(O[U]===""){for(;I.parent!==null;)I=I.parent;U++}do{do{if(!(I instanceof A.Namespace)){I=null;break}if(!((S=I.getChild(O[U]))&&S instanceof A.T&&(!T||S instanceof A.Namespace))){I=null;break}I=S,U++}while(U<O.length);if(I!=null)break;if(this.parent!==null)return this.parent.resolve(C,T)}while(I!=null);return I},l.qn=function(C){var T,S,O=[],I=C;do O.unshift(I.name),I=I.parent;while(I!==null);for(T=1;T<=O.length;T++)if(S=O.slice(O.length-T),C===this.resolve(S,C instanceof A.Namespace))return S.join(".");return C.fqn()},l.build=function(){var C,T,S,O={},I=this.children;for(T=0,S=I.length;S>T;++T)(C=I[T])instanceof d&&(O[C.name]=C.build());return Object.defineProperty&&Object.defineProperty(O,"$options",{value:this.buildOpt()}),O},l.buildOpt=function(){var C,T,S,O,I={},U=Object.keys(this.options);for(C=0,T=U.length;T>C;++C)S=U[C],O=this.options[U[C]],I[S]=O;return I},l.getOption=function(C){return C===void 0?this.options:this.options[C]!==void 0?this.options[C]:null},A.Namespace=d,a=(h=function(C,T,S,O){if(this.type=C,this.resolvedType=T,this.isMapKey=S,this.syntax=O,S&&o.MAP_KEY_TYPES.indexOf(C)<0)throw Error("Invalid map key type: "+C.name)}).prototype,h.defaultFieldValue=function(C){if(typeof C=="string"&&(C=o.TYPES[C]),C.defaultValue===void 0)throw Error("default value for type "+C.name+" is not supported");return C==o.TYPES.bytes?new t(0):C.defaultValue},a.verifyValue=function(C){var T,S,O,I=function(U,D){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+U+" ("+D+")")}.bind(this);switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:return(typeof C!="number"||C==C&&C%1!=0)&&I(typeof C,"not an integer"),C>4294967295?0|C:C;case o.TYPES.uint32:case o.TYPES.fixed32:return(typeof C!="number"||C==C&&C%1!=0)&&I(typeof C,"not an integer"),C<0?C>>>0:C;case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:if(o.Long)try{return s(C,!1)}catch(U){I(typeof C,U.message)}else I(typeof C,"requires Long.js");case o.TYPES.uint64:case o.TYPES.fixed64:if(o.Long)try{return s(C,!0)}catch(U){I(typeof C,U.message)}else I(typeof C,"requires Long.js");case o.TYPES.bool:return typeof C!="boolean"&&I(typeof C,"not a boolean"),C;case o.TYPES.float:case o.TYPES.double:return typeof C!="number"&&I(typeof C,"not a number"),C;case o.TYPES.string:return typeof C=="string"||C&&C instanceof String||I(typeof C,"not a string"),""+C;case o.TYPES.bytes:return n.isByteBuffer(C)?C:n.wrap(C);case o.TYPES.enum:for(T=this.resolvedType.getChildren(o.Reflect.Enum.Value),O=0;O<T.length;O++)if(T[O].name==C||T[O].id==C)return T[O].id;if(this.syntax==="proto3")return(typeof C!="number"||C==C&&C%1!=0)&&I(typeof C,"not an integer"),(C>4294967295||C<0)&&I(typeof C,"not in range for uint32"),C;I(C,"not a valid enum value");case o.TYPES.group:case o.TYPES.message:if(C&&typeof C=="object"||I(typeof C,"object expected"),C instanceof this.resolvedType.clazz)return C;if(C instanceof o.Builder.Message){for(O in S={},C)C.hasOwnProperty(O)&&(S[O]=C[O]);C=S}return new this.resolvedType.clazz(C)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+C+" (undefined type "+this.type+")")},a.calculateLength=function(C,T){if(T===null)return 0;var S;switch(this.type){case o.TYPES.int32:return T<0?t.calculateVarint64(T):t.calculateVarint32(T);case o.TYPES.uint32:return t.calculateVarint32(T);case o.TYPES.sint32:return t.calculateVarint32(t.zigZagEncode32(T));case o.TYPES.fixed32:case o.TYPES.sfixed32:case o.TYPES.float:return 4;case o.TYPES.int64:case o.TYPES.uint64:return t.calculateVarint64(T);case o.TYPES.sint64:return t.calculateVarint64(t.zigZagEncode64(T));case o.TYPES.fixed64:case o.TYPES.sfixed64:return 8;case o.TYPES.bool:return 1;case o.TYPES.enum:return t.calculateVarint32(T);case o.TYPES.double:return 8;case o.TYPES.string:return S=t.calculateUTF8Bytes(T),t.calculateVarint32(S)+S;case o.TYPES.bytes:if(T.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+T.remaining()+" bytes remaining");return t.calculateVarint32(T.remaining())+T.remaining();case o.TYPES.message:return S=this.resolvedType.calculate(T),t.calculateVarint32(S)+S;case o.TYPES.group:return(S=this.resolvedType.calculate(T))+t.calculateVarint32(C<<3|o.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+T+" (unknown type)")},a.encodeValue=function(C,T,S){var O,I;if(T===null)return S;switch(this.type){case o.TYPES.int32:T<0?S.writeVarint64(T):S.writeVarint32(T);break;case o.TYPES.uint32:S.writeVarint32(T);break;case o.TYPES.sint32:S.writeVarint32ZigZag(T);break;case o.TYPES.fixed32:S.writeUint32(T);break;case o.TYPES.sfixed32:S.writeInt32(T);break;case o.TYPES.int64:case o.TYPES.uint64:S.writeVarint64(T);break;case o.TYPES.sint64:S.writeVarint64ZigZag(T);break;case o.TYPES.fixed64:S.writeUint64(T);break;case o.TYPES.sfixed64:S.writeInt64(T);break;case o.TYPES.bool:typeof T=="string"?S.writeVarint32(T.toLowerCase()==="false"?0:!!T):S.writeVarint32(T?1:0);break;case o.TYPES.enum:S.writeVarint32(T);break;case o.TYPES.float:S.writeFloat32(T);break;case o.TYPES.double:S.writeFloat64(T);break;case o.TYPES.string:S.writeVString(T);break;case o.TYPES.bytes:if(T.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+T.remaining()+" bytes remaining");O=T.offset,S.writeVarint32(T.remaining()),S.append(T),T.offset=O;break;case o.TYPES.message:I=new t().LE(),this.resolvedType.encode(T,I),S.writeVarint32(I.offset),S.append(I.flip());break;case o.TYPES.group:this.resolvedType.encode(T,S),S.writeVarint32(C<<3|o.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+T+" (unknown type)")}return S},a.decode=function(C,T,S){if(T!=this.type.wireType)throw Error("Unexpected wire type for element");var O,I;switch(this.type){case o.TYPES.int32:return 0|C.readVarint32();case o.TYPES.uint32:return C.readVarint32()>>>0;case o.TYPES.sint32:return 0|C.readVarint32ZigZag();case o.TYPES.fixed32:return C.readUint32()>>>0;case o.TYPES.sfixed32:return 0|C.readInt32();case o.TYPES.int64:return C.readVarint64();case o.TYPES.uint64:return C.readVarint64().toUnsigned();case o.TYPES.sint64:return C.readVarint64ZigZag();case o.TYPES.fixed64:return C.readUint64();case o.TYPES.sfixed64:return C.readInt64();case o.TYPES.bool:return!!C.readVarint32();case o.TYPES.enum:return C.readVarint32();case o.TYPES.float:return C.readFloat();case o.TYPES.double:return C.readDouble();case o.TYPES.string:return C.readVString();case o.TYPES.bytes:if(I=C.readVarint32(),C.remaining()<I)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+I+" required but got only "+C.remaining());return(O=C.clone()).limit=O.offset+I,C.offset+=I,O;case o.TYPES.message:return I=C.readVarint32(),this.resolvedType.decode(C,I);case o.TYPES.group:return this.resolvedType.decode(C,-1,S)}throw Error("[INTERNAL] Illegal decode type")},a.valueFromString=function(C){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(C));case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:case o.TYPES.uint64:case o.TYPES.fixed64:return this.verifyValue(C);case o.TYPES.bool:return C==="true";case o.TYPES.string:return this.verifyValue(C);case o.TYPES.bytes:return t.fromBinary(C)}},a.valueToString=function(C){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===o.TYPES.bytes?C.toString("binary"):C.toString()},A.Element=h,(p=(c=function(C,T,S,O,I,U){d.call(this,C,T,S,O,U),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!I,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(d.prototype)).build=function(C){var T,S,O,I;if(this.clazz&&!C)return this.clazz;for(T=function(U,D){function $(k,z,Q,ie){var oe,ce,ut,Je,jr,Kr,Mt;if(k===null||typeof k!="object")return ie&&ie instanceof U.Reflect.Enum&&(oe=U.Reflect.Enum.getName(ie.object,k))!==null?oe:k;if(t.isByteBuffer(k))return z?k.toBase64():k.toBuffer();if(U.Long.isLong(k))return Q?k.toString():U.Long.fromValue(k);if(Array.isArray(k))return ce=[],k.forEach(function(ru,iu){ce[iu]=$(ru,z,Q,ie)}),ce;if(ce={},k instanceof U.Map){for(Je=(ut=k.entries()).next();!Je.done;Je=ut.next())ce[k.keyElem.valueToString(Je.value[0])]=$(Je.value[1],z,Q,k.valueElem.resolvedType);return ce}for(Mt in jr=k.$type,Kr=void 0,k)k.hasOwnProperty(Mt)&&(ce[Mt]=jr&&(Kr=jr.getChild(Mt))?$(k[Mt],z,Q,Kr.resolvedType):$(k[Mt],z,Q));return ce}var j,J,re=D.getChildren(U.Reflect.Message.Field),X=D.getChildren(U.Reflect.Message.OneOf),W=function(k){var z,Q,ie,oe;for(U.Builder.Message.call(this),z=0,Q=X.length;Q>z;++z)this[X[z].name]=null;for(z=0,Q=re.length;Q>z;++z)this[(ie=re[z]).name]=ie.repeated?[]:ie.map?new U.Map(ie):null,!ie.required&&D.syntax!=="proto3"||ie.defaultValue===null||(this[ie.name]=ie.defaultValue);if(arguments.length>0)if(arguments.length!==1||k===null||typeof k!="object"||!(typeof k.encode!="function"||k instanceof W)||Array.isArray(k)||k instanceof U.Map||t.isByteBuffer(k)||k instanceof ArrayBuffer||U.Long&&k instanceof U.Long)for(z=0,Q=arguments.length;Q>z;++z)(oe=arguments[z])!==void 0&&this.$set(re[z].name,oe);else this.$set(k)},Z=W.prototype=Object.create(U.Builder.Message.prototype);for(Z.add=function(k,z,Q){var ie=D._fieldsByName[k];if(!Q){if(!ie)throw Error(this+"#"+k+" is undefined");if(!(ie instanceof U.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: "+ie.toString(!0));if(!ie.repeated)throw Error(this+"#"+k+" is not a repeated field");z=ie.verifyValue(z,!0)}return this[k]===null&&(this[k]=[]),this[k].push(z),this},Z.$add=Z.add,Z.set=function(k,z,Q){var ie,oe,ce;if(k&&typeof k=="object"){for(ie in Q=z,k)k.hasOwnProperty(ie)&&(z=k[ie])!==void 0&&this.$set(ie,z,Q);return this}if(oe=D._fieldsByName[k],Q)this[k]=z;else{if(!oe)throw Error(this+"#"+k+" is not a field: undefined");if(!(oe instanceof U.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: "+oe.toString(!0));this[oe.name]=z=oe.verifyValue(z)}return oe&&oe.oneof&&(ce=this[oe.oneof.name],z!==null?(ce!==null&&ce!==oe.name&&(this[ce]=null),this[oe.oneof.name]=oe.name):ce===k&&(this[oe.oneof.name]=null)),this},Z.$set=Z.set,Z.get=function(k,z){if(z)return this[k];var Q=D._fieldsByName[k];if(!(Q&&Q instanceof U.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: undefined");if(!(Q instanceof U.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: "+Q.toString(!0));return this[Q.name]},Z.$get=Z.get,j=0;j<re.length;j++)(J=re[j])instanceof U.Reflect.Message.ExtensionField||D.builder.options.populateAccessors&&function(k){var z,Q,ie,oe=k.originalName.replace(/(_[a-zA-Z])/g,function(ce){return ce.toUpperCase().replace("_","")});oe=oe.substring(0,1).toUpperCase()+oe.substring(1),z=k.originalName.replace(/([A-Z])/g,function(ce){return"_"+ce}),Q=function(ce,ut){return this[k.name]=ut?ce:k.verifyValue(ce),this},ie=function(){return this[k.name]},D.getChild("set"+oe)===null&&(Z["set"+oe]=Q),D.getChild("set_"+z)===null&&(Z["set_"+z]=Q),D.getChild("get"+oe)===null&&(Z["get"+oe]=ie),D.getChild("get_"+z)===null&&(Z["get_"+z]=ie)}(J);return Z.encode=function(k,z){var Q,ie;typeof k=="boolean"&&(z=k,k=void 0),Q=!1,k||(k=new n,Q=!0),ie=k.littleEndian;try{return D.encode(this,k.LE(),z),(Q?k.flip():k).LE(ie)}catch(oe){throw k.LE(ie),oe}},W.encode=function(k,z,Q){return new W(k).encode(z,Q)},Z.calculate=function(){return D.calculate(this)},Z.encodeDelimited=function(k){var z,Q=!1;return k||(k=new t,Q=!0),z=new t().LE(),D.encode(this,z).flip(),k.writeVarint32(z.remaining()),k.append(z),Q?k.flip():k},Z.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toArrayBuffer()),k}},Z.toArrayBuffer=Z.encodeAB,Z.encodeNB=function(){try{return this.encode().toBuffer()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toBuffer()),k}},Z.toBuffer=Z.encodeNB,Z.encode64=function(){try{return this.encode().toBase64()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toBase64()),k}},Z.toBase64=Z.encode64,Z.encodeHex=function(){try{return this.encode().toHex()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toHex()),k}},Z.toHex=Z.encodeHex,Z.toRaw=function(k,z){return $(this,!!k,!!z,this.$type)},Z.encodeJSON=function(){return JSON.stringify($(this,!0,!0,this.$type))},W.decode=function(k,z){var Q,ie;typeof k=="string"&&(k=t.wrap(k,z||"base64")),Q=(k=t.isByteBuffer(k)?k:t.wrap(k)).littleEndian;try{return ie=D.decode(k.LE()),k.LE(Q),ie}catch(oe){throw k.LE(Q),oe}},W.decodeDelimited=function(k,z){var Q,ie,oe;if(typeof k=="string"&&(k=t.wrap(k,z||"base64")),(k=t.isByteBuffer(k)?k:t.wrap(k)).remaining()<1)return null;if(Q=k.offset,ie=k.readVarint32(),k.remaining()<ie)return k.offset=Q,null;try{return oe=D.decode(k.slice(k.offset,k.offset+ie).LE()),k.offset+=ie,oe}catch(ce){throw k.offset+=ie,ce}},W.decode64=function(k){return W.decode(k,"base64")},W.decodeHex=function(k){return W.decode(k,"hex")},W.decodeJSON=function(k){return new W(JSON.parse(k))},Z.toString=function(){return D.toString()},Object.defineProperty&&(Object.defineProperty(W,"$options",{value:D.buildOpt()}),Object.defineProperty(Z,"$options",{value:W.$options}),Object.defineProperty(W,"$type",{value:D}),Object.defineProperty(Z,"$type",{value:D})),W}(o,this),this._fields=[],this._fieldsById={},this._fieldsByName={},O=0,I=this.children.length;I>O;O++)if((S=this.children[O])instanceof R||S instanceof c||S instanceof L){if(T.hasOwnProperty(S.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+S.toString(!0)+" cannot override static property '"+S.name+"'");T[S.name]=S.build()}else if(S instanceof c.Field)S.build(),this._fields.push(S),this._fieldsById[S.id]=S,this._fieldsByName[S.name]=S;else if(!(S instanceof c.OneOf||S instanceof P))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[O].toString(!0));return this.clazz=T},p.encode=function(C,T,S){var O,I,U,D,$,j=null;for(U=0,D=this._fields.length;D>U;++U)I=C[(O=this._fields[U]).name],O.required&&I===null?j===null&&(j=O):O.encode(S?I:O.verifyValue(I),T,C);if(j!==null)throw($=Error("Missing at least one required field for "+this.toString(!0)+": "+j)).encoded=T,$;return T},p.calculate=function(C){for(var T,S,O=0,I=0,U=this._fields.length;U>I;++I){if(S=C[(T=this._fields[I]).name],T.required&&S===null)throw Error("Missing at least one required field for "+this.toString(!0)+": "+T);O+=T.calculate(S,C)}return O},p.decode=function(C,T,S){var O,I,U,D,$,j,J,re,X,W,Z,k;for(T=typeof T=="number"?T:-1,$=C.offset,j=new this.clazz;C.offset<$+T||T===-1&&C.remaining()>0;){if(U=(O=C.readVarint32())>>>3,(I=7&O)===o.WIRE_TYPES.ENDGROUP){if(U!==S)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+U+" ("+(S?S+" expected":"not a group")+")");break}if(D=this._fieldsById[U])D.repeated&&!D.options.packed?j[D.name].push(D.decode(I,C)):D.map?(re=D.decode(I,C),j[D.name].set(re[0],re[1])):(j[D.name]=D.decode(I,C),D.oneof&&((X=j[D.oneof.name])!==null&&X!==D.name&&(j[X]=null),j[D.oneof.name]=D.name));else switch(I){case o.WIRE_TYPES.VARINT:C.readVarint32();break;case o.WIRE_TYPES.BITS32:C.offset+=4;break;case o.WIRE_TYPES.BITS64:C.offset+=8;break;case o.WIRE_TYPES.LDELIM:J=C.readVarint32(),C.offset+=J;break;case o.WIRE_TYPES.STARTGROUP:for(;u(U,C););break;default:throw Error("Illegal wire type for unknown field "+U+" in "+this.toString(!0)+"#decode: "+I)}}for(W=0,Z=this._fields.length;Z>W;++W)if(j[(D=this._fields[W]).name]===null)if(this.syntax==="proto3")j[D.name]=D.defaultValue;else{if(D.required)throw(k=Error("Missing at least one required field for "+this.toString(!0)+": "+D.name)).decoded=j,k;o.populateDefaults&&D.defaultValue!==null&&(j[D.name]=D.defaultValue)}return j},A.Message=c,(m=(f=function(C,T,S,O,I,U,D,$,j,J){F.call(this,C,T,U),this.className="Message.Field",this.required=S==="required",this.repeated=S==="repeated",this.map=S==="map",this.keyType=O||null,this.type=I,this.resolvedType=null,this.id=D,this.options=$||{},this.defaultValue=null,this.oneof=j||null,this.syntax=J||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=o.Util.toCamelCase(this.name))}).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(C,T){var S,O,I;if(T=T||!1,S=function(U,D){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+U+" ("+D+")")}.bind(this),C===null)return this.required&&S(typeof C,"required"),this.syntax==="proto3"&&this.type!==o.TYPES.message&&S(typeof C,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!T){for(Array.isArray(C)||(C=[C]),I=[],O=0;O<C.length;O++)I.push(this.element.verifyValue(C[O]));return I}return this.map&&!T?C instanceof o.Map?C:(C instanceof Object||S(typeof C,"expected ProtoBuf.Map or raw object for map field"),new o.Map(this,C)):(!this.repeated&&Array.isArray(C)&&S(typeof C,"no array expected"),this.element.verifyValue(C))},m.hasWirePresence=function(C,T){if(this.syntax!=="proto3")return C!==null;if(this.oneof&&T[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 C!==0;case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:case o.TYPES.uint64:case o.TYPES.fixed64:return C.low!==0||C.high!==0;case o.TYPES.bool:return C;case o.TYPES.float:case o.TYPES.double:return C!==0;case o.TYPES.string:return C.length>0;case o.TYPES.bytes:return C.remaining()>0;case o.TYPES.enum:return C!==0;case o.TYPES.message:return C!==null;default:return!0}},m.encode=function(C,T,S){var O,I,U,D,$;if(this.type===null||typeof this.type!="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(C===null||this.repeated&&C.length==0)return T;try{if(this.repeated)if(this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(T.writeVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),T.ensureCapacity(T.offset+=1),I=T.offset,O=0;O<C.length;O++)this.element.encodeValue(this.id,C[O],T);U=T.offset-I,(D=t.calculateVarint32(U))>1&&($=T.slice(I,T.offset),I+=D-1,T.offset=I,T.append($)),T.writeVarint32(U,I-D)}else for(O=0;O<C.length;O++)T.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,C[O],T);else this.map?C.forEach(function(j,J){var re=t.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,J)+t.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,j);T.writeVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),T.writeVarint32(re),T.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,J,T),T.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,j,T)},this):this.hasWirePresence(C,S)&&(T.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,C,T))}catch(j){throw Error("Illegal value for "+this.toString(!0)+": "+C+" ("+j+")")}return T},m.calculate=function(C,T){var S,O,I;if(C=this.verifyValue(C),this.type===null||typeof this.type!="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(C===null||this.repeated&&C.length==0)return 0;S=0;try{if(this.repeated)if(this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(S+=t.calculateVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),I=0,O=0;O<C.length;O++)I+=this.element.calculateLength(this.id,C[O]);S+=t.calculateVarint32(I),S+=I}else for(O=0;O<C.length;O++)S+=t.calculateVarint32(this.id<<3|this.type.wireType),S+=this.element.calculateLength(this.id,C[O]);else this.map?C.forEach(function(U,D){var $=t.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,D)+t.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,U);S+=t.calculateVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),S+=t.calculateVarint32($),S+=$},this):this.hasWirePresence(C,T)&&(S+=t.calculateVarint32(this.id<<3|this.type.wireType),S+=this.element.calculateLength(this.id,C))}catch(U){throw Error("Illegal value for "+this.toString(!0)+": "+C+" ("+U+")")}return S},m.decode=function(C,T,S){var O,I,U,D,$,j,J;if(!(!this.map&&C==this.type.wireType||!S&&this.repeated&&this.options.packed&&C==o.WIRE_TYPES.LDELIM||this.map&&C==o.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+C+" ("+this.type.wireType+" expected)");if(C==o.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!S){for(I=T.readVarint32(),I=T.offset+I,U=[];T.offset<I;)U.push(this.decode(this.type.wireType,T,!0));return U}if(this.map){if(D=h.defaultFieldValue(this.keyType),O=h.defaultFieldValue(this.type),I=T.readVarint32(),T.remaining()<I)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+I+" required but got only "+T.remaining());for(($=T.clone()).limit=$.offset+I,T.offset+=I;$.remaining()>0;)if(C=7&(j=$.readVarint32()),(J=j>>>3)==1)D=this.keyElement.decode($,C,J);else{if(J!==2)throw Error("Unexpected tag in map field key/value submessage");O=this.element.decode($,C,J)}return[D,O]}return this.element.decode(T,C,this.id)},A.Message.Field=f,(_=function(C,T,S,O,I,U,D){f.call(this,C,T,S,null,O,I,U,D),this.extension}).prototype=Object.create(f.prototype),A.Message.ExtensionField=_,v=function(C,T,S){F.call(this,C,T,S),this.fields=[]},A.Message.OneOf=v,(R=function(C,T,S,O,I){d.call(this,C,T,S,O,I),this.className="Enum",this.object=null}).getName=function(C,T){var S,O,I=Object.keys(C);for(O=0;O<I.length;++O)if(C[S=I[O]]===T)return S;return null},(R.prototype=Object.create(d.prototype)).build=function(C){var T,S,O,I;if(this.object&&!C)return this.object;for(T=new o.Builder.Enum,O=0,I=(S=this.getChildren(R.Value)).length;I>O;++O)T[S[O].name]=S[O].id;return Object.defineProperty&&Object.defineProperty(T,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=T},A.Enum=R,(y=function(C,T,S,O){F.call(this,C,T,S),this.className="Enum.Value",this.id=O}).prototype=Object.create(F.prototype),A.Enum.Value=y,(P=function(C,T,S,O){F.call(this,C,T,S),this.field=O}).prototype=Object.create(F.prototype),A.Extension=P,((L=function(C,T,S,O){d.call(this,C,T,S,O),this.className="Service",this.clazz=null}).prototype=Object.create(d.prototype)).build=function(C){return this.clazz&&!C?this.clazz:this.clazz=function(T,S){var O,I=function($){T.Builder.Service.call(this),this.rpcImpl=$||function(j,J,re){setTimeout(re.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},U=I.prototype=Object.create(T.Builder.Service.prototype),D=S.getChildren(T.Reflect.Service.RPCMethod);for(O=0;O<D.length;O++)(function($){U[$.name]=function(j,J){try{try{j=$.resolvedRequestType.clazz.decode(t.wrap(j))}catch(re){if(!(re instanceof TypeError))throw re}if(j===null||typeof j!="object")throw Error("Illegal arguments");j instanceof $.resolvedRequestType.clazz||(j=new $.resolvedRequestType.clazz(j)),this.rpcImpl($.fqn(),j,function(re,X){if(!re){try{X=$.resolvedResponseType.clazz.decode(X)}catch{}return X&&X instanceof $.resolvedResponseType.clazz?void J(null,X):void J(Error("Illegal response type received in service method "+S.name+"#"+$.name))}J(re)})}catch(re){setTimeout(J.bind(this,re),0)}},I[$.name]=function(j,J,re){new I(j)[$.name](J,re)},Object.defineProperty&&(Object.defineProperty(I[$.name],"$options",{value:$.buildOpt()}),Object.defineProperty(U[$.name],"$options",{value:I[$.name].$options}))})(D[O]);return Object.defineProperty&&(Object.defineProperty(I,"$options",{value:S.buildOpt()}),Object.defineProperty(U,"$options",{value:I.$options}),Object.defineProperty(I,"$type",{value:S}),Object.defineProperty(U,"$type",{value:S})),I}(o,this)},A.Service=L,((N=function(C,T,S,O){F.call(this,C,T,S),this.className="Service.Method",this.options=O||{}}).prototype=Object.create(F.prototype)).buildOpt=l.buildOpt,A.Service.Method=N,(E=function(C,T,S,O,I,U,D,$){N.call(this,C,T,S,$),this.className="Service.RPCMethod",this.requestName=O,this.responseName=I,this.requestStream=U,this.responseStream=D,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(N.prototype),A.Service.RPCMethod=E,A}(i),i.Builder=function(o,s,u){function d(a){a.messages&&a.messages.forEach(function(c){c.syntax=a.syntax,d(c)}),a.enums&&a.enums.forEach(function(c){c.syntax=a.syntax})}var l=function(a){this.ns=new u.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(c){var p=this.ptr.getChild(c);p===null&&this.ptr.addChild(p=new u.Namespace(this,this.ptr,c)),this.ptr=p},this),this},h.create=function(a){var c,p,f,m,_;if(!a)return this;if(Array.isArray(a)){if(a.length===0)return this;a=a.slice()}else a=[a];for(c=[a];c.length>0;){if(a=c.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 u.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 u.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 R=null;if(typeof v.oneof=="string"&&!(R=m[v.oneof]))throw Error("illegal oneof in "+f.name+"#"+v.name+": "+v.oneof);v=new u.Message.Field(this,f,v.rule,v.keytype,v.type,v.name,v.id,v.options,R,p.syntax),R&&R.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){c.push(a),a=_,_=null,this.ptr=f,f=null;continue}_=null}else if(l.isEnum(p))f=new u.Enum(this,this.ptr,p.name,p.options,p.syntax),p.values.forEach(function(v){f.addChild(new u.Enum.Value(this,f,v.name,v.id))},this),this.ptr.addChild(f);else if(l.isService(p))f=new u.Service(this,this.ptr,p.name,p.options),Object.keys(p.rpc).forEach(function(v){var R=p.rpc[v];f.addChild(new u.Service.RPCMethod(this,f,v,R.request,R.response,!!R.request_stream,!!R.response_stream,R.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 R,y,P,L;if(f.getChild(0|v.id)!==null)throw Error("duplicate extended field id in "+f.name+": "+v.id);if(f.extensions&&(R=!1,f.extensions.forEach(function(N){v.id>=N[0]&&v.id<=N[1]&&(R=!0)}),!R))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)),P=new u.Message.ExtensionField(this,f,v.rule,v.type,this.ptr.fqn()+"."+y,v.id,v.options),L=new u.Extension(this,this.ptr,v.name,P),P.extension=L,this.ptr.addChild(L),f.addChild(P)},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,c){var p,f,m,_,v,R,y,P,L="/";if(typeof c=="string"){if(o.Util.IS_NODE,this.files[c]===!0)return this.reset();this.files[c]=!0}else if(typeof c=="object"){if(p=c.root,o.Util.IS_NODE,(p.indexOf("\\")>=0||c.file.indexOf("\\")>=0)&&(L="\\"),f=p+L+c.file,this.files[f]===!0)return this.reset();this.files[f]=!0}if(a.imports&&a.imports.length>0){for(_=!1,typeof c=="object"?(this.importRoot=c.root,_=!0,m=this.importRoot,c=c.file,(m.indexOf("\\")>=0||c.indexOf("\\")>=0)&&(L="\\")):typeof c=="string"?this.importRoot?m=this.importRoot:c.indexOf("/")>=0?(m=c.replace(/\/[^\/]*$/,""))===""&&(m="/"):c.indexOf("\\")>=0?(m=c.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((R=a.imports[v])==="google/protobuf/descriptor.proto"||(R=m+L+R,this.files[R]===!0))continue;if(/\.proto$/i.test(R)&&!o.DotProto&&(R=R.replace(/\.proto$/,".json")),(y=o.Util.fetch(R))===null)throw Error("failed to import '"+R+"' in '"+c+"': file not found");/\.json$/i.test(R)?this.import(JSON.parse(y+""),R):this.import(o.DotProto.Parser.parse(y),R)}else c?/\.(\w+)$/.test(c)?this.import(a.imports[v],c.replace(/^(.+)\.(\w+)$/,function(N,E,A){return E+"_import"+v+"."+A})):this.import(a.imports[v],c+"_import"+v):this.import(a.imports[v]);_&&(this.importRoot=null)}return a.package&&this.define(a.package),a.syntax&&d(a),P=this.ptr,a.options&&Object.keys(a.options).forEach(function(N){P.options[N]=a.options[N]}),a.messages&&(this.create(a.messages),this.ptr=P),a.enums&&(this.create(a.enums),this.ptr=P),a.services&&(this.create(a.services),this.ptr=P),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 u.Namespace)this.ptr.children.forEach(function(c){this.ptr=c,this.resolveAll()},this);else if(this.ptr instanceof u.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 u.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 u.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 u.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 c,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(c=typeof a=="string"?a.split("."):a,p=this.result,f=0;f<c.length;f++){if(!p[c[f]]){p=null;break}p=p[c[f]]}return p},h.lookup=function(a,c){return a?this.ns.resolve(a,c):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 u(h){var a=0;return{next:function(){return a<h.length?{done:!1,value:h[a++]}:{done:!0}}}}var d=function(h,a){var c,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(c=Object.keys(a),p=0;p<c.length;p++)f=this.keyElem.valueFromString(c[p]),m=this.valueElem.verifyValue(a[c[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)),c=a in this.map;return delete this.map[a],c},l.entries=function(){var h,a,c=[],p=Object.keys(this.map);for(a=0;a<p.length;a++)c.push([(h=this.map[p[a]]).key,h.value]);return u(c)},l.keys=function(){var h,a=[],c=Object.keys(this.map);for(h=0;h<c.length;h++)a.push(this.map[c[h]].key);return u(a)},l.values=function(){var h,a=[],c=Object.keys(this.map);for(h=0;h<c.length;h++)a.push(this.map[c[h]].value);return u(a)},l.forEach=function(h,a){var c,p,f=Object.keys(this.map);for(p=0;p<f.length;p++)h.call(a,(c=this.map[f[p]]).value,c.key,this)},l.set=function(h,a){var c=this.keyElem.verifyValue(h),p=this.valueElem.verifyValue(a);return this.map[this.keyElem.valueToString(c)]={key:c,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,u){return(typeof s=="string"||s&&typeof s.file=="string"&&typeof s.root=="string")&&(u=s,s=void 0),i.loadJson(i.DotProto.Parser.parse(o),s,u)},i.protoFromString=i.loadProto,i.loadProtoFile=function(o,s,u){if(s&&typeof s=="object"?(u=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,u,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,u,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,u){return(typeof s=="string"||s&&typeof s.file=="string"&&typeof s.root=="string")&&(u=s,s=null),s&&typeof s=="object"||(s=i.newBuilder()),typeof o=="string"&&(o=JSON.parse(o)),s.import(o,u),s.resolveAll(),s},i.loadJsonFile=function(o,s,u){if(s&&typeof s=="object"?(u=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),u,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),u,o)},r=Rs,i.loadProto(r,void 0,"").build("Modules").probuf}(function(n){function e(a){var c=0;return function(){return c<a.length?a.charCodeAt(c++):null}}function t(){var a=[],c=[];return function(){return arguments.length===0?c.join("")+u.apply(String,a):(a.length+arguments.length>1024&&(c.push(u.apply(String,a)),a.length=0),void Array.prototype.push.apply(a,arguments))}}function r(a,c,p,f,m){var _,v,R=8*m-f-1,y=(1<<R)-1,P=y>>1,L=-7,N=p?m-1:0,E=p?-1:1,A=a[c+N];for(N+=E,_=A&(1<<-L)-1,A>>=-L,L+=R;L>0;_=256*_+a[c+N],N+=E,L-=8);for(v=_&(1<<-L)-1,_>>=-L,L+=f;L>0;v=256*v+a[c+N],N+=E,L-=8);if(_===0)_=1-P;else{if(_===y)return v?NaN:1/0*(A?-1:1);v+=Math.pow(2,f),_-=P}return(A?-1:1)*v*Math.pow(2,_-f)}function i(a,c,p,f,m,_){var v,R,y,P=8*_-m-1,L=(1<<P)-1,N=L>>1,E=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=f?0:_-1,F=f?1:-1,q=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||1/0===c?(R=isNaN(c)?1:0,v=L):(v=Math.floor(Math.log(c)/Math.LN2),c*(y=Math.pow(2,-v))<1&&(v--,y*=2),(c+=v+N>=1?E/y:E*Math.pow(2,1-N))*y>=2&&(v++,y/=2),v+N>=L?(R=0,v=L):v+N>=1?(R=(c*y-1)*Math.pow(2,m),v+=N):(R=c*Math.pow(2,N-1)*Math.pow(2,m),v=0));m>=8;a[p+A]=255&R,A+=F,R/=256,m-=8);for(v=v<<m|R,P+=m;P>0;a[p+A]=255&v,A+=F,v/=256,P-=8);a[p+A-F]|=128*q}var o,s,u,d,l,h=function(a,c,p){if(a===void 0&&(a=h.DEFAULT_CAPACITY),c===void 0&&(c=h.DEFAULT_ENDIAN),p===void 0&&(p=h.DEFAULT_NOASSERT),!p){if((a|=0)<0)throw RangeError("Illegal capacity");c=!!c,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=c,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),u=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(a,c,p){return new h(a,c,p)},h.concat=function(a,c,p,f){var m,_,v,R,y,P;for((typeof c=="boolean"||typeof c!="string")&&(f=p,p=c,c=void 0),m=0,v=0,R=a.length;R>v;++v)h.isByteBuffer(a[v])||(a[v]=h.wrap(a[v],c)),(_=a[v].limit-a[v].offset)>0&&(m+=_);if(m===0)return new h(0,p,f);for(P=new h(m,p,f),v=0;R>v;)(_=(y=a[v++]).limit-y.offset)<=0||(P.view.set(y.view.subarray(y.offset,y.limit),P.offset),P.offset+=_);return P.limit=P.offset,P.offset=0,P},h.isByteBuffer=function(a){return(a&&a.__isByteBuffer__)===!0},h.type=function(){return ArrayBuffer},h.wrap=function(a,c,p,f){var m,_;if(typeof c!="string"&&(f=p,p=c,c=void 0),typeof a=="string")switch(c===void 0&&(c="utf8"),c){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: "+c)}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,c){var p,f,m,_,v,R,y=c===void 0;if(y&&(c=this.offset),!this.noAssert){if(!(a instanceof Array))throw TypeError("Illegal BitSet: Not an array");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}for(f=c,_=(m=a.length)>>3,v=0,c+=this.writeVarint32(m,c);_--;)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,c++);if(m>v){for(R=0,p=0;m>v;)p|=(1&!!a[v++])<<R++;this.writeByte(p,c++)}return y?(this.offset=c,this):c-f},o.readBitSet=function(a){var c,p,f,m,_,v,R,y=a===void 0;for(y&&(a=this.offset),m=(f=(p=this.readVarint32(a)).value)>>3,_=0,v=[],a+=p.length;m--;)c=this.readByte(a++),v[_++]=!!(1&c),v[_++]=!!(2&c),v[_++]=!!(4&c),v[_++]=!!(8&c),v[_++]=!!(16&c),v[_++]=!!(32&c),v[_++]=!!(64&c),v[_++]=!!(128&c);if(f>_)for(R=0,c=this.readByte(a++);f>_;)v[_++]=!!(1&c>>R++);return y&&(this.offset=a),v},o.readBytes=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+"+a+") <= "+this.buffer.byteLength)}return p=this.slice(c,c+a),f&&(this.offset+=a),p},o.writeBytes=o.append,o.writeInt8=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=1)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=1,this.view[c]=a,f&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(a){var c,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&(c=this.view[a]))==128&&(c=-(255-c+1)),p&&(this.offset+=1),c},o.readByte=o.readInt8,o.writeUint8=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=1)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=1,this.view[c]=a,f&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(a){var c,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 c=this.view[a],p&&(this.offset+=1),c},o.readUInt8=o.readUint8,o.writeInt16=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=2)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=2,this.littleEndian?(this.view[c+1]=(65280&a)>>>8,this.view[c]=255&a):(this.view[c]=(65280&a)>>>8,this.view[c+1]=255&a),f&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(a){var c,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 c=0,this.littleEndian?(c=this.view[a],c|=this.view[a+1]<<8):(c=this.view[a]<<8,c|=this.view[a+1]),(32768&c)==32768&&(c=-(65535-c+1)),p&&(this.offset+=2),c},o.readShort=o.readInt16,o.writeUint16=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=2)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=2,this.littleEndian?(this.view[c+1]=(65280&a)>>>8,this.view[c]=255&a):(this.view[c]=(65280&a)>>>8,this.view[c+1]=255&a),f&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(a){var c,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 c=0,this.littleEndian?(c=this.view[a],c|=this.view[a+1]<<8):(c=this.view[a]<<8,c|=this.view[a+1]),p&&(this.offset+=2),c},o.readUInt16=o.readUint16,o.writeInt32=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=4,this.littleEndian?(this.view[c+3]=255&a>>>24,this.view[c+2]=255&a>>>16,this.view[c+1]=255&a>>>8,this.view[c]=255&a):(this.view[c]=255&a>>>24,this.view[c+1]=255&a>>>16,this.view[c+2]=255&a>>>8,this.view[c+3]=255&a),f&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(a){var c,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 c=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),c|=0,p&&(this.offset+=4),c},o.readInt=o.readInt32,o.writeUint32=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=4,this.littleEndian?(this.view[c+3]=255&a>>>24,this.view[c+2]=255&a>>>16,this.view[c+1]=255&a>>>8,this.view[c]=255&a):(this.view[c]=255&a>>>24,this.view[c+1]=255&a>>>16,this.view[c+2]=255&a>>>8,this.view[c+3]=255&a),f&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(a){var c,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 c=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),p&&(this.offset+=4),c},o.readUInt32=o.readUint32,n&&(o.writeInt64=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=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 c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a)),(c+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=8,f=a.low,m=a.high,this.littleEndian?(this.view[c+3]=255&f>>>24,this.view[c+2]=255&f>>>16,this.view[c+1]=255&f>>>8,this.view[c]=255&f,c+=4,this.view[c+3]=255&m>>>24,this.view[c+2]=255&m>>>16,this.view[c+1]=255&m>>>8,this.view[c]=255&m):(this.view[c]=255&m>>>24,this.view[c+1]=255&m>>>16,this.view[c+2]=255&m>>>8,this.view[c+3]=255&m,c+=4,this.view[c]=255&f>>>24,this.view[c+1]=255&f>>>16,this.view[c+2]=255&f>>>8,this.view[c+3]=255&f),_&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(a){var c,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 c=0,p=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=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,c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),f=new n(c,p,!1),m&&(this.offset+=8),f},o.readLong=o.readInt64,o.writeUint64=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=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 c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a)),(c+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=8,f=a.low,m=a.high,this.littleEndian?(this.view[c+3]=255&f>>>24,this.view[c+2]=255&f>>>16,this.view[c+1]=255&f>>>8,this.view[c]=255&f,c+=4,this.view[c+3]=255&m>>>24,this.view[c+2]=255&m>>>16,this.view[c+1]=255&m>>>8,this.view[c]=255&m):(this.view[c]=255&m>>>24,this.view[c+1]=255&m>>>16,this.view[c+2]=255&m>>>8,this.view[c+3]=255&m,c+=4,this.view[c]=255&f>>>24,this.view[c+1]=255&f>>>16,this.view[c+2]=255&f>>>8,this.view[c+3]=255&f),_&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(a){var c,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 c=0,p=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=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,c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),f=new n(c,p,!0),m&&(this.offset+=8),f},o.readUInt64=o.readUint64),o.writeFloat32=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number")throw TypeError("Illegal value: "+a+" (not a number)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=4,i(this.view,a,c,this.littleEndian,23,4),f&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(a){var c,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 c=r(this.view,a,this.littleEndian,23,4),p&&(this.offset+=4),c},o.readFloat=o.readFloat32,o.writeFloat64=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number")throw TypeError("Illegal value: "+a+" (not a number)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=8,i(this.view,a,c,this.littleEndian,52,8),f&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(a){var c,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 c=r(this.view,a,this.littleEndian,52,8),p&&(this.offset+=8),c},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,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}for((c+=f=h.calculateVarint32(a))>(m=this.buffer.byteLength)&&this.resize((m*=2)>c?m:c),c-=f,a>>>=0;a>=128;)p=128|127&a,this.view[c++]=p,a>>>=7;return this.view[c++]=a,_?(this.offset=c,this):f},o.writeVarint32ZigZag=function(a,c){return this.writeVarint32(h.zigZagEncode32(a),c)},o.readVarint32=function(a){var c,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;c=this.view[a++],p<5&&(f|=(127&c)<<7*p),++p}while((128&c)!=0);return f|=0,_?(this.offset=a,f):{value:f,length:p}},o.readVarint32ZigZag=function(a){var c=this.readVarint32(a);return typeof c=="object"?c.value=h.zigZagDecode32(c.value):c=h.zigZagDecode32(c),c},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 c=a.toInt()>>>0,p=a.shiftRightUnsigned(28).toInt()>>>0,f=a.shiftRightUnsigned(56).toInt()>>>0;return f==0?p==0?c<16384?c<128?1:2:1<<21>c?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,c){var p,f,m,_,v,R=c===void 0;if(R&&(c=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 c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+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,(c+=p)>(v=this.buffer.byteLength)&&this.resize((v*=2)>c?v:c),c-=p,p){case 10:this.view[c+9]=1&_>>>7;case 9:this.view[c+8]=p!==9?128|_:127&_;case 8:this.view[c+7]=p!==8?128|m>>>21:127&m>>>21;case 7:this.view[c+6]=p!==7?128|m>>>14:127&m>>>14;case 6:this.view[c+5]=p!==6?128|m>>>7:127&m>>>7;case 5:this.view[c+4]=p!==5?128|m:127&m;case 4:this.view[c+3]=p!==4?128|f>>>21:127&f>>>21;case 3:this.view[c+2]=p!==3?128|f>>>14:127&f>>>14;case 2:this.view[c+1]=p!==2?128|f>>>7:127&f>>>7;case 1:this.view[c]=p!==1?128|f:127&f}return R?(this.offset+=p,this):p},o.writeVarint64ZigZag=function(a,c){return this.writeVarint64(h.zigZagEncode64(a),c)},o.readVarint64=function(a){var c,p,f,m,_,v,R=a===void 0;if(R&&(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(c=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),R?(this.offset=a,v):{value:v,length:a-c}},o.readVarint64ZigZag=function(a){var c=this.readVarint64(a);return c&&c.value instanceof n?c.value=h.zigZagDecode64(c.value):c=h.zigZagDecode64(c),c}),o.writeCString=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=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 c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return f=l.calculateUTF16asUTF8(e(a))[1],c+=f+1,m=this.buffer.byteLength,c>m&&this.resize((m*=2)>c?m:c),c-=f+1,l.encodeUTF16toUTF8(e(a),function(v){this.view[c++]=v}.bind(this)),this.view[c++]=0,_?(this.offset=c,this):f},o.readCString=function(a){var c,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 c=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=t(),!0),m?(this.offset=a,p()):{string:p(),length:a-c}},o.writeIString=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}if(f=c,p=l.calculateUTF16asUTF8(e(a),this.noAssert)[1],c+=4+p,m=this.buffer.byteLength,c>m&&this.resize((m*=2)>c?m:c),c-=4+p,this.littleEndian?(this.view[c+3]=255&p>>>24,this.view[c+2]=255&p>>>16,this.view[c+1]=255&p>>>8,this.view[c]=255&p):(this.view[c]=255&p>>>24,this.view[c+1]=255&p>>>16,this.view[c+2]=255&p>>>8,this.view[c+3]=255&p),c+=4,l.encodeUTF16toUTF8(e(a),function(v){this.view[c++]=v}.bind(this)),c!==f+4+p)throw RangeError("Illegal range: Truncated data, "+c+" == "+(c+4+p));return _?(this.offset=c,this):c-f},o.readIString=function(a){var c,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 c=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-c}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",o.writeUTF8String=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return f=c,p=l.calculateUTF16asUTF8(e(a))[1],c+=p,m=this.buffer.byteLength,c>m&&this.resize((m*=2)>c?m:c),c-=p,l.encodeUTF16toUTF8(e(a),function(v){this.view[c++]=v}.bind(this)),_?(this.offset=c,this):c-f},o.writeString=o.writeUTF8String,h.calculateUTF8Chars=function(a){return l.calculateUTF16asUTF8(e(a))[0]},h.calculateUTF8Bytes=function(a){return l.calculateUTF16asUTF8(e(a))[1]},h.calculateString=h.calculateUTF8Bytes,o.readUTF8String=function(a,c,p){var f,m,_,v,R;if(typeof c=="number"&&(p=c,c=void 0),(f=p===void 0)&&(p=this.offset),c===void 0&&(c=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,c===h.METRICS_CHARS){if(m=t(),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(c===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(R=p+a,l.decodeUTF8toUTF16(function(){return R>p?this.view[p++]:null}.bind(this),m=t(),this.noAssert),p!==R)throw RangeError("Illegal range: Truncated data, "+p+" == "+R);return f?(this.offset=p,m()):{string:m(),length:p-v}}throw TypeError("Unsupported metrics: "+c)},o.readString=o.readUTF8String,o.writeVString=function(a,c){var p,f,m,_,v=c===void 0;if(v&&(c=this.offset),!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}if(m=c,p=l.calculateUTF16asUTF8(e(a),this.noAssert)[1],f=h.calculateVarint32(p),c+=f+p,_=this.buffer.byteLength,c>_&&this.resize((_*=2)>c?_:c),c-=f+p,c+=this.writeVarint32(p,c),l.encodeUTF16toUTF8(e(a),function(R){this.view[c++]=R}.bind(this)),c!==m+p+f)throw RangeError("Illegal range: Truncated data, "+c+" == "+(c+p+f));return v?(this.offset=c,this):c-m},o.readVString=function(a){var c,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 c=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-c}},o.append=function(a,c,p){var f,m,_;if((typeof c=="number"||typeof c!="string")&&(p=c,c=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,c)),(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,c){return a.append(this,c),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 c=new h(0,this.littleEndian,this.noAssert);return a?(c.buffer=new ArrayBuffer(this.buffer.byteLength),c.view=new Uint8Array(c.buffer)):(c.buffer=this.buffer,c.view=this.view),c.offset=this.offset,c.markedOffset=this.markedOffset,c.limit=this.limit,c},o.compact=function(a,c){var p,f,m;if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}return a===0&&c===this.buffer.byteLength?this:(p=c-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,c)),this.buffer=f,this.view=m,this.markedOffset>=0&&(this.markedOffset-=a),this.offset=0,this.limit=p,this)},o.copy=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}if(a===c)return new h(0,this.littleEndian,this.noAssert);var p=c-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,c),f},o.copyTo=function(a,c,p,f){var m,_,v;if(!this.noAssert&&!h.isByteBuffer(a))throw TypeError("Illegal target: Not a ByteBuffer");if(c=(_=c===void 0)?a.offset:0|c,p=(m=p===void 0)?this.offset:0|p,f=f===void 0?this.limit:0|f,c<0||c>a.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+c+" <= "+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(c+v),a.view.set(this.view.subarray(p,f),c),m&&(this.offset+=v),_&&(a.offset+=v),this)},o.ensureCapacity=function(a){var c=this.buffer.byteLength;return a>c?this.resize((c*=2)>a?c:a):this},o.fill=function(a,c,p){var f=c===void 0;if(f&&(c=this.offset),typeof a=="string"&&a.length>0&&(a=a.charCodeAt(0)),c===void 0&&(c=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 c!="number"||c%1!=0)throw TypeError("Illegal begin: Not an integer");if(c>>>=0,typeof p!="number"||p%1!=0)throw TypeError("Illegal end: Not an integer");if(p>>>=0,c<0||c>p||p>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+c+" <= "+p+" <= "+this.buffer.byteLength)}if(c>=p)return this;for(;p>c;)this.view[c++]=a;return f&&(this.offset=c),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,c,p){var f,m,_,v,R;if((typeof c=="number"||typeof c!="string")&&(p=c,c=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,c)),(m=a.limit-a.offset)<=0||((_=m-p)>0?(v=new ArrayBuffer(this.buffer.byteLength+_),(R=new Uint8Array(v)).set(this.view.subarray(p,this.buffer.byteLength),m),this.buffer=v,this.view=R,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,c){return a.prepend(this,c),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 c,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&&(c=new ArrayBuffer(a),(p=new Uint8Array(c)).set(this.view),this.buffer=c,this.view=p),this},o.reverse=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}return a===c||Array.prototype.reverse.call(this.view.subarray(a,c)),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 c=this.offset+a;if(!this.noAssert&&(c<0||c>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+a+" <= "+this.buffer.byteLength);return this.offset=c,this},o.slice=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}var p=this.clone();return p.offset=a,p.limit=c,p},o.toBuffer=function(a){var c,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:(c=new ArrayBuffer(f-p),new Uint8Array(c).set(new Uint8Array(this.buffer).subarray(p,f),0),c):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(a,c,p){if(a===void 0)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch(typeof a=="number"&&(p=c=a="utf8"),a){case"utf8":return this.toUTF8(c,p);case"base64":return this.toBase64(c,p);case"hex":return this.toHex(c,p);case"binary":return this.toBinary(c,p);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+a)}},d=function(){var a,c,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,c=f.length;c>a;++a)m[f[a]]=a;return p.encode=function(_,v){for(var R,y;(R=_())!==null;)v(f[63&R>>2]),y=(3&R)<<4,(R=_())!==null?(v(f[63&((y|=15&R>>4)|15&R>>4)]),y=(15&R)<<2,(R=_())!==null?(v(f[63&(y|3&R>>6)]),v(f[63&R])):(v(f[63&y]),v(61))):(v(f[63&y]),v(61),v(61))},p.decode=function(_,v){function R(N){throw Error("Illegal character code: "+N)}for(var y,P,L;(y=_())!==null;)if((P=m[y])===void 0&&R(y),(y=_())!==null&&((L=m[y])===void 0&&R(y),v(P<<2>>>0|(48&L)>>4),(y=_())!==null)){if((P=m[y])===void 0){if(y===61)break;R(y)}if(v((15&L)<<4>>>0|(60&P)>>2),(y=_())!==null){if((L=m[y])===void 0){if(y===61)break;R(y)}v((3&P)<<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,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),c|=0,(a|=0)<0||c>this.capacity||a>c)throw RangeError("begin, end");var p;return d.encode(function(){return c>a?this.view[a++]:null}.bind(this),p=t()),p()},h.fromBase64=function(a,c){if(typeof a!="string")throw TypeError("str");var p=new h(a.length/4*3,c),f=0;return d.decode(e(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,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),c|=0,(a|=0)<0||c>this.capacity()||a>c)throw RangeError("begin, end");if(a===c)return"";for(var p=[],f=[];c>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,c){if(typeof a!="string")throw TypeError("str");for(var p,f=0,m=a.length,_=new h(m,c);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 c,p=-1,f=this.buffer.byteLength,m="",_="",v="";f>p;){if(p!==-1&&(m+=(c=this.view[p])<16?"0"+c.toString(16).toUpperCase():c.toString(16).toUpperCase(),a&&(_+=c>32&&c<127?String.fromCharCode(c):".")),++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,c,p){for(var f,m,_=a.length,v=new h(0|(_+1)/3,c,p),R=0,y=0,P=!1,L=!1,N=!1,E=!1,A=!1;_>R;){switch(f=a.charAt(R++)){case"!":if(!p){if(L||N||E){A=!0;break}L=N=E=!0}v.offset=v.markedOffset=v.limit=y,P=!1;break;case"|":if(!p){if(L||E){A=!0;break}L=E=!0}v.offset=v.limit=y,P=!1;break;case"[":if(!p){if(L||N){A=!0;break}L=N=!0}v.offset=v.markedOffset=y,P=!1;break;case"<":if(!p){if(L){A=!0;break}L=!0}v.offset=y,P=!1;break;case"]":if(!p){if(E||N){A=!0;break}E=N=!0}v.limit=v.markedOffset=y,P=!1;break;case">":if(!p){if(E){A=!0;break}E=!0}v.limit=y,P=!1;break;case"'":if(!p){if(N){A=!0;break}N=!0}v.markedOffset=y,P=!1;break;case" ":P=!1;break;default:if(!p&&P){A=!0;break}if(m=parseInt(f+a.charAt(R++),16),!p&&(isNaN(m)||m<0||m>255))throw TypeError("Illegal str: Not a debug encoded string");v.view[y++]=m,P=!0}if(A)throw TypeError("Illegal str: Invalid symbol at "+R)}if(!p){if(!L||!E)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,c){if(a=a===void 0?this.offset:a,c=c===void 0?this.limit:c,!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}for(var p,f=new Array(c-a);c>a;)(p=this.view[a++])<16?f.push("0",p.toString(16)):f.push(p.toString(16));return f.join("")},h.fromHex=function(a,c,p){var f,m,_,v,R;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,c),v=0,R=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[R++]=f}return _.limit=R,_},l=function(){var a={MAX_CODEPOINT:1114111,encodeUTF8:function(c,p){var f=null;for(typeof c=="number"&&(f=c,c=function(){return null});f!==null||(f=c())!==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(c,p){for(var f,m,_,v,R=function(y){y=y.slice(0,y.indexOf(null));var P=Error(y.toString());throw P.name="TruncatedError",P.bytes=y,P};(f=c())!==null;)if((128&f)==0)p(f);else if((224&f)==192)(m=c())===null&&R([f,m]),p((31&f)<<6|63&m);else if((240&f)==224)((m=c())===null||(_=c())===null)&&R([f,m,_]),p((15&f)<<12|(63&m)<<6|63&_);else{if((248&f)!=240)throw RangeError("Illegal starting byte: "+f);((m=c())===null||(_=c())===null||(v=c())===null)&&R([f,m,_,v]),p((7&f)<<18|(63&m)<<12|(63&_)<<6|63&v)}},UTF16toUTF8:function(c,p){for(var f,m=null;(f=m!==null?m:c())!==null;)f>=55296&&f<=57343&&(m=c())!==null&&m>=56320&&m<=57343?(p(1024*(f-55296)+m-56320+65536),m=null):p(f);m!==null&&p(m)},UTF8toUTF16:function(c,p){var f=null;for(typeof c=="number"&&(f=c,c=function(){return null});f!==null||(f=c())!==null;)f<=65535?p(f):(p(55296+((f-=65536)>>10)),p(f%1024+56320)),f=null},encodeUTF16toUTF8:function(c,p){a.UTF16toUTF8(c,function(f){a.encodeUTF8(f,p)})},decodeUTF8toUTF16:function(c,p){a.decodeUTF8(c,function(f){a.UTF8toUTF16(f,p)})},calculateCodePoint:function(c){return c<128?1:c<2048?2:c<65536?3:4},calculateUTF8:function(c){for(var p,f=0;(p=c())!==null;)f+=p<128?1:p<2048?2:p<65536?3:4;return f},calculateUTF16asUTF8:function(c){var p=0,f=0;return a.UTF16toUTF8(c,function(m){++p,f+=m<128?1:m<2048?2:m<65536?3:4}),[p,f]}};return a}(),o.toUTF8=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}var p;try{l.decodeUTF8toUTF16(function(){return c>a?this.view[a++]:null}.bind(this),p=t())}catch{if(a!==c)throw RangeError("Illegal range: Truncated data, "+a+" != "+c)}return p()},h.fromUTF8=function(a,c,p){if(!p&&typeof a!="string")throw TypeError("Illegal str: Not a string");var f=new h(l.calculateUTF16asUTF8(e(a),!0)[1],c,p),m=0;return l.encodeUTF16toUTF8(e(a),function(_){f.view[m++]=_}),f.limit=m,f},h}(Cs=function(){function n(E,A,F){this.low=0|E,this.high=0|A,this.unsigned=!!F}function e(E){return(E&&E.__isLong__)===!0}function t(E,A){var F,q,C;return A?(C=(E>>>=0)>=0&&E<256)&&(q=d[E])?q:(F=i(E,(0|E)<0?-1:0,!0),C&&(d[E]=F),F):(C=(E|=0)>=-128&&E<128)&&(q=u[E])?q:(F=i(E,E<0?-1:0,!1),C&&(u[E]=F),F)}function r(E,A){if(isNaN(E)||!isFinite(E))return A?m:f;if(A){if(E<0)return m;if(E>=a)return P}else{if(-c>=E)return L;if(E+1>=c)return y}return E<0?r(-E,A).neg():i(0|E%h,0|E/h,A)}function i(E,A,F){return new n(E,A,F)}function o(E,A,F){var q,C,T,S,O,I,U;if(E.length===0)throw Error("empty string");if(E==="NaN"||E==="Infinity"||E==="+Infinity"||E==="-Infinity")return f;if(typeof A=="number"?(F=A,A=!1):A=!!A,(F=F||10)<2||F>36)throw RangeError("radix");if((q=E.indexOf("-"))>0)throw Error("interior hyphen");if(q===0)return o(E.substring(1),A,F).neg();for(C=r(l(F,8)),T=f,S=0;S<E.length;S+=8)O=Math.min(8,E.length-S),I=parseInt(E.substring(S,S+O),F),O<8?(U=r(l(F,O)),T=T.mul(U).add(r(I))):T=(T=T.mul(C)).add(r(I));return T.unsigned=A,T}function s(E){return E instanceof n?E:typeof E=="number"?r(E):typeof E=="string"?o(E):i(E.low,E.high,E.unsigned)}var u,d,l,h,a,c,p,f,m,_,v,R,y,P,L,N;return n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),n.isLong=e,u={},d={},n.fromInt=t,n.fromNumber=r,n.fromBits=i,l=Math.pow,n.fromString=o,n.fromValue=s,c=(a=(h=4294967296)*h)/2,p=t(16777216),f=t(0),n.ZERO=f,m=t(0,!0),n.UZERO=m,_=t(1),n.ONE=_,v=t(1,!0),n.UONE=v,R=t(-1),n.NEG_ONE=R,y=i(-1,2147483647,!1),n.MAX_VALUE=y,P=i(-1,-1,!0),n.MAX_UNSIGNED_VALUE=P,L=i(0,-2147483648,!1),n.MIN_VALUE=L,(N=n.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},N.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},N.toString=function(E){var A,F,q,C,T,S,O,I;if((E=E||10)<2||E>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(L)?(A=r(E),q=(F=this.div(A)).mul(A).sub(this),F.toString(E)+q.toInt().toString(E)):"-"+this.neg().toString(E);for(C=r(l(E,6),this.unsigned),T=this,S="";;){if(O=T.div(C),I=(T.sub(O.mul(C)).toInt()>>>0).toString(E),(T=O).isZero())return I+S;for(;I.length<6;)I="0"+I;S=""+I+S}},N.getHighBits=function(){return this.high},N.getHighBitsUnsigned=function(){return this.high>>>0},N.getLowBits=function(){return this.low},N.getLowBitsUnsigned=function(){return this.low>>>0},N.getNumBitsAbs=function(){var E,A;if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(E=this.high!=0?this.high:this.low,A=31;A>0&&(E&1<<A)==0;A--);return this.high!=0?A+33:A+1},N.isZero=function(){return this.high===0&&this.low===0},N.isNegative=function(){return!this.unsigned&&this.high<0},N.isPositive=function(){return this.unsigned||this.high>=0},N.isOdd=function(){return(1&this.low)==1},N.isEven=function(){return(1&this.low)==0},N.equals=function(E){return e(E)||(E=s(E)),(this.unsigned===E.unsigned||this.high>>>31!=1||E.high>>>31!=1)&&this.high===E.high&&this.low===E.low},N.eq=N.equals,N.notEquals=function(E){return!this.eq(E)},N.neq=N.notEquals,N.lessThan=function(E){return this.comp(E)<0},N.lt=N.lessThan,N.lessThanOrEqual=function(E){return this.comp(E)<=0},N.lte=N.lessThanOrEqual,N.greaterThan=function(E){return this.comp(E)>0},N.gt=N.greaterThan,N.greaterThanOrEqual=function(E){return this.comp(E)>=0},N.gte=N.greaterThanOrEqual,N.compare=function(E){if(e(E)||(E=s(E)),this.eq(E))return 0;var A=this.isNegative(),F=E.isNegative();return A&&!F?-1:!A&&F?1:this.unsigned?E.high>>>0>this.high>>>0||E.high===this.high&&E.low>>>0>this.low>>>0?-1:1:this.sub(E).isNegative()?-1:1},N.comp=N.compare,N.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(_)},N.neg=N.negate,N.add=function(E){var A,F,q,C,T,S,O,I,U,D,$;return e(E)||(E=s(E)),A=this.high>>>16,F=65535&this.high,q=this.low>>>16,C=65535&this.low,T=E.high>>>16,S=65535&E.high,O=E.low>>>16,I=0,U=0,D=0,$=0,D+=($+=C+(65535&E.low))>>>16,U+=(D+=q+O)>>>16,I+=(U+=F+S)>>>16,I+=A+T,i((D&=65535)<<16|($&=65535),(I&=65535)<<16|(U&=65535),this.unsigned)},N.subtract=function(E){return e(E)||(E=s(E)),this.add(E.neg())},N.sub=N.subtract,N.multiply=function(E){var A,F,q,C,T,S,O,I,U,D,$,j;return this.isZero()?f:(e(E)||(E=s(E)),E.isZero()?f:this.eq(L)?E.isOdd()?L:f:E.eq(L)?this.isOdd()?L:f:this.isNegative()?E.isNegative()?this.neg().mul(E.neg()):this.neg().mul(E).neg():E.isNegative()?this.mul(E.neg()).neg():this.lt(p)&&E.lt(p)?r(this.toNumber()*E.toNumber(),this.unsigned):(A=this.high>>>16,F=65535&this.high,q=this.low>>>16,C=65535&this.low,T=E.high>>>16,S=65535&E.high,O=E.low>>>16,U=0,D=0,$=0,j=0,$+=(j+=C*(I=65535&E.low))>>>16,D+=($+=q*I)>>>16,$&=65535,D+=($+=C*O)>>>16,U+=(D+=F*I)>>>16,D&=65535,U+=(D+=q*O)>>>16,D&=65535,U+=(D+=C*S)>>>16,U+=A*I+F*O+q*S+C*T,i(($&=65535)<<16|(j&=65535),(U&=65535)<<16|(D&=65535),this.unsigned)))},N.mul=N.multiply,N.divide=function(E){var A,F,q,C,T,S,O;if(e(E)||(E=s(E)),E.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;if(this.unsigned){if(E.unsigned||(E=E.toUnsigned()),E.gt(this))return m;if(E.gt(this.shru(1)))return v;q=m}else{if(this.eq(L))return E.eq(_)||E.eq(R)?L:E.eq(L)?_:(A=this.shr(1).div(E).shl(1)).eq(f)?E.isNegative()?_:R:(F=this.sub(E.mul(A)),q=A.add(F.div(E)));if(E.eq(L))return this.unsigned?m:f;if(this.isNegative())return E.isNegative()?this.neg().div(E.neg()):this.neg().div(E).neg();if(E.isNegative())return this.div(E.neg()).neg();q=f}for(F=this;F.gte(E);){for(A=Math.max(1,Math.floor(F.toNumber()/E.toNumber())),T=(C=Math.ceil(Math.log(A)/Math.LN2))<=48?1:l(2,C-48),O=(S=r(A)).mul(E);O.isNegative()||O.gt(F);)O=(S=r(A-=T,this.unsigned)).mul(E);S.isZero()&&(S=_),q=q.add(S),F=F.sub(O)}return q},N.div=N.divide,N.modulo=function(E){return e(E)||(E=s(E)),this.sub(this.div(E).mul(E))},N.mod=N.modulo,N.not=function(){return i(~this.low,~this.high,this.unsigned)},N.and=function(E){return e(E)||(E=s(E)),i(this.low&E.low,this.high&E.high,this.unsigned)},N.or=function(E){return e(E)||(E=s(E)),i(this.low|E.low,this.high|E.high,this.unsigned)},N.xor=function(E){return e(E)||(E=s(E)),i(this.low^E.low,this.high^E.high,this.unsigned)},N.shiftLeft=function(E){return e(E)&&(E=E.toInt()),(E&=63)==0?this:E<32?i(this.low<<E,this.high<<E|this.low>>>32-E,this.unsigned):i(0,this.low<<E-32,this.unsigned)},N.shl=N.shiftLeft,N.shiftRight=function(E){return e(E)&&(E=E.toInt()),(E&=63)==0?this:E<32?i(this.low>>>E|this.high<<32-E,this.high>>E,this.unsigned):i(this.high>>E-32,this.high>=0?0:-1,this.unsigned)},N.shr=N.shiftRight,N.shiftRightUnsigned=function(E){var A;return e(E)&&(E=E.toInt()),(E&=63)==0?this:(A=this.high,E<32?i(this.low>>>E|A<<32-E,A>>>E,this.unsigned):i(E===32?A:A>>>E-32,0,this.unsigned))},N.shru=N.shiftRightUnsigned,N.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},N.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},N.toBytes=function(E){return E?this.toBytesLE():this.toBytesBE()},N.toBytesLE=function(){var E=this.high,A=this.low;return[255&A,255&A>>>8,255&A>>>16,255&A>>>24,255&E,255&E>>>8,255&E>>>16,255&E>>>24]},N.toBytesBE=function(){var E=this.high,A=this.low;return[255&E>>>24,255&E>>>16,255&E>>>8,255&E,255&A>>>24,255&A>>>16,255&A>>>8,255&A]},n}()),Cs));Ti.getModule=function(n){var e=new Ti[n];return e.getArrayData=function(){var t=e.toArrayBuffer();return t=ba(t)?[].slice.call(new Int8Array(t)):t},e};var Si,Zu="pgMsgP",Qu="chatMsg",Xu="pcMsgP",ed={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},td="delMsg",nd="joinChrm",rd="joinChrmR",id="exitChrm",od="setKV",sd="delKV",ad="setKVS",cd="delKVS",ys="qryRelationR",ud="delRelation",dd="setSeAtt",xn={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Fa="qryPMsg",ld="qryGMsg",$a="qryCHMsg",hd="qryCMsg",pd="qrySMsg",fd=((Qt={}).ppMsgP=ee.PRIVATE,Qt[Zu]=ee.GROUP,Qt[Qu]=ee.CHATROOM,Qt[Xu]=ee.CUSTOMER_SERVICE,Qt),gd=((kt={})[ee.PRIVATE]=Fa,kt[ee.GROUP]=ld,kt[ee.CHATROOM]=$a,kt[ee.CUSTOMER_SERVICE]=hd,kt[ee.SYSTEM]=pd,kt),md=((Xt={})[ee.PRIVATE]=xn.PRIVATE,Xt[ee.GROUP]=xn.GROUP,Xt[ee.CUSTOMER_SERVICE]=xn.CUSTOMER_SERVICE,Xt[ee.SYSTEM]=xn.SYSTEM,Xt),Jr="1",_d="0",Es=1,Ts=2,Ss=3,vd=function(){function n(e){this._codec=e==="websocket"?Ti:Tn,this._connectType=e}return n.prototype.decodeByPBName=function(e,t,r){var i,o=this,s=e,u=((i={})[Cn]=o._formatSyncMessages,i[wr]=o._formatReceivedMessage,i[Rn]=o._formatSentMessage,i[yn]=o._formatHistoryMessages,i[En]=o._formatConversationList,i[Mr]=o._formatChatRoomInfos,i[It]=o._formatRTCUserList,i[Pr]=o._formatRTCData,i[Ft]=o._formatChatRoomKVList,i[Lr]=o._formatUserSetting,i[Dr]=o._formatConversationStatus,i[Ur]=o._formatGrpReadReceiptQryResp,i[$t]=o._formatSetUserSettingOutput,i[kr]=o._formatUserSettingNotification,i[xr]=o._formatRTCRoomKVList,i[Ar]=o._formatRTCAuidenceJoinRoomData,i[Vr]=o._formatRTCJoinedUserInfo,i)[t];try{s=e.length>0&&o._codec[t].decode(e),Ne(s)&&(s=function(d){for(var l in d)Ne(d[l])&&(d[l]=$e(d[l]));return d}(s)),sr(u)&&(s=u.call(this,s,r))}catch(d){G.error(`PB parse error
- `,d,e,t)}return s},n.prototype._readBytes=function(e){var t=e.offset,r=e.buffer,i=e.limit;if(t)try{var o=ba(r)?new Uint8Array(r):r;return Nn.readUTF(o.subarray(t,i))}catch(s){G.info(`readBytes error
- `,s)}return e},n.prototype._formatBytes=function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(r){G.info(`formatBytes error
- `,r)}return t||e},n.prototype._formatSyncMessages=function(e,t){t=t||{};var r=this,i=e.list,o=e.syncTime,s=e.finished;return(le(s)||s===null)&&(e.finished=!0),e.syncTime=$e(o),e.list=Un(i,function(u){return r._formatReceivedMessage(u,t)}),e},n.prototype._formatReceivedMessage=function(e,t){var r=(t=t||{}).currentUserId,i=t.connectedTime,o=e.content,s=e.fromUserId,u=e.type,d=e.groupId,l=e.status,h=e.dataTime,a=e.classname,c=e.msgId,p=e.extraContent,f=e.pushContent,m=e.pushExt,_=e.configFlag,v=(e.direction||je.RECEIVE)===je.SEND,R=function(W){var Z=_n.READ;return{isPersited:!!(16&W),isCounted:!!(32&W),isMentioned:!!(64&W),disableNotification:!!(512&W),receivedStatus:Z=2&W?_n.RETRIEVED:Z,canIncludeExpansion:!!(1024&W)}}(l),y=R.isPersited,P=R.isCounted,L=R.isMentioned,N=R.disableNotification,E=R.receivedStatus,A=R.canIncludeExpansion,F=[ee.GROUP,ee.CHATROOM,ee.RTC_ROOM].indexOf(u)>-1?d:s,q=v?r:s,C=$e(h),T=C<i,S=u===ee.CHATROOM,O=this._formatBytes(o),I={};if(m&&(I=gs(m.pushConfigs,m.pushId)),O.user){var U=O.user,D=U.portrait,$=U.portraitUri,j=D||$;j&&(O.user.portrait=O.user.portraitUri=j)}var J,re=fe(fe({},I),{pushTitle:m==null?void 0:m.title,pushContent:f,pushData:f,disablePushTitle:!!_&&Boolean(4&_),forceShowDetailContent:!!_&&Boolean(8&_),templateId:m==null?void 0:m.templateId}),X=v?je.SEND:je.RECEIVE;return S&&s===r&&(X=je.SEND),p&&(J={},J=_s(p)),{conversationType:u,targetId:F,senderUserId:q,messageType:a,messageUId:c,isPersited:y,isCounted:P,isMentioned:L,sentTime:C,isOffLineMessage:T,messageDirection:X,receivedTime:xt.getTime(),disableNotification:N,receivedStatus:E,canIncludeExpansion:A,content:O,expansion:J,configFlag:_,pushConfig:re,channelId:e.busChannel||""}},n.prototype._formatSentMessage=function(e,t){var r,i=e.content,o=e.classname,s=e.sessionId,u=e.msgId,d=e.extraContent,l=e.pushExt,h=e.pushContent,a=e.configFlag,c=t.signal,p=t.currentUserId,f=c.date,m=c.topic,_=c.targetId,v=function(T){return{isPersited:!!(1&T),isCounted:!!(2&T),disableNotification:!!(32&T),canIncludeExpansion:!!(64&T)}}(s),R=v.isPersited,y=v.isCounted,P=v.disableNotification,L=v.canIncludeExpansion,N=fd[m]||ee.PRIVATE,E=Ku(ed,m),A=this._formatBytes(i),F=_;o===Ae.RECALL&&(N=A.conversationType||N,F=A.targetId||_),d&&(r={},r=_s(d));var q={};l&&(q=gs(l.pushConfigs,l.pushId));var C=fe(fe({},q),{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:N,targetId:F,messageType:o,messageUId:u,isPersited:R,isCounted:y,isStatusMessage:E,senderUserId:p,content:this._formatBytes(i),sentTime:1e3*f,receivedTime:xt.getTime(),messageDirection:je.SEND,isOffLineMessage:!1,disableNotification:P,canIncludeExpansion:L,expansion:r,pushConfig:C,channelId:e.busChannel||""}},n.prototype._formatHistoryMessages=function(e,t){var r=this,i=t.conversation||{},o=e.list,s=e.hasMsg,u=i.targetId,d=$e(e.syncTime),l=[];return ye(o,function(h){var a=r._formatReceivedMessage(h,t);a.targetId=u,l.push(a)},{isReverse:!0}),{syncTime:d,list:l,hasMore:!!s}},n.prototype._formatConversationList=function(e,t){var r=this,i=e.info,o=t.afterDecode||function(){};return(i=Un(i,function(s){var u=s.msg,d=s.userId,l=s.type,h=s.unreadCount,a=s.busChannel,c=null;u&&((c=r._formatReceivedMessage(u,t)).targetId=d);var p={targetId:d,conversationType:l,unreadMessageCount:h,latestMessage:c,channelId:a||""};return o(p)||p}))||[]},n.prototype._formatSetUserSettingOutput=function(e){return e},n.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,r=e.userInfos;return{userCount:t,userInfos:Un(r,function(i){var o=i.id,s=i.time;return{id:o,time:$e(s)}})}},n.prototype._formatChatRoomKVList=function(e){var t=e.entries,r=e.bFullUpdate,i=e.syncTime;return{kvEntries:t=Un(t=t||[],function(o){var s=o.key,u=o.value,d=o.status,l=o.timestamp,h=o.uid,a=function(c){return{isAutoDelete:!!(1&c),isOverwrite:!!(2&c),type:4&c?xe.DELETE:xe.UPDATE}}(d);return{key:s,value:u,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:h,timestamp:$e(l)}}),isFullUpdate:r,syncTime:i}},n.prototype._formatUserSetting=function(e){var t=this,r=e.items,i=e.version,o={};return ye(r||[],function(s){var u=s.key,d=s.version,l=s.value;s.version=$e(d),s.value=t._readBytes(l),u==="Tag"&&s.tags.forEach(function(h){h.createdTime=$e(h.createdTime),h.tagName=h.name}),o[u]=s}),{settings:o,version:i}},n.prototype._formatConversationStatus=function(e){var t=e.state,r=[];return ye(t,function(i){var o=i.type,s=i.channelId,u=i.time,d=i.stateItem,l=i.busChannel,h=Ut.CLOSE,a=!1,c=[];ye(d,function(p){var f=p.sessionStateType,m=p.value,_=p.tags;switch(f){case Es:h=m===Jr?Ut.OPEN:Ut.CLOSE;break;case Ts:a=m===Jr;break;case Ss:c=_}}),r.push({conversationType:o,type:o,targetId:s,notificationStatus:h,isTop:a,updatedTime:$e(u),tags:c,channelId:l||""})}),r},n.prototype._formatRTCUserList=function(e){var t=e.users,r=e.token,i=e.sessionId,o=e.roomInfo,s=e.entries,u={};return ye(t,function(d){var l=d.userId,h=d.userData,a={};ye(h,function(c){var p=c.key,f=c.value;a[p]=f}),u[l]=a}),{users:u,token:r,sessionId:i,roomInfo:o,kvEntries:s}},n.prototype._formatRTCData=function(e){var t=e.outInfo,r={};return ye(t,function(i){r[i.key]=i.value}),r},n.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,r=e.userCount,i=e.roomData,o={id:t,total:r};return ye(i,function(s){o[s.key]=s.value}),o},n.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,r=e.list;return r.forEach(function(i){i.readTime=$e(i.readTime)}),{totalMemberCount:t,list:r}},n.prototype._formatUserSettingNotification=function(e){return e},n.prototype._formatRTCRoomKVList=function(e){var t=e.entries,r=e.bFullUpdate,i=e.syncTime;return{kvEntries:t=(t=t||[]).map(function(o){var s=o.timestamp;return Object.assign(o,{timestamp:$e(s)})}),isFullUpdate:r,syncTime:i}},n.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},n.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map(function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:$e(t.joinTime)}})},n.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Wi);return e.setNothing(1),e.getArrayData()},n.prototype._getUpMsgModule=function(e,t){var r,i,o,s=this._connectType==="comet",u=(e.conversationType,t.messageType),d=t.isMentioned,l=t.mentionedType,h=t.mentionedUserIdList,a=t.content,c=t.pushContent,p=t.pushData,f=t.directionalUserIdList,m=t.isFilerWhiteBlacklist,_=t.isVoipPush,v=t.canIncludeExpansion,R=t.expansion,y=t.pushConfig,P=t.channelId;ee.GROUP;var L=this._codec.getModule(Rn),N=function(X){var W=X.isStatusMessage,Z=X.isPersited,k=X.isCounted;W&&(Z=k=!1);var z=0;return Z&&(z|=1),k&&(z|=2),X.isMentioned&&(z|=4),X.disableNotification&&(z|=32),X.canIncludeExpansion&&(z|=64),z}(t),E=y||{},A=E.pushTitle,F=E.pushContent,q=E.pushData,C=E.iOSConfig,T=E.androidConfig,S=E.templateId,O=E.disablePushTitle,I=E.forceShowDetailContent,U=0;L.setSessionId(N),d&&a&&(a.mentionedInfo={userIdList:((r=a.mentionedInfo)===null||r===void 0?void 0:r.userIdList)||h||[],type:((i=a.mentionedInfo)===null||i===void 0?void 0:i.type)||l||Yi.ALL,mentionedContent:((o=a.mentionedInfo)===null||o===void 0?void 0:o.mentionedContent)||""});var D=F||c||"",$=q||p||"";if(D&&L.setPushText(D),$&&L.setAppData($),f&&L.setUserId(f),U|=_?1:0,U|=m?2:0,U|=O?4:0,U|=I?8:0,L.setConfigFlag(U),L.setClassname(u),a.user&&a.user.portraitUri&&(a.user.portrait=a.user.portraitUri),L.setContent(JSON.stringify(a)),v&&R){var j={};ye(R,function(X,W){j[W]={v:X}}),L.setExtraContent(JSON.stringify(j))}if(y){var J=this._codec.getModule(Ji);if(A&&J.setTitle(A),C&&T){var re=Hu(C,T);J.setPushConfigs(re)}(T==null?void 0:T.notificationId)&&J.setPushId(T==null?void 0:T.notificationId),J.setTemplateId(S||""),L.setPushExt(s?J.getArrayData():J)}return le(P)||L.setBusChannel(P),L},n.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},n.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,r=e.inboxTime,i=this._codec.getModule(Zi);return i.setIspolling(!1),i.setIsPullSend(!0),i.setSendBoxSyncTime(t),i.setSyncTime(r),i.getArrayData()},n.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var r=this._codec.getModule(Qi);return r.setCount(t),r.setSyncTime(e),r.getArrayData()},n.prototype.encodeGetHistoryMsg=function(e,t){var r=t.count,i=t.order,o=t.timestamp,s=t.channelId,u=this._codec.getModule(Xi);return u.setTargetId(e),u.setTime(o),u.setCount(r),u.setOrder(i),u.setBusChannel(s||""),u.getArrayData()},n.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,r=e.startTime,i=this._codec.getModule(ur);return i.setType(1),i.setCount(t),i.setStartTime(r),i.getArrayData()},n.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,r=e.type,i=e.startTime,o=e.order;t=t||0,i=i||0,o=o||0;var s=this._codec.getModule(ur);return s.setType(r),s.setCount(t),s.setStartTime(i),s.setOrder(o),s.getArrayData()},n.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,r=e.channelId,i=this._codec.getModule(no);return i.setType(t),i.setBusChannel(r),i.getArrayData()},n.prototype.encodeRemoveConversationList=function(e){var t=this,r=this._codec.getModule(eo),i=[];return ye(e,function(o){var s=o.conversationType,u=o.targetId,d=t._codec.getModule(to);d.setType(s),d.setChannelId(u),i.push(d)}),r.setSessions(i),r.getArrayData()},n.prototype.encodeDeleteMessages=function(e,t,r,i){var o=this._codec.getModule(ro),s=[];return ye(r,function(u){s.push({msgId:u.messageUId,msgDataTime:u.sentTime,direct:u.messageDirection})}),o.setType(e),o.setConversationId(t),o.setMsgs(s),o.setBusChannel(i),o.getArrayData()},n.prototype.encodeClearMessages=function(e,t,r){var i=this._codec.getModule(io);return t=t||new Date().getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(r),i.getArrayData()},n.prototype.encodeClearUnreadCount=function(e,t){var r=e.conversationType,i=e.targetId,o=t.timestamp,s=this._codec.getModule(oo);return o=o||+new Date,s.setType(r),s.setChannelId(i),s.setMsgTime(o),s.getArrayData()},n.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(so);return e.setNothing(1),e.getArrayData()},n.prototype.encodeGetChatRoomInfo=function(e,t){var r=this._codec.getModule(co);return r.setCount(e),r.setOrder(t),r.getArrayData()},n.prototype.encodeGetFileToken=function(e,t,r,i){var o=this._codec.getModule(_o);return o.setType(e),o.setKey(t),o.setHttpMethod(r),o.setQueryString(i),o.getArrayData()},n.prototype.encodeGetFileUrl=function(e,t,r,i){var o=this._codec.getModule(e);return o.setType(t),o.setKey(r),i&&o.setFileName(i),o.getArrayData()},n.prototype.encodeModifyChatRoomKV=function(e,t,r){var i=this._connectType==="comet",o=this._codec.getModule(To),s=t.key,u=t.value,d=t.notificationExtra,l=t.isSendNotification,h=t.type||xe.UPDATE,a=vs(t,h),c={key:s,value:u||"",uid:r};if(le(a)||(c.status=a),o.setEntry(c),l){var p={conversationType:ee.CHATROOM,targetId:e},f={key:s,value:u,extra:d,type:h},m=this._getUpMsgModule(p,{messageType:Ae.CHRM_KV_NOTIFY,content:f,isPersited:!1,isCounted:!1});i?o.setNotification(m.getArrayData()):o.setNotification(m),o.setBNotify(!0),o.setType(ee.CHATROOM)}return o.getArrayData()},n.prototype.encodeModifyChatRoomKVS=function(e,t,r){this._connectType;var i=this._codec.getModule(So),o=t.entries,s=t.type||xe.UPDATE,u=vs(t,s),d=[];return o.forEach(function(l){var h={key:l.key,value:l.value||"",uid:r};le(u)||(h.status=u),d.push(h)}),i.setEntry(d),i.getArrayData()},n.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(bo);return t.setTimestamp(e),t.getArrayData()},n.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(Oo);return t.setVersion(e),t.getArrayData()},n.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(No);return t.setTime(e),t.getArrayData()},n.prototype.encodeSetConversationStatus=function(e){var t=this,r=this._connectType==="comet",i=this._codec.getModule(gr),o=xt.getTime(),s=[];return ye(e,function(u){var d=t._codec.getModule(pr),l=u.conversationType,h=u.targetId,a=u.notificationStatus,c=u.isTop,p=u.channelId,f=[];d.setType(l),d.setChannelId(h),d.setTime(o),d.setBusChannel(p);var m=a===Ut.OPEN,_={};le(a)||(_[Es]=m),le(c)||(_[Ts]=c),ye(_,function(R,y){if(!le(R)){var P=t._codec.getModule(fr);R=R?Jr:_d,P.setSessionStateType(Number(y)),P.setValue(R);var L=r?P.getArrayData():P;f.push(L)}}),d.setStateItem(f);var v=r?d.getArrayData():d;s.push(v)}),i.setVersion(o),i.setState(s),i.getArrayData()},n.prototype.encodeReadReceipt=function(e,t){var r=this._codec.getModule(mr);return r.setMsgId(e),t&&r.setChannelId(t),r.getArrayData()},n.prototype.encodeCreateTag=function(e,t){var r=this,i=this._connectType==="comet",o=this._codec.getModule(Mo),s=[];return e.forEach(function(u){var d=r._codec.getModule(pn);d.setTagId(u.tagId),d.setName(u.tagName),s.push(i?d.getArrayData():d)}),o.setTags(s),o.setVersion(t),o.getArrayData()},n.prototype.encodeMessageReader=function(e,t){var r=this._codec.getModule(mr);return r.setMsgId(e),t&&r.setChannelId(t),r.getArrayData()},n.prototype.encodeRemoveTag=function(e,t){var r=this,i=this._connectType==="comet",o=this._codec.getModule(Ao),s=[];return e.forEach(function(u){var d=r._codec.getModule(pn);d.setTagId(u),s.push(i?d.getArrayData():d)}),o.setTags(s),o.setVersion(t),o.getArrayData()},n.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Po);return t.setTagId(e),t.getArrayData()},n.prototype.encodeUpdateConversationTag=function(e,t){var r=this,i=this._connectType==="comet",o=this._codec.getModule(gr),s=[];return t.forEach(function(u){var d=r._codec.getModule(pr),l=r._codec.getModule(fr),h=[];e.forEach(function(a){var c=r._codec.getModule(pn);c.setTagId(a.tagId),le(a.isTop)||c.setIsTop(a.isTop),h.push(i?c.getArrayData():c)}),l.setSessionStateType(Ss),l.setValue(JSON.stringify(h)),l.setTags(h),d.setType(u.conversationType),d.setChannelId(u.targetId),d.setTime(Date.now()),d.setStateItem([i?l.getArrayData():l]),s.push(i?d.getArrayData():d)}),o.setState(s),o.setVersion(xt.getTime()),o.getArrayData()},n.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Lo);return t.setSdkInfo(e),t.getArrayData()},n.prototype.encodeJoinRTCRoom=function(e,t,r){var i=this._codec.getModule(dr);return e=e||0,i.setRoomType(e),le(t)||i.setBroadcastType(t),le(r)||i.setJoinType(r),i.getArrayData()},n.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(uo).getArrayData()},n.prototype.encodeSetRTCData=function(e,t,r,i,o){var s=this._codec.getModule(lo);if(s.setInterior(r),s.setTarget(i),s.setKey(e),s.setValue(t),o){o.name&&s.setObjectName(o.name);var u=o.content;u&&(Ne(u)&&(u=JSON.stringify(u)),s.setContent(u))}return s.getArrayData()},n.prototype.encodeUserSetRTCData=function(e,t,r,i){var o=this,s=this._connectType==="comet",u=this._codec.getModule(lr);u.setObjectName(r);var d=this._codec.getModule(He);d.setKey(e.name),d.setValue(e.content),s?u.setContent([d.getArrayData()]):u.setContent(d);var l=[];return["uris","mcu_uris"].forEach(function(h){var a=o._codec.getModule(He);a.setKey(h);var c=h==="uris"?t:i;a.setValue(c),s?l.push(a.getArrayData()):l.push(a)}),u.setValueInfo(l),u.getArrayData()},n.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var r=this._codec.getModule(lr);r.setObjectName(e);var i=this._codec.getModule(He);return i.setKey("cdn_uris"),i.setValue(t),r.setValueInfo(i),r.getArrayData()},n.prototype.encodeGetRTCData=function(e,t,r){var i=this._codec.getModule(hr);return i.setInterior(t),i.setTarget(r),i.setKey(e),i.getArrayData()},n.prototype.encodeRemoveRTCData=function(e,t,r,i){var o=this._codec.getModule(hr);o.setInterior(t),o.setTarget(r),o.setKey(e);var s=(i=i||{}).name,u=i.content;return!le(s)&&o.setObjectName(s),le(u)||(Ne(u)&&(u=JSON.stringify(u)),o.setContent(u)),o.getArrayData()},n.prototype.encodeSetRTCOutData=function(e,t,r){var i=this._codec.getModule(ho);i.setTarget(t),Ue(e)||(e=[e]),ye(e,function(u,d){u.key=u.key?u.key.toString():u.key,u.value=u.value?u.value.toString():u.value,e[d]=u}),i.setValueInfo(e);var o=(r=r||{}).name,s=r.content;return!le(o)&&i.setObjectName(o),le(s)||(Ne(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},n.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(fo);return t.setUserId(e),t.getArrayData()},n.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(po);return t.setState(e),t.getArrayData()},n.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(go);return e.setOrder(2),e.getArrayData()},n.prototype.encodeSetRTCUserInfo=function(e,t){var r=this._codec.getModule(He);return r.setKey(e),r.setValue(t),r.getArrayData()},n.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(mo);return t.setKey(e),t.getArrayData()},n.prototype.encodeIdentityChangeInfo=function(e,t,r){r===void 0&&(r=!1);var i=this._codec.getModule(dr);return i.setRoomType(Le.LIVE),t&&i.setBroadcastType(t),i.setIdentityChangeType(e),i.setNeedSysChatroom(r),i.getArrayData()},n.prototype.encodePullRTCRoomKV=function(e,t){var r=this._codec.getModule(Do);return r.setTimestamp(t),r.setRoomId(e),r.getArrayData()},n.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(Uo);return t.setUserId(e),t.getArrayData()},n.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteTimeout,s=e.inviteInfo,u=this._codec.getModule(xo);return u.setInvitedRoomId(t),u.setInvitedUserId(r),u.setInviteSessionId(i),u.setTimeoutTime(o),u.setInviteInfo(s),u.getArrayData()},n.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteInfo,s=this._codec.getModule(Vo);return s.setInvitedRoomId(t),s.setInvitedUserId(r),s.setInviteSessionId(i),s.setInviteInfo(o),s.getArrayData()},n.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,o=e.content,s=e.key,u=e.value,d=e.agree?1:0,l=this._codec.getModule(Bo);return l.setInviteUserId(t),l.setInviteRoomId(r),l.setInviteSessionId(i),l.setContent(o),l.setKey(s),l.setValue(u),l.setAnswerCode(d),l.getArrayData()},n.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,r=e.sessionId,i=e.content,o=e.keys,s=this._codec.getModule(Fo);return s.setInviteRoomId(t),s.setInviteSessionId(r),s.setInviteContent(i),s.setInviteRoomKeys(o),s.getArrayData()},n}(),Ha=function(n,e){this._watcher=e,this.codec=new vd(n)},ja=function(n,e){return n&&e?e+"_"+n:n||Date.now()},wn=function(){function n(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return n.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ja(e,t)},n.prototype.read=function(e,t,r){this.readMessage(e,t,r)},n.prototype.readMessage=function(e,t,r){return{stream:e,length:t}},n}(),Ka=function(){function n(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new zi(e,!1,st.AT_MOST_ONCE,!1)}return n.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ja(e,t)},n.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},n.prototype.setHeaderQos=function(e){this._header.qos=e},n.prototype.getHeaderFlag=function(){return this._header.encode()},n.prototype.getLengthSize=function(){return this.lengthSize},n.prototype.getBufferData=function(){var e=new Yu;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},n.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},n}(),qa=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return Re(e,n),e.prototype.readMessage=function(t,r,i){if(t.readByte(),this.status=+t.readByte(),r<=e.MESSAGE_LENGTH)return{stream:t,length:r};if(i===St.V4){var o=t.readByte();1&o&&(this.userId=t.readUTF()),2&o&&t.readUTF(),4&o&&(this.timestamp=t.readLong()),8&o&&(this.messageId=t.read2Byte())}else{this.userId=t.readUTF();var s=t.readUTF();G.debug("server sessionId -> "+s),this.timestamp=t.readLong()}return{stream:t,length:r}},e.MESSAGE_LENGTH=2,e}(wn),$o=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.DISCONNECT,t.status=0,t}return Re(e,n),e.prototype.readMessage=function(t,r){return t.readByte(),this.status=+t.readByte(),{stream:t,length:r}},e.MESSAGE_LENGTH=2,e}(wn),Rd=function(n){function e(){var t=n.call(this,Me.PING_REQ)||this;return t._name=Fe.PING_REQ,t}return Re(e,n),e.prototype.writeMessage=function(t){},e}(Ka),Ga=function(n){function e(t){var r=n.call(this,t)||this;return r._name=Fe.PING_RESP,r}return Re(e,n),e}(wn),Ho=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.messageId=0,t}return Re(e,n),e.prototype.readMessage=function(t,r){var i=256*t.readByte()+t.readByte();return this.messageId=parseInt(i.toString(),10),{stream:t,length:r}},e}(wn),Br=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.messageId=0,t}return Re(e,n),e.prototype.writeMessage=function(t){var r=this.messageId,i=255&r,o=(65280&r)>>8;t.write(o),t.write(i)},e}(Ka),Sn=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Nt.PUB,t}return Re(e,n),e.prototype.readMessage=function(t,r){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),n.prototype.readMessage.call(this,t,r),this.data=t.readAll(),{stream:t,length:r}},e}(Ho),en=function(n){function e(t,r,i){var o=n.call(this,Me.PUBLISH)||this;return o._name=Fe.PUBLISH,o.syncMsg=!1,o.identifier=Nt.PUB,o.topic=t,o.data=Be(r)?Nn.writeUTF(r):r,o.targetId=i,o}return Re(e,n),e.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),n.prototype.writeMessage.call(this,t),t.write(this.data)},e}(Br),Ii=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=Nt.PUB,t.topic="",t.targetId="",t}return Re(e,n),e.prototype.readMessage=function(t,r){return n.prototype.readMessage.call(this,t,r),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:r}},e}(Ho),Ya=function(n){function e(t){var r=n.call(this,Me.PUB_ACK)||this;return r._name=Fe.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=t,r}return Re(e,n),e.prototype.writeMessage=function(t){n.prototype.writeMessage.call(this,t)},e}(Br),te=function(n){function e(t,r,i){var o=n.call(this,Me.QUERY)||this;return o.name=Fe.QUERY,o.identifier=Nt.QUERY,o.topic=t,o.data=Be(r)?Nn.writeUTF(r):r,o.targetId=i,o}return Re(e,n),e.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),n.prototype.writeMessage.call(this,t),t.write(this.data)},e}(Br),za=function(n){function e(t){var r=n.call(this,Me.QUERY_CONFIRM)||this;return r._name=Fe.QUERY_CON,r.messageId=t,r}return Re(e,n),e}(Br),fn=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.QUERY_ACK,t.status=0,t.identifier=Nt.QUERY,t.topic="",t.targetId="",t}return Re(e,n),e.prototype.readMessage=function(t,r){return n.prototype.readMessage.call(this,t,r),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:r}},e}(Ho),Ja=function(n){var e,t=n.type;switch(t){case Me.CONN_ACK:e=new qa(n);break;case Me.PUBLISH:(e=new Sn(n)).syncMsg=n.syncMsg;break;case Me.PUB_ACK:e=new Ii(n);break;case Me.QUERY_ACK:e=new fn(n);break;case Me.SUB_ACK:case Me.UNSUB_ACK:case Me.PING_RESP:e=new Ga(n);break;case Me.DISCONNECT:e=new $o(n);break;default:e=new wn(n),G.error("No support for deserializing "+t+" messages")}return e};(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.addSeTag=73]="addSeTag",n[n.delSeTag=74]="delSeTag",n[n.addTag=75]="addTag",n[n.delTag=76]="delTag",n[n.disTag=77]="disTag",n[n.reportsdk=78]="reportsdk",n[n.rtcInvite=79]="rtcInvite",n[n.rtcCancelInvite=80]="rtcCancelInvite",n[n.rtcInviteAnswer=81]="rtcInviteAnswer",n[n.rtcEndInvite=82]="rtcEndInvite"})(Si||(Si={}));var We,x=Si,Wa=function(n,e,t,r){return V(void 0,void 0,void 0,function(){var i;return B(this,function(o){return i=0,n.forEach(function(s){return V(void 0,void 0,void 0,function(){var u,d;return B(this,function(l){switch(l.label){case 0:return u=e+"://"+s+"/ping?r="+(a=9999,(h=1e3)+Math.floor(Math.random()*(a-h))),G.debug("start ping",u),[4,t.httpReq({url:u,timeout:5e3})];case 1:return d=l.sent(),G.debug("end ping",i,u,d.status),i++,r({finished:i===n.length,code:d.status,host:s}),[2]}var h,a})})}),[2]})})},Za=function(n,e,t,r,i,o,s,u){return n+"://"+e+"/websocket?appId="+t+"&token="+encodeURIComponent(r)+"&sdkVer="+o+"&pid="+s+"&apiVer="+(i.isFromUniapp?"uniapp":"normal")+(i.connectPlatform?"&platform="+i.connectPlatform:"")+(u?"&protocolVer="+u:"")},Qa=function(n){return[x.ppMsgS,x.pgMsgS,x.chatMsgS].map(function(e){return x[e]}).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"})(We||(We={}));var Ze,Is=function(n,e){G.info("websocket send -> messageId: "+n.messageId);var t=n.getBufferData();e.send(t.buffer)},Yt=function(n){function e(t,r){var i=n.call(this,"websocket",r)||this;return i._runtime=t,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 Re(e,n),e.prototype.connect=function(t,r,i,o,s,u){return V(this,void 0,void 0,function(){var d=this;return B(this,function(l){return[2,new Promise(function(h){var a=[],c=0,p=!1,f=!1,m=function(){return V(d,void 0,void 0,function(){var _;return B(this,function(v){switch(v.label){case 0:return a.length===0||p?[2]:(p=!0,[4,this._connect(t,r,a.shift(),o,s,u)]);case 1:if((_=v.sent())===b.SUCCESS)this._checkAlive(),h(_);else if(_===we.REDIRECT)h(_);else{if(f&&a.length===0)return h(Oa(_)),[2];p=!1,m()}return[2]}})})};s=qi(s),d._watcher.status(se.CONNECTING),Wa(i,o,d._runtime,function(_){var v=_.code,R=_.finished,y=_.host;f=R,v===200&&(a.push(y),c++,m()),R&&c===0&&(G.error("No valid websocket server hosts!"),h(b.RC_SOCKET_NOT_CREATED))})})]})})},e.prototype._connect=function(t,r,i,o,s,u){return V(this,void 0,void 0,function(){var d,l,h,a,c,p=this;return B(this,function(f){switch(f.label){case 0:return d=o.replace("http","ws"),l=Za(d,i,t,r,this._runtime,s,"",u),G.debug("conenct start -> "+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,P){var L=new Uint8Array(y),N=new Gu(L),E=N.readByte(),A=new zi(E),F=Ja(A);return F.read(N,L.length-1,P),F}(_,u);if(v instanceof Ga&&p._pingResolve)return p._pingResolve(b.SUCCESS),void(p._pingResolve=void 0);if(v instanceof qa)return G.debug("recv connect ack -> "+v.status),v.status!==we.ACCEPTED?(G.warn("connect failed: "+v.status),void m(v.status)):(G.info("connect success -> "+l),p.connectedTime=v.timestamp,p.userId=v.userId||"",p._idCount=v.messageId,void m(b.SUCCESS));if(v instanceof $o){var R=v.status;switch(G.warn("recv disconnect signal -> status: "+R),R){case We.BLOCK:p._watcher.status(se.BLOCKED);break;case We.OTHER_DEVICE_LOGIN:p._watcher.status(se.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case We.REDIRECT_NEW:case We.REDIRECT:p._watcher.status(se.REDIRECT);break;default:p._watcher.status(se.DISCONNECT_BY_SERVER)}}else p._onReceiveSignal(v)}else G.error("Socket received invalid data:",_)}),h.onClose(function(_,v){for(var R in G.warn("websocket closed! code:",_,"reason:",v),a(se.CONNECTION_CLOSED),p._messageIds){var y=p._messageIds[R];delete p._messageIds[R],y(b.RC_NET_CHANNEL_INVALID)}m(_)}),h.onError(function(_){var v;for(var R in G.error("websocket error!",(v=_)===null||v===void 0?void 0:v.stack),a(se.WEBSOCKET_ERROR),p._messageIds){var y=p._messageIds[R];delete p._messageIds[R],y(b.RC_NET_CHANNEL_INVALID)}m(b.NETWORK_ERROR)}),h.onOpen(function(){return G.debug("websocket open =>",l)}),setTimeout(function(){m(b.TIMEOUT)},5e3)})];case 1:return(c=f.sent())===b.SUCCESS?this._socket=h:(G.warn("connect result -> code: "+c+", url: "+l),h.close()),[2,c]}})})},e.prototype._checkAlive=function(){var t;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?(G.debug("send ping ->"),this.sendOnly(new Rd),[4,new Promise(function(s){i._pingResolve=s,i._timer&&clearTimeout(i._timer),i._timer=setTimeout(function(){i._pingResolve=void 0,s(b.TIMEOUT)},15e3)})]):[2];case 1:return(r=o.sent())!==b.SUCCESS?(this._failedCount+=1,G.warn("ping failed count: "+this._failedCount+", code: "+r),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,G.warn("ping timeout, close current websocket to reconnect!"),(t=this._socket)===null||t===void 0||t.close(),this._watcher.status(se.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(G.debug("recv pong <-"),this._failedCount=0,setTimeout(function(){return i._checkAlive()},15e3),[2])}})})},e.prototype._onReceiveSignal=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,d,l=this;return B(this,function(h){switch(h.label){case 0:return r=t.messageId,t.header&&t.header.qos!==st.AT_MOST_ONCE&&(t instanceof Sn&&!t.syncMsg&&(G.debug("send pubAck -> "+r),this.sendOnly(new Ya(r))),t instanceof fn&&(G.debug("send queryCon -> "+r),this.sendOnly(new za(r)))),r>0&&(t instanceof Ii||t instanceof fn)&&(G.debug("recv ack -> messageId: "+r),(i=this._messageIds[r])&&(i(t),delete this._messageIds[r]),(o=this._syncMessageIds[r])&&(delete this._syncMessageIds[r],o(t))),t instanceof Sn?(s=t.syncMsg,(u=t.topic)===x[x.userSetData]?[2]:!s||Qa(u)?(this._watcher.signal(t),[2]):[4,new Promise(function(a){l._syncMessageIds[r]=a})]):[3,2];case 1:d=h.sent(),delete this._syncMessageIds[r],this._watcher.signal(t,d),h.label=2;case 2:return[2]}})})},e.prototype.sendOnly=function(t){this._socket&&Is(t,this._socket)},e.prototype.send=function(t,r,i,o){return o===void 0&&(o=3e4),V(this,void 0,void 0,function(){var s,u,d,l=this;return B(this,function(h){switch(h.label){case 0:return this._socket?(s=this._generateMessageId(),t.messageId=s,Is(t,this._socket),[4,new Promise(function(a){l._messageIds[s]=a,setTimeout(function(){l._messageIds[s]&&delete l._messageIds[s],a()},o)})]):[3,2];case 1:return(u=h.sent())?u instanceof fn||u instanceof Ii?(d=r&&u.data?this.codec.decodeByPBName(u.data,r,i):u,u.status!==0?(G.warn("send failed -> message: "+s+", respPBName: "+r+", status: "+u.status),[2,{code:u.status,data:r&&u.data?d:null}]):[2,{code:b.SUCCESS,data:d}]):[2,{code:u}]:(G.warn("send timeout -> message: "+s+", respPBName: "+r+", timeout: "+o),[2,{code:b.TIMEOUT}]);case 2:return[2,{code:b.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(se.DISCONNECTED))},e}(Ha);(function(n){n.GET="GET",n.POST="POST"})(Ze||(Ze={}));var zt=function(n){function e(t,r){var i=n.call(this,"comet",r)||this;return i._runtime=t,i._messageIds={},i._syncMessageIds={},i._idCount=0,i._generateMessageId=function(){return++i._idCount},i._pid=encodeURIComponent(new Date().getTime()+Math.random()+""),i}return Re(e,n),e.prototype.handleCometRes=function(t){var r=this;if(t.status!==200&&t.status!==202)return!1;var i=Be(t.data)?JSON.parse(t.data):t.data;return i?!Ue(i)||(ye(i,function(o){return V(r,void 0,void 0,function(){var s,u,d,l,h,a,c,p,f,m,_,v=this;return B(this,function(R){switch(R.label){case 0:if((s=o.sessionid)&&(this._sessionid=s),u=function(y){var P=y.headerCode,L=new zi(P),N=Ja(L);for(var E in y)N[E]=y[E];return N}(o),d=u.messageId,l=u._header,h=u.status,u.identifier,a=l&&l.qos!==st.AT_MOST_ONCE,d&&u.getIdentifier&&((c=this._messageIds[d])&&c(u),this._syncMessageIds[d]&&this._syncMessageIds[d](u)),a&&(u instanceof Sn&&!u.syncMsg&&(p=new Ya(d),this.sendOnly(p)),u instanceof fn&&(p=new za(d),this.sendOnly(p))),u instanceof $o){switch(h){case We.OTHER_DEVICE_LOGIN:this._watcher.status(se.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case We.BLOCK:this._watcher.status(se.BLOCKED);break;case We.REDIRECT_NEW:case We.REDIRECT:this._watcher.status(se.REDIRECT);break;default:this._watcher.status(se.DISCONNECT_BY_SERVER)}return[2]}return u instanceof Sn?(f=u.syncMsg,m=u.topic,!f||Qa(m)?(this._watcher.signal(u),[2,!1]):[4,new Promise(function(y){v._syncMessageIds[d]=y})]):[3,2];case 1:_=R.sent(),delete this._syncMessageIds[d],this._watcher.signal(u,_),R.label=2;case 2:return[2]}})})}),!0):(G.error("received data is not a validJson",i),!1)},e.prototype._startPullSignal=function(t){return V(this,void 0,void 0,function(){var r,i,o,s;return B(this,function(u){switch(u.label){case 0:return r=new Date().getTime(),i=t+"://"+this._domain+"/pullmsg.js?sessionid="+this._sessionid+"×trap="+r+"&pid="+this._pid,[4,this._runtime.httpReq({url:i,body:{pid:this._pid},timeout:45e3})];case 1:return o=u.sent(),s=this.handleCometRes(o),this._isDisconnected||(s?this._startPullSignal(t):(this._isDisconnected=!0,this._watcher.status(se.NETWORK_UNAVAILABLE))),[2]}})})},e.prototype.connect=function(t,r,i,o,s,u){return V(this,void 0,void 0,function(){var d,l,h,a,c=this;return B(this,function(p){return s=qi(s),this._protocol=o,this._isDisconnected=!1,this._watcher.status(se.CONNECTING),d=[],l=0,h=!1,a=!1,[2,new Promise(function(f){var m=function(){return V(c,void 0,void 0,function(){var _;return B(this,function(v){switch(v.label){case 0:return d.length===0||h?[2]:(h=!0,[4,this._connect(t,r,d.shift(),o,s)]);case 1:if((_=v.sent())===b.SUCCESS)this._startPullSignal(o),f(_);else if(_===we.REDIRECT)f(_);else{if(a&&d.length===0)return f(Oa(_)),[2];h=!1,m()}return[2]}})})};c._watcher.status(se.CONNECTING),Wa(i,o,c._runtime,function(_){var v=_.code,R=_.finished,y=_.host;a=R,v===200&&(d.push(y),l++,m()),R&&l===0&&(G.error("No valid websocket server hosts!"),f(b.RC_SOCKET_NOT_CREATED))})})]})})},e.prototype._connect=function(t,r,i,o,s){return V(this,void 0,void 0,function(){var u,d,l,h;return B(this,function(a){switch(a.label){case 0:return u=function(c){return c.status!==200&&c.status!==202?(G.error("handle comet res -> res: "+JSON.stringify(c||{})),!1):!!c.data&&(function(p){if(Ne(p))return!0;var f=!1;try{var m=JSON.parse(p);f=JSON.stringify(m)===p}catch{f=!1}return f}(c.data)?Ne(c.data)?c.data:JSON.parse(c.data):(G.error("received data is not a validJson",c.data),!1))},d=Za(o,i,t,r,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),G.debug("conenct start -> "+d),[4,this._runtime.httpReq({url:d,body:{pid:this._pid},timeout:5e3})];case 1:return l=a.sent(),h=u(l),this._domain=i,h&&h.status===0?(this._sessionid=h.sessionid,this.userId=h.userId,this.connectedTime=h.timestamp):G.warn("connect result -> code: "+(h==null?void 0:h.status)+", url: "+d),[2,h==null?void 0:h.status]}})})},e.prototype.sendCometData=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c,p;return B(this,function(f){switch(f.label){case 0:return o=(i=this)._domain,s=i._sessionid,u=i._pid,d=t.messageId,l=t.topic,h=t.targetId,t.identifier,a=t.getHeaderFlag(),c=l?this._protocol+"://"+o+"/websocket?messageid="+d+"&header="+a+"&sessionid="+s+"&topic="+l+"&targetid="+h+"&pid="+u:this._protocol+"://"+o+"/websocket?messageid="+d+"&header="+a+"&sessionid="+s+"&pid="+u,[4,this._runtime.httpReq({url:c,method:Ze.POST,body:t.getCometData()})];case 1:return p=f.sent(),this.handleCometRes(p),[2]}})})},e.prototype.sendOnly=function(t){this.sendCometData(t)},e.prototype.send=function(t,r,i,o){return o===void 0&&(o=3e4),V(this,void 0,void 0,function(){var s,u,d,l=this;return B(this,function(h){switch(h.label){case 0:return s=this._generateMessageId(),t.messageId=s,this.sendCometData(t),[4,new Promise(function(a){l._messageIds[s]=a,setTimeout(function(){delete l._messageIds[s],a()},o)})];case 1:return(u=h.sent())?(d=r&&u.data?this.codec.decodeByPBName(u.data,r,i):u,u.status!==0?[2,{code:u.status,data:r&&u.data?d:null}]:[2,{code:b.SUCCESS,data:d}]):[2,{code:b.TIMEOUT}]}})})},e.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(se.DISCONNECTED)},e}(Ha),Cd=function(n,e,t){this.runtime=n,this._watcher=e,this._options=t,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()},Wr=function(n){return["navi",n].join("_")},yd=function(){function n(e,t){this._runtime=e,this._options=t,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=qi(this._options.apiVersion)}return n.prototype.getInfo=function(e,t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){switch(u.label){case 0:return r&&this._clear(e),(o=function(d,l,h){var a,c,p=Wr(d);try{var f=h.getItem(p);c=f?JSON.parse(f):[]}catch{c=[]}var m=Date.now();return c.length>0&&(c=c.filter(function(_){return m-_.timestamp<72e5})),c.length===0?h.removeItem(p):h.setItem(p,JSON.stringify(c)),((a=c.find(function(_){return _.token===l}))===null||a===void 0?void 0:a.naviInfo)||null}(this._appkey,e,this._runtime.localStorage))?(this._naviInfo=o,[2,o]):(s=this._options.navigators.slice(),t.length&&t.forEach(function(d){s.indexOf(d)<0&&s.unshift(d)}),[4,this._reqNavi(s,this._appkey,e,i)]);case 1:return(o=u.sent())?(this._naviInfo=o,this.setNaviInfo2Cache(e,o),[2,o]):[2,o]}})})},n.prototype.setNaviInfo2Cache=function(e,t){this._naviInfo=t,function(r,i,o,s){var u,d=Wr(r);try{var l=s.getItem(d);u=l?JSON.parse(l):[]}catch{u=[]}var h=Date.now();u.length>0&&(u=u.filter(function(a){return h-a.timestamp<72e5&&i!==a.token})),u.push({timestamp:h,naviInfo:o,token:i}),s.setItem(d,JSON.stringify(u))}(this._appkey,e,t,this._runtime.localStorage)},n.prototype.getInfoFromCache=function(e){return this._naviInfo},n.prototype._clear=function(e){(function(t,r,i){var o,s=Wr(t);try{var u=i.getItem(s);o=u?JSON.parse(u):[]}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,e,this._runtime.localStorage)},n}(),Vn=function(n,e,t){return[n,e,t].join("_")},Ed=function(){function n(e,t){this._runtime=e,this._appkey=t,this._users={}}return n.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})},n.prototype.setInboxTime=function(e,t){var r=this._getMemData(t);if(!(r.inboxTime>e)){r.inboxTime=e;var i=Vn("inbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},n.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(t.inboxTime===0){var r=Vn("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(r))||0}return t.inboxTime},n.prototype.setOutboxTime=function(e,t){var r=this._getMemData(t);if(!(r.outboxTime>=e)){r.outboxTime=e;var i=Vn("outbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},n.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(t.outboxTime===0){var r=Vn("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(r))||0}return t.outboxTime},n}(),Zr={_caches:{},set:function(n,e){this._caches[n]=e},get:function(n){return this._caches[n]||0},clear:function(n){this._caches[n]=0}},Td=function(){function n(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return n.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},n.prototype._remove=function(e){var t=e.key,r=this._kvCaches[t];r&&(r.isDeleted=!0,this._kvCaches[t]=r)},n.prototype._setEntry=function(e,t){var r=e.key,i=e.type,o=e.isOverwrite,s=e.userId,u=this._getSetUserId(r),d=i===xe.DELETE,l=u===s,h=!this._isExisted(r),a=d?this._remove:this._add;(t||o||l||h)&&a.call(this,e)},n.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},n.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},n.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},n.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},r=t.value,i=t.isDeleted;return r&&!i},n.prototype.setEntries=function(e){var t=this,r=e.kvEntries,i=e.isFullUpdate;r=r||[],(i=i||!1)&&this.clear(),r.forEach(function(o){t._setEntry(o,i)}),G.debug("end setEntries")},n.prototype.clear=function(){this._kvCaches={}},n}(),Sd=function(){function n(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var e,t,r,i,o,s,u;return B(this,function(d){switch(d.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,r=e.timestamp,(i=Zr.get(t))>r?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return o=d.sent(),s=o.code,u=o.data,this._isPulling=!1,s===b.SUCCESS?(Zr.set(t,u.syncTime||0),this._startPull()):this._startPull(),[2]}})})},n.prototype.reset=function(e){Zr.clear(e);var t=this._storeCaches[e];t&&t.clear()},n.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},n.prototype.setLocal=function(e,t,r){var i=this._storeCaches[e];hn(i)||(i=new Td(e,r)),i.setEntries(t),this._storeCaches[e]=i},n.prototype.getValue=function(e,t){var r=this._storeCaches[e];return r?r.getValue(t):null},n.prototype.getAll=function(e){var t=this._storeCaches[e],r={};return t&&(r=t.getAllValue()),r},n}(),Id=function(){function n(e,t,r,i){this._runtime=e,this._appkey=t,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-"+this._appkey+"-"+this._userId}return n.prototype.set=function(e,t){t===void 0&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},n.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch{G.error("parse rejoined chrm infos error -> "+t),e={}}return e},n.prototype.remove=function(e){delete this._joinedChrmsInfo[e],hn(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}(),Qr="converStatusChanged",bd=function(){function n(e,t,r){this._eventEmitter=new On,this._pullQueue=[],this._isPulling=!1,this._storage=Or(e.runtime),this._appkey=t,this._currentUserId=r,this._engine=e,this._storagePullTimeKey="con-s-"+t+"-"+r}return n.prototype._set=function(e){var t=this;if(!le(e)&&Array.isArray(e)){var r=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach(function(o,s){var u=o.updatedTime||0;r=u>r?u:r,o.conversationType=o.type,t._eventEmitter.emit(Qr,{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 e,t,r,i;return B(this,function(o){switch(o.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=o.sent(),r=t.code,i=t.data,r===b.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}})})},n.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||e===0)&&(this._pullQueue.push(t),this._startPull())},n.prototype.watch=function(e){this._eventEmitter.on(Qr,function(t){e(t)})},n.prototype.unwatch=function(){this._eventEmitter.off(Qr,function(e){})},n}(),Tt={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},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},Xn={};for(var bs in Tt){var Od=Tt[bs].keyName;Xn[Od]=bs}var tn,Nd=function(){function n(e,t,r){this._appkey=t,this._currentUserId=r;var i="con-"+t+"-"+r;this.storage=new ss(e,i),this._localStore=new ss(e,"CONVER-"+t+"-"+r)}return n.prototype._getStoreKey=function(e,t,r){return r+"_"+e+"_"+t},n.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var r=t.shift(),i=t.shift(),o=t.join("_");return{conversationType:Number(i),targetId:o,channelId:r}}return{conversationType:ee.PRIVATE,targetId:"",channelId:""}},n.prototype.updateMentionedData=function(e){var t=this,r=e.conversationType,i=e.targetId,o=e.messageType,s=e.isMentioned,u=e.content,d=e.senderUserId,l=e.channelId,h=this._getStoreKey(r,i,l),a=this._localStore.get(h)||{},c=Xn.mentionedInfo,p=Xn.hasMentioned,f=a[c]||{},m=f.userIdList||[],_=u.mentionedInfo;if(_){if(s&&r===ee.GROUP&&((_.userIdList||[]).forEach(function(R){R===t._currentUserId&&m.indexOf(d)<0&&m.push(d)}),_.type===Yi.ALL&&m.indexOf(d)<0&&m.push(d)),o===Ae.RECALL&&r===ee.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[c]=_,a[p]=!0):(delete a[c],delete a[p]),hn(a)?this._localStore.set(h,a):this._localStore.remove(h)}},n.prototype.set=function(e,t,r,i){var o=this._getStoreKey(e,t,i),s=this._localStore.get(o)||{};for(var u in r){var d=Xn[u],l=r[u];if(!le(d)&&!le(l)&&u!=="hasMentioned"&&u!=="MentionedInfo"){if(l===Tt[d].defaultVal||u==="tags"&&!hn(l))delete s[d];else if(u==="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)}}hn(s)?this._localStore.set(o,s):this._localStore.remove(o)},n.prototype.get=function(e,t,r){r===void 0&&(r="");var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{},s={};for(var u in Tt){var d=Tt[u],l=d.keyName,h=d.defaultVal;s[l]=o[u]||Qn(h)}return s},n.prototype.getValue=function(e){var t=this._localStore.getValues()||{},r=[];for(var i in t){var o=this._getConOptionByKey(i),s={conversationType:o.conversationType,targetId:o.targetId,channelId:o.channelId},u=t[i];for(var d in u){var l=Tt[d],h=l.keyName,a=l.defaultVal;s[h]=u[d]||Qn(a)}s=e?e(s):s,r.push(s)}return r},n.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var r in e){var i=this._getConOptionByKey(r),o=i.conversationType,s=i.targetId,u={},d=e[r];for(var l in d){var h=Tt[l],a=h.keyName,c=h.defaultVal;u[a]=d[l]||Qn(c)}for(var p in u.tags){le(t[p])&&(t[p]=[]);var f=Object.assign({},u,{conversationType:o,targetId:s});delete f.tags,t[p].push(f)}}return t},n.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(Object.keys(e).length===0)return;for(var t in e){var r="_"+t;this._localStore.set(r,e[t])}}catch(i){G.error("adaptOldStore error: "+i.message)}},n}(),wd=[ee.PRIVATE,ee.GROUP,ee.SYSTEM,ee.PUBLIC_SERVICE,ee.APP_PUBLIC_SERVICE],Os="conversationChanged",Ns="conTagStatusChanged",Md=function(){function n(e,t,r,i,o){var s=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new On,this._draftMap={},this._appkey=t,this._loginUserId=r,this._store=new Nd(e.runtime,t,r),this._statusManager=new bd(e,t,r),this._statusManager.watch(function(u){var d=u.statusItem,l=u.isLastPull;s.addStatus(d,l)}),this._eventEmitter.on(Os,function(u){i(u)}),this._eventEmitter.on(Ns,function(){o()})}return n.prototype._calcUnreadCount=function(e,t){var r=e.content,i=e.messageType,o=e.sentTime,s=e.isCounted,u=e.messageDirection,d=e.senderUserId,l=u===je.SEND&&d===this._loginUserId,h=i===Ae.RECALL,a=Ne(r),c=!1,p={},f=t.lastUnreadTime||0,m=t.unreadMessageCount||0;return f>o||l?{hasChanged:c,localConversation:t,updateItems:p}:(s&&(t.unreadMessageCount=m+1,t.lastUnreadTime=o,c=!0),h&&a&&f>=r.sentTime&&m&&(t.unreadMessageCount=m-1,c=!0),c&&(p.unreadMessageCount={val:t.unreadMessageCount,time:o}),{hasChanged:c,localConversation:t,updateItems:p})},n.prototype._calcMentionedInfo=function(e,t){var r=e.content,i=(e.messageDirection,e.isMentioned),o=e.sentTime;je.SEND;var s=Ne(r),u=!1,d={};return i&&s&&r.mentionedInfo&&(t.hasMentioned=!0,u=!0,d.hasMentioned={val:!0,time:o},d.mentionedInfo={val:r.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:d}},n.prototype._calcMentionedCount=function(e,t){var r=e.content,i=e.messageDirection,o=!1;if(e.isMentioned&&i===je.RECEIVE&&(r==null?void 0:r.mentionedInfo)){var s=r.mentionedInfo,u=s.type,d=s.userIdList;if(u===Yi.ALL||(d||[]).includes(this._loginUserId)){o=!0;var l=t.unreadMentionedCount||0;t.unreadMentionedCount=l+1}}return{hasChanged:o,localConversation:t}},n.prototype._setUpdatedConversation=function(e){if(Ne(e)){var t=e.conversationType,r=e.targetId,i=e.channelId,o=t+"_"+r,s=this._store.get(t,r,i)||{};this._updatedConversations[o]=Object.assign(s,e)}},n.prototype._setConTagStatusChanged=function(e,t,r,i){var o=(this._store.get(e,t,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(e,t){var r=e.conversationType,i=e.targetId,o=e.updatedTime,s=e.notificationStatus,u=e.isTop,d=e.tags,l=e.channelId,h={},a={};le(s)||(a.notificationStatus={time:o,val:s}),le(u)||(a.isTop={time:o,val:u}),le(d)||(a.tags={time:o,val:d},d==null||d.forEach(function(c){h[c.tagId]={isTop:c.isTop}})),this._setConTagStatusChanged(r,i,h,l),this._store.set(r,i,{notificationStatus:s,isTop:u,tags:h},l),this._setUpdatedConversation({conversationType:r,targetId:i,updatedItems:a,channelId:l}),t&&this._notifyConversationChanged()},n.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);e.length!==0&&(this._eventEmitter.emit(Os,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Ns),this._conTagStatusChanged=!1))},n.prototype.setConversationCacheByMessage=function(e,t){var r=this,i=e.conversationType,o=e.isPersited,s=e.targetId,u=e.channelId;if(wd.indexOf(i)>=0){var d=!1,l=this._store.get(i,s,u),h={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach(function(p){var f=p.call(r,e,l),m=f.hasChanged,_=f.localConversation,v=f.updateItems;d=d||m,h=fe(fe({},h),v),l=Qn(_)}),d&&this._store.set(i,s,l,u),this._store.updateMentionedData(e),o){var a=this._store.get(i,s,u);a.updatedItems=fe({latestMessage:{time:e.sentTime,val:e}},h),a.latestMessage=e;var c=Object.assign(a,{conversationType:i,targetId:s,channelId:u});this._setUpdatedConversation(c)}(d||o)&&this._notifyConversationChanged()}},n.prototype.get=function(e,t,r){return r===void 0&&(r=""),this._store.get(e,t,r)},n.prototype.getAllUnreadCount=function(e,t,r){var i=this._store.getValue(),o=0;return i.forEach(function(s){var u=s.unreadMessageCount,d=s.notificationStatus,l=s.conversationType;u=u||0,(r||d!==1)&&(t.length>0?t.includes(Number(l))&&(o+=Number(u)):o+=Number(u))}),o},n.prototype.getUnreadCountByTag=function(e,t){var r=this._store.getValueForTag()[e]||[],i=0;return r.forEach(function(o){var s=o.unreadMessageCount,u=o.notificationStatus;(t||u!==1)&&(s=s||0,i+=Number(s))}),i},n.prototype.getUnreadCount=function(e,t,r){return this._store.get(e,t,r).unreadMessageCount||0},n.prototype.clearUnreadCount=function(e,t,r,i){i===void 0&&(i=!0);var o=this._store.get(e,t,r),s=o.unreadMessageCount,u=o.hasMentioned,d={};if(s&&(o.unreadMessageCount=0,d.unreadMessageCount={val:0,time:Date.now()}),u&&(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(e,t,o,r),i&&Object.keys(d).length!==0){var l=Object.assign(o,{conversationType:e,targetId:t,channelId:r,updatedItems:d});this._setUpdatedConversation(l),this._notifyConversationChanged()}},n.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach(function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,e._store.set(t.conversationType,t.targetId,t,t.channelId))})},n.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},n.prototype.setDraft=function(e,t,r,i){var o=e+"_"+t+"_"+i;this._draftMap[o]=r},n.prototype.getDraft=function(e,t,r){var i=e+"_"+t+"_"+r;return this._draftMap[i]},n.prototype.clearDraft=function(e,t,r){var i=e+"_"+t+"_"+r;delete this._draftMap[i]},n.prototype.addTagStatus=function(e,t,r,i){i===void 0&&(i="");var o=this._store.get(e,t,i).tags;o=Object.assign(o,r),this._store.set(e,t,{tags:o},i)},n.prototype.deleteTagStatus=function(e,t,r,i){i===void 0&&(i="");var o=this._store.get(e,t,i).tags;r.forEach(function(s){delete o[s]}),this._store.set(e,t,{tags:o},i)},n.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},n.prototype.getBlockConversationList=function(){return this._store.getValue().filter(function(e){return e.notificationStatus===Ut.OPEN}).map(function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}})},n.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter(function(e){return e.isTop}).map(function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}})},n.prototype.adaptOldStore=function(){this._store.adaptOldStore()},n.prototype.getUnreadMentionedCount=function(e,t,r){return e===void 0&&(e=""),this.get(t,r,e).unreadMentionedCount||0},n.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach(function(r){var i=r.unreadMentionedCount;i=i||0,t+=Number(i)}),t},n}(),Ad=function(){function n(e,t,r,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-"+t+"-"+r,this._storagePullTimeKey="us-s-"+t+"-"+r,this._storage=Or(e.runtime),this._engine=e,this._tagWatcherFunc=i}return n.prototype._updateTag=function(e){var t=e.tags,r={};t.forEach(function(i){r[i.tagId]={tagName:i.tagName,createdTime:i.createdTime}}),this._storage.set(this._storageTagKey,r),this._tagWatcherFunc()},n.prototype.addTag=function(e,t){var r=this._storage.get(this._storageTagKey)||{};e.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,t)},n.prototype.deleteTag=function(e,t){var r=this._storage.get(this._storageTagKey)||{};e.forEach(function(i){delete r[i]}),this._storage.set(this._storageTagKey,r),this._storage.set(this._storagePullTimeKey,t)},n.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},n.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var r in e)t.push({tagId:r,tagName:e[r].tagName,createdTime:e[r].createdTime,conversationCount:0});return t.sort(function(i,o){return(i.createdTime||0)-(o.createdTime||0)})},n.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var e,t,r,i,o,s,u,d;return B(this,function(l){switch(l.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=l.sent(),r=t.code,i=t.data,r!==b.SUCCESS||le(i)?(this._isPulling=!1,this._startPull()):(s=(o=i).settings,u=o.version,d=s.Tag,le(d)||this._updateTag(d),this._storage.set(this._storagePullTimeKey,u),this._isPulling=!1,this._startPull()),[2]}})})},n.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||e===0)&&(this._pullQueue.push(t),this._startPull())},n.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},n}(),Pd=function(n){function e(t,r){var i=n.call(this,t,r)||this;return i._miniConnectUrl="",i._connectType=r.connectionType,i}return Re(e,n),e.prototype._formatJSONPUrl=function(t,r,i,o){return t+"/"+(this._runtime.isSupportSocket()&&this._connectType==="websocket"?"navi":"cometnavi")+".js?appId="+i+"&token="+encodeURIComponent(r)+"&callBack="+o+"&v="+this._apiVersion+"&r="+Date.now()},e.prototype.getInfo=function(t,r,i){var o;return V(this,void 0,void 0,function(){var s;return B(this,function(u){return this._runtime.useNavi||(s=void 0,s=this._runtime.isSupportSocket()&&this._connectType==="websocket"?Pu.join(","):Lu.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,t,r,i)]})})},e.prototype._reqNavi=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p;return B(this,function(f){switch(f.label){case 0:o="getServerEndpoint",s=0,u=t.length,f.label=1;case 1:return s<u?(d=this._formatJSONPUrl(t[s],i,r,o),G.debug("req navi => "+d),[4,this._runtime.httpReq({url:d,timeout:1e4,dataType:"text"})]):[3,4];case 2:if((l=f.sent()).status!==200)return l.status===403?G.error("request navi error: "+b.RC_CONN_USER_OR_PASSWD_ERROR):l.status===401&&G.error("request navi error: "+b.RC_CONN_APP_BLOCKED_OR_DELETED),[3,3];try{return h=l.data.match(/{[\d\D]+}/),(a=h&&h[0]?h[0]:"").indexOf('{\\"code\\":')===0&&(a=JSON.parse('"'+a+'"')),p=JSON.parse(a),c=/^https/.test(d)?"https":"http",p.protocol=c,this._runtime.useNavi||(p.server="",p.backupServer=this._miniConnectUrl,p.logSwitch=0),[2,p]}catch(m){G.error("parse navi err =>",m)}f.label=3;case 3:return s+=1,[3,1];case 4:return this._runtime.useNavi?[2,null]:[2,p={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}]}})})},e}(yd),Ld=function(){function n(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return n.prototype._startPull=function(){return V(this,void 0,void 0,function(){var e,t,r,i,o,s,u;return B(this,function(d){switch(d.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,r=e.timestamp,(i=this._pullTime)>r?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,i)]);case 1:return o=d.sent(),s=o.code,u=o.data,s===b.SUCCESS?(this._isPulling=!1,this._pullTime=u.syncTime||0,this._startPull()):this._startPull(),[2]}})})},n.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},n.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},n}(),Xr=function(n,e){return["send_msg",n,e].join("_")},kd=function(){function n(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return n.prototype.init=function(e){this._userId=e;var t=Xr(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},n.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch{return{}}},n.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var r=Xr(this._appkey,this._userId),i=this._getLocalInfo(r);i[e]=t,this._runtime.localStorage.setItem(r,JSON.stringify(i))},n.prototype.getSendMessageMap=function(){return this._sendMessageMap},n.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},n.prototype.removeByTimestamp=function(e){var t=Xr(this._appkey,this._userId),r=this._getLocalInfo(t);Object.keys(r).forEach(function(i){r[i]<e&&delete r[i]}),this._runtime.localStorage.setItem(t,JSON.stringify(r))},n}(),Xa=function(n){var e="RCDeviceId",t=Or(n),r="",i=t.get(e);return i?r=i:(r=Ia(),t.set(e,r)),r};(tn={})[ee.PRIVATE]=x.qryPMsg,tn[ee.GROUP]=x.qryGMsg,tn[ee.CHATROOM]=x.qryCHMsg,tn[ee.CUSTOMER_SERVICE]=x.qryCMsg,tn[ee.SYSTEM]=x.qrySMsg;var Dd=[x[x.recallMsg],x[x.ppMsgS],x[x.pgMsgS],x[x.ppMsgP],x[x.pgMsgP],x[x.chatMsg],x[x.pcMsgP],x[x.prMsgS]],ei=function(n,e,t,r,i,o){return{conversationType:n,targetId:e,senderUserId:o,messageDirection:je.SEND,isCounted:!!t.isCounted,isMentioned:!!t.isMentioned,content:t.content,messageType:t.messageType,isOffLineMessage:!1,isPersited:!!t.isPersited,messageUId:r,sentTime:i,receivedTime:0,disableNotification:!!t.disableNotification,isStatusMessage:!!t.isStatusMessage,canIncludeExpansion:!!t.canIncludeExpansion,expansion:t.canIncludeExpansion?t.expansion:null,receivedStatus:_n.UNREAD,pushConfig:t.pushConfig,channelId:t.channelId}},Ud=function(n){function e(t,r,i){var o=n.call(this,t,r,i)||this;return o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o._connectedTime=0,o._localConnectedTime=0,o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._letterbox=new Ed(t,i.appkey),o._sendMessageStore=new kd(t,i.appkey),o._chrmEntryHandler=new Sd(o),o}return Re(e,n),e.prototype._createNavi=function(){return new Pd(this.runtime,this._options)},e.prototype.getConnectedTime=function(){return this._connectedTime},e.prototype.connect=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l=this;return B(this,function(h){switch(h.label){case 0:return i=[],this._naviInfo=r,r.server?i.push(r.server):G.warn("navi.server is invalid"),(o=r.backupServer)&&o.split(",").forEach(function(a){i.indexOf(a)<0&&i.push(a)}),i.length===0?(G.error("navi invaild.",i),[2,b.UNKNOWN]):(s=this.runtime.createDataChannel({status:function(a){l._connectionStatusHandler(a,t,i,r.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),u=St.V3,r.openAnti===1&&(u=St.V4),[4,s.connect(this._appkey,t,i,r.protocol,this._apiVer,u)]);case 1:return(d=h.sent())===b.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(se.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new Md(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Ad(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new Ld(this),this._joinedChrmManager=new Id(this.runtime,this._appkey,this.currentUserId,r.joinMChrm),this._startSyncInterval()):s.close(),[2,d]}})})},e.prototype._connectionStatusHandler=function(t,r,i,o){if(G.warn("connection status changed:",t),t!==se.CONNECTING)if(t!==se.CONNECTED){if(this._channel&&t!==se.DISCONNECTED)return t===se.BLOCKED||t===se.KICKED_OFFLINE_BY_OTHER_CLIENT||t===se.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(t)):void(t!==se.REDIRECT?(this._watcher.status(t),this._try2Reconnect(r,i,o)):this._watcher.status(t));this._watcher.status(t)}else this._watcher.status(t);else this._watcher.status(t)},e.prototype._try2Reconnect=function(t,r,i){return V(this,void 0,void 0,function(){var o,s=this;return B(this,function(u){switch(u.label){case 0:return this._channel?(o=St.V3,this._naviInfo.openAnti===1&&(o=St.V4),[4,this._channel.connect(this._appkey,t,r,i,this._apiVer,o)]):[2];case 1:return u.sent()===b.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(se.CONNECTED),this._rejoinChrm(),G.__insertLogIntoDatabase(),[2]):(this._watcher.status(se.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout(function(){s._reconnectTimer=-1,s._try2Reconnect(t,r,i)},5e3),[2])}})})},e.prototype._signalHandler=function(t,r){var i=t.syncMsg,o=t.topic;if(i)this._receiveSyncMsg(t,r);else{var s=x[o];if(s)switch(s){case x.s_ntf:G.info("recv s_ntf -> signal.messageId: "+t.messageId),this._pullMsg(t);break;case x.s_msg:this._receiveMsg(t);break;case x.s_cmd:this._receiveStateNotify(t);break;case x.s_us:this._receiveSettingNotify(t);break;case x.rtc_ntf:this._receiveRtcKv(t)}else G.error("unknown topic:",o)}},e.prototype._receiveStateNotify=function(t){var r,i=(r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(t.data,cr),o=i.time,s=i.type,u=i.chrmId;switch(s){case 2:this._chrmEntryHandler.pullEntry(u,o);break;case 3:this._conversationManager.startPullConversationStatus(o);break;case 4:this._chrmEntryHandler.reset(u),this._watcher.chatroom({chatroomDestroyed:t.targetId})}},e.prototype._receiveSettingNotify=function(t){var r,i=((r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(t.data,kr)).version;this._userSettingManager.pullUserSettings(i)},e.prototype._receiveRtcKv=function(t){var r,i=(r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(t.data,ko),o=i.time,s=i.type,u=i.roomId;switch(s){case 1:this._rtcKVManager.pullEntry(u,o)}},e.prototype._receiveMessageExpansion=function(t){var r=t.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}})},e.prototype._receiveSyncMsg=function(t,r){var i;if(Dd.includes(t.topic)){var o=(i=this._channel)===null||i===void 0?void 0:i.codec.decodeByPBName(t.data,Rn,{currentUserId:this.currentUserId,signal:t});o=this._handleMsgProperties(o),r&&(o.sentTime=r.timestamp,o.messageUId=r.messageUId),this._pullingMsg?this._pullQueue.push((r==null?void 0:r.timestamp)||o.sentTime):(r&&this._sendMessageStore.setMessage(r.messageUId,r.timestamp),o.messageType!==Ae.EXPANSION_NOTIFY?(o.messageType===Ae.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(o.conversationType,o.targetId,o.channelId),this._conversationManager.setConversationCacheByMessage(o,!0),this._watcher.batchMessage([o])):this._receiveMessageExpansion(o))}},e.prototype._pullMsg=function(t){if(this._channel){var r=this._channel.codec.decodeByPBName(t.data,cr),i=r.type,o=r.chrmId,s=r.time;if(G.info("s_ntf -> type: "+i+", chrmId: "+o+", time: "+s),i===2){var u=this._chrmsQueue[o];if(!u)return;u.queue.push(s),this._pullChrmMsg(o)}else this._pullQueue.push(s),this._syncMsg()}},e.prototype._startSyncInterval=function(){var t=this;this._stopSyncInterval(),this._intervalTimer=setInterval(function(){Date.now()-t._latestSyncTimestamp>=18e4&&t._syncMsg()},3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},e.prototype._stopSyncInterval=function(){this._intervalTimer!==-1&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},e.prototype._syncMsg=function(){return V(this,void 0,void 0,function(){var t,r,i,o,s,u,d,l,h,a,c,p,f,m,_=this;return B(this,function(v){switch(v.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,t=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),G.info("pullMsg -> sendboxTime: "+t+", inboxTime: "+r),i=this._channel.codec.encodeSyncMsg({sendboxTime:t,inboxTime:r}),o=new te(x[x.pullMsg],i,this.currentUserId),[4,this._channel.send(o,Cn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=v.sent(),u=s.code,d=s.data,this._latestSyncTimestamp=Date.now(),u===b.SUCCESS&&d?(l=d.list,h=d.finished,a=d.syncTime,G.info("pullMsg success -> syncTime: "+a+", finished: "+h),c=0,p=[],l.forEach(function(R){if(R.messageDirection===je.SEND&&(c=Math.max(R.sentTime,c),_._sendMessageStore.getSendMessageMap()[R.messageUId]))return void _._sendMessageStore.removeByUID(R.messageUId);if(R.messageType!==Ae.EXPANSION_NOTIFY){if(R.messageType===Ae.SYNC_READ_STATUS){if(R.senderUserId!==_.currentUserId)return;_._conversationManager.clearUnreadCount(R.conversationType,R.targetId,R.channelId)}var y=_._handleMsgProperties(R);_._conversationManager.setConversationCacheByMessage(y,!0),p.push(y)}else _._receiveMessageExpansion(R)}),this._watcher.batchMessage(p),this._letterbox.setInboxTime(a,this.currentUserId),this._letterbox.setOutboxTime(c,this.currentUserId),this._sendMessageStore.removeByTimestamp(c),this._pullingMsg=!1,f=this._pullQueue.filter(function(R){return R>a}),this._pullQueue.length=0,(m=this._pullQueue).push.apply(m,f),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!h||f.length>0)&&this._syncMsg(),[2]):(G.warn("pullMsg failed -> code:",u,", data: ",d),this._pullingMsg=!1,[2])}})})},e.prototype._receiveMsg=function(t){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var r=this._channel.codec.decodeByPBName(t.data,wr,{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!==Ae.EXPANSION_NOTIFY?r.messageType===Ae.SYNC_READ_STATUS&&r.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r)}},e.prototype._handleMsgProperties=function(t,r){r===void 0&&(r=!1);var i,o=t.messageType,s=t.isCounted,u=t.isPersited,d=t.isStatusMessage,l=o in os,h=o in this._customMessageType;if(i=l?os[o]:h?this._customMessageType[o]:{isCounted:!cs(s)&&s,isPersited:!cs(u)&&u},Object.assign(t,{isCounted:i.isCounted,isPersited:i.isPersited,isStatusMessage:ku.includes(o)}),r&&(t.isStatusMessage=d),!r){var a=t.content.user;if(a){var c=a.portrait,p=a.portraitUri,f=c||p;f&&(a.portrait=a.portraitUri=f)}}return t},e.prototype.getHistoryMessage=function(t,r,i,o,s,u){return u===void 0&&(u=""),V(this,void 0,void 0,function(){var d,l,h,a,c,p,f,m,_;return B(this,function(v){switch(v.label){case 0:return l=(d=this).currentUserId,h=d._channel,a=gd[t]||Fa,c=o===1&&i===0,h?(p=h.codec.encodeGetHistoryMsg(r,{timestamp:i,count:c?2:o,order:s,channelId:u}),[4,h.send(new te(a,p,l),yn,{currentUserId:l,connectedTime:h.connectedTime,conversation:{targetId:r}})]):[3,2];case 1:return f=v.sent(),(m=f.code)!==b.SUCCESS?[2,{code:m}]:(_=f.data,c&&_.list.length===2&&(_.hasMore=!0,s===0?_.list.shift():_.list.pop()),[2,{code:m,data:{list:_.list,hasMore:_.hasMore}}]);case 2:return[2,{code:b.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.reportSDKInfo=function(t){var r=this.currentUserId,i=this._channel;if(i){G.debug("reportSDKInfo ->",t);var o=i.codec.encodeReportSDKInfo(JSON.stringify(t)),s=new te(x[x.reportsdk],o,r);i.send(s).then(function(u){var d=u.code;d!==b.SUCCESS&&G.warn("reportSDKInfo failed -> code: "+d)})}},e.prototype.deleteRemoteMessage=function(t,r,i,o){return V(this,void 0,void 0,function(){var s,u,d,l,h,a,c;return B(this,function(p){switch(p.label){case 0:return u=(s=this).currentUserId,(d=s._channel)?(l=d.codec.encodeDeleteMessages(t,r,i,o),h=new te(td,l,u),[4,d.send(h)]):[3,2];case 1:return a=p.sent(),c=a.code,b.SUCCESS,[2,c];case 2:return[2,b.RC_NET_CHANNEL_INVALID]}})})},e.prototype.deleteRemoteMessageByTimestamp=function(t,r,i,o){return V(this,void 0,void 0,function(){var s,u,d,l,h,a,c,p;return B(this,function(f){switch(f.label){case 0:return u=(s=this).currentUserId,(d=s._channel)?(l=d.codec.encodeClearMessages(r,i,o),h=md[t],a=new te(h,l,u),[4,d.send(a)]):[3,2];case 1:return c=f.sent(),p=c.code,b.SUCCESS,[2,p];case 2:return[2,b.RC_NET_CHANNEL_INVALID]}})})},e.prototype.getConversationList=function(t,r,i,o,s){return t===void 0&&(t=300),V(this,void 0,void 0,function(){var u,d,l,h,a,c,p,f,m=this;return B(this,function(_){switch(_.label){case 0:return d=(u=this).currentUserId,l=u._channel,r=r||ee.PRIVATE,l?(h=l.codec.encodeOldConversationList({count:t,type:r,startTime:i,order:o}),a=new te(ys,h,d),[4,l.send(a,En,{currentUserId:d,connectedTime:l.connectedTime,afterDecode:function(v){var R=v.conversationType,y=v.targetId,P=v.channelId,L=m._conversationManager.get(R,y,P);return Object.assign(v,L),v}})]):[3,2];case 1:return c=_.sent(),p=c.code,f=c.data,p!==b.SUCCESS?[2,{code:p}]:[2,{code:p,data:f}];case 2:return[2,{code:b.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.removeConversation=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l;return B(this,function(h){switch(h.label){case 0:return(o=this._channel)?(s=o.codec.encodeRemoveOldConversationList({conversationType:t,channelId:i,targetId:r}),u=new te(ud,s,r),[4,o.send(u)]):[3,2];case 1:return d=h.sent(),G.info("RemoveConversation =>",d),l=d.code,b.SUCCESS,[2,l];case 2:return[2,b.RC_NET_CHANNEL_INVALID]}})})},e.prototype.getConversation=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h;return B(this,function(a){switch(a.label){case 0:return(o=this._conversationManager.get(t,r,i))?[4,this.getHistoryMessage(t,r,0,1,0)]:[2,{code:b.CONVER_GET_ERROR}];case 1:return s=a.sent(),u=s.code,d=s.data,u!==b.SUCCESS?[2,{code:b.CONVER_GET_ERROR}]:(l=(d==null?void 0:d.list[0])||null,h={conversationType:t,targetId:r,channelId:i,unreadMessageCount:o.unreadMessageCount||0,latestMessage:l,notificationStatus:o.notificationStatus||Ut.CLOSE,isTop:o.isTop||!1,lastUnreadTime:o.lastUnreadTime||0,unreadMentionedCount:o.unreadMentionedCount||0},[2,{code:b.SUCCESS,data:h}])}})})},e.prototype.getAllConversationUnreadCount=function(t,r,i){var o=this._conversationManager.getAllUnreadCount(t,r,i);return Promise.resolve({code:b.SUCCESS,data:o})},e.prototype.getConversationUnreadCount=function(t,r,i){var o=this._conversationManager.getUnreadCount(t,r,i);return Promise.resolve({code:b.SUCCESS,data:o})},e.prototype.clearConversationUnreadCount=function(t,r,i){return this._conversationManager.clearUnreadCount(t,r,i,!1),Promise.resolve(b.SUCCESS)},e.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(b.SUCCESS)},e.prototype.getFirstUnreadMessage=function(t,r){throw new Error("Method not implemented.")},e.prototype.saveConversationMessageDraft=function(t,r,i,o){return this._conversationManager.setDraft(t,r,i,o),Promise.resolve(b.SUCCESS)},e.prototype.getConversationMessageDraft=function(t,r,i){var o=this._conversationManager.getDraft(t,r,i);return Promise.resolve({code:b.SUCCESS,data:o})},e.prototype.clearConversationMessageDraft=function(t,r,i){return this._conversationManager.clearDraft(t,r,i),Promise.resolve(b.SUCCESS)},e.prototype.pullConversationStatus=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,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.encodeGetConversationStatus(t),u=new te(x[x.pullSeAtts],s,o),[4,i.send(u,Dr)]):[3,2];case 1:return d=a.sent(),l=d.code,h=d.data,l!==b.SUCCESS?[2,{code:l}]:[2,{code:l,data:h}];case 2:return[2,{code:b.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.batchSetConversationStatus=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,d,l,h,a,c=this;return B(this,function(p){switch(p.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeSetConversationStatus(t),u=new te(dd,s,i),[4,o.send(u,wo)]):[3,2];case 1:return d=p.sent(),l=d.code,h=d.data,l===b.SUCCESS?(a=h,t.forEach(function(f){c._conversationManager.addStatus(fe(fe({},f),{updatedTime:a.version}),!0)}),[2,l]):[2,l];case 2:return[2,b.RC_NET_CHANNEL_INVALID]}})})},e.prototype._joinChrm=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h,a;return B(this,function(c){switch(c.label){case 0:return(o=this._channel)?(s=o.codec.encodeJoinOrQuitChatRoom(),u=new te(i?rd:nd,s,t),[4,o.send(u,ao)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return d=c.sent(),l=d.code,h=d.data,l===b.SUCCESS&&(a=h.joinTime,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,r,a),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,r)),[2,l]}})})},e.prototype._rejoinChrm=function(){return V(this,void 0,void 0,function(){var t,r,i,o,s,u;return B(this,function(d){switch(d.label){case 0:for(i in t=this._joinedChrmManager.get(),r=[],t)r.push(i);o=0,d.label=1;case 1:return o<r.length?(s=r[o],[4,this._joinChrm(s,t[s]||10,!0)]):[3,4];case 2:(u=d.sent())===b.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:s,count:t[s]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:s,errorCode:u}}),d.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype._pullChrmMsg=function(t,r,i){return r===void 0&&(r=10),i===void 0&&(i=0),V(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p,f,m,_;return B(this,function(v){switch(v.label){case 0:return this._channel?(o=this._chrmsQueue[t],s=o.pulling,u=o.timestamp,s?[2]:(o.pulling=!0,d=this._channel.codec.encodeChrmSyncMsg(u,r),l=new te(x[x.chrmPull],d,t),[4,this._channel.send(l,Cn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return h=v.sent(),a=h.code,c=h.data,o.pulling=!1,a===b.SUCCESS&&c?(p=c.list,f=c.syncTime,m=c.finished,o.timestamp=i?Math.max(f,i):f,o.queue=o.queue.filter(function(R){return R>f}),_=[],p.forEach(function(R){R.sentTime<u||_.push(R)}),this._watcher.batchMessage(_),(!m||o.queue.length>0)&&this._pullChrmMsg(t),[2]):(G.warn("pull chatroom msg failed, code:",a,", data:",c),[2])}})})},e.prototype.joinChatroom=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._joinChrm(t,r,!1)]})})},e.prototype.joinExistChatroom=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._joinChrm(t,r,!0)]})})},e.prototype.quitChatroom=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u;return B(this,function(d){switch(d.label){case 0:return(r=this._channel)?(i=r.codec.encodeJoinOrQuitChatRoom(),o=new te(id,i,t),[4,r.send(o)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return s=d.sent(),(u=s.code)===b.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),[2,u]}})})},e.prototype.getChatroomInfo=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h;return B(this,function(a){switch(a.label){case 0:return(o=this._channel)?(s=o.codec.encodeGetChatRoomInfo(r,i),u=new te(x[x.queryChrmI],s,t),[4,o.send(u,Mr)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return d=a.sent(),l=d.code,h=d.data,l!==b.SUCCESS?[2,{code:l}]:[2,{code:l,data:h}]}})})},e.prototype.getChatroomHistoryMessages=function(t,r,i,o){return V(this,void 0,void 0,function(){var s,u,d,l,h,a;return B(this,function(c){switch(c.label){case 0:return(s=this._channel)?(u=s.codec.encodeGetHistoryMsg(t,{timestamp:r,count:i,order:o}),d=new te($a,u,t),[4,s.send(d,yn,{conversation:{targetId:t}})]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return l=c.sent(),h=l.code,a=l.data,h!==b.SUCCESS?[2,{code:h}]:[2,{code:h,data:{list:a.list,hasMore:a.hasMore}}]}})})},e.prototype._modifyChatroomKV=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a;return B(this,function(c){switch(c.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(u=o.codec.encodeModifyChatRoomKV(t,r,s),d=r.type===xe.UPDATE?od:sd,l=new te(d,u,t),[4,o.send(l)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return h=c.sent(),(a=h.code)===b.SUCCESS?(this._chrmEntryHandler.setLocal(t,{kvEntries:[r],syncTime:new Date().getTime()},s),[2,a]):[2,a]}})})},e.prototype._modifyChatroomKVS=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c,p,f,m;return B(this,function(_){switch(_.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(u=o.codec.encodeModifyChatRoomKVS(t,r,s),d=r.type===xe.UPDATE?ad:cd,l=new te(d,u,t),[4,o.send(l,Io)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return h=_.sent(),a=h.code,[b.SUCCESS,b.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(a)!==-1&&(p=[],delete(f=Object.assign({},r)).entries,r.entries.forEach(function(v){p.push(Object.assign({},v,f))}),a===b.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(m=h.data,G.warn("\u8BBE\u7F6E\u5931\u8D25\u7684\u5C5E\u6027\uFF1A",m.errorKeys),c=m.errorKeys,m&&Array.isArray(m.errorKeys)&&m.errorKeys.forEach(function(v){var R=p.findIndex(function(y){return v.key===y.key});R!==-1&&p.splice(R,1)})),G.warn("\u8BBE\u7F6E\u6210\u529F\u7684\u5C5E\u6027\uFF1A",p),this._chrmEntryHandler.setLocal(t,{kvEntries:p,syncTime:new Date().getTime()},s)),[2,{code:a,data:c}]}})})},e.prototype.setChatroomEntry=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=xe.UPDATE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.setChatroomEntries=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=xe.UPDATE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,r)]})})},e.prototype.forceSetChatroomEntry=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=xe.UPDATE,r.isOverwrite=!0,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.removeChatroomEntry=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=xe.DELETE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.removeChatroomEntries=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=xe.DELETE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,r)]})})},e.prototype.forceRemoveChatroomEntry=function(t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return r.type=xe.DELETE,r.isOverwrite=!0,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.getChatroomEntry=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h;return B(this,function(a){switch(a.label){case 0:return(i=this._chrmEntryHandler.getValue(t,r))?[2,Promise.resolve({code:b.SUCCESS,data:i})]:[3,1];case 1:return(o=this._channel)?(s=o.codec.encodePullChatRoomKV(0),u=new te(x[x.pullKV],s,t),[4,o.send(u,Ft)]):[2,Promise.reject({code:b.RC_NET_CHANNEL_INVALID})];case 2:return d=a.sent(),(l=d.data||{})&&l.kvEntries&&l.kvEntries.length&&(h=l.kvEntries.find(function(c){return c.key===r}))!==void 0?[2,Promise.resolve({code:b.SUCCESS,data:h==null?void 0:h.value})]:[2,Promise.resolve({code:b.CHATROOM_KEY_NOT_EXIST})]}})})},e.prototype.getAllChatroomEntry=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return B(this,function(h){switch(h.label){case 0:return(r=this._chrmEntryHandler.getAll(t))&&Object.keys(r).length?[2,Promise.resolve({code:b.SUCCESS,data:r})]:[3,1];case 1:return(i=this._channel)?(o={},s=i.codec.encodePullChatRoomKV(0),u=new te(x[x.pullKV],s,t),[4,i.send(u,Ft)]):[2,Promise.reject({code:b.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:b.SUCCESS,data:o})]}})})},e.prototype.pullChatroomEntry=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c,p;return B(this,function(f){switch(f.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(u=o.codec.encodePullChatRoomKV(r),d=new te(x[x.pullKV],u,t),[4,o.send(d,Ft)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return l=f.sent(),h=l.code,a=l.data,h===b.SUCCESS?(G.info("Pull success ChrmKV, "+JSON.stringify(l)),this._chrmEntryHandler.setLocal(t,a,s),G.info("Save into cache success!"),c=a.kvEntries,p=[],c.length>0&&(c.forEach(function(m){var _=m.key,v=m.value,R=m.type,y=m.timestamp;p.push({key:_,value:v,type:R,timestamp:y,chatroomId:t})}),this._watcher.chatroom({updatedEntries:p})),[2,{code:h,data:a}]):[2,{code:h}]}})})},e.prototype.sendMessage=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,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=!![ee.PRIVATE,ee.GROUP].includes(t)&&i.isStatusMessage,s=o?function(_){var v;return(v={},v[ee.PRIVATE]=x.ppMsgS,v[ee.GROUP]=x.pgMsgS,v)[_]}(t):function(_){var v;return(v={},v[ee.PRIVATE]=x.ppMsgP,v[ee.GROUP]=x.pgMsgP,v[ee.CHATROOM]=x.chatMsg,v[ee.CUSTOMER_SERVICE]=x.pcMsgP,v[ee.RTC_ROOM]=x.prMsgS,v)[_]}(t)||x.ppMsgP,o&&(i.isPersited=!1,i.isCounted=!1),u=this._channel.codec.encodeUpMsg({conversationType:t,targetId:r},i),(d=new en(x[s],u,r)).setHeaderQos(st.AT_LEAST_ONCE),o?(this._channel.sendOnly(d),[2,{code:b.SUCCESS,data:ei(t,r,fe({},i),"",0,this.currentUserId)}]):(l=Date.now()-this._localConnectedTime+this._connectedTime,h=ei(t,r,fe({},i),"",l,this.currentUserId),[4,this._channel.send(d)])):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return a=m.sent(),c=a.code,p=a.data,c!==b.SUCCESS?[2,{code:c,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:b.SUCCESS,data:h}])}})})},e.prototype.recallMsg=function(t,r,i,o,s){var u;return V(this,void 0,void 0,function(){var d,l,h,a,c,p,f,m,_,v;return B(this,function(R){switch(R.label){case 0:return this._channel?(d=s.user,l={content:{conversationType:t,targetId:r,messageUId:i,sentTime:o,user:d},messageType:"RC:RcCmd",disableNotification:s==null?void 0:s.disableNotification,pushConfig:s==null?void 0:s.pushConfig,pushContent:((u=s.pushConfig)===null||u===void 0?void 0:u.pushContent)||s.pushContent||"",channelId:s.channelId},h=x[x.recallMsg],a=this._channel.codec.encodeUpMsg({conversationType:t,targetId:r},l),(c=new en(h,a,this.currentUserId)).setHeaderQos(st.AT_LEAST_ONCE),[4,this._channel.send(c)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return p=R.sent(),f=p.code,m=p.data,f!==b.SUCCESS?[2,{code:f}]:(_=m,this._sendMessageStore.setMessage(_.messageUId,_.timestamp),v=ei(t,r,fe(fe({},l),{isPersited:!0}),_.messageUId,_.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:b.SUCCESS,data:v}])}})})},e.prototype.sendReadReceiptMessage=function(t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeReadReceipt(r,i),s=new te(x[x.rrMsg],o,t),[4,this._channel.send(s)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return[2,u.sent()]}})})},e.prototype.getMessageReader=function(t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeMessageReader(r,i),s=new te(x[x.rrList],o,t),[4,this._channel.send(s,Ur)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return[2,u.sent()]}})})},e.prototype.pullUserSettings=function(t){return V(this,void 0,void 0,function(){var r,i;return B(this,function(o){return this._channel?(r=this._channel.codec.encodePullUserSetting(t),i=new te(x[x.pullUS],r,this.currentUserId),[2,this._channel.send(i,Lr)]):[2,{code:b.RC_NET_CHANNEL_INVALID}]})})},e.prototype.getFileToken=function(t,r,i,o){return V(this,void 0,void 0,function(){var s,u,d,l,h,a;return B(this,function(c){switch(c.label){case 0:return this._channel?(s=o&&o!=="uploads"?r||"":$u(t,r),u=this._channel.codec.encodeGetFileToken(t,s,i||"",o||""),d=new te(x[x.qnTkn],u,this.currentUserId),[4,this._channel.send(d,vo)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return l=c.sent(),h=l.code,a=l.data,a=Object.assign(a,{fileName:s}),h===b.SUCCESS?[2,{code:h,data:a}]:[2,{code:h}]}})})},e.prototype.getFileUrl=function(t,r,i,o){return V(this,void 0,void 0,function(){var s,u,d,l,h,a,c,p,f;return B(this,function(m){switch(m.label){case 0:return this._channel?(s="",u="",d="",r===De.QINIU?(u=Ro,d=yo):(u=Co,d=Eo),s=r===De.QINIU?x[x.qnUrl]:r===De.AWS?x[x.s3Url]:r===De.STC?x[x.stcUrl]:x[x.aliUrl],l=this._channel.codec.encodeGetFileUrl(u,t,i,o),h=new te(s,l,this.currentUserId),[4,this._channel.send(h,d)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return a=m.sent(),c=a.code,p=a.data,f=p,c===b.SUCCESS?[2,{code:c,data:f}]:[2,{code:c}]}})})},e.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()},e.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},e.prototype.registerMessageType=function(t,r,i,o){this._customMessageType[t]={isPersited:r,isCounted:i}},e.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},e.prototype.getCurrentUserId=function(){return this.currentUserId},e.prototype.createTag=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeCreateTag([t],r),o=new te(x[x.addSeTag],i,this.currentUserId),[4,this._channel.send(o,$t)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),u=s.code,d=s.data,u!==b.SUCCESS?[2,{code:u}]:(l=d.version,this._userSettingManager.addTag([fe(fe({},t),{createdTime:l})],l),[2,{code:b.SUCCESS,data:d}])}})})},e.prototype.removeTag=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeRemoveTag([t],r),o=new te(x[x.delSeTag],i,this.currentUserId),[4,this._channel.send(o,$t)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),u=s.code,d=s.data,u!==b.SUCCESS?[2,{code:u}]:(l=d.version,this._userSettingManager.deleteTag([t],l),[2,{code:b.SUCCESS}])}})})},e.prototype.updateTag=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeCreateTag([t],r),o=new te(x[x.addSeTag],i,this.currentUserId),[4,this._channel.send(o,$t)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),u=s.code,d=s.data,u!==b.SUCCESS?[2,{code:u}]:(l=d.version,this._userSettingManager.addTag([t],l),[2,{code:b.SUCCESS,data:d}])}})})},e.prototype.getTagList=function(){return V(this,void 0,void 0,function(){var t,r;return B(this,function(i){return t=this._userSettingManager.getTags(),r=this._conversationManager.getConversationListForTag(),t.forEach(function(o){o.conversationCount=r[o.tagId]?r[o.tagId].length:0}),[2,{code:b.SUCCESS,data:t}]})})},e.prototype.addTagForConversations=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d=this;return B(this,function(l){switch(l.label){case 0:return this._channel?this._userSettingManager.getTagById(t)?(i=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],r),o=new te(x[x.addTag],i,this.currentUserId),[4,this._channel.send(o)]):[2,{code:b.TAG_NOT_EXIST}]:[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return(s=l.sent().code)!==b.SUCCESS?[2,{code:s}]:((u={})[t]={},r.forEach(function(h){d._conversationManager.addTagStatus(h.conversationType,h.targetId,u,h.channelId)}),[2,{code:b.SUCCESS}])}})})},e.prototype.removeTagForConversations=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u=this;return B(this,function(d){switch(d.label){case 0:return this._channel?(i=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],r),o=new te(x[x.delTag],i,this.currentUserId),[4,this._channel.send(o)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return(s=d.sent().code)!==b.SUCCESS?[2,{code:s}]:(r.forEach(function(l){u._conversationManager.deleteTagStatus(l.conversationType,l.targetId,[t],l.channelId)}),[2,{code:b.SUCCESS}])}})})},e.prototype.removeTagsForConversation=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h;return B(this,function(a){switch(a.label){case 0:return this._channel?(i=t.conversationType,o=t.targetId,s=t.channelId,u=r.map(function(c){return{tagId:c}}),d=this._channel.codec.encodeUpdateConversationTag(u,[t]),l=new te(x[x.delTag],d,this.currentUserId),[4,this._channel.send(l)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return(h=a.sent().code)!==b.SUCCESS?[2,{code:h}]:(this._conversationManager.deleteTagStatus(i,o,r,s),[2,{code:b.SUCCESS}])}})})},e.prototype.getConversationListByTag=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p;return B(this,function(f){switch(f.label){case 0:return s=(o=this).currentUserId,(u=o._channel)?(d=u.codec.encodeOldConversationList({count:i,type:ee.PRIVATE,startTime:r}),l=new te(ys,d,s),[4,u.send(l,En,{currentUserId:s,connectedTime:u.connectedTime})]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return h=f.sent(),a=h.code,c=h.data,p=this._conversationHasTagFilter(t,c),G.info("GetConversationListByTag",p),a!==b.SUCCESS?[2,{code:a}]:[2,{code:a,data:p}]}})})},e.prototype._conversationHasTagFilter=function(t,r){var i=this,o=[],s=[];function u(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,c=i._conversationManager.get(l,h,a),p=c.hasMentioned,f=c.mentionedInfo,m=c.lastUnreadTime,_=c.notificationStatus,v=c.isTop,R=c.tags,y=c.unreadMessageCount,P=R&&R[t];if(P){var L=fe(fe({},d),{hasMentioned:p,mentionedInfo:f,lastUnreadTime:m,notificationStatus:_,isTop:v,unreadMessageCount:y});P.isTop?o.push(fe(fe({},L),{isTopInTag:!0})):s.push(fe(fe({},L),{isTopInTag:!1}))}}),bt(bt([],o.sort(u)),s.sort(u))},e.prototype.getUnreadCountByTag=function(t,r){return V(this,void 0,void 0,function(){var i;return B(this,function(o){return this._channel?(i=this._conversationManager.getUnreadCountByTag(t,r),[2,{code:b.SUCCESS,data:i}]):[2,{code:b.RC_NET_CHANNEL_INVALID}]})})},e.prototype.setConversationStatusInTag=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p,f;return B(this,function(m){switch(m.label){case 0:return this._channel?(o=r.targetId,s=r.conversationType,u=r.channelId,d=i.isTop,l=[{tagId:t,isTop:d}],(h=this._conversationManager.get(s,o,u)).tags&&Object.hasOwnProperty.call(h.tags,t)?(a=this._channel.codec.encodeUpdateConversationTag(l,[r]),c=new te(x[x.addTag],a,this.currentUserId),[4,this._channel.send(c)]):[2,{code:b.NO_TAG_IN_CONVER}]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return(p=m.sent().code)!==b.SUCCESS?[2,{code:p}]:((f={})[t]={},d&&(f[t].isTop=!0),this._conversationManager.addTagStatus(s,o,f,u),[2,{code:b.SUCCESS}])}})})},e.prototype.getTagsForConversation=function(t){var r;return V(this,void 0,void 0,function(){var i,o,s,u;return B(this,function(d){if(!this._channel)return[2,{code:b.RC_NET_CHANNEL_INVALID}];if(i=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),o=this._userSettingManager.getTagsInfo(),s=[],i.tags)for(u in i.tags)s.push({tagId:u,tagName:(r=o[u])===null||r===void 0?void 0:r.tagName});return[2,{code:b.SUCCESS,data:s}]})})},e.prototype.getBlockConversationList=function(){var t=this._conversationManager.getBlockConversationList();return Promise.resolve({code:b.SUCCESS,data:t})},e.prototype.getTopConversationList=function(){var t=this._conversationManager.getTopConversationList();return Promise.resolve({code:b.SUCCESS,data:t})},e.prototype.getUnreadMentionedCount=function(t){var r=this._conversationManager.getUnreadMentionedCount(t.channelId,t.conversationType,t.targetId);return Promise.resolve({code:b.SUCCESS,data:r})},e.prototype.getAllUnreadMentionedCount=function(){var t=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:b.SUCCESS,data:t})},e.prototype.joinRTCRoom=function(t,r,i,o){return V(this,void 0,void 0,function(){var s,u;return B(this,function(d){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(r,i,o),u=new te(x[x.rtcRJoin_data],s,t),[2,this._channel.send(u,It)]):[2,{code:b.RC_NET_CHANNEL_INVALID}]})})},e.prototype.quitRTCRoom=function(t){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 te(x[x.rtcRExit],r,t),[4,this._channel.send(i)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}})})},e.prototype.rtcPing=function(t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new te(x[x.rtcPing],o,t),[4,this._channel.send(s)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}})})},e.prototype.getRTCRoomInfo=function(t){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 te(x[x.rtcRInfo],r,t),[2,this._channel.send(i,Aa)]):[2,{code:b.RC_NET_CHANNEL_INVALID}]})})},e.prototype.getRTCUserInfoList=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u;return B(this,function(d){switch(d.label){case 0:return this._channel?(r=this._channel.codec.encodeGetRTCRoomInfo(),i=new te(x[x.rtcUData],r,t),[4,this._channel.send(i,It)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return o=d.sent(),s=o.code,u=o.data,[2,{code:s,data:u&&{users:u.users}}]}})})},e.prototype.setRTCUserInfo=function(t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeSetRTCUserInfo(r,i),s=new te(x[x.rtcUPut],o,t),[4,this._channel.send(s)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}})})},e.prototype.removeRTCUserInfo=function(t,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 en(x[x.rtcUDel],i,t),[4,this._channel.send(o)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}})})},e.prototype.setRTCData=function(t,r,i,o,s,u){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,u),l=new en(x[x.rtcSetData],d,t),[4,this._channel.send(l)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,h.sent().code]}})})},e.prototype.setRTCTotalRes=function(t,r,i,o,s){return V(this,void 0,void 0,function(){var u,d;return B(this,function(l){switch(l.label){case 0:return this._channel?(u=this._channel.codec.encodeUserSetRTCData(r,i,o,s),d=new te(x[x.userSetData],u,t),[4,this._channel.send(d)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,l.sent().code]}})})},e.prototype.setRTCCDNUris=function(t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCCDNUris(r,i),s=new te(x[x.userSetData],o,t),[4,this._channel.send(s)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}})})},e.prototype.getRTCData=function(t,r,i,o){if(!this._channel)return Promise.resolve({code:b.RC_NET_CHANNEL_INVALID});var s=this._channel.codec.encodeGetRTCData(r,i,o),u=new te(x[x.rtcQryData],s,t);return this._channel.send(u,Pr)},e.prototype.removeRTCData=function(t,r,i,o,s){return V(this,void 0,void 0,function(){var u,d;return B(this,function(l){switch(l.label){case 0:return this._channel?(u=this._channel.codec.encodeRemoveRTCData(r,i,o,s),d=new en(x[x.rtcDelData],u,t),[4,this._channel.send(d)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,l.sent().code]}})})},e.prototype.setRTCOutData=function(t,r,i,o){throw new Error("JSEngine's method not implemented.")},e.prototype.getRTCOutData=function(t,r){throw new Error("JSEngine's method not implemented.")},e.prototype.getRTCToken=function(t,r,i){return V(this,void 0,void 0,function(){var o,s;return B(this,function(u){return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new te(x[x.rtcToken],o,t),[2,this._channel.send(s,Ar)]):[2,{code:b.RC_NET_CHANNEL_INVALID}]})})},e.prototype.setRTCState=function(t,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 te(x[x.rtcUserState],i,t),[4,this._channel.send(o)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}})})},e.prototype.getRTCUserInfo=function(t){return V(this,void 0,void 0,function(){return B(this,function(r){throw new Error("Method not implemented.")})})},e.prototype.getRTCUserList=function(t){if(!this._channel)return Promise.resolve({code:b.RC_NET_CHANNEL_INVALID});var r=this._channel.codec.encodeGetRTCRoomInfo(),i=new te(x[x.rtcUList],r,t);return this._channel.send(i,It)},e.prototype.joinLivingRoomAsAudience=function(t,r,i){return r===void 0&&(r=Le.LIVE),V(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c;return B(this,function(p){switch(p.label){case 0:return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new te(x[x.viewerJoinR],o,t),[4,this._channel.send(s,Va)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return u=p.sent(),d=u.code,l=u.data,d!==b.SUCCESS?[2,{code:d}]:(a=(h=l).rtcToken,c=h.entries,[2,{code:d,data:{token:a,kvEntries:c}}])}})})},e.prototype.quitLivingRoomAsAudience=function(t){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 te(x[x.viewerExitR],r,t),[4,this._channel.send(i)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.rtcIdentityChange=function(t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l;return B(this,function(h){switch(h.label){case 0:return this._channel?(o=this._channel.codec.encodeIdentityChangeInfo(r,i),s=new te(x[x.rtcIdentityChange],o,t),[4,this._channel.send(s,It)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return u=h.sent(),d=u.code,l=u.data,d!==b.SUCCESS?[2,{code:d}]:[2,{code:d,data:l}]}})})},e.prototype.pullRTCRoomEntry=function(t,r){return V(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c;return B(this,function(p){switch(p.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(G.info("audience in room start pull KV"),u=o.codec.encodePullRTCRoomKV(t,0),d=new te(x[x.rtcPullKv],u,s),[4,o.send(d,xr)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return l=p.sent(),h=l.code,a=l.data,G.info("audience in room end pull KV, code: "+h+", data: "+JSON.stringify(a||{})),h===b.SUCCESS?(c=a.kvEntries,this._watcher.onRTCDataChange(c,t),[2,{code:h,data:a}]):[2,{code:h}]}})})},e.prototype.getRTCJoinedUserInfo=function(t){return V(this,void 0,void 0,function(){var r,i,o,s,u,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(t),u=new te(x[x.rtcQueryJoined],s,o),[4,i.send(u,Vr)]):[2,{code:b.RC_NET_CHANNEL_INVALID}];case 1:return d=a.sent(),l=d.code,h=d.data,l===b.SUCCESS?[2,{code:l,data:h}]:[2,{code:l}]}})})},e.prototype.getDeviceId=function(){return Xa(this.runtime)},e.prototype.requestRoomPK=function(t){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(t),i=new te(x[x.rtcInvite],r,t.roomId),[4,this._channel.send(i)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.cancelRoomPK=function(t){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(t),i=new te(x[x.rtcCancelInvite],r,t.roomId),[4,this._channel.send(i)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.responseRoomPK=function(t){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(t),i=new te(x[x.rtcInviteAnswer],r,t.roomId),[4,this._channel.send(i)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.endRoomPK=function(t){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(t),i=new te(x[x.rtcEndInvite],r,t.roomId),[4,this._channel.send(i)]):[2,b.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.callExtra=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return Promise.resolve({code:b.EXTRA_METHOD_UNDEFINED})},e.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},e.prototype.getConversationListWithAllChannelByPage=function(t,r){throw new Error("Method not implemented.")},e.prototype.clearConversations=function(){throw new Error("Method not implemented.")},e.prototype.setUserStatusListener=function(t,r){throw new Error("Method not implemented.")},e.prototype.setUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.subscribeUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.getUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.addToBlacklist=function(t){throw new Error("Method not implemented.")},e.prototype.removeFromBlacklist=function(t){throw new Error("Method not implemented.")},e.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},e.prototype.getBlacklistStatus=function(t){throw new Error("Method not implemented.")},e.prototype.insertMessage=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.deleteMessages=function(t){throw new Error("Method not implemented.")},e.prototype.deleteMessagesByTimestamp=function(t,r,i,o,s){throw new Error("Method not implemented.")},e.prototype.clearMessages=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.getMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setMessageContent=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.setMessageSearchField=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.searchConversationByContent=function(t,r,i,o){throw new Error("Method not implemented.")},e.prototype.searchMessageByContent=function(t,r,i,o,s,u){throw new Error("Method not implemented.")},e.prototype.getUnreadMentionedMessages=function(t,r){throw new Error("Method not implemented.")},e.prototype.setMessageSentStatus=function(t,r){throw new Error("Method not implemented.")},e.prototype.setMessageReceivedStatus=function(t,r){throw new Error("Method not implemented.")},e.prototype.clearUnreadCountByTimestamp=function(t,r,i,o){throw new Error("Method not implemented.")},e.prototype.getConversationNotificationStatus=function(t,r,i){var o=this._conversationManager.get(t,r,i);return o?Promise.resolve({code:b.SUCCESS,data:o.notificationStatus}):Promise.resolve({code:b.CONVER_GET_ERROR})},e.prototype.getRemoteHistoryMessages=function(t,r,i,o,s,u){return this.getHistoryMessage(t,r,i,o,s,u)},e}(Cd),ec=function(){function n(e){this._context=e}return 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(e,t,r){return this._context.sendMessage(e,t,r)},n.prototype.registerMessageType=function(e,t,r,i){i===void 0&&(i=[]),this._context.registerMessageType(e,t,r,i)},n.prototype.getServerTime=function(){return this._context.getServerTime()},n.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},n}(),xd=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return Re(e,n),e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.joinRTCRoom=function(t,r,i,o){return this._context.joinRTCRoom(t,r,i,o)},e.prototype.quitRTCRoom=function(t){return this._context.quitRTCRoom(t)},e.prototype.rtcPing=function(t,r,i){return this._context.rtcPing(t,r,i)},e.prototype.getRTCRoomInfo=function(t){return this._context.getRTCRoomInfo(t)},e.prototype.getRTCUserInfoList=function(t){return this._context.getRTCUserInfoList(t)},e.prototype.getRTCUserInfo=function(t){return this._context.getRTCUserInfo(t)},e.prototype.setRTCUserInfo=function(t,r,i){return this._context.setRTCUserInfo(t,r,i)},e.prototype.removeRTCUserInfo=function(t,r){return this._context.removeRTCUserInfo(t,r)},e.prototype.setRTCData=function(t,r,i,o,s,u){return this._context.setRTCData(t,r,i,o,s,u)},e.prototype.setRTCTotalRes=function(t,r,i,o,s){return this._context.setRTCTotalRes(t,r,i,o,s)},e.prototype.setRTCCDNUris=function(t,r,i){return this._context.setRTCCDNUris(t,r,i)},e.prototype.getRTCData=function(t,r,i,o){return this._context.getRTCData(t,r,i,o)},e.prototype.removeRTCData=function(t,r,i,o,s){return this._context.removeRTCData(t,r,i,o,s)},e.prototype.setRTCOutData=function(t,r,i,o){return this._context.setRTCOutData(t,r,i,o)},e.prototype.getRTCOutData=function(t,r){return this._context.getRTCOutData(t,r)},e.prototype.getRTCToken=function(t,r,i){return this._context.getRTCToken(t,r,i)},e.prototype.setRTCState=function(t,r){return this._context.setRTCState(t,r)},e.prototype.getRTCUserList=function(t){return this._context.getRTCUserList(t)},e.prototype.joinLivingRoomAsAudience=function(t,r,i){return this._context.joinLivingRoomAsAudience(t,r,i)},e.prototype.quitLivingRoomAsAudience=function(t){return this._context.quitLivingRoomAsAudience(t)},e.prototype.rtcIdentityChange=function(t,r,i){return this._context.rtcIdentityChange(t,r,i)},e.prototype.requestRoomPK=function(t){return this._context.requestRoomPK(t)},e.prototype.cancelRoomPK=function(t){return this._context.cancelRoomPK(t)},e.prototype.responseRoomPK=function(t){return this._context.responseRoomPK(t)},e.prototype.endRoomPK=function(t){return this._context.endRoomPK(t)},e}(ec),ws=function(){function n(){}return n.compress=function(e){for(var t=this,r={},i=0;i<e.length-1;i++){var o=e.charAt(i)+e.charAt(i+1);r.hasOwnProperty(o)?r[o].push(i):r[o]=[i]}for(var s=[],u=[],d=function(){if(u.length>0){var _=u.join("");if(u=[],_.length>26){var v=t.numberEncode(_.length),R=String.fromCharCode(t.dataType.NormalExt|v.length);s.push(R+v)}else{var y=String.fromCharCode(t.dataType.Normal|_.length);s.push(y)}s.push(_)}},l=0;l<e.length;){var h=t.indexOf(r,e,l);if(h.length<2)u.push(e.charAt(l++));else if(h.length<4)u.push(e.substr(l,h.length)),l+=h.length;else{var a=t.numberEncode(l-h.offset),c=t.numberEncode(h.length);if(a.length+c.length>=h.length)u.push(e.substr(l,h.length)),l+=h.length;else{d();var p=String.fromCharCode(t.dataType.Compressed|a.length<<2|c.length);s.push(p+a+c),l+=h.length}}}d();var f=t.numberEncode(e.length),m=String.fromCharCode(t.dataType.Tail|f.length);return s.push(m+f),s.join("")},n.uncompress=function(e){var t=this,r=0,i="";e:do{var o=e.charCodeAt(r++),s=o&t.dataType.Mark,u=15&o,d=void 0;switch(s){case t.dataType.Compressed:var l=u>>2,h=3&u;if(l===0||h===0)throw new Error("Data parsing error,at "+r);var a=t.numberDecode(e.substr(r,l)),c=t.numberDecode(e.substr(r+=l,h));if((a=i.length-a)+c>i.length)throw new Error("Data parsing error,at "+r);r+=h,i+=i.substr(a,c);break;case t.dataType.Tail:if((d=t.numberDecode(e.substr(r,u)))!==i.length)throw console.log(i.length),console.log(d),new Error("Data parsing error,at "+r);r+=u;break e;case t.dataType.NormalExt:d=t.numberDecode(e.substr(r,u)),i+=e.substr(r+=u,d),r+=d;break;case t.dataType.Normal:i+=e.substr(r,u),r+=u;break;case t.dataType.Mark:if(u>10)throw new Error("Data parsing error,at "+r);i+=e.substr(r,16+u),r+=16+u;break;default:throw new Error("Data parsing error,at "+r+" header:"+s)}}while(r<e.length);return i},n.indexOf=function(e,t,r){var i={length:0,offset:-1};if(t.length,r>=t.length-1)return i;var o=e[t.charAt(r)+t.charAt(r+1)];if(o[0]===r)return i;for(var s=t.length-r,u=0,d=o.length;u<d;u++){var l=o[u],h=r-l;if(!(h>this.max)){var a=Math.min(s,h);if(a<=i.length)break;if(!(i.length>2&&t.charAt(l+i.length-1)!==t.charAt(r+i.length-1))){for(var c=2,p=c;p<a&&t.charAt(l+p)===t.charAt(r+p);p++)c++;c>=i.length&&(i.length=c,i.offset=l)}}}return i},n.numberEncode=function(e){var t=this,r=[],i=0;do i=e%t.scale,r.push(t.chars.charAt(i)),e=(e-i)/t.scale;while(e>0);return r.join("")},n.numberDecode=function(e){for(var t=0,r=0,i=e.length-1;i>=0;i--){if((r=this.chars.indexOf(e.charAt(i)))===-1)throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+r}return t},n.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},n.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n.scale=n.chars.length,n.max=238327,n}(),nn=1,rn=!1,Ms=typeof location!="undefined"&&location.protocol==="https://"?"https://":"http://",Bn=function(){function n(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=Xa(e.runtime),this.logSwitch=e.logSwitch;var t=qu(e.runtime);this.deviceInfo=t.type+"|"+t.version+"|"+Rt.sessionId,this.startReport()}return n.init=function(e){return rn=!0,n._instance||(n._instance=new n(e)),n._instance},n.getInstance=function(){return n._instance},n.prototype.startReport=function(){var e=this;if(this.logSwitch&&rn){var t=this.itv*Math.pow(2,nn-1);nn<this.times&&nn++,setTimeout(function(){e.reportRealtimeLog()},1e3*t)}},n.prototype.reportRealtimeLog=function(){var e=this,t=Rt.realTimeLogList.filter(function(o){return o.level<=e.level});if(t.length!==0){var r=ws.compress(t.map(function(o){return o.content}).join("")),i=""+Ms+this.logUrl+"?version="+this.info.version+"&appkey="+this.info.appkey+"&userId="+this.info.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web";this.info.runtime.httpReq({method:"POST",url:i,body:r}).then(function(o){G.__clearRealTimeLog(),G.debug("report real-time log success");var s=o.data;s&&(s=JSON.parse(s),e.itv=s.nextTime,e.level=s.level,e.logSwitch=s.logSwitch,nn=1),e.startReport()}).catch(function(o){G.debug("report real-time log error -> "+o),e.startReport()})}else this.startReport()},n.prototype.reportFullLog=function(e){return V(this,void 0,void 0,function(){var t,r,i,o,s,u,d,l,h,a,c=this;return B(this,function(p){switch(p.label){case 0:return t=e.startTime,r=e.endTime,i=e.platform,o=e.logId,s=e.uri,u=Gi.getInstance(),G.debug("received report log msg, "+i.toLowerCase(),u),i.toLowerCase()==="web"&&u?t>r?(G.warn("report error: The start time("+t+") cannot be greater than the end time("+t+")"),[2]):[4,G.__insertLogIntoDatabase()]:[2];case 1:return p.sent(),[4,u.getRangeData(Bt,"time",t,r)];case 2:return d=(d=p.sent()).filter(function(f){return!f.userId||f.userId===c.info.userId}),l=ws.compress(d.map(function(f){return f.content}).join("")||"no data"),h=1,(a=function(){if(!(h>3)&&rn){var f=s||c.logUrl,m=""+Ms+f+"?version="+c.info.version+"&appkey="+c.info.appkey+"&userId="+c.info.userId+"&logId="+o+"&deviceId="+c.deviceId+"&deviceInfo="+c.deviceInfo+"&platform=Web",_=5e3*(h-1);h++,setTimeout(function(){rn&&c.info.runtime.httpReq({url:m,method:"POST",body:l}).then(function(){G.debug("report full log success!")}).catch(function(v){a(),G.warn("report full log error -> "+v)})},_)}})(),[2]}})})},n.prototype.distroy=function(){nn=1,rn=!1},n}();function Fn(n){return Object.assign({},n)}var As,Vd=function(){function n(e,t){var r;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=se.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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,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,Au);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)};this._engine=ms()?new RCCppEngine(e,i,this._options):new Ud(e,i,this._options)}return n.init=function(e,t){return G.setLogLevel(t.logLevel),G.setLogStdout(t.logStdout),(t.indexDBSwitch||le(t.indexDBSwitch))&&Gi.init(),G.debug("APIContext.init =>",t.appkey,t.navigators),this._context?(G.error("Repeat initialize!"),this._context):(G.warn("RCEngine Commit:","41dbe38d1b376ca0a791b23ed94be291e3f92e81"),this._context=new n(e,t),G.__insertLogIntoDatabase(),this._context)},n.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},n.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return G.warn("Repeat install plugin: "+e.tag),this._pluginInstanseMap[e.tag];var r=e.tag==="RCRTC"?new xd(this):new ec(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(r,this._runtime,t)}catch(o){G.error(`install plugin error!
- `,o)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&this._pluginContextQueue.push(r),i&&(this._pluginInstanseMap[e.tag]=i),i},n.prototype._handleRedirect=function(){return V(this,void 0,void 0,function(){var e=this;return B(this,function(t){switch(t.label){case 0:return G.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return t.sent().code!==b.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout(function(){e._handleRedirect()},5e3)),[2]}})})},n.prototype._connectionStatusListener=function(e){var t;return V(this,void 0,void 0,function(){return B(this,function(r){return e===se.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):e===se.BLOCKED||e===se.KICKED_OFFLINE_BY_OTHER_CLIENT||e===se.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):e===se.CONNECTING?this._handleConnecting():e===se.CONNECTED?this._handleConnected():e===se.DISCONNECTED?this._handleDisconnect():e===se.NETWORK_UNAVAILABLE&&this._handleSuspend(),this._connectionStatus=e,((t=this._watcher.rtcInnerWatcher)===null||t===void 0?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach(function(i){i.onconnectionstatechange&&i.onconnectionstatechange(e)}),this._watcher.connectionState&&this._watcher.connectionState(e),[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(){this._watcher.onDisconnect&&this._watcher.onDisconnect()},n.prototype._handleSuspend=function(){this._watcher.onSuspend&&this._watcher.onSuspend()},n.prototype._messageReceiver=function(e,t,r){var i,o,s;if((e.conversationType===ee.RTC_ROOM||Object.prototype.hasOwnProperty.call(Vu,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Fn(e));else if(["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)===-1||typeof this._watcher.chatroomState!="function"){if(e.messageType!=="RC:ChrmMemChange"){if(e.messageType!==Ae.TYPING_STATUS||(this._addTypingInfo(Fn(e)),!this._watcher.typingState))if(e.messageType!==Ae.LOG_COMMAND||e.senderUserId!=="rongcloudsystem")if(e.messageType!==Ae.INTERCEPT){if(!this._pluginContextQueue.some(function(v){if(!v.onmessage)return!1;try{return v.onmessage(Fn(e))}catch(R){return G.error("plugin error =>",R),!1}}))if(e.messageType!=="RC:ReadNtf")if(e.messageType!=="RC:RRReqMsg"){if(e.messageType!=="RC:RRRspMsg")return this._watcher.message&&this._watcher.message(Fn(e),t,r),e;var u=(s=e.content)===null||s===void 0?void 0:s.receiptMessageDic;u&&Array.isArray(u[this._engine.currentUserId])&&typeof this._watcher.messageReceiptResponse=="function"&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,u[this._engine.currentUserId])}else typeof this._watcher.messageReceiptRequest=="function"&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else typeof this._watcher.readReceiptReceived=="function"&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId});else{var d=e.content,l=d.startTime,h=d.endTime,a=d.platform,c=d.logId,p=d.uri,f=d.packageName,m={startTime:parseInt(l),endTime:parseInt(h),platform:a,logId:c,uri:p,packageName:f};(o=Bn.getInstance())===null||o===void 0||o.reportFullLog(m)}}else if(typeof this._watcher.chatroomState=="function"){var _={};Array.isArray(e.content.userList)&&e.content.userList.forEach(function(v){_[v.userId]=v.status}),this._watcher.chatroomState({userChange:{users:_,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(i={},i[e.senderUserId]=e.messageType==="RC:ChrmQuitNtf"?hs.QUIT:hs.JOIN,i),chatroomId:e.targetId}})},n.prototype._batchMessageReceiver=function(e,t,r){var i=this,o=[];e.forEach(function(s){var u=i._messageReceiver(s,t,r);u&&o.push(u)}),o.length&&this._watcher.batchMessage&&this._watcher.batchMessage(o)},n.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},n.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},n.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},n.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},n.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},n.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},n.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},n.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},n.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach(function(r){r.onrtcdatachange&&r.onrtcdatachange(e,t)})},n.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach(function(r){if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];t._watcher[r]=sr(i)||Ne(i)?i:void 0}})},n.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach(function(t){e._watcher[t]=void 0})},n.prototype._addTypingInfo=function(e){var t=e.senderUserId,r=e.conversationType,i=e.targetId,o=e.content,s=e.channelId,u=o.typingContentType,d=r+"#"+i+"#"+(s||"");this._typingInfo[d]||(this._typingInfo[d]=[]);var l=this._typingInfo[d].findIndex(function(h){return h.userId===t});l>=0&&this._typingInfo[d][l].messageType===u?this._typingInfo[d][l].timestamp=Date.now():(l>=0&&this._typingInfo[d].splice(l,1),this._typingInfo[d].push({userId:t,messageType:u,timestamp:Date.now()}),this._typingChangedList.includes(d)||this._typingChangedList.push(d),this._startCheckTypingInfo())},n.prototype._startCheckTypingInfo=function(){var e=this;this._typingInternalTimer===-1&&Object.keys(this._typingInfo).length!==0&&(this._typingInternalTimer=setInterval(function(){for(var t in e._typingInfo){var r=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter(function(o){return Date.now()-o.timestamp<e._typingExpireTime}),e._typingInfo[t].length===r||e._typingChangedList.includes(t)||e._typingChangedList.push(t),e._typingInfo[t].length===0&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var i=e._typingChangedList.map(function(o){return{conversationType:Number(o.split("#")[0]),targetId:o.split("#")[1],channelId:o.split("#")[2],list:e._typingInfo[o]||[]}});e._typingStatusListener(i),e._typingChangedList=[]}Object.keys(e._typingInfo).length===0&&(clearInterval(e._typingInternalTimer),e._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(e,t){return t===void 0&&(t=!1),V(this,void 0,void 0,function(){var r,i,o,s,u,d;return B(this,function(l){switch(l.label){case 0:return this._connectionStatus===se.CONNECTED?[2,{code:b.SUCCESS,userId:this._engine.currentUserId}]:this._connectionStatus===se.CONNECTING?[2,{code:b.BIZ_ERROR_CONNECTING}]:typeof e!="string"||e.length===0?[2,{code:b.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,r=e.split("@"),i=r[1],o=i?i.split(";").map(function(h){return/^https?:/.test(h)?h:"https://"+h}):[],[4,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,t,this._options.checkCA)]);case 1:return(s=l.sent())?(s==null?void 0:s.type)===1?[2,{code:b.PACKAGE_ENVIRONMENT_ERROR}]:(u=Ot.getInfo(),[4,this._engine.connect(this._getTokenWithoutNavi(),s)]):[2,{code:b.RC_NAVI_RESOURCE_ERROR}];case 2:return d=l.sent(),G.__insertLogIntoDatabase(),d!==we.REDIRECT?[3,4]:(this._connectionStatus=se.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,l.sent()];case 4:return d===b.SUCCESS&&(G.info("connect success, userId: "+this._engine.currentUserId),(s==null?void 0:s.type)!==1&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),Bn.init({runtime:this._runtime,logSwitch:(s==null?void 0:s.logSwitch)||0,logPolicy:JSON.parse((s==null?void 0:s.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),Rt.init(this._engine.currentUserId),this._isInternalConnected=!0),d!==b.SUCCESS||ms()||s.openUS===1&&this._pullUserSettings(),d!==b.SUCCESS&&(this._connectionStatus=se.CONNECTION_CLOSED),[2,{code:d,userId:this._engine.currentUserId}]}})})},n.prototype._pullUserSettings=function(){return V(this,void 0,void 0,function(){return B(this,function(e){return[2]})})},n.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,(e=Bn.getInstance())===null||e===void 0||e.distroy(),G.__insertLogIntoDatabase(),Rt.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach(function(t){if(t.ondisconnect)try{t.ondisconnect()}catch(r){G.error("plugin error =>",r)}}),Promise.resolve()},n.prototype.reconnect=function(){return this._isInternalConnected?Promise.resolve({code:b.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())},n.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},n.prototype.getInfoFromCache=function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())},n.prototype.registerMessageType=function(e,t,r,i){i===void 0&&(i=[]),this._engine.registerMessageType(e,t,r,i)},n.prototype.sendMessage=function(e,t,r,i){var o=this.getInfoFromCache();if(((o==null?void 0:o.grpRRVer)||0)===1&&r.messageType===Ae.READ_RECEIPT_RESPONSE)return Promise.resolve({code:b.READ_RECEIPT_ERROR});var s=JSON.stringify(r.content);return Ta(s)>131072?Promise.resolve({code:b.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,r,i)},n.prototype.sendExpansionMessage=function(e){return V(this,void 0,void 0,function(){var t,r,i,o,s,u,d,l,h,a,c,p,f,m;return B(this,function(_){switch(_.label){case 0:if(t=e.channelId,r=e.conversationType,i=e.targetId,o=e.messageUId,s=e.keys,u=e.expansion,d=e.removeAll,!e.canIncludeExpansion)return[2,{code:b.MESSAGE_KV_NOT_SUPPORT}];if(l=!1,h=!1,a=!1,Ne(u)){for(p in c=Object.keys(u).length,l=c>20,u)if(f=u[p],h=Be(p)&&!/^[A-Za-z0-9_=+-]+$/.test(p),(a=p.length>32||f.length>64)||h)break}return l||a?[2,{code:b.EXPANSION_LIMIT_EXCEET}]:h?[2,{code:b.BIZ_ERROR_INVALID_PARAMETER}]:(m={mid:o},u&&(m.put=u),s&&(m.del=s),d&&(m.removeAll=1),[4,this._engine.sendMessage(r,i,{content:m,messageType:Ae.EXPANSION_NOTIFY,channelId:t})]);case 1:return[2,{code:_.sent().code}]}})})},n.prototype.sendReadReceiptMessage=function(e,t,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:b.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,r)]})})},n.prototype.getMessageReader=function(e,t,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:b.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,r)]})})},n.prototype._destroy=function(){var e;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(t){if(t.ondestroy)try{t.ondestroy()}catch(r){G.error("plugin error =>",r)}}),this._pluginContextQueue.length=0,this._pluginInstanseMap={},(e=Bn.getInstance())===null||e===void 0||e.distroy(),Rt.reset()},n.prototype.getHistoryMessage=function(e,t,r,i,o,s,u){return r===void 0&&(r=0),i===void 0&&(i=20),o===void 0&&(o=0),s===void 0&&(s=""),u===void 0&&(u=""),this._engine.getHistoryMessage(e,t,r,i,o,s,u||"")},n.prototype.getConversationList=function(e,t,r,i,o){return e===void 0&&(e=300),o===void 0&&(o=""),this._engine.getConversationList(e,t,r,i,o)},n.prototype.getConversation=function(e,t,r){return this._engine.getConversation(e,t,r)},n.prototype.removeConversation=function(e,t,r){return r===void 0&&(r=""),this._engine.removeConversation(e,t,r)},n.prototype.clearUnreadCount=function(e,t,r){return r===void 0&&(r=""),this._engine.clearConversationUnreadCount(e,t,r)},n.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},n.prototype.getUnreadCount=function(e,t,r){return r===void 0&&(r=""),this._engine.getConversationUnreadCount(e,t,r)},n.prototype.getTotalUnreadCount=function(e,t,r){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[ee.PRIVATE,ee.GROUP,ee.SYSTEM,ee.PUBLIC_SERVICE],!!r)},n.prototype.getFirstUnreadMessage=function(e,t,r){return r===void 0&&(r=""),this._engine.getFirstUnreadMessage(e,t,r)},n.prototype.setConversationStatus=function(e,t,r,i,o){o===void 0&&(o="");var s=[{conversationType:e,targetId:t,isTop:r,notificationStatus:i,channelId:o}];return this._engine.batchSetConversationStatus(s)},n.prototype.saveConversationMessageDraft=function(e,t,r,i){return i===void 0&&(i=""),this._engine.saveConversationMessageDraft(e,t,r,i)},n.prototype.getConversationMessageDraft=function(e,t,r){return r===void 0&&(r=""),this._engine.getConversationMessageDraft(e,t,r)},n.prototype.clearConversationMessageDraft=function(e,t,r){return r===void 0&&(r=""),this._engine.clearConversationMessageDraft(e,t,r)},n.prototype.recallMessage=function(e,t,r,i,o){return this._engine.recallMsg(e,t,r,i,o)},n.prototype.deleteRemoteMessage=function(e,t,r,i){return i===void 0&&(i=""),this._engine.deleteRemoteMessage(e,t,r,i)},n.prototype.deleteRemoteMessageByTimestamp=function(e,t,r,i){return i===void 0&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,r,i)},n.prototype.joinChatroom=function(e,t){return t===void 0&&(t=10),this._engine.joinChatroom(e,t)},n.prototype.joinExistChatroom=function(e,t){return t===void 0&&(t=10),this._engine.joinExistChatroom(e,t)},n.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},n.prototype.getChatroomInfo=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=0),this._engine.getChatroomInfo(e,t,r)},n.prototype.setChatroomEntry=function(e,t){var r=t.key,i=t.value;return Lt(r)&&zr(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(b.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.setChatroomEntries=function(e,t){for(var r=0;r<t.entries.length;r++){var i=t.entries[r],o=i.key,s=i.value;if(!Lt(o)||!zr(s))return Promise.resolve({code:b.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)},n.prototype.forceSetChatroomEntry=function(e,t){var r=t.key,i=t.value;return Lt(r)&&zr(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(b.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.removeChatroomEntry=function(e,t){var r=t.key;return Lt(r)?this._engine.removeChatroomEntry(e,t):Promise.resolve(b.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.removeChatroomEntries=function(e,t){for(var r=0;r<t.entries.length;r++){var i=t.entries[r].key;if(!Lt(i))return Promise.resolve({code:b.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},n.prototype.forceRemoveChatroomEntry=function(e,t){var r=t.key;return Lt(r)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(b.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},n.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},n.prototype.getChatroomHistoryMessages=function(e,t,r,i){return t===void 0&&(t=20),r===void 0&&(r=0),i===void 0&&(i=0),this._engine.getChatroomHistoryMessages(e,i,t,r)},n.prototype.getFileToken=function(e,t,r,i){return V(this,void 0,void 0,function(){var o,s,u,d,l,h,a;return B(this,function(c){switch(c.label){case 0:return o=this.getInfoFromCache(),s=(o==null?void 0:o.bosAddr)||"",u=(o==null?void 0:o.uploadServer)||"",d=(o==null?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(e,t,r,i)];case 1:return l=c.sent(),h=l.code,a=l.data,h===b.SUCCESS?[2,Promise.resolve(Object.assign(a,{bos:s,qiniu:u,ossConfig:d}))]:[2,Promise.reject(h)]}})})},n.prototype.getFileUrl=function(e,t,r,i,o){return o===void 0&&(o=De.QINIU),V(this,void 0,void 0,function(){var s,u,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(e,o,t,r)];case 1:return s=l.sent(),u=s.code,d=s.data,u===b.SUCCESS?[2,Promise.resolve(d)]:[2,Promise.reject(u)]}})})},n.prototype.createTag=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.createTag(e)]})})},n.prototype.removeTag=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.removeTag(e)]})})},n.prototype.updateTag=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.updateTag(e)]})})},n.prototype.getTagList=function(){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.getTagList()]})})},n.prototype.addTagForConversations=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){return t.length>1e3?[2,Promise.reject(b.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]})})},n.prototype.removeTagForConversations=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.removeTagForConversations(e,t)]})})},n.prototype.removeTagsForConversation=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.removeTagsForConversation(e,t)]})})},n.prototype.getConversationListByTag=function(e,t,r,i){return V(this,void 0,void 0,function(){return B(this,function(o){return[2,this._engine.getConversationListByTag(e,t,r,i)]})})},n.prototype.getUnreadCountByTag=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.getUnreadCountByTag(e,t)]})})},n.prototype.setConversationStatusInTag=function(e,t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.setConversationStatusInTag(e,t,r)]})})},n.prototype.getTagsForConversation=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.getTagsForConversation(e)]})})},n.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},n.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},n.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},n.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},n.prototype.callExtra=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,bt([e],r))},n.prototype.clearConversations=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){switch(r.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,r.sent()]}})})},n.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,function(r){try{t(r)}catch(i){G.error(i)}})},n.prototype.addToBlacklist=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.addToBlacklist(e)]})})},n.prototype.removeFromBlacklist=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.removeFromBlacklist(e)]})})},n.prototype.getBlacklist=function(){return V(this,void 0,void 0,function(){return B(this,function(e){return[2,this._engine.getBlacklist()]})})},n.prototype.getBlacklistStatus=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.getBlacklistStatus(e)]})})},n.prototype.insertMessage=function(e,t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.insertMessage(e,t,r)]})})},n.prototype.deleteMessages=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.deleteMessages(e)]})})},n.prototype.deleteMessagesByTimestamp=function(e,t,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(e,t,r,i,o)]})})},n.prototype.clearMessages=function(e,t,r){return r===void 0&&(r=""),V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.clearMessages(e,t,r)]})})},n.prototype.getMessage=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.getMessage(e)]})})},n.prototype.setMessageContent=function(e,t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.setMessageContent(e,t,r)]})})},n.prototype.setMessageSearchField=function(e,t,r){return V(this,void 0,void 0,function(){return B(this,function(i){return[2,this._engine.setMessageSearchField(e,t,r)]})})},n.prototype.setMessageSentStatus=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.setMessageSentStatus(e,t)]})})},n.prototype.setMessageReceivedStatus=function(e,t){return V(this,void 0,void 0,function(){return B(this,function(r){return[2,this._engine.setMessageReceivedStatus(e,t)]})})},n.prototype.setUserStatus=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.setUserStatus(e)]})})},n.prototype.subscribeUserStatus=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.subscribeUserStatus(e)]})})},n.prototype.getUserStatus=function(e){return V(this,void 0,void 0,function(){return B(this,function(t){return[2,this._engine.getUserStatus(e)]})})},n.prototype.searchConversationByContent=function(e,t,r,i){return t===void 0&&(t=[]),r===void 0&&(r=""),V(this,void 0,void 0,function(){return B(this,function(o){return[2,this._engine.searchConversationByContent(e,t,r,i)]})})},n.prototype.searchMessageByContent=function(e,t,r,i,o,s,u){return u===void 0&&(u=""),V(this,void 0,void 0,function(){return B(this,function(d){return[2,this._engine.searchMessageByContent(e,t,r,i,o,s,u)]})})},n.prototype.getUnreadMentionedMessages=function(e,t,r){return r===void 0&&(r=""),this._engine.getUnreadMentionedMessages(e,t,r)},n.prototype.clearUnreadCountByTimestamp=function(e,t,r,i){return i===void 0&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,r,i)},n.prototype.getConversationNotificationStatus=function(e,t,r){return r===void 0&&(r=""),this._engine.getConversationNotificationStatus(e,t,r)},n.prototype.getRemoteHistoryMessages=function(e,t,r,i,o,s){return this._engine.getRemoteHistoryMessages(e,t,r,i,o,s)},n.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},n.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},n.prototype.joinRTCRoom=function(e,t,r,i){return this._engine.joinRTCRoom(e,t,r,i)},n.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},n.prototype.rtcPing=function(e,t,r){return this._engine.rtcPing(e,t,r)},n.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},n.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},n.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},n.prototype.setRTCUserInfo=function(e,t,r){return this._engine.setRTCUserInfo(e,t,r)},n.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},n.prototype.setRTCData=function(e,t,r,i,o,s){return this._engine.setRTCData(e,t,r,i,o,s)},n.prototype.setRTCTotalRes=function(e,t,r,i,o){return o===void 0&&(o=""),this._engine.setRTCTotalRes(e,t,r,i,o)},n.prototype.setRTCCDNUris=function(e,t,r){return this._engine.setRTCCDNUris(e,t,r)},n.prototype.getRTCData=function(e,t,r,i){return this._engine.getRTCData(e,t,r,i)},n.prototype.removeRTCData=function(e,t,r,i,o){return this._engine.removeRTCData(e,t,r,i,o)},n.prototype.setRTCOutData=function(e,t,r,i){return this._engine.setRTCOutData(e,t,r,i)},n.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},n.prototype.getRTCToken=function(e,t,r){return this._engine.getRTCToken(e,t,r)},n.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},n.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},n.prototype.joinLivingRoomAsAudience=function(e,t,r){return this._engine.joinLivingRoomAsAudience(e,t,r)},n.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},n.prototype.rtcIdentityChange=function(e,t,r){return this._engine.rtcIdentityChange(e,t,r)},n.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},n.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},n.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},n.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},n.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},n}();(function(n){n[n.add=1]="add",n[n.update=2]="update",n[n.delete=3]="delete"})(As||(As={}));/*! *****************************************************************************
- 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.
- ***************************************************************************** */var bi=function(n,e){return bi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},bi(n,e)},Oi=function(){return Oi=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},Oi.apply(this,arguments)};function In(n,e,t,r){return new(t||(t=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function u(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 t?h:new t(function(a){a(h)})).then(s,u)}d((r=r.apply(n,e||[])).next())})}function bn(n,e){var t,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(l){return function(h){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=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=e.call(n,s)}catch(a){h=[6,a],r=0}finally{t=i=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([d,l])}}}var ke=new Rt("RCIM"),Mn=function(){return!(typeof uni=="undefined"||!function(n){for(var e=["canIUse","getSystemInfo"],t=0,r=e.length;t<r;t++)if(!n[e[t]])return!1;return!0}(uni))},Bd=Mn(),Ce,Ps={tag:"browser",httpReq:function(n){var e=n.method||Ze.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i);return new Promise(function(u){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(e,s),r&&l.setRequestHeader)for(var a in r)l.setRequestHeader(a,r[a]);if(h){l.timeout=t,l.onload=function(){u({data:l.responseText,status:l.status||200})},l.onerror=function(){u({status:l.status||0})},l.ontimeout=function(){u({status:l.status||0})};var c=typeof o=="object"?JSON.stringify(o):o;l.send(c)}else l.onreadystatechange=function(){l.readyState===4&&u({data:l.responseText,status:l.status})},l.onerror=function(){u({status:l.status||0})},setTimeout(function(){return u({status:l.status||0})},t),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||ke.warn("websocket not support"),n},useNavi:!0,connectPlatform:"",isFromUniapp:Bd,createWebSocket:function(n,e){var t=new WebSocket(n,e);return t.binaryType="arraybuffer",{onClose:function(r){t.onclose=function(i){var o=i.code,s=i.reason;r(o,s)}},onError:function(r){t.onerror=r},onMessage:function(r){t.onmessage=function(i){r(i.data)}},onOpen:function(r){t.onopen=r},send:function(r){t.send(r)},close:function(r,i){t.close(r,i)}}},createDataChannel:function(n,e){return this.isSupportSocket()&&e==="websocket"?new Yt(this,n):new zt(this,n)}},Fd=Mn(),$n=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return wx[n].apply(wx,e)}catch(r){ke.error(r)}}},Ls={setItem:$n("setStorageSync"),getItem:$n("getStorageSync"),removeItem:$n("removeStorageSync"),clear:$n("clearStorageSync")},ks={tag:"wechat",httpReq:function(n){var e=n.method||Ze.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i);return new Promise(function(u){wx.request({url:s,method:e,headers:r,timeout:t,data:o,success:function(d){u({data:d.data,status:d.statusCode})},fail:function(){u({status:b.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:Ls,sessionStorage:Ls,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Fd,createWebSocket:function(n,e){var t=wx.connectSocket({url:n,protocols:e});return{onClose:function(r){t.onClose(function(i){r(i.code,i.reason)})},onError:function(r){t.onError(function(i){r(i.errMsg)})},onMessage:function(r){t.onMessage(function(i){r(i.data)})},onOpen:function(r){t.onOpen(r)},send:function(r){t.send({data:r})},close:function(r,i){t.close({code:r,reason:i})}}},createDataChannel:function(n,e){return e==="websocket"?new Yt(this,n):new zt(this,n)}},$d=Mn(),Hn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return my[n].apply(my,e)}catch(r){ke.error(r)}}},Ds={setItem:Hn("setStorageSync"),getItem:Hn("getStorageSync"),removeItem:Hn("removeStorageSync"),clear:Hn("clearStorageSync")},Us={tag:"alipay",httpReq:function(n){var e=n.method||Ze.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i),u=n.dataType||"json";return new Promise(function(d){my.request({url:s,method:e,headers:r,timeout:t,data:o,dataType:u,success:function(l){d({data:l.data,status:l.status})},fail:function(){d({status:b.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:Ds,sessionStorage:Ds,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:$d,createDataChannel:function(n,e){return e==="websocket"?new Yt(this,n):new zt(this,n)}},Hd=Mn(),jn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return console.log("tt",tt),tt[n].apply(tt,e)}catch(r){ke.error(r)}}},xs={setItem:jn("setStorageSync"),getItem:jn("getStorageSync"),removeItem:jn("removeStorageSync"),clear:jn("clearStorageSync")},Vs={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Hd,localStorage:xs,sessionStorage:xs,httpReq:function(n){return new Promise(function(e,t){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};e(o)},fail:function(r){console.log("\u8C03\u7528\u5931\u8D25",r.errMsg),t({data:r.errMsg})}})})},createWebSocket:function(n,e){var t=tt.connectSocket({url:n,protocols:e});return{onOpen:function(r){t.onOpen(r)},onClose:function(r){t.onClose(function(i){return r(i.code,i.reason)})},onError:function(r){t.onError(function(i){return r(i.errMsg)})},onMessage:function(r){t.onMessage(function(i){return r(i.data)})},send:function(r){t.send({data:r})},close:function(r,i){t.close({code:r,reason:i})}}},createDataChannel:function(n,e){return e==="websocket"?new Yt(this,n):new zt(this,n)}},jd=Mn(),Kn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return console.log("swan",swan),swan[n].apply(swan,e)}catch(r){ke.error(r)}}},Bs={setItem:Kn("setStorageSync"),getItem:Kn("getStorageSync"),removeItem:Kn("removeStorageSync"),clear:Kn("clearStorageSync")},Fs={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:jd,localStorage:Bs,sessionStorage:Bs,httpReq:function(n){return new Promise(function(e,t){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};e(o)},fail:function(r){console.log("\u8C03\u7528\u5931\u8D25",r.errorCode),t({data:r.errorCode})}})})},createWebSocket:function(n,e){var t=swan.connectSocket({url:n,protocols:e});return{onOpen:function(r){t.onOpen(r)},onClose:function(r){t.onClose(function(i){return r(i.code,i.reason)})},onError:function(r){t.onError(function(i){return r(i.errMsg)})},onMessage:function(r){t.onMessage(function(i){return r(i.data)})},send:function(r){t.send({data:r})},close:function(r,i){t.close({code:r,reason:i})}}},createDataChannel:function(n,e){return e==="websocket"?new Yt(this,n):new zt(this,n)}},qn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return uni[n].apply(uni,e)}catch(r){ke.error(r)}}},$s={setItem:qn("setStorageSync"),getItem:qn("getStorageSync"),removeItem:qn("removeStorageSync"),clear:qn("clearStorageSync")},Kd={tag:"uniapp",httpReq:function(n){var e=n.method||Ze.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i);return new Promise(function(u){uni.request({url:s,method:e,headers:r,timeout:t,data:o,success:function(d){u({data:d.data,status:d.statusCode})},fail:function(){u({status:b.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:$s,sessionStorage:$s,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(n,e){var t={complete:function(){},url:n,protocols:e},r=uni.connectSocket(t);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,e){return e==="websocket"?new Yt(this,n):new zt(this,n)}},on=function(n){return n&&n.canIUse&&n.getSystemInfo},qd=typeof uni!="undefined"&&on(uni)?function(){switch({}.VUE_APP_PLATFORM){case"app-plus":return Kd;case"mp-baidu":return Fs;case"mp-toutiao":return Vs;case"mp-alipay":return Us;case"mp-weixin":return ks;default:return Ps}}():typeof wx!="undefined"&&on(wx)?ks:typeof my!="undefined"&&on(my)?Us:typeof tt!="undefined"&&on(tt)?Vs:typeof swan!="undefined"&&on(swan)?Fs:Ps;function _r(n){var e=n.conversationType,t=n.channelId,r=n.messageType,i=n.content,o=n.senderUserId,s=n.targetId,u=n.sentTime,d=n.receivedTime,l=n.messageUId,h=n.messageDirection,a=n.isPersited,c=n.isCounted,p=n.isOffLineMessage,f=n.canIncludeExpansion,m=n.expansion,_=n.receivedStatus,v=n.disableNotification,R=n.isMentioned,y=n.isStatusMessage,P=n.readReceiptInfo,L=n.pushConfig,N=n.messageId;return _||(_=_n.UNREAD),{messageType:r,channelId:t||"",content:i,senderUserId:o,targetId:s,conversationType:e,sentTime:u,receivedTime:d,messageUId:l,messageDirection:h,isPersited:a,isCounted:c,isOffLineMessage:p,isMentioned:R,disableNotification:v,isStatusMessage:y,canIncludeExpansion:f,expansion:m,receivedStatus:_,readReceiptInfo:P,pushConfig:L,messageId:N}}(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"})(Ce||(Ce={}));var wt,ze=function(n){function e(t){var r=n.call(this)||this;if(e.imClient)return ke.error("Please do not repeatedly perform the init method"),e.imClient;Ie("options.navigators",t.navigators,function(o){return Ue(o)&&(o.length===0||o.every(vn))});var i=t==null?void 0:t.connectType;return i?lt.WEBSOCKET!==i&<.COMET!==i&&(ke.warn("RongIMLib connectionType must be "+lt.WEBSOCKET+" or "+lt.COMET),i=lt.WEBSOCKET):i=lt.WEBSOCKET,r._context=Vd.init(qd,{appkey:t.appkey,apiVersion:"5.1.1",navigators:t.navigators||[],miniCMPProxy:t.customCMP||[],connectionType:i,logLevel:t.logLevel,logStdout:t.logStdout,indexDBSwitch:t.indexDBSwitch,checkCA:t.checkCA}),r.watch(),e.imClient=r,r}return function(t,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=t}bi(t,r),t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}(e,n),Object.defineProperty(e.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),e.prototype.watch=function(){var t=this,r={onConnecting:function(){t.emit(Ce.CONNECTING)},onConnected:function(){t.emit(Ce.CONNECTED)},onDisconnect:function(){t.emit(Ce.DISCONNECT)},onSuspend:function(){t.emit(Ce.SUSPEND)},batchMessage:function(i){t.emit(Ce.MESSAGES,{messages:i.map(function(o){return _r(o)})})},typingState:function(i){t.emit(Ce.TYPING_STATUS,{status:i})},readReceiptReceived:function(i,o,s){t.emit(Ce.READ_RECEIPT_RECEIVED,{conversation:i,messageUId:o,sentTime:s})},messageReceiptRequest:function(i,o,s){t.emit(Ce.MESSAGE_RECEIPT_REQUEST,{conversation:i,messageUId:o,senderUserId:s})},messageReceiptResponse:function(i,o,s){t.emit(Ce.MESSAGE_RECEIPT_RESPONSE,{conversation:i,receivedUserId:o,messageUIdList:s})},conversationState:function(i){var o=i.map(function(s){return{conversation:{conversationType:s.conversationType,latestMessage:s.latestMessage?_r(s.latestMessage):null,targetId:s.targetId,unreadMessageCount:s.unreadMessageCount,hasMentioned:s.hasMentioned,mentionedInfo:s.mentionedInfo,lastUnreadTime:s.lastUnreadTime,notificationStatus:s.notificationStatus,isTop:s.isTop,channelId:s.channelId,unreadMentionedCount:s.unreadMentionedCount},updatedItems:s.updatedItems}});t.emit(Ce.CONVERSATION,{conversationList:o})},chatroomState:function(i){t.emit(Ce.CHATROOM,i)},expansion:function(i){t.emit(Ce.EXPANSION,i)},pullFinished:function(){t.emit(Ce.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){t.emit(Ce.TAG)},conversationTagChanged:function(){t.emit(Ce.CONVERSATION_TAG)},messageBlocked:function(i){t.emit(Ce.MESSAGE_BLOCKED,i)}};this.context.assignWatcher(r)},e}(On),vr={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:b.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},Kt={},Gd={};for(var Hs in vr){var js=vr[Hs],Ks=js.code;Kt[Ks]=Hs,Gd[Ks]=js}vr.ROAMING_SERVICE_UNAVAILABLE.code;var Yd=function(n){wt=wt||new ze(n)};function zd(n,e){return wt==null?void 0:wt.context.install(n,e)}function Jd(n){return In(this,void 0,void 0,function(){var e;return bn(this,function(t){switch(t.label){case 0:return Ie("token",n,Ee.STRING,!0),ke.warn("RongIMLib Version: 5.1.1, Commit: 756868a83166be55e30e49e5685b1644456ea30f"),[4,wt.context.connect(n,!0)];case 1:return(e=t.sent()).code===b.SUCCESS?[2,{code:e.code,data:{userId:e.userId}}]:[2,{code:e.code,msg:Kt[e.code]}]}})})}function Wd(){return wt.context.disconnect()}function An(n,e,t){wt.on(n,e,t)}function Zd(n,e){return In(this,void 0,void 0,function(){var t,r;return bn(this,function(i){switch(i.label){case 0:return Ie("options.count",e.count,Ee.NUMBER,!0),t="id:"+n,ke.debug("join chatroom ->"+t),[4,ze.imClient.context.joinChatroom(n,e.count)];case 1:return(r=i.sent())!==b.SUCCESS?(ke.warn("join chatroom fail ->code+:"+Kt[r]+","+t),[2,{code:r,msg:Kt[r]}]):[2,{code:r}]}})})}var tc=function(n,e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!0),this.messageType=n,this.content=e,this.isPersited=t,this.isCounted=r};function qe(n,e,t){return e===void 0&&(e=!0),t===void 0&&(t=!0),function(r){return new tc(n,r,e,t)}}var nc,Ni,Qd=qe("RC:ImgMsg"),Xd=qe("RC:HQVCMsg"),el=qe("RC:SightMsg"),tl=qe("RC:TxtMsg"),nl=qe("RC:CombineMsg"),rl=qe("RC:FileMsg");qe("RC:GIFMsg");qe("RC:VcMsg");qe("RC:LBSMsg");qe("RC:ReferenceMsg");qe("RC:ImgTextMsg");var Dt={qiniu:function(n,e,t,r){var i,o="https://"+e.uploadHost.qiniu;i=sn()+pe[0][1]||o,pe.shift();var s=new XMLHttpRequest;s.upload&&e.support_options&&(s.upload.onprogress=function(u){t.onProgress(u.loaded,u.total)}),s.onreadystatechange=function(){if(s.readyState===4){var u=s.responseText||"{}";(u=JSON.parse(u)).filename=e.uniqueValue,u.uploadMethod=De?De.QINIU:"",s.status===200?t.onCompleted(u):pe.length?Dt[pe[0][0]](n,e,t,r):t.onError("upload fail")}},e.isChunk&&(i=function(u,d){var l="";return Gs(d,function(h,a){h!=="token"&&(l+=(l?"&":"")+encodeURIComponent(h)+"="+encodeURIComponent(a))}),l&&(u+=(u.indexOf("?")>0?"&":"?")+l),u}(i+="/mkblk/"+n.size,e.multi_parmas)),s.open(e.method,i,!0),t.onOpen(s),e.stream&&s.setRequestHeader("authorization","UpToken "+e.multi_parmas.token),Gs(e.headers,function(u,d){s.setRequestHeader(u,d)}),s.send(n)},baidu:function(n,e,t,r){if(console.log(r,e),r.size>qs)throw new Error("the file size is over 5GB!");var i=e||{};e=e||Ni;var o=new XMLHttpRequest,s=sn();if(!(!i.uploadHost.bos&&!i.bosUploadPath)){var u=s+pe[0][1]+i.bosUploadPath;pe.shift();var d=i.bosHeader||{},l={filename:e.uniqueValue||r.uniqueName,name:r.name,downloadUrl:u,isBosRes:!0};o.upload&&e.support_options&&(o.upload.onprogress=function(h){t.onProgress(h.loaded,h.total,!0)}),o.onreadystatechange=function(){if(o.readyState===4){var h=o.responseText||"{}";(h=JSON.parse(h)).filename=e.uniqueValue,o.status===200?t.onCompleted(l,!0):pe.length?Dt[pe[0][0]](n,e,t,r):t.onError("upload fail")}},o.open(e.method,u,!0),o.setRequestHeader("authorization",d.bosToken),o.setRequestHeader("x-bce-date",d.bosDate),o.send(r)}},aliyun:function(n,e,t,r){if(r.size>qs)throw new Error("the file size is over 5GB!");const i=new FormData;i.set("file",n.get("file")),i.set("key",n.get("key")),i.set("token",n.get("token"));const o=pe[0][1];pe.shift(),n=n||nc,e=(e=e||{})||Ni;var s=new XMLHttpRequest,u=sn()+e.ossBucketName+"."+o;s.upload&&e.support_options&&(s.upload.onprogress=function(l){t.onProgress(l.loaded,l.total)}),s.onreadystatechange=function(){if(s.readyState===4){var l=s.responseText||"{}";(l=JSON.parse(l)).name=e.uniqueValue,l.filename=e.uploadFileName,l.uploadMethod=De?De.ALI:"",s.status===200?t.onCompleted(l):pe.length?Dt[pe[0][0]](i,e,t,r):t.onError("upload fail")}},s.open(e.method,u,!0),console.log("ali:url",u);var d=e.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",e.uploadFileName),n.delete("file"),n.append("file",r),s.send(n)},s3:function(n,e,t,r){var i=new FormData,o=new XMLHttpRequest,s=sn();const u=pe[0][1];var d=s+e.s3BucketName+"."+u;console.log("uploadS3:url",d),pe.shift(),o.upload&&e.support_options&&(o.upload.onprogress=function(a){t.onProgress(a.loaded,a.total)}),o.onreadystatechange=function(){if(o.readyState===4){var a=o.responseText||"{}";if((a=JSON.parse(a)).name=e.uniqueValue,a.filename=e.uploadFileName,a.uploadMethod=De.AWS,console.log("UploadMethod:",De),o.status===200||o.status===204)t.onCompleted(a);else if(pe.length){const c=new FormData;c.set("file",n.get("file")),c.set("key",n.get("key")),c.set("token",n.get("token")),Dt[pe[0][0]](c,e,t,r)}else t.onError("upload fail")}},o.open(e.method,d,!0);var l=e?e.s3Header:{},h=r&&r.type;h==="text/html"?i.set("Content-Disposition","inline;"):i.set("Content-Disposition","attachment;"),i.set("Content-Type",h),i.set("x-amz-credential",l.s3Credential),i.set("x-amz-algorithm",l.s3Algorithm),i.set("x-amz-date",l.s3Date),i.set("policy",l.s3Policy),i.set("x-amz-signature",l.s3Signature),i.set("key",e.uploadFileName),i.set("file",r),o.send(i)},stc:function(n,e,t,r){new FormData;var i=new XMLHttpRequest;sn();var o="https://"+pe[0][1]+"/"+e.stcBucketName+"/"+e.uploadFileName;pe.shift(),i.upload&&e.support_options&&(i.upload.onprogress=function(u){t.onProgress(u.loaded,u.total)}),i.onreadystatechange=function(){if(i.readyState===4){var u=i.responseText||"{}";if((u=JSON.parse(u)).name=e.uniqueValue,u.filename=e.uploadFileName,u.uploadMethod=De?De.STC:"",i.status===200||i.status===204)t.onCompleted(u);else if(pe.length){const d=new FormData;d.set("file",n.get("file")),d.set("key",n.get("key")),d.set("token",n.get("token")),Dt[pe[0][0]](d,e,t,r)}else t.onError("upload fail")}},i.open("PUT",o,!0);var s=e?e.stcHeader:{};i.setRequestHeader("Content-Type",r.type),r.type==="text/html"?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attachment;"),i.setRequestHeader("Authorization",s.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",s.stcContentSha256),i.setRequestHeader("x-amz-date",s.stcDate),i.send(r)}},pe=[],qs=5368709120;function Gs(n,e){for(var t in n)e(t,n[t])}function sn(){var n="https://";return location.protocol!=="http:"&&location.protocol!=="file:"||(n="http://"),n}function il(n,e,t){var r,i,o=n&&n.type||"text/plain",s=o.indexOf("image")>-1?1:4,u=Math.ceil(n.size/e.stc_chunk_size),d=e&&JSON.parse(e.ossConfig?e.ossConfig:"");Array.isArray(d)||(d=[]);var l=d.find(m=>Object.keys(m).includes("stc")),h="uploads";ze.imClient.getFileToken(s,r,"POST",h).then(function(m){r=m.fileName,i="https://"+l.stc+"/"+e.stcBucketName+"/"+r,console.log("uploadStcMultipart:url",i);var _=new XMLHttpRequest;_.open("POST",i+"?"+h,!0),o==="text/html"?_.setRequestHeader("Content-Disposition","inline;"):_.setRequestHeader("Content-Disposition","attacshment;"),_.setRequestHeader("Authorization",m&&m.stcAuthorization),_.setRequestHeader("x-amz-content-sha256",m&&m.stcContentSha256),_.setRequestHeader("x-amz-date",m&&m.stcDate),_.setRequestHeader("Content-Type",o),_.send(),_.onreadystatechange=function(v){if(_.readyState===4){var R=_.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",R),_.status===200||_.status===204?function(y){for(var P=[],L=1;L<=u;L++)P.push(f(y,L));p(y,P)}(Array.isArray(R)&&R[1]):t.onError("uploadStcMultipart:did not get uploadId")}}},function(m){t.onError("uploadStcMultipart:"+m)});var a=[],c=new Map;function p(m,_){_&&Array.isArray(_)&&_.length!==0&&Promise.all(_).then(()=>{var v="uploadId="+m;if(c.size===u)ze.imClient.context.getFileToken(s,r,"POST",v).then(function(P){console.log("onSuccess",P),console.log("onSuccess:uploadId",m);var L=new XMLHttpRequest;L.open("POST",i+"?"+v,!0),L.setRequestHeader("Authorization",P&&P.stcAuthorization),L.setRequestHeader("x-amz-content-sha256",P&&P.stcContentSha256),L.setRequestHeader("x-amz-date",P&&P.stcDate),L.setRequestHeader("Content-Type",o);var N="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",E=Array.from(c.keys()||[]).sort((A,F)=>A-F);console.log("keys",E),E.map(A=>{N+=`<Part><ETag>${c.get(A)}</ETag><PartNumber>${A}</PartNumber></Part>`}),N+="</CompleteMultipartUpload>",L.send(N),console.log("xml",N),L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200||L.status===204){var A={};A.name=n.name,A.filename=e.uploadFileName,A.uploadMethod=De.STC,t.onCompleted(A)}else t.onError("uploadStcMultipart:upload does not end")}},function(P){t.onError("uploadStcMultipart:"+P)});else{var R=[];for(var y of a)R.push(f(m,y));p(m,R)}},v=>{console.error(v),t.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var R=[];for(var y of a)R.push(f(m,y));p(m,R)})}function f(m,_){return new Promise((v,R)=>{var y="partNumber="+_+"&uploadId="+m;ze.imClient.context.getFileToken(s,r,"PUT",y).then(function(P){console.log("signature "+_+" onSuccess",P);var L=n&&n.slice((_-1)*e.stc_chunk_size,_*e.stc_chunk_size);console.log("fileChunk:size",L.size);var N=new XMLHttpRequest;N.open("PUT",i+"?"+y,!0),N.setRequestHeader("Authorization",P&&P.stcAuthorization),N.setRequestHeader("x-amz-content-sha256",P&&P.stcContentSha256),N.setRequestHeader("x-amz-date",P&&P.stcDate),N.setRequestHeader("Content-Type",o),N.send(L),N.onreadystatechange=function(){if(N.readyState===4)if(N.status===200||N.status===204){var E=N.getResponseHeader("etag");console.log("etag:"+_,E),c.set(_,E),v(E)}else a.includes(_)||a.push(_),R(_)}},function(P){console.log("getETags:\u7B7E\u540D\u9A8C\u8BC1\u5931\u8D25"),a.includes(_)||a.push(_),R(_)})})}}var rc={form:function(n,e){var t=new FormData;if(e.unique_key){var r=n.name.substr(n.name.lastIndexOf(".")),i=wi()+r;t.append(e.unique_key,i),e.uniqueValue=i}return t.append(e.file_data_name,n),Mi(e.multi_parmas,function(o,s){t.append(o,s)}),t},json:function(n,e){var t={};if(e.unique_key){var r=n.name.substr(n.name.lastIndexOf(".")),i=wi()+r;t[e.unique_key]=i,e.uniqueValue=i}return t[e.file_data_name]=n,Mi(e.multi_parmas,function(o,s){t[o]=s}),JSON.stringify(t)},data:function(n,e){return n}};function wi(){var n=new Date().getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),(e==="x"?t:3&t|8).toString(16)})}function Mi(n,e){for(var t in n)e(t,n[t])}var Gn,ti=0;function ol(n){this.options=function(e){var t={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:rc.form,genUId:wi};if(!e||!e.domain)throw new Error("domain is null");for(var r in e)t[r]=e[r];return t}(n),this.setOptions=function(e){var t=this;Mi(e,function(r,i){t.options[r]=i})},console.log("options",n),this.upload=function(e,t){if(e){var r=this;(function(i,o,s){if(nc=i,Ni=o,pe=[],o.ossConfig){const h=JSON.parse(o.ossConfig);let a,c,p="";const f=[];h.forEach(m=>{const _=Number(m.p)-1;for(const v in m)v==="aliyun"&&(p=m[v]),v==="s3"&&(a=m[v]),v==="stc"&&(c=m[v]),v!=="p"&&(f[_]=[v,m[v]])}),f.forEach(function(m){m&&pe.push(m)}),h.length!==pe.length&&(pe=[["qiniu",o.domain],["baidu",o.uploadHost.bos],["aliyun",p],["s3",a],["stc",c]])}else pe=[["qiniu",o.domain],["baidu",o.uploadHost.bos]];var u;if(o.ossConfig){var d=o&&JSON.parse(o.ossConfig);Array.isArray(d)||(d=[]),u=d.find(h=>Object.keys(h).includes("stc"))}if(u&&parseInt(u.p)===1&&i.size>=4194304)il(i,o,s);else{var l=o.data(i,o);Dt[pe[0][0]](l,o,s,i)}})(e,this.options,{onProgress:function(i,o,s){Gn=i,s?Gn=ti+i/o*(o-ti):ti=Gn,t.onProgress(Gn,o)},onCompleted:function(i){t.onCompleted(i)},onError:function(i){t.onError(i)},onOpen:function(i){r.xhr=i}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var Ys={init:function(n){return new ol(n)},dataType:rc,resize:function(n,e,t){n.type;var r=document.createElement("canvas"),i=new FileReader;i.readAsDataURL(n),i.onload=function(o){var s=o.target.result,u=new Image;u.src=s;var d=u.width,l=u.height,h=function(c,p){var f=1,m=c.width,_=p.maxWidth||0;_>0&&m>_&&(f=_/m);var v=c.height,R=p.maxHeight||0;if(R>0&&v>R){var y=R/v;f=Math.min(f,y)}var P=p.maxSize||0,L=Math.ceil(c.size/1e3);if(L>P){var N=P/L;f=Math.min(f,N)}return f}({width:d,height:l,size:o.total},e),a=s;h<1&&(a=function(c,p,f){r.width=p,r.height=f,r.getContext("2d").drawImage(c,0,0,p,f);var m="image/jpg";return r.toDataURL(m)}(u,d*h,l*h)),t(a)}}};const sl=function(n,e,t){var r=document.createElement("canvas"),i=r.getContext("2d"),o=new Image;o.onload=function(){var s=function(l,h,a){var c,p,f,m=l<h,_=0,v=0;return(m?h/l:l/h)>a.scale?(m?(p=100,v=((f=h/(c=l/100))-a.maxHeight)/2):(f=100,_=((p=l/(c=h/100))-a.maxWidth)/2),{w:p,h:f,x:-_,y:-v}):(m?(c=h/a.maxHeight,f=a.maxHeight,p=l/c):(c=l/a.maxWidth,p=a.maxWidth,f=h/c),{w:p,h:f,x:-_,y:-v})}(o.width,o.height,e);r.width=s.w>e.maxWidth?e.maxWidth:s.w,r.height=s.h>e.maxHeight?e.maxHeight:s.h,i.drawImage(o,s.x,s.y,s.w,s.h);try{var u=r.toDataURL(n.type,e.quality),d=new RegExp("^data:image/[^;]+;base64,");u=u.replace(d,""),t(u)}catch(l){throw new Error(l)}},o.src=typeof n=="string"?"data:image/jpg;base64,"+n:function(s){var u=window.URL||window.webkitURL;return u?u.createObjectURL(s):""}(n)},al=function(n,e){var t=n.file,r=n.compress;sl(t,r,e)},ic=function(n,e){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=Ys.init(n);e(o)});else{n.headers||(n.headers={}),n.base64&&(n.headers["Content-type"]="application/octet-stream");var t=Ys.init(n);e(t)}};var ni,Yn,oc=function(n,e,t){e.upload(n.file,{onError:function(r){t.onError(r)},onProgress:function(r,i){t.onProgress(r,i)},onCompleted:function(r){r.filename||(r.filename=r.hash);var i=n.compressThumbnail||al;n.compress?i(n,function(o){r.thumbnail=o,t.onCompleted(r)}):t.onCompleted(r)}})},cl=function(n){var e=this;this.instance=n,this.upload=function(t,r){oc({file:t},e.instance,r)},this.cancel=function(){e.instance.cancel()}},ul=function(n,e){var t=this;this.cfg=e,this.instance=n,this.upload=function(r,i){var o={file:r,compress:t.cfg};oc(o,t.instance,i)},this.cancel=function(){t.instance.cancel()}},dl=function(n,e){ic(n,function(t){var r={maxHeight:n.maxHeight||160,maxWidth:n.maxWidth||160,quality:n.quality||.5,scale:n.scale||2.4},i=new ul(t,r);e(i)})},ll=function(n,e){ic(n,function(t){var r=new cl(t);e(r)})},hl=dl;function zs(n){return ni=ni||new AudioContext,new Promise(function(e,t){ni.decodeAudioData(n,function(r){e({duration:r.duration,length:r.length})},t)})}function pl(n,e,t,r,i){return Ie("fileType",n,xu,!0),Ie("filename",e,Ee.STRING),Ie("saveName",t,Ee.STRING),Ie("serverType",i,Ee.NUMBER),new Promise(function(o){ze.imClient.context.getFileUrl(n,e,t,r,i).then(function(s){o({code:b.SUCCESS,data:s})}).catch(function(s){o({code:s})})})}function sc(n,e,t){return In(this,void 0,void 0,function(){var r,i,o,s,u,d,l,h,a;return bn(this,function(c){switch(c.label){case 0:return t=t||{},e instanceof tc?(Ie("conversation.channelId",n==null?void 0:n.channelId,Ee.CHANNEL_ID),r=n.conversationType,i=n.targetId,o=n.channelId,s="conversationType:"+r+",targetId:"+i,ke.debug("send message ->"+s),(u=Object.assign(t,e)).channelId=o||"",[4,ze.imClient.context.sendMessage(r,i,u)]):(ke.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,vr.ILLGAL_PARAMS]);case 1:return d=c.sent(),l=d.code,h=d.data,l===b.SUCCESS?(a=_r(h),[2,{code:l,data:a}]):(ke.warn("send message fail ->"+l+":"+Kt[l]+","+s),[2,{code:l,msg:Kt[l],data:_r({isMentioned:!!t.isMentioned,content:e.content,messageType:e.messageType,isPersited:e.isPersited||!1,isCounted:e.isCounted||!1,disableNotification:!!(t==null?void 0:t.disableNotification),canIncludeExpansion:!!(t==null?void 0:t.canIncludeExpansion),expansion:(t==null?void 0:t.expansion)||null,conversationType:r,targetId:i,channelId:o||"",senderUserId:ze.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:je.SEND,isOffLineMessage:!1,sentTime:(h==null?void 0:h.sentTime)||0,receivedTime:0,isStatusMessage:t.isStatusMessage||!1,receivedStatus:_n.UNREAD})}])}})})}function Pn(n,e){return function(t,r,i,o){return new Promise(function(s){var u;(function(d,l,h,a){var c,p=this;if(l===void 0&&(l=Se.FILE),c=l===Se.IMAGE?Se.IMAGE:Se.FILE,!Yn){Yn="upload.qiniup.com";var f=ze.imClient.context.getInfoFromCache();if(f&&f.ossConfig)try{var m=JSON.parse(f.ossConfig).find(function(v){return v.qiniu!==void 0});m&&(Yn=m.qiniu)}catch{}}var _=Oi({domain:Yn,getToken:function(v){ze.imClient.context.getFileToken(c).then(function(R){v(R.token,R)}).catch(function(R){h.onFail(R)})}},a);(c===Se.IMAGE?hl:ll)(_,function(v){v.upload(d,{onProgress:function(R,y){var P,L=Math.floor(R/y*100);(P=h.onProgress)===null||P===void 0||P.call(h,L)},onCompleted:function(R){return In(p,void 0,void 0,function(){var y=this;return bn(this,function(P){return pl(c,R.filename,R.name,R,R.uploadMethod).then(function(L){return In(y,void 0,void 0,function(){var N,E;return bn(this,function(A){return L.code!==0?(h.onFail(L),[2]):((N=L.data).type=d.type,N.name=R.name||R.filename,l===Se.AUDIO?(typeof d.arrayBuffer=="function"?d.arrayBuffer().then(zs).then(function(F){Object.assign(N,F),h.onSuccess(N)},function(){h.onSuccess(N)}):((E=new FileReader).onload=function(){E.result?zs(E.result).then(function(F){Object.assign(N,F),h.onSuccess(N)},function(){h.onSuccess(N)}):h.onSuccess(N)},E.onerror=function(){N.duration=0,h.onSuccess(N)},E.readAsArrayBuffer(d)),[2]):(c===Se.IMAGE&&(N.thumbnail=R.thumbnail),h.onSuccess(N),[2]))})})}).catch(function(L){h.onFail(L)}),[2]})})},onError:function(R){h.onFail(R)}})})})(r.file,n,{onProgress:i==null?void 0:i.onProgress,onSuccess:function(d){var l,h=((l=i==null?void 0:i.onComplete)===null||l===void 0?void 0:l.call(i,{url:d.downloadUrl}))||e(d,r);sc(t,h,o).then(s)},onFail:function(d){s({code:b.UPLOAD_FILE_FAILED,msg:d||b[b.UPLOAD_FILE_FAILED]})}},((u=o)===null||u===void 0?void 0:u.thumbnailConfig)||{})})}}Pn(Se.FILE,function(n,e){return new rl({name:n.name,size:e.file.size,type:e.file.type,fileUrl:n.downloadUrl,user:e.user,extra:e.extra})});Pn(Se.IMAGE,function(n,e){return new Qd({content:n.thumbnail,imageUri:n.downloadUrl,user:e.user,extra:e.extra})});Pn(Se.AUDIO,function(n,e){return new Xd({remoteUrl:n.downloadUrl,duration:n.duration,type:n.type,user:e.user,extra:e.extra})});Pn(Se.SIGHT,function(n,e){return new el({sightUrl:n.downloadUrl,content:e.thumbnail,duration:e.duration,size:e.file.size||n.size,name:e.name||n.name,user:e.user,extra:e.extra})});function ct(n,e,t,r){return Ie("messageType",n,Ee.STRING,!0),Ie("isPersited",e,Ee.BOOLEAN,!0),Ie("isCounted",t,Ee.BOOLEAN,!0),ze.imClient.context.registerMessageType(n,e,t,r),qe(n,e,t)}Pn(Se.COMBINE_HTML,function(n,e){return new nl({remoteUrl:n.downloadUrl,nameList:e.nameList,summaryList:e.summaryList,conversationType:e.conversationType,user:e.user,extra:e.extra})});Ot.add("imlib","5.1.1"),Ot.validEngine("~5.1.1")||ke.error("The current engine version '"+Ot.getInfo().engine+"' error\uFF0Cimlib required engine version at least '~5.1.1'.");/*! *****************************************************************************
- 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 H(n,e,t,r){return new(t||(t=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function u(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 t?h:new t(function(a){a(h)})).then(s,u)}d((r=r.apply(n,e||[])).next())})}const M=new Rt("RCRTC");var w,Ai;(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"})(w||(w={})),function(n){n[n.JOIN_REFUSED=40032]="JOIN_REFUSED"}(Ai||(Ai={}));class ac{constructor(){this.queue=[],this.locked=!1}checkToStart(){return H(this,void 0,void 0,function*(){if(this.queue.length===0||this.locked)return;this.locked=!0;const{resolve:e,task:t,reject:r}=this.queue.shift();let i;try{i=yield t(),e(i)}catch(o){r(o)}this.locked=!1,this.checkToStart()})}push(e){const t=new Promise((r,i)=>{this.queue.push({resolve:r,task:e,reject:i})});return this.checkToStart(),t}}const fl=new ac,ve=n=>fl.push(n);let cc=!0,uc=!0;function an(n,e,t){const r=n.match(e);return r&&r.length>=t&&parseInt(r[t],10)}function Jt(n,e,t){if(!n.RTCPeerConnection)return;const r=n.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(s,u){if(s!==e)return i.apply(this,arguments);const d=l=>{const h=t(l);h&&(u.handleEvent?u.handleEvent(h):u(h))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(u,d),i.apply(this,[s,d])};const o=r.removeEventListener;r.removeEventListener=function(s,u){if(s!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(u))return o.apply(this,arguments);const d=this._eventMap[e].get(u);return this._eventMap[e].delete(u),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[s,d])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function gl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(cc=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function ml(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(uc=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function jo(){if(typeof window=="object"){if(cc)return;typeof console!="undefined"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Fr(n,e){uc&&console.warn(n+" is deprecated, please use "+e+" instead.")}function Js(n){return Object.prototype.toString.call(n)==="[object Object]"}function dc(n){return Js(n)?Object.keys(n).reduce(function(e,t){const r=Js(n[t]),i=r?dc(n[t]):n[t],o=r&&!Object.keys(i).length;return i===void 0||o?e:Object.assign(e,{[t]:i})},{}):n}function Pi(n,e,t){e&&!t.has(e.id)&&(t.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?Pi(n,n.get(e[r]),t):r.endsWith("Ids")&&e[r].forEach(i=>{Pi(n,n.get(i),t)})}))}function Ws(n,e,t){const r=t?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const o=[];return n.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&o.push(s)}),o.forEach(s=>{n.forEach(u=>{u.type===r&&u.trackId===s.id&&Pi(n,u,i)})}),i}const Zs=jo;function lc(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const r=function(s){if(typeof s!="object"||s.mandatory||s.optional)return s;const u={};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,c){return a?a+c.charAt(0).toUpperCase()+c.slice(1):c==="deviceId"?"sourceId":c};if(l.ideal!==void 0){u.optional=u.optional||[];let a={};typeof l.ideal=="number"?(a[h("min",d)]=l.ideal,u.optional.push(a),a={},a[h("max",d)]=l.ideal,u.optional.push(a)):(a[h("",d)]=l.ideal,u.optional.push(a))}l.exact!==void 0&&typeof l.exact!="number"?(u.mandatory=u.mandatory||{},u.mandatory[h("",d)]=l.exact):["min","max"].forEach(a=>{l[a]!==void 0&&(u.mandatory=u.mandatory||{},u.mandatory[h(a,d)]=l[a])})}),s.advanced&&(u.optional=(u.optional||[]).concat(s.advanced)),u},i=function(s,u){if(e.version>=61)return u(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=e.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&(!t.mediaDevices.getSupportedConstraints||!t.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 t.mediaDevices.enumerateDevices().then(a=>{let c=(a=a.filter(p=>p.kind==="videoinput")).find(p=>h.some(f=>p.label.toLowerCase().includes(f)));return!c&&a.length&&h.includes("back")&&(c=a[a.length-1]),c&&(s.video.deviceId=d.exact?{exact:c.deviceId}:{ideal:c.deviceId}),s.video=r(s.video),Zs("chrome: "+JSON.stringify(s)),u(s)})}s.video=r(s.video)}return Zs("chrome: "+JSON.stringify(s)),u(s)},o=function(s){return e.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(t.getUserMedia=function(s,u,d){i(s,l=>{t.webkitGetUserMedia(l,u,h=>{d&&d(o(h))})})}.bind(t),t.mediaDevices.getUserMedia){const s=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(u){return i(u,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 hc(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function pc(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",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=[t.stream],this.dispatchEvent(o)}),t.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=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Jt(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function fc(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=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,u){let d=i.apply(this,arguments);return d||(d=e(this,s),this._senders.push(d)),d};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){o.apply(this,arguments);const u=this._senders.indexOf(s);u!==-1&&this._senders.splice(u,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(i){this._senders=this._senders||[],t.apply(this,[i]),i.getTracks().forEach(o=>{this._senders.push(e(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(u=>u.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 e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(r=>r._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function gc(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,r,i]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const o=function(u){const d={};return u.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(u){return new Map(Object.keys(u).map(d=>[d,u[d]]))};if(arguments.length>=2){const u=function(d){r(s(o(d)))};return e.apply(this,[u,t])}return new Promise((u,d)=>{e.apply(this,[function(l){u(s(o(l)))},d])}).then(r,i)}}function mc(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const i=t.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=>Ws(o,i.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const r=t.apply(this,[]);return r.forEach(i=>i._pc=this),r}),Jt(n,"track",r=>(r.receiver._pc=r.srcElement,r)),n.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(i=>Ws(i,r.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype)||!("getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let r,i,o;return this.getSenders().forEach(s=>{s.track===t&&(r?o=!0:r=s)}),this.getReceivers().forEach(s=>(s.track===t&&(i?o=!0:i=s),s.track===t)),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 e.apply(this,arguments)}}function _c(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,s){if(!s)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const u=e.apply(this,arguments);return this._shimmedLocalStreams[s.id]?this._shimmedLocalStreams[s.id].indexOf(u)===-1&&this._shimmedLocalStreams[s.id].push(u):this._shimmedLocalStreams[s.id]=[s,u],u};const t=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();t.apply(this,arguments);const u=this.getSenders().filter(d=>s.indexOf(d)===-1);this._shimmedLocalStreams[o.id]=[o].concat(u)};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 u=this._shimmedLocalStreams[s].indexOf(o);u!==-1&&this._shimmedLocalStreams[s].splice(u,1),this._shimmedLocalStreams[s].length===1&&delete this._shimmedLocalStreams[s]}),i.apply(this,arguments)}}function vc(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return _c(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.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(c=>{const p=l._reverseStreams[c],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(c=>{const p=l._reverseStreams[c],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 c=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=o(this,p);c[0].apply(null,[f])},p=>{c[1]&&c[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=a[l]});const u=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),u.apply(this,arguments)):u.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(c=>l.track===c)&&(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 Li(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=n.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=i[t]})}function Rc(n,e){Jt(n,"negotiationneeded",t=>{const r=t.target;if(!(e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")||r.signalingState==="stable")return t})}var Qs=Object.freeze({__proto__:null,shimMediaStream:hc,shimOnTrack:pc,shimGetSendersWithDtmf:fc,shimGetStats:gc,shimSenderReceiverGetStats:mc,shimAddTrackRemoveTrackWithNative:_c,shimAddTrackRemoveTrack:vc,shimPeerConnection:Li,fixNegotiationNeeded:Rc,shimGetUserMedia:lc,shimGetDisplayMedia:function(n,e){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(typeof e=="function"?n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(r=>{const i=t.video&&t.video.width,o=t.video&&t.video.height,s=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:r,maxFrameRate:s||3}},i&&(t.video.mandatory.maxWidth=i),o&&(t.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(t)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Xs,ri,ne=(Xs=function(n){var e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
- `).map(function(r){return r.trim()})},e.splitSections=function(t){return t.split(`
- m=`).map(function(r,i){return(i>0?"m="+r:r).trim()+`\r
- `})},e.getDescription=function(t){var r=e.splitSections(t);return r&&r[0]},e.getMediaSections=function(t){var r=e.splitSections(t);return r.shift(),r},e.matchPrefix=function(t,r){return e.splitLines(t).filter(function(i){return i.indexOf(r)===0})},e.parseCandidate=function(t){for(var r,i={foundation:(r=t.indexOf("a=candidate:")===0?t.substring(12).split(" "):t.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},e.writeCandidate=function(t){var r=[];r.push(t.foundation),r.push(t.component),r.push(t.protocol.toUpperCase()),r.push(t.priority),r.push(t.address||t.ip),r.push(t.port);var i=t.type;return r.push("typ"),r.push(i),i!=="host"&&t.relatedAddress&&t.relatedPort&&(r.push("raddr"),r.push(t.relatedAddress),r.push("rport"),r.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(r.push("ufrag"),r.push(t.usernameFragment||t.ufrag)),"candidate:"+r.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){var r=t.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},e.writeRtpMap=function(t){var r=t.payloadType;t.preferredPayloadType!==void 0&&(r=t.preferredPayloadType);var i=t.channels||t.numChannels||1;return"a=rtpmap:"+r+" "+t.name+"/"+t.clockRate+(i!==1?"/"+i:"")+`\r
- `},e.parseExtmap=function(t){var r=t.substr(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&t.direction!=="sendrecv"?"/"+t.direction:"")+" "+t.uri+`\r
- `},e.parseFmtp=function(t){for(var r,i={},o=t.substr(t.indexOf(" ")+1).split(";"),s=0;s<o.length;s++)i[(r=o[s].trim().split("="))[0].trim()]=r[1];return i},e.writeFmtp=function(t){var r="",i=t.payloadType;if(t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){var o=[];Object.keys(t.parameters).forEach(function(s){t.parameters[s]?o.push(s+"="+t.parameters[s]):o.push(s)}),r+="a=fmtp:"+i+" "+o.join(";")+`\r
- `}return r},e.parseRtcpFb=function(t){var r=t.substr(t.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(t){var r="",i=t.payloadType;return t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(function(o){r+="a=rtcp-fb:"+i+" "+o.type+(o.parameter&&o.parameter.length?" "+o.parameter:"")+`\r
- `}),r},e.parseSsrcMedia=function(t){var r=t.indexOf(" "),i={ssrc:parseInt(t.substr(7,r-7),10)},o=t.indexOf(":",r);return o>-1?(i.attribute=t.substr(r+1,o-r-1),i.value=t.substr(o+1)):i.attribute=t.substr(r+1),i},e.parseSsrcGroup=function(t){var r=t.substr(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(function(i){return parseInt(i,10)})}},e.getMid=function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)},e.parseFingerprint=function(t){var r=t.substr(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1]}},e.getDtlsParameters=function(t,r){return{role:"auto",fingerprints:e.matchPrefix(t+r,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,r){var i="a=setup:"+r+`\r
- `;return t.fingerprints.forEach(function(o){i+="a=fingerprint:"+o.algorithm+" "+o.value+`\r
- `}),i},e.parseCryptoLine=function(t){var r=t.substr(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+(typeof t.keyParams=="object"?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+`\r
- `},e.parseCryptoKeyParams=function(t){if(t.indexOf("inline:")!==0)return null;var r=t.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}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,r){return e.matchPrefix(t+r,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,r){var i=e.matchPrefix(t+r,"a=ice-ufrag:")[0],o=e.matchPrefix(t+r,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substr(12),password:o.substr(10)}:null},e.writeIceParameters=function(t){return"a=ice-ufrag:"+t.usernameFragment+`\r
- a=ice-pwd:`+t.password+`\r
- `},e.parseRtpParameters=function(t){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=e.splitLines(t)[0].split(" "),o=3;o<i.length;o++){var s=i[o],u=e.matchPrefix(t,"a=rtpmap:"+s+" ")[0];if(u){var d=e.parseRtpMap(u),l=e.matchPrefix(t,"a=fmtp:"+s+" ");switch(d.parameters=l.length?e.parseFmtp(l[0]):{},d.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+s+" ").map(e.parseRtcpFb),r.codecs.push(d),d.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(d.name.toUpperCase())}}}return e.matchPrefix(t,"a=extmap:").forEach(function(h){r.headerExtensions.push(e.parseExtmap(h))}),r},e.writeRtpDescription=function(t,r){var i="";i+="m="+t+" ",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+=e.writeRtpMap(s),i+=e.writeFmtp(s),i+=e.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+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(t){var r,i=[],o=e.parseRtpParameters(t),s=o.fecMechanisms.indexOf("RED")!==-1,u=o.fecMechanisms.indexOf("ULPFEC")!==-1,d=e.matchPrefix(t,"a=ssrc:").map(function(c){return e.parseSsrcMedia(c)}).filter(function(c){return c.attribute==="cname"}),l=d.length>0&&d[0].ssrc,h=e.matchPrefix(t,"a=ssrc-group:FID").map(function(c){return c.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(c){if(c.name.toUpperCase()==="RTX"&&c.parameters.apt){var p={ssrc:l,codecPayloadType:parseInt(c.parameters.apt,10)};l&&r&&(p.rtx={ssrc:r}),i.push(p),s&&((p=JSON.parse(JSON.stringify(p))).fec={ssrc:l,mechanism:u?"red+ulpfec":"red"},i.push(p))}}),i.length===0&&l&&i.push({ssrc:l});var a=e.matchPrefix(t,"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(c){c.maxBitrate=a})),i},e.parseRtcpParameters=function(t){var r={},i=e.matchPrefix(t,"a=ssrc:").map(function(u){return e.parseSsrcMedia(u)}).filter(function(u){return u.attribute==="cname"})[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var o=e.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=o.length>0,r.compound=o.length===0;var s=e.matchPrefix(t,"a=rtcp-mux");return r.mux=s.length>0,r},e.parseMsid=function(t){var r,i=e.matchPrefix(t,"a=msid:");if(i.length===1)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var o=e.matchPrefix(t,"a=ssrc:").map(function(s){return e.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},e.parseSctpDescription=function(t){var r,i=e.parseMLine(t),o=e.matchPrefix(t,"a=max-message-size:");o.length>0&&(r=parseInt(o[0].substr(19),10)),isNaN(r)&&(r=65536);var s=e.matchPrefix(t,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substr(12),10),protocol:i.fmt,maxMessageSize:r};if(e.matchPrefix(t,"a=sctpmap:").length>0){var u=e.matchPrefix(t,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(u[0],10),protocol:u[1],maxMessageSize:r}}},e.writeSctpDescription=function(t,r){var i=[];return i=t.protocol!=="DTLS/SCTP"?["m="+t.kind+" 9 "+t.protocol+" "+r.protocol+`\r
- `,`c=IN IP4 0.0.0.0\r
- `,"a=sctp-port:"+r.port+`\r
- `]:["m="+t.kind+" 9 "+t.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("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(t,r,i){var o=r!==void 0?r:2;return`v=0\r
- o=`+(i||"thisisadapterortc")+" "+(t||e.generateSessionId())+" "+o+` IN IP4 127.0.0.1\r
- s=-\r
- t=0 0\r
- `},e.writeMediaSection=function(t,r,i,o){var s=e.writeRtpDescription(t.kind,r);if(s+=e.writeIceParameters(t.iceGatherer.getLocalParameters()),s+=e.writeDtlsParameters(t.dtlsTransport.getLocalParameters(),i==="offer"?"actpass":"active"),s+="a=mid:"+t.mid+`\r
- `,t.direction?s+="a="+t.direction+`\r
- `:t.rtpSender&&t.rtpReceiver?s+=`a=sendrecv\r
- `:t.rtpSender?s+=`a=sendonly\r
- `:t.rtpReceiver?s+=`a=recvonly\r
- `:s+=`a=inactive\r
- `,t.rtpSender){var u="msid:"+o.id+" "+t.rtpSender.track.id+`\r
- `;s+="a="+u,s+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" "+u,t.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" "+u,s+="a=ssrc-group:FID "+t.sendEncodingParameters[0].ssrc+" "+t.sendEncodingParameters[0].rtx.ssrc+`\r
- `)}return s+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" cname:"+e.localCName+`\r
- `,t.rtpSender&&t.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" cname:"+e.localCName+`\r
- `),s},e.getDirection=function(t,r){for(var i=e.splitLines(t),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?e.getDirection(r):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substr(2)},e.isRejected=function(t){return t.split(" ",2)[1]==="0"},e.parseMLine=function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},e.parseOLine=function(t){var r=e.matchPrefix(t,"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]}},e.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;for(var r=e.splitLines(t),i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0},n.exports=e},Xs(ri={exports:{}},ri.exports),ri.exports);function ea(n,e,t,r,i){var o=ne.writeRtpDescription(n.kind,e);if(o+=ne.writeIceParameters(n.iceGatherer.getLocalParameters()),o+=ne.writeDtlsParameters(n.dtlsTransport.getLocalParameters(),t==="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 u="msid:"+(r?r.id:"-")+" "+s+`\r
- `;o+="a="+u,o+="a=ssrc:"+n.sendEncodingParameters[0].ssrc+" "+u,n.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+n.sendEncodingParameters[0].rtx.ssrc+" "+u,o+="a=ssrc-group:FID "+n.sendEncodingParameters[0].ssrc+" "+n.sendEncodingParameters[0].rtx.ssrc+`\r
- `)}return o+="a=ssrc:"+n.sendEncodingParameters[0].ssrc+" cname:"+ne.localCName+`\r
- `,n.rtpSender&&n.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+n.sendEncodingParameters[0].rtx.ssrc+" cname:"+ne.localCName+`\r
- `),o}function zn(n,e){var t={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(o,s){o=parseInt(o,10);for(var u=0;u<s.length;u++)if(s[u].payloadType===o||s[u].preferredPayloadType===o)return s[u]},i=function(o,s,u,d){var l=r(o.parameters.apt,u),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<e.codecs.length;s++){var u=e.codecs[s];if(o.name.toLowerCase()===u.name.toLowerCase()&&o.clockRate===u.clockRate){if(o.name.toLowerCase()==="rtx"&&o.parameters&&u.parameters.apt&&!i(o,u,n.codecs,e.codecs))continue;(u=JSON.parse(JSON.stringify(u))).numChannels=Math.min(o.numChannels,u.numChannels),t.codecs.push(u),u.rtcpFeedback=u.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<e.headerExtensions.length;s++){var u=e.headerExtensions[s];if(o.uri===u.uri){t.headerExtensions.push(u);break}}}),t}function ta(n,e,t){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"]}}[e][n].indexOf(t)!==-1}function ii(n,e){var t=n.getRemoteCandidates().find(function(r){return e.foundation===r.foundation&&e.ip===r.ip&&e.port===r.port&&e.priority===r.priority&&e.protocol===r.protocol&&e.type===r.type});return t||n.addRemoteCandidate(e),!t}function be(n,e){var t=new Error(e);return t.name=n,t.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[n],t}var _l=function(n,e){function t(s,u){u.addTrack(s),u.dispatchEvent(new n.MediaStreamTrackEvent("addtrack",{track:s}))}function r(s,u,d,l){var h=new Event("track");h.track=u,h.receiver=d,h.transceiver={receiver:d},h.streams=l,n.setTimeout(function(){s._dispatchEvent("track",h)})}var i=function(s){var u=this,d=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(h){u[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 be("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 c=!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||c?_.indexOf("stun:")===0&&a>=14393&&_.indexOf("?transport=udp")===-1:(c=!0,!0)}),delete p.url,p.urls=m?f[0]:f,!!f.length}})}(s.iceServers||[],e),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=ne.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,u){this._isClosed||(this.dispatchEvent(u),typeof this["on"+s]=="function"&&this["on"+s](u))},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,u){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 u||this.transceivers.push(l),l},i.prototype.addTrack=function(s,u){if(this._isClosed)throw be("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var d;if(this.transceivers.find(function(h){return h.track===s}))throw be("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(u)===-1&&this.localStreams.push(u),d.track=s,d.stream=u,d.rtpSender=new n.RTCRtpSender(s,d.dtlsTransport),d.rtpSender},i.prototype.addStream=function(s){var u=this;if(e>=15025)s.getTracks().forEach(function(l){u.addTrack(l,s)});else{var d=s.clone();s.getTracks().forEach(function(l,h){var a=d.getTracks()[h];l.addEventListener("enabled",function(c){a.enabled=c.enabled})}),d.getTracks().forEach(function(l){u.addTrack(l,d)})}},i.prototype.removeTrack=function(s){if(this._isClosed)throw be("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 u=this.transceivers.find(function(l){return l.rtpSender===s});if(!u)throw be("InvalidAccessError","Sender was not created by this connection.");var d=u.stream;u.rtpSender.stop(),u.rtpSender=null,u.track=null,u.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 u=this;s.getTracks().forEach(function(d){var l=u.getSenders().find(function(h){return h.track===d});l&&u.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,u){var d=this;if(u&&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,u){var d=this,l=this.transceivers[u].iceGatherer;if(!l.onlocalcandidate){var h=this.transceivers[u].bufferedCandidateEvents;this.transceivers[u].bufferedCandidateEvents=null,l.removeEventListener("localcandidate",this.transceivers[u].bufferCandidates),l.onlocalcandidate=function(a){if(!(d.usingBundle&&u>0)){var c=new Event("icecandidate");c.candidate={sdpMid:s,sdpMLineIndex:u};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=ne.writeCandidate(p);c.candidate=Object.assign(c.candidate,ne.parseCandidate(m)),c.candidate.candidate=m,c.candidate.toJSON=function(){return{candidate:c.candidate.candidate,sdpMid:c.candidate.sdpMid,sdpMLineIndex:c.candidate.sdpMLineIndex,usernameFragment:c.candidate.usernameFragment}}}var _=ne.getMediaSections(d._localDescription.sdp);_[c.candidate.sdpMLineIndex]+=f?`a=end-of-candidates\r
- `:"a="+c.candidate.candidate+`\r
- `,d._localDescription.sdp=ne.getDescription(d._localDescription.sdp)+_.join("");var v=d.transceivers.every(function(R){return R.iceGatherer&&R.iceGatherer.state==="completed"});d.iceGatheringState!=="gathering"&&(d.iceGatheringState="gathering",d._emitGatheringStateChange()),f||d._dispatchEvent("icecandidate",c),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,u=new n.RTCIceTransport(null);u.onicestatechange=function(){s._updateIceConnectionState(),s._updateConnectionState()};var d=new n.RTCDtlsTransport(u);return d.ondtlsstatechange=function(){s._updateConnectionState()},d.onerror=function(){Object.defineProperty(d,"state",{value:"failed",writable:!0}),s._updateConnectionState()},{iceTransport:u,dtlsTransport:d}},i.prototype._disposeIceAndDtlsTransports=function(s){var u=this.transceivers[s].iceGatherer;u&&(delete u.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,u,d){var l=zn(s.localCapabilities,s.remoteCapabilities);u&&s.rtpSender&&(l.encodings=s.sendEncodingParameters,l.rtcp={cname:ne.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&&e<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 u,d,l=this;if(["offer","answer"].indexOf(s.type)===-1)return Promise.reject(be("TypeError",'Unsupported type "'+s.type+'"'));if(!ta("setLocalDescription",s.type,l.signalingState)||l._isClosed)return Promise.reject(be("InvalidStateError","Can not set local "+s.type+" in state "+l.signalingState));if(s.type==="offer")u=ne.splitSections(s.sdp),d=u.shift(),u.forEach(function(a,c){var p=ne.parseRtpParameters(a);l.transceivers[c].localCapabilities=p}),l.transceivers.forEach(function(a,c){l._gather(a.mid,c)});else if(s.type==="answer"){u=ne.splitSections(l._remoteDescription.sdp),d=u.shift();var h=ne.matchPrefix(d,"a=ice-lite").length>0;u.forEach(function(a,c){var p=l.transceivers[c],f=p.iceGatherer,m=p.iceTransport,_=p.dtlsTransport,v=p.localCapabilities,R=p.remoteCapabilities;if(!(ne.isRejected(a)&&ne.matchPrefix(a,"a=bundle-only").length===0)&&!p.rejected){var y=ne.getIceParameters(a,d),P=ne.getDtlsParameters(a,d);h&&(P.role="server"),l.usingBundle&&c!==0||(l._gather(p.mid,c),m.state==="new"&&m.start(f,y,h?"controlling":"controlled"),_.state==="new"&&_.start(P));var L=zn(v,R);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 u=this;if(["offer","answer"].indexOf(s.type)===-1)return Promise.reject(be("TypeError",'Unsupported type "'+s.type+'"'));if(!ta("setRemoteDescription",s.type,u.signalingState)||u._isClosed)return Promise.reject(be("InvalidStateError","Can not set remote "+s.type+" in state "+u.signalingState));var d={};u.remoteStreams.forEach(function(m){d[m.id]=m});var l=[],h=ne.splitSections(s.sdp),a=h.shift(),c=ne.matchPrefix(a,"a=ice-lite").length>0,p=ne.matchPrefix(a,"a=group:BUNDLE ").length>0;u.usingBundle=p;var f=ne.matchPrefix(a,"a=ice-options:")[0];return u.canTrickleIceCandidates=!!f&&f.substr(14).split(" ").indexOf("trickle")>=0,h.forEach(function(m,_){var v=ne.splitLines(m),R=ne.getKind(m),y=ne.isRejected(m)&&ne.matchPrefix(m,"a=bundle-only").length===0,P=v[0].substr(2).split(" ")[2],L=ne.getDirection(m,a),N=ne.parseMsid(m),E=ne.getMid(m)||ne.generateIdentifier();if(y||R==="application"&&(P==="DTLS/SCTP"||P==="UDP/DTLS/SCTP"))u.transceivers[_]={mid:E,kind:R,protocol:P,rejected:!0};else{var A,F,q,C,T,S,O,I,U;!y&&u.transceivers[_]&&u.transceivers[_].rejected&&(u.transceivers[_]=u._createTransceiver(R,!0));var D,$,j=ne.parseRtpParameters(m);y||(D=ne.getIceParameters(m,a),($=ne.getDtlsParameters(m,a)).role="client"),O=ne.parseRtpEncodingParameters(m);var J=ne.parseRtcpParameters(m),re=ne.matchPrefix(m,"a=end-of-candidates",a).length>0,X=ne.matchPrefix(m,"a=candidate:").map(function(k){return ne.parseCandidate(k)}).filter(function(k){return k.component===1});if((s.type==="offer"||s.type==="answer")&&!y&&p&&_>0&&u.transceivers[_]&&(u._disposeIceAndDtlsTransports(_),u.transceivers[_].iceGatherer=u.transceivers[0].iceGatherer,u.transceivers[_].iceTransport=u.transceivers[0].iceTransport,u.transceivers[_].dtlsTransport=u.transceivers[0].dtlsTransport,u.transceivers[_].rtpSender&&u.transceivers[_].rtpSender.setTransport(u.transceivers[0].dtlsTransport),u.transceivers[_].rtpReceiver&&u.transceivers[_].rtpReceiver.setTransport(u.transceivers[0].dtlsTransport)),s.type!=="offer"||y)s.type==="answer"&&!y&&(F=(A=u.transceivers[_]).iceGatherer,q=A.iceTransport,C=A.dtlsTransport,T=A.rtpReceiver,S=A.sendEncodingParameters,I=A.localCapabilities,u.transceivers[_].recvEncodingParameters=O,u.transceivers[_].remoteCapabilities=j,u.transceivers[_].rtcpParameters=J,X.length&&q.state==="new"&&(!c&&!re||p&&_!==0?X.forEach(function(k){ii(A.iceTransport,k)}):q.setRemoteCandidates(X)),p&&_!==0||(q.state==="new"&&q.start(F,D,"controlling"),C.state==="new"&&C.start($)),!zn(A.localCapabilities,A.remoteCapabilities).codecs.filter(function(k){return k.name.toLowerCase()==="rtx"}).length&&A.sendEncodingParameters[0].rtx&&delete A.sendEncodingParameters[0].rtx,u._transceive(A,L==="sendrecv"||L==="recvonly",L==="sendrecv"||L==="sendonly"),!T||L!=="sendrecv"&&L!=="sendonly"?delete A.rtpReceiver:(U=T.track,N?(d[N.stream]||(d[N.stream]=new n.MediaStream),t(U,d[N.stream]),l.push([U,T,d[N.stream]])):(d.default||(d.default=new n.MediaStream),t(U,d.default),l.push([U,T,d.default]))));else{(A=u.transceivers[_]||u._createTransceiver(R)).mid=E,A.iceGatherer||(A.iceGatherer=u._createIceGatherer(_,p)),X.length&&A.iceTransport.state==="new"&&(!re||p&&_!==0?X.forEach(function(k){ii(A.iceTransport,k)}):A.iceTransport.setRemoteCandidates(X)),I=n.RTCRtpReceiver.getCapabilities(R),e<15019&&(I.codecs=I.codecs.filter(function(k){return k.name!=="rtx"})),S=A.sendEncodingParameters||[{ssrc:1001*(2*_+2)}];var W,Z=!1;L==="sendrecv"||L==="sendonly"?(Z=!A.rtpReceiver,T=A.rtpReceiver||new n.RTCRtpReceiver(A.dtlsTransport,R),Z&&(U=T.track,N&&N.stream==="-"||(N?(d[N.stream]||(d[N.stream]=new n.MediaStream,Object.defineProperty(d[N.stream],"id",{get:function(){return N.stream}})),Object.defineProperty(U,"id",{get:function(){return N.track}}),W=d[N.stream]):(d.default||(d.default=new n.MediaStream),W=d.default)),W&&(t(U,W),A.associatedRemoteMediaStreams.push(W)),l.push([U,T,W]))):A.rtpReceiver&&A.rtpReceiver.track&&(A.associatedRemoteMediaStreams.forEach(function(k){var z=k.getTracks().find(function(Q){return Q.id===A.rtpReceiver.track.id});z&&function(Q,ie){ie.removeTrack(Q),ie.dispatchEvent(new n.MediaStreamTrackEvent("removetrack",{track:Q}))}(z,k)}),A.associatedRemoteMediaStreams=[]),A.localCapabilities=I,A.remoteCapabilities=j,A.rtpReceiver=T,A.rtcpParameters=J,A.sendEncodingParameters=S,A.recvEncodingParameters=O,u._transceive(u.transceivers[_],!1,Z)}}}),u._dtlsRole===void 0&&(u._dtlsRole=s.type==="offer"?"active":"passive"),u._remoteDescription={type:s.type,sdp:s.sdp},s.type==="offer"?u._updateSignalingState("have-remote-offer"):u._updateSignalingState("stable"),Object.keys(d).forEach(function(m){var _=d[m];if(_.getTracks().length){if(u.remoteStreams.indexOf(_)===-1){u.remoteStreams.push(_);var v=new Event("addstream");v.stream=_,n.setTimeout(function(){u._dispatchEvent("addstream",v)})}l.forEach(function(R){var y=R[0],P=R[1];_.id===R[2].id&&r(u,y,P,[_])})}}),l.forEach(function(m){m[2]||r(u,m[0],m[1],[])}),n.setTimeout(function(){u&&u.transceivers&&u.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 u=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",u)},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 u=new Event("negotiationneeded");s._dispatchEvent("negotiationneeded",u)}},0))},i.prototype._updateIceConnectionState=function(){var s,u={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(l){l.iceTransport&&!l.rejected&&u[l.iceTransport.state]++}),s="new",u.failed>0?s="failed":u.checking>0?s="checking":u.disconnected>0?s="disconnected":u.new>0?s="new":u.connected>0?s="connected":u.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,u={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&&(u[l.iceTransport.state]++,u[l.dtlsTransport.state]++)}),u.connected+=u.completed,s="new",u.failed>0?s="failed":u.connecting>0?s="connecting":u.disconnected>0?s="disconnected":u.new>0?s="new":u.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(be("InvalidStateError","Can not call createOffer after close"));var u=s.transceivers.filter(function(c){return c.kind==="audio"}).length,d=s.transceivers.filter(function(c){return c.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&&(u=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(c){c.kind==="audio"?--u<0&&(c.wantReceive=!1):c.kind==="video"&&--d<0&&(c.wantReceive=!1)});u>0||d>0;)u>0&&(s._createTransceiver("audio"),u--),d>0&&(s._createTransceiver("video"),d--);var h=ne.writeSessionBoilerplate(s._sdpSessionId,s._sdpSessionVersion++);s.transceivers.forEach(function(c,p){var f=c.track,m=c.kind,_=c.mid||ne.generateIdentifier();c.mid=_,c.iceGatherer||(c.iceGatherer=s._createIceGatherer(p,s.usingBundle));var v=n.RTCRtpSender.getCapabilities(m);e<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"),c.remoteCapabilities&&c.remoteCapabilities.codecs&&c.remoteCapabilities.codecs.forEach(function(P){y.name.toLowerCase()===P.name.toLowerCase()&&y.clockRate===P.clockRate&&(y.preferredPayloadType=P.payloadType)})}),v.headerExtensions.forEach(function(y){(c.remoteCapabilities&&c.remoteCapabilities.headerExtensions||[]).forEach(function(P){y.uri===P.uri&&(y.id=P.id)})});var R=c.sendEncodingParameters||[{ssrc:1001*(2*p+1)}];f&&e>=15019&&m==="video"&&!R[0].rtx&&(R[0].rtx={ssrc:R[0].ssrc+1}),c.wantReceive&&(c.rtpReceiver=new n.RTCRtpReceiver(c.dtlsTransport,m)),c.localCapabilities=v,c.sendEncodingParameters=R}),s._config.bundlePolicy!=="max-compat"&&(h+="a=group:BUNDLE "+s.transceivers.map(function(c){return c.mid}).join(" ")+`\r
- `),h+=`a=ice-options:trickle\r
- `,s.transceivers.forEach(function(c,p){h+=ea(c,c.localCapabilities,"offer",c.stream,s._dtlsRole),h+=`a=rtcp-rsize\r
- `,!c.iceGatherer||s.iceGatheringState==="new"||p!==0&&s.usingBundle||(c.iceGatherer.getLocalCandidates().forEach(function(f){f.component=1,h+="a="+ne.writeCandidate(f)+`\r
- `}),c.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(be("InvalidStateError","Can not call createAnswer after close"));if(s.signalingState!=="have-remote-offer"&&s.signalingState!=="have-local-pranswer")return Promise.reject(be("InvalidStateError","Can not call createAnswer in signalingState "+s.signalingState));var u=ne.writeSessionBoilerplate(s._sdpSessionId,s._sdpSessionVersion++);s.usingBundle&&(u+="a=group:BUNDLE "+s.transceivers.map(function(h){return h.mid}).join(" ")+`\r
- `),u+=`a=ice-options:trickle\r
- `;var d=ne.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"?u+=`m=application 0 DTLS/SCTP 5000\r
- `:u+="m=application 0 "+h.protocol+` webrtc-datachannel\r
- `:h.kind==="audio"?u+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
- a=rtpmap:0 PCMU/8000\r
- `:h.kind==="video"&&(u+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
- a=rtpmap:120 VP8/90000\r
- `),void(u+=`c=IN IP4 0.0.0.0\r
- a=inactive\r
- a=mid:`+h.mid+`\r
- `);var c;h.stream&&(h.kind==="audio"?c=h.stream.getAudioTracks()[0]:h.kind==="video"&&(c=h.stream.getVideoTracks()[0]),c&&e>=15019&&h.kind==="video"&&!h.sendEncodingParameters[0].rtx&&(h.sendEncodingParameters[0].rtx={ssrc:h.sendEncodingParameters[0].ssrc+1}));var p=zn(h.localCapabilities,h.remoteCapabilities);!p.codecs.filter(function(f){return f.name.toLowerCase()==="rtx"}).length&&h.sendEncodingParameters[0].rtx&&delete h.sendEncodingParameters[0].rtx,u+=ea(h,p,"answer",h.stream,s._dtlsRole),h.rtcpParameters&&h.rtcpParameters.reducedSize&&(u+=`a=rtcp-rsize\r
- `)}});var l=new n.RTCSessionDescription({type:"answer",sdp:u});return Promise.resolve(l)},i.prototype.addIceCandidate=function(s){var u,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(be("InvalidStateError","Can not add ICE candidate without a remote description"));if(s&&s.candidate!==""){var a=s.sdpMLineIndex;if(s.sdpMid){for(var c=0;c<d.transceivers.length;c++)if(d.transceivers[c].mid===s.sdpMid){a=c;break}}var p=d.transceivers[a];if(!p)return h(be("OperationError","Can not add ICE candidate"));if(p.rejected)return l();var f=Object.keys(s.candidate).length>0?ne.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)&&!ii(p.iceTransport,f))return h(be("OperationError","Can not add ICE candidate"));var m=s.candidate.trim();m.indexOf("a=")===0&&(m=m.substr(2)),(u=ne.getMediaSections(d._remoteDescription.sdp))[a]+="a="+(f.type?m:"end-of-candidates")+`\r
- `,d._remoteDescription.sdp=ne.getDescription(d._remoteDescription.sdp)+u.join("")}else for(var _=0;_<d.transceivers.length&&(d.transceivers[_].rejected||(d.transceivers[_].iceTransport.addRemoteCandidate({}),(u=ne.getMediaSections(d._remoteDescription.sdp))[_]+=`a=end-of-candidates\r
- `,d._remoteDescription.sdp=ne.getDescription(d._remoteDescription.sdp)+u.join(""),!d.usingBundle));_++);l()})},i.prototype.getStats=function(s){if(s&&s instanceof n.MediaStreamTrack){var u=null;if(this.transceivers.forEach(function(l){l.rtpSender&&l.rtpSender.track===s?u=l.rtpSender:l.rtpReceiver&&l.rtpReceiver.track===s&&(u=l.rtpReceiver)}),!u)throw be("InvalidAccessError","Invalid selector.");return u.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(c){h.set(c.id,c)})}),h})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(s){var u=n[s];if(u&&u.prototype&&u.prototype.getStats){var d=u.prototype.getStats;u.prototype.getStats=function(){return d.apply(this).then(function(l){var h=new Map;return Object.keys(l).forEach(function(a){var c;l[a].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(c=l[a]).type]||c.type,h.set(a,l[a])}),h})}}});var o=["createOffer","createAnswer"];return o.forEach(function(s){var u=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[0]=="function"||typeof d[1]=="function"?u.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])}):u.apply(this,arguments)}}),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(s){var u=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[1]=="function"||typeof d[2]=="function"?u.apply(this,arguments).then(function(){typeof d[1]=="function"&&d[1].apply(null)},function(l){typeof d[2]=="function"&&d[2].apply(null,[l])}):u.apply(this,arguments)}}),["getStats"].forEach(function(s){var u=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[1]=="function"?u.apply(this,arguments).then(function(){typeof d[1]=="function"&&d[1].apply(null)}):u.apply(this,arguments)}}),i};function Cc(n){const e=n&&n.navigator,t=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(r){return t(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 yc(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 ki(n,e){if(n.RTCIceGatherer&&(n.RTCIceCandidate||(n.RTCIceCandidate=function(r){return r}),n.RTCSessionDescription||(n.RTCSessionDescription=function(r){return r}),e.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 t=_l(n,e.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(u=>{if(u&&(u.urls||u.url)){let d=u.urls||u.url;u.url&&!u.urls&&Fr("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 u.url,u.urls=l?d[0]:d,!!d.length}})}(r.iceServers,e.version),jo("ICE servers after filtering:",r.iceServers)),new t(r)},n.RTCPeerConnection.prototype=t.prototype}function Ec(n){n.RTCRtpSender&&!("replaceTrack"in n.RTCRtpSender.prototype)&&(n.RTCRtpSender.prototype.replaceTrack=n.RTCRtpSender.prototype.setTrack)}var na=Object.freeze({__proto__:null,shimPeerConnection:ki,shimReplaceTrack:Ec,shimGetUserMedia:Cc,shimGetDisplayMedia:yc});function Tc(n,e){const t=n&&n.navigator,r=n&&n.MediaStreamTrack;if(t.getUserMedia=function(i,o,s){Fr("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(i).then(o,s)},!(e.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){const i=function(s,u,d){u in s&&!(d in s)&&(s[d]=s[u],delete s[u])},o=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.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 u=s.apply(this,arguments);return i(u,"mozAutoGainControl","autoGainControl"),i(u,"mozNoiseSuppression","noiseSuppression"),u}}if(r&&r.prototype.applyConstraints){const s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(u){return this.kind==="audio"&&typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)),i(u,"autoGainControl","mozAutoGainControl"),i(u,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[u])}}}}function Sc(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 Di(n,e){if(typeof n!="object"||!n.RTCPeerConnection&&!n.mozRTCPeerConnection)return;!n.RTCPeerConnection&&n.mozRTCPeerConnection&&(n.RTCPeerConnection=n.mozRTCPeerConnection),e.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 t={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(u=>{if(e.version<53&&!o)try{u.forEach(d=>{d.type=t[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;u.forEach((l,h)=>{u.set(h,Object.assign({},l,{type:t[l.type]||l.type}))})}return u}).then(o,s)}}function Ic(n){if(typeof n!="object"||!n.RTCPeerConnection||!n.RTCRtpSender||n.RTCRtpSender&&"getStats"in n.RTCRtpSender.prototype)return;const e=n.RTCPeerConnection.prototype.getSenders;e&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r});const t=n.RTCPeerConnection.prototype.addTrack;t&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=t.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 bc(n){if(typeof n!="object"||!n.RTCPeerConnection||!n.RTCRtpSender||n.RTCRtpSender&&"getStats"in n.RTCRtpReceiver.prototype)return;const e=n.RTCPeerConnection.prototype.getReceivers;e&&(n.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach(r=>r._pc=this),t}),Jt(n,"track",t=>(t.receiver._pc=t.srcElement,t)),n.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Oc(n){n.RTCPeerConnection&&!("removeStream"in n.RTCPeerConnection.prototype)&&(n.RTCPeerConnection.prototype.removeStream=function(e){Fr("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Nc(n){n.DataChannel&&!n.RTCDataChannel&&(n.RTCDataChannel=n.DataChannel)}function wc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.addTransceiver;e&&(n.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const t=arguments[1],r=t&&"sendEncodings"in t;r&&t.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=e.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=t.sendEncodings,o.sendEncodings=t.sendEncodings,this.setParametersPromises.push(o.setParameters(s).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return i})}function Mc(n){if(typeof n!="object"||!n.RTCRtpSender)return;const e=n.RTCRtpSender.prototype.getParameters;e&&(n.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function Ac(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function Pc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.createAnswer;n.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var ra=Object.freeze({__proto__:null,shimOnTrack:Sc,shimPeerConnection:Di,shimSenderGetStats:Ic,shimReceiverGetStats:bc,shimRemoveStream:Oc,shimRTCDataChannel:Nc,shimAddTransceiver:wc,shimGetParameters:Mc,shimCreateOffer:Ac,shimCreateAnswer:Pc,shimGetUserMedia:Tc,shimGetDisplayMedia:function(n,e){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(n.navigator.mediaDevices.getDisplayMedia=function(t){if(!t||!t.video){const r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return t.video===!0?t.video={mediaSource:e}:t.video.mediaSource=e,n.navigator.mediaDevices.getUserMedia(t)})}});function Lc(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 e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(r=>e.call(this,r,t)),t.getVideoTracks().forEach(r=>e.call(this,r,t))},n.RTCPeerConnection.prototype.addTrack=function(t,...r){return r&&r.forEach(i=>{this._localStreams?this._localStreams.includes(i)||this._localStreams.push(i):this._localStreams=[i]}),e.apply(this,arguments)}}"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(i=>{r.includes(i.track)&&this.removeTrack(i)})})}}function kc(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(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),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 e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(i=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(i)>=0)return;t._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,t.dispatchEvent(o)})}),e.apply(t,arguments)}}}function Dc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype,t=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(d,l){const h=arguments.length>=2?arguments[2]:arguments[0],a=t.apply(this,[h]);return l?(a.then(d,l),Promise.resolve()):a},e.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 u=function(d,l,h){const a=i.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a};e.setLocalDescription=u,u=function(d,l,h){const a=o.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a},e.setRemoteDescription=u,u=function(d,l,h){const a=s.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a},e.addIceCandidate=u}function Uc(n){const e=n&&n.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,r=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=i=>r(xc(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,r,i){e.mediaDevices.getUserMedia(t).then(r,i)}.bind(e))}function xc(n){return n&&n.video!==void 0?Object.assign({},n,{video:dc(n.video)}):n}function Vc(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection;n.RTCPeerConnection=function(t,r){if(t&&t.iceServers){const i=[];for(let o=0;o<t.iceServers.length;o++){let s=t.iceServers[o];!s.hasOwnProperty("urls")&&s.hasOwnProperty("url")?(Fr("RTCIceServer.url","RTCIceServer.urls"),s=JSON.parse(JSON.stringify(s)),s.urls=s.url,delete s.url,i.push(s)):i.push(t.iceServers[o])}t.iceServers=i}return new e(t,r)},n.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(n.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function Bc(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 Fc(n){const e=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(t){if(t){t.offerToReceiveAudio!==void 0&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const r=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");t.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"):t.offerToReceiveAudio!==!0||r||this.addTransceiver("audio"),t.offerToReceiveVideo!==void 0&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const i=this.getTransceivers().find(o=>o.receiver.track.kind==="video");t.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"):t.offerToReceiveVideo!==!0||i||this.addTransceiver("video")}return e.apply(this,arguments)}}function $c(n){typeof n!="object"||n.AudioContext||(n.AudioContext=n.webkitAudioContext)}var ia=Object.freeze({__proto__:null,shimLocalStreamsAPI:Lc,shimRemoteStreamsAPI:kc,shimCallbacksAPI:Dc,shimGetUserMedia:Uc,shimConstraints:xc,shimRTCIceServerUrls:Vc,shimTrackEventTransceiver:Bc,shimCreateOfferLegacy:Fc,shimAudioContext:$c});function er(n){if(!n.RTCIceCandidate||n.RTCIceCandidate&&"foundation"in n.RTCIceCandidate.prototype)return;const e=n.RTCIceCandidate;n.RTCIceCandidate=function(t){if(typeof t=="object"&&t.candidate&&t.candidate.indexOf("a=")===0&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const r=new e(t),i=ne.parseCandidate(t.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 e(t)},n.RTCIceCandidate.prototype=e.prototype,Jt(n,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new n.RTCIceCandidate(t.candidate),writable:"false"}),t))}function un(n,e){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 t=function(u){if(!u||!u.sdp)return!1;const d=ne.splitSections(u.sdp);return d.shift(),d.some(l=>{const h=ne.parseMLine(l);return h&&h.kind==="application"&&h.protocol.indexOf("SCTP")!==-1})},r=function(u){const d=u.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(u){let d=65536;return e.browser==="firefox"&&(d=e.version<57?u===-1?16384:2147483637:e.version<60?e.version===57?65535:65536:2147483637),d},o=function(u,d){let l=65536;e.browser==="firefox"&&e.version===57&&(l=65535);const h=ne.matchPrefix(u.sdp,"a=max-message-size:");return h.length>0?l=parseInt(h[0].substr(19),10):e.browser==="firefox"&&d!==-1&&(l=2147483637),l},s=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:u}=this.getConfiguration();u==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(t(arguments[0])){const u=r(arguments[0]),d=i(u),l=o(arguments[0],u);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 dn(n){if(!n.RTCPeerConnection||!("createDataChannel"in n.RTCPeerConnection.prototype))return;function e(r,i){const o=r.send;r.send=function(){const s=arguments[0],u=s.length||s.size||s.byteLength;if(r.readyState==="open"&&i.sctp&&u>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(r,arguments)}}const t=n.RTCPeerConnection.prototype.createDataChannel;n.RTCPeerConnection.prototype.createDataChannel=function(){const r=t.apply(this,arguments);return e(r,this),r},Jt(n,"datachannel",r=>(e(r.channel,r.target),r))}function Ui(n){if(!n.RTCPeerConnection||"connectionState"in n.RTCPeerConnection.prototype)return;const e=n.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const r=e[t];e[t]=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 xi(n,e){if(!n.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const t=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 t.apply(this,arguments)}}function tr(n,e){if(!n.RTCPeerConnection||!n.RTCPeerConnection.prototype)return;const t=n.RTCPeerConnection.prototype.addIceCandidate;t&&t.length!==0&&(n.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var vl=Object.freeze({__proto__:null,shimRTCIceCandidate:er,shimMaxMessageSize:un,shimSendThrowTypeError:dn,shimConnectionState:Ui,removeExtmapAllowMixed:xi,shimAddIceCandidateNullOrEmpty:tr});const Rl=function({window:n}={},e={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const t=jo,r=function(o){const s={browser:null,version:null};if(o===void 0||!o.navigator)return s.browser="Not a browser.",s;const{navigator:u}=o;if(u.mozGetUserMedia)s.browser="firefox",s.version=an(u.userAgent,/Firefox\/(\d+)\./,1);else if(u.webkitGetUserMedia||o.isSecureContext===!1&&o.webkitRTCPeerConnection&&!o.RTCIceGatherer)s.browser="chrome",s.version=an(u.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(u.mediaDevices&&u.userAgent.match(/Edge\/(\d+).(\d+)$/))s.browser="edge",s.version=an(u.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!o.RTCPeerConnection||!u.userAgent.match(/AppleWebKit\/(\d+)\./))return s.browser="Not a supported browser.",s;s.browser="safari",s.version=an(u.userAgent,/AppleWebKit\/(\d+)\./,1),s.supportsUnifiedPlan=o.RTCRtpTransceiver&&"currentDirection"in o.RTCRtpTransceiver.prototype}return s}(n),i={browserDetails:r,commonShim:vl,extractVersion:an,disableLog:gl,disableWarnings:ml};switch(r.browser){case"chrome":if(!Qs||!Li||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),i;if(r.version===null)return t("Chrome shim can not determine version, not shimming."),i;t("adapter.js shimming chrome."),i.browserShim=Qs,tr(n,r),lc(n,r),hc(n),Li(n,r),pc(n),vc(n,r),fc(n),gc(n),mc(n),Rc(n,r),er(n),Ui(n),un(n,r),dn(n),xi(n,r);break;case"firefox":if(!ra||!Di||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),i;t("adapter.js shimming firefox."),i.browserShim=ra,tr(n,r),Tc(n,r),Di(n,r),Sc(n),Oc(n),Ic(n),bc(n),Nc(n),wc(n),Mc(n),Ac(n),Pc(n),er(n),Ui(n),un(n,r),dn(n);break;case"edge":if(!na||!ki||!e.shimEdge)return t("MS edge shim is not included in this adapter release."),i;t("adapter.js shimming edge."),i.browserShim=na,Cc(n),yc(n),ki(n,r),Ec(n),un(n,r),dn(n);break;case"safari":if(!ia||!e.shimSafari)return t("Safari shim is not included in this adapter release."),i;t("adapter.js shimming safari."),i.browserShim=ia,tr(n,r),Vc(n),Fc(n),Dc(n),Lc(n),kc(n),Bc(n),Uc(n),$c(n),er(n),un(n,r),dn(n),xi(n,r);break;default:t("Unsupported browser!")}return i}({window:typeof window=="undefined"?void 0:window});var Qe,ge,he;(function(n){n.FPS_10="FPS_10",n.FPS_15="FPS_15",n.FPS_24="FPS_24",n.FPS_30="FPS_30"})(Qe||(Qe={})),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"}(ge||(ge={})),function(n){n[n.AUDIO_ONLY=0]="AUDIO_ONLY",n[n.VIDEO_ONLY=1]="VIDEO_ONLY",n[n.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(he||(he={}));const oa={[ge.W176_H132]:{width:176,height:132,maxBitrate:150,minBitrate:80},[ge.W176_H144]:{width:176,height:144,maxBitrate:160,minBitrate:80},[ge.W256_H144]:{width:256,height:144,maxBitrate:240,minBitrate:120},[ge.W320_H180]:{width:320,height:180,maxBitrate:280,minBitrate:120},[ge.W240_H240]:{width:240,height:240,maxBitrate:280,minBitrate:120},[ge.W320_H240]:{width:320,height:240,maxBitrate:400,minBitrate:120},[ge.W480_H360]:{width:480,height:360,maxBitrate:650,minBitrate:150},[ge.W640_H360]:{width:640,height:360,maxBitrate:800,minBitrate:180},[ge.W480_H480]:{width:480,height:480,maxBitrate:800,minBitrate:180},[ge.W640_H480]:{width:640,height:480,maxBitrate:900,minBitrate:200},[ge.W720_H480]:{width:720,height:480,maxBitrate:1e3,minBitrate:200},[ge.W1280_H720]:{width:1280,height:720,maxBitrate:2200,minBitrate:250},[ge.W1920_H1080]:{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}},Hc=(n,e)=>{const t=n*e;let r=Number.MAX_VALUE,i=null;for(const o in oa){const s=oa[o],u=Math.abs(s.width*s.height-t);u<r&&(i=s,r=u)}return i},sa={10:1,15:1,24:1.5,30:1.5},jc=n=>{let e=Number.MAX_VALUE,t=1;for(const r in sa){const i=Math.abs(n-parseInt(r));i<e&&(e=i,t=sa[r])}return t},Ko={getCameras:()=>H(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="videoinput")}),getMicrophones:()=>H(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="audioinput")}),getSpeakers:()=>H(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="audiooutput")})};class qo extends On{constructor(e,t,r,i,o){super(),this._tag=e,this._userId=t,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 e;return((e=this._msTrack)===null||e===void 0?void 0:e.readyState)==="live"}__innerSetMediaStreamTrack(e){this._msTrack=e,this._setLocalMuted(this._localMuted);const t=this._msStream=this._msStream||new MediaStream,r=t.getTracks()[0];r&&t.removeTrack(r),e?t.addTrack(e):this._element&&(this._element.pause(),this._element.srcObject=null)}_setLocalMuted(e){this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e}mute(){M.info(`set ${this._id} enabled: false`),this._setLocalMuted(!0)}unmute(){M.info(`set ${this._id} enabled: true`),this._setLocalMuted(!1)}isLocalMuted(){return this._localMuted}isMCUTrack(){return Boolean(this._roomId)}isOwnerMuted(){return this._remoteMuted}play(e,t){return H(this,void 0,void 0,function*(){if(!this._msTrack)return M.warn(`the track is not ready to play -> id: ${this._id}`),{code:w.TRACK_NOT_READY};if(this._msTrack.readyState==="ended"&&M.warn(`the track's readyState is 'ended' -> id: ${this._id}`),t==null?void 0:t.volume){if(!_e(t==null?void 0:t.volume))return M.error(`${t==null?void 0:t.volume} is not a number, the valid range of options.volume is 0-100`),{code:w.PARAMS_ERROR};(t==null?void 0:t.volume)<0&&(t.volume=0,M.warn("the valid range of options.volume is 0-100, the value of volume has been set 0")),(t==null?void 0:t.volume)>100&&(t.volume=100,M.warn("the valid range of options.volume is 0-100, the value of volume has been set 100"))}if((t==null?void 0:t.audioDeviceId)&&!(yield Ko.getSpeakers()).map(i=>i.deviceId).includes(t.audioDeviceId))return M.error(`the options.audioDeviceId is invalid --> ${t.audioDeviceId}`),{code:w.PARAMS_ERROR};const r=this.isVideoTrack();if(r&&(!e||!(e instanceof HTMLVideoElement)))return M.error(`the video track need an <video> to play -> id: ${this._id}`),{code:w.VIDEO_TRACK_MISS_MEDIA_ELEMENT};this._element=r?e: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;M.debug(`HTMLMediaElement onloadstart -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.ondurationchange=i=>{var o;M.debug(`HTMLMediaElement ondurationchange -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onloadedmetadata=i=>{var o;M.debug(`HTMLMediaElement onloadedmetadata -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onloadeddata=i=>{var o;M.debug(`HTMLMediaElement onloadeddata -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onabort=i=>{var o;M.info(`HTMLMediaElement onabort -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.oncanplay=i=>{var o;M.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));M.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||!(t==null?void 0:t.volume)&&(t==null?void 0:t.volume)!==0||(this._element.volume=(t==null?void 0:t.volume)/100);try{(t==null?void 0:t.audioDeviceId)&&!r?yield this._element.setSinkId(t.audioDeviceId):this._element.play()}catch(i){return i.message==="No permission to use requested device"?(M.error(`setSinkId failed -> ${i.message}`),{code:w.NO_PERMISSION_TO_USE_REQUESTED_DEVICE}):(M.error(i),{code:w.TRACK_PLAY_ERROR})}return{code:w.SUCCESS}})}__innerDestroy(){this.__innerSetMediaStreamTrack(void 0)}__releaseMediaElement(){this._element&&(this._element.remove(),this._element.srcObject=null)}}class de extends qo{constructor(e,t,r,i){super(e,t,r,!0),this._isPublished=!1,this.__innerSetMediaStreamTrack(i),i.onended=()=>{i.onended=null,this.emit(de.EVENT_LOCAL_TRACK_END,this),this.removeAll(de.EVENT_LOCAL_TRACK_END)}}_setLocalMuted(e){const t=this._localMuted!==e;super._setLocalMuted(e),this._remoteMuted=this._localMuted,t&&this.emit(de.__INNER_EVENT_MUTED_CHANGE__,this)}__innerSetPublished(e){this._isPublished=e}isPublished(){return this._isPublished}destroy(){var e;M.info(`track is destroyed -> trackId: ${this.getTrackId()}`),(e=this._msTrack)===null||e===void 0||e.stop(),super.__innerDestroy(),this.isAudioTrack()&&super.__releaseMediaElement(),this.emit(de.__INNER_EVENT_DESTROY__,this)}setBitrate(e=0,t=0,r=0){!_e(e)||!_e(t)||!_e(r)||e<=0||t<=0||e<t?M.error("setBitrate params error ->"):this._bitrateInfo={max:e,min:t,start:r}}getBitrate(){var e,t;const{min:r,max:i}=this._msTrack?Sl(this._msTrack):{min:0,max:0};return{min:((e=this._bitrateInfo)===null||e===void 0?void 0:e.min)||r,max:((t=this._bitrateInfo)===null||t===void 0?void 0:t.max)||i}}}de.EVENT_LOCAL_TRACK_END="local-track-end",de.__INNER_EVENT_MUTED_CHANGE__="inner-muted-change",de.__INNER_EVENT_DESTROY__="inner-destroy";class Vi extends de{constructor(e,t,r){super(e,t,"audio",r)}setBitrate(e,t,r){M.warn("`setBitrate` invalid for audio track")}getBitrate(){return{start:32,max:32,min:32}}}class qt extends de{constructor(e,t,r,i=!1){super(e,t,"video",r),this._isTiny=i}__isTiny(){return this._isTiny}getStreamId(){const e=super.getStreamId();return this._isTiny?`${e}_tiny`:e}getTrackId(){const e=super.getTrackId();return this._isTiny?`${e}_tiny`:e}}class Gt extends de{constructor(e,t,r,i,o){super(e,t,r,i),this._resource=o,Gt.__innerSetMapping(this.getTrackId(),o)}static __innerSetMapping(e,t){const r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}static __innerRemoveMapping(e,t){var r,i;const o=(r=this._mapping.get(t))===null||r===void 0?void 0:r.filter(s=>s!==e);o&&o.length>0?this._mapping.set(t,o):(this._mapping.delete(t),t.pause(),t.src="",(i=t.parentNode)===null||i===void 0||i.removeChild(t))}destroy(){this.isAudioTrack()&&this.mute(),Gt.__innerRemoveMapping(this.getTrackId(),this._resource),super.destroy()}}Gt._mapping=new Map;class Cl extends Gt{constructor(e,t,r,i){super(e,t,"video",r,i)}}class yl extends Gt{constructor(e,t,r,i){super(e,t,"audio",r,i)}_setLocalMuted(e){this._resource&&(this._resource.muted=e),super._setLocalMuted(e)}play(){return this._setLocalMuted(!1),Promise.resolve({code:w.SUCCESS})}}class aa extends Vi{}class ca extends qt{}class El extends qt{}class Oe extends qo{constructor(e,t,r,i){super(e,t,r,!1,i),this._isSubscribed=!1}__innerSetRemoteMuted(e){this._remoteMuted=e}__innerSetSubscribed(e){this._isSubscribed=e}isSubscribed(){return this._isSubscribed}}class pt extends Oe{constructor(e,t,r){super(e,t,"audio",r)}}class ft extends Oe{constructor(e,t,r){super(e,t,"video",r)}}const Jn=(n,e)=>({name:n,content:JSON.stringify({uris:e,ignore:!0})}),Et=n=>JSON.stringify(n),dt=n=>/^[a-zA-Z\d-=]+$/g.test(n),Tl=location.protocol!=="http:"||["localhost","127.0.0.1"].includes(location.hostname),oi=n=>{if(n===void 0)return 0;if(_e(n))return n;const e=n;return e.exact||e.ideal||e.max||0},Go=n=>{const e=n.getConstraints();return{width:oi(e.width),height:oi(e.height),frameRate:oi(e.frameRate)}},Sl=n=>{const{width:e,height:t,frameRate:r}=Go(n),i=Hc(e,t),o=jc(r);return{min:i.minBitrate*o,max:i.maxBitrate*o}},ue=n=>[n.msid,n.mediaType].join("_"),Pe=n=>{const e=n.split("_");return{mediaType:parseInt(e.pop()),tag:e.pop(),userId:e.join("_")}},si=(n,e)=>[n,e].join("_"),Wn=n=>n.map(e=>Object.assign({},e)),nr=(n,e,t=!1)=>{n=n.slice();const r=[],i=[],o=[];return e.forEach(s=>{const u=ue(s);let d=n.findIndex(h=>ue(h)===u);if(t&&(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}},Il=()=>{let n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=16*Math.random()|0;return(e==="x"?t:3&t|8).toString(16)});return n=n.replace(/-/g,"")+"0",n=parseInt(n,16),n=(e=>{const t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1;let i=+e;const o=[];do{const s=i%r;i=(i-s)/r,o.unshift(t[s])}while(i);return o.join("")})(n),n.length>22&&(n=n.slice(0,22)),n},it=n=>{const[e,t]=n.split("_").map(r=>parseInt(r.replace(/[^\d]/g,"")));return{width:e,height:t}},Ht=n=>!!ge[n],Bi=n=>!!Qe[n],ot=n=>parseInt(n.replace("FPS_","")),Ge=(()=>{const{browser:n,version:e,supportsUnifiedPlan:t}=Rl.browserDetails;return{browser:n,version:e,supportsUnifiedPlan:t!==!1}})();function Kc(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function qc(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}const Fi=n=>Object.prototype.toString.call(n)==="[object Null]",rr=n=>n.type===1,$i=n=>{const e={},t=Object.keys(n.users);return t.length&&t.forEach(r=>{const i=[],o=n.users[r];if(o.uris)try{i.push(...JSON.parse(o.uris))}catch{M.warn(`invalid user data -> userId: ${r}, userData: ${o}`)}e[r]=i}),e};var ae,Rr;(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"})(ae||(ae={})),function(n){n.SUCCESS="Success",n.FAIL="Fail"}(Rr||(Rr={}));class bl{constructor(e,t,r,i=1e4){this._roomId=e,this._roomMode=t,this._context=r,this._gap=i,this._latestTimestamp=Date.now(),this._timer=null}start(){return H(this,void 0,void 0,function*(){this._timer||(this._timer=setInterval(this._loop.bind(this),this._gap))})}_loop(){var e,t,r;return H(this,void 0,void 0,function*(){const i=yield new Promise(s=>{this._context.rtcPing(this._roomId,this._roomMode).then(s).catch(u=>{M.error(`rtcping receive unknown error -> ${u}`),s(b.UNKNOWN)}),setTimeout(s,1e4,b.TIMEOUT)}),o=Date.now();if(i===b.SUCCESS)return this._latestTimestamp=o,void((e=this.onPingResult)===null||e===void 0||e.call(this,Rr.SUCCESS));(t=this.onPingResult)===null||t===void 0||t.call(this,Rr.FAIL),M.warn(`rtcping failed -> code: ${i}`),(i===40003||o-this._latestTimestamp>6e4)&&(this.stop(),(r=this.onFailed)===null||r===void 0||r.call(this,i===40003))})}stop(){this._timer&&(clearInterval(this._timer),this._timer=null)}}var Ke;(function(n){n[n.NORMAL=1]="NORMAL",n[n.TINY=2]="TINY"})(Ke||(Ke={}));const ua=(n,e)=>Math.round(8*e/n),da=(n,e=2)=>{const t=10**e;return Math.round(n*t)/t},gt=(n,e=2)=>{n>1&&(n/=32767);const t=10**e;return Math.ceil(n*t)},Zn=(n,e,t,r)=>{if(e===0)return 0;if(!t||!r)return da(n/e,3);const i=e-r;if(i===0)return 0;const o=n-t;return o<0||i<0?0:da(o/i,3)},Gc=n=>{const{jitter:e,rtt:t,packetsLostRate:r}=n;return!Fi(e)||!Fi(t)||r!==0};class Yo{constructor(e,t){this._rtcPeerConn=e,this._sdpSemantics=t,this._latestPacketsSent={},this._latestBytesSent={},this._latestBytesRecv={},this._latestPacketsRecv={}}updateBytesSent(e,t,r){let i,o;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){const{bytesSent:s,timestamp:u}=this._latestBytesSent[e];i=t-s,o=r-u,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else i=t,o=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return ua(o,i)}updateBytesRecv(e,t,r){let i,o;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){const{bytesRecv:s,timestamp:u}=this._latestBytesRecv[e];i=t-s,o=r-u,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else i=t,o=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return ua(o,i)}updateSenderPacketsLost(e,t,r){let i;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){const{packetsLost:o,packetsSent:s}=this._latestPacketsSent[e];i=Zn(t,r,o,s),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?s:r}else i=Zn(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return i}updateReceiverPacketsLost(e,t,r){let i;if(this._latestPacketsRecv[e]){const{packetsLost:o,packetsRecv:s}=this._latestPacketsRecv[e];i=Zn(t,r+t,o,s+o)}else i=Zn(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},i}clearLatestpacketsSent(e){e.forEach(t=>{if(parseInt(t.split("_").pop())===he.VIDEO_ONLY){const r=`${t}_tiny`;delete this._latestPacketsSent[r],delete this._latestBytesSent[r]}delete this._latestPacketsSent[t],delete this._latestBytesSent[t]})}clearLatestPacketsRecv(e){e.forEach(t=>{delete this._latestPacketsRecv[t],delete this._latestBytesRecv[t]})}parseRTCStatsReport(e){const t=e.keys(),r={};let i=t.next();for(;!i.done;){const o=i.value,s=e.get(o);/^RTCCodec_/.test(o)||(r[o]=s),i=t.next()}return r}formatRCRTCStateReport(e){return{senders:[],receivers:[]}}getAudioLevelList(e){return[]}getResourceIdByParseSdp(e){var t,r;const i=e.ssrc,o=e.kind||e.mediaType,s=(t=this._rtcPeerConn.currentLocalDescription)===null||t===void 0?void 0:t.sdp,u=(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 c=a?a[1]:"";if(c)return`${c}_${o==="video"?1:0}`;const p=u==null?void 0:u.split(`\r
- m=`),f=p==null?void 0:p.filter(_=>_.includes(`a=ssrc:${i}`))[0],m=f==null?void 0:f.match(d);return c=m?m[1]:"",`${c}_${o==="video"?1:0}`}isValidSender(e){var t;const r=(t=this._rtcPeerConn.currentLocalDescription)===null||t===void 0?void 0:t.sdp,{ssrc:i}=e;return!(r==null?void 0:r.split(`\r
- m=`).some(o=>o.includes(i)&&o.includes("a=inactive")))}isValidReceiver(e){var t;const r=(t=this._rtcPeerConn.currentRemoteDescription)===null||t===void 0?void 0:t.sdp,{ssrc:i}=e;return!(r==null?void 0:r.split(`\r
- m=`).some(o=>o.includes(i)&&o.includes("a=inactive")))}}class Ol extends Yo{formatRCRTCStateReport(e){const t={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);t.timestamp=r;const i=Object.keys(e);let o=0,s=0;i.filter(l=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(h))return;const{id:a,kind:c,transportId:p,mediaSourceId:f,remoteId:m,packetsSent:_,bytesSent:v,trackId:R,encoderImplementation:y,pliCount:P,nackCount:L,firCount:N}=h;if(!R)return;let{framesPerSecond:E,frameWidth:A,frameHeight:F}=h;c!=="video"||A||F||E||(A=e[R].frameWidth,F=e[R].frameHeight,E=f?e[f].framesPerSecond:null);const q=e[m];let C=null,T=null,S=0;q&&(C=q.jitter,T=q.roundTripTime,S=q.packetsLost),o+=S;const O=this.getResourceIdByParseSdp(h),I=f?e[f].audioLevel:e[R].audioLevel;let U=null;!this._latestPacketsSent[O]&&(this._latestPacketsSent[O]={}),q?U=this.updateSenderPacketsLost(O,S,_):this._latestPacketsSent[O].crtPacketsSent=_;let D=this.updateBytesSent(O,v,r);D<0&&(D=0),s+=D,t.senders.push({id:a,trackId:O,kind:c,packetsLostRate:U,remoteResource:!1,audioLevel:I||I===0?gt(I):null,frameWidth:A,frameHeight:F,frameRate:E,bitrate:D,jitter:C&&Math.round(1e3*C),rtt:T,encoderImplementation:y,pliCount:P,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:c,packetsLost:p}=e[l],f=t.senders.filter(m=>m.id===h)[0];if(f&&!Gc(f)){const m=this.getResourceIdByParseSdp(e[f.id]);f.jitter=Math.round(1e3*a),f.rtt=c;const _=this._latestPacketsSent[m].crtPacketsSent;f.packetsLostRate=this.updateSenderPacketsLost(m,p,_)}});let u=0;i.filter(l=>/^RTCInboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(h))return;const{trackId:a,packetsLost:c,packetsReceived:p,jitter:f,bytesReceived:m,framesPerSecond:_,kind:v,codecImplementationName:R,nackCount:y,pliCount:P}=h;if(!a)return;let{frameWidth:L,frameHeight:N,audioLevel:E}=h;v==="video"?L||N||(L=e[a].frameWidth,N=e[a].frameHeight):E||(E=e[a].audioLevel),o+=c;const A=this.getResourceIdByParseSdp(h),F=this.updateReceiverPacketsLost(A,c,p);let q=this.updateBytesRecv(A,m,r);q<0&&(q=0),u+=q,t.receivers.push({trackId:A,kind:v,packetsLostRate:F,remoteResource:!0,audioLevel:E||E===0?gt(E):null,frameWidth:L,frameHeight:N,frameRate:_,bitrate:q,jitter:f?Math.round(1e3*f):0,codecImplementationName:R,nackCount:y,pliCount:P,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})});const d=i.filter(l=>/^RTCTransport_/.test(l))[0];if(d){const l=e[d],{selectedCandidatePairId:h}=l;if(h){const a=e[h],{availableOutgoingBitrate:c,availableIncomingBitrate:p,currentRoundTripTime:f,localCandidateId:m,remoteCandidateId:_}=a,v=e[m],{ip:R,port:y,networkType:P}=v,L=e[_],{ip:N,port:E,protocol:A}=L;t.iceCandidatePair={IP:R,port:y,networkType:P,remoteIP:N,remotePort:E,protocol:A,bitrateRecv:u,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:c,availableIncomingBitrate:p,totalPacketsLost:o},t.receivers.forEach(F=>{F.rtt=f})}}return t}getAudioLevelList(e){const t=[],r=Object.keys(e);return r.filter(i=>/^RTCOutboundRTPAudioStream_/.test(i)).forEach(i=>{var o;const s=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(s))return;const{mediaSourceId:u,trackId:d}=s,l=this.getResourceIdByParseSdp(s),h=u&&e[u]?e[u].audioLevel:((o=e[d])===null||o===void 0?void 0:o.audioLevel)||null;t.push({trackId:l,audioLevel:h||h===0?gt(h):null})}),r.filter(i=>/^RTCInboundRTPAudioStream_/.test(i)).forEach(i=>{const o=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(o))return;const{trackId:s}=o,u=o.audioLevel||e[s].audioLevel,d=this.getResourceIdByParseSdp(o);t.push({trackId:d,audioLevel:u||u===0?gt(u):null})}),t}}class Nl extends Yo{formatRCRTCStateReport(e){const t=+new Date,r={senders:[],receivers:[],timestamp:t};let i=0,o=0,s=0;for(const u in e){const d=e[u],l=d.type;if(l==="outbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(d))continue;const{id:h,kind:a,bytesSent:c,packetsSent:p,bitrateMean:f,framerateMean:m,nackCount:_,pliCount:v,remoteId:R}=d,{jitter:y,roundTripTime:P,packetsLost:L}=R?e[R]:{jitter:null,roundTripTime:null,packetsLost:0},N=this.getResourceIdByParseSdp(d);i+=L;let E=null;!this._latestPacketsSent[N]&&(this._latestPacketsSent[N]={}),R?E=this.updateSenderPacketsLost(N,L,p):this._latestPacketsSent[N].crtPacketsSent=p;let A=0;a==="video"?f&&(A=Math.floor(f/1e3)):A=this.updateBytesSent(N,c,t),A<0&&(A=0),o+=A,r.senders.push({trackId:N,kind:a,packetsLostRate:E,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(m),bitrate:A,jitter:y?Math.round(1e3*y):null,rtt:P,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(e[h]),c=r.senders.filter(p=>p.trackId===a)[0];c&&Gc(c)&&(c.jitter=Math.round(1e3*d.jitter),c.rtt=d.rtt,c.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:c,packetsReceived:p,jitter:f,framerateMean:m,kind:_,bitrateMean:v,nackCount:R,pliCount:y}=d,P=this.getResourceIdByParseSdp(d);i+=a;const L=this.updateReceiverPacketsLost(P,a,p);let N=0;_==="video"?v&&(N=Math.floor(v/1e3)):N=this.updateBytesRecv(P,c,t),N<0&&(N=0),s+=N,r.receivers.push({trackId:P,kind:_,packetsLostRate:L,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(m),bitrate:N,jitter:f?Math.round(1e3*f):null,codecImplementationName:null,nackCount:R,pliCount:y,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}if(l==="candidate-pair"&&d.state==="succeeded"){const h=e[d.localCandidateId],{address:a,port:c}=h,p=e[d.remoteCandidateId],{address:f,port:m,protocol:_}=p;r.iceCandidatePair={IP:a,port:c,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(e){const t=[];for(const r in e){const i=e[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 u=this.getResourceIdByParseSdp(i);t.push({trackId:u,audioLevel:null})}if(o==="inbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(i))continue;const{kind:s}=i;if(s==="video")continue;const u=this.getResourceIdByParseSdp(i);t.push({trackId:u,audioLevel:null})}}return t}}class wl extends Yo{formatRCRTCStateReport(e){const t={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);t.timestamp=r;const i=Object.keys(e);let o=0,s=0;i.filter(l=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(h))return;const a=this.getResourceIdByParseSdp(h),{mediaType:c,transportId:p,remoteId:f,packetsSent:m,bytesSent:_,trackId:v,encoderImplementation:R,pliCount:y,nackCount:P,firCount:L}=h;if(!v)return;const{audioLevel:N,frameHeight:E,frameWidth:A}=e[v];let F=this.updateBytesSent(a,_,r);F<0&&(F=0),s+=F,t.senders.push({trackId:a,kind:c,packetsLostRate:null,remoteResource:!1,audioLevel:N||N===0?gt(N):null,frameWidth:A,frameHeight:E,frameRate:null,bitrate:F,jitter:null,rtt:null,encoderImplementation:R,pliCount:y,nackCount:P,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})});let u=0;i.filter(l=>/^RTCInboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(h))return;const{trackId:a,packetsLost:c,packetsReceived:p,jitter:f,bytesReceived:m,mediaType:_,nackCount:v,pliCount:R}=h,y=this.getResourceIdByParseSdp(h);if(!a)return;const{frameHeight:P,frameWidth:L,audioLevel:N}=e[a];o+=c;const E=this.updateReceiverPacketsLost(y,c,p);let A=this.updateBytesRecv(y,m,r);A<0&&(A=0),u+=A,t.receivers.push({trackId:y,kind:_,packetsLostRate:E,remoteResource:!0,audioLevel:N||N===0?gt(N):null,frameWidth:L,frameHeight:P,frameRate:null,bitrate:A,jitter:f,codecImplementationName:null,nackCount:v,pliCount:R,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})});const d=i.filter(l=>/^RTCTransport_/.test(l))[0];if(d){const l=e[d],{selectedCandidatePairId:h}=l;if(h){const a=e[h],{availableOutgoingBitrate:c,availableIncomingBitrate:p,currentRoundTripTime:f,localCandidateId:m,remoteCandidateId:_}=a,v=e[m],{address:R,port:y}=v,P=e[_],{address:L,port:N,protocol:E}=P;t.iceCandidatePair={IP:R||null,port:y,networkType:null,remoteIP:L,remotePort:N,protocol:E,bitrateRecv:u,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:c,availableIncomingBitrate:p,totalPacketsLost:o},t.receivers.forEach(A=>{A.rtt=f})}}return t}getAudioLevelList(e){const t=[],r=Object.keys(e);return r.filter(i=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(i)).forEach(i=>{const o=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(o))return;const{trackId:s,mediaType:u}=o;if(u==="video")return;const d=this.getResourceIdByParseSdp(o),l=e[s];t.push({trackId:d,audioLevel:l||l===0?gt(l):null})}),r.filter(i=>/^RTCInboundRTP(Video|Audio)Stream_/.test(i)).forEach(i=>{const o=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(o))return;const{trackId:s,mediaType:u}=o;if(!s||u==="video")return;const{audioLevel:d}=e[s],l=this.getResourceIdByParseSdp(o);t.push({trackId:l,audioLevel:d||d===0?gt(d):null})}),t}}class Wt{constructor(e){this._peer=e,this._outboundStreams={}}static setSdpSemantics(e){const{browser:t,version:r,supportsUnifiedPlan:i}=Ge;i?/chrome/i.test(t)?this._sdpSemantics=r>92?"unified-plan":r<72?"plan-b":e:/firefox/i.test(t)?this._sdpSemantics="unified-plan":/safari/i.test(t)?this._sdpSemantics=r<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan":this._sdpSemantics="plan-b"}static getSdpSemantics(){return Wt._sdpSemantics}getOutboundVideoInfo(){const e=[];for(const t in this._outboundStreams){const r=this._outboundStreams[t].getVideoTracks()[0];if(!r)continue;const i=/_tiny$/.test(t),{width:o,height:s}=Go(r);e.push({trackId:r.id,simulcast:i?Ke.TINY:Ke.NORMAL,resolution:`${o}x${s}`})}return e}setRemoteAnswer(e){return H(this,void 0,void 0,function*(){e=e.replace(/\s+\r\n/g,`\r
- `);try{yield this._peer.setRemoteDescription({type:"answer",sdp:e})}catch(t){return M.error(t),w.SET_REMOTE_DESCRIPTION_FAILED}return w.SUCCESS})}getStatParsr(e,t){return/chrome/i.test(Ge.browser)?new Ol(e,t):/Firefox/i.test(Ge.browser)?new Nl(e,t):/Safari/i.test(Ge.browser)?new wl(e,t):null}}class Ml extends Wt{constructor(){super(...arguments),this.senders={},this._localTracks=[]}addLocalTrack(e){this._localTracks.includes(e)||this._localTracks.push(e);const t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),i=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);i.getTracks().forEach(u=>{u.kind===r.kind&&i.removeTrack(u)}),i.addTrack(r);const o=e.getTrackId(),s=this.senders[o];s?s.replaceTrack(r):this.senders[o]=this._peer.addTrack(r,i)}removeLocalTrack(e){const t=this._localTracks.findIndex(o=>o===e);t>=0&&this._localTracks.splice(t,1);const r=e.getTrackId(),i=this.senders[r];i&&(i.replaceTrack(null),this._peer.removeTrack(i),delete this.senders[r])}updateSubRemoteTracks(e){}updateRecvTransceiverMap(e,t){}setBitrate(e,t,r){this._maxBitrate=e,this._minBitrate=t,this._startBitrate=r||.7*e}createOffer(e){return H(this,void 0,void 0,function*(){const t=yield this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});for(const r in this._outboundStreams){const i=this._outboundStreams[r].id;t.sdp=t.sdp.replace(new RegExp(i,"g"),r)}return yield this._peer.setLocalDescription(t),{type:"offer",semantics:"plan-b",sdp:t.sdp}})}setRemoteAnswer(e){let t=0,r=0;this._localTracks.forEach(u=>{const{min:d,max:l}=u.getBitrate();r+=d,t+=l}),t=this._maxBitrate&&this._maxBitrate>0?Math.min(t,this._maxBitrate):t,r=this._minBitrate&&this._minBitrate>0?Math.max(r,this._minBitrate):r;const i=this._startBitrate||Math.round(.7*t),o=`b=AS:${t}`;e=e.replace(/[\r\n]+m=video[^\r\n]+/,u=>`${u}\r
- ${o}`);const s=[`;x-google-min-bitrate=${r}`,`;x-google-max-bitrate=${t}`,`;x-google-start-bitrate=${i}`].join("");return e=e.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,u=>u+s),super.setRemoteAnswer(e)}}class Al extends Wt{constructor(){super(...arguments),this._sendTransceiver={},this._localTracks={},this._recvAudio=[],this._recvVideo=[],this._recvTransceiver={},this._subedTracks=[]}setBitrate(e,t,r){M.warn("the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}addLocalTrack(e){const t=e.getTrackId(),r=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[t]=e;const o=this._outboundStreams[r]||(this._outboundStreams[r]=new MediaStream);o.getTracks().forEach(u=>{u.kind===i.kind&&o.removeTrack(u)}),o.addTrack(i);const s=this._sendTransceiver[t];s?(s.sender.replaceTrack(i),s.direction="sendonly"):this._sendTransceiver[t]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]})}removeLocalTrack(e){const t=e.getTrackId(),r=e.getStreamId();e.__innerGetMediaStreamTrack(),delete this._localTracks[t];const i=this._sendTransceiver[t];if(!i)return;i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null);const o=this._outboundStreams[r];(e.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach(l=>o.removeTrack(l));const s=this._sendTransceiver[`${t}_tiny`];if(!s||s.direction==="inactive")return;s.direction="inactive";const u=s.sender,d=u.track;this._peer.removeTrack(u),u.replaceTrack(null),this._outboundStreams[`${r}_tiny`].removeTrack(d),d.stop()}updateRecvTransceiverMap(e,t){const{mediaType:r}=Pe(e);this._recvTransceiver[e]=t;const i=r===he.AUDIO_ONLY?this._recvAudio:this._recvVideo,o=i.findIndex(s=>s===t);o>=0&&i.splice(o,1)}updateSubRemoteTracks(e){const t=e.slice(),r=this._subedTracks.slice();this._subedTracks=e.slice();for(let o=t.length-1;o>=0;o-=1){const s=t[o],u=r.findIndex(d=>d===s);u>=0&&(t.splice(o,1),r.splice(u,1))}r.length&&r.forEach(o=>{const s=o.getTrackId();o.__innerSetMediaStreamTrack(void 0);const u=this._recvTransceiver[s];u&&(u.direction="inactive")});const i={audio:0,video:0};t.length&&t.forEach(o=>{const s=o.isAudioTrack()?"audio":"video",u=this._recvTransceiver[o.getTrackId()];u?u.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(e){return H(this,void 0,void 0,function*(){const t=yield this._peer.createOffer({iceRestart:e});let r=t.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`),t.sdp=r,yield this._peer.setLocalDescription(t),{type:"offer",semantics:"unified-plan",sdp:r}})}setRemoteAnswer(e){e=e.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 u="";for(const f in this._sendTransceiver)if(this._sendTransceiver[f].mid===s){u=f;break}if(!u)return r;const d=(i=this._localTracks[u])===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,c=[];if(l&&l>0&&c.push(`;x-google-max-bitrate=${l}`),h&&h>0&&c.push(`;x-google-min-bitrate=${h}`),a>0&&c.push(`;x-google-start-bitrate=${a}`),c.length===0)return r;const p=c.join("");return r.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,f=>f+p)}).join(`\r
- `);const t=/[\r\n]+\r\n[\r\n]+/g;return t.test(e)&&(M.warn(`answer sdp invalid -> ${JSON.stringify(e)}`),e=e.replace(t,`\r
- `)),super.setRemoteAnswer(e)}}class at extends On{constructor(e,t){super(),this._reTryExchange=e,this._polarisReport=t,this.pubLocalTracks={},this._reTryExchangeTimer=null,this._reportStatsTimer=null,this._reportListener=null;const r=Wt.getSdpSemantics(),i=this._rtcPeerConn=new RTCPeerConnection({sdpSemantics:r});this._sdpStrategy=r==="plan-b"?new Ml(i):new Al(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(){M.info(`onconnectionstatechange -> ${this._rtcPeerConn.connectionState}`)}_onICEConnectionStateChange(){var e,t;M.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"||(M.warn("iceconenction state is `failed`, exchange SDP to try again."),this._reTryExchange(),this._reTryExchangeTimer=setInterval(this._reTryExchange,15e3));try{(t=(e=this._reportListener)===null||e===void 0?void 0:e.onICEConnectionStateChange)===null||t===void 0||t.call(e,this._rtcPeerConn.iceConnectionState)}catch(r){M.error("onICEConnectionStateChange error",r)}}_onTrackReady(e){if(!e.streams.length)return;const t=[e.streams[0].id,e.receiver.track.kind==="audio"?he.AUDIO_ONLY:he.VIDEO_ONLY].join("_");this._updateRecvTransceiverMap(t,e.transceiver),this.emit(at.__INNER_EVENT_TRACK_READY__,e)}setBitrate(e,t,r){return H(this,void 0,void 0,function*(){this._sdpStrategy.setBitrate(e,t,r)})}createOffer(e){return H(this,void 0,void 0,function*(){const t=yield this._sdpStrategy.createOffer(e);return M.debug(`offer -> ${JSON.stringify(t.sdp)}`),t})}setRemoteAnswer(e){return H(this,void 0,void 0,function*(){return M.debug(`answer -> ${JSON.stringify(e)}`),this._sdpStrategy.setRemoteAnswer(e)})}getLocalTrack(e){return this.pubLocalTracks[e]||null}addLocalTrack(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(de.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(de.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(de.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(de.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}removeLocalTrackById(e){const t=this.getLocalTrack(e);t&&this.removeLocalTrack(t)}removeAllLocalTrack(){Object.keys(this.pubLocalTracks).forEach(e=>{/_tiny$/.test(e)||this.removeLocalTrackById(e)})}removeLocalTrack(e){const t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(de.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(de.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);const r=`${t}_tiny`,i=this.getLocalTrack(r);i&&(this._sdpStrategy.removeLocalTrack(i),delete this.pubLocalTracks[r],i.destroy())}_updateRecvTransceiverMap(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}updateSubRemoteTracks(e){this._sdpStrategy.updateSubRemoteTracks(e)}getOutboundVideoInfo(){return this._sdpStrategy.getOutboundVideoInfo()}_onLocalTrackMuted(e){const t=this.getLocalTrack(`${e.getTrackId()}_tiny`);t&&(t.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(de.__INNER_EVENT_MUTED_CHANGE__,e)}_onLocalTrackDestroied(e){this.emit(de.__INNER_EVENT_DESTROY__,e)}registerReportListener(e){this._reportListener=e}_createRCRTCStateReport(e){const{timestamp:t,iceCandidatePair:r,senders:i,receivers:o}=JSON.parse(JSON.stringify(e));r==null||delete r.totalPacketsLost;for(const s in r)Fi(r[s])&&delete r[s];return{timestamp:t,iceCandidatePair:r,senders:i.map(s=>{const u={};return s.trackId&&(u.trackId=s.trackId),s.kind&&(u.kind=s.kind),(s.packetsLostRate||s.packetsLostRate===0)&&(u.packetsLostRate=s.packetsLostRate),u.remoteResource=s.remoteResource,(s.audioLevel||s.audioLevel===0)&&(u.audioLevel=s.audioLevel),s.frameWidth&&(u.frameWidth=s.frameWidth),s.frameHeight&&(u.frameHeight=s.frameHeight),s.frameRate&&(u.frameRate=s.frameRate),(s.bitrate||s.bitrate===0)&&(u.bitrate=s.bitrate),s.jitter&&(u.jitter=s.jitter),u}),receivers:o.map(s=>{const u={};return s.trackId&&(u.trackId=s.trackId),s.kind&&(u.kind=s.kind),(s.packetsLostRate||s.packetsLostRate===0)&&(u.packetsLostRate=s.packetsLostRate),u.remoteResource=s.remoteResource,(s.audioLevel||s.audioLevel===0)&&(u.audioLevel=s.audioLevel),s.frameWidth&&(u.frameWidth=s.frameWidth),s.frameHeight&&(u.frameHeight=s.frameHeight),s.frameRate&&(u.frameRate=s.frameRate),(s.bitrate||s.bitrate===0)&&(u.bitrate=s.bitrate),s.jitter&&(u.jitter=s.jitter),u})}}_getStatsData(){var e,t;return H(this,void 0,void 0,function*(){const r=yield this._rtcPeerConn.getStats(),i=(e=this.reportParser)===null||e===void 0?void 0:e.parseRTCStatsReport(r);return(t=this.reportParser)===null||t===void 0?void 0:t.formatRCRTCStateReport(i)})}getAudioLevelReportData(){var e,t;return H(this,void 0,void 0,function*(){const r=yield this._rtcPeerConn.getStats(),i=(e=this.reportParser)===null||e===void 0?void 0:e.parseRTCStatsReport(r);return i?(t=this.reportParser)===null||t===void 0?void 0:t.getAudioLevelList(i):[]})}_reportHandle(){var e,t,r;return H(this,void 0,void 0,function*(){const i=yield this._getStatsData();if(!i)return;(i.senders.length||i.receivers.length)&&((e=this._polarisReport)===null||e===void 0||e.sendR3R4Data(i));const o=this._createRCRTCStateReport(i);(r=(t=this._reportListener)===null||t===void 0?void 0:t.onStateReport)===null||r===void 0||r.call(t,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 Vt,Cr,mt,_t,yr;at.__INNER_EVENT_TRACK_READY__="inner-track-ready",function(n){n[n.DISABLE=0]="DISABLE",n[n.ENABLE=1]="ENABLE"}(Vt||(Vt={})),function(n){n[n.MeetingOrAnchor=1]="MeetingOrAnchor",n[n.Audience=2]="Audience"}(Cr||(Cr={}));class Yc{constructor(e,t,r,i,o=Cr.MeetingOrAnchor){this._context=e,this._runtime=t,this._roomId=r,this._crtRTCRoom=i,this._userRole=o}_send(e){this._context.getConnectionStatus()===se.CONNECTED&&this._context.setRTCState(this._roomId,e)}_getClientID(){const e="uuid";let t=this._runtime.localStorage.getItem(e);return t||(t=Il(),this._runtime.localStorage.setItem(e,t)),t}_getRealResourceId(e){let t=e;const r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}_getPolarisTrackId(e){let t="";const r=e.split("_");if(e.includes("_tiny")){const i=r.pop(),o=parseInt(r.pop())===he.AUDIO_ONLY?"audio":"video",s=r.pop();t=[r.join("_"),s,i,o].join("_")}else{const i=parseInt(r.pop())===he.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}sendR3R4Data(e){const{iceCandidatePair:t,senders:r,receivers:i}=e,o=(t==null?void 0:t.bitrateSend)||-1,s=(t==null?void 0:t.bitrateRecv)||-1,u=(t==null?void 0:t.networkType)||"unknown",d=(t==null?void 0:t.rtt)||-1,l=`${(t==null?void 0:t.IP)||-1}:${t==null?void 0:t.port}`,h=(t==null||t.remoteIP,t==null||t.remotePort,(t==null?void 0:t.availableIncomingBitrate)||-1),a=(t==null?void 0:t.availableOutgoingBitrate)||-1,c=(t==null?void 0:t.totalPacketsLost)||-1,p=this._context.getCurrentId();let f=`R3 ${o} -1 -1 -1 ${u} ${d} ${l} ${h} ${a} ${c} ${p}\r`,m=`R4 ${s} -1 -1 -1 ${u} ${d} ${l} ${h} ${a} ${c} ${p}\r`;const _=r.map(R=>{var y;const{trackId:P,audioLevel:L,samplingRate:N,bitrate:E,packetsLostRate:A,frameRate:F,frameWidth:q,frameHeight:C,googRenderDelayMs:T,jitter:S,nackCount:O,pliCount:I,rtt:U,googFirsSent:D,encoderImplementation:$}=R,j=this._getPolarisTrackId(P),J=this._getRealResourceId(P);return{trackId:j,googCodecName:$||String(-1),audioLevel:L||L===0?L:-1,bitrate:E||E===0?E:-1,packetsLostRate:A||A===0?A:-1,frameRate:F||-1,resolution:q&&C?`${q} * ${C}`:"-1",jitter:S||-1,nackCount:O||O===0?O:-1,pliCount:I||I===0?I:-1,rtt:U||-1,googFirsSent:D,samplingRate:N,googRenderDelayMs:T,encoderImplementation:$||String(-1),trackState:((y=this._crtRTCRoom.getLocalTrack(J))===null||y===void 0?void 0:y.isLocalMuted())?Vt.DISABLE:Vt.ENABLE}}),v=i.filter(R=>!!R.trackId).map(R=>{var y;const{trackId:P,audioLevel:L,samplingRate:N,bitrate:E,packetsLostRate:A,frameRate:F,frameWidth:q,frameHeight:C,googRenderDelayMs:T,jitter:S,nackCount:O,pliCount:I,rtt:U,googFirsReceived:D,codecImplementationName:$}=R,j=this._getPolarisTrackId(P),J=this._getRealResourceId(P);return{trackId:j,googCodecName:$||String(-1),audioLevel:L||L===0?L:-1,bitrate:E||E===0?E:-1,packetsLostRate:A||A===0?A:-1,frameRate:F||-1,resolution:q&&C?`${q} * ${C}`:"-1",jitter:S||-1,nackCount:O||O===0?O:-1,pliCount:I||I===0?I:-1,rtt:U||-1,googFirsReceived:D,samplingRate:N,googRenderDelayMs:T,codecImplementationName:$||String(-1),trackState:((y=this._crtRTCRoom.getRemoteTrack(J))===null||y===void 0?void 0:y.isLocalMuted())?Vt.DISABLE:Vt.ENABLE}});f+=_.map(R=>`${R.trackId} ${R.googCodecName} ${R.audioLevel} ${R.samplingRate} ${R.bitrate} ${R.packetsLostRate} ${R.frameRate} ${R.resolution} ${R.googRenderDelayMs} ${R.jitter} ${R.nackCount} ${R.pliCount} ${R.rtt} ${R.googFirsSent} ${R.encoderImplementation} ${R.trackState}`).join(`
- `),e.senders.length&&this._send(f+`\r${this._userRole}`),m+=v.map(R=>`${R.trackId} ${R.googCodecName} ${R.audioLevel} ${R.samplingRate} ${R.bitrate} ${R.packetsLostRate} ${R.frameRate} ${R.resolution} ${R.googRenderDelayMs} ${R.jitter} ${R.nackCount} ${R.pliCount} ${R.rtt} ${R.googFirsReceived} ${R.codecImplementationName} ${R.trackState}`).join(`
- `),e.receivers.length&&this._send(m+`\r${this._userRole}`)}sendR1(){const e=`R1 5.3.1 ${this._context.getCoreVersion()} web ${navigator.platform} -1 ${Ge.browser} ${Ge.version} ${this._getClientID()} ${this._userRole}`;this._send(e)}sendR2(e,t,r){const i=`R2 ${e} ${t} ${this._getClientID()}\r${r.join(" ")}\r${this._userRole}`;this._send(i)}}(function(n){n.PUBLISH="publish",n.SUBSCRIBE="subscribe"})(mt||(mt={})),function(n){n.BEGIN="begin",n.END="end"}(_t||(_t={}));class zc{constructor(e){this._room=e,this._audioLevelChangeHandler=null,this._timer=null,this._pc=this._room.__getPC()}_audioLevelReport(){return H(this,void 0,void 0,function*(){if(this._pc.getRTCPeerConn().iceConnectionState==="new"||!this._audioLevelChangeHandler)return;const e=(yield this._pc.getAudioLevelReportData()).map(t=>{const{userId:r}=Bl.parseTrackId(t.trackId);return{track:this._room.getCrtUserId()===r?this._room.getLocalTrack(t.trackId):this._room.getRemoteTrack(t.trackId),audioLevel:t.audioLevel||0}}).filter(t=>t.track);this._audioLevelChangeHandler(e)})}onAudioLevelChange(e,t){t<300||t>1e3?M.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000'):e?(this._audioLevelChangeHandler=e,this._timer=setInterval(this._audioLevelReport.bind(this),t)):this._audioLevelChangeHandler=null}clearAudioLevelReportTimer(){this._timer&&(clearInterval(this._timer),this._timer=null)}}(function(n){n[n.ANCHOR=1]="ANCHOR",n[n.AUDIENCE=2]="AUDIENCE"})(yr||(yr={}));const cn=n=>n instanceof qo?n.getTrackId():n.track.getTrackId();class Jc{constructor(e,t,r,i,o,s,u,d,l,h){this._context=e,this._runtime=t,this._roomId=r,this._roomMode=o,this._service=s,this._initOptions=u,this._ntfClearRoomItem=d,this._isMainRoom=h,this._remoteTracks={},this._subscribedList=[],this._destroyed=!1,this.msgTaskQueue=new ac,this._appListener=null,this._onRecvPKMsg=null,this._token=i.token,this._sessionId=i.sessionId,this._roomResources=l?{}:$i(i),this._initRemoteTracks();const a=this._context.getCurrentId(),c=this._roomResources[a]=this._roomResources[a]||[];M.debug(`room data -> ${JSON.stringify(this._roomResources)}`),c.length>0&&ve(()=>this._unpublishPrev(c)),l&&this._afterChangedRole(i),this._pinger=new bl(r,this._roomMode,e,this._initOptions.pingGap),this._pinger.onFailed=this._kickoff.bind(this),this._pinger.onPingResult=this._handlePingResult.bind(this),this._pinger.start(),this._polarisReport=new Yc(this._context,this._runtime,this._roomId,this),this._polarisReport.sendR1(),this._pc=new at(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(at.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.on(de.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),this._pc.on(de.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}_initRemoteTracks(){const e=this._context.getCurrentId();for(const t in this._roomResources){const r=this._roomResources[t];t!==e&&r.length!==0&&r.forEach(i=>{const o=ue(i),{tag:s,userId:u,mediaType:d}=Pe(o),l=d===he.AUDIO_ONLY?new pt(s,u):new ft(s,u);l.__innerSetRemoteMuted(i.state===0),this._remoteTracks[o]=l})}}_handlePingResult(e){this._callAppListener("onPing",e)}setBitrate(e,t,r){M.warn("`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),Ie("max",e,i=>_e(i)&&i>Math.max(t||1,200),!0),Ie("min",t,i=>_e(i)&&i>=1&&(!_e(e)||i<e),!0),Ie("start",r,i=>_e(i)&&i>t&&i<=e),this._pc.setBitrate(e,t,r)}_onTrackReady(e){const t=e.streams[0].id,r=e.receiver.track,i=[t,r.kind==="audio"?he.AUDIO_ONLY:he.VIDEO_ONLY].join("_"),o=this._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(r),this._callAppListener("onTrackReady",o)):M.warn(`cannot found remote track ${r.id}`)}_callAppListener(e,...t){var r;const i=(r=this._appListener)===null||r===void 0?void 0:r[e];if(i)try{i(...t)}catch(o){M.error(o)}}_onUserUnpublish(e){return H(this,void 0,void 0,function*(){yield this.unsubscribe(e),e.forEach(t=>{t.__innerDestroy(),delete this._remoteTracks[t.getTrackId()]}),this._onTrackUnpublish(e)})}_onTrackUnpublish(e){this._callAppListener("onTrackUnpublish",e)}_unpublishPrev(e){return H(this,void 0,void 0,function*(){const t=e.slice();e.length=0,M.info(`unpublish uris prev login: ${JSON.stringify(t)}`);const r=yield this._context.setRTCTotalRes(this._roomId,Jn(ae.UNPUBLISH,t),Et([]),ae.TOTAL_CONTENT_RESOURCE,Et([]));r!==b.SUCCESS?M.error(`unpublish prev uris failed -> code: ${r}`):M.debug("unpublish uris prev login succeed")})}__parseInnerMessage(e){const{targetId:t,conversationType:r}=e;if(r!==ee.RTC_ROOM)return!1;if(t!==this._roomId)return!0;M.info(`recv inner msg -> message: ${JSON.stringify(e)} | roomid: ${this._roomId}`);const i=e.content;switch(e.messageType){case ae.KICK:this._kickoff(!0,i);break;case ae.STATE:this.msgTaskQueue.push(()=>this._stateHandle(i));break;case ae.MODIFY:case ae.PUBLISH:case ae.UNPUBLISH:case ae.TOTAL_CONTENT_RESOURCE:this.msgTaskQueue.push(()=>this._resourceHandle(i,e.messageType,e.senderUserId));break;case ae.ROOM_NOTIFY:this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case ae.USER_NOTIFY:M.warn(`TODO: ${ae.USER_NOTIFY}`);break;case ae.PK_INVITE:case ae.PK_CANCEL_INVITE:case ae.PK_INVITE_TIMEOUT:case ae.PK_INVITE_ANSWER:case ae.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case ae.OTHER_ROOM_OFFLINE:break;default:this._callAppListener("onMessageReceive",e.messageType,e.content,e.senderUserId,e.messageUId)}return!0}_kickoff(e,t){let r;M.warn(`onKickOff -> byServer: ${e}`),this._ntfClearRoomItem(),this._leaveHandle(!e),e&&((t==null?void 0:t.users)||[]).forEach(i=>{i.userId===this._context.getCurrentId()&&(r=i.type)}),this._callAppListener("onKickOff",e,r)}_rtcpeerClosed(){this._ntfClearRoomItem(),this._leaveHandle(!0),this._callAppListener("onRTCPeerConnectionCloseByException")}_resourceHandle(e,t,r){return H(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return void M.warn(`room has been destroyed. -> roomId: ${this._roomId}`);const{uris:i,ignore:o}=e;if(o||!i)return;const s=[],u=[],d=[];let l;const h=this._roomResources[r]||(this._roomResources[r]=[]);switch(t){case ae.MODIFY:d.push(...i);break;case ae.PUBLISH:s.push(...i);break;case ae.UNPUBLISH:u.push(...i);break;case ae.TOTAL_CONTENT_RESOURCE:l=nr(h,i),s.push(...l.publishedList),u.push(...l.unpublishedList),d.push(...l.modifiedList)}if(s.length>0){const a=h.map(ue),c=[],p=[];if(s.forEach(f=>{const m=ue(f),_=a.indexOf(m),{userId:v,tag:R,mediaType:y}=Pe(m);_>-1?h[_]=f:h.push(f);let P=this._remoteTracks[m];P?P.isSubscribed()&&c.push(P):(P=y===he.AUDIO_ONLY?new pt(R,v):new ft(R,v),this._remoteTracks[m]=P,p.push(P)),P.__innerSetRemoteMuted(f.state===0)}),c.length){const f=c.map(_=>_.getTrackId());M.debug(`resub tracks -> ${JSON.stringify(f)}`);const{code:m}=yield ve(()=>this.__subscribe(c,!0));m!==w.SUCCESS&&M.error(`resub tracks failed -> code: ${m}, ids: ${JSON.stringify(f)}`)}this._onTrackPublish(p)}if(u.length>0){const a=u.map(ue);for(let p=h.length-1;p>=0;p-=1){const f=h[p];a.includes(ue(f))&&h.splice(p,1)}const c=u.map(p=>{const f=ue(p);return this._remoteTracks[f]});yield this._onUserUnpublish(c)}if(d.length>0){const a=h.map(ue);for(let c=0;c<d.length;c+=1){const p=d[c],f=ue(p),m=a.indexOf(f);h[m].state=p.state;const _=this._remoteTracks[f];_.__innerSetRemoteMuted(p.state===0),_.isAudioTrack()?this._onAudioMuteChange(_):this._onVideoMuteChange(_)}}})}_onTrackPublish(e){this._callAppListener("onTrackPublish",e)}_stateHandle(e){var t;return H(this,void 0,void 0,function*(){const{users:r}=e;if(r.length===0)return;const i=[],o=[],s=[],u=[];r.forEach(h=>{+h.state==0?(M.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]||[]):(M.debug(`user left -> ${h.userId}`),h.switchRoleType?u.push(h.userId):o.push(h.userId))});const d=[...i,...s],l=[...o,...u];if(l.length){const h=[],a=[];l.forEach(c=>{h.push(...this.getRemoteTracksByUserId(c)),a.push(c)}),h.length&&(yield this.unsubscribe(h),h.forEach(c=>delete this._remoteTracks[c.getTrackId()])),a.length&&a.forEach(c=>delete this._roomResources[c])}if((t=this._appListener)===null||t===void 0?void 0:t.onSwitchRole)return s.length&&s.forEach(h=>this._callAppListener("onSwitchRole",h,yr.ANCHOR)),u.length&&u.forEach(h=>this._callAppListener("onSwitchRole",h,yr.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 e=this._context.getCurrentId();return Object.keys(this._roomResources).filter(t=>t!==e)}getRemoteTracks(){const e=[];return this.getRemoteUserIds().forEach(t=>{e.push(...this.getRemoteTracksByUserId(t))}),e}getRemoteTracksByUserId(e){const t=[];for(const r in this._remoteTracks){const i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}getSessionId(){return this._sessionId}sendMessage(e,t){return H(this,void 0,void 0,function*(){const{code:r}=yield this._context.sendMessage(ee.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});return r!==b.SUCCESS?(M.error(`send message failed -> code: ${r}`),{code:w.SIGNAL_ERROR}):{code:w.SUCCESS}})}setRoomAttribute(e,t,r,i=!1){return H(this,void 0,void 0,function*(){const o=yield this._context.setRTCData(this._roomId,e,t,i,nt.ROOM,r);return o!==b.SUCCESS?(M.error(`SetRoomAttributeValue Failed: ${o}`),{code:w.SIGNAL_ERROR}):{code:w.SUCCESS}})}deleteRoomAttributes(e,t,r=!1){return H(this,void 0,void 0,function*(){const i=yield this._context.removeRTCData(this._roomId,e,r,nt.ROOM,t);return i!==b.SUCCESS?(M.error(`DeleteRoomAttribute Failed: ${i}`),{code:w.SIGNAL_ERROR}):{code:w.SUCCESS}})}getRoomAttributes(e=[],t=!1){return H(this,void 0,void 0,function*(){const{code:r,data:i}=yield this._context.getRTCData(this._roomId,e,t,nt.ROOM);return r!==b.SUCCESS?(M.error(`GetRoomAttributes Failed: ${r}`),{code:w.SIGNAL_ERROR}):{code:w.SUCCESS,data:i}})}_setUserAttributeValue(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,nt.PERSON,r)}_deleteUserAttributes(e,t){return this._context.removeRTCData(this._roomId,e,!1,nt.PERSON,t)}_getUserAttributes(e){return this._context.getRTCData(this._roomId,e,!1,nt.PERSON)}isDestroyed(){return this._destroyed}__destroy(e){return this._leaveHandle(e)}_leaveHandle(e){var t;return H(this,void 0,void 0,function*(){this._destroyed||(this._destroyed=!0,(t=this._audioLevelReport)===null||t===void 0||t.clearAudioLevelReportTimer(),e&&(yield this._context.quitRTCRoom(this._roomId)),this._isMainRoom&&this._quitAllPKRoom(),this._pc.removeAllLocalTrack(),this._pinger.stop(),this._isMainRoom&&(yield this._service.exit(this._getRTCReqestHeaders())),this._pc.destroy(),this._polarisReport=null,this._removeRemoteTracks())})}_onLocalTrackDestroied(e){e instanceof qt&&e.__isTiny()||this.unpublish([e])}_onLocalTrackMuted(e){return H(this,void 0,void 0,function*(){const t=e.getTrackId(),r=this._context.getCurrentId(),i=[{resourceId:t,enabled:!e.isLocalMuted()}],o=this._roomResources[r]||[],s=[];for(let d=0;d<o.length;d+=1){const l=o[d],h=ue(l),a=i.findIndex(c=>c.resourceId===h);if(a>=0){const{enabled:c}=i[a];l.state=c?1:0,s.push(l);break}}const u=yield ve(()=>this._context.setRTCTotalRes(this._roomId,Jn(ae.MODIFY,s),Et(o),ae.TOTAL_CONTENT_RESOURCE));u!==b.SUCCESS&&M.error("notice `track.enabled` change failed -> code: "+u)})}_removePubFailedTracks(e){e.forEach(t=>{const r=t instanceof de?t:t.track;M.debug(`remove pub failed track from peerconnection -> trackId: ${r.getTrackId()}`),this._pc.removeLocalTrackById(r.getTrackId())})}publish(e){return H(this,void 0,void 0,function*(){return ve(()=>this.__publish(e))})}__publish(e){return H(this,void 0,void 0,function*(){if(!this._isMainRoom&&this instanceof vt)return M.error("the `publish` is disabled in PK room "),{code:w.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(this._assertRoomDestroyed())return M.error(`publish failed, room has been destroyed. -> roomId: ${this._roomId}`),{code:w.ROOM_HAS_BEEN_DESTROYED};if(!me("tracks",e,()=>Ue(e)&&e.length>0&&e.every(y=>y instanceof de||y.track instanceof de),!0))return M.error(`publish failed, tracks is invalid -> roomId: ${this._roomId}`),{code:w.PARAMS_ERROR};const t=this._context.getCurrentId();if(this._pc.getLocalTracks().length+(y=>{let P=0;return y.forEach(L=>{L instanceof de?P++:L.pubTiny&&L.track.isVideoTrack()?P+=2:P++}),P})(e)>10)return M.error(`publish failed, tracks limit exceeded -> roomId: ${this._roomId}`),{code:w.PUBLISH_TRACK_LIMIT_EXCEEDED};M.debug(`publish tracks -> roomId: ${this._roomId}, tracks: ${e.map(cn)}`),e.forEach(y=>{const{track:P,pubTiny:L}=y instanceof de?{pubTiny:!1,track:y}:y;if(this._pc.addLocalTrack(P),P.isVideoTrack()&&L){let N;try{N=P.__innerGetMediaStreamTrack().clone();const E=L.frameRate||Qe.FPS_15,A=L.resolution||ge.W176_H144,{width:F,height:q}=it(A),C=ot(E);N.applyConstraints({width:F,height:q,frameRate:C})}catch(E){return N==null||N.stop(),void M.warn(`pubTiny failed -> id: ${P.getTrackId()}, msg: ${E.message}`)}this._pc.addLocalTrack(new qt(P.getTag(),P.getUserId(),N,!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!==w.SUCCESS)return M.error(`publish failed -> roomId: ${this._roomId}, code: ${o.code}`),this._removePubFailedTracks(e),{code:o.code};const{publishList:s,sdp:u,resultCode:d,message:l,urls:h,mcuPublishList:a}=o.data;if(d!==w.SUCCESS)return M.error(`publish failed -> roomId: ${this._roomId}, code: ${d}, msg: ${l}`),this._removePubFailedTracks(e),{code:d};const c=yield this._pc.setRemoteAnswer(u.sdp);if(c!==w.SUCCESS)return{code:c};const p=this._roomResources[t],f=s.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:this._getResourceState(ue(y))},y)),{publishedList:m}=nr(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,Jn(ae.PUBLISH,m),Et(f),ae.TOTAL_CONTENT_RESOURCE,Et(_));if(v!==b.SUCCESS)return M.error(`send publish streams notification failed: ${v}`),{code:w.SIGNAL_ERROR};this._roomResources[t]=f;const R=m.map(y=>ue(y));return this._polarisReport&&this._polarisReport.sendR2(mt.PUBLISH,_t.BEGIN,R),e.forEach(y=>{const{track:P}=y instanceof de?{track:y}:y;P.__innerSetPublished(!0)}),M.debug(`publish success: ${R.join(",")}`),this._roomMode===Le.LIVE?{code:w.SUCCESS,liveUrl:h==null?void 0:h.liveUrl}:{code:w.SUCCESS}})}_getPushOtherRoomsParams(){if(this instanceof vt){const{code:e,roomPKHandler:t}=this.getRoomPKHandler(),r=[];if(e===w.SUCCESS&&t){const i=t.getJoinedPKRooms();for(const o in i){const s=i[o].getSessionId(),u=t.getPKInfo(o);if(!u)return;const{inviterUserAutoMix:d,inviteeUserAutoMix:l,inviterUserId:h}=u,a=this._context.getCurrentId()===h;r.push({roomId:o,sessionId:s,autoMix:a?!!d:!!l})}}return r}}_reTryExchange(){return H(this,void 0,void 0,function*(){ve(()=>H(this,void 0,void 0,function*(){const e=yield this._createExchangeParams(this._subscribedList,!0),t=this._getPushOtherRoomsParams();t&&(e.pushOtherRooms=t);const r=yield this._exchangeHandle(e);if(r.code!==w.SUCCESS)return M.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==w.SUCCESS)return M.error(`reTryExchange failed: ${o}`),{code:o};this._pc.clearReTryExchangeTimer();const s=yield this._pc.setRemoteAnswer(i.sdp);return s!==w.SUCCESS?{code:s}:void 0}))})}_exchangeHandle(e){return this._service.exchange(this._getRTCReqestHeaders(),e)}_getRTCReqestHeaders(){return{"App-Key":this._context.getAppkey(),RoomId:this._roomId,Token:this._token,RoomType:this._roomMode,UserId:this._context.getCurrentId()}}_createExchangeParams(e,t){return H(this,void 0,void 0,function*(){return{sdp:yield this._pc.createOffer(t),extend:JSON.stringify({resolutionInfo:this._pc.getOutboundVideoInfo()}),subscribeList:e.filter(r=>{const i=r.track.getTrackId(),{userId:o}=Pe(i);return this._roomResources[o]?this._roomResources[o].filter(u=>i===`${u.msid}_${u.mediaType}`).length:!1}).map(r=>({simulcast:r.subTiny?Ke.TINY:Ke.NORMAL,resolution:"",uri:this._getResourceById(r.track.getTrackId()).uri})),switchstream:!1}})}_getResourceState(e){var t;return((t=this.getLocalTrack(e))===null||t===void 0?void 0:t.isLocalMuted())?0:1}unpublish(e){return H(this,void 0,void 0,function*(){return ve(()=>this.__unpublish(e))})}__unpublish(e){var t;return H(this,void 0,void 0,function*(){if(!this._isMainRoom&&this instanceof vt)return M.error("the `unpublish` is disabled in PK room "),{code:w.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(this._assertRoomDestroyed())return M.warn(`room has been destroyed, no need to unpublish tracks -> roomId: ${this._roomId}`),{code:w.SUCCESS};const r=this._context.getCurrentId();if(!me("tracks",e,()=>e.every(y=>y.getUserId()===r&&y instanceof de),!0))return M.warn(`unpublish failed, tracks is invalid -> roomId: ${this._roomId}, tracks: ${e.map(cn)}`),{code:w.PARAMS_ERROR};const i=e.map(y=>y.getTrackId()),o=i.map(this._getResourceById.bind(this)).filter(y=>!!y);if(o.length===0)return{code:w.SUCCESS};const s=this._roomResources[r].filter(y=>!o.includes(y));i.forEach(y=>this._pc.removeLocalTrackById(y)),(t=this._polarisReport)===null||t===void 0||t.sendR2(mt.PUBLISH,_t.END,i),this._pc.clearReTryExchangeTimer();const u=yield this._createExchangeParams(this._subscribedList,!1),d=this._getPushOtherRoomsParams();d&&(u.pushOtherRooms=d);const l=yield this._exchangeHandle(u);if(l.code!==w.SUCCESS)return M.error(`exchange failed -> code: ${l.code}`),{code:l.code};const{publishList:h,sdp:a,resultCode:c,message:p,mcuPublishList:f}=l.data;c!==w.SUCCESS&&M.error(`unpublish streams failed -> code: ${c}, msg: ${p}`);const m=f?f.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:1},y)):[],_=yield this._context.setRTCTotalRes(this._roomId,Jn(ae.UNPUBLISH,o),Et(s),ae.TOTAL_CONTENT_RESOURCE,Et(m));if(_!==b.SUCCESS)return M.error("send unpublish notification failed:",_),{code:w.SIGNAL_ERROR};M.debug(`unpublish success -> tracks: ${i.join(",")}`);const v=yield this._pc.setRemoteAnswer(a.sdp);if(v!==w.SUCCESS)return{code:v};const R=h.map(y=>Object.assign({tag:y.msid.split("_").pop(),state:this._getResourceState(ue(y))},y));return this._roomResources[r]=R,{code:w.SUCCESS}})}_getResourceById(e){const{userId:t}=Pe(e);return this._roomResources[t].find(r=>ue(r)===e)}_isValidResourceId(e){var t;const{userId:r}=Pe(e);return!!((t=this._roomResources[r])===null||t===void 0?void 0:t.find(i=>ue(i)===e))}subscribe(e){return H(this,void 0,void 0,function*(){return ve(()=>this.__subscribe(e,!1))})}__subscribe(e,t=!1){var r;return H(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return M.error(`subscribe failed, room has been destroyed -> roomId: ${this._roomId}`),{code:w.ROOM_HAS_BEEN_DESTROYED};if(!me("tracks",e,()=>Ue(e)&&e.length>0&&e.every(d=>d instanceof Oe||d.track instanceof Oe),!0))return M.error(`subscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:w.PARAMS_ERROR};M.info(`subscribe -> roomId: ${this._roomId}, tracks: ${e.map(cn)}`);const i=this._subscribedList.map(d=>Object.assign({},d)),o=e.map(d=>d instanceof Oe?{track:d}:d);let s=!1;const u=[];return o.forEach(d=>{const l=d.track.getTrackId();u.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||t?((r=this._polarisReport)===null||r===void 0||r.sendR2(mt.SUBSCRIBE,_t.BEGIN,u),this._updateSubListHandle(i,!0)):{code:w.SUCCESS}})}unsubscribe(e){return H(this,void 0,void 0,function*(){return ve(()=>this.__unsubscribe(e))})}__unsubscribe(e){var t;return H(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return M.warn(`room has beed destroyed, no need to unsubscribe tracks -> roomId: ${this._roomId}`),{code:w.SUCCESS};if(!me("tracks",e,()=>Ue(e)&&e.length>0&&e.every(i=>i instanceof Oe),!0))return M.error(`unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:w.PARAMS_ERROR};M.info(`unsubscribe -> roomId: ${this._roomId}, tracks: ${e.map(cn)}`);const r=this._subscribedList.map(i=>Object.assign({},i)).filter(i=>!e.includes(i.track));return(t=this._polarisReport)===null||t===void 0||t.sendR2(mt.SUBSCRIBE,_t.END,e.map(i=>i.getTrackId())),this._updateSubListHandle(r,!1)})}_assertRoomDestroyed(){if(this._destroyed){const e="This room has been destroyed. Please use `RCRTCClient.joinRTCRoom` or `RCRTCClient.joinLivingRoom` to catch another instance.";return M.warn(e),w.ROOM_HAS_BEEN_DESTROYED}}getLocalTrack(e){return this._pc.getLocalTrack(e)}getLocalTracks(){return this._pc.getLocalTracks()}getRemoteTrack(e){return this._remoteTracks[e]||null}updateSubList(e){return H(this,void 0,void 0,function*(){return ve(()=>this._updateSubListHandle(e,!1))})}_updateSubListHandle(e,t=!1){return H(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:w.ROOM_HAS_BEEN_DESTROYED};if(!me("resources",e,()=>Ue(e)&&e.every(R=>R instanceof Oe||R.track instanceof Oe),!0))return M.error(`update sublist failed, tracks is invalid -> roomId: ${this._roomId}`),{code:w.PARAMS_ERROR};M.info(`update subscribe list -> roomId: ${this._roomId}, forceReq: ${t}, tracks: ${e.map(cn)}`);let r=e.map(R=>R instanceof Oe?{track:R}:Object.assign({},R));const i={};r=r.filter(R=>{const y=R.track.getTrackId();return this._remoteTracks[y]?!i[y]&&(i[y]=!0):(M.warn(`track cannot found in room -> trackId: ${y}`),!1)}).map(R=>Object.assign({},R));const o=this._subscribedList.map(R=>Object.assign({},R));if(!t){let R=!1;if(r.forEach(y=>{const P=o.findIndex(L=>L.track===y.track);if(P===-1)return void(R=!0);o.splice(P,1)[0].subTiny!==y.subTiny&&(R=!0)}),o.length&&(R=!0),!R)return{code:w.SUCCESS}}this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(r.map(R=>R.track));const s=yield this._createExchangeParams(r,!1),u=this._getPushOtherRoomsParams();u&&(s.pushOtherRooms=u);const d=yield this._exchangeHandle(s),l=r.map(R=>R.track.getTrackId());if(d.code!==w.SUCCESS)return{code:d.code};const{sdp:h,resultCode:a,message:c,subscribedList:p}=d.data;if(a!==w.SUCCESS)return M.error(`change subscribe list failed: ${a}`),{code:a};M.debug(`subscribe success: ${l.join(",")}`);const f=yield this._pc.setRemoteAnswer(h.sdp);if(f!==w.SUCCESS)return{code:f};const m=p==null?void 0:p.map(R=>`${R.msid}_${R.mediaType}`),_=r.filter(R=>m==null?void 0:m.includes(R.track.getTrackId())),v=r.filter(R=>!(m==null?void 0:m.includes(R.track.getTrackId())));for(const R in this._remoteTracks){const y=_.some(P=>P.track.getTrackId()===R);this._remoteTracks[R].__innerSetSubscribed(y)}return this._subscribedList.splice(0,this._subscribedList.length,..._),v.length?{code:w.SUCCESS,failedList:v}:{code:w.SUCCESS}})}registerRoomEventListener(e){this._appListener=e}registerReportListener(e){this._pc.registerReportListener(e)}onAudioLevelChange(e,t){var r;(r=this._audioLevelReport)===null||r===void 0||r.clearAudioLevelReportTimer(),this._audioLevelReport=new zc(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}__onReconnected(e){return H(this,void 0,void 0,function*(){if(this._pc.getRTCPeerConn().connectionState==="closed")return M.warn("RTCPeerConnection closed. Please rejoin room to restore services."),void this._rtcpeerClosed();const{code:t,data:r}=yield this._context.joinRTCRoom(this._roomId,this._roomMode,e);if(t!==b.SUCCESS)return void M.error(`RTC __onReconnected getRTCRoomInfo failed: ${t}`);M.debug(`RTC __onReconnected getRTCRoomInfo success: ${JSON.stringify(r)}`);const i=[],o={},s={},u={},d=$i(r),l=Object.keys(d),h=Object.keys(this._roomResources);for(let a=l.length-1;a>=0;a-=1){const c=l[a],p=h.indexOf(c);if(p===-1){i.push(c),o[c]=Wn(d[c]);continue}const f=this._roomResources[c],m=d[c],{publishedList:_,modifiedList:v,unpublishedList:R}=nr(f,m,!0);o[c]=Wn(_),s[c]=Wn(R),u[c]=Wn(v),h.splice(p,1)}h.length&&h.forEach(a=>{delete this._roomResources[a]}),Object.assign(this._roomResources,d),h.length&&this._callAppListener("onUserLeave",h),i.length&&this._callAppListener("onUserJoin",i);for(const a in s){const c=s[a];if(c.length){const p=c.map(f=>this._remoteTracks[ue(f)]);yield this._onUserUnpublish(p)}}return Object.keys(o).forEach(a=>{const c=o[a];if(c.length===0)return;const p=c.map(f=>{const m=ue(f),{userId:_,tag:v,mediaType:R}=Pe(m),y=this._remoteTracks[m]=R===he.AUDIO_ONLY?new pt(v,_):new ft(v,_);return y.__innerSetRemoteMuted(f.state===0),y});this._onTrackPublish(p)}),Object.keys(u).forEach(a=>{u[a].forEach(c=>{const p=ue(c),f=this._remoteTracks[p];f.__innerSetRemoteMuted(c.state===0),f.isAudioTrack()?this._onAudioMuteChange(f):this._onVideoMuteChange(f)})}),{data:r}})}_onAudioMuteChange(e){this._callAppListener("onAudioMuteChange",e)}_onVideoMuteChange(e){this._callAppListener("onVideoMuteChange",e)}_afterChangedRole(e){}_removeRemoteTracks(){const e=Object.values(this._remoteTracks);e.length&&(e.forEach(t=>{t.isAudioTrack()&&t.__releaseMediaElement()}),this._remoteTracks={})}_registerPKMsgListener(e){this._onRecvPKMsg=e}_quitAllPKRoom(){}}var gn,jt,Er;(function(n){n[n.CROP=1]="CROP",n[n.WHOLE=2]="WHOLE"})(gn||(gn={})),function(n){n[n.CUSTOMIZE=1]="CUSTOMIZE",n[n.SUSPENSION=2]="SUSPENSION",n[n.ADAPTATION=3]="ADAPTATION"}(jt||(jt={})),function(n){n[n.CROP=1]="CROP",n[n.WHOLE=2]="WHOLE"}(Er||(Er={}));const la=()=>({version:1,mode:jt.SUSPENSION});class Pl{constructor(e,t,r){this._onFlush=e,this._isValidTrackId=t,this._sendCDNInfoSignal=r,this._values=la()}setHostVideoTrack(e){if(!this._isValidTrackId(e))return M.error(`setHostVideoTrack failed: videoTrackId is invalid -> ${e}`),this;const{mediaType:t,tag:r,userId:i}=Pe(e);return t!==he.VIDEO_ONLY?(M.error(`setHostVideoTrack failed: kind of resource is not 'video' -> ${e}`),this):(this._values.host_stream_id=si(i,r),this)}setMixLayoutMode(e){return[jt.CUSTOMIZE,jt.SUSPENSION,jt.ADAPTATION].includes(e)?(this._values.mode=e,this):(M.error(`layout mode is invalid: ${e}`),this)}_addOutputValue(e,t,r="normal"){const i=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if(e==="cdn")return void(i.cdn=t);if(e==="audio")return void(i.audio={bitrate:t});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:gn.CROP,picture:[]});Object.assign(s,t)}}else o.exparams={renderMode:t};else o.backgroundColor=t;else{const s=o[r]||(o[r]={});Object.assign(s,t)}}setOutputVideoResolution(e){if(!Ht(e))return M.warn("setOutputVideoResolution failed: `resolution` is invalid"),this;const{width:t,height:r}=it(e);return this._addOutputValue("video",{width:t,height:r},"normal"),this}setOutputVideoFPS(e){if(!Bi(e))return M.warn("setOutputVideoFPS failed: `fps` is invalid"),this;const t=ot(e);return this._addOutputValue("video",{fps:t},"normal"),this}setOutputVideoBitrate(e){return!_e(e)||e<=0?M.error(`bitrate is invalid: ${e}`):this._addOutputValue("video",{bitrate:e},"normal"),this}setOutputTinyVideoResolution(e){if(!Ht(e))return M.warn("setOutputTinyVideoResolution failed: `resolution` is invalid"),this;const{width:t,height:r}=it(e);return this._addOutputValue("video",{width:t,height:r},"tiny"),this}setOutputTinyVideoFPS(e){if(!Bi(e))return M.warn("setOutputTinyVideoFPS failed: `fps` is invalid"),this;const t=ot(e);return this._addOutputValue("video",{fps:t},"tiny"),this}setOutputTinyVideoBitrate(e){return!_e(e)||e<=0?M.error(`bitrate is invalid: ${e}`):this._addOutputValue("video",{bitrate:e},"tiny"),this}setOutputVideoRenderMode(e){return[Er.CROP,Er.WHOLE].includes(e)?this._addOutputValue("video",e,"exparams"):M.error(`renderMode is invalid: ${e}`),this}setOutputAudioBitrate(e){return _e(e)&&e>0?this._addOutputValue("audio",e):M.error(`bitrate is invalid: ${e}`),this}setOutputBackgroundColor(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?this._addOutputValue("video",e,"backgroundColor"):M.error(`color is invalid: ${e}`),this}addOutputBackgroundPicture(e,t,r,i,o){var s,u,d;if(!vn(e))return M.error(`uri is invalid: ${e}`),this;if([t,r,i,o].some(h=>!_e(h)||h<0||h>1))return M.error(`some attrs of (x, y, w, h) is invalid: ${t}, ${r}, ${i}, ${o}`),this;const l=((d=(u=(s=this._values.output)===null||s===void 0?void 0:s.video)===null||u===void 0?void 0:u.backgroundPicture)===null||d===void 0?void 0:d.picture)||[];return l.push({uri:e,w:i,h:o,x:t,y:r}),this._addOutputValue("video",{picture:l},"backgroundPicture"),this}removeOutputBackgroundPicture(e){var t,r,i;if(!vn(e))return M.error(`uri is invalid: ${e}`),this;let o=(i=(r=(t=this._values.output)===null||t===void 0?void 0:t.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!==e),this._addOutputValue("video",{pictures:o},"backgroundPicture")),this}clearOutputBackgroundPicture(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this}setOutputBackgroundPictureFillMode(e){return[gn.CROP,gn.WHOLE].includes(e)?this._addOutputValue("video",{fillMode:e},"backgroundPicture"):M.error(`fillMode is invalid: ${e}`),this}addPublishStreamUrls(e){var t,r;const i=/^rtmp:\/\/.+/;if(!Ue(e)||e.length===0||e.some(u=>!i.test(u)))return M.error(`urls is invalid: ${e}`),this;const o=((r=(t=this._values.output)===null||t===void 0?void 0:t.cdn)===null||r===void 0?void 0:r.concat())||[];let s=!1;return e.forEach(u=>{o.some(d=>d.pushurl===u)||(s=!0,o.push({pushurl:u}))}),o.length>5?(M.error("publish stream url no more than 5"),this):(s&&this._addOutputValue("cdn",o),this)}removePublishStreamUrls(e){var t,r;const i=/^rtmp:\/\/.+/;if(!Ue(e)||e.length===0||e.some(s=>!i.test(s)))return M.error(`urls is invalid: ${e}`),this;const o=((r=(t=this._values.output)===null||t===void 0?void 0:t.cdn)===null||r===void 0?void 0:r.concat())||[];for(let s=o.length-1;s>=0;s-=1){const{pushurl:u}=o[s],d=e.indexOf(u);d>=0&&(e.splice(d,1),o.splice(s,1))}return this._addOutputValue("cdn",o),this}clearPublishStreamUrls(){return this._addOutputValue("cdn",[]),this}addCustomizeLayoutVideo(e,t,r,i,o){if(!this._isValidTrackId(e))return M.error(`trackId is invalid: ${e}`),this;if(!_e(t)||!_e(r))return M.error(`some attrs of (x, y) is invalid: ${t}, ${r}`),this;if([i,o].some(h=>!_e(h)||h<0))return M.error(`some attrs of (width, height) is invalid: ${i}, ${o}`),this;const{userId:s,tag:u,mediaType:d}=Pe(e);if(d!==he.VIDEO_ONLY)return M.error(`kind of resource is not 'video': ${e}`),this;const l=si(s,u);return(this._values.input||(this._values.input={video:[]})).video.push({user_id:s,stream_id:l,x:t,y:r,width:i,height:o}),this}removeCustomizeLayoutVideo(e){if(!this._isValidTrackId(e))return M.error(`trackId is invalid: ${e}`),this;const{userId:t,tag:r,mediaType:i}=Pe(e);if(i!==he.VIDEO_ONLY)return M.error(`kind of resource is not 'video': ${e}`),this;const o=si(t,r),s=this._values.input||(this._values.input={video:[]});return s.video=s.video.filter(u=>u.stream_id===o),this}clearCustomizeLayoutVideo(){return(this._values.input||(this._values.input={video:[]})).video=[],this}flush(){var e,t,r,i;return H(this,void 0,void 0,function*(){const o=JSON.parse(JSON.stringify(this._values)),{code:s}=yield this._onFlush(o);return s===w.SUCCESS&&(((t=(e=this._values.output)===null||e===void 0?void 0:e.video.normal)===null||t===void 0?void 0:t.width)||((i=(r=this._values.output)===null||r===void 0?void 0:r.video.normal)===null||i===void 0?void 0:i.fps))&&this._sendCDNInfoSignal(),this._values=la(),{code:s}})}}var Tr,Sr,Ir,rt;(function(n){n[n.OPEN=1]="OPEN",n[n.STOP=2]="STOP"})(Tr||(Tr={})),function(n){n[n.SPREAD=0]="SPREAD",n[n.NO_SPREAD=-1]="NO_SPREAD"}(Sr||(Sr={})),function(n){n[n.AUTOMATIC=0]="AUTOMATIC",n[n.MANUAL=1]="MANUAL"}(Ir||(Ir={})),function(n){n[n.VIDEO=0]="VIDEO",n[n.AUDIO=1]="AUDIO"}(rt||(rt={}));const Wc=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=16*Math.random()|0;return(n==="x"?e:3&e|8).toString(16)});class Ll{constructor(e,t,r,i,o,s,u,d){this._context=e,this._runtime=t,this._service=r,this._initOptions=i,this._mainLivingRoom=o,this._registerPKMsgListener=s,this._onJoinedPKRoom=u,this._onLeavePKRoom=d,this._inviteTimeout=30,this._PKInfo={},this._appListener=null,this._joinedPKRooms={},this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}_callAppListener(e,...t){var r;const i=(r=this._appListener)===null||r===void 0?void 0:r[e];if(i)try{i(...t)}catch(o){M.error(o)}}_onInvite(e){const t=e.inviteInfo||{},{inviterRoomId:r,inviterUserId:i,extra:o}=t,s={inviterRoomId:r,inviterUserId:i};o&&Object.assign(s,{extra:o}),this._PKInfo[r]=t,this._callAppListener("onRequestJoinOtherRoom",s)}_onCancelInvite(e){const{inviterRoomId:t,inviterUserId:r,extra:i}=e.inviteInfo||{},o={inviterRoomId:t,inviterUserId:r};i&&Object.assign(o,{extra:i}),delete this._PKInfo[t],this._callAppListener("onCancelRequestOtherRoom",o)}_onInviteTimeout(e){}_onInviteAnswer(e){const{answerCode:t,inviteContent:r,inviteeUserAutoMix:i}=e,{inviterUserId:o,inviterRoomId:s,inviteeUserId:u,inviteeRoomId:d,extra:l}=r,h={agree:t===1,inviterRoomId:s,inviterUserId:o,inviteeRoomId:d,inviteeUserId:u};this._PKInfo[d].inviteeUserAutoMix=i,this._callAppListener("onResponseJoinOtherRoom",h)}_onPKEnd(e){return H(this,void 0,void 0,function*(){const{inviteeRoomId:t,inviterRoomId:r,userId:i}=e.inviteInfo,o=r===this._mainRoomId?t:r,s={endRoomId:o,endUserId:i};yield this.leaveOtherRoom(this._joinedPKRooms[o]),delete this._PKInfo[o],this._callAppListener("onFinishOtherRoom",s)})}_onRecvPKMsg(e){const{targetId:t,content:r,messageType:i}=e;switch(i){case ae.PK_INVITE:this._onInvite(r);break;case ae.PK_CANCEL_INVITE:this._onCancelInvite(r);break;case ae.PK_INVITE_TIMEOUT:this._onInviteTimeout(r);break;case ae.PK_INVITE_ANSWER:this._onInviteAnswer(r);break;case ae.PK_END:this._onPKEnd(r)}}registerRoomPKEventListener(e){this._appListener=e}requestJoinOtherRoom(e,t,r){return H(this,void 0,void 0,function*(){if(!me("inviteeRoomId",e,Ve,!0)||!me("inviteeUserId",t,Ve,!0))return{code:w.PARAMS_ERROR};M.debug(`requestRoomPK -> inviteeRoomId: ${e}; inviteeUserId: ${t}; options: ${JSON.stringify(r||{})}`);const i=Wc(),o=!or(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:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(r==null?void 0:r.extra)||""},u={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:i};M.debug(`requestRoomPK -> params: ${JSON.stringify(u)}`);const d=yield this._context.requestRoomPK(u);return d!==b.SUCCESS?(M.error(`requestRoomPK failed: ${d}`),{code:d}):(M.debug("requestRoomPK success"),this._PKInfo[e]={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e},{code:w.SUCCESS})})}cancelRequestJoinOtherRoom(e,t,r){return H(this,void 0,void 0,function*(){if(!me("inviteeRoomId",e,Ve,!0)||!me("inviteeUserId",t,Ve,!0))return{code:w.PARAMS_ERROR};if(!this._PKInfo[e])return M.error(`\u672A\u53D1\u8D77\u8FC7\u4E0E ${e} \u623F\u95F4\u5185 ${t} \u8FDE\u9EA6\u7684\u8BF7\u6C42`),{code:w.PARAMS_ERROR};M.debug(`canceRequestJoinPK -> inviteeRoomId: ${e}; inviteeUserId: ${t}; extra: ${r}`);const i={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:r||""},o={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(i)};M.debug(`canceRequestJoinPK -> params: ${JSON.stringify(o)}`);const s=yield this._context.cancelRoomPK(o);return s!==b.SUCCESS?(M.error(`canceRequestJoinPK failed: ${s}`),{code:s}):(M.debug("canceRequestJoinPK success"),delete this._PKInfo[e],{code:w.SUCCESS})})}responseJoinOtherRoom(e,t,r,i){return H(this,void 0,void 0,function*(){if(!me("inviterRoomId",e,Ve,!0)||!me("inviterUserId",t,Ve,!0))return{code:w.PARAMS_ERROR};if(!this._PKInfo[e])return M.error(`${e} \u623F\u95F4\u5185\u7684 ${t} \u672A\u53D1\u8D77\u8FC7\u8FDE\u9EA6\u8BF7\u6C42`),{code:w.PARAMS_ERROR};M.debug(`responseRoomPK -> inviterRoomId: ${e}; inviterUserId: ${t}; agree: ${r}; options: ${JSON.stringify(i||{})}`);const{inviteSessionId:o,inviterUserAutoMix:s}=this._PKInfo[e],u=!or(i==null?void 0:i.autoMix)||(i==null?void 0:i.autoMix),d={inviteSessionId:o,inviterRoomId:e,inviterUserId:t,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:u},l=Object.assign(d,{inviterUserAutoMix:s}),h=r?Object.assign(d,{MultiRoomKey:`${e}|${this._mainRoomId}`,MultiRoomValue:JSON.stringify(l)}):d;!le(i==null?void 0:i.extra)&&Object.assign(h,{extra:i.extra});const a={agree:r,roomId:this._mainRoomId,inviteSessionId:o,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(h),key:`${e}|${t}`,value:JSON.stringify(d)};M.debug(`responseRoomPK -> params: ${JSON.stringify(a)}`);const c=yield this._context.responseRoomPK(a);return c!==b.SUCCESS?(M.error(`responseRoomPK failed: ${c}`),{code:c}):(M.debug("responseRoomPK success"),this._PKInfo[e].inviteeUserAutoMix=u,{code:w.SUCCESS})})}_quitRoomPK(e){return H(this,void 0,void 0,function*(){const{inviterRoomId:t,inviteeRoomId:r,inviterUserId:i}=this._PKInfo[e],o={inviteeRoomId:r,inviterRoomId:t,userId:this._context.getCurrentId()},s={roomId:this._mainRoomId,endRoomId:e,sessionId:this._PKInfo[e].inviteSessionId,content:JSON.stringify(o),keys:[`${t}|${i}`]};M.debug(`quitRoomPK -> params: ${JSON.stringify(s)}`);const u=yield this._context.endRoomPK(s);return u!==b.SUCCESS?(M.error(`quitRoomPK failed: ${u}`),{code:w.SIGNAL_ERROR}):(M.debug("quitRoomPK success"),delete this._PKInfo[e],{code:w.SUCCESS})})}_relaseCrtRoom(){}joinOtherRoom(e){return H(this,void 0,void 0,function*(){if(!me("roomId",e,Ve,!0))return{code:w.PARAMS_ERROR};if(this._context.getConnectionStatus()!==se.CONNECTED)return{code:w.SIGNAL_DISCONNECTED};if(M.debug(`joinPKRoom, roomId: ${e}`),this._joinedPKRooms[e])return{code:w.REPERT_JOIN_ROOM};const t=rt.VIDEO,{code:r,data:i}=yield this._context.joinRTCRoom(e,Le.LIVE,t);if(r!==b.SUCCESS)return M.error(`joinRoom failed -> code: ${r}`),{code:r};M.debug(`JoinPKRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${e}, data: ${JSON.stringify(i)}`);const o=new vt(this._context,this._runtime,e,i,this._service,this._initOptions,this._relaseCrtRoom.bind(this),t,!1,!1);return this._joinedPKRooms[e]=o,this._onJoinedPKRoom(e,o),{room:o,code:w.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()}})}leaveOtherRoom(e,t){return H(this,void 0,void 0,function*(){return ve(()=>H(this,void 0,void 0,function*(){const r=e.getRoomId();return M.debug(`leavePKRoom -> userId: ${this._context.getCurrentId()} , roomId: ${r}`),yield e.__destroy(!0),delete this._joinedPKRooms[r],this._onLeavePKRoom(r),this._PKInfo[r]?(t&&this._quitRoomPK(r),{code:w.SUCCESS}):{code:w.SUCCESS}}))})}getPKInfo(e){return this._PKInfo[e]}getJoinedPKRooms(){return this._joinedPKRooms}}class vt extends Jc{constructor(e,t,r,i,o,s,u,d,l=!1,h){var a;super(e,t,r,i,Le.LIVE,o,s,u,l,h),this._livingType=d,this._isMainRoom=h,this._CDNUris=null,this._CDNEnable=!1,this._mcuConfigBuilder=new Pl(this._onMCUConfigFlush.bind(this),this._isValidResourceId.bind(this),this._sendCDNInfoSignal.bind(this)),this._isMainRoom&&(this._roomPKHandler=new Ll(e,t,o,s,this,super._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._onLeavePKRoom.bind(this)));const c=(a=i.roomInfo.filter(p=>p.key==="cdn_uris")[0])===null||a===void 0?void 0:a.value;c&&(this._CDNUris=JSON.parse(c)[0])}_isValidResourceId(e){var t;const{userId:r}=Pe(e),i=!!((t=this._roomResources[r])===null||t===void 0?void 0:t.find(h=>ue(h)===e));let o=!1;const{code:s,roomPKHandler:u}=this.getRoomPKHandler();if(s!==w.SUCCESS||!u)return i;const d=u.getJoinedPKRooms(),l=[];return Object.values(d).map(h=>{l.push(...h.getRemoteTracks())}),o=l.some(h=>e===h.getTrackId()),i||o}getLivingType(){return this._livingType}getMCUConfigBuilder(){return this._isMainRoom?this._mcuConfigBuilder:(M.error("the `getMCUConfigBuilder` is disabled in PK room "),{code:w.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}_onMCUConfigFlush(e){return H(this,void 0,void 0,function*(){const t={"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(t,e);return r!==w.SUCCESS?(M.error(`set MCU config failed: ${r}`),{code:r}):(M.info("set MCU config success"),i.pull_url&&(this._CDNUris=JSON.parse(i.pull_url)),{code:r,res:i})})}__onReconnected(){const e=Object.create(null,{__onReconnected:{get:()=>super.__onReconnected}});var t,r;return H(this,void 0,void 0,function*(){const i=yield e.__onReconnected.call(this,this._livingType);if(!i||!i.data)return;const o=i.data.roomInfo,s=(t=o.filter(d=>d.key==="cdn_uris")[0])===null||t===void 0?void 0:t.value;if(!s)return;const u=JSON.parse(s);((r=this._CDNUris)===null||r===void 0?void 0:r.enableInnerCDN)!==u.enableInnerCDN&&this._callAppListener("onCDNEnableChange",u.enableInnerCDN),this._CDNUris=u})}enableInnerCDN(e){return H(this,void 0,void 0,function*(){if(!this._isMainRoom)return M.error("the `enableInnerCDN` is disabled in PK room "),{code:w.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(!or(e))return M.error("`enable` is invalid"),{code:w.PARAMS_ERROR};this._CDNEnable=e;const t={version:2,output:{inCDNModel:e?Tr.OPEN:Tr.STOP}},{code:r}=yield this._onMCUConfigFlush(t);if(r!==w.SUCCESS)return M.error(`enableInnerCDN failed -> code: ${r}`),{code:w.SIGNAL_ERROR};if(this._CDNUris&&this._CDNUris.broadcast!==Sr.SPREAD)return M.info("enableInnerCDN succeed"),{code:w.SUCCESS};const{code:i}=yield ve(()=>H(this,void 0,void 0,function*(){return this._sendCDNInfoSignal()}));return i===w.SUCCESS?(M.info("enableInnerCDN succeed"),{code:w.SUCCESS}):(M.error(`enableInnerCDN failed -> code: ${i}`),{code:i})})}_sendCDNInfoSignal(){return H(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(e=>e.code===w.SUCCESS)?{code:w.SUCCESS}:{code:w.SIGNAL_ERROR}})}_spreadCDNInfo(e){return H(this,void 0,void 0,function*(){const t=yield this._context.setRTCCDNUris(this._roomId,ae.TOTAL_CONTENT_RESOURCE,JSON.stringify([e]));return t!==b.SUCCESS?(M.error(`spreadCDNInfo failed -> code: ${t}`),{code:w.SIGNAL_ERROR}):(M.info("spreadCDNInfo succeed"),{code:w.SUCCESS})})}_setRoomCDNInfo(e){return H(this,void 0,void 0,function*(){const t=yield this._context.setRTCData(this._roomId,"cdn_uris",JSON.stringify([e]),!0,nt.ROOM);return t!==b.SUCCESS?(M.error(`setRoomCDNInfo failed -> code: ${t}`),{code:w.SIGNAL_ERROR}):(M.info("setRoomCDNInfo succeed"),{code:w.SUCCESS})})}_resourceHandle(e,t,r){const i=Object.create(null,{_resourceHandle:{get:()=>super._resourceHandle}});var o;return H(this,void 0,void 0,function*(){i._resourceHandle.call(this,e,t,r),e.cdn_uris&&(((o=this._CDNUris)===null||o===void 0?void 0:o.enableInnerCDN)!==e.cdn_uris[0].enableInnerCDN&&this._callAppListener("onCDNEnableChange",!this.__getCDNEnable()),this._CDNUris=e.cdn_uris[0])})}_exchangeHandle(e){var t,r,i;return H(this,void 0,void 0,function*(){const o=yield this._service.exchange(this._getRTCReqestHeaders(),e),s=(r=(t=o.data)===null||t===void 0?void 0:t.urls)===null||r===void 0?void 0:r.pull_url;return o.code===w.SUCCESS&&s&&(this._CDNUris=JSON.parse(s),((i=this._CDNUris)===null||i===void 0?void 0:i.broadcast)===Sr.SPREAD&&(this._CDNEnable=!0,this._sendCDNInfoSignal())),o})}_afterChangedRole(e){const t=$i(e),r=this._context.getCurrentId(),i=Object.keys(t);setTimeout(()=>{var o,s,u;const d=i.filter(l=>l!==r);d.length>0&&this._callAppListener("onUserJoin",d);for(const l in t)l!==r&&this._resourceHandle({uris:t[l]},ae.TOTAL_CONTENT_RESOURCE,l);((o=e.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)===Ir.MANUAL&&this._callAppListener("onCDNEnableChange",(u=this._CDNUris)===null||u===void 0?void 0:u.enableInnerCDN)})}__getCDNEnable(){var e;return(e=this._CDNUris)===null||e===void 0?void 0:e.enableInnerCDN}__getCDNPushMode(){var e;return(e=this._CDNUris)===null||e===void 0?void 0:e.push_mode}_onJoinedPKRoom(e,t){const{code:r,roomPKHandler:i}=this.getRoomPKHandler();if(r===w.SUCCESS&&i){if(!i.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}_onLeavePKRoom(e){const{code:t,roomPKHandler:r}=this.getRoomPKHandler();if(t===w.SUCCESS&&r){if(!r.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}_exchangeWithPushOtherRoom(){return H(this,void 0,void 0,function*(){if(!this.getLocalTracks().length)return;const e=yield this._createExchangeParams(this._subscribedList,!1),t=this._getPushOtherRoomsParams();t&&(e.pushOtherRooms=t);const r=yield this._exchangeHandle(e);if(r.code!==w.SUCCESS)return M.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==w.SUCCESS)return M.error(`exchange with pushOtherRoom failed: ${o}`),{code:o};const s=yield this._pc.setRemoteAnswer(i.sdp);return s!==w.SUCCESS?{code:s}:void 0})}getRoomPKHandler(){return this._isMainRoom?{code:w.SUCCESS,roomPKHandler:this._roomPKHandler}:(M.error("the `getRoomPKHandler` is disabled in PK room "),{code:w.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}_quitAllPKRoom(){const e=this._roomPKHandler.getJoinedPKRooms();for(const t in e){const r=e[t];this._roomPKHandler.leaveOtherRoom(r)}}}class kl extends Jc{constructor(e,t,r,i,o,s,u){super(e,t,r,i,Le.RTC,o,s,u,!1)}}const ai=()=>({"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:`web|${Ge.browser}|${Ge.version}`,ClientVersion:"5.3.1","Client-Session-Id":Wc(),"Request-Id":Date.now().toString()});class zo{constructor(e,t,r,i=5e3){this._runtime=e,this._context=t,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(...(e=>{var t;if(!e)return[];let r;try{r=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch{return M.warn("parse `voipCallInfo` of navi failed: "+e.voipCallInfo),[]}if(r.strategy===0)return[];const i=(t=r.callEngine)===null||t===void 0?void 0:t.filter(u=>u.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(u=>{s.push(u.replace(/^(https?:\/\/)?/,"https://"))}),s})(this._context.getNaviInfo())):(this._msInNavi.push(...this._failedMs),this._failedMs.length=0)),this._msInNavi.map(e=>e.trim()))}_request(e,t,r){return H(this,void 0,void 0,function*(){const i=this.getNaviMS();if(i.length===0)return{code:w.NOT_OPEN_VIDEO_AUDIO_SERVER};this._rtcFinger&&(r.rtcFinger=this._rtcFinger);for(let o=0;o<i.length;o+=1){const s=`${i[o]}${e}`,u=ai();M.debug(`request -> Request-Id: ${u["Request-Id"]}, url: ${s}`);const{status:d,data:l}=yield this._runtime.httpReq({url:s,body:JSON.stringify(r),headers:Object.assign(Object.assign({},u),t),method:Ze.POST,timeout:this._timeout});if(d===200){const h=JSON.parse(l);return h.rtcFinger&&(this._rtcFinger=h.rtcFinger),h.clusterId&&(this._clusterId=h.clusterId),M.debug(`request success -> Request-Id: ${u["Request-Id"]}`),{code:w.SUCCESS,data:h}}M.warn(`request failed -> Request-Id: ${u["Request-Id"]}, status: ${d}, url: ${s}`),this._failedMs.push(...this._msInNavi.splice(o,1))}return{code:w.REQUEST_FAILED}})}exchange(e,t){var r;return H(this,void 0,void 0,function*(){const i=yield this._request("/exchange",e,t);if(i.code===w.SUCCESS&&((r=i.data)===null||r===void 0?void 0:r.resultCode)===w.SUCCESS){const o=i.data.urls;o&&(this._configUrl=o.configUrl)}return i})}exit(e){return H(this,void 0,void 0,function*(){const{code:t}=yield this._request("/exit",e,{});return t})}broadcastSubscribe(e,t){return this._request("/broadcast/subscribe",e,t)}broadcastExit(e){return H(this,void 0,void 0,function*(){const{code:t}=yield this._request("/broadcast/exit",e,{});return{code:t}})}setMcuConfig(e,t){return H(this,void 0,void 0,function*(){if(!this._configUrl)return{code:w.MCU_SERVER_NOT_FOUND};const r=`${this._configUrl.replace(/^(https?:\/\/)?/,"https://")}/server/mcu/config`,i=ai();M.debug(`request -> Request-Id: ${i["Request-Id"]}, url: ${r}`);const{status:o,data:s}=yield this._runtime.httpReq({url:r,headers:Object.assign(Object.assign({},i),e),body:JSON.stringify(t),method:Ze.POST});if(o===200){M.debug(`request success -> Request-Id: ${i["Request-Id"]}`);const u=JSON.parse(s);return{code:u.resultCode,res:u}}return{code:w.REQUEST_FAILED}})}getCDNResourceInfo(e,t){return H(this,void 0,void 0,function*(){const r=ai(),{status:i,data:o}=yield this._runtime.httpReq({url:t,headers:Object.assign(Object.assign({},r),e),method:Ze.GET});if(i===200){const s=JSON.parse(o);return{code:s.resultCode,res:s}}return M.warn(`request failed -> Request-Id: ${r["Request-Id"]}, status: ${i}, url: ${t}`),{code:w.REQUEST_FAILED}})}}class Dl{constructor(e,t,r){this._context=e,this._rtcToken="",this._liveUrl="",this._subTracks=[],this._livingType=null,this._mediaType=null,this._subTiny=!1,this._fromRetry=!1,this._appListener=null,this._service=new zo(t,e,r.mediaServer)}_getReqHeaders(e){return H(this,void 0,void 0,function*(){const t=this._context.getCurrentId(),r=t;if(!this._rtcToken){const{code:i,data:o}=yield this._context.getRTCToken(r,Le.LIVE,e);if(i!==b.SUCCESS)return M.error(`getRTCToken failed: ${i}`),{code:w.SIGNAL_ERROR};this._rtcToken=o.rtcToken}return{code:w.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:t,RoomId:r,RoomType:Le.LIVE,Token:this._rtcToken}}})}_clearSubscribeInfo(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,(e=this._pc)===null||e===void 0||e.destroy(),this._pc=null}_reTryExchange(){var e;return H(this,void 0,void 0,function*(){this._fromRetry=!0;const{code:t}=yield this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);t===w.SUCCESS&&((e=this._pc)===null||e===void 0||e.clearReTryExchangeTimer())})}subscribe(e,t,r,i=!1){return H(this,void 0,void 0,function*(){return ve(()=>this.__subscribe(e,t,r,i))})}__subscribe(e,t,r,i=!1){var o;return H(this,void 0,void 0,function*(){const s=[];if(rr(this._context.getNaviInfo()))return{code:w.PACKAGE_ENVIRONMENT_ERROR,tracks:s};if(!this._fromRetry&&((o=this._pc)===null||o===void 0||o.clearReTryExchangeTimer()),this._fromRetry=!1,!Be(e))return M.error(`liveUrl is invalid: ${e}`),{code:w.PARAMS_ERROR,tracks:s};if(![rt.AUDIO,rt.VIDEO].includes(t))return M.error(`livingType is invalid: ${t}`),{code:w.PARAMS_ERROR,tracks:s};if(![he.AUDIO_ONLY,he.VIDEO_ONLY,he.AUDIO_VIDEO].includes(r))return M.error(`mediaType is invalid: ${r}`),{code:w.PARAMS_ERROR,tracks:s};if(this._liveUrl&&this._liveUrl!==e)return{code:w.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s};this._pc||(this._pc=new at(this._reTryExchange.bind(this)),this._pc.on(at.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this.registerReportListener(this._reportListener)),this._liveUrl=e;const{code:u,headers:d}=yield this._getReqHeaders(t);if(u!==w.SUCCESS)return{code:u,tracks:s};const l=`rc_mcu_${Date.now()}`,h="RongCloudRTC";this._subTracks.length===0&&(this._subTracks.push(new pt(h,l),new ft(h,l)),this._pc.updateSubRemoteTracks(this._subTracks.slice()));const a={sdp:yield this._pc.createOffer(!0),liveUrl:e,mediaType:r,simulcast:i?Ke.TINY:Ke.NORMAL,switchstream:!1},c=yield this._service.broadcastSubscribe(d,a);if(c.code!==w.SUCCESS)return M.error(`andience subscribe failed: ${c.code}`),{code:c.code,tracks:s};const p=c.data;if(p.resultCode!==w.SUCCESS)return M.error(`andience subscribe failed! code: ${p.resultCode}; message: ${p.message}`),{code:p.resultCode,tracks:s};M.debug(`andience subscribe success: ${e}`),this._livingType=t,this._mediaType=r,this._subTiny=i;const{sdp:f,subscribedList:m}=p,_=[];return m.forEach(v=>{const{mediaType:R}=v,y=this._subTracks[R];_.push(y),y.__innerSetRemoteMuted(!0)}),this._pc.setRemoteAnswer(f.sdp),{code:w.SUCCESS,tracks:_}})}unsubscribe(){return H(this,void 0,void 0,function*(){return ve(()=>this.__unsubscribe())})}__unsubscribe(){var e;return H(this,void 0,void 0,function*(){if((e=this._pc)===null||e===void 0||e.clearReTryExchangeTimer(),!this._rtcToken||!this._liveUrl)return{code:w.SUCCESS};const{headers:t}=yield this._getReqHeaders(),{code:r}=yield this._service.broadcastExit(t);return r!==w.SUCCESS?M.error(`broadcast unsubscribe failed: ${r}`):M.debug("broadcast unsubscribe success"),this._clearSubscribeInfo(),{code:r}})}registerReportListener(e){var t;this._reportListener=e,(t=this._pc)===null||t===void 0||t.registerReportListener(e)}registerTrackEventListener(e){this._appListener=e}_onTrackReady(e){var t,r;const i=e.receiver.track,o=i.kind==="audio"?he.AUDIO_ONLY:he.VIDEO_ONLY,s=this._subTracks[o];s.__innerSetMediaStreamTrack(i);try{(r=(t=this._appListener)===null||t===void 0?void 0:t.onTrackReady)===null||r===void 0||r.call(t,s)}catch(u){M.error(u)}}}var Hi,mn;(function(n){n.RTMP="rtmp",n.FLV="flv",n.HLS="hls"})(Hi||(Hi={})),function(n){n[n.NOT_HTTPS=0]="NOT_HTTPS",n[n.HTTPS=1]="HTTPS"}(mn||(mn={}));const Ul=Object.assign(Object.assign({},it(ge.W176_H144)),{frameRate:ot(Qe.FPS_15)});class ha{constructor(e,t,r,i,o,s){this._context=e,this._runtime=t,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 zo(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout),this._polarisReport=new Yc(this._context,this._runtime,this._roomId,this,Cr.Audience),this._polarisReport.sendR1(),this._pc=new at(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(at.__INNER_EVENT_TRACK_READY__,u=>{const d=u.streams[0].id,l=u.receiver.track,h=[d,l.kind==="audio"?he.AUDIO_ONLY:he.VIDEO_ONLY].join("_"),a=this._remoteTracks[h];a?(a.__innerSetMediaStreamTrack(l),this._callAppListener("onTrackReady",a)):M.warn("cannot found RCRemoteTrack:",l.id)}),this._context.onrtcdatachange=this.singalDataChange.bind(this)}_setInitData(){const{sessionId:e,remoteUserIds:t,remoteRTCUris:r,remoteMUCUris:i,remoteTracks:o,CDNUris:s}=((u,d)=>{const l=d.filter(R=>R.key==="RC_RTC_SESSIONID")[0],h=l?l.value:"",a=d.filter(R=>R.key==="RC_ANCHOR_LIST").map(R=>JSON.parse(R.value||"[]"))[0],c=d.filter(R=>R.key.includes("RC_RES_")).map(R=>JSON.parse(R.value||"{}")),p=c.length?JSON.parse(c[0].mcu_uris||"[]"):[],f=[];p.forEach(R=>{const{mediaType:y,tag:P}=R,L=y===he.AUDIO_ONLY?new pt(P,"",u):new ft(P,"",u);f.push(L)});const m=[],_=[];c.forEach(R=>{const y=JSON.parse(R.uris||"[]");m.push(...y),y.forEach(P=>{const{mediaType:L,tag:N,msid:E}=P,A=E.split("_")[0],F=L===he.AUDIO_ONLY?new pt(N,A):new ft(N,A);_.push(F)})});const v=d.filter(R=>R.key==="RC_CDN").map(R=>{const y=JSON.parse(R.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=e,this._roomAnchorList=t,o.forEach(u=>{this._remoteTracks[u.getTrackId()]=u}),this._CDNUris=s,r.forEach(u=>{const d=u.msid.split("_")[0];this._roomAnchorRes[d]?this._roomAnchorRes[d].push(u):this._roomAnchorRes[d]=[u]}),i.forEach(u=>{const{mediaType:d,tag:l}=u,h=[this._roomId,l,d].join("_");this._roomRes[h]=u}),r.forEach(u=>{const d=ue(u);this._roomRes[d]=u})}_assertRoomDestroyed(){if(this._destroyed){const e="This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.";return M.warn(e),w.ROOM_HAS_BEEN_DESTROYED}}singalDataChange(e,t){var r;if(t!==this._roomId)return void M.warn(`singalDataChange -> not the current room data: data roomId: ${t}, current roomId: ${this._roomId}`);M.debug("singalDataChange -> singalData:",JSON.stringify(e||{}));const i=[],o=(r=e.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]),e.forEach(s=>{const{key:u,value:d,timestamp:l,uid:h}=s;if(u.indexOf("RC_RES_")!==-1){const a=JSON.parse(d||"{}"),c=JSON.parse(a.mcu_uris||"[]"),p=JSON.parse(a.uris||"[]");return i.push(...c),void this._diffAnchorResource(p,h)}if(u==="RC_ANCHOR_LIST"){const a=JSON.parse(d||"[]"),{joinUserIds:c,leftUserIds:p}=this._diffAnchorList(a);c.length>0&&this._handleNewJoinedAnchor(c),p.length>0&&this._handleLeftedAnchor(p)}}),this._diffRoomResource(i)}_diffAnchorList(e){const t=e.filter(r=>this._roomAnchorList.indexOf(r)<0);return{leftUserIds:this._roomAnchorList.filter(r=>e.indexOf(r)<0),joinUserIds:t}}_handleNewJoinedAnchor(e){this._roomAnchorList.push(...e),this._callAppListener("onAnchorJoin",e)}_handleLeftedAnchor(e){return H(this,void 0,void 0,function*(){this._roomAnchorList=this._roomAnchorList.filter(r=>!(e.indexOf(r)>-1));const t=[];e.forEach(r=>{t.push(...this.getRemoteTracksByUserId(r)),delete this._roomAnchorRes[r]}),t.length&&(yield this.unsubscribe(t),t.forEach(r=>delete this._remoteTracks[r.getTrackId()])),this._callAppListener("onAnchorLeave",e)})}_diffRoomResource(e){return H(this,void 0,void 0,function*(){const t=[],r=[],i=[];e.forEach(o=>{const s=ue(o),{userId:u,tag:d,mediaType:l}=Pe(s),h=[this._roomId,d,l].join("_");if(!this._remoteTracks[h]){const a=l===he.AUDIO_ONLY?new pt(d,"",this._roomId):new ft(d,"",this._roomId);t.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])}),t.length>0&&this._callAppListener("onTrackPublish",t),r.length>0&&this._onUserUnpublish(r,"onTrackUnpublish")})}_diffAnchorResource(e,t){return H(this,void 0,void 0,function*(){const r=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),{publishedList:i,unpublishedList:o,modifiedList:s}=nr(r,e);if(i.length){const u=r.map(ue),d=[],l=[];if(i.forEach(h=>{const a=ue(h),c=u.indexOf(a),{userId:p,tag:f,mediaType:m}=Pe(a);c>-1?r[c]=h:r.push(h);let _=this._remoteTracks[a];this._roomRes[a]=h,_?_.isSubscribed()&&d.push(_):(_=m===he.AUDIO_ONLY?new pt(f,p):new ft(f,p),this._remoteTracks[a]=_,l.push(_)),_.__innerSetRemoteMuted(h.state===0)}),d.length){const h=d.map(c=>c.getTrackId());M.debug(`resub tracks -> ${JSON.stringify(h)}`);const{code:a}=yield ve(()=>this._subscribeHandle(d,!0));a!==w.SUCCESS&&M.error(`resub tracks failed -> code: ${a}, ids: ${JSON.stringify(h)}`)}this._callAppListener("onAnchorTrackPublish",l)}if(o.length){const u=o.map(ue);for(let l=r.length-1;l>=0;l-=1){const h=r[l];u.includes(ue(h))&&r.splice(l,1)}const d=o.map(l=>{const h=ue(l);return this._remoteTracks[h]});yield this._onUserUnpublish(d,"onAnchorTrackUnpublish")}if(s.length){const u=r.map(ue);for(let d=0;d<s.length;d++){const l=s[d],h=ue(l),a=u.indexOf(h);r[a].state=l.state;const c=this._remoteTracks[h];c.__innerSetRemoteMuted(l.state===0),c.isAudioTrack()?this._callAppListener("onAudioMuteChange",c):this._callAppListener("onVideoMuteChange",c)}}})}_onUserUnpublish(e,t){return H(this,void 0,void 0,function*(){yield this.unsubscribe(e),e.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(t,e)})}_callAppListener(e,...t){var r;const i=(r=this._appListener)===null||r===void 0?void 0:r[e];if(i)try{i(...t)}catch(o){M.error(o)}}_reTryExchange(){return H(this,void 0,void 0,function*(){ve(()=>H(this,void 0,void 0,function*(){var e;const{reqBody:t}=yield this._createSubscribeParams(this._subscribedList,{},!0),r=yield this._exchangeHandle(t);if(r.code!==w.SUCCESS)return M.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==w.SUCCESS)return M.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=(e=this._roomRes[d])===null||e===void 0?void 0:e.msid,h=[this._roomId,"RongCloudRTC"].join("_");i.sdp=i.sdp.replace(new RegExp(l,"g"),h)}const u=yield this._pc.setRemoteAnswer(i.sdp);return u!==w.SUCCESS?{code:u}:void 0}))})}_createSubscribeParams(e,t,r){return H(this,void 0,void 0,function*(){const i=yield this._pc.createOffer(r),o={resolutionInfo:[]},s={min:0,max:0};return Object.keys(t).forEach(u=>{const{mediaStream:d,tinyStream:l}=t[u];[d,l].forEach((h,a)=>{var c;const p=a===1?[u,"tiny"].join("_"):u;i.sdp=(c=i.sdp)===null||c===void 0?void 0:c.replace(new RegExp(h.id,"g"),p);const f=h.getVideoTracks()[0];if(!f)return;const m=a===0,{width:_,height:v,frameRate:R}=m?Go(f):Ul;o.resolutionInfo.push({trackId:f.id,simulcast:m?Ke.NORMAL:Ke.TINY,resolution:`${_}x${v}`});const y=Hc(_,v),P=jc(R);s.min+=y.minBitrate*P,s.max+=y.maxBitrate*P})}),{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map(u=>({simulcast:u.subTiny?Ke.TINY:Ke.NORMAL,resolution:"",uri:this._roomRes[u.track.getTrackId()].uri}))},dynamicBitrate:s,offer:i}})}_subscribeHandle(e,t=!1){var r;return H(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:w.ROOM_HAS_BEEN_DESTROYED};if(!me("tracks",e,()=>Ue(e)&&e.length>0&&e.every(d=>d instanceof Oe||d.track instanceof Oe),!0))return{code:w.PARAMS_ERROR};const i=this._subscribedList.map(d=>Object.assign({},d)),o=e.map(d=>d instanceof Oe?{track:d}:d);let s=!1;const u=[];return o.forEach(d=>{const l=d.track.getTrackId();u.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||t?((r=this._polarisReport)===null||r===void 0||r.sendR2(mt.SUBSCRIBE,_t.BEGIN,u),this._updateSubListHandle(i,!0)):{code:w.SUCCESS}})}_getReqHeaders(){const e=this._context.getCurrentId();return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:Le.LIVE,UserId:e,"Session-Id":this._sessionId}}_exchangeHandle(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}_updateSubListHandle(e,t=!1){var r;return H(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:w.ROOM_HAS_BEEN_DESTROYED};if(!me("resources",e,()=>Ue(e)&&e.every(R=>R instanceof Oe||R.track instanceof Oe),!0))return{code:w.PARAMS_ERROR};let i=e.map(R=>R instanceof Oe?{track:R}:Object.assign({},R));const o={};i=i.filter(R=>{const y=R.track.getTrackId();return!o[y]&&(o[y]=!0)}).map(R=>Object.assign({},R));const s=this._subscribedList.map(R=>Object.assign({},R));if(!t){let R=!1;if(i.forEach(y=>{const P=s.findIndex(L=>L.track===y.track);if(P===-1)return void(R=!0);s.splice(P,1)[0].subTiny!==y.subTiny&&(R=!0)}),s.length&&(R=!0),!R)return{code:w.SUCCESS}}this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(i.map(R=>R.track));const{reqBody:u}=yield this._createSubscribeParams(i,{},!1),d=yield this._exchangeHandle(u);if(s.length){const R=[];s.forEach(y=>{R.push(y.track.getTrackId())}),(r=this._pc.reportParser)===null||r===void 0||r.clearLatestPacketsRecv(R)}if(d.code!==w.SUCCESS)return{code:d.code};const{sdp:l,resultCode:h,message:a,subscribedList:c}=d.data;if(h!==w.SUCCESS)return M.error("change subscribe list failed:",a,h),{code:h};i.forEach(R=>{const{track:y}=R;if(y.isMCUTrack()){const P=this._roomRes[y.getTrackId()].msid,{tag:L,userId:N}=Pe(y.getTrackId()),E=[N,L].join("_");l.sdp=l.sdp.replace(new RegExp(P,"g"),E)}});const p=yield this._pc.setRemoteAnswer(l.sdp);if(p!==w.SUCCESS)return{code:p};const f=c==null?void 0:c.map(R=>`${R.msid}_${R.mediaType}`),m=i.filter(R=>{if(R.track.isMCUTrack()){const y=this._roomRes[R.track.getTrackId()],P=`${y.msid}_${y.mediaType}`;return f.includes(P)}return f==null?void 0:f.includes(R.track.getTrackId())}),_=m==null?void 0:m.map(R=>`${R.track.getTrackId()}`),v=i.filter(R=>!(_==null?void 0:_.includes(R.track.getTrackId())));for(const R in this._remoteTracks){const y=m.some(P=>P.track.getTrackId()===R);this._remoteTracks[R].__innerSetSubscribed(y)}return this._subscribedList.splice(0,this._subscribedList.length,...m),v.length?{code:w.SUCCESS,failedList:v}:{code:w.SUCCESS}})}_diffCDNUris(e){return H(this,void 0,void 0,function*(){if(this._CDNUris.url&&!e.url)return this._callAppListener("onCDNInfoDisable"),void(this._CDNUris=e);(!this._CDNUris||!this._CDNUris.url&&e.url)&&this._callAppListener("onCDNInfoEnable",{resolution:`W${e.w}_H${e.h}`,fps:`FPS_${e.fps}`});const t=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,r=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,i=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps;(t||r||i)&&this._callAppListener("onCDNInfoChange",{resolution:`W${e.w}_H${e.h}`,fps:`FPS_${e.fps}`}),this._CDNUris=e})}_getCDNPlayUrl(e){return H(this,void 0,void 0,function*(){const{w:t,h:r,fps:i}=e,o=this._initOptions.pullInnerCDNProtocol||Hi.FLV,s=this._initOptions.pullInnerCDNUseHttps===mn.NOT_HTTPS?mn.NOT_HTTPS:mn.HTTPS;if(!this._CDNUris.url)return M.error(`cdn_uris url is empty, the anchor need to open or push CDN, code: ${w.CDN_RESOURCE_IS_EMPTY}`),{code:w.CDN_RESOURCE_IS_EMPTY};const u={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},d=[];t&&d.push(`w=${t}`),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:c}=yield this._service.getCDNResourceInfo(u,h);return a!==w.SUCCESS?(M.error(`getCDNPlayUrl failed: ${a}`),{code:a}):(M.info(`getCDNPlayUrl success: ${c==null?void 0:c.data.pull_url}`),{code:a,CDNPlayUrl:c==null?void 0:c.data.pull_url})})}getCDNPlayUrl(e,t){return H(this,void 0,void 0,function*(){if(e&&!Ht(e))return M.error("`resolution` is invalid"),{code:w.PARAMS_ERROR};if(t&&!Bi(t))return M.error("`fps` is invalid"),{code:w.PARAMS_ERROR};const{width:r,height:i}=e?it(e):{width:null,height:null},o=t?ot(t):null,s={};return r&&(s.w=r),i&&(s.h=i),o&&(s.fps=o),this._getCDNPlayUrl(s)})}subscribe(e){return H(this,void 0,void 0,function*(){return ve(()=>this._subscribeHandle(e,!1))})}__unsubscribe(e){var t;return H(this,void 0,void 0,function*(){if(!me("tracks",e,()=>Ue(e)&&e.length>0&&e.every(i=>i instanceof Oe),!0))return M.error(`unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:w.PARAMS_ERROR};const r=this._subscribedList.map(i=>Object.assign({},i)).filter(i=>!e.includes(i.track));return(t=this._polarisReport)===null||t===void 0||t.sendR2(mt.SUBSCRIBE,_t.END,e.map(i=>i.getTrackId())),this._updateSubListHandle(r,!1)})}unsubscribe(e){return H(this,void 0,void 0,function*(){return ve(()=>this.__unsubscribe(e))})}__destroy(e){var t;return H(this,void 0,void 0,function*(){this._destroyed||(this._destroyed=!0,(t=this._audioLevelReport)===null||t===void 0||t.clearAudioLevelReportTimer(),e&&(yield this._context.quitLivingRoomAsAudience(this._roomId)),yield this._service.broadcastExit(this._getReqHeaders()),this._pc.destroy(),this._polarisReport=null,this._context.onrtcdatachange=()=>{})})}getRemoteTrack(e){return this._remoteTracks[e]}__getPC(){return this._pc}getLocalTrack(e){return{}}__onReconnected(){return H(this,void 0,void 0,function*(){const{code:e}=yield this._context.joinLivingRoomAsAudience(this._roomId,Le.LIVE);e!==b.SUCCESS&&M.error("join living room error when on reconnected")})}registerRoomEventListener(e){this._appListener=e}onAudioLevelChange(e,t){var r;(r=this._audioLevelReport)===null||r===void 0||r.clearAudioLevelReportTimer(),this._audioLevelReport=new zc(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}registerReportListener(e){var t;(t=this._pc)===null||t===void 0||t.registerReportListener(e)}getRoomId(){return this._roomId}getCrtUserId(){return this._context.getCurrentId()}getSessionId(){return this._sessionId}getRemoteUserIds(){return this._roomAnchorList}getRemoteTracksByUserId(e){const t=[];for(const r in this._remoteTracks){const i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}getRemoteTracks(){const e=[],t=[];for(const r in this._remoteTracks){if(t.length===2)break;const i=this._remoteTracks[r];i.isMCUTrack()&&t.push(i)}return this._roomAnchorList.forEach(r=>{e.push(...this.getRemoteTracksByUserId(r))}),[...t,...e]}getRemoteRTCTracks(){const e=[];for(const t in this._remoteTracks){const r=this._remoteTracks[t];r.isMCUTrack()||e.push(r)}return e}getRemoteMCUTracks(){const e=[];for(const t in this._remoteTracks){const r=this._remoteTracks[t];r.isMCUTrack()&&e.push(r)}return e}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 pa=(n,e)=>{const t=[];return t[0]=(e==null?void 0:e.withoutAudio)?void 0:n.getAudioTracks()[0],t[1]=(e==null?void 0:e.withoutVideo)?void 0:n.getVideoTracks()[0],t};class xl{constructor(e,t,r){this._context=e,this._runtime=t,this._options=r,this._crtRoom=null,this._audience=null,this._crtAudienceLivingRoom=null,Wt.setSdpSemantics(r.sdpSemantics||"plan-b"),this._service=new zo(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(e){var t;return e.conversationType!==ee.RTC_ROOM?!1:(this._crtRoom instanceof vt&&this._getJoinedPKRoomList().forEach(r=>{r.__parseInnerMessage(e)}),(t=this._crtRoom)===null||t===void 0||t.__parseInnerMessage(e),!0)}_getJoinedPKRoomList(){const{code:e,roomPKHandler:t}=this._crtRoom.getRoomPKHandler();if(e===w.SUCCESS&&t){const r=t.getJoinedPKRooms()||{};return Object.values(r)}return[]}getCurrentId(){return this._context.getCurrentId()}joinRTCRoom(e,t){return ve(()=>this._joinRTCRoom(e,t))}_joinRTCRoom(e,t){return H(this,void 0,void 0,function*(){if(rr(this._context.getNaviInfo()))return{code:w.PACKAGE_ENVIRONMENT_ERROR};if(!me("roomId",e,Ve,!0))return{code:w.PARAMS_ERROR};if(this._crtRoom)return{code:w.REPERT_JOIN_ROOM};if(this._context.getConnectionStatus()!==se.CONNECTED)return{code:w.SIGNAL_DISCONNECTED};if(!this._service.getNaviMS().length)return{code:w.NOT_OPEN_VIDEO_AUDIO_SERVER};M.debug(`joinRoom -> roomId: ${e}; joinType: ${t||Ei.KICK}`);const{code:r,data:i}=yield this._context.joinRTCRoom(e,Le.RTC,void 0,t);if(r!==b.SUCCESS)return M.error(`joinRoom failed -> code: ${r}`),{code:r===Ai.JOIN_REFUSED?w.SIGNAL_JOIN_RTC_ROOM_REFUSED:r};M.debug(`joinRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${e}, data: ${JSON.stringify(i)}`);const o=new kl(this._context,this._runtime,e,i,this._service,this._options,this._releaseCrtRoomObj.bind(this));return this._crtRoom=o,{room:o,code:w.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()}})}joinLivingRoom(e,t){return ve(()=>this._joinLivingRoom(e,t))}_joinLivingRoom(e,t){return H(this,void 0,void 0,function*(){if(rr(this._context.getNaviInfo()))return{code:w.PACKAGE_ENVIRONMENT_ERROR};if(!me("roomId",e,Ve,!0)||!me("livingType",t,u=>u===rt.AUDIO||u===rt.VIDEO))return{code:w.PARAMS_ERROR};if(this._crtRoom)return{code:w.REPERT_JOIN_ROOM};if(this._context.getConnectionStatus()!==se.CONNECTED)return{code:w.SIGNAL_DISCONNECTED};if(!this._service.getNaviMS().length)return{code:w.NOT_OPEN_VIDEO_AUDIO_SERVER};M.debug(`joinRoom, roomId: ${e}`);const{code:r,data:i}=yield this._context.joinRTCRoom(e,Le.LIVE,t);if(r!==b.SUCCESS)return M.error(`joinRoom failed -> code: ${r}`),{code:r};M.debug(`JoinRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${e}, data: ${JSON.stringify(i)}`);const o=new vt(this._context,this._runtime,e,i,this._service,this._options,this._releaseCrtRoomObj.bind(this),t,!1,!0);this._crtRoom=o;const s={room:o,code:w.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()};return o.__getCDNPushMode()===Ir.MANUAL&&Object.assign(s,{CDNEnable:o.__getCDNEnable()}),s})}getAudienceClient(){return this._audience||(this._audience=new Dl(this._context,this._runtime,this._options)),this._audience}_onIMStatusChange(e){M.debug(`signal server connection state change: ${e}`),e===se.CONNECTED&&(this._crtRoom instanceof vt&&this._getJoinedPKRoomList().forEach(t=>{t.__onReconnected()}),this._crtRoom&&this._crtRoom.__onReconnected())}_onIMDisconnect(){M.debug("TODO -> on IM disconnect")}_onIMUninit(){M.debug("TODO -> on IM client ondestroy")}leaveRoom(e){return ve(()=>this._leaveRoom(e))}_leaveRoom(e){return H(this,void 0,void 0,function*(){return this._crtRoom?(yield this._crtRoom.__destroy(!0),M.debug(`quitRTCRoom -> userId: ${this._context.getCurrentId()} , roomId: ${this._crtRoom.getRoomId()}`),this._crtRoom=null,{code:w.SUCCESS}):{code:w.SUCCESS}})}_releaseCrtRoomObj(){this._crtRoom=null}_getMediaStream(e,t="getUserMedia"){return H(this,void 0,void 0,function*(){try{const r=yield navigator.mediaDevices[t](e);return{code:w.SUCCESS,stream:r}}catch(r){if(r.message==="Permission denied")return{code:w.PERMISSION_DENIED};M.error(`get user media failed -> ${r.message}`)}return{code:t==="getUserMedia"?w.GET_USER_MEDIA_FAILED:w.GET_DISPLAY_MEDIA_FAILED}})}createMicrophoneAudioTrack(e="RongCloudRTC",t){return H(this,void 0,void 0,function*(){if(!dt(e))return{code:w.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:w.INVALID_USER_ID};const{stream:i,code:o}=yield this._getMediaStream({audio:{deviceId:t==null?void 0:t.micphoneId,sampleRate:t==null?void 0:t.sampleRate}});if(o!==w.SUCCESS)return{code:o};const s=i.getAudioTracks()[0];return{code:o,track:new aa(e,r,s)}})}createCameraVideoTrack(e="RongCloudRTC",t){return H(this,void 0,void 0,function*(){if(!dt(e))return{code:w.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:w.INVALID_USER_ID};const i=Ht(t==null?void 0:t.resolution)?t.resolution:ge.W640_H480,{width:o,height:s}=it(i),{stream:u,code:d}=yield this._getMediaStream({video:{deviceId:t==null?void 0:t.cameraId,frameRate:ot((t==null?void 0:t.frameRate)||Qe.FPS_15),width:o,height:s,facingMode:t==null?void 0:t.faceMode}});if(d!==w.SUCCESS)return{code:d};const l=u.getVideoTracks()[0];return{code:d,track:new ca(e,r,l)}})}createMicrophoneAndCameraTracks(e="RongCloudRTC",t){var r,i,o,s,u,d;return H(this,void 0,void 0,function*(){const l=[];if(!dt(e))return{code:w.INVALID_TAGS,tracks:l};const h=this._context.getCurrentId();if(!h)return{code:w.INVALID_USER_ID,tracks:l};const a=Ht((r=t==null?void 0:t.video)===null||r===void 0?void 0:r.resolution)?t.video.resolution:ge.W640_H480,{width:c,height:p}=it(a),{stream:f,code:m}=yield this._getMediaStream({video:{deviceId:(i=t==null?void 0:t.video)===null||i===void 0?void 0:i.cameraId,frameRate:ot(((o=t==null?void 0:t.video)===null||o===void 0?void 0:o.frameRate)||Qe.FPS_15),width:c,height:p,facingMode:(s=t==null?void 0:t.video)===null||s===void 0?void 0:s.faceMode},audio:{deviceId:(u=t==null?void 0:t.audio)===null||u===void 0?void 0:u.micphoneId,sampleRate:(d=t==null?void 0:t.audio)===null||d===void 0?void 0:d.sampleRate}});return m!==w.SUCCESS||f.getTracks().forEach(_=>{_.kind==="video"?l.push(new ca(e,h,_)):l.unshift(new aa(e,h,_))}),{code:m,tracks:l}})}createScreenVideoTrack(e="screenshare",t){return H(this,void 0,void 0,function*(){if(!dt(e))return{code:w.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:w.INVALID_USER_ID};if(!qc())return{code:w.BROWSER_NOT_SUPPORT};const i=/Electron/.test(navigator.userAgent);if(i&&!(t==null?void 0:t.chromeMediaSourceId))return{code:w.PARAMS_ERROR};const o=Ht(t==null?void 0:t.resolution)?t.resolution:ge.W1280_H720,{width:s,height:u}=it(o),d=i?{mandatory:{chromeMediaSourceId:t.chromeMediaSourceId,chromeMediaSource:"desktop",minWidth:s,maxWidth:s,minHeight:u,maxHeight:u}}:{frameRate:ot((t==null?void 0:t.frameRate)||Qe.FPS_15),width:s,height:u},{stream:l,code:h}=yield this._getMediaStream({video:d,audio:!1},i?"getUserMedia":"getDisplayMedia");if(h!==w.SUCCESS)return{code:h};const a=l.getVideoTracks()[0];return{code:h,track:new El(e,r,a)}})}createLocalAudioTrack(e,t){return H(this,void 0,void 0,function*(){if(!dt(e))return{code:w.INVALID_TAGS};if(!t||t.toString()!=="[object MediaStreamTrack]"||t.kind!=="audio")return{code:w.CREATE_CUSTOM_TRACK_FAILED};const r=this._context.getCurrentId();return r?{code:w.SUCCESS,track:new Vi(e,r,t)}:{code:w.INVALID_USER_ID}})}createLocalVideoTrack(e,t){return H(this,void 0,void 0,function*(){if(!dt(e))return{code:w.INVALID_TAGS};if(!t||t.toString()!=="[object MediaStreamTrack]"||t.kind!=="video")return{code:w.CREATE_CUSTOM_TRACK_FAILED};const r=this._context.getCurrentId();return r?{code:w.SUCCESS,track:new qt(e,r,t)}:{code:w.INVALID_USER_ID}})}createLocalFileTracks(e,t,r){return H(this,void 0,void 0,function*(){if(!dt(e))return{code:w.INVALID_TAGS,tracks:[]};if(!Kc())return{code:w.BROWSER_NOT_SUPPORT,tracks:[]};const i=t instanceof File?URL.createObjectURL(t):t;if(!vn(i)&&!/^blob:/.test(i))return M.warn(`createLocalFileTracks failed: params error -> url: ${i}`),{code:w.PARAMS_ERROR,tracks:[]};const o=this._context.getCurrentId();return o?new Promise(s=>{const u=document.createElement("video");(r==null?void 0:r.withoutAudio)&&(u.muted=!0),u.onloadedmetadata=()=>{const d=[];let l;try{const c=u.mozCaptureStream?"mozCaptureStream":"captureStream";l=u[c]()}catch(c){M.error(`create RCLocalFileTrack failed, captureSteam error. -> url: ${i}`),M.error(c),s({code:w.CREATE_FILE_TRACK_FAILED,tracks:d})}const[h,a]=pa(l,r);h&&d.push(new yl(e,o,h,u)),a&&d.push(new Cl(e,o,a,u)),d.length===0&&(u.pause(),u.src=""),u.onerror=null,s({code:w.SUCCESS,tracks:d})},u.onerror=()=>{M.error(`create RCLocalFileTrack failed -> url: ${i}`),s({code:w.CREATE_FILE_TRACK_FAILED,tracks:[]})},u.src=i,u.loop=!0,u.play()}):{code:w.INVALID_USER_ID,tracks:[]}})}createLocalTracks(e,t,r){return H(this,void 0,void 0,function*(){const i=[];if(!dt(e))return{code:w.INVALID_TAGS,tracks:i};if(!(t instanceof MediaStream))return{code:w.PARAMS_ERROR,tracks:i};const o=this._context.getCurrentId();if(!o)return{code:w.INVALID_USER_ID,tracks:i};const[s,u]=pa(t,r);return s&&i.push(new Vi(e,o,s)),u&&i.push(new qt(e,o,u)),{code:w.SUCCESS,tracks:i}})}joinLivingRoomAsAudience(e,t){return H(this,void 0,void 0,function*(){if(rr(this._context.getNaviInfo()))return{code:w.PACKAGE_ENVIRONMENT_ERROR};if(!me("roomId",e,Ve,!0)||!me("livingType",t,s=>s===rt.AUDIO||s===rt.VIDEO))return{code:w.PARAMS_ERROR};if(this._crtAudienceLivingRoom)return{code:w.REPERT_JOIN_ROOM};if(!this._service.getNaviMS().length)return{code:w.NOT_OPEN_VIDEO_AUDIO_SERVER};const{code:r,data:i}=yield this._context.joinLivingRoomAsAudience(e,Le.LIVE,t);if(r!==b.SUCCESS)return M.error("audienceJoinLivingRoomError:",r),{code:w.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED};M.info(`joinLivingRoomAsAudience success, room data: ${JSON.stringify(i)}`);const o=new ha(this._context,this._runtime,this._options,e,i,t);return this._crtAudienceLivingRoom=o,{room:o,code:w.SUCCESS,userIds:o.getRemoteUserIds(),RTCTracks:o.getRemoteRTCTracks(),MCUTracks:o.getRemoteMCUTracks(),CDNUris:o.getCDNInfo()}})}leaveLivingRoomAsAudience(e){return H(this,void 0,void 0,function*(){return this._crtAudienceLivingRoom?this._crtAudienceLivingRoom!==e?{code:w.PARAMS_ERROR}:(yield this._crtAudienceLivingRoom.__destroy(!0),this._crtAudienceLivingRoom=null,{code:w.SUCCESS}):{code:w.SUCCESS}})}upgradeToAnchorRoom(e){return H(this,void 0,void 0,function*(){if(!me("room._roomId",e._roomId,Ve,!0))return{code:w.PARAMS_ERROR};if(this._crtRoom)return{code:w.REPERT_JOIN_ROOM};const{code:t,data:r}=yield this._context.rtcIdentityChange(e._roomId,ar.ViewerToAnchor,e._livingType);if(t!==b.SUCCESS)return M.error("change room identity error",t),{code:w.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED};yield this._crtAudienceLivingRoom.__destroy(!1);const i=new vt(this._context,this._runtime,e._roomId,r,this._service,this._options,this._releaseCrtRoomObj.bind(this),e._livingType,!0,!0);return this._crtRoom=i,this._crtAudienceLivingRoom=null,{room:i,code:w.SUCCESS,userIds:e.getRemoteUserIds(),tracks:i.getRemoteTracks()}})}downgradeToAudienceRoom(e){return H(this,void 0,void 0,function*(){if(!me("room._roomId",e._roomId,Ve,!0))return{code:w.PARAMS_ERROR};if(this._crtAudienceLivingRoom)return{code:w.REPERT_JOIN_ROOM};const{code:t,data:r}=yield this._context.rtcIdentityChange(e._roomId,ar.AnchorToViewer,e.getLivingType());if(t!==b.SUCCESS)return M.error("change room identity error",t),{code:w.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED};M.info(`downgradeToAudienceRoom success, room data: ${JSON.stringify(r)}`);const i=new ha(this._context,this._runtime,this._options,e._roomId,r,e.getLivingType());return this._crtAudienceLivingRoom=i,this._crtRoom.__destroy(!1),this._crtRoom=null,{room:i,code:w.SUCCESS,userIds:i.getRemoteUserIds(),RTCTracks:i.getRemoteRTCTracks(),MCUTracks:i.getRemoteMCUTracks(),CDNUris:i.getCDNInfo()}})}getJoinedRoomInfo(){return H(this,void 0,void 0,function*(){const{code:e,data:t}=yield this._context.getRTCJoinedUserInfo(this._context.getCurrentId());return e!==b.SUCCESS?(M.error("getJoinedUserInfo error",e),{code:w.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}):{code:w.SUCCESS,data:t}})}}var fa;(function(n){n[n.SERVER_KICK=1]="SERVER_KICK",n[n.OTHER_KICK=2]="OTHER_KICK"})(fa||(fa={}));const Vl={tag:"RCRTC",verify:n=>n.tag!=="browser"?(M.error(`RCRTC Plugin is not support the runtime '${n.tag}'`),!1):Tl?(Ot.add("plugin-rtc","5.3.1"),!!Ot.validEngine("5.1.0")||(M.error(`The current engine version '${Ot.getInfo().engine}' error, plugin-rtc required engine version at least '5.1.0'.`),!1)):(M.error("Please use the https protocol or use `http://localhost` to open the page!"),!1),setup:(n,e,t={})=>(M.setLogLevel(t.logLevel),M.setLogStdout(t.logStdout),M.warn("RCRTC Version: 5.3.1, Commit: e1af0f5ccb06a0084c94e1219d8af54c9793c06b"),M.warn(`browserInfo.browser -> ${Ge.browser}`),M.warn(`browserInfo.supportsUnifiedPlan -> ${Ge.supportsUnifiedPlan}`),M.warn(`browserInfo.version -> ${Ge.version}`),Ie("options.mediaServer",t.mediaServer,r=>!(!vn(r)||location.protocol==="https:"&&!/^https/.test(r))),Ie("options.timeout",t.timeout,r=>_e(r)&&r>=5e3&&r<=3e4),Ie("options.pingGap",t.pingGap,r=>_e(r)&&r>=3e3&&r<=1e4),new xl(n,e,t))},Bl={transResolution:it,transFrameRate:ot,parseTrackId:Pe,ifSupportLocalFileTrack:Kc,ifSupportScreenShare:qc};function Fl(n,e,t){var r=t||{},i=r.noTrailing,o=i===void 0?!1:i,s=r.noLeading,u=s===void 0?!1:s,d=r.debounceMode,l=d===void 0?void 0:d,h,a=!1,c=0;function p(){h&&clearTimeout(h)}function f(_){var v=_||{},R=v.upcomingOnly,y=R===void 0?!1:R;p(),a=!y}function m(){for(var _=arguments.length,v=new Array(_),R=0;R<_;R++)v[R]=arguments[R];var y=this,P=Date.now()-c;if(a)return;function L(){c=Date.now(),e.apply(y,v)}function N(){h=void 0}!u&&l&&!h&&L(),p(),l===void 0&&P>n?u?(c=Date.now(),o||(h=setTimeout(l?N:L,n))):L():o!==!0&&(h=setTimeout(l?N:L,l===void 0?n-P:n))}return m.cancel=f,m}function $l(n,e,t){var r=t||{},i=r.atBegin,o=i===void 0?!1:i;return Fl(n,e,{debounceMode:o!==!1})}const Ye=_a({user:null});function Zc(n){return{all:n=n||new Map,on:function(e,t){var r=n.get(e);r?r.push(t):n.set(e,[t])},off:function(e,t){var r=n.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):n.set(e,[]))},emit:function(e,t){var r=n.get(e);r&&r.slice().map(function(i){i(t)}),(r=n.get("*"))&&r.slice().map(function(i){i(e,t)})}}}const ga={"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 Qc=Zc(),Xc={exports:{}};(function(n,e){(function(t,r){n.exports=r()})(mu,function(){var t=1e3,r=6e4,i=36e5,o="millisecond",s="second",u="minute",d="hour",l="day",h="week",a="month",c="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,R={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(S,O,I){var U=String(S);return!U||U.length>=O?S:""+Array(O+1-U.length).join(I)+S},P={s:y,z:function(S){var O=-S.utcOffset(),I=Math.abs(O),U=Math.floor(I/60),D=I%60;return(O<=0?"+":"-")+y(U,2,"0")+":"+y(D,2,"0")},m:function S(O,I){if(O.date()<I.date())return-S(I,O);var U=12*(I.year()-O.year())+(I.month()-O.month()),D=O.clone().add(U,a),$=I-D<0,j=O.clone().add(U+($?-1:1),a);return+(-(U+(I-D)/($?D-j:j-D))||0)},a:function(S){return S<0?Math.ceil(S)||0:Math.floor(S)},p:function(S){return{M:a,y:p,w:h,d:l,D:f,h:d,m:u,s,ms:o,Q:c}[S]||String(S||"").toLowerCase().replace(/s$/,"")},u:function(S){return S===void 0}},L="en",N={};N[L]=R;var E=function(S){return S instanceof C},A=function(S,O,I){var U;if(!S)return L;if(typeof S=="string")N[S]&&(U=S),O&&(N[S]=O,U=S);else{var D=S.name;N[D]=S,U=D}return!I&&U&&(L=U),U||!I&&L},F=function(S,O){if(E(S))return S.clone();var I=typeof O=="object"?O:{};return I.date=S,I.args=arguments,new C(I)},q=P;q.l=A,q.i=E,q.w=function(S,O){return F(S,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var C=function(){function S(I){this.$L=A(I.locale,null,!0),this.parse(I)}var O=S.prototype;return O.parse=function(I){this.$d=function(U){var D=U.date,$=U.utc;if(D===null)return new Date(NaN);if(q.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var j=D.match(_);if(j){var J=j[2]-1||0,re=(j[7]||"0").substring(0,3);return $?new Date(Date.UTC(j[1],J,j[3]||1,j[4]||0,j[5]||0,j[6]||0,re)):new Date(j[1],J,j[3]||1,j[4]||0,j[5]||0,j[6]||0,re)}}return new Date(D)}(I),this.$x=I.x||{},this.init()},O.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},O.$utils=function(){return q},O.isValid=function(){return this.$d.toString()!==m},O.isSame=function(I,U){var D=F(I);return this.startOf(U)<=D&&D<=this.endOf(U)},O.isAfter=function(I,U){return F(I)<this.startOf(U)},O.isBefore=function(I,U){return this.endOf(U)<F(I)},O.$g=function(I,U,D){return q.u(I)?this[U]:this.set(D,I)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(I,U){var D=this,$=!!q.u(U)||U,j=q.p(I),J=function(ie,oe){var ce=q.w(D.$u?Date.UTC(D.$y,oe,ie):new Date(D.$y,oe,ie),D);return $?ce:ce.endOf(l)},re=function(ie,oe){return q.w(D.toDate()[ie].apply(D.toDate("s"),($?[0,0,0,0]:[23,59,59,999]).slice(oe)),D)},X=this.$W,W=this.$M,Z=this.$D,k="set"+(this.$u?"UTC":"");switch(j){case p:return $?J(1,0):J(31,11);case a:return $?J(1,W):J(0,W+1);case h:var z=this.$locale().weekStart||0,Q=(X<z?X+7:X)-z;return J($?Z-Q:Z+(6-Q),W);case l:case f:return re(k+"Hours",0);case d:return re(k+"Minutes",1);case u:return re(k+"Seconds",2);case s:return re(k+"Milliseconds",3);default:return this.clone()}},O.endOf=function(I){return this.startOf(I,!1)},O.$set=function(I,U){var D,$=q.p(I),j="set"+(this.$u?"UTC":""),J=(D={},D[l]=j+"Date",D[f]=j+"Date",D[a]=j+"Month",D[p]=j+"FullYear",D[d]=j+"Hours",D[u]=j+"Minutes",D[s]=j+"Seconds",D[o]=j+"Milliseconds",D)[$],re=$===l?this.$D+(U-this.$W):U;if($===a||$===p){var X=this.clone().set(f,1);X.$d[J](re),X.init(),this.$d=X.set(f,Math.min(this.$D,X.daysInMonth())).$d}else J&&this.$d[J](re);return this.init(),this},O.set=function(I,U){return this.clone().$set(I,U)},O.get=function(I){return this[q.p(I)]()},O.add=function(I,U){var D,$=this;I=Number(I);var j=q.p(U),J=function(W){var Z=F($);return q.w(Z.date(Z.date()+Math.round(W*I)),$)};if(j===a)return this.set(a,this.$M+I);if(j===p)return this.set(p,this.$y+I);if(j===l)return J(1);if(j===h)return J(7);var re=(D={},D[u]=r,D[d]=i,D[s]=t,D)[j]||1,X=this.$d.getTime()+I*re;return q.w(X,this)},O.subtract=function(I,U){return this.add(-1*I,U)},O.format=function(I){var U=this,D=this.$locale();if(!this.isValid())return D.invalidDate||m;var $=I||"YYYY-MM-DDTHH:mm:ssZ",j=q.z(this),J=this.$H,re=this.$m,X=this.$M,W=D.weekdays,Z=D.months,k=function(oe,ce,ut,Je){return oe&&(oe[ce]||oe(U,$))||ut[ce].substr(0,Je)},z=function(oe){return q.s(J%12||12,oe,"0")},Q=D.meridiem||function(oe,ce,ut){var Je=oe<12?"AM":"PM";return ut?Je.toLowerCase():Je},ie={YY:String(this.$y).slice(-2),YYYY:this.$y,M:X+1,MM:q.s(X+1,2,"0"),MMM:k(D.monthsShort,X,Z,3),MMMM:k(Z,X),D:this.$D,DD:q.s(this.$D,2,"0"),d:String(this.$W),dd:k(D.weekdaysMin,this.$W,W,2),ddd:k(D.weekdaysShort,this.$W,W,3),dddd:W[this.$W],H:String(J),HH:q.s(J,2,"0"),h:z(1),hh:z(2),a:Q(J,re,!0),A:Q(J,re,!1),m:String(re),mm:q.s(re,2,"0"),s:String(this.$s),ss:q.s(this.$s,2,"0"),SSS:q.s(this.$ms,3,"0"),Z:j};return $.replace(v,function(oe,ce){return ce||ie[oe]||j.replace(":","")})},O.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},O.diff=function(I,U,D){var $,j=q.p(U),J=F(I),re=(J.utcOffset()-this.utcOffset())*r,X=this-J,W=q.m(this,J);return W=($={},$[p]=W/12,$[a]=W,$[c]=W/3,$[h]=(X-re)/6048e5,$[l]=(X-re)/864e5,$[d]=X/i,$[u]=X/r,$[s]=X/t,$)[j]||X,D?W:q.a(W)},O.daysInMonth=function(){return this.endOf(a).$D},O.$locale=function(){return N[this.$L]},O.locale=function(I,U){if(!I)return this.$L;var D=this.clone(),$=A(I,U,!0);return $&&(D.$L=$),D},O.clone=function(){return q.w(this.$d,this)},O.toDate=function(){return new Date(this.valueOf())},O.toJSON=function(){return this.isValid()?this.toISOString():null},O.toISOString=function(){return this.$d.toISOString()},O.toString=function(){return this.$d.toUTCString()},S}(),T=C.prototype;return F.prototype=T,[["$ms",o],["$s",s],["$m",u],["$H",d],["$W",l],["$M",a],["$y",p],["$D",f]].forEach(function(S){T[S[1]]=function(O){return this.$g(O,S[0],S[1])}}),F.extend=function(S,O){return S.$i||(S(O,C,F),S.$i=!0),F},F.locale=A,F.isDayjs=E,F.unix=function(S){return F(1e3*S)},F.en=N[L],F.Ls=N,F.p={},F})})(Xc);var Hl=Xc.exports;let ci=!1;const eu="start-live-time",tu="start-live-status",jl="video-deviceId",Kl="audio-deviceId",Rh="audio-deviceId2",ql="audio-device-volume",K=_a({roomUid:sessionStorage.getItem("roomUid")||"",imConnectStatus:"connecting",screenShareStatus:!1,videoRef:_u(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}),Gl="6tnym1br6pv07";Yd({appkey:Gl});const Yl=ct("RC:Chatroom:SeatsCtrl",!0,!0),zl=ct("RC:Chatroom:ChatBan",!0,!0),Jl=ct("RC:Chatroom:SeatApply",!0,!0),Wl=ct("RC:Chatroom:SeatResponse",!0,!0),Zl=ct("RC:Chatroom:MemberCount",!0,!0),Ql=ct("RC:Chatroom:SeatMember",!0,!0),Xl=ct("RC:Chatroom:LikeCount",!0,!0),eh=ct("RC:Chatroom:Welcome",!0,!0),th=ct("RC:Chatroom:PauseLive",!0,!0),nh=Zc(),Ln=Ce,Xo=Ln,{MESSAGES:Ch}=Xo,rh=Qo(Xo,["MESSAGES"]);An(Ln.MESSAGES,n=>{var t;console.log(n,"\u6536\u5230\u6D88\u606F");const{messages:e}=n;for(const r of e)!(r.senderUserId&&Number(r.senderUserId)===((t=Ye.user)==null?void 0:t.speakerId))&&ga[r.messageType]&&Qc.emit(ga[r.messageType],At(Xe({},r.content),{$EventMessage:r}))});for(const n of Object.values(rh))An(n,e=>{console.log(n,e),Qc.emit(n,{$EventMessage:null})});An(Ln.CONNECTING,()=>{console.log("connecting"),K.imConnectStatus="connecting"});An(Ln.CONNECTED,()=>{console.log("connected"),K.imConnectStatus="connected"});An(Ln.DISCONNECT,()=>{console.log("disconnect"),K.imConnectStatus="disconnect",nu(!0,"IM");const n=Ct.parse(window.location.search);console.log(n,"disconnect"),window.location.href=window.location.origin+"/live?"+Ct.stringify(At(Xe({},n),{time:new Date().getTime()}))});const yh=async n=>{var e;try{const t=await Jd(n);return K.rtcClient=zd(Vl,{}),console.log("connect success",(e=t.data)==null?void 0:e.userId),t}catch(t){throw t}},Eh=n=>{localStorage.setItem(ql,n.toString()),K.videoRef&&(K.videoRef.volume=n/100),K.activeTracks.microphone._element&&(K.activeTracks.microphone._element.volume=n/100)},ih=async()=>{var n;if(K.screenShareStatus){ht.error("\u6B63\u5728\u5C4F\u5E55\u5171\u4EAB\u4E2D\uFF0C\u8BF7\u5148\u5173\u95ED\u5C4F\u5E55\u5171\u4EAB");return}if(K.rtcClient&&!K.screenShareStatus&&K.videoStatus==="liveing"){let e;try{e=await $r("screen")}catch{ht.error("\u5C4F\u5E55\u5206\u4EAB\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6388\u6743")}if(!e)return;const t=K.activeTracks.camera;t&&await((n=K.joinedRoom)==null?void 0:n.unpublish([t])),yt([e],"screen"),K.videoRef&&(e==null||e.play(K.videoRef),K.screenShareStatus=!0),e==null||e.on(de.EVENT_LOCAL_TRACK_END,r=>{K.screenShareStatus=!1,r.destroy(),t&&(yt([t],"camera"),K.videoRef&&t.play(K.videoRef))})}},oh=()=>{document.exitPictureInPicture();const n=K.activeTracks.screen;n&&(n.destroy(),K.screenShareStatus=!1);const e=K.activeTracks.camera;e&&(yt([e],"camera"),K.videoRef&&e.play(K.videoRef))},sh=n=>{const e=document.createElement("video");e.style.display="none",document.body.append(e),e.srcObject=n,e.play(),setTimeout(()=>{e.requestPictureInPicture()},1e3)},ah=async()=>{if(K.screenShareStatus)try{await va.confirm("\u662F\u5426\u786E\u8BA4\u53D6\u6D88\u5C4F\u5E55\u5171\u4EAB?"),oh()}catch{}else ih(),sh(K.activeTracks.camera._msStream),console.log(K.activeTracks.camera)},Th=async()=>{const n=await Ko.getMicrophones();return K.microphones=n,n},Sh=async()=>{const n=await Ko.getCameras();return K.cameras=n,n},Ih=async n=>{K.selectedCamera=n,localStorage.setItem(jl,n.deviceId);const e=K.activeTracks.camera;e&&await Hr([e],"camera",e.isPublished());const t=await $r("camera");yt([t],"camera",K.videoStatus==="liveing")},bh=async n=>{K.selectedMicrophone=n,localStorage.setItem(Kl,n.deviceId);const e=K.activeTracks.microphone;e&&await Hr([e],"microphone",e.isPublished());const t=await $r("microphone");yt([t],"microphone",K.videoStatus==="liveing"),nh.emit("microphoneChange",n)},$r=async n=>{var r,i,o,s,u,d,l;let e,t=null;if(n==="microphone"?e=await((i=K.rtcClient)==null?void 0:i.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:(r=K.selectedMicrophone)==null?void 0:r.deviceId,sampleRate:Number(localStorage.getItem("sampleRate")||"44100")||44100})):n==="microphone2"?e=await((s=K.rtcClient)==null?void 0:s.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:(o=K.selectedMicrophone2)==null?void 0:o.deviceId})):n==="camera"?e=await((d=K.rtcClient)==null?void 0:d.createCameraVideoTrack("RongCloudRTC",{cameraId:(u=K.selectedCamera)==null?void 0:u.deviceId,faceMode:"user",frameRate:Qe.FPS_30,resolution:ge.W1920_H1080})):e=await((l=K==null?void 0:K.rtcClient)==null?void 0:l.createScreenVideoTrack("screenshare",{frameRate:Qe.FPS_30,resolution:ge.W1920_H1080})),t=e==null?void 0:e.track,(n==="camera"&&!K.cameras.length||(n==="microphone"||n==="microphone2")&&!K.microphones.length||n==="screen"&&!K.screenShareStatus)&&(K.deviceStatus[n]="none"),e.code===w.PERMISSION_DENIED?K.deviceStatus[n]="denied":K.deviceStatus[n]="granted",e.code===w.GET_DISPLAY_MEDIA_FAILED)throw new Error("\u83B7\u53D6\u5C4F\u5E55\u5171\u4EAB\u5931\u8D25");return t},Oh=(n,e)=>{const t=window.AudioContext,r=new t,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=u=>$l(200,()=>{var a;const d=u.inputBuffer.getChannelData(0);for(var l=0,h=0;h<d.length;h++)l<d[h]&&(l=d[h]);e(l*100,(a=n.getAudioTracks()[0])==null?void 0:a.label)})(),s},yt=async(n,e,t=!0)=>{var i,o;const r=n.filter(s=>!!s);for(const s of r)K.activeTracks[e]=s;if(e==="camera"&&K.videoRef&&((i=K.activeTracks[e])==null||i.play(K.videoRef)),t)try{const s=await((o=K.joinedRoom)==null?void 0:o.publish(n.filter(u=>!!u)));console.log(s,"pub"),(s==null?void 0:s.code)!==w.SUCCESS&&!ci&&(ci=!0,window.onbeforeunload=null,va.alert("\u89C6\u9891\u63A8\u6D41\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u65B0\u5F00\u542F?","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",callback:()=>{ci=!1,window.location.reload()}}))}catch(s){console.log(s,"err")}},Hr=async(n,e,t=!0)=>{var i;const r=n.filter(o=>!!o);t&&await((i=K.joinedRoom)==null?void 0:i.unpublish(r));for(const o of r)o==null||o.destroy(),K.activeTracks[e]=null},ch=async(n,e,t)=>{var i,o;await Zd(n,{count:-1});const r=await((i=K.rtcClient)==null?void 0:i.joinLivingRoom(n,e));if((r==null?void 0:r.code)!=w.SUCCESS)throw Error("\u52A0\u5165\u623F\u95F4\u5931\u8D25");return(o=r.room)==null||o.registerRoomEventListener(t),r},Nh=async(n,e,t)=>await ch(n,e,t),wh=async(n=!0)=>{var t;if(K.videoStatus!=="stream"){const r="\u8BF7\u786E\u5B9A\u6444\u50CF\u5934\u5DF2\u7ECF\u5F00\u542F";throw ht.error(r),Error(r)}K.joinedRoom&&(await yt([K.activeTracks.camera],"camera"),await yt([K.activeTracks.microphone],"microphone"),await Zt.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"1",roomUid:K.roomUid,userId:(t=Ye.user)==null?void 0:t.speakerId}}),K.videoStatus="liveing"),n&&sessionStorage.setItem(eu,Hl().valueOf().toString()),sessionStorage.setItem(tu,"liveing")},nu=async(n=!1,e="Logout")=>{var t,r;try{e==="Logout"&&await Zt.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"2",roomUid:K.roomUid,userId:(t=Ye.user)==null?void 0:t.speakerId}})}catch{}sessionStorage.removeItem(eu),sessionStorage.removeItem(tu);for(const i in K.activeTracks)if(Object.prototype.hasOwnProperty.call(K.activeTracks,i)){const o=K.activeTracks[i];o&&(await((r=K.joinedRoom)==null?void 0:r.unpublish([o])),n&&await Hr([o],i))}K.videoStatus="stream"},uh=async()=>{if(Ye.user)try{await Zt.get("/api-web/imLiveBroadcastRoom/syncLike",{hideLoading:!0,hideMessage:!0,params:{likeNum:K.likeCount,roomUid:K.roomUid}}),K.lastLikeCount=K.likeCount,lh({count:K.likeCount},"LikeCount")}catch{}K.syncLikeTimer=setTimeout(()=>{uh()},1e3*10)},dh=()=>{var n,e,t,r;return{id:String((n=Ye.user)==null?void 0:n.speakerId),name:(e=Ye.user)==null?void 0:e.speakerName,userId:String((t=Ye.user)==null?void 0:t.speakerId),userName:(r=Ye.user)==null?void 0:r.speakerName}},lh=async(n,e="text")=>{var i;let t=null;if(!n)return;const r={conversationType:ee.CHATROOM,targetId:(i=K.joinedRoom)==null?void 0:i._roomId};if(e==="text"?t=new tl({user:dh(),content:n}):e==="SeatsCtrl"?t=new Yl(n):e==="ChatBan"?t=new zl(n):e==="SeatApply"?t=new Jl(n):e==="SeatResponse"?t=new Wl(n):e==="MemberCount"?t=new Zl(n):e==="SeatMember"?t=new Ql(n):e==="LikeCount"?t=new Xl(n):e==="Welcome"?t=new eh(n):e==="PauseLive"&&(t=new th(n)),!!t)return console.log(t),await sc(r,t)},hh=async(n,e=!0)=>{var t;if((n==="microphone"||n==="microphone2")&&K.activeTracks[n])(t=K.activeTracks[n])==null||t.unmute();else{const r=await $r(n);await yt([r],n,e),K.videoRef&&(r==null||r.play(K.videoRef))}},ji=async(n,e=!0)=>{const t=K.activeTracks[n];n!=="microphone"&&n!=="microphone2"?await Hr([t],n,e):t==null||t.mute()},Mh=async n=>{if(K.screenShareStatus){await ah();return}const e=K.activeTracks[n],t=K.videoStatus==="liveing";e?(n==="camera"&&(K.deviceStatus.camera="closed"),ji(n,t)):(n==="camera"&&(K.deviceStatus.camera="granted"),hh(n,t))},ph=async(n="Logout")=>{var e;await nu(!0,n),K.joinedRoom&&(await((e=K.rtcClient)==null?void 0:e.leaveRoom(K.joinedRoom)),K.joinedRoom=null,await Wd(),K.imConnectStatus="disconnect")},Zt=vu({requestType:"form",timeout:1e4});Zt.interceptors.request.use((n,e)=>{e.hideLoading||!1||wu();const r=Ra(),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:At(Xe({},e),{params:Ru(e.params),headers:Xe(Xe({},e.headers),s)})}});Zt.interceptors.response.use(async(n,e)=>{setTimeout(()=>{Mu()},200);let t=e.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 t||ht.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){t||ht.error("\u767B\u5F55\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\uFF01");try{await ph("IM"),ji("camera"),ji("microphone"),Ye.user=null}catch{}K.syncLikeTimer&&clearTimeout(K.syncLikeTimer),Ca();const o=Ct.parse(window.location.search);console.log(o,"disconnect"),window.location.href=window.location.origin+"/live?"+Ct.stringify(At(Xe({},o),{time:new Date().getTime()}))}throw r.code===404&&(t||ht.error("\u8BF7\u6C42\u8D44\u6E90\u4E0D\u5B58\u5728\uFF01"),br.push("/404")),r.code===403||r.code===401||t||ht.error(i),new Error(i)}return n});const fh=["/login"];br.beforeEach(async(n,e,t)=>{var i;if(Ra())if(n.path==="/login")t({path:"/"});else if((i=Ye.user)==null?void 0:i.speakerId)t();else try{const s=sessionStorage.getItem("roomUid"),u=await Zt.get("/api-web/imLiveBroadcastRoom/speakerJoinRoom",{params:{roomUid:s}});Ye.user=u.data,t(At(Xe({},n),{replace:!0}))}catch(s){s.msg&&ht.error(s.msg),Ca(),t(`/login?${Ct.stringify(n.query)}`)}else fh.indexOf(n.path)!==-1?t():t(`/login?${Ct.stringify(n.query)}`)});br.afterEach(()=>{});Cu(Eu).use(Nu).use(br).mount("#app");export{Kl as A,Nh as B,rt as C,yt as D,ql as E,dh as F,vh as G,ga as L,Ou as S,w as T,jl as V,mh as __vite_legacy_guard,K as a,Ca as b,ji as c,wh as d,Qc as e,nu as f,lh as g,nh as h,Oh as i,Eh as j,Ih as k,ph as l,bh as m,eu as n,hh as o,Hl as p,uh as q,Zt as r,Ye as s,Mh as t,Rh as u,tu as v,yh as w,Th as x,Sh as y,$r as z};
|